Commit 6fb35e2c authored by maoying's avatar maoying

Merge branch 'develop_dl_plan6' into develop_dl_plan6_temp

parents 8a7a56be ceb4483b
...@@ -942,11 +942,17 @@ public class DateUtils { ...@@ -942,11 +942,17 @@ public class DateUtils {
endDay = i; endDay = i;
} }
if(startDay != 0 && endDay != 0){ if(startDay != 0 && endDay != 0){
String s = year + "第" + getWeekOfYear(date2) + "周" + "(" + date.substring(5) + "月" + startDay + String s = "";
"日至" + date.substring(5) + "月" + endDay + "日" +")";
String weekStart = year + "-"+ date.substring(5) +"-" +startDay +" 00:00:00"; String weekStart = year + "-"+ date.substring(5) +"-" +startDay +" 00:00:00";
String weekEnd = year + "-"+ date.substring(5) +"-" +endDay +" 23:59:59"; String weekEnd = year + "-"+ date.substring(5) +"-" +endDay +" 23:59:59";
if("12".equals(date.substring(5)) && weekOfYear(date2) == 1 ){
long week = Long.valueOf(dates.get(dates.size()-1).get("name").substring(5,7)) + 1;
s = year + "第" + week + "周" + "(" + date.substring(5) + "月" + startDay +
"日至" + date.substring(5) + "月" + endDay + "日" +")";
} else {
s = year + "第" + getWeekOfYear(date2) + "周" + "(" + date.substring(5) + "月" + startDay +
"日至" + date.substring(5) + "月" + endDay + "日" +")";
}
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
map.put("name",s); map.put("name",s);
map.put("weekStart",weekStart); map.put("weekStart",weekStart);
...@@ -971,6 +977,14 @@ public class DateUtils { ...@@ -971,6 +977,14 @@ public class DateUtils {
return week_of_year; return week_of_year;
} }
public static int weekOfYear(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
c.setFirstDayOfWeek(Calendar.MONDAY);
int week_of_year = c.get(Calendar.WEEK_OF_YEAR);
return week_of_year;
}
/** /**
* 获得本月的开始时间,即2012-01-01 00:00:00 * 获得本月的开始时间,即2012-01-01 00:00:00
* *
......
...@@ -61,9 +61,9 @@ public interface EmergencyMapper extends BaseMapper{ ...@@ -61,9 +61,9 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object>> getCAFSWaterTankInfo(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getCAFSWaterTankInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> selectAlarmAnalysis(@Param("bizOrgCode") String bizOrgCode, @Param("startDate")String startDate, @Param("endDate")String endDate); List<Map<String, Object>> selectAlarmAnalysis(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("dataType")String dataType, @Param("date")String date, @Param("list") List<String> codes);
List<Map<String, Object>> selectAlarmAnalysisCount(@Param("bizOrgCode") String bizOrgCode, @Param("startDate")String startDate, @Param("endDate")String endDate); List<Map<String, Object>> selectAlarmAnalysisCount( @Param("startDate")String startDate, @Param("endDate")String endDate,@Param("list") List<String> codes);
Map<String, Object> getSystemAndCarCount(); Map<String, Object> getSystemAndCarCount();
......
...@@ -34,9 +34,9 @@ public interface IEmergencyService { ...@@ -34,9 +34,9 @@ public interface IEmergencyService {
Page<Map<String, Object>> selectPressureFlow(Page<Map<String, Object>> page, String bizOrgCode); Page<Map<String, Object>> selectPressureFlow(Page<Map<String, Object>> page, String bizOrgCode);
List<Map<String, Object>> selectAlarmAnalysis(String bizOrgCode, String startDate, String endDate); List<Map<String, Object>> selectAlarmAnalysis(String startDate, String endDate, String dataType, String date, String systemType);
List<Map<String, Object>> selectAlarmAnalysisCount(String bizOrgCode, String startDate, String endDate); List<Map<String, Object>> selectAlarmAnalysisCount(String systemType, String startDate, String endDate);
Map<String, Object> systemAndCar(); Map<String, Object> systemAndCar();
......
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.mapper.EmergencyMapper; import com.yeejoin.equipmanage.mapper.EmergencyMapper;
import com.yeejoin.equipmanage.service.IEmergencyService; import com.yeejoin.equipmanage.service.IEmergencyService;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
...@@ -8,8 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -8,8 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import static com.yeejoin.equipmanage.common.utils.DateUtils.getFirstDayOfMonth;
/** /**
* *
* 四横八纵应急模块接口服务类 * 四横八纵应急模块接口服务类
...@@ -90,13 +96,23 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -90,13 +96,23 @@ public class EmergencyServiceImpl implements IEmergencyService {
} }
@Override @Override
public List<Map<String, Object>> selectAlarmAnalysis(String bizOrgCode, String startDate, String endDate) { public List<Map<String, Object>> selectAlarmAnalysis(String startDate, String endDate, String dataType, String date, String systemType) {
return emergencyMapper.selectAlarmAnalysis(bizOrgCode, startDate, endDate); List<String> strings = emergencyMapper.selectSystemCodes(systemType);
if (!CollectionUtils.isEmpty(strings)) {
return emergencyMapper.selectAlarmAnalysis(startDate, endDate, dataType, date, strings);
}
return null;
} }
@Override @Override
public List<Map<String, Object>> selectAlarmAnalysisCount(String bizOrgCode, String startDate, String endDate) { public List<Map<String, Object>> selectAlarmAnalysisCount(String systemType, String startDate, String endDate) {
return emergencyMapper.selectAlarmAnalysisCount(bizOrgCode, startDate, endDate); List<String> strings = emergencyMapper.selectSystemCodes(systemType);
if (!CollectionUtils.isEmpty(strings)) {
return emergencyMapper.selectAlarmAnalysisCount( startDate, endDate,strings);
}
return null;
} }
@Override @Override
......
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.equipmanage.common.entity.*; import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.vo.*; import com.yeejoin.equipmanage.common.entity.vo.*;
...@@ -17,6 +18,7 @@ import org.apache.commons.lang3.RandomStringUtils; ...@@ -17,6 +18,7 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -57,6 +59,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -57,6 +59,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
@Autowired @Autowired
private IEquipmentDetailService iEquipmentDetailService; private IEquipmentDetailService iEquipmentDetailService;
@Autowired
private RedisUtils redisUtils;
// 装备分类code长度 // 装备分类code长度
private static final int CATECODELEN = 8; private static final int CATECODELEN = 8;
private String proviceCode = "44"; private String proviceCode = "44";
...@@ -111,10 +116,10 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -111,10 +116,10 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
} }
equipmentMapper.deleteById(equipment.getId()); equipmentMapper.deleteById(equipment.getId());
}); });
refreshData();
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("删除失败!"); throw new RuntimeException("删除失败!");
} }
} }
@Override @Override
...@@ -140,11 +145,23 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -140,11 +145,23 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
log.error("新增装备定义操作中,检测到巡检服务未启动或启动出错!"); log.error("新增装备定义操作中,检测到巡检服务未启动或启动出错!");
} }
if (num > 0) { if (num > 0) {
refreshData();
return true; return true;
} }
return false; return false;
} }
@Async
public void refreshData() {
if (redisUtils.hasKey("equip_equipDefinitions")) {
redisUtils.del("equip_equipDefinitions");
}
QueryWrapper<Equipment> equipmentQueryWrapper = new QueryWrapper<>();
equipmentQueryWrapper.isNotNull("id");
List<Equipment> equipments = equipmentMapper.selectList(equipmentQueryWrapper);
redisUtils.set("equip_equipDefinitions", JSONObject.toJSONString(equipments));
}
// public void saveEquipmentQRCodes(Equipment equipment) { // public void saveEquipmentQRCodes(Equipment equipment) {
// try { // try {
// EquipmentdefQrcode code = EquipmentdefQrcode.getBuilder().withEquipmentId(() -> equipment.getId()).build(); // EquipmentdefQrcode code = EquipmentdefQrcode.getBuilder().withEquipmentId(() -> equipment.getId()).build();
...@@ -233,6 +250,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -233,6 +250,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
log.error("编辑装备定义操作中,检测到巡检服务未启动或启动出错!"); log.error("编辑装备定义操作中,检测到巡检服务未启动或启动出错!");
} }
if (savedEquipment > 0) { if (savedEquipment > 0) {
refreshData();
return true; return true;
} }
return false; return false;
......
...@@ -8,6 +8,7 @@ import java.util.stream.Collectors; ...@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.utils.*; import com.yeejoin.equipmanage.common.utils.*;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -32,21 +33,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -32,21 +33,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.equipmanage.common.entity.Equipment;
import com.yeejoin.equipmanage.common.entity.EquipmentDetail;
import com.yeejoin.equipmanage.common.entity.EquipmentIndex;
import com.yeejoin.equipmanage.common.entity.EquipmentManageEntity;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.EquipmentSystemSourceStatistics;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.Journal;
import com.yeejoin.equipmanage.common.entity.ManufacturerInfo;
import com.yeejoin.equipmanage.common.entity.Stock;
import com.yeejoin.equipmanage.common.entity.StockBill;
import com.yeejoin.equipmanage.common.entity.StockBillDetail;
import com.yeejoin.equipmanage.common.entity.StockDetail;
import com.yeejoin.equipmanage.common.entity.WarehouseStructure;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentDetailDownloadVO; import com.yeejoin.equipmanage.common.entity.vo.EquipmentDetailDownloadVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo; import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.enums.BillContentEnum; import com.yeejoin.equipmanage.common.enums.BillContentEnum;
...@@ -507,10 +493,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -507,10 +493,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
relationRedisUtil.delSysRedisKey(fireFightSysIdsBuffer.toString()); relationRedisUtil.delSysRedisKey(fireFightSysIdsBuffer.toString());
} }
if (redisUtils.hasKey("equipAndCarIotCodes")) {
redisUtils.del("equipAndCarIotCodes");
}
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { // TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
// @Override // @Override
// public void afterCommit() { // public void afterCommit() {
...@@ -546,6 +528,10 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -546,6 +528,10 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
redisUtils.del("equipAndCarIotCodes"); redisUtils.del("equipAndCarIotCodes");
} }
redisUtils.set("equipAndCarIotCodes", JSONObject.toJSONString(data)); redisUtils.set("equipAndCarIotCodes", JSONObject.toJSONString(data));
if (redisUtils.hasKey("equip_warehouseStructures")) {
redisUtils.getAndDeletePatternKeys("equip_warehouseStructures" + "*");
}
return date; return date;
} }
...@@ -579,11 +565,22 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -579,11 +565,22 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
TransactionStatus transactionStatus = platformTransactionManager.getTransaction(transactionDefinition); TransactionStatus transactionStatus = platformTransactionManager.getTransaction(transactionDefinition);
try { try {
//查询装备定义信息 //查询装备定义信息
// equipmentQueryWrapper.lambda().eq(Equipment::getCode, equipmentDetailDownloadVOS.getCode());
// Equipment equipment = equipmentMapper.selectOne(equipmentQueryWrapper);
// 此处由于每次导入都需查装备定义导致导入缓慢,所以优化为加入缓存
Equipment equipment;
if (redisUtils.hasKey("equip_equipDefinitions")) {
List<Equipment> equipmentList = JSONObject.parseArray(redisUtils.get("equip_equipDefinitions").toString(), Equipment.class);;
equipment = equipmentList.stream().filter(x -> x.getCode().equals(equipmentDetailDownloadVOS.getCode())).collect(Collectors.toList()).get(0);
} else {
QueryWrapper<Equipment> equipmentQueryWrapper = new QueryWrapper<>(); QueryWrapper<Equipment> equipmentQueryWrapper = new QueryWrapper<>();
equipmentQueryWrapper.lambda().eq(Equipment::getCode, equipmentDetailDownloadVOS.getCode()); equipmentQueryWrapper.isNotNull("id");
Equipment equipment = equipmentMapper.selectOne(equipmentQueryWrapper); List<Equipment> equipments = equipmentMapper.selectList(equipmentQueryWrapper);
equipment = equipments.stream().filter(x -> x.getCode().equals(equipmentDetailDownloadVOS.getCode())).collect(Collectors.toList()).get(0);
redisUtils.set("equip_equipDefinitions", JSONObject.toJSONString(equipments));
}
if (equipment == null) { if (equipment == null) {
erryy.append(String.format("装备(器材)编码[%S]填写错误,请输入正确的装备(器材)编码!",equipmentDetailDownloadVOS.getCode()) + ","); erryy.append(String.format("装备(器材)编码[%S]填写错误,请输入正确的装备(器材)编码!",equipmentDetailDownloadVOS.getCode()) + ",");
throw new RuntimeException(String.format("装备(器材)编码[%S]填写错误,请输入正确的装备(器材)编码!",equipmentDetailDownloadVOS.getCode())); throw new RuntimeException(String.format("装备(器材)编码[%S]填写错误,请输入正确的装备(器材)编码!",equipmentDetailDownloadVOS.getCode()));
...@@ -604,8 +601,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -604,8 +601,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
throw new RuntimeException(String.format("物联编码[%S]填写重复,请重新输入!",iotCode)); throw new RuntimeException(String.format("物联编码[%S]填写重复,请重新输入!",iotCode));
} }
if(StringUtils.isNotEmpty(haveUsedIotPrefix) && Arrays.stream(haveUsedIotPrefix.split(",")).anyMatch(iotCode::startsWith)){ if(StringUtils.isNotEmpty(haveUsedIotPrefix) && Arrays.stream(haveUsedIotPrefix.split(",")).anyMatch(iotCode::startsWith)){
erryy.append(String.format("物联编码[%S]航班已占用,请重新输入!",iotCode)+ ","); erryy.append(String.format("物联编码[%S]已占用,请重新输入!",iotCode)+ ",");
throw new BadRequest("物联编码航班已占用"); throw new BadRequest("物联编码已占用");
} }
} }
AtomicReference<String> fightSysIds = new AtomicReference<>(""); AtomicReference<String> fightSysIds = new AtomicReference<>("");
...@@ -680,7 +677,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -680,7 +677,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
equipmentSpecific.setTeamId(fireTeam[1]); equipmentSpecific.setTeamId(fireTeam[1]);
} }
// 导入新增所属单位 // 导入新增所属单位
if (StringUtils.isNotBlank(equipmentDetailDownloadVOS.getCompanyName())) { if (StringUtils.isNotBlank(equipmentDetailDownloadVOS.getCompanyName())) {
String[] company = equipmentDetailDownloadVOS.getCompanyName().split("@"); String[] company = equipmentDetailDownloadVOS.getCompanyName().split("@");
equipmentSpecific.setAgencyId(company[1]); equipmentSpecific.setAgencyId(company[1]);
...@@ -700,9 +696,19 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -700,9 +696,19 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
controllerProxy.refreshCount(equipmentSpecific.getBizOrgCode()); controllerProxy.refreshCount(equipmentSpecific.getBizOrgCode());
//位置编码不为空入库 //位置编码不为空入库
if (equipmentDetailDownloadVOS != null && equipmentDetailDownloadVOS.getWarehouseStructCode() != null) { if (equipmentDetailDownloadVOS != null && equipmentDetailDownloadVOS.getWarehouseStructCode() != null) {
QueryWrapper<WarehouseStructure> warehouseStructureQueryWrapper = new QueryWrapper<>(); // QueryWrapper<WarehouseStructure> warehouseStructureQueryWrapper = new QueryWrapper<>();
warehouseStructureQueryWrapper.lambda().eq(WarehouseStructure::getCode, equipmentDetailDownloadVOS.getWarehouseStructCode()); // warehouseStructureQueryWrapper.lambda().eq(WarehouseStructure::getCode, equipmentDetailDownloadVOS.getWarehouseStructCode());
WarehouseStructure warehouseStructure = warehouseStructureService.getOne(warehouseStructureQueryWrapper); // WarehouseStructure warehouseStructure = warehouseStructureService.getOne(warehouseStructureQueryWrapper);
// 入库位置进行优化
WarehouseStructure warehouseStructure;
if (redisUtils.hasKey("equip_warehouseStructures")) {
List<WarehouseStructure> warehouseStructures = JSONObject.parseArray(redisUtils.get("equip_warehouseStructures").toString(), WarehouseStructure.class);
warehouseStructure = warehouseStructures.stream().filter(x -> x.getCode().equals(equipmentDetailDownloadVOS.getWarehouseStructCode())).collect(Collectors.toList()).get(0);
} else {
List<WarehouseStructure> warehouseStructures = warehouseStructureService.list();
warehouseStructure = warehouseStructures.stream().filter(x -> x.getCode().equals(equipmentDetailDownloadVOS.getWarehouseStructCode())).collect(Collectors.toList()).get(0);
redisUtils.set("equip_warehouseStructures", JSONObject.toJSONString(warehouseStructures));
}
if (warehouseStructure == null) { if (warehouseStructure == null) {
erryy.append(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode())+ ","); erryy.append(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode())+ ",");
throw new RuntimeException(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode())); throw new RuntimeException(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode()));
...@@ -781,10 +787,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -781,10 +787,6 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
} }
// @Async // @Async
public void refreshCount(String bizOrgCode) { public void refreshCount(String bizOrgCode) {
equipmentSpecificSerivce.refreshStaData(); equipmentSpecificSerivce.refreshStaData();
......
...@@ -412,7 +412,9 @@ ...@@ -412,7 +412,9 @@
wespa.equipment_specific_index_key LIKE concat('%', 'Fault') wespa.equipment_specific_index_key LIKE concat('%', 'Fault')
AND wespa.create_date LIKE concat(temp.date, '%') AND wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code like concat(#{bizOrgCode}, '%') <foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS faultNum, ) AS faultNum,
( (
SELECT SELECT
...@@ -427,7 +429,9 @@ ...@@ -427,7 +429,9 @@
wespa.equipment_specific_index_key LIKE concat('%', 'FireAlarm') wespa.equipment_specific_index_key LIKE concat('%', 'FireAlarm')
AND wespa.create_date LIKE concat(temp.date, '%') AND wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code like concat(#{bizOrgCode}, '%') <foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS alarmNum, ) AS alarmNum,
( (
SELECT SELECT
...@@ -442,9 +446,81 @@ ...@@ -442,9 +446,81 @@
wespa.equipment_specific_index_key LIKE concat('%', 'Shield') wespa.equipment_specific_index_key LIKE concat('%', 'Shield')
AND wespa.create_date LIKE concat(temp.date, '%') AND wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code like concat(#{bizOrgCode}, '%') <foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS shieldNum ) AS shieldNum
FROM FROM
<if test="dataType == 1">
(
SELECT
date_format(
(#{date} - INTERVAL 0 MONTH),
'%Y-%m'
) AS `date`
UNION
(SELECT
date_format(
(#{date} - INTERVAL -1 MONTH),
'%Y-%m'
) AS `date`)
UNION
(SELECT
date_format(
(#{date} - INTERVAL -2 MONTH),
'%Y-%m'
) AS `date`)
UNION
(SELECT
date_format(
(#{date} - INTERVAL -3 MONTH),
'%Y-%m'
) AS `date`)
UNION
(SELECT
date_format(
(#{date} - INTERVAL -4 MONTH),
'%Y-%m'
) AS `date`)
UNION
(SELECT
date_format(
(#{date} - INTERVAL -5 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -6 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -7 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -8 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -9 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -10 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -11 MONTH),
'%Y-%m'
) AS `date`))temp
</if>
<if test="dataType != 1">
( (
SELECT temp.selected_date as date FROM SELECT temp.selected_date as date FROM
(SELECT ADDDATE('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date FROM (SELECT ADDDATE('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date FROM
...@@ -458,6 +534,7 @@ ...@@ -458,6 +534,7 @@
) temp ) temp
ORDER BY ORDER BY
temp.date temp.date
</if>
</select> </select>
<select id="selectAlarmAnalysisCount" resultType="java.util.Map"> <select id="selectAlarmAnalysisCount" resultType="java.util.Map">
SELECT SELECT
...@@ -473,9 +550,11 @@ ...@@ -473,9 +550,11 @@
WHERE WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'Fault') wespa.equipment_specific_index_key LIKE concat('%', 'Fault')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND wespa.create_date BETWEEN #{startDate} AND wespa.create_date BETWEEN #{startDate}
AND #{endDate} AND #{endDate}
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS faultNum, ) AS faultNum,
( (
SELECT SELECT
...@@ -489,9 +568,11 @@ ...@@ -489,9 +568,11 @@
WHERE WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'FireAlarm') wespa.equipment_specific_index_key LIKE concat('%', 'FireAlarm')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND wespa.create_date BETWEEN #{startDate} AND wespa.create_date BETWEEN #{startDate}
AND #{endDate} AND #{endDate}
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS fireAlarmNum, ) AS fireAlarmNum,
( (
SELECT SELECT
...@@ -505,9 +586,11 @@ ...@@ -505,9 +586,11 @@
WHERE WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'Shield') wespa.equipment_specific_index_key LIKE concat('%', 'Shield')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND wespa.create_date BETWEEN #{startDate} AND wespa.create_date BETWEEN #{startDate}
AND #{endDate} AND #{endDate}
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS shieldNum ) AS shieldNum
</select> </select>
......
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