Commit b9ae6138 authored by 张森's avatar 张森

Merge remote-tracking branch 'origin/develop_dl' into develop_dl

parents 9803ced7 1b6ac106
...@@ -20,6 +20,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -20,6 +20,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j @Slf4j
...@@ -74,4 +75,16 @@ public class FireResourceSupervisionController extends BaseController { ...@@ -74,4 +75,16 @@ public class FireResourceSupervisionController extends BaseController {
}}; }};
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备平台消防资源-消防器材接口", notes = "设备平台消防资源-消防器材接口")
@RequestMapping(value = "/equip/statistic", method = RequestMethod.GET)
public ResponseModel<Object> equipStatistic(@RequestParam(value = "type", required = false) String type, @RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtils.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
List<Map<String, Object>> fireEquipStats = iFireResourceSupervisionService.getFireEquipStatistic(type, bizOrgCode);
return ResponseHelper.buildResponse(fireEquipStats);
}
} }
...@@ -743,5 +743,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -743,5 +743,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> getEquipmentRunLogBySysInfo(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode, Page<Map<String, Object>> getEquipmentRunLogBySysInfo(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode,
@Param("fireEquipmentName") String fireEquipmentName, @Param("startTime") String startTime, @Param("endTime") String endTime); @Param("fireEquipmentName") String fireEquipmentName, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<Map<String, Object>> getFireEquipStatistic(@Param("collect") List<String> collect, @Param("bizOrgCode")String bizOrgCode);
List<EquipCountBySystemVO> getFireEquipConfigInfo(@Param("codes") List<String> codes); List<EquipCountBySystemVO> getFireEquipConfigInfo(@Param("codes") List<String> codes);
} }
...@@ -2,6 +2,9 @@ package com.yeejoin.equipmanage.service; ...@@ -2,6 +2,9 @@ package com.yeejoin.equipmanage.service;
import com.yeejoin.equipmanage.common.entity.dto.FireResourceStatsDTO; import com.yeejoin.equipmanage.common.entity.dto.FireResourceStatsDTO;
import java.util.List;
import java.util.Map;
/** /**
* 消防资源监管 * 消防资源监管
*/ */
...@@ -25,4 +28,6 @@ public interface IFireResourceSupervisionService { ...@@ -25,4 +28,6 @@ public interface IFireResourceSupervisionService {
FireResourceStatsDTO getFireCarStats(String bizOrgCode); FireResourceStatsDTO getFireCarStats(String bizOrgCode);
FireResourceStatsDTO getFireEquipStats(String bizOrgCode); FireResourceStatsDTO getFireEquipStats(String bizOrgCode);
List<Map<String, Object>> getFireEquipStatistic(String type, String bizOrgCode);
} }
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.equipmanage.common.entity.dto.FireResourceStatsDTO; import com.yeejoin.equipmanage.common.entity.dto.FireResourceStatsDTO;
import com.yeejoin.equipmanage.common.enums.EmergencyEquipTypeEnum; import com.yeejoin.equipmanage.common.enums.EmergencyEquipTypeEnum;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.fegin.JcsFeign;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper; import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IFireResourceSupervisionService; import com.yeejoin.equipmanage.service.IFireResourceSupervisionService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -19,6 +26,9 @@ public class IFireResourceSupervisionServiceImpl implements IFireResourceSupervi ...@@ -19,6 +26,9 @@ public class IFireResourceSupervisionServiceImpl implements IFireResourceSupervi
@Autowired @Autowired
private FireFightingSystemMapper fireFightingSystemMapper; private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
JcsFeign jcsFeignClient;
/** /**
* 消防系统信息 * 消防系统信息
* *
...@@ -64,6 +74,19 @@ public class IFireResourceSupervisionServiceImpl implements IFireResourceSupervi ...@@ -64,6 +74,19 @@ public class IFireResourceSupervisionServiceImpl implements IFireResourceSupervi
return buildFireResourceStatsDTO(resultMap); return buildFireResourceStatsDTO(resultMap);
} }
@Override
public List<Map<String, Object>> getFireEquipStatistic(String type, String bizOrgCode) {
List<DataDictionary> dictionaryList = jcsFeignClient.dataDictionaryIdFillMenu(StringUtil.isNotEmpty(type) ? type : "ZYGL_XFQC").getResult();
List<String> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(dictionaryList)) {
dictionaryList.forEach(x -> {
list.add(x.getTreeCode());
});
}
List<Map<String, Object>> resultMap = fireFightingSystemMapper.getFireEquipStatistic(list, bizOrgCode);
return resultMap;
}
private FireResourceStatsDTO buildFireResourceStatsDTO(Map<String, Object> resultMap) { private FireResourceStatsDTO buildFireResourceStatsDTO(Map<String, Object> resultMap) {
FireResourceStatsDTO fireResourceStats = new FireResourceStatsDTO(); FireResourceStatsDTO fireResourceStats = new FireResourceStatsDTO();
fireResourceStats.setTotalCounts(Long.parseLong(resultMap.get("totalCount").toString())); fireResourceStats.setTotalCounts(Long.parseLong(resultMap.get("totalCount").toString()));
......
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
wle.code equipment_code, wle.code equipment_code,
wle.NAME equipment_name, wle.NAME equipment_name,
count(spe.id) num, count(spe.id) num,
wle.`code` equip_code,
unit.name unit_name, unit.name unit_name,
wle.shbz_img img, wle.shbz_img img,
cate.NAME AS equipmentCateGoryName cate.NAME AS equipmentCateGoryName
...@@ -6773,6 +6774,76 @@ ...@@ -6773,6 +6774,76 @@
ORDER BY d.create_date desc ORDER BY d.create_date desc
</select> </select>
<select id="getFireEquipStatistic" resultType="Map">
SELECT
a.`name` AS `name`,
wes.equipment_code AS `code`,
COUNT(1) AS `value`,
IFNULL(wu.`name`, '') AS unit,
IFNULL(IF(a.shbz_img IS NOT NULL, a.shbz_img, a.img), '') AS icon
FROM
wl_equipment_specific wes
LEFT JOIN (SELECT
id,
`code`,
`name`,
img,
shbz_img,
unit_id
FROM
wl_equipment
<where>
<if test="collect != null and collect.size > 0">
code IN
<foreach collection="collect" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
) a ON a.`code` = wes.equipment_code
LEFT JOIN wl_unit wu ON wu.id = a.unit_id
WHERE
a.`name` IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
GROUP BY
wes.equipment_code
UNION ALL
SELECT
'其他' AS `name`,
'' AS `code`,
COUNT( 1 ) AS `value`,
'' AS unit,
'' AS icon
FROM
wl_equipment_specific wes
LEFT JOIN (
SELECT
id,
`code`,
`name`,
img,
shbz_img,
unit_id
FROM
wl_equipment
<where>
<if test="collect != null and collect.size > 0">
code NOT IN
<foreach collection="collect" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
) a ON a.`code` = wes.equipment_code
WHERE
a.`name` IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</select>
<select id="getFireEquipConfigInfo" resultMap="EquipCountBySystemId"> <select id="getFireEquipConfigInfo" resultMap="EquipCountBySystemId">
SELECT SELECT
wle.id equipment_id, wle.id equipment_id,
......
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