Commit 5134338c authored by 张森's avatar 张森

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

parents bd60990b b59bc04b
...@@ -38,7 +38,7 @@ public class OrgUsrFormDto implements Serializable { ...@@ -38,7 +38,7 @@ public class OrgUsrFormDto implements Serializable {
@ApiModelProperty(value = "归属机构/部门") @ApiModelProperty(value = "归属机构/部门")
private String parentId; private String parentId;
@ApiModelProperty(value = "机构/部门名称") @ApiModelProperty(value = "机构/部门名称")
private String bizOrgName; private String bizOrgName;
...@@ -94,6 +94,8 @@ public class OrgUsrFormDto implements Serializable { ...@@ -94,6 +94,8 @@ public class OrgUsrFormDto implements Serializable {
private String dwfz; private String dwfz;
@ApiModelProperty(value = "消防安全负责人") @ApiModelProperty(value = "消防安全负责人")
private String xfaq; private String xfaq;
@ApiModelProperty(value = "换流站类型")
private String stationType;
@ApiModelProperty(value = "公司消防信息") @ApiModelProperty(value = "公司消防信息")
@TableField(exist = false) @TableField(exist = false)
...@@ -113,9 +115,9 @@ public class OrgUsrFormDto implements Serializable { ...@@ -113,9 +115,9 @@ public class OrgUsrFormDto implements Serializable {
}); });
} }
this.dynamicFormAlert=dynamicFormAlert; this.dynamicFormAlert=dynamicFormAlert;
} }
......
package com.yeejoin.amos.boot.module.jcs.api.mapper; package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Map;
public interface StationInfoMapper extends BaseMapper { public interface StationInfoMapper extends BaseMapper {
Long count(@Param("stationType") String stationType); Long count(@Param("stationType") String stationType);
Map<String, String> selectStationInfo(@Param("bizOrgCode") String bizOrgCode);
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.StationInfoMapper"> <mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.StationInfoMapper">
<select id="count" resultType="long"> <select id="count" resultType="long">
SELECT SELECT
COUNT(1) COUNT(1)
...@@ -11,5 +11,16 @@ ...@@ -11,5 +11,16 @@
</if> </if>
</where> </where>
</select> </select>
<select id="selectStationInfo" resultType="java.util.Map">
SELECT
*
FROM
idx_biz_station_info t
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t.BIZ_ORG_CODE = #{bizOrgCode}
</if>
</where>
LIMIT 1
</select>
</mapper> </mapper>
...@@ -4,6 +4,7 @@ import com.yeejoin.equipmanage.common.enums.UnitEnum; ...@@ -4,6 +4,7 @@ import com.yeejoin.equipmanage.common.enums.UnitEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -32,7 +33,7 @@ public class UnitTransformUtil { ...@@ -32,7 +33,7 @@ public class UnitTransformUtil {
&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) { && !"--".equals(maxValue) && !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) {
if (nowVal.compareTo(new BigDecimal(minValue)) < 0) { if (nowVal.compareTo(new BigDecimal(minValue)) < 0) {
map.put("status", "0"); map.put("status", "0");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); map.put("abs", getPercent(nowVal, new BigDecimal(maxValue)));
} else if (nowVal.compareTo(new BigDecimal(maxValue)) > 0) { // 当前值大于最大值 } else if (nowVal.compareTo(new BigDecimal(maxValue)) > 0) { // 当前值大于最大值
map.put("status", "2"); map.put("status", "2");
map.put("abs", 100); map.put("abs", 100);
...@@ -41,7 +42,7 @@ public class UnitTransformUtil { ...@@ -41,7 +42,7 @@ public class UnitTransformUtil {
map.put("abs", 100); map.put("abs", 100);
} else { } else {
map.put("status", "1"); map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); map.put("abs", getPercent(nowVal, new BigDecimal(maxValue)));
} }
} else { } else {
map.put("status", "--"); map.put("status", "--");
...@@ -65,7 +66,7 @@ public class UnitTransformUtil { ...@@ -65,7 +66,7 @@ public class UnitTransformUtil {
&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) { && !"--".equals(maxValue) && !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) {
if (nowVal.compareTo(new BigDecimal(minValue)) < 0) { if (nowVal.compareTo(new BigDecimal(minValue)) < 0) {
map.put("status", "0"); map.put("status", "0");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); map.put("abs", getPercent(nowVal, new BigDecimal(maxValue)));
} else if (nowVal.compareTo(new BigDecimal(maxValue)) == 1) { } else if (nowVal.compareTo(new BigDecimal(maxValue)) == 1) {
map.put("status", "2"); map.put("status", "2");
map.put("abs", 100); map.put("abs", 100);
...@@ -74,7 +75,7 @@ public class UnitTransformUtil { ...@@ -74,7 +75,7 @@ public class UnitTransformUtil {
map.put("abs", 100); map.put("abs", 100);
} else { } else {
map.put("status", "1"); map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); map.put("abs", getPercent(nowVal, new BigDecimal(maxValue)));
} }
} else { } else {
map.put("status", "--"); map.put("status", "--");
...@@ -98,7 +99,7 @@ public class UnitTransformUtil { ...@@ -98,7 +99,7 @@ public class UnitTransformUtil {
&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) { && !"--".equals(maxValue) && !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) {
if (nowVal.compareTo(new BigDecimal(minValue)) < 0) { if (nowVal.compareTo(new BigDecimal(minValue)) < 0) {
map.put("status", "0"); map.put("status", "0");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); map.put("abs", getPercent(nowVal, new BigDecimal(maxValue)));
} else if (nowVal.compareTo(new BigDecimal(maxValue)) == 1) { } else if (nowVal.compareTo(new BigDecimal(maxValue)) == 1) {
map.put("status", "2"); map.put("status", "2");
map.put("abs", 100); map.put("abs", 100);
...@@ -107,7 +108,7 @@ public class UnitTransformUtil { ...@@ -107,7 +108,7 @@ public class UnitTransformUtil {
map.put("abs", 100); map.put("abs", 100);
} else { } else {
map.put("status", "1"); map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); map.put("abs", getPercent(nowVal, new BigDecimal(maxValue)));
} }
} else { } else {
map.put("status", "--"); map.put("status", "--");
...@@ -133,7 +134,7 @@ public class UnitTransformUtil { ...@@ -133,7 +134,7 @@ public class UnitTransformUtil {
&& !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) { && !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) {
if (nowVal.compareTo(new BigDecimal(minValue)) < 0) { if (nowVal.compareTo(new BigDecimal(minValue)) < 0) {
map.put("status", "0"); map.put("status", "0");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); map.put("abs", getPercent(nowVal, new BigDecimal(maxValue)));
} else if (nowVal.compareTo(new BigDecimal(maxValue)) == 1) { } else if (nowVal.compareTo(new BigDecimal(maxValue)) == 1) {
map.put("status", "2"); map.put("status", "2");
map.put("abs", 100); map.put("abs", 100);
...@@ -142,7 +143,7 @@ public class UnitTransformUtil { ...@@ -142,7 +143,7 @@ public class UnitTransformUtil {
map.put("abs", 100); map.put("abs", 100);
} else { } else {
map.put("status", "1"); map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); map.put("abs", getPercent(nowVal, new BigDecimal(maxValue)));
} }
} else { } else {
map.put("status", "--"); map.put("status", "--");
...@@ -152,4 +153,12 @@ public class UnitTransformUtil { ...@@ -152,4 +153,12 @@ public class UnitTransformUtil {
map.put("unit", "M"); map.put("unit", "M");
return map; return map;
} }
private static BigDecimal getPercent(BigDecimal num1, BigDecimal num2) {
if (num2.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
} else {
return num1.divide(num2, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP);
}
}
} }
...@@ -28,10 +28,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.UserUnitTypeEnum; ...@@ -28,10 +28,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.UserUnitTypeEnum;
import com.yeejoin.amos.boot.module.common.api.feign.AmosTrainingFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.AmosTrainingFeignClient;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.feign.IdxFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.IdxFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper; import com.yeejoin.amos.boot.module.common.api.mapper.*;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersJacketMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDataSyncService; import com.yeejoin.amos.boot.module.common.api.service.IDataSyncService;
import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService; import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService; import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
...@@ -136,6 +133,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -136,6 +133,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Autowired @Autowired
OrgUsrServiceImpl iOrgUsrService; OrgUsrServiceImpl iOrgUsrService;
@Autowired
private StationInfoMapper stationInfoMapper;
@Value("${jcs.company.topic.delete:jcs/company/topic/delete}") @Value("${jcs.company.topic.delete:jcs/company/topic/delete}")
private String airportDeleteTopic; private String airportDeleteTopic;
...@@ -1421,6 +1420,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1421,6 +1420,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
CompanyInfo info = fireCompanyInfoServiceImpl.getOne(new QueryWrapper<CompanyInfo>().eq("instance_id", id).eq("is_delete", 0)); CompanyInfo info = fireCompanyInfoServiceImpl.getOne(new QueryWrapper<CompanyInfo>().eq("instance_id", id).eq("is_delete", 0));
orgUsrFormVo.setCompanyInfo(info); orgUsrFormVo.setCompanyInfo(info);
// 获取换流站类型
Map<String, String> stationInfo = stationInfoMapper.selectStationInfo(orgUsr.getBizOrgCode());
if (Objects.nonNull(stationInfo)) {
orgUsrFormVo.setStationType(stationInfo.getOrDefault("station_type", ""));
}
return orgUsrFormVo; return orgUsrFormVo;
} }
......
...@@ -82,14 +82,21 @@ public class AlarmStatisticController extends AbstractBaseController { ...@@ -82,14 +82,21 @@ public class AlarmStatisticController extends AbstractBaseController {
@GetMapping("/statistic/trend") @GetMapping("/statistic/trend")
public ResponseModel getSystemAlarmTrend(@RequestParam(value = "systemCode", required = false)String systemCode, public ResponseModel getSystemAlarmTrend(@RequestParam(value = "systemCode", required = false)String systemCode,
@RequestParam(value = "updateTime", required = false)String updateTime, @RequestParam(value = "updateTime", required = false)String updateTime,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) { @RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
return CommonResponseUtil.success(iFireFightingSystemService.getCenterSystemAlarmTrend(systemCode, updateTime, bizOrgCode)); @RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate
) {
return CommonResponseUtil.success(iFireFightingSystemService.getCenterSystemAlarmTrend(systemCode, updateTime, bizOrgCode, startDate, endDate));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "系统告警事件数量占比") @ApiOperation(value = "系统告警事件数量占比")
@GetMapping("/num") @GetMapping("/num")
public ResponseModel getSystemAlarmNum(@RequestParam(value = "bizOrgCode", required = false)String bizOrgCode) { public ResponseModel getSystemAlarmNum(
return CommonResponseUtil.success(iFireFightingSystemService.getSystemAlarmNum(bizOrgCode)); @RequestParam(value = "bizOrgCode", required = false)String bizOrgCode,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate
) {
return CommonResponseUtil.success(iFireFightingSystemService.getSystemAlarmNum(bizOrgCode, startDate, endDate));
} }
} }
...@@ -75,14 +75,14 @@ public class PoolStatisticController { ...@@ -75,14 +75,14 @@ public class PoolStatisticController {
poolMap.put("poolLow", pool.get("low").size()); poolMap.put("poolLow", pool.get("low").size());
poolMap.put("poolHigh", pool.get("high").size()); poolMap.put("poolHigh", pool.get("high").size());
poolMap.put("poolNormal", pool.get("normal").size()); poolMap.put("poolNormal", pool.get("normal").size());
poolMap.put("poolAbs", new BigDecimal(pool.get("normal").size()).divide(new BigDecimal(poolList.size()),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); poolMap.put("poolAbs", this.getPercent(new BigDecimal(pool.get("normal").size()), new BigDecimal(poolList.size())));
Map<String, List<Map<String, Object>>> industry = getPoolInfo(industryPoolList); Map<String, List<Map<String, Object>>> industry = getPoolInfo(industryPoolList);
poolMap.put("industryName", "工业水池"); poolMap.put("industryName", "工业水池");
poolMap.put("industryTotal", industryPoolList.size()); poolMap.put("industryTotal", industryPoolList.size());
poolMap.put("industryLow", industry.get("low").size()); poolMap.put("industryLow", industry.get("low").size());
poolMap.put("industryHigh", industry.get("high").size()); poolMap.put("industryHigh", industry.get("high").size());
poolMap.put("industryNormal", industry.get("normal").size()); poolMap.put("industryNormal", industry.get("normal").size());
poolMap.put("industryAbs", new BigDecimal(industry.get("normal").size()).divide(new BigDecimal(industryPoolList.size()),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); poolMap.put("industryAbs", this.getPercent(new BigDecimal(industry.get("normal").size()), new BigDecimal(industryPoolList.size())));
return CommonResponseUtil.success(poolMap); return CommonResponseUtil.success(poolMap);
} }
...@@ -184,7 +184,7 @@ public class PoolStatisticController { ...@@ -184,7 +184,7 @@ public class PoolStatisticController {
normalMap.put("name", "液位正常"); normalMap.put("name", "液位正常");
normalMap.put("value", normalList.size()); normalMap.put("value", normalList.size());
Map<String, Object> abNormalMap = new HashMap<>(); Map<String, Object> abNormalMap = new HashMap<>();
abNormalMap.put("key", "normal"); abNormalMap.put("key", "abnormal");
abNormalMap.put("name", "液位异常"); abNormalMap.put("name", "液位异常");
abNormalMap.put("value", abNormalList.size()); abNormalMap.put("value", abNormalList.size());
List<Map<String, Object>> res = new ArrayList<>(); List<Map<String, Object>> res = new ArrayList<>();
...@@ -371,4 +371,13 @@ public class PoolStatisticController { ...@@ -371,4 +371,13 @@ public class PoolStatisticController {
} }
return DateTimeUtil.format(date1, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC); return DateTimeUtil.format(date1, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
} }
private BigDecimal getPercent(BigDecimal num1, BigDecimal num2) {
if (num2.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO;
} else {
return num1.divide(num2, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP);
}
}
} }
...@@ -55,7 +55,7 @@ public class SystemStatisticController extends AbstractBaseController { ...@@ -55,7 +55,7 @@ public class SystemStatisticController extends AbstractBaseController {
if (total.compareTo(BigDecimal.ZERO) == 0) { if (total.compareTo(BigDecimal.ZERO) == 0) {
map.put("abs", BigDecimal.ZERO); map.put("abs", BigDecimal.ZERO);
} else { } else {
map.put("abs", normal.divide(total,2, RoundingMode.HALF_UP).movePointRight(2)); map.put("abs", normal.divide(total, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP));
} }
return CommonResponseUtil.success(map); return CommonResponseUtil.success(map);
} }
...@@ -115,5 +115,4 @@ public class SystemStatisticController extends AbstractBaseController { ...@@ -115,5 +115,4 @@ public class SystemStatisticController extends AbstractBaseController {
} }
return CommonResponseUtil.success(map); return CommonResponseUtil.success(map);
} }
} }
...@@ -742,7 +742,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -742,7 +742,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Map<String, String> getSystemAlarmStatistic(@Param("systemCode") String systemCode, @Param("startDate") String startDate, @Param("endDate") String endDate); Map<String, String> getSystemAlarmStatistic(@Param("systemCode") String systemCode, @Param("startDate") String startDate, @Param("endDate") String endDate);
List<Map<String, Object>> getSystemAlarmTrend(@Param("systemCode") String systemCode, @Param("updateTime") String updateTime, @Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getSystemAlarmTrend(@Param("systemCode") String systemCode, @Param("updateTime") String updateTime, @Param("intervalDays") Long intervalDays, @Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getSystemAlarmTrendForSbpt(@Param("systemCode") String systemCode, @Param("updateTime") String updateTime); List<Map<String, Object>> getSystemAlarmTrendForSbpt(@Param("systemCode") String systemCode, @Param("updateTime") String updateTime);
...@@ -768,7 +768,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -768,7 +768,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getFireCannonInfo(@Param("bizOrgCode") String bizOrgCode, @Param("list") String[] strings); List<Map<String, Object>> getFireCannonInfo(@Param("bizOrgCode") String bizOrgCode, @Param("list") String[] strings);
List<Map<String, Object>> getSystemAlarmNum(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getSystemAlarmNum(@Param("bizOrgCode") String bizOrgCode, String startDate, String endDate);
List<Map<String, Object>> getSystemTypes(String bizOrgCode); List<Map<String, Object>> getSystemTypes(String bizOrgCode);
} }
...@@ -351,7 +351,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -351,7 +351,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Map<String, Object> getSystemAlarmTrend(String systemCode, String updateTime, String bizOrgCode); Map<String, Object> getSystemAlarmTrend(String systemCode, String updateTime, String bizOrgCode);
Map<String, Object> getCenterSystemAlarmTrend(String systemCode, String updateTime, String bizOrgCode); Map<String, Object> getCenterSystemAlarmTrend(String systemCode, String updateTime, String bizOrgCode, String startDate, String endDate);
List<Map<String, Object>> getFireCannonInfo(String bizOrgCode); List<Map<String, Object>> getFireCannonInfo(String bizOrgCode);
...@@ -359,5 +359,5 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -359,5 +359,5 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<OrgMenuDto> getSystemEquipTree(String systemCode); List<OrgMenuDto> getSystemEquipTree(String systemCode);
List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode); List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode, String startDate, String endDate);
} }
...@@ -68,6 +68,8 @@ import java.net.SocketException; ...@@ -68,6 +68,8 @@ import java.net.SocketException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -2765,7 +2767,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2765,7 +2767,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if(!StringUtil.isNotEmpty(updateTime)) { if(!StringUtil.isNotEmpty(updateTime)) {
updateTime = new SimpleDateFormat(DateUtils.DATE_PATTERN).format(new Date()); updateTime = new SimpleDateFormat(DateUtils.DATE_PATTERN).format(new Date());
} }
List<Map<String, Object>> result = fireFightingSystemMapper.getSystemAlarmTrend(systemCode, updateTime, bizOrgCode); List<Map<String, Object>> result = fireFightingSystemMapper.getSystemAlarmTrend(systemCode, updateTime, null, bizOrgCode);
Map<String, Object> resMap = new HashMap<>(); Map<String, Object> resMap = new HashMap<>();
resMap.put("xAxisData", result.stream().map(x -> x.get("date")).collect(Collectors.toList())); resMap.put("xAxisData", result.stream().map(x -> x.get("date")).collect(Collectors.toList()));
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
...@@ -2786,11 +2788,18 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2786,11 +2788,18 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
@Override @Override
public Map<String, Object> getCenterSystemAlarmTrend(String systemCode, String updateTime, String bizOrgCode) { public Map<String, Object> getCenterSystemAlarmTrend(String systemCode, String updateTime, String bizOrgCode, String startDate, String endDate) {
if(!StringUtil.isNotEmpty(updateTime)) { Long intervalDays = null;
if(StringUtils.isEmpty(updateTime)) {
updateTime = new SimpleDateFormat(DateUtils.DATE_PATTERN).format(new Date()); updateTime = new SimpleDateFormat(DateUtils.DATE_PATTERN).format(new Date());
} }
List<Map<String, Object>> result = fireFightingSystemMapper.getSystemAlarmTrend(systemCode, updateTime, bizOrgCode); if (StringUtils.hasText(startDate) && StringUtils.hasText(endDate)) {
updateTime = endDate;
LocalDate date1 = LocalDate.parse(startDate, DateTimeFormatter.ofPattern(DateUtils.DATE_TIME_PATTERN));
LocalDate date2 = LocalDate.parse(endDate, DateTimeFormatter.ofPattern(DateUtils.DATE_TIME_PATTERN));
intervalDays = date1.until(date2, ChronoUnit.DAYS);
}
List<Map<String, Object>> result = fireFightingSystemMapper.getSystemAlarmTrend(systemCode, updateTime, intervalDays, bizOrgCode);
Map<String, Object> resMap = new HashMap<>(); Map<String, Object> resMap = new HashMap<>();
resMap.put("xAxisData", result.stream().map(x -> x.get("date")).collect(Collectors.toList())); resMap.put("xAxisData", result.stream().map(x -> x.get("date")).collect(Collectors.toList()));
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
...@@ -2876,8 +2885,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2876,8 +2885,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
@Override @Override
public List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode) { public List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode, String startDate, String endDate) {
return fireFightingSystemMapper.getSystemAlarmNum(bizOrgCode); return fireFightingSystemMapper.getSystemAlarmNum(bizOrgCode, startDate, endDate);
} }
@Override @Override
......
...@@ -6,12 +6,12 @@ import com.alibaba.fastjson.serializer.SerializerFeature; ...@@ -6,12 +6,12 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.mapper.StationInfoMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Sign; import com.yeejoin.amos.boot.module.jcs.api.entity.Sign;
import com.yeejoin.amos.boot.module.jcs.api.mapper.SignMapper; import com.yeejoin.amos.boot.module.jcs.api.mapper.SignMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.StationInfoMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.ISignService; import com.yeejoin.amos.boot.module.jcs.api.service.ISignService;
import com.yeejoin.amos.component.rule.config.RuleConfig; import com.yeejoin.amos.component.rule.config.RuleConfig;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
......
...@@ -6672,54 +6672,54 @@ ...@@ -6672,54 +6672,54 @@
<select id="getSystemAlarmTrend" resultType="Map"> <select id="getSystemAlarmTrend" resultType="Map">
SELECT SELECT
s1.date, s1.date,
IFNULL( s2.faultNum, 0 ) AS faultNum, IFNULL( s2.faultNum, 0 ) AS faultNum,
IFNULL( s2.alarmNum, 0 ) AS alarmNum, IFNULL( s2.alarmNum, 0 ) AS alarmNum,
IFNULL( s2.faultNum, 0 ) AS shieldNum IFNULL( s2.faultNum, 0 ) AS shieldNum
FROM FROM
( (
SELECT SELECT
@s := @s + 1 AS `index`, @s := @s + 1 AS `index`,
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD(#{updateTime}, INTERVAL - 6 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD(#{updateTime}, INTERVAL - IFNULL(#{intervalDays}, 6) DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date
FROM FROM
mysql.help_topic, mysql.help_topic,
( SELECT @s := - 1 ) temp ( SELECT @s := - 1 ) temp
WHERE WHERE
@s &lt; 6 @s &lt; IFNULL(#{intervalDays}, 6)
) s1 ) s1
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
s.* s.*
FROM
(
SELECT
IFNULL(SUM(IF(r.`status` = 0, 1, 0)), 0) AS normalNum,
IFNULL(SUM(IF((r.type = 'BREAKDOWN' AND r.`status` = 1), 1, 0)), 0) AS faultNum,
IFNULL(SUM(IF((r.type = 'FIREALARM' AND r.`status` = 1), 1, 0)), 0) AS alarmNum,
IFNULL(SUM(IF((r.type = 'SHIELD' AND r.`status` = 1), 1, 0)), 0) AS shieldNum,
DATE_FORMAT( r.update_date, '%Y-%m-%d') AS date
FROM FROM
wl_equipment_specific_alarm_log r (
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, r.system_ids ) SELECT
<where> IFNULL(SUM(IF(r.`status` = 0, 1, 0)), 0) AS normalNum,
r.update_date BETWEEN date_sub( now(), INTERVAL 6 MONTH ) AND now() IFNULL(SUM(IF((r.type = 'BREAKDOWN' AND r.`status` = 1), 1, 0)), 0) AS faultNum,
<if test="systemCode != null and systemCode != ''"> IFNULL(SUM(IF((r.type = 'FIREALARM' AND r.`status` = 1), 1, 0)), 0) AS alarmNum,
AND fs.`code` = #{systemCode} IFNULL(SUM(IF((r.type = 'SHIELD' AND r.`status` = 1), 1, 0)), 0) AS shieldNum,
</if> DATE_FORMAT( r.update_date, '%Y-%m-%d') AS date
<if test="bizOrgCode!=null and bizOrgCode!=''"> FROM
r.biz_org_code like concat(#{bizOrgCode}, '%') wl_equipment_specific_alarm_log r
</if> LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, r.system_ids )
</where> <where>
GROUP BY r.update_date BETWEEN date_sub( now(), INTERVAL 6 MONTH ) AND now()
LEFT ( r.update_date, 10 ) <if test="systemCode != null and systemCode != ''">
ORDER BY AND fs.`code` = #{systemCode}
r.update_date </if>
) s <if test="bizOrgCode!=null and bizOrgCode!=''">
r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
LEFT ( r.update_date, 10 )
ORDER BY
r.update_date
) s
) s2 ON s2.date = s1.date ) s2 ON s2.date = s1.date
GROUP BY GROUP BY
s1.date s1.date
ORDER BY ORDER BY
s1.date s1.date
</select> </select>
<select id="getSystemAlarmTrendForSbpt" resultType="Map"> <select id="getSystemAlarmTrendForSbpt" resultType="Map">
...@@ -7045,11 +7045,18 @@ ...@@ -7045,11 +7045,18 @@
FROM FROM
wl_equipment_specific_alarm_log wlesal wl_equipment_specific_alarm_log wlesal
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, wlesal.system_ids ) <![CDATA[<>]]> 0 LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, wlesal.system_ids ) <![CDATA[<>]]> 0
<where>
<if test="bizOrgCode!=null and bizOrgCode!=''"> <if test="bizOrgCode!=null and bizOrgCode!=''">
AND wlesal.biz_org_code LIKE CONCAT(#{bizOrgCode},'%') AND wlesal.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if> </if>
<if test="startDate!=null and startDate!=''">
AND wlesal.create_date &gt;= #{startDate}
</if>
<if test="endDate!=null and endDate!=''">
AND wlesal.create_date &lt;= #{endDate}
</if>
</where>
GROUP BY fs.system_type_code GROUP BY fs.system_type_code
</select> </select>
<select id="getSystemTypes" resultType="Map"> <select id="getSystemTypes" resultType="Map">
......
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