Explorar o código

东方新华凭证推送
医保局代码提交

zfc hai 10 meses
pai
achega
5e93d49aa3

+ 7 - 9
mjava-dongfangxinhua/src/main/java/com/malk/dongfangxinhua/controller/DFXHController.java

@@ -16,6 +16,7 @@ import com.malk.server.aliwork.YDParam;
 import com.malk.server.common.McException;
 import com.malk.server.common.McR;
 import com.malk.service.aliwork.YDClient;
+import com.malk.service.aliwork.YDService;
 import com.malk.utils.UtilHttp;
 import com.malk.utils.UtilMap;
 import com.malk.utils.UtilServlet;
@@ -50,7 +51,8 @@ public class DFXHController {
 
 
 
-
+    @Autowired
+    private YDService ydService;
     @Autowired
     private YDClient ydClient;
 
@@ -152,18 +154,14 @@ public class DFXHController {
      * @param request
      * @return
      */
-    @PostMapping("syncErp")
+    @RequestMapping("syncErp")
     McR pushErp(HttpServletRequest request) {
 
-        // 查询付款申请单(获取跟付款申请表,查询状态为付款完成、凭证号为空的数据)
-        YDParam ydParam = YDParam.builder()
+        List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
                 .formUuid("FORM-6L966171YHZA0OJOAUKWG89JTZA635EV3Y1ILR")
                 .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_lr08rrpc, textField_lof4wiqt", "付款成功","凭证未生成")))   //付款成功  且无凭证号的数据
-                .build();
-
-        //获取所有 状态为付款完成、凭证号为空的数据
-        List<Map> dataList = (List<Map>) ydClient.queryData(ydParam, YDConf.FORM_QUERY.retrieve_search_form).getData();
-        log.info("同步Erp凭证数据, {}", dataList);
+                .build());
+        log.info("同步Erp凭证数据, {}", dataList.size());
         dataList.forEach(item ->{
             payService.synProofStatus((String) item.get("formInstanceId"));
         });

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

@@ -1,6 +1,12 @@
 package com.malk.dongfangxinhua.schedule;
 
+import com.alibaba.fastjson.JSON;
 import com.malk.dongfangxinhua.service.PayService;
+import com.malk.server.aliwork.YDConf;
+import com.malk.server.aliwork.YDParam;
+import com.malk.service.aliwork.YDClient;
+import com.malk.service.aliwork.YDService;
+import com.malk.utils.UtilMap;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -8,6 +14,9 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
+import java.util.List;
+import java.util.Map;
+
 @Slf4j
 @Configuration
 @EnableScheduling
@@ -18,6 +27,8 @@ public class ScheduleTask {
      @Autowired
     PayService payService;
 
+    @Autowired
+    private YDService ydService;
     /**
      * ,每天1点同步付款状态
      */
@@ -37,7 +48,16 @@ public class ScheduleTask {
     @Scheduled(cron = " 0 5 1 * * ? ")
     public void syncErpStatus() {
         try {
-//            payService.syncPayStatus();
+            // 查询付款申请单(获取跟付款申请表,查询状态为付款完成、凭证号为空的数据)
+            //获取所有 状态为付款完成、凭证号为空的数据
+            List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
+                    .formUuid("FORM-6L966171YHZA0OJOAUKWG89JTZA635EV3Y1ILR")
+                    .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_lr08rrpc, textField_lof4wiqt", "付款成功","凭证未生成")))   //付款成功  且无凭证号的数据
+                    .build());
+            log.info("同步Erp凭证数据, {}", dataList.size());
+            dataList.forEach(item ->{
+                payService.synProofStatus((String) item.get("formInstanceId"));
+            });
         } catch (Exception e) {
             // 记录错误信息
             e.printStackTrace();

+ 4 - 15
mjava-dongfangxinhua/src/main/java/com/malk/dongfangxinhua/service/Impl/PayServiceImpl.java

@@ -247,8 +247,8 @@ public class PayServiceImpl implements PayService {
 
 
     //配置客户的sqlist URL
-//    private static final String SQLITE_URL ="jdbc:sqlite:D:/JavaSpace/fbi.dll";
-    private static final String SQLITE_URL ="jdbc:sqlite:D:/FASTBI/FBI/fbi.dll";
+    private static final String SQLITE_URL ="jdbc:sqlite:D:/JavaSpace/fbi.dll";
+//    private static final String SQLITE_URL ="jdbc:sqlite:D:/FASTBI/FBI/fbi.dll";
     /**
      * 同步凭证状态
      * @param formInstId
@@ -272,7 +272,8 @@ public class PayServiceImpl implements PayService {
 
             if (rowsAffected.next()) {
                 int status = rowsAffected.getInt("status");
-                String flag = rowsAffected.getString("flag");
+                //凭证号
+                String flag = rowsAffected.getString("record_id");
                 if (status == 1){
                     // 更新付款申请单凭证状态
                     ydClient.operateData(YDParam.builder()
@@ -281,18 +282,6 @@ public class PayServiceImpl implements PayService {
                             .build(), YDConf.FORM_OPERATION.update);
                     log.info("凭证已生成:{}",rowsAffected.getString("note"));
                 }
-                //条件查询是成功的、所以不会有状态2
-//                else if (status == 2){
-//                    // 更新付款申请单凭证状态
-//                ydClient.operateData(YDParam.builder()
-//                        .formInstanceId(formInstId)
-//                        .updateFormDataJson(JSON.toJSONString(UtilMap.map("textField_lof4wiqt","凭证生成失败")))
-//                        .build(), YDConf.FORM_OPERATION.update);
-//                    log.info("凭证生成失败:{}",rowsAffected.getString("note"));
-//                }
-//                else{
-//                    log.info("未查询到对应生成凭证成功数据!");
-//                }
             }else{
                 log.info("未查询到对应生成凭证成功数据!");
             }