|
@@ -1,43 +1,47 @@
|
|
package cn.com.ctop.kuaishou.modules.ai.controller;
|
|
package cn.com.ctop.kuaishou.modules.ai.controller;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.io.IOException;
|
|
|
|
-import java.io.UnsupportedEncodingException;
|
|
|
|
-import java.net.URLDecoder;
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
-
|
|
|
|
|
|
+import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
|
+import cn.com.ctop.common.module.utils.QueryGenerator;
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouVideoDirectionalPackage;
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouVideoDirectionalPackage;
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouVideoDirectionalPackageService;
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouVideoDirectionalPackageService;
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
-import org.jeecg.common.api.vo.Result;
|
|
|
|
-import cn.com.ctop.common.module.utils.QueryGenerator;
|
|
|
|
-import org.jeecg.common.util.oConvertUtils;
|
|
|
|
-
|
|
|
|
-import java.util.Date;
|
|
|
|
-
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-
|
|
|
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
|
+import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
-
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
|
+import java.net.URLDecoder;
|
|
|
|
+import java.util.Arrays;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 素材绑定的定向包模板
|
|
* 素材绑定的定向包模板
|
|
@@ -49,7 +53,7 @@ import io.swagger.annotations.ApiOperation;
|
|
@Slf4j
|
|
@Slf4j
|
|
@Api(tags = "素材绑定的定向包模板")
|
|
@Api(tags = "素材绑定的定向包模板")
|
|
@RestController
|
|
@RestController
|
|
-@RequestMapping("/kuais/kuaishouVideoDirectionalPackage")
|
|
|
|
|
|
+@RequestMapping("/kuaishouVideoDirectionalPackage")
|
|
public class KuaishouVideoDirectionalPackageController {
|
|
public class KuaishouVideoDirectionalPackageController {
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaishouVideoDirectionalPackageService kuaishouVideoDirectionalPackageService;
|
|
private IKuaishouVideoDirectionalPackageService kuaishouVideoDirectionalPackageService;
|
|
@@ -78,27 +82,45 @@ public class KuaishouVideoDirectionalPackageController {
|
|
result.setResult(pageList);
|
|
result.setResult(pageList);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
- /**
|
|
|
|
- * 创建定向包
|
|
|
|
- *
|
|
|
|
- * @param
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @PostMapping(value = "/createDirectionalPackage")
|
|
|
|
- public Result<Object> createDirectionalPackage(@RequestBody JSONObject requestJson) {
|
|
|
|
- Result<JSONObject> result = new Result<>();
|
|
|
|
- try {
|
|
|
|
- Long accountId = requestJson.getLong("projectId");
|
|
|
|
- if (Check.isNull(accountId)) {
|
|
|
|
- return Result.error("请选择账户id");
|
|
|
|
- }
|
|
|
|
-// return kuaishouVideoDirectionalPackageService.saveOrUpdate(null);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("创建定向包失败", e);
|
|
|
|
- return Result.error("创建失败" + e.getMessage());
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 创建定向包
|
|
|
|
+ *
|
|
|
|
+ * @param
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @PostMapping(value = "/saveOrUpdate")
|
|
|
|
+ public Result<Object> saveOrUpdate(@RequestBody JSONObject requestJson) {
|
|
|
|
+ Result<JSONObject> result = new Result<>();
|
|
|
|
+ try {
|
|
|
|
+ String videoGetId = requestJson.getString("videoGetId");
|
|
|
|
+ if (Check.isNull(videoGetId)) {
|
|
|
|
+ return Result.error("请选择素材");
|
|
|
|
+ }
|
|
|
|
+ KuaishouVideoDirectionalPackage directionalPackage = JSONObject.toJavaObject(requestJson, KuaishouVideoDirectionalPackage.class);
|
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("keyword"))) {
|
|
|
|
+ directionalPackage.setKeyword(JSONObject.toJSONString(requestJson.getJSONArray("keyword")));
|
|
|
|
+ }
|
|
|
|
+ kuaishouVideoDirectionalPackageService.saveOrUpdate(directionalPackage);
|
|
|
|
+ String id = "";
|
|
|
|
+ if (!Check.isNull(directionalPackage.getId())) {
|
|
|
|
+ id = directionalPackage.getId();
|
|
|
|
+ } else {
|
|
|
|
+ QueryWrapper<KuaishouVideoDirectionalPackage> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("video_get_id", videoGetId);
|
|
|
|
+ queryWrapper.eq("signature", directionalPackage.getSignature());
|
|
|
|
+ KuaishouVideoDirectionalPackage one = kuaishouVideoDirectionalPackageService.getOne(queryWrapper);
|
|
|
|
+ if(!Check.isNull(one)){
|
|
|
|
+ id = one.getId();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return Result.ok(id);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("创建定向包失败", e);
|
|
|
|
+ return Result.error("创建失败" + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 编辑
|
|
* 编辑
|
|
*
|
|
*
|
|
@@ -180,6 +202,32 @@ public class KuaishouVideoDirectionalPackageController {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 查询素材定向
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @GetMapping(value = "/queryDirctional")
|
|
|
|
+ public Result<Object> queryDirctional(String id) {
|
|
|
|
+ if (Check.isNull(id)) {
|
|
|
|
+ return Result.error("缺失参数");
|
|
|
|
+ }
|
|
|
|
+ Result<KuaishouVideoDirectionalPackage> result = new Result<>();
|
|
|
|
+ QueryWrapper<KuaishouVideoDirectionalPackage> advertiserQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ advertiserQueryWrapper.eq("video_get_id", id);
|
|
|
|
+ KuaishouVideoDirectionalPackage kuaishouVideoDirectionalPackage = kuaishouVideoDirectionalPackageService.getOne(advertiserQueryWrapper);
|
|
|
|
+ if (kuaishouVideoDirectionalPackage == null) {
|
|
|
|
+ return Result.ok("该素材未配置定向");
|
|
|
|
+ } else {
|
|
|
|
+ JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(kuaishouVideoDirectionalPackage)).toJavaObject(JSONObject.class);
|
|
|
|
+ if (!Check.isNull(data.getString("keyword"))) {
|
|
|
|
+ data.put("keyword", data.getJSONArray("keyword"));
|
|
|
|
+ }
|
|
|
|
+ return Result.ok(data);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 导出excel
|
|
* 导出excel
|
|
*
|
|
*
|
|
* @param request
|
|
* @param request
|