Commit 8e8b2fa2 authored by 李秀明's avatar 李秀明

fix(patrol) 巡检接口bug处理

parent ea000999
...@@ -24,8 +24,8 @@ public class FaultCaseServiceImpl extends ServiceImpl<FaultCaseMapper, FaultCase ...@@ -24,8 +24,8 @@ public class FaultCaseServiceImpl extends ServiceImpl<FaultCaseMapper, FaultCase
@Override @Override
public Page<FaultCase> listPage(Page page, FaultCase faultCase) { public Page<FaultCase> listPage(Page page, FaultCase faultCase) {
Page<FaultCase> pages = this.baseMapper.listPage(page, faultCase); Page<FaultCase> pages = this.baseMapper.listPage(page, faultCase);
if (0 < pages.getRecords().size()) { if (!pages.getRecords().isEmpty()) {
pages.getRecords().stream().map(x -> x.setFaultLevel(EmergencyLevelEum.getNameByCode(x.getFaultLevel()))).collect(Collectors.toList()); pages.getRecords().forEach(x -> x.setFaultLevel(EmergencyLevelEum.getNameByCode(x.getFaultLevel())));
} }
return pages; return pages;
} }
......
...@@ -1102,8 +1102,8 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -1102,8 +1102,8 @@ public class PlanTaskController extends AbstractBaseController {
@ApiParam(value = "开始日期") @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate, @ApiParam(value = "开始日期") @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@ApiParam(value = "结束日期") @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) { @ApiParam(value = "结束日期") @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) {
try { try {
Map<String, Object> map = planTaskService.queryPatrolInfo(bizOrgCode, startDate, endDate); List<Map<String, Object>> result = planTaskService.queryPatrolInfo(bizOrgCode, startDate, endDate);
return CommonPatrolResponseUtil.success(map); return CommonPatrolResponseUtil.success(result);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return CommonPatrolResponseUtil.failure("远程查询巡检信息失败!"); return CommonPatrolResponseUtil.failure("远程查询巡检信息失败!");
......
...@@ -2101,12 +2101,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -2101,12 +2101,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public Map<String, Object> queryPatrolInfo(String bizOrgCode, Date startDate, Date endDate) { public List<Map<String, Object>> queryPatrolInfo(String bizOrgCode, Date startDate, Date endDate) {
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
list = planTaskMapper.queryPatrolInfo(bizOrgCode, startDate, endDate); return planTaskMapper.queryPatrolInfo(bizOrgCode, startDate, endDate);
Map<String, Object> map = new HashMap<>();
map.put("patrol", list);
return map;
} }
public static byte[] file2byte(File file) { public static byte[] file2byte(File file) {
......
...@@ -201,6 +201,6 @@ public interface IPlanTaskService { ...@@ -201,6 +201,6 @@ public interface IPlanTaskService {
Map<String,Object> queryPatrolInfoList(String bizOrgCode, Date startDate, Date endDate); Map<String,Object> queryPatrolInfoList(String bizOrgCode, Date startDate, Date endDate);
Map<String,Object> queryPatrolInfo(String bizOrgCode, Date startDate, Date endDate); List<Map<String, Object>> queryPatrolInfo(String bizOrgCode, Date startDate, Date endDate);
} }
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,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
) a ) a
<include refid="plan-task-app-where"/> <include refid="plan-task-app-where"/>
<if test="orderBy != null and orderBy != ''"> order by ${orderBy} </if> <if test="orderBy != null and orderBy != ''"> order by ${orderBy} </if>
...@@ -514,7 +514,7 @@ ...@@ -514,7 +514,7 @@
ptd.route_id routeId, ptd.route_id routeId,
ptd.plan_id planId, ptd.plan_id planId,
ptd.user_id AS userId, ptd.user_id AS userId,
ptd.end_time AS endTime, ptd.end_time AS endTime,
pptd.id as planTaskDetailId, pptd.id as planTaskDetailId,
(select p_plan.dept_id from p_plan where p_plan.id=ptd.plan_id) depId (select p_plan.dept_id from p_plan where p_plan.id=ptd.plan_id) depId
...@@ -1589,54 +1589,52 @@ ...@@ -1589,54 +1589,52 @@
<select id="queryPatrolInfo" resultType="Map"> <select id="queryPatrolInfo" resultType="Map">
SELECT SELECT
s1.date, s1.date,
IFNULL(s2.`name`, '') AS `name`, IFNULL(s2.`name`, '') AS `name`,
IFNULL(s2.`code`, '') AS `code`, IFNULL(s2.`code`, '') AS `code`,
IFNULL(s2.`planPerson`, '') AS planPerson, IFNULL(s2.`planPerson`, '') AS planPerson,
IFNULL(s2.`chargePerson`, '') AS chargePerson, IFNULL(s2.`chargePerson`, '') AS chargePerson,
IFNULL(s2.`beginTime`, '') AS beginTime, IFNULL(s2.`beginTime`, '') AS beginTime,
IFNULL(s2.`endTime`, '') AS endTime, IFNULL(s2.`endTime`, '') AS endTime,
'patrol' AS type 'patrol' AS type
FROM FROM
( (
SELECT SELECT
@s := @s + 1 AS `index`, @s := @s + 1 AS `index`,
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD(#{endDate}, INTERVAL - DATEDIFF(#{endDate}, #{startDate}) DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD(#{endDate}, INTERVAL - DATEDIFF(#{endDate}, #{startDate}) DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date
FROM FROM
mysql.help_topic, mysql.help_topic,
( SELECT @s := -1 ) temp ( SELECT @s := -1 ) temp
WHERE WHERE
@s &lt; DATEDIFF(#{endDate}, #{startDate}) @s &lt; DATEDIFF(#{endDate}, #{startDate})
) s1 ) s1
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
s.* s.*
FROM FROM
( (
SELECT SELECT
p.`name`, p.`name`,
pt.batch_no AS `code`, pt.batch_no AS `code`,
pt.user_name AS planPerson, pt.user_name AS planPerson,
pt.user_name AS chargePerson, pt.user_name AS chargePerson,
pt.begin_time AS beginTime, pt.begin_time AS beginTime,
pt.end_time AS endTime, pt.end_time AS endTime,
DATE_FORMAT(pt.check_date, '%Y-%m-%d') AS date DATE_FORMAT(pt.check_date, '%Y-%m-%d') AS date
FROM FROM
`p_plan_task` pt `p_plan_task` pt
LEFT JOIN p_plan p ON p.id = pt.plan_id LEFT JOIN p_plan p ON p.id = pt.plan_id
<where> <where>
pt.finish_status=2 pt.finish_status=2
<if test="bizOrgCode != null"> <if test="bizOrgCode != null">
AND p.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%') AND p.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if> </if>
</where> </where>
GROUP BY ORDER BY
LEFT (pt.check_date, 10) pt.check_date
ORDER BY ) s
pt.check_date ) s2 ON s2.date = s1.date
) s
) s2 ON s2.date = s1.date
ORDER BY ORDER BY
s1.date s1.date
</select> </select>
</mapper> </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