Commit d0d46010 authored by 韩桐桐's avatar 韩桐桐

BUG :28134,28137

parent 878a903b
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
LEFT JOIN p_plan_task ppt ON pc.plan_task_id = ppt.id LEFT JOIN p_plan_task ppt ON pc.plan_task_id = ppt.id
LEFT JOIN p_check_input pci ON pc.id = pci.check_id LEFT JOIN p_check_input pci ON pc.id = pci.check_id
LEFT JOIN p_input_item pii ON pci.input_id = pii.id LEFT JOIN p_input_item pii ON pci.input_id = pii.id
LEFT JOIN p_check_shot pcs ON pci.check_id = pcs.check_id LEFT JOIN p_check_shot pcs ON pc.id = pcs.check_id
WHERE WHERE
pc.plan_task_id = #{planTaskId} pc.plan_task_id = #{planTaskId}
</select> </select>
......
...@@ -15,7 +15,6 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; ...@@ -15,7 +15,6 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.TzBaseEnterpriseInfoDto; import com.yeejoin.amos.boot.module.statistics.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.statistics.api.entity.TzBaseEnterpriseInfo; import com.yeejoin.amos.boot.module.statistics.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.statistics.api.entity.TzsBaseInstitution; import com.yeejoin.amos.boot.module.statistics.api.entity.TzsBaseInstitution;
...@@ -42,7 +41,6 @@ import com.yeejoin.amos.boot.module.ymt.flc.api.mapper.RegUnitInfoMapper; ...@@ -42,7 +41,6 @@ import com.yeejoin.amos.boot.module.ymt.flc.api.mapper.RegUnitInfoMapper;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -358,40 +356,41 @@ public class EnterpriseBizByTCMServiceImpl { ...@@ -358,40 +356,41 @@ public class EnterpriseBizByTCMServiceImpl {
//查询列表信息 //查询列表信息
Page<HashMap<String, Object>> pageList = planTaskMapper.getPlanTaskInfo(page,map); Page<HashMap<String, Object>> pageList = planTaskMapper.getPlanTaskInfo(page,map);
//处理userName //处理userName
if(!CollectionUtils.isEmpty(pageList.getRecords())) { // 2025/04/14 htt 处理了源头的错误数据 故不需要转化了
Map<String, String> userMap = new HashMap<>(); // if(!CollectionUtils.isEmpty(pageList.getRecords())) {
List<String> userIds = new ArrayList<>(); // Map<String, String> userMap = new HashMap<>();
for (Map<String, Object> record : pageList.getRecords()) { // List<String> userIds = new ArrayList<>();
String ids = record.get("userName")+""; // for (Map<String, Object> record : pageList.getRecords()) {
if (StrUtil.isNotBlank(ids)) { // String ids = record.get("userName")+"";
for (String id : ids.split(",")) { // if (StrUtil.isNotBlank(ids)) {
userIds.add(id); // for (String id : ids.split(",")) {
} // userIds.add(id);
} // }
} // }
if(!CollectionUtils.isEmpty(userIds)){ // }
List<Map<String,String>> userinfoList =planTaskMapper.getUserByUserName(userIds); // if(!CollectionUtils.isEmpty(userIds)){
for (Map<String, String> userinfo : userinfoList) { // List<Map<String,String>> userinfoList =planTaskMapper.getUserByUserName(userIds);
userMap.put(userinfo.get("userName"),userinfo.get("realName")); // for (Map<String, String> userinfo : userinfoList) {
} // userMap.put(userinfo.get("userName"),userinfo.get("realName"));
} // }
for (Map<String, Object> record : pageList.getRecords()) { // }
String ids = record.get("userName")+""; // for (Map<String, Object> record : pageList.getRecords()) {
if (StrUtil.isNotBlank(ids)) { // String ids = record.get("userName")+"";
List<String> realNameList = new ArrayList<>(); // if (StrUtil.isNotBlank(ids)) {
for (String id : ids.split(",")) { // List<String> realNameList = new ArrayList<>();
if(StrUtil.isNotBlank(userMap.get(id))) { // for (String id : ids.split(",")) {
realNameList.add(userMap.get(id)); // if(StrUtil.isNotBlank(userMap.get(id))) {
} // realNameList.add(userMap.get(id));
} // }
if(!CollectionUtils.isEmpty(realNameList)) { // }
record.put("userName", realNameList.stream().collect(Collectors.joining(","))); // if(!CollectionUtils.isEmpty(realNameList)) {
}else{ // record.put("userName", realNameList.stream().collect(Collectors.joining(",")));
record.put("userName",""); // }else{
} // record.put("userName","");
} // }
} // }
} // }
// }
result.put("taskList",pageList); result.put("taskList",pageList);
//查询企业类型 //查询企业类型
......
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
SELECT SELECT
${groupId} groupId, ${groupId} groupId,
tui.amos_user_id userId, tui.amos_user_id userId,
tui.amos_user_name userName, tui.name userName,
tui.unit_name, tui.unit_name,
tui.unit_code, tui.unit_code,
REPLACE ( tzei.unit_type, '#', ',' ) unitType, REPLACE ( tzei.unit_type, '#', ',' ) unitType,
......
...@@ -15,7 +15,6 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -15,7 +15,6 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel; import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo;
import com.yeejoin.amos.patrol.business.constants.XJConstant; import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.*; import com.yeejoin.amos.patrol.business.dao.mapper.*;
import com.yeejoin.amos.patrol.business.dao.repository.*; import com.yeejoin.amos.patrol.business.dao.repository.*;
...@@ -51,17 +50,13 @@ import org.springframework.cglib.beans.BeanMap; ...@@ -51,17 +50,13 @@ import org.springframework.cglib.beans.BeanMap;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -2116,33 +2111,35 @@ public class CheckServiceImpl implements ICheckService { ...@@ -2116,33 +2111,35 @@ public class CheckServiceImpl implements ICheckService {
List<CheckInputParam> checkItems = requestParam.getCheckItems(); List<CheckInputParam> checkItems = requestParam.getCheckItems();
Map<String,List<Map<String,Object>>> mapList = (Map<String,List<Map<String,Object>>>)JSON.parse(appCheckInput.toJSONString()); Map<String,List<Map<String,Object>>> mapList = (Map<String,List<Map<String,Object>>>)JSON.parse(appCheckInput.toJSONString());
List<AppCheckInputRespone> appCheckInputRespones = new ArrayList<>(); List<AppCheckInputRespone> appCheckInputRespones = new ArrayList<>();
if (!ObjectUtils.isEmpty(mapList.get("items"))){
for (Map<String,Object> map : mapList.get("items")) {
AppCheckInputRespone appCheckInputRespone = new AppCheckInputRespone();
CheckInputParam checkInputId = checkItems.stream().filter(x -> x.getInputItemId()== Long.valueOf(map.get("checkInputId").toString())).collect(Collectors.toList()).get(0);
try {
BeanUtils.copyProperties(appCheckInputRespone, map);
} catch (Exception e) {
e.printStackTrace();
return null;
}
CheckInput checkInput = setInputValueByItemType(new CheckInput(), appCheckInputRespone.getDataJson(), appCheckInputRespone.getItemType(), checkInputId, null);
if (XJConstant.NO.equals(checkInput.getIsOk())) {
planTask.setRiskStatus(XJConstant.RISK_NUM);
esTaskDetailDto.setIsRisk(XJConstant.NO_IS_RISK);
for (Map<String,Object> map : mapList.get("items")) { }
AppCheckInputRespone appCheckInputRespone = new AppCheckInputRespone(); if(ObjectUtils.isEmpty(planTask.getRiskStatus()) || planTask.getRiskStatus() == XJConstant.INIT_NUM) {
CheckInputParam checkInputId = checkItems.stream().filter(x -> x.getInputItemId()== Long.valueOf(map.get("checkInputId").toString())).collect(Collectors.toList()).get(0); planTask.setRiskStatus(XJConstant.NORISK_NUM);
try { esTaskDetailDto.setIsRisk(XJConstant.IS_RISK);
BeanUtils.copyProperties(appCheckInputRespone, map); }
} catch (Exception e) { appCheckInputRespone.setInputValue(checkInputId.getInputValue());
e.printStackTrace(); appCheckInputRespone.setPointInputImgUrls(ObjectUtils.isEmpty(checkInputId) ? new ArrayList<>() : checkInputId.getCheckInputImg());
return null; appCheckInputRespones.add(appCheckInputRespone);
}
CheckInput checkInput = setInputValueByItemType(new CheckInput(), appCheckInputRespone.getDataJson(), appCheckInputRespone.getItemType(), checkInputId, null);
if (XJConstant.NO.equals(checkInput.getIsOk())) {
planTask.setRiskStatus(XJConstant.RISK_NUM);
esTaskDetailDto.setIsRisk(XJConstant.NO_IS_RISK);
}
if(ObjectUtils.isEmpty(planTask.getRiskStatus()) || planTask.getRiskStatus() == XJConstant.INIT_NUM) {
planTask.setRiskStatus(XJConstant.NORISK_NUM);
esTaskDetailDto.setIsRisk(XJConstant.IS_RISK);
} }
appCheckInputRespone.setInputValue(checkInputId.getInputValue()); appCheckInput.put("items", appCheckInputRespones);
appCheckInputRespone.setPointInputImgUrls(ObjectUtils.isEmpty(checkInputId) ? new ArrayList<>() : checkInputId.getCheckInputImg());
appCheckInputRespones.add(appCheckInputRespone);
} }
appCheckInput.put("items", appCheckInputRespones);
esTaskDetailDto.setPointImgUrls(requestParam.getCheckRecordImg()); esTaskDetailDto.setPointImgUrls(requestParam.getCheckRecordImg());
esTaskDetailDto.setAppCheckInput(appCheckInput); esTaskDetailDto.setAppCheckInput(appCheckInput);
esTaskDetailDto.setRemark(requestParam.getRemark());
return esTaskDetailDto; return esTaskDetailDto;
} }
......
...@@ -574,17 +574,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -574,17 +574,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
throw new YeeException("删除数据内容不能为空"); throw new YeeException("删除数据内容不能为空");
} }
Set<Long> taskNos = new HashSet<>(); Set<Long> taskNos = new HashSet<>();
ArrayList<ESPlanTaskListDto> esPlanTaskListDtos = new ArrayList<>(); List<ESTaskDetailDto> esTaskDetailDtos = new ArrayList<>();
for (String id : strArry) { for (String id : strArry) {
esTaskDetailDtos.add(new ESTaskDetailDto().setId(id));
PlanTaskDetail planTkDet = planTaskDetail.findById(Long.parseLong(id)).get(); PlanTaskDetail planTkDet = planTaskDetail.findById(Long.parseLong(id)).get();
if (null != planTkDet) { if (null != planTkDet) {
taskNos.add(planTkDet.getTaskNo()); taskNos.add(planTkDet.getTaskNo());
esPlanTaskListDtos.add(new ESPlanTaskListDto().setId(Objects.toString(planTkDet.getTaskNo())));
} }
} }
// 删除es数据 // 删除对应的es数据 + 更新巡检点数
esPlanTaskList.deleteAll(esPlanTaskListDtos); this.handleEsPlanTaskListPointsByIds(Arrays.asList(strArry), taskNos.stream().map(Objects::toString).collect(Collectors.toList()));
List<ESTaskDetailDto> esTaskDetailDtos = planTaskDetailMapper.findAllByTaskNos(esPlanTaskListDtos.stream().map(ESPlanTaskListDto::getId).collect(Collectors.toList()));
esTaskDetail.deleteAll(esTaskDetailDtos); esTaskDetail.deleteAll(esTaskDetailDtos);
planTaskMapper.planTaskDet(strArry);// 删除数据 planTaskMapper.planTaskDet(strArry);// 删除数据
HashMap<String, Object> param = new HashMap<String, Object>(); HashMap<String, Object> param = new HashMap<String, Object>();
...@@ -593,6 +592,25 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -593,6 +592,25 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTaskMapper.updatePlanTaskPtInfo(param);// 更新主表,点数量,完成数量 planTaskMapper.updatePlanTaskPtInfo(param);// 更新主表,点数量,完成数量
} }
/**
* 删除任务中的巡检点 + 更新巡检点数 + 未开始数
* @param taskDetailIds
* @param taskIds
*/
private void handleEsPlanTaskListPointsByIds(List<String> taskDetailIds, List<String> taskIds) {
taskIds.forEach(taskId -> esPlanTaskList.findById(taskId).ifPresent(esPlanTaskListDto -> {
List<PlanTaskDetail> points = (List<PlanTaskDetail>) esPlanTaskListDto.getPoints();
List<PlanTaskDetail> filterPoints = points.stream().filter(point -> !taskDetailIds.contains(Objects.toString(point.getId()))).collect(Collectors.toList());
esPlanTaskList.deleteById(taskId);
if (!filterPoints.isEmpty()) {
esPlanTaskListDto.setPoints(filterPoints);
esPlanTaskListDto.setTaskPlanNum(Objects.toString(filterPoints.size()));
esPlanTaskListDto.setUnplan(Objects.toString(filterPoints.stream().filter(point -> "0".equals(point.getStatus())).count()));
esPlanTaskList.save(esPlanTaskListDto);
}
}));
}
@Override @Override
public List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam param) { public List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam param) {
List<PlanTaskVo> content = planTaskMapper.getPlanTaskInfoList(param); List<PlanTaskVo> content = planTaskMapper.getPlanTaskInfoList(param);
...@@ -2125,6 +2143,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -2125,6 +2143,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
list.forEach(e -> { list.forEach(e -> {
e.put("executiveName", e.get("userName")); e.put("executiveName", e.get("userName"));
// 填充 routeName ,企业自查显示,区分不同的管控类型的计划
String planTaskId = Objects.toString(e.get("planTaskId"));
Long routeId = planTaskMapper.selectRoutId(planTaskId);
e.put("routeName", routeDao.getOne(routeId).getName());
}); });
} }
return new PageImpl<>(list, pageParam, totle); return new PageImpl<>(list, pageParam, totle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment