提交 07c8eab4 authored 作者: Matrix's avatar Matrix

[核查模块] 修复了Miss Z 点出的很多奇怪的问题以及奇怪的需求

上级 debb315a
......@@ -209,25 +209,11 @@ public class DeviceCheckController {
LinkCheckDetail lcd = rev2lcd(child, endTime, cas.reverse());
lcd.setCheckUnit(unitName);
lcdList.add(lcd);
// if (cdcVo.getDeviceStatVoList().size() == 0) {
// LinkCheckDetail lcd = new LinkCheckDetail(child.getBillId(), "默认", "无", "未开始", 0);
// lcd.setCheckUnit(unitName);
// lcdList.add(lcd);
// } else {
// List<CheckAreaStatVo> casList = cdcVo.getDeviceStatVoList().stream()
// .map(CheckDeviceStatVo::getAreaStatList)
// .flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
// .collect(toList());
// String areaName = auService.findOne(AuExample.UnitId, child.getOwnUnit()).getName();
// CheckAreaStatVo cas = combineCaList(casList, areaName);
//
// LinkCheckDetail lcd = rev2lcd(child.getBillId(), endTime, cas.reverse());
// lcd.setCheckUnit(unitName);
// lcdList.add(lcd);
// }
if (child.getTitle().contains("统计确认待办任务")){
lcd.setCheckSituation("统计确认待办任务");
}
lcdList.add(lcd);
finalTime = System.currentTimeMillis();
log.info("[TEST] child-BILL id = {}的检查任务 , COST {} MS", child.getBillId(), finalTime - startTime);
} else {
......@@ -238,7 +224,8 @@ public class DeviceCheckController {
DeviceCheckDetail childDetail = detailRepo.findById(childBusId).get();
String unitName = childDetail.getCheckUnit();
List<CheckAreaStatVo> casList = parseStatString2Vo(child.parse2Bto(), childDetail).stream()
List<CheckDeviceStatVo> list = parseStatString2Vo(child.parse2Bto(), childDetail);
List<CheckAreaStatVo> casList = list.stream()
.map(CheckDeviceStatVo::getAreaStatList)
.flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
.collect(toList());
......@@ -277,6 +264,7 @@ public class DeviceCheckController {
// 找到所有的子节点
List<Task> childTask = taskRepo.findAllByParentTaskId(rootTask.getId());
//核查组成员和名称 找到父亲级节点 然后找到父节点的统计节点
String[] checkArray = ctVo.getRemark().split("\\|");// x,a |x ,b
List<String> groupNames = new ArrayList<>();
......@@ -361,7 +349,11 @@ public class DeviceCheckController {
} else if (revAreaStat.getComSituation() == 1) {
lcd.setCheckSituation("有误");
} else if (revAreaStat.getComSituation() == 0) {
lcd.setCheckSituation("无");
if (revAreaStat.getComProgress() == 0){
lcd.setCheckSituation("无");
}else {
lcd.setCheckSituation("无误");
}
} else {
lcd.setCheckSituation("异常");
}
......@@ -393,12 +385,16 @@ public class DeviceCheckController {
LinkExamDetail led = new LinkExamDetail();
led.setId(task.getBillId());
//核查情况 无误/有误/逾期
if (endTime.isBefore(LocalDateTime.now())) {
if (endTime.isBefore(LocalDateTime.now()) && task.getBillStatus() != 9999 && revAreaStat.getComProgress() != 2) {
led.setCheckSituation("逾期");
} else if (revAreaStat.getComSituation() == 1) {
led.setCheckSituation("有误");
} else if (revAreaStat.getComSituation() == 0) {
led.setCheckSituation("无");
if (revAreaStat.getComProgress() == 0){
led.setCheckSituation("无");
}else {
led.setCheckSituation("无误");
}
} else {
led.setCheckSituation("异常");
}
......@@ -476,7 +472,8 @@ public class DeviceCheckController {
Integer statId = taskService.get(provId).getBillId();
DeviceCheckStat deviceCheckStat = statRepo.getOne(statId);
String title = deviceCheckStat.getTitle();
return ResponseEntity.ok(new CheckTitleAndTimeVo(title, deviceCheckStat.getEndTime()));
String remark = deviceCheckStat.getRemark();
return ResponseEntity.ok(new CheckTitleAndTimeVo(title, deviceCheckStat.getEndTime(),remark));
}
@ApiOperation(value = "发起自动核查", notes = "发起自动核查")
......@@ -590,7 +587,7 @@ public class DeviceCheckController {
//核查组成员名称用当前登录用户
String names = loginUser.getName();
// 3-1 构建被查单位的 自查账单
DeviceCheckDetail unitDetailDoc = DeviceCheckDetail.EmptyWithChecker(names + "|" + "默认备注", "", 0, 0, 0, 0, unit.getName(), devInLib.getOrDefault(unit.getName(), new ArrayList<>()), devNotInLib.getOrDefault(unit.getName(), new ArrayList<>()));
DeviceCheckDetail unitDetailDoc = DeviceCheckDetail.EmptyWithChecker(names + "|" + "默认备注", ccVO.getRemark(), 0, 0, 0, 0, unit.getName(), devInLib.getOrDefault(unit.getName(), new ArrayList<>()), devNotInLib.getOrDefault(unit.getName(), new ArrayList<>()));
DeviceCheckDetail detail = detailRepo.save(unitDetailDoc);
// 将id放入统计中去 model -> areaName -> detailId
String areaName = auService.findOne(AuExample.UnitId, unit.getUnitId()).getName();
......@@ -629,47 +626,6 @@ public class DeviceCheckController {
return ResponseEntity.ok(ImmutableMap.of("msg", "发起核查成功"));
}
/**
* 根据taskId查询Remark
*/
@ApiOperation(value = "根据taskId查询Remark", notes = "根据taskId查询Remark")
@GetMapping("/selectRemark/{taskId}")
public ResponseEntity selectRemark(@PathVariable Integer taskId){
TaskBto taskBto=selectProvTask(taskId);
Optional<DeviceCheckStat> optional= statRepo.findById(taskBto.getBillId());
if (optional.isPresent()){
DeviceCheckStat deviceCheckStat=optional.get();
if (deviceCheckStat.getCheckType().getId()==0){
return ResponseEntity.ok(desMap.get(taskBto.getId()));
}else {
return ResponseEntity.ok(desMap.get(taskId));
}
}else {
throw new ApiException(ResponseEntity.status(500).body("没有找到id"));
}
}
/**
* 根据taskId查询Remark
*/
@ApiOperation(value = "根据BillId查询Remark", notes = "根据taskId查询Remark")
@GetMapping("/selectRemarkBill/{billId}")
public ResponseEntity selectRemarkBill(@PathVariable Integer billId){
return ResponseEntity.ok(desBillMap.get(billId));
}
private TaskBto selectProvTask(Integer taskId){
TaskBto taskBto= taskService.get(taskId);
if (taskBto.getParentTaskId()==0){
return taskBto;
}
return selectProvTask(taskBto.getParentTaskId());
}
/**
* 发起检查
* <li>1. 添加发起核查bill记录</>
......@@ -691,7 +647,7 @@ public class DeviceCheckController {
if (ceVo.getExamStatId() != 0) {
//update
log.info("[核查模块] update核查,自动添加id = {}市的自核查任务", startUnitId);
examDetailVos.add(examDetailVos.get(0).copy(uAreaId, "市自查"));
examDetailVos.add(examDetailVos.get(0).copy(uAreaId, "由省核查发起的自检查"));
}
......@@ -764,7 +720,7 @@ public class DeviceCheckController {
Units unit = unitsRepo.findByAreaId(ed.getAreaId()).get(0);
String names = ed.getUserNames().stream().collect(joining(","));
// 3-1 构建被查单位的 自查账单
DeviceCheckDetail unitDetailDoc = DeviceCheckDetail.EmptyWithChecker(names + "|" + ed.getRemark(), ceVo.getTitle(), 0, 0, 0, 0, unit.getName(), devInLib.getOrDefault(unit.getName(), new ArrayList<>()), devNotInLib.getOrDefault(unit.getName(), new ArrayList<>()));
DeviceCheckDetail unitDetailDoc = DeviceCheckDetail.EmptyWithChecker(names + "|" + ed.getRemark(), ceVo.getTitle()+"%^&"+ed.getRemark(), 0, 0, 0, 0, unit.getName(), devInLib.getOrDefault(unit.getName(), new ArrayList<>()), devNotInLib.getOrDefault(unit.getName(), new ArrayList<>()));
DeviceCheckDetail detail = detailRepo.save(unitDetailDoc);
detailIds.add(detail.getId());
// 将id放入统计中去 model -> areaName -> detailId
......@@ -796,6 +752,48 @@ public class DeviceCheckController {
));
}
/**
* 根据taskId查询Remark
*/
@ApiOperation(value = "根据taskId查询Remark", notes = "根据taskId查询Remark")
@GetMapping("/selectRemark/{taskId}")
public ResponseEntity selectRemark(@PathVariable Integer taskId){
TaskBto taskBto=selectProvTask(taskId);
Optional<DeviceCheckStat> optional= statRepo.findById(taskBto.getBillId());
if (optional.isPresent()){
DeviceCheckStat deviceCheckStat=optional.get();
if (deviceCheckStat.getCheckType().getId()==0){
return ResponseEntity.ok(desMap.get(taskBto.getId()));
}else {
return ResponseEntity.ok(desMap.get(taskId));
}
}else {
throw new ApiException(ResponseEntity.status(500).body("没有找到id"));
}
}
/**
* 根据taskId查询Remark
*/
@ApiOperation(value = "根据BillId查询Remark", notes = "根据taskId查询Remark")
@GetMapping("/selectRemarkBill/{billId}")
public ResponseEntity selectRemarkBill(@PathVariable Integer billId){
return ResponseEntity.ok(desBillMap.get(billId));
}
private TaskBto selectProvTask(Integer taskId){
TaskBto taskBto= taskService.get(taskId);
if (taskBto.getParentTaskId()==0){
return taskBto;
}
return selectProvTask(taskBto.getParentTaskId());
}
/**
* 对于专员A来说的逻辑
......@@ -816,7 +814,7 @@ public class DeviceCheckController {
String detailString = transUtil.devLib2String(devLibVo.getDevInLibrary(), devLibVo.getDevNotInLibrary());
User currentUser = Objects.requireNonNull(authenticationUtils.getAuthentication()).getCurrentUserInfo();
long count = devLibVo.getDevInLibrary().stream()
.filter(deviceInLibVo -> deviceInLibVo.getProofResult() == 1)
.filter(deviceInLibVo -> deviceInLibVo.getProofResult() % 10 !=9)
.count();
detailRepo.updateCheckDetail(id, detailString, checkResult, currentUser.getUserId(), assignUserId, (int) count);
//2. 推进TASK 状态
......@@ -888,7 +886,14 @@ public class DeviceCheckController {
public ResponseEntity<ResultObj> checkUserB(@PathVariable Integer id,
@RequestParam int checkStatus,
@RequestParam(required = false, defaultValue = "0") int checkUserAId,
@RequestParam(required = false, defaultValue = "0") int checkUserBId, @RequestBody List<FileRet> checkFiles) {
@RequestParam(required = false, defaultValue = "0") int checkUserBId,
@RequestParam(required = false, defaultValue = "0") int isUpdate,
@RequestParam String checkResult,
@RequestBody DetailVo detailVo
) {
List<FileRet> checkFiles = detailVo.getCheckFiles();
DevLibVo devLibVo = detailVo.getDevLibVo();
log.info("[核查模块] 专管员B正在进行核查操作,核查账单id为 {} ,且审核状态为 : {}", id, checkStatus == 1 ? "通过" : "不通过");
if (checkStatus == 0) {
return ResponseEntity.status(400).body(new ResultObj<>("checkStatus不应该为0!"));
......@@ -907,6 +912,18 @@ public class DeviceCheckController {
}
if (checkStatus == 1) {
// 只要通过了,且更新了详情结果,那么这里就进行一次更新
if (isUpdate == 1) {
String detailString = transUtil.devLib2String(devLibVo.getDevInLibrary(), devLibVo.getDevNotInLibrary());
User currentUser = Objects.requireNonNull(authenticationUtils.getAuthentication()).getCurrentUserInfo();
long count = devLibVo.getDevInLibrary().stream()
.filter(deviceInLibVo -> deviceInLibVo.getProofResult() %10 !=9)
.count();
log.info("[核查模块] 检测到专管员B人工核查修改了核查结果,实查装备数量为 : {}",count);
detailRepo.updateCheckDetail4Check(id, detailString, checkResult, (int) count);
}
//依据detail账单对应的checkUserId来判断是2流程还是多流程的
DeviceCheckDetail currentDetail = detailRepo.findById(id).get();
Integer userAId = currentDetail.getCheckUserAId();
......@@ -1174,17 +1191,18 @@ public class DeviceCheckController {
DeviceLibrary checkDevice = deviceMap.get(deviceId);
CheckAreaStatVo checkAreaStatVo;
// proofResult 9=(1,1) 1=(2,0) other=(2,1)
// 十位数 1 人工 2 自动
// 0缺失1无误2新增3不在库9未检查
int digits = proofResult % 10;
if (proofResult == 9) {
if (digits == 9) {
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 0, 0, statId, detailId);
} else if (proofResult == 3) {
} else if (digits == 3) {
//跳过非在库的统计
continue;
} else if (proofResult == 1) {
} else if (digits == 1) {
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 2, 0, statId, detailId);
} else if (proofResult == 0) {
} else if (digits == 0) {
checkAreaStatVo = new CheckAreaStatVo(areaName, 0, 1, 2, 1, statId, detailId);
} else {
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 2, 1, statId, detailId);
......@@ -1325,7 +1343,7 @@ public class DeviceCheckController {
supposeCount += v.getSupposeCount();
actualCount += v.getActualCount();
progressCount += v.getComProgress();
comSituationCount = v.getComSituation();
comSituationCount += v.getComSituation();
}
//comprogress合并逻辑 if all 0->0 2->2 else 1
......
......@@ -108,7 +108,7 @@ public class DeviceCheckDetail extends BaseEntity {
/**
* 核查详情(装备主键id+核对结果(0缺失1无误2新增3不在库9未检查,字符-作为状态分隔符字符,作为分隔符))
*/
@Column(name = "check_detail",columnDefinition = "TEXT")
@Column(name = "check_detail", columnDefinition = "TEXT")
@ApiModelProperty(value = "核查详情(装备主键id+核对结果(0缺失1无误2新增3不在库9未检查,字符x作为分隔符)),例如1-2,2-2,意为主键id为1的装备缺失,为2的无误,为3的新增")
private String checkDetail;
/**
......@@ -133,7 +133,7 @@ public class DeviceCheckDetail extends BaseEntity {
@ApiModelProperty(value = "区块链记录id")
private String recordId;
@Column(name = "check_files",columnDefinition = "TEXT")
@Column(name = "check_files", columnDefinition = "TEXT")
private String checkFiles;
@Transient
......@@ -222,7 +222,7 @@ public class DeviceCheckDetail extends BaseEntity {
String checkDetail = StringUtils.isEmpty(badCheckDetail) ? goodCheckDetail : goodCheckDetail + "," + badCheckDetail;
return new DeviceCheckDetail(
title + checkUnit + "核查详情单",
checkUnit + "核查详情单" + "%^&" + title,
0,
checkUserA,
checkUserB,
......
......@@ -61,7 +61,11 @@ public class CheckAreaStatVo implements Cloneable {
this.actualCount = vo.getActualCount();
this.supposeCount = vo.getSupposeCount();
this.comProgress = vo.getComProgress();
this.comSituation = vo.getComSituation();
if (this.comSituation == 1 || vo.getComSituation() == 1) {
this.comSituation = 1;
} else {
this.comSituation = 0;
}
this.areaStatId = vo.getAreaStatId();
this.areaDetailId = vo.getAreaDetailId();
}
......@@ -117,7 +121,12 @@ public class CheckAreaStatVo implements Cloneable {
reducedVo.supposeCount += other.supposeCount;
reducedVo.actualCount += other.actualCount;
reducedVo.comProgress = other.comProgress;
reducedVo.comSituation = other.comSituation;
//0 无误 1异常
if (reducedVo.comSituation == 1 || other.comSituation == 1) {
reducedVo.comSituation = 1;
} else {
reducedVo.comSituation = 0;
}
return reducedVo;
}
......@@ -159,7 +168,12 @@ public class CheckAreaStatVo implements Cloneable {
CheckAreaStatVo reducedVo = new CheckAreaStatVo(this);
reducedVo.actualCount += other.actualCount;
reducedVo.comProgress = other.comProgress;
reducedVo.comSituation = other.comSituation;
//0 无误 1异常
if (reducedVo.comSituation == 1 || other.comSituation == 1) {
reducedVo.comSituation = 1;
} else {
reducedVo.comSituation = 0;
}
return reducedVo;
}
......@@ -170,7 +184,12 @@ public class CheckAreaStatVo implements Cloneable {
this.supposeCount += other.getSupposeCount();
this.actualCount += other.getActualCount();
this.comProgress = other.getComProgress();
this.comSituation = other.getComSituation();
//0 无误 1异常
if (this.comSituation == 1 || other.comSituation == 1) {
this.comSituation = 1;
} else {
this.comSituation = 0;
}
return this;
}
......
......@@ -23,4 +23,7 @@ public class CheckTitleAndTimeVo {
@ApiModelProperty("截止时间")
private LocalDateTime createTime;
@ApiModelProperty("备注")
private String remark;
}
package com.tykj.dev.device.confirmcheck.entity.vo;
import com.tykj.dev.device.file.entity.FileRet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* DetailVo.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/5/26 at 7:06 下午
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DetailVo {
List<FileRet> checkFiles;
DevLibVo devLibVo;
}
......@@ -30,7 +30,8 @@ public class DeviceInLibVo {
private String rfidCardId;
/**
* 0缺失1无误2新增3不在库9未检查
* 十位数 1 人工 2 自动
* 个位数 0缺失1无误2新增3不在库9未检查
*/
private int proofResult;
......
......@@ -24,6 +24,16 @@ public interface DeviceCheckDetailDao extends JpaRepository<DeviceCheckDetail, I
@Query("update DeviceCheckDetail o set o.checkDetail=?2,o.checkResult = ?3,o.userAId =?4,o.userBId=?5,o.checkedCount=?6 where o.id=?1")
void updateCheckDetail(Integer id, String checkDetail, String checkResult, int userAId, int userBId, Integer checkedCount);
/**
* 根据id更新checkDetail 用于专管员B检查
*
* @param id detail id
* @param checkDetail 要更新的检查结果
*/
@Modifying
@Query("update DeviceCheckDetail o set o.checkDetail=?2,o.checkResult = ?3,o.checkedCount=?4 where o.id=?1")
void updateCheckDetail4Check(Integer id, String checkDetail, String checkResult, Integer checkedCount);
@Modifying
@Query("update DeviceCheckDetail o set o.checkStatus=?2 where o.id=?1")
int updateCheckStatus(int id, int checkStatus);
......
......@@ -39,6 +39,8 @@ import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toList;
/**
* ObjTransUtil.
*
......@@ -130,10 +132,28 @@ public class ObjTransUtil {
TaskBto fatherTask = taskService.get(stat.getId(), BusinessEnum.CONFIRM_CHECK_STAT.id);
Integer fatherTaskId = fatherTask.getId();
List<Task> childTasks = taskDao.findAllByParentTaskId(fatherTaskId);
long total = childTasks.size();
List<Task> childTask = taskDao.findAllByParentTaskId(fatherTaskId);
boolean flag = false;
boolean confirmTaskisDone = false;
for (Task task : childTask) {
if (task.getTitle().contains("统计确认待办任务")) {
if (task.getBillStatus() != 9999) {
flag = true;
} else {
confirmTaskisDone = true;
}
}
}
// 3/3 -> 统计待确认 -> 省统计任务待完结
childTask = childTask.stream().filter(task -> !task.getTitle().contains("统计确认待办任务"))
.collect(toList());
long total = childTask.size();
long done = childTasks.stream()
long done = childTask.stream()
.filter(task -> task.getBillStatus().equals(9999))
.count();
......@@ -143,7 +163,20 @@ public class ObjTransUtil {
if (stat.getCheckType() == CheckType.CT_EXAM && !fatherTask.getBillStatus().equals(9999)) {
completion = "核查完成待办结";
} else {
completion = "核查完成";
if (flag) {
completion = "核查完成待确认";
} else {
// confirmTaskidDone 为true 代表此时等待最后的father任务 为false代表 flag = false 且isDone为false 代表整个节点里没有确认节点直接完结
if (confirmTaskisDone) {
if (fatherTask.getBillStatus() == 9999) {
completion = "核查完成";
} else {
completion = "核查完成待办结";
}
} else {
completion = "核查完成";
}
}
}
} else {
completion = done + "/" + total;
......@@ -293,8 +326,9 @@ public class ObjTransUtil {
int proofResult = Integer.parseInt(array[1]);
DeviceLibrary device = deviceRepo.findById(deviceId).orElseThrow(
() -> new ApiException(ResponseEntity.badRequest().body(String.format("检查到装备序号为%d的装备不在资料库中,请先执行入库操作!", deviceId)))).setConfigName();
//依据proofResult 判断是否是在库装备
if (proofResult == 3) {
//依据proofResult的个位数 判断是否是在库装备
int digit = proofResult % 10;
if (digit == 3) {
// 非在库装备
notInLibVoList.add(toCheckNotInLibVo(device));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论