UAT问题清单,序号43,认证清单-添加配置接口开发。

This commit is contained in:
wangzhijiang
2023-04-12 17:23:27 +08:00
parent 512fe369e6
commit 6629d4bf74
4 changed files with 72 additions and 8 deletions
@@ -311,4 +311,16 @@ public class ProjectCertificationInventoryEOController extends JeroController<Pr
public Result<?> updateStatusBatch(@RequestBody JSONObject json) {
return this.projectCertificationInventoryEOService.updateStatusBatch(json);
}
/**
* 添加配置 等同于 复制
* @param json
* @return
*/
@AutoLog(value = "项目库-认证清单表-添加配置")
@ApiOperation(value="项目库-认证清单表-添加配置", notes="项目库-认证清单表-添加配置")
@PostMapping(value = "/addConfigByIds")
public Result<?> addConfigByIds(@RequestBody JSONObject json) {
return this.projectCertificationInventoryEOService.addConfigByIds(json);
}
}
@@ -69,6 +69,7 @@ public enum OperatorTypeEnum {
CERTIFICATION_INVENTORY_REVIEW_RETURNED("认证清单-认证工程师审核退回","certificationInventoryReviewReturned"),
CERTIFICATION_INVENTORY_CALL_ADD("认证清单-调取添加","certificationInventoryCallAdd"),
CERTIFICATION_INVENTORY_IMPORT_ADD("认证清单-导入添加","certificationInventoryImportAdd"),
CERTIFICATION_INVENTORY_ADD_CONFIG("认证清单-添加配置","certificationInventoryAddConfig"),
/**
* 项目库-法规清单
@@ -241,4 +241,11 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
* @return
*/
Result<?> updateStatusBatch(JSONObject json);
/**
* 添加配置
* @param json
* @return
*/
Result<?> addConfigByIds(JSONObject json);
}
@@ -523,11 +523,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
projectCertificationInventoryEOList.add(projectCertificationInventoryEO);
}
// 处理提示信息, 类别+检验项目+配置项+编号+责任领域 作为唯一检验
List<ProjectCertificationInventoryEO> saveDataList = this.dataUniqueCheck(projectCertificationInventoryEOList,cut,result,projectLibraryId);
// List<ProjectCertificationInventoryEO> saveDataList = this.dataUniqueCheck(projectCertificationInventoryEOList,cut,result,projectLibraryId);
if(CollectionUtils.isNotEmpty(saveDataList)){
this.saveBatch(saveDataList);
this.saveProjectCertificationInventoryLog(saveDataList,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD.getValue());
if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){
this.saveBatch(projectCertificationInventoryEOList);
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD.getValue());
}
}catch (Exception ex){
ex.printStackTrace();
@@ -2967,17 +2967,17 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
}
List<ProjectCertificationInventoryEO> saveDataList = this.dataUniqueCheck(projectCertificationInventoryEOList, cut, result, projectLibraryId);
// List<ProjectCertificationInventoryEO> saveDataList = this.dataUniqueCheck(projectCertificationInventoryEOList, cut, result, projectLibraryId);
this.saveBatch(saveDataList);
this.saveBatch(projectCertificationInventoryEOList);
// 设置历史log(修改历史)
this.saveProjectCertificationInventoryLog(saveDataList,OperatorTypeEnum.CERTIFICATION_INVENTORY_CALL_ADD.getValue());
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_CALL_ADD.getValue());
Date now = new Date();
//设置权限 先删后加
List<ProjectUserPermission> adds = new ArrayList<>();
for (ProjectCertificationInventoryEO pci: saveDataList) {
for (ProjectCertificationInventoryEO pci: projectCertificationInventoryEOList) {
if (ObjectUtils.isNotEmpty(pci.getSdt())) {
setProjectCertificationInventoryPermission(pci.getSdt(), pci.getProjectLibraryId(), pci.getId(), now, adds, ProjectUserLocationEnum.PROJECT_CERTIFICATION_INVENTORY_SDT.getValue());
}
@@ -4528,6 +4528,18 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
contentCnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" ");
contentCnSb.append("\"").append(pci.getSerialNumber()).append("\"").append(" ");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added ");
contentEnSb.append("\"").append(pci.getCategory()).append("\"").append(" ");
contentEnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" ");
contentEnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" ");
contentEnSb.append("\"").append(pci.getSerialNumber()).append("\"");
} else if(StringUtils.equals(operateType,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD_CONFIG.getValue())){
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 ");
contentCnSb.append("\"").append(pci.getCategory()).append("\"").append(" ");
contentCnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" ");
contentCnSb.append("\"").append(pci.getConfigItem()).append("\"").append(" ");
contentCnSb.append("\"").append(pci.getSerialNumber()).append("\"").append(" ");
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added ");
contentEnSb.append("\"").append(pci.getCategory()).append("\"").append(" ");
contentEnSb.append("\"").append(pci.getInspectionItem()).append("\"").append(" ");
@@ -4843,4 +4855,36 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
}
}
@Override
public Result<?> addConfigByIds(JSONObject json) {
String ids = json.getString("ids");
String configItem = json.getString("configItem");
if (StringUtils.isEmpty(ids)) {
throw new JeroBootException("至少选择一条数据进行添加配置操作!");
}
List<ProjectCertificationInventoryEO> addConfigPciEoList = new ArrayList<>();
QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>();
pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,Arrays.asList(ids.split(",")));
List<ProjectCertificationInventoryEO> pciEoList = this.list(pciQueryWrap);
pciEoList.forEach(pciEo -> {
ProjectCertificationInventoryEO addConfigPciEo = new ProjectCertificationInventoryEO();
BeanUtils.copyProperties(pciEo,addConfigPciEo);
addConfigPciEo.setId(UUID.randomUUID().toString().replace("-",""));
addConfigPciEo.setConfigItem(configItem);
addConfigPciEoList.add(addConfigPciEo);
});
if(CollectionUtils.isNotEmpty(addConfigPciEoList)){
this.saveBatch(addConfigPciEoList);
// 设置历史log(修改历史)
this.saveProjectCertificationInventoryLog(addConfigPciEoList,OperatorTypeEnum.CERTIFICATION_INVENTORY_ADD_CONFIG.getValue());
}
return Result.OK("添加配置成功!");
}
}