Browse Source

批量工具

yumeng 5 years ago
parent
commit
ae71f74b6e

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -172,7 +172,7 @@ public class UserAllocationController {
             if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
             }
-
+            queryWrapper.orderByDesc("create_time");
             List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
             result.setSuccess(true);
             result.setResult(userAllocations);

+ 0 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -142,7 +142,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                             jsonObject.remove("materialName");
                             url = "https:" + url;
                             String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
-                            //  String localPath = LoadFileUtil.downLoadFromUrl(url, "D:\\tets1\\image");
                             String md5 = LoadFileUtil.getMD5(localPath);
                             jsonObject.put("code", md5);
                             LoadFileUtil.delFile(localPath);
@@ -153,7 +152,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                                 fileNameStr = split[0];
                             }
                             jsonObject.put("materialName", AesEncryptUtil.getUrlDecoderString(fileNameStr));
-
                             insertMaterialInfo(url, type, jsonObject);
                         }
 

+ 137 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/BigDecimalUtil.java

@@ -0,0 +1,137 @@
+package cn.com.ctop.common.module.utils;
+
+import java.math.BigDecimal;
+
+public class BigDecimalUtil {
+
+    /**
+     * 想加
+     *
+     * @param v1
+     * @param v2
+     * @return
+     */
+    public static BigDecimal addBigDecimal(BigDecimal v1, BigDecimal v2) {
+        BigDecimal add_result = v1.add(v2);
+        return add_result;
+    }
+
+
+    /**
+     * 相减
+     *
+     * @param v1
+     * @param v2
+     * @return
+     */
+    public static BigDecimal subtractBigDecimal(BigDecimal v1, BigDecimal v2) {
+        BigDecimal subtract_result = v1.subtract(v2);
+        return subtract_result;
+    }
+
+
+    /**
+     * 相乘
+     *
+     * @param v1
+     * @param v2
+     * @return
+     */
+    public static BigDecimal multiplyBigDecimal(BigDecimal v1, BigDecimal v2) {
+        BigDecimal multiply_result = v1.multiply(v2);
+        return multiply_result;
+    }
+
+
+    /**
+     * 相除
+     *
+     * @param v1
+     * @param v2
+     * @return
+     */
+    public static BigDecimal divideBigDecimal(BigDecimal v1, BigDecimal v2) {
+        BigDecimal divide_result = v1.divide(v2);
+        return divide_result;
+    }
+
+
+    /**
+     * 余数
+     *
+     * @param v1
+     * @param v2
+     * @return
+     */
+    public static BigDecimal remainderDecimal(BigDecimal v1, BigDecimal v2) {
+        BigDecimal remainder_result = v1.remainder(v2);
+        return remainder_result;
+    }
+
+    /**
+     * 最大数
+     *
+     * @param v1
+     * @param v2
+     * @return
+     */
+
+    public static BigDecimal maxBigDecimal(BigDecimal v1, BigDecimal v2) {
+        BigDecimal max_result = v1.max(v2);
+        return max_result;
+    }
+
+    /**
+     * 最小数
+     *
+     * @param v1
+     * @param v2
+     * @return
+     */
+
+    public static BigDecimal minBigDecimal(BigDecimal v1, BigDecimal v2) {
+        BigDecimal min_result = v1.min(v2);
+        return min_result;
+    }
+
+    /**
+     * 绝对值
+     *
+     * @param v
+     * @return
+     */
+    public static BigDecimal absBigDecimal(BigDecimal v) {
+        BigDecimal abs_result = v.abs();
+        return abs_result;
+
+
+    }
+
+
+    /**
+     * 相反数
+     *
+     * @param v
+     * @return
+     */
+    public static BigDecimal negateBigDecimal(BigDecimal v) {
+        BigDecimal negate_result = v.negate();
+        return negate_result;
+
+    }
+
+
+    /**
+     * 比较大小
+     *
+     * @param v1
+     * @param v2
+     * @return
+     */
+    public static int compareToDecimal(BigDecimal v1, BigDecimal v2) {
+        int i = v1.compareTo(v2);
+        return i;
+
+    }
+
+}

+ 252 - 78
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
@@ -69,6 +70,12 @@ public class BatchController {
     private IKuaiShouAppInfoService appInfoService;
     @Autowired
     private IKuaiShouGroupTargetService targetService;
+    @Autowired
+    private IKuaiShouRegionListParentService regionListParentService;
+    @Autowired
+    private IKuaiShouImageGetService imageGetService;
+    @Autowired
+    private IKuaiShouVideoGetService videoGetService;
 
 
     /**
@@ -143,8 +150,6 @@ public class BatchController {
     @PostMapping(value = "/batchUpdateStatus")
     public Result<JSONObject> batchUpdateStatus(@RequestBody JSONObject requestJson) {
         Result<JSONObject> result = new Result<>();
-
-
         try {
             Long accountId = requestJson.getLong("accountId");
             CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
@@ -286,50 +291,9 @@ public class BatchController {
     @GetMapping(value = "/getRegion")
     public Result<List<KuaiShouRegionListParent>> getRegion(KuaiShouRegionListParent kuaiShouRegionListParent, HttpServletRequest req) {
         Result<List<KuaiShouRegionListParent>> result = new Result<>();
-
-
         try {
-            /*JSONArray regionArr = new JSONArray();
-            QueryWrapper<KuaiShouRegionListParent> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("level", 1);
-            List<KuaiShouRegionListParent> regionListParents = regionListParentMapper.selectList(queryWrapper);
-            if (!Check.isNull(regionListParents)) {
-
-                for (KuaiShouRegionListParent regionListParent : regionListParents) {
-                    if (Check.isNull(regionListParent)) {
-                        continue;
-                    }
-                    JSONObject parentJson = new JSONObject();
-                    Long regionId = regionListParent.getRegionId();
-                    parentJson.put("regionId", regionId);
-                    parentJson.put("name", regionListParent.getName());
-                    QueryWrapper<KuaiShouRegionListParent> childrenQueryWrapper = new QueryWrapper<>();
-                    childrenQueryWrapper.eq("parent", regionId);
-                    List<KuaiShouRegionListParent> childrenRegions = regionListParentMapper.selectList(childrenQueryWrapper);
-
-                    JSONArray childrenArr = new JSONArray();
-                    if (!Check.isNull(childrenRegions)) {
-                        for (KuaiShouRegionListParent childrenRegion : childrenRegions) {
-                            if (!Check.isNull(childrenRegion)) {
-                                JSONObject childrenJson = new JSONObject();
-                                childrenJson.put("regionId", childrenRegion.getRegionId());
-                                childrenJson.put("name", childrenRegion.getName());
-                                childrenArr.add(childrenJson);
-                            }
-                        }
-                        parentJson.put("children", childrenArr);
-
-                    }
-
-                    regionArr.add(parentJson);
-                }
-            }*/
-
-
             QueryWrapper<KuaiShouRegionListParent> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouRegionListParent, req.getParameterMap());
-
             List<KuaiShouRegionListParent> pageList = kuaiShouRegionListParentService.list(queryWrapper);
-
             result.setSuccess(true);
             result.setResult(pageList);
         } catch (Exception e) {
@@ -388,7 +352,6 @@ public class BatchController {
         try {
             QueryWrapper<KuaiShouAppList> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppList, req.getParameterMap());
             queryWrapper.orderByDesc("return_time");
-
             List<KuaiShouAppList> appList = kuaiShouAppListService.list(queryWrapper);
             result.setSuccess(true);
             result.setResult(appList);
@@ -471,7 +434,6 @@ public class BatchController {
             if (Check.isNull(deepConversionJson)) {
                 throw new Exception("深度类型数据返回为空");
             }
-
             result.setSuccess(true);
             result.setResult(deepConversionJson);
         } catch (Exception e) {
@@ -510,7 +472,6 @@ public class BatchController {
         }
 
         return result;
-
     }
 
     /**
@@ -615,7 +576,6 @@ public class BatchController {
     public Result<IPage<KuaiShouCreative>> getCreativeList(KuaiShouCreative kuaiShouCreative, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
         Result<IPage<KuaiShouCreative>> result = new Result<>();
-
         QueryWrapper<KuaiShouCreative> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCreative, req.getParameterMap());
         queryWrapper.orderByDesc("creative_id");
         Page<KuaiShouCreative> page = new Page<>(pageNo, pageSize);
@@ -635,8 +595,6 @@ public class BatchController {
     @PostMapping(value = "/batchUpdateUnitBudget")
     public Result<JSONObject> batchUpdateUnitBudget(@RequestBody JSONObject requestJson) {
         Result<JSONObject> result = new Result<>();
-
-
         try {
             Long accountId = requestJson.getLong("accountId");
             CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
@@ -686,6 +644,80 @@ public class BatchController {
 
 
     /**
+     * 根据比例批量修改广告组预算
+     *
+     * @param requestJson
+     * @return
+     */
+    @PostMapping(value = "/batchUpdateUnitBudgetByProportion")
+    public Result<JSONObject> batchUpdateUnitBudgetByProportion(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("账号信息为空");
+            }
+            BigDecimal proportion = requestJson.getBigDecimal("proportion");
+            if (proportion.compareTo(new BigDecimal(0)) == 0) {
+                throw new Exception("比例不能为0");
+            }
+            String userId = requestJson.getString("userId");
+            JSONArray unitIds = requestJson.getJSONArray("unitIds");
+            JSONArray failArr = new JSONArray();
+            if (!Check.isNull(unitIds)) {
+                for (int i = 0; i < unitIds.size(); i++) {
+                    Long unitId = unitIds.getLong(i);
+                    if (!Check.isNull(unitId)) {
+                        KuaiShouGroup group = batchService.getUnitInfo(accountId, unitId);
+                        if (!Check.isNull(group)) {
+                            Long dayBudget = group.getDayBudget();
+                            if (Check.isNull(dayBudget)) {
+                                continue;
+                            }
+                            BigDecimal totalFee = new BigDecimal(dayBudget);
+
+                            Long multiply = 0L;
+                            if (proportion.compareTo(new BigDecimal(0)) == -1) {
+                                BigDecimal absBigDecimal = BigDecimalUtil.absBigDecimal(proportion);
+                                BigDecimal decimal = BigDecimalUtil.multiplyBigDecimal(totalFee, absBigDecimal);
+                                multiply = (BigDecimalUtil.subtractBigDecimal(totalFee, decimal)).longValue();
+                            } else if (proportion.compareTo(new BigDecimal(0)) == 1) {
+                                multiply = (totalFee.multiply(proportion)).longValue();
+                            }
+
+                            Map<String, Object> updateMap = updateService.updateUnitDayBudget(token.getAccessToken(), accountId, unitId, multiply, userId);
+                            if (!Check.isNull(updateMap)) {
+                                Integer code = (Integer) updateMap.get("code");
+                                if (code != 0) {
+                                    JSONObject failJson = new JSONObject();
+                                    failJson.put("message", updateMap.get("message"));
+                                    if (!Check.isNull(group)) {
+                                        failJson.put("unitName", group.getUnitName());
+                                    }
+                                    failArr.add(failJson);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            JSONObject json = new JSONObject();
+            json.put("totalCount", unitIds.size());
+            json.put("failCount", failArr.size());
+            json.put("failInfo", failArr);
+            result.setResult(json);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+    /**
      * 批量修改广告组状态
      *
      * @param requestJson
@@ -694,8 +726,6 @@ public class BatchController {
     @PostMapping(value = "/batchUpdateUnitStatus")
     public Result<JSONObject> batchUpdateUnitStatus(@RequestBody JSONObject requestJson) {
         Result<JSONObject> result = new Result<>();
-
-
         try {
             Long accountId = requestJson.getLong("accountId");
             CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
@@ -745,6 +775,83 @@ public class BatchController {
 
 
     /**
+     * 根据比列批量修改广告组出价
+     *
+     * @param requestJson
+     * @return
+     */
+    @PostMapping(value = "/batchUpdateUnitBidByProportion")
+    public Result<JSONObject> batchUpdateUnitBidByProportion(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("账号信息为空");
+            }
+            BigDecimal proportion = requestJson.getBigDecimal("proportion");
+            if (proportion.compareTo(new BigDecimal(0)) == 0) {
+                throw new Exception("比例不能为0");
+            }
+            String userId = requestJson.getString("userId");
+            JSONArray unitIds = requestJson.getJSONArray("unitIds");
+            JSONArray failArr = new JSONArray();
+            if (!Check.isNull(unitIds)) {
+                for (int i = 0; i < unitIds.size(); i++) {
+                    Long unitId = unitIds.getLong(i);
+                    if (!Check.isNull(unitId)) {
+                        KuaiShouGroup group = batchService.getUnitInfo(accountId, unitId);
+                        if (Check.isNull(group)) {
+                            continue;
+                        }
+                        Long groupBid;
+                        Long bid = group.getBid();
+                        Long cpaBid = group.getCpaBid();
+                        if (!Check.isNull(cpaBid)) {
+                            groupBid = cpaBid;
+                        } else {
+                            groupBid = bid;
+                        }
+                        BigDecimal totalFee = new BigDecimal(groupBid);
+                        Long multiply = 0L;
+                        if (proportion.compareTo(new BigDecimal(0)) == -1) {
+                            BigDecimal absBigDecimal = BigDecimalUtil.absBigDecimal(proportion);
+                            BigDecimal decimal = BigDecimalUtil.multiplyBigDecimal(totalFee, absBigDecimal);
+                            multiply = (BigDecimalUtil.subtractBigDecimal(totalFee, decimal)).longValue();
+                        } else if (proportion.compareTo(new BigDecimal(0)) == 1) {
+                            multiply = (totalFee.multiply(proportion)).longValue();
+                        }
+                        Map<String, Object> updateMap = updateService.updateUnitBid(token.getAccessToken(), accountId, unitId, multiply, userId);
+                        if (!Check.isNull(updateMap)) {
+                            Integer code = (Integer) updateMap.get("code");
+                            if (code != 0) {
+                                JSONObject failJson = new JSONObject();
+                                failJson.put("message", updateMap.get("message"));
+                                if (!Check.isNull(group)) {
+                                    failJson.put("unitName", group.getUnitName());
+                                }
+                                failArr.add(failJson);
+                            }
+                        }
+                    }
+                }
+            }
+            JSONObject json = new JSONObject();
+            json.put("totalCount", unitIds.size());
+            json.put("failCount", failArr.size());
+            json.put("failInfo", failArr);
+            result.setResult(json);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+    /**
      * 批量修改广告组状态
      *
      * @param requestJson
@@ -778,7 +885,7 @@ public class BatchController {
                                 failJson.put("message", updateMap.get("message"));
                                 KuaiShouGroup group = batchService.getUnitInfo(accountId, unitId);
                                 if (!Check.isNull(group)) {
-                                    failJson.put("campaignName", group.getUnitName());
+                                    failJson.put("unitName", group.getUnitName());
                                 }
                                 failArr.add(failJson);
                             }
@@ -822,12 +929,8 @@ public class BatchController {
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
-
         }
-
         return result;
-
-
     }
 
     /**
@@ -842,7 +945,6 @@ public class BatchController {
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
         Result<IPage<KuaiShouVideoGet>> result = new Result<IPage<KuaiShouVideoGet>>();
         try {
-
             QueryWrapper<KuaiShouVideoGet> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouVideoGet, req.getParameterMap());
             queryWrapper.orderByDesc("create_time");
             Page<KuaiShouVideoGet> page = new Page<KuaiShouVideoGet>(pageNo, pageSize);
@@ -869,7 +971,6 @@ public class BatchController {
     public Result<MaterialInfo> getVideoList(String code) {
         Result<MaterialInfo> result = new Result<>();
         try {
-
             QueryWrapper<MaterialInfo> materialInfoQueryWrapper = new QueryWrapper<>();
             materialInfoQueryWrapper.eq("code", code);
             materialInfoQueryWrapper.last("limit 1");
@@ -931,8 +1032,6 @@ public class BatchController {
             e.printStackTrace();
             result.setSuccess(false);
         }
-
-
         return result;
     }
 
@@ -1010,7 +1109,6 @@ public class BatchController {
                                                                             HttpServletRequest req) {
         Result<List<KuaiShouDirectionalTemplate>> result = new Result<>();
         QueryWrapper<KuaiShouDirectionalTemplate> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDirectionalTemplate, req.getParameterMap());
-
         List<KuaiShouDirectionalTemplate> templates = kuaiShouDirectionalTemplateService.list(queryWrapper);
         result.setSuccess(true);
         result.setResult(templates);
@@ -1022,7 +1120,6 @@ public class BatchController {
      *
      * @return
      */
-
     @PostMapping(value = "/addDirectionalTemplate")
     public Result<KuaiShouDirectionalTemplate> add(@RequestBody KuaiShouDirectionalTemplate kuaiShouDirectionalTemplate) {
         Result<KuaiShouDirectionalTemplate> result = new Result<KuaiShouDirectionalTemplate>();
@@ -1065,7 +1162,6 @@ public class BatchController {
      * @param id
      * @return
      */
-
     @DeleteMapping(value = "/deleteeditDirectionalTemplate")
     public Result<?> deleteeditDirectionalTemplate(@RequestParam(name = "id", required = true) String id) {
         try {
@@ -1085,8 +1181,6 @@ public class BatchController {
      * @param unitId
      * @return
      */
-
-
     @GetMapping(value = "/getUnitDetail")
     public Result<JSONObject> getUnitDetail(Long accountId, Long unitId) {
         Result<JSONObject> result = new Result<>();
@@ -1143,7 +1237,6 @@ public class BatchController {
             if (Check.isNull(requestJson)) {
                 throw new Exception("入参为空");
             }
-
             JSONObject campaignJson = batchService.updateCampaign(requestJson);
             result.setSuccess(true);
             result.setResult(campaignJson);
@@ -1167,13 +1260,11 @@ public class BatchController {
      */
     @PostMapping(value = "/updateUnit")
     public Result<JSONObject> updateUnit(@RequestBody JSONObject requestJson) {
-
         Result<JSONObject> result = new Result<>();
         try {
             if (Check.isNull(requestJson)) {
                 throw new Exception("入参为空");
             }
-
             JSONObject unitJson = batchService.updateUnit(requestJson);
             result.setSuccess(true);
             result.setResult(unitJson);
@@ -1187,6 +1278,57 @@ public class BatchController {
 
 
     /**
+     * 批量修改广告组定向
+     *
+     * @param requestJson
+     * @return
+     */
+    @PostMapping(value = "/batchUpdateUnit")
+    public Result<JSONObject> batchUpdateUnit(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("入参为空");
+            }
+
+            JSONArray unitIds = requestJson.getJSONArray("unitIds");
+            if (Check.isNull(unitIds)) {
+                throw new Exception("请选择需要修改的广告组");
+            }
+            JSONObject returnJson = new JSONObject();
+            JSONArray failArr = new JSONArray();
+            for (int i = 0; i < unitIds.size(); i++) {
+                Long unitId = unitIds.getLong(i);
+                requestJson.put("unitId", unitId);
+                JSONObject unitJson = batchService.updateUnit(requestJson);
+                if (!Check.isNull(unitJson)) {
+                    Integer code = unitJson.getInteger("code");
+                    if (code != 0) {
+                        JSONObject failJson = new JSONObject();
+                        failJson.put("message", unitJson.get("message"));
+                        KuaiShouGroup group = batchService.getUnitInfo(requestJson.getLong("accountId"), unitId);
+                        if (!Check.isNull(group)) {
+                            failJson.put("unitName", group.getUnitName());
+                        }
+                        failArr.add(failJson);
+                    }
+                }
+            }
+            returnJson.put("totalCount", unitIds.size());
+            returnJson.put("failCount", failArr.size());
+            returnJson.put("failInfo", failArr);
+            result.setSuccess(true);
+            result.setResult(returnJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+    /**
      * 修改广告创意
      *
      * @param requestJson
@@ -1194,13 +1336,11 @@ public class BatchController {
      */
     @PostMapping(value = "/updateCreative")
     public Result<JSONObject> updateCreative(@RequestBody JSONObject requestJson) {
-
         Result<JSONObject> result = new Result<>();
         try {
             if (Check.isNull(requestJson)) {
                 throw new Exception("入参为空");
             }
-
             JSONObject creativeJson = batchService.updateCreative(requestJson);
             result.setSuccess(true);
             result.setResult(creativeJson);
@@ -1213,9 +1353,6 @@ public class BatchController {
     }
 
 
-    @Autowired
-    private IKuaiShouVideoGetService videoGetService;
-
     /**
      * 获取视频信息
      *
@@ -1240,15 +1377,11 @@ public class BatchController {
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
-
         }
         return result;
     }
 
 
-    @Autowired
-    private IKuaiShouImageGetService imageGetService;
-
     /**
      * 获取图片信息
      *
@@ -1273,10 +1406,51 @@ public class BatchController {
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
-
         }
         return result;
     }
 
 
+    /**
+     * 获取地域信息
+     *
+     * @param requestJson
+     * @return
+     */
+    @PostMapping(value = "/getRegionDetail")
+    public Result<JSONArray> getRegionDetail(@RequestBody JSONObject requestJson) {
+        Result<JSONArray> result = new Result<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("参数错误");
+            }
+            JSONArray returnArr = new JSONArray();
+            JSONArray regionArr = requestJson.getJSONArray("regionArr");
+            if (!Check.isNull(regionArr)) {
+                for (int i = 0; i < regionArr.size(); i++) {
+                    Long regionId = regionArr.getLong(i);
+                    if (!Check.isNull(regionId)) {
+                        QueryWrapper<KuaiShouRegionListParent> regionListParentQueryWrapper = new QueryWrapper<>();
+                        regionListParentQueryWrapper.eq("region_id", regionId);
+                        regionListParentQueryWrapper.last("limit 1");
+                        KuaiShouRegionListParent region = regionListParentService.getOne(regionListParentQueryWrapper);
+                        if (!Check.isNull(region)) {
+                            JSONObject returnJson = new JSONObject();
+                            returnJson.put("value", region.getRegionId());
+                            returnJson.put("label", region.getName());
+                            returnArr.add(returnJson);
+                        }
+                    }
+                }
+            }
+            result.setSuccess(true);
+            result.setResult(returnArr);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+
+        }
+        return result;
+    }
+
 }

+ 0 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java

@@ -487,8 +487,6 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
             String creativeId = requestJson.getString("creativeId");
             String creativeName = requestJson.getString("creativeName");
             String description = requestJson.getString("description");
-
-
             params.put("advertiser_id", advertiserId);
             params.put("creative_id", creativeId);
             params.put("creative_name", creativeName);

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -1516,6 +1516,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         try {
             String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
+            System.err.println(resultJson);
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");
                 if (code == 0) {