复制误差体系
This commit is contained in:
@@ -125,19 +125,19 @@ public class PqErrSysController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
// @OperateInfo(operateType = OperateType.ADD)
|
||||
// @GetMapping("/copy")
|
||||
// @ApiOperation("复制误差体系")
|
||||
// @ApiImplicitParam(name = "id", value = "误差体系id", required = true)
|
||||
// public HttpResult<Object> copy(@RequestParam("id") String id) {
|
||||
// String methodDescribe = getMethodDescribe("copy");
|
||||
// LogUtil.njcnDebug(log, "{},复制ID为:{}", methodDescribe, id);
|
||||
// boolean result = pqErrSysService.copyPqErrSys(id);
|
||||
// if (result) {
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
// } else {
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
// }
|
||||
// }
|
||||
@OperateInfo(operateType = OperateType.ADD)
|
||||
@GetMapping("/copy")
|
||||
@ApiOperation("复制误差体系")
|
||||
@ApiImplicitParam(name = "id", value = "误差体系id", required = true)
|
||||
public HttpResult<Object> copy(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("copy");
|
||||
LogUtil.njcnDebug(log, "{},复制ID为:{}", methodDescribe, id);
|
||||
boolean result = pqErrSysService.copyPqErrSys(id);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,5 +78,5 @@ public interface IPqErrSysService extends IService<PqErrSys> {
|
||||
* @param id 误差体系id
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
//boolean copyPqErrSys(String id);
|
||||
boolean copyPqErrSys(String id);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.err.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -7,15 +8,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||
import com.njcn.gather.err.mapper.PqErrSysMapper;
|
||||
import com.njcn.gather.err.pojo.enums.ErrResponseEnum;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysDtlsParam;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.err.pojo.vo.PqErrSysDtlsVO;
|
||||
import com.njcn.gather.err.service.IPqErrSysDtlsService;
|
||||
import com.njcn.gather.err.service.IPqErrSysService;
|
||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
@@ -189,15 +191,17 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
||||
throw new BusinessException(DevResponseEnum.PQ_ERRSYS_GEN_NAME_ERROR);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean copyPqErrSys(String id) {
|
||||
// PqErrSys pqErrSys = this.getPqErrSysById(id);
|
||||
// pqErrSys.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
// pqErrSys.setName(pqErrSys.getName() + "_副本");
|
||||
// pqErrSys.setStandardTime(LocalDate.of(pqErrSys.getStandardTime().getYear(), 1, 1));
|
||||
// pqErrSys.getPqErrSysDtlsList().forEach(pqErrSysDtls -> pqErrSysDtls.setId(UUID.randomUUID().toString().replaceAll("-", "")));
|
||||
// return this.save(pqErrSys);
|
||||
// }
|
||||
@Override
|
||||
public boolean copyPqErrSys(String id) {
|
||||
PqErrSys pqErrSys = this.getPqErrSysById(id);
|
||||
pqErrSys.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
pqErrSys.setName(pqErrSys.getName() + "_copy");
|
||||
pqErrSys.setStandardName(pqErrSys.getStandardName() + "_copy");
|
||||
pqErrSys.setStandardTime(LocalDate.of(pqErrSys.getStandardTime().getYear(), 1, 1));
|
||||
List<PqErrSysDtlsParam> pqErrSysDtlsParams = BeanUtil.copyToList(pqErrSys.getPqErrSysDtlsList(), PqErrSysDtlsParam.class);
|
||||
pqErrSysDtlsService.addPqErrSysDtls(pqErrSys.getId(), pqErrSysDtlsParams);
|
||||
return this.save(pqErrSys);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成误差体系名称(标准号+年份+设备等级)
|
||||
|
||||
@@ -25,4 +25,9 @@ public class RegInfoData {
|
||||
* 到期日期
|
||||
*/
|
||||
private List<String> expireDateList;
|
||||
|
||||
/**
|
||||
* 使用场景
|
||||
*/
|
||||
private String scene;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user