|
@@ -0,0 +1,42 @@
|
|
|
|
|
+package cn.iocoder.yudao.module.system.job;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
|
|
|
+import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.api.kingdee.KingdeeApi;
|
|
|
|
|
+import com.google.gson.Gson;
|
|
|
|
|
+import com.google.gson.JsonArray;
|
|
|
|
|
+import com.google.gson.JsonElement;
|
|
|
|
|
+import com.google.gson.JsonObject;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
|
+
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
|
+import java.time.YearMonth;
|
|
|
|
|
+@Component
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+public class HuBeiKingdeeOrderAbleSyncIdJob implements JobHandler {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private KingdeeApi kingdeeApi;
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @TenantIgnore
|
|
|
|
|
+ public String execute(String jsonParam) {
|
|
|
|
|
+ log.info("HuBeiKingdeeOrderAbleSyncIdJob execute param:{}", jsonParam);
|
|
|
|
|
+ Gson gson = new Gson();
|
|
|
|
|
+ JsonObject jsonObject = gson.fromJson(jsonParam, JsonObject.class);
|
|
|
|
|
+ JsonArray tenantIds = jsonObject.getAsJsonArray("tenantIds");
|
|
|
|
|
+ if (tenantIds == null) {
|
|
|
|
|
+ return "参数错误,tenantIds为空!";
|
|
|
|
|
+ }
|
|
|
|
|
+ String billingMonth = YearMonth.now().plusMonths(-1).toString();
|
|
|
|
|
+ StringBuilder msg = new StringBuilder();
|
|
|
|
|
+ for (JsonElement tenantId : tenantIds) {
|
|
|
|
|
+ // 应收单
|
|
|
|
|
+ Integer syncCount = kingdeeApi.syncArReceivable(tenantId.getAsLong(), billingMonth);
|
|
|
|
|
+ msg.append(String.format("租户{}同步金蝶用户账单数量{}", tenantId.getAsLong(), syncCount)).append("\n");
|
|
|
|
|
+ }
|
|
|
|
|
+ return msg.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|