瀏覽代碼

Merge remote-tracking branch 'origin/master'

yumeng 2 年之前
父節點
當前提交
d385085d48
共有 32 個文件被更改,包括 852 次插入92 次删除
  1. 1 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  2. 38 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/KuaiShouPromoterController.java
  3. 19 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/KuaishouPromoterMapper.java
  4. 79 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/KuaishouPromoterMapper.xml
  5. 4 4
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml
  6. 10 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/IKuaishouPromoterService.java
  7. 41 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/IKuaishouPromoterServiceImpl.java
  8. 12 6
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/ManagerSaleValueServiceImpl.java
  9. 49 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupTemplateController.java
  10. 55 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouMaterialUploadController.java
  11. 7 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchCreativeTemplate.java
  12. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTemplateMapper.java
  13. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouImageGetMapper.java
  14. 40 40
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTemplateMapper.xml
  15. 16 6
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouImageGetMapper.xml
  16. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupTemplateService.java
  17. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouImageGetService.java
  18. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java
  19. 12 6
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouImageGetServiceImpl.java
  20. 3 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouMaterialUploadServiceImpl.java
  21. 43 10
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCampaignPreviewServiceImpl.java
  22. 6 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCreativePreviewServiceImpl.java
  23. 18 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/controller/ReimburseApplyController.java
  24. 88 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/entity/ReimburseApplyProcess.java
  25. 17 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/ReimburseApplyProcessMapper.java
  26. 10 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/xml/ReimburseApplyMapper.xml
  27. 28 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/xml/ReimburseApplyProcessMapper.xml
  28. 16 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/IReimburseApplyProcessService.java
  29. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/IReimburseApplyService.java
  30. 31 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseApplyProcessServiceImpl.java
  31. 182 15
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseApplyServiceImpl.java
  32. 8 0
      jeecg-boot-module-system/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

+ 1 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -255,6 +255,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ctop/byteDance/videoReport/**", "anon");
 
         filterChainDefinitionMap.put("/designer/**", "anon");
+        filterChainDefinitionMap.put("/kuaiShou/promoter/**", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 38 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/KuaiShouPromoterController.java

@@ -0,0 +1,38 @@
+package org.jeecg.ctop.material.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.ctop.material.service.IKuaishouPromoterService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ *
+ */
+@Slf4j
+@RestController
+@RequestMapping("/kuaiShou/promoter")
+public class KuaiShouPromoterController {
+
+    @Autowired
+    IKuaishouPromoterService promoterService;
+
+    /**
+     * 查询达人详细数据
+     */
+    @GetMapping("/getPromoterInfo")
+    public JSONObject getPromoterInfo(Long promoterId) {
+        return promoterService.getPromoterInfo(promoterId);
+    }
+
+    /**
+     * 查询达人详细数据
+     */
+    @GetMapping("/getPromoterVideoInfo")
+    public JSONObject getPromoterVideoInfo(Long promoterId) {
+        return promoterService.getPromoterVideoInfo(promoterId);
+    }
+
+}

+ 19 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/KuaishouPromoterMapper.java

@@ -0,0 +1,19 @@
+package org.jeecg.ctop.material.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface KuaishouPromoterMapper {
+
+    JSONObject getPromoterInfo(@Param("promoterId") Long promoterId);
+
+    List<JSONObject> getFansCharacteristic(@Param("promoterId") Long promoterId);
+
+    List<JSONObject> getPromoterShortVideosCommerceInfo(@Param("promoterId") Long promoterId, @Param("startInt") Integer startInt, @Param("endInt") Integer endInt);
+
+    List<JSONObject> getPromoterLiveCommerceInfo(@Param("promoterId") Long promoterId, @Param("startInt") Integer startInt, @Param("endInt") Integer endInt);
+
+    JSONObject getPromoterVideoInfo(Long promoterId);
+}

+ 79 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/KuaishouPromoterMapper.xml

@@ -0,0 +1,79 @@
+<?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.ctop.material.mapper.KuaishouPromoterMapper">
+
+    <select id="getPromoterInfo" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.hotSaleChannelInfo,
+               t1.hotSaleBrandInfo,
+               t2.videoSales as 'totalSale',
+               t2.promotedProductsNum,
+               t3.promoteLiveCount,
+               t2.liveStreamGMV,
+               t3.liveStreamVisitorCount,
+               t3.avgVisitorOnlineCount,
+               t2.liveStreamGPM,
+               t3.interactionRate,
+               ROUND(avgViewTime / 60000, 0) as 'avgViewTime',
+               t3.maxSameTimeVisitorCount,
+               t2.videoGPM,
+               t2.avgVideoSales,
+               t2.avgVideoViewers,
+               t4.videoCount,
+               t4.videoWatchCount,
+               t4.totalSale as 'videoTotalSale'
+        FROM kwai_promoter.kwai_promoter_info t1
+                 LEFT JOIN kwai_promoter.kwai_promoter_base_info t2 ON t1.promoterId = t2.promoterId
+                 LEFT JOIN kwai_promoter.kwai_promoter_live_base_info t3 ON t1.promoterId = t3.promoterId
+            AND t3.timeRangeType = 2
+                 LEFT JOIN kwai_promoter.kwai_promoter_video_info t4 ON t1.promoterId = t4.promoterId
+            AND t4.timeRangeType = 2
+        WHERE t1.promoterId = #{promoterId}
+    </select>
+
+    <select id="getFansCharacteristic" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT type,
+               CONCAT(type_date, '居多') as 'name',
+               CONCAT(ROUND(MAX(FeatureRate) / 100, 2), '%') as 'roi'
+        FROM kwai_promoter.kwai_promoter_fans_base_info
+        WHERE promoterId = #{promoterId}
+          AND timeRangeType = 2
+        GROUP BY type
+
+    </select>
+
+    <select id="getPromoterLiveCommerceInfo" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT `date`,
+               commentsCount,
+               likesCount,
+               liveMinuteDuration,
+               liveVisitorCount,
+               maxVisitorCount,
+               sharesCount
+        from kwai_promoter.kwai_promoter_live_analyse_info
+        WHERE promoterId = #{promoterId}
+          AND `date` BETWEEN #{startInt}
+            and #{endInt}
+        GROUP BY `date`
+        ORDER BY `date`
+    </select>
+
+    <select id="getPromoterShortVideosCommerceInfo" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT `date`,
+               shareCount,
+               videoWatchCount,
+               likeCount,
+               commentCount
+        from kwai_promoter.kwai_promoter_video_report_analyse_info
+        WHERE promoterId = #{promoterId}
+          AND `date` BETWEEN #{startInt} and #{endInt}
+        GROUP BY `date`
+        ORDER BY `date`
+    </select>
+
+    <select id="getPromoterVideoInfo" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT IFNULL(avgVideoSales, 0.0) as 'avgVideoSales', IFNULL(videoSales, 0.0) as 'videoSales'
+        from kwai_promoter.kwai_promoter_base_info
+        WHERE promoterId = #{promoterId}
+    </select>
+
+</mapper>

+ 4 - 4
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml

@@ -1799,7 +1799,7 @@
             LEFT JOIN `application`.app_user_manage m ON u.id = m.user_id
             LEFT JOIN `jeecg-boot`.sys_user_role ur ON u.id = ur.user_id
             LEFT JOIN `jeecg-boot`.sys_role r ON ur.role_id = r.id
-            LEFT JOIN  application.kuaishou_account_report_daily_dw t ON t.user_id = u.id
+            LEFT JOIN  application.kuaishou_account_report_hourly_dw t ON t.user_id = u.id
         where m.manage_id = #{userId}
           AND   r.role_name LIKE '%运营%'
           AND u.STATUS = 1
@@ -1810,7 +1810,7 @@
         AND t.company_id = 'd57fecdcf7a94d009736d9c850731582'
         GROUP BY u.id
         UNION all
-        SELECT DISTINCT user_id FROM application.kuaishou_account_report_daily_dw t
+        SELECT DISTINCT user_id FROM application.kuaishou_account_report_hourly_dw t
         WHERE user_id = #{userId}
           AND t.stat_date >=#{startDate}
           AND t.stat_date &lt;=#{endDate}
@@ -1825,7 +1825,7 @@
         LEFT JOIN `application`.app_user_manage m ON u.id = m.user_id
         LEFT JOIN `jeecg-boot`.sys_user_role ur ON u.id = ur.user_id
         LEFT JOIN `jeecg-boot`.sys_role r ON ur.role_id = r.id
-        LEFT JOIN  application.bytedance_advertiser_report_daily_dw t ON t.user_id = u.id
+        LEFT JOIN  application.bytedance_advertiser_report_hourly_dw t ON t.user_id = u.id
         where m.manage_id =  #{userId}
         AND   r.role_name LIKE '%运营%'
         AND u.STATUS = 1
@@ -1836,7 +1836,7 @@
         AND t.company_id = 'd57fecdcf7a94d009736d9c850731582'
         GROUP BY u.id
         UNION ALL
-        SELECT DISTINCT user_id FROM application.bytedance_advertiser_report_daily_dw t
+        SELECT DISTINCT user_id FROM application.bytedance_advertiser_report_hourly_dw t
         WHERE user_id =  #{userId}
         AND t.stat_datetime >=#{startDate}
         AND t.stat_datetime &lt;=#{endDate}

+ 10 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/IKuaishouPromoterService.java

@@ -0,0 +1,10 @@
+package org.jeecg.ctop.material.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+public interface IKuaishouPromoterService {
+
+    JSONObject getPromoterInfo(Long promoterId);
+
+    JSONObject getPromoterVideoInfo(Long promoterId);
+}

+ 41 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/IKuaishouPromoterServiceImpl.java

@@ -0,0 +1,41 @@
+package org.jeecg.ctop.material.service.impl;
+
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.ctop.material.constants.Check;
+import org.jeecg.ctop.material.mapper.KuaishouPromoterMapper;
+import org.jeecg.ctop.material.service.IKuaishouPromoterService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Slf4j
+@Service
+public class IKuaishouPromoterServiceImpl implements IKuaishouPromoterService {
+
+    @Resource
+    private KuaishouPromoterMapper promoterMapper;
+
+    @Override
+    public JSONObject getPromoterInfo(Long promoterId) {
+        JSONObject data = promoterMapper.getPromoterInfo(promoterId);
+        if (!Check.isNull(data)) {
+            data.put("hotSaleBrandInfo", data.getJSONArray("hotSaleBrandInfo"));
+            data.put("hotSaleChannelInfo", data.getJSONArray("hotSaleChannelInfo"));
+            data.put("fanCharacteristic", promoterMapper.getFansCharacteristic(promoterId));
+            String today = DateUtils.date2Str();
+            Integer startInt = DateUtils.getDateInteger(DateUtils.getLastDay(today, 31));
+            Integer endInt = DateUtils.getDateInteger(DateUtils.getLastDay(today, 1));
+            data.put("liveInfo", promoterMapper.getPromoterLiveCommerceInfo(promoterId, startInt, endInt));
+            data.put("shortVideosInfo", promoterMapper.getPromoterShortVideosCommerceInfo(promoterId, startInt, endInt));
+        }
+        return data;
+    }
+
+    @Override
+    public JSONObject getPromoterVideoInfo(Long promoterId) {
+        return promoterMapper.getPromoterVideoInfo(promoterId);
+    }
+}

+ 12 - 6
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/ManagerSaleValueServiceImpl.java

@@ -16,7 +16,6 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -152,7 +151,11 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
                 if (!startTime.equals(statDay)) {
                     hour = 23;
                 }
-                //运营一部:李超及其下级 李超 id:f6a6843879c949618e4a859140c8a127
+                JSONObject oneResult = baseMapper.queryTtTodayCharge2(startTime, endTime, hour, accountIds, companyId, days);
+                result.put("oneCharge", oneResult.getBigDecimal("totalCharge"));
+                result.put("oneChargeRoi", oneResult.getString("chargeRoi"));
+
+                /*//运营一部:李超及其下级 李超 id:f6a6843879c949618e4a859140c8a127
                 oneAccountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber, Arrays.asList(lichaoId));
                 JSONObject oneResult = baseMapper.queryTtTodayCharge2(startTime, endTime, hour, oneAccountIds, companyId, days);
                 result.put("oneCharge", oneResult.getBigDecimal("totalCharge"));
@@ -166,7 +169,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
 
                 JSONObject twoResult2 = baseMapper.queryTtTodayCharge3(startTime, endTime, mediaId, hour, companyId, days);
                 result.put("twoCharge2", twoResult2.getBigDecimal("totalCharge"));
-                result.put("twoChargeRoi2", twoResult2.getString("chargeRoi"));
+                result.put("twoChargeRoi2", twoResult2.getString("chargeRoi"));*/
             }
         } else if ("2".equals(mediaId)) {
             result = baseMapper.queryKsTodayCharge(statDay, hour, accountIds, companyId);
@@ -185,6 +188,11 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
                 if (!startTime.equals(statDay)) {
                     hour = 23;
                 }
+                JSONObject oneResult = baseMapper.queryKsTodayCharge2(startTime, endTime, hour, accountIds, companyId, days);
+                result.put("oneCharge", oneResult.getBigDecimal("totalCharge"));
+                result.put("oneChargeRoi", oneResult.getString("chargeRoi"));
+                /*result.put("oneCharge", oneResult.getBigDecimal("totalCharge"));
+                result.put("oneChargeRoi", oneResult.getString("chargeRoi"));
                 //运营一部:李超及其下级 李超 id:f6a6843879c949618e4a859140c8a127
                 oneAccountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber, Arrays.asList(lichaoId));
                 JSONObject oneResult = baseMapper.queryKsTodayCharge2(startTime, endTime, hour, oneAccountIds, companyId, days);
@@ -200,9 +208,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
 
                 JSONObject twoResult2 = baseMapper.queryKsTodayCharge3(startTime, endTime, mediaId, hour, companyId, days);
                 result.put("twoCharge2", twoResult2.getBigDecimal("totalCharge"));
-                result.put("twoChargeRoi2", twoResult2.getString("chargeRoi"));
-
-
+                result.put("twoChargeRoi2", twoResult2.getString("chargeRoi"));*/
             }
         }
         result.put("weeklyGoalValue", baseMapper.getWeekly(userId, companyId, mediaId));

+ 49 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupTemplateController.java

@@ -4,8 +4,11 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -24,7 +27,15 @@ 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.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
@@ -57,7 +68,8 @@ public class KuaiShouGroupTemplateController {
     @Autowired
     private ICtopOauthTokenService tokenService;
     static ExecutorService executorService = Executors.newFixedThreadPool(10);
-
+    @Autowired
+    private IKuaiShouImageGetService iKuaiShouImageGetService;
 
     @PostMapping(value = "/getLibraryConfig")
     public Result<JSONObject> getLibraryConfig(@RequestBody JSONObject requestJson) {
@@ -231,6 +243,41 @@ public class KuaiShouGroupTemplateController {
 
     }
 
+    @PostMapping(value = "/getUrlByPhotoIds")
+    public Result<Object> getUrlByPhotoIds(@RequestBody JSONObject requestJson) {
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            JSONArray photoIds = requestJson.getJSONArray("photoIds");
+            if (photoIds.isEmpty()) {
+                throw new Exception("参数不能为空");
+            }
+            List<JSONObject> list = kuaiShouGroupTemplateService.getUrlByPhotoIds(accountId, photoIds);
+            return Result.ok(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+
+    }
+
+
+    @PostMapping(value = "/queryUrlByImageTokens")
+    public Result<Object> queryUrlByImageTokens(@RequestBody JSONObject requestJson) {
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            JSONArray imageTokens = requestJson.getJSONArray("imageTokens");
+            if (Check.isNull(accountId) || imageTokens.isEmpty()) {
+                throw new Exception("参数不能为空");
+            }
+            List<KuaiShouImageGet> list = iKuaiShouImageGetService.getUrlByImageTokens(accountId, imageTokens);
+            return Result.ok(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+
+    }
+
 
     /**
      * 分页列表查询

+ 55 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouMaterialUploadController.java

@@ -1,8 +1,10 @@
 package cn.com.ctop.kuaishou.modules.batch.controller;
 
+import cn.com.ctop.common.module.constant.CosConstant;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CosUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
@@ -12,14 +14,23 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.UUID;
+
+@Slf4j
 @RestController
 @RequestMapping("/kusiShouUpload")
 public class KuaiShouMaterialUploadController {
@@ -176,4 +187,48 @@ public class KuaiShouMaterialUploadController {
     }
 
 
+    @PostMapping(value = "/uploadImage")
+    public Result<Object> uploadImage(@RequestParam("file") MultipartFile file, Long accountId, String signature) throws Exception {
+        try {
+            QueryWrapper<KuaiShouImageGet> imageGetQueryWrapper = new QueryWrapper<>();
+            imageGetQueryWrapper.eq("signature", signature);
+            imageGetQueryWrapper.eq("account_id", accountId);
+            imageGetQueryWrapper.last("limit 1");
+            KuaiShouImageGet imageGet = iKuaiShouImageGetService.getOne(imageGetQueryWrapper);
+            if (Check.isNull(imageGet)) {
+                CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+                if (Check.isNull(oauthToken)) {
+                    return Result.error("未获取到账户信息");
+                }
+                String[] split = file.getOriginalFilename().split("\\.");
+                String fileName = accountId + System.currentTimeMillis() + UUID.randomUUID().toString().replace("-", "").substring(0, 5) + "." + split[1];
+                InputStream inputStream = null;
+                try {
+                    inputStream = file.getInputStream();
+                } catch (IOException e) {
+                    log.error("图片上传异常");
+                }
+                String splashPath = "splash/image/" + DateUtils.date2Str() + "/";
+                String md5 = CosUtils.uploadFileByInputStream(inputStream, splashPath, fileName);
+                Thread.sleep(200);
+                String imageUrl = CosConstant.URL_COS_ADDRESS + splashPath + fileName;
+                String imageToken = uploadService.kuauiShouImageUpload(imageUrl, md5, accountId, oauthToken.getAccessToken());
+                if (!Check.isNull(imageToken)) {
+                    imageGetQueryWrapper = new QueryWrapper<>();
+                    imageGetQueryWrapper.eq("image_token", imageToken);
+                    imageGetQueryWrapper.eq("account_id", accountId);
+                    imageGetQueryWrapper.last("limit 1");
+                    KuaiShouImageGet one = iKuaiShouImageGetService.getOne(imageGetQueryWrapper);
+                    return Result.ok(one);
+                }
+            } else {
+                return Result.ok(imageGet);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+
 }

+ 7 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchCreativeTemplate.java

@@ -83,6 +83,13 @@ public class KuaiShouBatchCreativeTemplate {
     @ApiModelProperty(value = "封面广告语标题")
     private String stickerTitle;
     /**
+     * 第三方开始播放监测链接
+     */
+    @Excel(name = "第三方开始播放监测链接", width = 15)
+    @ApiModelProperty(value = "第三方开始播放监测链接")
+    private String impressionUrl;
+
+    /**
      * 贴纸样式类型
      */
     @Excel(name = "贴纸样式类型", width = 15)

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTemplateMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
@@ -34,4 +35,5 @@ public interface KuaiShouGroupTemplateMapper extends BaseMapper<KuaiShouGroupTem
      */
     JSONObject getConfig(@Param("projectId") Long projectId);
 
+    List<JSONObject> getUrlByPhotoIds(@Param("accountId") Long accountId, @Param("photoIds") JSONArray photoIds);
 }

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouImageGetMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -19,4 +20,6 @@ public interface KuaiShouImageGetMapper extends BaseMapper<KuaiShouImageGet> {
     String getUrlByCode(String signature);
 
     String getCutFrameUrlByCode(String signature);
+
+    List<KuaiShouImageGet> getUrlByImageTokens(@Param(value = "accountId") Long accountId, @Param(value = "imageTokens") JSONArray imageTokens);
 }

+ 40 - 40
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTemplateMapper.xml

@@ -3,66 +3,66 @@
 <mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTemplateMapper">
 
     <select id="getMd5ByPhotoId" resultType="com.alibaba.fastjson.JSONObject">
-    select
-    signature  as 'md5',
-    material_type as 'materialType'
-    from ctop_kuaishou_video_get
-    where  photo_id = #{photoId}
-    and signature is not null
-    limit 1
+        select signature as 'md5', material_type as 'materialType'
+        from ctop_kuaishou_video_get
+        where photo_id = #{photoId}
+          and signature is not null limit 1
     </select>
 
     <select id="getImageListByMd5" resultType="com.alibaba.fastjson.JSONObject">
-      select
-      signature as 'md5',
-      url as 'url'
-      from ctop_material_cut_frame
-      where video_signature = #{md5}
-      ORDER BY RAND() LIMIT #{imageCount}
+        select signature as 'md5', url as 'url'
+        from ctop_material_cut_frame
+        where video_signature = #{md5}
+        ORDER BY RAND() LIMIT #{imageCount}
     </select>
     <select id="getImageJsonByMd5" resultType="com.alibaba.fastjson.JSONObject">
-      select
-      signature as 'md5',
-      url as 'url'
-      from ctop_material_cut_frame
-      where video_signature = #{md5}
-       ORDER BY RAND() LIMIT 1
+        select signature as 'md5', url as 'url'
+        from ctop_material_cut_frame
+        where video_signature = #{md5}
+        ORDER BY RAND() LIMIT 1
     </select>
 
 
     <select id="getApiCreateCount" resultType="java.lang.Integer">
         select count(1)
-        from
-            ctop_kuaishou_group
-        where  account_id = #{accountId}
+        from ctop_kuaishou_group
+        where account_id = #{accountId}
           and unit_type = #{unitType}
-          and DATE_FORMAT(group_create_time,'%Y-%m-%d') =  #{date}
+          and DATE_FORMAT(group_create_time, '%Y-%m-%d') = #{date}
     </select>
 
     <select id="getUrlByPhotoId" resultType="com.alibaba.fastjson.JSONObject">
-     select
-     cover_url as 'coverUrl',
-     url as 'url'
-     from
-     ctop_kuaishou_video_get
-     where  photo_id = #{photoId}
-     and status = 0
-     limit 1
+        select cover_url as 'coverUrl', url as 'url'
+        from ctop_kuaishou_video_get
+        where photo_id = #{photoId}
+          and status = 0 limit 1
     </select>
 
-    <select id="getIdList" resultType="java.lang.Long">
-    select id  from ctop_kuaishou_group_template
-    where  task_status = 0
-    order by create_time asc
-    limit 70
+    <select id="getUrlByPhotoIds" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        cover_url as 'coverUrl',
+        url as 'url'
+        from
+        ctop_kuaishou_video_get
+        where account_id = #{accountId}
+        and photo_id in
+        <foreach collection="photoIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
     </select>
 
+    <select id="getIdList" resultType="java.lang.Long">
+        select id
+        from ctop_kuaishou_group_template
+        where task_status = 0
+        order by create_time asc limit 70
+    </select>
 
 
     <select id="getConfig" resultType="com.alibaba.fastjson.JSONObject">
-      select
-      library_id as 'libraryId'
-      from ctop_kuaishou_library_config
-      where project_id = #{projectId}
+        select library_id as 'libraryId'
+        from ctop_kuaishou_library_config
+        where project_id = #{projectId}
     </select>
 </mapper>

+ 16 - 6
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouImageGetMapper.xml

@@ -39,15 +39,25 @@
     </insert>
 
     <select id="getUrlByCode" resultType="java.lang.String">
-        select url from ctop_material_image_info
-        where  code = #{signature}
-        limit 1
+        select url
+        from ctop_material_image_info
+        where code = #{signature} limit 1
+    </select>
+
+    <select id="getUrlByImageTokens" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet">
+        select * from ctop_kuaishou_image_get
+        where account_id = #{accountId}
+        And image_token in
+        <foreach collection="imageTokens" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
     </select>
 
     <select id="getCutFrameUrlByCode" resultType="java.lang.String">
-        select url from ctop_material_cut_frame
-        where  signature = #{signature}
-        limit 1
+        select url
+        from ctop_material_cut_frame
+        where signature = #{signature} limit 1
     </select>
 
 

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupTemplateService.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
@@ -61,10 +62,13 @@ public interface IKuaiShouGroupTemplateService extends IService<KuaiShouGroupTem
 
     /**
      * 获取商品库配置
+     *
      * @param accountId
      * @return
      */
     JSONObject getLibraryConfig(Long accountId);
 
     void createUnitAgain(KuaiShouGroupTemplate template);
+
+    List<JSONObject> getUrlByPhotoIds(Long accountId, JSONArray photoIds);
 }

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouImageGetService.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.List;
@@ -17,4 +18,6 @@ public interface IKuaiShouImageGetService extends IService<KuaiShouImageGet> {
     String getUrlByCode(String signature);
 
     KuaiShouImageGet getOneByParams(String url,String code);
+
+    List<KuaiShouImageGet> getUrlByImageTokens(Long accountId, JSONArray imageTokens);
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java

@@ -1107,6 +1107,11 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         }
     }
 
+    @Override
+    public List<JSONObject> getUrlByPhotoIds(Long accountId, JSONArray photoIds) {
+        return groupTemplateMapper.getUrlByPhotoIds(accountId, photoIds);
+    }
+
     private void createCreativeAgain(String accessToken, Long unitId, KuaiShouGroupTemplate template) {
         KuaiShouGroupTemplate updateTemplate = new KuaiShouGroupTemplate();
         updateTemplate.setId(template.getId());

+ 12 - 6
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouImageGetServiceImpl.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouImageGetMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -41,17 +42,22 @@ public class KuaiShouImageGetServiceImpl extends ServiceImpl<KuaiShouImageGetMap
 
 
     @Override
-    public KuaiShouImageGet getOneByParams(String url,String code) {
-        QueryWrapper<KuaiShouImageGet> queryWrapper= new QueryWrapper<>();
-        if(null!=url&&!"".equals(url.trim())){
-            queryWrapper.eq("url",url);
+    public KuaiShouImageGet getOneByParams(String url, String code) {
+        QueryWrapper<KuaiShouImageGet> queryWrapper = new QueryWrapper<>();
+        if (null != url && !"".equals(url.trim())) {
+            queryWrapper.eq("url", url);
         }
-        if(null!=code&&!"".equals(code.trim())){
-            queryWrapper.eq("signature",code);
+        if (null != code && !"".equals(code.trim())) {
+            queryWrapper.eq("signature", code);
         }
         queryWrapper.orderByDesc("create_time");
         queryWrapper.last("limit 1");
         return this.getOne(queryWrapper);
     }
 
+    @Override
+    public List<KuaiShouImageGet> getUrlByImageTokens(Long accountId, JSONArray imageTokens) {
+        return imageGetMapper.getUrlByImageTokens(accountId, imageTokens);
+    }
+
 }

+ 3 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouMaterialUploadServiceImpl.java

@@ -11,6 +11,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.io.FileSystemResource;
@@ -123,7 +124,7 @@ public class KuaiShouMaterialUploadServiceImpl implements IKuaiShouMaterialUploa
             requestJson.put("advertiser_id", accountId);
             headerMap.put("Access-Token", token);
             String requestUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
-            requestJson.put("upload_type", "2");
+            requestJson.put("upload_type", 2);
             String result = exceptInfoForRestTemplate(requestUrl, requestJson, headerMap);
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {
@@ -145,6 +146,7 @@ public class KuaiShouMaterialUploadServiceImpl implements IKuaiShouMaterialUploa
                         }
                         imageGet.setSignature(signature);
                         imageGet.setImageToken(image_token);
+                        imageGet.setStatDate(DateUtils.parseDate(DateUtils.date2Str(), "yyyy-MM-dd"));
                         iKuaiShouImageGetService.saveOrUpdate(imageGet);
                         return dataJson.getString("image_token");
                     }

+ 43 - 10
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCampaignPreviewServiceImpl.java

@@ -25,11 +25,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
 import com.xxl.job.core.enums.NoEn;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.RedisUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -60,6 +62,8 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
     private KuaiShouCampaignMapper kuaiShouCampaignMapper;
     @Autowired
     private IKuaiShouVideoGetService videoGetService;
+    @Autowired
+    private RedisUtil redisUtil;
 
     @Override
     public JSONObject queryByBatchId(String batchId, String accountId) {
@@ -94,8 +98,13 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
             for (KuaishouBatchCreativePreview creativePreview : kuaishouBatchCreativePreviews) {
                 if (groupPreview.getPlanId().equals(creativePreview.getPlanId()) && creativePreview.getGroupId().equals(groupPreview.getId())) {
                     JSONObject obj = new JSONObject();
-                    obj.put("photoId", creativePreview.getPhotoId());
-                    obj.put("imageUrl", creativePreview.getImageUrl());
+                    if (!Check.isNull(creativePreview.getPhotoId())) {
+                        obj.put("photoId", creativePreview.getPhotoId());
+                    } else if (!Check.isNull(creativePreview.getSplashPhotoIds())) {
+                        obj.put("photoIds", creativePreview.getSplashPhotoIds());
+                    } else if (!Check.isNull(creativePreview.getSplashImageTokens())) {
+                        obj.put("imageTokens", creativePreview.getSplashImageTokens());
+                    }
                     materialArr.add(obj);
                     descriptionArr.add(creativePreview.getDescription());
                     groupPreview.setSiteId(creativePreview.getSiteId());
@@ -341,7 +350,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                 }
                 if (Check.isNull(campaignId)) {
                     campaignPreview.setId(null);
-                    campaignPreview.setCampaignName(getName(campaignPreview.getCampaignNameFormat(), targetIds.getLong(i), groupPreview.getSceneId(), appId, groupPreview.getUnitType(), i, getRandomFromArr(materialList.getJSONObject(0).getJSONArray("photoArr")), creativePreview.getCreativeCategory()));
+                    campaignPreview.setCampaignName(getName(campaignPreview.getCampaignNameFormat(), targetIds.getLong(i), groupPreview.getSceneId(), appId, groupPreview.getUnitType(), i, getRandomFromArr(materialList.getJSONObject(0).getJSONArray("photoArr")), creativePreview.getCreativeCategory(), campaignPreview.getAccountId(), "campaign"));
                     campaignPreviewMapper.insert(campaignPreview);
                 }
                 for (int j = 0; j < materialList.size(); j++) {
@@ -378,7 +387,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                     groupPreview.setAppId(appId);
                     groupPreview.setPlanId(campaignPreview.getId());
                     groupPreview.setTemplateId(targetIds.getLong(i));
-                    groupPreview.setUnitName(getName(groupPreview.getUnitNameFormat(), targetIds.getLong(i), groupPreview.getSceneId(), appId, groupPreview.getUnitType(), j, getRandomFromArr(photoArr), creativePreview.getCreativeCategory()));
+                    groupPreview.setUnitName(getName(groupPreview.getUnitNameFormat(), targetIds.getLong(i), groupPreview.getSceneId(), appId, groupPreview.getUnitType(), j, getRandomFromArr(photoArr), creativePreview.getCreativeCategory(), null, null));
                     groupPreview.setUrl(url);
                     groupPreview.setSchemaUri(schemaUri);
                     if (!Check.isNull(groupPreview.getBidMax()) && !Check.isNull(groupPreview.getBidMin())) {
@@ -466,7 +475,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
             }
         } else if (NoEn.NO2.valueInt() == type) {
             /**
-             *按照 创意组 分组
+             * 按照 创意组 分组
              * 计划总数 = 创意组数
              * 则同一广告计划内的创意完全相同,定向包不同
              */
@@ -498,7 +507,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                 JSONArray photoArr = material.getJSONArray("photoArr");
 
                 campaignPreview.setId(null);
-                campaignPreview.setCampaignName(getName(campaignPreview.getCampaignNameFormat(), targetIds.getLong(new Random().nextInt(targetIds.size())), groupPreview.getSceneId(), appId, groupPreview.getUnitType(), i, getRandomFromArr(photoArr), creativePreview.getCreativeCategory()));
+                campaignPreview.setCampaignName(getName(campaignPreview.getCampaignNameFormat(), targetIds.getLong(new Random().nextInt(targetIds.size())), groupPreview.getSceneId(), appId, groupPreview.getUnitType(), i, getRandomFromArr(photoArr), creativePreview.getCreativeCategory(), campaignPreview.getAccountId(), "campaign"));
                 campaignPreviewMapper.insert(campaignPreview);
 
                 if (matchingMethod == 2) {
@@ -535,7 +544,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                     groupPreview.setAppId(appId);
                     groupPreview.setPlanId(campaignPreview.getId());
                     groupPreview.setTemplateId(targetIds.getLong(j));
-                    groupPreview.setUnitName(getName(groupPreview.getUnitNameFormat(), targetIds.getLong(j), groupPreview.getSceneId(), appId, groupPreview.getUnitType(), j, getRandomFromArr(photoArr), creativePreview.getCreativeCategory()));
+                    groupPreview.setUnitName(getName(groupPreview.getUnitNameFormat(), targetIds.getLong(j), groupPreview.getSceneId(), appId, groupPreview.getUnitType(), j, getRandomFromArr(photoArr), creativePreview.getCreativeCategory(), null, null));
                     groupPreview.setUrl(url);
                     groupPreview.setSchemaUri(schemaUri);
                     if (!Check.isNull(groupPreview.getBidMax()) && !Check.isNull(groupPreview.getBidMin())) {
@@ -657,7 +666,15 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         if (num == 2) {
             return !CollectionUtils.isEmpty(arr) && !CollectionUtils.isEmpty(arr2);
         } else {
-            return !CollectionUtils.isEmpty(arr);
+            if (!CollectionUtils.isEmpty(arr)) {
+                if (Check.isNull(arr.getString(0))) {
+                    return false;
+                } else {
+                    return true;
+                }
+            } else {
+                return false;
+            }
         }
     }
 
@@ -812,6 +829,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         creativePreview.setKolUserType(creativeJson.getInteger("kolUserType"));
         creativePreview.setImageTokens(creativeJson.getString("imageTokens"));
         creativePreview.setMaterialType(creativeJson.getString("materialType"));
+        creativePreview.setImpressionUrl(creativeJson.getString("impressionUrl"));
         creativePreview.setBatchId(batchId);
         return creativePreview;
     }
@@ -827,7 +845,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
      * @return
      */
     private String getName(String content, Long templateId, String sceneId, Integer appId, Integer unitType
-            , Integer number, String photoId, Integer creativeCategory) {
+            , Integer number, String photoId, Integer creativeCategory, Long accountId, String type) {
         String reg = "\\{\\{(.+?)\\}\\}";
         List<String> params = getParams(reg, content);
         if (Check.isNull(params)) {
@@ -877,7 +895,22 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                     data.put(regName, unitType == 4 ? "自定义" : "程序化创意2.0");
                 }
             } else if ("序号".equals(regName)) {
-                data.put(regName, number + "");
+                if ("campaign".equals(type)) {
+                    String nowDate = DateUtils.formatDate(new Date(), "yyMMdd");
+                    String redisKey = accountId + "_batch_" + nowDate;
+                    Integer cnt = null;
+                    Integer redisCnt = (Integer) redisUtil.get(redisKey);
+                    if (Check.isNull(redisCnt)) {
+                        cnt = 1;
+                        redisUtil.set(redisKey, cnt, 100000L);
+                    } else {
+                        cnt = redisCnt + 1;
+                        redisUtil.set(redisKey, cnt, 100000L);
+                    }
+                    data.put(regName, cnt + "");
+                } else {
+                    data.put(regName, number + "");
+                }
             } else if ("素材命名".equals(regName)) {
                 KuaiShouVideoGet video = videoGetService.getVideoByPhotoId(photoId);
                 if (!Check.isNull(video)) {

+ 6 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCreativePreviewServiceImpl.java

@@ -556,8 +556,13 @@ public class KuaishouBatchCreativePreviewServiceImpl extends ServiceImpl<Kuaisho
                 creative.put("creative_name", preview.getCreativeName()); // 创意名称
                 if (!Check.isNull(preview.getSplashPhotoIds())) {
                     creative.put("creative_material_type", 11);// 11-开屏视频
-                    creative.put("splash_photo_ids", JSONObject.parseArray(preview.getSplashPhotoIds()));  // 安卓下载中间页ID
+                    creative.put("splash_photo_ids", JSONObject.parseArray(preview.getSplashPhotoIds()));
                 }
+                if (!Check.isNull(preview.getSplashImageTokens())) {
+                    creative.put("creative_material_type", 12);// 12-开屏图片 image_token
+                    creative.put("splash_image_tokens", JSONObject.parseArray(preview.getSplashImageTokens()));
+                }
+
                 if (!Check.isNull(preview.getImageTokens())) {
                     creative.put("image_tokens", Arrays.asList(preview.getImageTokens()));
                     creative.put("creative_material_type", preview.getMaterialType());

+ 18 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/controller/ReimburseApplyController.java

@@ -146,6 +146,24 @@ public class ReimburseApplyController {
     }
 
     /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/queryProcess")
+    public Result<Object> queryProcess(@RequestParam(name = "id", required = true) String id) {
+        ReimburseApply reimburseApply = reimburseApplyService.getById(id);
+        if (reimburseApply == null) {
+            return Result.error("未找到对应实体");
+        } else {
+            List<JSONObject> list = reimburseApplyService.queryProcess(reimburseApply.getId());
+            return Result.ok(list);
+        }
+    }
+
+
+    /**
      * 编辑
      */
     @PostMapping(value = "/edit")

+ 88 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/entity/ReimburseApplyProcess.java

@@ -0,0 +1,88 @@
+package cn.com.ctop.reimburse.mondule.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;
+
+import java.util.Date;
+
+/**
+ * 报销申请提交表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2022-11-21
+ */
+@Data
+@TableName("ctop_reimburse_apply_process")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_reimburse_apply_process对象", description = "报销申请流程表")
+public class ReimburseApplyProcess {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 报销申请ID
+     */
+    @Excel(name = "报销申请ID", width = 15)
+    @ApiModelProperty(value = "报销申请ID")
+    private Long applyId;
+    /**
+     * 流程人员ID
+     */
+    @Excel(name = "流程人员ID", width = 15)
+    @ApiModelProperty(value = "流程人员ID")
+    private String userId;
+    /**
+     * 流程顺序
+     */
+    @Excel(name = "流程顺序", width = 15)
+    @ApiModelProperty(value = "流程顺序")
+    private Integer orders;
+    /**
+     * 审核状态
+     */
+    @Excel(name = "审核状态:0-创建,1-通过,2-拒绝,3-待审核,4-未审核,5-修改", width = 15)
+    @ApiModelProperty(value = "审核状态:0-创建,1-通过,2-拒绝,3-待审核,4-未审核,5-修改")
+    private String state;
+
+    /**
+     * 操作时间
+     */
+    @Excel(name = "操作时间", width = 15)
+    @ApiModelProperty(value = "操作时间")
+    private String statTime;
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date updateTime;
+
+    public ReimburseApplyProcess() {
+    }
+
+    public ReimburseApplyProcess(Long applyId, String userId, String state, Integer orders, String statTime) {
+        this.setApplyId(applyId);
+        this.setUserId(userId);
+        this.setState(state);
+        this.setOrders(orders);
+        this.setStatTime(statTime);
+    }
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/ReimburseApplyProcessMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.reimburse.mondule.mapper;
+
+import cn.com.ctop.reimburse.mondule.entity.ReimburseApplyProcess;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ReimburseApplyProcessMapper extends BaseMapper<ReimburseApplyProcess> {
+
+    List<JSONObject> queryProcess(@Param("applyId") Long applyId);
+
+    List<ReimburseApplyProcess> getListByApplyId(@Param("applyId") Long applyId);
+
+    void deleteByApplyId(@Param("applyId") Long applyId);
+}

+ 10 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/xml/ReimburseApplyMapper.xml

@@ -22,6 +22,9 @@
         <if test="status != null and status != ''">
             AND status =#{status}
         </if>
+        <if test="userName != null and userName != ''">
+            AND user_name like concat('%',#{userName},'%')
+        </if>
         <if test="startDate != null and startDate != ''">
             AND stat_date >=#{startDate}
             AND stat_date &lt;=#{endDate}
@@ -48,6 +51,9 @@
         <if test="status != null and status != ''">
             AND status =#{status}
         </if>
+        <if test="userName != null and userName != ''">
+            AND user_name like concat('%',#{userName},'%')
+        </if>
         <if test="startDate != null and startDate != ''">
             AND stat_date >=#{startDate}
             AND stat_date &lt;=#{endDate}
@@ -57,7 +63,7 @@
         left join ctop_reimburse_apply_leader_rel t2 on t1.id = t2.apply_id
         where
         t2.user_id = #{userId}
-          AND t1.id not in (
+        AND t1.id not in (
         SELECT id FROM ctop_reimburse_apply
         where 1=1
         <if test="financialReview == 1">
@@ -79,6 +85,9 @@
         <if test="status != null and status != ''">
             AND status =#{status}
         </if>
+        <if test="userName != null and userName != ''">
+            AND user_name like concat('%',#{userName},'%')
+        </if>
         <if test="startDate != null and startDate != ''">
             AND stat_date >=#{startDate}
             AND stat_date &lt;=#{endDate}

+ 28 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/xml/ReimburseApplyProcessMapper.xml

@@ -0,0 +1,28 @@
+<?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="cn.com.ctop.reimburse.mondule.mapper.ReimburseApplyProcessMapper">
+
+    <select id="queryProcess" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT IFNULL(t4.role_name, '财务审核') as 'roleName', IFNULL(t2.realname, '-') as 'userName', IFNULL(t1.orders, '') as 'orders', IFNULL(t1.state, '') as 'state', IFNULL(t1.stat_time, '') as 'statTime', IFNULL(t1.type, '') as 'type'
+        from ctop_reimburse_apply_process t1
+                 LEFT JOIN sys_user t2 on t1.user_id = t2.id
+                 LEFT JOIN sys_user_role t3 on t2.id = t3.user_id
+                 LEFT JOIN sys_role t4 on t3.role_id = t4.id
+        WHERE apply_id = #{applyId}
+    </select>
+
+
+    <select id="getListByApplyId" resultType="cn.com.ctop.reimburse.mondule.entity.ReimburseApplyProcess">
+        SELECT *
+        FROM ctop_reimburse_apply_process
+        where apply_id = #{applyId}
+        order by orders
+    </select>
+
+
+    <delete id="deleteByApplyId">
+        delete
+        from ctop_reimburse_apply_process
+        where apply_id = #{applyId}
+    </delete>
+</mapper>

+ 16 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/IReimburseApplyProcessService.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.reimburse.mondule.service;
+
+import cn.com.ctop.reimburse.mondule.entity.ReimburseApplyProcess;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+public interface IReimburseApplyProcessService extends IService<ReimburseApplyProcess> {
+
+    List<JSONObject> queryProcess(Long applyId);
+
+    List<ReimburseApplyProcess> getListByApplyId(Long applyId);
+
+    void deleteByApplyId(Long applyId);
+}

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/IReimburseApplyService.java

@@ -27,4 +27,6 @@ public interface IReimburseApplyService extends IService<ReimburseApply> {
     Result<Object> submitReview(String id);
 
     List<JSONObject> getCompanyList();
+
+    List<JSONObject> queryProcess(Long applyId);
 }

+ 31 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseApplyProcessServiceImpl.java

@@ -0,0 +1,31 @@
+package cn.com.ctop.reimburse.mondule.service.impl;
+
+import cn.com.ctop.reimburse.mondule.entity.ReimburseApplyProcess;
+import cn.com.ctop.reimburse.mondule.mapper.ReimburseApplyProcessMapper;
+import cn.com.ctop.reimburse.mondule.service.IReimburseApplyProcessService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Slf4j
+@Service
+public class ReimburseApplyProcessServiceImpl extends ServiceImpl<ReimburseApplyProcessMapper, ReimburseApplyProcess> implements IReimburseApplyProcessService {
+
+    @Override
+    public List<JSONObject> queryProcess(Long applyId) {
+        return baseMapper.queryProcess(applyId);
+    }
+
+    @Override
+    public List<ReimburseApplyProcess> getListByApplyId(Long applyId) {
+        return baseMapper.getListByApplyId(applyId);
+    }
+
+    @Override
+    public void deleteByApplyId(Long applyId) {
+        baseMapper.deleteByApplyId(applyId);
+    }
+}

+ 182 - 15
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseApplyServiceImpl.java

@@ -7,11 +7,14 @@ import cn.com.ctop.common.module.service.IUserCompanyService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.reimburse.mondule.entity.ReimburseApply;
+import cn.com.ctop.reimburse.mondule.entity.ReimburseApplyProcess;
 import cn.com.ctop.reimburse.mondule.entity.ReimburseProject;
 import cn.com.ctop.reimburse.mondule.mapper.ReimburseApplyMapper;
+import cn.com.ctop.reimburse.mondule.service.IReimburseApplyProcessService;
 import cn.com.ctop.reimburse.mondule.service.IReimburseApplyService;
 import cn.com.ctop.reimburse.mondule.service.IReimburseProjectService;
 import cn.hutool.core.util.RandomUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -26,6 +29,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +49,9 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
     private IReimburseProjectService projectService;
 
     @Autowired
+    private IReimburseApplyProcessService processService;
+
+    @Autowired
     private ISysDepartService sysDepartService;
 
     @Autowired
@@ -111,11 +119,171 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
             projectService.updateById(project);
         }
         baseMapper.insertRel(leader, apply.getId());
+
+        //是否是福利费用,是则发送非空
+        String welfareUser = checkWelfare(projects);
+        addProcess(apply.getId(), data.getString("userId"), leader, welfareUser);
+
         return Result.ok();
     }
 
+    //添加流程
+    private void addProcess(Long applyId, String userId, String leaderId, String welfareUserId) throws Exception {
+        List<ReimburseApplyProcess> list = new ArrayList<>();
+        list.add(new ReimburseApplyProcess(applyId, userId, "0", 1, DateUtils.now()));
+        List<String> leaders = getProcessLeaders(userId, 2);
+        for (int i = 0; i < leaders.size(); i++) {
+            if (leaderId.equals(leaders.get(i))) {
+                list.add(new ReimburseApplyProcess(applyId, leaders.get(i), "3", i + 2, null));
+            } else {
+                list.add(new ReimburseApplyProcess(applyId, leaders.get(i), "4", i + 2, null));
+            }
+        }
+        if (!Check.isNull(welfareUserId) && !leaders.contains(welfareUserId)) {
+            list.add(new ReimburseApplyProcess(applyId, welfareUserId, "4", list.size() + 1, null));
+        }
+        list.add(new ReimburseApplyProcess(applyId, "-", "4", list.size() + 1, null));
+        processService.saveBatch(list);
+    }
+
+
+    /*
+    流程状态 状态 1待审核、2审核通过、3审核拒绝、4审核中、5部分拒绝
+    更新流程 审核状态:0-创建,1-通过,2-拒绝,3-待审核,4-未审核,5-修改
+     */
+    private void updateProcess(Long applyId, String userId, String leaderId, String state, String welfareUserId) throws Exception {
+        List<ReimburseApplyProcess> editlist = new ArrayList<>();
+        List<ReimburseApplyProcess> list = processService.getListByApplyId(applyId);
+        if ("2".equals(state)) {
+            ReimburseApplyProcess process = list.get(list.size() - 1);
+            process.setState("1");
+            process.setStatTime(DateUtils.now());
+            process.setUserId(userId);
+            processService.updateById(process);
+        } else if ("3".equals(state) || "5".equals(state)) {
+            if (JSONArray.toJSONString(list).contains(userId)) {
+                for (int i = list.size() - 1; i >= 0; i--) {
+                    ReimburseApplyProcess process = list.get(i);
+                    if (userId.equals(process.getUserId())) {
+                        process.setState("2");
+                        process.setStatTime(DateUtils.now());
+                        break;
+                    } else {
+                        list.remove(i);
+                    }
+                }
+                editlist.addAll(list);
+                editlist.add(new ReimburseApplyProcess(applyId, list.get(0).getUserId(), "5", list.size() + 1, null));
+                List<String> leaders = getProcessLeaders(userId, 2);
+                for (int i = 0; i < leaders.size(); i++) {
+                    editlist.add(new ReimburseApplyProcess(applyId, leaders.get(i), "4", i + list.size() + 2, null));
+                }
+                if (!Check.isNull(welfareUserId) && !leaders.contains(welfareUserId)) {
+                    editlist.add(new ReimburseApplyProcess(applyId, welfareUserId, "4", editlist.size() + 1, null));
+                }
+                editlist.add(new ReimburseApplyProcess(applyId, "-", "4", editlist.size() + 1, null));
+            } else {
+                ReimburseApplyProcess process = list.get(list.size() - 1);
+                process.setUserId(userId);
+                process.setState("2");
+                process.setStatTime(DateUtils.now());
+                editlist.addAll(list);
+                editlist.add(new ReimburseApplyProcess(applyId, list.get(0).getUserId(), "5", list.size() + 1, null));
+                List<String> leaders = getProcessLeaders(list.get(0).getUserId(), list.size() + 2);
+                for (int i = 0; i < leaders.size(); i++) {
+                    editlist.add(new ReimburseApplyProcess(applyId, leaders.get(i), "4", i + list.size() + 2, null));
+                }
+                if (!Check.isNull(welfareUserId) && !leaders.contains(welfareUserId)) {
+                    editlist.add(new ReimburseApplyProcess(applyId, welfareUserId, "4", editlist.size() + 1, null));
+                }
+                editlist.add(new ReimburseApplyProcess(applyId, "-", "4", editlist.size() + 1, null));
+
+            }
+            processService.deleteByApplyId(applyId);
+            processService.saveBatch(editlist);
+
+        } else if ("4".equals(state)) {
+            for (int i = list.size() - 1; i >= 0; i--) {
+                ReimburseApplyProcess process = list.get(i);
+                if (process.getUserId().equals(leaderId)) {
+                    process.setState("3");
+                    editlist.add(process);
+                }
+                if (userId.equals(process.getUserId())) {
+                    process.setState("1");
+                    process.setStatTime(DateUtils.now());
+                    editlist.add(process);
+                    break;
+                }
+            }
+            for (ReimburseApplyProcess applyProcess : editlist) {
+                processService.updateById(applyProcess);
+            }
+        }
+
+    }
+
+    /**
+     * 获取审核流程全部人员
+     */
+    private List<String> getProcessLeaders(String userId, Integer order) throws Exception {
+        JSONObject company = userCompanyService.getCompanyInfoByUserId(userId);
+        if (Check.isNull(company)) {
+            throw new Exception("用户ID:" + userId + ",未查询到所属公司");
+        }
+        List<String> list = new ArrayList<>();
+        String companyId = company.getString("companyId");
+        if ("6608ed13c0dd42de93c790dbdf124234".equals(companyId)) {
+            //广州汇创思拓数字科技有限公司(华南) 直接返回 何田田
+            list.add("1cd4c769eabb4de98fed306de2a3bbbd");
+        } else if ("4b10089775c040119e139087517aed88".equals(companyId)) {
+            //上海汇创思拓数字科技有限公司 直接返回 吴婵
+            list.add("183dce577efb49b386369473368cf251");
+        } else {
+            String user = baseMapper.selectFinalLeaders(userId, companyId);
+            if (userId.equals(user)) {
+                list.add(userId);
+            } else {
+                //查询部门
+                List<SysDepart> departs = sysDepartService.queryUserDeparts(userId);
+                if (!departs.isEmpty()) {
+                    String orgCode = departs.get(0).getOrgCode();
+                    JSONObject object = sysDepartService.queryAllParentIdByOrgCode(orgCode);
+                    JSONObject map = object.getJSONObject(orgCode).getJSONObject("parentMap");
+                    JSONObject leader = new JSONObject();
+                    //查询审核人员信息
+                    List<JSONObject> leaders = baseMapper.selectLeaders(companyId);
+                    for (JSONObject obj : leaders) {
+                        String departName = obj.getString("depart_name");
+                        if (map.toJSONString().contains(departName)) {
+                            leader = obj;
+                            break;
+                        }
+                    }
+                    if (leader.isEmpty()) {
+                        return Collections.emptyList();
+                    }
+                    //第一审核人
+                    if (!Check.isNull(leader.getString("first_id"))) {
+                        list.add(leader.getString("first_id"));
+                    }
+                    //第二审核人
+                    if (!Check.isNull(leader.getString("second_id"))) {
+                        list.add(leader.getString("second_id"));
+                    }
+                    //终极审核人
+                    if (!Check.isNull(leader.getString("final_id"))) {
+                        list.add(leader.getString("final_id"));
+                    }
+                }
+            }
+        }
+        return list;
+    }
+
     @Override
     public Result<Object> edit(JSONObject data) throws Exception {
+
         String sender = null;
         String msg = null;
         String type = "1";
@@ -143,7 +311,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
             apply.setInvoices(invoices);
             apply.setAmount(amount.toString());
         }
-
+        String welfareUser = welfareUser = checkWelfare(projects);
         //登录人ID
         String loginId = data.getString("loginId");
         //创建人操作,直接修改
@@ -158,8 +326,10 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
             this.updateById(apply);
             for (ReimburseProject project : projects) {
                 project.setApplyId(apply.getId());
+                project.setAuditDescription("");
                 projectService.updateById(project);
             }
+            updateProcess(id, loginId, sender, "4", welfareUser);
             return Result.ok();
         } else {
             ReimburseApply entity = this.getById(apply.getId());
@@ -172,6 +342,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
                     String roleCode = dailyAccountMapper.getRoleCodeByUserId(loginId);
                     if ("financialReview".equals(roleCode)) {
                         apply.setStatus("2");
+                        status = apply.getStatus();
                     } else {
                         //发送 财务审核
                         isFinancialReview = true;
@@ -182,7 +353,8 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
                     apply.setFinalStatus("0");
                     sender = apply.getUserId();
                 }
-            } else {
+                updateProcess(id, loginId, sender, status, welfareUser);
+            } else if (loginId.equals(entity.getLeaderId())) {
                 //获取下次审核人信息
                 leader = getLeader(entity.getLeaderId());
                 if (Check.isNull(leader)) {
@@ -194,8 +366,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
                         //登录人和待审核人一样,则是部门最后审核人
                         apply.setFinalStatus("1");
                         //是否是福利费用,是则发送审核 到指定审核人;否则 发送到财务
-                        String welfareUser = checkWelfare(projects);
-                        if (!Check.isNull(welfareUser)) {
+                        if (!Check.isNull(welfareUser) && !welfareUser.equals(loginId)) {
                             apply.setLeaderId(welfareUser);
                             sender = welfareUser;
                         } else {
@@ -212,6 +383,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
                     apply.setFinalStatus("0");
                     sender = apply.getUserId();
                 }
+                updateProcess(id, loginId, sender, status, welfareUser);
             }
             this.updateById(apply);
             if (!Check.isNull(sender)) {
@@ -230,7 +402,6 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
                 }
             }
         }
-
         return Result.ok();
     }
 
@@ -250,6 +421,11 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
         return baseMapper.queryLeaderCompanyList();
     }
 
+    @Override
+    public List<JSONObject> queryProcess(Long applyId) {
+        return processService.queryProcess(applyId);
+    }
+
     // 获取审核人ID
     private String getLeader(String userId) throws Exception {
         JSONObject company = userCompanyService.getCompanyInfoByUserId(userId);
@@ -263,23 +439,14 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
         } else if ("4b10089775c040119e139087517aed88".equals(companyId)) {
             //上海汇创思拓数字科技有限公司 直接返回 吴婵
             return "183dce577efb49b386369473368cf251";
-        } else if ("4b10089775c040119e139087517aed88".equals(companyId)) {
-            //上海汇创思拓数字科技有限公司 直接返回 吴婵
-            return "183dce577efb49b386369473368cf251";
-        } else if ("d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
-            //北京汇创思拓数字科技有限公司
-            return getCompanyLeader(userId, companyId);
-        } else if ("3f362f527a804e8a9db6552ea12f7574".equals(companyId)) {
-            //石家庄汇创思拓数字科技有限公司
+        } else {
             return getCompanyLeader(userId, companyId);
         }
-        return null;
     }
 
     // 获取公司审核人ID
     private String getCompanyLeader(String userId, String companyId) {
         String leaderId = "";
-
         String user = baseMapper.selectFinalLeaders(userId, companyId);
         if (userId.equals(user)) {
             return userId;

+ 8 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -577,6 +577,14 @@ public class AccountReportConstants {
             "    \"filed\": \"CASE WHEN  sum(t1.download_completed) != 0 THEN concat(CAST(round(sum(t1.activation) / sum(t1.download_completed)*100,2) AS CHAR) ,'%') else '0.00%' end as activeRate \",\n" +
             "    \"comment\": \"下载完成激活率\"\n" +
             "  },\n" +
+            "  \"eventNewUserPay\": {\n" +
+            "    \"filed\": \"sum(t1.event_new_user_pay) as eventNewUserPay\",\n" +
+            "    \"comment\": \"新增付费人数\"\n" +
+            "  },\n" +
+            "  \"eventNewUserPayCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_new_user_pay) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_new_user_pay),3) end as eventNewUserPayCost \",\n" +
+            "    \"comment\": \"新增付费人数成本\"\n" +
+            "  },\n" +
             "  \"eventNewUserPayRatio\": {\n" +
             "    \"filed\": \"CASE WHEN  sum(t1.activation) != 0 THEN concat(CAST(round(sum(t1.event_pay) / sum(t1.activation)*100,2) AS CHAR) ,'%') else '0.00%' end as eventNewUserPayRatio \",\n" +
             "    \"comment\": \"新增付费人数率\"\n" +