Browse Source

2024 3 11 号

zhuwei 8 months ago
parent
commit
f68dcf90e9

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

@@ -56,11 +56,11 @@ public class EVisaController {
 
     // 电签主类
 
-    @Scheduled(cron = "0/30 * * * * ?")
+    @Scheduled(cron = "0/20 * * * * ?")
     public void SignInfo() {
         //执行代码
         log.info("扫描开始");
-        String sql = "SELECT * from u_task_batch where is_deleted<>5  and task_parallel_id=1765613633921875968 LIMIT 40";
+        String sql = "SELECT * from u_task_batch where is_deleted<>5  LIMIT 40";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
         if (maps != null && maps.size() >= 1) {
             for (Map<String, Object> dataInfo : maps) {
@@ -135,30 +135,37 @@ public class EVisaController {
                     } catch (Exception e) {
                         e.printStackTrace();
                     }
-
                     //修改主流程状态为已完成
                     String up_task = "update u_task set status=2,update_time=SYSDATE() where id="+taskApprovalVO.getTaskId();
-
+                    jdbcTemplate.execute(up_task);
                     //修改对应的业务数据状态为已审批
-                    taskClient.updateBusinessDataByFormDataId(masterTask, 2, finalPdfUrl, taskApprovalVO.getUserId());
-
-                    //返回电签成功的pdf路径,给试验用
-                    try {
-                        taskClient.trialSelfTaskRelated(taskApprovalVO, finalPdfUrl, taskApprovalVO.getId());
-                    } catch (FileNotFoundException e) {
-                        throw new RuntimeException(e);
+                    int approvalType = taskApprovalVO.getApprovalType();
+                    if(approvalType<=4){
+                        taskClient.updateBusinessDataByFormDataId(masterTask, 2, finalPdfUrl, taskApprovalVO.getUserId());
+                        //返回电签成功的pdf路径,给试验用
+                        try {
+                            taskClient.trialSelfTaskRelated(taskApprovalVO, finalPdfUrl, taskApprovalVO.getId());
+                        } catch (FileNotFoundException e) {
+                            throw new RuntimeException(e);
+                        }
+                    } else {
+                        UpMeterSignDataInfo(taskApprovalVO,finalPdfUrl);
                     }
                 }else {
                     //只更新PDF路径
                     taskClient.updateBusinessDataByFormDataId(masterTask, 1, eVisaStatus.contains("@@@@") ? eVisaStatus.split("@@@@")[1] : null, taskApprovalVO.getUserId());
                     String finalPdfUrl = eVisaStatus.contains("@@@@") ? eVisaStatus.split("@@@@")[1] : null;
-                    try {
-                        taskClient.trialSelfTaskRelated(taskApprovalVO, finalPdfUrl, taskApprovalVO.getId());
-                    } catch (FileNotFoundException e) {
-                        throw new RuntimeException(e);
+                    int approvalType = taskApprovalVO.getApprovalType();
+                    if(approvalType<=4){
+                        try {
+                            taskClient.trialSelfTaskRelated(taskApprovalVO, finalPdfUrl, taskApprovalVO.getId());
+                        } catch (FileNotFoundException e) {
+                            throw new RuntimeException(e);
+                        }
+                    }else{
+                        UpMeterSignDataInfo(taskApprovalVO,finalPdfUrl);
                     }
                 }
-
             }else if ("eVisaError".equals(eVisaStatus) || eVisaStatus.contains("eVisaError")) {
 
             }else {
@@ -166,7 +173,6 @@ 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();
@@ -174,4 +180,18 @@ public class EVisaController {
             jdbcTemplate.execute(up_task);
         }
     }
+
+    // 电签成功状态修改---计量系统
+    public void UpMeterSignDataInfo(TaskApprovalVO taskApprovalVO,String finalPdfUrl){
+        if (taskApprovalVO.getApprovalType()==5) { //计量 -
+            this.jdbcTemplate.execute("update s_interim_pay_certificate set raw_url='"+finalPdfUrl+"' where contract_period_id = " + taskApprovalVO.getFormDataId());
+            this.jdbcTemplate.execute("delete from u_task_batch where id="+taskApprovalVO.getId());
+            RedisTemplate.delete("sign-" + taskApprovalVO.getFormDataId());
+        } else if (taskApprovalVO.getApprovalType()==6 || taskApprovalVO.getApprovalType()==7) { //计量 --材料 ,中间
+            this.jdbcTemplate.execute("update s_material_start_statement set raw_url='"+finalPdfUrl+"' where meter_period_id = " + taskApprovalVO.getFormDataId());
+            this.jdbcTemplate.execute("delete from u_task_batch where id="+taskApprovalVO.getId());
+            RedisTemplate.delete("sign-" + taskApprovalVO.getFormDataId());
+        }
+    }
+
 }

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

@@ -92,8 +92,8 @@ import java.util.*;
 @AllArgsConstructor
 public class EVisaServiceImpl implements EVisaService {
 
-//    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_HOST = "172.30.224.79";
+   // private static final String SIGN_HOST = "47.115.117.246";
 
     private static final String SIGN_PORT = "8183";
 
@@ -458,7 +458,6 @@ public class EVisaServiceImpl implements EVisaService {
                 }
                 String contractId = this.taskClient.queryTaskContractId(task.getParallelProcessInstanceId());
                 String ids = String.join(",", eVisaConfigList);
-
                 //判断电签类型
 
                 if (taskFile.getRemarkType().equals("2")) {//东方 中讯 daMap.put("keyWord","1673632651551965184");

+ 13 - 14
blade-service/blade-manager/src/main/java/com/mixsmart/utils/FormulaUtils.java

@@ -39,6 +39,7 @@ import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.springblade.common.utils.BaseUtils;
 import org.springblade.common.utils.SnowFlakeUtil;
@@ -853,21 +854,19 @@ public class FormulaUtils {
         if(document!=null) {
             Elements list = document.getElementsByAttribute("dqid");
             if (list != null && !list.isEmpty()) {
-                list.stream().map(e-> {
-                            if (!e.hasAttr("y1") && !e.hasAttr("x1")&&e.children().size()>0) {
-                                  return e.children().get(0);
-                            } else {
-                                  return e;
-                            }
-                        }
-                ).filter(Objects::nonNull).forEach(element -> {
-                    try {
-                        int y1 = Func.toInt(element.attr("y1"));
-                        int x1 = Func.toInt(element.attr("x1"));
-                        result.put(y1+"_"+x1,element.attr("dqid"));
-                    }catch (Exception e){
-                        e.printStackTrace();
+                list.stream().forEach(e -> {
+                    String dqid = e.attr("dqid");
+                    int y1=0;
+                    int x1=0;
+                    if (!e.hasAttr("y1") && !e.hasAttr("x1")&&e.children().size()>0) {
+                        Element element = e.children().get(0);
+                        y1 = Func.toInt(element.attr("y1"));
+                        x1 = Func.toInt(element.attr("x1"));
+                    }else {
+                        y1 = Func.toInt(e.attr("y1"));
+                        x1 = Func.toInt(e.attr("x1"));
                     }
+                    result.put(y1+"_"+x1,dqid);
                 });
             }
         }

+ 7 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -17,6 +17,7 @@ import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
+import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.BaseUtils;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
@@ -37,11 +38,14 @@ import org.springblade.manager.mapper.WbsTreePrivateMapper;
 import org.springblade.manager.service.*;
 import org.springblade.manager.utils.FileUtils;
 import org.springblade.manager.vo.*;
+import org.springblade.system.cache.ParamCache;
 import org.springframework.beans.BeanUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 import javax.validation.constraints.NotNull;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.util.*;
@@ -2654,9 +2658,11 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         Map<String,String> parent=  getWtpParent(meterType.getName(),contractInfo.getPId());
         List<NodeTable> tableList=getTableListMeter(parent);
         Map<String,Document> documentMap=  tableList.parallelStream().collect(Collectors.toMap(NodeTable::getInitTableName,m->{
+            String htmlUrl = m.getHtmlUrl();
             InputStream inputStreamByUrl = null;
+            // 添加电签关键字Id
             try {
-                inputStreamByUrl = FileUtils.getInputStreamByUrl(m.getHtmlUrl());
+                inputStreamByUrl = FileUtils.getInputStreamByUrl(htmlUrl);
             } catch (Exception e) {
                 e.printStackTrace();
             }

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

@@ -410,9 +410,7 @@ public class FileUtils {
     public static String getNetUrl(String fileUrl){
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
-
        String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
-
         return path;
     }
 

+ 13 - 83
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -75,7 +75,6 @@ import java.io.*;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.math.BigDecimal;
-import java.sql.SQLException;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.Month;
@@ -2814,7 +2813,7 @@ public class TaskController extends BladeController {
                                 /*设置表头*/
                                 setTitle(sheet, tile);
                                 /*添加电签*/
-                                setDQInfo(sheet, rs);
+                                setDQInfo(sheet,rs,tile);
                                 //去掉表格虚线
                                 sheet.setPrintGridlines(false);
                                 //设置 整个工作表为一页
@@ -2870,15 +2869,17 @@ public class TaskController extends BladeController {
     }
 
     // 添加电签任务列表
-    public void addSignTaskBatch(Report report) {
-        try {
-            String sql = " insert INTO u_task_batch(id,task_parallel_id,json_data,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,nick_name) " +
-                    " SELECT a.id,a.process_instance_id,json_object('approvalFileList',json_array(),'approvalType',4+b.meter_task_type,'comment','','flag','OK','formDataId',b.form_data_id,'parallelProcessInstanceId',a.parallel_process_instance_id,'pass',true,'taskId',b.id) as  json_data,a.task_user,a.create_dept,a.create_time,a.update_user,a.update_time,1 as status,0 as is_deleted,a.task_user_name as nick_name " +
-                    " from u_task_parallel a,u_task b where a.process_instance_id=b.process_instance_id and b.form_data_id=" + report.getPeriodId() + " and b.meter_task_type=" + (Func.toInt(report.getType()) + 1);
-            jdbcTemplate.execute(sql);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+    public void addSignTaskBatch(Report report){
+        // 修改个人电签状态
+        String UPSql ="update u_task_parallel a set a.status=1,e_visa_status=0,e_visa_content='' where a.process_instance_id = (select b.process_instance_id from u_task b where  b.form_data_id="+report.getPeriodId()+" and b.meter_task_type="+(Func.toInt(report.getType())+1)+")";
+        String DeSql ="delete from u_task_batch where task_parallel_id = (select b.process_instance_id from u_task b where  b.form_data_id="+report.getPeriodId()+" and b.meter_task_type="+(Func.toInt(report.getType())+1)+")";
+        jdbcTemplate.execute(UPSql);
+        //删除以前存在的电签
+        jdbcTemplate.execute(DeSql);
+        String sql=" insert INTO u_task_batch(id,task_parallel_id,json_data,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,nick_name) "+
+                   " SELECT a.id,a.process_instance_id,json_object('approvalFileList',json_array(),'approvalType',4+b.meter_task_type,'comment','','flag','OK','formDataId',b.form_data_id,'parallelProcessInstanceId',a.parallel_process_instance_id,'pass',true,'taskId',b.id) as  json_data,a.task_user,a.create_dept,a.create_time,a.update_user,a.update_time,1 as status,0 as is_deleted,a.task_user_name as nick_name "+
+                   " from u_task_parallel a,u_task b where a.process_instance_id=b.process_instance_id and b.form_data_id="+report.getPeriodId()+" and b.meter_task_type="+(Func.toInt(report.getType())+1);
+        jdbcTemplate.execute(sql);
     }
 
     public void setTitle(Sheet sheet, String name) {
@@ -2900,77 +2901,7 @@ public class TaskController extends BladeController {
     }
 
     // 添加电签信息数据
-    public void setDQInfoOld(Sheet sheet, String htmlUrl, String title) {
-        String file_path = "/www/wwwroot/Users/hongchuangyanfa/Desktop/";//CollectionUtils.getSysLocalFileUrl();
-        // 添加电签关键字Id
-        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
-        File file = null;
-        InputStream fileInputStream;
-        try {
-            file = ResourceUtil.getFile(htmlUrl);
-            if (file.exists()) {
-                fileInputStream = new FileInputStream(file);
-            } else {
-                String path = sys_file_net_url + htmlUrl.replaceAll("//", "/").replaceAll(file_path, "");
-                fileInputStream = CommonUtil.getOSSInputStream(path);
-            }
-            String htmlString = IoUtil.readToString(fileInputStream);
-            org.jsoup.nodes.Document htmldoc = Jsoup.parse(htmlString);
-            Elements dqlist = htmldoc.getElementsByAttribute("dqid");
-            if (dqlist != null && dqlist.size() > 0) {
-                dqlist.forEach(element -> {
-                    System.out.println(element.hasAttr("y1"));
-                    int y1 = 0;
-                    int x1 = 0;
-                    if (!element.hasAttr("y1") && !element.hasAttr("x1")) {
-                        Element element2 = element.children().get(0);
-                        y1 = Func.toInt(element2.attr("y1"));
-                        x1 = Func.toInt(element2.attr("x1"));
-                    } else {
-                        y1 = Func.toInt(element.attr("y1"));
-                        x1 = Func.toInt(element.attr("x1"));
-                    }
-
-                    Row row = sheet.getRow(y1 - 1);
-                    if (row != null) {
-                        Cell cell = row.getCell(x1 - 1);
-                        if (cell != null && ObjectUtil.isNotEmpty(cell)) {
-
-                            String dataInfo = cell.getStringCellValue();
-                            String dqVal = element.attr("dqid");
-                            //调用方法设置字体样式到单元格中的指定字符
-                            Workbook workbook = cell.getSheet().getWorkbook();
-                            CellStyle cellStyle = workbook.createCellStyle();
-                            cellStyle.cloneStyleFrom(cell.getCellStyle());
-
-                            Font newFont = workbook.createFont();
-                            newFont.setFontHeightInPoints(workbook.getFontAt(cell.getCellStyle().getFontIndex()).getFontHeightInPoints());
-
-                            if (dataInfo == null || StringUtil.isEmpty(dataInfo)) {
-                                cell.setCellValue(dqVal);
-                                newFont.setFontHeightInPoints((short) 1);
-                                newFont.setColor(IndexedColors.WHITE.getIndex());
-                                cellStyle.setFont(newFont);
-                            } else {
-                                String lastData = dataInfo + "*" + dqVal;
-                                RichTextString richString = new XSSFRichTextString(lastData);
-                                richString.clearFormatting();
-                                richString.applyFont(0, dataInfo.length(), newFont);
-                                newFont.setFontHeightInPoints((short) 1);
-                                newFont.setColor(IndexedColors.WHITE.getIndex());
-                                richString.applyFont(dataInfo.length(), lastData.length(), newFont);
-                                cell.setCellValue(richString);
-                            }
-                            cell.setCellStyle(cellStyle);
-                        }
-                    }
-                });
-            }
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-    public void setDQInfo(Sheet sheet, ReportResult rs){
+    public void setDQInfo(Sheet sheet, ReportResult rs,String title){
         /*电签信息已经和坐标一起给出*/
         /*具体获取方法在 FormulaUtils 里的 public static Map<String,String> getESignMap(Document document)*/
         Map<String,String> signMap =rs.getESignMap();
@@ -3014,7 +2945,6 @@ public class TaskController extends BladeController {
                 }catch (Exception e){
                     e.printStackTrace();
                 }
-
             });
         }else{
             System.out.println(rs.getName()+"未找到电签配置信息");