zhuwei 1 ヶ月 前
コミット
19d99c4c9d

+ 11 - 7
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -257,7 +257,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     //资料填报原始pdf
 //                    String approvalPdf = StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl();
                     /** 修改需求,任务查看时,附件不在列表中显示,需要拼接在电签后面。如果此处修改影响其他地方,则到时候再说*/
-                    String approvalPdf = StringUtils.isNotEmpty(query.getNodePdfUrl()) ? query.getNodePdfUrl() : query.getPdfUrl();
+                    String approvalPdf = StringUtils.isNotEmpty(query.getEVisaPdfUrl()) ? query.getEVisaPdfUrl() : query.getPdfUrl();
                     vo.setApprovalFileList(query.getName(), this.getHppsToHttp(approvalPdf));
 
                     //试验关联文件合并pdf
@@ -1130,12 +1130,12 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             System.out.println("----- 电签成功--------");
             //添加nodePdf的值
             List<Map<String, Object>> mapList = jdbcTemplate.queryForList("select *,domain_url as url from m_table_file where is_deleted = 0 and type in (10,11,12) and tab_id = (select wbs_id from u_information_query WHERE id = + "+formDataId+")");
-            if(Func.isNotEmpty(mapList)&&mapList.size()>=1){
+            if(Func.isNotEmpty(mapList)&&mapList.size()>=1) {
                 String file_path = org.springblade.business.utils.FileUtils.getSysLocalFileUrl();
                 List<String> datainfo = new ArrayList<>();
                 datainfo.add(newFileUrl);
                 for (Map<String, Object> tabsx : mapList) {
-                    datainfo.add(tabsx.get("url")+"");
+                    datainfo.add(tabsx.get("url") + "");
                 }
                 String listPdf = file_path + "/nodePDF/" + formDataId + ".pdf";
                 File tabpdf2 = ResourceUtil.getFile(listPdf);
@@ -1144,12 +1144,12 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                 }
 
                 org.springblade.business.utils.FileUtils.mergePdfPublicMethods(datainfo, listPdf);
-                if(sys_isonline.equals("20")){
+                if (sys_isonline.equals("20")) {
                     BladeFile bladeFile = this.newIOSSClient.uploadFile(formDataId + ".pdf", listPdf);
                     if (bladeFile != null && Func.isNotEmpty(bladeFile.getLink())) {
                         nodePdfUrl = bladeFile.getLink();
                     }
-                }else{
+                } else {
                     nodePdfUrl = org.springblade.business.utils.FileUtils.getNetUrl(listPdf);
                 }
 
@@ -1464,9 +1464,11 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             try {
                 for (Task task : taskList) {
                     R result = new R();
+                    jdbcTemplate.execute("DELETE from u_task_batch where json_data like '%"+task.getId()+"%'");
                     boolean b = informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
                             .eq(InformationQuery::getId, task.getFormDataId())
-                            .set(InformationQuery::getEVisaPdfUrl, null));
+                            .set(InformationQuery::getEVisaPdfUrl, null)
+                            .set(InformationQuery::getPdfUrl, null));
 
                     if (type == 1) {
                         //重新保存
@@ -1501,7 +1503,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                             }
                         }
                         long startTime_2 = System.currentTimeMillis();
-                        this.batchCompleteApprovalTask(taskApprovalVOS);
+                        if(taskApprovalVOS!=null && taskApprovalVOS.size()>=1){
+                            this.batchCompleteApprovalTask(taskApprovalVOS);
+                        }
                         long endTime_2 = System.currentTimeMillis();
                         long executionTime_2 = endTime_2 - startTime_2;
                         log.info("batchCompleteApprovalTask执行时间:" + executionTime_2 + " 毫秒");

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

@@ -66,10 +66,10 @@ public class EVisaController {
         //执行代码
 
         log.info("扫描开始");
-        //String sql = "SELECT * from u_task_batch where json_data like '%1821798868568768512%' and is_deleted<>5  LIMIT 10";
+       // String sql = "SELECT * from u_task_batch where json_data like '%1840658122872455168%' and is_deleted<>5  LIMIT 10";
         String sql = "SELECT * from u_task_batch where is_deleted<>5 LIMIT 10";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
-        if (maps != null && maps.size() >= 1 && SystemUtils.isLinux()) {
+        if (maps != null && maps.size() >= 1 && SystemUtils.isLinux()) {//&& SystemUtils.isLinux()
             for (Map<String, Object> dataInfo : maps) {
                 if (executor.getQueue().size()<=40 ) {
                     String jsonData = dataInfo.get("json_data") + "";
@@ -129,9 +129,8 @@ public class EVisaController {
 
                 String  sql = "SELECT a.* from u_task_parallel a where a.process_instance_id=(SELECT process_instance_id from u_task_parallel b where  b.parallel_process_instance_id='"+taskApprovalVO.getParallelProcessInstanceId()+"') and is_deleted=0 and `status`=1 and sort not in(SELECT fixed_flow_branch_sort from u_fixed_flow_link where fixed_flow_id ="+masterTask.getFixedFlowId()+" and  flow_task_type=2 ) ";
                 List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
-                if (maps == null || maps.size() == 0) {
+                if (maps == null || maps.size() == 0 ) {
                     // 最后修改计量数据
-
                     //说明都审批完成,将主表状态更改为已完成
                     String finalPdfUrl = null;
                     if (eVisaStatus.contains("@@@@")) {

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

@@ -32,6 +32,7 @@ import com.alibaba.fastjson.JSONObject;
 import lombok.AllArgsConstructor;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
+import org.apache.http.entity.ContentType;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -90,7 +91,7 @@ import java.util.stream.Collectors;
 @AllArgsConstructor
 public class EVisaServiceImpl implements EVisaService {
 
-   // private static final String SIGN_HOST = "172.30.224.79";
+ //   private static final String SIGN_HOST = "172.30.224.79";
     private static final String SIGN_HOST = "47.115.117.246";
 
     private static final String SIGN_PORT = "8183";
@@ -603,7 +604,7 @@ public class EVisaServiceImpl implements EVisaService {
                     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])));
+                            MultipartFile newFiles = new MockMultipartFile("file", SnowFlakeUtil.getId() + ".pdf", ContentType.APPLICATION_OCTET_STREAM.toString(), IOUtils.toByteArray(new ByteArrayInputStream((byte[]) result[0])));
                             //重新上传
                             BladeFile bladeFile = this.newIOSSClient.uploadFileByInputStream(newFiles);
 
@@ -901,6 +902,7 @@ public class EVisaServiceImpl implements EVisaService {
             pdfBean.setBizSerialNo(GUIDUtil.generateId());
             pdfBean.setInputSource("");
             pdfBean.setInputType(BaseConstants.INPUT_TYPE_FILEDATA);
+            logger.info("【电签模块】pdf{}", "长度"+fileByte.length);
             pdfBean.setPdfData(fileByte);
             pdfBeans.add(pdfBean);
 
@@ -961,7 +963,6 @@ public class EVisaServiceImpl implements EVisaService {
         if (strategyVoList == null || strategyVoList.size() <= 0) {
             return null;
         }
-
         //构建策略
         for (SealStrategyVO vo : strategyVoList) {
             try {
@@ -1006,7 +1007,7 @@ public class EVisaServiceImpl implements EVisaService {
                             imageData = ImageUtil.resizeImage(imageData, 540, 540);
                         } else {
                             //非合同章
-                            imageData = ImageUtil.resizeImage(imageData, 400, 200);
+                            imageData = ImageUtil.resizeImage(imageData, 480, 132);
                         }
                     }
 

+ 90 - 20
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -75,6 +75,7 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -1926,13 +1927,7 @@ public class ExcelTabController extends BladeController {
         /*全加载,或者可以优化成依赖加载*/
         List<AppWbsTreeContractVO> tableAll = new ArrayList<>();
         List<TableInfo> tableInfoList = this.excelTabService.getTableInfoList(dataArray);
-/*        long start = System.currentTimeMillis();
-        if (tableInfoList != null) {
-            tableInfoList.forEach(e->{e.setToBeUpdated(true);});
-            tableAll = wbsTreeContractService.searchNodeAllTable(nodeId, "1", contractId, projectId, null);
-            doForTableIst(tableAll,tableInfoList);
-        }
-        System.out.println("加载所有表单数据耗时:"+(System.currentTimeMillis()-start));*/
+
         executionTime.info("公式前");
         //公式填充
         this.excelTabService.formulaFillData(tableInfoList, Long.parseLong(nodeId), ExecuteType.INSPECTION);
@@ -4017,19 +4012,21 @@ public class ExcelTabController extends BladeController {
                 JSONArray array = new JSONArray();
                 if (tableAll != null && tableAll.size() >= 1) {
                     /*只需加载第一张即可,生效会自动补全*/
-                    AppWbsTreeContractVO tab =tableAll.get(0);
-                    Map<String, Object> jo = excelTabService.getBussDataInfo(tab.getPKeyId(), 0);
-                    String s = new Gson().toJson(jo);
-                    //字符串转jsonobject
-                    JSONObject obj = JSON.parseObject(s);
-                    obj.put("classify", classify);
-                    obj.put("nodeId", noId);
-                    obj.put("contractId", contractId);
-                    obj.put("pkeyId", tab.getPKeyId());
-                    obj.put("projectId", projectId);
-                    obj.put("isCollapseLoad", true);
-                    obj.put("isRenderForm", true);
-                    array.add(obj);
+                    for(AppWbsTreeContractVO tab:tableAll) {
+                      //  AppWbsTreeContractVO tab = tableAll.get(0);
+                        Map<String, Object> jo = excelTabService.getBussDataInfo(tab.getPKeyId(), 0);
+                        String s = new Gson().toJson(jo);
+                        //字符串转jsonobject
+                        JSONObject obj = JSON.parseObject(s);
+                        obj.put("classify", classify);
+                        obj.put("nodeId", noId);
+                        obj.put("contractId", contractId);
+                        obj.put("pkeyId", tab.getPKeyId());
+                        obj.put("projectId", projectId);
+                        obj.put("isCollapseLoad", true);
+                        obj.put("isRenderForm", true);
+                        array.add(obj);
+                    }
                 }
                 js2.put("orderList", array);
                 js.put("dataInfo", js2);
@@ -4108,6 +4105,79 @@ public class ExcelTabController extends BladeController {
     }
 
 
+    @Scheduled(cron = "0/20 * * * * ?")
+    public void HtmlCope() {
+        //执行代码
+        String sql = "SELECT * from m_wbs_tree_contract where p_key_id=1789131196718907437" ;
+        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
+        if (maps != null && maps.size() >= 1) {
+            for (Map<String, Object> dataInfo : maps) {
+                if (executor.getQueue().size() <= 40) {
+                    String idkey = dataInfo.get("p_key_id") + "";
+                    Boolean aBoolean = RedisTemplate.hasKey("sign-" + idkey);
+                    if (!aBoolean) {
+                        RedisTemplate.opsForValue().set("sign-" + idkey, "1", 30, TimeUnit.SECONDS);
+                        CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
+                            try {
+                                this.checkHtmlCope(dataInfo);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        }, executor);
+                    }
+
+                }
+            }
+        }
+        System.out.println("队列数量" + executor.getQueue().size());
+        System.out.println("活跃数量" + executor.getActiveCount());
+        System.out.println("总共数量" + executor.getTaskCount());
+        System.out.println("完成数量" + executor.getCompletedTaskCount());
+    }
+
+    public void checkHtmlCope (Map < String, Object > dataInfo) throws Exception {
+        String pkey_id = dataInfo.get("p_key_id")+"";
+        String Html1 = dataInfo.get("html_url")+"";
+        String url183= "http://183.247.216.148:22776/";
+        String local183 = "/home/www/wwwroot/Users/hongchuangyanfa/Desktop/";
+        String s1 = Html1.replaceAll(local183, url183);
+        InputStream stream1 = getOSSInputStream2(s1);
+        if(stream1==null){
+
+        }else{
+            System.out.println("成功!");
+        }
+
+
+    }
+
+    public static synchronized InputStream getOSSInputStream2(String urlStr) throws Exception {
+        //获取OSS文件流
+        URL url =new URL(urlStr);
+        final URLConnection conn = url.openConnection();
+        conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+        try {
+            return conn.getInputStream();
+        } catch (Exception e){
+            System.out.println("zw-----------");
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static void main(String[] args) {
+        String Html1 = "/home/www/wwwroot/Users/hongchuangyanfa/Desktop/privateUrl/1790283758071447552.html";
+        String local183 = "/home/www/wwwroot/Users/hongchuangyanfa/Desktop/";
+        String url183= "http://183.247.216.148:22776/";
+
+        String s = Html1.replaceAll(local183, url183);
+
+        System.out.println(s);
+    }
+
+
+
+
   //  @Scheduled(cron = "0/20 * * * * ?")
     public void SignInfo() {
         //执行代码

+ 8 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/FormulaTurnPoint.java

@@ -141,14 +141,15 @@ public class FormulaTurnPoint implements FormulaStrategy {
                 Map<String, Object> tmp = new HashMap<>(16);
                 KEYS.forEach(k -> {
                     ElementData ed = map.get(c(k,args));
-                    tmp.put(configMap.get(k), ed.stringValue());
-                    /*V判断*/
-                    if (CD.equals(k)) {
-                        Long pkeyId = tableInfoIds.get(ed.getIndex());
-                        String findStr = "OP['" + cur.getTableName() + "']['" + pkeyId + "@" + cur.getKey() + "__" + ed.getY() + "_" + ed.getX() + "']['TF']";
-                        tmp.put("vertical", StringUtils.handleNull(Expression.parse(findStr).calculate(tec.getConstantMap())));
+                    if(ed!=null){
+                        tmp.put(configMap.get(k), ed.stringValue());
+                        /*V判断*/
+                        if (CD.equals(k)) {
+                            Long pkeyId = tableInfoIds.get(ed.getIndex());
+                            String findStr = "OP['" + cur.getTableName() + "']['" + pkeyId + "@" + cur.getKey() + "__" + ed.getY() + "_" + ed.getX() + "']['TF']";
+                            tmp.put("vertical", StringUtils.handleNull(Expression.parse(findStr).calculate(tec.getConstantMap())));
+                        }
                     }
-
                 });
                 tableData.add(tmp);
         }

+ 27 - 14
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -45,6 +45,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.node.ForestNodeMerger;
@@ -316,14 +317,23 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         }
                         dataMap2.put(k, lastStr);
                     } else {
-                        String dataVal = dataInfo2.getString(dataMap.get(k).get(0));
-                        if (StringUtils.isNotEmpty(dataVal)) {
-                            if (dataVal.contains("Ljava")) {
-                                Object o = dataInfo2.get(dataMap.get(k).get(0));
-                                dataVal = JSON.toJSONString(o).replace("\"", "");
+                            Object dataVal = dataInfo2.get(dataMap.get(k).get(0));
+                            if (Func.isNotEmpty(dataVal)) {
+                                if(dataVal instanceof JSONArray){ //数组时
+                                    JSONArray jsonArray = dataInfo2.getJSONArray(dataMap.get(k).get(0));
+                                    String data = jsonArray.get(0)+"";
+                                    if(data.contains("年") && data.contains("月")&& data.contains("日")){
+                                        JSONArray dataNew = new JSONArray(jsonArray.size());
+                                        for(int i=0;i<jsonArray.size();i++){
+                                            dataNew.add(i, jsonArray.get(i).toString().replace("\"", ""));
+                                        }
+                                        dataVal = dataNew;
+                                    }else{
+                                        dataVal = JSON.toJSONString(0).replace("\"", "");
+                                    }
+                                }
+                                dataMap2.put(k, dataVal + "_^_" + dataMap.get(k).get(0).split("__")[1]);
                             }
-                            dataMap2.put(k, dataVal + "_^_" + dataMap.get(k).get(0).split("__")[1]);
-                        }
                     }
                 }
                 dataInfo2.put("p_key_id", tableInfo.getPkeyId());
@@ -1152,11 +1162,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     /*检查发现有p_key_id缺失的情况,导致表单数据丢失,所以强制覆盖*/
                     dataMap2.put("p_key_id", tableInfo.getPkeyId());
                     //统计保存的字段
-//                    saveData.append(wbsTreeContract.getNodeName()+"<br>");
-//                    for (String s : dataMap2.keySet()) {
-//                        saveData.append(s+":"+dataMap2.get(s)+"<br>");
-//                    }
-//                    saveData.append("<br>");
+
                     sqlInfo = "INSERT INTO " + tabName + " ( ";
                     String keyStr = "id,";
                     String valStr = SnowFlakeUtil.getId() + ",";
@@ -1183,17 +1189,24 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     updateWrapper.in("p_key_id", tableInfo.getPkeyId());
                     updateWrapper.set("is_tab_pdf", 2);
                     wbsTreeContractService.update(updateWrapper);
-
+                    BladeUser user = AuthUtil.getUser();
                     TransactionStatus transactionStatus = this.beginTransaction(transactionManager1);
                     try {
+                        //添加被张表的操作日志
+                        StringBuffer sb = new StringBuffer();
+
+                        sb.append("insert into blade_tab_sql(p_key_id,user_id,create_time,sql_info) VALUES(");
+                        sb.append(tableInfo.getPkeyId());sb.append(",");sb.append(user.getUserId());
+                        sb.append(","); sb.append("SYSDATE()");sb.append(",\"");sb.append(sqlInfo);
+                        sb.append("\")");
                         jdbcTemplate.execute(delSql);
                         jdbcTemplate.execute(sqlInfo);
+                        jdbcTemplate.execute(sb.toString());
                         transactionManager1.commit(transactionStatus);
                     } catch (Exception e) {
                         transactionManager1.rollback(transactionStatus);
                         log.append(e.getMessage()).append("@@");
                         e.printStackTrace();
-                        /*return R.fail(wbsTreeContract.getNodeName());*/
                         return R.fail(reason(e.getMessage()));
                     }
                 }

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java

@@ -3,6 +3,8 @@ package org.springblade.manager.utils;
 import com.aspose.cells.PdfSaveOptions;
 import com.aspose.cells.SaveFormat;
 import com.aspose.cells.Workbook;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
 import com.itextpdf.text.Document;
 import com.itextpdf.text.pdf.PdfCopy;
 import com.itextpdf.text.pdf.PdfReader;