Compare commits
16 Commits
ac1d98efdc
...
2025-10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57ee3a4d43 | ||
| 563eb80b65 | |||
|
|
dae10378dd | ||
|
|
af4f000b13 | ||
|
|
321ec97130 | ||
|
|
0dd3502942 | ||
|
|
00ba09faae | ||
|
|
40e39d651b | ||
|
|
02c8164b7e | ||
|
|
8c598aec1e | ||
|
|
2c59defdc2 | ||
|
|
5642bf2b31 | ||
|
|
ba76df66b0 | ||
|
|
57c419eb70 | ||
|
|
98f4ecef6c | ||
|
|
20e07712cb |
@@ -1953,6 +1953,17 @@ public class SocketContrastResponseService {
|
||||
boolean isStar = DetectionCodeEnum.STAR.getCode().equals(monitorListDTO.getConnection());
|
||||
boolean isDelta = DetectionCodeEnum.DELTA.getCode().equals(monitorListDTO.getConnection());
|
||||
|
||||
PreDetection preDetection = FormalTestManager.devList.stream().filter(obj -> obj.getDevIP().equals(split[0])).findFirst().orElse(null);
|
||||
if (ObjectUtil.isNotNull(preDetection)) {
|
||||
if (preDetection.getUsePhaseIndex() == 1) {
|
||||
isStar = true;
|
||||
isDelta = false;
|
||||
} else {
|
||||
isStar = false;
|
||||
isDelta = true;
|
||||
}
|
||||
}
|
||||
|
||||
List<AlignDataVO.RawData> dataList = new ArrayList<>();
|
||||
for (int i = 0; i < channelDevDataList.size(); i++) {
|
||||
DevData.SqlDataDTO.ListDTO list1 = null;
|
||||
@@ -2032,6 +2043,7 @@ public class SocketContrastResponseService {
|
||||
channelDataMap.forEach((channel, channelDevDataList) -> {
|
||||
String standardDevMonitorId = ip + CnSocketUtil.SPLIT_TAG + channel;
|
||||
String devMonitorId = FormalTestManager.pairsIpMap.inverse().get(standardDevMonitorId);
|
||||
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
||||
PreDetection.MonitorListDTO monitorListDTO = FormalTestManager.monitorMap.get(devMonitorId);
|
||||
List<DevData> devDataList = BeanUtil.copyToList(FormalTestManager.devDataMap.get(devMonitorId), DevData.class);
|
||||
channelDevDataList.sort(Comparator.comparing(obj -> DetectionUtil.getMillis(obj.getTime())));
|
||||
@@ -2042,9 +2054,21 @@ public class SocketContrastResponseService {
|
||||
exportParams.setSheetName(standardDevName + "通道" + channel);
|
||||
sheet.put("title", exportParams);
|
||||
|
||||
List<AlignDataExcel> dataList = new ArrayList<>();
|
||||
boolean isStar = DetectionCodeEnum.STAR.getCode().equals(monitorListDTO.getConnection());
|
||||
boolean isDelta = DetectionCodeEnum.DELTA.getCode().equals(monitorListDTO.getConnection());
|
||||
|
||||
PreDetection preDetection = FormalTestManager.devList.stream().filter(obj -> obj.getDevIP().equals(split[0])).findFirst().orElse(null);
|
||||
if (ObjectUtil.isNotNull(preDetection)) {
|
||||
if (preDetection.getUsePhaseIndex() == 1) {
|
||||
isStar = true;
|
||||
isDelta = false;
|
||||
} else {
|
||||
isStar = false;
|
||||
isDelta = true;
|
||||
}
|
||||
}
|
||||
|
||||
List<AlignDataExcel> dataList = new ArrayList<>();
|
||||
for (int i = 0; i < channelDevDataList.size(); i++) {
|
||||
DevData.SqlDataDTO.ListDTO list1 = null;
|
||||
DevData.SqlDataDTO sqlDataDTO1 = null;
|
||||
@@ -2252,6 +2276,19 @@ public class SocketContrastResponseService {
|
||||
boolean isStar = DetectionCodeEnum.STAR.getCode().equals(monitorListDTO.getConnection());
|
||||
boolean isDelta = DetectionCodeEnum.DELTA.getCode().equals(monitorListDTO.getConnection());
|
||||
|
||||
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
||||
PreDetection preDetection = FormalTestManager.devList.stream().filter(obj -> obj.getDevIP().equals(split[0])).findFirst().orElse(null);
|
||||
|
||||
if (ObjectUtil.isNotNull(preDetection)) {
|
||||
if (preDetection.getUsePhaseIndex() == 1) {
|
||||
isStar = true;
|
||||
isDelta = false;
|
||||
} else {
|
||||
isStar = false;
|
||||
isDelta = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 电压校验
|
||||
List<DevData.SqlDataDTO> uDev = null;
|
||||
List<DevData.SqlDataDTO> uStd = null;
|
||||
@@ -2374,7 +2411,6 @@ public class SocketContrastResponseService {
|
||||
}
|
||||
|
||||
boolean isPhaseAngle = false;
|
||||
PreDetection preDetection = FormalTestManager.devList.stream().filter(dev -> dev.getDevId().equals(devMonitorId.split(CnSocketUtil.SPLIT_TAG)[0])).findFirst().orElse(null);
|
||||
if (ObjectUtil.isNotNull(preDetection)) {
|
||||
isPhaseAngle = preDetection.getAngle() == 1 ? true : false;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class PqDevController extends BaseController {
|
||||
@OperateInfo(operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除被检设备")
|
||||
@ApiImplicitParam(name = "ids", value = "被检设备id", required = true)
|
||||
@ApiImplicitParam(name = "param", value = "删除参数", required = true)
|
||||
public HttpResult<Boolean> delete(@RequestBody @Validated PqDevParam.DeleteParam param) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, param.getIds()));
|
||||
@@ -162,7 +162,8 @@ public class PqDevController extends BaseController {
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/getSelectOptions")
|
||||
@ApiOperation("根据历史记录信息来获取下拉框内容")
|
||||
@ApiOperation("从历史数据中查询下拉框选项")
|
||||
@ApiImplicitParam(name = "pattern", value = "模式id", required = true)
|
||||
public HttpResult<Map<String, List<String>>> getSelectOptions(@RequestParam("pattern") String pattern) {
|
||||
String methodDescribe = getMethodDescribe("getSelectOptions");
|
||||
Map<String, List<String>> result = pqDevService.listSelectOptions(pattern);
|
||||
|
||||
@@ -149,17 +149,17 @@ public class PqStandardDevController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/listByPlanId")
|
||||
@ApiOperation("查询出指定计划已关联的标准设备")
|
||||
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
||||
public HttpResult<List<PqStandardDev>> listByPlanId(@RequestParam("planId") String planId) {
|
||||
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, planId);
|
||||
List<PqStandardDev> pqDevVOList = pqStandardDevService.listByPlanId(planId);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqDevVOList, methodDescribe);
|
||||
}
|
||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
// @PostMapping("/listByPlanId")
|
||||
// @ApiOperation("查询出指定计划已关联的标准设备")
|
||||
// @ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
||||
// public HttpResult<List<PqStandardDev>> listByPlanId(@RequestParam("planId") String planId) {
|
||||
// String methodDescribe = getMethodDescribe("listByPlanId");
|
||||
// LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, planId);
|
||||
// List<PqStandardDev> pqDevVOList = pqStandardDevService.listByPlanId(planId);
|
||||
//
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqDevVOList, methodDescribe);
|
||||
// }
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
|
||||
@@ -82,7 +82,7 @@ public interface IPqStandardDevService extends IService<PqStandardDev> {
|
||||
* @param planId
|
||||
* @return
|
||||
*/
|
||||
List<PqStandardDev> listByPlanId(String planId);
|
||||
// List<PqStandardDev> listByPlanId(String planId);
|
||||
|
||||
/**
|
||||
* 查询出标准设备所需的检测信息
|
||||
|
||||
@@ -562,6 +562,13 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
PqDev dev = this.getById(devId);
|
||||
Integer checkState = pqMonitorService.getDevCheckState(devId);
|
||||
Integer checkResult = pqMonitorService.getDevCheckResult(devId);
|
||||
if (checkResult == 1) {
|
||||
checkResult = CheckResultEnum.ACCORD.getValue();
|
||||
}
|
||||
if (checkResult == 2) {
|
||||
checkResult = CheckResultEnum.NOT_ACCORD.getValue();
|
||||
}
|
||||
|
||||
|
||||
SysUser user = userService.getById(userId);
|
||||
|
||||
@@ -1265,6 +1272,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
.map(ContrastDevExcel::getPqMonitorExcelList)
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(List::stream)
|
||||
// 过滤掉没有线路号的数据
|
||||
.filter(item -> ObjectUtil.isNotNull(item.getNum()))
|
||||
.collect(Collectors.toList());
|
||||
// 取第一条为设备基本信息
|
||||
ContrastDevExcel devExcel = devExcelList.get(0);
|
||||
@@ -1290,7 +1299,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
// 判断是否有重复的num
|
||||
Set<Integer> uniqueNumSet = new HashSet<>(numList);
|
||||
if (uniqueNumSet.size() != numList.size()) {
|
||||
throw new BusinessException(DetectionResponseEnum.MONITOR_NUM_REPEAT);
|
||||
throw new BusinessException(DetectionResponseEnum.MONITOR_NUM_REPEAT, "【" + name + "】该被检设备下存在相同线路号的监测点!");
|
||||
}
|
||||
Integer max = CollectionUtil.max(numList);
|
||||
Integer min = CollectionUtil.min(numList);
|
||||
@@ -1309,10 +1318,10 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
// 根据num排序
|
||||
pqMonitorExcelList.sort(Comparator.comparingInt(PqMonitorExcel::getNum));
|
||||
StringBuilder inspectChannelBuilder = new StringBuilder();
|
||||
for (int i = 1; i <= devChns; i++) {
|
||||
inspectChannelBuilder.append(i);
|
||||
if (i < devChns) {
|
||||
inspectChannelBuilder.append(",");
|
||||
for (int i = 0; i < numList.size(); i++) {
|
||||
inspectChannelBuilder.append(numList.get(i));
|
||||
if (i < numList.size() - 1) {
|
||||
inspectChannelBuilder.append(StrUtil.COMMA);
|
||||
}
|
||||
}
|
||||
importPqDev.setInspectChannel(inspectChannelBuilder.toString());
|
||||
|
||||
@@ -154,10 +154,10 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
|
||||
this.importData(contrastDevExcelList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqStandardDev> listByPlanId(String planId) {
|
||||
return adPlanStandardDevMapper.listByPlanId(Collections.singletonList(planId));
|
||||
}
|
||||
// @Override
|
||||
// public List<PqStandardDev> listByPlanId(String planId) {
|
||||
// return adPlanStandardDevMapper.listByPlanId(Collections.singletonList(planId));
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<PreDetection> listStandardDevPreDetection(List<String> ids) {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.gather.monitor.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -33,5 +35,21 @@ public interface PqMonitorMapper extends MPJBaseMapper<PqMonitor> {
|
||||
PqMonitor getByDevIdAndNum(@Param("devId") String devId, @Param("num") Integer num);
|
||||
|
||||
List<PqMonitor> listByDevIds(@Param("devIds") List<String> devIds);
|
||||
|
||||
void updateDeviceCheckState(@Param("devId")String devId, @Param("value") Integer value);
|
||||
|
||||
void updateDeviceCheckResult(@Param("devId")String devId, @Param("value") Integer value);
|
||||
|
||||
void updateDeviceReportRState(@Param("devId")String devId, @Param("value") Integer value);
|
||||
|
||||
AdPlan getPlanByDevId(@Param("devId") String devId);
|
||||
|
||||
List<PqDevSub> listDevSubByPlanId(@Param("planId") String planId);
|
||||
|
||||
void updatePlanCheckState(@Param("planId") String planId, @Param("value") Integer value);
|
||||
|
||||
void updatePlanCheckResult(@Param("planId") String planId, @Param("value") Integer value);
|
||||
|
||||
void updatePlanReportRState(@Param("planId") String planId, @Param("value") Integer value);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.gather.monitor.mapper.PqMonitorMapper">
|
||||
|
||||
|
||||
<select id="selectMonitorInfo"
|
||||
resultType="com.njcn.gather.device.pojo.vo.PreDetection$MonitorListDTO">
|
||||
SELECT CONCAT(pq_dev.IP, '_', Num) as lineId,
|
||||
@@ -41,5 +42,55 @@
|
||||
</foreach>
|
||||
order by Num
|
||||
</select>
|
||||
|
||||
<update id="updateDeviceCheckState">
|
||||
update pq_dev_sub
|
||||
set Check_State = #{value}
|
||||
where dev_Id = #{devId}
|
||||
</update>
|
||||
|
||||
<update id="updateDeviceCheckResult">
|
||||
update pq_dev_sub
|
||||
set Check_Result = #{value}
|
||||
where dev_Id = #{devId}
|
||||
</update>
|
||||
|
||||
<update id="updateDeviceReportRState">
|
||||
update pq_dev_sub
|
||||
set Report_State = #{value}
|
||||
where dev_Id = #{devId}
|
||||
</update>
|
||||
|
||||
<select id="getPlanByDevId" resultType="com.njcn.gather.plan.pojo.po.AdPlan">
|
||||
select *
|
||||
from ad_plan
|
||||
inner join pq_dev on ad_plan.id = pq_dev.Plan_Id
|
||||
where pq_dev.Id = #{devId}
|
||||
</select>
|
||||
|
||||
<select id="listDevSubByPlanId" resultType="com.njcn.gather.device.pojo.po.PqDevSub">
|
||||
select *
|
||||
from pq_dev_sub
|
||||
inner join pq_dev on pq_dev_sub.dev_Id = pq_dev.Id
|
||||
where pq_dev.Plan_Id = #{planId}
|
||||
</select>
|
||||
|
||||
<update id="updatePlanCheckState">
|
||||
update ad_plan
|
||||
set Test_State = #{value}
|
||||
where id = #{planId}
|
||||
</update>
|
||||
|
||||
<update id="updatePlanCheckResult">
|
||||
update ad_plan
|
||||
set Result = #{value}
|
||||
where id = #{planId}
|
||||
</update>
|
||||
|
||||
<update id="updatePlanReportRState">
|
||||
update ad_plan
|
||||
set Report_State = #{value}
|
||||
where id = #{planId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -10,11 +10,15 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||
import com.njcn.gather.device.pojo.enums.CheckResultEnum;
|
||||
import com.njcn.gather.device.pojo.enums.CheckStateEnum;
|
||||
import com.njcn.gather.device.pojo.enums.DevReportStateEnum;
|
||||
import com.njcn.gather.device.pojo.po.PqDevSub;
|
||||
import com.njcn.gather.monitor.mapper.PqMonitorMapper;
|
||||
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||
import com.njcn.gather.storage.service.impl.DetectionDataServiceImpl;
|
||||
@@ -26,6 +30,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -62,11 +67,104 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
@Transactional
|
||||
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
||||
// 先删除原有数据
|
||||
this.deletePqMonitorByDevId(devId);
|
||||
// 再添加新数据
|
||||
// this.deletePqMonitorByDevId(devId);
|
||||
|
||||
// 添加新数据
|
||||
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(paramList, PqMonitor.class);
|
||||
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
||||
return this.saveBatch(pqMonitorList);
|
||||
|
||||
List<PqMonitor> existedMonitorList = this.listPqMonitorByDevIds(Collections.singletonList(devId));
|
||||
|
||||
Map<Integer, List<PqMonitor>> map = pqMonitorList.stream().collect(Collectors.groupingBy(PqMonitor::getNum));
|
||||
|
||||
List<PqMonitor> newMonitorList = new ArrayList<>();
|
||||
map.forEach((num, monitorList) -> {
|
||||
PqMonitor pqMonitor = existedMonitorList.stream().filter(monitor -> monitor.getNum() == num).findFirst().orElse(null);
|
||||
|
||||
if (ObjectUtil.isNotNull(pqMonitor)) {
|
||||
BeanUtil.copyProperties(monitorList.get(0), pqMonitor, "id", "realtimeResult", "statisticsResult", "recordedResult", "realtimeNum", "statisticsNum", "recordedNum", "resultType", "qualifiedNum");
|
||||
newMonitorList.add(pqMonitor);
|
||||
} else {
|
||||
newMonitorList.addAll(monitorList);
|
||||
}
|
||||
});
|
||||
|
||||
// 同步更新设备的状态
|
||||
List<PqMonitor> enableCheckMonitorList = newMonitorList.stream().filter(pqMonitor -> pqMonitor.getCheckFlag() == 1).collect(Collectors.toList());
|
||||
List<PqMonitor> checkedMonitorList = enableCheckMonitorList.stream().filter(pqMonitor -> ObjectUtil.isNotNull(pqMonitor.getResultType())).collect(Collectors.toList());
|
||||
|
||||
if (enableCheckMonitorList.size() == checkedMonitorList.size() && checkedMonitorList.size() > 0) {
|
||||
this.baseMapper.updateDeviceCheckState(devId, CheckStateEnum.CHECKED.getValue());
|
||||
this.baseMapper.updateDeviceReportRState(devId, DevReportStateEnum.NOT_GENERATED.getValue());
|
||||
}
|
||||
if (enableCheckMonitorList.size() > checkedMonitorList.size() && checkedMonitorList.size() > 0) {
|
||||
this.baseMapper.updateDeviceCheckState(devId, CheckStateEnum.CHECKING.getValue());
|
||||
this.baseMapper.updateDeviceReportRState(devId, DevReportStateEnum.NOT_GENERATED.getValue());
|
||||
}
|
||||
if (enableCheckMonitorList.size() > 0 && checkedMonitorList.size() == 0) {
|
||||
this.baseMapper.updateDeviceCheckState(devId, CheckStateEnum.UNCHECKED.getValue());
|
||||
}
|
||||
|
||||
List<Integer> monitorResultList = checkedMonitorList.stream().map(pqMonitor -> {
|
||||
String resultType = pqMonitor.getResultType();
|
||||
DataSourceEnum dataSourceEnum = DataSourceEnum.ofByValue(resultType);
|
||||
switch (dataSourceEnum) {
|
||||
case REAL_DATA:
|
||||
return pqMonitor.getRealtimeResult();
|
||||
case WAVE_DATA:
|
||||
return pqMonitor.getRecordedResult();
|
||||
case MINUTE_STATISTICS_MAX:
|
||||
case MINUTE_STATISTICS_MIN:
|
||||
case MINUTE_STATISTICS_AVG:
|
||||
case MINUTE_STATISTICS_CP95:
|
||||
return pqMonitor.getStatisticsResult();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
long qualifiedCount = monitorResultList.stream().filter(result -> result != null && result == 1).count();
|
||||
if (qualifiedCount == monitorResultList.size() && monitorResultList.size() > 0) {
|
||||
this.baseMapper.updateDeviceCheckResult(devId, CheckResultEnum.ACCORD.getValue());
|
||||
} else if (monitorResultList.size() > 0) {
|
||||
this.baseMapper.updateDeviceCheckResult(devId, CheckResultEnum.NOT_ACCORD.getValue());
|
||||
} else {
|
||||
this.baseMapper.updateDeviceCheckResult(devId, CheckResultEnum.UNCHECKED.getValue());
|
||||
}
|
||||
|
||||
// 同步更新计划的状态
|
||||
AdPlan plan = this.baseMapper.getPlanByDevId(devId);
|
||||
List<PqDevSub> devSubList = this.baseMapper.listDevSubByPlanId(plan.getId());
|
||||
|
||||
List<PqDevSub> checkedDevSubList = devSubList.stream().filter(pqDevSub -> pqDevSub.getCheckState() == CheckStateEnum.CHECKED.getValue()).collect(Collectors.toList());
|
||||
List<PqDevSub> checkingDevSubList = devSubList.stream().filter(pqDevSub -> pqDevSub.getCheckState() == CheckStateEnum.CHECKING.getValue()).collect(Collectors.toList());
|
||||
if (checkedDevSubList.size() == devSubList.size() && devSubList.size() > 0) {
|
||||
this.baseMapper.updatePlanCheckState(plan.getId(), CheckStateEnum.CHECKED.getValue());
|
||||
} else if (checkedDevSubList.size() > 0 || checkingDevSubList.size() > 0) {
|
||||
this.baseMapper.updatePlanCheckState(plan.getId(), CheckStateEnum.CHECKING.getValue());
|
||||
} else {
|
||||
this.baseMapper.updatePlanCheckState(plan.getId(), CheckStateEnum.UNCHECKED.getValue());
|
||||
}
|
||||
|
||||
List<PqDevSub> accordDevSubList = checkedDevSubList.stream().filter(pqDevSub -> pqDevSub.getCheckResult() == CheckResultEnum.ACCORD.getValue()).collect(Collectors.toList());
|
||||
if (accordDevSubList.size() == checkedDevSubList.size() && checkedDevSubList.size() > 0) {
|
||||
this.baseMapper.updatePlanCheckResult(plan.getId(), CheckResultEnum.ACCORD.getValue());
|
||||
} else if (accordDevSubList.size() > 0) {
|
||||
this.baseMapper.updatePlanCheckResult(plan.getId(), CheckResultEnum.NOT_ACCORD.getValue());
|
||||
} else {
|
||||
this.baseMapper.updatePlanCheckResult(plan.getId(), CheckResultEnum.UNCHECKED.getValue());
|
||||
}
|
||||
|
||||
List<PqDevSub> generatedDevSubList = checkedDevSubList.stream().filter(pqDevSub -> pqDevSub.getReportState() == DevReportStateEnum.GENERATED.getValue()).collect(Collectors.toList());
|
||||
if (generatedDevSubList.size() == checkedDevSubList.size() && checkedDevSubList.size() > 0) {
|
||||
this.baseMapper.updatePlanReportRState(plan.getId(), PlanReportStateEnum.REPORT_STATE_ALL_GENERATED.getValue());
|
||||
} else if (generatedDevSubList.size() > 0) {
|
||||
this.baseMapper.updatePlanReportRState(plan.getId(), PlanReportStateEnum.REPORT_STATE_PARTIALLY_GENERATED.getValue());
|
||||
} else {
|
||||
this.baseMapper.updatePlanReportRState(plan.getId(), PlanReportStateEnum.REPORT_STATE_NOT_GENERATED.getValue());
|
||||
}
|
||||
return this.saveOrUpdateBatch(newMonitorList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,10 +261,19 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
} else {
|
||||
newWaveNum.set(waveNum);
|
||||
newMonitorResult = waveNumResultMap.get(waveNum);
|
||||
if (newMonitorResult == 2) {
|
||||
newMonitorResult = CheckResultEnum.NOT_ACCORD.getValue();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
newMonitorResult = detectionDataDealService.getMonitorResult(monitorId, adTypes, dataSourceEnum.getValue(), num, null, code);
|
||||
if (newMonitorResult == 2) {
|
||||
newMonitorResult = CheckResultEnum.NOT_ACCORD.getValue();
|
||||
}
|
||||
if (newMonitorResult == 1) {
|
||||
newMonitorResult = CheckResultEnum.ACCORD.getValue();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -188,7 +295,18 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
|
||||
if (CheckResultEnum.ACCORD.getValue().equals(oldMonitorResult)) {
|
||||
if (CheckResultEnum.ACCORD.getValue().equals(newMonitorResult)) {
|
||||
qualifiedNum += 1;
|
||||
String oldNum = "";
|
||||
if (DataSourceEnum.REAL_DATA.getValue().equals(resultType)) {
|
||||
oldNum = monitor.getRealtimeNum();
|
||||
} else if (DataSourceEnum.WAVE_DATA.getValue().equals(resultType)) {
|
||||
oldNum = monitor.getRecordedNum();
|
||||
} else {
|
||||
oldNum = monitor.getStatisticsNum();
|
||||
}
|
||||
String[] split1 = oldNum.split(CnSocketUtil.SPLIT_TAG);
|
||||
if (!split1[0].equals(num.toString())) {
|
||||
qualifiedNum += 1;
|
||||
}
|
||||
updateFlag = true;
|
||||
}
|
||||
} else {
|
||||
@@ -269,11 +387,38 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
String resultType = monitor.getResultType();
|
||||
if (StrUtil.isNotBlank(resultType)) {
|
||||
if (DataSourceEnum.REAL_DATA.getValue().equals(resultType)) {
|
||||
allResultFlags.add(monitor.getRealtimeResult());
|
||||
//allResultFlags.add(monitor.getRealtimeResult());
|
||||
if (monitor.getRealtimeResult() == 0) {
|
||||
allResultFlags.add(2);
|
||||
}
|
||||
if (monitor.getRealtimeResult() == 1) {
|
||||
allResultFlags.add(1);
|
||||
}
|
||||
if (monitor.getRealtimeResult() == 4) {
|
||||
allResultFlags.add(4);
|
||||
}
|
||||
} else if (DataSourceEnum.WAVE_DATA.getValue().equals(resultType)) {
|
||||
allResultFlags.add(monitor.getRecordedResult());
|
||||
//allResultFlags.add(monitor.getRecordedResult());
|
||||
if (monitor.getRecordedResult() == 0) {
|
||||
allResultFlags.add(2);
|
||||
}
|
||||
if (monitor.getRecordedResult() == 1) {
|
||||
allResultFlags.add(1);
|
||||
}
|
||||
if (monitor.getRecordedResult() == 4) {
|
||||
allResultFlags.add(4);
|
||||
}
|
||||
} else {
|
||||
allResultFlags.add(monitor.getStatisticsResult());
|
||||
//allResultFlags.add(monitor.getStatisticsResult());
|
||||
if (monitor.getStatisticsResult() == 0) {
|
||||
allResultFlags.add(2);
|
||||
}
|
||||
if (monitor.getStatisticsResult() == 1) {
|
||||
allResultFlags.add(1);
|
||||
}
|
||||
if (monitor.getStatisticsResult() == 4) {
|
||||
allResultFlags.add(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class AdPlanController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getBigTestItem")
|
||||
@ApiOperation("获取检测大项数据")
|
||||
@ApiImplicitParam(name = "id", value = "检测计划id", required = true)
|
||||
@ApiImplicitParam(name = "checkParam", value = "检测计划id", required = true)
|
||||
public HttpResult<List<Map<String, String>>> getBigTestItem(@RequestBody AdPlanParam.CheckParam checkParam) {
|
||||
String methodDescribe = getMethodDescribe("getBigTestItem");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, checkParam);
|
||||
@@ -191,7 +191,7 @@ public class AdPlanController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/analyse")
|
||||
@ApiOperation("检测数据分析")
|
||||
@ApiImplicitParam(name = "planId", value = "检测计划id", required = true)
|
||||
@ApiImplicitParam(name = "ids", value = "检测计划id", required = true)
|
||||
public void analyse(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("analyse");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
@@ -201,7 +201,7 @@ public class AdPlanController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/listByPlanId")
|
||||
@ApiOperation("查询出所有已绑定的设备")
|
||||
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<List<PqDevVO>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||
@@ -241,7 +241,7 @@ public class AdPlanController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/listDevByPlanId")
|
||||
@ApiOperation("根据计划id分页查询被检设备")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqDevVO>> listDevByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||
String methodDescribe = getMethodDescribe("listDevByPlanId");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
* @data 2025/1/9 14:02
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "报表管理")
|
||||
@Api(tags = "报告管理")
|
||||
@RestController
|
||||
@RequestMapping("/report")
|
||||
@RequiredArgsConstructor
|
||||
@@ -46,7 +46,7 @@ public class ReportController extends BaseController {
|
||||
*/
|
||||
@OperateInfo
|
||||
@PostMapping("/generateReport")
|
||||
@ApiOperation("生成测试报告")
|
||||
@ApiOperation("生成报告")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<Object> generateReport(@RequestBody DevReportParam devReportParam) {
|
||||
String methodDescribe = getMethodDescribe("generateReport");
|
||||
@@ -60,7 +60,7 @@ public class ReportController extends BaseController {
|
||||
*/
|
||||
@OperateInfo
|
||||
@PostMapping("/downloadReport")
|
||||
@ApiOperation("下载测试报告")
|
||||
@ApiOperation("下载报告")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public void downloadReport(@RequestBody DevReportParam devReportParam, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("downloadReport");
|
||||
@@ -91,7 +91,7 @@ public class ReportController extends BaseController {
|
||||
@OperateInfo(operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增报告模板")
|
||||
@ApiImplicitParam(name = "param", value = "报告模板参数", required = true)
|
||||
@ApiImplicitParam(name = "reportParam", value = "报告模板参数", required = true)
|
||||
public HttpResult<Boolean> add(ReportParam reportParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},新增参数为:{}", methodDescribe, reportParam);
|
||||
@@ -106,7 +106,7 @@ public class ReportController extends BaseController {
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("更新报告模板")
|
||||
@ApiImplicitParam(name = "param", value = "报告模板参数", required = true)
|
||||
@ApiImplicitParam(name = "reportParam", value = "报告模板参数", required = true)
|
||||
public HttpResult<Boolean> update(ReportParam.UpdateParam reportParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},修改参数为:{}", methodDescribe, reportParam);
|
||||
@@ -136,7 +136,6 @@ public class ReportController extends BaseController {
|
||||
@OperateInfo
|
||||
@GetMapping("/listAllName")
|
||||
@ApiOperation("查询所有报告模板名称")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<List<String>> listAllName() {
|
||||
String methodDescribe = getMethodDescribe("listAllName");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqReportService.listAllName(), methodDescribe);
|
||||
@@ -145,7 +144,7 @@ public class ReportController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/documented")
|
||||
@ApiOperation("设备归档")
|
||||
@ApiImplicitParam(name = "id", value = "设备id", required = true)
|
||||
@ApiImplicitParam(name = "ids", value = "设备id", required = true)
|
||||
public HttpResult<Boolean> documented(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("documented");
|
||||
LogUtil.njcnDebug(log, "{},设备id为:{}", methodDescribe, ids);
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ResultController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/reCalculate")
|
||||
@ApiOperation("重新计算检测结果")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
@ApiImplicitParam(name = "param", value = "重新计算参数", required = true)
|
||||
public HttpResult<Object> reCalculate(@RequestBody @Validated ResultParam.ChangeErrorSystemParam param) {
|
||||
String methodDescribe = getMethodDescribe("reCalculate");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||
@@ -115,7 +115,7 @@ public class ResultController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
||||
@GetMapping("/deleteTempTable")
|
||||
@ApiOperation("删除临时表")
|
||||
@ApiImplicitParam(name = "param", value = "删除参数", required = true)
|
||||
@ApiImplicitParam(name = "code", value = "计划对应的表后缀code", required = true)
|
||||
public HttpResult<Object> deleteTempTable(@RequestParam("code") String code) {
|
||||
String methodDescribe = getMethodDescribe("deleteTempTable");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, code);
|
||||
@@ -127,7 +127,7 @@ public class ResultController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getContrastFormContent")
|
||||
@ApiOperation("获取比对式检测结果-表单内容")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<FormContentVO> getContrastFormContent(@RequestBody @Validated ResultParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("getContrastFormContent");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
@@ -139,7 +139,7 @@ public class ResultController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getContrastResult")
|
||||
@ApiOperation("获取比对式检测结果")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<ContrastResultVO> getContrastResult(@RequestBody @Validated ResultParam.QueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("getContrastResult");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
@@ -154,7 +154,7 @@ public class ResultController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getMonitorResult")
|
||||
@ApiOperation("获取监测点的检测结果")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true)
|
||||
public HttpResult<List<MonitorResultVO>> getMonitorResult(@RequestParam("devId") String devId) {
|
||||
String methodDescribe = getMethodDescribe("getMonitorResult");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, devId);
|
||||
@@ -180,7 +180,7 @@ public class ResultController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateMonitorResult")
|
||||
@ApiOperation("更新监测点的检测结果")
|
||||
@ApiImplicitParam(name = "result", value = "更新内容", required = true)
|
||||
@ApiImplicitParam(name = "resultParams", value = "更新内容", required = true)
|
||||
public HttpResult<Boolean> updateMonitorResult(@RequestBody @Validated MonitorResultVO resultParams) {
|
||||
String methodDescribe = getMethodDescribe("updateMonitorResult");
|
||||
LogUtil.njcnDebug(log, "{},更新数据为:{}", methodDescribe, resultParams);
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ResultParam {
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
|
||||
private String planId;
|
||||
|
||||
@ApiModelProperty(value = "脚本Id", required = false)
|
||||
@ApiModelProperty(value = "脚本Id")
|
||||
private String scriptId;
|
||||
|
||||
@ApiModelProperty(value = "误差体系Id", required = true)
|
||||
@@ -95,6 +95,7 @@ public class ResultParam {
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_ID_FORMAT_ERROR)
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty(value = "计划对应表后缀", required = true)
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "模式Id", required = true)
|
||||
|
||||
@@ -14,58 +14,38 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
public class MonitorResultVO implements Comparable<MonitorResultVO> {
|
||||
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
@ApiModelProperty(value = "监测点id", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.DEV_MONITOR_ID_NOT_BLANK)
|
||||
private String monitorId;
|
||||
|
||||
/**
|
||||
* 监测点序号
|
||||
*/
|
||||
@ApiModelProperty(value = "监测点序号")
|
||||
private Integer monitorNum;
|
||||
|
||||
/**
|
||||
* 总检测次数
|
||||
*/
|
||||
@ApiModelProperty(value = "总检测次数")
|
||||
private Integer totalNum;
|
||||
|
||||
/**
|
||||
* 合格检测次数
|
||||
*/
|
||||
@ApiModelProperty(value = "合格检测次数")
|
||||
private Integer qualifiedNum;
|
||||
|
||||
/**
|
||||
* 不合格检测次数
|
||||
*/
|
||||
@ApiModelProperty(value = "不合格检测次数")
|
||||
private Integer unQualifiedNum;
|
||||
|
||||
/**
|
||||
* 误差体系名称
|
||||
*/
|
||||
@ApiModelProperty(value = "误差体系名称")
|
||||
private String errorSysName;
|
||||
|
||||
/**
|
||||
* 检测结果
|
||||
*/
|
||||
@ApiModelProperty(value = "检测结果", required = true)
|
||||
@NotNull(message = DetectionValidMessage.DEV_MONITOR_RESULT_NOT_NULL)
|
||||
private Integer checkResult;
|
||||
|
||||
/**
|
||||
* 结论来源
|
||||
*/
|
||||
|
||||
@ApiModelProperty(value = "结论来源")
|
||||
private String resultOrigin;
|
||||
/**
|
||||
* 哪次
|
||||
*/
|
||||
|
||||
@ApiModelProperty(value = "使用哪次检测结果", required = true)
|
||||
@NotNull(message = DetectionValidMessage.DEV_MONITOR_RESULT_NUM_NOT_BLANK)
|
||||
private String whichTime;
|
||||
/**
|
||||
* 数据源类型
|
||||
*/
|
||||
|
||||
|
||||
@ApiModelProperty(value = "数据源类型", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.DEV_MONITOR_RESULT_TYPE_NOT_BLANK)
|
||||
private String resultType;
|
||||
|
||||
@@ -398,8 +398,8 @@ public class ResultServiceImpl implements IResultService {
|
||||
double cosValue = Math.cos((aDtl1.get(0).getAngle() - aDtl2.get(0).getAngle()) / 180 * Math.PI);
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(cosValue).setScale(6, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
dtlType.setScriptTypeName(ResultUnitEnum.V_RELATIVE.getName() + "=" + v.get(0).getValue().intValue() + unitV
|
||||
+ " " + ResultUnitEnum.I_RELATIVE.getName() + "=" + i.get(0).getValue().intValue() + unitI
|
||||
dtlType.setScriptTypeName(ResultUnitEnum.V_RELATIVE.getName() + "=" + v.get(0).getValue() + unitV
|
||||
+ " " + ResultUnitEnum.I_RELATIVE.getName() + "=" + i.get(0).getValue() + unitI
|
||||
+ " cos(φ)=" + bigDecimal.doubleValue());
|
||||
}
|
||||
break;
|
||||
@@ -415,7 +415,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
unit = ResultUnitEnum.V_ABSOLUTELY.getUnit();
|
||||
}
|
||||
List<PqScriptDtls> v = scriptDtlIndexList.stream().filter(x -> "VOL".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + v.get(0).getValue().intValue() + unit);
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + v.get(0).getValue() + unit);
|
||||
break;
|
||||
/**
|
||||
* 电流
|
||||
@@ -429,7 +429,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
unitI = ResultUnitEnum.I_ABSOLUTELY.getUnit();
|
||||
}
|
||||
List<PqScriptDtls> I = scriptDtlIndexList.stream().filter(x -> "CUR".equals(x.getValueType())).collect(Collectors.toList());
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + I.get(0).getValue().intValue() + unitI);
|
||||
dtlType.setScriptTypeName(dictTree.getName() + "=" + I.get(0).getValue() + unitI);
|
||||
break;
|
||||
/**
|
||||
* 谐波电压
|
||||
@@ -449,12 +449,12 @@ public class ResultServiceImpl implements IResultService {
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getHarmNum, LinkedHashMap::new, Collectors.toList()));
|
||||
if (harmNumMap.size() > 1) {
|
||||
//叠加2~50次谐波电压(含有率为GB/T)
|
||||
dtlType.setScriptTypeName("叠加" + harmNumMap.entrySet().iterator().next().getValue().get(0).getHarmNum().intValue() + "~" +
|
||||
new ArrayList<>(harmNumMap.entrySet()).get(harmNumMap.size() - 1).getValue().get(0).getHarmNum().intValue()
|
||||
dtlType.setScriptTypeName("叠加" + harmNumMap.entrySet().iterator().next().getValue().get(0).getHarmNum() + "~" +
|
||||
new ArrayList<>(harmNumMap.entrySet()).get(harmNumMap.size() - 1).getValue().get(0).getHarmNum()
|
||||
+ "次" + dictTree.getName()); // + "(含有率为GB/T)"
|
||||
} else {
|
||||
//叠加5%的2次谐波电压
|
||||
dtlType.setScriptTypeName("叠加" + hv.get(0).getValue().intValue() + ResultUnitEnum.HV.getUnit() + "的" + hv.get(0).getHarmNum().intValue() + "次" + dictTree.getName());
|
||||
dtlType.setScriptTypeName("叠加" + hv.get(0).getValue() + ResultUnitEnum.HV.getUnit() + "的" + hv.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||
}
|
||||
break;
|
||||
/**
|
||||
@@ -488,7 +488,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
dtlType.setScriptTypeName(a.toString());
|
||||
} else {
|
||||
//叠加5%的2次谐波电压
|
||||
dtlType.setScriptTypeName("叠加" + harmInNumList.get(0).getValue().intValue() + ResultUnitEnum.HV.getUnit() + "的" + harmInNumList.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||
dtlType.setScriptTypeName("叠加" + harmInNumList.get(0).getValue() + ResultUnitEnum.HV.getUnit() + "的" + harmInNumList.get(0).getHarmNum() + "次" + dictTree.getName());
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1554,10 +1554,10 @@ public class ResultServiceImpl implements IResultService {
|
||||
}
|
||||
List<ContrastBaseResult> allResultList = new ArrayList<>();
|
||||
|
||||
List<ContrastNonHarmonicResult> contrastNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, false, queryParam.getDeviceId(), adTypeList);
|
||||
contrastNonHarmonicResults.addAll(contrastNonHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, true, queryParam.getDeviceId(), adTypeList));
|
||||
List<ContrastHarmonicResult> contrastHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, false, queryParam.getDeviceId(), adTypeList);
|
||||
contrastHarmonicResults.addAll(contrastHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, true, queryParam.getDeviceId(), adTypeList));
|
||||
List<ContrastNonHarmonicResult> contrastNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, false, null, queryParam.getDeviceId(), adTypeList);
|
||||
contrastNonHarmonicResults.addAll(contrastNonHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, true, null, queryParam.getDeviceId(), adTypeList));
|
||||
List<ContrastHarmonicResult> contrastHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, false, null, queryParam.getDeviceId(), adTypeList);
|
||||
contrastHarmonicResults.addAll(contrastHarmonicService.listAllResultData(String.valueOf(plan.getCode()), null, null, true, null, queryParam.getDeviceId(), adTypeList));
|
||||
allResultList.addAll(contrastHarmonicResults);
|
||||
allResultList.addAll(contrastNonHarmonicResults);
|
||||
|
||||
@@ -1658,6 +1658,26 @@ public class ResultServiceImpl implements IResultService {
|
||||
result.setResultType(resultType + CnSocketUtil.SPLIT_TAG + waveData.get(1));
|
||||
result.setResultOrigin(dataSourceEnum.getMsg() + waveData.get(1));
|
||||
break;
|
||||
case MINUTE_STATISTICS_AVG:
|
||||
result.setCheckResult(pqMonitor.getStatisticsResult());
|
||||
result.setWhichTime(pqMonitor.getStatisticsNum());
|
||||
result.setResultOrigin(dataSourceEnum.getMsg());
|
||||
break;
|
||||
case MINUTE_STATISTICS_MAX:
|
||||
result.setCheckResult(pqMonitor.getStatisticsResult());
|
||||
result.setWhichTime(pqMonitor.getStatisticsNum());
|
||||
result.setResultOrigin(dataSourceEnum.getMsg());
|
||||
break;
|
||||
case MINUTE_STATISTICS_MIN:
|
||||
result.setCheckResult(pqMonitor.getStatisticsResult());
|
||||
result.setWhichTime(pqMonitor.getStatisticsNum());
|
||||
result.setResultOrigin(dataSourceEnum.getMsg());
|
||||
break;
|
||||
case MINUTE_STATISTICS_CP95:
|
||||
result.setCheckResult(pqMonitor.getStatisticsResult());
|
||||
result.setWhichTime(pqMonitor.getStatisticsNum());
|
||||
result.setResultOrigin(dataSourceEnum.getMsg());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1683,27 +1703,27 @@ public class ResultServiceImpl implements IResultService {
|
||||
}
|
||||
AdPlan finalPlan = plan;
|
||||
// 实时数据结果
|
||||
List<ContrastNonHarmonicResult> realNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, monitorId, null);
|
||||
Map<Integer, List<ContrastNonHarmonicResult>> numNonHarmonicMap = realNonHarmonicResults.stream()
|
||||
List<ContrastNonHarmonicResult> realNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, DataSourceEnum.REAL_DATA.getValue(), monitorId, null);
|
||||
Map<Integer, List<ContrastNonHarmonicResult>> realNumNonHarmonicMap = realNonHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getNum))
|
||||
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
List<ContrastHarmonicResult> realHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, monitorId, null);
|
||||
Map<Integer, List<ContrastHarmonicResult>> numHarmonicMap = realHarmonicResults.stream()
|
||||
List<ContrastHarmonicResult> realHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, DataSourceEnum.REAL_DATA.getValue(), monitorId, null);
|
||||
Map<Integer, List<ContrastHarmonicResult>> realNumHarmonicMap = realHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(ContrastHarmonicResult::getNum))
|
||||
.collect(Collectors.groupingBy(ContrastHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
Map<Integer, List<Integer>> numResutMap = new TreeMap<>();
|
||||
numNonHarmonicMap.forEach((num, resultList) -> {
|
||||
numResutMap.put(num, resultList.stream().map(ContrastNonHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||
Map<Integer, List<Integer>> realNumResutMap = new TreeMap<>();
|
||||
realNumNonHarmonicMap.forEach((num, resultList) -> {
|
||||
realNumResutMap.put(num, resultList.stream().map(ContrastNonHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||
});
|
||||
numHarmonicMap.forEach((num, resultList) -> {
|
||||
List<Integer> list = numResutMap.getOrDefault(num, new ArrayList<>());
|
||||
realNumHarmonicMap.forEach((num, resultList) -> {
|
||||
List<Integer> list = realNumResutMap.getOrDefault(num, new ArrayList<>());
|
||||
list.addAll(resultList.stream().map(ContrastHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||
numResutMap.put(num, list);
|
||||
realNumResutMap.put(num, list);
|
||||
});
|
||||
|
||||
numResutMap.forEach((num, resultList) -> {
|
||||
realNumResutMap.forEach((num, resultList) -> {
|
||||
List<DataSourceResultVO> dataSourceResultVOList = new ArrayList<>();
|
||||
DataSourceResultVO realDataSourceResultVO = new DataSourceResultVO();
|
||||
realDataSourceResultVO.setDataSourceCode(DataSourceEnum.REAL_DATA.getValue());
|
||||
@@ -1714,14 +1734,14 @@ public class ResultServiceImpl implements IResultService {
|
||||
result.put(num, dataSourceResultVOList);
|
||||
});
|
||||
|
||||
Map<Integer, Map<Integer, List<Integer>>> waveNumMap = new TreeMap<>();
|
||||
|
||||
// 录波数据结果
|
||||
List<ContrastNonHarmonicResult> waveNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, true, monitorId, null);
|
||||
Map<Integer, Map<Integer, List<Integer>>> waveNumMap = new TreeMap<>();
|
||||
List<ContrastNonHarmonicResult> waveNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, true, null, monitorId, null);
|
||||
Map<Integer, List<ContrastNonHarmonicResult>> waveNumNonHarmonicMap = waveNonHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getNum))
|
||||
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||
List<ContrastHarmonicResult> waveHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, true, monitorId, null);
|
||||
List<ContrastHarmonicResult> waveHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, true, null, monitorId, null);
|
||||
Map<Integer, List<ContrastHarmonicResult>> waveNumHarmonicMap = waveHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(ContrastHarmonicResult::getNum))
|
||||
.collect(Collectors.groupingBy(ContrastHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||
@@ -1763,6 +1783,62 @@ public class ResultServiceImpl implements IResultService {
|
||||
result.put(num, orDefault);
|
||||
});
|
||||
|
||||
String dataRule = finalPlan.getDatasourceId();
|
||||
String[] split1 = dataRule.split(CnSocketUtil.SPLIT_TAG);
|
||||
DataSourceEnum dataType = null;
|
||||
for (String s : split1) {
|
||||
if (MINUTE_STATISTICS_AVG.getValue().equals(s)) {
|
||||
dataType = MINUTE_STATISTICS_AVG;
|
||||
break;
|
||||
}
|
||||
if (MINUTE_STATISTICS_CP95.getValue().equals(s)) {
|
||||
dataType = MINUTE_STATISTICS_CP95;
|
||||
break;
|
||||
}
|
||||
if (MINUTE_STATISTICS_MAX.getValue().equals(s)) {
|
||||
dataType = MINUTE_STATISTICS_MAX;
|
||||
break;
|
||||
}
|
||||
if (MINUTE_STATISTICS_MIN.getValue().equals(s)) {
|
||||
dataType = MINUTE_STATISTICS_MIN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 统计数据
|
||||
if (ObjectUtil.isNotNull(dataType)) {
|
||||
List<ContrastNonHarmonicResult> statisticsNonHarmonicResults = contrastNonHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, dataType.getValue(), monitorId, null);
|
||||
Map<Integer, List<ContrastNonHarmonicResult>> statisticsNumNonHarmonicMap = statisticsNonHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(ContrastNonHarmonicResult::getNum))
|
||||
.collect(Collectors.groupingBy(ContrastNonHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
List<ContrastHarmonicResult> statisticsHarmonicResults = contrastHarmonicService.listAllResultData(String.valueOf(finalPlan.getCode()), null, null, false, dataType.getValue(), monitorId, null);
|
||||
Map<Integer, List<ContrastHarmonicResult>> statisticsNumHarmonicMap = statisticsHarmonicResults.stream()
|
||||
.sorted(Comparator.comparing(ContrastHarmonicResult::getNum))
|
||||
.collect(Collectors.groupingBy(ContrastHarmonicResult::getNum, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
Map<Integer, List<Integer>> statisticsNumResutMap = new TreeMap<>();
|
||||
statisticsNumNonHarmonicMap.forEach((num, resultList) -> {
|
||||
statisticsNumResutMap.put(num, resultList.stream().map(ContrastNonHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||
});
|
||||
statisticsNumHarmonicMap.forEach((num, resultList) -> {
|
||||
List<Integer> list = statisticsNumResutMap.getOrDefault(num, new ArrayList<>());
|
||||
list.addAll(resultList.stream().map(ContrastHarmonicResult::getResultFlag).distinct().collect(Collectors.toList()));
|
||||
statisticsNumResutMap.put(num, list);
|
||||
});
|
||||
|
||||
DataSourceEnum finalDataType = dataType;
|
||||
statisticsNumResutMap.forEach((num, resultList) -> {
|
||||
List<DataSourceResultVO> dataSourceResultVOList = new ArrayList<>();
|
||||
DataSourceResultVO realDataSourceResultVO = new DataSourceResultVO();
|
||||
realDataSourceResultVO.setDataSourceCode(finalDataType.getValue());
|
||||
realDataSourceResultVO.setDataSourceName(finalDataType.getMsg());
|
||||
realDataSourceResultVO.setCheckResult(StorageUtil.getInteger(resultList));
|
||||
dataSourceResultVOList.add(realDataSourceResultVO);
|
||||
|
||||
result.put(num, dataSourceResultVOList);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1802,8 +1878,11 @@ public class ResultServiceImpl implements IResultService {
|
||||
monitor.setRecordedResult(null);
|
||||
monitor.setRecordedNum(null);
|
||||
}
|
||||
boolean flag = pqMonitorService.updateById(monitor);
|
||||
|
||||
return pqMonitorService.updateById(monitor);
|
||||
pqDevService.updateResult(split[0], null);
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1814,8 +1893,8 @@ public class ResultServiceImpl implements IResultService {
|
||||
|
||||
String monitorId = devId + CnSocketUtil.SPLIT_TAG + chnNum;
|
||||
|
||||
List<ContrastNonHarmonicResult> realNoHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, null, false, monitorId, null);
|
||||
List<ContrastHarmonicResult> realHarmonicResults = contrastHarmonicService.listAllResultData(code, num, null, false, monitorId, null);
|
||||
List<ContrastNonHarmonicResult> realNoHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, null, false, null, monitorId, null);
|
||||
List<ContrastHarmonicResult> realHarmonicResults = contrastHarmonicService.listAllResultData(code, num, null, false, null, monitorId, null);
|
||||
|
||||
Map<String, List<Integer>> checkItemResultMap = realNoHarmonicResults.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getAdType, Collectors.mapping(ContrastNonHarmonicResult::getResultFlag, Collectors.toList())));
|
||||
checkItemResultMap.putAll(realHarmonicResults.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getAdType, Collectors.mapping(ContrastHarmonicResult::getResultFlag, Collectors.toList()))));
|
||||
@@ -1834,8 +1913,8 @@ public class ResultServiceImpl implements IResultService {
|
||||
|
||||
checkItemResultMap.clear();
|
||||
|
||||
List<ContrastNonHarmonicResult> waveNoHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, null, true, monitorId, null);
|
||||
List<ContrastHarmonicResult> waveHarmonicResults = contrastHarmonicService.listAllResultData(code, num, null, true, monitorId, null);
|
||||
List<ContrastNonHarmonicResult> waveNoHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, null, true, null, monitorId, null);
|
||||
List<ContrastHarmonicResult> waveHarmonicResults = contrastHarmonicService.listAllResultData(code, num, null, true, null, monitorId, null);
|
||||
if (CollUtil.isNotEmpty(waveNoHarmonicResults) && CollUtil.isNotEmpty(waveHarmonicResults)) {
|
||||
checkItemResultMap.putAll(waveNoHarmonicResults.stream().collect(Collectors.groupingBy(ContrastNonHarmonicResult::getAdType, Collectors.mapping(ContrastNonHarmonicResult::getResultFlag, Collectors.toList()))));
|
||||
checkItemResultMap.putAll(waveHarmonicResults.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getAdType, Collectors.mapping(ContrastHarmonicResult::getResultFlag, Collectors.toList()))));
|
||||
@@ -1955,8 +2034,10 @@ public class ResultServiceImpl implements IResultService {
|
||||
int totalDataPoints = 0; // 统计总的数据点数
|
||||
int zeroFilteredPoints = 0; // 统计双零过滤的数据点数
|
||||
|
||||
// 遍历 2~50 次谐波
|
||||
for (int harmNum = 2; harmNum <= 50; harmNum++) {
|
||||
// 间谐波从1开始,普通谐波从2开始
|
||||
int startHarmNum = isInterHarmonic ? 1 : 2;
|
||||
// 遍历谐波次数
|
||||
for (int harmNum = startHarmNum; harmNum <= 50; harmNum++) {
|
||||
String harmKey = String.valueOf(harmNum);
|
||||
Map<String, Map<String, Map<String, String>>> checkResultHarmonic = new LinkedHashMap<>();
|
||||
List<String> zeroFilteredPhases = new ArrayList<>(); // 当前次数被过滤的相别
|
||||
@@ -2301,10 +2382,8 @@ public class ResultServiceImpl implements IResultService {
|
||||
contrastTestResult.setHarmonic(false);
|
||||
List<String> allResult = new ArrayList<>();
|
||||
Map<String, Map<String, String>> checkResultNonHarmonic = new LinkedHashMap<>();
|
||||
|
||||
// 根据指标代码确定小数位数
|
||||
Integer decimalPlaces = getDecimalPlacesByScriptCode(dictTree.getCode());
|
||||
|
||||
try {
|
||||
// 非谐波的需要注意是否为T相还是ABC三相的
|
||||
if (PowerConstant.T_PHASE.contains(dictTree.getCode())) {
|
||||
@@ -2430,27 +2509,22 @@ public class ResultServiceImpl implements IResultService {
|
||||
Map<String, String> dataMap = new LinkedHashMap<>();
|
||||
if (CollUtil.isNotEmpty(dataList)) {
|
||||
DetectionData detectionData = dataList.get(0);
|
||||
|
||||
// 相别
|
||||
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
|
||||
// 有效组数 todo... 目前是对齐组数
|
||||
dataMap.put(ItemReportKeyEnum.NUM_OF_DATA.getKey(), String.valueOf(numOfData));
|
||||
|
||||
// 标准值 - 根据参数决定是否格式化
|
||||
String standardValue = String.valueOf(detectionData.getResultData());
|
||||
if (decimalPlaces != null && detectionData.getResultData() != null) {
|
||||
standardValue = formatSignificantDigits(detectionData.getResultData(), decimalPlaces);
|
||||
}
|
||||
dataMap.put(ItemReportKeyEnum.STANDARD.getKey(), standardValue);
|
||||
|
||||
// 被检值 - 根据参数决定是否格式化
|
||||
String testValue = String.valueOf(detectionData.getData());
|
||||
if (decimalPlaces != null && detectionData.getData() != null) {
|
||||
testValue = formatSignificantDigits(detectionData.getData(), decimalPlaces);
|
||||
}
|
||||
dataMap.put(ItemReportKeyEnum.TEST.getKey(), testValue);
|
||||
|
||||
|
||||
// 误差 - 根据参数决定是否格式化
|
||||
String errorValue = String.valueOf(detectionData.getErrorData());
|
||||
if (decimalPlaces != null && detectionData.getErrorData() != null) {
|
||||
@@ -2459,7 +2533,6 @@ public class ResultServiceImpl implements IResultService {
|
||||
errorValue = "/";
|
||||
}
|
||||
dataMap.put(ItemReportKeyEnum.ERROR.getKey(), errorValue);
|
||||
|
||||
// 误差范围 - 根据参数决定是否格式化
|
||||
String errorScope = String.valueOf(detectionData.getRadius());
|
||||
if (decimalPlaces != null && detectionData.getRadius() != null) {
|
||||
@@ -2468,7 +2541,6 @@ public class ResultServiceImpl implements IResultService {
|
||||
errorScope = "/";
|
||||
}
|
||||
dataMap.put(ItemReportKeyEnum.A_ERROR_SCOPE.getKey(), errorScope);
|
||||
|
||||
// 结论
|
||||
dataMap.put(ItemReportKeyEnum.RESULT.getKey(), getTestResult(detectionData.getIsData()));
|
||||
} else {
|
||||
@@ -2563,8 +2635,20 @@ public class ResultServiceImpl implements IResultService {
|
||||
Map<String, String> dataMap = new LinkedHashMap<>();
|
||||
if (CollUtil.isNotEmpty(dataList)) {
|
||||
DetectionData detectionData = dataList.get(0);
|
||||
// 次数
|
||||
dataMap.put(ItemReportKeyEnum.TIME.getKey(), String.valueOf(harmNum));
|
||||
// 次数 - 从数据对象中获取实际次数(间谐波为1.5、2.5等)
|
||||
String timeValue;
|
||||
if (detectionData.getNum() != null) {
|
||||
double numValue = detectionData.getNum();
|
||||
// 如果是整数,则只显示整数部分(如2.0显示为2)
|
||||
if (numValue == Math.floor(numValue)) {
|
||||
timeValue = String.valueOf((int) numValue);
|
||||
} else {
|
||||
timeValue = String.valueOf(numValue);
|
||||
}
|
||||
} else {
|
||||
timeValue = String.valueOf(harmNum);
|
||||
}
|
||||
dataMap.put(ItemReportKeyEnum.TIME.getKey(), timeValue);
|
||||
// 相别
|
||||
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
|
||||
// 有效组数 todo... 目前是对齐组数
|
||||
@@ -2605,7 +2689,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
// 结论
|
||||
dataMap.put(ItemReportKeyEnum.RESULT.getKey(), getTestResult(detectionData.getIsData()));
|
||||
} else {
|
||||
// 次数
|
||||
// 次数 - 数据为空时用循环变量作为兜底
|
||||
dataMap.put(ItemReportKeyEnum.TIME.getKey(), String.valueOf(harmNum));
|
||||
// 相别
|
||||
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
|
||||
@@ -2680,8 +2764,8 @@ public class ResultServiceImpl implements IResultService {
|
||||
private Map<String, List<RawResultDataVO>> getResultMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code) {
|
||||
Map<String, List<RawResultDataVO>> resultMap = new LinkedHashMap<>();
|
||||
|
||||
List<ContrastNonHarmonicResult> contrastNonHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, waveNum, isWave, monitorId, adTypeList);
|
||||
List<ContrastHarmonicResult> contrastHarmonicResults = contrastHarmonicService.listAllResultData(code, num, waveNum, isWave, monitorId, adTypeList);
|
||||
List<ContrastNonHarmonicResult> contrastNonHarmonicResults = contrastNonHarmonicService.listAllResultData(code, num, waveNum, isWave, null, monitorId, adTypeList);
|
||||
List<ContrastHarmonicResult> contrastHarmonicResults = contrastHarmonicService.listAllResultData(code, num, waveNum, isWave, null, monitorId, adTypeList);
|
||||
|
||||
if (CollUtil.isNotEmpty(contrastNonHarmonicResults)) {
|
||||
ContrastNonHarmonicResult contrastNonHarmonicResult = contrastNonHarmonicResults.get(0);
|
||||
@@ -2778,10 +2862,10 @@ public class ResultServiceImpl implements IResultService {
|
||||
private Map<String, List<AlignDataVO.RawData>> getRawDataMap(DictTree dictTree, List<String> adTypeList, String monitorId, String unit, Integer num, Integer waveNum, Boolean isWave, String code, List<String> keys) {
|
||||
Map<String, List<AlignDataVO.RawData>> rawMap = new LinkedHashMap<>();
|
||||
|
||||
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(code, num, waveNum, isWave, 0, monitorId, adTypeList);
|
||||
List<ContrastNonHarmonicResult> stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(code, num, waveNum, isWave, 1, monitorId, adTypeList);
|
||||
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(code, num, waveNum, isWave, 0, monitorId, adTypeList);
|
||||
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(code, num, waveNum, isWave, 1, monitorId, adTypeList);
|
||||
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(code, num, waveNum, isWave, null, 0, monitorId, adTypeList);
|
||||
List<ContrastNonHarmonicResult> stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(code, num, waveNum, isWave, null, 1, monitorId, adTypeList);
|
||||
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(code, num, waveNum, isWave, null, 0, monitorId, adTypeList);
|
||||
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(code, num, waveNum, isWave, null, 1, monitorId, adTypeList);
|
||||
|
||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
List<AlignDataVO.RawData> rawDataVOList = new ArrayList<>();
|
||||
@@ -3143,10 +3227,10 @@ public class ResultServiceImpl implements IResultService {
|
||||
devIdMapComm.put(standardDev.getIp(), standardDev.getId());
|
||||
});
|
||||
|
||||
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, 0, deviceId, null);
|
||||
List<ContrastNonHarmonicResult> stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, 1, deviceId, null);
|
||||
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, 0, deviceId, null);
|
||||
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, 1, deviceId, null);
|
||||
List<ContrastNonHarmonicResult> devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, null, 0, deviceId, null);
|
||||
List<ContrastNonHarmonicResult> stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, null, false, null, 1, deviceId, null);
|
||||
List<ContrastHarmonicResult> devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, null, 0, deviceId, null);
|
||||
List<ContrastHarmonicResult> stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, null, false, null, 1, deviceId, null);
|
||||
|
||||
List<DevData> devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
|
||||
List<DevData> standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1);
|
||||
@@ -3163,10 +3247,10 @@ public class ResultServiceImpl implements IResultService {
|
||||
|
||||
AdPlanTestConfig adPlanTestConfig = adPlanTestConfigService.getByPlanId(planId);
|
||||
for (int i = 1; i <= adPlanTestConfig.getWaveRecord(); i++) {
|
||||
devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, 0, deviceId, null);
|
||||
stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, 1, deviceId, null);
|
||||
devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, 0, deviceId, null);
|
||||
stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, 1, deviceId, null);
|
||||
devNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, null, 0, deviceId, null);
|
||||
stdDevNonHarmonicRawDataList = contrastNonHarmonicService.listAllRawData(oldCode, num, i, true, null, 1, deviceId, null);
|
||||
devHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, null, 0, deviceId, null);
|
||||
stdDevHarmonicRawDataList = contrastHarmonicService.listAllRawData(oldCode, num, i, true, null, 1, deviceId, null);
|
||||
|
||||
devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap, 0);
|
||||
standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap, 1);
|
||||
@@ -3317,8 +3401,17 @@ public class ResultServiceImpl implements IResultService {
|
||||
devMonitorIdMap2.forEach((devMonitorId, value) -> {
|
||||
Map<LocalDateTime, List<ContrastHarmonicResult>> timeListMap = value.stream().collect(Collectors.groupingBy(ContrastHarmonicResult::getTimeId, Collectors.toList()));
|
||||
|
||||
String[] split1 = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
||||
timeListMap.forEach((time, value1) -> {
|
||||
DevData devData = info.stream().filter(x -> x.getTime().equals(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)))).findFirst().orElse(null);
|
||||
// DevData devData = info.stream().filter(x -> x.getTime().equals(time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)))).findFirst().orElse(null);
|
||||
DevData devData = null;
|
||||
for (int i = 0; i < info.size(); i++) {
|
||||
DevData devData1 = info.get(i);
|
||||
if (time.format(DateTimeFormatter.ofPattern(DatePattern.ISO8601_PATTERN)).equals(devData1.getTime()) && devData1.getId().split(CnSocketUtil.SPLIT_TAG)[1].equals(split1[1])) {
|
||||
devData = devData1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(devData)) {
|
||||
String[] split = devMonitorId.split(CnSocketUtil.SPLIT_TAG);
|
||||
if (flag == 0) {
|
||||
@@ -3508,7 +3601,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
switch (scriptCode) {
|
||||
// 保留2位小数
|
||||
case "FREQ": // 频率
|
||||
return 2;
|
||||
return 4;
|
||||
// 保留3位小数
|
||||
case "I": // 电流
|
||||
return 3;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class PqScriptController extends BaseController {
|
||||
@OperateInfo(operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增检测脚本")
|
||||
@ApiImplicitParam(name = "pqDevParam", value = "检测脚本", required = true)
|
||||
@ApiImplicitParam(name = "param", value = "检测脚本", required = true)
|
||||
public HttpResult<String> add(@RequestBody @Validated PqScriptParam param) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||
@@ -69,7 +69,7 @@ public class PqScriptController extends BaseController {
|
||||
@OperateInfo(operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改检测脚本")
|
||||
@ApiImplicitParam(name = "updateParam", value = "检测脚本", required = true)
|
||||
@ApiImplicitParam(name = "param", value = "检测脚本", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated PqScriptParam.UpdateParam param) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
||||
|
||||
@@ -127,17 +127,5 @@ public class PqSourceController extends BaseController {
|
||||
List<SourceParam> result = pqSourceService.getSourceParam(sourceId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo
|
||||
@GetMapping("/aa")
|
||||
@ApiOperation("按照检测源ID获取源参数")
|
||||
@ApiImplicitParam(name = "pqSourceId", value = "检测源ID", required = true)
|
||||
public HttpResult<SourceInitialize> aa(@RequestParam("sourceId") String sourceId) {
|
||||
String methodDescribe = getMethodDescribe("getParam");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sourceId);
|
||||
SourceInitialize sourceInitializeParam = pqSourceService.getSourceInitializeParam(sourceId);
|
||||
String jsonString = JSON.toJSONString(sourceInitializeParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sourceInitializeParam, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class DevTypeController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改设备类型")
|
||||
@ApiImplicitParam(name = "devTypeParam", value = "设备类型", required = true)
|
||||
@ApiImplicitParam(name = "updateParam", value = "设备类型参数", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated DevTypeParam.UpdateParam updateParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, updateParam);
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.njcn.gather.storage.controller;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.gather.storage.pojo.po.SimAndDigHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.po.SimAndDigNonHarmonicResult;
|
||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "处理数据")
|
||||
@RestController
|
||||
@RequestMapping("/dataDeal")
|
||||
@RequiredArgsConstructor
|
||||
public class DataDealController extends BaseController {
|
||||
|
||||
private final DetectionDataDealService detectionDataDealService;
|
||||
|
||||
|
||||
@GetMapping("ttt")
|
||||
public HttpResult<Object> dataDealAndInsert(){
|
||||
String methodDescribe = getMethodDescribe("dataDealAndInsert");
|
||||
|
||||
List<SimAndDigHarmonicResult> list2 = new ArrayList<>();
|
||||
SimAndDigHarmonicResult SimAndDigHarmonicResult = new SimAndDigHarmonicResult();
|
||||
SimAndDigHarmonicResult.setDataType("aa");
|
||||
SimAndDigHarmonicResult.setAdType("aaaa");
|
||||
|
||||
SimAndDigHarmonicResult.setDevMonitorId("ss");
|
||||
SimAndDigHarmonicResult.setScriptId("ddd");
|
||||
SimAndDigHarmonicResult.setTimeId(LocalDateTime.now());
|
||||
|
||||
list2.add(SimAndDigHarmonicResult);
|
||||
SimAndDigHarmonicResult SimAndDigHarmonicResult2 = new SimAndDigHarmonicResult();
|
||||
SimAndDigHarmonicResult2.setDataType("aabb");
|
||||
SimAndDigHarmonicResult2.setAdType("aaaabb");
|
||||
|
||||
SimAndDigHarmonicResult2.setDevMonitorId("ssbb");
|
||||
SimAndDigHarmonicResult2.setScriptId("dddbb");
|
||||
SimAndDigHarmonicResult2.setTimeId(LocalDateTime.now());
|
||||
list2.add(SimAndDigHarmonicResult2);
|
||||
|
||||
detectionDataDealService.acceptHarmonic(list2,"1");
|
||||
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.njcn.gather.storage.controller;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.gather.storage.service.TableGenService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "生成表")
|
||||
@RestController
|
||||
@RequestMapping("/genTable")
|
||||
@RequiredArgsConstructor
|
||||
public class TableGenController extends BaseController {
|
||||
|
||||
private final TableGenService tableGenService;
|
||||
|
||||
|
||||
@GetMapping("genAdHarmonicTable")
|
||||
@ApiOperation("生成表")
|
||||
@OperateInfo
|
||||
public HttpResult<Object> genAdHarmonicTable(@RequestParam("code") String code, @RequestParam("isContrast") boolean isContrast) {
|
||||
String methodDescribe = getMethodDescribe("genAdHarmonicTable");
|
||||
tableGenService.genTable(code, isContrast);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@
|
||||
Time_Id DATETIME(3) NOT NULL COMMENT '时间',
|
||||
AD_Type CHAR(32) NOT NULL COMMENT '检测指标,字典表',
|
||||
Data_Type CHAR(32) NOT NULL COMMENT '数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表',
|
||||
A_Value float DEFAULT NULL COMMENT 'A相值',
|
||||
B_Value float DEFAULT NULL COMMENT 'B相值',
|
||||
C_Value float DEFAULT NULL COMMENT 'C相值',
|
||||
T_Value float DEFAULT NULL COMMENT 'T相值(没有相别的则存这里)',
|
||||
A_Value float(14,7) DEFAULT NULL COMMENT 'A相值',
|
||||
B_Value float(14,7) DEFAULT NULL COMMENT 'B相值',
|
||||
C_Value float(14,7) DEFAULT NULL COMMENT 'C相值',
|
||||
T_Value float(14,7) DEFAULT NULL COMMENT 'T相值(没有相别的则存这里)',
|
||||
Result_Flag int(1) NULL COMMENT '1合格 2不合格 4无法处理',
|
||||
<choose>
|
||||
<when test="isContrast">
|
||||
@@ -19,9 +19,9 @@
|
||||
Std_Dev_Monitor_Id CHAR(34) NOT NULL COMMENT '标准设备监测点Id',
|
||||
Num tinyint(1) unsigned DEFAULT 0 COMMENT '第几次检测',
|
||||
Flag tinyint(1) unsigned NOT NULL COMMENT '0表示被检设备数据,1表示标准设备数据',
|
||||
A_Value_0 float NULL COMMENT 'A相基波有效值',
|
||||
B_Value_0 float NULL COMMENT 'B相基波有效值',
|
||||
C_Value_0 float NULL COMMENT 'B相基波有效值',
|
||||
A_Value_0 float(14,7) NULL COMMENT 'A相基波有效值',
|
||||
B_Value_0 float(14,7) NULL COMMENT 'B相基波有效值',
|
||||
C_Value_0 float(14,7) NULL COMMENT 'B相基波有效值',
|
||||
Wave_Num tinyint(1) unsigned DEFAULT null COMMENT '录波数据第几组',
|
||||
PRIMARY KEY (Id)
|
||||
</when>
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.njcn.gather.storage.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.storage.pojo.po.ContrastHarmonicResult;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -22,7 +21,7 @@ public interface ContrastHarmonicService extends IService<ContrastHarmonicResult
|
||||
* @param adTypeList
|
||||
* @return
|
||||
*/
|
||||
List<ContrastHarmonicResult> listAllRawData(String code, Integer num, Integer waveNum, Boolean isWave, Integer flag, String devId, List<String> adTypeList);
|
||||
List<ContrastHarmonicResult> listAllRawData(String code, Integer num, Integer waveNum, Boolean isWave, String dataType, Integer flag, String devId, List<String> adTypeList);
|
||||
|
||||
/**
|
||||
* 获取所有谐波结果数据
|
||||
@@ -33,27 +32,29 @@ public interface ContrastHarmonicService extends IService<ContrastHarmonicResult
|
||||
* @param devId 设备ID
|
||||
* @return
|
||||
*/
|
||||
List<ContrastHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String devId, List<String> adTypeList);
|
||||
List<ContrastHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String dataType, String devId, List<String> adTypeList);
|
||||
|
||||
|
||||
/**
|
||||
* 获取谐波检测项的比对结果
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
*
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @param time 第几次检测
|
||||
* @return 检测结果
|
||||
*/
|
||||
ContrastHarmonicResult getContrastResultHarm(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time);
|
||||
|
||||
/**
|
||||
* 去原始表获取总次数
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
*
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @param time 第几次检测
|
||||
* @return 数据组数
|
||||
*/
|
||||
int getNumOfData(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time);
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.njcn.gather.storage.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.storage.pojo.po.ContrastNonHarmonicResult;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -19,12 +18,13 @@ public interface ContrastNonHarmonicService extends IService<ContrastNonHarmonic
|
||||
* @param num
|
||||
* @param waveNum
|
||||
* @param isWave
|
||||
* @param dataType
|
||||
* @param flag
|
||||
* @param devId
|
||||
* @param adTypeList
|
||||
* @return
|
||||
*/
|
||||
List<ContrastNonHarmonicResult> listAllRawData(String code, Integer num, Integer waveNum, Boolean isWave, Integer flag, String devId, List<String> adTypeList);
|
||||
List<ContrastNonHarmonicResult> listAllRawData(String code, Integer num, Integer waveNum, Boolean isWave, String dataType, Integer flag, String devId, List<String> adTypeList);
|
||||
|
||||
|
||||
/**
|
||||
@@ -34,31 +34,34 @@ public interface ContrastNonHarmonicService extends IService<ContrastNonHarmonic
|
||||
* @param num
|
||||
* @param waveNum
|
||||
* @param isWave
|
||||
* @param dataType
|
||||
* @param devId
|
||||
* @param adTypeList
|
||||
* @return
|
||||
*/
|
||||
|
||||
List<ContrastNonHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String devId, List<String> adTypeList);
|
||||
List<ContrastNonHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String dataType, String devId, List<String> adTypeList);
|
||||
|
||||
/**
|
||||
* 获取非谐波检测项的比对结果
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
*
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @param time 第几次检测
|
||||
* @return 检测结果
|
||||
*/
|
||||
ContrastNonHarmonicResult getContrastResultHarm(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time);
|
||||
|
||||
/**
|
||||
* 去原始表获取总次数
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
*
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @param time 第几次检测
|
||||
* @return 数据组数
|
||||
*/
|
||||
int getNumOfData(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time);
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.njcn.gather.storage.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.gather.storage.mapper.ContrastHarmonicMappper;
|
||||
import com.njcn.gather.storage.pojo.po.ContrastHarmonicResult;
|
||||
@@ -13,7 +13,6 @@ import com.njcn.gather.storage.service.ContrastHarmonicService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -26,12 +25,13 @@ public class ContrastHarmonicServiceImpl extends ServiceImpl<ContrastHarmonicMap
|
||||
|
||||
|
||||
@Override
|
||||
public List<ContrastHarmonicResult> listAllRawData(String code, Integer num, Integer waveNum, Boolean isWave, Integer flag, String devId, List<String> adTypeList) {
|
||||
public List<ContrastHarmonicResult> listAllRawData(String code, Integer num, Integer waveNum, Boolean isWave, String dataType, Integer flag, String devId, List<String> adTypeList) {
|
||||
String prefix = "ad_harmonic_" + code;
|
||||
DynamicTableNameHandler.setTableName(prefix);
|
||||
LambdaQueryChainWrapper<ContrastHarmonicResult> wrapper = this.lambdaQuery().likeRight(ContrastHarmonicResult::getDevMonitorId, devId)
|
||||
.eq(ObjectUtil.isNotNull(num), ContrastHarmonicResult::getNum, num)
|
||||
.eq(ContrastHarmonicResult::getFlag, flag)
|
||||
.eq(StrUtil.isNotBlank(dataType), ContrastHarmonicResult::getDataType, dataType)
|
||||
.in(CollUtil.isNotEmpty(adTypeList), ContrastHarmonicResult::getAdType, adTypeList)
|
||||
.orderByAsc(ContrastHarmonicResult::getTimeId);
|
||||
if (isWave) {
|
||||
@@ -48,15 +48,14 @@ public class ContrastHarmonicServiceImpl extends ServiceImpl<ContrastHarmonicMap
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* todo... 缺少统计的数据获取逻辑
|
||||
*/
|
||||
|
||||
@Override
|
||||
public List<ContrastHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String devId, List<String> adTypeList) {
|
||||
public List<ContrastHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String dataType, String devId, List<String> adTypeList) {
|
||||
String prefix = "ad_harmonic_result_" + code;
|
||||
DynamicTableNameHandler.setTableName(prefix);
|
||||
LambdaQueryChainWrapper<ContrastHarmonicResult> wrapper = this.lambdaQuery().likeRight(ContrastHarmonicResult::getDevMonitorId, devId)
|
||||
.eq(ObjectUtil.isNotNull(num), ContrastHarmonicResult::getNum, num)
|
||||
.eq(StrUtil.isNotBlank(dataType), ContrastHarmonicResult::getDataType, dataType)
|
||||
.in(CollUtil.isNotEmpty(adTypeList), ContrastHarmonicResult::getAdType, adTypeList);
|
||||
if (isWave) {
|
||||
if (ObjectUtil.isNotNull(waveNum)) {
|
||||
@@ -73,12 +72,11 @@ public class ContrastHarmonicServiceImpl extends ServiceImpl<ContrastHarmonicMap
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @param time 第几次检测
|
||||
* @return 检测结果
|
||||
*/
|
||||
@Override
|
||||
@@ -93,7 +91,7 @@ public class ContrastHarmonicServiceImpl extends ServiceImpl<ContrastHarmonicMap
|
||||
waveTime = Integer.parseInt(parts[parts.length - 1]);
|
||||
}
|
||||
}
|
||||
List<ContrastHarmonicResult> result = this.listAllResultData(String.valueOf(planCode), time, waveTime, isWave, monitorId, scriptId);
|
||||
List<ContrastHarmonicResult> result = this.listAllResultData(String.valueOf(planCode), time, waveTime, isWave, null, monitorId, scriptId);
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
return result.get(0);
|
||||
}
|
||||
@@ -102,11 +100,12 @@ public class ContrastHarmonicServiceImpl extends ServiceImpl<ContrastHarmonicMap
|
||||
|
||||
/**
|
||||
* 去原始表获取总次数
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
*
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @param time 第几次检测
|
||||
* @return 数据组数
|
||||
*/
|
||||
@Override
|
||||
@@ -128,10 +127,10 @@ public class ContrastHarmonicServiceImpl extends ServiceImpl<ContrastHarmonicMap
|
||||
.in(ContrastHarmonicResult::getAdType, scriptId)
|
||||
.eq(ContrastHarmonicResult::getFlag, 0)
|
||||
.eq(ContrastHarmonicResult::getNum, time);
|
||||
if(isWave){
|
||||
if (isWave) {
|
||||
wrapper.eq(ContrastHarmonicResult::getDataType, "wave_data")
|
||||
.eq(ContrastHarmonicResult::getWaveNum, waveTime);
|
||||
}else{
|
||||
} else {
|
||||
wrapper.eq(ContrastHarmonicResult::getDataType, resultType);
|
||||
}
|
||||
// 执行查询并统计满足条件的记录数
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.gather.storage.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
@@ -12,7 +13,6 @@ import com.njcn.gather.storage.service.ContrastNonHarmonicService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -25,12 +25,13 @@ public class ContrastNonHarmonicServiceImpl extends ServiceImpl<ContrastNonHarmo
|
||||
|
||||
|
||||
@Override
|
||||
public List<ContrastNonHarmonicResult> listAllRawData(String code, Integer num, Integer waveNum, Boolean isWave, Integer flag, String devId, List<String> adTypeList) {
|
||||
public List<ContrastNonHarmonicResult> listAllRawData(String code, Integer num, Integer waveNum, Boolean isWave, String dataType, Integer flag, String devId, List<String> adTypeList) {
|
||||
String prefix = "ad_non_harmonic_" + code;
|
||||
DynamicTableNameHandler.setTableName(prefix);
|
||||
LambdaQueryChainWrapper<ContrastNonHarmonicResult> wrapper = this.lambdaQuery().likeRight(ContrastNonHarmonicResult::getDevMonitorId, devId)
|
||||
.eq(ObjectUtil.isNotNull(num), ContrastNonHarmonicResult::getNum, num)
|
||||
.eq(ContrastNonHarmonicResult::getFlag, flag)
|
||||
.eq(StrUtil.isNotBlank(dataType), ContrastNonHarmonicResult::getDataType, dataType)
|
||||
.in(CollUtil.isNotEmpty(adTypeList), ContrastNonHarmonicResult::getAdType, adTypeList)
|
||||
.orderByAsc(ContrastNonHarmonicResult::getTimeId);
|
||||
if (isWave) {
|
||||
@@ -48,11 +49,12 @@ public class ContrastNonHarmonicServiceImpl extends ServiceImpl<ContrastNonHarmo
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ContrastNonHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String devId, List<String> adTypeList) {
|
||||
public List<ContrastNonHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String dataType, String devId, List<String> adTypeList) {
|
||||
String prefix = "ad_non_harmonic_result_" + code;
|
||||
DynamicTableNameHandler.setTableName(prefix);
|
||||
LambdaQueryChainWrapper<ContrastNonHarmonicResult> wrapper = this.lambdaQuery().likeRight(ContrastNonHarmonicResult::getDevMonitorId, devId)
|
||||
.eq(ObjectUtil.isNotNull(num), ContrastNonHarmonicResult::getNum, num)
|
||||
.eq(StrUtil.isNotBlank(dataType), ContrastNonHarmonicResult::getDataType, dataType)
|
||||
.in(CollUtil.isNotEmpty(adTypeList), ContrastNonHarmonicResult::getAdType, adTypeList);
|
||||
if (isWave) {
|
||||
if (ObjectUtil.isNotNull(waveNum)) {
|
||||
@@ -80,7 +82,7 @@ public class ContrastNonHarmonicServiceImpl extends ServiceImpl<ContrastNonHarmo
|
||||
waveTime = Integer.parseInt(parts[parts.length - 1]);
|
||||
}
|
||||
}
|
||||
List<ContrastNonHarmonicResult> result = this.listAllResultData(String.valueOf(planCode), time, waveTime, isWave, monitorId, scriptId);
|
||||
List<ContrastNonHarmonicResult> result = this.listAllResultData(String.valueOf(planCode), time, waveTime, isWave, null, monitorId, scriptId);
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
return result.get(0);
|
||||
}
|
||||
@@ -106,10 +108,10 @@ public class ContrastNonHarmonicServiceImpl extends ServiceImpl<ContrastNonHarmo
|
||||
.in(ContrastNonHarmonicResult::getAdType, scriptId)
|
||||
.eq(ContrastNonHarmonicResult::getFlag, 0)
|
||||
.eq(ContrastNonHarmonicResult::getNum, time);
|
||||
if(isWave){
|
||||
if (isWave) {
|
||||
wrapper.eq(ContrastNonHarmonicResult::getDataType, "wave_data")
|
||||
.eq(ContrastNonHarmonicResult::getWaveNum, waveTime);
|
||||
}else{
|
||||
} else {
|
||||
wrapper.eq(ContrastNonHarmonicResult::getDataType, resultType);
|
||||
}
|
||||
// 执行查询并统计满足条件的记录数
|
||||
|
||||
@@ -28,13 +28,13 @@ public class TableGenServiceImpl implements TableGenService {
|
||||
StringBuilder C = new StringBuilder();
|
||||
for (int i = 1; i <= 50; i++) {
|
||||
if (i == 1) {
|
||||
A.append("A_Value_").append(i).append(" float NULL COMMENT 'A相基波',");
|
||||
B.append("B_Value_").append(i).append(" float NULL COMMENT 'B相基波',");
|
||||
C.append("C_Value_").append(i).append(" float NULL COMMENT 'C相基波',");
|
||||
A.append("A_Value_").append(i).append(" float(14,7) NULL COMMENT 'A相基波',");
|
||||
B.append("B_Value_").append(i).append(" float(14,7) NULL COMMENT 'B相基波',");
|
||||
C.append("C_Value_").append(i).append(" float(14,7) NULL COMMENT 'C相基波',");
|
||||
} else {
|
||||
A.append("A_Value_").append(i).append(" float NULL COMMENT '").append(i).append("次A相谐波',");
|
||||
B.append("B_Value_").append(i).append(" float NULL COMMENT '").append(i).append("次B相谐波',");
|
||||
C.append("C_Value_").append(i).append(" float NULL COMMENT '").append(i).append("次C相谐波',");
|
||||
A.append("A_Value_").append(i).append(" float(14,7) NULL COMMENT '").append(i).append("次A相谐波',");
|
||||
B.append("B_Value_").append(i).append(" float(14,7) NULL COMMENT '").append(i).append("次B相谐波',");
|
||||
C.append("C_Value_").append(i).append(" float(14,7) NULL COMMENT '").append(i).append("次C相谐波',");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@ public class TableGenServiceImpl implements TableGenService {
|
||||
"Std_Dev_Monitor_Id CHAR(34) NOT NULL COMMENT '标准设备监测点Id',\n" +
|
||||
"Num tinyint(1) unsigned DEFAULT 0 COMMENT '第几次检测',\n" +
|
||||
"Flag tinyint(1) unsigned NOT NULL COMMENT '0表示被检设备数据,1表示标准设备数据',\n" +
|
||||
"A_Value_0 float NULL COMMENT 'A相基波有效值',\n" +
|
||||
"C_Value_0 float NULL COMMENT 'B相基波有效值',\n" +
|
||||
"B_Value_0 float NULL COMMENT 'B相基波有效值',\n" +
|
||||
"A_Value_0 float(14,7) NULL COMMENT 'A相基波有效值',\n" +
|
||||
"C_Value_0 float(14,7) NULL COMMENT 'B相基波有效值',\n" +
|
||||
"B_Value_0 float(14,7) NULL COMMENT 'B相基波有效值',\n" +
|
||||
"Wave_Num tinyint(1) unsigned DEFAULT null COMMENT '录波数据第几组',\n" +
|
||||
"PRIMARY KEY (Id)\n"
|
||||
:
|
||||
@@ -64,9 +64,9 @@ public class TableGenServiceImpl implements TableGenService {
|
||||
// 添加索引
|
||||
tableGenMapper.genAdHarmonicTable("CREATE INDEX idx_ad_harmonic_" + code + "_dev_monitor_id" + " ON ad_harmonic_" + code + " (Dev_Monitor_Id);");
|
||||
|
||||
String a = A.toString().replaceAll("float", "json");
|
||||
String b = B.toString().replaceAll("float", "json");
|
||||
String c = C.toString().replaceAll("float", "json");
|
||||
String a = A.toString().replaceAll("float\\(14,7\\)", "json");
|
||||
String b = B.toString().replaceAll("float\\(14,7\\)", "json");
|
||||
String c = C.toString().replaceAll("float\\(14,7\\)", "json");
|
||||
String sql2 = "CREATE TABLE AD_Harmonic_Result_" + code + " (\n" +
|
||||
" Dev_Monitor_Id CHAR(34) NOT NULL COMMENT '监测点Id',\n" +
|
||||
" Time_Id DATETIME(3) NULL COMMENT '时间',\n" +
|
||||
|
||||
@@ -99,7 +99,7 @@ public class DictDataController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getDicDataById")
|
||||
@ApiOperation("根据字典id查询字典数据")
|
||||
@ApiImplicitParam(name = "dicIndex", value = "查询参数", required = true)
|
||||
@ApiImplicitParam(name = "dicIndex", value = "字典id", required = true)
|
||||
public HttpResult<DictData> getDicDataById(@RequestParam("dicIndex") String dicIndex) {
|
||||
String methodDescribe = getMethodDescribe("getDicDataById");
|
||||
DictData result = dictDataService.getDictDataById(dicIndex);
|
||||
@@ -109,7 +109,7 @@ public class DictDataController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getDicDataByCode")
|
||||
@ApiOperation("根据字典code查询字典数据")
|
||||
@ApiImplicitParam(name = "code", value = "查询参数", required = true)
|
||||
@ApiImplicitParam(name = "code", value = "字典code", required = true)
|
||||
public HttpResult<DictData> getDicDataByCode(@RequestParam("code") String code) {
|
||||
String methodDescribe = getMethodDescribe("getDicDataByCode");
|
||||
DictData result = dictDataService.getDictDataByCode(code);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DictTreeController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getTreeByCode")
|
||||
@ApiOperation("按照code查询字典树")
|
||||
@ApiImplicitParam(name = "keyword", value = "查询参数", required = true)
|
||||
@ApiImplicitParam(name = "code", value = "查询参数", required = true)
|
||||
public HttpResult<List<DictTree>> getTreeByCode(@RequestParam("code") String code) {
|
||||
String methodDescribe = getMethodDescribe("getTreeByCode");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, code);
|
||||
|
||||
@@ -34,6 +34,7 @@ public class DictTreeParam {
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@ApiModelProperty(value = "编码")
|
||||
@TableField(value = "编码")
|
||||
@NotBlank(message = SystemValidMessage.CODE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DICT_CODE_REGEX, message = SystemValidMessage.DICT_TYPE_CODE_FORMAT_ERROR)
|
||||
@@ -42,21 +43,25 @@ public class DictTreeParam {
|
||||
/**
|
||||
* 用于区分多种类型的字典树 0.台账对象类型 1.自定义报表指标类型
|
||||
*/
|
||||
@ApiModelProperty(value = "0.台账对象类型 1.自定义报表指标类型")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 根据type自定义内容,type:0用于区分对象类型是101电网侧 102用户侧
|
||||
*/
|
||||
@ApiModelProperty(value = "根据type自定义内容,type:0用于区分对象类型是101电网侧 102用户侧")
|
||||
private String extend;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ public class SysLogAudit implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 日志发生事件
|
||||
* 日志发生时间
|
||||
*/
|
||||
@Excel(name = "日志发生事件", width = 30, exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "日志发生时间", width = 30, exportFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.njcn.gather.system.log.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.csv.entity.CsvExportParams;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -56,7 +58,8 @@ public class SysLogAuditServiceImpl extends ServiceImpl<SysLogAuditMapper, SysLo
|
||||
QueryWrapper<SysLogAudit> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(param)) {
|
||||
queryWrapper.like(StrUtil.isNotBlank(param.getUserName()), "sys_log_audit.User_name", param.getUserName())
|
||||
.between(StrUtil.isAllNotBlank(param.getSearchBeginTime(), param.getSearchEndTime()), "sys_log_audit.Log_time", param.getSearchBeginTime(), param.getSearchEndTime());
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), "sys_log_audit.Log_time", LocalDateTimeUtil.parse(param.getSearchBeginTime() + " 00:00:00", DatePattern.NORM_DATETIME_FORMATTER))
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), "sys_log_audit.Log_time", LocalDateTimeUtil.parse(param.getSearchEndTime() + " 23:59:59", DatePattern.NORM_DATETIME_FORMATTER));
|
||||
}
|
||||
queryWrapper.orderByDesc("sys_log_audit.Log_time");
|
||||
return this.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||
@@ -67,7 +70,8 @@ public class SysLogAuditServiceImpl extends ServiceImpl<SysLogAuditMapper, SysLo
|
||||
QueryWrapper<SysLogAudit> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(param)) {
|
||||
queryWrapper.like(StrUtil.isNotBlank(param.getUserName()), "sys_log_audit.User_name", param.getUserName())
|
||||
.between(StrUtil.isAllNotBlank(param.getSearchBeginTime(), param.getSearchEndTime()), "sys_log_audit.Log_time", param.getSearchBeginTime(), param.getSearchEndTime());
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), "sys_log_audit.Log_time", LocalDateTimeUtil.parse(param.getSearchBeginTime() + " 00:00:00", DatePattern.NORM_DATETIME_FORMATTER))
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), "sys_log_audit.Log_time", LocalDateTimeUtil.parse(param.getSearchEndTime() + " 23:59:59", DatePattern.NORM_DATETIME_FORMATTER));
|
||||
}
|
||||
queryWrapper.orderByDesc("sys_log_audit.Log_time");
|
||||
List<SysLogAudit> list = this.list(queryWrapper);
|
||||
|
||||
@@ -36,41 +36,41 @@ import java.util.Map;
|
||||
public class SysRegResController extends BaseController {
|
||||
private final ISysRegResService sysRegResService;
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询注册版本列表")
|
||||
public HttpResult<SysRegResVO> listRegRes() {
|
||||
String methodDescribe = getMethodDescribe("listRegRes");
|
||||
LogUtil.njcnDebug(log, "{},查询参数为空", methodDescribe);
|
||||
SysRegResVO result = sysRegResService.listRegRes();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
// @GetMapping("/list")
|
||||
// @ApiOperation("查询注册版本列表")
|
||||
// public HttpResult<SysRegResVO> listRegRes() {
|
||||
// String methodDescribe = getMethodDescribe("listRegRes");
|
||||
// LogUtil.njcnDebug(log, "{},查询参数为空", methodDescribe);
|
||||
// SysRegResVO result = sysRegResService.listRegRes();
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
// }
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getRegResByType")
|
||||
@ApiOperation("根据类型id查询配置")
|
||||
@ApiImplicitParam(name = "type", value = "类型id,字典值", required = true)
|
||||
public HttpResult<SysRegRes> getRegResByType(@RequestParam("id") String typeId) {
|
||||
@ApiImplicitParam(name = "typeId", value = "类型id,字典值", required = true)
|
||||
public HttpResult<SysRegRes> getRegResByType(@RequestParam("typeId") String typeId) {
|
||||
String methodDescribe = getMethodDescribe("listByTypeId");
|
||||
LogUtil.njcnDebug(log, "{},查询参数为:{}", methodDescribe, typeId);
|
||||
SysRegRes result = sysRegResService.getRegResByType(typeId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增注册版本")
|
||||
@ApiImplicitParam(name = "sysRegRes", value = "注册版本对象", required = true)
|
||||
public HttpResult<Boolean> addRegRes(@RequestBody @Validated SysRegResParam param) {
|
||||
String methodDescribe = getMethodDescribe("addRegRes");
|
||||
LogUtil.njcnDebug(log, "{},新增参数为:{}", methodDescribe, param);
|
||||
boolean result = sysRegResService.addRegRes(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
}
|
||||
// @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
// @PostMapping("/add")
|
||||
// @ApiOperation("新增注册版本")
|
||||
// @ApiImplicitParam(name = "sysRegRes", value = "注册版本对象", required = true)
|
||||
// public HttpResult<Boolean> addRegRes(@RequestBody @Validated SysRegResParam param) {
|
||||
// String methodDescribe = getMethodDescribe("addRegRes");
|
||||
// LogUtil.njcnDebug(log, "{},新增参数为:{}", methodDescribe, param);
|
||||
// boolean result = sysRegResService.addRegRes(param);
|
||||
// if (result) {
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
// } else {
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
// }
|
||||
// }
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
|
||||
@@ -5,16 +5,13 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.njcn.gather</groupId>
|
||||
<artifactId>CN_Gather</artifactId>
|
||||
<artifactId>tools</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>activate-tool</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -30,21 +27,4 @@
|
||||
<version>2.3.12</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.json.JSONUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.tool.active.service.ActivateService;
|
||||
@@ -57,7 +58,12 @@ public class ActivateController extends BaseController {
|
||||
public HttpResult getLicense() {
|
||||
String methodDescribe = getMethodDescribe("checkLicense");
|
||||
LogUtil.njcnDebug(log, "{},获取许可信息", methodDescribe);
|
||||
ActivationCodePlaintext activationCodePlaintext = activateService.readLicenseFile();
|
||||
ActivationCodePlaintext activationCodePlaintext = null;
|
||||
try {
|
||||
activationCodePlaintext = activateService.readLicenseFile();
|
||||
} catch (BusinessException e) {
|
||||
methodDescribe = "无效的许可信息";
|
||||
}
|
||||
String macAddress = NetUtil.getLocalMacAddress();
|
||||
if (activationCodePlaintext == null) {
|
||||
activationCodePlaintext = new ActivationCodePlaintext();
|
||||
@@ -81,7 +87,6 @@ public class ActivateController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, activationCodePlaintext, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiModel("验证设备激活码参数")
|
||||
@Data
|
||||
public static class VerifyActivationCodeParams {
|
||||
@ApiModelProperty(value = "激活码")
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "登录/注销")
|
||||
@Api(tags = "登录-注销")
|
||||
@RequestMapping("/admin")
|
||||
@RequiredArgsConstructor
|
||||
public class AuthController extends BaseController {
|
||||
|
||||
@@ -153,7 +153,7 @@ public class SysFunctionController extends BaseController {
|
||||
@OperateInfo(operateType = OperateType.UPDATE, info = LogEnum.SYSTEM_MEDIUM)
|
||||
@PostMapping("/assignFunctionByRoleId")
|
||||
@ApiOperation("角色分配菜单")
|
||||
@ApiImplicitParam(name = "roleFunctionComponent", value = "角色信息", required = true)
|
||||
@ApiImplicitParam(name = "param", value = "角色信息", required = true)
|
||||
public HttpResult<Boolean> assignFunctionByRoleId(@RequestBody @Validated SysRoleParam.RoleBindFunction param) {
|
||||
String methodDescribe = getMethodDescribe("assignFunctionByRoleId");
|
||||
LogUtil.njcnDebug(log, "{},传入的角色id和资源id集合为:{}", methodDescribe, param);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class SysRoleController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增角色信息")
|
||||
@ApiImplicitParam(name = "roleParam", value = "角色信息", required = true)
|
||||
@ApiImplicitParam(name = "sysRoleParam", value = "角色信息", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated SysRoleParam sysRoleParam) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},角色信息数据为:{}", methodDescribe, sysRoleParam);
|
||||
|
||||
@@ -102,11 +102,7 @@ public class SysUserController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/updatePassword")
|
||||
@ApiOperation("修改密码")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "用户id", required = true),
|
||||
@ApiImplicitParam(name = "oldPassword", value = "旧密码", required = true),
|
||||
@ApiImplicitParam(name = "newPassword", value = "新密码", required = true)
|
||||
})
|
||||
@ApiImplicitParam(name = "param", value = "修改密码参数", required = true)
|
||||
public HttpResult<Boolean> updatePassword(@RequestBody @Validated SysUserParam.SysUserUpdatePasswordParam param) {
|
||||
String methodDescribe = getMethodDescribe("updatePassword");
|
||||
LogUtil.njcnDebug(log, "{},用户id:{},用户旧密码:{},新密码:{}", methodDescribe, param.getId(), param.getOldPassword(), param.getNewPassword());
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AuthGlobalFilter implements Filter, Ordered {
|
||||
private final static List<String> IGNORE_URI = Arrays.asList("/admin/login","/admin/getPublicKey", "/report/generateReport");
|
||||
private final static List<String> IGNORE_URI = Arrays.asList("/doc.html","/v3/api-docs","/admin/login","/admin/getPublicKey", "/report/generateReport");
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
@@ -42,7 +42,7 @@ public class AuthGlobalFilter implements Filter, Ordered {
|
||||
res.setContentType("application/json; charset=utf-8");
|
||||
|
||||
String requestURI = req.getRequestURI();
|
||||
if (IGNORE_URI.contains(requestURI)) {
|
||||
if (IGNORE_URI.contains(requestURI) || requestURI.startsWith("/webjars") || requestURI.startsWith("/swagger-resources")) {
|
||||
filterChain.doFilter(req, res);
|
||||
} else {
|
||||
String accessTokenStr = req.getHeader(SecurityConstants.AUTHORIZATION_KEY);
|
||||
|
||||
Reference in New Issue
Block a user