提交 be1b9fb3 authored 作者: Matrix's avatar Matrix

fix(核查模块): 修复了省发起检查时省审核通过后 核查结果的显示问题

修复了省发起检查时省审核通过后 核查结果的显示问题
上级 2079bfca
......@@ -138,7 +138,7 @@ public class DeviceCheckController {
*/
@GetMapping("/handleUsers/{id}")
@ApiOperation(value = "查询该detail经手的相关人员")
public ResponseEntity getDetailHanderUsers(@PathVariable Integer id){
public ResponseEntity getDetailHanderUsers(@PathVariable Integer id) {
DeviceCheckDetail detail = detailRepo.findById(id).orElseThrow(() -> new ApiException("没有找到id = " + id + "的detail自查单!"));
Map<String, String> handUsers = new HashMap<>();
......@@ -147,27 +147,27 @@ public class DeviceCheckController {
Integer userBId = detail.getUserBId();
Integer userCId = detail.getUserCId();
if (Objects.nonNull(startUserId) && startUserId !=0){
if (Objects.nonNull(startUserId) && startUserId != 0) {
handUsers.put("startUserId", userService.findByUser(startUserId).getName());
}else {
} else {
handUsers.put("startUserId", "NoBody");
}
if (Objects.nonNull(userAId) && userAId !=0){
if (Objects.nonNull(userAId) && userAId != 0) {
handUsers.put("userA", userService.findByUser(userAId).getName());
}else {
} else {
handUsers.put("userA", "NoBody");
}
if (Objects.nonNull(userBId) && userBId !=0){
if (Objects.nonNull(userBId) && userBId != 0) {
handUsers.put("userBId", userService.findByUser(userBId).getName());
}else {
} else {
handUsers.put("userBId", "NoBody");
}
if (Objects.nonNull(userCId) && userCId !=0){
if (Objects.nonNull(userCId) && userCId != 0) {
handUsers.put("userCId", userService.findByUser(userCId).getName());
}else {
} else {
handUsers.put("userCId", "NoBody");
}
......@@ -220,7 +220,6 @@ public class DeviceCheckController {
}
@ApiOperation(value = "根据id查询核查详情数据", notes = "可以通过这个接口查询核查详情数据")
@GetMapping("/detail/{id}")
public ResponseEntity<ResultObj<CheckDetailVo>> findDetail(@PathVariable Integer id) {
......@@ -246,7 +245,8 @@ public class DeviceCheckController {
@ApiOperation(value = "根据id 刷新 核查详情数据", notes = "可以通过这个接口 刷新 核查详情数据")
@GetMapping("/detail/refresh/{id}")
public ResponseEntity<ResultObj<CheckDetailVo>> refreshDetail(@PathVariable Integer id) {
DeviceCheckDetail detail = detailRepo.findById(id).get();
DeviceCheckDetail detail = detailRepo.findById(id)
.orElseThrow(() -> new ApiException("没有找到指定的detail数据,你提供的是 id = " + id));
String checkUnit = detail.getCheckUnit();
//查出所有装备 分为4类 A 所在是本单位 B 所属是本单位 其中
List<DeviceLibrary> allDevices = dcService.getAllDeviceLibraryList();
......@@ -377,7 +377,7 @@ public class DeviceCheckController {
.collect(toList());
totalList.addAll(casList);
long end1 = System.currentTimeMillis();
log.info("[性能分析] task id = {} cost {} ms",cct.getId(),end1-start1);
log.info("[性能分析] task id = {} cost {} ms", cct.getId(), end1 - start1);
}
//
String areaName = auService.findOne(AuExample.UnitId, child.getOwnUnit()).getName();
......@@ -685,7 +685,15 @@ public class DeviceCheckController {
if (startUnitId != 1) {
checkResult = "无";
} else {
checkResult = "等待省审核";
//根据detail userC为省且任务状态是完结状态时 变为无误 否则是等待省审核
Integer detailId = task.getBillId();
Integer userCId = detailRepo.findById(detailId).get().getUserCId();
if (task.getBillStatus().equals(END.id) && Objects.nonNull(userCId) && userIsProv(userCId)){
checkResult = "无误";
}else {
checkResult = "等待省审核";
}
}
} else {
checkResult = "等待省审核";
......@@ -698,14 +706,14 @@ public class DeviceCheckController {
redoTime = Integer.valueOf(remark.split("-")[1]);
}
checkResult = redoTime + "次未通过";
}else if (comSituation == 0){
if (task.getBillStatus().equals(END.id)){
} 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 {
} else {
checkResult = "等待省审核";
}
} else {
......@@ -718,6 +726,17 @@ public class DeviceCheckController {
return led;
}
/**
* 判断用户是否是省级用户
*
* @return
*/
private boolean userIsProv(Integer userId) {
Integer unitsId = userService.findById(userId).getUnitsId();
Integer level = unitsRepo.findById(unitsId).get().getLevel();
return level == 1;
}
/**
* @param periodId 1-月度 2-季度 3-年度
* @return
......@@ -784,10 +803,9 @@ public class DeviceCheckController {
}
@ApiOperation(value = "根据地区ID获取下级的单位", notes = "根据地区ID获取下级的单位")
@GetMapping("/under/{areaId}")
public ResponseEntity getUnitsUnderAreaId(@PathVariable Integer areaId,@RequestParam(defaultValue = "true") boolean filter) {
public ResponseEntity getUnitsUnderAreaId(@PathVariable Integer areaId, @RequestParam(defaultValue = "true") boolean filter) {
//1.获取child AreaId List
List<Integer> areaIds = areaRepo.findAllByFatherId(areaId).stream()
.map(Area::getId)
......@@ -797,7 +815,7 @@ public class DeviceCheckController {
List<Units> unitsList = unitsRepo.findAllByAreaIdIn(areaIds);
// 根据filter 决定是否将没有数据的装备给过滤掉
if (filter){
if (filter) {
unitsList = unitsList.stream()
.filter(unit -> deviceRepo.findAllByOwnUnit(unit.getName()).size() != 0)
.collect(toList());
......@@ -1383,7 +1401,7 @@ public class DeviceCheckController {
currentDetail.setCheckFiles("");
currentDetail.setCheckFileList(Lists.newArrayList());
Integer userId = authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId();
currentDetail.setUserCId(userId);
currentDetail.setUserCId(0);
currentDetail = detailRepo.save(currentDetail);
//该detail对应的stat数据里相应的数据剔除(写一个通用的剔除方法), 否则在第二次审核通过的时候会重复计算一次数据
TaskBto fatherTask = taskService.get(currentTask.getParentTaskId());
......@@ -1870,14 +1888,14 @@ public class DeviceCheckController {
continue;
}
String[] device = s.split("-");
if (device.length < 2|| StringUtils.isEmpty(device[0])){
if (device.length < 2 || StringUtils.isEmpty(device[0])) {
continue;
}
int deviceId = Integer.parseInt(device[0]);
int proofResult = Integer.parseInt(device[1]);
DeviceLibrary checkDevice = deviceMap.get(deviceId);
if (Objects.isNull(checkDevice)){
if (Objects.isNull(checkDevice)) {
continue;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论