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

BUG :28134,28137

parent 878a903b
......@@ -93,7 +93,7 @@
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_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
pc.plan_task_id = #{planTaskId}
</select>
......
......@@ -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.RedisKey;
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.entity.TzBaseEnterpriseInfo;
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;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -358,40 +356,41 @@ public class EnterpriseBizByTCMServiceImpl {
//查询列表信息
Page<HashMap<String, Object>> pageList = planTaskMapper.getPlanTaskInfo(page,map);
//处理userName
if(!CollectionUtils.isEmpty(pageList.getRecords())) {
Map<String, String> userMap = new HashMap<>();
List<String> userIds = new ArrayList<>();
for (Map<String, Object> record : pageList.getRecords()) {
String ids = record.get("userName")+"";
if (StrUtil.isNotBlank(ids)) {
for (String id : ids.split(",")) {
userIds.add(id);
}
}
}
if(!CollectionUtils.isEmpty(userIds)){
List<Map<String,String>> userinfoList =planTaskMapper.getUserByUserName(userIds);
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")+"";
if (StrUtil.isNotBlank(ids)) {
List<String> realNameList = new ArrayList<>();
for (String id : ids.split(",")) {
if(StrUtil.isNotBlank(userMap.get(id))) {
realNameList.add(userMap.get(id));
}
}
if(!CollectionUtils.isEmpty(realNameList)) {
record.put("userName", realNameList.stream().collect(Collectors.joining(",")));
}else{
record.put("userName","");
}
}
}
}
// 2025/04/14 htt 处理了源头的错误数据 故不需要转化了
// if(!CollectionUtils.isEmpty(pageList.getRecords())) {
// Map<String, String> userMap = new HashMap<>();
// List<String> userIds = new ArrayList<>();
// for (Map<String, Object> record : pageList.getRecords()) {
// String ids = record.get("userName")+"";
// if (StrUtil.isNotBlank(ids)) {
// for (String id : ids.split(",")) {
// userIds.add(id);
// }
// }
// }
// if(!CollectionUtils.isEmpty(userIds)){
// List<Map<String,String>> userinfoList =planTaskMapper.getUserByUserName(userIds);
// 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")+"";
// if (StrUtil.isNotBlank(ids)) {
// List<String> realNameList = new ArrayList<>();
// for (String id : ids.split(",")) {
// if(StrUtil.isNotBlank(userMap.get(id))) {
// realNameList.add(userMap.get(id));
// }
// }
// if(!CollectionUtils.isEmpty(realNameList)) {
// record.put("userName", realNameList.stream().collect(Collectors.joining(",")));
// }else{
// record.put("userName","");
// }
// }
// }
// }
result.put("taskList",pageList);
//查询企业类型
......
......@@ -210,7 +210,7 @@
SELECT
${groupId} groupId,
tui.amos_user_id userId,
tui.amos_user_name userName,
tui.name userName,
tui.unit_name,
tui.unit_code,
REPLACE ( tzei.unit_type, '#', ',' ) unitType,
......
......@@ -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.systemctl.Systemctl;
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.dao.mapper.*;
import com.yeejoin.amos.patrol.business.dao.repository.*;
......@@ -51,17 +50,13 @@ import org.springframework.cglib.beans.BeanMap;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.Transactional;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
......@@ -2116,7 +2111,7 @@ public class CheckServiceImpl implements ICheckService {
List<CheckInputParam> checkItems = requestParam.getCheckItems();
Map<String,List<Map<String,Object>>> mapList = (Map<String,List<Map<String,Object>>>)JSON.parse(appCheckInput.toJSONString());
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);
......@@ -2141,8 +2136,10 @@ public class CheckServiceImpl implements ICheckService {
appCheckInputRespones.add(appCheckInputRespone);
}
appCheckInput.put("items", appCheckInputRespones);
}
esTaskDetailDto.setPointImgUrls(requestParam.getCheckRecordImg());
esTaskDetailDto.setAppCheckInput(appCheckInput);
esTaskDetailDto.setRemark(requestParam.getRemark());
return esTaskDetailDto;
}
......
......@@ -574,17 +574,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
throw new YeeException("删除数据内容不能为空");
}
Set<Long> taskNos = new HashSet<>();
ArrayList<ESPlanTaskListDto> esPlanTaskListDtos = new ArrayList<>();
List<ESTaskDetailDto> esTaskDetailDtos = new ArrayList<>();
for (String id : strArry) {
esTaskDetailDtos.add(new ESTaskDetailDto().setId(id));
PlanTaskDetail planTkDet = planTaskDetail.findById(Long.parseLong(id)).get();
if (null != planTkDet) {
taskNos.add(planTkDet.getTaskNo());
esPlanTaskListDtos.add(new ESPlanTaskListDto().setId(Objects.toString(planTkDet.getTaskNo())));
}
}
// 删除es数据
esPlanTaskList.deleteAll(esPlanTaskListDtos);
List<ESTaskDetailDto> esTaskDetailDtos = planTaskDetailMapper.findAllByTaskNos(esPlanTaskListDtos.stream().map(ESPlanTaskListDto::getId).collect(Collectors.toList()));
// 删除对应的es数据 + 更新巡检点数
this.handleEsPlanTaskListPointsByIds(Arrays.asList(strArry), taskNos.stream().map(Objects::toString).collect(Collectors.toList()));
esTaskDetail.deleteAll(esTaskDetailDtos);
planTaskMapper.planTaskDet(strArry);// 删除数据
HashMap<String, Object> param = new HashMap<String, Object>();
......@@ -593,6 +592,25 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
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
public List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam param) {
List<PlanTaskVo> content = planTaskMapper.getPlanTaskInfoList(param);
......@@ -2125,6 +2143,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
if (!CollectionUtils.isEmpty(list)) {
list.forEach(e -> {
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);
......
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