Commit afc9e3c1 authored by tianyiming's avatar tianyiming

更新索引--涉及任务下发、定时器修改、任务执行

parent eb36129d
......@@ -9,7 +9,10 @@ import java.util.List;
public class AppPointCheckRespone {
private long id;
private long pointId;
private long planTaskId;
private String pointName;
......@@ -175,11 +178,26 @@ public class AppPointCheckRespone {
public long getPointId() {
return pointId;
}
public long getPlanTaskId() {
return planTaskId;
}
public long getId() {
return id;
}
public void setPointId(long pointId) {
this.pointId = pointId;
}
public void setId(long id) {
this.id = id;
}
public void setPlanTaskId(long planTaskId) {
this.planTaskId = planTaskId;
}
public String getRemark() {
return remark;
}
......
......@@ -22,7 +22,7 @@ public class ESTaskDetailDto {
@Id
private String id;
private Long id;
@Field(type = FieldType.Text)
private String pointId;
......@@ -86,7 +86,7 @@ public class ESTaskDetailDto {
@Field(type = FieldType.Text)
private List<String> pointImgUrls;
@Field(type = FieldType.Text)
@Field(type = FieldType.Object)
private JSONObject appCheckInput;
......
......@@ -4,6 +4,7 @@ import java.util.Date;
public class PointCheckDetailBo {
private Long id;
private long pointId;
private String pointName;
......@@ -18,6 +19,10 @@ public class PointCheckDetailBo {
private String defaultValue;
public long getId() {
return id;
}
public String getDefaultValue() {
return defaultValue;
}
......
package com.yeejoin.amos.patrol.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDetailDao;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.patrol.business.dao.repository.*;
import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo;
import com.yeejoin.amos.patrol.business.param.PlanInfoPageParam;
import com.yeejoin.amos.patrol.business.service.intfc.ICheckService;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanService;
import com.yeejoin.amos.patrol.core.common.response.AppCheckInputRespone;
import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.patrol.core.util.DateUtil;
import com.yeejoin.amos.patrol.core.util.StringUtil;
import com.yeejoin.amos.patrol.dao.entity.Check;
import com.yeejoin.amos.patrol.dao.entity.CheckInput;
import com.yeejoin.amos.patrol.dao.entity.CheckShot;
import com.yeejoin.amos.patrol.dao.entity.Plan;
import liquibase.pro.packaged.L;
import org.slf4j.Logger;
......@@ -21,6 +28,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
@Service("planService")
public class PlanServiceImpl implements IPlanService {
......@@ -44,7 +52,104 @@ public class PlanServiceImpl implements IPlanService {
Page<HashMap<String, Object>> result = new PageImpl<HashMap<String, Object>>(content, param, total);
return result;
}
@Autowired
private ICheckDao checkDao;
@Autowired
private ICheckService checkService;
@Autowired
PlanTaskMapper planTaskMapper;
@Autowired
private ICheckShotDao iCheckShotDao;
@Override
public AppPointCheckRespone queryPointPlanTaskDetail(String toke, String product, String appKey, Long planTaskId, Long pointId) {
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetailInVersion2(toke, product, appKey, check.getId(), planTaskId, pointId);
} else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
pointCheckRespone.setTaskStatus(planPointInfo.getTaskStatus());
pointCheckRespone.setPointStatus(planPointInfo.getPointStatus());
if (planPointInfo != null) {
if(check != null) {
List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(check.getId(),
0L);
List<String> photos = new ArrayList<>();
if (!org.springframework.util.CollectionUtils.isEmpty(checkShots)) {
photos = checkShots.stream().map(e -> {
if (e != null) {
return e.getPhotoData().replaceAll("\\\\", "/");
} else {
return "";
}
}).collect(Collectors.toList());
}
pointCheckRespone.setPointImgUrls(photos);
}
pointCheckRespone.setId(planPointInfo.getId());
pointCheckRespone.setPlanTaskId(Long.valueOf(planPointInfo.getPlanTaskId()));
pointCheckRespone.setPointId(pointId);
pointCheckRespone.setPointName(planPointInfo.getPointName());
pointCheckRespone.setPointNo(planPointInfo.getPointNo());
pointCheckRespone.setBeginTime(planPointInfo.getBeginTime());
pointCheckRespone.setEndTime(planPointInfo.getEndTime());
pointCheckRespone.setPlanName(planPointInfo.getPlanName());
pointCheckRespone.setShortMaxNumber(planPointInfo.getShortMaxNumber());
pointCheckRespone.setShortMinNumber(planPointInfo.getShortMinNumber());
List<PointCheckDetailBo> pointInputs = planTaskMapper.getPointInputByRouteIdAndPointId(planPointInfo.getRouteId(), planPointInfo.getPointId());
JSONObject appResponeMap = new JSONObject();
List<AppCheckInputRespone> appCheckInputResponeList = new ArrayList<AppCheckInputRespone>();
pointInputs.forEach(action -> {
AppCheckInputRespone input = new AppCheckInputRespone();
input.setInputName(action.getInputName());
input.setCheckInputId(action.getCheckInputId());
input.setDefaultValue(action.getDefaultValue());
input.setDataJson(action.getDataJson());
input.setIsMultiline(action.getIsMultiline());
input.setIsMust(action.getIsMust());
input.setInputValue(null);
if(null != check) {
for (CheckInput ck :check.getCheckInput()
) {
if(ck.getInputId().toString().equals(String.valueOf(action.getCheckInputId()))) {
input.setInputValue(ck.getInputValue());
}
}
List<CheckShot> checkShotsNew = iCheckShotDao.findAllByCheckIdAndCheckInputId(check.getId(),
action.getCheckInputId());
List<String> photosNew = new ArrayList<>();
if (!org.springframework.util.CollectionUtils.isEmpty(checkShotsNew)) {
photosNew = checkShotsNew.stream().map(e -> {
if (e != null) {
return e.getPhotoData().replaceAll("\\\\", "/");
} else {
return "";
}
}).collect(Collectors.toList());
}
input.setPointInputImgUrls(photosNew);
}
input.setItemType(action.getItemType());
input.setOrderNo(action.getOrderNo());
input.setPictureJson(action.getPictureJson());
input.setClassifyId(action.getClassifyId());
input.setClassifyName(action.getClassifyName());
appCheckInputResponeList.add(input);
});
appResponeMap.put("items", appCheckInputResponeList);
pointCheckRespone.setAppCheckInput(appResponeMap);
}
}
return pointCheckRespone;
}
@Override
public Plan addPlan(HashMap<String, Object> map) {
Plan param = (Plan) map.get("param");
......
......@@ -27,6 +27,7 @@ import com.yeejoin.amos.patrol.business.param.CheckPtListPageParam;
import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam;
import com.yeejoin.amos.patrol.business.service.intfc.ICheckService;
import com.yeejoin.amos.patrol.business.service.intfc.IPatrolDataSyncService;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanService;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.patrol.business.util.MyByteArrayMultipartFile;
import com.yeejoin.amos.patrol.business.util.PlanTaskUtil;
......@@ -115,6 +116,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
ESPlanTaskList esPlanTaskList;
@Autowired
ESTaskDetail esTaskDetail;
@Autowired
IPlanService planService;
@Autowired
PlanTaskMapper planTaskMapper;
@Autowired
PlanTaskDetailMapper planTaskDetailMapper;
......@@ -944,6 +951,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Point point = pointMapper.selectPointInfo(taskDetail.getPointId());
taskDetail.setName(point.getName());
taskDetail.setPointNo(point.getPointNo());
AppPointCheckRespone appPointCheckRespone = planService.queryPointPlanTaskDetail(null, null, null, taskDetail.getTaskNo(), taskDetail.getPointId());
ESTaskDetailDto esTaskDetailDto = JSONObject.parseObject(toJSONString(appPointCheckRespone),
ESTaskDetailDto.class);
esTaskDetail.save(esTaskDetailDto);
}
for (ESPlanTaskListDto esPlanTaskListDto : esPlanTaskListDtos) {
......@@ -1295,6 +1306,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
iPlanTaskDetailDao.saveAndFlush(action);
planTaskDetailMapper.finishTaskDetail(action.getId(), action.getPointId(),
action.getPlanTask().getId(), userId);
AppPointCheckRespone appPointCheckRespone = planService.queryPointPlanTaskDetail(null, null, null, action.getTaskNo(), action.getPointId());
ESTaskDetailDto esTaskDetailDto = JSONObject.parseObject(toJSONString(appPointCheckRespone),
ESTaskDetailDto.class);
esTaskDetail.save(esTaskDetailDto);
return action;
}).collect(Collectors.toList());
}
......@@ -1308,6 +1323,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
esPlanTaskListDto.setTaskPlanNum(ObjectUtils.isEmpty(task.get("taskPlanNum")) ? "0" : task.get("taskPlanNum").toString());
esPlanTaskListDto.setPoints(planTaskDetails);
esPlanTaskList.save(esPlanTaskListDto);
// 生成巡检记录
jobService.createCheckRecord(planTask, userId);
}
......@@ -1629,92 +1645,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return planTaskMapper.getPlanTaskStatisticsForApp(params);
}
@Override
public AppPointCheckRespone queryPointPlanTaskDetail(String toke, String product, String appKey, Long planTaskId, Long pointId) {
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetailInVersion2(toke, product, appKey, check.getId(), planTaskId, pointId);
} else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
pointCheckRespone.setTaskStatus(planPointInfo.getTaskStatus());
pointCheckRespone.setPointStatus(planPointInfo.getPointStatus());
if (planPointInfo != null) {
if(check != null) {
List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(check.getId(),
0L);
List<String> photos = new ArrayList<>();
if (!org.springframework.util.CollectionUtils.isEmpty(checkShots)) {
photos = checkShots.stream().map(e -> {
if (e != null) {
return e.getPhotoData().replaceAll("\\\\", "/");
} else {
return "";
}
}).collect(Collectors.toList());
}
pointCheckRespone.setPointImgUrls(photos);
}
pointCheckRespone.setPointId(pointId);
pointCheckRespone.setPointName(planPointInfo.getPointName());
pointCheckRespone.setPointNo(planPointInfo.getPointNo());
pointCheckRespone.setBeginTime(planPointInfo.getBeginTime());
pointCheckRespone.setEndTime(planPointInfo.getEndTime());
pointCheckRespone.setPlanName(planPointInfo.getPlanName());
pointCheckRespone.setShortMaxNumber(planPointInfo.getShortMaxNumber());
pointCheckRespone.setShortMinNumber(planPointInfo.getShortMinNumber());
List<PointCheckDetailBo> pointInputs = planTaskMapper.getPointInputByRouteIdAndPointId(planPointInfo.getRouteId(), planPointInfo.getPointId());
JSONObject appResponeMap = new JSONObject();
List<AppCheckInputRespone> appCheckInputResponeList = new ArrayList<AppCheckInputRespone>();
pointInputs.forEach(action -> {
AppCheckInputRespone input = new AppCheckInputRespone();
input.setInputName(action.getInputName());
input.setCheckInputId(action.getCheckInputId());
input.setDefaultValue(action.getDefaultValue());
input.setDataJson(action.getDataJson());
input.setIsMultiline(action.getIsMultiline());
input.setIsMust(action.getIsMust());
input.setInputValue(null);
if(null != check) {
for (CheckInput ck :check.getCheckInput()
) {
if(ck.getInputId().toString().equals(String.valueOf(action.getCheckInputId()))) {
input.setInputValue(ck.getInputValue());
}
}
List<CheckShot> checkShotsNew = iCheckShotDao.findAllByCheckIdAndCheckInputId(check.getId(),
action.getCheckInputId());
List<String> photosNew = new ArrayList<>();
if (!org.springframework.util.CollectionUtils.isEmpty(checkShotsNew)) {
photosNew = checkShotsNew.stream().map(e -> {
if (e != null) {
return e.getPhotoData().replaceAll("\\\\", "/");
} else {
return "";
}
}).collect(Collectors.toList());
}
input.setPointInputImgUrls(photosNew);
}
input.setItemType(action.getItemType());
input.setOrderNo(action.getOrderNo());
input.setPictureJson(action.getPictureJson());
input.setClassifyId(action.getClassifyId());
input.setClassifyName(action.getClassifyName());
appCheckInputResponeList.add(input);
});
appResponeMap.put("items", appCheckInputResponeList);
pointCheckRespone.setAppCheckInput(appResponeMap);
}
}
return pointCheckRespone;
}
@Override
public AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke, String product, String appKey, Long planTaskId, Long pointId) {
......
package com.yeejoin.amos.patrol.business.service.intfc;
import com.yeejoin.amos.patrol.business.param.PlanInfoPageParam;
import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.patrol.dao.entity.Plan;
import org.springframework.data.domain.Page;
......@@ -23,6 +24,14 @@ public interface IPlanService {
Plan addPlan(HashMap<String, Object> map);
/**
* 根据任务id点id 获取点详情
* @param planTaskId
* @param pointId
* @return
*/
AppPointCheckRespone queryPointPlanTaskDetail(String toke, String product, String appKey, Long planTaskId, Long pointId);
/**
* 巡检计划删除
*/
void delPlanById(Long[] param);
......
......@@ -156,13 +156,6 @@ public interface IPlanTaskService {
*/
List<PlanTaskVo> getPlanTaskListByIds(String toke,String product,String appKey,Long[] ids);
List<PlanTaskVo> getPlanTaskListByIdsNew(Long[] ids);
/**
* 根据任务id点id 获取点详情
* @param planTaskId
* @param pointId
* @return
*/
AppPointCheckRespone queryPointPlanTaskDetail(String toke,String product,String appKey,Long planTaskId,Long pointId);
AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke,String product,String appKey,Long planTaskId,Long pointId);
......
......@@ -21,15 +21,19 @@ import com.yeejoin.amos.patrol.business.entity.mybatis.PlanTaskPointInputItemBo;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.param.CheckInputParam;
import com.yeejoin.amos.patrol.business.param.MsgConfigParam;
import com.yeejoin.amos.patrol.business.service.impl.PlanServiceImpl;
import com.yeejoin.amos.patrol.business.service.intfc.IMessageService;
import com.yeejoin.amos.patrol.business.service.intfc.IPatrolDataSyncService;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanService;
import com.yeejoin.amos.patrol.business.util.DateUtil;
import com.yeejoin.amos.patrol.business.util.Toke;
import com.yeejoin.amos.patrol.common.enums.*;
import com.yeejoin.amos.patrol.core.async.AsyncTask;
import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.patrol.dao.entity.*;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.mqtt.WebMqttComponent;
import liquibase.pro.packaged.I;
import org.quartz.Job;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -49,6 +53,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.toJSONString;
import static com.yeejoin.amos.patrol.common.enums.NotifyBusinessTypeEum.planTask;
@Service("jobService")
......@@ -60,6 +65,12 @@ public class JobService implements IJobService {
ESPlanTaskList esPlanTaskList;
@Autowired
IPlanService planService;
@Autowired
ESTaskDetail esTaskDetail;
@Autowired
private ITaskDao iTaskDao;
@Autowired
......@@ -208,6 +219,10 @@ public class JobService implements IJobService {
}
if (!ObjectUtils.isEmpty(ids)) {
updateEsPlanTaskList(ids, PlanTaskFinishStatusEnum.NOTSTARTED.getValue());
for (String id : ids) {
}
}
} catch (ParseException e) {
// TODO Auto-generated catch block
......@@ -231,6 +246,12 @@ public class JobService implements IJobService {
esPlanTaskListDto.setUnplan(ObjectUtils.isEmpty(task.get("unplan")) ? "0" : task.get("unplan").toString());
esPlanTaskListDto.setTaskPlanNum(ObjectUtils.isEmpty(task.get("taskPlanNum")) ? "0" : task.get("taskPlanNum").toString());
List<PlanTaskDetail> planTaskDetailList = planTaskMapper.selectTaskDetails(id);
for (PlanTaskDetail taskDetail : planTaskDetailList) {
AppPointCheckRespone appPointCheckRespone = planService.queryPointPlanTaskDetail(null, null, null, taskDetail.getTaskNo(), taskDetail.getPointId());
ESTaskDetailDto esTaskDetailDto = JSONObject.parseObject(toJSONString(appPointCheckRespone),
ESTaskDetailDto.class);
esTaskDetail.save(esTaskDetailDto);
}
esPlanTaskListDto.setPoints(planTaskDetailList);
esPlanTaskListDtos.add(esPlanTaskListDto);
}
......
......@@ -682,6 +682,8 @@
<select id="getPointPlanTaskInfo" resultType="com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo" parameterType="long">
SELECT
pptd.id,
ppt.id planTaskId,
pp.id pointId,
pp.name pointName,
pp.point_no pointNo,
......
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