瀏覽代碼

Merge remote-tracking branch 'origin/test' into test

zhouzeyu@c-top.com.cn 3 年之前
父節點
當前提交
2efcbcfc8f
共有 14 個文件被更改,包括 460 次插入100 次删除
  1. 2 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  2. 2 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyInfoMapper.java
  3. 87 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyInfoMapper.xml
  4. 49 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/ImportPolicyController.java
  5. 1 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/pojo/CtopCwjsSlettementReport.java
  6. 105 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/PolicyImportVo.java
  7. 2 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/SettlementReportBytedanceVo.java
  8. 2 2
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/ReportSettlementMapper.java
  9. 2 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/CwjsProfitMapper.xml
  10. 29 12
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/ReportSettlementMapper.xml
  11. 6 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/IReportSettlementService.java
  12. 101 18
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/ReportSettlementServiceImpl.java
  13. 69 65
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/SettlementInfoServiceImpl.java
  14. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

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

@@ -216,6 +216,8 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/estimatePeopleNumber/**", "anon");
         filterChainDefinitionMap.put("/estimatePeopleNumber/**", "anon");
 
 
         filterChainDefinitionMap.put("/exportReportController/**", "anon");
         filterChainDefinitionMap.put("/exportReportController/**", "anon");
+
+        filterChainDefinitionMap.put("/importPolicyController/importPolicyInit", "anon");
         //filterChainDefinitionMap.put("/settLementController/**", "anon");
         //filterChainDefinitionMap.put("/settLementController/**", "anon");
 //        filterChainDefinitionMap.put("/settLementFileController/**", "anon");
 //        filterChainDefinitionMap.put("/settLementFileController/**", "anon");
 
 

+ 2 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyInfoMapper.java

@@ -30,4 +30,6 @@ public interface CwjsPolicyInfoMapper extends BaseMapper<CwjsPolicyInfo> {
     List<JSONObject> getAllSaleByUserId(String userId);
     List<JSONObject> getAllSaleByUserId(String userId);
 
 
     void updatePolicyInfoById(CwjsPolicyInfo policyInfo);
     void updatePolicyInfoById(CwjsPolicyInfo policyInfo);
+
+    CwjsPolicyInfo getPolicyInfo(CwjsPolicyInfo policyInfo);
 }
 }

+ 87 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyInfoMapper.xml

@@ -134,4 +134,91 @@
         where id = #{id}
         where id = #{id}
     </update>
     </update>
 
 
+
+
+
+
+
+
+
+
+    <select id="getPolicyInfo" resultType="org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo">
+        SELECT pi.*
+        FROM
+            ctop_cwjs_policy_info pi
+          where pi.del_flag = 0
+        <if test="companyName != null and companyName != ''">
+            and pi.company_name = #{companyName}
+        </if>
+        <if test="advertiserName != null and advertiserName != ''">
+            and pi.advertiser_name = #{advertiserName}
+        </if>
+        <if test="mediaType != null and mediaType != ''">
+            and pi.media_type = #{mediaType}
+        </if>
+
+        <if test="companySubjectId != null">
+            and pi.company_subject_id = #{companySubjectId}
+        </if>
+
+        <if test="groupAbbreviation != null and groupAbbreviation != ''">
+            and pi.group_abbreviation = #{groupAbbreviation}
+        </if>
+
+        <if test="advancePay != null">
+            and pi.advance_pay = #{advancePay}
+        </if>
+        <if test="accountingPeriod != null and accountingPeriod != ''">
+            and pi.accounting_period = #{accountingPeriod}
+        </if>
+
+        <if test="rebateType != null">
+            and pi.rebate_type = #{rebateType}
+        </if>
+
+        <if test="rebateRate != null and rebateRate != ''">
+            and pi.rebate_rate = #{rebateRate}
+        </if>
+
+        <if test="isDianPay != null">
+            and pi.is_dian_pay = #{isDianPay}
+        </if>
+
+        <if test="dianPayCompanyName != null and dianPayCompanyName != ''">
+            and pi.dian_pay_company_name = #{dianPayCompanyName}
+        </if>
+
+        <if test="dianPayCompanyRebateRate != null and dianPayCompanyRebateRate != ''">
+            and pi.dian_pay_company_rebate_rate = #{dianPayCompanyRebateRate}
+        </if>
+
+        <if test="promotionType != null">
+            and pi.promotion_type = #{promotionType}
+        </if>
+
+        <if test="policyStartDate != null and policyStartDate != ''">
+            and pi.policy_start_date = #{policyStartDate}
+        </if>
+
+        <if test="policyEndDate != null and policyEndDate != ''">
+            and pi.policy_end_date = #{policyEndDate}
+        </if>
+
+        <if test="createUserId != null and createUserId != ''">
+            and pi.create_user_id = #{createUserId}
+        </if>
+        limit 1
+
+
+    </select>
+
+
+
+
+
+
+
+
+
+
 </mapper>
 </mapper>

+ 49 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/ImportPolicyController.java

@@ -0,0 +1,49 @@
+package org.jeecg.ctop.finance.settlement.controller;
+
+import cn.com.ctop.common.module.service.ISysUserService;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.entity.SysUser;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
+import org.jeecg.ctop.finance.settlement.service.IReportSettlementService;
+import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
+import org.jeecg.ctop.finance.settlement.service.serviceImpl.ReportSettlementServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+
+
+/**
+ * 政策信息 导入
+ * Administrator
+ * 2021/7/28
+ **/
+
+@Slf4j
+@RestController
+@RequestMapping("/importPolicyController")
+public class ImportPolicyController {
+
+    @Autowired
+    private ReportSettlementServiceImpl reportSettlementService;
+    @Autowired
+    private ISysUserService userService;
+
+    @ApiOperation(value = "财务结算-导入政策数据", notes = "财务结算-导入政策数据")
+    @PostMapping(value = "/importPolicyInit")
+    public Result importPolicyInit(@RequestParam("file") MultipartFile files) throws Exception{
+
+        return reportSettlementService.importPolicyInit(files);
+    }
+
+
+
+
+
+
+}

+ 1 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/pojo/CtopCwjsSlettementReport.java

@@ -20,6 +20,7 @@ public class CtopCwjsSlettementReport implements Serializable {
     private Long id;
     private Long id;
     private Integer policyId;
     private Integer policyId;
     private String advertiserName;
     private String advertiserName;
+    private String companyName;
     private String productName;
     private String productName;
     private String policyDate;
     private String policyDate;
     private Integer mediaType;
     private Integer mediaType;

+ 105 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/PolicyImportVo.java

@@ -0,0 +1,105 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ *
+ * @description: 政策 上传 数据 excel
+ * @return:
+ * @author: zianY
+ */
+@Data
+public class PolicyImportVo implements Serializable {
+    /**公司名称*/
+    @Excel(name = "公司名称")
+    private String companyName;
+    /**广告主id*/
+    @Excel(name = "广告主")
+    private String advertiserName;
+
+    @Excel(name = "产品名称(多个产品名称使用英文'-'分割)")
+    private String policyProductName;
+
+
+    /**媒体类型*/
+    @Excel(name = "媒体(1-头条 2-快手)")
+    private Integer mediaType;
+
+    @Excel(name = "销售人员名称")
+    private String createUserName;
+    /**区域 华北,华南,华东*/
+    @Excel(name = "区域(华北,石家庄,华南,骄阳,杭州,华东)")
+    private String areaInfo;
+
+    /**我司主体*/
+    @Excel(name = "我司主体(北京汇创思拓数字科技有限公司,广州汇创思拓数字科技有限公司,骄阳,上海贯月,舟山有梗)")
+    private String companySubjectIdStr;
+
+
+    /**运营方式: 0:自运营  1:代运营*/
+    @Excel(name = "运营方式(0:自运营  1:代运营)")
+    private Integer promotionType;
+
+    /**集团简称*/
+    @Excel(name = "集团简称")
+    private String groupAbbreviation;
+    /**状态 0:待审核 1:审核中 2:审核通过3:审核拒绝*/
+
+    @ApiModelProperty(value = "状态 0:待审核 1:审核中 2:审核通过3:审核拒绝")
+    private Integer approvedStatus;
+
+    /**是否预付:0:否  1:是 */
+    @Excel(name = "是否预付(0:否  1:是)")
+    private Integer advancePay;
+
+    /**返点类型:0:返现  1:返货   2:返现+返货*/
+    @Excel(name = "返点类型(0:返现  1:返货   2:返现+返货)")
+    private Integer rebateType;
+
+    /**返点比例*/
+    @Excel(name = "返点比列(保留2位小数,不需要带'%')")
+    private java.math.BigDecimal rebateRate;
+
+    /**账期*/
+    @Excel(name = "账期")
+    private String accountingPeriod;
+
+    /**是否垫付:0:否  1:是 */
+    @Excel(name = "是否第三方垫付(0:否  1:是)")
+    private Integer isDianPay;
+    /**垫付公司名称*/
+    @Excel(name = "垫付公司")
+    private String dianPayCompanyName;
+    /**垫付公司返点比例*/
+    @Excel(name = "垫付返点(保留4位小数)")
+    private java.math.BigDecimal dianPayCompanyRebateRate;
+
+    /**政策开始时间*/
+    @Excel(name = "政策开始时间(年-月-日)")
+    private String policyStartDate;
+    /**政策结束时间*/
+    @Excel(name = "政策结束时间(年-月-日)")
+    private String policyEndDate;
+    /**备注:如果没人填的话记录被拒次数*/
+    @Excel(name = "备注")
+    private String remarks;
+
+
+    @ApiModelProperty(value = "删除状态(0,正常,1已删除)")
+    private Integer delFlag;
+    /**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**更新时间*/
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+
+}

+ 2 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/SettlementReportBytedanceVo.java

@@ -50,6 +50,8 @@ public class SettlementReportBytedanceVo implements Serializable {
 
 
 
 
     private String accountName;
     private String accountName;
+    private String agentId;
+    private String agentName;
 
 
 
 
 
 

+ 2 - 2
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/ReportSettlementMapper.java

@@ -79,9 +79,9 @@ public interface ReportSettlementMapper {
      * @param
      * @param
      * @return
      * @return
      */
      */
-    List<Map<String,Object>> getProfitBytedance(@Param("productName") String productName,@Param("mediaType") String mediaType,@Param("startTime")String startTime,@Param("endTime")String endTime);
+    List<Map<String,Object>> getProfitBytedance(@Param("advertiserName") String advertiserName,@Param("productName") String productName,@Param("saleId") String saleId,@Param("mediaType") String mediaType,@Param("startTime")String startTime,@Param("endTime")String endTime);
 
 
-    Map<String,Object> getProfitRebate(@Param("productName") String productName,@Param("startTime")String startTime,@Param("endTime")String endTime);
+    Map<String,Object> getProfitRebate(@Param("advertiserName") String advertiserName,@Param("productName") String productName,@Param("saleId") String saleId,@Param("mediaType") String mediaType,@Param("startTime")String startTime,@Param("endTime")String endTime);
 
 
     Map<String,Object> getProfitReportSale(String accountId);
     Map<String,Object> getProfitReportSale(String accountId);
 
 

+ 2 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/CwjsProfitMapper.xml

@@ -6,6 +6,7 @@
     <insert id="replaceCwjsSlettementProfit">
     <insert id="replaceCwjsSlettementProfit">
             replace into ctop_cwjs_slettement_report(
             replace into ctop_cwjs_slettement_report(
             advertiser_name,
             advertiser_name,
+            company_name,
             product_name,
             product_name,
             policy_date,
             policy_date,
             create_user_id,
             create_user_id,
@@ -15,6 +16,7 @@
             values
             values
             <foreach collection="list" item="l" separator=",">
             <foreach collection="list" item="l" separator=",">
                 (#{l.advertiserName},
                 (#{l.advertiserName},
+                #{l.companyName},
                 #{l.productName},
                 #{l.productName},
                 #{l.policyDate},
                 #{l.policyDate},
                 #{l.createUserId},
                 #{l.createUserId},

+ 29 - 12
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/ReportSettlementMapper.xml

@@ -7,7 +7,27 @@
         select t.*,c.auth_name as accountName from (select id,
         select t.*,c.auth_name as accountName from (select id,
         advertiser_id,
         advertiser_id,
         date,DATE_FORMAT(date,'%Y-%m') as uploadYears,
         date,DATE_FORMAT(date,'%Y-%m') as uploadYears,
-        balance,cash_cost,cost,frozen,income,reward_cost,shared_wallet_cost,transfer_in,transfer_out,create_time
+        balance,cash_cost,cost,frozen,income,reward_cost,shared_wallet_cost,transfer_in,transfer_out,create_time,
+        (
+        SELECT
+        ag.agent_id
+        from
+        ctop_cwjs_agent_info ag
+        LEFT JOIN ctop_agent_account ac on ag.agent_id = ac.agent_id
+        where ac.state = 0
+        and ag.`status` = 0
+        and ag.enabled = 0
+        and ac.account_id = #{accountId}) as agentId,
+        (
+        SELECT
+        ag.name
+        from
+        ctop_cwjs_agent_info ag
+        LEFT JOIN ctop_agent_account ac on ag.agent_id = ac.agent_id
+        where ac.state = 0
+        and ag.`status` = 0
+        and ag.enabled = 0
+        and ac.account_id = #{accountId}) as agentName
          from
          from
         ctop_account_transaction_day
         ctop_account_transaction_day
         where cost >0
         where cost >0
@@ -316,7 +336,9 @@
         <if test="mediaType !=null and mediaType != ''">
         <if test="mediaType !=null and mediaType != ''">
             AND cp.media_type = #{mediaType}
             AND cp.media_type = #{mediaType}
         </if>
         </if>
+            AND r.advertiser_name = #{advertiserName}
             AND r.product_name = #{productName}
             AND r.product_name = #{productName}
+            AND r.create_user_id = #{saleId}
         <if test="startTime !=null and startTime != ''">
         <if test="startTime !=null and startTime != ''">
             AND  r.policy_date &gt;= #{startTime}
             AND  r.policy_date &gt;= #{startTime}
         </if>
         </if>
@@ -339,9 +361,12 @@
         LEFT JOIN ctop_cwjs_policy_info p ON r.policy_id = p.id
         LEFT JOIN ctop_cwjs_policy_info p ON r.policy_id = p.id
         WHERE
         WHERE
         p.del_flag = 0
         p.del_flag = 0
-        <if test="productName !=null and productName != ''">
-            AND r.product_name = #{productName}
+        <if test="mediaType !=null and mediaType != ''">
+            AND p.media_type = #{mediaType}
         </if>
         </if>
+        AND r.advertiser_name = #{advertiserName}
+        AND r.product_name = #{productName}
+        AND r.create_user_id = #{saleId}
         <if test="startTime !=null and startTime != ''">
         <if test="startTime !=null and startTime != ''">
             AND  r.policy_date &gt;= #{startTime}
             AND  r.policy_date &gt;= #{startTime}
         </if>
         </if>
@@ -355,16 +380,8 @@
 
 
     <!-- 查询 利润表  销售人员姓名 -->
     <!-- 查询 利润表  销售人员姓名 -->
     <select id="getProfitReportSale" resultType="java.util.LinkedHashMap">
     <select id="getProfitReportSale" resultType="java.util.LinkedHashMap">
-       <!-- SELECT f.create_user_id,u.realname as saleName
-        from ctop_cwjs_settlement_info f
-        LEFT  JOIN sys_user u on u.id = f.create_user_id
-        where f.del_flag = 0
-        <if test="accountId !=null and accountId != ''">
-            AND f.account_id = #{accountId}
-        </if>
-        limit 1-->
         ( SELECT
         ( SELECT
-        p.sale_id,
+        p.sale_id AS saleId,
         y.realname AS saleName
         y.realname AS saleName
         FROM
         FROM
         ctop_user_allocation u
         ctop_user_allocation u

+ 6 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/IReportSettlementService.java

@@ -6,6 +6,7 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
 import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo;
+import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 import java.util.List;
@@ -29,4 +30,9 @@ public interface IReportSettlementService {
     void cwjsPRofit(CwjsPolicyInfo cwjsPolicyInfo);
     void cwjsPRofit(CwjsPolicyInfo cwjsPolicyInfo);
 
 
     List<String> getAccountId(SettlementFileParamsVo paramsVo,SysUser user);
     List<String> getAccountId(SettlementFileParamsVo paramsVo,SysUser user);
+
+
+
+    Result importPolicyInit(MultipartFile file);
+
 }
 }

+ 101 - 18
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/ReportSettlementServiceImpl.java

@@ -1,13 +1,13 @@
 package org.jeecg.ctop.finance.settlement.service.serviceImpl;
 package org.jeecg.ctop.finance.settlement.service.serviceImpl;
 
 
 import cn.afterturn.easypoi.excel.ExcelExportUtil;
 import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.ExcelImportUtil;
 import cn.afterturn.easypoi.excel.entity.ExportParams;
 import cn.afterturn.easypoi.excel.entity.ExportParams;
+import cn.afterturn.easypoi.excel.entity.ImportParams;
+import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
 import cn.com.ctop.common.module.entity.SysLog;
 import cn.com.ctop.common.module.entity.SysLog;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
-import cn.com.ctop.common.module.mapper.MailLogMapper;
-import cn.com.ctop.common.module.mapper.SysLogMapper;
-import cn.com.ctop.common.module.mapper.SysRoleMapper;
-import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+import cn.com.ctop.common.module.mapper.*;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
 import cn.com.ctop.common.module.utils.ImageUtils;
 import cn.com.ctop.common.module.utils.ImageUtils;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -24,8 +24,11 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject;
 import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
 import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
 import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
 import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
+import org.jeecg.ctop.finance.policy.mapper.CwjsCompanySubjectMapper;
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyInfoMapper;
 import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyProductMapper;
 import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyProductMapper;
 import org.jeecg.ctop.finance.policy.utils.Check;
 import org.jeecg.ctop.finance.policy.utils.Check;
 import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSettlementInfo;
 import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSettlementInfo;
@@ -41,6 +44,7 @@ import org.jeecg.modules.ctop.service.IMaterialReportOverViewService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.imageio.ImageIO;
 import javax.imageio.ImageIO;
@@ -200,8 +204,8 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     row.createCell(0).setCellValue(vo.getDate());
                     row.createCell(0).setCellValue(vo.getDate());
                     row.createCell(1).setCellValue(vo.getAccountName());
                     row.createCell(1).setCellValue(vo.getAccountName());
                     row.createCell(2).setCellValue(vo.getAdvertiserId());
                     row.createCell(2).setCellValue(vo.getAdvertiserId());
-                    row.createCell(3).setCellValue("北京汇创思拓数字科技有限公司-ka");
-                    row.createCell(4).setCellValue("73970348172");
+                    row.createCell(3).setCellValue(vo.getAgentName());
+                    row.createCell(4).setCellValue(vo.getAgentId());
                     row.createCell(5).setCellValue(vo.getCost());
                     row.createCell(5).setCellValue(vo.getCost());
                     row.createCell(6).setCellValue(vo.getCashCost());
                     row.createCell(6).setCellValue(vo.getCashCost());
                     row.createCell(7).setCellValue(vo.getRewardCost());
                     row.createCell(7).setCellValue(vo.getRewardCost());
@@ -563,7 +567,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                 List<String> policyDaysList = new ArrayList<>();
                 List<String> policyDaysList = new ArrayList<>();
                 if (!Check.isNull(map.get("productName"))){
                 if (!Check.isNull(map.get("productName"))){
                     //查询 头条利润表  返点类型和比列
                     //查询 头条利润表  返点类型和比列
-                    List<Map<String,Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("productName")+"","1",paramsVo.getStartTime(),paramsVo.getEndTime());
+                    List<Map<String,Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName")+"",slaeMap.get("saleId")+"","1",paramsVo.getStartTime(),paramsVo.getEndTime());
                     List listPolicyTIme = new ArrayList();
                     List listPolicyTIme = new ArrayList();
                     for (Map<String, Object> rate : rateMap) {
                     for (Map<String, Object> rate : rateMap) {
                         listPolicyTIme.add(rate.get("policyStartDate"));
                         listPolicyTIme.add(rate.get("policyStartDate"));
@@ -585,7 +589,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     for (Map<String, String> stringMap : arrayList) {
                     for (Map<String, String> stringMap : arrayList) {
                         ProfitReportBytedanceVo vo = new ProfitReportBytedanceVo();
                         ProfitReportBytedanceVo vo = new ProfitReportBytedanceVo();
                         //使用政策 返点类型和比例
                         //使用政策 返点类型和比例
-                        Map<String,Object>  policyRateMap = reportSettlementMapper.getProfitRebate(map.get("productName")+"",stringMap.get("startDate"),stringMap.get("endDate"));
+                        Map<String,Object>  policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName")+"",map.get("productName")+"",slaeMap.get("saleId")+"","1",stringMap.get("startDate"),stringMap.get("endDate"));
                         if (!Check.isNull(policyRateMap)){
                         if (!Check.isNull(policyRateMap)){
                             if(Integer.valueOf(policyRateMap.get("rebateType").toString())== 0){
                             if(Integer.valueOf(policyRateMap.get("rebateType").toString())== 0){
                                 vo.setRebateType("返现");//返点类型
                                 vo.setRebateType("返现");//返点类型
@@ -721,7 +725,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                 List<String> policyDaysList = new ArrayList<>();
                 List<String> policyDaysList = new ArrayList<>();
                 if (!Check.isNull(map.get("productName"))) {
                 if (!Check.isNull(map.get("productName"))) {
                     //查询 快手利润表  返点类型和比列
                     //查询 快手利润表  返点类型和比列
-                    List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("productName") + "", "2", paramsVo.getStartTime(), paramsVo.getEndTime());
+                    List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName") + "", slaeMap.get("saleId")+"","2", paramsVo.getStartTime(), paramsVo.getEndTime());
                     List listPolicyTIme = new ArrayList();
                     List listPolicyTIme = new ArrayList();
                     for (Map<String, Object> rate : rateMap) {
                     for (Map<String, Object> rate : rateMap) {
                         listPolicyTIme.add(rate.get("policyStartDate"));
                         listPolicyTIme.add(rate.get("policyStartDate"));
@@ -745,7 +749,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     for (Map<String, String> stringMap : arrayList) {
                     for (Map<String, String> stringMap : arrayList) {
                         ProfitReportKuaiShouVo vo = new ProfitReportKuaiShouVo();
                         ProfitReportKuaiShouVo vo = new ProfitReportKuaiShouVo();
                         //使用政策 返点类型和比例
                         //使用政策 返点类型和比例
-                        Map<String, Object> policyRateMap = reportSettlementMapper.getProfitRebate(map.get("productName") + "", stringMap.get("startDate"), stringMap.get("endDate"));
+                        Map<String, Object> policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName")+"",map.get("productName") + "", slaeMap.get("saleId")+"","2",stringMap.get("startDate"), stringMap.get("endDate"));
                         if (!Check.isNull(policyRateMap)) {
                         if (!Check.isNull(policyRateMap)) {
                             if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 0) {
                             if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 0) {
                                 vo.setRebateType("返现");//返点类型
                                 vo.setRebateType("返现");//返点类型
@@ -796,11 +800,9 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     vo.setTime(!Check.isNull(vo.getRebateType()) ? stringMap.get("startDate") + "----" + stringMap.get("endDate") : "");
                     vo.setTime(!Check.isNull(vo.getRebateType()) ? stringMap.get("startDate") + "----" + stringMap.get("endDate") : "");
                     resultList.add(vo);
                     resultList.add(vo);
                 }
                 }
-
             }
             }
 
 
             Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("快手利润单", "快手利润单"), ProfitReportKuaiShouVo.class, resultList);
             Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("快手利润单", "快手利润单"), ProfitReportKuaiShouVo.class, resultList);
-
             try {
             try {
                 response.setCharacterEncoding("UTF-8");
                 response.setCharacterEncoding("UTF-8");
                 response.setHeader("content-Type", "application/vnd.ms-excel");
                 response.setHeader("content-Type", "application/vnd.ms-excel");
@@ -809,7 +811,6 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             } catch (IOException e) {
             } catch (IOException e) {
                 throw new RuntimeException(e);
                 throw new RuntimeException(e);
             }
             }
-
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
             return Result.errorMsg(e.getMessage());
             return Result.errorMsg(e.getMessage());
@@ -834,7 +835,6 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
         int accountNum = 0;
         int accountNum = 0;
         String productInfo = null;
         String productInfo = null;
         String message =  "{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
         String message =  "{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
-
         //查询所有 运营绑定的账户
         //查询所有 运营绑定的账户
         List<Map<String,Object>> userList = reportSettlementMapper.getAccountOperateUserId();
         List<Map<String,Object>> userList = reportSettlementMapper.getAccountOperateUserId();
         for (Map<String, Object> userMap : userList) {
         for (Map<String, Object> userMap : userList) {
@@ -849,7 +849,6 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             productNum = product.size();
             productNum = product.size();
             accountNum = productList.size();
             accountNum = productList.size();
             productInfo = StringUtils.join(product.toArray(),"、");
             productInfo = StringUtils.join(product.toArray(),"、");
-
             //发送微信通知
             //发送微信通知
             JSONObject jsonObject =  mailLogMapper.getWChatIdByUserId(userId);
             JSONObject jsonObject =  mailLogMapper.getWChatIdByUserId(userId);
             String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
             String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
@@ -881,7 +880,6 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             productNum = product.size();
             productNum = product.size();
             accountNum = productList.size();
             accountNum = productList.size();
             productInfo = StringUtils.join(product.toArray(),"、");
             productInfo = StringUtils.join(product.toArray(),"、");
-
             //发送微信通知
             //发送微信通知
             JSONObject jsonObject =  mailLogMapper.getWChatIdByUserId(Check.isNull(userId) ? "f990f815ecef43fab9cbe1bb22bb6d63" : userId);
             JSONObject jsonObject =  mailLogMapper.getWChatIdByUserId(Check.isNull(userId) ? "f990f815ecef43fab9cbe1bb22bb6d63" : userId);
             String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
             String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
@@ -893,10 +891,8 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
     @Resource
     @Resource
     private CwjsPolicyProductMapper cwjsPolicyProductMapper;
     private CwjsPolicyProductMapper cwjsPolicyProductMapper;
 
 
-
     @Override
     @Override
     public void cwjsPRofit(CwjsPolicyInfo cwjsPolicyInfo) {
     public void cwjsPRofit(CwjsPolicyInfo cwjsPolicyInfo) {
-
         // 获取两个日期之间 所有的 时间 年-月-日
         // 获取两个日期之间 所有的 时间 年-月-日
         List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(cwjsPolicyInfo.getPolicyStartDate(),cwjsPolicyInfo.getPolicyEndDate());
         List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(cwjsPolicyInfo.getPolicyStartDate(),cwjsPolicyInfo.getPolicyEndDate());
         //查看 政策下的产品
         //查看 政策下的产品
@@ -909,6 +905,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                         CtopCwjsSlettementReport report = new CtopCwjsSlettementReport();
                         CtopCwjsSlettementReport report = new CtopCwjsSlettementReport();
                         report.setPolicyId(cwjsPolicyInfo.getId());
                         report.setPolicyId(cwjsPolicyInfo.getId());
                         report.setAdvertiserName(cwjsPolicyInfo.getAdvertiserName());
                         report.setAdvertiserName(cwjsPolicyInfo.getAdvertiserName());
+                        report.setCompanyName(cwjsPolicyInfo.getCompanyName());
                         report.setProductName(product.getPolicyProductName());
                         report.setProductName(product.getPolicyProductName());
                         report.setMediaType(cwjsPolicyInfo.getMediaType());
                         report.setMediaType(cwjsPolicyInfo.getMediaType());
                         report.setCreateUserId(cwjsPolicyInfo.getCreateUserId());
                         report.setCreateUserId(cwjsPolicyInfo.getCreateUserId());
@@ -920,4 +917,90 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             }
             }
         }
         }
     }
     }
+
+    @Resource
+    private CwjsPolicyInfoMapper cwjsPolicyInfoMapper;
+    @Resource
+    private SysUserMapper sysUserMapper;
+    @Resource
+    private CwjsCompanySubjectMapper cwjsCompanySubjectMapper;
+
+    @Override
+    public Result importPolicyInit(MultipartFile file) {
+        try {
+            //LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            //settlementInfo.setCreateUserId(user.getId());
+            //settlementInfo.setCreateUserId("b161b7d9793942f980dbfe8c931cd1b0");
+            ImportParams importParams = new ImportParams();
+            //表头行数
+            importParams.setHeadRows(1);
+
+            ExcelImportResult<PolicyImportVo> importResult = ExcelImportUtil.importExcelMore(file.getInputStream(), PolicyImportVo.class, importParams);
+            if (importResult.getList().size() < 1) {
+                return Result.error("读取Excel失败,数据不能为空,请重新检查数据并导入");
+            }
+
+            for (PolicyImportVo importVo : importResult.getList()) {
+                if (cn.com.ctop.common.module.utils.Check.isNull(importVo.getCompanyName())){
+                    continue;
+                }
+                if (cn.com.ctop.common.module.utils.Check.isNull(importVo.getPolicyProductName())){
+                    continue;
+                }
+                List<String> productNameList = Arrays.asList(importVo.getPolicyProductName().split("-"));
+
+                CwjsPolicyInfo cwjsPolicyInfo = new CwjsPolicyInfo();
+                BeanUtils.copyProperties(importVo, cwjsPolicyInfo);
+
+                // 销售 - 创建人
+                QueryWrapper<SysUser> sysUserQw = new QueryWrapper<>();
+                sysUserQw.eq("realname", importVo.getCreateUserName());
+                sysUserQw.last("limit 1");
+                SysUser user = sysUserMapper.selectOne(sysUserQw);
+                cwjsPolicyInfo.setCreateUserId(user.getId());
+
+                //公司主体
+                QueryWrapper<CwjsCompanySubject> companySubQw = new QueryWrapper<>();
+                companySubQw.eq("company_subject_name", importVo.getCompanySubjectIdStr());
+                companySubQw.eq("area_info", importVo.getAreaInfo());
+                companySubQw.last("limit 1");
+                CwjsCompanySubject companySubject = cwjsCompanySubjectMapper.selectOne(companySubQw);
+                cwjsPolicyInfo.setCompanySubjectId(companySubject.getId());
+
+                cwjsPolicyInfo.setApprovedStatus(3);
+
+                CwjsPolicyInfo policy = cwjsPolicyInfoMapper.getPolicyInfo(cwjsPolicyInfo);
+
+                if (cn.com.ctop.common.module.utils.Check.isNull(policy)){
+                    cwjsPolicyInfoMapper.insert(cwjsPolicyInfo);
+                    policy = cwjsPolicyInfoMapper.getPolicyInfo(cwjsPolicyInfo);
+                }
+
+                //查看 政策下的产品
+                List<CwjsPolicyProduct> productList = cwjsPolicyProductMapper.queryProductsByPolicyId(policy.getId());
+                List proList = productList.stream().map(CwjsPolicyProduct:: getPolicyProductName).collect(Collectors.toList());
+                for (String str : productNameList) {
+                    if (!proList.contains(str)){
+                        //新增产品
+                        CwjsPolicyProduct policyProduct = new CwjsPolicyProduct();
+                        policyProduct.setPolicyId(policy.getId());
+                        policyProduct.setPolicyProductName(str);
+                        policyProduct.setCreateUserId(cwjsPolicyInfo.getCreateUserId());
+                        policyProduct.setDelFlag(0);
+                        cwjsPolicyProductMapper.insert(policyProduct);
+                    }
+                }
+                this.cwjsPRofit(policy);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("政策数据上传失败,请使用正确的模板导入!");
+        }
+        return Result.successMsg("政策数据上传成功", null);
+    }
+
+
+
+
+
 }
 }

+ 69 - 65
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/SettlementInfoServiceImpl.java

@@ -8,6 +8,7 @@ import cn.com.ctop.alarm.modules.service.impl.RuleAccountTemplateServiceImpl;
 import cn.com.ctop.common.module.entity.SysLog;
 import cn.com.ctop.common.module.entity.SysLog;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.SysLogMapper;
 import cn.com.ctop.common.module.mapper.SysLogMapper;
+import cn.com.ctop.common.module.mapper.SysUserMapper;
 import cn.com.ctop.common.module.service.impl.UserAllocationServiceImpl;
 import cn.com.ctop.common.module.service.impl.UserAllocationServiceImpl;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.Check;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -19,9 +20,18 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
+import org.jeecg.ctop.finance.policy.mapper.CwjsCompanySubjectMapper;
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyInfoMapper;
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyProductMapper;
+import org.jeecg.ctop.finance.policy.service.impl.CwjsPolicyProductServiceImpl;
 import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSettlementInfo;
 import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSettlementInfo;
 import org.jeecg.ctop.finance.settlement.entity.vo.AccountImportVo;
 import org.jeecg.ctop.finance.settlement.entity.vo.AccountImportVo;
+import org.jeecg.ctop.finance.settlement.entity.vo.PolicyImportVo;
 import org.jeecg.ctop.finance.settlement.mapper.SettlementInfoMapper;
 import org.jeecg.ctop.finance.settlement.mapper.SettlementInfoMapper;
 import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
 import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.entity.ProjectMember;
@@ -38,6 +48,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.*;
 import java.util.*;
+import java.util.stream.Collectors;
 
 
 
 
 @Slf4j
 @Slf4j
@@ -53,12 +64,10 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
 
 
 
 
     /**
     /**
-     *
-     * @description: 查询 财务结算-账户列表
-     *
      * @param settlementInfo
      * @param settlementInfo
      * @param pageNo
      * @param pageNo
      * @param pageSize
      * @param pageSize
+     * @description: 查询 财务结算-账户列表
      * @return: org.jeecg.common.api.vo.Result
      * @return: org.jeecg.common.api.vo.Result
      * @author: zianY
      * @author: zianY
      */
      */
@@ -73,26 +82,27 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
 
 
     @Autowired
     @Autowired
     private UserAllocationServiceImpl userAllocationService;
     private UserAllocationServiceImpl userAllocationService;
+
     /**
     /**
-     * @description: 财务结算-修改账户状态
      * @param id
      * @param id
      * @param status 账户状态 0-开 1-关
      * @param status 账户状态 0-开 1-关
+     * @description: 财务结算-修改账户状态
      * @return: org.jeecg.common.api.vo.Result
      * @return: org.jeecg.common.api.vo.Result
      * @author: zianY
      * @author: zianY
      */
      */
     @Override
     @Override
     public Result updSettlementStatusById(Long id, Integer status) {
     public Result updSettlementStatusById(Long id, Integer status) {
         // 修改状态
         // 修改状态
-        settlementInfoMapper.updSettlementStatusById(id,status);
+        settlementInfoMapper.updSettlementStatusById(id, status);
 
 
         //同步 状态
         //同步 状态
-       CtopCwjsSettlementInfo settlementInfo =  settlementInfoMapper.selectById(id);
+        CtopCwjsSettlementInfo settlementInfo = settlementInfoMapper.selectById(id);
 
 
         UserAllocation userAllocation = userAllocationService.getByAccountId(new Long(settlementInfo.getAccountId()));
         UserAllocation userAllocation = userAllocationService.getByAccountId(new Long(settlementInfo.getAccountId()));
-        if (!Check.isNull(userAllocation)){
+        if (!Check.isNull(userAllocation)) {
             userAllocation.setAccountStatus(status);
             userAllocation.setAccountStatus(status);
             userAllocationService.editUserAlloCation(userAllocation);
             userAllocationService.editUserAlloCation(userAllocation);
-        }else{
+        } else {
             LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
             LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
             SysLog sysLog = new SysLog();
             SysLog sysLog = new SysLog();
             sysLog.setLogType(2);
             sysLog.setLogType(2);
@@ -155,10 +165,8 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
     */
     */
 
 
     /**
     /**
-     *
-     * @description: 删除
-     *
      * @param id
      * @param id
+     * @description: 删除
      * @return: org.jeecg.common.api.vo.Result
      * @return: org.jeecg.common.api.vo.Result
      * @author: zianY
      * @author: zianY
      */
      */
@@ -170,11 +178,9 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
 
 
 
 
     /**
     /**
-     *
-     * @description:
-     *
      * @param settlementInfo
      * @param settlementInfo
      * @param file
      * @param file
+     * @description:
      * @return: org.jeecg.common.api.vo.Result
      * @return: org.jeecg.common.api.vo.Result
      * @author: zianY
      * @author: zianY
      * @time: 2021/7/30 16:26
      * @time: 2021/7/30 16:26
@@ -182,69 +188,67 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
     @Override
     @Override
     public Result settlementAccountImport(CtopCwjsSettlementInfo settlementInfo, MultipartFile file) {
     public Result settlementAccountImport(CtopCwjsSettlementInfo settlementInfo, MultipartFile file) {
 
 
-            try {
-                //LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-                //settlementInfo.setCreateUserId(user.getId());
-                //settlementInfo.setCreateUserId("b161b7d9793942f980dbfe8c931cd1b0");
-                ImportParams importParams = new ImportParams();
-                //表格标题行数
-                importParams.setTitleRows(1);
-                //表头行数
-                importParams.setHeadRows(1);
-
-                //校验表头 头条
-                if (StringUtils.equals("1",String.valueOf(settlementInfo.getMediaId()))){
-                    importParams.setImportFields(new String[]{"账户ID","账户名称"});
-                    //快手
-                }else if (StringUtils.equals("2",String.valueOf(settlementInfo.getMediaId()))){
-                    importParams.setImportFields(new String[]{"快手ID","账户ID","账户名称"});
+        try {
+            //LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            //settlementInfo.setCreateUserId(user.getId());
+            //settlementInfo.setCreateUserId("b161b7d9793942f980dbfe8c931cd1b0");
+            ImportParams importParams = new ImportParams();
+            //表格标题行数
+            importParams.setTitleRows(1);
+            //表头行数
+            importParams.setHeadRows(1);
+
+            //校验表头 头条
+            if (StringUtils.equals("1", String.valueOf(settlementInfo.getMediaId()))) {
+                importParams.setImportFields(new String[]{"账户ID", "账户名称"});
+                //快手
+            } else if (StringUtils.equals("2", String.valueOf(settlementInfo.getMediaId()))) {
+                importParams.setImportFields(new String[]{"快手ID", "账户ID", "账户名称"});
+            }
+            //校验excel的标题列顺序
+            importParams.setNeedCheckOrder(true);
+            ExcelImportResult<AccountImportVo> importResult = ExcelImportUtil.importExcelMore(file.getInputStream(), AccountImportVo.class, importParams);
+            if (importResult.getList().size() < 1) {
+                return Result.error("读取Excel失败,数据不能为空,请重新检查数据并导入");
+            }
+            for (AccountImportVo importVo : importResult.getList()) {
+                if (Check.isNull(importVo.getAccountId())) {
+                    continue;
                 }
                 }
-                //校验excel的标题列顺序
-                importParams.setNeedCheckOrder(true);
-                ExcelImportResult<AccountImportVo> importResult = ExcelImportUtil.importExcelMore(file.getInputStream(), AccountImportVo.class,importParams);
-                if (importResult.getList().size() < 1){
-                    return Result.error("读取Excel失败,数据不能为空,请重新检查数据并导入");
+                //查询 账户 状态
+                UserAllocation userAllocation = userAllocationService.getByAccountId(new Long(importVo.getAccountId()));
+                if (Check.isNull(userAllocation)) {
+                    settlementInfo.setStatus(0);
+                } else {
+                    settlementInfo.setStatus(userAllocation.getAccountStatus());
                 }
                 }
-                for (AccountImportVo importVo : importResult.getList()) {
-                    if (Check.isNull(importVo.getAccountId())){
-                        continue;
-                    }
-                    //查询 账户 状态
-                    UserAllocation userAllocation = userAllocationService.getByAccountId(new Long(importVo.getAccountId()));
-                    if (Check.isNull(userAllocation)){
-                        settlementInfo.setStatus(0);
-                    }else {
-                        settlementInfo.setStatus(userAllocation.getAccountStatus());
-                    }
-                    BeanUtils.copyProperties(importVo,settlementInfo);
-                    //根据账户id 查看
-                    CtopCwjsSettlementInfo cwjs = settlementInfoMapper.getSettlementByAccountId(importVo.getAccountId());
-                    if (Check.isNull(cwjs)){
-                       // BeanUtils.copyProperties(importVo,settlementInfo);
-                        settlementInfoMapper.insert(settlementInfo);
-                    }else {
-                        settlementInfo.setId(cwjs.getId());
-                        settlementInfoMapper.updateById(settlementInfo);
-                    }
+                BeanUtils.copyProperties(importVo, settlementInfo);
+                //根据账户id 查看
+                CtopCwjsSettlementInfo cwjs = settlementInfoMapper.getSettlementByAccountId(importVo.getAccountId());
+                if (Check.isNull(cwjs)) {
+                    // BeanUtils.copyProperties(importVo,settlementInfo);
+                    settlementInfoMapper.insert(settlementInfo);
+                } else {
+                    settlementInfo.setId(cwjs.getId());
+                    settlementInfoMapper.updateById(settlementInfo);
                 }
                 }
-            }catch (Exception e){
-                e.printStackTrace();
-                return Result.error("账户数据上传失败,请使用正确的模板导入!");
             }
             }
-            return Result.successMsg("账户数据上传成功",null);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("账户数据上传失败,请使用正确的模板导入!");
         }
         }
+        return Result.successMsg("账户数据上传成功", null);
+    }
 
 
 
 
     /**
     /**
-     *
-     * @description: 查询多个用户信息
-     *
      * @param userIds
      * @param userIds
-     * @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
+     * @description: 查询多个用户信息
+     * @return: java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
      * @author: zianY
      * @author: zianY
      */
      */
     @Override
     @Override
-    public List<Map<String,Object>> getUserByIds(Set userIds) {
+    public List<Map<String, Object>> getUserByIds(Set userIds) {
         return settlementInfoMapper.getUserByIds(userIds);
         return settlementInfoMapper.getUserByIds(userIds);
     }
     }
 
 

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

@@ -1362,12 +1362,12 @@ public class TestController {
         }
         }
         List<CtopOauthToken> tokens = tokenService.getByProjectId(458L);    //淘特项目
         List<CtopOauthToken> tokens = tokenService.getByProjectId(458L);    //淘特项目
         for (CtopOauthToken token : tokens) {
         for (CtopOauthToken token : tokens) {
-            Date startDate = DateUtils.getNowDate();
+            Date startDate = DateUtils.addDay(DateUtils.getNowDate(), -1);
             if(startDate.after(token.getAccessTokenExpiresIn())){   //过期跳过
             if(startDate.after(token.getAccessTokenExpiresIn())){   //过期跳过
                 continue;
                 continue;
             }
             }
-            Date enDate = DateUtils.addDay(startDate, 30);
-            List<AiKuaishouUnitLevelOperationRecord> planIdsAndUnitIds = kuaishouUnitLevelOperationRecordMapper.selectAllByAccountIdAndDate(token.getAccountId(), startDate, enDate);
+            Date enDate = DateUtils.addDay(startDate, -30);
+            List<AiKuaishouUnitLevelOperationRecord> planIdsAndUnitIds = kuaishouUnitLevelOperationRecordMapper.selectAllByAccountIdAndDate(token.getAccountId(), enDate, startDate);
             if(Check.isNull(planIdsAndUnitIds)){
             if(Check.isNull(planIdsAndUnitIds)){
                 continue;
                 continue;
             }
             }