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

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

parents bd60990b b59bc04b
......@@ -94,6 +94,8 @@ public class OrgUsrFormDto implements Serializable {
private String dwfz;
@ApiModelProperty(value = "消防安全负责人")
private String xfaq;
@ApiModelProperty(value = "换流站类型")
private String stationType;
@ApiModelProperty(value = "公司消防信息")
@TableField(exist = false)
......
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 org.apache.ibatis.annotations.Param;
import java.util.Map;
public interface StationInfoMapper extends BaseMapper {
Long count(@Param("stationType") String stationType);
Map<String, String> selectStationInfo(@Param("bizOrgCode") String bizOrgCode);
}
<?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">
<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
COUNT(1)
......@@ -11,5 +11,16 @@
</if>
</where>
</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>
......@@ -4,6 +4,7 @@ import com.yeejoin.equipmanage.common.enums.UnitEnum;
import lombok.extern.slf4j.Slf4j;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.Map;
......@@ -32,7 +33,7 @@ public class UnitTransformUtil {
&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) {
if (nowVal.compareTo(new BigDecimal(minValue)) < 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) { // 当前值大于最大值
map.put("status", "2");
map.put("abs", 100);
......@@ -41,7 +42,7 @@ public class UnitTransformUtil {
map.put("abs", 100);
} else {
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 {
map.put("status", "--");
......@@ -65,7 +66,7 @@ public class UnitTransformUtil {
&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) {
if (nowVal.compareTo(new BigDecimal(minValue)) < 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) {
map.put("status", "2");
map.put("abs", 100);
......@@ -74,7 +75,7 @@ public class UnitTransformUtil {
map.put("abs", 100);
} else {
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 {
map.put("status", "--");
......@@ -98,7 +99,7 @@ public class UnitTransformUtil {
&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) {
if (nowVal.compareTo(new BigDecimal(minValue)) < 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) {
map.put("status", "2");
map.put("abs", 100);
......@@ -107,7 +108,7 @@ public class UnitTransformUtil {
map.put("abs", 100);
} else {
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 {
map.put("status", "--");
......@@ -133,7 +134,7 @@ public class UnitTransformUtil {
&& !"null".equalsIgnoreCase(minValue)&& !"--".equals(maxValue) && !"null".equalsIgnoreCase(maxValue)) {
if (nowVal.compareTo(new BigDecimal(minValue)) < 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) {
map.put("status", "2");
map.put("abs", 100);
......@@ -142,7 +143,7 @@ public class UnitTransformUtil {
map.put("abs", 100);
} else {
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 {
map.put("status", "--");
......@@ -152,4 +153,12 @@ public class UnitTransformUtil {
map.put("unit", "M");
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;
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.IdxFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper;
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.mapper.*;
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.IOrgUsrService;
......@@ -136,6 +133,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Autowired
private StationInfoMapper stationInfoMapper;
@Value("${jcs.company.topic.delete:jcs/company/topic/delete}")
private String airportDeleteTopic;
......@@ -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));
orgUsrFormVo.setCompanyInfo(info);
// 获取换流站类型
Map<String, String> stationInfo = stationInfoMapper.selectStationInfo(orgUsr.getBizOrgCode());
if (Objects.nonNull(stationInfo)) {
orgUsrFormVo.setStationType(stationInfo.getOrDefault("station_type", ""));
}
return orgUsrFormVo;
}
......
......@@ -82,14 +82,21 @@ public class AlarmStatisticController extends AbstractBaseController {
@GetMapping("/statistic/trend")
public ResponseModel getSystemAlarmTrend(@RequestParam(value = "systemCode", required = false)String systemCode,
@RequestParam(value = "updateTime", required = false)String updateTime,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
return CommonResponseUtil.success(iFireFightingSystemService.getCenterSystemAlarmTrend(systemCode, updateTime, 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.getCenterSystemAlarmTrend(systemCode, updateTime, bizOrgCode, startDate, endDate));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "系统告警事件数量占比")
@GetMapping("/num")
public ResponseModel getSystemAlarmNum(@RequestParam(value = "bizOrgCode", required = false)String bizOrgCode) {
return CommonResponseUtil.success(iFireFightingSystemService.getSystemAlarmNum(bizOrgCode));
public ResponseModel getSystemAlarmNum(
@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 {
poolMap.put("poolLow", pool.get("low").size());
poolMap.put("poolHigh", pool.get("high").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);
poolMap.put("industryName", "工业水池");
poolMap.put("industryTotal", industryPoolList.size());
poolMap.put("industryLow", industry.get("low").size());
poolMap.put("industryHigh", industry.get("high").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);
}
......@@ -184,7 +184,7 @@ public class PoolStatisticController {
normalMap.put("name", "液位正常");
normalMap.put("value", normalList.size());
Map<String, Object> abNormalMap = new HashMap<>();
abNormalMap.put("key", "normal");
abNormalMap.put("key", "abnormal");
abNormalMap.put("name", "液位异常");
abNormalMap.put("value", abNormalList.size());
List<Map<String, Object>> res = new ArrayList<>();
......@@ -371,4 +371,13 @@ public class PoolStatisticController {
}
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 {
if (total.compareTo(BigDecimal.ZERO) == 0) {
map.put("abs", BigDecimal.ZERO);
} 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);
}
......@@ -115,5 +115,4 @@ public class SystemStatisticController extends AbstractBaseController {
}
return CommonResponseUtil.success(map);
}
}
......@@ -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);
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);
......@@ -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>> 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);
}
......@@ -351,7 +351,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
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);
......@@ -359,5 +359,5 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
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;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -2765,7 +2767,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if(!StringUtil.isNotEmpty(updateTime)) {
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<>();
resMap.put("xAxisData", result.stream().map(x -> x.get("date")).collect(Collectors.toList()));
List<Map<String, Object>> list = new ArrayList<>();
......@@ -2786,11 +2788,18 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public Map<String, Object> getCenterSystemAlarmTrend(String systemCode, String updateTime, String bizOrgCode) {
if(!StringUtil.isNotEmpty(updateTime)) {
public Map<String, Object> getCenterSystemAlarmTrend(String systemCode, String updateTime, String bizOrgCode, String startDate, String endDate) {
Long intervalDays = null;
if(StringUtils.isEmpty(updateTime)) {
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<>();
resMap.put("xAxisData", result.stream().map(x -> x.get("date")).collect(Collectors.toList()));
List<Map<String, Object>> list = new ArrayList<>();
......@@ -2876,8 +2885,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode) {
return fireFightingSystemMapper.getSystemAlarmNum(bizOrgCode);
public List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode, String startDate, String endDate) {
return fireFightingSystemMapper.getSystemAlarmNum(bizOrgCode, startDate, endDate);
}
@Override
......
......@@ -6,12 +6,12 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.jcs.api.dto.SignDto;
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.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.component.rule.config.RuleConfig;
import lombok.extern.slf4j.Slf4j;
......
......@@ -6680,12 +6680,12 @@
(
SELECT
@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
mysql.help_topic,
( SELECT @s := - 1 ) temp
WHERE
@s &lt; 6
@s &lt; IFNULL(#{intervalDays}, 6)
) s1
LEFT JOIN (
SELECT
......@@ -7045,11 +7045,18 @@
FROM
wl_equipment_specific_alarm_log wlesal
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!=''">
AND wlesal.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</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
</select>
<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