Bladeren bron

Merge remote-tracking branch 'origin/master'

xuzuoyun 5 jaren geleden
bovenliggende
commit
5d7fa78581
43 gewijzigde bestanden met toevoegingen van 2909 en 1016 verwijderingen
  1. 41 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthController.java
  2. 244 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthTaskController.java
  3. 286 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountAuthController.java
  4. 0 277
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountController.java
  5. 299 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java
  6. 70 27
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  7. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  8. 44 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/AuthTask.java
  9. 70 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BindAccountAuth.java
  10. 12 18
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BindAccount.java
  11. 97 54
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/UserAllocation.java
  12. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/AuthTaskMapper.java
  13. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/BindAccountAuthMapper.java
  14. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/BindAccountLoginMapper.java
  15. 0 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/BindAccountMapper.java
  16. 2 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/UserAllocationMapper.java
  17. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BindAccountMapper.xml
  18. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BindAccountAuthMapper.xml
  19. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BindAccountLoginMapper.xml
  20. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IAuthTaskService.java
  21. 7 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBindAccountService.java
  22. 18 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBindAccountLoginService.java
  23. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IUserAllocationService.java
  24. 32 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/AuthTaskServiceImpl.java
  25. 44 48
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountServiceImpl.java
  26. 54 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountLoginServiceImpl.java
  27. 13 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/UserAllocationServiceImpl.java
  28. 157 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/AuthTaskList.vue
  29. 168 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/BindAccountAuthList.vue
  30. 18 23
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/BindAccountList.vue
  31. 22 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/UserAllocationList.vue
  32. 130 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/AuthTaskModal.vue
  33. 137 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/AuthTaskModal__Style#Drawer.vue
  34. 136 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BindAccountAuthModal.vue
  35. 143 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BindAccountAuthModal__Style#Drawer.vue
  36. 8 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BindAccountModal.vue
  37. 8 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BindAccountModal__Style#Drawer.vue
  38. 25 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/UserAllocationModal.vue
  39. 25 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/UserAllocationModal__Style#Drawer.vue
  40. 274 267
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
  41. 8 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysUser.java
  42. 26 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java
  43. 218 199
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java

+ 41 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthController.java

@@ -8,11 +8,15 @@ import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import constant.KuaishouInterfaceConstant;
 import org.apache.commons.lang.StringUtils;
+import org.jeecg.modules.ctop.entity.AuthTask;
 import org.jeecg.modules.ctop.entity.CTopOauthToken;
+import org.jeecg.modules.ctop.entity.UserAllocation;
 import org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper;
+import org.jeecg.modules.ctop.mapper.UserAllocationMapper;
+import org.jeecg.modules.ctop.service.IAuthTaskService;
+import org.jeecg.modules.ctop.service.IBindAccountAuthService;
 import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
-import org.jeecg.modules.ctop.service.IBindAccountService;
-import org.jeecg.modules.kuaishou.service.IKuaishouInterfaceService;
+import org.jeecg.modules.ctop.service.IUserAllocationService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,13 +36,18 @@ import java.util.UUID;
 @RequestMapping("/auth")
 public class AuthController {
     private static final Logger logger = LoggerFactory.getLogger(AuthController.class);
+
     @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-    @Autowired
-    private IBindAccountService bindAccountService;
+    private IBindAccountAuthService bindAccountAuthService;
 
     @Autowired
     private CTopOauthTokenMapper cTopOauthTokenMapper;
+    @Autowired
+    private IAuthTaskService authTaskService;
+    @Autowired
+    private UserAllocationMapper allocationMapper;
+    @Autowired
+    private IUserAllocationService userAllocationService;
 
     @RequestMapping("/begin")
     public String authBegin(HttpServletRequest request,
@@ -48,11 +57,11 @@ public class AuthController {
             String codeUrl = "";
             switch (authType) {
                 case "bytedance":
-                    codeUrl = bindAccountService.getByteDanceCodeUrl(UUID.randomUUID().toString());
+                    codeUrl = bindAccountAuthService.getByteDanceCodeUrl(UUID.randomUUID().toString());
                     System.out.println(codeUrl);
                     return "redirect:" + codeUrl;
                 case "kuaishou":
-                    codeUrl = bindAccountService.getKuaishouCodeUrl(UUID.randomUUID().toString());
+                    codeUrl = bindAccountAuthService.getKuaishouCodeUrl(UUID.randomUUID().toString());
                     System.out.println(codeUrl);
                     return "redirect:" + codeUrl;
                 default:
@@ -109,12 +118,35 @@ public class AuthController {
             JSONObject data = resultObject.getJSONObject("data");
             CTopOauthToken token = new CTopOauthToken(accountId, data);
             if (Check.isNull(token)) {
+                AuthTask authTask = authTaskService.getAuthTask(state);
+                if (Check.isNull(authTask)) {
+                    throw new Exception("根据taskId未取到任务相关信息,taskId:" + state);
+                }
+                String advertiserId = authTask.getAdvertiserId();
+
                 Map<String, Object> deleteMap = new HashMap<>();
-                deleteMap.put("advertiser_id", state);
+                deleteMap.put("advertiser_id", advertiserId);
                 deleteMap.put("account_id", token.getAccountId());
                 cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
+                token.setAdvertiserId(advertiserId);
                 cTopOauthTokenMapper.insert(token);
-                bindAccountService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.TYPE_AUTHORIZATION, state, KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE); //账号绑定
+                bindAccountAuthService.addBindAccount(token.getAccountId(), KuaishouInterfaceConstant.LOGIN_TYPE_BYTEDANCE, advertiserId); //账号绑定
+
+                // 快手 更新账号分配表
+                UserAllocation userAllocation = userAllocationService.selectByTaskId(state);
+                userAllocation.setAccountId(token.getAccountId());
+                allocationMapper.deleteById(userAllocation.getId());
+
+                Map<String, Object> deleteUserMap = new HashMap<>();
+                deleteUserMap.put("account_id", accountId);
+                deleteUserMap.put("advertiser_id", advertiserId);
+                allocationMapper.deleteByMap(deleteUserMap);
+
+                int i = allocationMapper.insert(userAllocation);
+                if (i > 0) {
+                    logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
+
+                }
             }
         } catch (Exception e) {
             e.printStackTrace();

+ 244 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AuthTaskController.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.AuthTask;
+import org.jeecg.modules.ctop.service.IAuthTaskService;
+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-31
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags="关联用户分配")
+@RestController
+@RequestMapping("/ctop/authTask")
+public class AuthTaskController {
+	@Autowired
+	private IAuthTaskService authTaskService;
+	
+	/**
+	  * 分页列表查询
+	 * @param authTask
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "关联用户分配-分页列表查询")
+	@ApiOperation(value="关联用户分配-分页列表查询", notes="关联用户分配-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<AuthTask>> queryPageList(AuthTask authTask,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  HttpServletRequest req) {
+		Result<IPage<AuthTask>> result = new Result<IPage<AuthTask>>();
+		QueryWrapper<AuthTask> queryWrapper = QueryGenerator.initQueryWrapper(authTask, req.getParameterMap());
+		Page<AuthTask> page = new Page<AuthTask>(pageNo, pageSize);
+		IPage<AuthTask> pageList = authTaskService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+	
+	/**
+	  *   添加
+	 * @param authTask
+	 * @return
+	 */
+	@AutoLog(value = "关联用户分配-添加")
+	@ApiOperation(value="关联用户分配-添加", notes="关联用户分配-添加")
+	@PostMapping(value = "/add")
+	public Result<AuthTask> add(@RequestBody AuthTask authTask) {
+		Result<AuthTask> result = new Result<AuthTask>();
+		try {
+			authTaskService.save(authTask);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+	
+	/**
+	  *  编辑
+	 * @param authTask
+	 * @return
+	 */
+	@AutoLog(value = "关联用户分配-编辑")
+	@ApiOperation(value="关联用户分配-编辑", notes="关联用户分配-编辑")
+	@PutMapping(value = "/edit")
+	public Result<AuthTask> edit(@RequestBody AuthTask authTask) {
+		Result<AuthTask> result = new Result<AuthTask>();
+		AuthTask authTaskEntity = authTaskService.getById(authTask.getId());
+		if(authTaskEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = authTaskService.updateById(authTask);
+			//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 {
+			authTaskService.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<AuthTask> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<AuthTask> result = new Result<AuthTask>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.authTaskService.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<AuthTask> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<AuthTask> result = new Result<AuthTask>();
+		AuthTask authTask = authTaskService.getById(id);
+		if(authTask==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(authTask);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<AuthTask> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              AuthTask authTask = JSON.parseObject(deString, AuthTask.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(authTask, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<AuthTask> pageList = authTaskService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "关联用户分配列表");
+      mv.addObject(NormalExcelConstants.CLASS, AuthTask.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<AuthTask> listAuthTasks = ExcelImportUtil.importExcel(file.getInputStream(), AuthTask.class, params);
+              authTaskService.saveBatch(listAuthTasks);
+              return Result.ok("文件导入成功!数据行数:" + listAuthTasks.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("文件导入失败!");
+  }
+
+}

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

@@ -0,0 +1,286 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.utils.Check;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.BindAccountAuth;
+import org.jeecg.modules.ctop.entity.UserAllocation;
+import org.jeecg.modules.ctop.service.IBindAccountAuthService;
+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 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;
+
+/**
+ * @Description: 账号绑定-授权
+ * @Author: jeecg-boot
+ * @Date: 2019-07-31
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags = "账号绑定-授权")
+@RestController
+@RequestMapping("/ctop/bindAccountAuth")
+public class BindAccountAuthController {
+    @Autowired
+    private IBindAccountAuthService bindAccountAuthService;
+
+    @PostMapping(value = "/authorization")
+    public Result<IPage<BindAccountAuth>> authorization(@RequestBody JSONObject json) {
+        Result<IPage<BindAccountAuth>> result = new Result<IPage<BindAccountAuth>>();
+        String codeUrl = null;
+        try {
+            String advertiserId = json.getString("advertiserId");
+            if(Check.isNull(advertiserId)){
+                System.err.println("advertiserId不能为空");
+                result.setSuccess(false);
+                return result;
+            }
+            String authorizationType = json.getString("authorizationType");
+            String distributionName = json.getString("distributionName");//指定分配人姓名
+            String advertiserName = json.getString("advertiser_name"); // 广告主名称
+            String mediaId = json.getString("mediaId"); // 媒体类型: 1 头条 2 快手
+            String realName = json.getString("realName");
+            String departmentId = json.getString("departmentId"); //部门id
+            String userId = json.getString("userId"); //创建人
+            UserAllocation userAllocation = new UserAllocation();
+            userAllocation.setDistributionName(distributionName);
+            userAllocation.setUserId(userId);
+            userAllocation.setAdvertiserName(advertiserName);
+            userAllocation.setMediaId(mediaId);
+            userAllocation.setDepartmentId(departmentId);
+            userAllocation.setOperationName(realName);
+            codeUrl = bindAccountAuthService.bindAuthorization(advertiserId, authorizationType, userAllocation);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        result.setMessage(codeUrl);
+        result.setSuccess(true);
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param bindAccountAuth
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "账号绑定-授权-分页列表查询")
+    @ApiOperation(value = "账号绑定-授权-分页列表查询", notes = "账号绑定-授权-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BindAccountAuth>> queryPageList(BindAccountAuth bindAccountAuth,
+                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                        HttpServletRequest req) {
+        Result<IPage<BindAccountAuth>> result = new Result<IPage<BindAccountAuth>>();
+        QueryWrapper<BindAccountAuth> queryWrapper = QueryGenerator.initQueryWrapper(bindAccountAuth, req.getParameterMap());
+        Page<BindAccountAuth> page = new Page<BindAccountAuth>(pageNo, pageSize);
+        IPage<BindAccountAuth> pageList = bindAccountAuthService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param bindAccountAuth
+     * @return
+     */
+    @AutoLog(value = "账号绑定-授权-添加")
+    @ApiOperation(value = "账号绑定-授权-添加", notes = "账号绑定-授权-添加")
+    @PostMapping(value = "/add")
+    public Result<BindAccountAuth> add(@RequestBody BindAccountAuth bindAccountAuth) {
+        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        try {
+            bindAccountAuthService.save(bindAccountAuth);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param bindAccountAuth
+     * @return
+     */
+    @AutoLog(value = "账号绑定-授权-编辑")
+    @ApiOperation(value = "账号绑定-授权-编辑", notes = "账号绑定-授权-编辑")
+    @PutMapping(value = "/edit")
+    public Result<BindAccountAuth> edit(@RequestBody BindAccountAuth bindAccountAuth) {
+        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        BindAccountAuth bindAccountAuthEntity = bindAccountAuthService.getById(bindAccountAuth.getId());
+        if (bindAccountAuthEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = bindAccountAuthService.updateById(bindAccountAuth);
+            //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 {
+            bindAccountAuthService.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<BindAccountAuth> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.bindAccountAuthService.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<BindAccountAuth> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<BindAccountAuth> result = new Result<BindAccountAuth>();
+        BindAccountAuth bindAccountAuth = bindAccountAuthService.getById(id);
+        if (bindAccountAuth == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(bindAccountAuth);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<BindAccountAuth> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                BindAccountAuth bindAccountAuth = JSON.parseObject(deString, BindAccountAuth.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(bindAccountAuth, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<BindAccountAuth> pageList = bindAccountAuthService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "账号绑定-授权列表");
+        mv.addObject(NormalExcelConstants.CLASS, BindAccountAuth.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<BindAccountAuth> listBindAccountAuths = ExcelImportUtil.importExcel(file.getInputStream(), BindAccountAuth.class, params);
+                bindAccountAuthService.saveBatch(listBindAccountAuths);
+                return Result.ok("文件导入成功!数据行数:" + listBindAccountAuths.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 - 277
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountController.java

@@ -1,277 +0,0 @@
-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.BindAccount;
-import org.jeecg.modules.ctop.service.IBindAccountService;
-
-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/bindAccount")
-public class BindAccountController {
-    @Autowired
-    private IBindAccountService bindAccountService;
-
-
-    @GetMapping(value = "/login")
-    public Result<IPage<BindAccount>> login(String advertiserId, String accountName, String password, String loginType) {
-        Result<IPage<BindAccount>> result = new Result<IPage<BindAccount>>();
-        boolean trueOrFalse = bindAccountService.bindLogin(advertiserId, accountName, password, loginType);
-        result.setSuccess(trueOrFalse);
-        return result;
-    }
-
-    @GetMapping(value = "/authorization")
-    public Result<IPage<BindAccount>> authorization(String advertiserId, String authorizationType) {
-        Result<IPage<BindAccount>> result = new Result<IPage<BindAccount>>();
-        String codeUrl = null;
-        try {
-            codeUrl = bindAccountService.bindAuthorization(advertiserId, authorizationType);
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-        result.setMessage(codeUrl);
-        result.setSuccess(true);
-        return result;
-    }
-
-
-    /**
-     * 分页列表查询
-     *
-     * @param bindAccount
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     */
-    @AutoLog(value = "账户绑定-分页列表查询")
-    @ApiOperation(value = "账户绑定-分页列表查询", notes = "账户绑定-分页列表查询")
-    @GetMapping(value = "/list")
-    public Result<IPage<BindAccount>> queryPageList(BindAccount bindAccount,
-                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                    HttpServletRequest req) {
-        Result<IPage<BindAccount>> result = new Result<IPage<BindAccount>>();
-        QueryWrapper<BindAccount> queryWrapper = QueryGenerator.initQueryWrapper(bindAccount, req.getParameterMap());
-        Page<BindAccount> page = new Page<BindAccount>(pageNo, pageSize);
-        IPage<BindAccount> pageList = bindAccountService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
-     * 添加
-     *
-     * @param bindAccount
-     * @return
-     */
-    @AutoLog(value = "账户绑定-添加")
-    @ApiOperation(value = "账户绑定-添加", notes = "账户绑定-添加")
-    @PostMapping(value = "/add")
-    public Result<BindAccount> add(@RequestBody BindAccount bindAccount) {
-        Result<BindAccount> result = new Result<BindAccount>();
-        try {
-            bindAccountService.save(bindAccount);
-            result.success("添加成功!");
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    /**
-     * 编辑
-     *
-     * @param bindAccount
-     * @return
-     */
-    @AutoLog(value = "账户绑定-编辑")
-    @ApiOperation(value = "账户绑定-编辑", notes = "账户绑定-编辑")
-    @PutMapping(value = "/edit")
-    public Result<BindAccount> edit(@RequestBody BindAccount bindAccount) {
-        Result<BindAccount> result = new Result<BindAccount>();
-        BindAccount bindAccountEntity = bindAccountService.getById(bindAccount.getId());
-        if (bindAccountEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            boolean ok = bindAccountService.updateById(bindAccount);
-            //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 {
-            bindAccountService.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<BindAccount> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<BindAccount> result = new Result<BindAccount>();
-        if (ids == null || "".equals(ids.trim())) {
-            result.error500("参数不识别!");
-        } else {
-            this.bindAccountService.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<BindAccount> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<BindAccount> result = new Result<BindAccount>();
-        BindAccount bindAccount = bindAccountService.getById(id);
-        if (bindAccount == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(bindAccount);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<BindAccount> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                BindAccount bindAccount = JSON.parseObject(deString, BindAccount.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(bindAccount, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<BindAccount> pageList = bindAccountService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "账户绑定列表");
-        mv.addObject(NormalExcelConstants.CLASS, BindAccount.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<BindAccount> listBindAccounts = ExcelImportUtil.importExcel(file.getInputStream(), BindAccount.class, params);
-                bindAccountService.saveBatch(listBindAccounts);
-                return Result.ok("文件导入成功!数据行数:" + listBindAccounts.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("文件导入失败!");
-    }
-
-}

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

@@ -0,0 +1,299 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.utils.Check;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.BindAccountLogin;
+import org.jeecg.modules.ctop.entity.UserAllocation;
+import org.jeecg.modules.ctop.mapper.UserAllocationMapper;
+import org.jeecg.modules.ctop.service.IBindAccountLoginService;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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 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;
+
+/**
+ * @Description: 账号绑定-登陆
+ * @Author: jeecg-boot
+ * @Date: 2019-07-31
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags = "账号绑定-登陆")
+@RestController
+@RequestMapping("/ctop/bindAccountLogin")
+public class BindAccountLoginController {
+    private static final Logger logger = LoggerFactory.getLogger(BindAccountLoginController.class);
+
+    @Autowired
+    private IBindAccountLoginService bindAccountLoginService;
+    @Autowired
+    private UserAllocationMapper userAllocationMapper;
+
+
+    @PostMapping(value = "/login")
+    public Result<IPage<BindAccountLogin>> login(@RequestBody JSONObject json) {
+        Result<IPage<BindAccountLogin>> result = new Result<IPage<BindAccountLogin>>();
+        String advertiserId = json.getString("advertiserId");
+        if (Check.isNull(advertiserId)) {
+            System.err.println("advertiserId不能为空");
+            result.setSuccess(false);
+            return result;
+        }
+        String password = json.getString("password");
+        String loginType = json.getString("loginType");
+        String accountName = json.getString("accountName"); //账号
+        boolean trueOrFalse = bindAccountLoginService.bindLogin(advertiserId, accountName, password, loginType);
+        if (trueOrFalse) {
+            String realName = json.getString("realName");
+            String departmentId = json.getString("departmentId"); //部门id
+            String distributionName = json.getString("distributionName");//指定分配人姓名
+            String advertiserName = json.getString("advertiser_name"); // 广告主名称
+            String mediaId = json.getString("mediaId"); // 媒体类型: 1 头条 2 快手
+            String userId = json.getString("userId"); //创建人
+            UserAllocation userAllocation = new UserAllocation();
+            userAllocation.setDistributionName(distributionName);
+            userAllocation.setUserId(userId);
+            userAllocation.setAdvertiserId(advertiserId);
+            userAllocation.setDepartmentId(departmentId);
+            userAllocation.setAdvertiserName(advertiserName);
+            userAllocation.setAccountName(accountName);
+            userAllocation.setMediaId(mediaId);
+            userAllocation.setOperationName(realName);
+            int i = userAllocationMapper.insert(userAllocation);
+            if (i > 0) {
+                logger.info("用户分配入库完成,advertiserId:{}", advertiserId);
+            }
+        }
+
+        result.setSuccess(trueOrFalse);
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param bindAccountLogin
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "账号绑定-登陆-分页列表查询")
+    @ApiOperation(value = "账号绑定-登陆-分页列表查询", notes = "账号绑定-登陆-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BindAccountLogin>> queryPageList(BindAccountLogin bindAccountLogin,
+                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                         HttpServletRequest req) {
+        Result<IPage<BindAccountLogin>> result = new Result<IPage<BindAccountLogin>>();
+        QueryWrapper<BindAccountLogin> queryWrapper = QueryGenerator.initQueryWrapper(bindAccountLogin, req.getParameterMap());
+        Page<BindAccountLogin> page = new Page<BindAccountLogin>(pageNo, pageSize);
+        IPage<BindAccountLogin> pageList = bindAccountLoginService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param bindAccountLogin
+     * @return
+     */
+    @AutoLog(value = "账号绑定-登陆-添加")
+    @ApiOperation(value = "账号绑定-登陆-添加", notes = "账号绑定-登陆-添加")
+    @PostMapping(value = "/add")
+    public Result<BindAccountLogin> add(@RequestBody BindAccountLogin bindAccountLogin) {
+        Result<BindAccountLogin> result = new Result<BindAccountLogin>();
+        try {
+            bindAccountLoginService.save(bindAccountLogin);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param bindAccountLogin
+     * @return
+     */
+    @AutoLog(value = "账号绑定-登陆-编辑")
+    @ApiOperation(value = "账号绑定-登陆-编辑", notes = "账号绑定-登陆-编辑")
+    @PutMapping(value = "/edit")
+    public Result<BindAccountLogin> edit(@RequestBody BindAccountLogin bindAccountLogin) {
+        Result<BindAccountLogin> result = new Result<BindAccountLogin>();
+        BindAccountLogin bindAccountLoginEntity = bindAccountLoginService.getById(bindAccountLogin.getId());
+        if (bindAccountLoginEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = bindAccountLoginService.updateById(bindAccountLogin);
+            //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 {
+            bindAccountLoginService.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<BindAccountLogin> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<BindAccountLogin> result = new Result<BindAccountLogin>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.bindAccountLoginService.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<BindAccountLogin> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<BindAccountLogin> result = new Result<BindAccountLogin>();
+        BindAccountLogin bindAccountLogin = bindAccountLoginService.getById(id);
+        if (bindAccountLogin == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(bindAccountLogin);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<BindAccountLogin> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                BindAccountLogin bindAccountLogin = JSON.parseObject(deString, BindAccountLogin.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(bindAccountLogin, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<BindAccountLogin> pageList = bindAccountLoginService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "账号绑定-登陆列表");
+        mv.addObject(NormalExcelConstants.CLASS, BindAccountLogin.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<BindAccountLogin> listBindAccountLogins = ExcelImportUtil.importExcel(file.getInputStream(), BindAccountLogin.class, params);
+                bindAccountLoginService.saveBatch(listBindAccountLogins);
+                return Result.ok("文件导入成功!数据行数:" + listBindAccountLogins.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("文件导入失败!");
+    }
+
+}

+ 70 - 27
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -1,14 +1,23 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.utils.Check;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.kuaishou.modules.material.service.IKuaishouAccessTokenService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import constant.KuaishouInterfaceConstant;
 import org.apache.commons.lang.StringUtils;
+import org.jeecg.modules.ctop.entity.AuthTask;
 import org.jeecg.modules.ctop.entity.CTopOauthToken;
+import org.jeecg.modules.ctop.entity.UserAllocation;
 import org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper;
-import org.jeecg.modules.ctop.service.IBindAccountService;
+import org.jeecg.modules.ctop.mapper.UserAllocationMapper;
+import org.jeecg.modules.ctop.service.IAuthTaskService;
+import org.jeecg.modules.ctop.service.IBindAccountAuthService;
+import org.jeecg.modules.ctop.service.IUserAllocationService;
 import org.jeecg.modules.kuaishou.service.IKuaishouInterfaceService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -24,6 +33,8 @@ import java.util.Map;
 @Controller
 @RequestMapping("/")
 public class CallbackController {
+    private static final Logger logger = LoggerFactory.getLogger(CallbackController.class);
+
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
@@ -31,7 +42,14 @@ public class CallbackController {
     @Autowired
     private CTopOauthTokenMapper cTopOauthTokenMapper;
     @Autowired
-    private IBindAccountService bindAccountService;
+    private IBindAccountAuthService bindAccountAuthService;
+    @Autowired
+    private IAuthTaskService authTaskService;
+    @Autowired
+    private UserAllocationMapper allocationMapper;
+    @Autowired
+    private IUserAllocationService allocationService;
+
 
     @RequestMapping("/kuaishou")
     @ResponseBody
@@ -39,32 +57,57 @@ public class CallbackController {
                            HttpServletResponse response,
                            @RequestParam("auth_code") String authCode,
                            @RequestParam("state") String state) {
-        if (StringUtils.isNotBlank(authCode)) {
-            KuaishouResultToken accessToken = kuaishouInterfaceService.getAccessToken(authCode);
-            KuaishouAccessToken token = accessToken.getData();
-            if (token != null) {
-                CTopOauthToken topOauthToken = new CTopOauthToken();
-                Long accountId = token.getAccountId();
-                Map<String, Object> deleteMap = new HashMap<>();
-                deleteMap.put("advertiser_id", state);
-                deleteMap.put("account_id", accountId);
-                cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
-                topOauthToken.setAccountId(accountId);
-                topOauthToken.setMediaId("2");
-                topOauthToken.setAdvertiserId(state);
-                topOauthToken.setAccessToken(token.getAccessToken());
-                long accessTokenExpireIn = token.getAccessTokenExpiresIn() * 1000L;
-                long now = System.currentTimeMillis();
-                Date accessTokenExpireInDate = new Date(now + accessTokenExpireIn);
-                topOauthToken.setAccessTokenExpiresIn(accessTokenExpireInDate);
-                topOauthToken.setRefreshToken(token.getRefreshToken());
-                long refreshTokenExpireIn = token.getRefreshTokenExpiresIn() * 1000L;
-                Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
-                topOauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
-                cTopOauthTokenMapper.insert(topOauthToken);
-                bindAccountService.addBindAccount(accountId, KuaishouInterfaceConstant.TYPE_AUTHORIZATION, state, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU); //账号绑定
+        try {
+            if (StringUtils.isNotBlank(authCode)) {
+                KuaishouResultToken accessToken = kuaishouInterfaceService.getAccessToken(authCode);
+                KuaishouAccessToken token = accessToken.getData();
+                if (token != null) {
+                    AuthTask authTask = authTaskService.getAuthTask(state);
+                    if (Check.isNull(authTask)) {
+                        throw new Exception("根据taskId未取到任务相关信息,taskId:" + state);
+                    }
+                    String advertiserId = authTask.getAdvertiserId();
+                    CTopOauthToken topOauthToken = new CTopOauthToken();
+                    Long accountId = token.getAccountId();
+                    Map<String, Object> deleteMap = new HashMap<>();
+                    deleteMap.put("advertiser_id", advertiserId);
+                    deleteMap.put("account_id", accountId);
+                    cTopOauthTokenMapper.deleteByMap(deleteMap); //删除 广告主id下的相关授权信息
+                    topOauthToken.setAccountId(accountId);
+                    topOauthToken.setMediaId("2");
+                    topOauthToken.setAdvertiserId(advertiserId);
+                    topOauthToken.setAccessToken(token.getAccessToken());
+                    long accessTokenExpireIn = token.getAccessTokenExpiresIn() * 1000L;
+                    long now = System.currentTimeMillis();
+                    Date accessTokenExpireInDate = new Date(now + accessTokenExpireIn);
+                    topOauthToken.setAccessTokenExpiresIn(accessTokenExpireInDate);
+                    topOauthToken.setRefreshToken(token.getRefreshToken());
+                    long refreshTokenExpireIn = token.getRefreshTokenExpiresIn() * 1000L;
+                    Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
+                    topOauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
+                    cTopOauthTokenMapper.insert(topOauthToken);
+                    bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiserId); //账号绑定
+
+
+                    UserAllocation userAllocation = allocationService.selectByTaskId(state);
+                    userAllocation.setAccountId(accountId);
+                    allocationMapper.deleteById(userAllocation.getId());
+
+                    Map<String, Object> deleteUserMap = new HashMap<>();
+                    deleteUserMap.put("advertiser_id", advertiserId);
+                    deleteUserMap.put("account_id", accountId);
+                    allocationMapper.deleteByMap(deleteUserMap);
+
+                    int i = allocationMapper.insert(userAllocation);
+                    if (i > 0) {
+                        logger.info("同步分配用户表完成,task_id:{},accountId:{}", state, accountId);
+
+                    }
+                }
+                return "auth_success";
             }
-            return "auth_success";
+        } catch (Exception e) {
+            e.printStackTrace();
         }
         return "auth_fail";
     }

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

@@ -38,7 +38,7 @@ import io.swagger.annotations.ApiOperation;
  /**
  * @Description: 用户分配
  * @Author: jeecg-boot
- * @Date:   2019-07-30
+ * @Date:   2019-07-31
  * @Version: V1.0
  */
 @Slf4j

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

@@ -0,0 +1,44 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @Description: 关联用户分配
+ * @Author: jeecg-boot
+ * @Date: 2019-07-31
+ * @Version: V1.0
+ */
+@Data
+@TableName("ctop_auth_task")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_auth_task对象", description = "关联用户分配")
+public class AuthTask {
+
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键ID")
+    private Long id;
+    /**
+     * 广告主ID
+     */
+    @Excel(name = "广告主ID", width = 15)
+    @ApiModelProperty(value = "广告主ID")
+    private String advertiserId;
+    /**
+     * task_id
+     */
+    @Excel(name = "task_id", width = 15)
+    @ApiModelProperty(value = "task_id")
+    private String taskId;
+}

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

@@ -0,0 +1,70 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @Description: 账号绑定-授权
+ * @Author: jeecg-boot
+ * @Date: 2019-07-31
+ * @Version: V1.0
+ */
+@Data
+@TableName("ctop_bind_account_auth")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_bind_account_auth对象", description = "账号绑定-授权")
+public class BindAccountAuth {
+
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键ID")
+    private Long id;
+    /**
+     * 广告id
+     */
+    @Excel(name = "广告id", width = 15)
+    @ApiModelProperty(value = "广告id")
+    private String advertiserId;
+    /**
+     * 授权方式
+     */
+    @Excel(name = "授权方式", width = 15)
+    @ApiModelProperty(value = "授权方式")
+    private String authType;
+    /**
+     * 回调返回广告主id
+     */
+    @Excel(name = "回调返回广告主id", width = 15)
+    @ApiModelProperty(value = "回调返回广告主id")
+    private Long accountId;
+    /**
+     * 创建时间
+     */
+    @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 = 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;
+}

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

@@ -15,17 +15,17 @@ import org.springframework.format.annotation.DateTimeFormat;
 import java.util.Date;
 
 /**
- * @Description: 账户绑定
+ * @Description: 账号绑定-登陆
  * @Author: jeecg-boot
- * @Date: 2019-07-30
+ * @Date: 2019-07-31
  * @Version: V1.0
  */
 @Data
-@TableName("ctop_bind_account")
+@TableName("ctop_bind_account_login")
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
-@ApiModel(value = "ctop_bind_account对象", description = "账户绑定")
-public class BindAccount {
+@ApiModel(value = "ctop_bind_account_login对象", description = "账号绑定-登陆")
+public class BindAccountLogin {
 
     /**
      * 主键ID
@@ -52,23 +52,17 @@ public class BindAccount {
     @ApiModelProperty(value = "密码")
     private String password;
     /**
-     * 登录/授权方式
+     * 登录方式
      */
-    @Excel(name = "登录/授权方式", width = 15)
-    @ApiModelProperty(value = "登录/授权方式")
+    @Excel(name = "登录方式", width = 15)
+    @ApiModelProperty(value = "登录方式")
     private String loginType;
     /**
-     * 方式:登录或授权
+     * 1未登陆 2已登陆
      */
-    @Excel(name = "方式:登录或授权", width = 15)
-    @ApiModelProperty(value = "方式:登录或授权")
-    private String type;
-    /**
-     * 回调返回广告主id
-     */
-    @Excel(name = "回调返回广告主id", width = 15)
-    @ApiModelProperty(value = "回调返回广告主id")
-    private Long accountId;
+    @Excel(name = "1未登陆 2已登陆", width = 15)
+    @ApiModelProperty(value = "1未登陆 2已登陆")
+    private String status;
     /**
      * 创建时间
      */

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

@@ -1,87 +1,130 @@
 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 com.fasterxml.jackson.annotation.JsonFormat;
 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;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 /**
  * @Description: 用户分配
  * @Author: jeecg-boot
- * @Date:   2019-07-30
+ * @Date: 2019-07-31
  * @Version: V1.0
  */
 @Data
 @TableName("ctop_user_allocation")
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
-@ApiModel(value="ctop_user_allocation对象", description="用户分配")
+@ApiModel(value = "ctop_user_allocation对象", description = "用户分配")
 public class UserAllocation {
-    
-	/**主键ID*/
-	@TableId(type = IdType.UUID)
+
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "主键ID")
-	private Integer id;
-	/**登陆人id*/
-	@Excel(name = "登陆人id", width = 15)
+    private Long 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)
+    private String userId;
+    /**
+     * 账户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)
-    @ApiModelProperty(value = "分配人")
-	private String distributionName;
-	/**部门id*/
-	@Excel(name = "部门id", width = 15)
+    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)
+    private String departmentId;
+    /**
+     * 管理员名称
+     */
+    @Excel(name = "管理员名称", width = 15)
     @ApiModelProperty(value = "管理员名称")
-	private String adminName;
-	/**广告主名称*/
-	@Excel(name = "广告主名称", width = 15)
+    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")
+    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)
+    private Date createTime;
+    /**
+     * task_id
+     */
+    @Excel(name = "task_id", width = 15)
+    @ApiModelProperty(value = "task_id")
+    private String taskId;
+    /**
+     * 操作人姓名
+     */
+    @Excel(name = "操作人姓名", width = 15)
+    @ApiModelProperty(value = "操作人姓名")
+    private String operationName;
+    /**
+     * 创建人
+     */
+    @Excel(name = "创建人", width = 15)
     @ApiModelProperty(value = "创建人")
-	private String createBy;
-	/**修改人*/
-	@Excel(name = "修改人", width = 15)
+    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")
+    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;
+    private Date updateTime;
+    /**
+     * 平台类型 1 头条 2快手
+     */
+    @Excel(name = "平台类型 1 头条 2快手", width = 15)
+    @ApiModelProperty(value = "平台类型 1 头条 2快手")
+    private String mediaId;
 }

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

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.AuthTask;
+
+/**
+ * @Description: 关联用户分配
+ * @Author: jeecg-boot
+ * @Date: 2019-07-31
+ * @Version: V1.0
+ */
+public interface AuthTaskMapper extends BaseMapper<AuthTask> {
+
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/BindAccountAuthMapper.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.BindAccountAuth;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 账号绑定-授权
+ * @Author: jeecg-boot
+ * @Date:   2019-07-31
+ * @Version: V1.0
+ */
+public interface BindAccountAuthMapper extends BaseMapper<BindAccountAuth> {
+
+}

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

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.BindAccountLogin;
+
+/**
+ * @Description: 账号绑定-登陆
+ * @Author: jeecg-boot
+ * @Date: 2019-07-31
+ * @Version: V1.0
+ */
+public interface BindAccountLoginMapper extends BaseMapper<BindAccountLogin> {
+
+}

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

@@ -1,14 +0,0 @@
-package org.jeecg.modules.ctop.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.jeecg.modules.ctop.entity.BindAccount;
-
-/**
- * @Description: 账户绑定
- * @Author: jeecg-boot
- * @Date: 2019-07-30
- * @Version: V1.0
- */
-public interface BindAccountMapper extends BaseMapper<BindAccount> {
-
-}

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

@@ -1,15 +1,12 @@
 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;
+import org.jeecg.modules.ctop.entity.UserAllocation;
 
 /**
  * @Description: 用户分配
  * @Author: jeecg-boot
- * @Date:   2019-07-30
+ * @Date: 2019-07-31
  * @Version: V1.0
  */
 public interface UserAllocationMapper extends BaseMapper<UserAllocation> {

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BindAccountMapper.xml

@@ -1,5 +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.BindAccountMapper">
+<mapper namespace="org.jeecg.modules.ctop.mapper.AuthTaskMapper">
 
 </mapper>

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BindAccountAuthMapper.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.BindAccountAuthMapper">
+
+</mapper>

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BindAccountLoginMapper.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.BindAccountLoginMapper">
+
+</mapper>

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

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.service;
+
+import org.jeecg.modules.ctop.entity.AuthTask;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 关联用户分配
+ * @Author: jeecg-boot
+ * @Date: 2019-07-31
+ * @Version: V1.0
+ */
+public interface IAuthTaskService extends IService<AuthTask> {
+    AuthTask getAuthTask(String taskId);
+}

+ 7 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBindAccountService.java

@@ -1,25 +1,25 @@
 package org.jeecg.modules.ctop.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.ctop.entity.BindAccount;
+import org.jeecg.modules.ctop.entity.BindAccountAuth;
+import org.jeecg.modules.ctop.entity.UserAllocation;
 
 import java.io.UnsupportedEncodingException;
 
 /**
- * @Description: 账户绑定
+ * @Description: 账号绑定-授权
  * @Author: jeecg-boot
- * @Date: 2019-07-30
+ * @Date: 2019-07-31
  * @Version: V1.0
  */
-public interface IBindAccountService extends IService<BindAccount> {
-    boolean bindLogin(String advertiserId, String accountName, String password, String loginType);
+public interface IBindAccountAuthService extends IService<BindAccountAuth> {
 
-    String bindAuthorization(String advertiserId, String authorizationType) throws UnsupportedEncodingException;
+    String bindAuthorization(String advertiserId, String authorizationType, UserAllocation userAllocation) throws UnsupportedEncodingException;
 
     String getKuaishouCodeUrl(String state) throws UnsupportedEncodingException;
 
     String getByteDanceCodeUrl(String state) throws UnsupportedEncodingException;
 
 
-    void addBindAccount(Long accountId, String type, String state, String loginType);
+    void addBindAccount(Long accountId, String type, String state);
 }

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

@@ -0,0 +1,18 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.BindAccountLogin;
+
+/**
+ * @Description: 账号绑定-登陆
+ * @Author: jeecg-boot
+ * @Date: 2019-07-31
+ * @Version: V1.0
+ */
+public interface IBindAccountLoginService extends IService<BindAccountLogin> {
+
+
+    boolean bindLogin(String advertiserId, String accountName, String password, String loginType);
+
+
+}

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

@@ -6,9 +6,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
 /**
  * @Description: 用户分配
  * @Author: jeecg-boot
- * @Date:   2019-07-30
+ * @Date:   2019-07-31
  * @Version: V1.0
  */
 public interface IUserAllocationService extends IService<UserAllocation> {
 
+    UserAllocation selectByTaskId(String state);
 }

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

@@ -0,0 +1,32 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.jeecg.modules.ctop.entity.AuthTask;
+import org.jeecg.modules.ctop.entity.CTopOauthToken;
+import org.jeecg.modules.ctop.mapper.AuthTaskMapper;
+import org.jeecg.modules.ctop.service.IAuthTaskService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 关联用户分配
+ * @Author: jeecg-boot
+ * @Date: 2019-07-31
+ * @Version: V1.0
+ */
+@Service
+public class AuthTaskServiceImpl extends ServiceImpl<AuthTaskMapper, AuthTask> implements IAuthTaskService {
+
+    @Autowired
+    private AuthTaskMapper authTaskMapper;
+
+    @Override
+    public AuthTask getAuthTask(String taskId) {
+        QueryWrapper<AuthTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("task_id", taskId).orderByDesc("create_time");
+        AuthTask authTask = authTaskMapper.selectOne(queryWrapper);
+        return authTask;
+    }
+}

+ 44 - 48
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BindAccountServiceImpl.java

@@ -1,13 +1,16 @@
 package org.jeecg.modules.ctop.service.impl;
 
-import cn.com.ctop.common.utils.Check;
 import cn.com.ctop.common.utils.PropertiesUtils;
 import cn.com.ctop.toutiao.common.BytedanceInterfaceConstant;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import constant.KuaishouInterfaceConstant;
-import org.jeecg.modules.ctop.entity.BindAccount;
-import org.jeecg.modules.ctop.mapper.BindAccountMapper;
-import org.jeecg.modules.ctop.service.IBindAccountService;
+import org.jeecg.modules.ctop.entity.AuthTask;
+import org.jeecg.modules.ctop.entity.BindAccountAuth;
+import org.jeecg.modules.ctop.entity.UserAllocation;
+import org.jeecg.modules.ctop.mapper.AuthTaskMapper;
+import org.jeecg.modules.ctop.mapper.BindAccountAuthMapper;
+import org.jeecg.modules.ctop.mapper.UserAllocationMapper;
+import org.jeecg.modules.ctop.service.IBindAccountAuthService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,46 +19,26 @@ import org.springframework.stereotype.Service;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 /**
- * @Description: 账户绑定
+ * @Description: 账号绑定-授权
  * @Author: jeecg-boot
- * @Date: 2019-07-30
+ * @Date: 2019-07-31
  * @Version: V1.0
  */
 @Service
-public class BindAccountServiceImpl extends ServiceImpl<BindAccountMapper, BindAccount> implements IBindAccountService {
-    private static final Logger logger = LoggerFactory.getLogger(BindAccountServiceImpl.class);
-
+public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMapper, BindAccountAuth> implements IBindAccountAuthService {
+    private static final Logger logger = LoggerFactory.getLogger(BindAccountAuthServiceImpl.class);
     @Autowired
-    BindAccountMapper bindAccountMapper;
+    private AuthTaskMapper authTaskMapper;
 
-    @Override
-    public boolean bindLogin(String advertiserId, String accountName, String password, String loginType) {
-        Map<String, Object> requestMap = new HashMap<>();
-        requestMap.put("advertiser_id", advertiserId);
-        requestMap.put("account_name", accountName);
-        requestMap.put("login_type", loginType);
-        List<BindAccount> bindAccounts = bindAccountMapper.selectByMap(requestMap);
-        if (!Check.isNull(bindAccounts)) {
-            return false;
-        }
-        BindAccount bindAccount = new BindAccount();
-        bindAccount.setAdvertiserId(advertiserId);
-        bindAccount.setAccountName(accountName);
-        bindAccount.setPassword(password);
-        bindAccount.setType(KuaishouInterfaceConstant.TYPE_LOGIN);
-        bindAccount.setLoginType(loginType);
-        int i = bindAccountMapper.insert(bindAccount);
-        if (i > 0) {
-            logger.info("登录账号绑定成功,广告主id:{}", bindAccount.getAdvertiserId());
-            return true;
-        }
+    @Autowired
+    private BindAccountAuthMapper bindAccountAuthMapper;
 
-        return false;
-    }
+    @Autowired
+    private UserAllocationMapper userAllocationMapper;
 
     /**
      * 授权
@@ -65,46 +48,59 @@ public class BindAccountServiceImpl extends ServiceImpl<BindAccountMapper, BindA
      * @return
      */
     @Override
-    public String bindAuthorization(String advertiserId, String authorizationType) throws UnsupportedEncodingException {
+    public String bindAuthorization(String advertiserId, String authorizationType, UserAllocation userAllocation) throws UnsupportedEncodingException {
+        String taskId = UUID.randomUUID().toString();
+        AuthTask authTask = new AuthTask();
+        authTask.setAdvertiserId(advertiserId);
+        authTask.setTaskId(taskId);
+        int i = authTaskMapper.insert(authTask);
+        if (i > 0) {
+            logger.info("广告主关联id,auth_task入库完成,advertiserId:{}", advertiserId);
+        }
+
+        userAllocation.setTaskId(taskId);
+        userAllocation.setAdvertiserId(advertiserId);
+        int y = userAllocationMapper.insert(userAllocation);
+        if (y > 0) {
+            logger.info("用户分配,入库完成,advertiserId:{}", advertiserId);
+        }
+
         String codeUrl = "";
         if ("kuaishou".equals(authorizationType)) {
-            codeUrl = getKuaishouCodeUrl(advertiserId);
+            codeUrl = getKuaishouCodeUrl(taskId);
         }
         if ("toutiao".equals(authorizationType)) {
-            codeUrl = getByteDanceCodeUrl(advertiserId);
+            codeUrl = getByteDanceCodeUrl(taskId);
         }
 
         return codeUrl;
     }
 
-
     /**
      * 授权 绑定账号信息
      *
      * @param accountId
-     * @param type
      * @param state
-     * @param loginType
      */
     @Override
-    public void addBindAccount(Long accountId, String type, String state, String loginType) {
+    public void addBindAccount(Long accountId, String authType, String state) {
         Map<String, Object> deleteMap = new HashMap<>();
         deleteMap.put("advertiser_id", state);
         deleteMap.put("account_id", accountId);
-        deleteMap.put("type", type);
-        deleteMap.put("login_type", loginType);
-        bindAccountMapper.deleteByMap(deleteMap);
-        BindAccount bindAccount = new BindAccount();
+        deleteMap.put("auth_type", authType);
+        bindAccountAuthMapper.deleteByMap(deleteMap);
+        BindAccountAuth bindAccount = new BindAccountAuth();
         bindAccount.setAccountId(accountId);
-        bindAccount.setLoginType(loginType);
+
         bindAccount.setAdvertiserId(state);
-        bindAccount.setType(type);
-        int i = bindAccountMapper.insert(bindAccount);
+        bindAccount.setAuthType(authType);
+        int i = bindAccountAuthMapper.insert(bindAccount);
         if (i > 0) {
             logger.info("授权账号绑定成功,本地id:{},accountId:{}", bindAccount.getAdvertiserId(), accountId);
         }
     }
 
+
     @Override
     public String getKuaishouCodeUrl(String state) throws UnsupportedEncodingException {
         StringBuffer sb = new StringBuffer();

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

@@ -0,0 +1,54 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.utils.Check;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.BindAccountLogin;
+import org.jeecg.modules.ctop.mapper.BindAccountLoginMapper;
+import org.jeecg.modules.ctop.service.IBindAccountLoginService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 账号绑定-登陆
+ * @Author: jeecg-boot
+ * @Date: 2019-07-31
+ * @Version: V1.0
+ */
+@Service
+public class BindAccountLoginServiceImpl extends ServiceImpl<BindAccountLoginMapper, BindAccountLogin> implements IBindAccountLoginService {
+    private static final Logger logger = LoggerFactory.getLogger(BindAccountLoginServiceImpl.class);
+
+    @Autowired
+    private BindAccountLoginMapper bindAccountLoginMapper;
+
+    @Override
+    public boolean bindLogin(String advertiserId, String accountName, String password, String loginType) {
+        Map<String, Object> requestMap = new HashMap<>();
+        requestMap.put("advertiser_id", advertiserId);
+        requestMap.put("account_name", accountName);
+        requestMap.put("login_type", loginType);
+        List<BindAccountLogin> bindAccounts = bindAccountLoginMapper.selectByMap(requestMap);
+        if (!Check.isNull(bindAccounts)) {
+            return false;
+        }
+        BindAccountLogin bindAccountLogin = new BindAccountLogin();
+        bindAccountLogin.setAdvertiserId(advertiserId);
+        bindAccountLogin.setAccountName(accountName);
+        bindAccountLogin.setPassword(password);
+        bindAccountLogin.setLoginType(loginType);
+        int i = bindAccountLoginMapper.insert(bindAccountLogin);
+        if (i > 0) {
+            logger.info("登录账号绑定成功,广告主id:{}", bindAccountLogin.getAdvertiserId());
+            return true;
+        }
+
+        return false;
+    }
+
+}

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

@@ -1,8 +1,11 @@
 package org.jeecg.modules.ctop.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.jeecg.modules.ctop.entity.CTopOauthToken;
 import org.jeecg.modules.ctop.entity.UserAllocation;
 import org.jeecg.modules.ctop.mapper.UserAllocationMapper;
 import org.jeecg.modules.ctop.service.IUserAllocationService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -10,10 +13,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 /**
  * @Description: 用户分配
  * @Author: jeecg-boot
- * @Date:   2019-07-30
+ * @Date: 2019-07-31
  * @Version: V1.0
  */
 @Service
 public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper, UserAllocation> implements IUserAllocationService {
+    @Autowired
+    private UserAllocationMapper userAllocationMapper;
 
+    @Override
+    public UserAllocation selectByTaskId(String state) {
+        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("task_id", state).orderByDesc("create_time");
+        UserAllocation userAllocation = userAllocationMapper.selectOne(queryWrapper);
+        return userAllocation;
+    }
 }

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

@@ -0,0 +1,157 @@
+<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.advertiserId"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="task_id">
+              <a-input placeholder="请输入task_id" v-model="queryParam.taskId"></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 -->
+
+    <!-- 表单区域 -->
+    <authTask-modal ref="modalForm" @ok="modalFormOk"></authTask-modal>
+  </a-card>
+</template>
+
+<script>
+  import AuthTaskModal from './modules/AuthTaskModal'
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+
+  export default {
+    name: "AuthTaskList",
+    mixins:[JeecgListMixin],
+    components: {
+      AuthTaskModal
+    },
+    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: 'advertiserId'
+           },
+		   {
+            title: 'task_id',
+            align:"center",
+            dataIndex: 'taskId'
+           },
+          {
+            title: '操作',
+            dataIndex: 'action',
+            align:"center",
+            scopedSlots: { customRender: 'action' },
+          }
+        ],
+		url: {
+          list: "/ctop/authTask/list",
+          delete: "/ctop/authTask/delete",
+          deleteBatch: "/ctop/authTask/deleteBatch",
+          exportXlsUrl: "ctop/authTask/exportXls",
+          importExcelUrl: "ctop/authTask/importExcel",
+       },
+    }
+  },
+  computed: {
+    importExcelUrl: function(){
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+    }
+  },
+    methods: {
+     
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less'
+</style>

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

@@ -0,0 +1,168 @@
+<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.advertiserId"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="授权方式">
+              <a-input placeholder="请输入授权方式" v-model="queryParam.authType"></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.accountId"></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 -->
+
+    <!-- 表单区域 -->
+    <bindAccountAuth-modal ref="modalForm" @ok="modalFormOk"></bindAccountAuth-modal>
+  </a-card>
+</template>
+
+<script>
+  import BindAccountAuthModal from './modules/BindAccountAuthModal'
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+
+  export default {
+    name: "BindAccountAuthList",
+    mixins:[JeecgListMixin],
+    components: {
+      BindAccountAuthModal
+    },
+    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: 'advertiserId'
+           },
+		   {
+            title: '授权方式',
+            align:"center",
+            dataIndex: 'authType'
+           },
+		   {
+            title: '回调返回广告主id',
+            align:"center",
+            dataIndex: 'accountId'
+           },
+          {
+            title: '操作',
+            dataIndex: 'action',
+            align:"center",
+            scopedSlots: { customRender: 'action' },
+          }
+        ],
+		url: {
+          list: "/ctop/bindAccountAuth/list",
+          delete: "/ctop/bindAccountAuth/delete",
+          deleteBatch: "/ctop/bindAccountAuth/deleteBatch",
+          exportXlsUrl: "ctop/bindAccountAuth/exportXls",
+          importExcelUrl: "ctop/bindAccountAuth/importExcel",
+       },
+    }
+  },
+  computed: {
+    importExcelUrl: function(){
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+    }
+  },
+    methods: {
+     
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less'
+</style>

+ 18 - 23
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/BindAccountList.vue

@@ -23,13 +23,13 @@
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="8">
-            <a-form-item label="登录/授权方式">
-              <a-input placeholder="请输入登录/授权方式" v-model="queryParam.loginType"></a-input>
+            <a-form-item label="登录方式">
+              <a-input placeholder="请输入登录方式" v-model="queryParam.loginType"></a-input>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="8">
-            <a-form-item label="方式:登录或授权">
-              <a-input placeholder="请输入方式:登录或授权" v-model="queryParam.type"></a-input>
+            <a-form-item label="1未登陆 2已登陆">
+              <a-input placeholder="请输入1未登陆 2已登陆" v-model="queryParam.status"></a-input>
             </a-form-item>
           </a-col>
           </template>
@@ -51,7 +51,7 @@
     <!-- 操作按钮区域 -->
     <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-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>
@@ -103,23 +103,23 @@
     <!-- table区域-end -->
 
     <!-- 表单区域 -->
-    <bindAccount-modal ref="modalForm" @ok="modalFormOk"></bindAccount-modal>
+    <bindAccountLogin-modal ref="modalForm" @ok="modalFormOk"></bindAccountLogin-modal>
   </a-card>
 </template>
 
 <script>
-  import BindAccountModal from './modules/BindAccountModal'
+  import BindAccountLoginModal from './modules/BindAccountLoginModal'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 
   export default {
-    name: "BindAccountList",
+    name: "BindAccountLoginList",
     mixins:[JeecgListMixin],
     components: {
-      BindAccountModal
+      BindAccountLoginModal
     },
     data () {
       return {
-        description: '账户绑定管理页面',
+        description: '账号绑定-登陆管理页面',
         // 表头
         columns: [
           {
@@ -148,19 +148,14 @@
             dataIndex: 'password'
            },
 		   {
-            title: '登录/授权方式',
+            title: '登录方式',
             align:"center",
             dataIndex: 'loginType'
            },
 		   {
-            title: '方式:登录或授权',
+            title: '1未登陆 2已登陆',
             align:"center",
-            dataIndex: 'type'
-           },
-		   {
-            title: '回调返回广告主id',
-            align:"center",
-            dataIndex: 'accountId'
+            dataIndex: 'status'
            },
           {
             title: '操作',
@@ -170,11 +165,11 @@
           }
         ],
 		url: {
-          list: "/ctop/bindAccount/list",
-          delete: "/ctop/bindAccount/delete",
-          deleteBatch: "/ctop/bindAccount/deleteBatch",
-          exportXlsUrl: "ctop/bindAccount/exportXls",
-          importExcelUrl: "ctop/bindAccount/importExcel",
+          list: "/ctop/bindAccountLogin/list",
+          delete: "/ctop/bindAccountLogin/delete",
+          deleteBatch: "/ctop/bindAccountLogin/deleteBatch",
+          exportXlsUrl: "ctop/bindAccountLogin/exportXls",
+          importExcelUrl: "ctop/bindAccountLogin/importExcel",
        },
     }
   },

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

@@ -12,8 +12,8 @@
             </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 label="账户id --授权">
+              <a-input placeholder="请输入账户id --授权" v-model="queryParam.accountId"></a-input>
             </a-form-item>
           </a-col>
         <template v-if="toggleSearchStatus">
@@ -23,8 +23,8 @@
             </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 label="指定分配人">
+              <a-input placeholder="请输入指定分配人" v-model="queryParam.distributionName"></a-input>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="8">
@@ -138,7 +138,7 @@
             dataIndex: 'userId'
            },
 		   {
-            title: '账户id',
+            title: '账户id --授权',
             align:"center",
             dataIndex: 'accountId'
            },
@@ -148,7 +148,7 @@
             dataIndex: 'advertiserId'
            },
 		   {
-            title: '分配人',
+            title: '指定分配人',
             align:"center",
             dataIndex: 'distributionName'
            },
@@ -168,10 +168,25 @@
             dataIndex: 'advertiserName'
            },
 		   {
-            title: '账号姓名',
+            title: '输入账号  --登陆',
             align:"center",
             dataIndex: 'accountName'
            },
+		   {
+            title: 'task_id',
+            align:"center",
+            dataIndex: 'taskId'
+           },
+		   {
+            title: '操作人姓名',
+            align:"center",
+            dataIndex: 'operationName'
+           },
+		   {
+            title: '平台类型 1 头条 2快手',
+            align:"center",
+            dataIndex: 'mediaId'
+           },
           {
             title: '操作',
             dataIndex: 'action',

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

@@ -0,0 +1,130 @@
+<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="['advertiserId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="task_id">
+          <a-input placeholder="请输入task_id" v-decorator="['taskId', {}]" />
+        </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: "AuthTaskModal",
+    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/authTask/add",
+          edit: "/ctop/authTask/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,'advertiserId','taskId'))
+		  //时间格式化
+        });
+
+      },
+      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>

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

@@ -0,0 +1,137 @@
+<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="['advertiserId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="task_id">
+          <a-input placeholder="请输入task_id" v-decorator="['taskId', {}]" />
+        </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: "AuthTaskModal",
+    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/authTask/add",
+          edit: "/ctop/authTask/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,'advertiserId','taskId'))
+		  //时间格式化
+        });
+
+      },
+      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>

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

@@ -0,0 +1,136 @@
+<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="['advertiserId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="授权方式">
+          <a-input placeholder="请输入授权方式" v-decorator="['authType', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="回调返回广告主id">
+          <a-input placeholder="请输入回调返回广告主id" v-decorator="['accountId', {}]" />
+        </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: "BindAccountAuthModal",
+    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/bindAccountAuth/add",
+          edit: "/ctop/bindAccountAuth/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,'advertiserId','authType','accountId'))
+		  //时间格式化
+        });
+
+      },
+      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>

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

@@ -0,0 +1,143 @@
+<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="['advertiserId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="授权方式">
+          <a-input placeholder="请输入授权方式" v-decorator="['authType', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="回调返回广告主id">
+          <a-input placeholder="请输入回调返回广告主id" v-decorator="['accountId', {}]" />
+        </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: "BindAccountAuthModal",
+    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/bindAccountAuth/add",
+          edit: "/ctop/bindAccountAuth/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,'advertiserId','authType','accountId'))
+		  //时间格式化
+        });
+
+      },
+      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>

+ 8 - 14
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BindAccountModal.vue

@@ -32,20 +32,14 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="登录/授权方式">
-          <a-input placeholder="请输入登录/授权方式" v-decorator="['loginType', {}]" />
+          label="登录方式">
+          <a-input placeholder="请输入登录方式" v-decorator="['loginType', {}]" />
         </a-form-item>
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="方式:登录或授权">
-          <a-input placeholder="请输入方式:登录或授权" v-decorator="['type', {}]" />
-        </a-form-item>
-        <a-form-item
-          :labelCol="labelCol"
-          :wrapperCol="wrapperCol"
-          label="回调返回广告主id">
-          <a-input placeholder="请输入回调返回广告主id" v-decorator="['accountId', {}]" />
+          label="1未登陆 2已登陆">
+          <a-input placeholder="请输入1未登陆 2已登陆" v-decorator="['status', {}]" />
         </a-form-item>
 		
       </a-form>
@@ -59,7 +53,7 @@
   import moment from "moment"
 
   export default {
-    name: "BindAccountModal",
+    name: "BindAccountLoginModal",
     data () {
       return {
         title:"操作",
@@ -79,8 +73,8 @@
         validatorRules:{
         },
         url: {
-          add: "/ctop/bindAccount/add",
-          edit: "/ctop/bindAccount/edit",
+          add: "/ctop/bindAccountLogin/add",
+          edit: "/ctop/bindAccountLogin/edit",
         },
       }
     },
@@ -95,7 +89,7 @@
         this.model = Object.assign({}, record);
         this.visible = true;
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model,'advertiserId','accountName','password','loginType','type','accountId'))
+          this.form.setFieldsValue(pick(this.model,'advertiserId','accountName','password','loginType','status'))
 		  //时间格式化
         });
 

+ 8 - 14
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BindAccountModal__Style#Drawer.vue

@@ -32,20 +32,14 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="登录/授权方式">
-          <a-input placeholder="请输入登录/授权方式" v-decorator="['loginType', {}]" />
+          label="登录方式">
+          <a-input placeholder="请输入登录方式" v-decorator="['loginType', {}]" />
         </a-form-item>
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="方式:登录或授权">
-          <a-input placeholder="请输入方式:登录或授权" v-decorator="['type', {}]" />
-        </a-form-item>
-        <a-form-item
-          :labelCol="labelCol"
-          :wrapperCol="wrapperCol"
-          label="回调返回广告主id">
-          <a-input placeholder="请输入回调返回广告主id" v-decorator="['accountId', {}]" />
+          label="1未登陆 2已登陆">
+          <a-input placeholder="请输入1未登陆 2已登陆" v-decorator="['status', {}]" />
         </a-form-item>
 		
       </a-form>
@@ -61,7 +55,7 @@
   import moment from "moment"
 
   export default {
-    name: "BindAccountModal",
+    name: "BindAccountLoginModal",
     data () {
       return {
         title:"操作",
@@ -81,8 +75,8 @@
         validatorRules:{
         },
         url: {
-          add: "/ctop/bindAccount/add",
-          edit: "/ctop/bindAccount/edit",
+          add: "/ctop/bindAccountLogin/add",
+          edit: "/ctop/bindAccountLogin/edit",
         },
       }
     },
@@ -97,7 +91,7 @@
         this.model = Object.assign({}, record);
         this.visible = true;
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model,'advertiserId','accountName','password','loginType','type','accountId'))
+          this.form.setFieldsValue(pick(this.model,'advertiserId','accountName','password','loginType','status'))
 		  //时间格式化
         });
 

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

@@ -20,8 +20,8 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="账户id">
-          <a-input placeholder="请输入账户id" v-decorator="['accountId', {}]" />
+          label="账户id --授权">
+          <a-input placeholder="请输入账户id --授权" v-decorator="['accountId', {}]" />
         </a-form-item>
         <a-form-item
           :labelCol="labelCol"
@@ -32,8 +32,8 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="分配人">
-          <a-input placeholder="请输入分配人" v-decorator="['distributionName', {}]" />
+          label="指定分配人">
+          <a-input placeholder="请输入指定分配人" v-decorator="['distributionName', {}]" />
         </a-form-item>
         <a-form-item
           :labelCol="labelCol"
@@ -56,8 +56,26 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="账号姓名">
-          <a-input placeholder="请输入账号姓名" v-decorator="['accountName', {}]" />
+          label="输入账号  --登陆">
+          <a-input placeholder="请输入输入账号  --登陆" v-decorator="['accountName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="task_id">
+          <a-input placeholder="请输入task_id" v-decorator="['taskId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="操作人姓名">
+          <a-input placeholder="请输入操作人姓名" v-decorator="['operationName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="平台类型 1 头条 2快手">
+          <a-input placeholder="请输入平台类型 1 头条 2快手" v-decorator="['mediaId', {}]" />
         </a-form-item>
 		
       </a-form>
@@ -107,7 +125,7 @@
         this.model = Object.assign({}, record);
         this.visible = true;
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model,'userId','accountId','advertiserId','distributionName','departmentId','adminName','advertiserName','accountName'))
+          this.form.setFieldsValue(pick(this.model,'userId','accountId','advertiserId','distributionName','departmentId','adminName','advertiserName','accountName','taskId','operationName','mediaId'))
 		  //时间格式化
         });
 

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

@@ -20,8 +20,8 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="账户id">
-          <a-input placeholder="请输入账户id" v-decorator="['accountId', {}]" />
+          label="账户id --授权">
+          <a-input placeholder="请输入账户id --授权" v-decorator="['accountId', {}]" />
         </a-form-item>
         <a-form-item
           :labelCol="labelCol"
@@ -32,8 +32,8 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="分配人">
-          <a-input placeholder="请输入分配人" v-decorator="['distributionName', {}]" />
+          label="指定分配人">
+          <a-input placeholder="请输入指定分配人" v-decorator="['distributionName', {}]" />
         </a-form-item>
         <a-form-item
           :labelCol="labelCol"
@@ -56,8 +56,26 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
-          label="账号姓名">
-          <a-input placeholder="请输入账号姓名" v-decorator="['accountName', {}]" />
+          label="输入账号  --登陆">
+          <a-input placeholder="请输入输入账号  --登陆" v-decorator="['accountName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="task_id">
+          <a-input placeholder="请输入task_id" v-decorator="['taskId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="操作人姓名">
+          <a-input placeholder="请输入操作人姓名" v-decorator="['operationName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="平台类型 1 头条 2快手">
+          <a-input placeholder="请输入平台类型 1 头条 2快手" v-decorator="['mediaId', {}]" />
         </a-form-item>
 		
       </a-form>
@@ -109,7 +127,7 @@
         this.model = Object.assign({}, record);
         this.visible = true;
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model,'userId','accountId','advertiserId','distributionName','departmentId','adminName','advertiserName','accountName'))
+          this.form.setFieldsValue(pick(this.model,'userId','accountId','advertiserId','distributionName','departmentId','adminName','advertiserName','accountName','taskId','operationName','mediaId'))
 		  //时间格式化
         });
 

+ 274 - 267
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java

@@ -39,291 +39,298 @@ import java.util.*;
  */
 @RestController
 @RequestMapping("/sys")
-@Api(tags="用户登录")
+@Api(tags = "用户登录")
 @Slf4j
 public class LoginController {
-	@Autowired
-	private ISysUserService sysUserService;
-	@Autowired
-	private ISysBaseAPI sysBaseAPI;
-	@Autowired
-	private ISysLogService logService;
-	@Autowired
+    @Autowired
+    private ISysUserService sysUserService;
+    @Autowired
+    private ISysBaseAPI sysBaseAPI;
+    @Autowired
+    private ISysLogService logService;
+    @Autowired
     private RedisUtil redisUtil;
-	@Autowired
+    @Autowired
     private ISysDepartService sysDepartService;
 
-	@RequestMapping(value = "/login", method = RequestMethod.POST)
-	@ApiOperation("登录接口")
-	public Result<JSONObject> login(@RequestBody SysLoginModel sysLoginModel) throws Exception {
-		Result<JSONObject> result = new Result<JSONObject>();
-		String username = sysLoginModel.getUsername();
-		String password = sysLoginModel.getPassword();
-		//步骤1:TODO 前端密码加密,后端进行密码解密,防止传输密码篡改等问题,不配就直接提示密码错误,并记录日志后期进行统计分析是否锁定
-		password = AesEncryptUtil.desEncrypt(sysLoginModel.getPassword()).trim();//密码解密
-		//1. 校验用户是否有效
-		SysUser sysUser = sysUserService.getUserByName(username);
-		result = sysUserService.checkUserIsEffective(sysUser);
-		if(!result.isSuccess()) {
-			return result;
-		}
-		
-		//2. 校验用户名或密码是否正确
-		String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
-		String syspassword = sysUser.getPassword();
-		if (!syspassword.equals(userpassword)) {
-			result.error500("用户名或密码错误");
-			return result;
-		}
-				
-		//用户登录信息
-		userInfo(sysUser, result);
-		sysBaseAPI.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
-		return result;
-	}
-	
-	/**
-	 * 退出登录
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping(value = "/logout")
-	public Result<Object> logout(HttpServletRequest request,HttpServletResponse response) {
-		//用户退出逻辑
-		Subject subject = SecurityUtils.getSubject();
-		LoginUser sysUser = (LoginUser)subject.getPrincipal();
-		sysBaseAPI.addLog("用户名: "+sysUser.getRealname()+",退出成功!", CommonConstant.LOG_TYPE_1, null);
-		log.info(" 用户名:  "+sysUser.getRealname()+",退出成功! ");
-	    subject.logout();
+    @RequestMapping(value = "/login", method = RequestMethod.POST)
+    @ApiOperation("登录接口")
+    public Result<JSONObject> login(@RequestBody SysLoginModel sysLoginModel) throws Exception {
+        Result<JSONObject> result = new Result<JSONObject>();
+        String username = sysLoginModel.getUsername();
+        String password = sysLoginModel.getPassword();
+        //步骤1:TODO 前端密码加密,后端进行密码解密,防止传输密码篡改等问题,不配就直接提示密码错误,并记录日志后期进行统计分析是否锁定
+        password = AesEncryptUtil.desEncrypt(sysLoginModel.getPassword()).trim();//密码解密
+        //1. 校验用户是否有效
+        SysUser sysUser = sysUserService.getUserByName(username);
+        String departId = sysDepartService.selectIdByOrdCode(sysUser.getOrgCode());
+        sysUser.setDepartId(departId);
+        result = sysUserService.checkUserIsEffective(sysUser);
+        if (!result.isSuccess()) {
+            return result;
+        }
 
-	    String token = request.getHeader(DefContants.X_ACCESS_TOKEN);
-	    //清空用户Token缓存
-	    redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + token);
-	    //清空用户权限缓存:权限Perms和角色集合
-	    redisUtil.del(CommonConstant.LOGIN_USER_CACHERULES_ROLE + sysUser.getUsername());
-	    redisUtil.del(CommonConstant.LOGIN_USER_CACHERULES_PERMISSION + sysUser.getUsername());
-		return Result.ok("退出登录成功!");
-	}
-	
-	/**
-	 * 获取访问量
-	 * @return
-	 */
-	@GetMapping("loginfo")
-	public Result<JSONObject> loginfo() {
-		Result<JSONObject> result = new Result<JSONObject>();
-		JSONObject obj = new JSONObject();
-		//update-begin--Author:zhangweijian  Date:20190428 for:传入开始时间,结束时间参数
-		// 获取一天的开始和结束时间
-		Calendar calendar = new GregorianCalendar();
-		calendar.set(Calendar.HOUR_OF_DAY, 0);
-		calendar.set(Calendar.MINUTE, 0);
-		calendar.set(Calendar.SECOND, 0);
-		calendar.set(Calendar.MILLISECOND, 0);
-		Date dayStart = calendar.getTime();
-		calendar.add(Calendar.DATE, 1);
-		Date dayEnd = calendar.getTime();
-		// 获取系统访问记录
-		Long totalVisitCount = logService.findTotalVisitCount();
-		obj.put("totalVisitCount", totalVisitCount);
-		Long todayVisitCount = logService.findTodayVisitCount(dayStart,dayEnd);
-		obj.put("todayVisitCount", todayVisitCount);
-		Long todayIp = logService.findTodayIp(dayStart,dayEnd);
-		//update-end--Author:zhangweijian  Date:20190428 for:传入开始时间,结束时间参数
-		obj.put("todayIp", todayIp);
-		result.setResult(obj);
-		result.success("登录成功");
-		return result;
-	}
-	
-	/**
-	 * 获取访问量
-	 * @return
-	 */
-	@GetMapping("visitInfo")
-	public Result<List<Map<String,Object>>> visitInfo() {
-		Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
-		Calendar calendar = new GregorianCalendar();
-		calendar.set(Calendar.HOUR_OF_DAY,0);
-        calendar.set(Calendar.MINUTE,0);
-        calendar.set(Calendar.SECOND,0);
-        calendar.set(Calendar.MILLISECOND,0);
+        //2. 校验用户名或密码是否正确
+        String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
+        String syspassword = sysUser.getPassword();
+        if (!syspassword.equals(userpassword)) {
+            result.error500("用户名或密码错误");
+            return result;
+        }
+
+        //用户登录信息
+        userInfo(sysUser, result);
+        sysBaseAPI.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
+        return result;
+    }
+
+    /**
+     * 退出登录
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/logout")
+    public Result<Object> logout(HttpServletRequest request, HttpServletResponse response) {
+        //用户退出逻辑
+        Subject subject = SecurityUtils.getSubject();
+        LoginUser sysUser = (LoginUser) subject.getPrincipal();
+        sysBaseAPI.addLog("用户名: " + sysUser.getRealname() + ",退出成功!", CommonConstant.LOG_TYPE_1, null);
+        log.info(" 用户名:  " + sysUser.getRealname() + ",退出成功! ");
+        subject.logout();
+
+        String token = request.getHeader(DefContants.X_ACCESS_TOKEN);
+        //清空用户Token缓存
+        redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + token);
+        //清空用户权限缓存:权限Perms和角色集合
+        redisUtil.del(CommonConstant.LOGIN_USER_CACHERULES_ROLE + sysUser.getUsername());
+        redisUtil.del(CommonConstant.LOGIN_USER_CACHERULES_PERMISSION + sysUser.getUsername());
+        return Result.ok("退出登录成功!");
+    }
+
+    /**
+     * 获取访问量
+     *
+     * @return
+     */
+    @GetMapping("loginfo")
+    public Result<JSONObject> loginfo() {
+        Result<JSONObject> result = new Result<JSONObject>();
+        JSONObject obj = new JSONObject();
+        //update-begin--Author:zhangweijian  Date:20190428 for:传入开始时间,结束时间参数
+        // 获取一天的开始和结束时间
+        Calendar calendar = new GregorianCalendar();
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        Date dayStart = calendar.getTime();
+        calendar.add(Calendar.DATE, 1);
+        Date dayEnd = calendar.getTime();
+        // 获取系统访问记录
+        Long totalVisitCount = logService.findTotalVisitCount();
+        obj.put("totalVisitCount", totalVisitCount);
+        Long todayVisitCount = logService.findTodayVisitCount(dayStart, dayEnd);
+        obj.put("todayVisitCount", todayVisitCount);
+        Long todayIp = logService.findTodayIp(dayStart, dayEnd);
+        //update-end--Author:zhangweijian  Date:20190428 for:传入开始时间,结束时间参数
+        obj.put("todayIp", todayIp);
+        result.setResult(obj);
+        result.success("登录成功");
+        return result;
+    }
+
+    /**
+     * 获取访问量
+     *
+     * @return
+     */
+    @GetMapping("visitInfo")
+    public Result<List<Map<String, Object>>> visitInfo() {
+        Result<List<Map<String, Object>>> result = new Result<List<Map<String, Object>>>();
+        Calendar calendar = new GregorianCalendar();
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
         calendar.add(Calendar.DAY_OF_MONTH, 1);
         Date dayEnd = calendar.getTime();
         calendar.add(Calendar.DAY_OF_MONTH, -7);
         Date dayStart = calendar.getTime();
-        List<Map<String,Object>> list = logService.findVisitCount(dayStart, dayEnd);
-		result.setResult(oConvertUtils.toLowerCasePageList(list));
-		return result;
-	}
-	
-	
-	/**
-	 * 登陆成功选择用户当前部门
-	 * @param user
-	 * @return
-	 */
-	@RequestMapping(value = "/selectDepart", method = RequestMethod.PUT)
-	public Result<?> selectDepart(@RequestBody SysUser user) {
-		String username = user.getUsername();
-		if(oConvertUtils.isEmpty(username)) {
-			LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
-			username = sysUser.getUsername();
-		}
-		String orgCode= user.getOrgCode();
-		this.sysUserService.updateUserDepart(username, orgCode);
-		return Result.ok();
-	}
+        List<Map<String, Object>> list = logService.findVisitCount(dayStart, dayEnd);
+        result.setResult(oConvertUtils.toLowerCasePageList(list));
+        return result;
+    }
+
+
+    /**
+     * 登陆成功选择用户当前部门
+     *
+     * @param user
+     * @return
+     */
+    @RequestMapping(value = "/selectDepart", method = RequestMethod.PUT)
+    public Result<?> selectDepart(@RequestBody SysUser user) {
+        String username = user.getUsername();
+        if (oConvertUtils.isEmpty(username)) {
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            username = sysUser.getUsername();
+        }
+        String orgCode = user.getOrgCode();
+        this.sysUserService.updateUserDepart(username, orgCode);
+        return Result.ok();
+    }
+
+    /**
+     * 短信登录接口
+     *
+     * @param jsonObject
+     * @return
+     */
+    @PostMapping(value = "/sms")
+    public Result<String> sms(@RequestBody JSONObject jsonObject) {
+        Result<String> result = new Result<String>();
+        String mobile = jsonObject.get("mobile").toString();
+        String smsmode = jsonObject.get("smsmode").toString();
+        log.info(mobile);
+        Object object = redisUtil.get(mobile);
+        if (object != null) {
+            result.setMessage("验证码10分钟内,仍然有效!");
+            result.setSuccess(false);
+            return result;
+        }
+
+        //随机数
+        String captcha = RandomUtil.randomNumbers(6);
+        try {
+            boolean b = false;
+            //注册模板
+            if (CommonConstant.SMS_TPL_TYPE_1.equals(smsmode)) {
+                SysUser sysUser = sysUserService.getUserByPhone(mobile);
+                if (sysUser != null) {
+                    result.error500(" 手机号已经注册,请直接登录!");
+                    sysBaseAPI.addLog("手机号已经注册,请直接登录!", CommonConstant.LOG_TYPE_1, null);
+                    return result;
+                }
+                b = DySmsHelper.sendSms(mobile, captcha, DySmsHelper.REGISTER_TEMPLATE_CODE);
+            } else {
+                //登录模式,校验用户有效性
+                SysUser sysUser = sysUserService.getUserByPhone(mobile);
+                result = sysUserService.checkUserIsEffective(sysUser);
+                if (!result.isSuccess()) {
+                    return result;
+                }
+
+                /**
+                 * smsmode 短信模板方式  0 .登录模板、1.注册模板、2.忘记密码模板
+                 */
+                if (CommonConstant.SMS_TPL_TYPE_0.equals(smsmode)) {
+                    //登录模板
+                    b = DySmsHelper.sendSms(mobile, captcha, DySmsHelper.LOGIN_TEMPLATE_CODE);
+                } else if (CommonConstant.SMS_TPL_TYPE_2.equals(smsmode)) {
+                    //忘记密码模板
+                    b = DySmsHelper.sendSms(mobile, captcha, DySmsHelper.FORGET_PASSWORD_TEMPLATE_CODE);
+                }
+            }
+
+            if (b == false) {
+                result.setMessage("短信验证码发送失败,请稍后重试");
+                result.setSuccess(false);
+                return result;
+            }
+            //验证码10分钟内有效
+            redisUtil.set(mobile, captcha, 600);
+            result.setResult(captcha);
+            result.setSuccess(true);
 
-	/**
-	 * 短信登录接口
-	 * 
-	 * @param jsonObject
-	 * @return
-	 */
-	@PostMapping(value = "/sms")
-	public Result<String> sms(@RequestBody JSONObject jsonObject) {
-		Result<String> result = new Result<String>();
-		String mobile = jsonObject.get("mobile").toString();
-		String smsmode=jsonObject.get("smsmode").toString();
-		log.info(mobile);	
-		Object object = redisUtil.get(mobile);
-		if (object != null) {
-			result.setMessage("验证码10分钟内,仍然有效!");
-			result.setSuccess(false);
-			return result;
-		}
+        } catch (ClientException e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
 
-		//随机数
-		String captcha = RandomUtil.randomNumbers(6);
-		try {
-			boolean b = false;
-			//注册模板
-			if (CommonConstant.SMS_TPL_TYPE_1.equals(smsmode)) {
-				SysUser sysUser = sysUserService.getUserByPhone(mobile);
-				if(sysUser!=null) {
-					result.error500(" 手机号已经注册,请直接登录!");
-					sysBaseAPI.addLog("手机号已经注册,请直接登录!", CommonConstant.LOG_TYPE_1, null);
-					return result;
-				}
-				b = DySmsHelper.sendSms(mobile, captcha, DySmsHelper.REGISTER_TEMPLATE_CODE);
-			}else {
-				//登录模式,校验用户有效性
-				SysUser sysUser = sysUserService.getUserByPhone(mobile);
-				result = sysUserService.checkUserIsEffective(sysUser);
-				if(!result.isSuccess()) {
-					return result;
-				}
-				
-				/**
-				 * smsmode 短信模板方式  0 .登录模板、1.注册模板、2.忘记密码模板
-				 */
-				if (CommonConstant.SMS_TPL_TYPE_0.equals(smsmode)) {
-					//登录模板
-					b = DySmsHelper.sendSms(mobile, captcha, DySmsHelper.LOGIN_TEMPLATE_CODE);
-				} else if(CommonConstant.SMS_TPL_TYPE_2.equals(smsmode)) {
-					//忘记密码模板
-					b = DySmsHelper.sendSms(mobile, captcha, DySmsHelper.FORGET_PASSWORD_TEMPLATE_CODE);
-				}
-			}
 
-			if (b == false) {
-				result.setMessage("短信验证码发送失败,请稍后重试");
-				result.setSuccess(false);
-				return result;
-			}
-			//验证码10分钟内有效
-			redisUtil.set(mobile, captcha, 600);
-			result.setResult(captcha);
-			result.setSuccess(true);
+    /**
+     * 手机号登录接口
+     *
+     * @param jsonObject
+     * @return
+     */
+    @PostMapping("/phoneLogin")
+    public Result<JSONObject> login(@RequestBody JSONObject jsonObject) {
+        Result<JSONObject> result = new Result<JSONObject>();
+        String phone = jsonObject.getString("mobile");
 
-		} catch (ClientException e) {
-			e.printStackTrace();
-		}
-		return result;
-	}
-	
+        //校验用户有效性
+        SysUser sysUser = sysUserService.getUserByPhone(phone);
+        result = sysUserService.checkUserIsEffective(sysUser);
+        if (!result.isSuccess()) {
+            return result;
+        }
 
-	/**
-	 * 手机号登录接口
-	 * 
-	 * @param jsonObject
-	 * @return
-	 */
-	@PostMapping("/phoneLogin")
-	public Result<JSONObject> login(@RequestBody JSONObject jsonObject) {
-		Result<JSONObject> result = new Result<JSONObject>();
-		String phone = jsonObject.getString("mobile");
-		
-		//校验用户有效性
-		SysUser sysUser = sysUserService.getUserByPhone(phone);
-		result = sysUserService.checkUserIsEffective(sysUser);
-		if(!result.isSuccess()) {
-			return result;
-		}
-		
-		String smscode = jsonObject.getString("captcha");
-		Object code = redisUtil.get(phone);
-		if (!smscode.equals(code)) {
-			result.setMessage("手机验证码错误");
-			return result;
-		}
-		//用户信息
-		userInfo(sysUser, result);
-		//添加日志
-		sysBaseAPI.addLog("用户名: " + sysUser.getUsername() + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
+        String smscode = jsonObject.getString("captcha");
+        Object code = redisUtil.get(phone);
+        if (!smscode.equals(code)) {
+            result.setMessage("手机验证码错误");
+            return result;
+        }
+        //用户信息
+        userInfo(sysUser, result);
+        //添加日志
+        sysBaseAPI.addLog("用户名: " + sysUser.getUsername() + ",登录成功!", CommonConstant.LOG_TYPE_1, null);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	/**
-	 * 用户信息
-	 *
-	 * @param sysUser
-	 * @param result
-	 * @return
-	 */
-	private Result<JSONObject> userInfo(SysUser sysUser, Result<JSONObject> result) {
-		String syspassword = sysUser.getPassword();
-		String username = sysUser.getUsername();
-		// 生成token
-		String token = JwtUtil.sign(username, syspassword);
-		redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
-		// 设置超时时间
-		redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
+    /**
+     * 用户信息
+     *
+     * @param sysUser
+     * @param result
+     * @return
+     */
+    private Result<JSONObject> userInfo(SysUser sysUser, Result<JSONObject> result) {
+        String syspassword = sysUser.getPassword();
+        String username = sysUser.getUsername();
+        // 生成token
+        String token = JwtUtil.sign(username, syspassword);
+        redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
+        // 设置超时时间
+        redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
 
-		// 获取用户部门信息
-		JSONObject obj = new JSONObject();
-		List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
-		obj.put("departs", departs);
-		if (departs == null || departs.size() == 0) {
-			obj.put("multi_depart", 0);
-		} else if (departs.size() == 1) {
-			sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
-			obj.put("multi_depart", 1);
-		} else {
-			obj.put("multi_depart", 2);
-		}
-		obj.put("token", token);
-		obj.put("userInfo", sysUser);
-		result.setResult(obj);
-		result.success("登录成功");
-		return result;
-	}
+        // 获取用户部门信息
+        JSONObject obj = new JSONObject();
+        List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
+        obj.put("departs", departs);
+        if (departs == null || departs.size() == 0) {
+            obj.put("multi_depart", 0);
+        } else if (departs.size() == 1) {
+            sysUserService.updateUserDepart(username, departs.get(0).getOrgCode());
+            obj.put("multi_depart", 1);
+        } else {
+            obj.put("multi_depart", 2);
+        }
+        obj.put("token", token);
+        obj.put("userInfo", sysUser);
+        result.setResult(obj);
+        result.success("登录成功");
+        return result;
+    }
 
-	/**
-	 * 获取加密字符串
-	 * @return
-	 */
-	@GetMapping(value = "/getEncryptedString")
-	public Result<Map<String,String>> getEncryptedString(){
-		Result<Map<String,String>> result = new Result<Map<String,String>>();
-		Map<String,String> map = new HashMap<String,String>();
-		map.put("key", EncryptedString.key);
-		map.put("iv",EncryptedString.iv);
-		result.setResult(map);
-		return result;
-	}
+    /**
+     * 获取加密字符串
+     *
+     * @return
+     */
+    @GetMapping(value = "/getEncryptedString")
+    public Result<Map<String, String>> getEncryptedString() {
+        Result<Map<String, String>> result = new Result<Map<String, String>>();
+        Map<String, String> map = new HashMap<String, String>();
+        map.put("key", EncryptedString.key);
+        map.put("iv", EncryptedString.iv);
+        result.setResult(map);
+        return result;
+    }
 }

+ 8 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysUser.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.system.entity;
 
 import java.util.Date;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecgframework.poi.excel.annotation.Excel;
@@ -77,7 +78,7 @@ public class SysUser implements Serializable {
     /**
      * 性别(1:男 2:女)
      */
-    @Excel(name = "性别", width = 15,dicCode="sex")
+    @Excel(name = "性别", width = 15, dicCode = "sex")
     @Dict(dicCode = "sex")
     private Integer sex;
 
@@ -101,14 +102,14 @@ public class SysUser implements Serializable {
     /**
      * 状态(1:正常  2:冻结 )
      */
-    @Excel(name = "状态", width = 15,dicCode="user_status")
+    @Excel(name = "状态", width = 15, dicCode = "user_status")
     @Dict(dicCode = "user_status")
     private Integer status;
 
     /**
      * 删除状态(0,正常,1已删除)
      */
-    @Excel(name = "删除状态", width = 15,dicCode="del_flag")
+    @Excel(name = "删除状态", width = 15, dicCode = "del_flag")
     @TableLogic
     private String delFlag;
 
@@ -137,4 +138,8 @@ public class SysUser implements Serializable {
     private String activitiSync;
 
 
+    @TableField(exist = false)
+    private String departId;
+
+
 }

+ 26 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java

@@ -3,64 +3,78 @@ package org.jeecg.modules.system.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.model.SysDepartTreeModel;
+
 import java.util.List;
 
 /**
  * <p>
  * 部门表 服务实现类
  * <p>
- * 
+ *
  * @Author:Steve
- * @Since:   2019-01-22
+ * @Since: 2019-01-22
  */
-public interface ISysDepartService extends IService<SysDepart>{
+public interface ISysDepartService extends IService<SysDepart> {
 
 
     /**
      * 查询所有部门信息,并分节点进行显示
+     *
      * @return
      */
     List<SysDepartTreeModel> queryTreeList();
 
     /**
      * 保存部门数据
+     *
      * @param sysDepart
      */
-    void saveDepartData(SysDepart sysDepart,String username);
+    void saveDepartData(SysDepart sysDepart, String username);
 
     /**
      * 更新depart数据
+     *
      * @param sysDepart
      * @return
      */
-    Boolean updateDepartDataById(SysDepart sysDepart,String username);
-    
+    Boolean updateDepartDataById(SysDepart sysDepart, String username);
+
     /**
      * 删除depart数据
      * @param id
      * @return
      */
-	/* boolean removeDepartDataById(String id); */
-    
+    /* boolean removeDepartDataById(String id); */
+
     /**
      * 根据关键字搜索相关的部门数据
+     *
      * @param keyWord
      * @return
      */
     List<SysDepartTreeModel> searhBy(String keyWord);
-    
+
     /**
      * 根据部门id删除并删除其可能存在的子级部门
+     *
      * @param id
      * @return
      */
     boolean delete(String id);
-    
+
     /**
      * 查询SysDepart集合
+     *
      * @param userId
      * @return
      */
-	public List<SysDepart> queryUserDeparts(String userId);
-    
+    public List<SysDepart> queryUserDeparts(String userId);
+
+    /**
+     * 查询departId
+     *
+     * @param orgCode
+     * @return
+     */
+    String selectIdByOrdCode(String orgCode);
 }

File diff suppressed because it is too large
+ 218 - 199
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java