Jelajahi Sumber

Merge branch 'test' of http://39.106.184.70:3000/ctop/adsp-boot into test

xuzuoyun 5 tahun lalu
induk
melakukan
261caeb7dc
38 mengubah file dengan 1487 tambahan dan 13 penghapusan
  1. 5 0
      jeecg-boot-module-system/pom.xml
  2. 3 1
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java
  3. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  4. 5 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaItemInfoController.java
  5. 251 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouChannelRegInfoController.java
  6. 19 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  7. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  8. 321 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TransferAccountController.java
  9. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  10. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaItemInfo.java
  11. 47 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/KuaishouChannelRegInfo.java
  12. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Project.java
  13. 115 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/TransferAccount.java
  14. 21 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouReportDailyGroupChannelCodeJob.java
  15. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/KuaishouChannelRegInfoMapper.java
  16. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/TransferAccountMapper.java
  17. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/KuaishouChannelRegInfoMapper.xml
  18. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/TransferAccountMapper.xml
  19. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IDramaItemInfoService.java
  20. 16 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IKuaishouChannelRegInfoService.java
  21. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ITransferAccountService.java
  22. 14 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/DramaItemInfoServiceImpl.java
  23. 40 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/KuaishouChannelRegInfoServiceImpl.java
  24. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/TransferAccountServiceImpl.java
  25. 71 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/ExcelUtils.java
  26. 58 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/KuaishouChannelRegInfoExcelListener.java
  27. 37 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/SpringUtils.java
  28. 103 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/KuaishouChannelRegInfoEntity.java
  29. 142 7
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  30. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MailLogMapper.java
  31. 13 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MailLogMapper.xml
  32. 12 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMailLogService.java
  33. 55 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MailLogServiceImpl.java
  34. 24 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/CorpWexinUtils.java
  35. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyGroup.java
  36. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyGroupMapper.java
  37. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyGroupService.java
  38. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyGroupServiceImpl.java

+ 5 - 0
jeecg-boot-module-system/pom.xml

@@ -157,6 +157,11 @@
         <version>3.17</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>1.1.2-beat1</version>
+        </dependency>
 
         <dependency>
             <groupId>com.bstek.ureport</groupId>

+ 3 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java

@@ -1,13 +1,14 @@
 package org.jeecg;
 
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.excelutil.SpringUtils;
 import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
 import org.springframework.core.env.Environment;
 import org.springframework.web.client.RestTemplate;
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
@@ -20,6 +21,7 @@ import java.net.UnknownHostException;
 @SpringBootApplication
 @ComponentScan(basePackages = {"cn.com.ctop", "org.jeecg"})
 @Configuration
+@Import(SpringUtils.class)
 public class JeecgApplication {
     public static void main(String[] args) throws UnknownHostException {
         ConfigurableApplicationContext application = SpringApplication.run(JeecgApplication.class, args);

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -75,6 +75,9 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/template/creative/words/get", "anon");
 		filterChainDefinitionMap.put("/appium/crawler/*", "anon");
 
+        filterChainDefinitionMap.put("/ctop/kuaishouChannelRegInfo/*", "anon");
+
+
 		//优化师相关
 		//filterChainDefinitionMap.put("/ctop/performanceOptimizer/detail", "anon");
 		//filterChainDefinitionMap.put("/ctop/performanceOptimizer/ranking/list", "anon");

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

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
+import java.util.Date;
 
 /**
  * 剧本内容信息
@@ -51,7 +52,7 @@ public class DramaItemInfoController {
         Result<IPage<DramaItemInfo>> result = new Result<IPage<DramaItemInfo>>();
         QueryWrapper<DramaItemInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaItemInfo, req.getParameterMap());
         Page<DramaItemInfo> page = new Page<DramaItemInfo>(pageNo, pageSize);
-        queryWrapper.orderByAsc("rank");
+        queryWrapper.orderByAsc("rank").orderByDesc("update_time");
         IPage<DramaItemInfo> pageList = dramaItemInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -70,6 +71,8 @@ public class DramaItemInfoController {
     public Result<DramaItemInfo> add(@RequestBody DramaItemInfo dramaItemInfo) {
         Result<DramaItemInfo> result = new Result<>();
         try {
+            int rank = dramaItemInfoService.getMaxRankByDramaId(dramaItemInfo.getDramaId());
+            dramaItemInfo.setRank(rank);
             dramaItemInfoService.save(dramaItemInfo);
             result.success("添加成功!");
         } catch (Exception e) {
@@ -94,6 +97,7 @@ public class DramaItemInfoController {
         if (dramaItemInfoEntity == null) {
             result.error500("未找到对应实体");
         } else {
+            dramaItemInfo.setUpdateTime(new Date());
             boolean ok = dramaItemInfoService.updateById(dramaItemInfo);
             if (ok) {
                 result.success("修改成功!");

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

@@ -0,0 +1,251 @@
+package org.jeecg.modules.ctop.controller;
+
+import com.alibaba.excel.event.AnalysisEventListener;
+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.KuaishouChannelRegInfo;
+import org.jeecg.modules.ctop.service.IKuaishouChannelRegInfoService;
+import org.jeecg.modules.excelutil.ExcelUtils;
+import org.jeecg.modules.excelutil.KuaishouChannelRegInfoExcelListener;
+import org.jeecg.modules.excelutil.entity.KuaishouChannelRegInfoEntity;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+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.FileInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手渠道注册信息表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-26
+ */
+@Slf4j
+@Api(tags = "快手渠道注册信息表")
+@RestController
+@RequestMapping("/ctop/kuaishouChannelRegInfo")
+public class KuaishouChannelRegInfoController {
+    @Autowired
+    private IKuaishouChannelRegInfoService kuaishouChannelRegInfoService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaishouChannelRegInfo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手渠道注册信息表-分页列表查询")
+    @ApiOperation(value = "快手渠道注册信息表-分页列表查询", notes = "快手渠道注册信息表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaishouChannelRegInfo>> queryPageList(KuaishouChannelRegInfo kuaishouChannelRegInfo,
+                                                               @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                               @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                               HttpServletRequest req) {
+        Result<IPage<KuaishouChannelRegInfo>> result = new Result<IPage<KuaishouChannelRegInfo>>();
+        QueryWrapper<KuaishouChannelRegInfo> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouChannelRegInfo, req.getParameterMap());
+        Page<KuaishouChannelRegInfo> page = new Page<KuaishouChannelRegInfo>(pageNo, pageSize);
+        IPage<KuaishouChannelRegInfo> pageList = kuaishouChannelRegInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaishouChannelRegInfo
+     * @return
+     */
+    @AutoLog(value = "快手渠道注册信息表-添加")
+    @ApiOperation(value = "快手渠道注册信息表-添加", notes = "快手渠道注册信息表-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaishouChannelRegInfo> add(@RequestBody KuaishouChannelRegInfo kuaishouChannelRegInfo) {
+        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        try {
+            kuaishouChannelRegInfoService.save(kuaishouChannelRegInfo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaishouChannelRegInfo
+     * @return
+     */
+    @AutoLog(value = "快手渠道注册信息表-编辑")
+    @ApiOperation(value = "快手渠道注册信息表-编辑", notes = "快手渠道注册信息表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaishouChannelRegInfo> edit(@RequestBody KuaishouChannelRegInfo kuaishouChannelRegInfo) {
+        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        KuaishouChannelRegInfo kuaishouChannelRegInfoEntity = kuaishouChannelRegInfoService.getById(kuaishouChannelRegInfo.getId());
+        if (kuaishouChannelRegInfoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaishouChannelRegInfoService.updateById(kuaishouChannelRegInfo);
+            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 {
+            kuaishouChannelRegInfoService.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<KuaishouChannelRegInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouChannelRegInfoService.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<KuaishouChannelRegInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouChannelRegInfo> result = new Result<KuaishouChannelRegInfo>();
+        KuaishouChannelRegInfo kuaishouChannelRegInfo = kuaishouChannelRegInfoService.getById(id);
+        if (kuaishouChannelRegInfo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouChannelRegInfo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouChannelRegInfo> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouChannelRegInfo kuaishouChannelRegInfo = JSON.parseObject(deString, KuaishouChannelRegInfo.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouChannelRegInfo, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouChannelRegInfo> pageList = kuaishouChannelRegInfoService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手渠道注册信息表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouChannelRegInfo.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) {
+        //1.读Excel
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            FileInputStream fis = null;
+            try {
+                MultipartFile file = entity.getValue();
+                fis = (FileInputStream) file.getInputStream();
+                AnalysisEventListener listener = new KuaishouChannelRegInfoExcelListener();
+                Boolean flag = ExcelUtils.readExcel(fis, KuaishouChannelRegInfoEntity.class, listener);
+                System.out.println("导入是否成功:" + flag);
+            } catch (Exception e) {
+                e.printStackTrace();
+            } finally {
+                if (fis != null) {
+                    try {
+                        fis.close();
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+        return Result.ok("文件导入成功!");
+    }
+
+}

+ 19 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.ctop.controller;
 
 
 import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -19,11 +20,13 @@ import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.Advertiser;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
+import org.jeecg.modules.ctop.entity.TransferAccount;
 import org.jeecg.modules.ctop.mapper.ProjectMapper;
 import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IAdvertiserService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
+import org.jeecg.modules.ctop.service.ITransferAccountService;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.mapper.UserCompanyMapper;
 import org.jeecg.modules.system.service.ISysUserService;
@@ -71,6 +74,8 @@ public class ProjectController {
     private MaterialReportMapper materialReportMapper;
     @Autowired
     private UserCompanyMapper userCompanyMapper;
+    @Autowired
+    private ITransferAccountService transferAccountService;
 
     /**
      * 根据 项目 媒体类型 查看项目
@@ -143,14 +148,22 @@ public class ProjectController {
                     List<Project> designResponsibles = projectMapper.selectList(projectQueryWrapper);
                     projects = designResponsibles;
                 }
-
-
             }
         } else {
             queryWrapper.orderByDesc("create_time");
             projects = projectMapper.selectList(queryWrapper);
         }
 
+        if (!Check.isNull(projects)) {
+            for (Project project : projects) {
+                QueryWrapper<TransferAccount> transferAccountQueryWrapper = new QueryWrapper<>();
+                transferAccountQueryWrapper.eq("project_id", project.getId());
+                transferAccountQueryWrapper.eq("status", 0);
+                List<TransferAccount> list = transferAccountService.list(transferAccountQueryWrapper);
+                project.setNeedExamine(list.size());
+            }
+        }
+
         map.put("success", true);
         map.put("code", 0);
         map.put("result", projects);
@@ -223,7 +236,6 @@ public class ProjectController {
                 memberMap.put(sysUser.getId(), sysUser.getRealname());
             }
 
-
             SysUser designSysUser = sysUserService.getById(project.getDesignResponsibleId());
             if (!Check.isNull(designSysUser)) {
                 project.setDesignResponsibleName(designSysUser.getRealname());
@@ -307,6 +319,9 @@ public class ProjectController {
         return result;
     }
 
+    @Autowired
+    private IUserAllocationService userAllocationService;
+
     /**
      * 通过id删除
      *
@@ -322,6 +337,7 @@ public class ProjectController {
             Map<String, Object> deleteMap = new HashMap<>();
             deleteMap.put("project_id", id);
             projectMemberService.removeByMap(deleteMap);
+            userAllocationService.removeByMap(deleteMap);
         } catch (Exception e) {
             log.error("删除失败", e.getMessage());
             return Result.error("删除失败!");

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

@@ -821,6 +821,7 @@ public class TestController {
 
         try {
 
+
             QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
             oauthTokenQueryWrapper.eq("media_id", 2);
             List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);

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

@@ -0,0 +1,321 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.service.IMailLogService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.Project;
+import org.jeecg.modules.ctop.entity.ProjectMember;
+import org.jeecg.modules.ctop.entity.TransferAccount;
+import org.jeecg.modules.ctop.service.IProjectMemberService;
+import org.jeecg.modules.ctop.service.IProjectService;
+import org.jeecg.modules.ctop.service.ITransferAccountService;
+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;
+
+/**
+ * 转户记录表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-26
+ */
+@Slf4j
+@Api(tags = "转户记录表")
+@RestController
+@RequestMapping("/ctop/transferAccount")
+public class TransferAccountController {
+    @Autowired
+    private ITransferAccountService transferAccountService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private IProjectService projectService;
+    @Autowired
+    private IMailLogService mailLogService;
+    @Autowired
+    private MailLogMapper mailLogMapper;
+    @Autowired
+    private IProjectMemberService projectMemberService;
+
+    @Autowired
+    private IMaterialInfoService materialInfoService;
+
+    /**
+     * 添加
+     *
+     * @param transferAccount
+     * @return
+     */
+    @AutoLog(value = "转户记录表-添加")
+    @ApiOperation(value = "转户记录表-添加", notes = "转户记录表-添加")
+    @PostMapping(value = "/add")
+    public Result<TransferAccount> add(@RequestBody TransferAccount transferAccount) {
+        Result<TransferAccount> result = new Result<TransferAccount>();
+        try {
+            QueryWrapper<TransferAccount> transferAccountQueryWrapper = new QueryWrapper<>();
+            transferAccountQueryWrapper.eq("account_id", transferAccount.getAccountId());
+            transferAccountQueryWrapper.eq("status", 0);
+            List<TransferAccount> list = transferAccountService.list(transferAccountQueryWrapper);
+            if (!Check.isNull(list)) {
+                result.setSuccess(false);
+                result.setMessage("此账户有未完成的转户操作");
+                return result;
+            }
+
+            transferAccountService.save(transferAccount);
+            Long projectId = transferAccount.getProjectId();
+            Project project = projectService.getById(projectId);
+            if (!Check.isNull(project)) {
+                String responsibleId = project.getResponsibleId();
+                mailLogService.sendWeChat(responsibleId, transferAccount.getAccountId(), project.getProjectName(), transferAccount.getTransferor(), transferAccount.getAssignee());
+            }
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param transferAccount
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "转户记录表-分页列表查询")
+    @ApiOperation(value = "转户记录表-分页列表查询", notes = "转户记录表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<List<TransferAccount>> queryPageList(TransferAccount transferAccount, HttpServletRequest req) {
+        Result<List<TransferAccount>> result = new Result<>();
+        QueryWrapper<TransferAccount> queryWrapper = QueryGenerator.initQueryWrapper(transferAccount, req.getParameterMap());
+        List<TransferAccount> records = transferAccountService.list(queryWrapper);
+        if (!Check.isNull(records)) {
+            for (TransferAccount transfer : records) {
+                String transferorName = mailLogMapper.getUserNameByUserId(transfer.getTransferor()); // 转让人姓名
+                transfer.setTransferorName(transferorName);
+                String assigneeName = mailLogMapper.getUserNameByUserId(transfer.getAssignee()); // 转让人姓名
+                transfer.setAssigneeName(assigneeName);
+            }
+        }
+
+        result.setSuccess(true);
+        result.setResult(records);
+        return result;
+    }
+
+
+    /**
+     * 编辑
+     *
+     * @param transferAccount
+     * @return
+     */
+    @AutoLog(value = "转户记录表-编辑")
+    @ApiOperation(value = "转户记录表-编辑", notes = "转户记录表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<TransferAccount> edit(@RequestBody TransferAccount transferAccount) {
+        Result<TransferAccount> result = new Result<TransferAccount>();
+        TransferAccount transferAccountEntity = transferAccountService.getById(transferAccount.getId());
+        if (transferAccountEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            Integer status = transferAccount.getStatus();
+
+            Long projectId = transferAccountEntity.getProjectId();
+            Project project = projectService.getById(projectId);
+
+            if (status == 1) { // 审核通过 修改账户所属人信息 添加受让人到项目成员列表
+                QueryWrapper<UserAllocation> updateQueryWrapper = new QueryWrapper<>();
+                updateQueryWrapper.eq("account_id", transferAccountEntity.getAccountId());
+                updateQueryWrapper.eq("project_id", transferAccountEntity.getProjectId());
+                UserAllocation updateUserAllocation = new UserAllocation();
+                updateUserAllocation.setUserId(transferAccountEntity.getAssignee());
+                String userName = mailLogMapper.getUserNameByUserId(transferAccountEntity.getAssignee()); // 转让人姓名
+                updateUserAllocation.setUserName(userName);
+                userAllocationService.update(updateUserAllocation, updateQueryWrapper);
+                QueryWrapper<ProjectMember> projectMemberQueryWrapper = new QueryWrapper<>();
+                projectMemberQueryWrapper.eq("project_id", transferAccountEntity.getProjectId());
+                projectMemberQueryWrapper.eq("user_id", transferAccountEntity.getAssignee());
+                projectMemberQueryWrapper.last("limit 1");
+                ProjectMember projectMember = projectMemberService.getOne(projectMemberQueryWrapper);
+                if (Check.isNull(projectMember)) {
+                    ProjectMember addProjectMember = new ProjectMember();
+                    String roleCode = materialInfoService.getRoleCodeByUserId(transferAccountEntity.getAssignee());
+                    addProjectMember.setRoleCode(roleCode);
+                    addProjectMember.setUserId(transferAccountEntity.getAssignee());
+                    addProjectMember.setUserName(userName);
+                    addProjectMember.setProjectId(project.getId());
+                    addProjectMember.setProjectName(project.getProjectName());
+                    projectMemberService.save(addProjectMember);
+                }
+            }
+            mailLogService.sendWeChatByStatus(project.getProjectName(), status, transferAccountEntity.getTransferor(), transferAccountEntity.getAccountId());
+            mailLogService.sendWeChatByStatus(project.getProjectName(), status, transferAccountEntity.getAssignee(), transferAccountEntity.getAccountId());
+            boolean ok = transferAccountService.updateById(transferAccount);
+            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 {
+            transferAccountService.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<TransferAccount> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<TransferAccount> result = new Result<TransferAccount>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.transferAccountService.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<TransferAccount> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<TransferAccount> result = new Result<TransferAccount>();
+        TransferAccount transferAccount = transferAccountService.getById(id);
+        if (transferAccount == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(transferAccount);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<TransferAccount> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                TransferAccount transferAccount = JSON.parseObject(deString, TransferAccount.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(transferAccount, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<TransferAccount> pageList = transferAccountService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "转户记录表列表");
+        mv.addObject(NormalExcelConstants.CLASS, TransferAccount.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<TransferAccount> listTransferAccounts = ExcelImportUtil.importExcel(file.getInputStream(), TransferAccount.class, params);
+                transferAccountService.saveBatch(listTransferAccounts);
+                return Result.ok("文件导入成功!数据行数:" + listTransferAccounts.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("文件导入失败!");
+    }
+
+}

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

@@ -70,6 +70,15 @@ public class UserAllocationController {
     private IProjectMemberService projectMemberService;
 
 
+    @PostMapping(value = "/transferAccount")
+    public Result transferAccount(Long accountId, Long projectId) {
+
+
+        return null;
+
+    }
+
+
     @GetMapping(value = "/accountTurnProject")
     public Result getAccountList(Long accountId, Long projectId) {
         Result result = new Result<>();

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

@@ -39,6 +39,7 @@ public class DramaItemInfo {
     @Excel(name = "元素类型1:情节描述 2:对话", width = 15)
     @ApiModelProperty(value = "元素类型1:描述 2:对话")
     private Integer type;
+    private Integer plainSeq;
     /**
      * 剧本id
      */

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

@@ -0,0 +1,47 @@
+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 lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.modules.excelutil.entity.KuaishouChannelRegInfoEntity;
+
+import java.util.Date;
+
+/**
+ * 快手渠道注册信息表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-26
+ */
+@TableName("ctop_kuaishou_channel_reg_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@Data
+public class KuaishouChannelRegInfo {
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+    private String stateDate;
+    private String channelCode;
+    private Integer regNum;
+    private String perfectDataRate;
+    private String maleRatio;
+    private Date createTime;
+    private Date updateTime;
+
+    public KuaishouChannelRegInfo() {
+    }
+
+    public KuaishouChannelRegInfo(KuaishouChannelRegInfoEntity regInfoEntity) {
+        this.stateDate = regInfoEntity.getStateDate();
+        this.channelCode = regInfoEntity.getChannelCode() + "_" + regInfoEntity.getChildChannelCode();
+        this.regNum = regInfoEntity.getRegNum();
+        this.perfectDataRate = regInfoEntity.getPerfectDataRate();
+        this.maleRatio = regInfoEntity.getMaleRatio();
+        this.createTime = new Date();
+        this.updateTime = new Date();
+    }
+}

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

@@ -1,6 +1,7 @@
 package org.jeecg.modules.ctop.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -112,4 +113,8 @@ public class Project {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
+
+
+    @TableField(exist = false)
+    private Integer needExamine;
 }

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

@@ -0,0 +1,115 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+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;
+
+/**
+ * 转户记录表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-26
+ */
+@Data
+@TableName("ctop_transfer_account")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_transfer_account对象", description = "转户记录表")
+public class TransferAccount {
+
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键ID")
+    private Long id;
+    /**
+     * 转户账号
+     */
+    @Excel(name = "转户账号", width = 15)
+    @ApiModelProperty(value = "转户账号")
+    private Long accountId;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 转户人
+     */
+    @Excel(name = "转户人", width = 15)
+    @ApiModelProperty(value = "转户人")
+    private String transferor;
+    /**
+     * 受让人
+     */
+    @Excel(name = "受让人", width = 15)
+    @ApiModelProperty(value = "受让人")
+    private String assignee;
+    /**
+     * 转户人绩效统计截止日期
+     */
+    @Excel(name = "转户人绩效统计截止日期", width = 15)
+    @ApiModelProperty(value = "转户人绩效统计截止日期")
+    private String transferorDate;
+    /**
+     * 受让人绩效统计开始日期
+     */
+    @Excel(name = "受让人绩效统计开始日期", width = 15)
+    @ApiModelProperty(value = "受让人绩效统计开始日期")
+    private String assigneeDate;
+    /**
+     * 审核人
+     */
+    @Excel(name = "审核人", width = 15)
+    @ApiModelProperty(value = "审核人")
+    private String auditor;
+    /**
+     * 审核状态 0:新建 1:通过 2:拒绝
+     */
+    @Excel(name = "审核状态 0:新建 1:通过 2:拒绝", width = 15)
+    @ApiModelProperty(value = "审核状态 0:新建 1:通过 2:拒绝")
+    private Integer status;
+    /**
+     * 备注
+     */
+    @Excel(name = "备注", width = 15)
+    @ApiModelProperty(value = "备注")
+    private Object remarks;
+    /**
+     * 创建时间
+     */
+    @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;
+
+    @TableField(exist = false)
+    private String transferorName;
+
+
+    @TableField(exist = false)
+    private String assigneeName;
+}

+ 21 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouReportDailyGroupChannelCodeJob.java

@@ -0,0 +1,21 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+
+public class KuaishouReportDailyGroupChannelCodeJob implements Job {
+    @Autowired
+    private IKuaishouReportDailyGroupService groupService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String date = DateUtils.formatDate(DateUtils.addDay(new Date(), -1));
+        groupService.formatChannelCode(date);
+    }
+}

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

@@ -0,0 +1,15 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.KuaishouChannelRegInfo;
+
+/**
+ * 快手渠道注册信息表
+ *
+ * @author: jeecg-boot
+ * @date: 2020-03-26
+ * @cersion: V1.0
+ */
+public interface KuaishouChannelRegInfoMapper extends BaseMapper<KuaishouChannelRegInfo> {
+
+}

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

@@ -0,0 +1,15 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.TransferAccount;
+
+/**
+ * 转户记录表
+ *
+ * @author: jeecg-boot
+ * @date: 2020-03-26
+ * @cersion: V1.0
+ */
+public interface TransferAccountMapper extends BaseMapper<TransferAccount> {
+
+}

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

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

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

@@ -15,4 +15,6 @@ import java.util.List;
 public interface IDramaItemInfoService extends IService<DramaItemInfo> {
 
     List<DramaItemInfo> getByDramaId(Long dramaId);
+
+    int getMaxRankByDramaId(Long dramaId);
 }

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

@@ -0,0 +1,16 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.KuaishouChannelRegInfo;
+import org.jeecg.modules.excelutil.entity.KuaishouChannelRegInfoEntity;
+
+/**
+ * 快手渠道注册信息表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-26
+ */
+public interface IKuaishouChannelRegInfoService extends IService<KuaishouChannelRegInfo> {
+    void saveOrUpdateBychannelCodeAndDate(KuaishouChannelRegInfoEntity regInfo);
+}

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

@@ -0,0 +1,15 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.TransferAccount;
+
+/**
+ * 转户记录表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-26
+ */
+public interface ITransferAccountService extends IService<TransferAccount> {
+
+}

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

@@ -29,7 +29,7 @@ public class DramaItemInfoServiceImpl extends ServiceImpl<DramaItemInfoMapper, D
     @Override
     public List<DramaItemInfo> getByDramaId(Long dramaId) {
         QueryWrapper<DramaItemInfo> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("drama_id", dramaId).eq("enabled", 1).orderByAsc("rank");
+        queryWrapper.eq("drama_id", dramaId).eq("enabled", 1).orderByAsc("rank").orderByDesc("update_time");
         List<DramaItemInfo> infos = this.list(queryWrapper);
         List<DramaItemInfo> returnInfos = new ArrayList<>();
         if (null != infos && infos.size() > 0) {
@@ -43,4 +43,17 @@ public class DramaItemInfoServiceImpl extends ServiceImpl<DramaItemInfoMapper, D
         }
         return returnInfos;
     }
+
+    @Override
+    public int getMaxRankByDramaId(Long dramaId) {
+        QueryWrapper<DramaItemInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("drama_id", dramaId);
+        queryWrapper.orderByDesc("rank").last(" limit 1");
+        DramaItemInfo itemInfo = this.getOne(queryWrapper);
+        if (null == itemInfo) {
+            return 1;
+        } else {
+            return itemInfo.getRank() + 1;
+        }
+    }
 }

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

@@ -0,0 +1,40 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.KuaishouChannelRegInfo;
+import org.jeecg.modules.ctop.mapper.KuaishouChannelRegInfoMapper;
+import org.jeecg.modules.ctop.service.IKuaishouChannelRegInfoService;
+import org.jeecg.modules.excelutil.entity.KuaishouChannelRegInfoEntity;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+/**
+ * 快手渠道注册信息表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-26
+ */
+@Service
+public class KuaishouChannelRegInfoServiceImpl extends ServiceImpl<KuaishouChannelRegInfoMapper, KuaishouChannelRegInfo> implements IKuaishouChannelRegInfoService {
+
+    @Override
+    public void saveOrUpdateBychannelCodeAndDate(KuaishouChannelRegInfoEntity regInfo) {
+        QueryWrapper<KuaishouChannelRegInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("state_date", regInfo.getStateDate());
+        queryWrapper.eq("channel_code", regInfo.getChannelCode());
+        KuaishouChannelRegInfo getRegInfo = this.getOne(queryWrapper);
+        if (null == getRegInfo) {
+            getRegInfo = new KuaishouChannelRegInfo(regInfo);
+            this.save(getRegInfo);
+        } else {
+            getRegInfo.setRegNum(regInfo.getRegNum());
+            getRegInfo.setPerfectDataRate(regInfo.getPerfectDataRate());
+            getRegInfo.setMaleRatio(regInfo.getMaleRatio());
+            getRegInfo.setUpdateTime(new Date());
+            this.updateById(getRegInfo);
+        }
+    }
+}

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

@@ -0,0 +1,19 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.TransferAccount;
+import org.jeecg.modules.ctop.mapper.TransferAccountMapper;
+import org.jeecg.modules.ctop.service.ITransferAccountService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 转户记录表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-26
+ */
+@Service
+public class TransferAccountServiceImpl extends ServiceImpl<TransferAccountMapper, TransferAccount> implements ITransferAccountService {
+
+}

+ 71 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/ExcelUtils.java

@@ -0,0 +1,71 @@
+package org.jeecg.modules.excelutil;
+
+import com.alibaba.excel.EasyExcelFactory;
+import com.alibaba.excel.ExcelReader;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.alibaba.excel.metadata.BaseRowModel;
+import com.alibaba.excel.metadata.Sheet;
+import com.alibaba.excel.support.ExcelTypeEnum;
+
+import java.io.*;
+import java.util.List;
+
+public class ExcelUtils {
+    /**
+     * @param is    导入文件输入流
+     * @param clazz Excel实体映射类
+     * @return
+     */
+    public static Boolean readExcel(InputStream is, Class clazz, AnalysisEventListener listener) {
+        BufferedInputStream bis = null;
+        try {
+            bis = new BufferedInputStream(is);
+            // 解析每行结果在listener中处理
+            ExcelReader excelReader = EasyExcelFactory.getReader(bis, listener);
+            excelReader.read(new Sheet(1, 1, clazz));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        } finally {
+            if (bis != null) {
+                try {
+                    bis.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * @param os    文件输出流
+     * @param clazz Excel实体映射类
+     * @param data  导出数据
+     * @return
+     */
+    public static Boolean writeExcel(OutputStream os, Class clazz, List<? extends BaseRowModel> data) {
+        BufferedOutputStream bos = null;
+        try {
+            bos = new BufferedOutputStream(os);
+            ExcelWriter writer = new ExcelWriter(bos, ExcelTypeEnum.XLSX);
+            //写第一个sheet, sheet1  数据全是List<String> 无模型映射关系
+            Sheet sheet1 = new Sheet(1, 0, clazz);
+            writer.write(data, sheet1);
+            writer.finish();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        } finally {
+            if (bos != null) {
+                try {
+                    bos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return true;
+    }
+}

+ 58 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/KuaishouChannelRegInfoExcelListener.java

@@ -0,0 +1,58 @@
+package org.jeecg.modules.excelutil;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.ctop.service.impl.KuaishouChannelRegInfoServiceImpl;
+import org.jeecg.modules.excelutil.entity.KuaishouChannelRegInfoEntity;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class KuaishouChannelRegInfoExcelListener extends AnalysisEventListener {
+    //自定义用于暂时存储data。
+    //可以通过实例获取该值
+    private List<Object> datas = new ArrayList<Object>();
+
+    @Override
+    public void invoke(Object object, AnalysisContext context) {
+        //数据存储到list,供批量处理,或后续自己业务逻辑处理。
+        datas.add(object);
+        //根据自己业务做处理
+        doSomething(object);
+    }
+
+    private void doSomething(Object object) {
+        //入库调用接口
+        KuaishouChannelRegInfoEntity regInfo = (KuaishouChannelRegInfoEntity) object;
+        regInfo.setCreateTime(new Date());
+        regInfo.setUpdateTime(new Date());
+        regInfo.setChannelCode(regInfo.getChannelCode() + "_" + regInfo.getChildChannelCode());
+        String date = regInfo.getStateDate();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
+        try {
+            date = DateUtils.formatDate(dateFormat.parse(date));
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        regInfo.setStateDate(date);
+        KuaishouChannelRegInfoServiceImpl regInfoService = SpringUtils.getApplicationContext().getBean(KuaishouChannelRegInfoServiceImpl.class);
+        regInfoService.saveOrUpdateBychannelCodeAndDate(regInfo);
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext context) {
+        // datas.clear();//解析结束销毁不用的资源
+    }
+
+    public List<Object> getDatas() {
+        return datas;
+    }
+
+    public void setDatas(List<Object> datas) {
+        this.datas = datas;
+    }
+}

+ 37 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/SpringUtils.java

@@ -0,0 +1,37 @@
+package org.jeecg.modules.excelutil;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+public class SpringUtils implements ApplicationContextAware {
+    private static ApplicationContext applicationContext = null;
+
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        if (SpringUtils.applicationContext == null) {
+            SpringUtils.applicationContext = applicationContext;
+        }
+    }
+
+
+    //获取applicationContext
+    public static ApplicationContext getApplicationContext() {
+        return applicationContext;
+    }
+
+    //通过name获取 Bean.
+    public static Object getBean(String name) {
+        return getApplicationContext().getBean(name);
+    }
+
+    //通过class获取Bean.
+    public static <T> T getBean(Class<T> clazz) {
+        return getApplicationContext().getBean(clazz);
+    }
+
+    //通过name,以及Clazz返回指定的Bean
+    public static <T> T getBean(String name, Class<T> clazz) {
+        return getApplicationContext().getBean(name, clazz);
+    }
+}

+ 103 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/KuaishouChannelRegInfoEntity.java

@@ -0,0 +1,103 @@
+package org.jeecg.modules.excelutil.entity;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.metadata.BaseRowModel;
+import com.baomidou.mybatisplus.annotation.TableField;
+
+import java.util.Date;
+
+public class KuaishouChannelRegInfoEntity extends BaseRowModel {
+    @ExcelProperty(index = 0, value = "统计日期")
+    private String stateDate;
+    @ExcelProperty(index = 1, value = "渠道号")
+    private String channelCode;
+    @ExcelProperty(index = 2, value = "子渠道")
+    @TableField(exist = false)
+    private String childChannelCode;
+    @ExcelProperty(index = 3, value = "注册数")
+    private Integer regNum;
+    @ExcelProperty(index = 4, value = "完善资料率")
+    private String perfectDataRate;
+    @ExcelProperty(index = 5, value = "男高占比")
+    private String maleRatio;
+    private Date createTime;
+    private Date updateTime;
+
+    public String getStateDate() {
+        return stateDate;
+    }
+
+    public void setStateDate(String stateDate) {
+        this.stateDate = stateDate;
+    }
+
+    public String getChannelCode() {
+        return channelCode;
+    }
+
+    public void setChannelCode(String channelCode) {
+        this.channelCode = channelCode;
+    }
+
+    public String getChildChannelCode() {
+        return childChannelCode;
+    }
+
+    public void setChildChannelCode(String childChannelCode) {
+        this.childChannelCode = childChannelCode;
+    }
+
+    public Integer getRegNum() {
+        return regNum;
+    }
+
+    public void setRegNum(Integer regNum) {
+        this.regNum = regNum;
+    }
+
+    public String getPerfectDataRate() {
+        return perfectDataRate;
+    }
+
+    public void setPerfectDataRate(String perfectDataRate) {
+        this.perfectDataRate = perfectDataRate;
+    }
+
+    public String getMaleRatio() {
+        return maleRatio;
+    }
+
+    public void setMaleRatio(String maleRatio) {
+        this.maleRatio = maleRatio;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    @Override
+    public String toString() {
+        return "KuaishouChannelRegInfo{" +
+                "stateDate='" + stateDate + '\'' +
+                ", channelCode='" + channelCode + '\'' +
+                ", childChannelCode='" + childChannelCode + '\'' +
+                ", regNum=" + regNum +
+                ", perfectDataRate='" + perfectDataRate + '\'' +
+                ", maleRatio='" + maleRatio + '\'' +
+                ", createTime=" + createTime +
+                ", updateTime=" + updateTime +
+                '}';
+    }
+}

+ 142 - 7
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -6,8 +6,9 @@ import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import com.alibaba.fastjson.JSONArray;
@@ -22,8 +23,7 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -158,14 +158,14 @@ public class SampleTest {
 
         // 1629785592929294
 
-        conditions.put("advertiser_id", "109437044830");
+        conditions.put("advertiser_id", "1659671533108238");
         JSONObject job = new JSONObject();
         job.put("job_conf_id", 10);
         JSONArray input = new JSONArray();
         JSONObject inputJson = new JSONObject();
         inputJson.put("task_id", 1);
         JSONArray videoIds = new JSONArray();
-        videoIds.add("v02033290000bgq1cejpqv6e4k29b2jg");
+        videoIds.add("v02033aa0000bpspgippskdk4jcuso80");
         inputJson.put("video_ids", videoIds);
         JSONArray music_id = new JSONArray();
         JSONArray image_urls = new JSONArray();
@@ -201,13 +201,148 @@ public class SampleTest {
         conditions.put("job", job);
 
 
-        JSONObject jsonObject = HttpUtils.bytedancePostRequest("8ea30cb02cab8d92b480c4ab01cfc4545fdce33e", url, conditions);
+        JSONObject jsonObject = HttpUtils.bytedancePostRequest("f925c180e05d585f7a9fce048ba62eecc5dab7c2", url, conditions);
         System.err.println(jsonObject);
 
 
     }
 
 
+    @Autowired
+    private IKuaiShouCreativeService creativeService;
+
+    @Test
+    public void suZhao() {
+
+
+        /*Long accountId = 3917130L;
+        String token = "9f2caae880367a9477cf1b6bf86e3858";
+
+        String url = "https://ad.e.kuaishou.com/rest/openapi/v1/file/ad/video/su_zao/list";
+
+
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token);
+        Map<String, Object> param = new HashMap<String, Object>();
+
+        param.put("advertiser_id", accountId);
+        param.put("temporal_granularity", "HOURLY");
+        param.put("page_size", 499);
+        param.put("page", 1);
+        String result = HttpUtils.httpPostRequest(url, param, headers);
+        System.err.println(result);*/
+
+
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_LIST;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", " application/json");
+        headers.put("Access-Token", "bd90c55f01d79450c66260bcb15b5c0a");
+        Long advertiserId = 23212L;
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", 23212);
+        //   param.put("creative_id", creativeId);
+        param.put("page_size", 500);
+        param.put("page", 1);
+
+        System.err.println(param);
+        System.err.println(headers);
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        System.err.println(resultJson);
+
+
+        if (Check.isNull(resultJson)) {
+            log.error("获取广告创意返回结果为空,advertiserId:{}", advertiserId);
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取广告创意返回结果异常,advertiserId:{},message:{}", advertiserId, message);
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (null == details || details.size() <= 0) {
+//            log.error("获取广告创意返回结果数据为空,advertiserId:{}", advertiserId);
+            return;
+        }
+        List<KuaiShouCreative> creatives = new ArrayList<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
+            if (!Check.isNull(detailJson)) {
+                KuaiShouCreative creative = new KuaiShouCreative();
+                creative.setId("" + advertiserId + detailJson.getLong("creative_id"));
+                creative.setAccountId(advertiserId);
+                creative.setCampaignId(detailJson.getLong("campaign_id"));
+                creative.setUnitId(detailJson.getLong("unit_id"));
+                creative.setCreativeId(detailJson.getLong("creative_id"));
+                creative.setCreativeName(detailJson.getString("creative_name"));
+                creative.setCreativeMaterialType(detailJson.getInteger("creative_material_type"));
+                //
+                if (!Check.isNull(detailJson.getJSONArray("material_url"))) {
+                    creative.setMaterialUrl(detailJson.getJSONArray("material_url").toJSONString());
+                }
+
+                if (!Check.isNull(detailJson.getJSONArray("image_tokens"))) {
+                    creative.setImageTokens(detailJson.getJSONArray("image_tokens").toJSONString());
+                }
+                creative.setStatus(detailJson.getInteger("status"));
+                creative.setPutStatus(detailJson.getInteger("put_status"));
+                creative.setCreateChannel(detailJson.getInteger("create_channel"));
+                creative.setReviewDetail(detailJson.getString("review_detail"));
+                creative.setCoverUrl(detailJson.getString("cover_url"));
+                creative.setImageToken(detailJson.getString("image_token"));
+                creative.setCoverWidth(detailJson.getString("cover_width"));
+                creative.setCoverHeight(detailJson.getString("cover_height"));
+                creative.setOverlayBgUrl(detailJson.getString("overlay_bg_url"));
+                creative.setOverlayBgImageToken(detailJson.getString("overlay_bg_image_token"));
+                creative.setStickerTitle(detailJson.getString("sticker_title"));
+                creative.setOverlayType(detailJson.getString("overlay_type"));
+                creative.setClickTrackUrl(detailJson.getString("click_track_url"));
+                creative.setImpressionUrl(detailJson.getString("impression_url"));
+                creative.setAdPhotoPlayedT3sUrl(detailJson.getString("ad_photo_played_t3s_url"));
+                creative.setCreativeCreateTime(detailJson.getDate("create_time"));
+                JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
+                if (!Check.isNull(displayInfoJson)) {
+                    creative.setDescription(displayInfoJson.getString("description"));
+                    creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
+                }
+                creative.setCreateTime(new Date());
+                creative.setUpdateTime(new Date());
+
+                if (detailJson.getLong("photo_id") == 0) {
+                    JSONObject programmed_creative_material = detailJson.getJSONObject("programmed_creative_material");
+                    if (!Check.isNull(programmed_creative_material)) {
+                        JSONArray materials = programmed_creative_material.getJSONArray("materials");
+                        if (!Check.isNull(materials)) {
+                            for (int j = 0; j < materials.size(); j++) {
+                                JSONObject materialJson = materials.getJSONObject(j);
+                                if (!Check.isNull(materialJson)) {
+                                    Long photo_id = materialJson.getLong("photo_id");
+                                    creative.setPhotoId(String.valueOf(photo_id));
+                                    creatives.add(creative);
+                                }
+                            }
+                        }
+                    }
+
+
+                } else {
+                    creative.setPhotoId(detailJson.getString("photo_id"));
+                    creatives.add(creative);
+                }
+
+
+            }
+        }
+        creativeService.replaceBatch(creatives);
+
+
+    }
+
+
 }
 
 

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MailLogMapper.java

@@ -21,4 +21,7 @@ public interface MailLogMapper extends BaseMapper<MailLog> {
 
     List<String> selectWeiXinIdList(@Param("projectId") Long projectId);
 
+    String getWChatIdByUserId(@Param("userId") String responsibleId);
+
+    String getUserNameByUserId(@Param("userId") String transferor);
 }

+ 13 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MailLogMapper.xml

@@ -38,6 +38,19 @@
      and t2.wexin_id != ''
     </select>
 
+    <select id="getWChatIdByUserId" resultType="java.lang.String">
+    select wexin_id
+    from ctop_corp_wexin_user
+    where  user_id = #{userId}
+
+    </select>
+
+    <select id="getUserNameByUserId" resultType="java.lang.String">
+    select
+    realname
+    from sys_user
+    where id = #{userId}
+    </select>
 
 
 </mapper>

+ 12 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMailLogService.java

@@ -12,4 +12,16 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IMailLogService extends IService<MailLog> {
 
+    /**
+     * 发送转户申请信息
+     *
+     * @param responsibleId
+     * @param accountId
+     * @param projectName
+     * @param transferor
+     * @param assignee
+     */
+    void sendWeChat(String responsibleId, Long accountId, String projectName, String transferor, String assignee);
+
+    void sendWeChatByStatus(String projectName, Integer status, String transferor, Long accountId);
 }

+ 55 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MailLogServiceImpl.java

@@ -3,7 +3,10 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.MailLog;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.service.IMailLogService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CorpWexinUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -15,5 +18,57 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class MailLogServiceImpl extends ServiceImpl<MailLogMapper, MailLog> implements IMailLogService {
+    @Autowired
+    private MailLogMapper mailLogMapper;
 
+
+    @Override
+    public void sendWeChat(String responsibleId, Long accountId, String projectName, String transferor, String assignee) {
+        String weChatId = mailLogMapper.getWChatIdByUserId(responsibleId);
+        if (!Check.isNull(weChatId)) {
+            String transferorName = mailLogMapper.getUserNameByUserId(transferor); // 转让人姓名
+            String assigneeName = mailLogMapper.getUserNameByUserId(assignee); // 转让人姓名
+            StringBuilder text = new StringBuilder();
+            text.append("转户申请").append("<br/>").
+                    append("您的项目:").append(projectName + ",").append("<br/>")
+                    .append("账号:" + accountId).append(",申请由:" + transferorName + "转户于:" + assigneeName).append("<br/>")
+                    .append("等待您的审核,请您及时处理!");
+
+            CorpWexinUtils.sendMessageByWeChatId(weChatId, text.toString());
+        }
+    }
+
+
+    /**
+     * 转户通过或失败发送通知
+     *
+     * @param projectName
+     * @param status
+     * @param userId
+     */
+    @Override
+    public void sendWeChatByStatus(String projectName, Integer status, String userId, Long accountId) {
+
+        String weChatId = mailLogMapper.getWChatIdByUserId(userId);
+        if (!Check.isNull(weChatId)) {
+            String statusName = "";
+
+            if (status == 1) {
+                statusName = "通过";
+            } else if (status == 2) {
+                statusName = "拒绝";
+            }
+
+            StringBuilder text = new StringBuilder();
+            text.append("转户申请审核通知").append("<br/>").
+                    append("您的项目:").append(projectName + ",").append("<br/>")
+                    .append("账号:" + accountId).append("<br/>")
+                    .append("申请的转户操作已:" + statusName).append("<br/>")
+                    .append("请您前往验证,谢谢!");
+
+            CorpWexinUtils.sendMessageByWeChatId(weChatId, text.toString());
+        }
+
+
+    }
 }

+ 24 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/CorpWexinUtils.java

@@ -46,4 +46,28 @@ public class CorpWexinUtils {
             }
         }
     }
+
+
+    public static void sendMessageByWeChatId(String weChatId, String content) {
+        if (wxCpService == null) {
+            initService();
+        }
+
+        if (!Check.isNull(weChatId)) {
+            WxCpMessage message = new WxCpMessage();
+            message.setMsgType("text");
+            message.setContent(content);
+            message.setAgentId(1000002);
+            message.setToUser(weChatId);
+            try {
+                wxCpService.messageSend(message);
+            } catch (WxErrorException e) {
+                e.printStackTrace();
+            }
+
+        }
+
+
+    }
+
 }

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyGroup.java

@@ -127,4 +127,6 @@ public class KuaishouReportDailyGroup implements Serializable {
     private Date createTime;
     @JsonProperty
     private Date updateTime;
+
+    private String channelCode;
 }

+ 6 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyGroupMapper.java

@@ -3,7 +3,13 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Update;
 
 public interface KuaishouReportDailyGroupMapper extends BaseMapper<KuaishouReportDailyGroup> {
     void loadGroupDailyReport(@Param("accountId") Long accountId, @Param("localPath") String localPath);
+
+    @Update("update ctop_kuaishou_report_daily_group " +
+            "set channel_code = substring_index(unit_name, '-', 1) " +
+            "where stat_date =#{date}")
+    void formatChannelCode(@Param("date") String date);
 }

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyGroupService.java

@@ -4,4 +4,5 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 public interface IKuaishouReportDailyGroupService extends IService<KuaishouReportDailyGroup> {
+    void formatChannelCode(String date);
 }

+ 8 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyGroupServiceImpl.java

@@ -4,8 +4,16 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 @Service
 public class KuaishouReportDailyGroupServiceImpl extends ServiceImpl<KuaishouReportDailyGroupMapper, KuaishouReportDailyGroup> implements IKuaishouReportDailyGroupService {
+    @Autowired
+    private KuaishouReportDailyGroupMapper groupMapper;
+
+    @Override
+    public void formatChannelCode(String date) {
+        groupMapper.formatChannelCode(date);
+    }
 }