提交 231bb82f authored 作者: ljj234's avatar ljj234

refactor: 修改核查模块(重构)

上级 0bc0f828
...@@ -610,9 +610,12 @@ public class DeviceCheckController { ...@@ -610,9 +610,12 @@ public class DeviceCheckController {
// 这里只显示detail任务 // 这里只显示detail任务
if (child.getBusinessType() == CONFIRM_CHECK_STAT.id) { if (child.getBusinessType() == CONFIRM_CHECK_STAT.id) {
String[] split = child.getTitle().split("]");
ledList.add(LinkExamDetail.builder() ledList.add(LinkExamDetail.builder()
.examName("")
.examUser("")
.checkResult("无误") .checkResult("无误")
.checkUnit(unitsRepo.findById(child.getOwnUnit()).get().getName()) .checkUnit(split[0].replace("[",""))
.checkSituation("211") .checkSituation("211")
.id(child.getBillId()) .id(child.getBillId())
.remark(1) .remark(1)
...@@ -1180,6 +1183,7 @@ public class DeviceCheckController { ...@@ -1180,6 +1183,7 @@ public class DeviceCheckController {
@RequestParam String checkResult, @RequestParam String checkResult,
@RequestBody DetailVo detailVo @RequestBody DetailVo detailVo
) { ) {
// 0:待核查,1:审核失败,2:核查完成
List<FileRet> checkFiles = detailVo.getCheckFiles(); List<FileRet> checkFiles = detailVo.getCheckFiles();
DevLibVo devLibVo = detailVo.getDevLibVo(); DevLibVo devLibVo = detailVo.getDevLibVo();
...@@ -1259,6 +1263,8 @@ public class DeviceCheckController { ...@@ -1259,6 +1263,8 @@ public class DeviceCheckController {
/** /**
* 市人员审核区自查数据的接口 * 市人员审核区自查数据的接口
* *
* 市 审核 区
*
* @param detailId * @param detailId
* @param pass 是否通过 true - 通过 ,false - 未通过 * @param pass 是否通过 true - 通过 ,false - 未通过
* @return * @return
...@@ -1275,7 +1281,7 @@ public class DeviceCheckController { ...@@ -1275,7 +1281,7 @@ public class DeviceCheckController {
if (pass) { if (pass) {
// 通过的话就推进任务进度,合并数据 // 通过的话就推进任务进度,合并数据
log.info("[核查模块] 市专管员审核通过,结束 {} 区的自查任务并汇总数据", unitsRepo.findById(currentDetail.getCheckUnitId()).get().getName()); log.info("[核查模块] 市专管员审核通过,结束 {} 区的自查任务并汇总数据", unitsRepo.findById(currentDetail.getCheckUnitId()).get().getName());
taskService.moveToNext(currentTask); taskService.moveToSpecial(currentTask,END);
Integer userId = authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId(); Integer userId = authenticationUtils.getAuthentication().getCurrentUserInfo().getUserId();
currentDetail.setUserCId(userId); currentDetail.setUserCId(userId);
currentDetail = detailRepo.save(currentDetail); currentDetail = detailRepo.save(currentDetail);
...@@ -1308,6 +1314,14 @@ public class DeviceCheckController { ...@@ -1308,6 +1314,14 @@ public class DeviceCheckController {
taskService.update(fatherTask); taskService.update(fatherTask);
} }
TaskBto granderFatherTask = taskService.get(fatherTask.getParentTaskId());
if (END.id.equals(granderFatherTask.getBillStatus()) || CHECK_SHUT_DOWN.id.equals(granderFatherTask.getBillStatus())) {
granderFatherTask.setBillStatus(StatusEnum.CHECK_EXAM_STAT_1.id);
taskService.update(granderFatherTask);
}
// 撤销时恢复省的统计任务
return ResponseEntity.ok("回退成功!回滚该任务到初始状态,id = " + currentTask.getId()); return ResponseEntity.ok("回退成功!回滚该任务到初始状态,id = " + currentTask.getId());
} }
...@@ -1786,7 +1800,12 @@ public class DeviceCheckController { ...@@ -1786,7 +1800,12 @@ public class DeviceCheckController {
return level == 1; return level == 1;
} }
// todo /**
* 拼接待办,如[unit]title
* @param units unit
* @param title title
* @return [unit]title
*/
private String getUnitDateString(Units units, String title) { private String getUnitDateString(Units units, String title) {
return "[" + units.getUnitDesc() + "]" + title; return "[" + units.getUnitDesc() + "]" + title;
...@@ -2058,7 +2077,7 @@ public class DeviceCheckController { ...@@ -2058,7 +2077,7 @@ public class DeviceCheckController {
detailIdList.add(c1.getBillId()); detailIdList.add(c1.getBillId());
} }
if (c1.getCustomInfo().equals("exam")) { if (c1.getCustomInfo().equals("exam") || c1.getCustomInfo().equals("check")) {
if (!(c1.getBillStatus().equals(END.id) || c1.getBillStatus().equals(CHECK_SHUT_DOWN.id))) { if (!(c1.getBillStatus().equals(END.id) || c1.getBillStatus().equals(CHECK_SHUT_DOWN.id))) {
examIsDone = false; examIsDone = false;
} }
......
...@@ -161,7 +161,7 @@ public class DeviceCheckDetail extends BaseEntity { ...@@ -161,7 +161,7 @@ public class DeviceCheckDetail extends BaseEntity {
@Transient @Transient
private List<FileRet> checkFileList = new ArrayList<>(); private List<FileRet> checkFileList = new ArrayList<>();
@ApiModelProperty(value = "手持终端信息字段") @ApiModelProperty(value = "checkC")
@Column(name = "checkC_name") @Column(name = "checkC_name")
private String checkCName = ""; private String checkCName = "";
......
...@@ -6,6 +6,7 @@ import lombok.AllArgsConstructor; ...@@ -6,6 +6,7 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.persistence.Column;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -85,6 +86,14 @@ public class CheckDetailVo { ...@@ -85,6 +86,14 @@ public class CheckDetailVo {
@ApiModelProperty(value = "上级审核人id") @ApiModelProperty(value = "上级审核人id")
private Integer userCId; private Integer userCId;
/**
* 审核人
*/
@ApiModelProperty(value = "checkC")
@Column(name = "checkC_name")
private String checkCName = "";
/** /**
* 核查时间 * 核查时间
*/ */
......
...@@ -18,6 +18,7 @@ import com.tykj.dev.device.confirmcheck.repository.DeviceCheckBillDao; ...@@ -18,6 +18,7 @@ import com.tykj.dev.device.confirmcheck.repository.DeviceCheckBillDao;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao; import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckPeriodDao; import com.tykj.dev.device.confirmcheck.repository.DeviceCheckPeriodDao;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao; import com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao;
import com.tykj.dev.device.confirmcheck.service.CheckUnitService;
import com.tykj.dev.device.confirmcheck.service.ConfirmCheckService; import com.tykj.dev.device.confirmcheck.service.ConfirmCheckService;
import com.tykj.dev.device.confirmcheck.utils.ObjTransUtil; import com.tykj.dev.device.confirmcheck.utils.ObjTransUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
...@@ -32,6 +33,7 @@ import com.tykj.dev.device.user.subject.dao.UnitsDao; ...@@ -32,6 +33,7 @@ import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.entity.Area; import com.tykj.dev.device.user.subject.entity.Area;
import com.tykj.dev.device.user.subject.entity.Units; import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User; import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserService; import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
...@@ -76,6 +78,9 @@ import static java.util.stream.Collectors.*; ...@@ -76,6 +78,9 @@ import static java.util.stream.Collectors.*;
@Service @Service
public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLineRunner { public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLineRunner {
@Autowired
private UnitsService unitsService;
@Autowired @Autowired
private DeviceCheckStatDao statDao; private DeviceCheckStatDao statDao;
...@@ -263,7 +268,7 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine ...@@ -263,7 +268,7 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
List<CheckDeviceStatVo> countyVo = regionMap.get(true); List<CheckDeviceStatVo> countyVo = regionMap.get(true);
// 市级数据 // 市级数据
Map<String, CheckDeviceStatVo> map = regionMap.get(false).stream() Map<String, CheckDeviceStatVo> map = regionMap.get(false).stream()
.collect(toMap(d -> d.getDeviceModel()+d.getDeviceName(), Function.identity())); .collect(toMap(d -> d.getDeviceModel() + d.getDeviceName(), Function.identity()));
//查找区域数据内的父级地区(即市),将数据count数据add进去(通过两次get),将areaList数据也加进去 //查找区域数据内的父级地区(即市),将数据count数据add进去(通过两次get),将areaList数据也加进去
...@@ -272,8 +277,8 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine ...@@ -272,8 +277,8 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
String cityName = areaCache.findFatherByName(couName).getName(); String cityName = areaCache.findFatherByName(couName).getName();
//把相同型号与名字的的区级的数据merge到市级即可,没有的话改个名加进去 //把相同型号与名字的的区级的数据merge到市级即可,没有的话改个名加进去
Integer cityStatId = areaStatIdMap.get(cityName); Integer cityStatId = areaStatIdMap.get(cityName);
map.computeIfPresent(v.getDeviceModel()+v.getDeviceName(), (k, value) -> value.reduce(v, cityName, cityStatId)); map.computeIfPresent(v.getDeviceModel() + v.getDeviceName(), (k, value) -> value.reduce(v, cityName, cityStatId));
map.computeIfAbsent(v.getDeviceModel()+v.getDeviceName(), k -> { map.computeIfAbsent(v.getDeviceModel() + v.getDeviceName(), k -> {
v.getAreaStatList().forEach(area -> area.setAreaName(cityName)); v.getAreaStatList().forEach(area -> area.setAreaName(cityName));
return v; return v;
}); });
...@@ -300,7 +305,7 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine ...@@ -300,7 +305,7 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
List<CheckDeviceStatVo> cityStatVo = new ArrayList<>(); List<CheckDeviceStatVo> cityStatVo = new ArrayList<>();
statVoListCopy2.stream() statVoListCopy2.stream()
.filter(stat -> cityNames.contains(stat.getAreaStatList().get(0).getAreaName())) .filter(stat -> cityNames.contains(stat.getAreaStatList().get(0).getAreaName()))
.collect(Collectors.groupingBy(d -> d.getDeviceModel()+d.getDeviceName(), reducing(CheckDeviceStatVo::reduce))) .collect(Collectors.groupingBy(d -> d.getDeviceModel() + d.getDeviceName(), reducing(CheckDeviceStatVo::reduce)))
.forEach((k, v) -> cityStatVo.add(v.get())); .forEach((k, v) -> cityStatVo.add(v.get()));
csd.setStatInfo(JacksonUtil.toJSon(cityStatVo)); csd.setStatInfo(JacksonUtil.toJSon(cityStatVo));
} }
...@@ -312,57 +317,67 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine ...@@ -312,57 +317,67 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
/** /**
* 根据关键字查询报告列表 * 根据关键字查询报告列表
*
* @return {@link CheckStatTableVo} 's List * @return {@link CheckStatTableVo} 's List
*/ */
@Override @Override
public Page<CheckStatTableVo> findAllStatTable(CheckBillSelectVo checkBillSelectVo) { public Page<CheckStatTableVo> findAllStatTable(CheckBillSelectVo checkBillSelectVo) {
//过滤出顶级节点 过滤逻辑是1.自己就是父节点2.自己的customInfo = exam or check //过滤出顶级节点 过滤逻辑是1.自己就是父节点2.自己的customInfo = exam or check
List<TaskBto> topStatList = taskService.findBillType(7); List<TaskBto> topStatList = taskService.findBillType(7);
List<Integer> topIdList = topStatList.stream() List<Integer> topIdList = topStatList.stream()
.filter(taskBto -> taskBto.getParentTaskId().equals(0) || taskBto.getParentTaskId() == null || taskBto.getCustomInfo().equals("exam")) .filter(taskBto -> {
if (unitsService.isProvUnit(checkBillSelectVo.getUnitId())) {
return (taskBto.getParentTaskId().equals(0) || taskBto.getParentTaskId() == null)
&& ("exam".equals(taskBto.getCustomInfo()) || "check".equals(taskBto.getCustomInfo()));
} else {
return taskBto.getBusinessType() == 7 && taskBto.getOwnUnit().equals(checkBillSelectVo.getUnitId());
}
})
.map(TaskBto::getBillId) .map(TaskBto::getBillId)
.collect(toList()); .collect(toList());
List<CheckStatTableVo> tableVos = statDao.findAll(checkBillSelectVo.getPageable().getSort()).stream() List<CheckStatTableVo> tableVos = statDao.findAll(checkBillSelectVo.getPageable().getSort()).stream()
.filter(deviceCheckStat -> !"[]".equals(deviceCheckStat.getStatInfo()))
.map(objTransUtil::stat2TableVo) .map(objTransUtil::stat2TableVo)
.filter(vo -> keywordFilter(vo, checkBillSelectVo.getKeyword())) .filter(vo -> keywordFilter(vo, checkBillSelectVo.getKeyword()))
.filter(v->topIdList.contains(v.getId())) .filter(v -> topIdList.contains(v.getId()))
.filter(v1->unitIdFilter(v1,checkBillSelectVo.getUnitId())) .filter(v1 -> unitIdFilter(v1, checkBillSelectVo.getUnitId()))
.collect(Collectors.toList()); .collect(Collectors.toList());
//市级需要添加详情账单信息 //市级需要添加详情账单信息
Units unit = unitsRepo.findById(checkBillSelectVo.getUnitId()).get(); // Units unit = unitsRepo.findById(checkBillSelectVo.getUnitId()).get();
if(unit.getLevel() == 2) { // if (unit.getLevel() == 2) {
Specification<DeviceCheckDetail> pred = Specifications.<DeviceCheckDetail>and() // Specification<DeviceCheckDetail> pred = Specifications.<DeviceCheckDetail>and()
.eq("checkUnitId", checkBillSelectVo.getUnitId()) // .eq("checkUnitId", checkBillSelectVo.getUnitId())
.build(); // .build();
List<CheckDetailVo> detailVoList = detailRepo.findAll(pred).stream() // List<CheckDetailVo> detailVoList = detailRepo.findAll(pred).stream()
.map(transUtil::CheckDetailDo2Vo) // .map(transUtil::CheckDetailDo2Vo)
.collect(toList()); // .collect(toList());
List<CheckStatTableVo> cityDetailToStatList = detailVoList.stream().map(checkDetailVo -> { // List<CheckStatTableVo> cityDetailToStatList = detailVoList.stream().map(checkDetailVo -> {
CheckStatTableVo checkStatTableVo = new CheckStatTableVo(); // CheckStatTableVo checkStatTableVo = new CheckStatTableVo();
checkStatTableVo.setId(checkDetailVo.getId()); // checkStatTableVo.setId(checkDetailVo.getId());
String[] titles = checkDetailVo.getTitle().split("\\%\\^\\&"); // String[] titles = checkDetailVo.getTitle().split("\\%\\^\\&");
if(titles.length > 1) { // if (titles.length > 1) {
checkStatTableVo.setTitle(titles[1]); // checkStatTableVo.setTitle(titles[1]);
} // }
checkStatTableVo.setShowType(1); //
checkStatTableVo.setCreateTime(TimestampUtil.dateToLocalDateTime(checkDetailVo.getCheckTime())); // checkStatTableVo.setShowType(1);
//设置完成情况 // checkStatTableVo.setCreateTime(TimestampUtil.dateToLocalDateTime(checkDetailVo.getCheckTime()));
List<TaskUserVo> taskUserVos = taskService.findByBillIdAndBusinessType(checkDetailVo.getId(), 8) // //设置完成情况
.stream().map(Task::parse2Bto).map(TaskBto::toVo).collect(toList()); // List<TaskUserVo> taskUserVos = taskService.findByBillIdAndBusinessType(checkDetailVo.getId(), 8)
if (taskUserVos.size() == 1) { // .stream().map(Task::parse2Bto).map(TaskBto::toVo).collect(toList());
checkStatTableVo.setCompletion(taskUserVos.get(0).getStatus()); // if (taskUserVos.size() == 1) {
} // checkStatTableVo.setCompletion(taskUserVos.get(0).getStatus());
return checkStatTableVo; // }
}).collect(toList()); // return checkStatTableVo;
tableVos.addAll(cityDetailToStatList); // }).collect(toList());
} // tableVos.addAll(cityDetailToStatList);
// }
return PageUtil.getPerPage(checkBillSelectVo.getPage(),checkBillSelectVo.getSize(),tableVos,checkBillSelectVo.getPageable());
return PageUtil.getPerPage(checkBillSelectVo.getPage(), checkBillSelectVo.getSize(), tableVos, checkBillSelectVo.getPageable());
} }
...@@ -537,7 +552,7 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine ...@@ -537,7 +552,7 @@ public class ConfirmCheckServiceImpl implements ConfirmCheckService, CommandLine
if (unitId == null) { if (unitId == null) {
return true; return true;
} else { } else {
TaskBto taskBto=taskService.findByBillIdAndBusinessTypeIsNotCustomInfo(vo.getId(),7); TaskBto taskBto = taskService.findByBillIdAndBusinessTypeIsNotCustomInfo(vo.getId(), 7);
List<Integer> userIds = userService.findAllByUnite(unitId).stream().map(User::getUserId).collect(toList()); List<Integer> userIds = userService.findAllByUnite(unitId).stream().map(User::getUserId).collect(toList());
userIds.retainAll(taskBto.getInvolveUserIdList()); userIds.retainAll(taskBto.getInvolveUserIdList());
return taskBto.getOwnUnit().equals(unitId); return taskBto.getOwnUnit().equals(unitId);
......
...@@ -1268,7 +1268,7 @@ public class TaskServiceImpl implements TaskService { ...@@ -1268,7 +1268,7 @@ public class TaskServiceImpl implements TaskService {
.filter(o -> { .filter(o -> {
if (o.getExhibit() == null) { if (o.getExhibit() == null) {
return true; return true;
} else return !o.getExhibit().equals("-1"); } else {return !o.getExhibit().equals("-1");}
}) })
.map(Task::parse2Bto) .map(Task::parse2Bto)
.collect(Collectors.toList()); .collect(Collectors.toList());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论