Browse Source

bug

Signed-off-by: liuyc <56808083@qq.com>
liuyc 1 year ago
parent
commit
f928a589b0

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

@@ -504,11 +504,11 @@ public class EVisaServiceImpl implements EVisaService {
                     pdfVO.setStrategyVoList(sealStrategyVOS);
 
                     //获取字节
-                    URL url =new URL(pdfUrl);
+                    URL url = new URL(pdfUrl);
                     byte[] fileByte;
                     try {
                         fileByte = IOUtils.toByteArray(url);
-                    }catch (Exception e){
+                    } catch (Exception e) {
                         return null;
                     }
 
@@ -541,7 +541,7 @@ public class EVisaServiceImpl implements EVisaService {
         //释放锁
         //  DistributedRedisLock.release(task.getUserId().toString());
 
-        System.out.println("bladeFile---eVisa"+task.getFormDataId()+"--"+resultMessage);
+        System.out.println("bladeFile---eVisa" + task.getFormDataId() + "--" + resultMessage);
         return resultMessage;
     }
 
@@ -552,7 +552,7 @@ public class EVisaServiceImpl implements EVisaService {
      */
     public String eVisaCustom(org.springblade.evisa.vo.TaskArchiveDTO taskArchiveDTO) {
         //type=1表示任务审批自定义签章,type=2表示认证电签签章(不涉及审批任务)
-        if (taskArchiveDTO.getSealStrategy()!=null && taskArchiveDTO.getSealStrategy().size() > 0 && taskArchiveDTO.getType() == 1) {
+        if (taskArchiveDTO.getSealStrategy() != null && taskArchiveDTO.getSealStrategy().size() > 0 && taskArchiveDTO.getType() == 1) {
             //获取档案任务
             Task task = jdbcTemplate.queryForObject("select form_data_id from u_task where id = " + taskArchiveDTO.getTaskId(), new BeanPropertyRowMapper<>(Task.class));
             if (task != null) {
@@ -621,7 +621,7 @@ public class EVisaServiceImpl implements EVisaService {
                 }
             }
             return "";
-        } else if (taskArchiveDTO.getSealStrategy()!=null && taskArchiveDTO.getSealStrategy().size() > 0 && taskArchiveDTO.getType() == 2) {
+        } else if (taskArchiveDTO.getSealStrategy() != null && taskArchiveDTO.getSealStrategy().size() > 0 && taskArchiveDTO.getType() == 2) {
             //此时的taskArchiveDTO.taskId=档案数据业务id(档案认证不涉及审批流任务)
             //获取档案任务的文件信息(这里根据id再查询一次,入参的时候不想重新构造入参的dto了)
             ArchiveFile archiveFile = jdbcTemplate.queryForObject("select pdf_file_url,e_visa_file from u_archive_file where id = " + taskArchiveDTO.getTaskId(), new BeanPropertyRowMapper<>(ArchiveFile.class));
@@ -784,7 +784,7 @@ public class EVisaServiceImpl implements EVisaService {
      */
     private Object[] signPdfByAXQZ(SealPdfVO pdfVO, byte[] fileByte) {
         Object[] result = new Object[3];
-            try {
+        try {
             PaperlessClient paperlessClient = new PaperlessClient(SIGN_HOST, SIGN_PORT, 300000, 1800000);
             paperlessClient.setSSL(false);
             //*****************************************************************************
@@ -834,11 +834,11 @@ public class EVisaServiceImpl implements EVisaService {
 
             compoundSealPdfListDetachedRequest.setBody(requestBody);
             //****************************** 请求服务端进行签章 *********************************************
-            System.out.println("-----------------------"+new Date().toString()+"开始"+transactionNo +"----------------------------");
+            System.out.println("-----------------------" + new Date().toString() + "开始" + transactionNo + "----------------------------");
 
             ResponseDto responseDto = paperlessClient.execute(compoundSealPdfListDetachedRequest);
 
-            System.out.println("-----------------------"+new Date().toString()+"结束"+transactionNo +"----------------------------");
+            System.out.println("-----------------------" + new Date().toString() + "结束" + transactionNo + "----------------------------");
             //******************************解析响应结果 *********************************************
             CompoundSealPdfListDetachedResponse compoundSealPdfListDetachedResponse = (CompoundSealPdfListDetachedResponse) responseDto;
             ResponseHead responseHead = compoundSealPdfListDetachedResponse.getHead();
@@ -856,9 +856,9 @@ public class EVisaServiceImpl implements EVisaService {
                 result[1] = compoundSealPdfListDetachedResponse.toString();
                 result[2] = responseHead.getMessage();
             }
-            }catch (Exception e){
-                e.printStackTrace();
-            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         return result;
     }
 
@@ -1142,8 +1142,18 @@ public class EVisaServiceImpl implements EVisaService {
                         Rectangle page = reader.getPageSize(Integer.parseInt(vo.getPage()));
                         float x1 = page.getWidth() / 100 * Float.parseFloat(vo.getLx()) + 3;
                         float y1 = page.getHeight() / 100 * Float.parseFloat(vo.getLy());
-                        String x2 = String.valueOf(x1).substring(0, String.valueOf(x1).indexOf("."));
-                        String y2 = String.valueOf(y1).substring(0, String.valueOf(y1).indexOf("."));
+                        String x2;
+                        if (String.valueOf(x1).contains(".")) {
+                            x2 = String.valueOf(x1).substring(0, String.valueOf(x1).indexOf("."));
+                        } else {
+                            x2 = String.valueOf(x1);
+                        }
+                        String y2;
+                        if (String.valueOf(x1).contains(".")) {
+                            y2 = String.valueOf(y1).substring(0, String.valueOf(y1).indexOf("."));
+                        } else {
+                            y2 = String.valueOf(y1);
+                        }
                         sealStrategy.setSignWithCoordinate(vo.getPage(), x2, y2);
                     }
                 }

+ 51 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/feign/MeterTaskClientImpl.java

@@ -0,0 +1,51 @@
+package org.springblade.meter.feign;
+
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang.StringUtils;
+import org.springblade.business.entity.MessageWarning;
+import org.springblade.business.entity.Task;
+import org.springblade.business.entity.TaskParallel;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+@AllArgsConstructor
+public class MeterTaskClientImpl implements MeterWebSocketClient {
+
+    private final JdbcTemplate jdbcTemplate;
+
+    @Override
+    public Map<String, String> getWebsocketMsg(String projectId, String contractId, String userIdResult) {
+        List<Task> tasks = jdbcTemplate.query("SELECT process_instance_id FROM u_task WHERE project_id = " + projectId + " AND contract_id = " + contractId + " AND status = 1 AND approval_type = 5 AND is_deleted = 0", new BeanPropertyRowMapper<>(Task.class));
+        List<String> taskCountIds = tasks.stream().map(Task::getProcessInstanceId).collect(Collectors.toList());
+        long taskAllCount = 0;
+        if (taskCountIds.size() > 0) {
+            List<TaskParallel> query = jdbcTemplate.query("SELECT id FROM u_task_parallel WHERE process_instance_id IN (" + StringUtils.join(taskCountIds, ",") + ") AND task_user = " + userIdResult + " AND status = 1", new BeanPropertyRowMapper<>(TaskParallel.class));
+            taskAllCount = query.size();
+        }
+        List<MessageWarning> messageWarnings = jdbcTemplate.query("SELECT type FROM u_message_warning WHERE project_id = " + projectId + " AND contract_id = " + contractId + " AND push_user = " + userIdResult + " AND is_read = 0 AND is_deleted = 0", new BeanPropertyRowMapper<>(MessageWarning.class));
+        long messageCount1 = messageWarnings.stream().filter(f -> f.getType().equals(1)).count();
+        long messageCount2 = messageWarnings.stream().filter(f -> f.getType().equals(2)).count();
+        long messageCount3 = messageWarnings.stream().filter(f -> f.getType().equals(3)).count();
+        long messageCount4 = messageWarnings.stream().filter(f -> f.getType().equals(4)).count();
+        long messageCount5 = messageWarnings.stream().filter(f -> f.getType().equals(5)).count();
+        Map<String, String> map = new HashMap<>();
+        map.put("allCount", String.valueOf(taskAllCount + messageWarnings.size()));
+        map.put("taskCount", String.valueOf(taskAllCount));
+        map.put("messageCount", String.valueOf(messageWarnings.size()));
+        map.put("messageCount_1", String.valueOf(messageCount1));
+        map.put("messageCount_2", String.valueOf(messageCount2));
+        map.put("messageCount_3", String.valueOf(messageCount3));
+        map.put("messageCount_4", String.valueOf(messageCount4));
+        map.put("messageCount_5", String.valueOf(messageCount5));
+        map.put("userId", userIdResult);
+        return map;
+    }
+
+
+}

+ 2 - 2
blade-service/blade-rabbitmq-consumer/src/main/java/org/springblade/consumer/socket/WebSocketEndpoint.java

@@ -117,7 +117,7 @@ public class WebSocketEndpoint implements ApplicationContextAware {
                         stringMap = businessWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
                         break;
                     case ClientIdConstant.METER_CLIENT_ID:
-                        // TODO stringMap = meterWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                        stringMap = meterWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
                         break;
                 }
                 try {
@@ -193,7 +193,7 @@ public class WebSocketEndpoint implements ApplicationContextAware {
                                 stringMap = businessWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
                                 break;
                             case ClientIdConstant.METER_CLIENT_ID:
-                                // TODO stringMap = meterWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                                stringMap = meterWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
                                 break;
                         }
                         if (stringMap.size() > 0) {