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

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

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