提交 0cb1a683 authored 作者: ljj's avatar ljj

fix(screen): 修改核查大屏地图的bug

上级 f63bcc44
......@@ -7,6 +7,7 @@ import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.TimestampUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Value;
......@@ -38,6 +39,7 @@ import java.util.stream.Collectors;
@ApiModel("核查详情")
@NoArgsConstructor
@Table(name = "device_check_detail")
@AllArgsConstructor
public class DeviceCheckDetail extends BaseEntity {
/**
......
......@@ -10,6 +10,8 @@ import com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao;
import com.tykj.dev.device.confirmcheck.service.CheckScreenService;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.subject.entity.Units;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
......@@ -37,6 +39,8 @@ public class CheckScreenServiceImpl implements CheckScreenService {
private TaskDao taskDao;
@Autowired
private DeviceCheckStatDao statDao;
@Autowired
private UnitsCache unitsCache;
@Override
public List<CheckUnitInfo> statMapData() {
......@@ -50,7 +54,7 @@ public class CheckScreenServiceImpl implements CheckScreenService {
List<DeviceCheckStat> statList = statDao.findAll(and.build());
// 查询task,所有的顶级任务
// 查询task,所有的顶级任务,过滤掉已结束或已终止的任务
List<Task> tasks = taskDao.findAllByBillIdInAndBusinessTypeAndBillStatusNotIn(
statList.parallelStream().map(DeviceCheckStat::getId).collect(Collectors.toList()),
7,
......@@ -61,23 +65,29 @@ public class CheckScreenServiceImpl implements CheckScreenService {
List<CheckUnitInfo> rs = new ArrayList<>();
for (Task task : tasks) {
List<Task> secondTasks = taskDao.findAllByParentTaskId(task.getId());
// 过滤掉已完成的二级任务
List<Task> secondTasks = taskDao.findAllByParentTaskId(task.getId()).stream()
.filter(o -> o.getBillStatus() != 9999 || o.getBillStatus() != 20001)
.collect(Collectors.toList());
for (Task secondTask : secondTasks) {
if (secondTask.getBusinessType() == 8) {
CheckUnitInfo c = CheckFill(initCheckUnitInfo(task,task.getBillId()), secondTask, task.getBillId());
rs.add(c);
log.error("[check] 核查地图统计发现错误数据: task id:{}", secondTask.getId());
} else {
List<Task> threeTasks = taskDao.findAllByParentTaskId(secondTask.getId());
List<Task> threeTasks = taskDao.findAllByParentTaskId(secondTask.getId()).stream()
.filter(o -> o.getBillStatus() != 9999 || o.getBillStatus() != 20001)
.collect(Collectors.toList());
for (Task threeTask : threeTasks) {
if (threeTask.getBusinessType() == 8) {
if (threeTask.getBusinessType() == 8 ) {
CheckUnitInfo c = CheckFill(initCheckUnitInfo(task, task.getBillId()), threeTask, task.getBillId());
if (c != null) {
rs.add(c);
}
}
}
}
}
}
return rs;
......@@ -102,30 +112,52 @@ public class CheckScreenServiceImpl implements CheckScreenService {
private CheckUnitInfo CheckFill(CheckUnitInfo checkUnitInfo, Task task, Integer bigBillId) {
Units byId = unitsCache.findById(task.getOwnUnit());
// detail 数据
DeviceCheckDetail detail = detailDao.findById(task.getBillId()).orElse(new DeviceCheckDetail());
if (detail.isReview() && (task.getBillStatus() == 9999 || task.getBillStatus() == 20001)) {
// 如果不是待核查,不统计
return null;
}
checkUnitInfo.setBillId(bigBillId);
checkUnitInfo.setUnitId(task.getOwnUnit());
if (task.getBillStatus() == 120 ||task.getBillStatus() == 140) {
log.info("big task :{},task bill id:{}, 状态:{}", bigBillId, task.getBillId(), task.getBillStatus());
if (task.getBillStatus() == 140 ||task.getBillStatus() == 160) {
checkUnitInfo.setCheckOneInfo(0);
checkUnitInfo.setCheckTwoInfo(0);
checkUnitInfo.setCheckThreeInfo(0);
} else if (task.getBillStatus() == 160) {
} else if (task.getBillStatus() == 120) {
checkUnitInfo.setCheckOneInfo(0);
checkUnitInfo.setCheckTwoInfo(0);
checkUnitInfo.setCheckThreeInfo(-1);
} else if (task.getBillStatus() == 121 ||task.getBillStatus() == 141 ) {
} else if (task.getBillStatus() == 141 ||task.getBillStatus() == 161 ) {
checkUnitInfo.setCheckOneInfo(1);
checkUnitInfo.setCheckTwoInfo(0);
checkUnitInfo.setCheckThreeInfo(0);
} else if (task.getBillStatus() == 161) {
} else if (task.getBillStatus() == 121) {
checkUnitInfo.setCheckOneInfo(1);
checkUnitInfo.setCheckTwoInfo(0);
checkUnitInfo.setCheckThreeInfo(-1);
} else if (task.getBillStatus() == 122 ||task.getBillStatus() == 142) {
} else if (task.getBillStatus() == 142 ||task.getBillStatus() == 162) {
checkUnitInfo.setCheckOneInfo(1);
checkUnitInfo.setCheckTwoInfo(1);
checkUnitInfo.setCheckThreeInfo(0);
} else if (task.getBillStatus() == 9999 && !detail.isReview()) {
checkUnitInfo.setCheckOneInfo(1);
checkUnitInfo.setCheckTwoInfo(1);
checkUnitInfo.setCheckThreeInfo(0);
Units units = unitsCache.findById(task.getOwnUnit());
if (units.getLevel() == 1 || units.getEscrow() == 1) {
checkUnitInfo.setCheckThreeInfo(-1);
}
}
return checkUnitInfo;
......
......@@ -105,7 +105,7 @@ public class CheckMapTask implements CommandLineRunner {
.code(regionData.getCode())
.unitId(qu.getUnitId())
.unitName(qu.getName())
.data(collect.get(units.getUnitId()))
.data(collect.get(qu.getUnitId()))
.build();
childrenData.add(build);
}
......
......@@ -31,8 +31,6 @@ public class RegionUtil {
List<RegionData> shis = regionDataDao.findAllByParentId(ZJ_ID);
shis.forEach(o -> o.setRegionDatas(regionDataDao.findAllByParentId(o.getRegionId())));
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论