覆盖验证

This commit is contained in:
zhn
2023-08-28 16:52:14 +08:00
parent c870a66247
commit 6a3b345a73
3 changed files with 65 additions and 0 deletions
@@ -227,4 +227,13 @@ public class ProjectRxswinEOController extends JeroController<ProjectRxswinEO, I
return Result.OK("提交成功");
}
@AutoLog(value = "覆盖验证")
@ApiOperation(value="覆盖验证", notes="覆盖验证")
@GetMapping(value = "/iSExist")
public Result<?> iSExist(@RequestParam(name="projectId",required=true) String projectId,
@RequestParam(name="ids",required=true) String ids) {
String iSExist = projectRxswinEOService.iSExist(projectId, ids);
return Result.OK(iSExist);
}
}
@@ -85,4 +85,11 @@ public interface IProjectRxswinEOService extends IService<ProjectRxswinEO> {
* @param ids
*/
void submitInfo(String projectId,String ids);
/**
* 覆盖验证
* @param projectId
* @param ids
*/
String iSExist(String projectId,String ids);
}
@@ -180,7 +180,56 @@ public class ProjectRxswinEOServiceImpl extends ServiceImpl<ProjectRxswinEOMappe
projectRxswinEO.setProjectId(projectId);
projectRxswinEO.setCreateTime(new Date());
projectRxswinEO.setCreateBy(user.getUsername());
projectRxswinEO.setState(StatusEnum.SUBMIT.getValue());
}
this.saveBatch(rxswinEOList);
}
/**
* 覆盖验证
* @param projectId
* @param ids
*/
@Override
public String iSExist(String projectId, String ids) {
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//新增的
LambdaQueryWrapper<ProjectRxswinEO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ProjectRxswinEO::getId, Arrays.asList(ids.split(",")));
List<ProjectRxswinEO> rxswinEOList = this.list(wrapper);
//已存在的
LambdaQueryWrapper<ProjectRxswinEO> wrapperTemp = new LambdaQueryWrapper<>();
wrapperTemp.eq(ProjectRxswinEO::getProjectId, projectId);
List<ProjectRxswinEO> rxswinEOS = this.list(wrapperTemp);
if(!rxswinEOS.isEmpty()){
List<String> themeList = rxswinEOS.stream().map(ProjectRxswinEO::getTheme).collect(Collectors.toList());
List<ProjectRxswinEO> projectRxswinEOS = rxswinEOList.stream().filter(e -> themeList.contains(e.getTheme())).collect(Collectors.toList());
if(projectRxswinEOS.isEmpty()){
//直接新增
for (ProjectRxswinEO projectRxswinEO : rxswinEOList) {
projectRxswinEO.setId(UUID.randomUUID().toString().replaceAll("-",""));
projectRxswinEO.setProjectId(projectId);
projectRxswinEO.setCreateTime(new Date());
projectRxswinEO.setCreateBy(user.getUsername());
projectRxswinEO.setState(StatusEnum.SAVE.getValue());
}
this.saveBatch(rxswinEOList);
}else{
return "YES";
}
}else{
//直接新增
for (ProjectRxswinEO projectRxswinEO : rxswinEOList) {
projectRxswinEO.setId(UUID.randomUUID().toString().replaceAll("-",""));
projectRxswinEO.setProjectId(projectId);
projectRxswinEO.setCreateTime(new Date());
projectRxswinEO.setCreateBy(user.getUsername());
projectRxswinEO.setState(StatusEnum.SAVE.getValue());
}
this.saveBatch(rxswinEOList);
}
return "NO";
}
}