Sfoglia il codice sorgente

评估项目作废

sangwenwei 1 anno fa
parent
commit
ee60933ef4
11 ha cambiato i file con 162 aggiunte e 37 eliminazioni
  1. 5 0
      jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/flowable/factory/AssessApiFallbackFactory.java
  2. 6 0
      jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/flowable/feign/IAssessApi.java
  3. 22 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/controller/ProjectListController.java
  4. 5 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/domain/ProgramReportCancellation.java
  5. 1 1
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/mapper/ProgramReportCancellationMapper.java
  6. 2 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/mapper/ProgramReportNoMapper.java
  7. 1 1
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/mapper/xml/ProgramReportCancellationMapper.xml
  8. 14 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/mapper/xml/ProgramReportNoMapper.xml
  9. 77 35
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/service/ProjectListService.java
  10. 5 0
      jeeplus-modules/jeeplus-xxl-job-executor-sample/src/main/java/com/jeeplus/domain/ProgramReportCancellationDTO.java
  11. 24 0
      jeeplus-modules/jeeplus-xxl-job-executor-sample/src/main/java/com/xxl/job/executor/service/jobhandler/SampleXxlJob.java

+ 5 - 0
jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/flowable/factory/AssessApiFallbackFactory.java

@@ -39,6 +39,11 @@ public class AssessApiFallbackFactory implements FallbackFactory<IAssessApi> {
 
             }
 
+            @Override
+            public String getCancelledProject() {
+                return null;
+            }
+
 
         };
     }

+ 6 - 0
jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/flowable/feign/IAssessApi.java

@@ -43,4 +43,10 @@ public interface IAssessApi {
     @GetMapping(value = "/program/projectList/insertReportNo")
     void insertReportNo(@RequestParam(value = "value")String value);
 
+    /**
+     * 查询已作废项目的报告
+     */
+    @GetMapping(value = "/program/projectList/getCancelledProject")
+    String getCancelledProject();
+
 }

+ 22 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/controller/ProjectListController.java

@@ -712,6 +712,18 @@ public class ProjectListController {
     }
 
     /**
+     * 查询已作废项目的报告号
+     * @param
+     * @return
+     */
+    @ApiOperation(value = "查询已作废项目的报告号")
+    @GetMapping(value = "/getCancelledProject")
+    public String getCancelledProject()  {
+        List<ProgramReportNo> listInfos= projectListService.getCancelledProject();
+        return JSON.toJSONString(listInfos);
+    }
+
+    /**
      * 将报告号添加到报告号作废表中
      */
     @ApiOperation(value = "将报告号添加到报告号作废表中")
@@ -720,4 +732,14 @@ public class ProjectListController {
         projectListService.insertReportNo(value);
     }
 
+    /**
+     * 根据报告号查询该报告号是否被使用
+     */
+    @ApiOperation(value = "根据报告号查询该报告号是否被使用")
+    @GetMapping(value = "/getIsUsed")
+    public Boolean getIsUsed(String reportNo){
+        Boolean data = projectListService.getIsUsed(reportNo);
+        return data;
+    }
+
 }

+ 5 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/domain/ProgramReportCancellation.java

@@ -18,4 +18,9 @@ public class ProgramReportCancellation extends BaseEntity {
      */
     private String inFlag;
 
+    /**
+     * 报告号年份
+     */
+    private String number;
+
 }

+ 1 - 1
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/mapper/ProgramReportCancellationMapper.java

@@ -15,5 +15,5 @@ public interface ProgramReportCancellationMapper extends BaseMapper<ProgramRepor
 
     void updateInfoById(ProgramReportCancellation cancellation);
 
-    ProgramReportCancellation getInfos(@Param("type") String type);
+    ProgramReportCancellation getInfos(@Param("type") String type,@Param("currentYear") String currentYear);
 }

+ 2 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/mapper/ProgramReportNoMapper.java

@@ -24,6 +24,8 @@ public interface ProgramReportNoMapper extends BaseMapper<ProgramReportNo> {
     ProgramReportNo selectByProgramId(String id);
     @InterceptorIgnore(tenantLine = "true")
     List<ProgramReportNo> getByProgramId(@Param("id") String id);
+    @InterceptorIgnore(tenantLine = "true")
+    List<ProgramReportNo> getCancelledProject();
 }
 
 

+ 1 - 1
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/mapper/xml/ProgramReportCancellationMapper.xml

@@ -36,7 +36,7 @@
         create_time &lt; DATE_SUB(NOW(), INTERVAL (SELECT dv.label FROM sys_dict_type dt LEFT JOIN sys_dict_value dv ON dt.id = dv.dict_type_id WHERE dt.type = 'program_report_days') DAY)
         OR in_flag = '2'
         )
-        AND YEAR(create_time) = YEAR(CURDATE())
+        AND number = #{currentYear}
         AND report_no LIKE concat('%',#{type},'%')
         and del_flag = '0'
         ORDER BY create_time ASC

+ 14 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/mapper/xml/ProgramReportNoMapper.xml

@@ -36,4 +36,18 @@
             resultType="com.jeeplus.assess.program.configuration.projectList.domain.ProgramReportNo">
         select id,create_by_id,create_time,del_flag,program_id,report_no from program_report_no where program_id = #{id} and del_flag = 0
     </select>
+
+    <select id="getCancelledProject"
+            resultType="com.jeeplus.assess.program.configuration.projectList.domain.ProgramReportNo">
+        select
+            rn.id,
+            rn.create_by_id,
+            rn.create_time,
+            rn.del_flag,
+            rn.program_id,
+            rn.report_no
+        from program_report_no rn
+        left join program_cancellation pc on rn.program_id = pc.project_id and pc.del_flag = 0
+        where pc.status = '5' and rn.del_flag = '0'
+    </select>
 </mapper>

+ 77 - 35
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/program/configuration/projectList/service/ProjectListService.java

@@ -54,6 +54,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -149,7 +150,7 @@ public class ProjectListService {
         return add(dto,tabType);
     }
 
-    public String add(ProjectListDto dto,String tabType) throws Exception{
+    public synchronized String add(ProjectListDto dto,String tabType) throws Exception{
         String currentToken = TokenProvider.getCurrentToken();
         ProgramProjectListInfo info = new ProgramProjectListInfo();
         //获取当前登录人信息
@@ -159,13 +160,17 @@ public class ProjectListService {
         String reportNo = "";
         String id = UUID.randomUUID().toString().replace("-", "");
         if (("true").equals(dto.getGenerateReportNumber())) {
+            // 获取当前日期
+            LocalDate currentDate = LocalDate.now();
+            // 获取当前年份
+            String currentYear = String.valueOf(currentDate.getYear());
             if(StringUtils.isNotBlank(info.getReportType())){
                 //用于查询报告号时不同的报告类型
                 String type = "";
                 if (info.getReportType().equals("1")){
                     //先从报告号作废表中查询当年是否还有未被使用的报告号
                     type = "报字";
-                    ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
+                    ProgramReportCancellation infos=reportCancellationMapper.getInfos(type,currentYear);
                     if (ObjectUtil.isNotEmpty(infos)){
                         reportNo = infos.getReportNo();
                     }else {
@@ -173,7 +178,7 @@ public class ProjectListService {
                     }
                 } else if (info.getReportType().equals("2")) {
                     type = "咨字";
-                    ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
+                    ProgramReportCancellation infos=reportCancellationMapper.getInfos(type,currentYear);
                     if (ObjectUtil.isNotEmpty(infos)){
                         reportNo = infos.getReportNo();
                     }else {
@@ -445,7 +450,7 @@ public class ProjectListService {
         return programAudit.getId();
     }
 
-    public String update(ProjectListDto dto) throws Exception{
+    public synchronized String update(ProjectListDto dto) throws Exception{
         String currentToken = TokenProvider.getCurrentToken();
         //获取当前登录人信息
         UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken());
@@ -457,6 +462,10 @@ public class ProjectListService {
         info.setDelFlag(0);
         projectListMapper.updateById(info);
         String reportNo = "";
+        // 获取当前日期
+        LocalDate currentDate = LocalDate.now();
+        // 获取当前年份
+        String currentYear = String.valueOf(currentDate.getYear());
         if (("true").equals(dto.getGenerateReportNumber())) {
             ProgramReportNo programReportNo = programReportNoMapper.selectByProgramId(info.getId());
             if (null == programReportNo) {
@@ -466,7 +475,7 @@ public class ProjectListService {
                     if (info.getReportType().equals("1")) {
                         //先从报告号作废表中查询当年是否还有未被使用的报告号
                         type = "报字";
-                        ProgramReportCancellation infos = reportCancellationMapper.getInfos(type);
+                        ProgramReportCancellation infos = reportCancellationMapper.getInfos(type,currentYear);
                         if (ObjectUtil.isNotEmpty(infos)) {
                             reportNo = infos.getReportNo();
                         } else {
@@ -474,7 +483,7 @@ public class ProjectListService {
                         }
                     }else if (info.getReportType().equals("2")) {
                         type = "咨字";
-                        ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
+                        ProgramReportCancellation infos=reportCancellationMapper.getInfos(type,currentYear);
                         if (ObjectUtil.isNotEmpty(infos)){
                             reportNo = infos.getReportNo();
                         }else {
@@ -494,35 +503,37 @@ public class ProjectListService {
             }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);
+                if (ObjectUtil.isNotEmpty(byReportNo)){
+                    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,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);
+                                    }
                                 }
+                                ProgramReportNo programReportNo1 = programReportNoMapper.selectByProgramId(info.getId());
+                                ProgramReportNo programReport = new ProgramReportNo();
+                                programReport.setId(programReportNo1.getId());
+                                programReport.setReportNo(reportNo);
+                                programReportNoMapper.updateById(programReport);
                             }
-                            ProgramReportNo programReportNo1 = programReportNoMapper.selectByProgramId(info.getId());
-                            ProgramReportNo programReport = new ProgramReportNo();
-                            programReport.setId(programReportNo1.getId());
-                            programReport.setReportNo(reportNo);
-                            programReportNoMapper.updateById(programReport);
                         }
                     }
                 }
@@ -2061,10 +2072,12 @@ public class ProjectListService {
                         reportCancellationMapper.deleteByCanId(reportNo.getId());
                     }
                         if (StringUtils.isNotBlank(listInfo.getReportNo())){
+                            String number = listInfo.getReportNo().substring(7,11);
                             ProgramReportCancellation programReportCancellation = new ProgramReportCancellation();
                             programReportCancellation.setInFlag("1");
                             programReportCancellation.setReportNo(listInfo.getReportNo());
                             programReportCancellation.setId(UUID.randomUUID().toString().replace("-",""));
+                            programReportCancellation.setNumber(number);
                             reportCancellationMapper.insert(programReportCancellation);
                         }
 
@@ -2097,6 +2110,10 @@ 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())){
                 //根据报告号去报告号作废表中是否有该报告号
@@ -2117,7 +2134,7 @@ public class ProjectListService {
                                 if (listInfo.getReportType().equals("1")){
                                     //先从报告号作废表中查询当年是否还有未被使用的报告号
                                     type = "报字";
-                                    ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
+                                    ProgramReportCancellation infos=reportCancellationMapper.getInfos(type,currentYear);
                                     if (ObjectUtil.isNotEmpty(infos)){
                                         reportNo = infos.getReportNo();
                                     }else {
@@ -2125,7 +2142,7 @@ public class ProjectListService {
                                     }
                                 } else if (listInfo.getReportType().equals("2")) {
                                     type = "咨字";
-                                    ProgramReportCancellation infos=reportCancellationMapper.getInfos(type);
+                                    ProgramReportCancellation infos=reportCancellationMapper.getInfos(type,currentYear);
                                     if (ObjectUtil.isNotEmpty(infos)){
                                         reportNo = infos.getReportNo();
                                     }else {
@@ -2207,4 +2224,29 @@ public class ProjectListService {
             reportCancellationMapper.insert(reportCancellation);
         }
     }
+
+    /**
+     * 根据报告号查询该报告号是否被使用
+     * @param reportNo
+     * @return
+     */
+    public Boolean getIsUsed(String reportNo) {
+        ProgramReportCancellation reportCancellation = reportCancellationMapper.getByReportNo(reportNo);
+        if (ObjectUtil.isNotEmpty(reportCancellation)){
+            if (reportCancellation.getDelFlag() == 1){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 查询已作废项目的报告号
+     * @return
+     */
+    public List<ProgramReportNo> getCancelledProject() {
+        //获取已经作废的项目
+        List<ProgramReportNo> list=programReportNoMapper.getCancelledProject();
+        return list;
+    }
 }

+ 5 - 0
jeeplus-modules/jeeplus-xxl-job-executor-sample/src/main/java/com/jeeplus/domain/ProgramReportCancellationDTO.java

@@ -16,4 +16,9 @@ public class ProgramReportCancellationDTO extends BaseEntity {
      */
     private String inFlag;
 
+    /**
+     * 年份
+     */
+    private String number;
+
 }

+ 24 - 0
jeeplus-modules/jeeplus-xxl-job-executor-sample/src/main/java/com/xxl/job/executor/service/jobhandler/SampleXxlJob.java

@@ -110,12 +110,36 @@ public class SampleXxlJob {
             for (ProgramProjectListInfo info : infos) {
                 ProgramReportCancellationDTO dto = new ProgramReportCancellationDTO();
                 String id = UUID.randomUUID().toString().replace("-", "");
+                String number = info.getReportNo().substring(7,11);
                 dto.setId(id);
                 dto.setCreateById("1");
                 dto.setCreateTime(new Date());
                 dto.setUpdateById("1");
                 dto.setUpdateTime(new Date());
                 dto.setInFlag("2");
+                dto.setNumber(number);
+                dto.setReportNo(info.getReportNo());
+
+                String value = JSON.toJSONString(dto);
+                //保存数据
+                SpringUtil.getBean(IAssessApi.class).insertReportNo(value);
+            }
+        }
+        //查询已作废的项目
+        String list=SpringUtil.getBean(IAssessApi.class).getCancelledProject();
+        List<ProgramProjectListInfo> listInfos = JSON.parseObject(list, new TypeReference<List<ProgramProjectListInfo>>() {});
+        if (CollectionUtil.isNotEmpty(listInfos)){
+            for (ProgramProjectListInfo info : listInfos) {
+                ProgramReportCancellationDTO dto = new ProgramReportCancellationDTO();
+                String id = UUID.randomUUID().toString().replace("-", "");
+                String number = info.getReportNo().substring(7, 11);
+                dto.setId(id);
+                dto.setCreateById("1");
+                dto.setCreateTime(new Date());
+                dto.setUpdateById("1");
+                dto.setUpdateTime(new Date());
+                dto.setInFlag("1");
+                dto.setNumber(number);
                 dto.setReportNo(info.getReportNo());
 
                 String value = JSON.toJSONString(dto);