Browse Source

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

yangyj 11 months ago
parent
commit
ca1a680365

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

@@ -404,14 +404,13 @@ public class EVisaTaskCheckController {
                         //设置提示信息
                         String name="";
                         List<Map<String, Object>> userInfo = jdbcTemplate.queryForList("select name from blade_user WHERE id =" + userRole.getString("userId"));
-                        if(userInfo!=null && userInfo.size()>1){
+                        if(userInfo!=null && userInfo.size()>=1){
                             name = userInfo.get(0).get("name")+"";
                             next.setTips(name + "没有电签权限,请检查电签配置或查看表单是否隐藏");
                         }else{
                             name = userRole.getString("userId");
                             next.setTips(name + "该用户不存在");
                         }
-
                         break;
                     }
                 }

+ 4 - 2
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/EVisaController.java

@@ -174,10 +174,12 @@ public class EVisaController {
             RedisTemplate.delete("sign-" + taskApprovalVO.getFormDataId());
         }else{ //废除
             // 修改 主 任务 u_task 表 状态改为3
-            String up_task_par = "update u_task_parallel set status=3 where parallel_process_instance_id="+taskApprovalVO.getParallelProcessInstanceId();
-            String up_task = "update u_task set status=3 where id="+taskApprovalVO.getTaskId();
+            String up_task_par = "update u_task_parallel set status=3 where parallel_process_instance_id='"+taskApprovalVO.getParallelProcessInstanceId()+"'";
+            String up_task = "update u_task set status=3 where id='"+taskApprovalVO.getTaskId()+"'";
+            this.jdbcTemplate.execute("delete from u_task_batch where id="+taskApprovalVO.getId());
             jdbcTemplate.execute(up_task_par);
             jdbcTemplate.execute(up_task);
+            RedisTemplate.delete("sign-" + taskApprovalVO.getFormDataId());
         }
     }
 

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

@@ -60,6 +60,7 @@ import org.springblade.evisa.utils.FileUtils;
 import org.springblade.evisa.utils.PDFUtils;
 import org.springblade.evisa.vo.*;
 import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
 import org.springblade.manager.entity.SignPfxFile;
 import org.springblade.manager.feign.ContractClient;
 import org.springblade.manager.feign.SignPfxClient;
@@ -239,6 +240,8 @@ public class EVisaServiceImpl implements EVisaService {
         if (CommonUtil.checkIsBigDecimal(sysBatch)) {
             batch = new Integer(sysBatch);
         }
+        String sql = "SELECT DISTINCT a.remark_type from m_project_info a,u_task b where a.id=b.project_id  and form_data_id='"+task.getFormDataId()+"'";
+        String reType = jdbcTemplate.queryForObject(sql, String.class);
 
         if (DistributedRedisLock.acquire(AuthUtil.getUserId().toString(), batch)) {
             try {
@@ -250,135 +253,89 @@ public class EVisaServiceImpl implements EVisaService {
                 String contractId = this.taskClient.queryTaskContractId(task.getParallelProcessInstanceId());
 
                 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 + ")";
+                String sqlinfo = "SELECT a.id,a.pyzbx,a.pyzby,b.signature_file_url,b.id as sfId,b.certificate_password,b.certificate_user_name,b.certificate_number 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);
                 if (maps == null || maps.isEmpty()) {
                     return finalPdfUrl;
                 }
-                //准备签章策略
-                List<SealStrategyVO> sealStrategyVOS = new ArrayList<>();
-                for (Map<String, Object> eVisaConfig : maps) {
-                    //设置签章策略
-                    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.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") + "");
-                    sealStrategyVOS.add(vo);
-                }
+                //
+                if(reType.equals("2")){
+                    if (maps != null && !maps.isEmpty()) {
+                        String fileUrl = finalPdfUrl;
+                        for (Map<String, Object> dataMap : maps) {
+                            HashMap<String, Object> daMa = new HashMap<>();
+                            daMa.put("keyWord", dataMap.get("id"));
+                            daMa.put("sealId", dataMap.get("certificate_number"));
+
+                            byte[] fileByte;
+                            if (fileUrl.indexOf("aliyuncs.com") >= 0) {
 
-                SealPdfVO pdfVO = new SealPdfVO();
-                pdfVO.setStrategyVoList(sealStrategyVOS);
-
-                //获取字节
-                byte[] fileByte = CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(finalPdfUrl));
-                //执行电签
-                Object[] result = this.signPdfByAXQZ(pdfVO, fileByte);
-                if (result != null) {
-                    if (result[0] != null) {
-                        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) {
-                            finalPdfUrl = bladeFile.getLink();
+                                URL url =new URL(finalPdfUrl);
+                                fileByte = IOUtils.toByteArray(url);
+                            } else {
+                                FileReader fileReader = new FileReader(fileUrl);
+                                fileByte = fileReader.readBytes();
+                            }
+                            String originalFileB64 = Base64.toBase64String(fileByte);
+                            daMa.put("fileB64", originalFileB64);
+                            daMa.put("lastSignFlag", false);
+                            String reData = signPdfByDFZX(daMa);
+                            if (reData.indexOf("success@") >= 0) {
+                                fileUrl = reData.split("@@@@")[1];
+                            }
                         }
+                        if (fileUrl.indexOf("aliyuncs.com") >= 0) {
+                            return E_VISA_ERROR;
+                        } else {
+                            BladeFile bladeFile = this.newIOSSClient.uploadFile(fileUrl.substring(fileUrl.lastIndexOf("/") + 1, fileUrl.length()), fileUrl);
+                            if (bladeFile != null) {
+                                System.out.println("pdf上传=" + bladeFile.getLink());
+                                return bladeFile.getLink();
+                            } else {
+                                return E_VISA_ERROR;
+                            }
+                        }
+                    } else {
+                        System.out.println("------3------");
+                        RedisTemplate.delete("sign-" + task.getFormDataId());
+                        return finalPdfUrl;
                     }
-                }
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-        //释放锁
-        DistributedRedisLock.release(AuthUtil.getUserId().toString());
-
-        return finalPdfUrl;
-    }
-
-
-    /**
-     * 合同章 签字
-     *
-     * @param task
-     * @param finalPdfUrl
-     * @return
-     */
-
-    public String eVisaContractSeal222(EVisaTaskApprovalVO task, String finalPdfUrl) {
-        //获取任务对应表格的电签配置(合同张)
-        List<JSONObject> eVisaConfigList = this.taskClient.queryBusinessTableEVisaConfig(task.getParallelProcessInstanceId(), task.getUserId(), "true");
-        if (eVisaConfigList == null || eVisaConfigList.size() == 0) {
-            //没有电签配置,默认当前任务为不签字审批,返回成功
-            return finalPdfUrl;
-        }
-
-        String sysBatch = ParamCache.getValue(CommonConstant.SYS_USER_TASK_BATCH);
-        int batch = 2;
-        if (CommonUtil.checkIsBigDecimal(sysBatch)) {
-            batch = new Integer(sysBatch);
-        }
-
-        //确定合同段并获取合同章
-        List<SignPfxFile> userPfxList = this.signPfxClient.querySignPfxByUserIdOrContractId("", this.taskClient.queryTaskContractId(task.getParallelProcessInstanceId()));
-        if (userPfxList == null || userPfxList.size() <= 0) {
-            //没有签章,不执行电签
-            return finalPdfUrl;
-        }
+                }else {
 
-        //上锁
-        System.out.println(AuthUtil.getUserId().toString());
-        if (DistributedRedisLock.acquire(AuthUtil.getUserId().toString(), batch)) {
-            try {
-                //准备签章策略
-                List<SealStrategyVO> sealStrategyVOS = new ArrayList<>();
-                for (JSONObject eVisaConfig : eVisaConfigList) {
-                    //找到类型与之对应的合同章
-                    Iterator<SignPfxFile> iterator = userPfxList.iterator();
-                    while (iterator.hasNext()) {
-                        SignPfxFile next = iterator.next();
-                        if (eVisaConfig.getString("type").equals(next.getPfxType())) {
-                            //设置签章策略
-                            SealStrategyVO vo = new SealStrategyVO();
-                            vo.setSealCode(EVisaConstant.SIGN_SEAL_CODE + next.getId());
-                            vo.setSealPassword(next.getCertificatePassword());
-                            vo.setSealPerson(next.getCertificateUserName() + System.currentTimeMillis());
-                            //设置签字文件
-                            vo.setImageUrl(next.getSignatureFileUrl());
-                            vo.setSealType("3");
-
-                            vo.setCompanySeal(true);
-
-                            vo.setKeyword(eVisaConfig.getString("KEY"));
-                            vo.setOffSetX(eVisaConfig.getString("X"));
-                            vo.setOffSetY(eVisaConfig.getString("Y"));
-
-                            sealStrategyVOS.add(vo);
-                            iterator.remove();
-                            break;
-                        }
+                    //准备签章策略
+                    List<SealStrategyVO> sealStrategyVOS = new ArrayList<>();
+                    for (Map<String, Object> eVisaConfig : maps) {
+                        //设置签章策略
+                        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.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") + "");
+                        sealStrategyVOS.add(vo);
                     }
-                }
 
-                SealPdfVO pdfVO = new SealPdfVO();
-                pdfVO.setStrategyVoList(sealStrategyVOS);
-
-                //获取字节
-                byte[] fileByte = CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(finalPdfUrl));
-                //执行电签
-                Object[] result = this.signPdfByAXQZ(pdfVO, fileByte);
-                if (result != null) {
-                    if (result[0] != null) {
-                        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) {
-                            finalPdfUrl = bladeFile.getLink();
+                    SealPdfVO pdfVO = new SealPdfVO();
+                    pdfVO.setStrategyVoList(sealStrategyVOS);
+
+                    //获取字节
+                    byte[] fileByte = CommonUtil.InputStreamToBytes(CommonUtil.getOSSInputStream(finalPdfUrl));
+                    //执行电签
+                    Object[] result = this.signPdfByAXQZ(pdfVO, fileByte);
+                    if (result != null) {
+                        if (result[0] != null) {
+                            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) {
+                                finalPdfUrl = bladeFile.getLink();
+                            }
                         }
                     }
                 }
@@ -393,6 +350,7 @@ public class EVisaServiceImpl implements EVisaService {
     }
 
 
+
     /**
      * 个人-电签信息
      *
@@ -419,10 +377,10 @@ public class EVisaServiceImpl implements EVisaService {
            // 计量任务类型  5 = 中间计量申请,6 = 材料计量单,7 = 开工预付款计量单,8 = 变更令
             Map<String, Object> map =new HashMap<>();
             if(task.getApprovalType()==6 || task.getApprovalType()==7){
-                map = this.jdbcTemplate.queryForMap("select * from  s_material_start_statement where meter_period_id = " + task.getFormDataId());
+                map = this.jdbcTemplate.queryForMap("select * from  s_material_start_statement where is_deleted=0 and meter_period_id = " + task.getFormDataId());
                 taskFile.setApprovalFileList(map.get("period_number")+"", map.get("raw_url")+"");
             }else if (task.getApprovalType()==5) {
-                map = this.jdbcTemplate.queryForMap("select * from s_interim_pay_certificate where contract_period_id = " + task.getFormDataId());
+                map = this.jdbcTemplate.queryForMap("select * from s_interim_pay_certificate where  is_deleted=0 and contract_period_id = " + task.getFormDataId());
                 taskFile.setApprovalFileList(map.get("period_number")+"", map.get("raw_url")+"");
             }
             taskFile.setRemarkType("1");
@@ -722,20 +680,15 @@ public class EVisaServiceImpl implements EVisaService {
     }
 
   /*  public static void main(String[] args) throws Exception {
-        String pdfPath ="/Users/hongchuangyanfa/Downloads/d2cf9f4ee9bef0cad6c1105e86b3ab09.pdf";
-        String sealId ="0ff724e095fc4a16b9c9c25ebe44e68f";
+        String pdfPath ="/Users/hongchuangyanfa/Documents/fcf5efab3af8d1e7f26cec1d5fbdb634.pdf";
+        String sealId ="289b84c769694deba4c42599032699a4";
         String formDataId ="vv";
         List<Map<String,Object>> maps = new ArrayList<>();
         Map<String,Object> daMap = new HashMap<>();
-        daMap.put("keyWord","1715216098053324800");
+        daMap.put("keyWord","1630012525913309193");
         daMap.put("sealId",sealId);
         maps.add(daMap);
 
-        Map<String,Object> daMap2 = new HashMap<>();
-        daMap2.put("keyWord","1673632651463884");
-        daMap2.put("sealId",sealId);
-        maps.add(daMap2);
-
         String fileUrl =pdfPath;
         for(int i=0;i<maps.size();i++){
             HashMap daMa  = (HashMap) maps.get(i);
@@ -764,7 +717,8 @@ public class EVisaServiceImpl implements EVisaService {
      * @throws Exception
      */
     public static String signPdfByDFZX(HashMap<String, Object> request) {
-        String url = "http://47.110.251.215:9125/FrontSysGs/SealServicezx/FileSignByKeyWord";
+        String url = "http://39.108.216.210:9125/FrontSysGs/SealServicezx/FileSignByKeyWord";
+       // String url = "http://172.30.224.81:9125/FrontSysGs/SealServicezx/FileSignByKeyWord";
         String sysLocalFileUrl = FileUtils.getSysLocalFileUrl();
         String filecode = SnowFlakeUtil.getId() + "";
         String dataFileUrl = sysLocalFileUrl + "/pdf/" + filecode + ".pdf";

+ 7 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TextdictInfoController.java

@@ -162,10 +162,14 @@ public class TextdictInfoController extends BladeController {
     @PostMapping("/remove")
     @ApiOperationSupport(order = 7)
     @ApiOperation(value = "逻辑删除", notes = "传入ids")
-    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) throws FileNotFoundException {
+    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids,@ApiParam(value = "wbs p_key_id", required = true) @RequestParam String tabId) throws FileNotFoundException {
         //获取节点信息
-        TextdictInfo textdictInfo = textdictInfoService.getById(ids);
-        WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(Long.parseLong(textdictInfo.getTabId()));
+
+        WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(Long.parseLong(tabId));
+        TextdictInfo textdi = new TextdictInfo();
+        textdi.setId(Func.toLong(ids));
+        textdi.setProjectId(wbsTreePrivate.getProjectId());
+        TextdictInfoVO textdictInfo = textdictInfoService.selectTextdictInfoById(textdi);
 
         //获取当前项目下引用相同模板的元素表信息
         List<WbsTreePrivate> wbsTreePrivatesEqual = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()

+ 3 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMeterPeriodController.java

@@ -111,6 +111,9 @@ public class ContractMeterPeriodController extends BladeController {
 				if (interimPayCertificate != null) {
 					interimPayCertificate.setPeriodNumber(period.getPeriodNumber());
 					interimPayCertificate.setPrintDate(period.getFormPrintDate());
+					interimPayCertificate.setStartDate(period.getStartDate());
+					interimPayCertificate.setEndDate(period.getEndDate());
+					interimPayCertificate.setCertificateNumber(interimPayCertificate.getPeriodNumber());
 					interimPayCertificateService.saveOrUpdate(interimPayCertificate);
 				}
 			}