소스 검색

定时同步物料功能

zhaoxian 4 년 전
부모
커밋
f77d52f5ee
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

+ 7 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -162,6 +162,10 @@ public class CallbackController {
                     BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
                     BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
                     String systemType = json.getString("systemType");
+                    Integer autoDelivery = json.getInteger("autoDelivery");
+                    String materialTypeStr = json.getString("materialType");
+                    //物料类型,0-不同步,1应用包,(2人群包,3定向包)
+                    JSONArray materialTypeArr = json.getJSONArray("materialType");
 
                     CtopOauthToken topOauthToken = new CtopOauthToken();
                     topOauthToken.setId(String.valueOf(accountId));
@@ -208,19 +212,18 @@ public class CallbackController {
                     userAllocation.setCreateTime(new Date());
                     userAllocation.setUpdateTime(new Date());
                     //自动投放,0关闭,1开启
-                    userAllocation.setAutoDelivery(json.getInteger("autoDelivery"));
-                    userAllocation.setMaterialType(json.getString("materialType"));
+                    userAllocation.setAutoDelivery(autoDelivery);
+                    userAllocation.setMaterialType(materialTypeStr);
                     allocationMapper.deleteById(userAllocation.getId());
                     Map<String, Object> deleteUserMap = new HashMap<>();
                     deleteUserMap.put("advertiser_id", advertiserId);
                     deleteUserMap.put("account_id", accountId);
                     allocationMapper.deleteByMap(deleteUserMap);
+                    log.info("待创建账户信息:{}", userAllocation.toString());
                     int i = allocationMapper.insert(userAllocation);
                     if (i > 0) {
                         log.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
                     }
-                    //物料类型,0-不同步,1应用包,(2人群包,3定向包)
-                    JSONArray materialTypeArr = json.getJSONArray("materialType");
                     Integer materialType = materialTypeArr.getInteger(0);
                     //账号绑定
                     bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiserId);