Commit 7489f784 authored by tangwei's avatar tangwei

Merge branch 'developer' into develop_ccs

# Conflicts: # amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/FireFightingSystemEntity.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentDetailServiceImpl.java # amos-boot-system-equip/src/main/resources/application-dev.properties 解决冲突
parents a1b49703 ce5d62c6
......@@ -845,4 +845,14 @@ public class DateUtils {
time = String.format(time, h, m, s);
return time;
}
public static Date getTargetEndTime(Date target) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(target);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
Date end = calendar.getTime();
return end;
}
}
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 设备告警月统计
*
* @author system_generator
* @date 2022-01-16
*/
@Data
@Accessors(chain = true)
@TableName("wl_analysis_report_month")
public class AnalysisReportMonth {
private static final long serialVersionUID = 1L;
/**
* 系统id
*/
@TableField("system_id")
private Long systemId;
/**
* 总数量
*/
@TableField("num")
private Integer num;
/**
* 装备定义编码
*/
@TableField("equipment_code")
private String equipmentCode;
/**
*
*/
@TableField("equipment_name")
private String equipmentName;
/**
* 报告所在年月
*/
@TableField("report_month")
private String reportMonth;
/**
* 故障设备数量
*/
@TableField("fault_equip_num")
private Integer faultEquipNum;
/**
* 故障信息条数
*/
@TableField("fault_info_num")
private Integer faultInfoNum;
/**
* 告警设备数量
*/
@TableField("alarm_equip_num")
private Integer alarmEquipNum;
/**
* 告警信息条数
*/
@TableField("alarm_info_num")
private Integer alarmInfoNum;
/**
* 总信息数量
*/
@TableField("total_info_num")
private Integer totalInfoNum;
/**
* 创建时间
*/
@TableField("create_date")
private Date createDate;
}
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 总结报告
*
* @author system_generator
* @date 2022-01-16
*/
@Data
@Accessors(chain = true)
@TableName("wl_analysis_report_summary")
public class AnalysisReportSummary {
private static final long serialVersionUID = 1L;
/**
* 系统id
*/
@TableField("system_id")
private Long systemId;
/**
* 系统名称
*/
@TableField("system_name")
private String systemName;
/**
* 报告类型
*/
@TableField("report_type")
private String reportType;
/**
* 报告日期
*/
@TableField("report_date")
private Date reportDate;
/**
* 总结信息
*/
@TableField("summary_info")
private String summaryInfo;
/**
* 创建时间
*/
@TableField("create_date")
private Date createDate;
}
......@@ -123,9 +123,14 @@ public class FireFightingSystemEntity {
@ApiModelProperty("系统类型编码")
private String systemTypeCode;
@ApiModelProperty("机构/部门名称")
private String bizOrgName;
@ApiModelProperty("机构编码")
private String bizOrgCode;
@ApiModelProperty(value = "分析报告统计用参数(为空不统计) ")
private String analysisIndexKey;
}
......@@ -126,8 +126,6 @@ public class CarController extends AbstractBaseController {
private String appKeyApp;
@Value("${iot.vehicle.track}")
private String iotServerName;
@Value("${fileserver_domain}")
private String fileServer;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
......@@ -593,7 +591,7 @@ public class CarController extends AbstractBaseController {
for (Map<String, Object> map : list) {
String img = (String) map.get("img");
if (img != null && !"".equals(img)) {
map.put("img", fileServer + img);
map.put("img", img);
}
}
}
......@@ -848,7 +846,7 @@ public class CarController extends AbstractBaseController {
mape.put("brand", brand);
listdate = equipmentCategoryMapper.getEquipmentCount(mape);
for (Map<String, Object> map : listdate) {
map.put("img", fileServer + map.get("img"));
map.put("img", map.get("img"));
Object amount = map.get("amount");
String unit = map.get("unit").toString();
if (ercode.substring(0, 1).equals("4")) {
......@@ -892,7 +890,7 @@ public class CarController extends AbstractBaseController {
amount = amount + utname;
}
map.put("amount", amount);
map.put("img", fileServer + map.get("img"));
map.put("img", map.get("img"));
}
return listdate;
} catch (Exception e) {
......
......@@ -53,9 +53,6 @@ public class ManufacturerInfoController {
@Autowired
ISystemDicService iSystemDicService;
@Value("${fileserver_domain}")
private String fileServer;
/**
* 新增
*
......@@ -66,9 +63,6 @@ public class ManufacturerInfoController {
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ManufacturerInfo saveManufacturerInfo(HttpServletRequest request,
@RequestBody ManufacturerInfo manufacturerInfo) {
if (!ObjectUtils.isEmpty(manufacturerInfo.getImg()) && manufacturerInfo.getImg().contains(fileServer)) {
manufacturerInfo.setImg(manufacturerInfo.getImg().replace(fileServer, ""));
}
if (!ObjectUtils.isEmpty(manufacturerInfo.getCountryId())) {
SystemDic byId = iSystemDicService.getByIdforAll(manufacturerInfo.getCountryId());
manufacturerInfo.setCountry(byId.getName());
......@@ -113,9 +107,6 @@ public class ManufacturerInfoController {
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean updateByIdManufacturerInfo(HttpServletRequest request,
@RequestBody ManufacturerInfo manufacturerInfo) {
if (!ObjectUtils.isEmpty(manufacturerInfo.getImg()) && manufacturerInfo.getImg().contains(fileServer)) {
manufacturerInfo.setImg(manufacturerInfo.getImg().replace(fileServer, ""));
}
if (!ObjectUtils.isEmpty(manufacturerInfo.getCountryId())) {
SystemDic byId = iSystemDicService.getByIdforAll(manufacturerInfo.getCountryId());
manufacturerInfo.setCountryId(manufacturerInfo.getCountryId());
......@@ -150,9 +141,6 @@ public class ManufacturerInfoController {
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ManufacturerInfo selectById(HttpServletRequest request, @PathVariable Long id) {
ManufacturerInfo manufacturerInfo = iManufacturerInfoService.getById(id);
if (!ObjectUtils.isEmpty(manufacturerInfo.getImg())) {
manufacturerInfo.setImg(fileServer + manufacturerInfo.getImg());
}
return manufacturerInfo;
}
......
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.AnalysisReportMonth;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 设备告警月统计 Mapper 接口
*
* @author system_generator
* @date 2022-01-16
*/
public interface AnalysisReportMonthMapper extends BaseMapper<AnalysisReportMonth> {
/**
* 插入月分析列表数据
* @param suffix 指标信息
* @param beginDate 开始日期
* @param endDate 结束日期
* @param systemId 系统id
*/
void insertSystemMonthData(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId);
}
package com.yeejoin.equipmanage.mapper;
import com.yeejoin.equipmanage.common.entity.AnalysisReportSummary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 总结报告 Mapper 接口
*
* @author system_generator
* @date 2022-01-16
*/
public interface AnalysisReportSummaryMapper extends BaseMapper<AnalysisReportSummary> {
/**
* 插入月总结信息
* @param suffix 指标参数
* @param beginDate 开始日期
* @param endDate 结束日期
* @param systemId 系统id
*/
void insertSystemMonthSummaryData(@Param("indexKeySuffix") List<String> suffix, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("systemId") Long systemId);
}
......@@ -50,6 +50,6 @@ public class AnalysisReportSchedulerJob {
Date yestDay = DateUtils.dateAdd(new Date(),-1,false);
Date beginDate = DateUtils.getFirstDayOfMonth(yestDay);
Date endDate = DateUtils.getLastDayOfMonth(yestDay);
iAnalysisReportLogService.generateReport(AnalysisReportEnum.MONTH_REPORT,beginDate,endDate);
iAnalysisReportLogService.generateMonthReport(AnalysisReportEnum.MONTH_REPORT,beginDate,endDate);
}
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import java.text.ParseException;
import java.util.Date;
/**
......@@ -27,4 +28,11 @@ public interface IAnalysisReportLogService extends IService<AnalysisReportLog> {
* @param endDate 结束日期
*/
void generateReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate);
/** 月报表生成
* @param monthReport 报告类型
* @param beginDate 开始日期
* @param endDate 结束日期
*/
void generateMonthReport(AnalysisReportEnum monthReport, Date beginDate, Date endDate) throws ParseException;
}
......@@ -5,14 +5,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.mapper.AnalysisReportLogMapper;
import com.yeejoin.equipmanage.mapper.AnalysisReportMonthMapper;
import com.yeejoin.equipmanage.mapper.AnalysisReportSummaryMapper;
import com.yeejoin.equipmanage.service.IAnalysisReportLogService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Calendar;
import java.util.Date;
import java.text.ParseException;
import java.util.*;
/**
* 报告流水表 服务实现类
......@@ -23,6 +30,16 @@ import java.util.Date;
@Service
public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogMapper, AnalysisReportLog> implements IAnalysisReportLogService {
@Autowired
IFireFightingSystemService fireFightingSystemService;
@Autowired
AnalysisReportMonthMapper analysisReportMonthMapper;
@Autowired
AnalysisReportSummaryMapper analysisReportSummaryMapper;
@Override
public IPage<AnalysisReportLog> listPage(Page page, AnalysisReportLog analysisReportLog) {
......@@ -39,12 +56,35 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
@Override
public void generateReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) {
this.saveAnalysisReportLog(reportEnum, beginDate, endDate);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void generateMonthReport(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) 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.insertSystemMonthData(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId());
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(Arrays.asList(f.getAnalysisIndexKey().split(","))), beginDateStr, endDateStr, f.getId());
});
}
private void saveAnalysisReportLog(AnalysisReportEnum reportEnum, Date beginDate, Date endDate) {
AnalysisReportLog reportLog = new AnalysisReportLog();
reportLog.setName(reportEnum.getName());
reportLog.setReportType(reportEnum.getType());
reportLog.setStartDate(beginDate);
reportLog.setEndDate(endDate);
reportLog.setReportDateDesc(buildReportDateDesc(reportEnum,beginDate,endDate));
reportLog.setReportDateDesc(buildReportDateDesc(reportEnum, beginDate, endDate));
this.save(reportLog);
}
......@@ -52,7 +92,7 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
StringBuilder desc = new StringBuilder();
Calendar calendar = Calendar.getInstance();
calendar.setTime(beginDate);
switch (reportEnum){
switch (reportEnum) {
case DAY_REPORT:
desc.append(calendar.get(Calendar.YEAR));
desc.append("年");
......
......@@ -116,8 +116,6 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
@Autowired
@Lazy
private IEquipmentIndexService equipmentIndexService;
@Value("${fileserver_domain}")
private String fileServer;
@Autowired
private IManufacturerInfoService iManufacturerInfoService;
@Autowired
......@@ -1075,7 +1073,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
Equipment equipment = iEquipmentService.getById(carOne.getEquipmentId());
String utilName = carMapper.getUtilName(equipment.getUnitId());
carOne.setUnitName(utilName);
equipment.setImg(fileServer + equipment.getImg());
equipment.setImg(equipment.getImg());
carOne.setEquipment(equipment);
carOne.setCarState(CarStatusEnum.getEnum(carOne.getCarState().toString()).getName());
}
......@@ -1216,9 +1214,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
return new ArrayList<UploadFile>();
}
list.forEach(item -> {
if (item.getUrl().contains(fileServer)) {
item.setUrl(item.getUrl().replace(fileServer, ""));
}
item.setUrl(item.getUrl());
item.setFileType(type);
item.setObjectType(BillContentEnum.CL.getKey());
item.setObjectId(id);
......@@ -1319,7 +1315,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
car.setCarPropertyList(carPropertyList);
ManufacturerInfo manufacturerInfo = iManufacturerInfoService.getById(car.getManufacturerId());
manufacturerInfo.setImg(fileServer + manufacturerInfo.getImg());
manufacturerInfo.setImg(manufacturerInfo.getImg());
car.setManufacturerInfo(manufacturerInfo);
car.setImg(getCarFileList(id, FileTypeEnum.image.toString()));
car.setVideo(getCarFileList(id, FileTypeEnum.video.toString()));
......@@ -1348,7 +1344,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
Map<String, List<CarIndexVo>> map = carVoList.stream().collect(Collectors.groupingBy(vo -> vo.getName()));
car.setExt(JSONObject.toJSONString(map));
ManufacturerInfo manufacturerInfo = iManufacturerInfoService.getById(car.getManufacturerId());
manufacturerInfo.setImg(fileServer + manufacturerInfo.getImg());
manufacturerInfo.setImg(manufacturerInfo.getImg());
car.setManufacturerInfo(manufacturerInfo);
car.setImg(getCarFileList(id, FileTypeEnum.image.toString()));
Equipment equipment = iEquipmentService.getById(car.getEquipmentId());
......@@ -1375,7 +1371,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
Map<String, List<CarIndexVo>> map = carVoList.stream().collect(Collectors.groupingBy(vo -> vo.getName()));
car.setExt(JSONObject.toJSONString(map));
ManufacturerInfo manufacturerInfo = iManufacturerInfoService.getById(car.getManufacturerId());
manufacturerInfo.setImg(fileServer + manufacturerInfo.getImg());
manufacturerInfo.setImg(manufacturerInfo.getImg());
car.setManufacturerInfo(manufacturerInfo);
car.setImg(getCarFileList(car.getId(), FileTypeEnum.image.toString()));
Equipment equipment = iEquipmentService.getById(car.getEquipmentId());
......@@ -1394,7 +1390,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
List<UploadFile> list = iUploadFileService.list(new QueryWrapper<UploadFile>().eq("object_id", id)
.eq("object_type", BillContentEnum.CL.getKey()).eq("file_type", type));
list.forEach(item -> {
item.setUrl(fileServer + item.getUrl());
item.setUrl(item.getUrl());
});
return list;
}
......
......@@ -65,7 +65,6 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
@Autowired
private IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce;
@Autowired
JCSRemoteService jcsRemoteService;
@Value("${fileserver_domain}")
......@@ -74,6 +73,7 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
@Value("${auth-key-fire-equip:fire_equip_info}")
private String authKey;
@Autowired
private ISystemDicService iSystemDicService;
......@@ -91,9 +91,7 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
return new ArrayList<>();
}
list.forEach(item -> {
if (item.getUrl().contains(fileServer)) {
item.setUrl(item.getUrl().replace(fileServer, ""));
}
item.setUrl(item.getUrl());
item.setFileType(type);
item.setObjectType(BillContentEnum.ZB.getKey());
item.setObjectId(id);
......@@ -144,7 +142,7 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
List<UploadFile> list = iUploadFileService.list(new QueryWrapper<UploadFile>().eq("object_id", id)
.eq("object_type", BillContentEnum.ZB.getKey()).eq("file_type", type));
list.forEach(item -> {
item.setUrl(fileServer + item.getUrl());
item.setUrl(item.getUrl());
});
return list;
}
......
......@@ -37,13 +37,6 @@ import java.util.Map;
@Service
public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMapper, EquipmentManageEntity> implements EquipmentManageService {
/**
* 文件服务器地址
*/
@Value("${fileserver_domain}")
private String ipUrl;
@Autowired
EquipmentManageMapper equipmentManageMapper;
......@@ -275,7 +268,7 @@ public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMappe
response.setHeader("Access-Control-Allow-Origin", "*");
response.setContentType("multipart/form-data");
try {
InputStream inputStream = getInputStreamFromURL(ipUrl + vo.getUrl());
InputStream inputStream = getInputStreamFromURL(vo.getUrl());
//3.通过response获取ServletOutputStream对象(out)
out = response.getOutputStream();
......
......@@ -57,13 +57,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
private PatrolFeign patrolFeign;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Value("${fileserver_domain}")
private String fileServer;
@Autowired
private IEquipmentDetailService iEquipmentDetailService;
@Value("${fileserver_domain}")
private String fileUrl;
// 装备分类code长度
private static final int CATECODELEN = 8;
private String proviceCode = "44";
......@@ -339,7 +335,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
imgQueryWrapper.eq("file_type", "image");
List<UploadFile> uploadFiles = uploadFileMapper.selectList(imgQueryWrapper);
for (UploadFile s : uploadFiles) {
s.setUrl(fileServer + s.getUrl());
s.setUrl(s.getUrl());
}
equipmentBaseApp.setImg(uploadFiles);
equipmentApp.setEquipmentBase(equipmentBaseApp);
......@@ -349,7 +345,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
excelQueryWrapper.eq("file_type", "instruction");
List<UploadFile> uploadFiles1 = uploadFileMapper.selectList(excelQueryWrapper);
for (UploadFile s : uploadFiles1) {
s.setUrl(fileServer + s.getUrl());
s.setUrl(s.getUrl());
}
equipmentApp.setExcel(uploadFiles1);
//性能指标,带指标值
......@@ -424,7 +420,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
images.forEach(a -> {
String picture = a.getPicture();
if (StringUtils.isNotEmpty(picture)) {
a.setPicture(fileUrl + picture);
a.setPicture(picture);
}
});
}
......
......@@ -89,9 +89,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
@Autowired
private IVideoService videoService;
@Value("${fileserver_domain}")
private String fileServer;
@Override
public void handleExport(HttpServletResponse response, List<Long> ids, String alarmType) {
CommonPageInfoParam param = new CommonPageInfoParam();
......@@ -469,7 +466,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
alarmDataVO5.setKey(EquipmentDataEnum.XT.getName());
alarmDataVO5.setValue(StringUtil.isNotEmpty(sourceData.get("systemName")) ? sourceData.get("systemName").toString() : null);
lists.add(alarmDataVO5);
alarmEquipMockDataVO.setPic(StringUtil.isNotEmpty(sourceData.get("imgUrl")) ? fileServer + sourceData.get("imgUrl") : null);
alarmEquipMockDataVO.setPic(StringUtil.isNotEmpty(sourceData.get("imgUrl")) ? sourceData.get("imgUrl").toString() : null);
alarmEquipMockDataVO.setAlarmCount(count);
alarmEquipMockDataVO.setQrcode(StringUtil.isNotEmpty(sourceData.get("qrCode")) ? sourceData.get("qrCode").toString() : null);
alarmEquipMockDataVO.setDetailUrl(null);
......
......@@ -121,9 +121,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
@Value("${fileserver_domain}")
private String fileServer;
@Value("${equipment.filter.code}")
private String codes;
......@@ -384,9 +381,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return new ArrayList<UploadFile>();
}
list.forEach(item -> {
if (item.getUrl().contains(fileServer)) {
item.setUrl(item.getUrl().replace(fileServer, ""));
}
item.setUrl(item.getUrl());
item.setId(sequence.nextId());
item.setFileType(type);
item.setObjectType(BillContentEnum.ZB.getKey());
......
......@@ -301,6 +301,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
BeanUtils.copyProperties(equipmentSpecificIndex, equipmentSpeIndex);
String value = iotDataVO.getValue().toString();
equipmentSpeIndex.setValue(value);
equipmentSpeIndex.setUpdateDate(new Date());
equipmentSpecificIndex.setValue(value);
String enumStr = equipmentSpecificIndex.getValueEnum();
if (!ObjectUtils.isEmpty(enumStr)) {
......
......@@ -94,8 +94,6 @@ public class QREquipmentDefServiceImpl implements IQRCodeService<ScanResult<QREq
private IStockDetailService stockDetailService;
@Autowired
private UploadFileMapper uploadFileMapper;
@Value("${fileserver_domain}")
private String fileUrl;
@Autowired
IEquipmentService iEquipmentService;
......@@ -269,7 +267,7 @@ public class QREquipmentDefServiceImpl implements IQRCodeService<ScanResult<QREq
ParsePropertyUtil.setting(info::setCarNum, car::getCarNum);
ParsePropertyUtil.setting(info::setEquipmentId, car::getEquipmentId);
ParsePropertyUtil.setting(info::setEquipName, equipment::getName);
info.setImg(fileUrl+img);
info.setImg(img);
// ParsePropertyUtil.setting(info::setImg, () -> {
// if(car.getImg().size()>0){
// if (StringUtil.isNotEmpty(car.getImg().get(0).getUrl())) {
......
......@@ -126,9 +126,6 @@ public class QREquipmentKnowledgeServiceImpl implements IQRCodeService<ScanResul
private IEquipmentSpecificSerivce equipmentSpecificSerivce;
@Autowired
private IStockDetailService iStockDetailService;
@Value("${fileserver_domain}")
private String fileUrl;
public ScanResult<QREquipResponse> scan(QRCodeRequest request) throws RuntimeException {
try {
......@@ -377,7 +374,7 @@ public class QREquipmentKnowledgeServiceImpl implements IQRCodeService<ScanResul
}
});
String img = iEquipmentService.getById(equipmentDetail.getEquipmentId()).getImg();
info.setImg(fileUrl+img);
info.setImg(img);
// ParsePropertyUtil.setting(info::setImg, () -> {
// if(equipmentDetail.getVideo()!=null && equipmentDetail.getVideo().size() != 0){
// if (null != equipmentDetail.getImg().get(0).getUrl()) {
......
......@@ -31,7 +31,7 @@ public class RuleConfirmAlarmService {
* 警情确认
*/
public Boolean confirmAlam(IotSystemAlarmRo iotSystemAlarmRo, String appKey, String product, String token) throws Exception {
iotSystemAlarmRo.setCategory(1);
iotSystemAlarmRo.setCategory(2); // 系统消息
iotSystemAlarmRo.setRelationId(String.valueOf(iotSystemAlarmRo.getId()));
iotSystemAlarmRo.setTerminal("WEB");
iotSystemAlarmRo.setMsgType(msgType);
......
......@@ -43,9 +43,6 @@ public class ScrapDetailServiceImpl extends ServiceImpl<ScrapDetailMapper, Scrap
@Autowired
private ScrapMapper scrapMapper;
@Value("${fileserver_domain}")
private String fileServer;
@Override
public ScrapDetail getOneById(Long id) {
ScrapDetail scrapDetail = getById(id);
......@@ -68,14 +65,14 @@ public class ScrapDetailServiceImpl extends ServiceImpl<ScrapDetailMapper, Scrap
scrapDetail.setStockDetail(stockDetail);
String img = equipmentDetail.getEquipment().getImg();
if (img !=null && !"".equals(img)){
scrapDetail.setImg(fileServer+img);
scrapDetail.setImg(img);
}
} else if (scrapDetail.getCarId() != null) {
Car car = iCarService.getById(scrapDetail.getCarId());
scrapDetail.setCar(car);
String img = scrapMapper.getImgById(scrapDetail.getScrapId(), "2");
if (img != null && !"".equals(img)) {
scrapDetail.setImg(fileServer+img);
scrapDetail.setImg(img);
}
}
......
......@@ -61,9 +61,6 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements
@Autowired
private EquipmentOnCarMapper equipmentOnCarMapper;
@Value("${fileserver_domain}")
private String fileServer;
@Override
public Scrap create(List<ScrapDetail> list, String type, AgencyUserModel agencyUserModel) {
this.scrapCheck(type, list);
......@@ -267,7 +264,7 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements
String type = scrap.getBillType();
String img = scrapMapper.getImgById(scrap.getId(), type);
if (img != null && !"".equals(img)) {
scrap.setImg(fileServer + img);
scrap.setImg(img);
}
List<Map<String, Object>> list = scrapDetailService.geteqTypeAndAmount(scrap.getId());
if (0 < list().size()) {
......
......@@ -51,9 +51,6 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
@Autowired
private StockDetailMapper stockDetailMapper;
@Value("${fileserver_domain}")
private String fileServer;
@Override
public Page<StockDetail> pageCategoryStock(Page<EquipmentDetail> pageBean, String category,
Long warehouseStructureId) {
......@@ -73,7 +70,7 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
stockDetail.setEquipmentDetail(equipmentDetail);
String img = equipmentDetail.getEquipment().getImg();
if (img != null && !"".equals(img)) {
stockDetail.setImg(fileServer + img);
stockDetail.setImg(img);
}
stockDetailList.add(stockDetail);
}
......@@ -122,7 +119,7 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
stockDetail.setEquipmentDetail(equipmentDetail);
String img = equipmentDetail.getEquipment().getImg();
if (img != null && !"".equals(img)) {
stockDetail.setImg(fileServer + img);
stockDetail.setImg(img);
}
}
return page;
......
......@@ -37,7 +37,7 @@ public class LatentDangerDto {
/**
* 创建隐患的业务id(p_check_input)
*/
private Long bizId = 0L;
private Long bizId;
/**
* 建筑id
......
......@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
......@@ -242,7 +243,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (ValidationUtil.isEmpty(dangerTypeEnum)) {
throw new Exception("检查类型参数有误");
}
Date endTime = this.GetTargetEndTime(param.getReformLimitDate());
Date endTime = DateUtils.getTargetEndTime(param.getReformLimitDate());
param.setReformLimitDate(endTime);
// 保存隐患
LatentDanger latentDanger = saveLatentDanger(param, userId, departmentId, businessKey, orgCode,
......@@ -318,16 +319,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
// riskFactorMapper.updateControlStatus(riskFactorBo);
// }
public static Date GetTargetEndTime(Date target) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(target);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
Date end = calendar.getTime();
return end;
}
// TODO 使用远程调用替换
private void updateCheckInputDangerState(Long id, int code) {
latentDangerMapper.updateCheckInputDangerState(id, code);
......@@ -2206,10 +2197,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
throw new Exception("隐患不存");
}
latentDangerDto.setDangerPosition(null);
//以下方法存在bug会将数值类型的默认值0拷贝到对象上造成数据覆盖
//Bean.copyExistPropertis(latentDangerDto, latentDanger);
latentDanger.setId(latentDangerDto.getId());
latentDanger.setFlowJson(latentDangerDto.getFlowJson());
Bean.copyExistPropertis(latentDangerDto, latentDanger);
if (!ValidationUtil.isEmpty(latentDangerDto.getPhotoUrl())) {
latentDanger.setPhotoUrls(Joiner.on(",").join(latentDangerDto.getPhotoUrl()));
......@@ -2235,9 +2223,13 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (!executeSubmitDto.getIsOk()) {
throw new Exception(executeSubmitDto.getMsg());
}
sendSubmitMessage(executeType, latentDanger, executeSubmitDto);
return executeSubmitDto;
}
public void sendSubmitMessage(Integer executeType, LatentDanger latentDanger, DangerExecuteSubmitDto executeSubmitDto) throws Exception {
List<String> userIds = workflowExecuteService.getUserIdsByWorkflow(latentDanger.getInstanceId(), executeSubmitDto.getCheckLeaderId());
ruleDangerService.addDangerSubmitRule(latentDanger, userIds, RuleTypeEnum.隐患审核.getCode(), ExecuteTypeEnum.getNameByCode(executeType));
return executeSubmitDto;
}
@Override
......
......@@ -17,6 +17,7 @@ import com.yeejoin.amos.latentdanger.common.enums.LatentDangerState;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -87,6 +88,9 @@ public class RuleDangerService {
latentDangerRo.setIsSendWeb(true);
latentDangerRo.setRecivers(userIds);
latentDangerRo.setTerminal(RuleConstant.APP_WEB);
if (ValidationUtil.isEmpty(userIds)) {
return false;
}
//触发规则
ruleTrigger.publish(latentDangerRo, packageId, new String[0]);
return true;
......
......@@ -58,7 +58,6 @@ public class RulePlanService {
@Autowired
private PointServiceImpl pointService;
@Async
public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, Long pointId) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, pointId);
//触发规则
......@@ -66,7 +65,6 @@ public class RulePlanService {
return true;
}
@Async
public Boolean addPlanAuditRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, String excuteStateName) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, null);
planRo.setExcuteStateName(excuteStateName);
......@@ -77,12 +75,12 @@ public class RulePlanService {
private PlanRo buildPlanRo(Plan plan, List<String> userIds, RuleTypeEnum ruleType, Long pointId) {
// 设置token
if (ValidationUtil.isEmpty(RequestContext.getToken())) {
Toke tokenObj = remoteSecurityService.getServerToken();
RequestContext.setProduct(tokenObj.getProduct());
RequestContext.setAppKey(tokenObj.getAppKey());
RequestContext.setToken(tokenObj.getToke());
}
// if (ValidationUtil.isEmpty(RequestContext.getToken())) {
// Toke tokenObj = remoteSecurityService.getServerToken();
// RequestContext.setProduct(tokenObj.getProduct());
// RequestContext.setAppKey(tokenObj.getAppKey());
// RequestContext.setToken(tokenObj.getToke());
// }
PlanRo planRo = new PlanRo();
BeanUtils.copyProperties(plan, planRo);
......@@ -116,7 +114,6 @@ public class RulePlanService {
userIds = (List<String>) jcsFeignClient.getAmosIdListByUserIds(leadPeopleIds).getResult();
// pointId是被检查单位id
if (!ValidationUtil.isEmpty(pointId)) {
List<String> userIdList = Lists.newArrayList();
Point point = pointService.queryPointById(pointId);
List<OrgUsrFormDto> personList =
jcsFeignClient.getPersonListByCompanyId(point.getOriginalId()).getResult();
......
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.6.60:3306/xiy_amos_satety_business?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=root_123
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.minimum-idle= 3
......@@ -12,6 +14,7 @@ spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 60000
spring.datasource.hikari.connection-test-query= SELECT 1
# \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
fileserver_domain=http://39.98.45.134:9000/
......
......@@ -12,9 +12,6 @@ spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000
spring.datasource.hikari.connection-test-query= SELECT 1
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
......
......@@ -17,8 +17,6 @@ fdfs.connect-timeout=601
fdfs.thumb-image.height=200
fdfs.thumb-image.width=200
fdfs.tracker-list[0]=39.98.246.31:22122
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.10.72
eureka.instance.prefer-ip-address = true
......
......@@ -12,9 +12,6 @@ spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000
spring.datasource.hikari.connection-test-query= SELECT 1
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
......
......@@ -12,9 +12,6 @@ spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000
spring.datasource.hikari.connection-test-query= SELECT 1
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
......
......@@ -2298,4 +2298,73 @@
ALTER TABLE wl_equipment ADD COLUMN clean_type varchar(50) DEFAULT NULL COMMENT '警情消除方式(0:收到复位信号自动消除;1:警情处理确认后消除)';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-1">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_analysis_report_month"/>
</not>
</preConditions>
<comment>create table wl_analysis_report_month 分析报告用</comment>
<sql>
CREATE TABLE `wl_analysis_report_month` (
`system_id` bigint DEFAULT NULL COMMENT '系统id',
`num` int DEFAULT NULL COMMENT '总数量',
`equipment_code` varchar(255) DEFAULT NULL COMMENT '装备定义编码',
`equipment_name` varchar(255) DEFAULT NULL,
`report_month` varchar(255) DEFAULT NULL COMMENT '报告所在年月',
`fault_equip_num` int DEFAULT NULL COMMENT '故障设备数量',
`fault_info_num` int DEFAULT NULL COMMENT '故障信息条数',
`alarm_equip_num` int DEFAULT NULL COMMENT '告警设备数量',
`alarm_info_num` int DEFAULT NULL COMMENT '告警信息条数',
`total_info_num` int DEFAULT NULL COMMENT '总信息数量',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
UNIQUE KEY `uk_system_id_report_month_equipment_code` (`system_id`,`equipment_code`,`report_month`) USING BTREE,
KEY `idx_report_month` (`report_month`) USING BTREE
) ENGINE=InnoDB COMMENT='设备告警月统计';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-2">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_analysis_report_summary"/>
</not>
</preConditions>
<comment>create table wl_analysis_report_summary 分析报告用</comment>
<sql>
CREATE TABLE `wl_analysis_report_summary` (
`system_id` bigint DEFAULT NULL COMMENT '系统id',
`system_name` varchar(255) DEFAULT NULL COMMENT '系统名称',
`report_type` varchar(255) DEFAULT NULL COMMENT '报告类型',
`report_date` date DEFAULT NULL COMMENT '报告日期',
`summary_info` varchar(500) DEFAULT NULL COMMENT '总结信息',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
UNIQUE KEY `uk_system_id_report_type_report_date` (`system_id`,`report_type`,`report_date`),
KEY `idx_systemid_report_type` (`system_id`,`report_type`) USING BTREE
) ENGINE=InnoDB COMMENT='总结报告';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-3">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_fire_fighting_system" columnName="analysis_index_key"/>
</not>
</preConditions>
<comment>f_fire_fighting_system add column analysis_index_key 分析报告用</comment>
<sql>
ALTER TABLE f_fire_fighting_system ADD COLUMN `analysis_index_key` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分析报告统计用参数(为空不统计)';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1642465149617-4">
<preConditions onFail="MARK_RAN">
<columnExists tableName="f_fire_fighting_system" columnName="analysis_index_key"/>
</preConditions>
<comment>f_fire_fighting_system 更新 analysis_index_key 分析报告统计用</comment>
<sql>
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Open,OilLeak' WHERE (`code`='029026401813010000000030');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='FireAlarm,Fault,Shield' WHERE (`code`='029026401813010000000016');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Alarm,Abnormal' WHERE (`code`='029026401813010000000023');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='Fault,Shield,FireAlarm' WHERE (`code`='029026401813010000000047');
UPDATE `f_fire_fighting_system` SET `analysis_index_key`='FireAlarm,Fault,Shield,State' WHERE (`code`='029026401813010000000054');
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.AnalysisReportMonthMapper">
<insert id="insertSystemMonthData">
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(NOW(),'%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>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.AnalysisReportSummaryMapper">
<insert id="insertSystemMonthSummaryData">
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(IFNULL(f1.normalEquipNumPercent,0)*100,'%'),',',
'同比上月',IF(IFNULL(f1.totalNormalEquipNum,0)- IFNULL(f1.lastMonthTotalNormalEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalNormalEquipNum,0) = 0 ,'---',CONCAT(round(IFNULL(f1.totalNormalEquipNum,0)/f1.lastMonthTotalNormalEquipNum -1,2)* 100,'%')),',',CHAR(10)),
CONCAT('故障设备',IFNULL(f1.totalFaultEquipNum,0),'台,','故障率:',concat(ROUND(IFNULL(f1.faultEquipPercent,0),2)*100,'%'),',',
'同比上月',IF(IFNULL(f1.totalFaultEquipNum,0)- IFNULL(f1.lastMonthTotalFaultEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalFaultEquipNum,0) = 0 ,'---',CONCAT(round(IFNULL(f1.totalFaultEquipNum,0)/f1.lastMonthTotalFaultEquipNum -1,2)* 100,'%')),',',CHAR(10)),
CONCAT('告警设备',IFNULL(f1.totalAlarmEquipNum,0),'台,',
'同比上月',IF(IFNULL(f1.totalAlarmEquipNum,0)- IFNULL(f1.lastMonthTotalAlarmEquipNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmEquipNum,0) = 0 ,'---',CONCAT(round(IFNULL(f1.totalAlarmEquipNum,0)/f1.lastMonthTotalAlarmEquipNum -1,2)* 100,'%')),',',CHAR(10)),
CONCAT('告警总数',IFNULL(f1.totalAlarmInfoNum,0),'条,',
'同比上月',IF(IFNULL(f1.totalAlarmInfoNum,0)- IFNULL(f1.lastMonthTotalAlarmInfoNum,0) >0 ,'增加','减少'),
if(IFNULL(f1.lastMonthTotalAlarmInfoNum,0) = 0 ,'---', CONCAT(round(IFNULL(f1.totalAlarmInfoNum,0)/f1.lastMonthTotalAlarmInfoNum -1,2)* 100,'%'))
,'。')) 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,
if(sum(num) > 0,ROUND(sum(normalEquipNum)/sum(num),2), '-') as normalEquipNumPercent,
if(sum(num) > 0,ROUND(sum(faultEquipNum)/sum(num),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>
</mapper>
......@@ -959,7 +959,15 @@
pld.business_key = #{businessKey}
</select>
<select id="selectPageByParam" resultType="com.yeejoin.amos.latentdanger.dao.entity.LatentDanger">
select * from p_latent_danger a
select
*,
CASE
WHEN a.reform_limit_date <![CDATA[ < ]]> NOW() THEN
1
ELSE
0
END as overtimeState
from p_latent_danger a
<where>
deleted = 0
<foreach collection="paramMap" index="key" item="value">
......
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