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

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

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