Commit 2f4da6d3 authored by tangwei's avatar tangwei

修改nug

parent e23ef89a
...@@ -579,6 +579,132 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -579,6 +579,132 @@ public class PlanTaskController extends AbstractBaseController {
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据计划任务ID查询计划任务详情和任务点(<font color='blue'>手机app</font>)", notes = "根据计划任务ID查询计划任务详情和任务点(<font color='blue'>手机app</font>)")
@RequestMapping(value = "/queryPlanTaskByIdNew", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryPlanTaskByIdNew(
@ApiParam(value = "巡检计划任务ID", required = true) @RequestParam(required = true) Long planTaskId) {
try {
Map<String, Object> response = new HashMap<String, Object>();
Map task = planTaskService.queryPlanTaskById(planTaskId);
if (ObjectUtils.isEmpty(task) || ObjectUtils.isEmpty(task.get("planTaskId"))) {
return CommonResponseUtil.failure("该计划已刷新,请重新选择!!!");
}
List points = planTaskService.getPlanTaskPoints(planTaskId);
String[] userIds = task.get("userId").toString().split(",");
for (String userId : userIds) {
task.put("userId", userId);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
task.put("checkDate", sdf.format(task.get("checkDate") != null ? sdf.parse(task.get("checkDate").toString()) : new Date()));
response.put("planTask", task);
response.put("points", points);
return CommonResponseUtil.success(response);
} catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage());
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据任务id和点id获取“未开始”任务点详情(<font color='blue'>手机app</font>)", notes = "根据任务id和点id获取“未开始”任务点详情(<font color='blue'>手机app</font>)")
@RequestMapping(value = "/v2/queryPointPlanTaskDetailNew", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryPointPlanTaskDetailInVersion2New(
@ApiParam(value = "巡检计划任务ID", required = true) @RequestParam(required = true) Long planTaskId,
@ApiParam(value = "巡检点ID", required = true) @RequestParam(required = true) Long pointId) {
try {
AppPointCheckRespone result = planTaskService.queryPointPlanTaskDetailInVersion2New( planTaskId, pointId);
if (ObjectUtils.isEmpty(result)) {
return CommonResponseUtil.failure("该计划巡检点已更新,请退回重新选择");
}
return CommonResponseUtil.success(result);
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure(e.getMessage());
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
// @Authorization(ingore = true)
@ApiOperation(value = "根据计划任务ID和点ID初始化巡检页面(<font color='blue'>手机app</font>)", notes = "根据计划任务ID和点ID初始化巡检页面((<font color='blue'>手机app</font>)")
@RequestMapping(value = "/v2/initPlanTaskNew", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryPlanTaskDetailByIdInVersion2New(
@ApiParam(value = "巡检计划任务ID") @RequestParam(required = false) Long planTaskId,
@ApiParam(value = "巡检点id", required = true) @RequestParam Long pointId) {
try {
Map<String, Object> response = new HashMap<String, Object>();
if (planTaskId != null && planTaskId > 0) {
Point point = pointService.queryPointById(pointId);
if (!XJConstant.IS_FIXED_YES.equals(point.getIsFixed())) {
// 1.校验当前点的执行情况,不能重复巡检及超时巡检
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("planTaskId", planTaskId);
List<CodeOrderVo> list = planTaskService.queryCodeOrderVo(params);
if (ObjectUtils.isEmpty(list)) {
return CommonResponseUtil.failure("该计划已刷新,请重新选择!!!");
}
if (list.get(0).getStatus() == PlanTaskFinishStatusEnum.OVERTIME.getValue()) {
return CommonResponseUtil.failure("任务已超时!");
}
if (list.get(0).getStatus() == PlanTaskFinishStatusEnum.FINISHED.getValue()) {
return CommonResponseUtil.failure("任务已结束!");
}
//2.顺序执行->按照点planTaskId,查询出所有点并按照orderNo排序,判断上一个点的执行情况
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getPointId().longValue() == pointId) {
if (!PlanTaskDetailStatusEnum.NOTSTARTED.getValue().equals(list.get(i).getIsFinish())) {
return CommonResponseUtil.failure("任务已结束!");
}
if (TaskIsOrderEnum.ISORDER.getValue().equals(list.get(0).getInOrder())) {
if (i > 0 && PlanTaskDetailStatusEnum.NOTSTARTED.getValue().equals(list.get(i - 1).getIsFinish())) {
return CommonResponseUtil.failure("请按顺序执行!");
}
}
}
}
}
Map taskDetail = planTaskService.findPlanTaskByTaskIdAndPointId(planTaskId, pointId);
taskDetail.put("shotMaxNumber", point.getShotMaxNumber());
taskDetail.put("shotMinNumber", point.getShotMinNumber());
response.put("planTask", taskDetail);
Long routeId = Long.valueOf(taskDetail.get("routeId").toString());
List<PointInputItemVo> inputItems = routeService.listRoutePointInputItem(routeId, pointId);
List<Map<String, Object>> pointClassify = pointService.queryPointClassifyByRouteIdAndPointId(routeId, pointId);
pointClassify.removeAll(Collections.singleton(null));
response.put("class", pointClassify);
response.put("checkItem", pointService.getClassifyRiskDescMap(inputItems));
log.info(JSONObject.toJSONString(response));
return CommonResponseUtil.success(response);
} else {
Point point = pointService.queryPointById(pointId);
JSONObject inputItems = pointService.getClassifyRiskDescMap(pointId);
response.put("checkItem", inputItems);
List<PointClassify> catalogs = pointService.queryPointClassify(pointId);
response.put("class", catalogs);
response.put("point", point);
log.info(JSONObject.toJSONString(response));
return CommonResponseUtil.success(response);
}
} catch (Exception e) {
log.error("请求异常", e);
return CommonResponseUtil.failure(e.getMessage());
}
}
/** /**
* 查询任务点详情 * 查询任务点详情
* *
......
...@@ -1001,6 +1001,108 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1001,6 +1001,108 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override
public AppPointCheckRespone queryCheckPointDetailInVersion2New(long checkId) {
List<PointCheckDetailBo> list = checkMapper.findCheckPointInputItem(checkId);
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
if (!list.isEmpty()) {
List<String> pointImgUrls = new ArrayList<>();
PointCheckDetailBo pointCheckDetailBo = list.get(0);
List<CheckShot> pointShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), 0l,0l);
pointShot.forEach(action -> {
pointImgUrls.add(action.getPhotoData());
});
Check check = checkDao.findById(checkId).get();
pointCheckRespone.setPointId(pointCheckDetailBo.getPointId());
pointCheckRespone.setPointName(pointCheckDetailBo.getPointName());
pointCheckRespone.setPointNo(pointCheckDetailBo.getPointNo());
pointCheckRespone.setPointStatus(pointCheckDetailBo.getPointStatus());
pointCheckRespone.setPlanName(pointCheckDetailBo.getPlanName());
pointCheckRespone.setRemark(pointCheckDetailBo.getCheckRemark());
pointCheckRespone.setCheckTime(pointCheckDetailBo.getCheckTime());
pointCheckRespone.setStrCheckTime(DateUtil.getLongDate(pointCheckDetailBo.getCheckTime()));
pointCheckRespone.setCheckId(pointCheckDetailBo.getCheckId());
pointCheckRespone.setPointImgUrls(pointImgUrls);
pointCheckRespone.setScore(check.getScore() + "");
pointCheckRespone.setUsername(pointCheckDetailBo.getUsername());
pointCheckRespone.setDepartmentName(pointCheckDetailBo.getDepartmentName());
JSONObject appResponeMap = new JSONObject();
list.forEach(action -> {
List<String> pointInputImgUrls = new ArrayList<>();
List<CheckShot> pointInputShot = checkShotDao.findAllByCheckIdAndCheckInputIdAndClassifyId(pointCheckDetailBo.getCheckId(), action.getCheckInputId(),action.getClassifyId());
pointInputShot.forEach(inputShot -> {
pointInputImgUrls.add(inputShot.getPhotoData());
});
AppCheckInputRespone appCheckInputRespone = new AppCheckInputRespone();
appCheckInputRespone.setCheckInputId(action.getCheckInputId());
appCheckInputRespone.setInputName(action.getInputName());
appCheckInputRespone.setInputStatus(action.getInputStatus());
appCheckInputRespone.setRiskDesc(action.getRiskDesc());
appCheckInputRespone.setInputValue(action.getInputValue());
appCheckInputRespone.setItemType(action.getItemType());
appCheckInputRespone.setDataJson(action.getDataJson());
appCheckInputRespone.setIsMust(action.getIsMust());
appCheckInputRespone.setIsMultiline(action.getIsMultiline());
appCheckInputRespone.setPictureJson(action.getPictureJson());
appCheckInputRespone.setOrderNo(action.getOrderNo());
appCheckInputRespone.setPointInputImgUrls(pointInputImgUrls);
appCheckInputRespone.setClassifyId(action.getClassifyId());
appCheckInputRespone.setClassifyName(action.getClassifyName());
appCheckInputRespone.setRemark(action.getRemark());
String classifyName = action.getClassifyName();
if (!StringUtil.isNotEmpty(classifyName)) {
classifyName = "其他";
}
String riskDesc = action.getRiskDesc();
if (!StringUtil.isNotEmpty(riskDesc)) {
riskDesc = XJConstant.DEFAULT_RISKDESC;
}
JSONObject classifyJson;
if (appResponeMap.containsKey(classifyName)) {
classifyJson = appResponeMap.getJSONObject(classifyName);
} else {
classifyJson = new JSONObject();
}
JSONArray riskDescArr;
if (classifyJson.containsKey(riskDesc)) {
riskDescArr = classifyJson.getJSONArray(riskDesc);
} else {
riskDescArr = new JSONArray();
}
riskDescArr.add(appCheckInputRespone);
classifyJson.put(riskDesc, riskDescArr);
appResponeMap.put(classifyName, classifyJson);
});
pointCheckRespone.setAppCheckInput(appResponeMap);
return pointCheckRespone;
}
return pointCheckRespone;
}
@Override @Override
public Map<String, Object> queryRecordByPointId(HashMap<String, Object> req) { public Map<String, Object> queryRecordByPointId(HashMap<String, Object> req) {
// if (!ObjectUtils.isEmpty(req.get("userId"))) { // if (!ObjectUtils.isEmpty(req.get("userId"))) {
......
...@@ -1476,6 +1476,91 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1476,6 +1476,91 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return pointCheckRespone; return pointCheckRespone;
} }
@Override
public AppPointCheckRespone queryPointPlanTaskDetailInVersion2New( Long planTaskId, Long pointId) {
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetailInVersion2New(check.getId());
} else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
if (planPointInfo != null) {
pointCheckRespone.setPointId(pointId);
pointCheckRespone.setPointName(planPointInfo.getPointName());
pointCheckRespone.setPointNo(planPointInfo.getPointNo());
pointCheckRespone.setPointStatus("0");
pointCheckRespone.setPlanName(planPointInfo.getPlanName());
List<PointCheckDetailBo> pointInputs = planTaskMapper.getPointInputByRouteIdAndPointId(planPointInfo.getRouteId(), planPointInfo.getPointId());
JSONObject appResponeMap = new JSONObject();
pointInputs.forEach(action -> {
AppCheckInputRespone input = new AppCheckInputRespone();
input.setInputName(action.getInputName());
input.setCheckInputId(action.getCheckInputId());
input.setDataJson(action.getDataJson());
input.setIsMultiline(action.getIsMultiline());
input.setIsMust(action.getIsMust());
input.setItemType(action.getItemType());
input.setOrderNo(action.getOrderNo());
input.setPictureJson(action.getPictureJson());
input.setClassifyId(action.getClassifyId());
input.setClassifyName(action.getClassifyName());
String classifyName = action.getClassifyName();
if (!StringUtil.isNotEmpty(classifyName)) {
classifyName = "其他";
}
String riskDesc = action.getRiskDesc();
if (!StringUtil.isNotEmpty(riskDesc)) {
riskDesc = XJConstant.DEFAULT_RISKDESC;
}
JSONObject classifyJson;
if (appResponeMap.containsKey(classifyName)) {
classifyJson = appResponeMap.getJSONObject(classifyName);
} else {
classifyJson = new JSONObject();
}
JSONArray riskDescArr;
if (classifyJson.containsKey(riskDesc)) {
riskDescArr = classifyJson.getJSONArray(riskDesc);
} else {
riskDescArr = new JSONArray();
}
riskDescArr.add(action);
classifyJson.put(riskDesc, riskDescArr);
appResponeMap.put(classifyName, classifyJson);
});
pointCheckRespone.setAppCheckInput(appResponeMap);
} else {
return null;
}
}
return pointCheckRespone;
}
@Override @Override
public String getCumulativePlanCountByOrgCode(String loginOrgCode) { public String getCumulativePlanCountByOrgCode(String loginOrgCode) {
return planTaskMapper.getCumulativePlanCountByOrgCode(loginOrgCode); return planTaskMapper.getCumulativePlanCountByOrgCode(loginOrgCode);
......
...@@ -645,10 +645,12 @@ public class RouteServiceImpl implements IRouteService { ...@@ -645,10 +645,12 @@ public class RouteServiceImpl implements IRouteService {
public List<HashMap<String, Object>> queryRouteListByOrgCode(String orgCode, String userId, String deptId) { public List<HashMap<String, Object>> queryRouteListByOrgCode(String orgCode, String userId, String deptId) {
return routeMapper.queryRouteListByOrgCode(orgCode, userId, deptId); return routeMapper.queryRouteListByOrgCode(orgCode, userId, deptId);
} }
@Override @Override
public List<HashMap<String, Object>> queryRouteListByOrgCodeNew(String orgCode, String userId) { public List<HashMap<String, Object>> queryRouteListByOrgCodeNew(String orgCode, String userId) {
return routeMapper.queryRouteListByOrgCodeNew(orgCode, userId); return routeMapper.queryRouteListByOrgCodeNew(orgCode, userId);
} }
@Override @Override
public void exchangeRoutePointOrderNumber(long src, long target) { public void exchangeRoutePointOrderNumber(long src, long target) {
List<Long> ids = new ArrayList<>(); List<Long> ids = new ArrayList<>();
......
...@@ -74,6 +74,7 @@ public interface ICheckService { ...@@ -74,6 +74,7 @@ public interface ICheckService {
AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId); AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId);
AppPointCheckRespone queryCheckPointDetailInVersion2(String toke,String product,String appKey,long checkId); AppPointCheckRespone queryCheckPointDetailInVersion2(String toke,String product,String appKey,long checkId);
AppPointCheckRespone queryCheckPointDetailInVersion2New(long checkId);
/** /**
* 巡检统计 * 巡检统计
......
...@@ -150,6 +150,10 @@ public interface IPlanTaskService { ...@@ -150,6 +150,10 @@ public interface IPlanTaskService {
AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke,String product,String appKey,Long planTaskId,Long pointId); AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke,String product,String appKey,Long planTaskId,Long pointId);
AppPointCheckRespone queryPointPlanTaskDetailInVersion2New(Long planTaskId,Long pointId);
Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params); Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params);
/** /**
......
...@@ -632,6 +632,7 @@ ...@@ -632,6 +632,7 @@
ppt.begin_time checkTime, ppt.begin_time checkTime,
ppl.dept_id checkDepartmentId, ppl.dept_id checkDepartmentId,
ppt.user_id userId, ppt.user_id userId,
ppt.user_name userName,
pptd.`status` pointStatus pptd.`status` pointStatus
FROM FROM
p_plan_task_detail pptd p_plan_task_detail pptd
...@@ -669,27 +670,28 @@ ...@@ -669,27 +670,28 @@
LEFT JOIN p_input_item pii ON pii.id = ppii.input_item_id LEFT JOIN p_input_item pii ON pii.id = ppii.input_item_id
WHERE prp.point_id = #{pointId} WHERE prp.point_id = #{pointId}
AND prp.route_id =#{routeId} AND prp.route_id =#{routeId}
AND NOT FIND_IN_SET(prpi.point_input_item_id,prp.exclude_items) <!--AND NOT FIND_IN_SET(prpi.point_input_item_id,prp.exclude_items)-->
ORDER BY AND (FIND_IN_SET(prpi.point_input_item_id,prp.exclude_items) is null or FIND_IN_SET(prpi.point_input_item_id,prp.exclude_items) <![CDATA[<=]]> 0)
prpi.order_no ORDER BY
prpi.order_no
<!-- <!--
SELECT SELECT
pii.`name` inputName, pii.`name` inputName,
pii.id checkInputId pii.id checkInputId
FROM FROM
p_route_point_item prpi, p_route_point_item prpi,
p_route_point prp, p_route_point prp,
p_point_inputitem ppii, p_point_inputitem ppii,
p_input_item pii p_input_item pii
WHERE WHERE
prpi.route_point_id = prp.id prpi.route_point_id = prp.id
AND prpi.point_input_item_id = ppii.id AND prpi.point_input_item_id = ppii.id
AND pii.id = ppii.input_item_id AND pii.id = ppii.input_item_id
AND prp.point_id = #{pointId} AND prp.point_id = #{pointId}
AND prp.route_id = #{routeId} AND prp.route_id = #{routeId}
ORDER BY ORDER BY
prpi.order_no --> prpi.order_no -->
</select> </select>
<select id="getCumulativePlanCountByOrgCode" resultType="String"> <select id="getCumulativePlanCountByOrgCode" resultType="String">
......
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