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;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -32,6 +33,8 @@ public class PersonIdentifyAspect {
RedisUtils redisUtils;
@Autowired
private IOrgUsrService orgUsrService;
@Value("${logic}")
Boolean logic;
@Before(value = "@annotation(com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify) && @annotation(permission)")
public void personIdentity(JoinPoint joinPoint, PersonIdentify permission) throws PermissionException {
......@@ -41,12 +44,19 @@ public class PersonIdentifyAspect {
UserDto userDto = orgUsrService.getUserParentInfo(userId);
ReginParams.PersonIdentity personIdentity = new ReginParams.PersonIdentity();
// 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.setCompanyName(userDto.getCompanyName());
personIdentity.setPersonSeq(userDto.getPersonSeq());
personIdentity.setPersonName(userDto.getPersonName());
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());
reginParam.setPersonIdentity(personIdentity);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
......
......@@ -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);
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 {
List<Map<String, Object>> queryByCompanyId(List<String> bizNames);
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 @@
AND i.field_value != ''
GROUP BY i.field_value
</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
DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY )),'%Y-%m-%d') AS date,
......
......@@ -123,4 +123,7 @@ public class EquipmentIndex extends BaseEntity {
@TableField(value = "emergency_level_describe")
private String emergencyLevelDescribe;
@TableField(value = "unit")
private String unit;
}
......@@ -180,6 +180,7 @@ public class EquipmentSpecificIndex extends BaseEntity {
@TableField(exist = false)
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 @@
) s group by date,bizOrgCode
</select>
<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
</select>
......
......@@ -149,6 +149,28 @@ public class DutyPersonController extends BaseController {
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));
}
/**
* 调班
*
......
......@@ -329,8 +329,17 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType
public List<Map<String, Object>> queryByCompanyNew(String 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) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getNewEquipmentForSpecifyDate(dutyDay,
this.getGroupCode(), "deptId", "deptName", "result.deptId");
......
......@@ -14,6 +14,7 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
......@@ -38,6 +39,9 @@ public class PersonIdentifyAspect {
@Autowired
private JcsFeign jcsFeignClient;
@Value("${logic}")
Boolean logic;
@Pointcut("execution(public * com.*.equipmanage.controller..*(..))")
public void userDate() {
......@@ -60,6 +64,11 @@ public class PersonIdentifyAspect {
// ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
String s = JSONObject.toJSONString(responseModel.getResult());
ReginParams.PersonIdentity personIdentity = JSONObject.parseObject(s, ReginParams.PersonIdentity.class);
//电力默认走公司权限
if (!logic){
personIdentity.setBizOrgCode(StringUtils.isEmpty(personIdentity.getCompanyBizOrgCode()) ? "-1" : personIdentity.getCompanyBizOrgCode());
}
reginParam.setPersonIdentity(personIdentity);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
}
......
......@@ -8,6 +8,7 @@ import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -45,6 +46,7 @@ public class AnalysisReportLogController extends AbstractBaseController {
// 工具栏中,显示第几个按钮,从左到右,可由逗号隔开显示多个
private String showButton = "6";
@Lazy
@Autowired
IAnalysisReportLogService iAnalysisReportLogService;
......@@ -103,7 +105,10 @@ public class AnalysisReportLogController extends AbstractBaseController {
dto.setStartDate(startDate);
dto.setEndDate(endDate);
dto.setReportType(reportType);
dto.setStationCode(stationCode);
ReginParams reginParams = getSelectedOrgInfo();
dto.setStationCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
return iAnalysisReportLogService.iotReportPage(page, dto);
}
}
......@@ -100,6 +100,7 @@ public class CarController extends AbstractBaseController {
@Autowired
ICarLonAndLatDataService iCarLonAndLatDataService;
@Lazy
@Autowired
IEquipmentService iEquipmentService;
......
......@@ -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.rule.action.MessageAction;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.fegin.IotFeign;
......@@ -272,17 +273,27 @@ public class ConfigureController extends AbstractBaseController {
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
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);
if (!ObjectUtils.isEmpty(record.get("nowLevel")) && !"--".equals(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"))){
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 {
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
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/iotWeekReport")
......
......@@ -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.DateUtils;
import com.yeejoin.equipmanage.common.vo.IotDataVO;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.service.IEmergencyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
......@@ -65,7 +67,7 @@ public class EmergencyController extends AbstractBaseController {
public ResponseModel getCAFSWaterTankInfo() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
return CommonResponseUtil.success(iEmergencyService.getCAFSWaterTankInfo(bizOrgCode));
return CommonResponseUtil.success(iEmergencyService.getCAFSWaterTankInfo());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -114,16 +116,11 @@ public class EmergencyController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("泡沫罐列表")
@GetMapping(value = "/selectFoamTank")
public Page<Map<String, Object>> selectFoamTank(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "pageNumber") int pageNumber,
public Page<Map<String, Object>> selectFoamTank(@RequestParam(value = "pageNumber") int pageNumber,
@RequestParam(value = "pageSize") int pageSize
) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
if (ObjectUtils.isEmpty(bizOrgCode)){
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return iEmergencyService.selectFoamTank(page, bizOrgCode);
return iEmergencyService.selectFoamTank(page);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -560,6 +557,30 @@ public class EmergencyController extends AbstractBaseController {
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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -288,6 +289,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
*/
@DeleteMapping(value = "/delEquipmentBySpecificId")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@Transactional(rollbackFor = Exception.class)
@ApiOperation(value = "删除装备相关所有数据", notes = "删除装备相关所有数据")
public ResponseModel delEquipmentBySpecificId(@RequestParam Long specificId) {
EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getById(specificId);
......@@ -297,6 +299,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
return CommonResponseUtil.success(result);
}
private void refreshCount(String bizOrgCode) {
try {
equipmentSpecificSerivce.refreshStaData();
......@@ -438,7 +441,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
List<String> split= Arrays.asList(equipSpeId.split(","));
for (String s : split) {
// 1.根据 equipSpeId 查询装备iotCode
EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectById(equipSpeId);
EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectById(s);
if (ObjectUtils.isEmpty(equipmentSpecific)) {
return CommonResponseUtil.failure("未查询到装备信息!");
}
......
......@@ -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.metadata.IPage;
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.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
......@@ -196,9 +197,40 @@ public class FireFightingSystemController extends AbstractBaseController {
//查询系统下设备状态
@RequestMapping(value = "/alarmSystem/info", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("通过id查询消防系统信息")
public List<Map<String,Object>> getEquip() {
return fireFightingSystemService.getEquip();
@ApiOperation("通过systemCode查询消防系统信息")
public List<Map<String,Object>> getEquip(@RequestParam(required = false) String bizOrgCode,
@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);
}
......
......@@ -25,4 +25,31 @@ public interface IotFeign {
@RequestParam(value = "deviceName") String deviceName,
@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;
import com.yeejoin.equipmanage.common.entity.AnalysisReportMonth;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
......@@ -22,4 +23,6 @@ public interface AnalysisReportMonthMapper extends BaseMapper<AnalysisReportMont
* @param systemId 系统id
*/
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;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
......@@ -22,4 +23,5 @@ public interface AnalysisReportSummaryMapper extends BaseMapper<AnalysisReportSu
* @param systemId 系统id
*/
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{
* @param bizOrgCode
* @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{
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);
......@@ -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, 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
@Param("startDate") String startDate,
@Param("endDate") String endDate,
@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,
@Param("startDate") String startDate,
@Param("endDate") String endDate,
......@@ -634,7 +641,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
String selectEquipSystemType(String code);
Map<String, Object> getWaterlevelUnit();
Map<String, Object> getWaterlevelUnit(@Param("equipmentSpecificId") String equipmentSpecificId, @Param("equipmentIndexKey") String equipmentIndexKey);
Map<String, Object> getStationConnectStatus();
......@@ -644,10 +651,11 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
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);
Map<String, Object> selectEquipmentSpecificById(@Param("id") String id);
}
......@@ -3,6 +3,8 @@ package com.yeejoin.equipmanage.quartz;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.service.IAnalysisReportLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -20,7 +22,7 @@ public class AnalysisReportSchedulerJob {
@Autowired
private IAnalysisReportLogService iAnalysisReportLogService;
private final Logger log = LoggerFactory.getLogger(AnalysisReportSchedulerJob.class);
/**
* 每天凌晨0点-日报生成
*/
......@@ -50,6 +52,7 @@ public class AnalysisReportSchedulerJob {
Date yestDay = DateUtils.dateAdd(new Date(),-1,false);
Date beginDate = DateUtils.getFirstDayOfMonth(yestDay);
Date endDate = DateUtils.getLastDayOfMonth(yestDay);
log.warn("monthReport报表开始生成");
iAnalysisReportLogService.generateMonthReport(AnalysisReportEnum.MONTH_REPORT,beginDate,endDate);
}
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.Date;
......@@ -37,6 +38,9 @@ public interface IAnalysisReportLogService extends IService<AnalysisReportLog> {
*/
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
......
......@@ -20,7 +20,7 @@ public interface IEmergencyService {
/**
* @return
*/
List<Map<String, Object>> getCAFSWaterTankInfo(String bizOrgCode);
List<Map<String, Object>> getCAFSWaterTankInfo();
Map<String, Object> emergencyMaterials();
......@@ -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>> 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);
......@@ -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>> getEquipExpiryStatistics(Integer expiryDayNum);
List<Map<String, String>> getEquipExpiryList(Integer expiryDayNum);
Map<String, Integer> getStockEquipStatistics();
}
......@@ -171,7 +171,10 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
*/
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
});
}
@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) {
AnalysisReportLog reportLog = new AnalysisReportLog();
reportLog.setName(reportEnum.getName());
......
package com.yeejoin.equipmanage.service.impl;
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.StringUtil;
import com.yeejoin.equipmanage.common.utils.UnitTransformUtil;
import com.yeejoin.equipmanage.mapper.EmergencyMapper;
import com.yeejoin.equipmanage.service.IEmergencyService;
import org.apache.commons.compress.utils.Lists;
......@@ -49,19 +52,21 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
@Override
public List<Map<String, Object>> getCAFSWaterTankInfo(String bizOrgCode) {
List<Map<String, Object>> list = emergencyMapper.getCAFSWaterTankInfo(bizOrgCode);
// List<Map<String, Object>> res = new ArrayList();
// if (0 < list.size()) {
// list.forEach(x -> {
// Map<String, Object> map = new HashMap<>();
// map.put("key", x.get("specificId"));
// map.put("code", x.get("code"));
// map.put("name", x.get("name"));
// map.put("value", x.get("specificId"));
// map.put("key", x.get("specificId"));
// });
// }
public List<Map<String, Object>> getCAFSWaterTankInfo() {
List<Map<String, Object>> list = emergencyMapper.getCAFSWaterTankInfo();
if (0 < list.size()) {
for (Map<String, Object> m : list) {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("value")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("value", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
m.put("statusDesc", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
m.put("statusDesc", "--");
}
m.put("sxyl", transResult.get("abs"));
}
}
return Optional.ofNullable(list).orElse(Lists.newArrayList());
}
......@@ -81,8 +86,23 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
@Override
public Page<Map<String, Object>> selectFoamTank(Page<Map<String, Object>> page, String bizOrgCode) {
return emergencyMapper.selectFoamTank(page, bizOrgCode);
public Page<Map<String, Object>> selectFoamTank(Page<Map<String, Object>> page) {
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
......@@ -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;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -30,6 +31,7 @@ public class EquipmentDefUpload implements IEquipmentDefUpload {
@Autowired
private EquipmentMapper equipmentMapper;
@Lazy
@Autowired
private IEquipmentService equipmentService;
......
......@@ -19,6 +19,7 @@ import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
......@@ -59,13 +60,14 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
@Autowired
private IEquipmentCategoryService iEquipmentCategoryService;
@Lazy
@Autowired
private IEquipmentService iEquipmentService;
@Autowired
private IUnitService iUnitService;
@Lazy
@Autowired
private IUploadFileService iUploadFileService;
@Autowired
......
......@@ -18,6 +18,7 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -48,6 +49,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
private IEquipmentIndexService iEquipmentIndexService;
@Autowired
private IUnitService iUnitService;
@Lazy
@Autowired
private UploadFileMapper uploadFileMapper;
@Autowired
......@@ -56,6 +58,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
private PatrolFeign patrolFeign;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Lazy
@Autowired
private IEquipmentDetailService iEquipmentDetailService;
......
......@@ -1577,6 +1577,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
equipmentSpecificIndex.setIsAlarm(index.getIsAlarm());
equipmentSpecificIndex.setEmergencyLevel(index.getEmergencyLevel());
equipmentSpecificIndex.setEmergencyLevelDescribe(index.getEmergencyLevelDescribe());
equipmentSpecificIndex.setUnit(index.getUnit());
equipmentSpecificIndices.add(equipmentSpecificIndex);
});
}
......
......@@ -16,6 +16,7 @@ import java.util.stream.Collectors;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
......@@ -76,8 +77,10 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
private RemoteSecurityService securityService;
@Autowired
private IEquipmentCategoryService iEquipmentCategoryService;
@Lazy
@Autowired
private IEquipmentService iEquipmentService;
@Lazy
@Autowired
private IEquipmentDetailService iEquipmentDetailService;
@Autowired
......
......@@ -17,6 +17,7 @@ import com.yeejoin.equipmanage.service.IEquipmentService;
import com.yeejoin.equipmanage.service.IStockDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.*;
......@@ -29,10 +30,10 @@ import java.util.*;
*/
@Service
public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, StockDetail> implements IStockDetailService {
@Lazy
@Autowired
private IEquipmentDetailService iEquipmentDetailService;
@Lazy
@Autowired
private IEquipmentService iEquipmentService;
......
......@@ -4,7 +4,6 @@ import java.io.InputStream;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
......@@ -13,14 +12,11 @@ import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.excel.ExplicitConstraint;
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.SinStaticDto;
import io.github.classgraph.json.JSONUtils;
import io.micrometer.core.instrument.util.JsonUtils;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
......@@ -34,6 +30,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
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.StringUtils;
import org.springframework.web.multipart.MultipartFile;
......@@ -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.SpecialPositionStaff;
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.DutyPersonServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyPersonShiftServiceImpl;
......@@ -193,12 +185,15 @@ public class ExcelServiceImpl {
@Autowired
private OrgUsrMapper orgUsrMapper;
@Autowired
private IDataSyncService dataSyncService;
@Value("${logic}")
Boolean logic;
@Autowired
SignServiceImpl signServiceImpl;
public void templateExport(HttpServletResponse response, ExcelDto excelDto) throws ClassNotFoundException {
String url = excelDto.getClassUrl();
Class<?> clz = Class.forName(url);
......@@ -207,7 +202,7 @@ public class ExcelServiceImpl {
}
public void commonExport(HttpServletResponse response, ExcelDto excelDto, Map par) {
// ReginParams reginParams= getCurrentAllInfo();
// boolean authFalg= false;
// if(reginParams ==null) {
......@@ -304,7 +299,7 @@ public class ExcelServiceImpl {
break;
}
String nameString =null;
Long bizCompanyId =null;
Long bizCompanyId =null;
if(par!=null && par.size()>0) {
nameString =par.containsKey("name")?par.get("name").toString():null;
bizCompanyId =par.containsKey("bizCompanyId")?Long.parseLong(par.get("bizCompanyId").toString()):null;
......@@ -940,6 +935,14 @@ public class ExcelServiceImpl {
// 保存其余项
orgUsrExcelDto.setOrgUsrId(orgUsrDto.getSequenceNbr().toString());
savePeopleItem(orgUsrExcelDto);
// 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
dataSyncService.OrgUsrSyncDtoDataSync(orgUsrDto.getSequenceNbr());
}
});
}
} catch (Exception e) {
e.printStackTrace();
......@@ -1237,7 +1240,7 @@ public class ExcelServiceImpl {
}
private void excelImportFireStation(MultipartFile multipartFile) throws Exception {
List<FireStationDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireStationDto.class, 1);
Map<String, String> maps = getAllBuildingIdForParentBuilingIds(excelDtoList);
List<FireStation> excelEntityList = new ArrayList<>();
......@@ -1570,7 +1573,7 @@ public class ExcelServiceImpl {
redisUtils.set(uuidString, 2);
}
}
}
private void ImportDutyPerson(MultipartFile multipartFile, String dutyType) throws Exception {
String fileName = multipartFile.getOriginalFilename();
......@@ -1607,7 +1610,7 @@ public class ExcelServiceImpl {
dutyFirstAidService.saveImportData(dataList);
}
}
}
private void initDutyFirstAidData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) {
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
......@@ -1660,7 +1663,7 @@ public class ExcelServiceImpl {
Map<String, Object> dutyPersonDtoMap = Bean.BeantoMap(dutyFirstAidDto);
dataList.add(dutyPersonDtoMap);
}
}
private void excelImportSafeReport(MultipartFile multipartFile) throws Exception {
......
......@@ -84,15 +84,9 @@ public class DocLibraryResource {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "知识库卡片信息")
@RequestMapping(value = "/card", method = RequestMethod.GET)
public ResponseModel<Object> queryDocCard(HttpServletRequest request,
@RequestParam(value = "offset") Integer offset,
@RequestParam(value = "end") Integer end,
@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());
public ResponseModel<Object> queryDocCard( @RequestParam(value = "id", required = false) Long id,
@RequestParam(value = "ids", required = false) List<Long> ids) {
return ResponseHelper.buildResponse(docLibraryService.queryCardList(id , ids));
}
/**
......
......@@ -29,7 +29,7 @@ public interface DocContentMapper extends BaseMapper<KnowledgeDocContent> {
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();
......
......@@ -181,13 +181,21 @@ public class DocLibraryService {
return page;
}
public Map<String,Object> queryCardList(){
List<Map<String, Object>> content = docContentService.getBaseMapper().queryDocCardList();
public Map<String,Object> queryCardList(Long id, List<Long> ids){
List<Map<String, Object>> content = docContentService.getBaseMapper().queryDocCardList(id, ids);
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);
countMap.forEach(e->resultMap.put(e.get("directoryName").toString(),e.get("num")));
return resultMap;
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;
}
......
......@@ -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.maintenance.business.feign.JCSFeignClient;
import com.yeejoin.amos.maintenance.exception.PermissionException;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
......@@ -36,6 +38,8 @@ public class PersonIdentifyAspect {
RedisUtils redisUtils;
@Autowired
JCSFeignClient jcsFeignClient;
@Value("${logic}")
Boolean logic;
@Before(value = "@annotation(com.yeejoin.amos.maintenance.core.framework.PersonIdentify) && @annotation(permission)")
......@@ -49,6 +53,12 @@ public class PersonIdentifyAspect {
throw new RuntimeException(responseModel.getDevMessage());
}
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);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
}
......
......@@ -555,9 +555,6 @@ public class InputItemController extends AbstractBaseController {
if(param.getId()>0){
if (param.getEquipmentType()==null && param.getCustomType()==null &&param.getFacilitiesType() == null&&param.getKeyPartsType() == null){
throw new BadRequest("适用类型至少需选择一项");
}
}else{
if ("1".equals(param.getEquipmentType()) && "1".equals(param.getCustomType()) &&param.getFacilitiesType() == null&&param.getKeyPartsType() == null){
throw new BadRequest("适用类型至少需选择一项");
......
......@@ -15,6 +15,7 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
......@@ -39,6 +40,8 @@ public class PersonIdentifyAspect {
@Autowired
private JcsFeignClient jcsFeignClient;
@Value("${logic}")
Boolean logic;
@Pointcut("execution(public * com.yeejoin.amos.*.business.controller..*(..))")
public void userDate() {
......@@ -69,6 +72,11 @@ public class PersonIdentifyAspect {
String s = JSONObject.toJSONString(responseModel.getResult());
ReginParams.PersonIdentity personIdentity = JSONObject.parseObject(s, 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);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
......
package com.yeejoin.amos.patrol.quartz;
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.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
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.dao.mapper.CheckInputMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.MsgMapper;
......@@ -26,6 +28,7 @@ import com.yeejoin.amos.patrol.mqtt.WebMqttComponent;
import org.quartz.Job;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -530,6 +533,11 @@ public class JobService implements IJobService {
if (PlanTaskFinishStatusEnum.NOTSTARTED.getValue() == planTask.getFinishStatus()) {
planTask.setFinishStatus(PlanTaskFinishStatusEnum.UNDERWAY.getValue());
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)) {
if (PlanTaskFinishStatusEnum.UNDERWAY.getValue() == planTask.getFinishStatus()) {
......@@ -543,6 +551,19 @@ public class JobService implements IJobService {
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
public void msgAddJob(Msg msg) {
addJob("msg", XJConstant.MESSAGE_PUSH, msg.getId(), msg.getFixedTime());
......
......@@ -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.supervision.business.feign.JCSFeignClient;
import com.yeejoin.amos.supervision.exception.PermissionException;
import org.apache.commons.lang.StringUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.ResponseBody;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.List;
import java.util.Map;
......@@ -36,6 +37,8 @@ public class PersonIdentifyAspect {
RedisUtils redisUtils;
@Autowired
JCSFeignClient jcsFeignClient;
@Value("${logic}")
Boolean logic;
@Before(value = "@annotation(com.yeejoin.amos.supervision.core.framework.PersonIdentify) && @annotation(permission)")
public void personIdentity(JoinPoint joinPoint, PersonIdentify permission) throws PermissionException {
......@@ -61,6 +64,10 @@ public class PersonIdentifyAspect {
personIdentity.setCompanyId((String) other.get("sequenceNbr"));
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);
reginParam.setPersonIdentity(personIdentity);
......
......@@ -115,7 +115,7 @@ equipment.scrap.day=30
equipment.scrap.cron=0 0 9 * * ?
# 稳压泵启动信号
equipment.pressurepump.start=FHS_PressurePump_Start
equipment.pressurepump.start=FHS_FirePump_RunStatus
# 稳压泵停止信号
equipment.pressurepump.stop=FHS_PressurePump_Stop
......
......@@ -126,4 +126,7 @@ management.security.enabled=true
management.endpoint.health.show-details=always
spring.security.user.name=admin
spring.security.user.password=a1234560
stationCode=LSHLZ1bZAJU645Pgl7
\ No newline at end of file
stationCode=LSHLZ1bZAJU645Pgl7
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
\ No newline at end of file
......@@ -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');
</sql>
</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>
\ No newline at end of file
......@@ -1419,7 +1419,7 @@
<w:sz-cs w:val="28"/>
<w:lang w:val="EN-US" w:fareast="ZH-CN"/>
</w:rPr>
<w:t>测数据</w:t>
<w:t>测数据</w:t>
</w:r>
</w:p>
</w:tc>
......
......@@ -1420,7 +1420,7 @@
<w:sz-cs w:val="28"/>
<w:lang w:val="EN-US" w:fareast="ZH-CN"/>
</w:rPr>
<w:t>测数据</w:t>
<w:t>测数据</w:t>
</w:r>
</w:p>
</w:tc>
......
......@@ -7,7 +7,7 @@
},
{
"code": "92990000",
"code": "92100000",
"index": "OilLeak,Open,Fault"
}
......
......@@ -87,4 +87,90 @@
GROUP BY equipment.code,s.id, equipment.name ORDER BY system_id, code
) a) as a1
</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>
......@@ -1323,7 +1323,7 @@
LEFT JOIN wl_equipment e ON e.id = ed.equipment_id
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,
(
SELECT COUNT(DISTINCT(esa.iot_code)) FROM wl_equipment_specific_alarm esa
......
......@@ -103,5 +103,7 @@ redis.cache.failure.time=10800
#now.gateway.address=http://172.16.10.72:10005/
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
......@@ -23,3 +23,5 @@ mybatis-plus.mapper-locations=classpath:mapper/*
redis.cache.failure.time=10800
management.endpoints.enabled-by-default=false
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
......@@ -253,70 +253,44 @@
SELECT SEQUENCE_NBR FROM knowledge_doc_content WHERE DOC_STATUS = "PUBLISHED"
</select>
<select id="queryDocCardList" resultType="map">
<select id="queryDocCardList" parameterType="map" resultType="map">
SELECT
SEQUENCE_NBR sequenceNbr,
REC_DATE recDate,
DOC_STATUS docStatus,
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
kdc.SEQUENCE_NBR id,
kdc.DOC_TITLE title,
cat.CATEGORY_NAME categoryName
FROM
knowledge_doc_content doct
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
knowledge_doc_content kdc LEFT JOIN knowledge_doc_category cat ON cat.SEQUENCE_NBR = kdc.DIRECTORY_ID
WHERE
DOC_STATUS = 'PUBLISHED'
ORDER BY
directoryName DESC,
create_time DESC
kdc.DOC_STATUS = "PUBLISHED"
<if test="id != null and id != ''">
AND cat.PARENT_ID = #{id}
</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 id="queryCardCount" resultType="map">
SELECT
( SELECT kdc.CATEGORY_NAME FROM knowledge_doc_category kdc WHERE kdc.SEQUENCE_NBR = DIRECTORY_ID ) directoryName,
COUNT(SEQUENCE_NBR) as num
SEQUENCE_NBR id,
CATEGORY_NAME categoryName,
(
SELECT
COUNT( doc.SEQUENCE_NBR )
FROM
knowledge_doc_content doc
LEFT JOIN knowledge_doc_category kdc ON kdc.SEQUENCE_NBR = doc.DIRECTORY_ID
WHERE
kdc.PARENT_ID = k.SEQUENCE_NBR
) num
FROM
knowledge_doc_content doct
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" ) favor ON doct.SEQUENCE_NBR = favor.ENTITY_ID
knowledge_doc_category k
WHERE
DOC_STATUS = 'PUBLISHED'
GROUP BY DIRECTORY_ID
PARENT_ID = 0
</select>
</mapper>
......
......@@ -65,3 +65,5 @@ Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 消防救援保障部ID
fire-rescue=1432549862557130753
management.endpoints.enabled-by-default=false
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
......@@ -67,4 +67,7 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
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
management.endpoints.enabled-by-default=false
\ No newline at end of file
management.endpoints.enabled-by-default=false
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
......@@ -50,7 +50,7 @@ amosRefresh.patrol.topic =patrolCheckInsert
patrol.point.classify.topic=patrol/point/classify
patrol.topic=patrol/#
#停止通过WEB公开所有端点
management.endpoints.web.exposure.exclude=*
#management.endpoints.web.exposure.exclude=*
## redis失效时间
redis.cache.failure.time=10800
......@@ -61,7 +61,7 @@ rule.definition.default-agency=STATE_GRID
jcs.fegin.name=JCS
emergency.command.section.id=1418223840361709569
management.endpoints.enabled-by-default=false
#management.endpoints.enabled-by-default=false
equipment.hierarchy=1,2,4,6
......
......@@ -83,7 +83,7 @@
<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="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="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if>
<if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if>
......@@ -292,7 +292,7 @@
<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="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="planTaskId!=null">and a.plan_task_id = #{planTaskId}</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"
#server.ssl.key-store-type=JKS
login.environment=dev
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
......@@ -73,4 +73,7 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
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
management.endpoints.enabled-by-default=false
\ No newline at end of file
management.endpoints.enabled-by-default=false
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
......@@ -5,3 +5,5 @@ spring.profiles.active=dev
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.serialization.write-dates-as-timestamps=true
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
......@@ -6,3 +6,5 @@ spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.serialization.write-dates-as-timestamps=true
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
......@@ -35,3 +35,7 @@ spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
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