认证清单-引用交付物开发

This commit is contained in:
wangzhijiang
2023-03-13 16:42:34 +08:00
parent acd8ea5d80
commit 5d5420da3c
3 changed files with 95 additions and 1 deletions
@@ -262,4 +262,11 @@ public class ProjectCertificationInventoryEOController extends JeroController<Pr
public Result<?> callAdd(@RequestBody JSONObject json) {
return this.projectCertificationInventoryEOService.callAdd(json);
}
@AutoLog(value = "项目库-认证清单表-引用交付物")
@ApiOperation(value="项目库-认证清单表-引用交付物", notes="项目库-认证清单表-引用交付物")
@PostMapping(value = "/citeDeliverable")
public Result<?> citeDeliverable(@RequestBody JSONObject json) {
return this.projectCertificationInventoryEOService.citeDeliverable(json);
}
}
@@ -184,4 +184,11 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
* @return
*/
Result<?> callAdd(JSONObject json);
/**
* 引用交付物
* @param json
* @return
*/
Result<?> citeDeliverable(JSONObject json);
}
@@ -18,9 +18,11 @@ import com.jero.modules.authDummy.service.IAuthDummyInventoryInfoEOService;
import com.jero.modules.feishu.enums.TemplateInfoEnum2;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.project.entity.ProjectCertificationInventoryEO;
import com.jero.modules.project.entity.ProjectCertificationInventoryLogEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
import com.jero.modules.project.enums.*;
import com.jero.modules.project.service.IProjectCertificationInventoryLogEOService;
import com.jero.modules.project.service.IProjectRelatedPersonnelService;
import com.jero.modules.system.enums.ProjectRoleEnum;
import com.jero.modules.project.mapper.ProjectCertificationInventoryEOMapper;
@@ -106,6 +108,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
private IAuthDummyInventoryBaseEOService authDummyInventoryBaseEOService;
@Autowired
private IAuthDummyInventoryInfoEOService authDummyInventoryInfoEOService;
@Autowired
private IProjectCertificationInventoryLogEOService projectCertificationInventoryLogEOService;
@Value(value = "${jero.backUrl}")
@@ -164,7 +168,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
@Override
public void deleteByIds(List<String> ids) {
QueryWrapper<ProjectCertificationInventoryEO> queryWrap = new QueryWrapper<>();
queryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,ids);
queryWrap.lambda().in(ProjectCertificationInventoryEO::getId,ids);
List<ProjectCertificationInventoryEO> list = this.list(queryWrap);
removeByIds(ids);
@@ -218,6 +222,32 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){
this.saveBatch(projectCertificationInventoryEOList);
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
for (ProjectCertificationInventoryEO certificationInventoryEO : projectCertificationInventoryEOList) {
StringBuilder contentCnSb = new StringBuilder();
contentCnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" 添加了 ");
contentCnSb.append("\"").append(certificationInventoryEO.getCategory()).append("\"").append(" ");
contentCnSb.append("\"").append(certificationInventoryEO.getInspectionItem()).append("\"").append(" ");
contentCnSb.append("\"").append(certificationInventoryEO.getConfigItem()).append("\"").append(" ");
contentCnSb.append("\"").append(certificationInventoryEO.getSerialNumber()).append("\"").append(" ");
StringBuilder contentEnSb = new StringBuilder();
contentEnSb.append("\"").append(currentUser.getUsername()).append("\"").append(" added ");
contentEnSb.append("\"").append(certificationInventoryEO.getCategory()).append("\"").append(" ");
contentEnSb.append("\"").append(certificationInventoryEO.getInspectionItem()).append("\"").append(" ");
contentEnSb.append("\"").append(certificationInventoryEO.getConfigItem()).append("\"").append(" ");
contentEnSb.append("\"").append(certificationInventoryEO.getSerialNumber()).append("\"");
ProjectCertificationInventoryLogEO projectCertificationInventoryLogEO = new ProjectCertificationInventoryLogEO();
projectCertificationInventoryLogEO.setProjectCertificationInventoryId(certificationInventoryEO.getId());
projectCertificationInventoryLogEO.setContentCn(contentCnSb.toString());
projectCertificationInventoryLogEO.setContentEn(contentEnSb.toString());
projectCertificationInventoryLogEOList.add(projectCertificationInventoryLogEO);
}
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
}
}catch (Exception ex){
throw new JeroBootException("添加失败!");
@@ -1819,7 +1849,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
ProjectCertificationInventoryEO projectCertificationInventoryEOTemp = new ProjectCertificationInventoryEO();
BeanUtils.copyProperties(authDummyInventoryInfoEO,projectCertificationInventoryEOTemp);
projectCertificationInventoryEOTemp.setId(UUID.randomUUID().toString().replace("-", ""));
projectCertificationInventoryEOTemp.setProjectLibraryId(projectLibraryId);
projectCertificationInventoryEOTemp.setFlowStatus(CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue());
projectCertificationInventoryEOList.add(projectCertificationInventoryEOTemp);
}
this.saveBatch(projectCertificationInventoryEOList);
@@ -1933,4 +1965,52 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
}
@Override
public Result<?> citeDeliverable(JSONObject json) {
String projectCertificationInventoryIds = json.getString("projectCertificationInventoryIds");
if(StringUtils.isEmpty(projectCertificationInventoryIds)){
throw new JeroBootException("请选择需要引用的认证清单数据!");
}
String projectLibraryId = json.getString("projectLibraryId");
String citeProjectLibraryId = json.getString("citeProjectLibraryId");
if(StringUtils.isEmpty(citeProjectLibraryId)){
throw new JeroBootException("请选择引用的项目!");
}
QueryWrapper<ProjectCertificationInventoryEO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,projectCertificationInventoryIds.split(","));
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = this.list(queryWrapper);
if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){
QueryWrapper<ProjectCertificationInventoryEO> citeQueryWrapper = new QueryWrapper<>();
citeQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,citeProjectLibraryId);
citeQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.REVIEW_AND_PASS.getValue());
List<ProjectCertificationInventoryEO> citeProjectCertificationInventoryEOList = this.list(queryWrapper);
if(CollectionUtils.isNotEmpty(citeProjectCertificationInventoryEOList)){
for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) {
for (ProjectCertificationInventoryEO citeProjectCertificationInventoryEO : citeProjectCertificationInventoryEOList) {
// 匹配数据 类别、检验项目、配置项、标准编号、交付物类型完全一致,并且数据的状态为 审查完成
boolean flag = (
StringUtils.equals(projectCertificationInventoryEO.getCategory(),citeProjectCertificationInventoryEO.getCategory())
&& StringUtils.equals(projectCertificationInventoryEO.getInspectionItem(),citeProjectCertificationInventoryEO.getInspectionItem())
&& StringUtils.equals(projectCertificationInventoryEO.getConfigItem(),citeProjectCertificationInventoryEO.getConfigItem())
&& StringUtils.equals(projectCertificationInventoryEO.getSerialNumber(),citeProjectCertificationInventoryEO.getSerialNumber())
&& StringUtils.equals(projectCertificationInventoryEO.getDeliverableType(),citeProjectCertificationInventoryEO.getDeliverableType())
);
if(flag){
projectCertificationInventoryEO.setDeliveryResult(citeProjectCertificationInventoryEO.getDeliveryResult());
break;
}
}
}
this.updateBatchById(projectCertificationInventoryEOList);
}
}
return Result.OK("引用交付物成功!");
}
}