Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceBudgetTemplateServiceImpl.java
xuzuoyun 5 anni fa
parent
commit
589b73b65a
19 ha cambiato i file con 934 aggiunte e 70 eliminazioni
  1. 2 1
      .gitignore
  2. 244 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  3. 0 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCampaignTemplate.java
  4. 2 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCreativeTemplate.java
  5. 0 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceUserOrientationTemplate.java
  6. 1 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceAdvertisePlanTemplate.java
  7. 0 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceDeliveryTargetTemplate.java
  8. 87 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/UserAllocation.java
  9. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/UserAllocationMapper.java
  10. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/UserAllocationMapper.xml
  11. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IUserAllocationService.java
  12. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceCampaignTemplateServiceImpl.java
  13. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceUserOrientationTemplateServiceImpl.java
  14. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceAdvertisePlanTemplateServiceImpl.java
  15. 1 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceDeliveryTargetTemplateServiceImpl.java
  16. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/UserAllocationServiceImpl.java
  17. 203 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/UserAllocationList.vue
  18. 166 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/UserAllocationModal.vue
  19. 173 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/UserAllocationModal__Style#Drawer.vue

+ 2 - 1
.gitignore

@@ -31,4 +31,5 @@ gen
 
 # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 hs_err_pid*
-**/target/
+**/target/
+application-dev.yml

+ 244 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -0,0 +1,244 @@
+package org.jeecg.modules.ctop.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 org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.UserAllocation;
+import org.jeecg.modules.ctop.service.IUserAllocationService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * @Description: 用户分配
+ * @Author: jeecg-boot
+ * @Date:   2019-07-30
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags="用户分配")
+@RestController
+@RequestMapping("/ctop/userAllocation")
+public class UserAllocationController {
+	@Autowired
+	private IUserAllocationService userAllocationService;
+	
+	/**
+	  * 分页列表查询
+	 * @param userAllocation
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "用户分配-分页列表查询")
+	@ApiOperation(value="用户分配-分页列表查询", notes="用户分配-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<UserAllocation>> queryPageList(UserAllocation userAllocation,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+		Result<IPage<UserAllocation>> result = new Result<IPage<UserAllocation>>();
+		QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
+		Page<UserAllocation> page = new Page<UserAllocation>(pageNo, pageSize);
+		IPage<UserAllocation> pageList = userAllocationService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+	
+	/**
+	  *   添加
+	 * @param userAllocation
+	 * @return
+	 */
+	@AutoLog(value = "用户分配-添加")
+	@ApiOperation(value="用户分配-添加", notes="用户分配-添加")
+	@PostMapping(value = "/add")
+	public Result<UserAllocation> add(@RequestBody UserAllocation userAllocation) {
+		Result<UserAllocation> result = new Result<UserAllocation>();
+		try {
+			userAllocationService.save(userAllocation);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+	
+	/**
+	  *  编辑
+	 * @param userAllocation
+	 * @return
+	 */
+	@AutoLog(value = "用户分配-编辑")
+	@ApiOperation(value="用户分配-编辑", notes="用户分配-编辑")
+	@PutMapping(value = "/edit")
+	public Result<UserAllocation> edit(@RequestBody UserAllocation userAllocation) {
+		Result<UserAllocation> result = new Result<UserAllocation>();
+		UserAllocation userAllocationEntity = userAllocationService.getById(userAllocation.getId());
+		if(userAllocationEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = userAllocationService.updateById(userAllocation);
+			//TODO 返回false说明什么?
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "用户分配-通过id删除")
+	@ApiOperation(value="用户分配-通过id删除", notes="用户分配-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			userAllocationService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+	
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "用户分配-批量删除")
+	@ApiOperation(value="用户分配-批量删除", notes="用户分配-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<UserAllocation> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<UserAllocation> result = new Result<UserAllocation>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.userAllocationService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+	
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "用户分配-通过id查询")
+	@ApiOperation(value="用户分配-通过id查询", notes="用户分配-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<UserAllocation> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<UserAllocation> result = new Result<UserAllocation>();
+		UserAllocation userAllocation = userAllocationService.getById(id);
+		if(userAllocation==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(userAllocation);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<UserAllocation> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              UserAllocation userAllocation = JSON.parseObject(deString, UserAllocation.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<UserAllocation> pageList = userAllocationService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "用户分配列表");
+      mv.addObject(NormalExcelConstants.CLASS, UserAllocation.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户分配列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();// 获取上传文件对象
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<UserAllocation> listUserAllocations = ExcelImportUtil.importExcel(file.getInputStream(), UserAllocation.class, params);
+              userAllocationService.saveBatch(listUserAllocations);
+              return Result.ok("文件导入成功!数据行数:" + listUserAllocations.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 0 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCampaignTemplate.java

@@ -37,15 +37,6 @@ public class ByteDanceCampaignTemplate {
     @ApiModelProperty(value = "id")
     private Long id;
     /**
-     * accountId
-     */
-    @Excel(name = "头条账号id")
-    @ApiModelProperty(value = "头条账号id")
-    private Long accountId;
-    @Excel(name = "平台广告主id")
-    @ApiModelProperty(value = "平台广告主id")
-    private String advertiserId;
-    /**
      * 投放目标
      */
     @Excel(name = "投放目标", width = 15)

+ 2 - 14
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCreativeTemplate.java

@@ -32,21 +32,9 @@ public class ByteDanceCreativeTemplate {
     /**
      * id
      */
-    @TableId(type = IdType.UUID)
+    @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
-    private Integer id;
-    /**
-     * 用户头条id
-     */
-    @Excel(name = "用户头条id", width = 15)
-    @ApiModelProperty(value = "用户头条id")
-    private String accountId;
-    /**
-     * 广告主id
-     */
-    @Excel(name = "广告主id", width = 15)
-    @ApiModelProperty(value = "广告主id")
-    private Integer advertiserId;
+    private Long id;
     /**
      * 广告计划id
      */

+ 0 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceUserOrientationTemplate.java

@@ -36,18 +36,6 @@ public class ByteDanceUserOrientationTemplate {
     @ApiModelProperty(value = "id")
     private Long id;
     /**
-     * 头条账号id
-     */
-    @Excel(name = "头条账号id", width = 15)
-    @ApiModelProperty(value = "头条账号id")
-    private Long accountId;
-    /**
-     * 广告主id
-     */
-    @Excel(name = "广告主id", width = 15)
-    @ApiModelProperty(value = "广告主id")
-    private String advertiserId;
-    /**
      * 模板名称
      */
     @Excel(name = "模板名称", width = 15)

+ 1 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceAdvertisePlanTemplate.java

@@ -34,19 +34,7 @@ public class BytedanceAdvertisePlanTemplate {
      */
     @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
-    private Integer id;
-    /**
-     * 头条账号id
-     */
-    @Excel(name = "头条账号id", width = 15)
-    @ApiModelProperty(value = "头条账号id")
-    private Long accountId;
-    /**
-     * 广告主id
-     */
-    @Excel(name = "广告主id", width = 15)
-    @ApiModelProperty(value = "广告主id")
-    private String advertiserId;
+    private Long id;
     /**
      * 广告组模板id
      */

+ 0 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceDeliveryTargetTemplate.java

@@ -36,18 +36,6 @@ public class BytedanceDeliveryTargetTemplate {
     @ApiModelProperty(value = "id")
     private Long id;
     /**
-     * 头条平台id
-     */
-    @Excel(name = "头条平台id", width = 15)
-    @ApiModelProperty(value = "头条平台id")
-    private Long accountId;
-    /**
-     * 平台账号id
-     */
-    @Excel(name = "平台账号id", width = 15)
-    @ApiModelProperty(value = "平台账号id")
-    private String advertiserId;
-    /**
      * 模板名称
      */
     @Excel(name = "模板名称", width = 15)

+ 87 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/UserAllocation.java

@@ -0,0 +1,87 @@
+package org.jeecg.modules.ctop.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @Description: 用户分配
+ * @Author: jeecg-boot
+ * @Date:   2019-07-30
+ * @Version: V1.0
+ */
+@Data
+@TableName("ctop_user_allocation")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_user_allocation对象", description="用户分配")
+public class UserAllocation {
+    
+	/**主键ID*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "主键ID")
+	private Integer id;
+	/**登陆人id*/
+	@Excel(name = "登陆人id", width = 15)
+    @ApiModelProperty(value = "登陆人id")
+	private String userId;
+	/**账户id*/
+	@Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+	private Integer accountId;
+	/**广告主ID*/
+	@Excel(name = "广告主ID", width = 15)
+    @ApiModelProperty(value = "广告主ID")
+	private String advertiserId;
+	/**分配人*/
+	@Excel(name = "分配人", width = 15)
+    @ApiModelProperty(value = "分配人")
+	private String distributionName;
+	/**部门id*/
+	@Excel(name = "部门id", width = 15)
+    @ApiModelProperty(value = "部门id")
+	private String departmentId;
+	/**管理员名称*/
+	@Excel(name = "管理员名称", width = 15)
+    @ApiModelProperty(value = "管理员名称")
+	private String adminName;
+	/**广告主名称*/
+	@Excel(name = "广告主名称", width = 15)
+    @ApiModelProperty(value = "广告主名称")
+	private String advertiserName;
+	/**账号姓名*/
+	@Excel(name = "账号姓名", width = 15)
+    @ApiModelProperty(value = "账号姓名")
+	private String accountName;
+	/**创建时间*/
+	@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**创建人*/
+	@Excel(name = "创建人", width = 15)
+    @ApiModelProperty(value = "创建人")
+	private String createBy;
+	/**修改人*/
+	@Excel(name = "修改人", width = 15)
+    @ApiModelProperty(value = "修改人")
+	private String updateBy;
+	/**修改时间*/
+	@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/UserAllocationMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.ctop.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.ctop.entity.UserAllocation;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 用户分配
+ * @Author: jeecg-boot
+ * @Date:   2019-07-30
+ * @Version: V1.0
+ */
+public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/UserAllocationMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.ctop.mapper.UserAllocationMapper">
+
+</mapper>

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IUserAllocationService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.service;
+
+import org.jeecg.modules.ctop.entity.UserAllocation;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 用户分配
+ * @Author: jeecg-boot
+ * @Date:   2019-07-30
+ * @Version: V1.0
+ */
+public interface IUserAllocationService extends IService<UserAllocation> {
+
+}

+ 0 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceCampaignTemplateServiceImpl.java

@@ -37,8 +37,6 @@ public class ByteDanceCampaignTemplateServiceImpl extends ServiceImpl<ByteDanceC
         Map<String, Object> resultMap = new HashMap<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         CTopOauthToken token = tokenService.getOAuthTokenByAccountId(user.getId());
-        template.setAccountId(token.getAccountId());
-        template.setAdvertiserId(token.getAdvertiserId());
         campaignTemplateMapper.insert(template);
         return advertiserDataService.campaignCreate(token, template);
     }

+ 0 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceUserOrientationTemplateServiceImpl.java

@@ -38,8 +38,6 @@ public class ByteDanceUserOrientationTemplateServiceImpl extends ServiceImpl<Byt
         Map<String, Object> resultMap = new HashMap<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         CTopOauthToken token = tokenService.getOAuthTokenByAccountId(user.getId());
-        template.setAccountId(token.getAccountId());
-        template.setAdvertiserId(token.getAdvertiserId());
         template.setStatus(1);
         templateMapper.insert(template);
         resultMap.put("success", true);

+ 0 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceAdvertisePlanTemplateServiceImpl.java

@@ -32,8 +32,6 @@ public class BytedanceAdvertisePlanTemplateServiceImpl extends ServiceImpl<Byted
         Map<String, Object> resultMap = new HashMap<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         CTopOauthToken token = tokenService.getOAuthTokenByAccountId(user.getId());
-        template.setAccountId(token.getAccountId());
-        template.setAdvertiserId(token.getAdvertiserId());
         template.setStatus(1);
         templateMapper.insert(template);
         //同步线上广告计划信息

+ 1 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceDeliveryTargetTemplateServiceImpl.java

@@ -35,9 +35,7 @@ public class BytedanceDeliveryTargetTemplateServiceImpl extends ServiceImpl<Byte
     public Map<String, Object> insertTemplate(BytedanceDeliveryTargetTemplate template) {
         Map<String, Object> resultMap = new HashMap<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        CTopOauthToken token = tokenService.getOAuthTokenByAccountId(user.getId());
-        template.setAccountId(token.getAccountId());
-        template.setAdvertiserId(token.getAdvertiserId());
+        CTopOauthToken token = tokenService.getOAuthTokenByAccountId("74099510334");
         template.setStatus(1);
         deliveryTargetTemplateMapper.insert(template);
         resultMap.put("success", true);

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/UserAllocationServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import org.jeecg.modules.ctop.entity.UserAllocation;
+import org.jeecg.modules.ctop.mapper.UserAllocationMapper;
+import org.jeecg.modules.ctop.service.IUserAllocationService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 用户分配
+ * @Author: jeecg-boot
+ * @Date:   2019-07-30
+ * @Version: V1.0
+ */
+@Service
+public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper, UserAllocation> implements IUserAllocationService {
+
+}

+ 203 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/UserAllocationList.vue

@@ -0,0 +1,203 @@
+<template>
+  <a-card :bordered="false">
+
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline">
+        <a-row :gutter="24">
+
+          <a-col :md="6" :sm="8">
+            <a-form-item label="登陆人id">
+              <a-input placeholder="请输入登陆人id" v-model="queryParam.userId"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="账户id">
+              <a-input placeholder="请输入账户id" v-model="queryParam.accountId"></a-input>
+            </a-form-item>
+          </a-col>
+        <template v-if="toggleSearchStatus">
+        <a-col :md="6" :sm="8">
+            <a-form-item label="广告主ID">
+              <a-input placeholder="请输入广告主ID" v-model="queryParam.advertiserId"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="分配人">
+              <a-input placeholder="请输入分配人" v-model="queryParam.distributionName"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="部门id">
+              <a-input placeholder="请输入部门id" v-model="queryParam.departmentId"></a-input>
+            </a-form-item>
+          </a-col>
+          </template>
+          <a-col :md="6" :sm="8" >
+            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
+              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
+              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
+              <a @click="handleToggleSearch" style="margin-left: 8px">
+                {{ toggleSearchStatus ? '收起' : '展开' }}
+                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
+              </a>
+            </span>
+          </a-col>
+
+        </a-row>
+      </a-form>
+    </div>
+
+    <!-- 操作按钮区域 -->
+    <div class="table-operator">
+      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
+      <a-button type="primary" icon="download" @click="handleExportXls('用户分配')">导出</a-button>
+      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
+        <a-button type="primary" icon="import">导入</a-button>
+      </a-upload>
+      <a-dropdown v-if="selectedRowKeys.length > 0">
+        <a-menu slot="overlay">
+          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
+        </a-menu>
+        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
+      </a-dropdown>
+    </div>
+
+    <!-- table区域-begin -->
+    <div>
+      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
+        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
+      </div>
+
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+        @change="handleTableChange">
+
+        <span slot="action" slot-scope="text, record">
+          <a @click="handleEdit(record)">编辑</a>
+
+          <a-divider type="vertical" />
+          <a-dropdown>
+            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
+            <a-menu slot="overlay">
+              <a-menu-item>
+                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
+                  <a>删除</a>
+                </a-popconfirm>
+              </a-menu-item>
+            </a-menu>
+          </a-dropdown>
+        </span>
+
+      </a-table>
+    </div>
+    <!-- table区域-end -->
+
+    <!-- 表单区域 -->
+    <userAllocation-modal ref="modalForm" @ok="modalFormOk"></userAllocation-modal>
+  </a-card>
+</template>
+
+<script>
+  import UserAllocationModal from './modules/UserAllocationModal'
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+
+  export default {
+    name: "UserAllocationList",
+    mixins:[JeecgListMixin],
+    components: {
+      UserAllocationModal
+    },
+    data () {
+      return {
+        description: '用户分配管理页面',
+        // 表头
+        columns: [
+          {
+            title: '#',
+            dataIndex: '',
+            key:'rowIndex',
+            width:60,
+            align:"center",
+            customRender:function (t,r,index) {
+              return parseInt(index)+1;
+            }
+           },
+		   {
+            title: '登陆人id',
+            align:"center",
+            dataIndex: 'userId'
+           },
+		   {
+            title: '账户id',
+            align:"center",
+            dataIndex: 'accountId'
+           },
+		   {
+            title: '广告主ID',
+            align:"center",
+            dataIndex: 'advertiserId'
+           },
+		   {
+            title: '分配人',
+            align:"center",
+            dataIndex: 'distributionName'
+           },
+		   {
+            title: '部门id',
+            align:"center",
+            dataIndex: 'departmentId'
+           },
+		   {
+            title: '管理员名称',
+            align:"center",
+            dataIndex: 'adminName'
+           },
+		   {
+            title: '广告主名称',
+            align:"center",
+            dataIndex: 'advertiserName'
+           },
+		   {
+            title: '账号姓名',
+            align:"center",
+            dataIndex: 'accountName'
+           },
+          {
+            title: '操作',
+            dataIndex: 'action',
+            align:"center",
+            scopedSlots: { customRender: 'action' },
+          }
+        ],
+		url: {
+          list: "/ctop/userAllocation/list",
+          delete: "/ctop/userAllocation/delete",
+          deleteBatch: "/ctop/userAllocation/deleteBatch",
+          exportXlsUrl: "ctop/userAllocation/exportXls",
+          importExcelUrl: "ctop/userAllocation/importExcel",
+       },
+    }
+  },
+  computed: {
+    importExcelUrl: function(){
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+    }
+  },
+    methods: {
+     
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less'
+</style>

+ 166 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/UserAllocationModal.vue

@@ -0,0 +1,166 @@
+<template>
+  <a-modal
+    :title="title"
+    :width="800"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="关闭">
+    
+    <a-spin :spinning="confirmLoading">
+      <a-form :form="form">
+      
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="登陆人id">
+          <a-input placeholder="请输入登陆人id" v-decorator="['userId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="账户id">
+          <a-input placeholder="请输入账户id" v-decorator="['accountId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="广告主ID">
+          <a-input placeholder="请输入广告主ID" v-decorator="['advertiserId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="分配人">
+          <a-input placeholder="请输入分配人" v-decorator="['distributionName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="部门id">
+          <a-input placeholder="请输入部门id" v-decorator="['departmentId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="管理员名称">
+          <a-input placeholder="请输入管理员名称" v-decorator="['adminName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="广告主名称">
+          <a-input placeholder="请输入广告主名称" v-decorator="['advertiserName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="账号姓名">
+          <a-input placeholder="请输入账号姓名" v-decorator="['accountName', {}]" />
+        </a-form-item>
+		
+      </a-form>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+  import { httpAction } from '@/api/manage'
+  import pick from 'lodash.pick'
+  import moment from "moment"
+
+  export default {
+    name: "UserAllocationModal",
+    data () {
+      return {
+        title:"操作",
+        visible: false,
+        model: {},
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+
+        confirmLoading: false,
+        form: this.$form.createForm(this),
+        validatorRules:{
+        },
+        url: {
+          add: "/ctop/userAllocation/add",
+          edit: "/ctop/userAllocation/edit",
+        },
+      }
+    },
+    created () {
+    },
+    methods: {
+      add () {
+        this.edit({});
+      },
+      edit (record) {
+        this.form.resetFields();
+        this.model = Object.assign({}, record);
+        this.visible = true;
+        this.$nextTick(() => {
+          this.form.setFieldsValue(pick(this.model,'userId','accountId','advertiserId','distributionName','departmentId','adminName','advertiserName','accountName'))
+		  //时间格式化
+        });
+
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        const that = this;
+        // 触发表单验证
+        this.form.validateFields((err, values) => {
+          if (!err) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            let formData = Object.assign(this.model, values);
+            //时间格式化
+            
+            console.log(formData)
+            httpAction(httpurl,formData,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+              that.close();
+            })
+
+
+
+          }
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+
+
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+
+</style>

+ 173 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/UserAllocationModal__Style#Drawer.vue

@@ -0,0 +1,173 @@
+<template>
+  <a-drawer
+      :title="title"
+      :width="800"
+      placement="right"
+      :closable="false"
+      @close="close"
+      :visible="visible"
+  >
+
+    <a-spin :spinning="confirmLoading">
+      <a-form :form="form">
+      
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="登陆人id">
+          <a-input placeholder="请输入登陆人id" v-decorator="['userId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="账户id">
+          <a-input placeholder="请输入账户id" v-decorator="['accountId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="广告主ID">
+          <a-input placeholder="请输入广告主ID" v-decorator="['advertiserId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="分配人">
+          <a-input placeholder="请输入分配人" v-decorator="['distributionName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="部门id">
+          <a-input placeholder="请输入部门id" v-decorator="['departmentId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="管理员名称">
+          <a-input placeholder="请输入管理员名称" v-decorator="['adminName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="广告主名称">
+          <a-input placeholder="请输入广告主名称" v-decorator="['advertiserName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="账号姓名">
+          <a-input placeholder="请输入账号姓名" v-decorator="['accountName', {}]" />
+        </a-form-item>
+		
+      </a-form>
+    </a-spin>
+    <a-button type="primary" @click="handleOk">确定</a-button>
+    <a-button type="primary" @click="handleCancel">取消</a-button>
+  </a-drawer>
+</template>
+
+<script>
+  import { httpAction } from '@/api/manage'
+  import pick from 'lodash.pick'
+  import moment from "moment"
+
+  export default {
+    name: "UserAllocationModal",
+    data () {
+      return {
+        title:"操作",
+        visible: false,
+        model: {},
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+
+        confirmLoading: false,
+        form: this.$form.createForm(this),
+        validatorRules:{
+        },
+        url: {
+          add: "/ctop/userAllocation/add",
+          edit: "/ctop/userAllocation/edit",
+        },
+      }
+    },
+    created () {
+    },
+    methods: {
+      add () {
+        this.edit({});
+      },
+      edit (record) {
+        this.form.resetFields();
+        this.model = Object.assign({}, record);
+        this.visible = true;
+        this.$nextTick(() => {
+          this.form.setFieldsValue(pick(this.model,'userId','accountId','advertiserId','distributionName','departmentId','adminName','advertiserName','accountName'))
+		  //时间格式化
+        });
+
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        const that = this;
+        // 触发表单验证
+        this.form.validateFields((err, values) => {
+          if (!err) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            let formData = Object.assign(this.model, values);
+            //时间格式化
+            
+            console.log(formData)
+            httpAction(httpurl,formData,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+              that.close();
+            })
+
+
+
+          }
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+
+
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+/** Button按钮间距 */
+  .ant-btn {
+    margin-left: 30px;
+    margin-bottom: 30px;
+    float: right;
+  }
+</style>