|
@@ -166,25 +166,26 @@ public class ProjectListService {
|
|
|
String currentYear = String.valueOf(currentDate.getYear());
|
|
|
if(StringUtils.isNotBlank(info.getReportType())){
|
|
|
//用于查询报告号时不同的报告类型
|
|
|
- String type = "";
|
|
|
- if (info.getReportType().equals("1")){
|
|
|
- //先从报告号作废表中查询当年是否还有未被使用的报告号
|
|
|
- type = "报字";
|
|
|
- ProgramReportCancellation infos=reportCancellationMapper.getInfos(type,currentYear);
|
|
|
- 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,currentYear);
|
|
|
- if (ObjectUtil.isNotEmpty(infos)){
|
|
|
- reportNo = infos.getReportNo();
|
|
|
- }else {
|
|
|
- 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,currentYear);
|
|
|
+// 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,currentYear);
|
|
|
+// if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+// reportNo = infos.getReportNo();
|
|
|
+// }else {
|
|
|
+// reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ reportNo = this.generateReportNo(info.getReportType());
|
|
|
ProgramReportNo programReportNo = new ProgramReportNo();
|
|
|
programReportNo.setProgramId(id);
|
|
|
programReportNo.setReportNo(reportNo);
|
|
@@ -404,15 +405,22 @@ public class ProjectListService {
|
|
|
if (programAuditDto.getStatus().equals("5")) {
|
|
|
if (projectListInfo.getGenerateReportNumber().equals("false")) {
|
|
|
if(StringUtils.isNotBlank(projectListInfo.getReportType())){
|
|
|
- if (projectListInfo.getReportType().equals("1")){
|
|
|
- reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE,currentToken);
|
|
|
- } else if (projectListInfo.getReportType().equals("2")) {
|
|
|
- reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
- }
|
|
|
+// if (projectListInfo.getReportType().equals("1")){
|
|
|
+// reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE,currentToken);
|
|
|
+// } else if (projectListInfo.getReportType().equals("2")) {
|
|
|
+// reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+// }
|
|
|
+ //生成报告号
|
|
|
+ reportNo = this.generateReportNo(projectListInfo.getReportType());
|
|
|
ProgramReportNo programReportNo = new ProgramReportNo();
|
|
|
programReportNo.setProgramId(projectListInfo.getId());
|
|
|
programReportNo.setReportNo(reportNo);
|
|
|
programReportNoMapper.insert(programReportNo);
|
|
|
+ //根据报告号去报告号作废表中查询数据,并进行逻辑删除
|
|
|
+ ProgramReportCancellation byReportNo = reportCancellationMapper.getByReportNo(reportNo);
|
|
|
+ if (ObjectUtil.isNotEmpty(byReportNo)){
|
|
|
+ reportCancellationMapper.deleteById(byReportNo.getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -470,26 +478,27 @@ public class ProjectListService {
|
|
|
ProgramReportNo programReportNo = programReportNoMapper.selectByProgramId(info.getId());
|
|
|
if (null == programReportNo) {
|
|
|
if(StringUtils.isNotBlank(info.getReportType())){
|
|
|
- //用于查询报告号时不同的报告类型
|
|
|
- String type = "";
|
|
|
- if (info.getReportType().equals("1")) {
|
|
|
- //先从报告号作废表中查询当年是否还有未被使用的报告号
|
|
|
- type = "报字";
|
|
|
- ProgramReportCancellation infos = reportCancellationMapper.getInfos(type,currentYear);
|
|
|
- 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,currentYear);
|
|
|
- if (ObjectUtil.isNotEmpty(infos)){
|
|
|
- reportNo = infos.getReportNo();
|
|
|
- }else {
|
|
|
- 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,currentYear);
|
|
|
+// 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,currentYear);
|
|
|
+// if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+// reportNo = infos.getReportNo();
|
|
|
+// }else {
|
|
|
+// reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ reportNo = this.generateReportNo(info.getReportType());
|
|
|
programReportNo = new ProgramReportNo();
|
|
|
programReportNo.setProgramId(info.getId());
|
|
|
programReportNo.setReportNo(reportNo);
|
|
@@ -533,6 +542,11 @@ public class ProjectListService {
|
|
|
programReport.setId(programReportNo1.getId());
|
|
|
programReport.setReportNo(reportNo);
|
|
|
programReportNoMapper.updateById(programReport);
|
|
|
+ //根据报告号去报告号作废表中查询数据,并进行逻辑删除
|
|
|
+ ProgramReportCancellation byReportNo1 = reportCancellationMapper.getByReportNo(reportNo);
|
|
|
+ if (ObjectUtil.isNotEmpty(byReportNo1)){
|
|
|
+ reportCancellationMapper.deleteById(byReportNo1.getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2114,10 +2128,6 @@ public class ProjectListService {
|
|
|
//根据id查询项目
|
|
|
ProgramCancellation programCancellation = programCancellationMapper.selectById(dto.getCancellId());
|
|
|
if (ObjectUtil.isNotEmpty(programCancellation)){
|
|
|
- // 获取当前日期
|
|
|
- LocalDate currentDate = LocalDate.now();
|
|
|
- // 获取当前年份
|
|
|
- String currentYear = String.valueOf(currentDate.getYear());
|
|
|
ProgramProjectListInfo listInfo = projectListMapper.getById(programCancellation.getProjectId());
|
|
|
if (ObjectUtil.isNotEmpty(listInfo) && "true".equals(listInfo.getGenerateReportNumber())){
|
|
|
//根据报告号去报告号作废表中是否有该报告号
|
|
@@ -2133,31 +2143,37 @@ public class ProjectListService {
|
|
|
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,currentYear);
|
|
|
- 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,currentYear);
|
|
|
- if (ObjectUtil.isNotEmpty(infos)){
|
|
|
- reportNo = infos.getReportNo();
|
|
|
- }else {
|
|
|
- reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
- }
|
|
|
- }
|
|
|
+// //用于查询报告号时不同的报告类型
|
|
|
+// String type = "";
|
|
|
+// if (listInfo.getReportType().equals("1")){
|
|
|
+// //先从报告号作废表中查询当年是否还有未被使用的报告号
|
|
|
+// type = "报字";
|
|
|
+// ProgramReportCancellation infos=reportCancellationMapper.getInfos(type,currentYear);
|
|
|
+// 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,currentYear);
|
|
|
+// if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+// reportNo = infos.getReportNo();
|
|
|
+// }else {
|
|
|
+// reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ reportNo = this.generateReportNo(listInfo.getReportType());
|
|
|
ProgramReportNo programReportNo = programReportNoMapper.selectByProgramId(listInfo.getId());
|
|
|
ProgramReportNo programReport = new ProgramReportNo();
|
|
|
programReport.setId(programReportNo.getId());
|
|
|
programReport.setReportNo(reportNo);
|
|
|
programReportNoMapper.updateById(programReport);
|
|
|
+ //根据报告号去报告号作废表中查询数据,并进行逻辑删除
|
|
|
+ ProgramReportCancellation byReportNo1 = reportCancellationMapper.getByReportNo(reportNo);
|
|
|
+ if (ObjectUtil.isNotEmpty(byReportNo1)){
|
|
|
+ reportCancellationMapper.deleteById(byReportNo1.getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2253,4 +2269,39 @@ public class ProjectListService {
|
|
|
List<ProgramReportNo> list=programReportNoMapper.getCancelledProject();
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用于生成报告号
|
|
|
+ */
|
|
|
+ private String generateReportNo(String reportType) throws Exception {
|
|
|
+ String currentToken = TokenProvider.getCurrentToken();
|
|
|
+ UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
|
|
|
+
|
|
|
+ String reportNo="";
|
|
|
+ // 获取当前日期
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+ // 获取当前年份
|
|
|
+ String currentYear = String.valueOf(currentDate.getYear());
|
|
|
+ //用于查询报告号时不同的报告类型
|
|
|
+ String type = "";
|
|
|
+ if (reportType.equals("1")){
|
|
|
+ //先从报告号作废表中查询当年是否还有未被使用的报告号
|
|
|
+ type = "报字";
|
|
|
+ ProgramReportCancellation infos=reportCancellationMapper.getInfos(type,currentYear);
|
|
|
+ if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+ reportNo = infos.getReportNo();
|
|
|
+ }else {
|
|
|
+ reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE,currentToken);
|
|
|
+ }
|
|
|
+ } else if (reportType.equals("2")) {
|
|
|
+ type = "咨字";
|
|
|
+ ProgramReportCancellation infos=reportCancellationMapper.getInfos(type,currentYear);
|
|
|
+ if (ObjectUtil.isNotEmpty(infos)){
|
|
|
+ reportNo = infos.getReportNo();
|
|
|
+ }else {
|
|
|
+ reportNo = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), ProgramReportNoDto.BIZ_CODE_,currentToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return reportNo;
|
|
|
+ }
|
|
|
}
|