添加补招小时批处理

This commit is contained in:
hzj
2025-08-21 19:38:10 +08:00
parent f4e1632386
commit e2f3ea7764
8 changed files with 137 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
package com.njcn.advance.controller.carrycapacity;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityQueryDataParam;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityResultParam;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDResultVO;
@@ -45,6 +46,15 @@ public class CarryCapacityResultController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryResultbyCondition")
@ApiOperation("承载能力评估列表查询")
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
public HttpResult<CarryCapacityDResultVO> queryResultbyCondition(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
String methodDescribe = getMethodDescribe("queryResultbyCondition");
CarryCapacityDResultVO vo = carryCapacityResultPOService.queryResultbyCondition(queryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/remove")
@ApiOperation("承载能力评估用户批量删除")

View File

@@ -1,6 +1,7 @@
package com.njcn.advance.service.carrycapacity;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityQueryDataParam;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityResultParam;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -18,4 +19,6 @@ public interface CarryCapacityResultPOService extends IService<CarryCapacityResu
IPage<CarryCapacityDResultVO> queryResultList(CarryCapacityResultParam.CarryCapacityResultPageParam queryParam);
CarryCapacityDResultVO queryResultbyCondition(CarryCapacityQueryDataParam queryParam);
}

View File

@@ -6,6 +6,7 @@ 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.njcn.advance.mapper.carrycapacity.CarryCapacityResultPOMapper;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityQueryDataParam;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityResultParam;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO;
@@ -83,4 +84,21 @@ public class CarryCapacityResultPOServiceImpl extends ServiceImpl<CarryCapacityR
return returnpage;
}
@Override
public CarryCapacityDResultVO queryResultbyCondition(CarryCapacityQueryDataParam queryParam) {
CarryCapacityDResultVO vo = new CarryCapacityDResultVO();
CarryCapacityResultPO one = this.lambdaQuery().eq(CarryCapacityResultPO::getLineId, queryParam.getLineId())
.eq(CarryCapacityResultPO::getStartTime, queryParam.getStartTime())
.eq(CarryCapacityResultPO::getEndTime, queryParam.getEndTime())
.eq(CarryCapacityResultPO::getUserId, queryParam.getUserId())
.eq(CarryCapacityResultPO::getStatus, 1).one();
if(Objects.nonNull(one)){
BeanUtils.copyProperties(one, vo);
}
return vo;
}
}

View File

@@ -476,11 +476,14 @@ public class CarryCapacityServiceImpl implements CarryCapacityService {
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
List<Double> uList = new ArrayList<>();
List<Double> pftList = new ArrayList<>();
List<Double> btList = new ArrayList<>();
for (String phase : phaseType) {
Double pMin = calParam.getP_βminMap().get(phase);
Double qMin = calParam.getQ_βminMap().get(phase);
Double pMin = calParam.getP_βminMap().get(phase)/1000;
Double qMin = calParam.getQ_βminMap().get(phase)/1000;
Double[] res = calParam.getStringMap().get(phase);
// double bt = CZNLPG.calculateB(pMin, qMin, Double.parseDouble(CarryingCapacityEnum.K.getValue()), sT, sPv, pPv);
double bt = CZNLPG.calculateB(pMin, qMin, Double.parseDouble(CarryingCapacityEnum.K.getValue()), sT, sPv, pPv);
btList.add(bt);
double pft = CZNLPG.calculatePF_T(pMin, qMin, Double.parseDouble(CarryingCapacityEnum.K.getValue()), sPv);
pftList.add(pft);
double u = CZNLPG.calculateU(res[0], res[1], res[2], pMin, Double.parseDouble(CarryingCapacityEnum.K.getValue()), qMin, sPv, Double.parseDouble(scaleValue));
@@ -491,6 +494,11 @@ public class CarryCapacityServiceImpl implements CarryCapacityService {
.max()
.getAsDouble();
double btMax = btList.stream().mapToDouble(Double::doubleValue)
.max()
.getAsDouble();
double pftMax = pftList.stream().mapToDouble(Double::doubleValue)
.max()
.getAsDouble();
@@ -500,7 +508,7 @@ public class CarryCapacityServiceImpl implements CarryCapacityService {
Integer pftLevel = CZNLPG.evaluatePowerFactorLevel(pftMax);
carryCapacitydResultVO.setPfTLevel(pftLevel);
Integer btLevel = CZNLPG.evaluateEquivalentLoadRateLevel(pftMax);
Integer btLevel = CZNLPG.evaluateEquivalentLoadRateLevel(btMax);
carryCapacitydResultVO.setBTLevel(btLevel);
//谐波电流幅值判断
//获取限值

View File

@@ -198,8 +198,8 @@ public class CZNLPG {
// term2 = Math.pow(k * S_pv * I_inv / 220, 2);
// term3 = K * I_cp95 * (k * S_pv * I_inv / 220);
// } else if (voltage == 380) {
term2 = Math.pow(k * S_pv * I_inv / 3 * 220, 2);
term3 = K * I_cp95 * (k * S_pv * I_inv / 3 * 220);
term2 = Math.pow(k * S_pv * I_inv /(3 * 220) , 2);
term3 = K * I_cp95 * (k * S_pv * I_inv / (3 * 220));
// } else {
// return 0;
// }

View File

@@ -2,22 +2,33 @@ package com.njcn.device.pq.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.bpm.utils.CollectionUtils;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
import com.njcn.device.pq.constant.Param;
import com.njcn.device.pq.mapper.LineMapper;
import com.njcn.device.pq.mapper.PqsTerminalLogsMapper;
import com.njcn.device.pq.pojo.dto.PqIcdPathDTO;
import com.njcn.device.pq.pojo.param.PqIcdPathParam;
import com.njcn.device.pq.pojo.po.PqDevType;
import com.njcn.device.pq.pojo.po.*;
import com.njcn.device.pq.service.IDeviceService;
import com.njcn.device.pq.service.PqDevTypeService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.UserFeignClient;
import com.njcn.user.pojo.po.User;
import com.njcn.web.pojo.param.BaseParam;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -26,11 +37,12 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.device.pq.pojo.po.PqIcdPath;
import com.njcn.device.pq.mapper.PqIcdPathMapper;
import com.njcn.device.pq.service.PqIcdPathService;
import org.springframework.transaction.annotation.Transactional;
import static com.njcn.device.pq.enums.LineBaseEnum.SUB_LEVEL;
/**
* Description:
* Date: 2024/11/5 11:24【需求编号】
@@ -44,7 +56,10 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
private final PqDevTypeService devTypeService;
private final UserFeignClient userFeignClient;
private final IDeviceService deviceService;
private final PqsTerminalLogsMapper pqsTerminalLogsMapper;
private final DicDataFeignClient dicDataFeignClient;
private final LineMapper lineMapper;
@Override
public List<PqIcdPathDTO> icdPathList(List<String> devType) {
@@ -135,6 +150,35 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
PqIcdPath icdPath = BeanUtil.copyProperties(param, PqIcdPath.class);
icdPath.setName(param.getFileName());
icdPath.setPath(param.getFilePath());
//查询绑定的icd的设备型号
List<PqDevType> pqDevTypeList = devTypeService.lambdaQuery().eq(PqDevType::getIcdId, param.getId()).eq(PqDevType::getState, 1).list();
if(!CollectionUtil.isEmpty(pqDevTypeList)) {
List<String> collect = pqDevTypeList.stream().map(PqDevType::getId).collect(Collectors.toList());
List<Device> list = deviceService.lambdaQuery().in(Device::getDevType,collect).eq(Device::getRunFlag, 0).list();
list.forEach(temp -> {
//记录日志
DictData dataDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.DEV_PARAMETER.getCode(), DicDataTypeEnum.DEV_OPS.getCode()).getData();
String name = RequestUtil.getUserNickname();
PqsTerminalLogs pqsTerminalLogs = new PqsTerminalLogs();
pqsTerminalLogs.setLogsType(dataDic.getId());
//终端为4
pqsTerminalLogs.setTerminalType(4);
List<Line> subList = lineMapper.selectList(null);
Map<String, Line> subMap = subList.stream().collect(Collectors.toMap(Line::getId, Function.identity()));
Line dev = subMap.get(temp.getId());
String subName = subMap.get(dev.getPids().split(StrUtil.COMMA)[SUB_LEVEL.getCode()]).getName();
String temLos = "%s进行更新终端进程操作;终端名称 %s,修改了icd文件";
String tem = String.format(temLos, name, subName + "_" + dev.getName());
pqsTerminalLogs.setTerminalDescribe(tem);
pqsTerminalLogs.setState(DataStateEnum.ENABLE.getCode());
pqsTerminalLogs.setIsPush(0);
pqsTerminalLogs.setOperateType(Param.UPDATE);
pqsTerminalLogs.setObjIndex(temp.getId());
pqsTerminalLogsMapper.insert(pqsTerminalLogs);
});
}
return this.updateById(icdPath);
}

View File

@@ -3640,6 +3640,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
DeviceInfo deviceInfo = deviceInfos.get(0);
DeviceRebootMessage.DeviceInfo deviceInfo1 = new DeviceRebootMessage.DeviceInfo();
BeanUtils.copyProperties(deviceInfo, deviceInfo1);
deviceInfo1.setProcessNo(processNum);
List<DeviceRebootMessage.DeviceInfo.MonitorInfo> monitorInfoList = deviceInfo.getMonitorData().stream().map(tempMonitorInfo -> {
DeviceRebootMessage.DeviceInfo.MonitorInfo m = new DeviceRebootMessage.DeviceInfo.MonitorInfo();
BeanUtils.copyProperties(tempMonitorInfo, m);

View File

@@ -0,0 +1,43 @@
package com.njcn.system.timer.tasks;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
import com.njcn.dataProcess.api.DataRecallFeignClient;
import com.njcn.dataProcess.param.FullRecallMessage;
import com.njcn.message.message.RecallMessage;
import com.njcn.system.timer.TimerTaskRunner;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 类的介绍:装置算法执行链定时任务
*
* @author xuyang
* @version 1.0.0
* @createTime 2023/12/6 9:35
*/
@Component
@RequiredArgsConstructor
public class DataRecallHourTaskRunner implements TimerTaskRunner {
private final DataRecallFeignClient dataRecallFeignClient;
@Override
public void action(String date) {
if(StrUtil.isBlank(date)){
FullRecallMessage baseParam = new FullRecallMessage();
baseParam.setReCallStartTime(LocalDateTime.now().withMinute(0).withSecond(0).withNano(0).minusHours(1));
baseParam.setReCallEndTime(LocalDateTime.now().withMinute(0).withSecond(0).withNano(0));
dataRecallFeignClient.fullHourRecall(baseParam);
}
}
}