|
@@ -17,9 +17,11 @@
|
|
|
package org.springblade.bank.keypwd.controller;
|
|
package org.springblade.bank.keypwd.controller;
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -40,6 +42,7 @@ import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.modules.desk.entity.Notice;
|
|
import org.springblade.modules.desk.entity.Notice;
|
|
|
import org.springblade.modules.desk.service.INoticeService;
|
|
import org.springblade.modules.desk.service.INoticeService;
|
|
|
import org.springblade.modules.system.entity.Dept;
|
|
import org.springblade.modules.system.entity.Dept;
|
|
@@ -52,6 +55,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 網點鎖匙/密碼登記表 控制器
|
|
* 網點鎖匙/密碼登記表 控制器
|
|
@@ -102,6 +106,11 @@ public class KeyPwdController extends BladeController {
|
|
|
@ApiOperationSupport(order = 3)
|
|
@ApiOperationSupport(order = 3)
|
|
|
@ApiOperation(value = "分页", notes = "传入keyPwd")
|
|
@ApiOperation(value = "分页", notes = "传入keyPwd")
|
|
|
public R<IPage<KeyPwdVO>> page(KeyPwdVO keyPwd, Query query) {
|
|
public R<IPage<KeyPwdVO>> page(KeyPwdVO keyPwd, Query query) {
|
|
|
|
|
+ Long deptId = Long.valueOf(AuthUtil.getDeptId());
|
|
|
|
|
+ List<Long> deptChildIds = deptService.getDeptChildIds(deptId);
|
|
|
|
|
+ deptChildIds.add(deptId);
|
|
|
|
|
+ keyPwd.setDeptIdList(deptChildIds);
|
|
|
|
|
+ keyPwd.setCurrentuserId(AuthUtil.getUserId());
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(keyPwd.getCategory())){
|
|
if (StringUtils.isNotBlank(keyPwd.getCategory())){
|
|
|
List<String> categorys = Func.toStrList(keyPwd.getCategory());
|
|
List<String> categorys = Func.toStrList(keyPwd.getCategory());
|
|
@@ -122,7 +131,12 @@ public class KeyPwdController extends BladeController {
|
|
|
@GetMapping("/getKeepList")
|
|
@GetMapping("/getKeepList")
|
|
|
@ApiOperationSupport(order = 3)
|
|
@ApiOperationSupport(order = 3)
|
|
|
@ApiOperation(value = "分页", notes = "传入keyPwd")
|
|
@ApiOperation(value = "分页", notes = "传入keyPwd")
|
|
|
- public R<IPage<KeyPwdVO>> getKeepList(KeyPwdVO keyPwd, Query query) {
|
|
|
|
|
|
|
+ public R<List<KeyPwd>> getKeepList(KeyPwdVO keyPwd) {
|
|
|
|
|
+ Long deptId = Long.valueOf(AuthUtil.getDeptId());
|
|
|
|
|
+ List<Long> deptChildIds = deptService.getDeptChildIds(deptId);
|
|
|
|
|
+ deptChildIds.add(deptId);
|
|
|
|
|
+ keyPwd.setDeptIdList(deptChildIds);
|
|
|
|
|
+ keyPwd.setCurrentuserId(AuthUtil.getUserId());
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(keyPwd.getCategory())){
|
|
if (StringUtils.isNotBlank(keyPwd.getCategory())){
|
|
|
List<String> categorys = Func.toStrList(keyPwd.getCategory());
|
|
List<String> categorys = Func.toStrList(keyPwd.getCategory());
|
|
@@ -133,12 +147,11 @@ public class KeyPwdController extends BladeController {
|
|
|
keyPwd.setOrgNos(orgNos);
|
|
keyPwd.setOrgNos(orgNos);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- query.setSize(500);
|
|
|
|
|
- IPage<KeyPwdVO> pages = keyPwdService.selectKeyPwdPage(Condition.getPage(query), keyPwd);
|
|
|
|
|
- List<KeyPwdVO> records = pages.getRecords();
|
|
|
|
|
|
|
+ keyPwd.setIsTurnIn(0); //未上缴的
|
|
|
|
|
+ List<KeyPwd> list = keyPwdService.getList(keyPwd);
|
|
|
HashSet<Map> set = new HashSet<>();
|
|
HashSet<Map> set = new HashSet<>();
|
|
|
- for (int i = 0; i < records.size(); i++) {
|
|
|
|
|
- KeyPwd item = records.get(i);
|
|
|
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
+ KeyPwd item = list.get(i);
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
map.put("bankNo", item.getBankNo());
|
|
map.put("bankNo", item.getBankNo());
|
|
|
map.put("orgNo", item.getOrgNo());
|
|
map.put("orgNo", item.getOrgNo());
|
|
@@ -146,22 +159,40 @@ public class KeyPwdController extends BladeController {
|
|
|
int size1 = set.size();
|
|
int size1 = set.size();
|
|
|
set.add(map);
|
|
set.add(map);
|
|
|
if (set.size() == size1){
|
|
if (set.size() == size1){
|
|
|
- records.remove(i);
|
|
|
|
|
|
|
+ list.remove(i);
|
|
|
i--;
|
|
i--;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return R.data(pages);
|
|
|
|
|
|
|
+ return R.data(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 新增 網點鎖匙/密碼登記表
|
|
|
|
|
|
|
+ * 确认 網點鎖匙/密碼登記表
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/save")
|
|
|
|
|
|
|
+ @PostMapping("/sure")
|
|
|
@ApiOperationSupport(order = 4)
|
|
@ApiOperationSupport(order = 4)
|
|
|
- @ApiOperation(value = "新增", notes = "传入keyPwd")
|
|
|
|
|
- public R save(@Valid @RequestBody KeyPwd keyPwd) {
|
|
|
|
|
- return R.status(keyPwdService.save(keyPwd));
|
|
|
|
|
|
|
+ @ApiOperation(value = "确认", notes = "传入keyPwd")
|
|
|
|
|
+ public R sure(@Valid @RequestBody KeyPwd keyPwd) {
|
|
|
|
|
+ keyPwd.setProcess(3);
|
|
|
|
|
+ keyPwd.setSureTime(DateUtil.now());
|
|
|
|
|
+ if (keyPwdService.updateById(keyPwd)){
|
|
|
|
|
+ User user = userService.getById(AuthUtil.getUserId());
|
|
|
|
|
+ Dept dept = deptService.getById(user.getDeptId());
|
|
|
|
|
+
|
|
|
|
|
+ UserLog userLog = new UserLog();
|
|
|
|
|
+ userLog.setTableName("keypwd");
|
|
|
|
|
+ userLog.setBankNo(dept.getBankNo());
|
|
|
|
|
+ userLog.setOrgNo(dept.getOrgNo());
|
|
|
|
|
+ userLog.setOrgName(dept.getDeptName());
|
|
|
|
|
+ userLog.setNewData(JSONUtil.toJsonStr(keyPwd));
|
|
|
|
|
+ userLog.setPersonNo(user.getEhr());
|
|
|
|
|
+ userLog.setPersonName(user.getName());
|
|
|
|
|
+ userLog.setOperationType("sure");
|
|
|
|
|
+ userLogService.save(userLog);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.status(true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -182,6 +213,12 @@ public class KeyPwdController extends BladeController {
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入keyPwd")
|
|
@ApiOperation(value = "新增或修改", notes = "传入keyPwd")
|
|
|
public R submit(@Valid @RequestBody KeyPwd keyPwd) {
|
|
public R submit(@Valid @RequestBody KeyPwd keyPwd) {
|
|
|
|
|
|
|
|
|
|
+ if (keyPwd.getIsTurnIn() == 1){
|
|
|
|
|
+ keyPwd.setProcess(3); //已确认,直接完结流程
|
|
|
|
|
+ }else {
|
|
|
|
|
+ keyPwd.setProcess(2); //待确认
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
boolean isAdd = keyPwd.getId() == null;
|
|
boolean isAdd = keyPwd.getId() == null;
|
|
|
BladeUser currentUser = AuthUtil.getUser();
|
|
BladeUser currentUser = AuthUtil.getUser();
|
|
|
User user = userService.getById(currentUser.getUserId());
|
|
User user = userService.getById(currentUser.getUserId());
|
|
@@ -208,14 +245,13 @@ public class KeyPwdController extends BladeController {
|
|
|
|
|
|
|
|
if (isAdd){
|
|
if (isAdd){
|
|
|
userLog.setOperationType("add");
|
|
userLog.setOperationType("add");
|
|
|
-
|
|
|
|
|
//發送通知
|
|
//發送通知
|
|
|
- noticeService.sendKeyPwdNotice(keyPwd, false);
|
|
|
|
|
|
|
+ noticeService.sendKeyPwdNotice(keyPwd, false, keyPwd.getIsTurnIn().equals(1));
|
|
|
}else{
|
|
}else{
|
|
|
userLog.setOperationType("edit");
|
|
userLog.setOperationType("edit");
|
|
|
userLog.setOldData(JSONUtil.toJsonStr(old));
|
|
userLog.setOldData(JSONUtil.toJsonStr(old));
|
|
|
//發送通知
|
|
//發送通知
|
|
|
- noticeService.sendKeyPwdNotice(keyPwd, true);
|
|
|
|
|
|
|
+ noticeService.sendKeyPwdNotice(keyPwd, true, false);
|
|
|
}
|
|
}
|
|
|
userLogService.save(userLog);
|
|
userLogService.save(userLog);
|
|
|
}
|
|
}
|
|
@@ -275,6 +311,19 @@ public class KeyPwdController extends BladeController {
|
|
|
return R.data(null);
|
|
return R.data(null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取当前用户所持有的分类,逗号拼接返回
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/getCurrentUserKeepCategory")
|
|
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
|
|
+ @ApiOperation(value = "获取当前用户所持有的分类", notes = "")
|
|
|
|
|
+ public R getCurrentUserKeepCategory(){
|
|
|
|
|
+ List<KeyPwd> list = keyPwdService.list(Wrappers.<KeyPwd>lambdaQuery().eq(KeyPwd::getReceiverId, AuthUtil.getUserId()).eq(KeyPwd::getProcess, 3));
|
|
|
|
|
+ String categorys = list.stream().map(keyPwd -> keyPwd.getCategory()).collect(Collectors.joining(","));
|
|
|
|
|
+ return R.data(categorys);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@GetMapping("/getList")
|
|
@GetMapping("/getList")
|
|
|
public R getList(KeyPwdVO keyPwd){
|
|
public R getList(KeyPwdVO keyPwd){
|
|
|
|
|
|
|
@@ -290,11 +339,16 @@ public class KeyPwdController extends BladeController {
|
|
|
List<KeyPwd> list = keyPwdService.getList(keyPwd);
|
|
List<KeyPwd> list = keyPwdService.getList(keyPwd);
|
|
|
|
|
|
|
|
list.forEach(item -> {
|
|
list.forEach(item -> {
|
|
|
- String category = item.getCategory();
|
|
|
|
|
- String value = dictService.getValue("key_type", category);
|
|
|
|
|
- String[] split = category.split("_");
|
|
|
|
|
- String key_type = dictService.getValue("key_type", split[0] + "_" + split[1] + "_" + split[2]);
|
|
|
|
|
- item.setCategory(key_type + "-" + value);
|
|
|
|
|
|
|
+ List<String> categoryStrList = new ArrayList<>();
|
|
|
|
|
+ String[] categorys = item.getCategory().split(",");
|
|
|
|
|
+ for (int i = 0; i < categorys.length; i++) {
|
|
|
|
|
+ String category = categorys[i];
|
|
|
|
|
+ String value = dictService.getValue("key_type", category);
|
|
|
|
|
+ String[] split = category.split("_");
|
|
|
|
|
+ String key_type = dictService.getValue("key_type", split[0] + "_" + split[1] + "_" + split[2]);
|
|
|
|
|
+ categoryStrList.add(key_type + "-" + value);
|
|
|
|
|
+ }
|
|
|
|
|
+ item.setCategory(StringUtil.join(categoryStrList, " | "));
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
return R.data(list);
|
|
return R.data(list);
|