|
@@ -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.entity.MaterialInfo;
|
|
import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
|
|
import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
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.common.module.utils.Check;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.*;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.*;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
|
|
@@ -69,6 +70,12 @@ public class BatchController {
|
|
private IKuaiShouAppInfoService appInfoService;
|
|
private IKuaiShouAppInfoService appInfoService;
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaiShouGroupTargetService targetService;
|
|
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")
|
|
@PostMapping(value = "/batchUpdateStatus")
|
|
public Result<JSONObject> batchUpdateStatus(@RequestBody JSONObject requestJson) {
|
|
public Result<JSONObject> batchUpdateStatus(@RequestBody JSONObject requestJson) {
|
|
Result<JSONObject> result = new Result<>();
|
|
Result<JSONObject> result = new Result<>();
|
|
-
|
|
|
|
-
|
|
|
|
try {
|
|
try {
|
|
Long accountId = requestJson.getLong("accountId");
|
|
Long accountId = requestJson.getLong("accountId");
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
@@ -250,6 +255,76 @@ public class BatchController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 根据比例批量修改广告计划预算
|
|
|
|
+ *
|
|
|
|
+ * @param requestJson
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @PostMapping(value = "/batchUpdateDayBudgetByProportion")
|
|
|
|
+ public Result<JSONObject> batchUpdateDayBudgetByProportion(@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 campaignIds = requestJson.getJSONArray("campaignIds");
|
|
|
|
+ JSONArray failArr = new JSONArray();
|
|
|
|
+ if (!Check.isNull(campaignIds)) {
|
|
|
|
+ for (int i = 0; i < campaignIds.size(); i++) {
|
|
|
|
+ Long campaignId = campaignIds.getLong(i);
|
|
|
|
+ if (!Check.isNull(campaignId)) {
|
|
|
|
+ KuaiShouCampaign campaign = batchService.getCampaignInfo(accountId, campaignId);
|
|
|
|
+ if (!Check.isNull(campaign)) {
|
|
|
|
+ Long dayBudget = campaign.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.updateCampaign(token.getAccessToken(), accountId, campaignId, 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"));
|
|
|
|
+ failJson.put("campaignName", campaign.getCampaignName());
|
|
|
|
+ failArr.add(failJson);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+ json.put("totalCount", campaignIds.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 kuaiShouGroup
|
|
* @param kuaiShouGroup
|
|
@@ -286,50 +361,9 @@ public class BatchController {
|
|
@GetMapping(value = "/getRegion")
|
|
@GetMapping(value = "/getRegion")
|
|
public Result<List<KuaiShouRegionListParent>> getRegion(KuaiShouRegionListParent kuaiShouRegionListParent, HttpServletRequest req) {
|
|
public Result<List<KuaiShouRegionListParent>> getRegion(KuaiShouRegionListParent kuaiShouRegionListParent, HttpServletRequest req) {
|
|
Result<List<KuaiShouRegionListParent>> result = new Result<>();
|
|
Result<List<KuaiShouRegionListParent>> result = new Result<>();
|
|
-
|
|
|
|
-
|
|
|
|
try {
|
|
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());
|
|
QueryWrapper<KuaiShouRegionListParent> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouRegionListParent, req.getParameterMap());
|
|
-
|
|
|
|
List<KuaiShouRegionListParent> pageList = kuaiShouRegionListParentService.list(queryWrapper);
|
|
List<KuaiShouRegionListParent> pageList = kuaiShouRegionListParentService.list(queryWrapper);
|
|
-
|
|
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
result.setResult(pageList);
|
|
result.setResult(pageList);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -388,7 +422,6 @@ public class BatchController {
|
|
try {
|
|
try {
|
|
QueryWrapper<KuaiShouAppList> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppList, req.getParameterMap());
|
|
QueryWrapper<KuaiShouAppList> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppList, req.getParameterMap());
|
|
queryWrapper.orderByDesc("return_time");
|
|
queryWrapper.orderByDesc("return_time");
|
|
-
|
|
|
|
List<KuaiShouAppList> appList = kuaiShouAppListService.list(queryWrapper);
|
|
List<KuaiShouAppList> appList = kuaiShouAppListService.list(queryWrapper);
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
result.setResult(appList);
|
|
result.setResult(appList);
|
|
@@ -471,7 +504,6 @@ public class BatchController {
|
|
if (Check.isNull(deepConversionJson)) {
|
|
if (Check.isNull(deepConversionJson)) {
|
|
throw new Exception("深度类型数据返回为空");
|
|
throw new Exception("深度类型数据返回为空");
|
|
}
|
|
}
|
|
-
|
|
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
result.setResult(deepConversionJson);
|
|
result.setResult(deepConversionJson);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -510,7 +542,6 @@ public class BatchController {
|
|
}
|
|
}
|
|
|
|
|
|
return result;
|
|
return result;
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -615,7 +646,6 @@ public class BatchController {
|
|
public Result<IPage<KuaiShouCreative>> getCreativeList(KuaiShouCreative kuaiShouCreative, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
public Result<IPage<KuaiShouCreative>> getCreativeList(KuaiShouCreative kuaiShouCreative, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
|
Result<IPage<KuaiShouCreative>> result = new Result<>();
|
|
Result<IPage<KuaiShouCreative>> result = new Result<>();
|
|
-
|
|
|
|
QueryWrapper<KuaiShouCreative> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCreative, req.getParameterMap());
|
|
QueryWrapper<KuaiShouCreative> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCreative, req.getParameterMap());
|
|
queryWrapper.orderByDesc("creative_id");
|
|
queryWrapper.orderByDesc("creative_id");
|
|
Page<KuaiShouCreative> page = new Page<>(pageNo, pageSize);
|
|
Page<KuaiShouCreative> page = new Page<>(pageNo, pageSize);
|
|
@@ -635,8 +665,6 @@ public class BatchController {
|
|
@PostMapping(value = "/batchUpdateUnitBudget")
|
|
@PostMapping(value = "/batchUpdateUnitBudget")
|
|
public Result<JSONObject> batchUpdateUnitBudget(@RequestBody JSONObject requestJson) {
|
|
public Result<JSONObject> batchUpdateUnitBudget(@RequestBody JSONObject requestJson) {
|
|
Result<JSONObject> result = new Result<>();
|
|
Result<JSONObject> result = new Result<>();
|
|
-
|
|
|
|
-
|
|
|
|
try {
|
|
try {
|
|
Long accountId = requestJson.getLong("accountId");
|
|
Long accountId = requestJson.getLong("accountId");
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
@@ -686,6 +714,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
|
|
* @param requestJson
|
|
@@ -694,8 +796,6 @@ public class BatchController {
|
|
@PostMapping(value = "/batchUpdateUnitStatus")
|
|
@PostMapping(value = "/batchUpdateUnitStatus")
|
|
public Result<JSONObject> batchUpdateUnitStatus(@RequestBody JSONObject requestJson) {
|
|
public Result<JSONObject> batchUpdateUnitStatus(@RequestBody JSONObject requestJson) {
|
|
Result<JSONObject> result = new Result<>();
|
|
Result<JSONObject> result = new Result<>();
|
|
-
|
|
|
|
-
|
|
|
|
try {
|
|
try {
|
|
Long accountId = requestJson.getLong("accountId");
|
|
Long accountId = requestJson.getLong("accountId");
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
@@ -745,6 +845,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
|
|
* @param requestJson
|
|
@@ -778,7 +955,7 @@ public class BatchController {
|
|
failJson.put("message", updateMap.get("message"));
|
|
failJson.put("message", updateMap.get("message"));
|
|
KuaiShouGroup group = batchService.getUnitInfo(accountId, unitId);
|
|
KuaiShouGroup group = batchService.getUnitInfo(accountId, unitId);
|
|
if (!Check.isNull(group)) {
|
|
if (!Check.isNull(group)) {
|
|
- failJson.put("campaignName", group.getUnitName());
|
|
|
|
|
|
+ failJson.put("unitName", group.getUnitName());
|
|
}
|
|
}
|
|
failArr.add(failJson);
|
|
failArr.add(failJson);
|
|
}
|
|
}
|
|
@@ -822,12 +999,8 @@ public class BatchController {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
result.setSuccess(false);
|
|
result.setSuccess(false);
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
return result;
|
|
return result;
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -842,7 +1015,6 @@ public class BatchController {
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
|
Result<IPage<KuaiShouVideoGet>> result = new Result<IPage<KuaiShouVideoGet>>();
|
|
Result<IPage<KuaiShouVideoGet>> result = new Result<IPage<KuaiShouVideoGet>>();
|
|
try {
|
|
try {
|
|
-
|
|
|
|
QueryWrapper<KuaiShouVideoGet> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouVideoGet, req.getParameterMap());
|
|
QueryWrapper<KuaiShouVideoGet> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouVideoGet, req.getParameterMap());
|
|
queryWrapper.orderByDesc("create_time");
|
|
queryWrapper.orderByDesc("create_time");
|
|
Page<KuaiShouVideoGet> page = new Page<KuaiShouVideoGet>(pageNo, pageSize);
|
|
Page<KuaiShouVideoGet> page = new Page<KuaiShouVideoGet>(pageNo, pageSize);
|
|
@@ -869,7 +1041,6 @@ public class BatchController {
|
|
public Result<MaterialInfo> getVideoList(String code) {
|
|
public Result<MaterialInfo> getVideoList(String code) {
|
|
Result<MaterialInfo> result = new Result<>();
|
|
Result<MaterialInfo> result = new Result<>();
|
|
try {
|
|
try {
|
|
-
|
|
|
|
QueryWrapper<MaterialInfo> materialInfoQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<MaterialInfo> materialInfoQueryWrapper = new QueryWrapper<>();
|
|
materialInfoQueryWrapper.eq("code", code);
|
|
materialInfoQueryWrapper.eq("code", code);
|
|
materialInfoQueryWrapper.last("limit 1");
|
|
materialInfoQueryWrapper.last("limit 1");
|
|
@@ -931,8 +1102,6 @@ public class BatchController {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
result.setSuccess(false);
|
|
result.setSuccess(false);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1010,7 +1179,6 @@ public class BatchController {
|
|
HttpServletRequest req) {
|
|
HttpServletRequest req) {
|
|
Result<List<KuaiShouDirectionalTemplate>> result = new Result<>();
|
|
Result<List<KuaiShouDirectionalTemplate>> result = new Result<>();
|
|
QueryWrapper<KuaiShouDirectionalTemplate> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDirectionalTemplate, req.getParameterMap());
|
|
QueryWrapper<KuaiShouDirectionalTemplate> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouDirectionalTemplate, req.getParameterMap());
|
|
-
|
|
|
|
List<KuaiShouDirectionalTemplate> templates = kuaiShouDirectionalTemplateService.list(queryWrapper);
|
|
List<KuaiShouDirectionalTemplate> templates = kuaiShouDirectionalTemplateService.list(queryWrapper);
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
result.setResult(templates);
|
|
result.setResult(templates);
|
|
@@ -1022,7 +1190,6 @@ public class BatchController {
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
-
|
|
|
|
@PostMapping(value = "/addDirectionalTemplate")
|
|
@PostMapping(value = "/addDirectionalTemplate")
|
|
public Result<KuaiShouDirectionalTemplate> add(@RequestBody KuaiShouDirectionalTemplate kuaiShouDirectionalTemplate) {
|
|
public Result<KuaiShouDirectionalTemplate> add(@RequestBody KuaiShouDirectionalTemplate kuaiShouDirectionalTemplate) {
|
|
Result<KuaiShouDirectionalTemplate> result = new Result<KuaiShouDirectionalTemplate>();
|
|
Result<KuaiShouDirectionalTemplate> result = new Result<KuaiShouDirectionalTemplate>();
|
|
@@ -1065,9 +1232,8 @@ public class BatchController {
|
|
* @param id
|
|
* @param id
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
-
|
|
|
|
- @DeleteMapping(value = "/deleteeditDirectionalTemplate")
|
|
|
|
- public Result<?> deleteeditDirectionalTemplate(@RequestParam(name = "id", required = true) String id) {
|
|
|
|
|
|
+ @DeleteMapping(value = "/deleteDirectionalTemplate")
|
|
|
|
+ public Result<?> deleteDirectionalTemplate(@RequestParam(name = "id", required = true) String id) {
|
|
try {
|
|
try {
|
|
kuaiShouDirectionalTemplateService.removeById(id);
|
|
kuaiShouDirectionalTemplateService.removeById(id);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -1085,8 +1251,6 @@ public class BatchController {
|
|
* @param unitId
|
|
* @param unitId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
-
|
|
|
|
-
|
|
|
|
@GetMapping(value = "/getUnitDetail")
|
|
@GetMapping(value = "/getUnitDetail")
|
|
public Result<JSONObject> getUnitDetail(Long accountId, Long unitId) {
|
|
public Result<JSONObject> getUnitDetail(Long accountId, Long unitId) {
|
|
Result<JSONObject> result = new Result<>();
|
|
Result<JSONObject> result = new Result<>();
|
|
@@ -1143,7 +1307,6 @@ public class BatchController {
|
|
if (Check.isNull(requestJson)) {
|
|
if (Check.isNull(requestJson)) {
|
|
throw new Exception("入参为空");
|
|
throw new Exception("入参为空");
|
|
}
|
|
}
|
|
-
|
|
|
|
JSONObject campaignJson = batchService.updateCampaign(requestJson);
|
|
JSONObject campaignJson = batchService.updateCampaign(requestJson);
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
result.setResult(campaignJson);
|
|
result.setResult(campaignJson);
|
|
@@ -1167,13 +1330,11 @@ public class BatchController {
|
|
*/
|
|
*/
|
|
@PostMapping(value = "/updateUnit")
|
|
@PostMapping(value = "/updateUnit")
|
|
public Result<JSONObject> updateUnit(@RequestBody JSONObject requestJson) {
|
|
public Result<JSONObject> updateUnit(@RequestBody JSONObject requestJson) {
|
|
-
|
|
|
|
Result<JSONObject> result = new Result<>();
|
|
Result<JSONObject> result = new Result<>();
|
|
try {
|
|
try {
|
|
if (Check.isNull(requestJson)) {
|
|
if (Check.isNull(requestJson)) {
|
|
throw new Exception("入参为空");
|
|
throw new Exception("入参为空");
|
|
}
|
|
}
|
|
-
|
|
|
|
JSONObject unitJson = batchService.updateUnit(requestJson);
|
|
JSONObject unitJson = batchService.updateUnit(requestJson);
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
result.setResult(unitJson);
|
|
result.setResult(unitJson);
|
|
@@ -1187,6 +1348,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
|
|
* @param requestJson
|
|
@@ -1194,13 +1406,11 @@ public class BatchController {
|
|
*/
|
|
*/
|
|
@PostMapping(value = "/updateCreative")
|
|
@PostMapping(value = "/updateCreative")
|
|
public Result<JSONObject> updateCreative(@RequestBody JSONObject requestJson) {
|
|
public Result<JSONObject> updateCreative(@RequestBody JSONObject requestJson) {
|
|
-
|
|
|
|
Result<JSONObject> result = new Result<>();
|
|
Result<JSONObject> result = new Result<>();
|
|
try {
|
|
try {
|
|
if (Check.isNull(requestJson)) {
|
|
if (Check.isNull(requestJson)) {
|
|
throw new Exception("入参为空");
|
|
throw new Exception("入参为空");
|
|
}
|
|
}
|
|
-
|
|
|
|
JSONObject creativeJson = batchService.updateCreative(requestJson);
|
|
JSONObject creativeJson = batchService.updateCreative(requestJson);
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
result.setResult(creativeJson);
|
|
result.setResult(creativeJson);
|
|
@@ -1213,9 +1423,6 @@ public class BatchController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private IKuaiShouVideoGetService videoGetService;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 获取视频信息
|
|
* 获取视频信息
|
|
*
|
|
*
|
|
@@ -1240,15 +1447,11 @@ public class BatchController {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
result.setSuccess(false);
|
|
result.setSuccess(false);
|
|
-
|
|
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private IKuaiShouImageGetService imageGetService;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 获取图片信息
|
|
* 获取图片信息
|
|
*
|
|
*
|
|
@@ -1273,10 +1476,51 @@ public class BatchController {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
result.setSuccess(false);
|
|
result.setSuccess(false);
|
|
-
|
|
|
|
}
|
|
}
|
|
return result;
|
|
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;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|