Переглянути джерело

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

lvy 1 день тому
батько
коміт
af92e2c874

+ 2 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/VolumeDto4.java

@@ -13,4 +13,6 @@ public class VolumeDto4 {
     private Integer filePage;
     //是否已被分卷 0否 1是
     private Integer isCheck=0;
+
+    private Long archiveId;
 }

+ 20 - 4
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -5697,7 +5697,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 	public Boolean updateArchivePage(List<Long> archiveIds) {
 		for (Long archiveId : archiveIds) {
 			ArchivesAuto archivesAuto = this.getById(archiveId);
-			List<ArchiveFile> files = archiveFileClient.getArchiveFileByArchivesId(archiveId+"", null);
+			List<ArchiveFile> files = archiveFileClient.getArchiveFileByArchivesId(archiveId+"", "");
 			archivesAuto.setFileN(files.size());
 			archivesAuto.setPageN(files.stream().mapToInt(ArchiveFile::getFilePage).sum());
 			archivesAuto.setColourStatus(2);
@@ -5714,7 +5714,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		updateIds.add(archivesAuto.getId());
 		if(!dto.getList().isEmpty()){
 			archivesAuto.setIsVolume(1);
-			archivesAuto.setVolumeIds(null);
+			archivesAuto.setVolumeIds("");
 			for (SaveVolumeDto1 saveVolumeDto1 : dto.getList()) {
 				Long archiveId;
 				if(saveVolumeDto1.getId()==null){
@@ -5729,9 +5729,25 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 					archiveId=saveVolumeDto1.getId();
 				}
 				updateIds.add(archiveId);
-				String update = "UPDATE u_archive_file SET archive_id = ?, old_archive_id = ?, is_volume = 1 WHERE id IN (?)";
-				jdbcTemplate.update(update, archiveId, dto.getArchiveId(), saveVolumeDto1.getFileIds());
+				String update = "UPDATE u_archive_file SET archive_id = ?, old_archive_id = ?, is_volume = 1 WHERE id IN (" + saveVolumeDto1.getFileIds() + ")";
+				jdbcTemplate.update(update, archiveId, dto.getArchiveId());
 				archivesAuto.setVolumeIds(archivesAuto.getVolumeIds()+archiveId+",");
+				List<ArchiveFile> files1 = archiveFileClient.getArchiveFileByArchivesId(archiveId + "", "");
+				if(!files1.isEmpty()){
+					List<Integer> sorts = files1.stream()
+							.map(file -> Optional.ofNullable(file.getSort()).orElse(0))
+							.sorted()
+							.collect(Collectors.toList());
+					String[] fileIds = saveVolumeDto1.getFileIds().split(",");
+					if(sorts.size()==fileIds.length){
+						if(fileIds.length>0){
+							for (int i = 0; i < fileIds.length; i++) {
+								String updateSql = "UPDATE u_archive_file SET sort = ? WHERE id = ?";
+								jdbcTemplate.update(updateSql, sorts.get(i), fileIds[i]);
+							}
+						}
+					}
+				}
 			}
 			archivesAuto.setVolumeIds(archivesAuto.getVolumeIds().substring(0,archivesAuto.getVolumeIds().length()-1));
 		}

+ 14 - 18
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ArchiveFileServiceImpl.java

@@ -438,7 +438,7 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
     public List<VolumeDto1> selectVolumeAfter(Long archiveId) {
         List<VolumeDto1> list = new ArrayList<>();
         ArchivesAuto archivesAuto = archiveAutoClient.getArchiveById(archiveId);
-        if(archivesAuto.getIsVolume()==1&&StringUtils.isEmpty(archivesAuto.getVolumeIds())){
+        if(archivesAuto.getIsVolume()==1&&StringUtils.isNotEmpty(archivesAuto.getVolumeIds())){
             String volumeIds = archivesAuto.getVolumeIds();
             String[] archivesAutoIds = volumeIds.split(",");
             for (String autoId : archivesAutoIds) {
@@ -468,30 +468,26 @@ public class ArchiveFileServiceImpl extends BaseServiceImpl<ArchiveFileMapper, A
     public VolumeDto3 selectVolumeBefore(Long archiveId,Integer type) {
         ArchivesAuto auto = archiveAutoClient.getArchiveById(archiveId);
         VolumeDto3 dto=new VolumeDto3();
-        if(auto.getIsVolume()==1&&StringUtils.isEmpty(auto.getVolumeIds())){
-            String volumeIds = auto.getVolumeIds();
-            String[] archivesAutoIds = volumeIds.split(",");
+        //查询原案卷
+        if(type==1){
             String sql="select id,file_number,file_name,file_time,duty_user,file_page from u_archive_file where archive_id="+auto.getId()+" and is_deleted=0 order by archive_sort,sort,sort_num,create_time";
             List<VolumeDto4> dto2s = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(VolumeDto4.class));
-            dto.getList().addAll(dto2s);
-            if(type==2){
-                for (String autoId : archivesAutoIds) {
-                    String sql1="select id,file_number,file_name,file_time,duty_user,file_page from u_archive_file where archive_id="+autoId+" and is_deleted=0 order by archive_sort,sort,sort_num,create_time";
-                    List<VolumeDto4> dto2s1 = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(VolumeDto4.class));
-                    dto2s1.stream().forEach(dto2 -> dto2.setIsCheck(1));
-                    dto.getList().addAll(dto2s);
-                }
-            }
             dto.setId(auto.getId());
             dto.setName(auto.getName());
             dto.setTotal(auto.getPageN());
+            dto.setList(dto2s);
         }else {
-            dto.setId(auto.getId());
-            dto.setName(auto.getName());
-            String sql="select id,file_number,file_name,file_time,duty_user,file_page from u_archive_file where archive_id="+auto.getId()+" and is_deleted=0 order by archive_sort,sort,sort_num,create_time";
+            String archiveIds=auto.getId().toString();
+            //查询所有案卷
+            if(StringUtils.isNotEmpty(auto.getVolumeIds())){
+                archiveIds=archiveIds+","+auto.getVolumeIds();
+            }
+            String sql="select id,file_number,file_name,file_time,duty_user,file_page,archive_id from u_archive_file where archive_id in ("+archiveIds+") and is_deleted=0 order by archive_sort,sort,sort_num,create_time";
             List<VolumeDto4> dto2s = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(VolumeDto4.class));
-            dto.setList(dto2s);
-            dto.setTotal(auto.getPageN());
+            if(StringUtils.isNotEmpty(auto.getVolumeIds())){
+                dto2s.stream().filter(item ->auto.getVolumeIds().contains(item.getArchiveId().toString())).forEach(item ->item.setIsCheck(1));
+            }
+           dto.setList(dto2s);
         }
         return dto;
     }

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

@@ -3212,7 +3212,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                 String sqlList1 = "Select parent_id,node_name,p_id from m_wbs_tree_contract where contract_id=" + wbsTreeContractRoot.getContractId() + " and wbs_id=" + wbsTreeContractRoot.getWbsId() + " and is_deleted=0";
                 List<WbsTreeContract> WbsTreeContractList = jdbcTemplate.query(sqlList1, new BeanPropertyRowMapper<>(WbsTreeContract.class));
                 for (ImportTreeDto dto : list) {
-                    if(i!=size){
+                    if(size-i>=1){
                         String progressStr = String.format("%.2f", ((double) i/ size)*100);
                         bladeRedis.set("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId(), progressStr);
                     }
@@ -3539,9 +3539,6 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 //        catch (InterruptedException e) {
 //            throw new RuntimeException(e);
 //        }
-        finally {
-            bladeRedis.del("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId());
-        }
     }
 
     @Override