Commit c1871718 authored by tianyiming's avatar tianyiming

1、四横八纵消防临期报废设备

2、消防设备/耗材报废管理统计接口 3、wl_equipment添加四横八纵图片属性字段
parent 76bda8a4
...@@ -5,9 +5,11 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams; ...@@ -5,9 +5,11 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
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.common.vo.IotDataVO; import com.yeejoin.equipmanage.common.vo.IotDataVO;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.service.IEmergencyService; import com.yeejoin.equipmanage.service.IEmergencyService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -65,7 +67,7 @@ public class EmergencyController extends AbstractBaseController { ...@@ -65,7 +67,7 @@ public class EmergencyController extends AbstractBaseController {
public ResponseModel getCAFSWaterTankInfo() { public ResponseModel getCAFSWaterTankInfo() {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode(); String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
return CommonResponseUtil.success(iEmergencyService.getCAFSWaterTankInfo(bizOrgCode)); return CommonResponseUtil.success(iEmergencyService.getCAFSWaterTankInfo());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
...@@ -114,16 +116,11 @@ public class EmergencyController extends AbstractBaseController { ...@@ -114,16 +116,11 @@ public class EmergencyController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("泡沫罐列表") @ApiOperation("泡沫罐列表")
@GetMapping(value = "/selectFoamTank") @GetMapping(value = "/selectFoamTank")
public Page<Map<String, Object>> selectFoamTank(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode, public Page<Map<String, Object>> selectFoamTank(@RequestParam(value = "pageNumber") int pageNumber,
@RequestParam(value = "pageNumber") int pageNumber,
@RequestParam(value = "pageSize") int pageSize @RequestParam(value = "pageSize") int pageSize
) { ) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize); Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
if (ObjectUtils.isEmpty(bizOrgCode)){ return iEmergencyService.selectFoamTank(page);
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return iEmergencyService.selectFoamTank(page, bizOrgCode);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
...@@ -560,6 +557,30 @@ public class EmergencyController extends AbstractBaseController { ...@@ -560,6 +557,30 @@ public class EmergencyController extends AbstractBaseController {
return result; return result;
} }
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getEquipExpiryList")
@ApiOperation(httpMethod = "GET", value = "四横八纵-临期设备列表", notes = "四横八纵-临期设备列表")
public ResponseModel getEquipExpiryList(@ApiParam("临期天数-近多少天") @RequestParam(value = "expiryDayNum", required = false) Integer expiryDayNum) {
expiryDayNum = Objects.isNull(expiryDayNum) ? 180 : expiryDayNum;
return CommonResponseUtil.success(iEmergencyService.getEquipExpiryList(expiryDayNum));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getEquipExpiryStatistics")
@ApiOperation(httpMethod = "GET", value = "四横八纵-临期设备统计", notes = "四横八纵-临期设备统计")
public ResponseModel getEquipExpiryStatistics(@ApiParam("临期天数-近多少天") @RequestParam(value = "expiryDayNum", required = false) Integer expiryDayNum) {
expiryDayNum = Objects.isNull(expiryDayNum) ? 180 : expiryDayNum;
return CommonResponseUtil.success(iEmergencyService.getEquipExpiryStatistics(expiryDayNum));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getStockEquipStatistics")
@ApiOperation(httpMethod = "GET", value = "四横八纵-报废设备统计", notes = "四横八纵-报废设备统计")
public ResponseModel getStockEquipStatistics() {
return CommonResponseUtil.success(iEmergencyService.getStockEquipStatistics());
}
} }
...@@ -39,7 +39,7 @@ public interface EmergencyMapper extends BaseMapper{ ...@@ -39,7 +39,7 @@ public interface EmergencyMapper extends BaseMapper{
* @param bizOrgCode * @param bizOrgCode
* @return * @return
*/ */
Page<Map<String, Object>> selectFoamTank(Page<Map<String, Object>> page , @Param("bizOrgCode") String bizOrgCode); Page<Map<String, Object>> selectFoamTank(Page<Map<String, Object>> page);
/** /**
* 排油系统 * 排油系统
...@@ -59,7 +59,7 @@ public interface EmergencyMapper extends BaseMapper{ ...@@ -59,7 +59,7 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object>> getSystemState(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getSystemState(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getCAFSWaterTankInfo(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getCAFSWaterTankInfo();
List<Map<String, Object>> selectAlarmAnalysis(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("dataType")String dataType, @Param("date")String date, @Param("list") List<String> codes); List<Map<String, Object>> selectAlarmAnalysis(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("dataType")String dataType, @Param("date")String date, @Param("list") List<String> codes);
...@@ -77,7 +77,10 @@ public interface EmergencyMapper extends BaseMapper{ ...@@ -77,7 +77,10 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object>> fireCannonSystemAlarmAnalysis(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("dataType")String dataType, @Param("date")String date, @Param("list") List<String> codes); List<Map<String, Object>> fireCannonSystemAlarmAnalysis(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("dataType")String dataType, @Param("date")String date, @Param("list") List<String> codes);
List<Map<String, String>> getEquipExpiryList(@Param("expiryDayNum") Integer expiryDayNum);
Map<String, Integer> getStockEquipStatistics();
List<Map<String, Object>> getEquipExpiryStatistics(@Param("expiryDayNum") Integer expiryDayNum);
} }
...@@ -20,7 +20,7 @@ public interface IEmergencyService { ...@@ -20,7 +20,7 @@ public interface IEmergencyService {
/** /**
* @return * @return
*/ */
List<Map<String, Object>> getCAFSWaterTankInfo(String bizOrgCode); List<Map<String, Object>> getCAFSWaterTankInfo();
Map<String, Object> emergencyMaterials(); Map<String, Object> emergencyMaterials();
...@@ -28,7 +28,7 @@ public interface IEmergencyService { ...@@ -28,7 +28,7 @@ public interface IEmergencyService {
Page<Map<String, Object>> selectFireMonitor(Page<Map<String, Object>> page, String bizOrgCode,String code); Page<Map<String, Object>> selectFireMonitor(Page<Map<String, Object>> page, String bizOrgCode,String code);
Page<Map<String, Object>> selectFoamTank(Page<Map<String, Object>> page, String bizOrgCode); Page<Map<String, Object>> selectFoamTank(Page<Map<String, Object>> page);
Page<Map<String, Object>> selectOilDrainage(Page<Map<String, Object>> page, String bizOrgCode, String code); Page<Map<String, Object>> selectOilDrainage(Page<Map<String, Object>> page, String bizOrgCode, String code);
...@@ -48,5 +48,9 @@ public interface IEmergencyService { ...@@ -48,5 +48,9 @@ public interface IEmergencyService {
List<Map<String, Object>> fireCannonSystemAlarmAnalysis(String startDate, String endDate, String dataType, String date, String systemType); List<Map<String, Object>> fireCannonSystemAlarmAnalysis(String startDate, String endDate, String dataType, String date, String systemType);
List<Map<String, Object>> getEquipExpiryStatistics(Integer expiryDayNum);
List<Map<String, String>> getEquipExpiryList(Integer expiryDayNum);
Map<String, Integer> getStockEquipStatistics();
} }
...@@ -49,8 +49,8 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -49,8 +49,8 @@ public class EmergencyServiceImpl implements IEmergencyService {
} }
@Override @Override
public List<Map<String, Object>> getCAFSWaterTankInfo(String bizOrgCode) { public List<Map<String, Object>> getCAFSWaterTankInfo() {
List<Map<String, Object>> list = emergencyMapper.getCAFSWaterTankInfo(bizOrgCode); List<Map<String, Object>> list = emergencyMapper.getCAFSWaterTankInfo();
// List<Map<String, Object>> res = new ArrayList(); // List<Map<String, Object>> res = new ArrayList();
// if (0 < list.size()) { // if (0 < list.size()) {
// list.forEach(x -> { // list.forEach(x -> {
...@@ -81,8 +81,8 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -81,8 +81,8 @@ public class EmergencyServiceImpl implements IEmergencyService {
} }
@Override @Override
public Page<Map<String, Object>> selectFoamTank(Page<Map<String, Object>> page, String bizOrgCode) { public Page<Map<String, Object>> selectFoamTank(Page<Map<String, Object>> page) {
return emergencyMapper.selectFoamTank(page, bizOrgCode); return emergencyMapper.selectFoamTank(page);
} }
@Override @Override
...@@ -158,4 +158,25 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -158,4 +158,25 @@ public class EmergencyServiceImpl implements IEmergencyService {
} }
@Override
public List<Map<String, Object>> getEquipExpiryStatistics(Integer expiryDayNum) {
List<Map<String, Object>> equipExpiryStatistics = emergencyMapper.getEquipExpiryStatistics(expiryDayNum);
equipExpiryStatistics.forEach(item -> {
item.put("value", Integer.parseInt(item.get("value").toString()));
});
return equipExpiryStatistics;
}
@Override
public List<Map<String, String>> getEquipExpiryList(Integer expiryDayNum) {
return emergencyMapper.getEquipExpiryList(expiryDayNum);
}
@Override
public Map<String, Integer> getStockEquipStatistics() {
return emergencyMapper.getStockEquipStatistics();
}
} }
...@@ -542,4 +542,16 @@ ...@@ -542,4 +542,16 @@
REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000356, 'maxFlow', '最高报警流量(L/S)', 'inputNumber', 132828674827, 'eq', b'0', '92010700', 2581805, '2022-10-09 09:24:40'); REPLACE INTO `wl_form_group_column_equip`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000356, 'maxFlow', '最高报警流量(L/S)', 'inputNumber', 132828674827, 'eq', b'0', '92010700', 2581805, '2022-10-09 09:24:40');
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="tianyiming" id="202301101653">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment" columnName="shbz_img"/>
</not>
</preConditions>
<comment>新增四横八纵图片属性字段</comment>
<sql>
ALTER TABLE `wl_equipment` ADD COLUMN `shbz_img` varchar(255) NULL COMMENT '四横八纵图片' AFTER `img`;</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -91,9 +91,9 @@ ...@@ -91,9 +91,9 @@
WHERE WHERE
-- 因为此处属于确定查询条件,所以此处写入常量 -- 因为此处属于确定查询条件,所以此处写入常量
wes.equipment_code LIKE CONCAT( '92032000', '%' ) wes.equipment_code LIKE CONCAT( '92032000', '%' )
<if test="bizOrgCode!=null and bizOrgCode!=''"> <!-- <if test="bizOrgCode!=null and bizOrgCode!=''">-->
AND wes.biz_org_code like concat(#{bizOrgCode}, '%') <!-- AND wes.biz_org_code like concat(#{bizOrgCode}, '%')-->
</if> <!-- </if>-->
</select> </select>
<select id="selectEmergencyMaterials" resultType="java.util.Map"> <select id="selectEmergencyMaterials" resultType="java.util.Map">
...@@ -211,8 +211,6 @@ ...@@ -211,8 +211,6 @@
WHERE WHERE
wes.equipment_code LIKE concat( '920319', '%' ) wes.equipment_code LIKE concat( '920319', '%' )
AND wes.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
) temp ) temp
</select> </select>
...@@ -1022,4 +1020,149 @@ ...@@ -1022,4 +1020,149 @@
(SELECT count(*) FROM f_fire_fighting_system) fireSystem, (SELECT count(*) FROM f_fire_fighting_system) fireSystem,
(SELECT count(*) FROM wl_car) fireCar (SELECT count(*) FROM wl_car) fireCar
</select> </select>
<select id="getEquipExpiryStatistics" resultType="java.util.Map">
SELECT
a.`name`,
a.value,
CONCAT( CAST( ROUND(( a.VALUE / b.num )* 100,1) AS CHAR),'%') percent
FROM
(
SELECT
CONCAT( temp.NAME, '类' ) AS `name`,
count( 1 ) AS `value`,
CODE
FROM
(
SELECT
es.id,
ed.`name`,
DATE_FORMAT( ed.production_date, '%Y-%m-%d' ) AS productDate,
ed.CODE
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND (
( sd.`status` != 7 )
OR ( sd.`status` IS NULL )
OR ( sd.`status` = '' ))
AND e.expiry_date IS NOT NULL
AND #{expiryDayNum} >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
) temp
GROUP BY
temp.CODE
) a
LEFT JOIN ( SELECT equipment_code CODE, COUNT( 1 ) num FROM wl_equipment_specific es GROUP BY equipment_code ) b ON a.`code` = b.`code`
</select>
<select id="getEquipExpiryList" resultType="java.util.Map">
SELECT
@rownum := @rownum + 1 AS id,
t.*
FROM
( SELECT @rownum := 0 ) r,
(
SELECT
ed.`name` AS specificName,
IFNULL( ed.standard, '' ) AS modelNumber,
DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) AS dayNum,
COUNT( ed.CODE ) sum,
IFNULL( ws.full_name, '' ) AS equipAddress
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_warehouse_structure ws ON ws.id = es.warehouse_structure_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND (
( sd.`status` != 7 )
OR ( sd.`status` IS NULL )
OR ( sd.`status` = '' ))
AND e.expiry_date IS NOT NULL
AND #{expiryDayNum} >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
GROUP BY
ed.standard,
ed.CODE,
equipAddress
ORDER BY
DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) ASC
) AS t
</select>
<select id="getStockEquipStatistics" resultType="java.util.Map">
SELECT
(
SELECT
count( 1 )
FROM
wl_stock_detail sd
LEFT JOIN wl_equipment_specific es ON es.id = sd.equipment_specific_id
WHERE
sd.`status` = 7
AND update_date LIKE CONCAT( DATE_FORMAT( CURRENT_DATE, '%Y' ), '%' )) yearScrap,
(
SELECT
count( 1 )
FROM
wl_stock_detail sd
LEFT JOIN wl_equipment_specific es ON es.id = sd.equipment_specific_id
WHERE
sd.`status` = 7
AND update_date LIKE CONCAT( DATE_FORMAT( CURRENT_DATE, '%Y-%m' ), '%' )) monthScrap,
( SELECT count( 1 ) FROM wl_stock_detail sd LEFT JOIN wl_equipment_specific es ON es.id = sd.equipment_specific_id WHERE sd.`status` = 7 ) scrap,
(
SELECT
count( es.id )
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND (
( sd.`status` != 7 )
OR ( sd.`status` IS NULL )
OR ( sd.`status` = '' ))
AND e.expiry_date IS NOT NULL
AND 30 >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )) oneImminent,
(
SELECT
count( es.id )
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND (
( sd.`status` != 7 )
OR ( sd.`status` IS NULL )
OR ( sd.`status` = '' ))
AND e.expiry_date IS NOT NULL
AND 60 >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )) twoImminent,
(
SELECT
count( es.id )
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND (
( sd.`status` != 7 )
OR ( sd.`status` IS NULL )
OR ( sd.`status` = '' ))
AND e.expiry_date IS NOT NULL
AND 90 >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )) sixImminent
</select>
</mapper> </mapper>
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