Commit e8026901 authored by KeYong's avatar KeYong

更新消防监督接口

parent a754a80d
......@@ -14,10 +14,12 @@ public enum OrderByEnum {
*/
TIME_DESC("时间倒序", "1", "beginTime desc"),
TIME_ASC("时间正序", "2", "beginTime asc"),
PLAN_TASK_NUM_ASC("计划维保设施数正序", "3", "taskPlanNum asc"),
PLAN_TASK_NUM_DESC("计划维保设施数倒序", "4", "taskPlanNum desc"),
PLAN_TASK_NUM_ASC("检查设施数正序", "3", "taskPlanNum asc"),
PLAN_TASK_NUM_DESC("检查设施数倒序", "4", "taskPlanNum desc"),
FINISH_NUM_DESC("完成数倒序", "5", "finishNum desc"),
FINISH_NUM_ASC("完成数正序", "6", "finishNum asc");
FINISH_NUM_ASC("完成数正序", "6", "finishNum asc"),
PLAN_TASK_ITEM_NUM_ASC("检查项正序", "7", "itemNum asc"),
PLAN_TASK_ITEM_NUM_DESC("检查项正序", "8", "itemNum desc");
/**
* 名字
......
......@@ -4,9 +4,10 @@ import java.util.ArrayList;
import java.util.List;
public enum PlanTaskDetailIsFinishEnum {
UNFINISHED("未完成",0),
FINISHED("已完成",1),
OVERTIME("超时漏检",2);
UNFINISHED("未开始",0),
EXECUTION("执行中",1),
FINISHED("已完成",2),
OVERTIME("超时漏检",3);
/**
* 名称
......
......@@ -7,7 +7,7 @@ import java.util.Map;
public enum PlanTaskFinishStatusEnum {
NOTSTARTED("未开始",0),
UNDERWAY("处理中",1),
UNDERWAY("待执行",1),
FINISHED("已结束",2),
OVERTIME("已超时",3);
......
package com.yeejoin.amos.supervision.common.enums;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author DELL
*
*/
public enum TaskCheckTypeEnum {
/**
* 维保任务排序
*/
RCJC("日常检查", "1"),
ZXJC("专项检查", "2");
/**
* 名字
*/
private String name;
/**
* 编号
*/
private String code;
TaskCheckTypeEnum(String name, String code) {
this.code = code;
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public static List<Map<String, Object>> getEnumList() {
return Arrays.stream(TaskCheckTypeEnum.values()).map(e -> {
Map<String, Object> map = new HashMap<>();
map.put(e.getCode(), e.getName());
return map;
}).collect(Collectors.toList());
}
public static TaskCheckTypeEnum getEumByCode(String code) throws Exception {
Optional<TaskCheckTypeEnum> op = Arrays.stream(TaskCheckTypeEnum.values()).filter(e->e.getCode().equals(code)).findFirst();
return op.orElseThrow(()->new Exception("非法的条件"));
}
}
......@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.supervision.business.vo.CodeOrderVo;
import com.yeejoin.amos.supervision.business.vo.PlanTaskVo;
import com.yeejoin.amos.supervision.business.vo.PointInputItemVo;
import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.supervision.exception.YeeException;
import com.yeejoin.amos.supervision.feign.RemoteSecurityService;
import org.slf4j.Logger;
......@@ -43,10 +44,6 @@ import com.yeejoin.amos.supervision.business.util.CommonResponseUtil;
import com.yeejoin.amos.supervision.business.util.FileHelper;
import com.yeejoin.amos.supervision.business.util.PlanTaskPageParamUtil;
import com.yeejoin.amos.supervision.business.util.Toke;
import com.yeejoin.amos.supervision.common.enums.OrderByEnum;
import com.yeejoin.amos.supervision.common.enums.PlanTaskDetailStatusEnum;
import com.yeejoin.amos.supervision.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.supervision.common.enums.TaskIsOrderEnum;
import com.yeejoin.amos.supervision.core.common.request.CommonPageable;
import com.yeejoin.amos.supervision.core.common.request.CommonRequest;
import com.yeejoin.amos.supervision.core.common.response.AppPointCheckRespone;
......@@ -56,6 +53,8 @@ import com.yeejoin.amos.supervision.dao.entity.PointClassify;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController
@RequestMapping(value = "/api/planTask")
......@@ -489,43 +488,71 @@ public class PlanTaskController extends AbstractBaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "维保任务查询-mobile", notes = "根据用户条件查询所有计划任务")
@ApiOperation(value = "消防监督任务查询-mobile", notes = "根据用户条件查询所有计划任务")
@RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryLoginUserPlanTask(
public ResponseModel qryLoginUserPlanTask(
@ApiParam(value = "人员") @RequestParam(value = "userId", required = false) Long userId,
@ApiParam(value = "开始日期") @RequestParam(value = "startTime") String startTime,
@ApiParam(value = "结束日期") @RequestParam(value = "endTime") String endTime,
@ApiParam(value = "维保状态") @RequestParam(value = "finishStatus", required = false) Integer finishStatus,
@ApiParam(value = "检查状态") @RequestParam(value = "finishStatus", required = false) Integer finishStatus,
@ApiParam(value = "排序条件") @RequestParam(value = "orderBy") String orderBy,
@ApiParam(value = "业主单位") @RequestParam(value = "companyId", required = false) String companyId,
@ApiParam(value = "被检查单位") @RequestParam(value = "companyId", required = false) String companyId,
@ApiParam(value = "检查人员") @RequestParam(value = "executorId", required = false) Long executorId,
@ApiParam(value = "任务类型") @RequestParam(value = "taskType", required = false) String taskType,
@ApiParam(value = "当前页") @RequestParam(value = "pageNumber") int pageNumber,
@ApiParam(value = "页大小") @RequestParam(value = "pageSize") int pageSize) throws Exception {
HashMap<String, Object> params = new HashMap<String, Object>();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
Map<String, Object> authMap = Bean.BeantoMap(reginParams.getPersonIdentity());
params.putAll(authMap);
// ReginParams reginParams = getSelectedOrgInfo();
// String loginOrgCode = getOrgCode(reginParams);
// Map<String, Object> authMap = Bean.BeantoMap(reginParams.getPersonIdentity());
// params.putAll(authMap);
params.put("userId", userId);
params.put("companyId", companyId);
params.put("orgCode", loginOrgCode);
params.put("userId", userId);
params.put("taskType", taskType);
params.put("startTime", startTime);
params.put("endTime", endTime);
params.put("executorId", executorId);
params.put("finishStatus", finishStatus);
params.put("taskType", TaskCheckTypeEnum.getEumByCode(taskType).getName());
params.put("orderBy", OrderByEnum.getEumByCode(orderBy).getOderBy());
CommonPageable pageable = new CommonPageable(pageNumber, pageSize);
return ResponseHelper.buildResponse(planTaskService.getPlanTasks(params, pageable));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据检查任务ID查询计划任务详情和任务点(<font color='blue'>手机app</font>)", notes = "根据检查任务ID查询计划任务详情和任务点(<font color='blue'>手机app</font>)")
@RequestMapping(value = "/detail", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public ResponseModel qryPlanTaskDetailById(
@ApiParam(value = "检查计划任务ID", required = true) @RequestParam Long planTaskId) {
ResponseModel result = null;
try {
return CommonResponseUtil.success(planTaskService.getPlanTasks(params, pageable));
Map<String, Object> response = new HashMap<String, Object>();
Map task = planTaskService.queryPlanTaskById(planTaskId);
if (ObjectUtils.isEmpty(task) || ObjectUtils.isEmpty(task.get("planTaskId"))) {
result = ResponseHelper.buildResponse("该计划已刷新,请重新选择!!!");
} else {
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);
result = ResponseHelper.buildResponse(response);
}
} catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage());
e.printStackTrace();
}
return result;
}
public static Object nvl(Object param) {
return param != null ? param : null;
}
/**
* 查询任务列表
*/
......
......@@ -61,6 +61,8 @@ import com.yeejoin.amos.supervision.dao.entity.PointClassify;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController
@RequestMapping(value = "/api/point")
......@@ -804,4 +806,11 @@ public class PointController extends AbstractBaseController {
return CommonResponseUtil.success(iPointService.getRegionTress());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询巡检点详情<font color='blue'>手机app</font>)", notes = "查询巡检点详情<font color='blue'>手机app</font>)")
@GetMapping(value = "/detail/item", produces = "application/json;charset=UTF-8")
public ResponseModel queryItemDetailByPointId(@ApiParam(value = "巡检点id", required = true) @RequestParam(name = "pointId") Long id) {
return ResponseHelper.buildResponse(iPointService.queryItemDetailByPointId(id));
}
}
......@@ -156,4 +156,6 @@ public interface PointMapper extends BaseMapper {
* 根据路线id查询所有点
*/
List<Long> getPointoriginalidbyrouteid(@Param(value = "routeId") Long routeId);
List<Map<String, Object>> queryItemsByPointId(@Param(value = "pointId") Long pointId);
}
......@@ -30,6 +30,7 @@ import com.yeejoin.amos.supervision.business.vo.CalDateVo;
import com.yeejoin.amos.supervision.business.vo.CodeOrderVo;
import com.yeejoin.amos.supervision.business.vo.LeavePlanTaskVo;
import com.yeejoin.amos.supervision.business.vo.PlanTaskVo;
import com.yeejoin.amos.supervision.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.supervision.core.common.request.CommonPageable;
import com.yeejoin.amos.supervision.core.common.response.AppCheckInputRespone;
import com.yeejoin.amos.supervision.core.common.response.AppPointCheckRespone;
......@@ -577,13 +578,27 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
if (total == 0) {
return new PageImpl<>(content, pageParam, total);
}
params.put("offset", pageParam.getOffset());
params.put("pageSize", pageParam.getPageSize());
content = planTaskMapper.getPlanTasks(params);
content.forEach(c -> {
if (c.containsKey("finishStatus")) {
String finishStatusDesc = PlanTaskFinishStatusEnum.getName(Integer.parseInt(c.get("finishStatus").toString()));
c.put("finishStatusDesc", finishStatusDesc);
}
});
return new PageImpl<>(content, pageParam, total);
}
@Override
public Map queryPlanTaskById(Long planTaskId) {
return planTaskMapper.queryPlanTaskById(planTaskId);
Map map = new HashMap();
map = planTaskMapper.queryPlanTaskById(planTaskId);
if (map.containsKey("finishStatus")) {
String finishStatusDesc = PlanTaskFinishStatusEnum.getName(Integer.parseInt(map.get("finishStatus").toString()));
map.put("finishStatusDesc", finishStatusDesc);
}
return map;
}
@Override
......
......@@ -131,6 +131,9 @@ public class PointServiceImpl implements IPointService {
@Autowired
Sequence sequence;
@Value("${file.url}")
private String fileUrl;
@Override
@Transactional
public Point addPoint(PointParam pointParam) {
......@@ -1205,4 +1208,17 @@ public class PointServiceImpl implements IPointService {
iPointDao.delPointByPointNo(id);
}
@Override
public List<Map<String, Object>> queryItemDetailByPointId(Long id) {
List<Map<String, Object>> list = pointMapper.queryItemsByPointId(id);
if (0 < list.size()) {
for (Map<String, Object> map : list) {
if (map.containsKey("picJson") && !ObjectUtils.isEmpty(map.get("picJson"))) {
map.put("remark", fileUrl + map.get("remark"));
}
}
}
return list;
}
}
......@@ -327,4 +327,6 @@ public interface IPointService {
*/
void delPointByPointNo(Long id);
List<Map<String, Object>> queryItemDetailByPointId(Long id);
}
......@@ -158,4 +158,14 @@
ALTER TABLE `p_plan_task_detail` ADD COLUMN `major_danger_num` int(11) DEFAULT 0 COMMENT '重大隐患个数' AFTER `safety_danger_num`;
</sql>
</changeSet>
<changeSet author="keyong" id="1629863569-1">
<preConditions onFail="MARK_RAN">
<columnExists tableName="p_plan_task_detail" columnName="is_finish"/>
</preConditions>
<comment>p_plan_task_detail modify column is_finish</comment>
<sql>
alter table `p_plan_task_detail` modify column `is_finish` int(11) COMMENT '0-未开始,1-执行中,2-已完成,3-超时漏检(有一个检查项漏检则为漏检)' after `create_date`;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -178,6 +178,7 @@
pt.id planTaskId,
pt.org_code orgCode,
p.name taskName,
p.check_type_name checkTypeName,
pt.status,
pt.user_id userId,
date_format(
......@@ -200,11 +201,14 @@
pt.route_id,
pt.user_name userName,
r.owner_id,
R.owner_name as ownerName
R.owner_name as ownerName,
ptd.item_num AS itemNum,
ptd.executor_id AS executorId
FROM
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_plan_task_detail ptd ON ptd.task_no = pt.id
) a
<include refid="mobile-plan-task-where" />
limit #{offset},#{pageSize}
......@@ -212,8 +216,11 @@
<sql id="mobile-plan-task-where">
<where>
<if test="userId != null and userId > 0 "> and find_in_set(#{userId},a.userId)>0</if>
<if test="executorId != null and executorId > 0 "> and find_in_set(#{executorId},a.executorId)>0</if>
<if test="companyId != null"> and a.owner_id = #{companyId}</if>
<if test="taskType != null"> and a.checkTypeName = #{taskType}</if>
<if test="finishStatus != null"> and a.finishStatus = #{finishStatus}</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
AND (
(
a.beginTime <![CDATA[>=]]> #{startTime}
......@@ -233,15 +240,15 @@
)
)
</if>
<choose>
<when test="identityType==1">
And (a.orgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.orgCode= #{orgCode} )
<if test="companyId != null"> and a.owner_id = #{companyId}</if>
</when>
<when test="identityType==2">
And a.owner_id = #{companyId}
</when>
</choose>
<!-- <choose>-->
<!-- <when test="identityType==1">-->
<!-- And (a.orgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.orgCode= #{orgCode} )-->
<!-- <if test="companyId != null"> and a.owner_id = #{companyId}</if>-->
<!-- </when>-->
<!-- <when test="identityType==2">-->
<!-- And a.owner_id = #{companyId}-->
<!-- </when>-->
<!-- </choose>-->
</where>
<if test="orderBy != null and orderBy != ''"> order by ${orderBy} </if>
</sql>
......@@ -258,11 +265,13 @@
pt.org_code as orgCode,
pt.begin_time as beginTime,
pt.end_time as endTime,
r.owner_id
r.owner_id,
ptd.item_num AS itemNum
FROM
p_plan_task pt
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_plan_task_detail ptd ON ptd.task_no = pt.id
) a
<include refid="mobile-plan-task-where" />
</select>
......@@ -282,6 +291,10 @@
count(a.finish) taskPlanNum,
a.finishStatus,
a.batchNo,
a.itemNum,
a.remain,
a.safetyNum,
a.majorNum,
a.inOrder
FROM
(
......@@ -304,6 +317,10 @@
pt.finish_num finishNum,
pt.finish_status finishStatus,
pt.batch_no batchNo,
ptd.item_num itemNum,
(ptd.item_num - ptd.executed_num) remain,
ptd.safety_danger_num safetyNum,
ptd.major_danger_num majorNum,
CASE ptd.`status`
WHEN 1 THEN
1
......@@ -527,7 +544,6 @@
<if test="endTime != null and endTime != '' "> and pt.begin_time <![CDATA[<=]]> #{endTime} </if>
</where>
) a
</select>
<select id="getPointPlanTaskInfo" resultType="com.yeejoin.amos.supervision.business.entity.mybatis.PointCheckDetailBo" parameterType="long">
......
......@@ -1139,4 +1139,28 @@
WHERE
prp.route_id = #{routeId}
</select>
<select id="queryItemsByPointId" resultType="map">
SELECT
ppi.id,
ppi.input_item_id itemId,
ppi.point_id pointId,
pii.name itemName,
pii.item_type itemTyp,
pii.data_json dataJson,
pii.remark remark,
pii.picture_json picJson,
CASE pii.`input_type`
WHEN 0 THEN
'手动录入'
ELSE
'同步'
END inputType
FROM
p_point_inputitem ppi
LEFT JOIN p_input_item pii ON pii.id = ppi.input_item_id
WHERE
ppi.point_id = #{pointId} AND pii.is_delete = 0
ORDER BY pii.order_no
</select>
</mapper>
\ No newline at end of file
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