|
@@ -1,337 +0,0 @@
|
|
-package org.jeecg.modules.ctop.controller;
|
|
|
|
-
|
|
|
|
-import cn.com.ctop.common.module.entity.Advertiser;
|
|
|
|
-import cn.com.ctop.common.module.entity.Project;
|
|
|
|
-import cn.com.ctop.common.module.service.IProductService;
|
|
|
|
-import cn.com.ctop.common.module.utils.Check;
|
|
|
|
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
|
|
|
|
-
|
|
|
|
-import cn.com.ctop.common.module.vo.ProductInfoDto;
|
|
|
|
-import cn.com.ctop.common.module.vo.ProductVO;
|
|
|
|
-import cn.com.ctop.common.module.vo.ProjectVO;
|
|
|
|
-import cn.com.ctop.manage.modules.actor.entity.Actor;
|
|
|
|
-import cn.com.ctop.manage.modules.actor.entity.ActorComment;
|
|
|
|
-import cn.com.ctop.manage.modules.actor.entity.ActorPhoto;
|
|
|
|
-import cn.com.ctop.manage.modules.actor.entity.ActorVideo;
|
|
|
|
-import cn.com.ctop.manage.modules.actor.service.IActorCommentService;
|
|
|
|
-import cn.com.ctop.manage.modules.actor.service.IActorPhotoService;
|
|
|
|
-import cn.com.ctop.manage.modules.actor.service.IActorService;
|
|
|
|
-import cn.com.ctop.manage.modules.actor.service.IActorVideoService;
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
-import com.github.pagehelper.PageInfo;
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
-import org.jeecg.common.api.vo.Result;
|
|
|
|
-import org.jeecg.common.system.query.QueryGenerator;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
-
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-
|
|
|
|
-@RestController
|
|
|
|
-@Slf4j
|
|
|
|
-@RequestMapping("/ctop/product")
|
|
|
|
-public class ProductController {
|
|
|
|
- @Autowired
|
|
|
|
- private IProductService productService;
|
|
|
|
-
|
|
|
|
- //获取广告主列表
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "/advertiserList")
|
|
|
|
- public Result<List<Advertiser>> advertiserList(HttpServletRequest request,HttpServletResponse response){
|
|
|
|
- log.info("/ctop/product/advertiserList 方法开始");
|
|
|
|
- Result<List<Advertiser>> result = new Result();
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- List<Advertiser> advertiserList = productService.advertiserList();
|
|
|
|
- result.setResult(advertiserList);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("error");
|
|
|
|
- }finally{
|
|
|
|
- log.info("/ctop/product/advertiserList 方法结束");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //根据广告主id获取项目列表
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "/getProjectListByAdvertiserId")
|
|
|
|
- public Result<List<Project>> getProjectListByAdvertiserId(@RequestBody ProductInfoDto dto,
|
|
|
|
- HttpServletRequest request, HttpServletResponse response){
|
|
|
|
- log.info("/ctop/product/getProjectListByAdvertiserId 方法开始");
|
|
|
|
- Result<List<Project>> result = new Result();
|
|
|
|
- if(dto == null || dto.getAdvertiserId() ==null ){
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("advertiserId不能为空");
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- List<Project> projectList = productService.getProjectListByAdvertiserId(dto.getAdvertiserId());
|
|
|
|
- result.setResult(projectList);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("error");
|
|
|
|
- }finally{
|
|
|
|
- log.info("/ctop/product/getProjectListByAdvertiserId 方法结束");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //根据项目列表获取运营和销售的信息
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "/getSaleAndYunyingListByProjectIds")
|
|
|
|
- public Result<Map<String, Object>> getSaleAndYunyingListByProjectIds(@RequestBody ProductInfoDto dto,
|
|
|
|
- HttpServletRequest request, HttpServletResponse response){
|
|
|
|
- log.info("/ctop/product/getSaleAndYunyingListByProjectIds 方法开始");
|
|
|
|
- Result<Map<String, Object>> result = new Result();
|
|
|
|
- if(dto == null || dto.getProjectIds() ==null || dto.getProjectIds().size() ==0 ){
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("projectIds不能为空");
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- Map<String, Object> map = productService.getSaleAndYunyingListByProjectIds(dto.getProjectIds());
|
|
|
|
- result.setResult(map);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("error");
|
|
|
|
- }finally{
|
|
|
|
- log.info("/ctop/product/getSaleAndYunyingListByProjectIds 方法结束");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //逻辑删除产品
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "/deleteProduct")
|
|
|
|
- public Result deleteProduct(@RequestBody ProductInfoDto dto,HttpServletRequest request, HttpServletResponse response){
|
|
|
|
- log.info("/ctop/product/deleteProduct 方法开始");
|
|
|
|
- Result result = new Result();
|
|
|
|
- if(dto == null || dto.getProductId() ==null ){
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("productId不能为空");
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- productService.deleteProduct(dto.getProductId());
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("error");
|
|
|
|
- }finally{
|
|
|
|
- log.info("/ctop/product/deleteProduct 方法结束");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //产品信息入库
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "/insertOrUpdateProduct")
|
|
|
|
- public Result insertOrUpdateProduct(@RequestBody ProductVO vo, HttpServletRequest request, HttpServletResponse response){
|
|
|
|
- log.info("/ctop/product/insertOrUpdateProduct 方法开始");
|
|
|
|
- Result result = new Result();
|
|
|
|
-
|
|
|
|
- //if(vo==null || vo.getId() == null){
|
|
|
|
- // if(StringUtils.isBlank(vo.getProductName())){
|
|
|
|
- // result.setSuccess(false);
|
|
|
|
- // result.setMessage("产品不能为空");
|
|
|
|
- // return result;
|
|
|
|
- // }
|
|
|
|
- // Integer count = productService.getProductNameCount(vo.getProductName());
|
|
|
|
- // if(count != 0){
|
|
|
|
- // result.setSuccess(false);
|
|
|
|
- // result.setMessage("产品名字已存在");
|
|
|
|
- // return result;
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- productService.insertOrUpdateProduct(vo);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("error");
|
|
|
|
- }finally{
|
|
|
|
- log.info("/ctop/product/insertOrUpdateProduct 方法结束");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //编辑产品反显
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "/getProductInfo")
|
|
|
|
- public Result<Map<String, Object>> getProductInfo(@RequestBody ProductInfoDto dto, HttpServletRequest request, HttpServletResponse response){
|
|
|
|
- log.info("/ctop/product/getProductInfo 方法开始");
|
|
|
|
- Result<Map<String, Object>> result = new Result();
|
|
|
|
- if(dto==null || dto.getProductId() == null){
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("productId不能为空");
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- Map<String, Object> productInfo = productService.getProductInfo(dto.getProductId());
|
|
|
|
- result.setResult(productInfo);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("error");
|
|
|
|
- }finally{
|
|
|
|
- log.info("/ctop/product/getProductInfo 方法结束");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //单独删除产品关联项目
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "/deleteByProjectIdAndProductId")
|
|
|
|
- public Result deleteByProjectIdAndProductId(@RequestBody ProductInfoDto dto, HttpServletRequest request, HttpServletResponse response){
|
|
|
|
- log.info("/ctop/product/deleteByProjectIdAndProductId 方法开始");
|
|
|
|
- Result result = new Result();
|
|
|
|
- if(dto==null || dto.getProductId() == null || dto.getProjectId() ==null){
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("productId,projectId不能为空");
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- productService.deleteByProjectIdAndProductId(dto.getProjectId(), dto.getProductId());
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("error");
|
|
|
|
- }finally{
|
|
|
|
- log.info("/ctop/product/deleteByProjectIdAndProductId 方法结束");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //编辑产品按钮反显
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "/getProjectListByProductId")
|
|
|
|
- public Result<List<ProjectVO>> getProjectListByProductId(@RequestBody ProductInfoDto dto, HttpServletRequest request, HttpServletResponse response){
|
|
|
|
- log.info("/ctop/product/getProjectListByProductId 方法开始");
|
|
|
|
- Result<List<ProjectVO>> result = new Result();
|
|
|
|
- if(dto==null || dto.getProductId() == null){
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("productId,projectId不能为空");
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- List<ProjectVO> projectListByProductId = productService.getProjectListByProductId(dto.getProductId());
|
|
|
|
- result.setResult(projectListByProductId);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("error");
|
|
|
|
- }finally{
|
|
|
|
- log.info("/ctop/product/getProjectListByProductId 方法结束");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //产品列表
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "/getProductList")
|
|
|
|
- public Result<PageInfo<ProductVO>> getProductList(@RequestBody ProductInfoDto dto, HttpServletRequest request, HttpServletResponse response){
|
|
|
|
- log.info("/ctop/product/getProductList 方法开始");
|
|
|
|
- Result<PageInfo<ProductVO>> result = new Result();
|
|
|
|
- if(dto==null || dto.getPageNum() == 0 || dto.getPageSize() ==0){
|
|
|
|
- dto.setPageNum(1);
|
|
|
|
- dto.setPageSize(10);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- PageInfo<ProductVO> productList = productService.getProductList(dto.getAdvertiserName(), dto.getProductName(), dto.getPageNum(), dto.getPageSize());
|
|
|
|
- result.setResult(productList);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("error");
|
|
|
|
- }finally{
|
|
|
|
- log.info("/ctop/product/getProductList 方法结束");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //产品列表
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "/insertProductProjectMap")
|
|
|
|
- public Result insertProductProjectMap(@RequestBody ProductInfoDto dto, HttpServletRequest request, HttpServletResponse response){
|
|
|
|
- log.info("/ctop/product/insertProductProjectMap 方法开始");
|
|
|
|
- Result result = new Result();
|
|
|
|
- if(dto==null || dto.getProductId() == null || dto.getProjectIds() == null){
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("productId,projectIds不能为空");
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<Long> dtoProjectIds = dto.getProjectIds();
|
|
|
|
- List<Long> projectIdsHas = productService.getProjectIdsByProductId(dto.getProductId());
|
|
|
|
- List<Long> addProjectIds = new ArrayList<>();
|
|
|
|
-
|
|
|
|
- for(Long dtoProjectId:dtoProjectIds){
|
|
|
|
- int filter = 0;
|
|
|
|
- for(Long projectIdHas:projectIdsHas){
|
|
|
|
- if(projectIdHas.equals(dtoProjectId)){
|
|
|
|
- filter = -1;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(filter == 0){
|
|
|
|
- addProjectIds.add(dtoProjectId);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(addProjectIds==null || addProjectIds.size()==0){
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- productService.insertProductProjectMap(dto.getProductId(), addProjectIds);
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("error");
|
|
|
|
- }finally{
|
|
|
|
- log.info("/ctop/product/insertProductProjectMap 方法结束");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-}
|
|
|