Browse Source

Merge branch 'master' of http://175.6.40.68:8081/Jone/hzims-back

 Conflicts:
	hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
zhongwei
liwen 7 months ago
parent
commit
8591f43bb7
  1. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java
  2. 25
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  3. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java

@ -152,7 +152,7 @@ public class AlarmServiceImpl implements AlarmService {
alarm.setIsShowAlert(1);
alarm.setIsSmallBell(1);
alarm.setIsMask(1);
alarm.setIsBroadcast(0);
alarm.setIsBroadcast(1);
alarm.setIsPlatformMessage(1);
alarm.setIsShortMessage(1);
alarm.setIsWxMessage(1);

25
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -38,6 +38,7 @@ import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient;
import com.hnac.hzinfo.sdk.v5.device.dto.ReductionDataDTO;
import com.hnac.hzinfo.sdk.v5.device.vo.ReductionDataVO;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
@ -57,6 +58,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -118,7 +120,12 @@ public class RealTargetServiceImpl implements RealTargetService {
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key";
private final static String load_photovoltaic_real_key = "hzims:operation:photovoltaic:real:key";
private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key";
@Getter
private static final ThreadPoolExecutor fixedThreadExecutor;
static {
ThreadFactory threadFactory = Executors.defaultThreadFactory();
fixedThreadExecutor = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingDeque(), threadFactory);
}
@Override
public void loadEmInfo(String param) {
@ -1217,6 +1224,9 @@ public class RealTargetServiceImpl implements RealTargetService {
*/
@Override
public void loadPowerData(String param, List<Integer> types, Integer serveType, int year) {
Long time=System.currentTimeMillis();
System.out.println("近年发电量接口耗时测试开始=======================");
log.info("近年发电量接口耗时测试开始=======================");
// 站点查询
List<StationEntity> stationList = stationService.list(new LambdaQueryWrapper<StationEntity>() {{
eq(StationEntity::getDataOrigin,"0");
@ -1241,7 +1251,10 @@ public class RealTargetServiceImpl implements RealTargetService {
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
// 存储数据map :<站点id,<月份,发电量>>
Map<Long, Map<String, Float>> powerMap = new HashMap<>();
Long time2=System.currentTimeMillis();
log.info("近年发电量接口,数据组装"+(time2-time));
stationList.forEach(station -> {
fixedThreadExecutor.execute(()->{
// 站点设备集合
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
log.error("load_power_data station :" + station.getCode() + "==== device :" + stationDevices );
@ -1251,7 +1264,10 @@ public class RealTargetServiceImpl implements RealTargetService {
}
powerMap.put(station.getId(),generateMap);
});
});
redisTemplate.opsForValue().set(recent_year_power_data, powerMap);
Long time3=System.currentTimeMillis();
log.info("近年发电量数据接口,总耗时:"+(time3-time));
}
@Override
@ -1396,6 +1412,7 @@ public class RealTargetServiceImpl implements RealTargetService {
*/
private Map<String, Float> getGenerateYear(StationEntity station,List<EminfoAndEmParamVo> devices, String start, String end) {
List<PowerMonthVo> datas = new ArrayList<>();
long l = System.currentTimeMillis();
// 设备采集发电量
if(CollectionUtil.isNotEmpty(devices)){
devices.forEach(device->{
@ -1416,11 +1433,17 @@ public class RealTargetServiceImpl implements RealTargetService {
}).collect(Collectors.toList()));
});
}
long l2 = System.currentTimeMillis();
log.info("getGenerateYear接口,"+station.getName()+"-设备采集发电量数据耗时:"+(l2-l));
// 补充填报数据
datas.addAll(this.generateFill(station,start,end));
long l3 = System.currentTimeMillis();
log.info("getGenerateYear接口,"+station.getName()+":补充填报数据"+(l3-l2));
if(CollectionUtil.isEmpty(datas)){
return null;
}
long l4 = System.currentTimeMillis();
log.info("getGenerateYear接口,"+station.getName()+":接口总耗时"+(l4-l));
return datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum));
}
/**

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

@ -166,7 +166,15 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
);
String suffix = String.format(String.format("%03d", ticketList.size() + 1));
String result = stationR.getData().getSignage() + yearMonth + suffix;
OperPhenomenonEntity operPhenomenonEntity = this.getOne(
Wrappers.<OperPhenomenonEntity>lambdaQuery().eq(OperPhenomenonEntity::getDefectCode, result)
.last("limit 1;")
);
if (ObjectUtil.isNotEmpty(operPhenomenonEntity)){
suffix= String.format(String.format("%03d", ticketList.size() + 10));
result= stationR.getData().getSignage() + yearMonth + suffix;
}
// 缺陷编码 : 按项目+年+月+序号
if (Func.isNotEmpty(result)) {
entity.setDefectCode(result);

Loading…
Cancel
Save