Browse Source

Merge remote-tracking branch 'origin/master'

liuyc 2 years ago
parent
commit
4612d53d80

+ 3 - 0
blade-service-api/blade-control-api/src/main/java/org/springblade/control/vo/ProjectCostBudgetStatsVO.java

@@ -37,4 +37,7 @@ public class ProjectCostBudgetStatsVO extends ProjectCostBudgetStats {
 
 
     @ApiModelProperty(value = "建设单位预算集合")
     @ApiModelProperty(value = "建设单位预算集合")
     private List<ProjectCostBudget> constructUnit;
     private List<ProjectCostBudget> constructUnit;
+
+    @ApiModelProperty(value = "1显示提交审批,0不显示")
+    private String approveStatus;
 }
 }

+ 8 - 2
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml

@@ -474,7 +474,10 @@
     <select id="pageByArchivesAuto11" resultMap="archivesAutoResultMap">
     <select id="pageByArchivesAuto11" resultMap="archivesAutoResultMap">
         select uaa.*
         select uaa.*
         from m_archive_tree_contract matc left join u_archives_auto uaa on matc.id = uaa.node_id
         from m_archive_tree_contract matc left join u_archives_auto uaa on matc.id = uaa.node_id
-        where uaa.is_deleted = 0 and uaa.is_archive = 1 and uaa.name like concat('%',#{vo.queryValue},'%')
+        where uaa.is_deleted = 0 and uaa.is_archive = 1
+        <if test="vo.queryValue != null and vo.queryValue != ''">
+            and uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%')
+        </if>
         <if test="vo.projectId != null and vo.projectId != ''">
         <if test="vo.projectId != null and vo.projectId != ''">
             and matc.project_id = #{vo.projectId}
             and matc.project_id = #{vo.projectId}
         </if>
         </if>
@@ -576,7 +579,10 @@
             or ancestors like concat('%',#{nodeId},'%') or id = #{nodeId}
             or ancestors like concat('%',#{nodeId},'%') or id = #{nodeId}
         </foreach>
         </foreach>
         ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
         ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
-        where uaa.is_deleted = 0 and uaa.is_archive = 1 and uaa.name like concat('%',#{vo.queryValue},'%')
+        where uaa.is_deleted = 0 and uaa.is_archive = 1
+        <if test="vo.queryValue != null and vo.queryValue != ''">
+            and uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%')
+        </if>
         <if test="vo.contractId != null and vo.contractId != ''">
         <if test="vo.contractId != null and vo.contractId != ''">
             and uaa.contract_id = #{vo.contractId}
             and uaa.contract_id = #{vo.contractId}
         </if>
         </if>

+ 11 - 3
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -985,6 +985,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             return;
             return;
         }
         }
 
 
+        ContractInfo contractIndfo = contractClient.getContractById(contractId);
+
         ArchiveFile archiveFile = this.archiveFileService.getOne(Wrappers.<ArchiveFile>lambdaQuery()
         ArchiveFile archiveFile = this.archiveFileService.getOne(Wrappers.<ArchiveFile>lambdaQuery()
                 .eq(ArchiveFile::getNodeId, nodeId.toString())
                 .eq(ArchiveFile::getNodeId, nodeId.toString())
                 .eq(ArchiveFile::getNodeExtId, keyId)
                 .eq(ArchiveFile::getNodeExtId, keyId)
@@ -1001,12 +1003,12 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             this.archiveFileService.updateById(archiveFile);
             this.archiveFileService.updateById(archiveFile);
 
 
         } else {
         } else {
-            archiveFile = getArchiveFile(query,nodeId,keyId,fileSize);
+            archiveFile = getArchiveFile(query,nodeId,keyId,fileSize,contractIndfo.archivesUnit());
             this.archiveFileService.save(archiveFile);
             this.archiveFileService.save(archiveFile);
         }
         }
     }
     }
 
 
-    public ArchiveFile getArchiveFile(InformationQuery query,Long nodeId,Long keyId,Long fileSize) {
+    public ArchiveFile getArchiveFile(InformationQuery query,Long nodeId,Long keyId,Long fileSize,String unit) {
         ArchiveFile archiveFile = new ArchiveFile();
         ArchiveFile archiveFile = new ArchiveFile();
         archiveFile.setNodeId(nodeId.toString());
         archiveFile.setNodeId(nodeId.toString());
         archiveFile.setNodeExtId(keyId);
         archiveFile.setNodeExtId(keyId);
@@ -1014,10 +1016,16 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
         archiveFile.setStatus(2); // 这里是新增归档文件,所以状态为1(已完成)
         archiveFile.setStatus(2); // 这里是新增归档文件,所以状态为1(已完成)
         //TODO 文件题名规则,待补充
         //TODO 文件题名规则,待补充
         fillFileNameAndTime(archiveFile,query);
         fillFileNameAndTime(archiveFile,query);
-        archiveFile.setFileSize(fileSize);
+
         archiveFile.setSourceType(1);
         archiveFile.setSourceType(1);
 
 
         //责任人怎么取
         //责任人怎么取
+        archiveFile.setDutyUser(unit);
+
+        //文件大小
+        archiveFile.setFileSize(query.getEVisaPdfSize());
+        archiveFile.setFilePage(query.getEVisaPdfPage());
+        archiveFile.setFileSize(fileSize);
 
 
         //
         //
         archiveFile.setEVisaFile(query.getEVisaPdfUrl());
         archiveFile.setEVisaFile(query.getEVisaPdfUrl());

+ 20 - 7
blade-service/blade-control/src/main/java/org/springblade/control/mapper/AnnualBudgetMapper.xml

@@ -21,18 +21,31 @@
                (select dict_name  from c_dict_info WHERE code = 'contract_type' AND dict_value= cci.contract_type) as contractTypeValue
                (select dict_name  from c_dict_info WHERE code = 'contract_type' AND dict_value= cci.contract_type) as contractTypeValue
         from c_control_project_info cpi left join c_control_contract_info cci on cpi.id = cci.project_id
         from c_control_project_info cpi left join c_control_contract_info cci on cpi.id = cci.project_id
     </select>
     </select>
+<!--    <select id="getReturnedByAnnualBudgetId" resultType="org.springblade.control.vo.AnnualBudgetIncomeVO">-->
+<!--        SELECT-->
+<!--                (select name from c_control_project_info WHERE id = abi.project_id ) as projectName,-->
+<!--                (select dict_name  from c_dict_info WHERE code = 'project_income_type' AND dict_value = abi.income_type) as incomeTypeValue,-->
+<!--                abi.project_type_value ,-->
+<!--               abi.contract_type_value,-->
+<!--               cri.practical_returned_time as returnTime,-->
+<!--               cri.practical_returned_money as returnMoney-->
+<!--        FROM c_annual_budget_income abi left join c_contract_returned_info cri on abi.project_id = cri.project_id-->
+<!--        WHERE cri.practical_returned_time is not null and cri.practical_returned_money is not NULL-->
+<!--          AND abi.annual_budget_id = #{id}-->
+<!--    </select>-->
+
     <select id="getReturnedByAnnualBudgetId" resultType="org.springblade.control.vo.AnnualBudgetIncomeVO">
     <select id="getReturnedByAnnualBudgetId" resultType="org.springblade.control.vo.AnnualBudgetIncomeVO">
-        SELECT
+        SELECT  abi.predict_contract_money,
                 (select name from c_control_project_info WHERE id = abi.project_id ) as projectName,
                 (select name from c_control_project_info WHERE id = abi.project_id ) as projectName,
                 (select dict_name  from c_dict_info WHERE code = 'project_income_type' AND dict_value = abi.income_type) as incomeTypeValue,
                 (select dict_name  from c_dict_info WHERE code = 'project_income_type' AND dict_value = abi.income_type) as incomeTypeValue,
                 abi.project_type_value ,
                 abi.project_type_value ,
-               abi.contract_type_value,
-               cri.practical_returned_time as returnTime,
-               cri.practical_returned_money as returnMoney
-        FROM c_annual_budget_income abi left join c_contract_returned_info cri on abi.project_id = cri.project_id
-        WHERE cri.practical_returned_time is not null and cri.practical_returned_money is not NULL
-          AND abi.annual_budget_id = #{id}
+                abi.contract_type_value,
+                abi.predict_sign_date as returnTime,
+                abi.predict_annual_returned as returnMoney
+        FROM c_annual_budget_income abi
+        WHERE abi.annual_budget_id = #{id}
     </select>
     </select>
+
     <select id="getDisburseByAnnualBudgetId" resultType="org.springblade.control.vo.AnnualBudgetDisburseVO">
     <select id="getDisburseByAnnualBudgetId" resultType="org.springblade.control.vo.AnnualBudgetDisburseVO">
         select abd.*,
         select abd.*,
                (select dict_name  from c_dict_info WHERE `type` = 1 AND dict_value = abd.budget_subject AND parent_id = 0) as budgetSubjectValue,
                (select dict_name  from c_dict_info WHERE `type` = 1 AND dict_value = abd.budget_subject AND parent_id = 0) as budgetSubjectValue,

+ 3 - 2
blade-service/blade-control/src/main/java/org/springblade/control/mapper/DepartmentMonthPlanMapper.xml

@@ -18,14 +18,15 @@
                     and (pcb.plan_start_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date
                     and (pcb.plan_start_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date
                     or pcb.plan_end_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date)) as 'planTotal',
                     or pcb.plan_end_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date)) as 'planTotal',
                 (select COUNT(1)  from c_project_cost_budget pcb WHERE pcb.cost_type = dmp.department_type
                 (select COUNT(1)  from c_project_cost_budget pcb WHERE pcb.cost_type = dmp.department_type
-                                                                   and pcb.status = 4
+                                                                   and pcb.task_approve = 1
                     and (pcb.plan_start_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date
                     and (pcb.plan_start_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date
                     or pcb.plan_end_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date)) as 'finishPlanTotal',
                     or pcb.plan_end_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date)) as 'finishPlanTotal',
                 (select COUNT(1)  from c_project_cost_budget pcb WHERE pcb.cost_type = dmp.department_type
                 (select COUNT(1)  from c_project_cost_budget pcb WHERE pcb.cost_type = dmp.department_type
-                                                                   and pcb.status != 4
+                                                                   and pcb.task_approve = 0
                     and (pcb.plan_start_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date
                     and (pcb.plan_start_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date
                     or pcb.plan_end_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date)) as 'beginPlanTotal'
                     or pcb.plan_end_time BETWEEN dmp.plan_start_date AND dmp.plan_end_date)) as 'beginPlanTotal'
         FROM c_department_month_plan dmp
         FROM c_department_month_plan dmp
+        order by dmp.plan_start_date desc
     </select>
     </select>
     <select id="getDepartmentUserDict" resultType="org.springblade.core.secure.BladeUser">
     <select id="getDepartmentUserDict" resultType="org.springblade.core.secure.BladeUser">
 
 

+ 3 - 1
blade-service/blade-control/src/main/java/org/springblade/control/mapper/ProjectCostBudgetStatsMapper.xml

@@ -14,7 +14,9 @@
     </select>
     </select>
 
 
     <select id="page" resultType="org.springblade.control.vo.ProjectCostBudgetStatsVO">
     <select id="page" resultType="org.springblade.control.vo.ProjectCostBudgetStatsVO">
-        SELECT cbs.*,cpi.name as projectName,CASE cbs.status WHEN '0' THEN '未上报' WHEN '1' THEN '已上报' WHEN '2' THEN '已审批' ELSE '已驳回' END as statusValue
+        SELECT cbs.*,cpi.name as projectName,
+--                CASE cbs.status WHEN '0' THEN '未上报' WHEN '1' THEN '已上报' WHEN '2' THEN '已审批' ELSE '已驳回' END as statusValue
+        IF ((select COUNT(1)  from c_project_cost_budget pcb WHERE pcb.project_id = cbs.project_id and pcb.approve = 0)=0,0,1) as 'approveStatus'
         from c_project_cost_budget_stats cbs left join bladex.c_control_project_info cpi on cbs.project_id = cpi.id
         from c_project_cost_budget_stats cbs left join bladex.c_control_project_info cpi on cbs.project_id = cpi.id
         where cbs.is_deleted = 0
         where cbs.is_deleted = 0
         <if test="queryValue != null and queryValue != ''">
         <if test="queryValue != null and queryValue != ''">

+ 1 - 1
blade-service/blade-control/src/main/java/org/springblade/control/mapper/ProjectInfoMapper.xml

@@ -23,7 +23,7 @@
             and pi.implement_principal = #{dto.implementPrincipal}
             and pi.implement_principal = #{dto.implementPrincipal}
         </if>
         </if>
         <if test="dto.queryDate != null and dto.queryDate != ''">
         <if test="dto.queryDate != null and dto.queryDate != ''">
-            and #{dto.queryDate} BETWEEN pi.start_time AND pi.end_time
+            and #{dto.queryDate} between DATE_FORMAT(pi.start_time ,'%Y-%m') and DATE_FORMAT(pi.end_time ,'%Y-%m')
         </if>
         </if>
         <if test="dto.queryValue != null and dto.queryValue != ''">
         <if test="dto.queryValue != null and dto.queryValue != ''">
             and pi.name like concat('%', #{dto.queryValue}, '%')
             and pi.name like concat('%', #{dto.queryValue}, '%')

+ 10 - 0
blade-service/blade-control/src/main/java/org/springblade/control/service/impl/ContractInfoServiceImpl.java

@@ -22,6 +22,8 @@ import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.mp.support.Query;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.entity.DictBiz;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
@@ -39,6 +41,8 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
 
 
     private final IContractReturnedInfoService returnedInfoService;
     private final IContractReturnedInfoService returnedInfoService;
 
 
+    private final JdbcTemplate jdbcTemplate;
+
     /**
     /**
      * 添加合同信息
      * 添加合同信息
      */
      */
@@ -48,6 +52,9 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
         Long id = SnowFlakeUtil.getId();
         Long id = SnowFlakeUtil.getId();
         dto.setId(id);
         dto.setId(id);
         BeanUtils.copyProperties(dto,contractInfo);
         BeanUtils.copyProperties(dto,contractInfo);
+        if (dto.getStartTime() != null && dto.getEndTime() != null){
+            jdbcTemplate.execute("update c_control_project_info set start_time = '"+dto.getStartTime() + "', end_time = '"+ dto.getEndTime() +"' where id = "+ dto.getProjectId());
+        }
         baseMapper.insert(contractInfo);
         baseMapper.insert(contractInfo);
         returnedInfoService.saveOrUpdateBatchReturned(dto);
         returnedInfoService.saveOrUpdateBatchReturned(dto);
 
 
@@ -94,6 +101,9 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
     public void updateContractInfo(ControlContractInfoDTO dto) {
     public void updateContractInfo(ControlContractInfoDTO dto) {
         ControlContractInfo contractInfo = new ControlContractInfo();
         ControlContractInfo contractInfo = new ControlContractInfo();
         BeanUtils.copyProperties(dto,contractInfo);
         BeanUtils.copyProperties(dto,contractInfo);
+        if (dto.getStartTime() != null && dto.getEndTime() != null){
+            jdbcTemplate.execute("update c_control_project_info set start_time = '"+dto.getStartTime() + "', end_time = '"+ dto.getEndTime() +"' where id = "+ dto.getProjectId());
+        }
         this.updateById(contractInfo);
         this.updateById(contractInfo);
         returnedInfoService.saveOrUpdateBatchReturned(dto);
         returnedInfoService.saveOrUpdateBatchReturned(dto);
     }
     }

+ 4 - 0
blade-service/blade-control/src/main/java/org/springblade/control/service/impl/ProjectInfoServiceImpl.java

@@ -107,6 +107,10 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, C
         if (one1 != null){
         if (one1 != null){
             throw new ServiceException("项目存在合同,不能删除");
             throw new ServiceException("项目存在合同,不能删除");
         }
         }
+        List<ProjectCostBudget> list = budgetService.list(new LambdaQueryWrapper<ProjectCostBudget>().eq(ProjectCostBudget::getProjectId, id));
+        if (list != null || list.size() > 0){
+            throw new ServiceException("项目已经做了预算,不能删除");
+        }
         baseMapper.deleteById(id);
         baseMapper.deleteById(id);
         processService.removeProjectProcess(id);
         processService.removeProjectProcess(id);
     }
     }

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml

@@ -489,7 +489,7 @@
         <if test="contractId!=null and contractId!=''">
         <if test="contractId!=null and contractId!=''">
             and contract_id = #{contractId}
             and contract_id = #{contractId}
         </if>
         </if>
-        ORDER BY d.sort
+        ORDER BY d.sort, title, d.create_time
     </select>
     </select>
 
 
     <select id="trialRelationTree" resultType="org.springblade.manager.vo.TrialRecordZJTreeVO">
     <select id="trialRelationTree" resultType="org.springblade.manager.vo.TrialRecordZJTreeVO">

+ 20 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractSyncImpl.java

@@ -6,11 +6,15 @@ import org.springblade.business.entity.InformationQuery;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.manager.entity.ArchiveTreeContract;
 import org.springblade.manager.entity.ArchiveTreeContract;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
 import org.springblade.manager.mapper.ArchiveTreeContractMapper;
 import org.springblade.manager.mapper.ArchiveTreeContractMapper;
+import org.springblade.manager.service.IContractInfoService;
 import org.springblade.manager.service.IProjectInfoService;
 import org.springblade.manager.service.IProjectInfoService;
 import org.springblade.common.utils.ForestNodeMergerEx;
 import org.springblade.common.utils.ForestNodeMergerEx;
+import org.springblade.manager.utils.ForestNodeMerger;
 import org.springblade.manager.vo.ArchiveTreeContractVO2;
 import org.springblade.manager.vo.ArchiveTreeContractVO2;
 import org.springblade.manager.vo.ArchiveTreeVO2;
 import org.springblade.manager.vo.ArchiveTreeVO2;
+import org.springblade.manager.vo.WbsTreeContractVO6;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.*;
 import java.util.*;
@@ -27,6 +31,8 @@ public class ArchiveTreeContractSyncImpl {
 
 
     private final ArchiveAutoRuleSyncImpl archiveAutoRuleSync;
     private final ArchiveAutoRuleSyncImpl archiveAutoRuleSync;
 
 
+    private final IContractInfoService contractInfoService;
+
     /**
     /**
      * 普通同步
      * 普通同步
      *
      *
@@ -215,7 +221,7 @@ public class ArchiveTreeContractSyncImpl {
     }
     }
 
 
 
 
-    public void  syncBusinessData(Long contractId) {
+    public void  syncBusinessData(Long projectId,Long contractId) {
         //获取某个合同段所有的电签完成的文件题名,取 id wbsid name,eVisaPdfUrl
         //获取某个合同段所有的电签完成的文件题名,取 id wbsid name,eVisaPdfUrl
         List<InformationQuery> informationQueryList = getInformationQuerys(contractId);
         List<InformationQuery> informationQueryList = getInformationQuerys(contractId);
 
 
@@ -242,6 +248,19 @@ public class ArchiveTreeContractSyncImpl {
             }
             }
         }
         }
 
 
+        ProjectInfo projectInfo = projectInfoService.getOne(projectId);
+
+        Long lWbsId = projectInfo.getReferenceWbsTemplateId();
+
+        List<WbsTreeContractVO6> wbsTrees = contractInfoService.tree8(lWbsId.toString(), projectId.toString(), contractId.toString());
+        if (wbsTrees == null || wbsTrees.size() == 0) {
+            return ;
+        }
+
+        List<WbsTreeContractVO6> wbsTreeContractVO6s = new ArrayList<>();
+        ForestNodeMerger.getTreeList(wbsTrees.get(0), wbsTreeContractVO6s);
+
+
         //对于newInformationQueryList。生成,需提供对应的nodeid
         //对于newInformationQueryList。生成,需提供对应的nodeid
 
 
         //对于updateInformationQueryList,需要找出更新文件和文件大小
         //对于updateInformationQueryList,需要找出更新文件和文件大小