Commit 05df5a18 authored by lisong's avatar lisong

修改耗材报废管理统计bug

parent d843e30c
......@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.vo.IotDataVO;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.service.IEmergencyService;
import io.swagger.annotations.Api;
......@@ -616,4 +615,29 @@ public class EmergencyController extends AbstractBaseController {
return CommonResponseUtil.success(iEmergencyService.getPressurePumpDiagnosticAnalysis(equipmentCode, nameKeys, fieldKey, bizOrgCode, getAppKey(), getProduct(), getToken()));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/alarmList")
@ApiOperation(httpMethod = "GET", value = "消防告警信息", notes = "消防告警信息")
public ResponseModel alarmList(@RequestParam Integer pageNumber,
@RequestParam Integer pageSize,
@RequestParam(required = false) List<String> types,
@RequestParam(required = false) List<String> emergencyLevels,
@RequestParam(required = false) String name,
@RequestParam(required = false) Integer cleanStatus,
@RequestParam(required = false) String bizOrgCode) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(page);
}
}
}
return CommonResponseUtil.success(iEmergencyService.alarmList(page, bizOrgCode, types, emergencyLevels, name, cleanStatus));
}
}
......@@ -83,4 +83,15 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object>> getEquipExpiryStatistics(@Param("expiryDayNum") Integer expiryDayNum);
/**
*
* @param page
* @param bizOrgCode
* @param types 类型
* @param emergencyLevels 等级
* @param name 设备名称
* @return
*/
Page<Map<String, Object>> alarmList(@Param("page") Page<Map<String, Object>> page, @Param("bizOrgCode") String bizOrgCode, @Param("types") List<String> types, @Param("emergencyLevels") List<String> emergencyLevels, @Param("name") String name, @Param("cleanStatus") Integer cleanStatus);
}
......@@ -57,4 +57,6 @@ public interface IEmergencyService {
Map<String, Object> getPressurePumpStatusChart(String equipmentCode, String startTime, String endTime, String bizOrgCode, String appKey, String product, String token);
List<Map<String, Object>> getPressurePumpDiagnosticAnalysis(String equipmentCode, String nameKeys, String fieldKey, String bizOrgCode, String appKey, String product, String token);
Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus);
}
......@@ -432,4 +432,8 @@ public class EmergencyServiceImpl implements IEmergencyService {
return list;
}
@Override
public Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus) {
return emergencyMapper.alarmList(page, bizOrgCode, types, emergencyLevels, name, cleanStatus);
}
}
......@@ -991,7 +991,7 @@
(
SELECT
CONCAT( temp.NAME, '类' ) AS `name`,
count( 1 ) AS `value`,
SUM(temp.amount) AS `value`,
CODE
FROM
(
......@@ -999,7 +999,8 @@
es.id,
ed.`name`,
DATE_FORMAT( ed.production_date, '%Y-%m-%d' ) AS productDate,
ed.CODE
ed.CODE,
ifnull(sd.amount,0) as amount
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
......@@ -1076,10 +1077,36 @@
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 )
SUM(sd.amount)
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 0 > DATEDIFF(
DATE_ADD(
DATE_FORMAT(
ed.production_date,
'%Y-%m-%d'
),
INTERVAL e.expiry_date YEAR
),
CURRENT_DATE
)
) scrap,
(
SELECT
ifnull(SUM(sd.amount), 0)
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
......@@ -1095,7 +1122,7 @@
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 )
ifnull(SUM(sd.amount), 0)
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
......@@ -1111,7 +1138,7 @@
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 )
ifnull(SUM(sd.amount), 0)
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
......@@ -1124,7 +1151,89 @@
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
AND 180 >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )) sixImminent
</select>
<select id="alarmList" resultType="java.util.Map">
SELECT
wlesal.id,
concat(
wlesal.equipment_specific_name,
wlesal.equipment_specific_index_name
) AS alamContent,
IF (
wlesal.confirm_type IS NULL,
'未处理',
'已处理'
) handleStatus,
IF (
wlesal.clean_time IS NOT NULL,
'已消除',
'未消除'
) cleanStatus,
wlesal.equipment_index_id AS fireEquipmentIndexId,
wlesal.equipment_specific_index_key AS fireEquipmentSpecificIndexKey,
wlesal.equipment_specific_index_name AS fireEquipmentSpecificIndexName,
CASE wlesal.equipment_specific_index_value
WHEN 'true' THEN
'是'
WHEN 'false' THEN
'否'
ELSE
wlesal.equipment_specific_index_value
END AS fireEquipmentPointValue,
wlesal.type AS typeCode,
(
SELECT
type_name
FROM
wl_signal_classify sc
WHERE
sc.type_code = wlesal.type
LIMIT 1
) AS type,
wlesal.equipment_specific_name AS equipmentSpecificName,
wlesal.location,
date_format(
wlesal.create_date,
'%Y-%m-%d %H:%i:%s'
) createDate,
wlesal.emergency_level_describe AS emergencyLevelDescribe
FROM
wl_equipment_specific_alarm_log wlesal
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
and wlesal.biz_org_code like concat(#{bizOrgCode},'%')
</if>
<if test="name != null and name != ''">
and wlesal.equipment_specific_name like concat(#{name},'%')
</if>
<if test="cleanStatus != null and cleanStatus != '' and cleanStatus == 2">
and wlesal.clean_time IS NULL
</if>
<if test="cleanStatus != null and cleanStatus != '' and cleanStatus == 1">
and wlesal.clean_time IS NOT NULL
</if>
<if test="types != null">
<foreach collection="types" index="index" item="item" open="and (" separator=" OR " close=")">
wlesal.type = #{item}
</foreach>
</if>
<if test="emergencyLevels != null">
<foreach collection="emergencyLevels" index="index" item="item" open="and (" separator=" OR " close=")">
wlesal.emergency_level = #{item}
</foreach>
</if>
</where>
ORDER BY
wlesal.create_date DESC
</select>
</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