提交 0bc0f828 authored 作者: ljj234's avatar ljj234

refactor: 修改核查模块,市自动转发个区

上级 f9d3f845
......@@ -366,19 +366,19 @@ public class DeviceCheckController {
// todo
// 代管 - 如果当前自查为省本级自查,则需要将被代管的装备加入到省本级
Units unit = unitsRepo.findByName(checkUnit);
boolean isProv = unit.getLevel() == 1 && unit.getType() == 1;
if (isProv) {
//获得所有的需要被代管的单位的在库与非在库装备,添加到省本级的在库与非在库中去
List<Units> escrowUnits = unitsRepo.findByTypeAndEscrow(2, 1);
for (Units eu : escrowUnits) {
log.info("[核查模块] 正在将 {} 单位的装备托管代理到 {} 单位", checkUnit, eu.getName());
Map<Boolean, List<DeviceLibrary>> libMap = getDevLibMap(eu.getName(), allDevices);
devInLib.addAll(libMap.get(true));
devNotInLib.addAll(libMap.get(false));
}
}
// Units unit = unitsRepo.findByName(checkUnit);
// boolean isProv = unit.getLevel() == 1 && unit.getType() == 1;
// if (isProv) {
// //获得所有的需要被代管的单位的在库与非在库装备,添加到省本级的在库与非在库中去
// List<Units> escrowUnits = unitsRepo.findByTypeAndEscrow(2, 1);
// for (Units eu : escrowUnits) {
// log.info("[核查模块] 正在将 {} 单位的装备托管代理到 {} 单位", checkUnit, eu.getName());
// Map<Boolean, List<DeviceLibrary>> libMap = getDevLibMap(eu.getName(), allDevices);
// devInLib.addAll(libMap.get(true));
// devNotInLib.addAll(libMap.get(false));
// }
//
// }
detail.updateDevice(devInLib, devNotInLib);
......@@ -397,6 +397,8 @@ public class DeviceCheckController {
* 1-1 省核查页面 - 市的检查以及省直属的自查任务
* 2 - 详情跳转
*
* type: 1_省核查 2_两级的省检查 3_核查下面的市检查 4_市检查
*
* @param type 7 统计
* @param billId 业务id
* @return
......@@ -513,21 +515,45 @@ public class DeviceCheckController {
String areaName = auService.findOne(AuExample.UnitId, child.getOwnUnit()).getName();
LinkCheckDetail lcd = cas2lcd(totalList, child, cctask, areaName);
lcd.setCheckUnit(unitName);
// 需修改省局单位和省直单位
lcd.setCheckUnit(areaName);
if (unitsService.isProvUnit(child.getOwnUnit())) {
String[] split = child.getTitle().split("]");
String replace = split[0].replace("[", "");
lcd.setCheckUnit(replace);
}
if (child.getTitle().contains("统计确认待办任务")) {
lcd.setCheckSituation("统计确认待办任务");
}
lcdList.add(lcd);
LinkExamDetail led = lcd.toLed();
ledList.add(led);
finalTime = System.currentTimeMillis();
log.info("[TEST] child-BILL id = {}的检查任务 , COST {} MS", child.getBillId(), finalTime - startTime);
} else {
// 处理detail
log.info("[处理子节点] 子节点为自查类子节点");
startTime = System.currentTimeMillis();
// 省直属 ,省本级自查
// 直属自查 -> detail里面找
DeviceCheckDetail childDetail = detailRepo.findById(childBusId).get();
Units checkUnit = unitsRepo.findById(childDetail.getCheckUnitId()).get();
if ((checkUnit.getType() == 1 && checkUnit.getLevel() == 1)
|| (checkUnit.getLevel() == 1 && checkUnit.getType() == 2)
|| (checkUnit.getLevel() == 4 && checkUnit.getType() == 2)
) {
linkVo.setType(1);
} else {
linkVo.setType(3);
}
String unitName = unitsRepo.findById(childDetail.getCheckUnitId()).get().getName();
List<CheckDeviceStatVo> list = parseStatString2Vo(child.parse2Bto(), childDetail);
......@@ -550,6 +576,8 @@ public class DeviceCheckController {
LinkExamDetail led = cas2led(cas, child, endTime, updateTime);
led.setCheckUnit(unitName);
led.setExamName("默认单位");
led.setExamUser("默认检查人");
ledList.add(led);
finalTime = System.currentTimeMillis();
......@@ -567,8 +595,6 @@ public class DeviceCheckController {
Integer ownUnit = rootTask.getOwnUnit();
if (unitsService.isProvUnit(ownUnit)) {
linkVo.setType(2);
} else if (rootTask.getParentTaskId() != 0) {
linkVo.setType(3);
} else {
linkVo.setType(4);
}
......@@ -584,7 +610,7 @@ public class DeviceCheckController {
// 这里只显示detail任务
if (child.getBusinessType() == CONFIRM_CHECK_STAT.id) {
lcdList.add(LinkCheckDetail.builder()
ledList.add(LinkExamDetail.builder()
.checkResult("无误")
.checkUnit(unitsRepo.findById(child.getOwnUnit()).get().getName())
.checkSituation("211")
......
......@@ -156,10 +156,16 @@ public class ExamController {
@GetMapping("/confirm/unit")
@ApiOperation(value = "查询默认的可以被核查单位的清单(省本直,省直属,市局),同时过滤掉那些已经被代管的单位")
public ResponseEntity findDefaultUnits(@RequestParam(defaultValue = "false") boolean isExam) {
Map<Integer, List<Units>> checkUnit = checkUnitService.findCheckUnit(isExam);
// 需要去除掉被托管的单位
return ResponseEntity.ok(new ResultObj<>(checkUnit));
public ResponseEntity findDefaultUnits(@RequestParam(defaultValue = "false") boolean isExam,
@RequestParam(defaultValue = "1") Integer unitId) {
if (unitsService.isProvUnit(unitId)){
Map<Integer, List<Units>> checkUnit = checkUnitService.findCheckUnit(isExam);
// 需要去除掉被托管的单位
return ResponseEntity.ok(new ResultObj<>(checkUnit));
} else {
return ResponseEntity.ok(new ResultObj<>(ImmutableMap.of(1,unitsService.findBySubordinateNotOneself(unitId))));
}
}
@ApiOperation(value = "发起核查", notes = "对指定单位发起核查任务")
......@@ -214,7 +220,7 @@ public class ExamController {
}
// 拼接检查组和检查组成员
String groupUserString = "默认检查组,默认人员";
String groupUserString = "默认检查";
List<Integer> unitIds = examDetailVos.stream().flatMap(cv -> cv.getUnitIds().stream()).collect(toList());
List<Units> checkedUnits = unitsRepo.findAllById(unitIds);
......@@ -272,14 +278,13 @@ public class ExamController {
// 3-1-1 创建省局单位的统计账单
DeviceCheckStat proStat = new DeviceCheckStat(ceVo.getTitle(), "", LocalDateTime.now(), ceVo.getEndTime().atStartOfDay(),
"[]", 0, 0, ceVo.getDetail().get(0).getRemark());
"[]", 0, 0, "默认检查");
proStat.setCheckType(isExam ? CheckType.CT_EXAM : CheckType.CT_CHECK);
DeviceCheckStat proStatSave = statRepo.save(proStat);
// 3-1-2 构建省局单位的任务
TaskBto taskBtoPro = new Task(CHECK_EXAM_STAT_1.id,
// getUnitDateString(startUnit , ceVo.getTitle()),
getUnitDateString(startUnit, "省局单位检查任务"),
"[省局单位]" + ceVo.getTitle(),
cityStatTask.getId(), ".0.", CONFIRM_CHECK_STAT.id, proStatSave.getId(), startUnitId)
.parse2Bto();
taskBtoPro.setCustomInfo(isExam ? "exam" : "check");
......@@ -288,11 +293,13 @@ public class ExamController {
taskBtoPro.getInvolveUserIdList().add(0);
taskBtoPro.setCurrentPoint(1);
// 不在代办中显示
taskBtoPro.setRemark("-1");
taskBtoPro.setExhibit("-1");
taskBtoPro = taskService.start(taskBtoPro);
// 3-1-3 构建省级单位的自查账单及任务
List<Units> unitsPro = checkedUnits.stream().filter(o -> o.getLevel() == 1 && o.getType() == 2).collect(toList());
List<Units> unitsPro = checkedUnits.stream()
.filter(o -> (o.getLevel() == 1 && o.getType() == 2) || (o.getType() == 1 && o.getLevel() == 1))
.collect(toList());
log.info("[核查] 生成省局统计及详情:{}",unitsPro.toString());
......@@ -332,7 +339,7 @@ public class ExamController {
if (checkTypeNum(ceVo.getDetail().get(0).getUnitIds(), 2)) {
// 3-1-1 创建省直单位的统计账单
DeviceCheckStat esStat = new DeviceCheckStat(ceVo.getTitle(), "", LocalDateTime.now(), ceVo.getEndTime().atStartOfDay(),
"[]", 0, 0, ceVo.getDetail().get(0).getRemark());
"[]", 0, 0, "默认检查");
esStat.setCheckType(isExam ? CheckType.CT_EXAM : CheckType.CT_CHECK);
DeviceCheckStat esStatSave = statRepo.save(esStat);
......@@ -381,18 +388,18 @@ public class ExamController {
unitsRepo.findAllByTypeAndLevel(1, 1).get(0).getUnitId(),
0);
checkedTask.setCustomInfo("manual");
checkedTask.setRemark("-1");
checkedTask.setExhibit("-1");
taskService.start(checkedTask);
}
}
// 3-3 创建市单位的账单及详情,并且发起单位为省局
if (checkTypeNum(ceVo.getDetail().get(0).getUnitIds(), 3)
if (isExam && checkTypeNum(ceVo.getDetail().get(0).getUnitIds(), 3)
&& (ceVo.getUnitId().equals(unitsRepo.findAllByTypeAndLevel(1, 1).get(0).getUnitId()))) {
// 3-1-1 创建市里的的统计账单
DeviceCheckStat ciyStat = new DeviceCheckStat(ceVo.getTitle(), "", LocalDateTime.now(), ceVo.getEndTime().atStartOfDay(),
"[]", 0, 0, ceVo.getDetail().get(0).getRemark());
"[]", 0, 0, "默认检查");
ciyStat.setCheckType(isExam ? CheckType.CT_EXAM : CheckType.CT_CHECK);
DeviceCheckStat cityStatSave = statRepo.save(ciyStat);
......@@ -406,7 +413,7 @@ public class ExamController {
// 检查变为待办
taskBtoCity.getInvolveUserIdList().add(0);
taskBtoCity.setCurrentPoint(1);
taskBtoCity.setRemark("-1");
taskBtoCity.setExhibit("-1");
taskBtoCity = taskService.start(taskBtoCity);
// 3-1-3 构建市单位的自查账单及任务
......@@ -448,7 +455,7 @@ public class ExamController {
// 3-4 (before) 核查时对市县进行核查的逻辑,需判断是否勾选了市级单位
if(!isExam && (checkedUnits.stream().anyMatch(o -> o.getLevel() == 2))) {
// 找到市相关的单位,包括市本级以及下级单位
// 找到市相关的单位,包括市本级以及下级单位
List<Units> units = checkedUnits.stream().filter(o -> o.getLevel() == 2).collect(toList());
log.info("[核查] 核查,生成市的统计及详情:{}",units.toString());
......@@ -466,13 +473,13 @@ public class ExamController {
// 1.创建市的统计账单及任务
// 3-1-1 创建市里的的统计账单
DeviceCheckStat ciyStat = new DeviceCheckStat(ceVo.getTitle(), "", LocalDateTime.now(), ceVo.getEndTime().atStartOfDay(),
"[]", 0, 0, ceVo.getDetail().get(0).getRemark());
"[]", 0, 0, "默认核查_市级统计任务");
ciyStat.setCheckType(CheckType.CT_CHECK);
DeviceCheckStat cityStatSave = statRepo.save(ciyStat);
// 3-1-2 构建市单位的任务
TaskBto taskBtoCity = new Task(CHECK_EXAM_STAT_1.id,
getUnitDateString(startUnit, ceVo.getTitle()),
getUnitDateString(unit, ceVo.getTitle()),
cityStatTask.getId(), ".0.", CONFIRM_CHECK_STAT.id, cityStatSave.getId(),
unit.getUnitId()).parse2Bto();
taskBtoCity.setCustomInfo("check");
......@@ -519,15 +526,23 @@ public class ExamController {
}
// 判断当前登录用户是否为市级
Optional<Units> byId = unitsRepo.findById(authenticationUtils.getAuthentication().getCurrentUserInfo().getUnitsId());
boolean cityExam = false;
if (byId.isPresent()){
if(byId.get().getLevel() == 2 && byId.get().getType() == 1) {
cityExam = true;
}
}
// 3-4 创建区单位的账单及详情,只有市发起检查时才触发这里的代码
if (checkTypeNum(ceVo.getDetail().get(0).getUnitIds(), 4) && isExam) {
if (checkTypeNum(ceVo.getDetail().get(0).getUnitIds(), 4) && isExam && cityExam) {
// a 构建区单位的自查账单及任务
List<Units> unitsEs = checkedUnits.stream().filter(o -> o.getLevel() == 3).collect(toList());
log.info("[核查] 检查,生成区的统计及详情:{}",unitsEs.toString());
for (Units unit : unitsEs) {
DeviceCheckDetail unitDetailDoc = DeviceCheckDetail.EmptyWithChecker(
......@@ -559,47 +574,7 @@ public class ExamController {
}
}
// 4. 构建直属单位的统计,只有省会发起直属单位的检查/核查,不涉及转发,因此examStatId = 0,且unit 的level = 1,type =1时才会触发
// if (ceVo.getExamStatId() == 0 && startUnit.getType() == 1 && startUnit.getLevel() == 1) {
//
// DeviceCheckStat escrowStat = initStatData(
// checkedUnitNames,
// ceVo.getTitle(),
// groupUserString,
// 0,
// 0,
// startUnit.getName(),
// checkedUnits,
// ceVo.getEndTime().atStartOfDay()
// );
// escrowStat.setSubtitle("省直属单位待核查装备统计单");
// DeviceCheckStat esSaveStat = statRepo.save(escrowStat);
//
// TaskBto esTaskBto;
//
// esTaskBto = new Task(CHECK_EXAM_STAT_0.id,
// "[省直属单位]" + ceVo.getTitle(),
// cityStatTask.getId(), ".0.", CONFIRM_CHECK_STAT.id, esSaveStat.getId(), startUnitId)
// .parse2Bto();
//
// esTaskBto.setCustomInfo("exam");
// esTaskBto.getInvolveUserIdList().add(currentUserId);
// // 检查变为待办
// esTaskBto.getInvolveUserIdList().add(0);
// esTaskBto.setCurrentPoint(1);
// TaskBto start = taskService.start(esTaskBto);
//
// Optional<List<Task>> esTask = taskRepo.findAllByOwnUnitInAndParentTaskId(esIds, cityStatTask.getId());
// if (esTask.isPresent()) {
// List<Task> tasks = esTask.get();
// tasks.forEach(o -> o.setParentTaskId(start.getId()));
// taskRepo.saveAll(tasks);
// }
// }
// 5. 重新设置并保存统计账单
statRepo.save(provinceCheckStat);
log.info("[核查模块] {}单位成功发起对 {} 单位的检查任务分发", startUnit.getName(), checkedUnitNames);
return ResponseEntity.ok(new ResultObj<>(
ImmutableMap.of("statIds", statId, "detailIds", detailIds),
......
......@@ -162,6 +162,7 @@ public class DeviceCheckDetail extends BaseEntity {
private List<FileRet> checkFileList = new ArrayList<>();
@ApiModelProperty(value = "手持终端信息字段")
@Column(name = "checkC_name")
private String checkCName = "";
/**
......
package com.tykj.dev.device.confirmcheck.entity.vo;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
import com.tykj.dev.misc.base.BeanHelper;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper;
/**
* LinkCheckDetail.
......@@ -29,4 +32,12 @@ public class LinkCheckDetail {
private String checkResult;
private int remark;
public LinkExamDetail toLed() {
ModelMapper mapper = BeanHelper.getUserMapper();
LinkExamDetail detail = mapper.map(this, LinkExamDetail.class);
detail.setExamName("");
detail.setExamUser("");
return detail;
}
}
package com.tykj.dev.device.confirmcheck.entity.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -13,6 +14,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
public class LinkExamDetail {
/**
......
......@@ -1265,6 +1265,11 @@ public class TaskServiceImpl implements TaskService {
&& (!task.getBillStatus().equals(StatusEnum.ARCHIVE.id))
&& (!task.getBillStatus().equals(StatusEnum.REVOKEALLOTTASK.id))
&& (!task.getBillStatus().equals(StatusEnum.CHECK_SHUT_DOWN.id)))
.filter(o -> {
if (o.getExhibit() == null) {
return true;
} else return !o.getExhibit().equals("-1");
})
.map(Task::parse2Bto)
.collect(Collectors.toList());
//查询待办
......@@ -1279,8 +1284,7 @@ public class TaskServiceImpl implements TaskService {
boolean belongUnit = taskBto.getOwnUnit().equals(userUtils.getCurrentUnitId());
boolean isCountry = taskSelectVo.getType() == null || (taskSelectVo.getType() == 1 ? (taskBto.getCustomInfo() == null || (!"country".equals(taskBto.getCustomInfo()) && !"country1".equals(taskBto.getCustomInfo()))) : (taskBto.getCustomInfo() != null && ("country".equals(taskBto.getCustomInfo()) || "country1".equals(taskBto.getCustomInfo()))));
return involveExists && pointExists && (userConfirm || (noUserHandle && belongUnit)) && isCountry;
}).filter(o -> !(o.getBusinessType() == 7 && "-1".equals(o.getRemark()))).filter(o -> !(o.getBusinessType() == 8 && "-1".equals(o.getRemark())))
})
.collect(Collectors.toList());
//查询所有的业务
if (bussinessType == null ||bussinessType.isEmpty()) {
......
......@@ -81,6 +81,9 @@ public class TaskBto {
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "是否展示")
private String exhibit;
public TaskBto(Integer billStatus, String title, Integer parentTaskId, String nodeIdDetail, Integer billId, Integer businessType, Integer ownUnit, Integer currentPoint, String customInfo, List<Integer> involveUserIdList) {
this.billStatus = billStatus;
this.title = title;
......@@ -109,6 +112,21 @@ public class TaskBto {
this.currentPoint = 0;
}
public TaskBto(Integer status, String title, Integer parentTaskId, String nodeIdDetail, Integer businessType, Integer billId, Integer ownUnit, int startUserId, String exhibit) {
this.billStatus = status;
this.title = title;
this.parentTaskId = parentTaskId;
this.nodeIdDetail = nodeIdDetail;
this.businessType = businessType;
this.billId = billId;
this.ownUnit = ownUnit;
List<Integer> involveUserIdList = new ArrayList<>();
involveUserIdList.add(startUserId);
this.involveUserIdList = involveUserIdList;
this.currentPoint = 0;
this.exhibit = exhibit;
}
/**
* bto类转化为do类
*/
......
......@@ -105,6 +105,9 @@ public class Task {
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "是否展示")
private String exhibit;
public Task(String title, Integer parentTaskId, String nodeIdDetail, Integer businessType, Integer billId, Integer ownUnit) {
this.title = title;
this.parentTaskId = parentTaskId;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论