lfx 2 weeks ago
parent
commit
d721a3e949

+ 104 - 0
mjava-aosk/src/main/java/com/malk/aosk/event/DDaskEventImpl.java

@@ -0,0 +1,104 @@
+package com.malk.aosk.event;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.URLUtil;
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.malk.delegate.DDEvent;
+import com.malk.server.dingtalk.DDConf;
+import com.malk.server.dingtalk.DDR_New;
+import com.malk.service.dingtalk.DDClient;
+import com.malk.service.dingtalk.DDClient_Workflow;
+import com.malk.utils.UtilMap;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Primary;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Primary
+@Service
+public class DDaskEventImpl implements DDEvent {
+
+    @Autowired
+    private DDClient_Workflow ddClientWorkflow;
+    @Autowired
+    private DDClient ddClient;
+    @Value("${aosk.oa.path}")
+    private String PATH;
+
+    @Override
+    public void executeEvent_Task_Finish(String processInstanceId, String processCode, boolean isAgree, String remark) {
+
+    }
+
+    @Override
+    public void executeEvent_Task_Start(String processInstanceId, String processCode) {
+
+    }
+
+    @Override
+    public void executeEvent_Task_Comment(String processInstanceId, String processCode) {
+        // 评论回调 1.查询审批实例 2.获取评论附件 3.保存附件
+        Map form = ddClientWorkflow.getForms(ddClient.getAccessToken(),processCode);
+        Map map = ddClientWorkflow.getProcessInstanceId(ddClient.getAccessToken(), processInstanceId);
+        String createTime=UtilMap.getString(map,"createTime");
+        String yearMonth = createTime.substring(0,7).replace("-","");
+        String filePath = PATH+"/"+yearMonth+"/"+UtilMap.getString(form,"name")+"/"+UtilMap.getString(map,"businessId")+"/";
+        List<Map> list = UtilMap.getList(map, "operationRecords");
+        for (Map record : list) {
+            if("ADD_REMARK".equals(UtilMap.getString(record,"type"))){
+                if((record.containsKey("attachments")&& UtilMap.getList(record,"attachments").size()>0)){
+                    saveFile(filePath, JSONArray.parseArray(UtilMap.getString(record,"attachments")),processInstanceId);
+                }
+                if((record.containsKey("images")&& UtilMap.getList(record,"images").size()>0)){
+                    saveImg(filePath, UtilMap.getList(record,"images"));
+                }
+            }
+        }
+    }
+
+    private void saveImg(String filePath, List<String> attachments){
+        for(String attachment : attachments){
+            // 1. 获取URL的路径部分(自动解码%20等字符)
+            String path = URLUtil.getPath(attachment);
+            // 2. 从路径中提取文件名
+            String fileName = FileUtil.getName(path);
+            HttpUtil.downloadFile(attachment,filePath+fileName);
+        }
+    }
+
+    private void saveFile(String filePath,JSONArray fileIds,String pid){
+        for(int i=0;i<fileIds.size();i++){
+            JSONObject fileInfo=fileIds.getJSONObject(i);
+            String fileId=fileInfo.getString("fileId");
+            String fileName=fileInfo.getString("fileName");
+            String url=ddClientWorkflow.getFileUrl(ddClient.getAccessToken(),pid,fileId,true);
+            HttpUtil.downloadFile(url,filePath+fileName);
+        }
+    }
+
+
+
+    @Override
+    public void executeEvent_Task_Redirect(String processInstanceId, String processCode) {
+
+    }
+
+    @Override
+    public void executeEvent_Instance_Finish(String processInstanceId, String processCode, boolean isAgree, boolean isTerminate, String staffId) {
+
+    }
+
+    @Override
+    public void executeEvent_Instance_Start(String processInstanceId, String processCode) {
+
+    }
+}

+ 2 - 2
mjava-aosk/src/main/resources/application-dev.yml

@@ -19,8 +19,8 @@ dingtalk:
   appKey: dinghbynhnd2dbgypmsa
   appSecret: Kl5Xw8x0TlEIlvcJuUkYZD18UTTShJmfdKrAIpY8oX-Q_tazyUKA28nQh7dG5-mq
   corpId:
-  aesKey:
-  token:
+  aesKey: hUKD4QaLkGTvh86GyOHCmWZ4I1YvAlaUvKkGufXFdaD
+  token: TE0bPgJ1v9Fc3Svu8cfMKcoBd6q5TkljPHg
 # aliwork
 aliwork:
   appType:

+ 2 - 2
mjava-aosk/src/main/resources/application-pord.yml

@@ -19,8 +19,8 @@ dingtalk:
   appKey: ding8gscrk6omavamv35
   appSecret: 83f9h77IMXKIuhcq8jJvKjV8sANGCWZRLRXFaQUEhZL2ZVWhH7FZsIY-jlY8cQux
   corpId:
-  aesKey:
-  token:
+  aesKey: EkvVcJhdbzw5jcbtw04Clhty5SsYbLb8yMbTCFDM3hq
+  token: BliMBpPrXf1SyJcjZXu
 # aliwork
 aliwork:
   appType:

+ 1 - 1
mjava-aosk/src/main/resources/application.yml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: pord
+    active: prod
   servlet:
     multipart:
       max-file-size: 100MB

+ 1 - 1
mjava-huagao/src/main/java/com/malk/huagao/schedule/ScheduleTask.java

@@ -73,7 +73,7 @@ public class ScheduleTask {
 
     /**
      */
-    @Scheduled(cron = "0 35 0 * * ?")
+    @Scheduled(cron = "0 35 6 * * ?")
     public void syncDay() {
         log.info("考勤同步-昨天");
         LocalDateTime startTime= LocalDate.now().minusDays(1).atTime(LocalTime.MIN);

+ 10 - 5
mjava-xzkj/src/main/java/com/malk/xzkj/controller/IVController.java

@@ -28,10 +28,7 @@ import net.coobird.thumbnailator.Thumbnails;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.util.IOUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.ByteArrayInputStream;
@@ -292,7 +289,9 @@ public class IVController {
                 Map rsp = txyInvoice.doVatInvoiceVerifyNew(dto.getKindName(), dto.getCode(), invoiceNo, dto.getDate(), String.valueOf(dto.getAmount()), dto.getCheckCode(), String.valueOf(dto.getExcludingTax()), serialTips,dto.getSellerTaxId());
                 Map invoice = (Map) rsp.get("Invoice");
                 McException.assertAccessException(!dto.getBuyerName().equals(guyuanNameRepalce(invoice.get("BuyerName").toString())), serialTips + ", 购买方名称不匹配!");
-                McException.assertAccessException(!dto.getBuyerTaxId().equals(invoice.get("BuyerTaxCode")), serialTips + ", 购买方税号不匹配!");
+                if(!PublicUtil.isNull(invoice.get("BuyerTaxCode"))){
+                    McException.assertAccessException(!dto.getBuyerTaxId().equals(invoice.get("BuyerTaxCode")), serialTips + ", 购买方税号不匹配!");
+                }
                 McException.assertAccessException(!dto.getSellerName().equals(guyuanNameRepalce(invoice.get("SellerName").toString())), serialTips + ", 销售方名称不匹配!");
                 McException.assertAccessException(!dto.getSellerTaxId().equals(invoice.get("SellerTaxCode")), serialTips + ", 销售方税号不匹配!");
             } catch (TencentCloudSDKException e) {
@@ -467,4 +466,10 @@ public class IVController {
         return McR.success();
     }
 
+    @GetMapping("test2")
+    McR test2() throws TencentCloudSDKException {
+        Map map=txyInvoice.doVatInvoiceVerifyNew("增值税普通发票", "144032509110", "13052133", "2025-04-28", "300", "5e8db", "283.02", "","91440300708461136T");
+        return McR.success(map);
+    }
+
 }

+ 1 - 1
mjava-xzkj/src/main/java/com/malk/xzkj/service/impl/TXYImplInvoice.java

@@ -132,7 +132,7 @@ public class TXYImplInvoice implements TXYInvoice {
         log.debug("请求响应, {}", result);
         McException.assertAccessException(!UtilNumber.equalBigDecimal(UtilMap.getString(invoice, "AmountWithTax"), amount), tips + ", 价税合计金额不匹配!");
         // ppExt: 增值税卷票: 票面无税率, 税额. 但接口验证返回或本质上发票是有税率, 税额. 因此取消后置判断
-        McException.assertAccessException(!invoiceKind.contains("卷票") && !UtilNumber.equalBigDecimal(UtilMap.getString(invoice, "AmountWithoutTax"), excludingTax), tips + ", 不含税金额不匹配!");
+//        McException.assertAccessException(!invoiceKind.contains("卷票") && !UtilNumber.equalBigDecimal(UtilMap.getString(invoice, "AmountWithoutTax"), excludingTax), tips + ", 不含税金额不匹配!");
         return rsp;
     }