huangjn пре 3 година
родитељ
комит
d9f90fdb9c

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/ArchiveFileController.java

@@ -109,7 +109,7 @@ public class ArchiveFileController extends BladeController {
 				}
 			}
 		}
-		return list.size() == 0 ? R.data(true) : R.data(300, false, "操作失败");
+		return list.size() == 0 ? R.data(true) : R.data(300, false, "没有找到证书文件或PDF文件");
 	}
 
 	/**

+ 56 - 34
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -234,18 +234,6 @@ public class InformationWriteQueryController extends BladeController {
 			//获取被复制节点的表格
 			List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(wbsTreeContract, "queryTable", "");
 			if(tableList != null && tableList.size() > 0){
-				//获取合同段信息
-				ContractInfo contract = this.contractClient.getContractById(Long.parseLong(tableList.get(0).getContractId()));
-				if(new Integer("1").equals(contract.getIsCopyData())){
-					//说明开启数据复制限制,根据合同段类型判断哪些数据是能够被复制的
-					String removeString = new Integer("1").equals(contract.getContractType()) ? "1,2,3" : "5,6,7";
-					//删除掉不符合条件的数据
-					tableList.removeIf(table -> Arrays.asList(removeString.split(",")).contains(table.getTableType().toString()));
-
-                    if(tableList.size() <= 0){
-                        return R.data(300, false, "当前合同段已开启数据隔离,当前节点下未找到符合复制条件的数据");
-                    }
-				}
 
 				//获取表格的业务数据
 				Map<String, List<List<Map<String, Object>>>> tableBusinessDataMap = new HashMap<>();
@@ -271,8 +259,31 @@ public class InformationWriteQueryController extends BladeController {
 				//新增数据SQL
 				List<String> saveSqlList = new ArrayList<>();
 				for(CopyContractTreeNodeVO.CopyBatch copyBatch : batchPathList){
+					//获取选择的节点信息
+					WbsTreeContract selectNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId());
+
+					//获取合同段信息
+					ContractInfo contract = this.contractClient.getContractById(Long.parseLong(selectNode.getContractId()));
+
+					//实际获取的数据
+					Map<String, List<List<Map<String, Object>>>> currentDataMap = new HashMap<>();
+					if(new Integer("1").equals(contract.getIsCopyData())){
+						//说明开启数据复制限制,根据合同段类型判断哪些数据是能够被复制的
+						String removeString = new Integer("1").equals(contract.getContractType()) ? "1,2,3" : "5,6,7";
+						//找符合条件的表格
+						List<WbsTreeContract> tables = tableList.stream().filter(tree -> Arrays.asList(removeString.split(",")).contains(tree.getTableType().toString())).distinct().collect(Collectors.toList());
+						if(tables.size() <= 0){
+							continue;
+						}
+						for(WbsTreeContract node : tables){
+							if(tableBusinessDataMap.containsKey(node.getId().toString()) && !currentDataMap.containsKey(node.getId().toString())){
+								currentDataMap.put(node.getId().toString(), tableBusinessDataMap.get(node.getId().toString()));
+							}
+						}
+					}
+
 					//获取表格信息
-					List<WbsTreeContract> copyToTableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId()), "queryTable", "");
+					List<WbsTreeContract> copyToTableList = this.wbsTreeContractClient.queryChildByParentId(selectNode, "queryTable", "");
 					if(copyToTableList != null && copyToTableList.size() > 0){
                         //首先,记录数据删除sql
                         for(WbsTreeContract table : copyToTableList){
@@ -282,15 +293,15 @@ public class InformationWriteQueryController extends BladeController {
                         }
 
 						//其次,检测是否表格是否存在差异(如果存在oldId则优先使用这个字段,不存在时才使用id)
-						List<WbsTreeContract> remainTableList = copyToTableList.stream().filter(toTable -> tableBusinessDataMap.containsKey(StringUtils.isNotEmpty(toTable.getOldId()) ? toTable.getOldId() : toTable.getId().toString())).collect(Collectors.toList());
+						List<WbsTreeContract> remainTableList = copyToTableList.stream().filter(toTable -> currentDataMap.containsKey(StringUtils.isNotEmpty(toTable.getOldId()) ? toTable.getOldId() : toTable.getId().toString())).collect(Collectors.toList());
 						//循环有数据的表格
 						for(WbsTreeContract remainTable : remainTableList){
 							if(StringUtils.isNotEmpty(remainTable.getInitTableName())){
 								//获取主键
 								String id = StringUtils.isNotEmpty(remainTable.getOldId()) ? remainTable.getOldId() : remainTable.getId().toString();
-								if(tableBusinessDataMap.containsKey(id)){
+								if(currentDataMap.containsKey(id)){
 									//获取对应表格的数据
-									Iterator<List<Map<String, Object>>> oneLevelIterator = tableBusinessDataMap.get(id).iterator();
+									Iterator<List<Map<String, Object>>> oneLevelIterator = currentDataMap.get(id).iterator();
 									while (oneLevelIterator.hasNext()){
 										List<Map<String, Object>> dataMapList = oneLevelIterator.next();
 										Iterator<Map<String, Object>> iterator = dataMapList.iterator();
@@ -506,7 +517,7 @@ public class InformationWriteQueryController extends BladeController {
 				result.removeIf(query -> StringUtils.isEmpty(query.getPdfUrl()) && StringUtils.isEmpty(query.getPdfUrl()));
 				if(result.size() > 0){
 					List<String> urls = new ArrayList<>();
-					result.forEach(query -> urls.add(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl()));
+					result.forEach(query -> urls.add(StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() + "@@@" + query.getName() : query.getPdfUrl() + "@@@" + query.getName()));
 					//删除空数据
 					urls.removeIf(StringUtils::isEmpty);
 					//打包下载
@@ -703,6 +714,10 @@ public class InformationWriteQueryController extends BladeController {
 					//初始化PDF路径
 					newData.setPdfUrl(null);
 					newData.setCreateUser(AuthUtil.getUserId());
+
+					//重塑父节点关联关系
+					this.restoreParent(newData, oldToNewIdMap);
+
 					//保存到集合中
 					saveList.add(newData);
 
@@ -762,23 +777,7 @@ public class InformationWriteQueryController extends BladeController {
 						newData.setPdfUrl(null);
 
 						//重塑父节点关联关系
-						String ancestors = newData.getAncestors();
-						if(StringUtils.isNotEmpty(ancestors)){
-							//重组后的链表
-							StringBuilder stringBuilder = new StringBuilder();
-							//拆分重组
-							String[] ancestorsArray = ancestors.split(",");
-							for(String oldParentId : ancestorsArray){
-								if(StringUtils.isNotEmpty(oldParentId)){
-									//获取新的
-									Long newParentId = oldToNewIdMap.get(Long.parseLong(oldParentId));
-									//如果新的id为空,说明不变
-									stringBuilder.append(",").append(newParentId == null ? oldParentId : newParentId);
-								}
-							}
-							//将新链表设置进对象中
-							newData.setAncestors(stringBuilder.substring(1));
-						}
+						this.restoreParent(newData, oldToNewIdMap);
 
 						//保存到集合中
 						saveList.add(newData);
@@ -795,6 +794,29 @@ public class InformationWriteQueryController extends BladeController {
 		return this.saveOrCopyNodeTree(saveList, saveLedger, 32);
 	}
 
+	/**
+	 * 重塑父节点链
+	 */
+	private void restoreParent(WbsTreeContract newData, Map<Long,Long> oldToNewIdMap){
+		String ancestors = newData.getAncestors();
+		if(StringUtils.isNotEmpty(ancestors)){
+			//重组后的链表
+			StringBuilder stringBuilder = new StringBuilder();
+			//拆分重组
+			String[] ancestorsArray = ancestors.split(",");
+			for(String oldParentId : ancestorsArray){
+				if(StringUtils.isNotEmpty(oldParentId)){
+					//获取新的
+					Long newParentId = oldToNewIdMap.get(Long.parseLong(oldParentId));
+					//如果新的id为空,说明不变
+					stringBuilder.append(",").append(newParentId == null ? oldParentId : newParentId);
+				}
+			}
+			//将新链表设置进对象中
+			newData.setAncestors(stringBuilder.substring(1));
+		}
+	}
+
 	/**
 	 * 生成施工日志记录
 	 */

+ 33 - 16
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -101,22 +101,39 @@
     </select>
 
     <select id="countInformationQuery" resultType="java.lang.Integer">
-        select count(id) from u_information_query
-        where
-            is_deleted = 0
-        and classify = #{query.classify}
-        and contract_id = #{query.contractId}
-        <if test="query.taskStatus != null and query.taskStatus != ''"> and status = #{query.taskStatus} </if>
-        <if test="query.sourceType != null and query.sourceType != ''"> and source_type = #{query.sourceType} </if>
-        <if test="query.reportNumber != null and query.reportNumber != ''"> and report_number = #{query.reportNumber} </if>
-        <if test="query.fileUserIdAndName != null and query.fileUserIdAndName != ''"> and file_user_id_and_name like concat('%',#{query.fileUserIdAndName},'%') </if>
-        <if test="query.queryValue != null and query.queryValue != ''"> and (name like concat('%',#{query.queryValue},'%') OR number like concat('%',#{query.queryValue},'%')) </if>
-        <if test="query.wbsIds != null">
-            and wbs_id in
-            <foreach collection="query.wbsIds" item="wbsIdc" open="(" separator="," close=")">
-                #{wbsIdc}
-            </foreach>
-        </if>
+        select
+          count(query.id)
+        from
+        (
+            select
+              query.id
+            from
+            (
+                select
+                  id
+                from u_information_query
+                where
+                  is_deleted = 0
+                and classify = #{query.classify}
+                and contract_id = #{query.contractId}
+                <if test="query.taskStatus != null and query.taskStatus != ''"> and status = #{query.taskStatus} </if>
+                <if test="query.sourceType != null and query.sourceType != ''"> and source_type = #{query.sourceType} </if>
+                <if test="query.reportNumber != null and query.reportNumber != ''"> and report_number = #{query.reportNumber} </if>
+                <if test="query.fileUserIdAndName != null and query.fileUserIdAndName != ''"> and file_user_id_and_name like concat('%',#{query.fileUserIdAndName},'%') </if>
+                <if test="query.queryValue != null and query.queryValue != ''"> and (name like concat('%',#{query.queryValue},'%') OR number like concat('%',#{query.queryValue},'%')) </if>
+                <if test="query.wbsIds != null">
+                    and wbs_id in
+                    <foreach collection="query.wbsIds" item="wbsIdc" open="(" separator="," close=")">
+                        #{wbsIdc}
+                    </foreach>
+                </if>
+            ) AS query
+            where
+            1 = 1
+            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
+                and query.createTimes between #{query.startTime} and #{query.endTime}
+            </if>
+        ) AS query
     </select>
 
     <select id="selectInformationQueryPage" resultMap="informationQueryResultMap">

+ 20 - 2
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -176,8 +176,6 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 	@Override
 	public IPage<InformationQueryVO> selectInformationQueryPage(IPage<InformationQueryVO> page, InformationQueryVO vo) {
 		long current = (page.getCurrent() - 1L) * page.getSize();
-		//获取总量
-		Integer count = this.baseMapper.countInformationQuery(vo);
 
 		if(StringUtils.isNotEmpty(vo.getBetweenTime())){
 			String[] betweenTime;
@@ -191,6 +189,13 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 			vo.setEndTime(betweenTime[1]);
 		}
 
+		if(StringUtils.isNotEmpty(vo.getFileUserIdAndName())){
+			vo.setFileUserIdAndName(vo.getFileUserIdAndName().split("-")[0]);
+		}
+
+		//获取总量
+		Integer count = this.baseMapper.countInformationQuery(vo);
+
 		//获取数据
 		List<InformationQuery> result = this.baseMapper.selectInformationQueryPage(current, page.getSize(), vo);
 		//转换VO
@@ -200,6 +205,19 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 			voResult.forEach(vor -> {
 				vor.setStartTime(DateUtil.format(vor.getCreateTime(), "yyyy-MM-dd"));
 				vor.setTaskStatusStr(new Integer("0").equals(vor.getStatus()) ? "未上报" : new Integer("1").equals(vor.getStatus()) ? "待审批" : new Integer("2").equals(vor.getStatus()) ? "已审批" : "已废除");
+				try{
+					//填报人
+					String fileUserIdAndName = vor.getFileUserIdAndName();
+					String[] fileUserIdAndNames = fileUserIdAndName.split(",");
+					List<String> names = new ArrayList<>();
+					for(String str : fileUserIdAndNames){
+						names.add(str.split("-")[1]);
+					}
+					//只拼接名字
+					vor.setFileUserIdAndName(String.join(",", names));
+				}catch (Exception e){
+					e.printStackTrace();
+				}
 
 				if(Arrays.asList("1,2".split(",")).contains(vor.getStatus().toString())){
 					//说明属于待审批和已审批状态,查询待办信息

+ 24 - 4
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVisaServiceImpl.java

@@ -43,7 +43,9 @@ import org.springblade.evisa.vo.EVisaMakeSealVO;
 import org.springblade.evisa.vo.EVisaTaskApprovalVO;
 import org.springblade.evisa.vo.SealPdfVO;
 import org.springblade.evisa.vo.SealStrategyVO;
+import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.SignPfxFile;
+import org.springblade.manager.feign.ContractClient;
 import org.springblade.manager.feign.SignPfxClient;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springframework.mock.web.MockMultipartFile;
@@ -89,6 +91,8 @@ public class EVisaServiceImpl implements EVisaService {
 
     private final NewIOSSClient newIOSSClient;
 
+    private final ContractClient contractClient;
+
     @Override
     public String certification(String pdfUrl, String fileName, String contractId) {
         try{
@@ -97,13 +101,26 @@ public class EVisaServiceImpl implements EVisaService {
             if(pfxFiles == null || pfxFiles.size() <= 0){
                 return NOT_PFX_OR_FILE;
             }
+            //查询合同段信息
+            ContractInfo contract = this.contractClient.getContractById(Long.parseLong(contractId));
+
             //找到合同章
             SignPfxFile contractPfx = null;
             for(SignPfxFile pfxFile : pfxFiles){
-                if("2".equals(pfxFile.getPfxType())){
-                    //找到当前合同段的合同章类型
-                    contractPfx = pfxFile;
-                    break;
+                if(new Integer("1").equals(contract.getContractType())){
+                    //施工方
+                    if("2".equals(pfxFile.getPfxType())){
+                        //找到当前合同段的合同章类型
+                        contractPfx = pfxFile;
+                        break;
+                    }
+                } else if(new Integer("2").equals(contract.getContractType())){
+                    //监理方
+                    if("3".equals(pfxFile.getPfxType())){
+                        //找到当前合同段的合同章类型
+                        contractPfx = pfxFile;
+                        break;
+                    }
                 }
             }
             //没有找到合同章,直接返回
@@ -552,6 +569,9 @@ public class EVisaServiceImpl implements EVisaService {
                 logger.info("【电签模块】{}", "创建印章成功==========certDn: " + responseBodyBean.getCertDn() + " ; message: " + responseHeadBean.getMessage());
                 //请求结果
                 return responseHeadBean.getMessage();
+            } else if(responseHeadBean.getMessage().contains("is exist")) {
+                logger.info("【电签模块】{}", responseHeadBean.getMessage());
+                return "successfully";
             }
         }catch (Exception e){
             e.printStackTrace();

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

@@ -159,7 +159,7 @@ public class SignPfxFileServiceImpl extends BaseServiceImpl<SignPfxFileMapper, S
 	/**
 	 * 注册印模
 	 */
-	public Boolean pfxMakeSeal(MakeSealDTO makeSeal, String msg, String pfxFileId){
+	private Boolean pfxMakeSeal(MakeSealDTO makeSeal, String msg, String pfxFileId){
 		try{
 			//调用接口创建印模
 			String resultCode = this.eVisaClient.createSeal(JSONObject.parseObject(JSONObject.toJSONString(makeSeal), EVisaMakeSealVO.class));