ソースを参照

Merge remote-tracking branch 'origin/master' into master

yangyj 1 年間 前
コミット
e09a662ce7

+ 3 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileTaskController.java

@@ -69,6 +69,9 @@ public class ArchiveFileTaskController extends BladeController {
                 //固定水印图片章
                 String pngQzUrl = "https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20230911/5b42583d931664b785ebf481c37d17bc.png";
                 for (ArchiveFile archiveFile : archiveFileList) {
+                    if (!archiveFile.getStatus().equals(0) && !archiveFile.getIsCertification().equals(0)) {
+                        throw new ServiceException("只有未认证且是未上报状态的业务数据才能认证!");
+                    }
                     String pdfUrl = StringUtils.isNotEmpty(archiveFile.getEVisaFile()) ? archiveFile.getEVisaFile() : archiveFile.getPdfFileUrl();
                     if (StringUtils.isEmpty(pdfUrl)) {
                         continue;

+ 7 - 4
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveProjectConfigServiceImpl.java

@@ -9,6 +9,8 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class ArchiveProjectConfigServiceImpl extends BaseServiceImpl<ArchiveProjectConfigMapper, ArchiveProjectConfig> implements IArchiveProjectConfigService {
 
@@ -20,17 +22,18 @@ public class ArchiveProjectConfigServiceImpl extends BaseServiceImpl<ArchiveProj
      */
     @Override
     public ArchiveProjectConfig getByProjectIdOrNew(Long projectId) {
-        ArchiveProjectConfig config = baseMapper.selectOne(new LambdaQueryWrapper<ArchiveProjectConfig>().eq(ArchiveProjectConfig::getTenantId, SecureUtil.getTenantId()).eq(ArchiveProjectConfig::getProjectId, projectId));
-        if (config == null) {
+        List<ArchiveProjectConfig> configs = baseMapper.selectList(new LambdaQueryWrapper<ArchiveProjectConfig>().eq(ArchiveProjectConfig::getTenantId, SecureUtil.getTenantId()).eq(ArchiveProjectConfig::getProjectId, projectId));
+        if (configs == null || configs.size() == 0) {
             // 创建新对象
-            config = new ArchiveProjectConfig();
+            ArchiveProjectConfig config = new ArchiveProjectConfig();
             config.setTenantId(AuthUtil.getTenantId());
             config.setProjectId(projectId);
             config.setFactorType("1,2,3,4,5"); // 设置默认值
             config.setProjectType(3);
             this.save(config); // 保存到数据库
+            return config;
         }
-        return config;
+        return configs.get(0);
     }
 }
 

+ 7 - 4
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -474,9 +474,12 @@ public class TaskController extends BladeController {
         if (repealDTO.getType().equals(1)) { //文件收集废除
             String[] archiveIds = repealDTO.getIds().split(",");
             for (String archiveId : archiveIds) {
-                //判断现在的数据是否是待审批数据,只有待审批数据才能撤销
+                //判断现在的数据是否是待审批数据,只有上报状态、未认证状态的数据才能撤销
                 ArchiveFile archiveFile = jdbcTemplate.queryForObject("select * from u_archive_file where id = " + archiveId, new BeanPropertyRowMapper<>(ArchiveFile.class));
-                if (archiveFile != null && archiveFile.getStatus().equals(1)) {
+                if (archiveFile != null && !archiveFile.getIsCertification().equals(0) && (!archiveFile.getStatus().equals(1) || !archiveFile.getStatus().equals(2))) {
+                    throw new ServiceException("当前数据不是未认证,并且处于上报状态,无法进行废除操作!");
+                }
+                if (archiveFile != null) {
                     //修改档案文件收集业务数据状态=已废除
                     jdbcTemplate.execute("update u_archive_file set status = 3 where id = " + archiveId);
                     Task task = jdbcTemplate.queryForObject("select id,status,process_instance_id from u_task where form_data_id = " + archiveId, new BeanPropertyRowMapper<>(Task.class));
@@ -484,7 +487,7 @@ public class TaskController extends BladeController {
                         //待审批审批任务=已废除
                         jdbcTemplate.execute("update u_task set status = 3 where id = " + task.getId());
                         //审批任务详情=已废除
-                        jdbcTemplate.execute("update u_task_parallel set status = 3 where process_instance_id = " + task.getProcessInstanceId());
+                        jdbcTemplate.execute("update u_task_parallel set status = 3 where process_instance_id = '" + task.getProcessInstanceId() + "'");
                     }
                 }
             }
@@ -514,7 +517,7 @@ public class TaskController extends BladeController {
                     //待审批审批任务=已废除
                     jdbcTemplate.execute("update u_task set status = 3 where id = " + task.getId());
                     //审批任务详情=已废除
-                    jdbcTemplate.execute("update u_task_parallel set status = 3 where process_instance_id = " + task.getProcessInstanceId());
+                    jdbcTemplate.execute("update u_task_parallel set status = 3 where process_instance_id = '" + task.getProcessInstanceId() + "'");
                     //修改档案文件收集业务数据状态
                     jdbcTemplate.execute("update u_archive_file set status = 3 where id = " + task.getFormDataId());
                 }

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

@@ -238,7 +238,7 @@ public class EVisaServiceImpl implements EVisaService {
                 String ids = String.join(",", eVisaConfigList);
                 String sqlinfo = "SELECT a.id,a.pyzbx,a.pyzby,b.signature_file_url,b.id as sfId,b.certificate_password,b.certificate_user_name from m_textdict_info a ,m_sign_pfx_file b where a.sig_role_id = b.pfx_type and b.project_contract_role like '%" + contractId + "%' and a.is_deleted=0 and b.is_deleted=0 and a.type=6 and a.id in(" + ids + ")";
                 List<Map<String, Object>> maps = jdbcTemplate.queryForList(sqlinfo);
-                System.out.println("合同-"+contractId+"--"+sqlinfo);
+                System.out.println("合同-" + contractId + "--" + sqlinfo);
 
                 //准备签章策略
                 List<SealStrategyVO> sealStrategyVOS = new ArrayList<>();
@@ -246,15 +246,15 @@ public class EVisaServiceImpl implements EVisaService {
                     //设置签章策略
                     SealStrategyVO vo = new SealStrategyVO();
                     vo.setSealCode(EVisaConstant.SIGN_SEAL_CODE + eVisaConfig.get("sfId"));
-                    vo.setSealPassword(eVisaConfig.get("certificate_password")+"");
-                    vo.setSealPerson(eVisaConfig.get("certificate_user_name")+"" + System.currentTimeMillis());
+                    vo.setSealPassword(eVisaConfig.get("certificate_password") + "");
+                    vo.setSealPerson(eVisaConfig.get("certificate_user_name") + "" + System.currentTimeMillis());
                     //设置签字文件
-                    vo.setImageUrl(eVisaConfig.get("signature_file_url")+"");
+                    vo.setImageUrl(eVisaConfig.get("signature_file_url") + "");
                     vo.setSealType("3");
                     vo.setCompanySeal(true);
-                    vo.setKeyword(eVisaConfig.get("id")+"");
-                    vo.setOffSetX(eVisaConfig.get("pyzbx")+"");
-                    vo.setOffSetY(eVisaConfig.get("pyzby")+"");
+                    vo.setKeyword(eVisaConfig.get("id") + "");
+                    vo.setOffSetX(eVisaConfig.get("pyzbx") + "");
+                    vo.setOffSetY(eVisaConfig.get("pyzby") + "");
                     sealStrategyVOS.add(vo);
                 }
 
@@ -425,7 +425,7 @@ public class EVisaServiceImpl implements EVisaService {
                 String ids = String.join(",", eVisaConfigList);
                 String sqlinfo = " SELECT a.id,a.pyzbx ,a.pyzby,(SELECT signature_file_url from m_sign_pfx_file where is_register=1 and certificate_user_id='" + task.getUserId() + "' and is_deleted=0  ) as signature_file_url from m_textdict_info a where  a.type =2 and a.id in (" + ids + ")  and sig_role_id in (SELECT DISTINCT c.role_id from m_project_assignment_user c  where c.contract_id=" + contractId + " and user_id=" + task.getUserId() + " and c.is_deleted=0 )";
                 List<Map<String, Object>> maps = jdbcTemplate.queryForList(sqlinfo);
-                System.out.println("个人-user-id"+task.getUserId()+"--SQL="+sqlinfo);
+                System.out.println("个人-user-id" + task.getUserId() + "--SQL=" + sqlinfo);
                 if (maps == null || maps.size() <= 0) {
                     //没有签章,不执行电签
                     RedisTemplate.delete("sign-" + task.getFormDataId());
@@ -539,13 +539,13 @@ public class EVisaServiceImpl implements EVisaService {
                         //返回结果集
                         if (result != null) {
                             if (result[0] != null) {
-                                byte[] byteArray = IOUtils.toByteArray(new ByteArrayInputStream((byte[]) result[0]));
-
+                                //byte[] byteArray = IOUtils.toByteArray(new ByteArrayInputStream((byte[]) result[0]));
                                 /*String dataUrl = "C:\\pdfFiles\\" + SnowFlakeUtil.getId() + ".pdf";
                                 File file1 = new File(dataUrl);
                                 FileUtils.writeByteArrayToFile(file1, byteArray);*/
 
-                                BladeFile bladeFile = this.newIOSSClient.updateFile(byteArray, SnowFlakeUtil.getId() + ".pdf");
+                                MultipartFile newFiles = new MockMultipartFile("file", SnowFlakeUtil.getId() + ".pdf", "text/plain", IOUtils.toByteArray(new ByteArrayInputStream((byte[]) result[0])));
+                                BladeFile bladeFile = this.newIOSSClient.uploadFileByInputStream(newFiles);
                                 if (bladeFile != null) {
                                     //更新最新的电签pdfUrl
                                     jdbcTemplate.execute("update u_archive_file set e_visa_file = '" + bladeFile.getLink() + "' where id = " + task.getFormDataId());
@@ -608,13 +608,13 @@ public class EVisaServiceImpl implements EVisaService {
                     //返回结果集
                     if (result != null) {
                         if (result[0] != null) {
-                            byte[] byteArray = IOUtils.toByteArray(new ByteArrayInputStream((byte[]) result[0]));
-
+                            //byte[] byteArray = IOUtils.toByteArray(new ByteArrayInputStream((byte[]) result[0]));
                             /*String dataUrl = "C:\\pdfFiles\\" + SnowFlakeUtil.getId() + ".pdf";
                             File file1 = new File(dataUrl);
                             FileUtils.writeByteArrayToFile(file1, byteArray);*/
 
-                            BladeFile bladeFile = this.newIOSSClient.updateFile(byteArray, SnowFlakeUtil.getId() + ".pdf");
+                            MultipartFile newFiles = new MockMultipartFile("file", SnowFlakeUtil.getId() + ".pdf", "text/plain", IOUtils.toByteArray(new ByteArrayInputStream((byte[]) result[0])));
+                            BladeFile bladeFile = this.newIOSSClient.uploadFileByInputStream(newFiles);
                             if (bladeFile != null) {
                                 //更新最新的认证电签pdfUrl
                                 jdbcTemplate.execute("update u_archive_file set is_certification = 1,e_visa_file = '" + bladeFile.getLink() + "',certification_time = '" + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + "' where id = " + taskArchiveDTO.getTaskId());