|
@@ -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();
|