Commit 80cc8a5d authored by KeYong's avatar KeYong

更新水源接口

parent 8dae380c
...@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.controller;
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.equipmanage.common.entity.dto.OrgUsrDto; import com.yeejoin.equipmanage.common.entity.dto.OrgUsrDto;
import com.yeejoin.equipmanage.common.entity.publics.CommonResponse;
import com.yeejoin.equipmanage.common.utils.*; import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.config.PersonIdentify; import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper; import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
...@@ -204,4 +205,13 @@ public class DCenterController extends AbstractBaseController { ...@@ -204,4 +205,13 @@ public class DCenterController extends AbstractBaseController {
return CommonResponseUtil.success(menus); return CommonResponseUtil.success(menus);
} }
@GetMapping("/water/statics")
@ApiOperation(value = "消防水源信息")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel getFireWaterStatics() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
return CommonResponseUtil.success(fireFightingSystemService.getFireWaterStatics(bizOrgCode));
}
} }
...@@ -680,4 +680,6 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -680,4 +680,6 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Map<String, Object> selectEquipmentSpecificById(@Param("id") String id); Map<String, Object> selectEquipmentSpecificById(@Param("id") String id);
void updateStatusById(@Param("id") String id, @Param("status") String status); void updateStatusById(@Param("id") String id, @Param("status") String status);
Map<String, Object> getFireWaterStatics(@Param("bizOrgCode") String bizOrgCode);
} }
...@@ -317,4 +317,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -317,4 +317,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
*/ */
void resetMorphic(); void resetMorphic();
Map<String, Object> getFireWaterStatics(String bizOrgCode);
} }
...@@ -2456,4 +2456,20 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2456,4 +2456,20 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
} }
@Override
public Map<String, Object> getFireWaterStatics(String bizOrgCode) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> resultMap = fireFightingSystemMapper.getFireWaterStatics(bizOrgCode);
map.put("total", resultMap.get("total"));
map.put("redCode", resultMap.get("redCode"));
map.put("yellowCode", resultMap.get("yellowCode"));
BigDecimal total = new BigDecimal(String.valueOf(resultMap.get("total")));
BigDecimal redNum = new BigDecimal(String.valueOf(resultMap.get("redCode")));
BigDecimal yellowNum = new BigDecimal(String.valueOf(resultMap.get("yellowCode")));
BigDecimal errorNum = redNum.add(yellowNum);
BigDecimal ratePercent = errorNum.divide(total, 2, BigDecimal.ROUND_HALF_UP);
map.put("ratePercent", ratePercent);
return map;
}
} }
...@@ -47,6 +47,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper; ...@@ -47,6 +47,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.math.RoundingMode; import java.math.RoundingMode;
...@@ -177,9 +178,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -177,9 +178,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
CarMapper carMapper; CarMapper carMapper;
@Autowired @Autowired
IMainIotMonitorSerivce iMainIotMonitorSerivce;
@Autowired
private ISyncDataService syncDataService; private ISyncDataService syncDataService;
@Autowired @Autowired
......
...@@ -34,4 +34,12 @@ public class ControlScreenController extends AbstractBaseController { ...@@ -34,4 +34,12 @@ public class ControlScreenController extends AbstractBaseController {
} }
return CommonResponseUtil.success(iPlanTaskService.firePatrolStatics(bizOrgCode)); return CommonResponseUtil.success(iPlanTaskService.firePatrolStatics(bizOrgCode));
} }
@GetMapping("/statics")
@ApiOperation(value = "消防运维信息")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public CommonResponse getStatics(@RequestParam(required = false) String companyCode) {
return CommonResponseUtil.success(iPlanTaskService.getStatics(companyCode));
}
} }
...@@ -216,4 +216,9 @@ public interface PlanTaskMapper extends BaseMapper { ...@@ -216,4 +216,9 @@ public interface PlanTaskMapper extends BaseMapper {
List<Map<String, Object>> getCheckNotQualifiedEquipInfo(@Param(value="taskDetailId") String taskDetailId); List<Map<String, Object>> getCheckNotQualifiedEquipInfo(@Param(value="taskDetailId") String taskDetailId);
String getCheckIdByDetailId(@Param(value="taskDetailId") String taskDetailId); String getCheckIdByDetailId(@Param(value="taskDetailId") String taskDetailId);
String queryByCompanyCode(@Param("companyCode") String companyCode);
List<Map<String, Object>> getStatics(@Param("bizOrgCode") String bizOrgCode);
} }
...@@ -2028,6 +2028,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -2028,6 +2028,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return map; return map;
} }
@Override
public List<Map<String, Object>> getStatics(String companyCode) {
String bizOrgCode = null;
if (StringUtil.isNotEmpty(companyCode)) {
bizOrgCode = planTaskMapper.queryByCompanyCode(companyCode);
}
return planTaskMapper.getStatics(bizOrgCode);
}
public static byte[] file2byte(File file) { public static byte[] file2byte(File file) {
try { try {
FileInputStream in = new FileInputStream(file); FileInputStream in = new FileInputStream(file);
......
...@@ -187,6 +187,8 @@ public interface IPlanTaskService { ...@@ -187,6 +187,8 @@ public interface IPlanTaskService {
*/ */
List<Map<String,Object>> firePatrolStatics(String bizOrgCode); List<Map<String,Object>> firePatrolStatics(String bizOrgCode);
List<Map<String,Object>> getStatics(String companyCode);
/** /**
* 计划执行查询 * 计划执行查询
*/ */
......
...@@ -5892,4 +5892,39 @@ ...@@ -5892,4 +5892,39 @@
update f_fire_fighting_system set system_status = #{status} where id = #{id} update f_fire_fighting_system set system_status = #{status} where id = #{id}
</update> </update>
<select id="getFireWaterStatics" resultType="java.util.Map">
select
(select
count(sequence_nbr)
from
cb_water_resource
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
) AS total,
(select
count(sequence_nbr)
from
cb_water_resource
<where>
water_status = '2'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
) AS redCode,
(select
count(sequence_nbr)
from
cb_water_resource
<where>
water_status = '1'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
) AS yellowCode
</select>
</mapper> </mapper>
...@@ -1354,4 +1354,82 @@ ...@@ -1354,4 +1354,82 @@
<select id="getCheckIdByDetailId" resultType="java.lang.String"> <select id="getCheckIdByDetailId" resultType="java.lang.String">
select id from p_check where plan_task_detail_id = #{taskDetailId} limit 1 select id from p_check where plan_task_detail_id = #{taskDetailId} limit 1
</select> </select>
<select id="getStatics" resultType="java.util.Map">
SELECT
'1' AS `key`,
ifnull( sum( `p_plan_task`.`finish_num` ), 0 ) AS `value`,
'' AS unit,
'今日累计巡查点位' AS `name`,
'xfxcjrljxcdw' AS code
FROM
`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>
UNION ALL
SELECT
ifnull( sum( ppk.`point_num` ), 0 ) AS `value`,
'' AS unit,
'合格' AS `name`,
'xfxchg' AS code,
'2' AS `key`
FROM
`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>
UNION ALL
SELECT
'' AS `value`,
'%' AS unit,
'合格占比' AS `name`,
'xfxchgzb' AS code,
'3' AS `key`
UNION ALL
SELECT
'' AS `value`,
'' AS unit,
'不合格' AS `name`,
'xfxcbhg' AS code,
'4' AS `key`
UNION ALL
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 ) AS `value`,
'' AS unit,
'今日漏查点位' AS `name`,
'currentDayMiss' AS `indexKey`,
'xfxcjrlcdw' AS code,
'5' AS `key`
FROM
`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>
UNION ALL
SELECT
'' AS `value`,
'' AS unit,
'漏查率' AS `name`,
'xfxclcl' AS code,
'6' AS `key`
</select>
<select id="queryByCompanyCode" resultType="java.lang.String">
SELECT biz_org_code
FROM cb_org_usr
WHERE is_delete = 0
<if test="companyCode != null and companyCode != ''">
AND code = #{companyCode}
</if>
</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