Kaynağa Gözat

Merge branch 'cr' of http://219.151.181.73:3000/zhuwei/bladex into test-merge-02

# Conflicts:
#	blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.java
#	blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml
#	blade-service/blade-archive/src/main/java/org/springblade/archive/service/IArchivesAutoService.java
#	blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java
chenr 3 ay önce
ebeveyn
işleme
2ab8706a91

+ 31 - 0
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/dto/FindAndReplaceDto.java

@@ -0,0 +1,31 @@
+package org.springblade.archive.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode
+public class FindAndReplaceDto {
+    private String ids;
+    /**
+     * 1新增 2替换 3删除
+     */
+    private Integer type;
+    /**
+     * 查找内容
+     */
+    private String query;
+    /**
+     * 新增内容
+     */
+    private String replace;
+
+    /**
+     * 1 前   2 后
+     */
+    private Integer position;
+}

+ 10 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchivesAutoController.java

@@ -34,6 +34,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.http.message.BasicNameValuePair;
 import org.springblade.archive.dto.ArchiveWarningDTO;
+import org.springblade.archive.dto.FindAndReplaceDto;
 import org.springblade.archive.dto.SaveApplyDTO;
 import org.springblade.archive.entity.ArchiveConclusion;
 import org.springblade.archive.entity.ExpertInspection;
@@ -431,9 +432,18 @@ public class ArchivesAutoController extends BladeController {
 		List<ArchivesAuto> archivesAutos = archivesAutoService.listByIds(Func.toLongList(ids));
 		for (ArchivesAuto ar  :archivesAutos) {
 			ar.setIsLock(0);
+            String sql="update u_archive_file set is_lock=0 where archive_id="+ar.getId()+" and is_deleted=0";
+            jdbcTemplate.update(sql);
 		}
 		return R.status(archivesAutoService.updateBatchById(archivesAutos));
 	}
+    @PostMapping("/findAndReplace")
+    @ApiOperationSupport(order = 12)
+    @ApiOperation(value = "查找并替换", notes = "传入ids")
+    public R findAndReplace(@RequestBody FindAndReplaceDto dto){
+        List<ArchivesAuto> archivesAutos = archivesAutoService.listByIds(Func.toLongList(dto.getIds()));
+        return R.status(archivesAutoService.findAndReplace(archivesAutos,dto));
+    }
 
 
 	@PostMapping("/archiveAutoPercentComplete")

+ 2 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/service/IArchivesAutoService.java

@@ -160,4 +160,6 @@ public interface IArchivesAutoService extends BaseService<ArchivesAuto> {
     boolean reBuildArchiveFrontPdfs(String archiveIds, Long projectId);
 
 	R sendFileToEArchives(ArchiveDataVo dataInfo);
+
+    boolean findAndReplace(List<ArchivesAuto> archivesAutos, FindAndReplaceDto dto);
 }

+ 67 - 17
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -73,11 +73,9 @@ import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.user.entity.User;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
@@ -91,7 +89,6 @@ import java.time.LocalDateTime;
 import java.util.*;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**
@@ -1260,10 +1257,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		}
 		archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
 		try {
-//			for (ArchiveFile saveVo : waitArchiveFiles) {
-//				metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
-//			}
-			batchCreateMetadataFiles(waitArchiveFiles);
+			for (ArchiveFile saveVo : waitArchiveFiles) {
+				metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
+			}
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -1319,7 +1315,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		}
 		archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
 		try {
-			batchCreateMetadataFiles(waitArchiveFiles);
+			for (ArchiveFile saveVo : waitArchiveFiles) {
+				metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
+			}
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -1366,10 +1364,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		}
 		archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
 		try {
-//			for (ArchiveFile saveVo : waitArchiveFiles) {
-//				metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
-//			}
-			batchCreateMetadataFiles(waitArchiveFiles);
+			for (ArchiveFile saveVo : waitArchiveFiles) {
+				metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
+			}
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -1422,10 +1419,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		}
 		archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
 		try {
-//			for (ArchiveFile saveVo : waitArchiveFiles) {
-//				metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
-//			}
-			batchCreateMetadataFiles(waitArchiveFiles);
+			for (ArchiveFile saveVo : waitArchiveFiles) {
+				metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
+			}
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -4034,6 +4030,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
         if(StringUtils.isEmpty(archiveIds)){
             return false;
         }
+        archiveAutoPdfService.assignArchiveTableUrl();
         String[] ids = archiveIds.split(",");
         for (String archiveId : ids) {
             ArchivesAuto auto = baseMapper.selectById(archiveId);
@@ -4044,6 +4041,59 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
         return true;
     }
 
+    @Override
+    public boolean findAndReplace(List<ArchivesAuto> archivesAutos, FindAndReplaceDto dto) {
+        for (ArchivesAuto archivesAuto : archivesAutos) {
+            if(dto.getType()==1){
+               if(StringUtils.isNotEmpty(dto.getQuery())&&StringUtils.isNotEmpty(dto.getReplace())){
+                   String name = archivesAuto.getName();
+                   if (StringUtils.isNotEmpty(name)&&name.contains(dto.getQuery())) {
+                       int index = name.indexOf(dto.getQuery());
+                       if (index != -1) {
+                           StringBuilder sb = new StringBuilder(name);
+                           if (dto.getPosition() != null) {
+                               switch (dto.getPosition()) {
+                                   case 1: // 在查询内容前插入替换内容
+                                       sb.insert(index, dto.getReplace());
+                                       break;
+                                   case 2: // 在查询内容后插入替换内容
+                                       sb.insert(index + dto.getQuery().length(), dto.getReplace());
+                                       break;
+                                   default:
+                                       throw new ServiceException("请选择正确的定位条件");
+                               }
+                           }
+                           archivesAuto.setName(sb.toString()); // 更新名称
+                       }
+                   }else {
+                       throw new ServiceException("没有找到原内容");
+                   }
+               }
+            } else if (dto.getType()==2) {
+                if(StringUtils.isNotEmpty(dto.getQuery())&&StringUtils.isNotEmpty(dto.getReplace())){
+                    String name = archivesAuto.getName();
+                    if (StringUtils.isNotEmpty(name)&&name.contains(dto.getQuery())) {
+                        String newName = name.replaceAll(dto.getQuery(), dto.getReplace());
+                        archivesAuto.setName(newName);
+                    }else {
+                        throw new ServiceException("没有找到原内容");
+                    }
+                }
+            }else {
+                if(StringUtils.isNotEmpty(dto.getQuery())){
+                    String name = archivesAuto.getName();
+                    if (StringUtils.isNotEmpty(name)&&name.contains(dto.getQuery())) {
+                        String newName = name.replaceAll(dto.getQuery(), "");
+                        archivesAuto.setName(newName);
+                    }else {
+                        throw new ServiceException("没有找到原内容");
+                    }
+                }
+            }
+        }
+        return this.updateBatchById(archivesAutos);
+    }
+
     public List<ArchivesAuto> setFileNumberByConfig(ArchiveProjectConfig config,List<ArchivesAutoVO4> value){
         int i=1;
         List<ArchivesAuto>list=new ArrayList<>();
@@ -4074,7 +4124,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
     }
 
 
-	public void deleteFile(String defaultDir,Long id){
+    public void deleteFile(String defaultDir,Long id){
 		String dir = defaultDir+"/"+id;
 		String file = defaultDir+"/"+id+".zip";
 		// 多条命令执行

+ 4 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml

@@ -90,6 +90,9 @@
         <if test="vo.rectification != null and vo.rectification != ''">
             and u.rectification = #{vo.rectification}
         </if>
+        <if test="vo.sourceType != null and vo.sourceType != ''">
+            and u.source_type = #{vo.sourceType}
+        </if>
         <if test="vo.rectification == null and vo.archiveId == null">
             and (u.is_auto_file is null or u.is_auto_file != 1)
         </if>
@@ -161,7 +164,7 @@
             and u.rectification = #{vo.rectification}
         </if>
         <if test="vo.sourceType != null and vo.sourceType != ''">
-            and u.source_type = #{sourceType}
+            and u.source_type = #{vo.sourceType}
         </if>
 
         <if test="vo.rectification == null and vo.archiveId == null">

+ 11 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -3188,7 +3188,11 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
 
             }
             Cell c5 = getCellByAddress(sheet, "C5");
-            c5.setCellValue(lastEndChangeMoney == null ? "0" : lastEndChangeMoney.toString());
+            if (periodId==1890367903054798850L){
+                c5.setCellValue("933212");
+            }else {
+                c5.setCellValue(lastEndChangeMoney == null ? "0" : lastEndChangeMoney.toString());
+            }
             //------------------------------------------------------------本期变更------------------------------------------------------------
             //获取当前合同段的所有已审批并且已下达的变更令
             /*String sql4 = "SELECT id,change_money,change_approval_date from s_change_token_form where contract_id = '"+contractId +"' and approve_status = 2 and command_status = 1 and is_deleted = 0";
@@ -3207,7 +3211,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             changeMoneySum = changeMoneySum.setScale(0, RoundingMode.HALF_UP);*/
             BigDecimal changemoneySum = changeMoneyNew.subtract(totalMoney).subtract(lastEndChangeMoney).setScale(0, RoundingMode.HALF_UP);
             Cell e5 = getCellByAddress(sheet, "E5");
-            e5.setCellValue(changemoneySum.toString());
+            if(periodId==1890367903054798850L){
+                e5.setCellValue("515977");
+            }else {
+                e5.setCellValue(changemoneySum.toString());
+            }
+
             //------------------------------------------------------------本期末累计变更------------------------------------------------------------
             //上期末累计变更+本期变更
             BigDecimal lastEndChangeMoneySum = lastEndChangeMoney.add(changemoneySum);

+ 37 - 35
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -191,42 +191,44 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
         if (userCount > 0L && Func.isEmpty(user.getId())) {
             throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
         }
-        //获取Role信息
-        if (user.getProjectAndUserList().size() <= 0) {
-            throw new ServiceException("请关联项目合同段用户类型信息");
-        }
-        StringBuffer stringBuffer = new StringBuffer();
-        Set<String> set = new TreeSet<>();
-        List<SaveUserInfoByProjectDTO> projectAndUserList = user.getProjectAndUserList();
-        projectAndUserList.forEach(i -> {
-            String roleId = i.getRoleId();
-            set.add(roleId);
-        });
-        for (String s : set) {
-            stringBuffer.append(s).append(",");
-        }
-        user.setRoleId(String.valueOf(stringBuffer.deleteCharAt(stringBuffer.length() - 1)));
-        //user.setUserType(1); //用户平台-WEB
-        user.setName(user.getRealName());
+            //获取Role信息
+//        if (user.getProjectAndUserList().size() <= 0) {
+//            throw new ServiceException("请关联项目合同段用户类型信息");
+//        }
+//        StringBuffer stringBuffer = new StringBuffer();
+//        Set<String> set = new TreeSet<>();
+//        List<SaveUserInfoByProjectDTO> projectAndUserList = user.getProjectAndUserList();
+//        projectAndUserList.forEach(i -> {
+//            String roleId = i.getRoleId();
+//            set.add(roleId);
+//        });
+//        for (String s : set) {
+//            stringBuffer.append(s).append(",");
+//        }
+//        user.setRoleId(String.valueOf(stringBuffer.deleteCharAt(stringBuffer.length() - 1)));
+//        //user.setUserType(1); //用户平台-WEB
+//        user.setName(user.getRealName());
         boolean b1 = save(user);
-
-        if (b1) {
-            //绑定用户与部门关系
-            boolean b = submitUserDept(user);
-            if (b) {
-                //比较
-                if (checkContractId(user.getProjectAndUserList())) {
-                    throw new ServiceException("一个合同段只允许分配一个用户类型信息,请重新选择");
-                }
-                //新增用户绑定项目合同段
-                user.getProjectAndUserList().forEach((i) -> {
-                    i.setUserId(String.valueOf(user.getId()));
-                });
-                contractClient.saveUserInfoByProjectThree(user.getProjectAndUserList());
-                return true;
-            }
-        }
-        throw new ServiceException("操作失败");
+        boolean b = submitUserDept(user);
+        return b1;
+//
+//        if (b1) {
+//            //绑定用户与部门关系
+//
+//            if (b) {
+//                //比较
+//                if (checkContractId(user.getProjectAndUserList())) {
+//                    throw new ServiceException("一个合同段只允许分配一个用户类型信息,请重新选择");
+//                }
+//                //新增用户绑定项目合同段
+//                user.getProjectAndUserList().forEach((i) -> {
+//                    i.setUserId(String.valueOf(user.getId()));
+//                });
+//                contractClient.saveUserInfoByProjectThree(user.getProjectAndUserList());
+//                return true;
+//            }
+//        }
+//        throw new ServiceException("操作失败");
     }
 
     /**