Commit a5ecc676 authored by suhuiguang's avatar suhuiguang

1.路线编辑删除点,增加约束,级联删除关联的任务点

parent d01dfa5b
...@@ -186,27 +186,6 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -186,27 +186,6 @@ public class PlanTaskController extends AbstractBaseController {
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "维保设施分页列表-mobile", notes = "维保设施分页列表-mobile")
@RequestMapping(value = "/point/{planTaskId}/list", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryPlanTaskById(
@ApiParam(value = "巡检计划任务ID", required = true) @PathVariable Long planTaskId,
@ApiParam(value = "建筑id", required = true) @RequestParam(value = "buildingId", required = false) String buildingId,
@ApiParam(value = "维保状态", required = true) @RequestParam(value = "isFinish", required = false) String isFinish,
@ApiParam(value = "消防系统id", required = true) @RequestParam(value = "systemId", required = false) String systemId,
@ApiParam(value = "设备编号", required = true) @RequestParam(value = "pointNo", required = false) String pointNo,
@ApiParam(value = "设备名称", required = true) @RequestParam(value = "pointName", required = false) String pointName
) {
Map<String, Object> param = new HashMap<>();
param.put("planTaskId", planTaskId);
param.put("buildingId", buildingId);
param.put("isFinish", isFinish);
param.put("systemId", systemId);
param.put("pointNo", pointNo);
param.put("pointName", pointName);
return CommonResponseUtil.success(planTaskService.getPlanTaskPoints(param));
}
/** /**
* 查询任务列表 * 查询任务列表
* *
...@@ -243,6 +222,27 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -243,6 +222,27 @@ public class PlanTaskController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "维保设施分页列表-mobile", notes = "维保设施分页列表-mobile")
@RequestMapping(value = "/point/{planTaskId}/list", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryPlanTaskById(
@ApiParam(value = "巡检计划任务ID", required = true) @PathVariable Long planTaskId,
@ApiParam(value = "建筑id", required = true) @RequestParam(value = "buildingId", required = false) String buildingId,
@ApiParam(value = "维保状态", required = true) @RequestParam(value = "isFinish", required = false) String isFinish,
@ApiParam(value = "消防系统id", required = true) @RequestParam(value = "systemId", required = false) String systemId,
@ApiParam(value = "设备编号", required = true) @RequestParam(value = "pointNo", required = false) String pointNo,
@ApiParam(value = "设备名称", required = true) @RequestParam(value = "pointName", required = false) String pointName
) {
Map<String, Object> param = new HashMap<>();
param.put("planTaskId", planTaskId);
param.put("buildingId", buildingId);
param.put("isFinish", isFinish);
param.put("systemId", systemId);
param.put("pointNo", pointNo);
param.put("pointName", pointName);
return CommonResponseUtil.success(planTaskService.getPlanTaskPoints(param));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询维保设施,检查内容详情") @ApiOperation(value = "查询维保设施,检查内容详情")
@GetMapping(value = "/task-point-detail") @GetMapping(value = "/task-point-detail")
public CommonResponse planTaskPointDetail( public CommonResponse planTaskPointDetail(
......
...@@ -9,4 +9,6 @@ public interface PlanTaskDetailMapper extends BaseMapper { ...@@ -9,4 +9,6 @@ public interface PlanTaskDetailMapper extends BaseMapper {
, @Param(value="executorId") String executorId); , @Param(value="executorId") String executorId);
Map findPlanTaskByTaskIdAndPointId(@Param(value="planTaskId") long planTaskId,@Param(value="pointId") long pointId); Map findPlanTaskByTaskIdAndPointId(@Param(value="planTaskId") long planTaskId,@Param(value="pointId") long pointId);
void deleteByPointIdAndRouteId(@Param("pointId") long pointId, @Param("routeId") long routeId);
} }
package com.yeejoin.amos.maintenance.business.service.impl; package com.yeejoin.amos.maintenance.business.service.impl;
import com.yeejoin.amos.maintenance.business.constants.XJConstant; import com.yeejoin.amos.maintenance.business.constants.XJConstant;
import com.yeejoin.amos.maintenance.business.dao.mapper.InputItemMapper; import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PointMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.RouteMapper; import com.yeejoin.amos.maintenance.business.dao.mapper.RouteMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.RoutePointItemMapper;
import com.yeejoin.amos.maintenance.business.dao.repository.*; import com.yeejoin.amos.maintenance.business.dao.repository.*;
import com.yeejoin.amos.maintenance.business.param.RoutePageParam; import com.yeejoin.amos.maintenance.business.param.RoutePageParam;
import com.yeejoin.amos.maintenance.business.service.intfc.IPlanService; import com.yeejoin.amos.maintenance.business.service.intfc.IPlanService;
...@@ -18,7 +16,6 @@ import com.yeejoin.amos.maintenance.core.common.response.RoutePointRespone; ...@@ -18,7 +16,6 @@ import com.yeejoin.amos.maintenance.core.common.response.RoutePointRespone;
import com.yeejoin.amos.maintenance.core.util.query.BaseQuerySpecification; import com.yeejoin.amos.maintenance.core.util.query.BaseQuerySpecification;
import com.yeejoin.amos.maintenance.dao.entity.*; import com.yeejoin.amos.maintenance.dao.entity.*;
import com.yeejoin.amos.maintenance.exception.YeeException; import com.yeejoin.amos.maintenance.exception.YeeException;
import com.yeejoin.amos.maintenance.feign.RemoteSecurityService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -53,15 +50,6 @@ public class RouteServiceImpl implements IRouteService { ...@@ -53,15 +50,6 @@ public class RouteServiceImpl implements IRouteService {
@Resource @Resource
private RouteMapper routeMapper; private RouteMapper routeMapper;
@Resource
private PointMapper pointMapper;
@Resource
private InputItemMapper inputItemMapper;
@Resource
private RoutePointItemMapper routePointItemMapper;
@Autowired @Autowired
private IPointInputItemDao iPointInputItemDao; private IPointInputItemDao iPointInputItemDao;
...@@ -72,9 +60,10 @@ public class RouteServiceImpl implements IRouteService { ...@@ -72,9 +60,10 @@ public class RouteServiceImpl implements IRouteService {
private IPlanTaskService planTaskService; private IPlanTaskService planTaskService;
@Autowired @Autowired
private IRoutePointItemDao iRoutePointItemDao; PlanTaskDetailMapper planTaskDetailMapper;
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private IRoutePointItemDao iRoutePointItemDao;
@Override @Override
@Transactional @Transactional
...@@ -119,6 +108,7 @@ public class RouteServiceImpl implements IRouteService { ...@@ -119,6 +108,7 @@ public class RouteServiceImpl implements IRouteService {
Long routeId = route.getId(); Long routeId = route.getId();
String orgCode = route.getOrgCode(); String orgCode = route.getOrgCode();
String creatorId = route.getCreatorId(); String creatorId = route.getCreatorId();
Route finalRoute = route;
routePoints.forEach(rp -> { routePoints.forEach(rp -> {
rp.setOrgCode(orgCode); rp.setOrgCode(orgCode);
rp.setRouteId(routeId); rp.setRouteId(routeId);
...@@ -126,6 +116,8 @@ public class RouteServiceImpl implements IRouteService { ...@@ -126,6 +116,8 @@ public class RouteServiceImpl implements IRouteService {
if (rp.getIsDelete()) { if (rp.getIsDelete()) {
iRoutePointItemDao.delRoutePointItem(rp.getId()); iRoutePointItemDao.delRoutePointItem(rp.getId());
iRoutePointDao.deleteById(rp.getId()); iRoutePointDao.deleteById(rp.getId());
//删除p_plan_task_detail 对应点
planTaskDetailMapper.deleteByPointIdAndRouteId(rp.getPointId(), finalRoute.getId());
} else { } else {
List<RoutePointItem> routePointItems = rp.getRoutePointItem(); List<RoutePointItem> routePointItems = rp.getRoutePointItem();
iRoutePointDao.saveAndFlush(rp); iRoutePointDao.saveAndFlush(rp);
......
...@@ -205,6 +205,7 @@ ...@@ -205,6 +205,7 @@
p_plan_task pt p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id INNER JOIN p_plan p ON pt.plan_id = p.id
INNER JOIN p_route r on r.id = pt.route_id INNER JOIN p_route r on r.id = pt.route_id
where pt.status = 0
) a ) a
<include refid="mobile-plan-task-where" /> <include refid="mobile-plan-task-where" />
<if test="orderBy != null and orderBy != ''"> order by ${orderBy}</if> <if test="orderBy != null and orderBy != ''"> order by ${orderBy}</if>
...@@ -263,6 +264,7 @@ ...@@ -263,6 +264,7 @@
p_plan_task pt p_plan_task pt
INNER JOIN p_plan p ON pt.plan_id = p.id INNER JOIN p_plan p ON pt.plan_id = p.id
INNER JOIN p_route r on r.id = pt.route_id INNER JOIN p_route r on r.id = pt.route_id
where pt.status = 0
) a ) a
<include refid="mobile-plan-task-where" /> <include refid="mobile-plan-task-where" />
</select> </select>
......
...@@ -5,7 +5,12 @@ ...@@ -5,7 +5,12 @@
<update id="finishTaskDetail"> <update id="finishTaskDetail">
call updatePlanTask(#{planTaskId}, #{pointId}, #{planTaskDetailId} ,#{executorId}) call updatePlanTask(#{planTaskId}, #{pointId}, #{planTaskDetailId} ,#{executorId})
</update> </update>
<delete id="deleteByPointIdAndRouteId">
delete FROM `p_plan_task_detail`
where
point_id = #{pointId}
and task_no in (select id from p_plan_task t where t.route_id = #{routeId}) ;
</delete>
<select id="findPlanTaskByTaskIdAndPointId" resultType="Map"> <select id="findPlanTaskByTaskIdAndPointId" resultType="Map">
SELECT SELECT
p.name planName, pt.begin_time beginTime, pt.end_time endTime, pp.name pointName, pp.point_no pointNo, ptd.id planTaskDetailId, pt.route_id routeId, pr.name routeName p.name planName, pt.begin_time beginTime, pt.end_time endTime, pp.name pointName, pp.point_no pointNo, ptd.id planTaskDetailId, pt.route_id routeId, pr.name routeName
......
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