Commit e0e8635d authored by 李秀明's avatar 李秀明

fix(patrol): 巡检接口查询数据错误

parent d968c366
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil; import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.utils.DateUtils; import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.config.PersonIdentify; import com.yeejoin.equipmanage.config.PersonIdentify;
...@@ -18,6 +21,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -18,6 +21,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -41,6 +45,9 @@ public class EmergencyController extends AbstractBaseController { ...@@ -41,6 +45,9 @@ public class EmergencyController extends AbstractBaseController {
@Autowired @Autowired
IEmergencyService iEmergencyService; IEmergencyService iEmergencyService;
@Autowired
RedisUtils redisUtils;
/** /**
* 通过bizOrgCode过滤 * 通过bizOrgCode过滤
*/ */
...@@ -48,8 +55,8 @@ public class EmergencyController extends AbstractBaseController { ...@@ -48,8 +55,8 @@ public class EmergencyController extends AbstractBaseController {
@ApiOperation("系统状态") @ApiOperation("系统状态")
@GetMapping(value = "/system/state") @GetMapping(value = "/system/state")
public ResponseModel getSystemState() { public ResponseModel getSystemState() {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode(); String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
return CommonResponseUtil.success(iEmergencyService.getSystemState(bizOrgCode)); return CommonResponseUtil.success(iEmergencyService.getSystemState(bizOrgCode));
} }
......
...@@ -99,10 +99,10 @@ public class CheckController extends AbstractBaseController { ...@@ -99,10 +99,10 @@ public class CheckController extends AbstractBaseController {
// //
// @Value("${file.port}") // @Value("${file.port}")
// private String filePort; // private String filePort;
// @Value("${file.url}") // @Value("${file.url}")
// private String fileUrl; // private String fileUrl;
@Value("${amosRefresh.patrol.topic}") @Value("${amosRefresh.patrol.topic}")
private String patrolTopic; private String patrolTopic;
@Autowired @Autowired
...@@ -137,7 +137,7 @@ public class CheckController extends AbstractBaseController { ...@@ -137,7 +137,7 @@ public class CheckController extends AbstractBaseController {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
param.setOrderBy("checkDate desc"); param.setOrderBy("checkDate desc");
param.setBizOrgCode(ObjectUtils.isEmpty(param.getBizOrgCode()) ? param.setBizOrgCode(ObjectUtils.isEmpty(param.getBizOrgCode()) ?
"3".equals(param.getIsOK()) ? null : reginParams.getPersonIdentity().getBizOrgCode() "3".equals(param.getIsOK()) ? null : reginParams.getPersonIdentity().getCompanyBizOrgCode()
: param.getBizOrgCode()); : param.getBizOrgCode());
if(commonPageable !=null){ if(commonPageable !=null){
param.setPageNumber(commonPageable.getPageNumber()-1); param.setPageNumber(commonPageable.getPageNumber()-1);
......
...@@ -43,6 +43,10 @@ public class ControlScreenController extends AbstractBaseController { ...@@ -43,6 +43,10 @@ public class ControlScreenController extends AbstractBaseController {
@RequestParam(required = false) String companyCode, @RequestParam(required = false) String companyCode,
@RequestParam(required = false) String bizOrgCode @RequestParam(required = false) String bizOrgCode
) { ) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
}
return CommonResponseUtil.success(iPlanTaskService.getStatics(companyCode, bizOrgCode)); return CommonResponseUtil.success(iPlanTaskService.getStatics(companyCode, bizOrgCode));
} }
......
...@@ -23,6 +23,8 @@ public interface CheckMapper extends BaseMapper { ...@@ -23,6 +23,8 @@ public interface CheckMapper extends BaseMapper {
long getCheckInfoCount(CheckInfoPageParam param); long getCheckInfoCount(CheckInfoPageParam param);
long getCheckInfoCountNew(CheckInfoPageParam param);
List<Map> queryUnqualifiedInputItem(@Param(value="checkId") int checkId); List<Map> queryUnqualifiedInputItem(@Param(value="checkId") int checkId);
List<Map> queryCheckPointInputItem(@Param(value="planTaskId") int planTaskId, @Param(value="pointId") int pointId); List<Map> queryCheckPointInputItem(@Param(value="planTaskId") int planTaskId, @Param(value="pointId") int pointId);
......
...@@ -159,7 +159,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -159,7 +159,7 @@ public class CheckServiceImpl implements ICheckService {
} }
public Page<CheckInfoVo> getCheckInfoNew(String toke,String product,String appKey,CheckInfoPageParam param) { public Page<CheckInfoVo> getCheckInfoNew(String toke,String product,String appKey,CheckInfoPageParam param) {
long total = checkMapper.getCheckInfoCount(param); long total = checkMapper.getCheckInfoCountNew(param);
List<CheckInfoVo> content = Lists.newArrayList(); List<CheckInfoVo> content = Lists.newArrayList();
if (total == 0) { if (total == 0) {
return new PageImpl<>(content, param, total); return new PageImpl<>(content, param, total);
......
...@@ -1359,91 +1359,103 @@ ...@@ -1359,91 +1359,103 @@
<select id="getStatics" resultType="java.util.Map"> <select id="getStatics" resultType="java.util.Map">
SELECT SELECT
'0' AS `key`, '0' AS `key`,
ifnull( sum( `p_plan_task`.`point_num` ), 0 ) AS `value`, ifnull( sum( `p_plan_task`.`point_num` ), 0 ) AS `value`,
'' AS unit, '' AS unit,
'今日总巡查点位' AS `name`, '今日总巡查点位' AS `name`,
'xfxcjrzxcdw' AS code 'xfxcjrzxcdw' AS code
FROM FROM
`p_plan_task` `p_plan_task`
WHERE WHERE
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE () DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if test="bizOrgCode != null and bizOrgCode != ''"> <if test="bizOrgCode != null and bizOrgCode != ''">
AND org_code LIKE CONCAT(#{bizOrgCode}, '%') AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if> </if>
UNION ALL UNION ALL
SELECT SELECT
'1' AS `key`, '1' AS `key`,
ifnull( sum( `p_plan_task`.`finish_num` ), 0 ) AS `value`, ifnull( sum( `p_plan_task`.`finish_num` ), 0 ) AS `value`,
'' AS unit, '' AS unit,
'今日累计巡查点位' AS `name`, '今日累计巡查点位' AS `name`,
'xfxcjrljxcdw' AS code 'xfxcjrljxcdw' AS code
FROM FROM
`p_plan_task` `p_plan_task`
WHERE WHERE
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE () DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if test="bizOrgCode != null and bizOrgCode != ''"> <if test="bizOrgCode != null and bizOrgCode != ''">
AND org_code LIKE CONCAT(#{bizOrgCode}, '%') AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if> </if>
UNION ALL UNION ALL
SELECT SELECT
'2' AS `key`, '2' AS `key`,
count(1) AS `value`, count(1) AS `value`,
'' AS unit, '' AS unit,
'合格' AS `name`, '合格' AS `name`,
'xfxchg' AS code 'xfxchg' AS code
FROM FROM
`p_plan_task` ppk `p_plan_task` ppk
LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id
WHERE WHERE
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE () AND pptd.STATUS = 1 DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE () AND pptd.STATUS = 1
<if test="bizOrgCode != null and bizOrgCode != ''"> <if test="bizOrgCode != null and bizOrgCode != ''">
AND org_code LIKE CONCAT(#{bizOrgCode}, '%') AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if> </if>
UNION ALL UNION ALL
SELECT SELECT
'3' AS `key`, '3' AS `key`,
'' AS `value`, '' AS `value`,
'%' AS unit, '%' AS unit,
'合格占比' AS `name`, '合格占比' AS `name`,
'xfxchgzb' AS code 'xfxchgzb' AS code
UNION ALL UNION ALL
SELECT SELECT
'4' AS `key`, '4' AS `key`,
count(1) AS `value`, count(1) AS `value`,
'' AS unit, '' AS unit,
'不合格' AS `name`, '不合格' AS `name`,
'xfxcbhg' AS code 'xfxcbhg' AS code
FROM FROM
`p_plan_task` ppk `p_plan_task` ppk
LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id
WHERE WHERE
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE () AND pptd.STATUS = 2 DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE () AND pptd.STATUS = 2
<if test="bizOrgCode != null and bizOrgCode != ''"> <if test="bizOrgCode != null and bizOrgCode != ''">
AND org_code LIKE CONCAT(#{bizOrgCode}, '%') AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if> </if>
UNION ALL UNION ALL
SELECT SELECT
'5' AS `key`, '5' AS `key`,
count(1) AS `value`, count(1) AS `value`,
'' AS unit, '' AS unit,
'今日漏查点位' AS `name`, '今日漏查点位' AS `name`,
'xfxcjrlcdw' AS code 'xfxcjrlcdw' AS code
FROM FROM
`p_plan_task` `p_plan_task`
WHERE WHERE
`finish_status` = 3 `finish_status` = 3
AND DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE () AND DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if test="bizOrgCode != null and bizOrgCode != ''"> <if test="bizOrgCode != null and bizOrgCode != ''">
AND org_code LIKE CONCAT(#{bizOrgCode}, '%') AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if> </if>
UNION ALL UNION ALL
SELECT SELECT
'6' AS `key`, '6' AS `key`,
'' AS `value`, '' AS `value`,
'%' AS unit, '%' AS unit,
'漏查率' AS `name`, '漏查率' AS `name`,
'xfxclcl' AS code 'xfxclcl' AS code
</select> </select>
<select id="queryByCompanyCode" resultType="java.lang.String"> <select id="queryByCompanyCode" resultType="java.lang.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