Commit 2cc4e6cf authored by maoying's avatar maoying

Merge branch 'develop_dl_plan6_temp' of…

Merge branch 'develop_dl_plan6_temp' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6_temp
parents 4ccb56b6 e4c605f2
...@@ -14,6 +14,7 @@ import org.aspectj.lang.JoinPoint; ...@@ -14,6 +14,7 @@ import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -32,6 +33,8 @@ public class PersonIdentifyAspect { ...@@ -32,6 +33,8 @@ public class PersonIdentifyAspect {
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired @Autowired
private IOrgUsrService orgUsrService; private IOrgUsrService orgUsrService;
@Value("${logic}")
Boolean logic;
@Before(value = "@annotation(com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify) && @annotation(permission)") @Before(value = "@annotation(com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify) && @annotation(permission)")
public void personIdentity(JoinPoint joinPoint, PersonIdentify permission) throws PermissionException { public void personIdentity(JoinPoint joinPoint, PersonIdentify permission) throws PermissionException {
...@@ -41,12 +44,19 @@ public class PersonIdentifyAspect { ...@@ -41,12 +44,19 @@ public class PersonIdentifyAspect {
UserDto userDto = orgUsrService.getUserParentInfo(userId); UserDto userDto = orgUsrService.getUserParentInfo(userId);
ReginParams.PersonIdentity personIdentity = new ReginParams.PersonIdentity(); ReginParams.PersonIdentity personIdentity = new ReginParams.PersonIdentity();
// TODO 没有绑定机场单位的人员,则赋值不存在的bizOrgCode,规避查询出所有数据 // TODO 没有绑定机场单位的人员,则赋值不存在的bizOrgCode,规避查询出所有数据
personIdentity.setBizOrgCode(StringUtils.isEmpty(userDto.getBizOrgCode()) ? "-1" : userDto.getBizOrgCode()); // personIdentity.setBizOrgCode(StringUtils.isEmpty(userDto.getBizOrgCode()) ? "-1" : userDto.getBizOrgCode());
personIdentity.setCompanyId(userDto.getCompanyId()); personIdentity.setCompanyId(userDto.getCompanyId());
personIdentity.setCompanyName(userDto.getCompanyName()); personIdentity.setCompanyName(userDto.getCompanyName());
personIdentity.setPersonSeq(userDto.getPersonSeq()); personIdentity.setPersonSeq(userDto.getPersonSeq());
personIdentity.setPersonName(userDto.getPersonName()); personIdentity.setPersonName(userDto.getPersonName());
personIdentity.setIdentityType(userDto.getIdentityType()); personIdentity.setIdentityType(userDto.getIdentityType());
//电力默认走公司权限
if (!logic){
personIdentity.setBizOrgCode(StringUtils.isEmpty(userDto.getCompanyBizOrgCode()) ? "-1" : userDto.getCompanyBizOrgCode());
}else{
personIdentity.setBizOrgCode(StringUtils.isEmpty(userDto.getBizOrgCode()) ? "-1" : userDto.getBizOrgCode());
}
personIdentity.setCompanyBizOrgCode(userDto.getCompanyBizOrgCode()); personIdentity.setCompanyBizOrgCode(userDto.getCompanyBizOrgCode());
reginParam.setPersonIdentity(personIdentity); reginParam.setPersonIdentity(personIdentity);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam)); redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
......
...@@ -150,4 +150,8 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> { ...@@ -150,4 +150,8 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
List<Map<String, Object>> getNewEquipmentForSpecifyDate(String dutyDate,String groupCode,String equipmentId,String equipmentName,String groupByName); List<Map<String, Object>> getNewEquipmentForSpecifyDate(String dutyDate,String groupCode,String equipmentId,String equipmentName,String groupByName);
String getFirstAidCompanyId (); String getFirstAidCompanyId ();
List<Map<String, Object>> dayDutyStatistics(String date, String groupCode, String fieldCode, String dictType);
List<Map<String, Object>> dayDutyList(String date, String dictCodes);
} }
...@@ -37,4 +37,8 @@ public interface IDutyPersonService extends IDutyCommonService { ...@@ -37,4 +37,8 @@ public interface IDutyPersonService extends IDutyCommonService {
List<Map<String, Object>> queryByCompanyId(List<String> bizNames); List<Map<String, Object>> queryByCompanyId(List<String> bizNames);
List<Map<String, Object>> queryByCompanyNew(String bizOrgName); List<Map<String, Object>> queryByCompanyNew(String bizOrgName);
List<Map<String, Object>> dayDutyStatistics(String date, String groupCode, String fieldCode, String dictType);
List<Map<String, Object>> dayDutyList(String date, String dictCodes);
} }
...@@ -119,6 +119,82 @@ ...@@ -119,6 +119,82 @@
AND i.field_value != '' AND i.field_value != ''
GROUP BY i.field_value GROUP BY i.field_value
</select> </select>
<select id="dayDutyStatistics" resultType="java.util.Map">
SELECT
i.field_value AS postTypeName,
count( 1 ) AS total,
d.`code`,
MAX( CASE d.`code` WHEN '1601' THEN 'firePerson' WHEN '1602' THEN 'opsPerson' WHEN '1603' THEN 'securityPerson' WHEN '1604' THEN 'overhaulPerson' ELSE 'otherPerson' END ) AS postType
FROM
cb_duty_person_shift s,
cb_dynamic_form_instance i
LEFT JOIN cb_data_dictionary d ON i.field_value = d.`name`
WHERE
s.instance_id = i.instance_id
<if test="fieldCode != null and fieldCode != ''">
AND i.field_code = #{fieldCode}
</if>
<if test="date != null and date != ''">
AND s.duty_date = #{date}
</if>
AND s.shift_id IS NOT NULL
<if test="groupCode != null and groupCode != ''">
AND i.group_code = #{groupCode}
</if>
AND i.field_value IS NOT NULL
AND i.field_value != ''
<if test="dictType != null and dictType != ''">
AND d.type = #{dictType}
</if>
GROUP BY
i.field_value
</select>
<select id="dayDutyList" resultType="java.util.Map">
SELECT
id,
userName,
telephone,
peopleType
FROM
(
SELECT
ou.sequence_nbr AS id,
ou.biz_org_name AS userName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'telephone' THEN field_value END ), '' ) AS telephone,
IFNULL( MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value END ), '' ) AS postTypeName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'personImg' THEN field_value END ), '' ) AS personImg,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM
(
SELECT
IFNULL( max( CASE WHEN fi.field_code = 'userId' THEN fi.field_value END ), ps.instance_id ) AS id
FROM
cb_duty_person_shift ps
LEFT JOIN cb_dynamic_form_instance fi ON fi.instance_id = ps.instance_id
<where>
<if test="date != null and date != ''">
ps.duty_date = #{date}
</if>
</where>
GROUP BY
fi.instance_id
) a
LEFT JOIN cb_org_usr ou ON ou.sequence_nbr = a.id
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
GROUP BY
a.id
) b
<where>
<if test="dictCodes != null and dictCodes.split(',').length >0">
b.peopleType IN
<foreach collection="dictCodes.split(',')" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
GROUP BY
b.id
</select>
<select id="genRangeDate" resultType="map"> <select id="genRangeDate" resultType="map">
SELECT SELECT
DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY )),'%Y-%m-%d') AS date, DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY )),'%Y-%m-%d') AS date,
......
...@@ -123,4 +123,7 @@ public class EquipmentIndex extends BaseEntity { ...@@ -123,4 +123,7 @@ public class EquipmentIndex extends BaseEntity {
@TableField(value = "emergency_level_describe") @TableField(value = "emergency_level_describe")
private String emergencyLevelDescribe; private String emergencyLevelDescribe;
@TableField(value = "unit")
private String unit;
} }
...@@ -180,6 +180,7 @@ public class EquipmentSpecificIndex extends BaseEntity { ...@@ -180,6 +180,7 @@ public class EquipmentSpecificIndex extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String UUID; private String UUID;
@TableField(value = "unit")
private String unit;
} }
package com.yeejoin.equipmanage.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author keyong
* @title: UnitEnum
* <pre>
* @description: TODO
* </pre>
* @date 2023/1/13 20:44
*/
@Getter
@AllArgsConstructor
public enum IndexStatusEnum {
LOW("0", "液位低", ""),
NORMAL("1", "正常", ""),
HIGH("2", "液位高", "");
private String key;
private String describe1;
private String describe2;
public static IndexStatusEnum getEnumByKey(String key) {
IndexStatusEnum statusEnum = null;
for (IndexStatusEnum u : IndexStatusEnum.values()) {
if (u.getKey().equals(key)) {
statusEnum = u;
break;
}
}
return statusEnum;
}
}
package com.yeejoin.equipmanage.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author keyong
* @title: UnitEnum
* <pre>
* @description: TODO
* </pre>
* @date 2023/1/13 20:44
*/
@Getter
@AllArgsConstructor
public enum UnitEnum {
M("m", "米", ""),
DM("dm", "分米", ""),
CM("cm", "厘米", ""),
MM("mm", "毫米", "");
private String key;
private String name;
private String description;
public static UnitEnum getEnum(String key) {
UnitEnum unitEnum = null;
for (UnitEnum u : UnitEnum.values()) {
if (u.getKey().equals(key)) {
unitEnum = u;
break;
}
}
return unitEnum;
}
}
package com.yeejoin.equipmanage.common.utils;
import com.yeejoin.equipmanage.common.enums.UnitEnum;
import lombok.extern.slf4j.Slf4j;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* @author
* @title: UnitTransformUtil
* <pre>
* @description: TODO
* </pre>
* @date 2023/1/13 20:43
*/
@Slf4j
public class UnitTransformUtil {
public static Map<String, Object> transformValues(String currentValue, String currentUnit, String minValue, String maxValue) {
Map<String, Object> map = new HashMap<>();
if (UnitEnum.MM.getKey().equalsIgnoreCase(currentUnit) || UnitEnum.MM.getName().equals(currentUnit)){
BigDecimal divide = new BigDecimal(1000);
if (StringUtil.isNotEmpty(currentValue) && !"--".equals(currentValue)){
BigDecimal nowLevel = new BigDecimal(currentValue);
map.put("nowValue", nowLevel.divide(divide,2,BigDecimal.ROUND_HALF_UP));
BigDecimal nowVal = new BigDecimal(currentValue).divide(divide,2,BigDecimal.ROUND_HALF_UP);
// status 中 0 表示过低;1 表示正常;2 表示过高
if (StringUtil.isNotEmpty(minValue) && !"--".equals(minValue) && StringUtil.isNotEmpty(maxValue)
&& !"--".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));
} else if (nowVal.compareTo(new BigDecimal(maxValue)) == 1) {
map.put("status", "2");
map.put("abs", 100);
} else {
map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
}
} else {
map.put("status", "--");
map.put("abs", "--");
}
} else {
map.put("nowValue", "--");
map.put("status", "--");
map.put("abs", "--");
}
} else if (UnitEnum.CM.getKey().equalsIgnoreCase(currentUnit) || UnitEnum.CM.getName().equals(currentUnit)){
BigDecimal divide = new BigDecimal(100);
if (StringUtil.isNotEmpty(currentValue) && !"--".equals(currentValue)){
BigDecimal nowLevel = new BigDecimal(currentValue);
map.put("nowValue", nowLevel.divide(divide,2,BigDecimal.ROUND_HALF_UP));
BigDecimal nowVal = new BigDecimal(currentValue).divide(divide,2,BigDecimal.ROUND_HALF_UP);
// status 中 0 表示过低;1 表示正常;2 表示过高
if (StringUtil.isNotEmpty(minValue) && !"--".equals(minValue) && StringUtil.isNotEmpty(maxValue)
&& !"--".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));
} else if (nowVal.compareTo(new BigDecimal(maxValue)) == 1) {
map.put("status", "2");
map.put("abs", 100);
} else {
map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
}
} else {
map.put("status", "--");
map.put("abs", "--");
}
} else {
map.put("nowValue", "--");
map.put("status", "--");
map.put("abs", "--");
}
} else if (UnitEnum.DM.getKey().equalsIgnoreCase(currentUnit) || UnitEnum.DM.getName().equals(currentUnit)) {
BigDecimal divide = new BigDecimal(10);
if (StringUtil.isNotEmpty(currentValue) && !"--".equals(currentValue)){
BigDecimal nowLevel = new BigDecimal(currentValue);
map.put("nowValue",nowLevel.divide(divide,2,BigDecimal.ROUND_HALF_UP));
BigDecimal nowVal = new BigDecimal(currentValue).divide(divide,2,BigDecimal.ROUND_HALF_UP);
// status 中 0 表示过低;1 表示正常;2 表示过高
if (StringUtil.isNotEmpty(minValue) && !"--".equals(minValue) && StringUtil.isNotEmpty(maxValue)
&& !"--".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));
} else if (nowVal.compareTo(new BigDecimal(maxValue)) == 1) {
map.put("status", "2");
map.put("abs", 100);
} else {
map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
}
} else {
map.put("status", "--");
map.put("abs", "--");
}
} else {
map.put("nowValue", "--");
map.put("status", "--");
map.put("abs", "--");
}
} else {
BigDecimal nowVal = new BigDecimal(0);
if (StringUtil.isNotEmpty(currentValue) && !"--".equals(currentValue)) {
nowVal = new BigDecimal(currentValue);
map.put("nowValue", nowVal);
} else {
map.put("nowValue", "--");
}
// status 中 0 表示过低;1 表示正常;2 表示过高
if (StringUtil.isNotEmpty(currentValue) && !"--".equals(currentValue)
&& StringUtil.isNotEmpty(minValue) && !"--".equals(minValue)
&& StringUtil.isNotEmpty(maxValue) && !"--".equals(maxValue) && StringUtil.isNotEmpty(currentUnit)
&& !"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));
} else if (nowVal.compareTo(new BigDecimal(maxValue)) == 1) {
map.put("status", "2");
map.put("abs", 100);
} else {
map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
}
} else {
map.put("status", "--");
map.put("abs", "--");
}
}
return map;
}
}
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
) s group by date,bizOrgCode ) s group by date,bizOrgCode
</select> </select>
<select id="queryPersonNum" resultType="java.lang.Integer"> <select id="queryPersonNum" resultType="java.lang.Integer">
select count(*) from cb_firefighters where biz_org_code = #{bizOgrCode} AND people_type = '1601' select count(*) from cb_firefighters where biz_org_code like CONCAT('%',#{bizOgrCode}, '%') AND people_type = '1601'
AND is_delete = 0 AND now() > rec_date AND is_delete = 0 AND now() > rec_date
</select> </select>
......
...@@ -149,6 +149,28 @@ public class DutyPersonController extends BaseController { ...@@ -149,6 +149,28 @@ public class DutyPersonController extends BaseController {
return ResponseHelper.buildResponse(iDutyPersonService.newStatisticsDay(beginDate, endDate, fieldCode)); return ResponseHelper.buildResponse(iDutyPersonService.newStatisticsDay(beginDate, endDate, fieldCode));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/day-duty-statistics")
@ApiOperation(httpMethod = "GET", value = "获取指定日期值班人员统计", notes = "获取指定日期值班人员统计")
public ResponseModel<List<Map<String, Object>>> dayDutyStatistics(
@ApiParam(value = "值班日期") @RequestParam(required = false) String date,
@ApiParam(value = "分组编码") @RequestParam(required = false) String groupCode,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode,
@ApiParam(value = "字典类型") @RequestParam(required = false) String dictType
) throws ParseException {
return ResponseHelper.buildResponse(iDutyPersonService.dayDutyStatistics(date, groupCode, fieldCode, dictType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/day-duty-list")
@ApiOperation(httpMethod = "GET", value = "获取指定日期值班人员列表", notes = "获取指定日期值班人员列表")
public ResponseModel<List<Map<String, Object>>> dayDutyList(
@ApiParam(value = "值班日期") @RequestParam(required = false) String date,
@ApiParam(value = "字典编码") @RequestParam(required = false) String dictCodes
) throws ParseException {
return ResponseHelper.buildResponse(iDutyPersonService.dayDutyList(date, dictCodes));
}
/** /**
* 调班 * 调班
* *
......
...@@ -330,6 +330,15 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType ...@@ -330,6 +330,15 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType
return dutyPersonShiftMapper.queryByCompanyNew(bizOrgName); return dutyPersonShiftMapper.queryByCompanyNew(bizOrgName);
} }
@Override
public List<Map<String, Object>> dayDutyStatistics(String date, String groupCode, String fieldCode, String dictType) {
return dutyPersonShiftMapper.dayDutyStatistics(date, groupCode, fieldCode, dictType);
}
@Override
public List<Map<String, Object>> dayDutyList(String date, String dictCodes) {
return dutyPersonShiftMapper.dayDutyList(date, dictCodes);
}
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType, String fieldCode) { public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType, String fieldCode) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getNewEquipmentForSpecifyDate(dutyDay, List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getNewEquipmentForSpecifyDate(dutyDay,
......
...@@ -14,6 +14,7 @@ import org.aspectj.lang.annotation.Aspect; ...@@ -14,6 +14,7 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -38,6 +39,9 @@ public class PersonIdentifyAspect { ...@@ -38,6 +39,9 @@ public class PersonIdentifyAspect {
@Autowired @Autowired
private JcsFeign jcsFeignClient; private JcsFeign jcsFeignClient;
@Value("${logic}")
Boolean logic;
@Pointcut("execution(public * com.*.equipmanage.controller..*(..))") @Pointcut("execution(public * com.*.equipmanage.controller..*(..))")
public void userDate() { public void userDate() {
...@@ -60,6 +64,11 @@ public class PersonIdentifyAspect { ...@@ -60,6 +64,11 @@ public class PersonIdentifyAspect {
// ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class); // ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
String s = JSONObject.toJSONString(responseModel.getResult()); String s = JSONObject.toJSONString(responseModel.getResult());
ReginParams.PersonIdentity personIdentity = JSONObject.parseObject(s, ReginParams.PersonIdentity.class); ReginParams.PersonIdentity personIdentity = JSONObject.parseObject(s, ReginParams.PersonIdentity.class);
//电力默认走公司权限
if (!logic){
personIdentity.setBizOrgCode(StringUtils.isEmpty(personIdentity.getCompanyBizOrgCode()) ? "-1" : personIdentity.getCompanyBizOrgCode());
}
reginParam.setPersonIdentity(personIdentity); reginParam.setPersonIdentity(personIdentity);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam)); redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
} }
......
...@@ -8,6 +8,7 @@ import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto; ...@@ -8,6 +8,7 @@ import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -45,6 +46,7 @@ public class AnalysisReportLogController extends AbstractBaseController { ...@@ -45,6 +46,7 @@ public class AnalysisReportLogController extends AbstractBaseController {
// 工具栏中,显示第几个按钮,从左到右,可由逗号隔开显示多个 // 工具栏中,显示第几个按钮,从左到右,可由逗号隔开显示多个
private String showButton = "6"; private String showButton = "6";
@Lazy
@Autowired @Autowired
IAnalysisReportLogService iAnalysisReportLogService; IAnalysisReportLogService iAnalysisReportLogService;
...@@ -103,7 +105,10 @@ public class AnalysisReportLogController extends AbstractBaseController { ...@@ -103,7 +105,10 @@ public class AnalysisReportLogController extends AbstractBaseController {
dto.setStartDate(startDate); dto.setStartDate(startDate);
dto.setEndDate(endDate); dto.setEndDate(endDate);
dto.setReportType(reportType); dto.setReportType(reportType);
dto.setStationCode(stationCode); ReginParams reginParams = getSelectedOrgInfo();
dto.setStationCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
return iAnalysisReportLogService.iotReportPage(page, dto); return iAnalysisReportLogService.iotReportPage(page, dto);
} }
} }
...@@ -100,6 +100,7 @@ public class CarController extends AbstractBaseController { ...@@ -100,6 +100,7 @@ public class CarController extends AbstractBaseController {
@Autowired @Autowired
ICarLonAndLatDataService iCarLonAndLatDataService; ICarLonAndLatDataService iCarLonAndLatDataService;
@Lazy
@Autowired @Autowired
IEquipmentService iEquipmentService; IEquipmentService iEquipmentService;
......
...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.rule.action.MessageAction; import com.yeejoin.amos.boot.biz.common.rule.action.MessageAction;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto; import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import com.yeejoin.equipmanage.common.utils.*; import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.config.PersonIdentify; import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.fegin.IotFeign; import com.yeejoin.equipmanage.fegin.IotFeign;
...@@ -272,17 +273,27 @@ public class ConfigureController extends AbstractBaseController { ...@@ -272,17 +273,27 @@ public class ConfigureController extends AbstractBaseController {
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null; String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize()); Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
Page<Map<String, Object>> waterInfo = fireFightingSystemMapper.getWaterInfo(page, bizOrgCode, null); Page<Map<String, Object>> waterInfo = fireFightingSystemMapper.getWaterInfo(page, bizOrgCode, null);
Map<String, Object> unit = fireFightingSystemMapper.getWaterlevelUnit();
if ("CM".equals(unit.get("unit")) || "cm".equals(unit.get("unit")) || "厘米".equals(unit.get("unit"))){
for (Map<String, Object> record : waterInfo.getRecords()) { for (Map<String, Object> record : waterInfo.getRecords()) {
Map<String, Object> unit = null;
String deviceId = String.valueOf(record.get("level_device_id"));
String[] split = deviceId.split(",");
if (!ObjectUtils.isEmpty(split) && !ObjectUtils.isEmpty(split[0])) {
String s = split[0];
if ("pool".equals(record.get("resource_type"))) {
unit = fireFightingSystemMapper.getWaterlevelUnit(s, "FHS_FirePoolDevice_WaterLevel");
} else {
unit = fireFightingSystemMapper.getWaterlevelUnit(s, "FHS_WirelessliquidDetector_WaterLevel");
}
}
if (!ObjectUtils.isEmpty(unit) && "CM".equals(unit.get("unit")) || "cm".equals(unit.get("unit")) || "厘米".equals(unit.get("unit"))){
BigDecimal divide = new BigDecimal(100); BigDecimal divide = new BigDecimal(100);
if (!ObjectUtils.isEmpty(record.get("nowLevel")) && !"--".equals(record.get("nowLevel"))){ if (!ObjectUtils.isEmpty(record.get("nowLevel")) && !"--".equals(record.get("nowLevel"))){
BigDecimal nowLevel = new BigDecimal(String.valueOf(record.get("nowLevel"))); BigDecimal nowLevel = new BigDecimal(String.valueOf(record.get("nowLevel")));
record.put("nowLevel",nowLevel.divide(divide,2,BigDecimal.ROUND_HALF_UP)); record.put("nowLevel", nowLevel.divide(divide, 2, BigDecimal.ROUND_HALF_UP));
} }
if (!ObjectUtils.isEmpty(record.get("levelAbs")) && !"--".equals(record.get("nowLevel"))){ if (!ObjectUtils.isEmpty(record.get("levelAbs")) && !"--".equals(record.get("nowLevel"))){
BigDecimal levelAbs = new BigDecimal(String.valueOf(record.get("levelAbs"))); BigDecimal levelAbs = new BigDecimal(String.valueOf(record.get("levelAbs")));
record.put("levelAbs",levelAbs.divide(divide,2,BigDecimal.ROUND_HALF_UP)); record.put("levelAbs", levelAbs.divide(divide, 2, BigDecimal.ROUND_HALF_UP));
} }
} }
} }
...@@ -845,6 +856,19 @@ public class ConfigureController extends AbstractBaseController { ...@@ -845,6 +856,19 @@ public class ConfigureController extends AbstractBaseController {
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
@ApiOperation(httpMethod = "GET", value = "定时生成 MonthReport表", notes = "MonthReport表")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/testMonthReport")
public void monthReport(String date,int num) throws ParseException {
Date time = DateUtils.longStr2Date(date);
Date yestDay = DateUtils.dateAdd(time,-num,false);
Date beginDate = DateUtils.getFirstDayOfMonth(yestDay);
Date endDate = DateUtils.getLastDayOfMonth(yestDay);
log.warn("monthReport报表开始生成");
iAnalysisReportLogService.generateMonthReportTest(AnalysisReportEnum.MONTH_REPORT,beginDate,endDate,time,num);
}
@PersonIdentify @PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/iotWeekReport") @GetMapping(value = "/iotWeekReport")
......
...@@ -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());
}
} }
...@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -288,6 +289,7 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -288,6 +289,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
*/ */
@DeleteMapping(value = "/delEquipmentBySpecificId") @DeleteMapping(value = "/delEquipmentBySpecificId")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@Transactional(rollbackFor = Exception.class)
@ApiOperation(value = "删除装备相关所有数据", notes = "删除装备相关所有数据") @ApiOperation(value = "删除装备相关所有数据", notes = "删除装备相关所有数据")
public ResponseModel delEquipmentBySpecificId(@RequestParam Long specificId) { public ResponseModel delEquipmentBySpecificId(@RequestParam Long specificId) {
EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getById(specificId); EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getById(specificId);
...@@ -297,6 +299,7 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -297,6 +299,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
return CommonResponseUtil.success(result); return CommonResponseUtil.success(result);
} }
private void refreshCount(String bizOrgCode) { private void refreshCount(String bizOrgCode) {
try { try {
equipmentSpecificSerivce.refreshStaData(); equipmentSpecificSerivce.refreshStaData();
...@@ -438,7 +441,7 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -438,7 +441,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
List<String> split= Arrays.asList(equipSpeId.split(",")); List<String> split= Arrays.asList(equipSpeId.split(","));
for (String s : split) { for (String s : split) {
// 1.根据 equipSpeId 查询装备iotCode // 1.根据 equipSpeId 查询装备iotCode
EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectById(equipSpeId); EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectById(s);
if (ObjectUtils.isEmpty(equipmentSpecific)) { if (ObjectUtils.isEmpty(equipmentSpecific)) {
return CommonResponseUtil.failure("未查询到装备信息!"); return CommonResponseUtil.failure("未查询到装备信息!");
} }
......
...@@ -35,6 +35,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -35,6 +35,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil; import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
...@@ -196,9 +197,40 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -196,9 +197,40 @@ public class FireFightingSystemController extends AbstractBaseController {
//查询系统下设备状态 //查询系统下设备状态
@RequestMapping(value = "/alarmSystem/info", method = RequestMethod.GET) @RequestMapping(value = "/alarmSystem/info", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("通过id查询消防系统信息") @ApiOperation("通过systemCode查询消防系统信息")
public List<Map<String,Object>> getEquip() { public List<Map<String,Object>> getEquip(@RequestParam(required = false) String bizOrgCode,
return fireFightingSystemService.getEquip(); @RequestParam(required = false) String systemCode) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return Lists.newArrayList();
}
}
}
return fireFightingSystemService.getEquip(bizOrgCode, systemCode);
}
//查询系统下设备状态
@RequestMapping(value = "/getFireSystemEquipStatusList", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("通过systemCode、设备分类编码字符串查询消防系统信息")
public List<Map<String,Object>> getFireSystemEquipStatusList(@RequestParam(required = false) String bizOrgCode,
@RequestParam(required = false) String systemCode,
@RequestParam(required = false) String categoryCodes) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return Lists.newArrayList();
}
}
}
return fireFightingSystemService.getFireSystemEquipStatusList(bizOrgCode, systemCode, categoryCodes);
} }
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.enums.IndexStatusEnum;
import com.yeejoin.equipmanage.common.utils.*; import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.config.PersonIdentify; import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.fegin.IotFeign; import com.yeejoin.equipmanage.fegin.IotFeign;
...@@ -57,6 +58,9 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -57,6 +58,9 @@ public class SupervisionConfigureController extends AbstractBaseController {
@Value("${equipment.pressurepump.start}") @Value("${equipment.pressurepump.start}")
private String pressurePumpStart; private String pressurePumpStart;
@Value("${equipment.pressurepump.stop}")
private String pressurePumpStop;
@PersonIdentify @PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘概览水源信息") @ApiOperation(value = "监盘概览水源信息")
...@@ -70,7 +74,22 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -70,7 +74,22 @@ public class SupervisionConfigureController extends AbstractBaseController {
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null; bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
} }
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize()); Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getWaterInfoBySuper(page, bizOrgCode)); Page<Map<String, Object>> page1 = fireFightingSystemMapper.getWaterInfoBySuper(page, bizOrgCode);
List<Map<String, Object>> res = page1.getRecords();
if (0 < res.size()) {
for (Map<String, Object> m : res) {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
m.put("levelStatus", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
m.put("levelStatus", "--");
}
m.put("levelAbs", transResult.get("abs"));
}
}
return CommonResponseUtil.success(page1);
} }
@PersonIdentify @PersonIdentify
...@@ -257,7 +276,8 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -257,7 +276,8 @@ public class SupervisionConfigureController extends AbstractBaseController {
} }
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize()); Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
Page<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null); Page<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null);
List<Long> ids = new ArrayList(); List<Long> startTimeList = new ArrayList();
List<Long> stopTimeList = new ArrayList();
pressurePumpInfo.getRecords().stream().map(item -> { pressurePumpInfo.getRecords().stream().map(item -> {
item.put("monthStartNum", 0); item.put("monthStartNum", 0);
item.put("halfHourStartNum", 0); item.put("halfHourStartNum", 0);
...@@ -296,12 +316,16 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -296,12 +316,16 @@ public class SupervisionConfigureController extends AbstractBaseController {
ResponseModel twoHourEntity = null; ResponseModel twoHourEntity = null;
ResponseModel fourHourEntity = null; ResponseModel fourHourEntity = null;
ResponseModel oneHourEntity = null; ResponseModel oneHourEntity = null;
ResponseModel start = null;
ResponseModel stop = null;
try { try {
mounthEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, pressurePumpStart); mounthEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), startDateStr, nowStrLong, prefix, suffix, pressurePumpStart);
halfHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), half, nowStrLong, prefix, suffix, pressurePumpStart); halfHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), half, nowStrLong, prefix, suffix, pressurePumpStart);
twoHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), two, nowStrLong, prefix, suffix, pressurePumpStart); twoHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), two, nowStrLong, prefix, suffix, pressurePumpStart);
fourHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), four, nowStrLong, prefix, suffix, pressurePumpStart); fourHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), four, nowStrLong, prefix, suffix, pressurePumpStart);
oneHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), one, nowStrLong, prefix, suffix, pressurePumpStart); oneHourEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), one, nowStrLong, prefix, suffix, pressurePumpStart);
start = iotFeign.selectOne(getAppKey(), getProduct(), getToken(), "1", prefix, suffix, "true", pressurePumpStart);
stop = iotFeign.selectOne(getAppKey(), getProduct(), getToken(), "1", prefix, suffix, "flase", pressurePumpStart);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -340,31 +364,77 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -340,31 +364,77 @@ public class SupervisionConfigureController extends AbstractBaseController {
int num = collect.size(); int num = collect.size();
item.put("oneHourStartNum", num); item.put("oneHourStartNum", num);
} }
if (200 == start.getStatus() && !ObjectUtils.isEmpty(start.getResult())) {
String json1 = JSON.toJSONString(start.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey("time"))).collect(Collectors.toList());
item.put("start", collect.get(0).get("time"));
}
if (200 == stop.getStatus() && !ObjectUtils.isEmpty(stop.getResult())) {
String json1 = JSON.toJSONString(stop.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey("time"))).collect(Collectors.toList());
item.put("stop", collect.get(0).get("time"));
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long nowDateTime = new Date().getTime();//当前时间戳 long nowDateTime = new Date().getTime();//当前时间戳
Map<String, String> stateMap = fireFightingSystemMapper.queryPressureNowStateBySpecificId((Long) item.get("id"));
ids.add((Long) item.get("id"));
boolean time = true; boolean time = true;
if (!ObjectUtils.isEmpty(stateMap) && stateMap.containsKey("update_date") && stateMap.containsKey("equipment_index_name")) { String startTime = null;
item.put("update_time", String.valueOf(stateMap.get("update_date")).replaceAll("T", " ")); String stopTime = null;
if (!ObjectUtils.isEmpty(stateMap.get("value"))) { Long start_time = 0L;
item.put("equipment_index_name", stateMap.get("equipment_index_name")); Long stop_time = 0L;
} else { Date startDate = null;
Date stopDate = null;
if (ObjectUtils.isEmpty(item.get("start")) && ObjectUtils.isEmpty(item.get("stop"))) {
item.put("equipment_index_name", "无信号"); item.put("equipment_index_name", "无信号");
} else {
if (!ObjectUtils.isEmpty(item.get("start"))) {
startTime = item.get("start").toString().substring(0, 19).replace("T", " ");
startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTime), +8);
startTimeList.add(startDate.getTime());
start_time = startDate.getTime();
item.put("startTime", startDate);
} else {
item.put("startTime", 0);
}
if (!ObjectUtils.isEmpty(item.get("stop"))) {
stopTime = item.get("stop").toString().substring(0, 19).replace("T", " ");
stopDate = DateUtils.dateAddHours(DateUtils.longStr2Date(stopTime), +8);
stopTimeList.add(stopDate.getTime());
stop_time = stopDate.getTime();
item.put("stopTime", stopDate);
} else {
item.put("stopTime", 0);
} }
if ("启动".equals(item.get("equipment_index_name"))) { if (!"0".equals(item.get("startTime"))) {
long update_time = 0L; if ("0".equals(item.get("stopTime"))) {
try { long res = nowDateTime - start_time;
update_time = sdf.parse(String.valueOf(stateMap.get("update_date")).replaceAll("T", " ")).getTime(); long diffMinute = res / 1000 / 60;
} catch (ParseException e) { if (diffMinute > 5) {
throw new RuntimeException(e); time = false;
} }
long res = nowDateTime - update_time; item.put("upTime", diffMinute);
item.put("equipment_index_name", "启动");
item.put("update_time", startDate);
} else {
String startOrStop = start_time - stop_time > 0 ? "start" : " stop";
if ("start".equals(startOrStop)) {
long res = nowDateTime - start_time;
long diffMinute = res / 1000 / 60; long diffMinute = res / 1000 / 60;
if (diffMinute > 5) { if (diffMinute > 5) {
time = false; time = false;
} }
item.put("upTime", diffMinute); item.put("upTime", diffMinute);
item.put("equipment_index_name", "启动");
item.put("update_time", startDate);
} else {
item.put("upTime", 0);
item.put("equipment_index_name", "停止");
item.put("update_time", stopDate);
}
}
} else {
item.put("upTime", 0);
} }
} }
item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? "正常" : "异常"); item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? "正常" : "异常");
...@@ -375,23 +445,14 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -375,23 +445,14 @@ public class SupervisionConfigureController extends AbstractBaseController {
} }
return item; return item;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
List<Map<String, Object>> stateMap = fireFightingSystemMapper.queryStartAndStopBySpecificId(ids); List<Long> startCollect = startTimeList.stream().sorted(Comparator.reverseOrder()).limit(1).collect(Collectors.toList());
long diffMinute = 0L; List<Long> stopCollect = stopTimeList.stream().sorted(Comparator.reverseOrder()).limit(1).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(stateMap)) { long res = 0L;
String startTime = stateMap.get(0).get("update_date").toString(); if (startCollect.size() > 0 && stopCollect.size() > 0) {
String endTime = stateMap.get(1).get("update_date").toString(); res = Math.abs(startCollect.get(0) - stopCollect.get(0));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long start = 0L;
long end = 0L;
try {
start = sdf.parse(startTime.replaceAll("T", " ")).getTime();
end = sdf.parse(endTime.replaceAll("T", " ")).getTime();
} catch (ParseException e) {
throw new RuntimeException(e);
} }
long res = Math.abs(start - end); long diffMinute = 0L;
diffMinute = res / 1000 / 60; diffMinute = res / 1000 / 60;
}
long finalDiffMinute = diffMinute; long finalDiffMinute = diffMinute;
pressurePumpInfo.getRecords().stream( pressurePumpInfo.getRecords().stream(
).map(item -> { ).map(item -> {
...@@ -523,7 +584,8 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -523,7 +584,8 @@ public class SupervisionConfigureController extends AbstractBaseController {
map.put("name", pressurePump.get("name")); map.put("name", pressurePump.get("name"));
String json1 = JSON.toJSONString(mounthEntity.getResult()); String json1 = JSON.toJSONString(mounthEntity.getResult());
List<Map<String, String>> list = (List<Map<String, String>>) JSONArray.parse(json1); List<Map<String, String>> list = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = list.stream().filter(t -> (t.containsKey("time") && t.get("time").substring(0, 10).equals(item.get("date")))).collect(Collectors.toList()); List<Map<String, String>> collect = list.stream().filter(t -> (t.containsKey("time") && t.get("time").substring(0, 10).equals(item.get("date"))) && ((t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("true"))
|| (t.containsKey(pressurePumpStart) && t.get(pressurePumpStart).equals("false")))).collect(Collectors.toList());
map.put("value", collect.size()); map.put("value", collect.size());
map.put("id", pressurePump.get("id")); map.put("id", pressurePump.get("id"));
if (item.containsKey("yData")) { if (item.containsKey("yData")) {
...@@ -548,6 +610,7 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -548,6 +610,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "稳压泵详情", produces = "application/json;charset=UTF-8", notes = "稳压泵详情") @ApiOperation(httpMethod = "GET", value = "稳压泵详情", produces = "application/json;charset=UTF-8", notes = "稳压泵详情")
public ResponseModel selectPressureDetails(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) { public ResponseModel selectPressureDetails(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity(); ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) { if (!ValidationUtil.isEmpty(personIdentity)) {
...@@ -556,8 +619,65 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -556,8 +619,65 @@ public class SupervisionConfigureController extends AbstractBaseController {
return CommonResponseUtil.success(null); return CommonResponseUtil.success(null);
} }
} }
List<Map<String, Object>> pressurePumps = fireFightingSystemMapper.selectPressureDetails(bizOrgCode); }
return CommonResponseUtil.success(pressurePumps); List<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.selectAllPressurePumpInfo(bizOrgCode);
pressurePumpInfo.stream().map(item -> {
String prefix = null;
String suffix = null;
String iotCode = item.get("iot_code").toString();
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码错误,请确认!");
}
ResponseModel start = null;
ResponseModel stop = null;
try {
start = iotFeign.selectOne(getAppKey(), getProduct(), getToken(), "1", prefix, suffix, "true", pressurePumpStart);
stop = iotFeign.selectOne(getAppKey(), getProduct(), getToken(), "1", prefix, suffix, "flase", pressurePumpStart);
} catch (Exception e) {
e.printStackTrace();
}
if (200 == start.getStatus() && !ObjectUtils.isEmpty(start.getResult())) {
String json1 = JSON.toJSONString(start.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey("time"))).collect(Collectors.toList());
if (collect.size() > 0) {
String startTime = collect.get(0).get("time").substring(0, 19).replace("T", " ");
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTime), +8);
item.put("startTime", startDate);
} else {
item.put("startTime", "");
}
}
if (200 == stop.getStatus() && !ObjectUtils.isEmpty(stop.getResult())) {
String json1 = JSON.toJSONString(stop.getResult());
List<Map<String, String>> listObject1 = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = listObject1.stream().filter(t -> (t.containsKey("time"))).collect(Collectors.toList());
if (collect.size() > 0) {
String stopTime = collect.get(0).get("time").substring(0, 19).replace("T", " ");
Date stopDate = DateUtils.dateAddHours(DateUtils.longStr2Date(stopTime), +8);
item.put("stopTime", stopDate);
} else {
item.put("stopTime", "");
}
}
return item;
}).collect(Collectors.toList());
return CommonResponseUtil.success(pressurePumpInfo);
// ReginParams reginParams = getSelectedOrgInfo();
// ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
// if (!ValidationUtil.isEmpty(personIdentity)) {
// bizOrgCode = personIdentity.getBizOrgCode();
// if (bizOrgCode == null) {
// return CommonResponseUtil.success(null);
// }
// }
// List<Map<String, Object>> pressurePumps = fireFightingSystemMapper.selectPressureDetails(bizOrgCode);
// return CommonResponseUtil.success(pressurePumps);
} }
......
...@@ -38,6 +38,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -38,6 +38,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; 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.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -846,18 +847,18 @@ public class TopographyController extends AbstractBaseController { ...@@ -846,18 +847,18 @@ public class TopographyController extends AbstractBaseController {
@RequestParam(required = false) String endDate) throws ParseException { @RequestParam(required = false) String endDate) throws ParseException {
Map<String, List<IotIndexResVo>> resultMap = new HashMap<>(); Map<String, List<IotIndexResVo>> resultMap = new HashMap<>();
List<String> split= Arrays.asList(equipSpeId.split(",")); List<String> split = Arrays.asList(equipSpeId.split(","));
List<IotIndexResVo> finalRes = new ArrayList<>(); List<IotIndexResVo> finalRes = new ArrayList<>();
List<IotIndexResVo> finalResContainsWaterLevel = new ArrayList<>(); List<IotIndexResVo> finalResContainsWaterLevel = new ArrayList<>();
List<IotIndexResVo> resultResContainsWater = new ArrayList<>(); List<IotIndexResVo> resultResContainsWater = new ArrayList<>();
Map<String, String> iotCodeMap = new HashMap<>();
for (String specId : split) { for (String specId : split) {
String eqpId; String eqpId;
String iotCode = null; String iotCode = null;
if(null != fieldKey || null != isTrend) { if (null != fieldKey || null != isTrend) {
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(specId); EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(specId);
iotCode = equipmentSpecific.getIotCode(); iotCode = equipmentSpecific.getIotCode();
iotCodeMap.put(specId, iotCode);
List<EquipmentIndex> equipmentSpecifics = equipmentIndexService.getPerfQutoaIotList(Long.valueOf(specId)); List<EquipmentIndex> equipmentSpecifics = equipmentIndexService.getPerfQutoaIotList(Long.valueOf(specId));
...@@ -867,7 +868,6 @@ public class TopographyController extends AbstractBaseController { ...@@ -867,7 +868,6 @@ public class TopographyController extends AbstractBaseController {
if ("true".equals(isTrend)) { if ("true".equals(isTrend)) {
fieldKey = equipmentSpecifics.stream().filter(equipmentIndex -> equipmentIndex.getIsTrend()).map(EquipmentIndex::getPerfQuotaDefinitionId).collect(Collectors.joining(",")); fieldKey = equipmentSpecifics.stream().filter(equipmentIndex -> equipmentIndex.getIsTrend()).map(EquipmentIndex::getPerfQuotaDefinitionId).collect(Collectors.joining(","));
} }
} else { } else {
if (StringUtil.isNotEmpty(specId)) { if (StringUtil.isNotEmpty(specId)) {
eqpId = specId; eqpId = specId;
...@@ -882,7 +882,6 @@ public class TopographyController extends AbstractBaseController { ...@@ -882,7 +882,6 @@ public class TopographyController extends AbstractBaseController {
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(eqpId); EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(eqpId);
iotCode = equipmentSpecific.getIotCode(); iotCode = equipmentSpecific.getIotCode();
} }
String prefix = null; String prefix = null;
String suffix = null; String suffix = null;
if (StringUtil.isNotEmpty(iotCode) && iotCode.length() > 8) { if (StringUtil.isNotEmpty(iotCode) && iotCode.length() > 8) {
...@@ -911,26 +910,15 @@ public class TopographyController extends AbstractBaseController { ...@@ -911,26 +910,15 @@ public class TopographyController extends AbstractBaseController {
} }
} }
} }
// List<IotDataVO> timeList = vos.stream().filter(x -> x.getKey().equals("time")).collect(Collectors.toList());
// List<Date> dates = new ArrayList<>();
Map<String, List<Date>> dateMap = new HashMap<>(); Map<String, List<Date>> dateMap = new HashMap<>();
// String indexKey = null;
// String useDate = null;
for (int i = 0; i < vos.size(); i = i + 2) { for (int i = 0; i < vos.size(); i = i + 2) {
Date useDate = null; Date useDate = null;
String indexKey = null; String indexKey = null;
if (vos.get(i).getKey().equals("time")) { if (vos.get(i).getKey().equals("time")) {
String strDate = String.valueOf(vos.get(i).getValue()).substring(0, 19); useDate = dateParse(vos.get(i).getValue().toString());
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
useDate = sdf.parse(strDate);
indexKey = String.valueOf(vos.get(i + 1).getKey()); indexKey = String.valueOf(vos.get(i + 1).getKey());
} else { } else {
String strDate = String.valueOf(vos.get(i + 1).getValue()).substring(0, 19); useDate = dateParse(vos.get(i).getValue().toString());
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
useDate = sdf.parse(strDate);
indexKey = String.valueOf(vos.get(i).getKey()); indexKey = String.valueOf(vos.get(i).getKey());
} }
if (!dateMap.containsKey(indexKey)) { if (!dateMap.containsKey(indexKey)) {
...@@ -941,44 +929,7 @@ public class TopographyController extends AbstractBaseController { ...@@ -941,44 +929,7 @@ public class TopographyController extends AbstractBaseController {
dateMap.get(indexKey).add(useDate); dateMap.get(indexKey).add(useDate);
} }
} }
// for (IotDataVO vo : vos) {
// if (!vo.getKey().equals("time")) {
// indexKey = vo.getKey();
// if (useDate != null) {
// SimpleDateFormat sdf1 = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
// if (!dateMap.containsKey(indexKey)) {
// ArrayList<Date> dates1 = new ArrayList<>();
// dates1.add(sdf1.parse(useDate));
// dateMap.put(indexKey, dates1);
// } else {
// dateMap.get(indexKey).add(sdf1.parse(useDate));
// }
// indexKey = null;
// }
// } else {
// String value = String.valueOf(vo.getValue());
// String strDate = value.substring(0, 19);
// SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
// SimpleDateFormat sdf1 = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
// logger.info("返回时间===================================(" + vo.getValue() + ") =======================================");
// sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
// Date date = sdf.parse(strDate);
// String time = DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
// if (indexKey == null) {
// useDate = time;
// }
//// dates.add(sdf1.parse(time));
// logger.info("返回时间===================================(" + sdf1.parse(time) + ") =======================================");
// }
// }
List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCodeAndTrend(iotCode); List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCodeAndTrend(iotCode);
if (0 < indexes.size()) { if (0 < indexes.size()) {
List<TopographyIotIndexTrendVo> list = new ArrayList<>(); List<TopographyIotIndexTrendVo> list = new ArrayList<>();
vos.forEach(iotDataVO -> { vos.forEach(iotDataVO -> {
...@@ -1006,7 +957,6 @@ public class TopographyController extends AbstractBaseController { ...@@ -1006,7 +957,6 @@ public class TopographyController extends AbstractBaseController {
for (String str : maps.keySet()) { for (String str : maps.keySet()) {
mapIndex.put(str, maps.get(str).get(0).getId()); mapIndex.put(str, maps.get(str).get(0).getId());
} }
List<IotIndexResVo> res = new ArrayList<>(); List<IotIndexResVo> res = new ArrayList<>();
List<IotIndexResVo> resContainsWaterLevelList = new ArrayList<>(); List<IotIndexResVo> resContainsWaterLevelList = new ArrayList<>();
for (String s : mapIndex.keySet()) { for (String s : mapIndex.keySet()) {
...@@ -1027,7 +977,6 @@ public class TopographyController extends AbstractBaseController { ...@@ -1027,7 +977,6 @@ public class TopographyController extends AbstractBaseController {
res.add(vo); res.add(vo);
} }
} }
for (IotIndexResVo s : res) { for (IotIndexResVo s : res) {
s.setIotData(map.get(s.getNameKey())); s.setIotData(map.get(s.getNameKey()));
s.setTimes(dateMap.get(s.getNameKey())); s.setTimes(dateMap.get(s.getNameKey()));
...@@ -1037,9 +986,9 @@ public class TopographyController extends AbstractBaseController { ...@@ -1037,9 +986,9 @@ public class TopographyController extends AbstractBaseController {
} }
} }
} }
List<Date> containsWaterDates = new ArrayList<>();
Map<String, Map<Date, IotDataVO>> iotDataAndDateMap= new HashMap<>(); List<Date> containsWaterDates = new ArrayList<>();
Map<String, Map<Date, IotDataVO>> iotDataAndDateMap = new HashMap<>();
finalResContainsWaterLevel.stream().forEach(item -> { finalResContainsWaterLevel.stream().forEach(item -> {
if (!CollectionUtils.isEmpty(item.getTimes())) { if (!CollectionUtils.isEmpty(item.getTimes())) {
containsWaterDates.addAll(item.getTimes()); containsWaterDates.addAll(item.getTimes());
...@@ -1051,9 +1000,10 @@ public class TopographyController extends AbstractBaseController { ...@@ -1051,9 +1000,10 @@ public class TopographyController extends AbstractBaseController {
} }
}); });
List<Date> collect = containsWaterDates.stream().distinct().sorted(Comparator.comparing(t -> t)).collect(Collectors.toList()); List<Date> collect = containsWaterDates.stream().distinct().sorted(Comparator.comparing(t -> t)).collect(Collectors.toList());
IotIndexResVo iotIndexRes = null;
Map<String, List<IotDataVO>> map = new HashMap<>();
for (IotIndexResVo indexResVo : finalResContainsWaterLevel) { for (IotIndexResVo indexResVo : finalResContainsWaterLevel) {
IotIndexResVo iotIndexRes = new IotIndexResVo(); iotIndexRes = new IotIndexResVo();
iotIndexRes.setName(indexResVo.getName()); iotIndexRes.setName(indexResVo.getName());
iotIndexRes.setTimes(collect); iotIndexRes.setTimes(collect);
iotIndexRes.setId(indexResVo.getId()); iotIndexRes.setId(indexResVo.getId());
...@@ -1063,14 +1013,67 @@ public class TopographyController extends AbstractBaseController { ...@@ -1063,14 +1013,67 @@ public class TopographyController extends AbstractBaseController {
List<IotDataVO> list = new ArrayList<>(); List<IotDataVO> list = new ArrayList<>();
collect.forEach(item -> { collect.forEach(item -> {
IotDataVO iotDataVO = new IotDataVO(); IotDataVO iotDataVO = new IotDataVO();
iotDataVO.setValue(0);
iotDataVO.setKey(indexResVo.getIotData().get(0).getKey()); iotDataVO.setKey(indexResVo.getIotData().get(0).getKey());
iotDataVO.setValue(0);
if (dateIotDataVOMap.containsKey(item)) { if (dateIotDataVOMap.containsKey(item)) {
iotDataVO.setValue(dateIotDataVOMap.get(item).getValue()); iotDataVO.setValue(dateIotDataVOMap.get(item).getValue());
} else {
String currentIotCode = iotCodeMap.get(indexResVo.getEquipId());
String currentPrefix = currentIotCode.substring(0, 8);
String currentSuffix = currentIotCode.substring(8);
ResponseModel entity = null;
try {
entity = iotFeign.selectPage(getAppKey(), getProduct(), getToken(), "2000-01-01 00:00:00", endDate, currentPrefix, currentSuffix, indexResVo.getIotData().get(0).getKey(), 0, 1);
} catch (Exception e) {
throw new RuntimeException("调用AMOS-API-IOT服务失败,请检查服务是否正常!");
}
if (200 == entity.getStatus() && !ObjectUtils.isEmpty(entity.getResult())) {
String json = JSON.toJSONString(entity.getResult());
Map<String, Object> listObject = (Map<String, Object>) JSONArray.parse(json);
List<Map<String, String>> listData = (List<Map<String, String>>) listObject.get("records");
if (!CollectionUtils.isEmpty(listData)) {
for (Map.Entry<String, String> stringStringEntry : listData.get(0).entrySet()) {
if (indexResVo.getIotData().get(0).getKey().equals(stringStringEntry.getKey())) {
iotDataVO.setValue(String.valueOf(stringStringEntry.getValue()));
}
}
} else {
iotDataVO.setValue(0);
}
} else {
iotDataVO.setValue(0);
}
} }
list.add(iotDataVO); list.add(iotDataVO);
}); });
map.put(indexResVo.getEquipId(), list);
}
List<IotDataVO> list = new ArrayList<>();
int j = 0;
for (Map.Entry<String, List<IotDataVO>> stringListEntry : map.entrySet()) {
if (j == 0) {
list = stringListEntry.getValue();
} else {
for (int i = 0; i < stringListEntry.getValue().size(); i++) {
Object last = list.get(i).getValue();
Object current = stringListEntry.getValue().get(i).getValue();
BigDecimal value1 = new BigDecimal(String.valueOf(last));
BigDecimal value2 = new BigDecimal(String.valueOf(current));
BigDecimal add = value1.add(value2);
BigDecimal divide = add.divide(new BigDecimal(2), 2, BigDecimal.ROUND_DOWN);
list.get(i).setValue(divide);
}
}
j++;
}
if (!CollectionUtils.isEmpty(list)) {
iotIndexRes.setIotData(list); iotIndexRes.setIotData(list);
}
if (!ObjectUtils.isEmpty(iotIndexRes)) {
resultResContainsWater.add(iotIndexRes); resultResContainsWater.add(iotIndexRes);
} }
resultMap.put("noMergeList", finalRes); resultMap.put("noMergeList", finalRes);
......
...@@ -25,4 +25,31 @@ public interface IotFeign { ...@@ -25,4 +25,31 @@ public interface IotFeign {
@RequestParam(value = "deviceName") String deviceName, @RequestParam(value = "deviceName") String deviceName,
@RequestParam(required = false, value = "fieldKey") String fieldKey); @RequestParam(required = false, value = "fieldKey") String fieldKey);
@RequestMapping(value = "/v1/livedata/page", method = RequestMethod.GET, consumes = "application/json")
ResponseModel selectPage(
@RequestHeader("appKey") String appKey,
@RequestHeader("product") String product,
@RequestHeader("token") String token,
@RequestParam(value = "timeStart") String beginDate,
@RequestParam(value = "timeEnd") String endDate,
@RequestParam(value = "productKey") String productKey,
@RequestParam(value = "deviceName") String deviceName,
@RequestParam(required = false, value = "fieldKey") String fieldKey,
@RequestParam(value = "current") Integer current,
@RequestParam(value = "size") Integer size);
@RequestMapping(value = "v1/livedata/common/top", method = RequestMethod.GET, consumes = "application/json")
ResponseModel selectOne(
@RequestHeader("appKey") String appKey,
@RequestHeader("product") String product,
@RequestHeader("token") String token,
@RequestParam(value = "top") String top,
@RequestParam(value = "productKey") String productKey,
@RequestParam(value = "deviceName") String deviceName,
@RequestParam("FHS_FirePump_RunStatus") String key,
@RequestParam(required = false, value = "fieldKey") String fieldKey);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.AnalysisReportMonth; import com.yeejoin.equipmanage.common.entity.AnalysisReportMonth;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -22,4 +23,6 @@ public interface AnalysisReportMonthMapper extends BaseMapper<AnalysisReportMont ...@@ -22,4 +23,6 @@ public interface AnalysisReportMonthMapper extends BaseMapper<AnalysisReportMont
* @param systemId 系统id * @param systemId 系统id
*/ */
void insertSystemMonthData(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId); void insertSystemMonthData(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId);
void insertSystemMonthDataTest(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId, @Param("date") Date date, @Param("num") int num);
} }
...@@ -4,6 +4,7 @@ import com.yeejoin.equipmanage.common.entity.AnalysisReportSummary; ...@@ -4,6 +4,7 @@ import com.yeejoin.equipmanage.common.entity.AnalysisReportSummary;
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.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -22,4 +23,5 @@ public interface AnalysisReportSummaryMapper extends BaseMapper<AnalysisReportSu ...@@ -22,4 +23,5 @@ public interface AnalysisReportSummaryMapper extends BaseMapper<AnalysisReportSu
* @param systemId 系统id * @param systemId 系统id
*/ */
void insertSystemMonthSummaryData(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId); void insertSystemMonthSummaryData(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId);
void insertSystemMonthSummaryDataTest(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId, @Param("date") Date date, @Param("num") int num);
} }
...@@ -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);
} }
...@@ -565,6 +565,13 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -565,6 +565,13 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
@Param("startDate") String startDate, @Param("startDate") String startDate,
@Param("endDate") String endDate, @Param("endDate") String endDate,
@Param("indicator") List<String> indicator); @Param("indicator") List<String> indicator);
Integer selectWeekAlarmsEquip(@Param("systemId") String systemId,
@Param("indexType") String indexType,
@Param("equipmentCode") String equipmentCode,
@Param("startDate") String startDate,
@Param("endDate") String endDate,
@Param("typeCode") String typeCode);
Map<String, Object> selectWeekSummarize(@Param("systemId") String systemId, Map<String, Object> selectWeekSummarize(@Param("systemId") String systemId,
@Param("startDate") String startDate, @Param("startDate") String startDate,
@Param("endDate") String endDate, @Param("endDate") String endDate,
...@@ -634,7 +641,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -634,7 +641,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
String selectEquipSystemType(String code); String selectEquipSystemType(String code);
Map<String, Object> getWaterlevelUnit(); Map<String, Object> getWaterlevelUnit(@Param("equipmentSpecificId") String equipmentSpecificId, @Param("equipmentIndexKey") String equipmentIndexKey);
Map<String, Object> getStationConnectStatus(); Map<String, Object> getStationConnectStatus();
...@@ -644,10 +651,11 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -644,10 +651,11 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> selectAllDays(); List<Map<String, Object>> selectAllDays();
List<Map<String, Object>> getEquip(); List<Map<String, Object>> getEquip(String bizOrgCode, String systemCode);
List<Map<String, Object>> getFireSystemEquipStatusList(String bizOrgCode, String systemCode, String categoryCodes);
List<Map<String, Object>> selectPressureDetails(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> selectPressureDetails(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> selectEquipmentSpecificById(@Param("id") String id); Map<String, Object> selectEquipmentSpecificById(@Param("id") String id);
} }
...@@ -3,6 +3,8 @@ package com.yeejoin.equipmanage.quartz; ...@@ -3,6 +3,8 @@ package com.yeejoin.equipmanage.quartz;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum; import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import com.yeejoin.equipmanage.common.utils.DateUtils; import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.service.IAnalysisReportLogService; import com.yeejoin.equipmanage.service.IAnalysisReportLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
...@@ -20,7 +22,7 @@ public class AnalysisReportSchedulerJob { ...@@ -20,7 +22,7 @@ public class AnalysisReportSchedulerJob {
@Autowired @Autowired
private IAnalysisReportLogService iAnalysisReportLogService; private IAnalysisReportLogService iAnalysisReportLogService;
private final Logger log = LoggerFactory.getLogger(AnalysisReportSchedulerJob.class);
/** /**
* 每天凌晨0点-日报生成 * 每天凌晨0点-日报生成
*/ */
...@@ -50,6 +52,7 @@ public class AnalysisReportSchedulerJob { ...@@ -50,6 +52,7 @@ public class AnalysisReportSchedulerJob {
Date yestDay = DateUtils.dateAdd(new Date(),-1,false); Date yestDay = DateUtils.dateAdd(new Date(),-1,false);
Date beginDate = DateUtils.getFirstDayOfMonth(yestDay); Date beginDate = DateUtils.getFirstDayOfMonth(yestDay);
Date endDate = DateUtils.getLastDayOfMonth(yestDay); Date endDate = DateUtils.getLastDayOfMonth(yestDay);
log.warn("monthReport报表开始生成");
iAnalysisReportLogService.generateMonthReport(AnalysisReportEnum.MONTH_REPORT,beginDate,endDate); iAnalysisReportLogService.generateMonthReport(AnalysisReportEnum.MONTH_REPORT,beginDate,endDate);
} }
} }
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto; import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog; import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum; import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date; import java.util.Date;
...@@ -37,6 +38,9 @@ public interface IAnalysisReportLogService extends IService<AnalysisReportLog> { ...@@ -37,6 +38,9 @@ public interface IAnalysisReportLogService extends IService<AnalysisReportLog> {
*/ */
void generateMonthReport(AnalysisReportEnum monthReport, Date beginDate, Date endDate) throws ParseException; void generateMonthReport(AnalysisReportEnum monthReport, Date beginDate, Date endDate) throws ParseException;
void generateMonthReportTest(AnalysisReportEnum reportEnum, Date beginDate, Date endDate, Date now, int num) throws ParseException;
/** /**
* 消防物联报表列表分页查询 * 消防物联报表列表分页查询
* @param page * @param page
......
...@@ -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();
} }
...@@ -171,7 +171,10 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -171,7 +171,10 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
*/ */
FireFightingSystemEntity getDetailByCode(String systemCode); FireFightingSystemEntity getDetailByCode(String systemCode);
List<Map<String,Object>> getEquip(); List<Map<String,Object>> getEquip(String bizOrgCode, String systemCode);
List<Map<String, Object>> getFireSystemEquipStatusList(String bizOrgCode, String systemCode, String categoryCodes);
/** /**
* 集成页面系统数据 * 集成页面系统数据
* *
......
...@@ -86,6 +86,25 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM ...@@ -86,6 +86,25 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
}); });
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void generateMonthReportTest(AnalysisReportEnum reportEnum, Date beginDate, Date endDate,Date now,int num) throws ParseException {
// 0.保存日志
this.saveAnalysisReportLog(reportEnum, beginDate, endDate);
// 创建月分析统计报告数据
// 1、 查询消防系统表,捞出所有系统,新增字段,存放自定义用的告警指标模糊查询指标key,逗号分隔
List<FireFightingSystemEntity> fightingSystemEntityList = fireFightingSystemService.getBaseMapper().selectList(
new LambdaQueryWrapper<FireFightingSystemEntity>()
.isNotNull(FireFightingSystemEntity::getAnalysisIndexKey));
// 2、循环插入 wl_analysis_report_month、wl_analysis_report_summary
String beginDateStr = DateUtils.dateFormat(beginDate,DateUtils.DATE_PATTERN);
String endDateStr = DateUtils.dateFormat(endDate,DateUtils.DATE_PATTERN);
fightingSystemEntityList.forEach(f -> {
analysisReportMonthMapper.insertSystemMonthDataTest(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId(),now,num);
analysisReportSummaryMapper.insertSystemMonthSummaryDataTest(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId(),now,num);
});
}
private void saveAnalysisReportLog(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) { private void saveAnalysisReportLog(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) {
AnalysisReportLog reportLog = new AnalysisReportLog(); AnalysisReportLog reportLog = new AnalysisReportLog();
reportLog.setName(reportEnum.getName()); reportLog.setName(reportEnum.getName());
......
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.enums.IndexStatusEnum;
import com.yeejoin.equipmanage.common.utils.DateUtils; import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.utils.UnitTransformUtil;
import com.yeejoin.equipmanage.mapper.EmergencyMapper; import com.yeejoin.equipmanage.mapper.EmergencyMapper;
import com.yeejoin.equipmanage.service.IEmergencyService; import com.yeejoin.equipmanage.service.IEmergencyService;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
...@@ -49,19 +52,21 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -49,19 +52,21 @@ 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(); if (0 < list.size()) {
// if (0 < list.size()) { for (Map<String, Object> m : list) {
// list.forEach(x -> { Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("value")),
// Map<String, Object> map = new HashMap<>(); String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
// map.put("key", x.get("specificId")); m.put("value", transResult.get("nowValue"));
// map.put("code", x.get("code")); if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
// map.put("name", x.get("name")); m.put("statusDesc", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
// map.put("value", x.get("specificId")); } else {
// map.put("key", x.get("specificId")); m.put("statusDesc", "--");
// }); }
// } m.put("sxyl", transResult.get("abs"));
}
}
return Optional.ofNullable(list).orElse(Lists.newArrayList()); return Optional.ofNullable(list).orElse(Lists.newArrayList());
} }
...@@ -81,8 +86,23 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -81,8 +86,23 @@ 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); Page<Map<String, Object>> page1 = emergencyMapper.selectFoamTank(page);
List<Map<String, Object>> res = page1.getRecords();
if (0 < res.size()) {
for (Map<String, Object> m : res) {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
m.put("status", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
m.put("status", "--");
}
m.put("abs", transResult.get("abs"));
}
}
return page1;
} }
@Override @Override
...@@ -158,4 +178,25 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -158,4 +178,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();
}
} }
...@@ -14,6 +14,7 @@ import com.yeejoin.equipmanage.service.IEquipmentService; ...@@ -14,6 +14,7 @@ import com.yeejoin.equipmanage.service.IEquipmentService;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -30,6 +31,7 @@ public class EquipmentDefUpload implements IEquipmentDefUpload { ...@@ -30,6 +31,7 @@ public class EquipmentDefUpload implements IEquipmentDefUpload {
@Autowired @Autowired
private EquipmentMapper equipmentMapper; private EquipmentMapper equipmentMapper;
@Lazy
@Autowired @Autowired
private IEquipmentService equipmentService; private IEquipmentService equipmentService;
......
...@@ -19,6 +19,7 @@ import com.yeejoin.equipmanage.mapper.*; ...@@ -19,6 +19,7 @@ import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -59,13 +60,14 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe ...@@ -59,13 +60,14 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
@Autowired @Autowired
private IEquipmentCategoryService iEquipmentCategoryService; private IEquipmentCategoryService iEquipmentCategoryService;
@Lazy
@Autowired @Autowired
private IEquipmentService iEquipmentService; private IEquipmentService iEquipmentService;
@Autowired @Autowired
private IUnitService iUnitService; private IUnitService iUnitService;
@Lazy
@Autowired @Autowired
private IUploadFileService iUploadFileService; private IUploadFileService iUploadFileService;
@Autowired @Autowired
......
...@@ -18,6 +18,7 @@ import org.apache.commons.lang3.RandomStringUtils; ...@@ -18,6 +18,7 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -48,6 +49,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -48,6 +49,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
private IEquipmentIndexService iEquipmentIndexService; private IEquipmentIndexService iEquipmentIndexService;
@Autowired @Autowired
private IUnitService iUnitService; private IUnitService iUnitService;
@Lazy
@Autowired @Autowired
private UploadFileMapper uploadFileMapper; private UploadFileMapper uploadFileMapper;
@Autowired @Autowired
...@@ -56,6 +58,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -56,6 +58,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
private PatrolFeign patrolFeign; private PatrolFeign patrolFeign;
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
@Lazy
@Autowired @Autowired
private IEquipmentDetailService iEquipmentDetailService; private IEquipmentDetailService iEquipmentDetailService;
......
...@@ -1577,6 +1577,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1577,6 +1577,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
equipmentSpecificIndex.setIsAlarm(index.getIsAlarm()); equipmentSpecificIndex.setIsAlarm(index.getIsAlarm());
equipmentSpecificIndex.setEmergencyLevel(index.getEmergencyLevel()); equipmentSpecificIndex.setEmergencyLevel(index.getEmergencyLevel());
equipmentSpecificIndex.setEmergencyLevelDescribe(index.getEmergencyLevelDescribe()); equipmentSpecificIndex.setEmergencyLevelDescribe(index.getEmergencyLevelDescribe());
equipmentSpecificIndex.setUnit(index.getUnit());
equipmentSpecificIndices.add(equipmentSpecificIndex); equipmentSpecificIndices.add(equipmentSpecificIndex);
}); });
} }
......
...@@ -36,6 +36,7 @@ import com.yeejoin.equipmanage.fegin.JcsFeign; ...@@ -36,6 +36,7 @@ import com.yeejoin.equipmanage.fegin.JcsFeign;
import com.yeejoin.equipmanage.mapper.*; import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.remote.RemoteSecurityService; import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import liquibase.pro.packaged.S;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
...@@ -168,7 +169,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -168,7 +169,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
@Override @Override
public List<EquiplistSpecificBySystemVO> getEquiplistBySystemId(Long systemId) { public List<EquiplistSpecificBySystemVO>
getEquiplistBySystemId(Long systemId) {
return this.baseMapper.getEquiplistBySystemId(systemId); return this.baseMapper.getEquiplistBySystemId(systemId);
} }
...@@ -186,14 +188,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -186,14 +188,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
stb.append(y.getChargePerson()); stb.append(y.getChargePerson());
} }
}); });
Map<String, String> userMap = new HashMap<>(); //此userMap已被注掉 无用代码
/* Map<String, String> userMap = new HashMap<>();
if (StringUtil.isNotEmpty(stb)) { if (StringUtil.isNotEmpty(stb)) {
List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(stb.toString()); List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(stb.toString());
agencyUserModels.forEach(z -> { agencyUserModels.forEach(z -> {
userMap.put(z.getUserId(), z.getRealName()); userMap.put(z.getUserId(), z.getRealName());
}); });
} }*/
dataList.forEach(x -> { dataList.forEach(x -> {
// x.setChargePerson(userMap.get(x.getChargePerson())); // x.setChargePerson(userMap.get(x.getChargePerson()));
x.setSystemimg(equipmentManageMapper.getFiles(valueOf(x.getId()), "face")); x.setSystemimg(equipmentManageMapper.getFiles(valueOf(x.getId()), "face"));
...@@ -981,22 +983,61 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -981,22 +983,61 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
@Override @Override
public List<Map<String, Object>> getEquip() { public List<Map<String, Object>> getEquip(String bizOrgCode, String systemCode) {
List<Map<String, Object>> list = fireFightingSystemMapper.getEquip(); List<Map<String, Object>> list = fireFightingSystemMapper.getEquip(bizOrgCode, systemCode);
List<Map<String, Object>> resList = new ArrayList<>(); List<Map<String, Object>> resList = new ArrayList<>();
int i = 1; int i = 1;
if (0 < list.size()) { if (0 < list.size()) {
for (Map<String, Object> m : list) { for (Map<String, Object> m : list) {
List<Map<String, Object>> list1 = new ArrayList();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Map<String, Object> statusMap = new HashMap<>();
map.put("key", i); map.put("key", i);
map.put("name", m.get("equipmentName")); map.put("name", m.get("name"));
map.put("equipmentCode", m.get("equipmentCode"));
map.put("code", m.get("code")); map.put("code", m.get("code"));
map.put("value", m.get("flag")); map.put("systemTypeCode", systemCode);
map.put("unit", ""); map.put("img", m.get("shbzImg"));
statusMap.put("name", m.get("status"));
if ("正常".equals(String.valueOf(m.get("status")))) {
statusMap.put("level", "success");
} else {
statusMap.put("level", "warning");
}
list1.add(statusMap);
map.put("status", list1);
resList.add(map); resList.add(map);
i++; i++;
};
}
return resList;
}
@Override
public List<Map<String, Object>> getFireSystemEquipStatusList(String bizOrgCode, String systemCode, String categoryCodes) {
List<Map<String, Object>> list = fireFightingSystemMapper.getFireSystemEquipStatusList(bizOrgCode, systemCode, categoryCodes);
List<Map<String, Object>> resList = new ArrayList<>();
int i = 1;
if (0 < list.size()) {
for (Map<String, Object> m : list) {
List<Map<String, Object>> list1 = new ArrayList();
Map<String, Object> map = new HashMap<>();
Map<String, Object> statusMap = new HashMap<>();
map.put("key", i);
map.put("name", m.get("name"));
map.put("code", m.get("code"));
map.put("systemTypeCode", systemCode);
map.put("img", m.get("shbzImg"));
statusMap.put("name", m.get("status"));
if ("正常".equals(String.valueOf(m.get("status")))) {
statusMap.put("level", "success");
} else {
statusMap.put("level", "warning");
} }
list1.add(statusMap);
map.put("status", list1);
resList.add(map);
i++;
};
} }
return resList; return resList;
} }
...@@ -1562,7 +1603,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1562,7 +1603,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// 设备故障总数 // 设备故障总数
alarmMap.put("fault_equip_num", ObjectUtils.isEmpty(alarm.get("fault_equip_num")) ? "" : String.valueOf(alarm.get("fault_equip_num"))); alarmMap.put("fault_equip_num", ObjectUtils.isEmpty(alarm.get("fault_equip_num")) ? "" : String.valueOf(alarm.get("fault_equip_num")));
// 故障信息条数 // 故障信息条数
alarmMap.put("alarm_info_num", ObjectUtils.isEmpty(alarm.get("alarm_info_num")) ? "" : String.valueOf(alarm.get("alarm_info_num"))); alarmMap.put("alarm_info_num", ObjectUtils.isEmpty(alarm.get("fault_info_num")) ? "" : String.valueOf(alarm.get("fault_info_num")));
// 设备故障率 // 设备故障率
alarmMap.put("faultEquipPercent", ObjectUtils.isEmpty(alarm.get("faultEquipPercent")) ? "" : String.valueOf(alarm.get("faultEquipPercent"))); alarmMap.put("faultEquipPercent", ObjectUtils.isEmpty(alarm.get("faultEquipPercent")) ? "" : String.valueOf(alarm.get("faultEquipPercent")));
// 报警设备总数 // 报警设备总数
...@@ -1610,7 +1651,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1610,7 +1651,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
String pieChart = ChartsUtils.pieChart(pieChartList, "故障设备类型占比"); String pieChart = ChartsUtils.pieChart(pieChartList, "故障设备类型占比");
systemData.put("bing1", pieChart); systemData.put("bing1", pieChart);
if (!CollectionUtils.isEmpty(pieChartListTwo)) { if (!CollectionUtils.isEmpty(pieChartListTwo)) {
String pieChart1 = ChartsUtils.pieChart(pieChartListTwo, "告警信息占比"); String pieChart1 = ChartsUtils.pieChart(pieChartListTwo, "告警设备占比");
systemData.put("bing2", pieChart1); systemData.put("bing2", pieChart1);
} else { } else {
List<Map<String, Object>> data = new ArrayList<>(); List<Map<String, Object>> data = new ArrayList<>();
...@@ -1765,7 +1806,13 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1765,7 +1806,13 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// 正常标准 // 正常标准
listItem.put("normal", ObjectUtils.isEmpty(weekItem.get("normal")) ? "" : String.valueOf(weekItem.get("normal"))); listItem.put("normal", ObjectUtils.isEmpty(weekItem.get("normal")) ? "" : String.valueOf(weekItem.get("normal")));
// 7日告警设备数 // 7日告警设备数
listItem.put("alarmEquipNum", ObjectUtils.isEmpty(weekItem.get("alarmEquipNum")) ? "" : String.valueOf(weekItem.get("alarmEquipNum"))); if (!ObjectUtils.isEmpty(weekItem.get("type_code")) && !ObjectUtils.isEmpty(weekItem.get("code"))) {
Integer integer = fireFightingSystemMapper.selectWeekAlarmsEquip(valueOf(system.get("id")), valueOf(weekItem.get("type_code")), valueOf(weekItem.get("code")), startDate, endDate, String.valueOf(weekItem.get("type_code")));
listItem.put("alarmEquipNum", String.valueOf(integer));
} else {
listItem.put("alarmEquipNum", String.valueOf(0));
}
// listItem.put("alarmEquipNum", ObjectUtils.isEmpty(weekItem.get("alarmEquipNum")) ? "" : String.valueOf(weekItem.get("alarmEquipNum")));
// 7日告警条数 // 7日告警条数
if (!ObjectUtils.isEmpty(weekItem.get("type_code")) && !ObjectUtils.isEmpty(weekItem.get("code"))) { if (!ObjectUtils.isEmpty(weekItem.get("type_code")) && !ObjectUtils.isEmpty(weekItem.get("code"))) {
Integer integer = fireFightingSystemMapper.selectAlarms(valueOf(system.get("id")), valueOf(weekItem.get("type_code")), valueOf(weekItem.get("code")), startDate, endDate, indicatorList); Integer integer = fireFightingSystemMapper.selectAlarms(valueOf(system.get("id")), valueOf(weekItem.get("type_code")), valueOf(weekItem.get("code")), startDate, endDate, indicatorList);
...@@ -1774,8 +1821,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1774,8 +1821,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
listItem.put("trueNum", String.valueOf(0)); listItem.put("trueNum", String.valueOf(0));
} }
list.add(listItem); list.add(listItem);
} }
} else { } else {
HashMap<String, Object> listItem = new HashMap<>(); HashMap<String, Object> listItem = new HashMap<>();
...@@ -1829,11 +1874,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1829,11 +1874,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
dayEchartsDate1.put("value",0); dayEchartsDate1.put("value",0);
} }
mapList.add(dayEchartsDate1); mapList.add(dayEchartsDate1);
String pieChart1 = ChartsUtils.pieChart(mapList, "故障设备类型占比"); String pieChart1 = ChartsUtils.pieChart(mapList, "告警设备占比");
systemData.put("pictureLeft", pieChart1); systemData.put("pictureLeft", pieChart1);
List<Map<String, Object>> weekEchart = fireFightingSystemMapper.selectWeekEchart(valueOf(system.get("code")), startDate, endDate); List<Map<String, Object>> weekEchart = fireFightingSystemMapper.selectWeekEchart(valueOf(system.get("code")), startDate, endDate);
String pieChart2 = ChartsUtils.pieChart(weekEchart, "告警信息占比"); String pieChart2 = ChartsUtils.pieChart(weekEchart, "故障设备类型占比");
systemData.put("pictureCenter", pieChart2); systemData.put("pictureCenter", pieChart2);
List<Map<String, Object>> linesEchart = fireFightingSystemMapper.selectWeekLinesEchart(valueOf(system.get("code")), startDate, endDate, indicatorList); List<Map<String, Object>> linesEchart = fireFightingSystemMapper.selectWeekLinesEchart(valueOf(system.get("code")), startDate, endDate, indicatorList);
...@@ -1941,7 +1986,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1941,7 +1986,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List<Map<String, Object>> weekReportList = fireFightingSystemMapper.selectWeekReportList(String.valueOf(system.get("id")), startDate, endDate); List<Map<String, Object>> weekReportList = fireFightingSystemMapper.selectWeekReportList(String.valueOf(system.get("id")), startDate, endDate);
ArrayList<Map<String, Object>> list = new ArrayList<>(); ArrayList<Map<String, Object>> list = new ArrayList<>();
ArrayList<Map<String, Object>> alarmMapList = new ArrayList<>(); ArrayList<Map<String, Object>> alarmMapList = new ArrayList<>();
Map<String, Object> binMap = new HashMap<>();
if (!CollectionUtils.isEmpty(weekReportList)) { if (!CollectionUtils.isEmpty(weekReportList)) {
for (Map<String, Object> weekItem : weekReportList) { for (Map<String, Object> weekItem : weekReportList) {
HashMap<String, Object> listItem = new HashMap<>(); HashMap<String, Object> listItem = new HashMap<>();
...@@ -1968,12 +2013,26 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1968,12 +2013,26 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} else { } else {
listItem.put("trueNum", String.valueOf(0)); listItem.put("trueNum", String.valueOf(0));
} }
Map<String, Object> alarmMap = new HashMap<>(); if (!ObjectUtils.isEmpty(weekItem.get("type_code")) && String.valueOf(weekItem.get("type_code")).endsWith("Fault")){
alarmMap.put("type",listItem.get("name")); if (!ObjectUtils.isEmpty(binMap) && !ObjectUtils.isEmpty(listItem.get("name")) && binMap.containsKey(String.valueOf(listItem.get("name")))){
alarmMap.put("value",listItem.get("alarmEquipNum")); int newValue = Integer.parseInt(String.valueOf(listItem.get("alarmEquipNum")));
alarmMapList.add(alarmMap); int oldValue = Integer.parseInt(String.valueOf(binMap.get(String.valueOf(listItem.get("name")))));
binMap.put(String.valueOf(listItem.get("name")),newValue + oldValue);
}else {
binMap.put(String.valueOf(listItem.get("name")),listItem.get("alarmEquipNum"));
}
}
list.add(listItem); list.add(listItem);
} }
ArrayList<String> strings = new ArrayList<>(binMap.keySet());
for (String string : strings) {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("type", string);
hashMap.put("value", binMap.get(string));
alarmMapList.add(hashMap);
}
} else { } else {
HashMap<String, Object> listItem = new HashMap<>(); HashMap<String, Object> listItem = new HashMap<>();
listItem.put("name", ""); listItem.put("name", "");
...@@ -2000,7 +2059,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2000,7 +2059,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
"条,正常设备"+(ObjectUtils.isEmpty(summarize.get("normalNum"))?0:summarize.get("normalNum"))+"台,正常率"+(ObjectUtils.isEmpty(summarize.get("normalRate"))?0:summarize.get("normalRate"))+"%"); "条,正常设备"+(ObjectUtils.isEmpty(summarize.get("normalNum"))?0:summarize.get("normalNum"))+"台,正常率"+(ObjectUtils.isEmpty(summarize.get("normalRate"))?0:summarize.get("normalRate"))+"%");
// echarts 图表 // echarts 图表
// List<Map<String, Object>> mapList = fireFightingSystemMapper.selectDayEquipEchart(valueOf(system.get("code")), startDate, endDate); List<Map<String, Object>> mapList = fireFightingSystemMapper.selectDayEquipEchart(valueOf(system.get("code")), startDate, endDate);
String pieChart1 = ChartsUtils.pieChart(alarmMapList, "故障设备类型占比"); String pieChart1 = ChartsUtils.pieChart(alarmMapList, "故障设备类型占比");
// List<Map<String, Object>> dayEcharts = fireFightingSystemMapper.selectDayEchart(valueOf(system.get("id")), startDate, indicatorList); // List<Map<String, Object>> dayEcharts = fireFightingSystemMapper.selectDayEchart(valueOf(system.get("id")), startDate, indicatorList);
...@@ -2146,6 +2205,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2146,6 +2205,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override @Override
public List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate) { public List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate) {
if (!StringUtil.isNotEmpty(startDate)) {
startDate = null;
}
if (!StringUtil.isNotEmpty(endDate)) {
endDate = null;
}
return fireFightingSystemMapper.getSystemAlarmInfoList(startDate, endDate); return fireFightingSystemMapper.getSystemAlarmInfoList(startDate, endDate);
} }
......
...@@ -16,6 +16,7 @@ import java.util.stream.Collectors; ...@@ -16,6 +16,7 @@ import java.util.stream.Collectors;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -76,8 +77,10 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe ...@@ -76,8 +77,10 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
private RemoteSecurityService securityService; private RemoteSecurityService securityService;
@Autowired @Autowired
private IEquipmentCategoryService iEquipmentCategoryService; private IEquipmentCategoryService iEquipmentCategoryService;
@Lazy
@Autowired @Autowired
private IEquipmentService iEquipmentService; private IEquipmentService iEquipmentService;
@Lazy
@Autowired @Autowired
private IEquipmentDetailService iEquipmentDetailService; private IEquipmentDetailService iEquipmentDetailService;
@Autowired @Autowired
......
...@@ -17,6 +17,7 @@ import com.yeejoin.equipmanage.service.IEquipmentService; ...@@ -17,6 +17,7 @@ import com.yeejoin.equipmanage.service.IEquipmentService;
import com.yeejoin.equipmanage.service.IStockDetailService; import com.yeejoin.equipmanage.service.IStockDetailService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
...@@ -29,10 +30,10 @@ import java.util.*; ...@@ -29,10 +30,10 @@ import java.util.*;
*/ */
@Service @Service
public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, StockDetail> implements IStockDetailService { public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, StockDetail> implements IStockDetailService {
@Lazy
@Autowired @Autowired
private IEquipmentDetailService iEquipmentDetailService; private IEquipmentDetailService iEquipmentDetailService;
@Lazy
@Autowired @Autowired
private IEquipmentService iEquipmentService; private IEquipmentService iEquipmentService;
......
...@@ -4,7 +4,6 @@ import java.io.InputStream; ...@@ -4,7 +4,6 @@ import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -13,14 +12,11 @@ import javax.servlet.http.HttpServletResponse; ...@@ -13,14 +12,11 @@ import javax.servlet.http.HttpServletResponse;
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.spire.ms.System.Collections.Specialized.CollectionsUtil;
import com.yeejoin.amos.boot.module.common.api.dto.*; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint; import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper; import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.*;
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 io.github.classgraph.json.JSONUtils;
import io.micrometer.core.instrument.util.JsonUtils;
import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.beanutils.ConvertUtils;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
...@@ -34,6 +30,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -34,6 +30,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -73,12 +71,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; ...@@ -73,12 +71,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.entity.RescueEquipment; import com.yeejoin.amos.boot.module.common.api.entity.RescueEquipment;
import com.yeejoin.amos.boot.module.common.api.entity.SpecialPositionStaff; import com.yeejoin.amos.boot.module.common.api.entity.SpecialPositionStaff;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil; import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFireFightingService;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFirstAidService;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
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.biz.service.impl.DutyCarServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyCarServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyPersonServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyPersonServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyPersonShiftServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyPersonShiftServiceImpl;
...@@ -193,6 +185,9 @@ public class ExcelServiceImpl { ...@@ -193,6 +185,9 @@ public class ExcelServiceImpl {
@Autowired @Autowired
private OrgUsrMapper orgUsrMapper; private OrgUsrMapper orgUsrMapper;
@Autowired
private IDataSyncService dataSyncService;
@Value("${logic}") @Value("${logic}")
Boolean logic; Boolean logic;
...@@ -940,6 +935,14 @@ public class ExcelServiceImpl { ...@@ -940,6 +935,14 @@ public class ExcelServiceImpl {
// 保存其余项 // 保存其余项
orgUsrExcelDto.setOrgUsrId(orgUsrDto.getSequenceNbr().toString()); orgUsrExcelDto.setOrgUsrId(orgUsrDto.getSequenceNbr().toString());
savePeopleItem(orgUsrExcelDto); savePeopleItem(orgUsrExcelDto);
// 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
dataSyncService.OrgUsrSyncDtoDataSync(orgUsrDto.getSequenceNbr());
}
});
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -84,15 +84,9 @@ public class DocLibraryResource { ...@@ -84,15 +84,9 @@ public class DocLibraryResource {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "知识库卡片信息") @ApiOperation(value = "知识库卡片信息")
@RequestMapping(value = "/card", method = RequestMethod.GET) @RequestMapping(value = "/card", method = RequestMethod.GET)
public ResponseModel<Object> queryDocCard(HttpServletRequest request, public ResponseModel<Object> queryDocCard( @RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "offset") Integer offset, @RequestParam(value = "ids", required = false) List<Long> ids) {
@RequestParam(value = "end") Integer end, return ResponseHelper.buildResponse(docLibraryService.queryCardList(id , ids));
@RequestParam(value = "filterByCollection") String filterByCollection,
@RequestParam(value = "directoryId", required = false) Long directoryId,
@RequestParam(value = "docTitle", required = false) String docTitle,
@RequestParam(value = "createTimeLeft", required = false) String createTimeLeft,
@RequestParam(value = "createTimeRight", required = false) String createTimeRight) {
return ResponseHelper.buildResponse(docLibraryService.queryCardList());
} }
/** /**
......
...@@ -29,7 +29,7 @@ public interface DocContentMapper extends BaseMapper<KnowledgeDocContent> { ...@@ -29,7 +29,7 @@ public interface DocContentMapper extends BaseMapper<KnowledgeDocContent> {
List<Map<String,Object>> queryDocBaseInfoList(Map<String, Object> paramMap); List<Map<String,Object>> queryDocBaseInfoList(Map<String, Object> paramMap);
List<Map<String,Object>> queryDocCardList(); List<Map<String,Object>> queryDocCardList(@Param("id")Long id, @Param("ids") List<Long> ids);
List<Map<String,Object>> queryCardCount(); List<Map<String,Object>> queryCardCount();
......
...@@ -181,12 +181,20 @@ public class DocLibraryService { ...@@ -181,12 +181,20 @@ public class DocLibraryService {
return page; return page;
} }
public Map<String,Object> queryCardList(){ public Map<String,Object> queryCardList(Long id, List<Long> ids){
List<Map<String, Object>> content = docContentService.getBaseMapper().queryDocCardList(); List<Map<String, Object>> content = docContentService.getBaseMapper().queryDocCardList(id, ids);
List<Map<String, Object>> countMap = docContentService.getBaseMapper().queryCardCount(); List<Map<String, Object>> countMap = docContentService.getBaseMapper().queryCardCount();
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>(2);
resultMap.put("content",content); resultMap.put("content",content);
countMap.forEach(e->resultMap.put(e.get("directoryName").toString(),e.get("num"))); List<Map<String, Object>> list = new ArrayList<>();
countMap.forEach(e-> {
Map<String, Object> map = new HashMap<>(2);
map.put("value",e.get("num"));
map.put("name",e.get("categoryName"));
map.put("id",e.get("id"));
list.add(map);
});
resultMap.put("count", list);
return resultMap; return resultMap;
} }
......
...@@ -9,10 +9,12 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -9,10 +9,12 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient; import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient;
import com.yeejoin.amos.maintenance.exception.PermissionException; import com.yeejoin.amos.maintenance.exception.PermissionException;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -36,6 +38,8 @@ public class PersonIdentifyAspect { ...@@ -36,6 +38,8 @@ public class PersonIdentifyAspect {
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired @Autowired
JCSFeignClient jcsFeignClient; JCSFeignClient jcsFeignClient;
@Value("${logic}")
Boolean logic;
@Before(value = "@annotation(com.yeejoin.amos.maintenance.core.framework.PersonIdentify) && @annotation(permission)") @Before(value = "@annotation(com.yeejoin.amos.maintenance.core.framework.PersonIdentify) && @annotation(permission)")
...@@ -49,6 +53,12 @@ public class PersonIdentifyAspect { ...@@ -49,6 +53,12 @@ public class PersonIdentifyAspect {
throw new RuntimeException(responseModel.getDevMessage()); throw new RuntimeException(responseModel.getDevMessage());
} }
ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class); ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
//电力默认走公司权限
if (!logic){
personIdentity.setBizOrgCode(StringUtils.isEmpty(personIdentity.getCompanyBizOrgCode()) ? "-1" : personIdentity.getCompanyBizOrgCode());
}
reginParam.setPersonIdentity(personIdentity); reginParam.setPersonIdentity(personIdentity);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam)); redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
} }
......
...@@ -555,9 +555,6 @@ public class InputItemController extends AbstractBaseController { ...@@ -555,9 +555,6 @@ public class InputItemController extends AbstractBaseController {
if(param.getId()>0){ if(param.getId()>0){
if (param.getEquipmentType()==null && param.getCustomType()==null &&param.getFacilitiesType() == null&&param.getKeyPartsType() == null){
throw new BadRequest("适用类型至少需选择一项");
}
}else{ }else{
if ("1".equals(param.getEquipmentType()) && "1".equals(param.getCustomType()) &&param.getFacilitiesType() == null&&param.getKeyPartsType() == null){ if ("1".equals(param.getEquipmentType()) && "1".equals(param.getCustomType()) &&param.getFacilitiesType() == null&&param.getKeyPartsType() == null){
throw new BadRequest("适用类型至少需选择一项"); throw new BadRequest("适用类型至少需选择一项");
......
...@@ -15,6 +15,7 @@ import org.aspectj.lang.annotation.Aspect; ...@@ -15,6 +15,7 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -39,6 +40,8 @@ public class PersonIdentifyAspect { ...@@ -39,6 +40,8 @@ public class PersonIdentifyAspect {
@Autowired @Autowired
private JcsFeignClient jcsFeignClient; private JcsFeignClient jcsFeignClient;
@Value("${logic}")
Boolean logic;
@Pointcut("execution(public * com.yeejoin.amos.*.business.controller..*(..))") @Pointcut("execution(public * com.yeejoin.amos.*.business.controller..*(..))")
public void userDate() { public void userDate() {
...@@ -69,6 +72,11 @@ public class PersonIdentifyAspect { ...@@ -69,6 +72,11 @@ public class PersonIdentifyAspect {
String s = JSONObject.toJSONString(responseModel.getResult()); String s = JSONObject.toJSONString(responseModel.getResult());
ReginParams.PersonIdentity personIdentity = JSONObject.parseObject(s, ReginParams.PersonIdentity.class); ReginParams.PersonIdentity personIdentity = JSONObject.parseObject(s, ReginParams.PersonIdentity.class);
// ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class); // ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
//电力默认走公司权限
if (!logic){
personIdentity.setBizOrgCode(StringUtils.isEmpty(personIdentity.getCompanyBizOrgCode()) ? "-1" : personIdentity.getCompanyBizOrgCode());
}
reginParam.setPersonIdentity(personIdentity); reginParam.setPersonIdentity(personIdentity);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam)); redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
......
package com.yeejoin.amos.patrol.quartz; package com.yeejoin.amos.patrol.quartz;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel; import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo; import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo;
import com.yeejoin.amos.patrol.business.bo.PlanTaskSyncBo;
import com.yeejoin.amos.patrol.business.constants.XJConstant; import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.CheckInputMapper; import com.yeejoin.amos.patrol.business.dao.mapper.CheckInputMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.MsgMapper; import com.yeejoin.amos.patrol.business.dao.mapper.MsgMapper;
...@@ -26,6 +28,7 @@ import com.yeejoin.amos.patrol.mqtt.WebMqttComponent; ...@@ -26,6 +28,7 @@ import com.yeejoin.amos.patrol.mqtt.WebMqttComponent;
import org.quartz.Job; import org.quartz.Job;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -530,6 +533,11 @@ public class JobService implements IJobService { ...@@ -530,6 +533,11 @@ public class JobService implements IJobService {
if (PlanTaskFinishStatusEnum.NOTSTARTED.getValue() == planTask.getFinishStatus()) { if (PlanTaskFinishStatusEnum.NOTSTARTED.getValue() == planTask.getFinishStatus()) {
planTask.setFinishStatus(PlanTaskFinishStatusEnum.UNDERWAY.getValue()); planTask.setFinishStatus(PlanTaskFinishStatusEnum.UNDERWAY.getValue());
iPlanTaskDao.save(planTask); iPlanTaskDao.save(planTask);
if (planTask != null) {
PlanTaskSyncBo planTaskSyncBo = buildPlanTaskBo(planTask);
String message = buildSyncMessage(PatrolDataSyncTopicEnum.PLAN_TASK.getTopic(), planTaskSyncBo);
webMqttComponent.publish(PatrolDataSyncTopicEnum.EQM_PATROL_CREATED.getTopic(), message);
}
} }
} else if (XJConstant.STATUS_MONITOR_END.equals(jobType)) { } else if (XJConstant.STATUS_MONITOR_END.equals(jobType)) {
if (PlanTaskFinishStatusEnum.UNDERWAY.getValue() == planTask.getFinishStatus()) { if (PlanTaskFinishStatusEnum.UNDERWAY.getValue() == planTask.getFinishStatus()) {
...@@ -543,6 +551,19 @@ public class JobService implements IJobService { ...@@ -543,6 +551,19 @@ public class JobService implements IJobService {
removeJob(jobName); removeJob(jobName);
} }
public PlanTaskSyncBo buildPlanTaskBo(PlanTask planTask) {
PlanTaskSyncBo taskSyncBo = new PlanTaskSyncBo();
BeanUtils.copyProperties(planTask, taskSyncBo);
return taskSyncBo;
}
public String buildSyncMessage(String topic, Object object) {
Map<String, Object> map = new HashMap<>();
map.put("topic", topic);
map.put("data", object);
return JSON.toJSONString(map, SerializerFeature.WriteMapNullValue);
}
@Override @Override
public void msgAddJob(Msg msg) { public void msgAddJob(Msg msg) {
addJob("msg", XJConstant.MESSAGE_PUSH, msg.getId(), msg.getFixedTime()); addJob("msg", XJConstant.MESSAGE_PUSH, msg.getId(), msg.getFixedTime());
......
...@@ -9,17 +9,18 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -9,17 +9,18 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.supervision.business.feign.JCSFeignClient; import com.yeejoin.amos.supervision.business.feign.JCSFeignClient;
import com.yeejoin.amos.supervision.exception.PermissionException; import com.yeejoin.amos.supervision.exception.PermissionException;
import org.apache.commons.lang.StringUtils;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -36,6 +37,8 @@ public class PersonIdentifyAspect { ...@@ -36,6 +37,8 @@ public class PersonIdentifyAspect {
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired @Autowired
JCSFeignClient jcsFeignClient; JCSFeignClient jcsFeignClient;
@Value("${logic}")
Boolean logic;
@Before(value = "@annotation(com.yeejoin.amos.supervision.core.framework.PersonIdentify) && @annotation(permission)") @Before(value = "@annotation(com.yeejoin.amos.supervision.core.framework.PersonIdentify) && @annotation(permission)")
public void personIdentity(JoinPoint joinPoint, PersonIdentify permission) throws PermissionException { public void personIdentity(JoinPoint joinPoint, PersonIdentify permission) throws PermissionException {
...@@ -61,6 +64,10 @@ public class PersonIdentifyAspect { ...@@ -61,6 +64,10 @@ public class PersonIdentifyAspect {
personIdentity.setCompanyId((String) other.get("sequenceNbr")); personIdentity.setCompanyId((String) other.get("sequenceNbr"));
personIdentity.setCompanyName((String) other.get("bizOrgName")); personIdentity.setCompanyName((String) other.get("bizOrgName"));
} }
//电力默认走公司权限
if (!logic){
personIdentity.setBizOrgCode(StringUtils.isEmpty(personIdentity.getCompanyBizOrgCode()) ? "-1" : personIdentity.getCompanyBizOrgCode());
}
// ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) result.get(0), ReginParams.PersonIdentity.class); // ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) result.get(0), ReginParams.PersonIdentity.class);
reginParam.setPersonIdentity(personIdentity); reginParam.setPersonIdentity(personIdentity);
......
...@@ -115,7 +115,7 @@ equipment.scrap.day=30 ...@@ -115,7 +115,7 @@ equipment.scrap.day=30
equipment.scrap.cron=0 0 9 * * ? equipment.scrap.cron=0 0 9 * * ?
# 稳压泵启动信号 # 稳压泵启动信号
equipment.pressurepump.start=FHS_PressurePump_Start equipment.pressurepump.start=FHS_FirePump_RunStatus
# 稳压泵停止信号 # 稳压泵停止信号
equipment.pressurepump.stop=FHS_PressurePump_Stop equipment.pressurepump.stop=FHS_PressurePump_Stop
......
...@@ -127,3 +127,6 @@ management.endpoint.health.show-details=always ...@@ -127,3 +127,6 @@ management.endpoint.health.show-details=always
spring.security.user.name=admin spring.security.user.name=admin
spring.security.user.password=a1234560 spring.security.user.password=a1234560
stationCode=LSHLZ1bZAJU645Pgl7 stationCode=LSHLZ1bZAJU645Pgl7
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
\ No newline at end of file
...@@ -3062,4 +3062,18 @@ ...@@ -3062,4 +3062,18 @@
REPLACE INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000323, 'longitude', '经度', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2022-03-01 12:04:47'); REPLACE INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000323, 'longitude', '经度', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2022-03-01 12:04:47');
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="ls" id="20230201-1" runAlways="true">
<preConditions onFail="MARK_RAN">
<tableExists tableName="idx_width_report"/>
</preConditions>
<dropTable tableName="idx_width_report"/>
</changeSet>
<changeSet author="ls" id="20230201-2" runAlways="true">
<preConditions onFail="MARK_RAN">
<tableExists tableName="idx_width_defect"/>
</preConditions>
<dropTable tableName="idx_width_defect"/>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -613,4 +613,132 @@ ...@@ -613,4 +613,132 @@
</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>
<changeSet author="gaojianqiang" id="20230113-02">
<preConditions onFail="MARK_RAN">
<columnExists tableName="wl_equipment" columnName="shbz_img"/>
</preConditions>
<comment>初始化四横八纵shbz_img图片属性字段</comment>
<sql>
-- ----------------------------
-- Table structure for equipment_icon
-- ----------------------------
DROP TABLE IF EXISTS `equipment_icon`;
CREATE TABLE `equipment_icon` (
`id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`sys_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`type_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`type_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`sort` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of equipment_icon
-- ----------------------------
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361070315945986', '排油注氮系统', 'ONL-交流电源', '921002000JK44', 'upload/state/dcfc/viewicon/jiaoLiuDianYuan.png', 1);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1578945741864742914', '排油注氮系统', '消防水箱', '93060600HQK44', 'upload/state/dcfc/viewicon/fireShuiXiang.png', 2);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1417377349053444098', '排油注氮系统', 'ONL-智能终端', '92101800NKO44', 'upload/state/dcfc/viewicon/zhunDuan.png', 3);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361071851061250', '排油注氮系统', 'ONL-排油注氮装置', '92100500RIP44', 'upload/state/dcfc/viewicon/paiyouzhudanzhuangzhi.png', 4);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361070907342850', '排油注氮系统', 'ONL-直流电源', '92100300MNL44', 'upload/state/dcfc/viewicon/zhiLiuDianYuan.png', 5);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361071419047937', '排油注氮系统', 'ONL-排油阀', '92100400VWE44', 'upload/state/dcfc/viewicon/benTiPaiYouFa.png', 6);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1404693507742093314', '排油注氮系统', 'ONL-采集模块', '92101400P3N44', 'upload/state/dcfc/viewicon/caiJiMuKuai.png', 7);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361063550533634', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-交换机', '92031300WFJ44', 'upload/state/dcfc/viewicon/jiaoHuanji.png', 8);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361062007029761', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-设备间', '92031000EXB44', 'upload/state/dcfc/viewicon/sheBeiJian.png', 9);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361061012979713', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-控制柜', '92030800K2R44', 'upload/state/dcfc/viewicon/kongZhiGui.png', 10);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361057749811202', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-炮阀', '92030200DOD44', 'upload/state/dcfc/viewicon/paofa.png', 11);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361058894856194', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-卷帘门', '92030400FTV44', 'upload/state/dcfc/viewicon/juanLianMen.png', 12);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361059477864450', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-产生装置', '92030500MG644', 'upload/state/dcfc/viewicon/chanshengzhuangzhi.png', 13);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361064620081153', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-电源', '92031500Z9E44', 'upload/state/dcfc/viewicon/power.png', 14);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361065161146370', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-AD通道', '92031600TQ244', 'upload/state/dcfc/viewicon/tongDao.png', 15);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361061486936066', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-电源柜', '92030900KYD44', 'upload/state/dcfc/viewicon/pwoerGui.png', 16);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361058299265025', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-切换阀', '92030300DI444', 'upload/state/dcfc/viewicon/qieHuanFa.png', 17);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361059951820801', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-泡沫泵', '92030600QO344', 'upload/state/dcfc/viewicon/paoMoPump.png', 18);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361060509663233', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-空压机', '92030700SFT44', 'upload/state/dcfc/viewicon/kongYaMachine.png', 19);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361062543900673', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-控制按钮', '92031100HQL44', 'upload/state/dcfc/viewicon/kongZhiButton.png', 20);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361065656074242', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-断路器', '92031700EGW44', 'upload/state/dcfc/viewicon/duanLuQi.png', 21);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1417377350970241025', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-直流系统', '92032400MWX44', 'upload/state/dcfc/viewicon/zhiliuSystem.png', 22);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662055093518337', '消防给水及消火栓系统', 'FHS-稳压泵', '92010800KAL44', 'upload/state/dcfc/viewicon/wenYaBeng.png', 23);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866678450778114', '消防给水及消火栓系统', 'FHS-液位探测器', '92011100BIK44', 'upload/state/dcfc/viewicon/yeWeiDetecor.png', 24);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418444533010169858', '消防给水及消火栓系统', '消火栓', '31050000ZLF44', 'upload/state/dcfc/viewicon/fireMachine.png', 25);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418466180761026562', '压缩空气泡沫灭火系统(CAFS)', '压缩空气泡沫灭火系统', '92030000WEW44', 'upload/state/dcfc/viewicon/yasuokongqi.png', 26);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418505479128817666', '消防给水及消火栓系统', '消防供水设施', '92010000S0F44', 'upload/state/dcfc/viewicon/gongshuiSheShi.png', 27);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1527227300964233217', '消防给水及消火栓系统', '消火栓', '93060400CQX44', 'upload/state/dcfc/viewicon/fireMachine.png', 28);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361063101743105', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-插件', '92031200DMT44', 'upload/state/dcfc/viewicon/chaJian.png', 29);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361057196163073', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-主机', '92030100TGX44', 'upload/state/dcfc/viewicon/zhuji.png', 30);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866678975066113', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-CAFS消防炮', '92032200BUX44', 'upload/state/dcfc/viewicon/CAFSGun.png', 31);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361064016101378', '压缩空气泡沫灭火系统(CAFS)', 'CAFS-光纤', '92031400GMT44', 'upload/state/dcfc/viewicon/guangxian.png', 32);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866673925124097', '火灾自动报警系统', 'FAS-感温式火灾探测器', '92041200KNU44', 'upload/state/dcfc/viewicon/ganYanTanCeQi.png', 33);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361054348230658', '火灾自动报警系统', 'FAS-感温电缆', '92040700PEM44', 'upload/state/dcfc/viewicon/ganWenDianLan.png', 34);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1417377347702878209', '火灾自动报警系统', 'FAS-复位电源', '92042300YBA44', 'upload/state/dcfc/viewicon/fuWeiPower.png', 35);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418462802521784321', '火灾自动报警系统', '火灾自动报警系统', '92040000KPO44', 'upload/state/dcfc/viewicon/fireAutoAlarm.png', 36);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418464225015791617', '自动喷水灭火系统', '消防专用电话', '92120000GYI44', 'upload/state/dcfc/viewicon/fireMobile.png', 37);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418465438318886913', '自动喷水灭火系统', '雨淋阀', '92110900V9B44', 'upload/state/dcfc/viewicon/yuLinFa.png', 38);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1417377345773498370', '火灾自动报警系统', 'FAS-强切设备', '92042200EKM44', 'upload/state/dcfc/viewicon/qiangQieShebei.png', 39);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418466508642353153', '自动喷水灭火系统', '自动喷水灭火系统', '92130000YCG44', 'upload/state/dcfc/viewicon/autoPenShui.png', 40);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361056457965569', '火灾自动报警系统', 'FAS-声光报警器', '92041000LCW44', 'upload/state/dcfc/viewicon/shengGuangBaoJingQi.png', 41);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418822147562434562', '自动喷水灭火系统', '消防水池', '92010000XBB44', 'upload/state/dcfc/viewicon/xiaoFangShuiChi.png', 42);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361052318187522', '火灾自动报警系统', 'FAS-手动报警器', '920404002PU44', 'upload/state/dcfc/viewicon/shouDongBaoJingQi.png', 43);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361051122810882', '火灾自动报警系统', 'FAS-烟雾报警器', '920402009EM44', 'upload/state/dcfc/viewicon/ganYanTanCeQi.png', 44);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866678102650882', '自动喷水灭火系统', 'FHS-压力开关', '92010900K8G44', 'upload/state/dcfc/viewicon/yaLiKaiGuan.png', 45);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361049260539906', '自动喷水灭火系统', 'FHS-消防泵', '920106007GV44', 'upload/state/dcfc/viewicon/firePump.png', 46);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1417377352845094913', '火灾自动报警系统', 'FAS-切电设备', '92042400X2V44', 'upload/state/dcfc/viewicon/cutPower.png', 47);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866680124305409', '火灾自动报警系统', 'AIRCS-空调', '92200100VAC44', 'upload/state/dcfc/viewicon/airCondition.png', 48);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1404693508211855361', '火灾自动报警系统', 'FAS-感光式火灾探测器', '92041900GNS44', 'upload/state/dcfc/viewicon/ziWaiHuoYanTanCeQi.png', 49);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866675300855810', '火灾自动报警系统', 'FAS-备用设备', '92041800CK844', 'upload/state/dcfc/viewicon/spareEquipment.png', 50);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1404693508639674370', '火灾自动报警系统', 'FAS-模块', '92042000YVN44', 'upload/state/dcfc/viewicon/module.png', 51);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361052926361602', '火灾自动报警系统', 'FAS-空气采样探测器', '920405002O544', 'upload/state/dcfc/viewicon/AirSamplingDetector.png', 52);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662045933158401', '火灾自动报警系统', 'SCS-防火阀', '92160200J4244', 'upload/state/dcfc/viewicon/fireDamper.png', 53);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662052493049858', '自动喷水灭火系统', 'FFS-雨淋蝶阀', '92110900ATW44', 'upload/state/dcfc/viewicon/DelugeButterflyValve.png', 54);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662028300304385', '自动喷水灭火系统', 'WSS-雨淋阀', '92130300BH644', 'upload/state/dcfc/viewicon/delugeValve.png', 55);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418465836974899202', '其他系统', '消防小室', '92990000AQT44', 'upload/state/dcfc/viewicon/fireCompartment.png', 56);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418496226158649346', '其他系统', '灭火器巡检', '92990000N2844', 'upload/state/dcfc/viewicon/fireExtinguisherInspection.png', 57);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418497428988567554', '其他系统', '消火栓系统', '92990000RIN44', 'upload/state/dcfc/viewicon/fireWaterSystem.png', 58);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418464823584915458', '其他系统', '防火分隔设施', '92990000UVR44', 'upload/state/dcfc/viewicon/separationFacility.png', 59);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1404693512771063809', '其他系统', 'FPMS-配电开关', '922206009JO44', 'upload/state/dcfc/viewicon/distributionSwitch.png', 60);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1418445233194696705', '其他系统', '灭火器', '31040000PV244', 'upload/state/dcfc/viewicon/fireExtinguisher.png', 61);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1450756152672518146', '其他系统', 'FHS-无线液位探测器', '92011500EBH44', 'upload/state/dcfc/viewicon/wirelessLiquidLevelDetector.png', 62);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662054481149954', '其他系统', 'FHS-消防水池装置', '92010700SHY44', 'upload/state/dcfc/viewicon/poolInstallation.png', 63);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392361066734010370', '其他系统', 'CAFS-泡沫罐', '92031900INJ44', 'upload/state/dcfc/viewicon/foamTank.png', 64);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1401866678308171778', '其他系统', 'FHS-管网压力探测器', '92011000T5Q44', 'upload/state/dcfc/viewicon/guanWangYaLi.png', 65);
INSERT INTO `equipment_icon`(`id`, `sys_name`, `type_name`, `type_code`, `icon`, `sort`) VALUES ('1392662048705593345', '其他系统', 'ES-电梯', '92170100NKI44', 'upload/state/dcfc/viewicon/elevator.png', 66);
UPDATE wl_equipment e SET e.shbz_img = (SELECT ei.icon FROM equipment_icon ei WHERE e.`code` = ei.`type_code`);
DROP TABLE IF EXISTS `equipment_icon`;
</sql>
</changeSet>
<changeSet author="keyong" id="1673609612-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_index" columnName="unit"/>
</not>
</preConditions>
<comment>新增属性字段 unit</comment>
<sql>
alter table `wl_equipment_specific_index` add column `unit` varchar(50) DEFAULT NULL COMMENT '指标单位(冗余字段)';
</sql>
</changeSet>
<changeSet author="keyong" id="1673609612-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_equipment_specific_index" />
</preConditions>
<comment>sync field</comment>
<sql>
UPDATE wl_equipment_specific_index wesi
SET wesi.unit = ( SELECT unit FROM wl_equipment_index wei WHERE wei.id = wesi.equipment_index_id );
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -1419,7 +1419,7 @@ ...@@ -1419,7 +1419,7 @@
<w:sz-cs w:val="28"/> <w:sz-cs w:val="28"/>
<w:lang w:val="EN-US" w:fareast="ZH-CN"/> <w:lang w:val="EN-US" w:fareast="ZH-CN"/>
</w:rPr> </w:rPr>
<w:t>测数据</w:t> <w:t>测数据</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
......
...@@ -1420,7 +1420,7 @@ ...@@ -1420,7 +1420,7 @@
<w:sz-cs w:val="28"/> <w:sz-cs w:val="28"/>
<w:lang w:val="EN-US" w:fareast="ZH-CN"/> <w:lang w:val="EN-US" w:fareast="ZH-CN"/>
</w:rPr> </w:rPr>
<w:t>测数据</w:t> <w:t>测数据</w:t>
</w:r> </w:r>
</w:p> </w:p>
</w:tc> </w:tc>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
}, },
{ {
"code": "92990000", "code": "92100000",
"index": "OilLeak,Open,Fault" "index": "OilLeak,Open,Fault"
} }
......
...@@ -87,4 +87,90 @@ ...@@ -87,4 +87,90 @@
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1 ) a) as a1
</insert> </insert>
<insert id="insertSystemMonthDataTest">
insert into wl_analysis_report_month
(
system_id,
num,
equipment_name,
equipment_code,
fault_equip_num,
fault_info_num,
alarm_equip_num,
alarm_info_num,
total_info_num,
report_month
)
select
a1.*,
DATE_FORMAT(DATE_SUB(#{date},INTERVAL #{num} day),'%Y-%m')
from
(SELECT
system_id,
num,
name,
code,
(SELECT
count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_true_num >0
and report.index_type LIKE CONCAT('%','Fault')
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as faultEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_type LIKE CONCAT('%','Fault')
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as faultInfoNum,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_true_num >0
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmInfoNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as totalInfoNum
FROM(
SELECT
s.id as system_id,
equipment.code,
equipment.name,
count(1) AS num
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id <![CDATA[<>]]> '' and s.id = #{systemId}
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1
</insert>
</mapper> </mapper>
...@@ -14,18 +14,18 @@ ...@@ -14,18 +14,18 @@
select select
s.id, s.id,
CONCAT(s.name,',',#{beginDate},' - ',#{endDate} ,':',CHAR(10), CONCAT(s.name,',',#{beginDate},' - ',#{endDate} ,':',CHAR(10),
CONCAT('正常设备',IFNULL(f1.totalNormalEquipNum,0),'台,','正常率:',concat(TRUNCATE(ABS(IFNULL(f1.normalEquipNumPercent,0)*100), 2),'%'),',', CONCAT('正常设备',IFNULL(f1.totalNormalEquipNum,0),'台,','正常率:',concat(f1.normalEquipNumPercent,'%'),',',
'同比上月',IF(IFNULL(f1.totalNormalEquipNum,0)- IFNULL(f1.lastMonthTotalNormalEquipNum,0) >0 ,'增加','减少'), '同比上月',IF(IFNULL(f1.totalNormalEquipNum,0)- IFNULL(f1.lastMonthTotalNormalEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalNormalEquipNum,0) = 0 ,'---',CONCAT(TRUNCATE(ABS(IFNULL(f1.totalNormalEquipNum,0)/f1.lastMonthTotalNormalEquipNum -1),2)* 100,'%')),',',CHAR(10)), if(IFNULL(f1.lastMonthTotalNormalEquipNum,0) = 0 ,'---',CONCAT(format(ABS(IFNULL(f1.totalNormalEquipNum,0)/f1.lastMonthTotalNormalEquipNum -1)* 100,2),'%')),','),
CONCAT('故障设备',IFNULL(f1.totalFaultEquipNum,0),'台,','故障率:',concat(TRUNCATE(ABS(IFNULL(f1.faultEquipPercent,0)),2)*100,'%'),',', CONCAT('故障设备',IFNULL(f1.totalFaultEquipNum,0),'台,','故障率:',concat(IFNULL(f1.faultEquipPercent,0),'%'),',',
'同比上月',IF(IFNULL(f1.totalFaultEquipNum,0)- IFNULL(f1.lastMonthTotalFaultEquipNum,0) >0 ,'增加','减少'), '同比上月',IF(IFNULL(f1.totalFaultEquipNum,0)- IFNULL(f1.lastMonthTotalFaultEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalFaultEquipNum,0) = 0 ,'---',CONCAT(TRUNCATE(ABS(IFNULL(f1.totalFaultEquipNum,0)/f1.lastMonthTotalFaultEquipNum -1),2)* 100,'%')),',',CHAR(10)), if(IFNULL(f1.lastMonthTotalFaultEquipNum,0) = 0 ,'---',CONCAT(format(ABS(IFNULL(f1.totalFaultEquipNum,0)/f1.lastMonthTotalFaultEquipNum -1)* 100,2),'%')),','),
CONCAT('告警设备',IFNULL(f1.totalAlarmEquipNum,0),'台,', CONCAT('告警设备',IFNULL(f1.totalAlarmEquipNum,0),'台,',
'同比上月',IF(IFNULL(f1.totalAlarmEquipNum,0)- IFNULL(f1.lastMonthTotalAlarmEquipNum,0) >0 ,'增加','减少'), '同比上月',IF(IFNULL(f1.totalAlarmEquipNum,0)- IFNULL(f1.lastMonthTotalAlarmEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmEquipNum,0) = 0 ,'---',CONCAT(TRUNCATE(ABS(IFNULL(f1.totalAlarmEquipNum,0)/f1.lastMonthTotalAlarmEquipNum -1),2)* 100,'%')),',',CHAR(10)), if(IFNULL(f1.lastMonthTotalAlarmEquipNum,0) = 0 ,'---',CONCAT(format(ABS(IFNULL(f1.totalAlarmEquipNum,0)/f1.lastMonthTotalAlarmEquipNum -1)* 100,2),'%')),','),
CONCAT('告警总数',IFNULL(f1.totalAlarmInfoNum,0),'条,', CONCAT('告警总数',IFNULL(f1.totalAlarmInfoNum,0),'条,',
'同比上月',IF(IFNULL(f1.totalAlarmInfoNum,0)- IFNULL(f1.lastMonthTotalAlarmInfoNum,0) >0 ,'增加','减少'), '同比上月',IF(IFNULL(f1.totalAlarmInfoNum,0)- IFNULL(f1.lastMonthTotalAlarmInfoNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmInfoNum,0) = 0 ,'---', CONCAT(TRUNCATE(ABS(IFNULL(f1.totalAlarmInfoNum,0)/f1.lastMonthTotalAlarmInfoNum -1),2)* 100,'%')) if(IFNULL(f1.lastMonthTotalAlarmInfoNum,0) = 0 ,'---', CONCAT(format(ABS(IFNULL(f1.totalAlarmInfoNum,0)/f1.lastMonthTotalAlarmInfoNum -1)* 100,2),'%'))
,'。')) as content, ,'。')) as content,
s.`name`, s.`name`,
3 as report_type, 3 as report_type,
...@@ -48,8 +48,190 @@ ...@@ -48,8 +48,190 @@
IFNULL(sum(faultEquipNum),0) as totalFaultEquipNum, IFNULL(sum(faultEquipNum),0) as totalFaultEquipNum,
IFNULL(sum(alarmEquipNum),0) as totalAlarmEquipNum, IFNULL(sum(alarmEquipNum),0) as totalAlarmEquipNum,
IFNULL(sum(alarmInfoNum),0) as totalAlarmInfoNum, IFNULL(sum(alarmInfoNum),0) as totalAlarmInfoNum,
if(sum(num) > 0,ROUND(sum(normalEquipNum)/sum(num),2), '-') as normalEquipNumPercent, FORMAT( (abs( ( sum(normalEquipNum) / IF ( sum(num) = 0, 1, sum(num)) ) ) * 100
if(sum(num) > 0,ROUND(sum(faultEquipNum)/sum(num),2), '-') as faultEquipPercent ),2)as normalEquipNumPercent,
FORMAT( (abs( (sum(faultEquipNum) / IF ( sum(num) = 0, 1, sum(num)) ) ) * 100
),2) as faultEquipPercent
from
(select
a1.*,
(a1.num - a1.alarmEquipNum) as normalEquipNum
from
(SELECT
system_id,
num,
name,
code,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_true_num >0
and report.index_type LIKE CONCAT('%','Fault')
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as faultEquipNum,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.index_true_num >0
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= #{beginDate}
and report.report_date <![CDATA[<=]]> #{endDate}
) as alarmInfoNum
FROM
(
SELECT
s.id as system_id,
equipment.code,
equipment.name,
count(1) AS num
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id <![CDATA[<>]]> ''
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1) u1
GROUP BY u1.system_id) s1
LEFT JOIN
(SELECT
u1.system_id,
sum(num) as totalEquipNum,
sum(normalEquipNum) as totalNormalEquipNum,
sum(faultEquipNum) as totalFaultEquipNum,
sum(alarmEquipNum) as totalAlarmEquipNum,
sum(alarmInfoNum) as totalAlarmInfoNum
from
(select
a1.*,
(a1.num - a1.alarmEquipNum) as normalEquipNum
from
(SELECT
system_id,
num,
name,
code,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_type LIKE CONCAT('%','Fault')
and report.index_true_num >0
and report.report_date >= DATE_SUB(#{beginDate},INTERVAL 1 MONTH)
and report.report_date <![CDATA[<=]]> DATE_SUB(#{endDate},INTERVAL 1 MONTH)
) as faultEquipNum,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.index_true_num >0
and report.report_date >= DATE_SUB(#{beginDate},INTERVAL 1 MONTH)
and report.report_date <![CDATA[<=]]> DATE_SUB(#{endDate},INTERVAL 1 MONTH)
) as alarmEquipNum,
(SELECT IFNULL(sum(report.index_true_num),0)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
<if test="indexKeySuffix.size() > 0">
and
<foreach collection="indexKeySuffix" item="keySuffix" open="(" close=")" separator="or">
report.index_type LIKE CONCAT('%',#{keySuffix})
</foreach>
</if>
and report.report_date >= DATE_SUB(#{beginDate},INTERVAL 1 MONTH)
and report.report_date<![CDATA[<=]]> DATE_SUB(#{endDate},INTERVAL 1 MONTH)
) as alarmInfoNum
FROM
(
SELECT
s.id as system_id,
equipment.code,
equipment.name,
count(1) AS num
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where
spec.system_id <![CDATA[<>]]> ''
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1) u1
GROUP BY u1.system_id) s2 ON s1.system_id = s2.system_id
) f1 on s.id = f1.system_id
where s.id = #{systemId}
</insert>
<insert id="insertSystemMonthSummaryDataTest">
insert into
wl_analysis_report_summary (
system_id,
summary_info,
system_name,
report_type,
report_date
)
select
s.id,
CONCAT(s.name,',',#{beginDate},' - ',#{endDate} ,':',CHAR(10),
CONCAT('正常设备',IFNULL(f1.totalNormalEquipNum,0),'台,','正常率:',concat(f1.normalEquipNumPercent,'%'),',',
'同比上月',IF(IFNULL(f1.totalNormalEquipNum,0)- IFNULL(f1.lastMonthTotalNormalEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalNormalEquipNum,0) = 0 ,'---',CONCAT(format(ABS(IFNULL(f1.totalNormalEquipNum,0)/f1.lastMonthTotalNormalEquipNum -1)* 100,2),'%')),','),
CONCAT('故障设备',IFNULL(f1.totalFaultEquipNum,0),'台,','故障率:',concat(IFNULL(f1.faultEquipPercent,0),'%'),',',
'同比上月',IF(IFNULL(f1.totalFaultEquipNum,0)- IFNULL(f1.lastMonthTotalFaultEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalFaultEquipNum,0) = 0 ,'---',CONCAT(format(ABS(IFNULL(f1.totalFaultEquipNum,0)/f1.lastMonthTotalFaultEquipNum -1)* 100,2),'%')),','),
CONCAT('告警设备',IFNULL(f1.totalAlarmEquipNum,0),'台,',
'同比上月',IF(IFNULL(f1.totalAlarmEquipNum,0)- IFNULL(f1.lastMonthTotalAlarmEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmEquipNum,0) = 0 ,'---',CONCAT(format(ABS(IFNULL(f1.totalAlarmEquipNum,0)/f1.lastMonthTotalAlarmEquipNum -1)* 100,2),'%')),','),
CONCAT('告警总数',IFNULL(f1.totalAlarmInfoNum,0),'条,',
'同比上月',IF(IFNULL(f1.totalAlarmInfoNum,0)- IFNULL(f1.lastMonthTotalAlarmInfoNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmInfoNum,0) = 0 ,'---', CONCAT(format(ABS(IFNULL(f1.totalAlarmInfoNum,0)/f1.lastMonthTotalAlarmInfoNum -1)* 100,2),'%'))
,'。')) as content,
s.`name`,
3 as report_type,
#{endDate} as report_date
from
f_fire_fighting_system s
LEFT JOIN
(select
s1.*,
IFNULL(s2.totalAlarmEquipNum,0) as lastMonthTotalAlarmEquipNum,
IFNULL(s2.totalAlarmInfoNum,0) as lastMonthTotalAlarmInfoNum,
IFNULL(s2.totalNormalEquipNum,0) as lastMonthTotalNormalEquipNum,
IFNULL(s2.totalEquipNum,0) as lastMonthTotalEquipNum,
IFNULL(s2.totalFaultEquipNum,0) as lastMonthTotalFaultEquipNum
from
(SELECT
u1.system_id,
IFNULL(sum(num),0) as totalEquipNum,
IFNULL(sum(normalEquipNum),0) as totalNormalEquipNum,
IFNULL(sum(faultEquipNum),0) as totalFaultEquipNum,
IFNULL(sum(alarmEquipNum),0) as totalAlarmEquipNum,
IFNULL(sum(alarmInfoNum),0) as totalAlarmInfoNum,
FORMAT( (abs( ( sum(normalEquipNum) / IF ( sum(num) = 0, 1, sum(num)) ) ) * 100
),2)as normalEquipNumPercent,
FORMAT( (abs( (sum(faultEquipNum) / IF ( sum(num) = 0, 1, sum(num)) ) ) * 100
),2) as faultEquipPercent
from from
(select (select
a1.*, a1.*,
......
...@@ -40,49 +40,25 @@ ...@@ -40,49 +40,25 @@
SELECT SELECT
wes.id AS specificId, wes.id AS specificId,
wes.`name`, wes.`name`,
a.statusDesc,
a.sxyl,
a.`value`, a.`value`,
wes.`code`, wes.`code`,
a.sxrj a.sxrj,
a.`unit`,
a.minLevel,
a.maxLevel
FROM FROM
wl_equipment_specific wes wl_equipment_specific wes
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
wlesi.equipment_specific_id, wlesi.equipment_specific_id,
IFNULL(wlesi.`value`, '--') AS `value`, IFNULL(wlesi.`value`, '--') AS `value`,
CASE wlesi.`unit`,
WHEN wlesi.`value` IS NULL THEN (SELECT wfie.field_value FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'maxLevel') AS maxLevel,
'--' (SELECT IFNULL( wfie.field_value, 0 ) FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'minLevel') AS minLevel,
WHEN wlesi.`value` - ( SELECT IFNULL( wfie.field_value, 0 ) FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'maxLevel' ) &gt; 0 THEN
'液位高'
WHEN wlesi.`value` - ( SELECT IFNULL( wfie.field_value, 0 ) FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'minLevel' ) &lt; 0 THEN
'液位低' ELSE '正常'
END AS statusDesc,
CASE CASE
WHEN ( SELECT IFNULL( wfie.field_value, 0 ) FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'volume' ) <![CDATA[<>]]> 0 THEN WHEN ( SELECT IFNULL( wfie.field_value, 0 ) FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'volume' ) <![CDATA[<>]]> 0 THEN
CONCAT(( SELECT field_value FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'volume' ),'m³') ELSE '--m³' CONCAT(( SELECT field_value FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'volume' ),'m³') ELSE '--m³'
END AS sxrj, END AS sxrj
CASE
WHEN wlesi.`value` IS NULL THEN
'--' ELSE
IF
(
wlesi.`value` - ( SELECT IFNULL( field_value, 0 ) FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'maxLevel' ) &gt; 0,
100,
ROUND(abs(
(
wlesi.`value` /
IF
(
( SELECT IFNULL( field_value, 0 ) FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'maxLevel' ) = 0,
1,
( SELECT IFNULL( field_value, 0 ) FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'maxLevel' )
)
)
) * 100, 2)
)
END AS sxyl
FROM FROM
wl_equipment_specific_index wlesi wl_equipment_specific_index wlesi
WHERE WHERE
...@@ -91,9 +67,9 @@ ...@@ -91,9 +67,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">
...@@ -169,50 +145,47 @@ ...@@ -169,50 +145,47 @@
temp.name, temp.name,
temp.nowLevel, temp.nowLevel,
temp.volume, temp.volume,
CASE temp.unit,
WHEN ( temp.nowLevel = '--' ) THEN temp.minLevel,
'--' temp.maxLevel
WHEN ( temp.maxLevel = 0 ) THEN -- CASE
'--' -- WHEN ( temp.nowLevel = '--' ) THEN
WHEN ( temp.minLevel = 0 ) THEN -- '--'
'--' -- WHEN ( temp.minLevel - temp.nowLevel > 0 ) THEN
WHEN ( temp.minLevel - temp.nowLevel > 0 ) THEN -- '液位低'
'液位低' -- WHEN ( temp.nowLevel - temp.maxLevel > 0) THEN
WHEN ( temp.nowLevel - temp.maxLevel > 0) THEN -- '液位高' ELSE '正常'
'液位高' ELSE '正常' -- END AS status,
END AS status, -- CASE
CASE -- WHEN ( temp.nowLevel = '--' ) THEN
WHEN ( temp.nowLevel = '--' ) THEN -- '--' ELSE format(
'--' ELSE format( -- IF
IF -- (
( -- (
( -- abs( ( ( temp.nowLevel ) / IF ( temp.maxLevel = 0, 1, temp.maxLevel ) ) ) * 100
abs( ( ( temp.nowLevel ) / IF ( temp.maxLevel = 0, 1, temp.maxLevel ) ) ) * 100 -- ) > 100,
) > 100, -- 100,
100, -- (
( -- abs( ( ( temp.nowLevel ) / IF ( temp.maxLevel = 0, 1, temp.maxLevel ) ) ) * 100
abs( ( ( temp.nowLevel ) / IF ( temp.maxLevel = 0, 1, temp.maxLevel ) ) ) * 100 -- )
) -- ),
), -- 2
2 -- )
) -- END AS abs
END AS abs
FROM FROM
( (
SELECT SELECT
wes.id, wes.id,
wes.name, wes.name,
IFNULL( ( SELECT value FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' ), '--' ) AS nowLevel, IFNULL( ( SELECT value FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' ), '--' ) AS nowLevel,
IFNULL( ( SELECT unit FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' ), '--' ) AS unit,
IFNULL(( SELECT field_value FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'maxLevel' ) , 0 )AS maxLevel, IFNULL(( SELECT field_value FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'maxLevel' ) , 0 )AS maxLevel,
IFNULL( ( SELECT field_value FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'minLevel' ), 0 ) AS minLevel, IFNULL( ( SELECT field_value FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'minLevel' ), 0 ) AS minLevel,
IFNULL( ( SELECT field_value FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'volume' ), 0 ) AS volume IFNULL( ( SELECT field_value FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'volume' ), 0 ) AS volume
FROM FROM
wl_equipment_specific wes wl_equipment_specific wes
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 +995,149 @@ ...@@ -1022,4 +995,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>
...@@ -1323,7 +1323,7 @@ ...@@ -1323,7 +1323,7 @@
LEFT JOIN wl_equipment e ON e.id = ed.equipment_id LEFT JOIN wl_equipment e ON e.id = ed.equipment_id
WHERE WHERE
e.is_iot = 1 and es.biz_org_code = #{bizOrgCode} e.is_iot = 1 and es.biz_org_code like concat(#{bizOrgCode},'%')
)AS total, )AS total,
( (
SELECT COUNT(DISTINCT(esa.iot_code)) FROM wl_equipment_specific_alarm esa SELECT COUNT(DISTINCT(esa.iot_code)) FROM wl_equipment_specific_alarm esa
......
...@@ -2378,6 +2378,7 @@ ...@@ -2378,6 +2378,7 @@
<select id="getWaterInfo" resultType="java.util.Map"> <select id="getWaterInfo" resultType="java.util.Map">
select * from ( select * from (
select * from (
(SELECT (SELECT
r.`name`, r.`name`,
ou.`code`, ou.`code`,
...@@ -2394,7 +2395,7 @@ ...@@ -2394,7 +2395,7 @@
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) &lt; IFNULL( rp.min_water_level, 0 ) WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) &lt; IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN AND rp.max_water_level IS NULL THEN
'--' ELSE IFNULL(( '--' ELSE IFNULL((
FORMAT(
abs( abs(
IFNULL( IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ), max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
...@@ -2403,9 +2404,7 @@ ...@@ -2403,9 +2404,7 @@
( (
IFNULL( rp.max_water_level, 0 ) = 0, IFNULL( rp.max_water_level, 0 ) = 0,
1, 1,
IFNULL( rp.max_water_level, 0 ))) * 100, IFNULL( rp.max_water_level, 0 ))) * 100
2
)
), ),
0 0
) )
...@@ -2428,6 +2427,7 @@ ...@@ -2428,6 +2427,7 @@
ec.image, ec.image,
r.resource_type, r.resource_type,
r.sequence_nbr, r.sequence_nbr,
rp.level_device_id,
fs.`code` AS systemCode fs.`code` AS systemCode
FROM FROM
cb_water_resource r cb_water_resource r
...@@ -2466,7 +2466,7 @@ ...@@ -2466,7 +2466,7 @@
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL(( '--' ELSE IFNULL((
FORMAT(
abs( abs(
IFNULL( IFNULL(
a.nowLevel, a.nowLevel,
...@@ -2475,9 +2475,7 @@ ...@@ -2475,9 +2475,7 @@
( (
IFNULL( a.maxLevel, 0 ) = 0, IFNULL( a.maxLevel, 0 ) = 0,
1, 1,
IFNULL( a.maxLevel, 0 ))) * 100, IFNULL( a.maxLevel, 0 ))) * 100
2
)
), ),
0 0
) )
...@@ -2500,6 +2498,7 @@ ...@@ -2500,6 +2498,7 @@
a.image, a.image,
a.resource_type, a.resource_type,
a.sequence_nbr, a.sequence_nbr,
a.level_device_id,
a.`code` AS systemCode a.`code` AS systemCode
FROM FROM
( (
...@@ -2509,7 +2508,7 @@ ...@@ -2509,7 +2508,7 @@
IFNULL( rp.min_water_level, 0 ) AS minLevel, IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel, IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(select (select
FORMAT(avg(IFNULL(ei.`value`,0)), 2) avg(IFNULL(ei.`value`,0))
from from
wl_equipment_specific_index ei wl_equipment_specific_index ei
where where
...@@ -2543,7 +2542,7 @@ ...@@ -2543,7 +2542,7 @@
) a ) a
)) b )) b
ORDER BY ORDER BY
levelStatus DESC,sequence_nbr DESC levelStatus DESC,sequence_nbr DESC ) as a
</select> </select>
<select id="getFireSystemInfo" resultType="java.util.Map"> <select id="getFireSystemInfo" resultType="java.util.Map">
...@@ -2847,6 +2846,7 @@ ...@@ -2847,6 +2846,7 @@
LEFT JOIN wl_equipment_specific_alarm esa ON esa.equipment_specific_id = es.id LEFT JOIN wl_equipment_specific_alarm esa ON esa.equipment_specific_id = es.id
WHERE WHERE
ed.`code` LIKE '92010800%' ed.`code` LIKE '92010800%'
AND es.iot_code IS NOT NULL
AND es.biz_org_code like concat(#{bizOrgCode}, '%') AND es.biz_org_code like concat(#{bizOrgCode}, '%')
<if test="systemCode!=null and systemCode!=''"> <if test="systemCode!=null and systemCode!=''">
AND fs.code = #{systemCode,jdbcType=VARCHAR} AND fs.code = #{systemCode,jdbcType=VARCHAR}
...@@ -2884,7 +2884,7 @@ ...@@ -2884,7 +2884,7 @@
LEFT JOIN wl_warehouse_structure wws ON wsd.warehouse_structure_id = wws.id LEFT JOIN wl_warehouse_structure wws ON wsd.warehouse_structure_id = wws.id
LEFT JOIN wl_equipment_category wec on wec.id=eq.category_id LEFT JOIN wl_equipment_category wec on wec.id=eq.category_id
<where> <where>
and wec.industry_code = 2 wec.industry_code = 2
<if test="dto.code!=null and dto.code!=''"> <if test="dto.code!=null and dto.code!=''">
and wesp.code = #{dto.code} and wesp.code = #{dto.code}
</if> </if>
...@@ -3852,16 +3852,24 @@ ...@@ -3852,16 +3852,24 @@
FROM `f_fire_fighting_system` ffs FROM `f_fire_fighting_system` ffs
LEFT JOIN wl_equipment_category wec LEFT JOIN wl_equipment_category wec
on ffs.system_type = wec.id on ffs.system_type = wec.id
WHERE biz_org_code = #{bizOrgCode} WHERE biz_org_code like concat(#{bizOrgCode},'%')
order by ffs.sort order by ffs.sort
</select> </select>
<select id="selectAlarmList" resultType="java.util.Map"> <select id="selectAlarmList" resultType="java.util.Map">
select select
a1.*, a1.*,
(a1.num - a1.alarm_equip_num) as normalEquipNum, (a1.num - a1.alarm_equip_num) as normalEquipNum,
if(a1.num > 0 , concat(ROUND((a1.num - a1.alarm_equip_num)/a1.num,2)*100,'%'), '-') as normalEquipPercent, concat(FORMAT( (abs( ( (a1.num - a1.alarm_equip_num) / IF ( a1.num = 0, 1, a1.num ) ) ) * 100
if(a1.num > 0 , concat(ROUND(a1.fault_equip_num/a1.num,2)*100,'%'), '-') as faultEquipPercent, ),2), '%') as normalEquipPercent,
if(a1.num > 0 , concat(ROUND(a1.alarm_equip_num/a1.num,2)*100,'%'), '-') as alarmEquipPercent
concat(FORMAT( (
abs( ( (a1.fault_equip_num) / IF ( a1.num = 0, 1, a1.num ) ) ) * 100
) ,2), '%') as faultEquipPercent,
concat(FORMAT( (
abs( ( (a1.alarm_equip_num) / IF ( a1.num = 0, 1, a1.num ) ) ) * 100
) ,2), '%') as alarmEquipPercent
from from
wl_analysis_report_month a1 wl_analysis_report_month a1
where where
...@@ -3910,13 +3918,14 @@ ...@@ -3910,13 +3918,14 @@
<select id="selectMonthPieChartTwo" resultType="java.util.Map"> <select id="selectMonthPieChartTwo" resultType="java.util.Map">
SELECT SELECT
ss.alarm_type_name as type, ss.alarm_type_name as type,
SUM(index_true_num) as value count(distinct(ss.equipment_specific_id)) as value
from from
( (
SELECT SELECT
rep.alarm_type, rep.alarm_type,
rep.alarm_type_name, rep.alarm_type_name,
rep.index_true_num rep.index_true_num,
rep.equipment_specific_id
FROM FROM
wl_equipment_alarm_report_day rep, wl_equipment_alarm_report_day rep,
( (
...@@ -4103,7 +4112,7 @@ ...@@ -4103,7 +4112,7 @@
wl_equipment_alarm_equip_day e wl_equipment_alarm_equip_day e
WHERE WHERE
e.system_id is not null e.system_id is not null
and e.system_id = #{systemId} and FIND_IN_SET( #{systemId},e.system_id)
AND e.equipment_code = spec.equipment_code AND e.equipment_code = spec.equipment_code
AND e.index_key = spec_index.equipment_index_key AND e.index_key = spec_index.equipment_index_key
AND e.report_date >= DATE_FORMAT(#{startDate},'%y-%m-%d') AND e.report_date >= DATE_FORMAT(#{startDate},'%y-%m-%d')
...@@ -4123,23 +4132,22 @@ ...@@ -4123,23 +4132,22 @@
)temp LEFT JOIN wl_equipment_index wei on temp.equipment_index_id = wei.id )temp LEFT JOIN wl_equipment_index wei on temp.equipment_index_id = wei.id
)temp1 on temp.system_id = temp1.systemId and temp.code = temp1.code )temp1 on temp.system_id = temp1.systemId and temp.code = temp1.code
group by type_code
ORDER BY temp.name ORDER BY temp.name
</select> </select>
<select id="selectAlarms" resultType="java.lang.Integer"> <select id="selectAlarms" resultType="java.lang.Integer">
SELECT SELECT
COUNT(1) ifnull(SUM(index_true_num), 0)
FROM FROM
wl_equipment_alarm_report_day report wl_equipment_alarm_report_day report
LEFT JOIN f_fire_fighting_system s ON FIND_IN_SET( s.id, report.system_ids ) LEFT JOIN f_fire_fighting_system s ON FIND_IN_SET( s.id, report.system_ids )
LEFT JOIN wl_equipment_specific spec on report.equipment_specific_id = spec.id LEFT JOIN wl_equipment_specific spec on report.equipment_specific_id = spec.id
where report.system_ids is not null and report.index_true_num > 0 where report.system_ids is not null and report.index_true_num > 0
and( report.index_type LIKE CONCAT('%','Fault','%')
or report.index_type LIKE CONCAT('%','FireAlarm','%') <foreach collection="indicator" item="index" open="AND(" separator="or" close=")">
or report.index_type LIKE CONCAT('%','Shield','%') report.index_type like concat ('%', #{index})
or report.index_type LIKE CONCAT('%','Open','%') </foreach>
or report.index_type LIKE CONCAT('%','OilLeak','%')
or report.index_type LIKE CONCAT('%','Alarm','%'))
and report.report_date BETWEEN #{startDate} and #{endDate} and report.report_date BETWEEN #{startDate} and #{endDate}
and system_id = #{systemId} and system_id = #{systemId}
and index_type = #{indexType} and index_type = #{indexType}
...@@ -4236,7 +4244,7 @@ ...@@ -4236,7 +4244,7 @@
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id) left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id = #{systemId} and spec.create_date &lt; #{endDate} where FIND_IN_SET(#{systemId} , spec.system_id) and spec.create_date &lt; #{endDate}
GROUP BY code,s.id, name ORDER BY system_id, code ) a) as a1 GROUP BY code,s.id, name ORDER BY system_id, code ) a) as a1
GROUP BY a1.system_id GROUP BY a1.system_id
) as b ) as b
...@@ -4462,7 +4470,8 @@ ...@@ -4462,7 +4470,8 @@
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id) left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where where
FIND_IN_SET(#{systemId},spec.system_id) AND equipment.is_iot = 1 FIND_IN_SET(#{systemId},spec.system_id)
AND equipment.is_iot = 1
GROUP BY code,s.id, name ORDER BY system_id, code ) a) as a1 GROUP BY code,s.id, name ORDER BY system_id, code ) a) as a1
GROUP BY a1.system_id GROUP BY a1.system_id
) as b ) as b
...@@ -4622,47 +4631,8 @@ ...@@ -4622,47 +4631,8 @@
r.`name`, r.`name`,
IFNULL( rp.min_water_level, 0 ) AS minLevel, IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel, IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL THEN
'--'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) >= IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'100'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) &lt; IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) /
IF
(
IFNULL( rp.max_water_level, 0 ) = 0,
1,
IFNULL( rp.max_water_level, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel, IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel,
( IFNULL(CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' THEN ei.`unit` END,'--') AS 'unit',
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL
OR rp.min_water_level IS NULL THEN
'--'
WHEN IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) &lt; IFNULL( rp.min_water_level, 0 ) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
IFNULL( rp.volume, 0 ) AS volume, IFNULL( rp.volume, 0 ) AS volume,
ec.image, ec.image,
r.resource_type, r.resource_type,
...@@ -4687,47 +4657,8 @@ ...@@ -4687,47 +4657,8 @@
a.`name`, a.`name`,
a.minLevel, a.minLevel,
a.maxLevel, a.maxLevel,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL( a.nowLevel, '--' ) nowLevel, IFNULL( a.nowLevel, '--' ) nowLevel,
( a.`unit`,
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
a.volume, a.volume,
a.image, a.image,
a.resource_type, a.resource_type,
...@@ -4739,12 +4670,20 @@ ...@@ -4739,12 +4670,20 @@
IFNULL( rp.min_water_level, 0 ) AS minLevel, IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel, IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(select (select
FORMAT(avg(IFNULL(ei.`value`,0)), 2) avg(IFNULL(ei.`value`,0))
from from
wl_equipment_specific_index ei wl_equipment_specific_index ei
where where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel') (ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel, and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
(select
ei.unit
from
wl_equipment_specific_index ei
where
-- or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' 此处由于单位会出现多个,所以无法确定选择哪一个,所以此处默认用一个指标的单位进行单位换算
ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel'
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS 'unit',
IFNULL( rp.volume, 0 ) AS volume, IFNULL( rp.volume, 0 ) AS volume,
ec.image, ec.image,
r.resource_type, r.resource_type,
...@@ -4767,7 +4706,7 @@ ...@@ -4767,7 +4706,7 @@
) a ) a
)) b )) b
ORDER BY ORDER BY
levelStatus DESC,sequence_nbr DESC sequence_nbr DESC
</select> </select>
<select id="getFoamTankBySuper" resultType="java.util.Map"> <select id="getFoamTankBySuper" resultType="java.util.Map">
...@@ -4810,9 +4749,7 @@ ...@@ -4810,9 +4749,7 @@
WHEN a.nowLevel IS NULL WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN OR a.minLevel IS NULL THEN
'--' '--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL( WHEN a.minLevel - a.nowLevel > 0 THEN
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常' '缺水' ELSE '正常'
END END
) AS levelStatus, ) AS levelStatus,
...@@ -4880,9 +4817,7 @@ ...@@ -4880,9 +4817,7 @@
WHEN a.nowLevel IS NULL WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN OR a.minLevel IS NULL THEN
'--' '--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL( WHEN a.minLevel - a.nowLevel > 0 THEN
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常' '缺水' ELSE '正常'
END END
) AS levelStatus, ) AS levelStatus,
...@@ -4933,11 +4868,11 @@ ...@@ -4933,11 +4868,11 @@
WHEN nowPressure IS NOT NULL WHEN nowPressure IS NOT NULL
AND minLevel IS NOT NULL AND minLevel IS NOT NULL
AND nowPressure >= minLevel THEN AND nowPressure - minLevel >= 0 THEN
'正常' '正常'
WHEN nowPressure IS NOT NULL WHEN nowPressure IS NOT NULL
AND minLevel IS NOT NULL AND minLevel IS NOT NULL
AND minLevel > nowPressure THEN AND minLevel - nowPressure > 0 THEN
'压力低' ELSE '--' '压力低' ELSE '--'
END END
) AS `status` ) AS `status`
...@@ -5037,6 +4972,7 @@ ...@@ -5037,6 +4972,7 @@
AND AND
</if> </if>
i.equipment_index_key in ('FHS_PressurePump_Start') i.equipment_index_key in ('FHS_PressurePump_Start')
and i.value = 'true'
ORDER BY ORDER BY
i.update_date DESC i.update_date DESC
limit 1 limit 1
...@@ -5057,6 +4993,7 @@ ...@@ -5057,6 +4993,7 @@
AND AND
</if> </if>
i.equipment_index_key in ('FHS_PressurePump_Stop') i.equipment_index_key in ('FHS_PressurePump_Stop')
and i.value = 'true'
ORDER BY ORDER BY
i.update_date DESC i.update_date DESC
limit 1 limit 1
...@@ -5284,7 +5221,7 @@ ...@@ -5284,7 +5221,7 @@
END as 'status' END as 'status'
FROM FROM
f_fire_fighting_system fs f_fire_fighting_system fs
where system_type_code IS NOT NULL where system_type_code IS NOT NULL AND LENGTH(trim(system_type_code)) != 0
</select> </select>
<select id="getSystemAlarmInfoList" resultType="java.util.Map"> <select id="getSystemAlarmInfoList" resultType="java.util.Map">
SELECT SELECT
...@@ -5310,7 +5247,7 @@ ...@@ -5310,7 +5247,7 @@
FROM FROM
`f_fire_fighting_system` `fs` `f_fire_fighting_system` `fs`
where where
fs.system_type_code IS NOT NULL fs.system_type_code IS NOT NULL AND LENGTH(trim(fs.system_type_code)) != 0 AND fs.system_type_code != 'otherSys'
</select> </select>
<select id="getSystemCountInfo" resultType="java.util.Map"> <select id="getSystemCountInfo" resultType="java.util.Map">
...@@ -5473,7 +5410,14 @@ ...@@ -5473,7 +5410,14 @@
<select id="getWaterlevelUnit" resultType="java.util.Map"> <select id="getWaterlevelUnit" resultType="java.util.Map">
SELECT unit FROM `wl_equipment_index` WHERE name_key = 'FHS_FirePoolDevice_WaterLevel' SELECT
wes.unit
FROM
wl_equipment_specific_index wes
WHERE
wes.equipment_index_key = #{equipmentIndexKey}
AND wes.equipment_specific_id = #{equipmentSpecificId}
LIMIT 1
</select> </select>
<select id="getStationConnectStatus" resultType="java.util.Map"> <select id="getStationConnectStatus" resultType="java.util.Map">
...@@ -5620,29 +5564,68 @@ ...@@ -5620,29 +5564,68 @@
<select id="getEquip" resultType="java.util.Map"> <select id="getEquip" resultType="java.util.Map">
SELECT SELECT
spe.id, spe.id,
det.`name` equipmentName, wle.`name`,
spe.`code`, wle.`code`,
det.`code` equipmentCode,
( (
CASE CASE
( SELECT count(*) FROM wl_equipment_specific_alarm wesa WHERE wesa.equipment_specific_id = spe.id AND STATUS = 1 ) ( SELECT count(*) FROM wl_equipment_specific_alarm wesa WHERE wesa.equipment_specific_id = spe.id AND STATUS = 1 )
WHEN 0 THEN WHEN 0 THEN
'正常' ELSE '异常' '正常' ELSE '异常'
END END
) flag ) `status`,
wle.shbz_img shbzImg
FROM FROM
wl_equipment_specific AS spe wl_equipment_specific AS spe
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, spe.system_id ) LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, spe.system_id )
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN wl_stock_detail AS wlsd ON wlsd.equipment_detail_id = det.id
WHERE WHERE
fs.system_type_code IS NOT NULL fs.system_type_code IS NOT NULL
AND fs.system_type_code = 'fireAlarmSys' <if test="bizOrgCode != null and bizOrgCode != ''">
AND wlsd.`status` = 1 AND spe.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
<if test="systemCode != null and systemCode != ''">
AND fs.system_type_code = #{systemCode}
</if>
GROUP BY det.`code` GROUP BY det.`code`
</select> </select>
<select id="getFireSystemEquipStatusList" resultType="java.util.Map">
SELECT
spe.id,
spe.`name`,
spe.`code`,
(
CASE
( SELECT count(*) FROM wl_equipment_specific_alarm wesa WHERE wesa.equipment_specific_id = spe.id AND STATUS = 1 )
WHEN 0 THEN
'正常' ELSE '异常'
END
) `status`,
wle.shbz_img shbzImg
FROM
wl_equipment_specific AS spe
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, spe.system_id )
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
WHERE
fs.system_type_code IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
AND spe.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
<if test="systemCode != null and systemCode != ''">
AND fs.system_type_code = #{systemCode}
</if>
<if test="categoryCodes != null and categoryCodes.split(',').length >0">
AND
<foreach collection="categoryCodes.split(',')" item="item" index="index" open="(" close=")" separator=" OR ">
LOCATE(#{item}, det.`code`) > 0
</foreach>
</if>
GROUP BY spe.id
ORDER BY spe.id
</select>
<select id="selectPressureDetails" resultType="java.util.Map"> <select id="selectPressureDetails" resultType="java.util.Map">
SELECT SELECT
ed.`name`, ed.`name`,
...@@ -5657,6 +5640,7 @@ ...@@ -5657,6 +5640,7 @@
WHERE WHERE
wesi.equipment_specific_id = es.id wesi.equipment_specific_id = es.id
AND wesi.equipment_index_key IN ('FHS_PressurePump_Stop') AND wesi.equipment_index_key IN ('FHS_PressurePump_Stop')
AND wesi.value = 'true'
ORDER BY ORDER BY
wesi.update_date DESC wesi.update_date DESC
LIMIT 1 LIMIT 1
...@@ -5669,6 +5653,7 @@ ...@@ -5669,6 +5653,7 @@
WHERE WHERE
wesi.equipment_specific_id = es.id wesi.equipment_specific_id = es.id
AND wesi.equipment_index_key IN ('FHS_PressurePump_Start') AND wesi.equipment_index_key IN ('FHS_PressurePump_Start')
AND wesi.value = 'true'
ORDER BY ORDER BY
wesi.update_date DESC wesi.update_date DESC
LIMIT 1 LIMIT 1
...@@ -5688,5 +5673,18 @@ ...@@ -5688,5 +5673,18 @@
<select id="selectEquipmentSpecificById" resultType="java.util.Map"> <select id="selectEquipmentSpecificById" resultType="java.util.Map">
select * from wl_equipment_specific where id = #{id} select * from wl_equipment_specific where id = #{id}
</select> </select>
<select id="selectWeekAlarmsEquip" resultType="java.lang.Integer">
SELECT
COUNT(DISTINCT(e.equipment_specific_id))
FROM
wl_equipment_alarm_report_day e
WHERE
FIND_IN_SET( #{systemId},e.system_ids)
AND e.equipment_code = #{equipmentCode}
AND e.index_type = #{typeCode}
AND e.report_date >= DATE_FORMAT(#{startDate},'%y-%m-%d')
AND e.report_date &lt;= DATE_FORMAT(#{endDate},'%y-%m-%d')
</select>
</mapper> </mapper>
...@@ -103,5 +103,7 @@ redis.cache.failure.time=10800 ...@@ -103,5 +103,7 @@ redis.cache.failure.time=10800
#now.gateway.address=http://172.16.10.72:10005/ #now.gateway.address=http://172.16.10.72:10005/
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
...@@ -23,3 +23,5 @@ mybatis-plus.mapper-locations=classpath:mapper/* ...@@ -23,3 +23,5 @@ mybatis-plus.mapper-locations=classpath:mapper/*
redis.cache.failure.time=10800 redis.cache.failure.time=10800
management.endpoints.enabled-by-default=false management.endpoints.enabled-by-default=false
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
...@@ -253,70 +253,44 @@ ...@@ -253,70 +253,44 @@
SELECT SEQUENCE_NBR FROM knowledge_doc_content WHERE DOC_STATUS = "PUBLISHED" SELECT SEQUENCE_NBR FROM knowledge_doc_content WHERE DOC_STATUS = "PUBLISHED"
</select> </select>
<select id="queryDocCardList" resultType="map"> <select id="queryDocCardList" parameterType="map" resultType="map">
SELECT SELECT
SEQUENCE_NBR sequenceNbr, kdc.SEQUENCE_NBR id,
REC_DATE recDate, kdc.DOC_TITLE title,
DOC_STATUS docStatus, cat.CATEGORY_NAME categoryName
CREATE_TIME createTime,
USER_ID userId,
AUDIT_STATUS auditStatus,
REJECTION_COMMENT rejectionComment,
AUDITOR_USER_ID auditorUserId,
ORG_CODE orgCode,
DOC_TITLE docTitle,
DIRECTORY_ID directoryId,
( SELECT kdc.CATEGORY_NAME FROM knowledge_doc_category kdc WHERE kdc.SEQUENCE_NBR = DIRECTORY_ID ) directoryName,
releaseDate,
excuteDate,
IFNULL( collectNum, 0 ) collectNum,
IFNULL( quoteNum, 0 ) quoteNum,
IFNULL( collect, "UNCOLLECT" ) collect
FROM FROM
knowledge_doc_content doct knowledge_doc_content kdc LEFT JOIN knowledge_doc_category cat ON cat.SEQUENCE_NBR = kdc.DIRECTORY_ID
LEFT JOIN (
SELECT
INSTANCE_ID,
MAX( CASE FIELD_NAME WHEN 'releaseDate' THEN FIELD_VALUE ELSE NULL END ) AS releaseDate,
MAX( CASE FIELD_NAME WHEN 'excuteDate' THEN FIELD_VALUE ELSE NULL END ) AS excuteDate
FROM
knowledge_dynamics_value
GROUP BY
INSTANCE_ID
) fieldt ON doct.SEQUENCE_NBR = fieldt.INSTANCE_ID
LEFT JOIN ( SELECT ENTITY_ID, COUNT( 1 ) collectNum FROM knowledge_interaction_record WHERE OPERATE_TYPE = "COLLECT" GROUP BY ENTITY_ID ) coll ON doct.SEQUENCE_NBR = coll.ENTITY_ID
LEFT JOIN ( SELECT ENTITY_ID, OPERATE_COUNT quoteNum FROM knowledge_interaction_count WHERE OPERATE_TYPE = "PUBLISH" AND ENTITY_TYPE = "DOC" ) quot ON doct.SEQUENCE_NBR = quot.ENTITY_ID
LEFT JOIN ( SELECT ENTITY_ID, OPERATE_TYPE collect FROM knowledge_interaction_record WHERE OPERATE_TYPE = "COLLECT" AND USER_ID = 3780967 ) favor ON doct.SEQUENCE_NBR = favor.ENTITY_ID
WHERE WHERE
DOC_STATUS = 'PUBLISHED' kdc.DOC_STATUS = "PUBLISHED"
ORDER BY <if test="id != null and id != ''">
directoryName DESC, AND cat.PARENT_ID = #{id}
create_time DESC </if>
<if test="ids != null and ids.size > 0">
AND cat.PARENT_ID not in
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
ORDER BY kdc.CREATE_TIME DESC
</select> </select>
<select id="queryCardCount" resultType="map"> <select id="queryCardCount" resultType="map">
SELECT SELECT
SEQUENCE_NBR id,
( SELECT kdc.CATEGORY_NAME FROM knowledge_doc_category kdc WHERE kdc.SEQUENCE_NBR = DIRECTORY_ID ) directoryName, CATEGORY_NAME categoryName,
COUNT(SEQUENCE_NBR) as num (
FROM
knowledge_doc_content doct
LEFT JOIN (
SELECT SELECT
INSTANCE_ID, COUNT( doc.SEQUENCE_NBR )
MAX( CASE FIELD_NAME WHEN 'releaseDate' THEN FIELD_VALUE ELSE NULL END ) AS releaseDate,
MAX( CASE FIELD_NAME WHEN 'excuteDate' THEN FIELD_VALUE ELSE NULL END ) AS excuteDate
FROM FROM
knowledge_dynamics_value knowledge_doc_content doc
GROUP BY LEFT JOIN knowledge_doc_category kdc ON kdc.SEQUENCE_NBR = doc.DIRECTORY_ID
INSTANCE_ID WHERE
) fieldt ON doct.SEQUENCE_NBR = fieldt.INSTANCE_ID kdc.PARENT_ID = k.SEQUENCE_NBR
LEFT JOIN ( SELECT ENTITY_ID, COUNT( 1 ) collectNum FROM knowledge_interaction_record WHERE OPERATE_TYPE = "COLLECT" GROUP BY ENTITY_ID ) coll ON doct.SEQUENCE_NBR = coll.ENTITY_ID ) num
LEFT JOIN ( SELECT ENTITY_ID, OPERATE_COUNT quoteNum FROM knowledge_interaction_count WHERE OPERATE_TYPE = "PUBLISH" AND ENTITY_TYPE = "DOC" ) quot ON doct.SEQUENCE_NBR = quot.ENTITY_ID FROM
LEFT JOIN ( SELECT ENTITY_ID, OPERATE_TYPE collect FROM knowledge_interaction_record WHERE OPERATE_TYPE = "COLLECT" ) favor ON doct.SEQUENCE_NBR = favor.ENTITY_ID knowledge_doc_category k
WHERE WHERE
DOC_STATUS = 'PUBLISHED' PARENT_ID = 0
GROUP BY DIRECTORY_ID
</select> </select>
</mapper> </mapper>
......
...@@ -65,3 +65,5 @@ Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE ...@@ -65,3 +65,5 @@ Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 消防救援保障部ID ## 消防救援保障部ID
fire-rescue=1432549862557130753 fire-rescue=1432549862557130753
management.endpoints.enabled-by-default=false management.endpoints.enabled-by-default=false
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
...@@ -68,3 +68,6 @@ eureka.instance.status-page-url-path=/actuator/info ...@@ -68,3 +68,6 @@ eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
management.endpoints.enabled-by-default=false management.endpoints.enabled-by-default=false
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
...@@ -50,7 +50,7 @@ amosRefresh.patrol.topic =patrolCheckInsert ...@@ -50,7 +50,7 @@ amosRefresh.patrol.topic =patrolCheckInsert
patrol.point.classify.topic=patrol/point/classify patrol.point.classify.topic=patrol/point/classify
patrol.topic=patrol/# patrol.topic=patrol/#
#停止通过WEB公开所有端点 #停止通过WEB公开所有端点
management.endpoints.web.exposure.exclude=* #management.endpoints.web.exposure.exclude=*
## redis失效时间 ## redis失效时间
redis.cache.failure.time=10800 redis.cache.failure.time=10800
...@@ -61,7 +61,7 @@ rule.definition.default-agency=STATE_GRID ...@@ -61,7 +61,7 @@ rule.definition.default-agency=STATE_GRID
jcs.fegin.name=JCS jcs.fegin.name=JCS
emergency.command.section.id=1418223840361709569 emergency.command.section.id=1418223840361709569
management.endpoints.enabled-by-default=false #management.endpoints.enabled-by-default=false
equipment.hierarchy=1,2,4,6 equipment.hierarchy=1,2,4,6
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<if test="pointName!=null">and b.name like concat(concat("%",#{pointName}),"%")</if> <if test="pointName!=null">and b.name like concat(concat("%",#{pointName}),"%")</if>
<if test="pointNo!=null">and b.point_no like concat('%',#{pointNo},'%')</if> <if test="pointNo!=null">and b.point_no like concat('%',#{pointNo},'%')</if>
<if test="isFixed!=null">and b.is_fixed = #{isFixed}</if> <if test="isFixed!=null">and b.is_fixed = #{isFixed}</if>
<if test="isOK!=null and isOk!=''">and a.is_OK = #{isOK}</if> <if test="isOK!=null and isOK!=''">and a.is_OK = #{isOK}</if>
<if test="planId!=null">and a.plan_Id = #{planId}</if> <if test="planId!=null">and a.plan_Id = #{planId}</if>
<if test="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if> <if test="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if>
<if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if> <if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if>
...@@ -292,7 +292,7 @@ ...@@ -292,7 +292,7 @@
<if test="pointName!=null">and b.name like concat(concat("%",#{pointName}),"%")</if> <if test="pointName!=null">and b.name like concat(concat("%",#{pointName}),"%")</if>
<if test="pointNo!=null">and b.point_no like concat('%',#{pointNo},'%')</if> <if test="pointNo!=null">and b.point_no like concat('%',#{pointNo},'%')</if>
<if test="isFixed!=null">and b.is_fixed = #{isFixed}</if> <if test="isFixed!=null">and b.is_fixed = #{isFixed}</if>
<if test="isOK!=null">and a.is_OK = #{isOK}</if> <if test="isOK!=null and isOK!=''">and a.is_OK = #{isOK}</if>
<if test="planId!=null">and a.plan_Id = #{planId}</if> <if test="planId!=null">and a.plan_Id = #{planId}</if>
<if test="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if> <if test="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if>
<if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if> <if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if>
......
...@@ -27,3 +27,5 @@ rule.award="\u65BD\u5DE5\u5B89\u5168\u9884\u63A7/award" ...@@ -27,3 +27,5 @@ rule.award="\u65BD\u5DE5\u5B89\u5168\u9884\u63A7/award"
#server.ssl.key-store-type=JKS #server.ssl.key-store-type=JKS
login.environment=dev login.environment=dev
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
...@@ -74,3 +74,6 @@ eureka.instance.status-page-url-path=/actuator/info ...@@ -74,3 +74,6 @@ eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
management.endpoints.enabled-by-default=false management.endpoints.enabled-by-default=false
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
...@@ -5,3 +5,5 @@ spring.profiles.active=dev ...@@ -5,3 +5,5 @@ spring.profiles.active=dev
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.serialization.write-dates-as-timestamps=true spring.jackson.serialization.write-dates-as-timestamps=true
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
...@@ -6,3 +6,5 @@ spring.jackson.time-zone=GMT+8 ...@@ -6,3 +6,5 @@ spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.serialization.write-dates-as-timestamps=true spring.jackson.serialization.write-dates-as-timestamps=true
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
...@@ -35,3 +35,7 @@ spring.redis.lettuce.pool.max-wait=-1 ...@@ -35,3 +35,7 @@ spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0 spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
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