|
@@ -101,6 +101,9 @@ public class ProjectListService {
|
|
|
|
|
|
@Autowired
|
|
|
private ProgramCancellationMapper programCancellationMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProgramReportCancellationMapper reportCancellationMapper;
|
|
|
// @Autowired
|
|
|
// private UserService userService;
|
|
|
|
|
@@ -157,15 +160,35 @@ public class ProjectListService {
|
|
|
String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
if (("true").equals(dto.getGenerateReportNumber())) {
|
|
|
if(StringUtils.isNotBlank(info.getReportType())){
|
|
|
+ //用于查询报告号时不同的报告类型
|
|
|
+ String type = "";
|
|
|
if (info.getReportType().equals("1")){
|
|
|
- reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE,currentToken);
|
|
|
+ //先从报告号作废表中查询当年是否还有未被使用的报告号
|
|
|
+ type = "报字";
|
|
|
+ ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
|
|
|
+ if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+ reportNo = infos.getReportNo();
|
|
|
+ }else {
|
|
|
+ reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE,currentToken);
|
|
|
+ }
|
|
|
} else if (info.getReportType().equals("2")) {
|
|
|
- reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+ type = "咨字";
|
|
|
+ ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
|
|
|
+ if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+ reportNo = infos.getReportNo();
|
|
|
+ }else {
|
|
|
+ reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+ }
|
|
|
}
|
|
|
ProgramReportNo programReportNo = new ProgramReportNo();
|
|
|
programReportNo.setProgramId(id);
|
|
|
programReportNo.setReportNo(reportNo);
|
|
|
programReportNoMapper.insert(programReportNo);
|
|
|
+ //根据报告号去报告号作废表中查询数据,并进行逻辑删除
|
|
|
+ ProgramReportCancellation byReportNo = reportCancellationMapper.getByReportNo(reportNo);
|
|
|
+ if (ObjectUtil.isNotEmpty(byReportNo)){
|
|
|
+ reportCancellationMapper.deleteById(byReportNo.getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//合同编号生成
|
|
@@ -438,15 +461,70 @@ public class ProjectListService {
|
|
|
ProgramReportNo programReportNo = programReportNoMapper.selectByProgramId(info.getId());
|
|
|
if (null == programReportNo) {
|
|
|
if(StringUtils.isNotBlank(info.getReportType())){
|
|
|
- if (info.getReportType().equals("1")){
|
|
|
- reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE,currentToken);
|
|
|
- } else if (info.getReportType().equals("2")) {
|
|
|
- reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+ //用于查询报告号时不同的报告类型
|
|
|
+ String type = "";
|
|
|
+ if (info.getReportType().equals("1")) {
|
|
|
+ //先从报告号作废表中查询当年是否还有未被使用的报告号
|
|
|
+ type = "报字";
|
|
|
+ ProgramReportCancellation infos = reportCancellationMapper.getInfos(type);
|
|
|
+ if (ObjectUtil.isNotEmpty(infos)) {
|
|
|
+ reportNo = infos.getReportNo();
|
|
|
+ } else {
|
|
|
+ reportNo = SpringUtil.getBean(IWorkAttachmentApi.class).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE, currentToken);
|
|
|
+ }
|
|
|
+ }else if (info.getReportType().equals("2")) {
|
|
|
+ type = "咨字";
|
|
|
+ ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
|
|
|
+ if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+ reportNo = infos.getReportNo();
|
|
|
+ }else {
|
|
|
+ reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+ }
|
|
|
}
|
|
|
programReportNo = new ProgramReportNo();
|
|
|
programReportNo.setProgramId(info.getId());
|
|
|
programReportNo.setReportNo(reportNo);
|
|
|
programReportNoMapper.insert(programReportNo);
|
|
|
+ //根据报告号去报告号作废表中查询数据,并进行逻辑删除
|
|
|
+ ProgramReportCancellation byReportNo = reportCancellationMapper.getByReportNo(reportNo);
|
|
|
+ if (ObjectUtil.isNotEmpty(byReportNo)){
|
|
|
+ reportCancellationMapper.deleteById(byReportNo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //判断该报告中的报告号是否被使用
|
|
|
+ ProgramReportCancellation byReportNo = reportCancellationMapper.getByReportNo(programReportNo.getReportNo());
|
|
|
+ if (1 == byReportNo.getDelFlag()){
|
|
|
+ //如果该报告号已经被使用,则重新生成新的报告号
|
|
|
+ if (("true").equals(info.getGenerateReportNumber())) {
|
|
|
+ if(StringUtils.isNotBlank(info.getReportType())){
|
|
|
+ //用于查询报告号时不同的报告类型
|
|
|
+ String type = "";
|
|
|
+ if (info.getReportType().equals("1")){
|
|
|
+ //先从报告号作废表中查询当年是否还有未被使用的报告号
|
|
|
+ type = "报字";
|
|
|
+ ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
|
|
|
+ if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+ reportNo = infos.getReportNo();
|
|
|
+ }else {
|
|
|
+ reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE,currentToken);
|
|
|
+ }
|
|
|
+ } else if (info.getReportType().equals("2")) {
|
|
|
+ type = "咨字";
|
|
|
+ ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
|
|
|
+ if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+ reportNo = infos.getReportNo();
|
|
|
+ }else {
|
|
|
+ reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ProgramReportNo programReportNo1 = programReportNoMapper.selectByProgramId(info.getId());
|
|
|
+ ProgramReportNo programReport = new ProgramReportNo();
|
|
|
+ programReport.setId(programReportNo1.getId());
|
|
|
+ programReport.setReportNo(reportNo);
|
|
|
+ programReportNoMapper.updateById(programReport);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -698,6 +776,25 @@ public class ProjectListService {
|
|
|
// LambdaQueryWrapper<WorkAttachmentInfo> wrapper = new LambdaQueryWrapper<>();
|
|
|
// wrapper.eq(WorkAttachmentInfo::getAttachmentId, id);
|
|
|
SpringUtil.getBean ( IWorkAttachmentApi.class ).deleteByAttachmentId(id);
|
|
|
+ //根据id查找报告号,并将报告号存到报告号作废表中
|
|
|
+ ProgramProjectListInfo listInfo = projectListMapper.getById(id);
|
|
|
+ if (ObjectUtil.isNotEmpty(listInfo)){
|
|
|
+ //先查询报告号作废表中是否存在该数据
|
|
|
+ ProgramReportCancellation reportNo = reportCancellationMapper.getByReportNo(listInfo.getReportNo());
|
|
|
+ if (ObjectUtil.isNotEmpty(reportNo)){
|
|
|
+ //存在则进行删除
|
|
|
+ reportCancellationMapper.deleteByCanId(reportNo.getId());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(listInfo.getReportNo())){
|
|
|
+ ProgramReportCancellation programReportCancellation = new ProgramReportCancellation();
|
|
|
+ programReportCancellation.setInFlag("1");
|
|
|
+ programReportCancellation.setReportNo(listInfo.getReportNo());
|
|
|
+ programReportCancellation.setId(UUID.randomUUID().toString().replace("-",""));
|
|
|
+ reportCancellationMapper.insert(programReportCancellation);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
return "删除项目成功";
|
|
|
}
|
|
|
|
|
@@ -1953,6 +2050,28 @@ public class ProjectListService {
|
|
|
programCancellation.setReason(projectListDto.getReason());
|
|
|
programCancellationMapper.updateById(programCancellation);
|
|
|
canId=projectListDto.getCancellId();
|
|
|
+ //项目作废后将该项目的报告号存到报告号作废表中
|
|
|
+ if ("5".equals(projectListDto.getStatus())){
|
|
|
+ ProgramProjectListInfo listInfo = projectListMapper.getById(projectListDto.getId());
|
|
|
+ if (ObjectUtil.isNotEmpty(listInfo)){
|
|
|
+ //先查询报告号作废表中是否存在该数据
|
|
|
+ ProgramReportCancellation reportNo = reportCancellationMapper.getByReportNo(listInfo.getReportNo());
|
|
|
+ if (ObjectUtil.isNotEmpty(reportNo)){
|
|
|
+ //存在则进行删除
|
|
|
+ reportCancellationMapper.deleteByCanId(reportNo.getId());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(listInfo.getReportNo())){
|
|
|
+ ProgramReportCancellation programReportCancellation = new ProgramReportCancellation();
|
|
|
+ programReportCancellation.setInFlag("1");
|
|
|
+ programReportCancellation.setReportNo(listInfo.getReportNo());
|
|
|
+ programReportCancellation.setId(UUID.randomUUID().toString().replace("-",""));
|
|
|
+ reportCancellationMapper.insert(programReportCancellation);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}else {
|
|
|
String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
ProgramCancellation programCancellation = new ProgramCancellation();
|
|
@@ -1971,8 +2090,121 @@ public class ProjectListService {
|
|
|
* @param dto
|
|
|
* @return
|
|
|
*/
|
|
|
- public String updateStatusByCancellId(ProjectListDto dto) {
|
|
|
+ public String updateStatusByCancellId(ProjectListDto dto) throws Exception {
|
|
|
+ String currentToken = TokenProvider.getCurrentToken();
|
|
|
programCancellationMapper.updateStatusById(dto.getCancellId(),dto.getCancellationStatus());
|
|
|
+ UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
|
|
|
+ //根据id查询项目
|
|
|
+ ProgramCancellation programCancellation = programCancellationMapper.selectById(dto.getCancellId());
|
|
|
+ if (ObjectUtil.isNotEmpty(programCancellation)){
|
|
|
+ ProgramProjectListInfo listInfo = projectListMapper.getById(programCancellation.getProjectId());
|
|
|
+ if (ObjectUtil.isNotEmpty(listInfo) && "true".equals(listInfo.getGenerateReportNumber())){
|
|
|
+ //根据报告号去报告号作废表中是否有该报告号
|
|
|
+ ProgramReportCancellation programReportCancellation=reportCancellationMapper.getByReportNo(listInfo.getReportNo());
|
|
|
+ if (ObjectUtil.isNotEmpty(programReportCancellation)){
|
|
|
+ if (0==programReportCancellation.getDelFlag()){
|
|
|
+ ProgramReportCancellation cancellation = new ProgramReportCancellation();
|
|
|
+ cancellation.setId(programReportCancellation.getId());
|
|
|
+ cancellation.setDelFlag(1);
|
|
|
+ reportCancellationMapper.updateInfoById(cancellation);
|
|
|
+ }else {
|
|
|
+ //如果该报告号已经被使用,则重新生成新的报告号
|
|
|
+ String reportNo = "";
|
|
|
+ if (("true").equals(listInfo.getGenerateReportNumber())) {
|
|
|
+ if(StringUtils.isNotBlank(listInfo.getReportType())){
|
|
|
+ //用于查询报告号时不同的报告类型
|
|
|
+ String type = "";
|
|
|
+ if (listInfo.getReportType().equals("1")){
|
|
|
+ //先从报告号作废表中查询当年是否还有未被使用的报告号
|
|
|
+ type = "报字";
|
|
|
+ ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
|
|
|
+ if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+ reportNo = infos.getReportNo();
|
|
|
+ }else {
|
|
|
+ reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE,currentToken);
|
|
|
+ }
|
|
|
+ } else if (listInfo.getReportType().equals("2")) {
|
|
|
+ type = "咨字";
|
|
|
+ ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
|
|
|
+ if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+ reportNo = infos.getReportNo();
|
|
|
+ }else {
|
|
|
+ reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ProgramReportNo programReportNo = programReportNoMapper.selectByProgramId(listInfo.getId());
|
|
|
+ ProgramReportNo programReport = new ProgramReportNo();
|
|
|
+ programReport.setId(programReportNo.getId());
|
|
|
+ programReport.setReportNo(reportNo);
|
|
|
+ programReportNoMapper.updateById(programReport);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return "操作成功";
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询未关联项目的报告号
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ProgramReportNo> getProjectList() {
|
|
|
+ ArrayList<ProgramReportNo> programProjectListInfos = new ArrayList<>();
|
|
|
+ //查询报告
|
|
|
+ QueryWrapper<ProgramReportNo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("del_flag", 0);
|
|
|
+ List<ProgramReportNo> reportNos = programReportNoMapper.selectList(queryWrapper);
|
|
|
+ //查询需要生成报告的项目
|
|
|
+ QueryWrapper<ProgramProjectListInfo> projectListInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ List<ProgramProjectListInfo> listInfos = projectListMapper.selectList(projectListInfoQueryWrapper);
|
|
|
+
|
|
|
+ HashSet<String> strings = new HashSet<>();
|
|
|
+ //将项目id存到list中
|
|
|
+ for (ProgramProjectListInfo listInfo : listInfos) {
|
|
|
+ strings.add(listInfo.getId());
|
|
|
+ }
|
|
|
+ //将未关联项目的报告存到集合中
|
|
|
+ for (ProgramReportNo reportNo : reportNos) {
|
|
|
+ if (StringUtils.isNotBlank(reportNo.getProgramId())){
|
|
|
+ if (!strings.contains(reportNo.getProgramId())){
|
|
|
+ programProjectListInfos.add(reportNo);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ programProjectListInfos.add(reportNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (ProgramProjectListInfo listInfo : listInfos) {
|
|
|
+ //查找项目下的报告
|
|
|
+ List<ProgramReportNo> list= programReportNoMapper.getByProgramId(listInfo.getId());
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ if (list.size()>1){
|
|
|
+ programProjectListInfos.addAll(list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //进行去重
|
|
|
+ List<ProgramReportNo> distinctInfos = programProjectListInfos.stream()
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return distinctInfos;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /*8
|
|
|
+ 将报告号添加到报告号作废表中
|
|
|
+ */
|
|
|
+ public void insertReportNo(String value) {
|
|
|
+ ProgramReportCancellation reportCancellation=JSON.parseObject(value,ProgramReportCancellation.class);
|
|
|
+ //先去查询看是否有这条数据
|
|
|
+ ProgramReportCancellation byReportNo = reportCancellationMapper.getByReportNo(reportCancellation.getReportNo());
|
|
|
+ //没有的话进行添加,有的话不做任何操作
|
|
|
+ if (ObjectUtil.isEmpty(byReportNo)){
|
|
|
+ reportCancellationMapper.insert(reportCancellation);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|