提交 cf22e642 authored 作者: ljj's avatar ljj

feat(screen): 新增自核查展示

上级 ba556686
......@@ -14,10 +14,12 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
......@@ -36,6 +38,7 @@ public class CheckScreenServiceImpl implements CheckScreenService {
@Autowired
private DeviceCheckStatDao statDao;
@Override
public List<CheckUnitInfo> statMapData() {
......@@ -46,8 +49,13 @@ public class CheckScreenServiceImpl implements CheckScreenService {
// 查询到所有快过期到统计任务
List<DeviceCheckStat> statList = statDao.findAll(and.build());
// 查询task,所有的顶级任务
List<Task> tasks = taskDao.findAllByBillIdInAndBusinessType(statList.parallelStream().map(DeviceCheckStat::getId).collect(Collectors.toList()), 7)
List<Task> tasks = taskDao.findAllByBillIdInAndBusinessTypeAndBillStatusNotIn(
statList.parallelStream().map(DeviceCheckStat::getId).collect(Collectors.toList()),
7,
Arrays.asList(20001, 9999)
)
.parallelStream().filter(o -> o.getParentTaskId() == 0).collect(Collectors.toList());
List<CheckUnitInfo> rs = new ArrayList<>();
......@@ -57,13 +65,13 @@ public class CheckScreenServiceImpl implements CheckScreenService {
for (Task secondTask : secondTasks) {
if (secondTask.getBusinessType() == 8) {
CheckUnitInfo c = CheckFill(initCheckUnitInfo(task), secondTask);
CheckUnitInfo c = CheckFill(initCheckUnitInfo(task,task.getBillId()), secondTask, task.getBillId());
rs.add(c);
} else {
List<Task> threeTasks = taskDao.findAllByParentTaskId(secondTask.getId());
for (Task threeTask : threeTasks) {
if (threeTask.getBusinessType() == 8) {
CheckUnitInfo c = CheckFill(initCheckUnitInfo(task), threeTask);
CheckUnitInfo c = CheckFill(initCheckUnitInfo(task, task.getBillId()), threeTask, task.getBillId());
rs.add(c);
}
}
......@@ -75,11 +83,12 @@ public class CheckScreenServiceImpl implements CheckScreenService {
}
private CheckUnitInfo initCheckUnitInfo(Task task) {
private CheckUnitInfo initCheckUnitInfo(Task task,Integer billId) {
DeviceCheckStat stat = statDao.findById(billId).get();
CheckUnitInfo checkUnitInfo = new CheckUnitInfo();
DeviceCheckStat deviceCheckStat = statDao.findById(task.getId()).orElse(new DeviceCheckStat());
checkUnitInfo.setStartTime(deviceCheckStat.getStartTime());
checkUnitInfo.setEndTime(deviceCheckStat.getEndTime());
checkUnitInfo.setStartTime(stat.getStartTime());
checkUnitInfo.setEndTime(stat.getEndTime());
checkUnitInfo.setUnitId(task.getOwnUnit());
// 判断是检查还是核查
if ("check".equals(task.getCustomInfo())) {
......@@ -92,17 +101,21 @@ public class CheckScreenServiceImpl implements CheckScreenService {
}
private CheckUnitInfo CheckFill(CheckUnitInfo checkUnitInfo, Task task) {
private CheckUnitInfo CheckFill(CheckUnitInfo checkUnitInfo, Task task, Integer bigBillId) {
DeviceCheckDetail detail = detailDao.findById(task.getBillId()).orElse(new DeviceCheckDetail());
checkUnitInfo.setBillId(task.getBillId());
if (detail.getUserAId() != null) {
checkUnitInfo.setBillId(bigBillId);
checkUnitInfo.setUnitId(task.getOwnUnit());
if (detail.getUserAId() != null && detail.getUserAId() != 0) {
checkUnitInfo.setCheckOneInfo(1);
}
if (detail.getUserBId() != null) {
if (detail.getUserBId() != null && detail.getUserAId() != 0 ) {
checkUnitInfo.setCheckTwoInfo(1);
}
if (detail.getUserCId() != null) {
if (detail.getUserCId() != null && detail.getUserAId() != 0 ) {
checkUnitInfo.setCheckThreeInfo(1);
} else {
checkUnitInfo.setCheckThreeInfo(0);
}
return checkUnitInfo;
}
......
......@@ -12,10 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
......@@ -35,7 +32,7 @@ public class ScreenController {
private CheckMapTask checkMapTask;
@ApiOperation(value = "自核查接口", notes = "添加系统配置变量值")
@PostMapping(value = "/check")
@GetMapping(value = "/check")
public ResponseEntity<HashMap<String, List<MapCheckVO>>> add() {
return ResponseEntity.ok(checkMapTask.getData());
}
......
......@@ -67,7 +67,7 @@ public class CheckMapTask implements CommandLineRunner {
public void initArea() {
List<String> strUnit = Arrays.asList("浙江省","省直属", "省局");
List<String> strUnit = Arrays.asList("省机要局","省直属");
for (String s : strUnit) {
List<Units> units = findUnitByArea(s);
List<MapCheckVO> objects = new ArrayList<>();
......@@ -150,13 +150,16 @@ public class CheckMapTask implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
log.info("加载地区信息");
initShi();
initAll();
}
public void initAll() {
initShi();
init();
long startTime = System.currentTimeMillis();
log.info("开始计算数据", System.currentTimeMillis() - startTime);
log.info("开始计算数据");
initArea();
log.info("计算数据,用时:{}ms", System.currentTimeMillis() - startTime);
log.info("打印{}",rs.toString());
......
......@@ -107,4 +107,6 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
List<Task> findAllByBusinessTypeAndOwnUnitAndCustomInfo(Integer businessType, Integer ownUnit,String customInfo);
List<Task> findAllByIdIn(List<Integer> ids);
List<Task> findAllByBillIdInAndBusinessTypeAndBillStatusNotIn(List<Integer> ids,Integer type, List<Integer> status);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论