Ver código fonte

修改账号绑定

yumeng 5 anos atrás
pai
commit
4544f0ac05

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

@@ -1,250 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import com.alibaba.fastjson.JSON;
-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.AuthTask;
-import org.jeecg.modules.ctop.service.IAuthTaskService;
-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;
-
-/**
- * TODO 相关AuthTask 需要删除
- *
- * @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("文件导入失败!");
-    }
-}

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

@@ -1,10 +1,10 @@
 package org.jeecg.modules.ctop.controller;
 
-import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -13,9 +13,11 @@ 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.apache.shiro.SecurityUtils;
 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.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -79,17 +81,17 @@ public class BindAccountLoginController {
         String userId = json.getString("userId");
         String password = json.getString("password");
         String loginType = json.getString("loginType");
+        // 广告主名称
+        String advertiserName = json.getString("advertiser_name");
         //账号
         String accountName = json.getString("accountName");
-        boolean trueOrFalse = createInternalService.bindLogin(advertiserId, accountName, password, loginType, userId);
+        boolean trueOrFalse = createInternalService.bindLogin(advertiserId, accountName, password, loginType, userId, advertiserName);
         if (trueOrFalse) {
             String realName = json.getString("realName");
             //部门id
             String departmentId = json.getString("departmentId");
             //指定分配人姓名
             String distributionName = json.getString("distributionName");
-            // 广告主名称
-            String advertiserName = json.getString("advertiser_name");
             // 媒体类型: 1 头条 2 快手
             String mediaId = json.getString("mediaId");
             UserAllocation userAllocation = new UserAllocation();
@@ -130,6 +132,11 @@ public class BindAccountLoginController {
                                                          HttpServletRequest req) {
         Result<IPage<BindAccountLogin>> result = new Result<>();
         QueryWrapper<BindAccountLogin> queryWrapper = QueryGenerator.initQueryWrapper(bindAccountLogin, req.getParameterMap());
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        if (!Check.isNull(user)) {
+            queryWrapper.eq("user_id", user.getId());
+        }
+        queryWrapper.orderByDesc("id");
         Page<BindAccountLogin> page = new Page<>(pageNo, pageSize);
         IPage<BindAccountLogin> pageList = bindAccountLoginService.page(page, queryWrapper);
         result.setSuccess(true);

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

@@ -1,44 +0,0 @@
-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;
-
-/**
- * 关联用户分配
- * @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;
-}

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

@@ -1,14 +0,0 @@
-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> {
-
-}

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

@@ -1,5 +0,0 @@
-<?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.AuthTaskMapper">
-
-</mapper>

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

@@ -1,14 +0,0 @@
-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);
-}

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

@@ -9,5 +9,5 @@ public interface ICreateInternalService {
 
     Map<String, Object> checkAccountPassword(String account, String password);
 
-    public boolean bindLogin(String advertiserId, String accountName, String password, String loginType, String userId);
+     boolean bindLogin(String advertiserId, String accountName, String password, String loginType, String userId,String advertiserName);
 }

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

@@ -1,31 +0,0 @@
-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.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;
-    }
-}

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java

@@ -39,6 +39,13 @@ public class BindAccountLogin {
     @Excel(name = "广告id", width = 15)
     @ApiModelProperty(value = "广告id")
     private String advertiserId;
+
+    /**
+     * 广告名称
+     */
+    @Excel(name = "广告名称", width = 15)
+    @ApiModelProperty(value = "广告名称")
+    private String advertiserName;
     /**
      * 广告id
      */