|
@@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -250,6 +251,7 @@ public class BatchController {
|
|
|
HttpServletRequest req) {
|
|
|
Result<IPage<KuaiShouGroup>> result = new Result<IPage<KuaiShouGroup>>();
|
|
|
QueryWrapper<KuaiShouGroup> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroup, req.getParameterMap());
|
|
|
+ queryWrapper.orderByDesc("unit_id");
|
|
|
Page<KuaiShouGroup> page = new Page<KuaiShouGroup>(pageNo, pageSize);
|
|
|
IPage<KuaiShouGroup> pageList = kuaiShouGroupService.page(page, queryWrapper);
|
|
|
result.setSuccess(true);
|
|
@@ -264,12 +266,16 @@ public class BatchController {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouRegionListParentService kuaiShouRegionListParentService;
|
|
|
+
|
|
|
@GetMapping(value = "/getRegion")
|
|
|
- public Result<JSONArray> getRegion() {
|
|
|
- Result<JSONArray> result = new Result<>();
|
|
|
+ public Result<List<KuaiShouRegionListParent>> getRegion(KuaiShouRegionListParent kuaiShouRegionListParent, HttpServletRequest req) {
|
|
|
+ Result<List<KuaiShouRegionListParent>> result = new Result<>();
|
|
|
+
|
|
|
|
|
|
try {
|
|
|
- JSONArray regionArr = new JSONArray();
|
|
|
+ /*JSONArray regionArr = new JSONArray();
|
|
|
QueryWrapper<KuaiShouRegionListParent> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("level", 1);
|
|
|
List<KuaiShouRegionListParent> regionListParents = regionListParentMapper.selectList(queryWrapper);
|
|
@@ -303,10 +309,15 @@ public class BatchController {
|
|
|
|
|
|
regionArr.add(parentJson);
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
+
|
|
|
+ QueryWrapper<KuaiShouRegionListParent> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouRegionListParent, req.getParameterMap());
|
|
|
+
|
|
|
+ List<KuaiShouRegionListParent> pageList = kuaiShouRegionListParentService.list(queryWrapper);
|
|
|
|
|
|
result.setSuccess(true);
|
|
|
- result.setResult(regionArr);
|
|
|
+ result.setResult(pageList);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
result.setSuccess(false);
|
|
@@ -577,4 +588,199 @@ public class BatchController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouCreativeService kuaiShouCreativeService;
|
|
|
+
|
|
|
+
|
|
|
+ @AutoLog(value = "快手-创意信息-分页列表查询")
|
|
|
+ @GetMapping(value = "/getCreativeList")
|
|
|
+ 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);
|
|
|
+ IPage<KuaiShouCreative> creativeList = kuaiShouCreativeService.page(page, queryWrapper);
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setResult(creativeList);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量修改广告组预算
|
|
|
+ *
|
|
|
+ * @param requestJson
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @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);
|
|
|
+ if (Check.isNull(token)) {
|
|
|
+ throw new Exception("账号信息为空");
|
|
|
+ }
|
|
|
+ Long dayBudget = requestJson.getLong("dayBudget");
|
|
|
+ if (Check.isNull(dayBudget)) {
|
|
|
+ throw new Exception("预算信息为空");
|
|
|
+ }
|
|
|
+ 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)) {
|
|
|
+ Map<String, Object> updateMap = updateService.updateUnitDayBudget(token.getAccessToken(), accountId, unitId, dayBudget, userId);
|
|
|
+ if (!Check.isNull(updateMap)) {
|
|
|
+ Integer code = (Integer) updateMap.get("code");
|
|
|
+ if (code != 0) {
|
|
|
+ JSONObject failJson = new JSONObject();
|
|
|
+ failJson.put("message", updateMap.get("message"));
|
|
|
+ KuaiShouGroup group = batchService.getUnitInfo(accountId, unitId);
|
|
|
+ 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
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @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);
|
|
|
+ if (Check.isNull(token)) {
|
|
|
+ throw new Exception("账号信息为空");
|
|
|
+ }
|
|
|
+ Integer putStatus = requestJson.getInteger("putStatus");
|
|
|
+ if (putStatus == null) {
|
|
|
+ throw new Exception("请选择状态");
|
|
|
+ }
|
|
|
+ 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)) {
|
|
|
+ Map<String, Object> updateMap = updateService.updateUnitStatus(token.getAccessToken(), accountId, unitId, putStatus, userId);
|
|
|
+ if (!Check.isNull(updateMap)) {
|
|
|
+ Integer code = (Integer) updateMap.get("code");
|
|
|
+ if (code != 0) {
|
|
|
+ JSONObject failJson = new JSONObject();
|
|
|
+ failJson.put("message", updateMap.get("message"));
|
|
|
+ KuaiShouGroup group = batchService.getUnitInfo(accountId, unitId);
|
|
|
+ if (!Check.isNull(group)) {
|
|
|
+ failJson.put("campaignName", 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
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/batchUpdateUnitBid")
|
|
|
+ public Result<JSONObject> batchUpdateUnitBid(@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("账号信息为空");
|
|
|
+ }
|
|
|
+ Long bid = requestJson.getLong("bid");
|
|
|
+ if (bid == null) {
|
|
|
+ throw new Exception("请输入出价");
|
|
|
+ }
|
|
|
+ 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)) {
|
|
|
+ Map<String, Object> updateMap = updateService.updateUnitBid(token.getAccessToken(), accountId, unitId, bid, userId);
|
|
|
+ if (!Check.isNull(updateMap)) {
|
|
|
+ Integer code = (Integer) updateMap.get("code");
|
|
|
+ if (code != 0) {
|
|
|
+ JSONObject failJson = new JSONObject();
|
|
|
+ failJson.put("message", updateMap.get("message"));
|
|
|
+ KuaiShouGroup group = batchService.getUnitInfo(accountId, unitId);
|
|
|
+ if (!Check.isNull(group)) {
|
|
|
+ failJson.put("campaignName", 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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|