|
@@ -1,6 +1,7 @@
|
|
package cn.com.ctop.kuaishou.modules.batch.controller;
|
|
package cn.com.ctop.kuaishou.modules.batch.controller;
|
|
|
|
|
|
import cn.com.ctop.common.module.annotation.AutoLog;
|
|
import cn.com.ctop.common.module.annotation.AutoLog;
|
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchCampaignTemplateService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchCampaignTemplateService;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -90,17 +91,30 @@ public class KuaiShouBatchCampaignTemplateController {
|
|
*/
|
|
*/
|
|
@AutoLog(value = "计划模板-编辑")
|
|
@AutoLog(value = "计划模板-编辑")
|
|
@ApiOperation(value = "计划模板-编辑", notes = "计划模板-编辑")
|
|
@ApiOperation(value = "计划模板-编辑", notes = "计划模板-编辑")
|
|
- @PutMapping(value = "/edit")
|
|
|
|
|
|
+ @PostMapping(value = "/saveOrUpdate")
|
|
public Result<KuaiShouBatchCampaignTemplate> edit(@RequestBody KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplate) {
|
|
public Result<KuaiShouBatchCampaignTemplate> edit(@RequestBody KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplate) {
|
|
Result<KuaiShouBatchCampaignTemplate> result = new Result<KuaiShouBatchCampaignTemplate>();
|
|
Result<KuaiShouBatchCampaignTemplate> result = new Result<KuaiShouBatchCampaignTemplate>();
|
|
- KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchCampaignTemplateService.getById(kuaiShouBatchCampaignTemplate.getId());
|
|
|
|
- if (kuaiShouBatchCampaignTemplateEntity == null) {
|
|
|
|
- result.error500("未找到对应实体");
|
|
|
|
- } else {
|
|
|
|
- boolean ok = kuaiShouBatchCampaignTemplateService.updateById(kuaiShouBatchCampaignTemplate);
|
|
|
|
|
|
+ boolean ok;
|
|
|
|
+ try {
|
|
|
|
+ Long id = kuaiShouBatchCampaignTemplate.getId();
|
|
|
|
+ if (Check.isNull(id)) {
|
|
|
|
+ ok = kuaiShouBatchCampaignTemplateService.save(kuaiShouBatchCampaignTemplate);
|
|
|
|
+ } else {
|
|
|
|
+ KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchCampaignTemplateService.getById(kuaiShouBatchCampaignTemplate.getId());
|
|
|
|
+ if (!Check.isNull(kuaiShouBatchCampaignTemplateEntity)) {
|
|
|
|
+ ok = kuaiShouBatchCampaignTemplateService.updateById(kuaiShouBatchCampaignTemplate);
|
|
|
|
+ } else {
|
|
|
|
+ throw new Exception("未获取到账户id对应的详细信息");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (ok) {
|
|
if (ok) {
|
|
- result.success("修改成功!");
|
|
|
|
|
|
+ result.success("操作成功!");
|
|
}
|
|
}
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ result.error500(e.getMessage());
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
return result;
|
|
return result;
|