refactor(service): 优化设备容量计算和事件处理逻辑

- 重构CsDevCapacityPOServiceImpl中的设备容量获取方法,简化代码逻辑并添加空值检查
- 在CsEquipmentDeliveryServiceImpl中添加二维码信息更新功能
- 优化CsEventPOServiceImpl中的事件处理,添加处理标志位设置和幅度值转换
- 增强CsFeedbackServiceImpl中的工程ID验证,防止空值异常
- 优化CsLinePOServiceImpl中的线路数据处理,统一设备ID格式化
- 移除无用的包导入并修复MQTT消息处理器中的大小写问题
- 更新离线数据上传服务中的等待逻辑和设备版本获取方式
- 修复InfluxDB查询中的值类型大小写问题
This commit is contained in:
xy
2026-06-24 20:32:59 +08:00
parent 6f66e1d336
commit a27315075c
10 changed files with 66 additions and 61 deletions

View File

@@ -1,25 +1,19 @@
package com.njcn.csdevice.service.impl; package com.njcn.csdevice.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csdevice.service.CsLinePOService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.mapper.CsDevCapacityPOMapper; import com.njcn.csdevice.mapper.CsDevCapacityPOMapper;
import com.njcn.csdevice.pojo.po.CsDevCapacityPO; import com.njcn.csdevice.pojo.po.CsDevCapacityPO;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csdevice.service.CsDevCapacityPOService; import com.njcn.csdevice.service.CsDevCapacityPOService;
import com.njcn.csdevice.service.CsLinePOService;
import com.njcn.system.api.DicDataFeignClient;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
/** /**
* *
@@ -48,16 +42,13 @@ public class CsDevCapacityPOServiceImpl extends ServiceImpl<CsDevCapacityPOMappe
@Override @Override
public Double getDevCapacity(String id) { public Double getDevCapacity(String id) {
List<CsLinePO> csLinePOS = csLinePOService.queryByDevId(id); List<CsLinePO> pos = csLinePOService.queryByDevId(id);
//String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
//Optional.ofNullable(csLinePOS).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
//List<CsLinePO> collect1 = csLinePOS.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
/*治理侧监测点*/ /*治理侧监测点*/
CsLinePO csLinePO = csLinePOS.get(0); CsLinePO po = pos.stream().filter(item -> Objects.equals(item.getClDid(),0)).findFirst().orElse(null);
CsDevCapacityPO one = this.lambdaQuery().eq(CsDevCapacityPO::getLineId, csLinePO.getLineId()).eq(CsDevCapacityPO::getCldid, 0).one(); if (po == null) {
// Optional.ofNullable(one).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DATA_MISSING)); return 0.0;
}
CsDevCapacityPO one = this.lambdaQuery().eq(CsDevCapacityPO::getLineId, po.getLineId()).eq(CsDevCapacityPO::getCldid, 0).one();
if(Objects.isNull(one)){ if(Objects.isNull(one)){
return 0.0; return 0.0;
} }

View File

@@ -396,6 +396,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
csEquipmentDeliveryPo.setStatus(2); csEquipmentDeliveryPo.setStatus(2);
//4.清空老mac的数据模板 //4.清空老mac的数据模板
stringRedisTemplate.convertAndSend("model_cache_clear", "clear"); stringRedisTemplate.convertAndSend("model_cache_clear", "clear");
//5.修改二维码信息
String qr = this.createQr(csEquipmentDeliveryAuditParm.getNdid());
csEquipmentDeliveryPo.setQrPath(qr);
} }
List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId()).ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list(); List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId()).ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {

View File

@@ -154,7 +154,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CsLinePO addCldLine(CsLineParam param) { public CsLinePO addCldLine(CsLineParam param) {
String lineId = IdUtil.fastSimpleUUID(); String lineId = IdUtil.fastSimpleUUID();
List<CsDeviceRegistry> data = csDeviceRegistryService.queryByCurrentNdid(param.getDevMac().replace(":", "")); String nDid = param.getDevMac().replace(":", "");
List<CsDeviceRegistry> data = csDeviceRegistryService.queryByCurrentNdid(nDid);
Map<Integer, String> clDidToIdMap; Map<Integer, String> clDidToIdMap;
if (CollUtil.isNotEmpty(data)) { if (CollUtil.isNotEmpty(data)) {
clDidToIdMap = data.stream().collect(Collectors.toMap(CsDeviceRegistry::getClDid, CsDeviceRegistry::getId, (a, b) -> a)); clDidToIdMap = data.stream().collect(Collectors.toMap(CsDeviceRegistry::getClDid, CsDeviceRegistry::getId, (a, b) -> a));
@@ -208,8 +209,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
if (Objects.isNull(clDidToIdMap.get(param.getLineNo()))) { if (Objects.isNull(clDidToIdMap.get(param.getLineNo()))) {
CsDeviceRegistry registry = new CsDeviceRegistry(); CsDeviceRegistry registry = new CsDeviceRegistry();
registry.setId(lineId); registry.setId(lineId);
registry.setCurrentNdid(param.getDevMac()); registry.setCurrentNdid(nDid);
registry.setOldNdid(param.getDevMac()); registry.setOldNdid(nDid);
registry.setClDid(param.getLineNo()); registry.setClDid(param.getLineNo());
registry.setFirstSeenTime(LocalDateTime.now()); registry.setFirstSeenTime(LocalDateTime.now());
csDeviceRegistryService.add(Collections.singletonList(registry)); csDeviceRegistryService.add(Collections.singletonList(registry));

View File

@@ -50,7 +50,6 @@ public class OfflineDataUploadController extends BaseController {
@PostMapping(value = "/makeUpData") @PostMapping(value = "/makeUpData")
@ApiOperation("补招数据-界面") @ApiOperation("补招数据-界面")
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true) @ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
@Deprecated
public HttpResult<List<MakeUpVo>> makeUpData(@RequestParam("lineId") String lineId){ public HttpResult<List<MakeUpVo>> makeUpData(@RequestParam("lineId") String lineId){
String methodDescribe = getMethodDescribe("makeUpData"); String methodDescribe = getMethodDescribe("makeUpData");
List<MakeUpVo> list = offlineDataUploadService.getMakeUpData(lineId); List<MakeUpVo> list = offlineDataUploadService.getMakeUpData(lineId);

View File

@@ -137,21 +137,19 @@ public class MqttMessageHandler {
FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam(); FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam();
frequencyStatisticalQueryParam.setDevId(devId); frequencyStatisticalQueryParam.setDevId(devId);
frequencyStatisticalQueryParam.setStatisticalId(temp.getId()); frequencyStatisticalQueryParam.setStatisticalId(temp.getId());
frequencyStatisticalQueryParam.setValueType("avg"); frequencyStatisticalQueryParam.setValueType("AVG");
frequencyStatisticalQueryParam.setFrequencyStart(temp.getHarmStart()); frequencyStatisticalQueryParam.setFrequencyStart(temp.getHarmStart());
frequencyStatisticalQueryParam.setFrequencyEnd(temp.getHarmEnd()); frequencyStatisticalQueryParam.setFrequencyEnd(temp.getHarmEnd());
List<ThdDataVO> thdDataVOList = stableDataService.QuerySqlData(frequencyStatisticalQueryParam); List<ThdDataVO> thdDataVOList = stableDataService.QuerySqlData(frequencyStatisticalQueryParam);
tempList.addAll(thdDataVOList); tempList.addAll(thdDataVOList);
} else { } else {
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam(); CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
commonStatisticalQueryParam.setDevId(devId); commonStatisticalQueryParam.setDevId(devId);
commonStatisticalQueryParam.setStatisticalId(temp.getId()); commonStatisticalQueryParam.setStatisticalId(temp.getId());
commonStatisticalQueryParam.setValueType("avg"); commonStatisticalQueryParam.setValueType("AVG");
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam); List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
tempList.addAll(listFuture); tempList.addAll(listFuture);
} }
}); });
//过滤T相 //过滤T相
@@ -185,7 +183,7 @@ public class MqttMessageHandler {
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam(); CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
commonStatisticalQueryParam.setDevId(devId); commonStatisticalQueryParam.setDevId(devId);
commonStatisticalQueryParam.setStatisticalId(temp.getId()); commonStatisticalQueryParam.setStatisticalId(temp.getId());
commonStatisticalQueryParam.setValueType("avg"); commonStatisticalQueryParam.setValueType("AVG");
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam); List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
l1.addAll(listFuture); l1.addAll(listFuture);
}); });
@@ -224,7 +222,7 @@ public class MqttMessageHandler {
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam(); CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
commonStatisticalQueryParam.setDevId(devId); commonStatisticalQueryParam.setDevId(devId);
commonStatisticalQueryParam.setStatisticalId(temp.getId()); commonStatisticalQueryParam.setStatisticalId(temp.getId());
commonStatisticalQueryParam.setValueType("avg"); commonStatisticalQueryParam.setValueType("AVG");
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam); List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
l1.addAll(listFuture); l1.addAll(listFuture);
}); });
@@ -265,7 +263,7 @@ public class MqttMessageHandler {
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam(); CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
commonStatisticalQueryParam.setDevId(devId); commonStatisticalQueryParam.setDevId(devId);
commonStatisticalQueryParam.setStatisticalId(temp.getId()); commonStatisticalQueryParam.setStatisticalId(temp.getId());
commonStatisticalQueryParam.setValueType("avg"); commonStatisticalQueryParam.setValueType("AVG");
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam); List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
l1.addAll(listFuture); l1.addAll(listFuture);
}); });

View File

@@ -566,6 +566,9 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
po2.setAdvanceReason(po.getAdvanceReason()); po2.setAdvanceReason(po.getAdvanceReason());
po2.setAdvanceType(po.getAdvanceType()); po2.setAdvanceType(po.getAdvanceType());
po2.setFileFlag(1); po2.setFileFlag(1);
if (!Objects.isNull(po.getAdvanceReason()) && !Objects.isNull(po.getAdvanceType())) {
po2.setDealFlag(1);
}
int row = wlRmpEventDetailMapper.updateById(po2); int row = wlRmpEventDetailMapper.updateById(po2);
if (row > 0) { if (row > 0) {
result = true; result = true;
@@ -580,7 +583,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId()); rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
rmpEventDetailPO.setStartTime(time); rmpEventDetailPO.setStartTime(time);
rmpEventDetailPO.setEventType(getEventType(param.getEventType())); rmpEventDetailPO.setEventType(getEventType(param.getEventType()));
rmpEventDetailPO.setFeatureAmplitude(param.getAmplitude()); rmpEventDetailPO.setFeatureAmplitude(param.getAmplitude() * 100);
rmpEventDetailPO.setDuration(param.getDuration()); rmpEventDetailPO.setDuration(param.getDuration());
rmpEventDetailPO.setEventDescribe(getTag(param.getEventType())); rmpEventDetailPO.setEventDescribe(getTag(param.getEventType()));
rmpEventDetailPO.setPhase(param.getPhase()); rmpEventDetailPO.setPhase(param.getPhase());
@@ -598,6 +601,9 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
po.setAdvanceReason(advanceReason); po.setAdvanceReason(advanceReason);
po.setAdvanceType(advanceType); po.setAdvanceType(advanceType);
po.setFileFlag(1); po.setFileFlag(1);
if (!Objects.isNull(advanceReason) && !Objects.isNull(advanceType)) {
po.setDealFlag(1);
}
wlRmpEventDetailMapper.updateById(po); wlRmpEventDetailMapper.updateById(po);
} }

View File

@@ -20,6 +20,7 @@ import com.njcn.csdevice.api.DeviceFtpFeignClient;
import com.njcn.csdevice.api.EquipmentFeignClient; import com.njcn.csdevice.api.EquipmentFeignClient;
import com.njcn.csdevice.api.PortableOffLogFeignClient; import com.njcn.csdevice.api.PortableOffLogFeignClient;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO; import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO; import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
import com.njcn.csharmonic.enums.CsHarmonicResponseEnum; import com.njcn.csharmonic.enums.CsHarmonicResponseEnum;
import com.njcn.csharmonic.offline.constant.OfflineConstant; import com.njcn.csharmonic.offline.constant.OfflineConstant;
@@ -151,30 +152,33 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
try { try {
//询问装置项目信息 //询问装置项目信息
askProjectInfo(lineId,null, Integer.parseInt(TypeEnum.TYPE_6.getCode()),null,"DevCmd"); askProjectInfo(lineId,null, Integer.parseInt(TypeEnum.TYPE_6.getCode()),null,"DevCmd");
Thread.sleep(5000); for (int i = 0; i < 5; i++) {
String key = AppRedisKey.PROJECT_INFO + lineId; Thread.sleep(1000);
Object object = redisUtil.getObjectByKey(key); String key = AppRedisKey.PROJECT_INFO + lineId;
if (!Objects.isNull(object)) { Object object = redisUtil.getObjectByKey(key);
// 创建 DateTimeFormatter 对象并指定格式 if (!Objects.isNull(object)) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // 创建 DateTimeFormatter 对象并指定格式
List<RspDataDto.ProjectInfo> projectInfoList = channelObjectUtil.objectToList(redisUtil.getObjectByKey(key),RspDataDto.ProjectInfo.class); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
for (RspDataDto.ProjectInfo item : projectInfoList) { List<RspDataDto.ProjectInfo> projectInfoList = channelObjectUtil.objectToList(redisUtil.getObjectByKey(key),RspDataDto.ProjectInfo.class);
MakeUpVo vo = new MakeUpVo(); for (RspDataDto.ProjectInfo item : projectInfoList) {
vo.setType("dir"); MakeUpVo vo = new MakeUpVo();
BeanUtils.copyProperties(item,vo); vo.setType("dir");
long startTime = item.getPrjTimeStart(); BeanUtils.copyProperties(item,vo);
if (startTime != 0) { long startTime = item.getPrjTimeStart();
LocalDateTime dateTime = Instant.ofEpochMilli((startTime-8*3600)*1000).atZone(ZoneId.systemDefault()).toLocalDateTime(); if (startTime != 0) {
String formattedDate = dateTime.format(formatter); LocalDateTime dateTime = Instant.ofEpochMilli((startTime-8*3600)*1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
vo.setStartTime(formattedDate); String formattedDate = dateTime.format(formatter);
vo.setStartTime(formattedDate);
}
long endTime = item.getPrjTimeEnd();
if (endTime != -1) {
LocalDateTime dateTime = Instant.ofEpochMilli((endTime-8*3600)*1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
String formattedDate = dateTime.format(formatter);
vo.setEndTime(formattedDate);
}
result.add(vo);
} }
long endTime = item.getPrjTimeEnd(); break;
if (endTime != -1) {
LocalDateTime dateTime = Instant.ofEpochMilli((endTime-8*3600)*1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
String formattedDate = dateTime.format(formatter);
vo.setEndTime(formattedDate);
}
result.add(vo);
} }
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
@@ -497,7 +501,8 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
CsEquipmentDeliveryPO po = equipmentFeignClient.getDevByLineId(lineId).getData(); CsEquipmentDeliveryPO po = equipmentFeignClient.getDevByLineId(lineId).getData();
nDid = po.getNdid(); nDid = po.getNdid();
} }
String version = csTopicFeignClient.find(nDid).getData(); // String version = csTopicFeignClient.find(nDid).getData();
String version = "V1";
ReqAndResDto.Req reqAndResParam = createRequestParameters(lineId, type, path); ReqAndResDto.Req reqAndResParam = createRequestParameters(lineId, type, path);
publisher.send("/Pfm/"+topic+"/" + version + "/" + nDid, new Gson().toJson(reqAndResParam), 1, false); publisher.send("/Pfm/"+topic+"/" + version + "/" + nDid, new Gson().toJson(reqAndResParam), 1, false);
} }
@@ -523,11 +528,10 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
private void handleType8454(ReqAndResDto.Req reqAndResParam, String lineId) { private void handleType8454(ReqAndResDto.Req reqAndResParam, String lineId) {
if (StringUtils.isNotBlank(lineId)) { if (StringUtils.isNotBlank(lineId)) {
int length = StringUtils.length(lineId); CsLinePO po = csLineFeignClient.getById(lineId).getData();
Integer clDid = Integer.parseInt(lineId.substring(length - 1));
reqAndResParam.setType(8454); reqAndResParam.setType(8454);
MakeUpDto makeUpDto = new MakeUpDto(); MakeUpDto makeUpDto = new MakeUpDto();
makeUpDto.setClDid(clDid); makeUpDto.setClDid(po.getClDid());
makeUpDto.setDataType(Integer.parseInt(DATA_48.getCode())); makeUpDto.setDataType(Integer.parseInt(DATA_48.getCode()));
makeUpDto.setDataAttr(0); makeUpDto.setDataAttr(0);
makeUpDto.setOperate(1); makeUpDto.setOperate(1);

View File

@@ -388,7 +388,7 @@ public class StableDataServiceImpl implements StableDataService {
stringBuilder1.append("last("+data.getName()).append("_"+i).append(") AS "+data.getName()).append("_"+i).append(","); stringBuilder1.append("last("+data.getName()).append("_"+i).append(") AS "+data.getName()).append("_"+i).append(",");
} }
} }
stringBuilder2.append ("line_id='").append (csLinePO.getLineId()).append("' and value_type = 'avg' and process='"+data1.get(0).getProcess()+"' group by phasic_type ").append(InfluxDbSqlConstant.TZ); stringBuilder2.append ("line_id='").append (csLinePO.getLineId()).append("' and value_type = 'AVG' and process='"+data1.get(0).getProcess()+"' group by phasic_type ").append(InfluxDbSqlConstant.TZ);
String sql1 = "select "+stringBuilder1+" from "+"apf_data"+" where "+stringBuilder2; String sql1 = "select "+stringBuilder1+" from "+"apf_data"+" where "+stringBuilder2;
QueryResult sqlData = influxDbUtils.query(sql1); QueryResult sqlData = influxDbUtils.query(sql1);

View File

@@ -1,7 +1,6 @@
package com.njcn.cssystem.controller.feedback; package com.njcn.cssystem.controller.feedback;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.common.LogEnum;

View File

@@ -3,6 +3,7 @@ package com.njcn.cssystem.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.RoleEngineerDevFeignClient; import com.njcn.csdevice.api.RoleEngineerDevFeignClient;
import com.njcn.cssystem.mapper.CsFeedbackChatMapper; import com.njcn.cssystem.mapper.CsFeedbackChatMapper;
import com.njcn.cssystem.mapper.CsFeedbackMapper; import com.njcn.cssystem.mapper.CsFeedbackMapper;
@@ -52,6 +53,9 @@ public class CsFeedbackServiceImpl extends ServiceImpl<CsFeedbackMapper, CsFeedb
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean addFeedBack(CsFeedbackAddParm csFeedbackAddParm) { public Boolean addFeedBack(CsFeedbackAddParm csFeedbackAddParm) {
if (Objects.isNull(csFeedbackAddParm.getEngineeringId())) {
throw new BusinessException("请选择工程后,再进行反馈!");
}
CsFeedbackPO csFeedbackPO = new CsFeedbackPO (); CsFeedbackPO csFeedbackPO = new CsFeedbackPO ();
BeanUtils.copyProperties (csFeedbackAddParm, csFeedbackPO); BeanUtils.copyProperties (csFeedbackAddParm, csFeedbackPO);
csFeedbackPO.setUserId(RequestUtil.getUserIndex()); csFeedbackPO.setUserId(RequestUtil.getUserIndex());