获取便携式设备基础数据功能
This commit is contained in:
@@ -1,14 +1,25 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.common.utils.LogUtil;
|
||||||
import com.njcn.csdevice.api.fallback.WlRecordClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.WlRecordClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
*/
|
*/
|
||||||
@@ -21,4 +32,21 @@ public interface WlRecordFeignClient {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/addBaseData")
|
@PostMapping("/addBaseData")
|
||||||
HttpResult<Boolean> addBaseData(@RequestBody @Validated WlRecord wlRecord);
|
HttpResult<Boolean> addBaseData(@RequestBody @Validated WlRecord wlRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增原始数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/addBaseDataList")
|
||||||
|
HttpResult<Boolean> addBaseDataList(@RequestBody @Validated List<WlRecord> wlRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按条件查询设备基础数据
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/findDevBaseData")
|
||||||
|
HttpResult<WlRecord> findDevBaseData(@RequestBody @Validated WlRecordParam.Record param);
|
||||||
|
|
||||||
|
@PostMapping("/updateTestRecord")
|
||||||
|
HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.WlRecordFeignClient;
|
import com.njcn.csdevice.api.WlRecordFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
*/
|
*/
|
||||||
@@ -30,6 +33,24 @@ public class WlRecordClientFallbackFactory implements FallbackFactory<WlRecordFe
|
|||||||
log.error("{}异常,降级处理,异常为:{}","新增原始数据",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","新增原始数据",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> addBaseDataList(List<WlRecord> wlRecord) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","批量新增原始数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<WlRecord> findDevBaseData(WlRecordParam.Record param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","查询装置基础数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> updateTestRecord(WlRecordParam.UpdateRecord record) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","修改测试项",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.njcn.csdevice.pojo.param;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,7 +18,7 @@ import java.util.List;
|
|||||||
public class WlRecordParam {
|
public class WlRecordParam {
|
||||||
|
|
||||||
@ApiModelProperty("方案名称")
|
@ApiModelProperty("方案名称")
|
||||||
private String itemName;
|
private String proName;
|
||||||
|
|
||||||
@ApiModelProperty("描述")
|
@ApiModelProperty("描述")
|
||||||
private String describe;
|
private String describe;
|
||||||
@@ -25,6 +27,18 @@ public class WlRecordParam {
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public static class Record extends WlRecordParam {
|
public static class Record extends WlRecordParam {
|
||||||
|
|
||||||
|
@ApiModelProperty("装置id")
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目起始时间")
|
||||||
|
private LocalDateTime proStartTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目结束时间")
|
||||||
|
private LocalDateTime proEndTime;
|
||||||
|
|
||||||
@ApiModelProperty("测试项名称")
|
@ApiModelProperty("测试项名称")
|
||||||
private String itemName;
|
private String itemName;
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,6 +99,20 @@ public class WlRecordController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增原始数据
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/addBaseDataList")
|
||||||
|
@ApiOperation("批量新增原始数据")
|
||||||
|
@ApiImplicitParam(name = "wlRecord", value = "装置原始数据", required = true)
|
||||||
|
public HttpResult<Boolean> addBaseDataList(@RequestBody @Validated List<WlRecord> wlRecord) {
|
||||||
|
String methodDescribe = getMethodDescribe("addBaseDataList");
|
||||||
|
LogUtil.njcnDebug(log, "{},装置原始数据为:{}", methodDescribe, wlRecord);
|
||||||
|
wlRecordService.addBaseDataList(wlRecord);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改测试项
|
* 修改测试项
|
||||||
*/
|
*/
|
||||||
@@ -166,5 +181,19 @@ public class WlRecordController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询装置基础数据
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
|
||||||
|
@PostMapping("/findDevBaseData")
|
||||||
|
@ApiOperation("查询装置基础数据")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询条件", required = true)
|
||||||
|
public HttpResult<WlRecord> findDevBaseData(@RequestBody @Validated WlRecordParam.Record param) {
|
||||||
|
String methodDescribe = getMethodDescribe("findDevBaseData");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, param);
|
||||||
|
WlRecord record = wlRecordService.findDevBaseData(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,13 @@ public interface IWlRecordService extends IService<WlRecord> {
|
|||||||
*/
|
*/
|
||||||
void addBaseData(WlRecord wlRecord);
|
void addBaseData(WlRecord wlRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增原始数据
|
||||||
|
* @param wlRecord
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void addBaseDataList(List<WlRecord> wlRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改测试项
|
* 修改测试项
|
||||||
* @param record
|
* @param record
|
||||||
@@ -89,4 +96,10 @@ public interface IWlRecordService extends IService<WlRecord> {
|
|||||||
*/
|
*/
|
||||||
List<ThdDataVO> queryCommonStatisticalByTest(CommonStatisticalQueryParam commonStatisticalQueryParam);
|
List<ThdDataVO> queryCommonStatisticalByTest(CommonStatisticalQueryParam commonStatisticalQueryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取装置基础数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
WlRecord findDevBaseData(WlRecordParam.Record param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,13 +98,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
portable.setPid("0");
|
portable.setPid("0");
|
||||||
portable.setId(IdUtil.simpleUUID());
|
portable.setId(IdUtil.simpleUUID());
|
||||||
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
||||||
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
|
||||||
checkDevSetData(portables);
|
|
||||||
for(CsLedgerVO c : portables){
|
for(CsLedgerVO c : portables){
|
||||||
c.setPid(portable.getId());
|
c.setPid(portable.getId());
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||||
c.setComFlag(po.getRunStatus());
|
c.setComFlag(po.getRunStatus());
|
||||||
}
|
}
|
||||||
|
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||||
|
checkDevSetData(portables);
|
||||||
portable.setChildren(portables);
|
portable.setChildren(portables);
|
||||||
|
|
||||||
CsLedgerVO government = new CsLedgerVO();
|
CsLedgerVO government = new CsLedgerVO();
|
||||||
|
|||||||
@@ -115,11 +115,18 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
this.save(wlRecord);
|
this.save(wlRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addBaseDataList(List<WlRecord> wlRecord) {
|
||||||
|
this.saveBatch(wlRecord);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateTestRecord(WlRecordParam.UpdateRecord record) {
|
public void updateTestRecord(WlRecordParam.UpdateRecord record) {
|
||||||
WlRecord wlRecord = new WlRecord();
|
WlRecord wlRecord = new WlRecord();
|
||||||
BeanUtils.copyProperties(record, wlRecord);
|
BeanUtils.copyProperties(record, wlRecord);
|
||||||
|
wlRecord.setStartTime(record.getProStartTime());
|
||||||
|
wlRecord.setEndTime(record.getProEndTime());
|
||||||
this.updateById(wlRecord);
|
this.updateById(wlRecord);
|
||||||
saveDataRecord(record);
|
saveDataRecord(record);
|
||||||
}
|
}
|
||||||
@@ -399,6 +406,18 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WlRecord findDevBaseData(WlRecordParam.Record param) {
|
||||||
|
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(WlRecord::getGcName,param.getProName())
|
||||||
|
.eq(WlRecord::getDevId,param.getDevId())
|
||||||
|
.eq(WlRecord::getLineId,param.getLineId())
|
||||||
|
.eq(WlRecord::getStartTime,param.getProStartTime())
|
||||||
|
.eq(WlRecord::getType,1)
|
||||||
|
.eq(WlRecord::getState,1);
|
||||||
|
return this.getOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据项内的时间进行覆盖:解决多个数据项的startTime及endTime之间存在时间冲突
|
* 数据项内的时间进行覆盖:解决多个数据项的startTime及endTime之间存在时间冲突
|
||||||
* @param data 数据项
|
* @param data 数据项
|
||||||
|
|||||||
Reference in New Issue
Block a user