提交 04204b36 authored 作者: Matrix's avatar Matrix

fix(核查模块): 修复了核查单文件在撤回中的问题

修复了核查单文件在撤回中的问题
上级 496a38b0
package com.tykj.dev.config;
import com.tykj.dev.misc.base.*;
import lombok.Data;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import java.util.Arrays;
import java.util.Map;
......@@ -10,6 +13,7 @@ import java.util.stream.Collectors;
/**
* @author dengdiyi
*/
@Slf4j
public class GlobalMap {
public static final Map<Integer, StatusEnum> statusEnumMap;
......@@ -53,6 +57,7 @@ public class GlobalMap {
.collect(Collectors.toMap(deviceSecretLevel -> deviceSecretLevel.id, Function.identity()));
businessMap = Arrays.stream(BusinessEnum.values())
.collect(Collectors.toMap(businessEnum -> businessEnum.id, businessEnum -> businessEnum.name));
log.info("[初始化] 初始map结束...");
}
public static Map<Integer, StatusEnum> getStatusEnumMap() {
......@@ -71,6 +76,10 @@ public class GlobalMap {
return deviceLifeStatusMap;
}
public static Map<Integer, MatchingRange> getMatchingRangeMap() {
return matchingRangeMap;
}
public static Map<Integer, StorageType> getStorageTypeMap() {
return storageTypeMap;
}
......@@ -79,18 +88,14 @@ public class GlobalMap {
return matchingDeviceTypeMap;
}
public static Map<Integer, MatchingRange> getMatchingRangeMap() {
return matchingRangeMap;
public static Map<Integer, DeviceInvisibleRange> getDeviceInvisibleRangeMap() {
return deviceInvisibleRangeMap;
}
public static Map<Integer, DeviceSecretLevel> getDeviceSecretLevelMap() {
return deviceSecretLevelMap;
}
public static Map<Integer, DeviceInvisibleRange> getDeviceInvisibleRangeMap() {
return deviceInvisibleRangeMap;
}
public static Map<Integer, String> getBusinessMap() {
return businessMap;
}
......
......@@ -80,7 +80,6 @@ public enum LogType {
REPAIR_SEND_4(33,REPAIR.id, WAIT_RECEIVE.id, END.id, "上传相关单据,任务结束"),//
REPAIR_SEND_5(34,REPAIR.id, WAIT_RECEIVE.id, WAIT_UPLOAD_FILE.id, "接收维修装备并发起入库(缺少单据)"),
REPAIR_SEND_6(35,REPAIR.id, WAIT_UPLOAD_FILE.id, END.id, "上传送修单据"),
......@@ -155,7 +154,9 @@ public enum LogType {
CONFIRM_CHECK_EXAM_CITY_VERIFY_DONE(426, CONFIRM_CHECK_DETAIL.id, CONFIRM_STAT_0.id, END.id, "市统计数据确认完毕"),
CONFIRM_CHECK_EXAM_CITY_DETAIL_DONE(427, CONFIRM_CHECK_DETAIL.id, CHECK_DETAIL_CITY_1.id, END.id, "专管员B处理完毕"),
CONFIRM_CHECK_EXAM_CITY_DETAIL_DONE(427, CONFIRM_CHECK_DETAIL.id, CHECK_DETAIL_CITY_1.id, END.id, "专管员B处理完毕,任务结束"),
CONFIRM_CHECK_EXAM_CITY_STAT_0(428, CONFIRM_CHECK_STAT.id, ORIGIN_STATUS.id, CHECK_STAT_1.id, "统计任务开始"),
......
......@@ -129,10 +129,51 @@ public class DeviceCheckController {
@GetMapping("/unit")
@ApiOperation(value = "查询默认的可以被核查单位的清单(省本直,省直属,市局)")
public ResponseEntity findDefaultUnits() {
return ResponseEntity.ok(new ResultObj<>(unitsRepo.findAllByTypeNotInAndLevelIn(Lists.newArrayList(3), Lists.newArrayList(0, 1, 2))));
}
/**
* @param id
* @return
*/
@GetMapping("/handleUsers/{id}")
@ApiOperation(value = "查询该detail经手的相关人员")
public ResponseEntity getDetailHanderUsers(@PathVariable Integer id){
DeviceCheckDetail detail = detailRepo.findById(id).orElseThrow(() -> new ApiException("没有找到id = " + id + "的detail自查单!"));
Map<String, String> handUsers = new HashMap<>();
Integer startUserId = detail.getCreateUserId();
Integer userAId = detail.getUserAId();
Integer userBId = detail.getUserBId();
Integer userCId = detail.getUserCId();
if (Objects.nonNull(startUserId) && startUserId !=0){
handUsers.put("startUserId", userService.findByUser(startUserId).getName());
}else {
handUsers.put("startUserId", "NoBody");
}
if (Objects.nonNull(userAId) && userAId !=0){
handUsers.put("userA", userService.findByUser(userAId).getName());
}else {
handUsers.put("userA", "NoBody");
}
if (Objects.nonNull(userBId) && userBId !=0){
handUsers.put("userBId", userService.findByUser(userBId).getName());
}else {
handUsers.put("userBId", "NoBody");
}
if (Objects.nonNull(userCId) && userCId !=0){
handUsers.put("userCId", userService.findByUser(userCId).getName());
}else {
handUsers.put("userCId", "NoBody");
}
return ResponseEntity.ok(handUsers);
}
@GetMapping("/judge/{taskId}")
@ApiOperation(value = "根据taskId判断该task任务是由核查发起的还是由检查发起的")
public ResponseEntity judgeExamDetail(@PathVariable Integer taskId) {
......@@ -178,6 +219,8 @@ public class DeviceCheckController {
return ccService.findAllStatTable(checkBillSelectVo);
}
@ApiOperation(value = "根据id查询核查详情数据", notes = "可以通过这个接口查询核查详情数据")
@GetMapping("/detail/{id}")
public ResponseEntity<ResultObj<CheckDetailVo>> findDetail(@PathVariable Integer id) {
......@@ -526,7 +569,7 @@ public class DeviceCheckController {
String checkReuslt = "";
// Task 先将历史数据给过滤掉 - 方法是按照billId分组排序,跳出主键id最大的即最新的一条
detailTasks = detailTasks.stream()
.collect(groupingBy(Task::getBillId,
.collect(groupingBy(Task::getTitle,
collectingAndThen(maxBy(Comparator.comparing(Task::getId)), Optional::get)))
.values().stream()
.collect(toList());
......@@ -655,6 +698,16 @@ public class DeviceCheckController {
redoTime = Integer.valueOf(remark.split("-")[1]);
}
checkResult = redoTime + "次未通过";
}else if (comSituation == 0){
if (task.getBillStatus().equals(END.id)){
int redoTime = 1;
if (Objects.nonNull(remark) && remark.contains("ROLLBACK")) {
redoTime = Integer.valueOf(remark.split("-")[1]);
}
checkResult = redoTime + "次未通过";
}else {
checkResult = "等待省审核";
}
} else {
checkResult = "状态异常";
}
......@@ -1123,7 +1176,18 @@ public class DeviceCheckController {
@RequestParam int assignUserId,
@RequestParam String checkResult,
@RequestParam String terminalInfo,
@RequestBody DevLibVo devLibVo) {
@RequestBody DetailVo detailVo) {
// 获取参数
DevLibVo devLibVo = detailVo.getDevLibVo();
List<FileRet> checkFiles = detailVo.getCheckFiles();
//是否上传检查单
if (checkFiles != null && checkFiles.size() > 0) {
DeviceCheckDetail deviceCheckDetail = detailRepo.findById(id).get();
deviceCheckDetail.setCheckFiles(FilesUtil.stringFileToList(checkFiles));
detailRepo.save(deviceCheckDetail);
}
//1. 更新checkDetail
log.info("[核查模块] 专管员A正在进行详情账单核查,且指定下一个审核人B id 为 {}", assignUserId);
String detailString = transUtil.devLib2String(devLibVo.getDevInLibrary(), devLibVo.getDevNotInLibrary());
......@@ -1265,6 +1329,9 @@ public class DeviceCheckController {
//不通过则回到第一阶段
log.info("[核查模块] 核查员B退回自查任务...");
StatusEnum firstStatus = getFirstStatus(currentTask.getBillStatus(), Integer.valueOf(currentDetail.getVar2()));
currentDetail.setCheckFiles("");
currentDetail.setCheckFileList(Lists.newArrayList());
detailRepo.save(currentDetail);
taskService.moveToSpecial(currentTask, firstStatus, 0);
}
log.info("[核查模块] 专管员B操作成功");
......@@ -1293,6 +1360,8 @@ public class DeviceCheckController {
// 通过的话就推进任务进度,合并数据
log.info("[核查模块] 市专管员审核通过,结束 {} 区的自查任务并汇总数据", currentDetail.getCheckUnit());
taskService.moveToNext(currentTask);
Integer userId = authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId();
currentDetail.setUserCId(userId);
summaryDetail(currentTask, currentDetail);
return ResponseEntity.ok("市专管员审核通过,结束" + currentDetail.getCheckUnit() + " 区的自查任务并汇总数据");
} else {
......@@ -1303,6 +1372,10 @@ public class DeviceCheckController {
taskService.moveToSpecial(currentTask, firstStatus, 0);
//重置该自查详情里的各个装备的自查详情
currentDetail = setDetailCheckNumber(currentDetail, 119);
currentDetail.setCheckFiles("");
currentDetail.setCheckFileList(Lists.newArrayList());
Integer userId = authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId();
currentDetail.setUserCId(userId);
currentDetail = detailRepo.save(currentDetail);
//该detail对应的stat数据里相应的数据剔除(写一个通用的剔除方法), 否则在第二次审核通过的时候会重复计算一次数据
TaskBto fatherTask = taskService.get(currentTask.getParentTaskId());
......@@ -1388,6 +1461,8 @@ public class DeviceCheckController {
DeviceCheckDetail cDetail = detail.copyWithoutId();
cDetail.setId(null);
cDetail.setCheckDetail(initalDetail);
cDetail.setCheckFiles("");
cDetail.setCheckFileList(Lists.newArrayList());
cDetail = detailRepo.save(cDetail);
// 创建新的任务(被拒绝的自查单位如果是区则是140状态,否则是160状态)
String unitName = cDetail.getCheckUnit();
......@@ -1499,6 +1574,7 @@ public class DeviceCheckController {
*/
private String changeHunds(String detailString, Integer value) {
String updateDetail = Arrays.stream(detailString.split(","))
.filter(s -> StringUtils.isNoneEmpty(s))
.map(s -> {
Integer number = Integer.valueOf(s.split("-")[1]);
int digit = number % 10;
......@@ -1766,6 +1842,7 @@ public class DeviceCheckController {
List<Integer> idList = Arrays.stream(statArray)
.filter(StringUtils::isNotEmpty)
.map(s -> s.split("-")[0])
.filter(StringUtils::isNotEmpty)
.map(Integer::parseInt)
.collect(toList());
......@@ -1784,6 +1861,9 @@ public class DeviceCheckController {
continue;
}
String[] device = s.split("-");
if (device.length < 2|| StringUtils.isEmpty(device[0])){
continue;
}
int deviceId = Integer.parseInt(device[0]);
int proofResult = Integer.parseInt(device[1]);
......
......@@ -71,6 +71,7 @@ public class DeviceCheckDetail extends BaseEntity {
@ApiModelProperty(value = "本级经办人id(A岗)")
@Column(name = "userA_id")
private Integer userAId;
/**
* 本级审核人id(B岗)
*/
......@@ -78,10 +79,13 @@ public class DeviceCheckDetail extends BaseEntity {
@ApiModelProperty(value = "本级审核人id(B岗)")
@Column(name = "userB_id")
private Integer userBId;
@ApiModelProperty(value = "上级审核人id")
@Column(name = "userC_id")
private Integer userCId;
/**
* 核查时间
*/
@ApiModelProperty(value = "核查时间")
private Date checkTime;
/**
......
......@@ -79,6 +79,12 @@ public class CheckDetailVo {
@ApiModelProperty(value = "本级审核人id(B岗)")
private Integer userBId;
/**
* 上级审核人Id
*/
@ApiModelProperty(value = "上级审核人id")
private Integer userCId;
/**
* 核查时间
*/
......
......@@ -137,7 +137,6 @@ public class ObjTransUtil {
// 构建完成情况参数 未完成数量/总数
// 获得当前节点的子节点总数 = 总数 其中状态为9999的为已完成
//
TaskBto fatherTask = taskService.get(stat.getId(), BusinessEnum.CONFIRM_CHECK_STAT.id);
Integer fatherTaskId = fatherTask.getId();
......
......@@ -12,6 +12,8 @@ target/
.settings
.springBeans
.sts4-cache
.idea/**
*.http
### IntelliJ IDEA ###
.idea
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论