Przeglądaj źródła

Merge branch 'test'

# Conflicts:
#	jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserCompanyServiceImpl.java
#	jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/KuaishouAccountCleanTemplateMapper.java
#	jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/agent/service/impl/AgentManagementServiceImpl.java
songyh 3 lat temu
rodzic
commit
08028b9308
100 zmienionych plików z 7020 dodań i 144 usunięć
  1. 0 21
      jeecg-boot-base/jeecg-boot-base-api/jeecg-system-cloud-api/pom.xml
  2. 0 75
      jeecg-boot-base/jeecg-boot-base-api/jeecg-system-cloud-api/src/main/java/org/jeecg/config/FeignConfig.java
  3. 1 1
      jeecg-boot-base/jeecg-boot-base-api/pom.xml
  4. 46 2
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/DictAspect.java
  5. 33 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MD5Util.java
  6. 1 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  7. 6 4
      jeecg-boot-bytedance-ad/pom.xml
  8. 131 0
      jeecg-boot-finance/pom.xml
  9. 24 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/JeecgBootFinanceApplication.java
  10. 70 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/controller/AgentManagementController.java
  11. 33 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/entity/TransactionDay.java
  12. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/agent/entity/TransactionDetails.java
  13. 16 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/mapper/CtopAccountTransactionDayMapper.java
  14. 5 4
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/agent/mapper/CtopAccountTransactionDetailsMapper.java
  15. 24 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/mapper/CtopAgentAccountMapper.java
  16. 30 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/mapper/xml/CtopAccountTransactionDayMapper.xml
  17. 2 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/agent/mapper/xml/CtopAccountTransactionDetailsMapper.xml
  18. 55 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/mapper/xml/CtopAgentAccountMapper.xml
  19. 28 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/service/AgentManagementService.java
  20. 481 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/service/impl/AgentManagementServiceImpl.java
  21. 571 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/CwjsPolicyInfoController.java
  22. 95 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/DemoController.java
  23. 61 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsCompanyApprovalUser.java
  24. 61 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsCompanySubject.java
  25. 57 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyApprovalLog.java
  26. 152 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyInfo.java
  27. 57 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyProduct.java
  28. 23 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsCompanyApprovalUserMapper.java
  29. 21 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsCompanySubjectMapper.java
  30. 17 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyApprovalLogMapper.java
  31. 22 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyInfoMapper.java
  32. 19 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyProductMapper.java
  33. 16 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsCompanyApprovalUserMapper.xml
  34. 13 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsCompanySubjectMapper.xml
  35. 7 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyApprovalLogMapper.xml
  36. 61 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyInfoMapper.xml
  37. 11 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/xml/CwjsPolicyProductMapper.xml
  38. 14 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsCompanyApprovalUserService.java
  39. 14 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsCompanySubjectService.java
  40. 14 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyApprovalLogService.java
  41. 25 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyInfoService.java
  42. 19 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyProductService.java
  43. 19 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsCompanyApprovalUserServiceImpl.java
  44. 19 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsCompanySubjectServiceImpl.java
  45. 28 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyApprovalLogServiceImpl.java
  46. 101 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyInfoServiceImpl.java
  47. 34 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyProductServiceImpl.java
  48. 149 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/utils/Check.java
  49. 19 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/utils/ListPageUtil.java
  50. 242 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/DemoReportController.java
  51. 74 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/ExportReportController.java
  52. 89 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/SettlementController.java
  53. 114 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/SettlementFileController.java
  54. 112 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/pojo/ctopCwjsSettlementFileInfo.java
  55. 110 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/pojo/ctopCwjsSettlementInfo.java
  56. 25 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/AccountImportVo.java
  57. 49 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/ProfitReportBytedanceVo.java
  58. 54 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/ProfitReportKuaiShouVo.java
  59. 83 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/SettlementFileParamsVo.java
  60. 57 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/SettlementReportBytedanceVo.java
  61. 90 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/SettlementReportKuaiShouVo.java
  62. 97 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/ReportSettlementMapper.java
  63. 45 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/SettlementFileInfoMapper.java
  64. 40 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/SettlementInfoMapper.java
  65. 236 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/ReportSettlementMapper.xml
  66. 150 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/SettlementFileInfoMapper.xml
  67. 85 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/SettlementInfoMapper.xml
  68. 33 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/IReportSettlementService.java
  69. 25 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/ISettlementFileInfoService.java
  70. 21 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/ISettlementInfoService.java
  71. 59 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/ExcelListener.java
  72. 83 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/FileLoaderImpl.java
  73. 613 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/ReportSettlementServiceImpl.java
  74. 162 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/SettlementFileInfoServiceImpl.java
  75. 130 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/SettlementInfoServiceImpl.java
  76. 147 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/utils/SettlementUtil.java
  77. 54 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/utils/createExcelByTemplate.java
  78. 295 0
      jeecg-boot-finance/src/main/resources/application-dev.yml
  79. 289 0
      jeecg-boot-finance/src/main/resources/application-prod.yml
  80. 248 0
      jeecg-boot-finance/src/main/resources/application-test.yml
  81. 17 0
      jeecg-boot-finance/src/main/resources/application.yml
  82. 61 0
      jeecg-boot-finance/src/test/java/org/jeecg/modules/finance/FinanceTest.java
  83. 22 0
      jeecg-boot-module-demo/pom.xml
  84. 29 0
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/test/controller/TestAlinkController.java
  85. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/entity/MaterialAscription.java
  86. 1 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/entity/UserCompany.java
  87. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  88. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  89. 12 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml
  90. 5 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  91. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserCompanyService.java
  92. 174 12
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  93. 7 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserCompanyServiceImpl.java
  94. 1 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java
  95. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouUnitLevelOperationRecordMapper.java
  96. 7 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouUnitLevelOperationRecordMapper.xml
  97. 8 3
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  98. 8 8
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/KuaishouAccountCleanTemplateMapper.java
  99. 36 8
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/label/controller/LbelController.java
  100. 0 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/label/entity/LabelStandardInfo.java

+ 0 - 21
jeecg-boot-base/jeecg-boot-base-api/jeecg-system-cloud-api/pom.xml

@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>jeecg-boot-base-api</artifactId>
-        <groupId>org.jeecgframework.boot</groupId>
-        <version>2.4.5</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>jeecg-system-cloud-api</artifactId>
-
-    <dependencies>
-        <!-- feign -->
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-openfeign</artifactId>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 75
jeecg-boot-base/jeecg-boot-base-api/jeecg-system-cloud-api/src/main/java/org/jeecg/config/FeignConfig.java

@@ -1,75 +0,0 @@
-package org.jeecg.config;
-
-import feign.Feign;
-import feign.Logger;
-import feign.RequestInterceptor;
-import feign.codec.Encoder;
-import feign.form.spring.SpringFormEncoder;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.constant.CommonConstant;
-import org.springframework.beans.factory.ObjectFactory;
-import org.springframework.boot.autoconfigure.AutoConfigureBefore;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
-import org.springframework.cloud.openfeign.FeignAutoConfiguration;
-import org.springframework.cloud.openfeign.support.SpringEncoder;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
-import org.springframework.context.annotation.Scope;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-import javax.servlet.http.HttpServletRequest;
-
-
-@ConditionalOnClass(Feign.class)
-@AutoConfigureBefore(FeignAutoConfiguration.class)
-@Slf4j
-@Configuration
-public class FeignConfig {
-
-    @Bean
-    public RequestInterceptor requestInterceptor() {
-        return requestTemplate -> {
-            ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
-            if (null != attributes) {
-                HttpServletRequest request = attributes.getRequest();
-                log.info("Feign request: {}", request.getRequestURI());
-                // 将token信息放入header中
-                String token = request.getHeader(CommonConstant.X_ACCESS_TOKEN);
-                if(token==null){
-                    token = request.getParameter("token");
-                }
-                log.info("Feign request token: {}", token);
-                requestTemplate.header(CommonConstant.X_ACCESS_TOKEN, token);
-            }
-        };
-    }
-
-
-
-    /**
-     * Feign 客户端的日志记录,默认级别为NONE
-     * Logger.Level 的具体级别如下:
-     * NONE:不记录任何信息
-     * BASIC:仅记录请求方法、URL以及响应状态码和执行时间
-     * HEADERS:除了记录 BASIC级别的信息外,还会记录请求和响应的头信息
-     * FULL:记录所有请求与响应的明细,包括头信息、请求体、元数据
-     */
-    @Bean
-    Logger.Level feignLoggerLevel() {
-        return Logger.Level.FULL;
-    }
-
-    /**
-     * Feign支持文件上传
-     * @param messageConverters
-     * @return
-     */
-    @Bean
-    @Primary
-    @Scope("prototype")
-    public Encoder multipartFormEncoder(ObjectFactory<HttpMessageConverters> messageConverters) {
-        return new SpringFormEncoder(new SpringEncoder(messageConverters));
-    }
-}

+ 1 - 1
jeecg-boot-base/jeecg-boot-base-api/pom.xml

@@ -14,7 +14,7 @@
 
     <modules>
         <module>jeecg-system-local-api</module>
-        <module>jeecg-system-cloud-api</module>
+<!--        <module>jeecg-system-cloud-api</module>-->
     </modules>
 
     <dependencies>

+ 46 - 2
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/DictAspect.java

@@ -1,10 +1,12 @@
 package org.jeecg.common.aspect;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.aspectj.lang.ProceedingJoinPoint;
 import org.aspectj.lang.annotation.Around;
@@ -17,6 +19,7 @@ import org.jeecg.common.system.service.ICoreService;
 import org.jeecg.common.util.oConvertUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
 
 import java.lang.reflect.Field;
@@ -42,7 +45,7 @@ public class DictAspect {
     /**
      * 定义切点Pointcut
      */
-    @Pointcut("execution(public * org.jeecg.modules..*.*Controller.*(..))||execution(public * cn.com.ctop..*.*Controller.*(..))||execution(public * ctop.bytedane.ad..*.*Controller.*(..))")
+    @Pointcut("execution(public * org.jeecg.modules..*.*Controller.*(..))||execution(public * ctop.bytedance.ad..*.*Controller.*(..)) ||execution(public * org.jeecg.ctop.finance..*.*Controller.*(..))")
     public void excudeService() {
     }
 
@@ -128,8 +131,49 @@ public class DictAspect {
                     items.add(item);
                 }
                 ((IPage) ((Result) result).getResult()).setRecords(items);
+            }else if(((Result) result).getResult() instanceof PageInfo){
+                List<JSONObject> items = new ArrayList<>();
+                for (Object record : ((Result<PageInfo>) result).getResult().getList()){
+                    ObjectMapper mapper = new ObjectMapper();
+                    String json="{}";
+                    try {
+                        //解决@JsonFormat注解解析不了的问题详见SysAnnouncement类的@JsonFormat
+                        json = mapper.writeValueAsString(record);
+                    } catch (JsonProcessingException e) {
+                        log.error("json解析失败"+e.getMessage(),e);
+                    }
+                    JSONObject item = JSONObject.parseObject(json);
+                    //for (Field field : record.getClass().getDeclaredFields()) {
+                    for (Field field : oConvertUtils.getAllFields(record)) {
+                        if (field.getAnnotation(Dict.class) != null) {
+                            String code = field.getAnnotation(Dict.class).dicCode();
+                            String text = field.getAnnotation(Dict.class).dicText();
+                            String table = field.getAnnotation(Dict.class).dictTable();
+                            String extendsKey = field.getAnnotation(Dict.class).extendsKey();
+                            if("".equals(extendsKey.trim())){
+                                extendsKey = null;
+                            }
+                            String extendsValue = field.getAnnotation(Dict.class).extendsValue();
+                            if("".equals(extendsValue.trim())){
+                                extendsValue = null;
+                            }
+                            String key = String.valueOf(item.get(field.getName()));
+                            //翻译字典值对应的txt
+                            String textValue = translateDictValue(code, text, table, key,extendsKey,extendsValue);
+                            log.debug(" 字典Val : "+ textValue);
+                            log.debug(" __翻译字典字段__ "+field.getName() + CommonConstant.DICT_TEXT_SUFFIX+": "+ textValue);
+                            item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
+                        }
+                        //date类型默认转换string格式化日期
+                        if (field.getType().getName().equals("java.util.Date")&&field.getAnnotation(JsonFormat.class)==null&&item.get(field.getName())!=null){
+                            SimpleDateFormat aDate=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                            item.put(field.getName(), aDate.format(new Date((Long) item.get(field.getName()))));
+                        }
+                    }
+                    items.add(item);
+                }
+                ((Result<PageInfo>) result).getResult().setList(items);
             }
-
         }
     }
 

+ 33 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MD5Util.java

@@ -3,6 +3,10 @@ package org.jeecg.common.util;
 import org.springframework.util.DigestUtils;
 
 import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 
@@ -30,6 +34,35 @@ public class MD5Util {
 		return String.valueOf(str);
 	}
 
+	public static String md5ByUrl(String imgUrl){
+		String md5 = "";
+		InputStream inputStream = null;
+		try {
+			//url路径
+			URL url=new URL(imgUrl);
+			//获取连接
+			HttpURLConnection connection=(HttpURLConnection)url.openConnection();
+			connection.setConnectTimeout(3*1000);
+			//设置请求头
+			connection.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36");
+			inputStream = connection.getInputStream();
+			//DigestUtils为org.apache.commons.codec.digest.DigestUtils下的类
+			md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(inputStream);
+		} catch (IOException e) {
+			e.printStackTrace();
+		} finally{
+			try {
+				if (inputStream != null) {
+					//关闭流
+					inputStream.close();
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return  md5;
+	}
+
 	public static String getMd5(String url) {
 		MessageDigest md5 = MD5.get();
 		md5.reset();

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

@@ -211,6 +211,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/kuaishou/batch/*", "anon");
         filterChainDefinitionMap.put("/dimension/kuaiShouDimensionAccount/*", "anon");
         filterChainDefinitionMap.put("/ai/projectCreate/*", "anon");
+        filterChainDefinitionMap.put("/cwjsPolicyInfo/**", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 6 - 4
jeecg-boot-bytedance-ad/pom.xml

@@ -26,10 +26,7 @@
             <groupId>org.jeecgframework.boot</groupId>
             <artifactId>jeecg-boot-starter-cloud</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.jeecgframework.boot</groupId>
-            <artifactId>jeecg-system-local-api</artifactId>
-        </dependency>
+
 
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
@@ -48,6 +45,11 @@
             <version>1.16</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-system-local-api</artifactId>
+        </dependency>
+
 
     </dependencies>
     <build>

+ 131 - 0
jeecg-boot-finance/pom.xml

@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>jeecg-boot-parent</artifactId>
+        <groupId>org.jeecgframework.boot</groupId>
+        <version>2.4.5</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+<!--
+    <groupId>org.jeecg.framework.boot</groupId>-->
+    <artifactId>jeecg-boot-finance</artifactId>
+
+
+    <dependencies>
+        <!--引入微服务启动依赖 starter-->
+        <dependency>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-boot-starter-cloud</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-webflux</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        <!--健康监控-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
+
+
+        <dependency>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-boot-base-core</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.jeecgframework.boot</groupId>
+                    <artifactId>hibernate-re</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-system-cloud-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-web</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-annotation</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.15</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jeecgframework.boot</groupId>
+            <artifactId>jeecg-boot-module-system</artifactId>
+        </dependency>
+
+
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+        <resources>
+            <!-- 解决MyBatis配置文件引入问题 -->
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                    <include>**/*.xml</include>
+                </includes>
+                <!-- 是否替换资源中的属性-->
+                <filtering>true</filtering>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+    </build>
+
+    <!-- 环境 -->
+    <profiles>
+        <!-- 开发 -->
+        <profile>
+            <id>dev</id>
+            <properties>
+                <activatedProperties>dev</activatedProperties>
+            </properties>
+        </profile>
+        <!-- 测试 -->
+        <profile>
+            <id>test</id>
+            <properties>
+                <activatedProperties>test</activatedProperties>
+            </properties>
+        </profile>
+        <!-- 生产 -->
+        <profile>
+            <id>prod</id>
+            <properties>
+                <activatedProperties>prod</activatedProperties>
+            </properties>
+        </profile>
+    </profiles>
+
+
+</project>

+ 24 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/JeecgBootFinanceApplication.java

@@ -0,0 +1,24 @@
+package org.jeecg.ctop.finance;
+
+import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.apache.shiro.spring.boot.autoconfigure.ShiroAnnotationProcessorAutoConfiguration;
+import org.apache.shiro.spring.boot.autoconfigure.ShiroAutoConfiguration;
+import org.apache.shiro.spring.boot.autoconfigure.ShiroBeanAutoConfiguration;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+
+/**
+ * zian Y
+ * 2021/7/26
+ **/
+
+@SpringBootApplication(exclude = {ShiroAnnotationProcessorAutoConfiguration.class, ShiroAutoConfiguration.class, ShiroBeanAutoConfiguration.class})
+@EnableDubbo
+@ComponentScan(basePackages = {"org.jeecg", "cn.com.ctop"})
+public class JeecgBootFinanceApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(JeecgBootFinanceApplication.class, args);
+    }
+}

+ 70 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/controller/AgentManagementController.java

@@ -0,0 +1,70 @@
+package org.jeecg.ctop.finance.agent.controller;
+
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.agent.service.AgentManagementService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+@RestController
+@RequestMapping("/agent")
+@Slf4j
+public class AgentManagementController {
+
+    @Autowired
+    AgentManagementService agentManagementService;
+
+    @RequestMapping("/queryAccountTransactionDetails")
+    public void getList(@Param("starDate")String startDate,@Param("endDate")String endDate) {
+        Result recharge = agentManagementService.synchronousAccountTransactionDetails(startDate,endDate);
+
+    }
+
+    @RequestMapping("/synchronousAccount")
+    public void synchronousAccount() {
+        Result recharge = agentManagementService.synchronousAccount();
+    }
+
+
+    @RequestMapping("/synchronousAccountTransactionDay")
+    public void synchronousAccountTransactionDay(@Param("starDate")String startDate,@Param("endDate")String endDate) {
+        Result recharge = agentManagementService.synchronousAccountTransactionDay(startDate,endDate);
+    }
+
+
+    @RequestMapping("/synchronous")
+    public void synchronous() throws ParseException {
+        String date1="2021-05-01";
+        String date2="2021-05-31";
+        String date3="2021-06-01";
+        String date4="2021-06-30";
+        String date5="2021-07-01";
+        String date6="2021-07-31";
+        String date7="2021-08-01";
+        String date8="2021-08-31";
+        agentManagementService.synchronousAccount();
+        //5月份
+         agentManagementService.synchronousAccountTransactionDetails(date1,date2);
+         agentManagementService.synchronousAccountTransactionDay(date1,date2);
+        //6月份
+         agentManagementService.synchronousAccountTransactionDetails(date3,date4);
+         agentManagementService.synchronousAccountTransactionDay(date3,date4);
+        //7月份
+         agentManagementService.synchronousAccountTransactionDetails(date5,date6);
+         agentManagementService.synchronousAccountTransactionDay(date5,date6);
+        //8月份
+          agentManagementService.synchronousAccountTransactionDetails(date7,date8);
+          agentManagementService.synchronousAccountTransactionDay(date7,date8);
+    }
+
+
+
+}

+ 33 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/entity/TransactionDay.java

@@ -0,0 +1,33 @@
+package org.jeecg.ctop.finance.agent.entity;
+
+import lombok.Data;
+
+@Data
+public class TransactionDay {
+    //
+    private String id;
+    //广告主ID
+    private String advertiserId;
+    //日期
+    private String date;
+    //日终结余(单位元)
+    private String balance;
+    //现金支出(单位元)
+    private String cashCost;
+    //总支出(单位元)
+    private String cost;
+    //冻结(单位元)
+    private String frozen;
+    //总存入(单位元)
+    private String income;
+    //赠款支出(单位元)
+    private String rewardCost;
+    //共享钱包支出(单位元)
+    private String sharedWalletCost;
+    //总转入(单位元)
+    private String transferIn;
+    //总转出(单位元)
+    private String transferOut;
+    //创建时间
+    private String createTime;
+}

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/agent/entity/TransactionDetails.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.toutiao.modules.agent.entity;
+package org.jeecg.ctop.finance.agent.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;

+ 16 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/mapper/CtopAccountTransactionDayMapper.java

@@ -0,0 +1,16 @@
+package org.jeecg.ctop.finance.agent.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.ctop.finance.agent.entity.TransactionDay;
+
+import java.util.List;
+
+@Mapper
+public interface CtopAccountTransactionDayMapper {
+
+    List<String> getAdvertiserIdByDate(@Param("date") String date,@Param("advertiserId") String advertiserId);
+
+    void saveAccountTransactionDay(@Param("list") List<TransactionDay> list, @Param("date") String date);
+
+}

+ 5 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/agent/mapper/CtopAccountTransactionDetailsMapper.java

@@ -1,15 +1,16 @@
-package cn.com.ctop.toutiao.modules.agent.mapper;
+package org.jeecg.ctop.finance.agent.mapper;
 
-import cn.com.ctop.toutiao.modules.agent.entity.TransactionDetails;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.ctop.finance.agent.entity.TransactionDetails;
 
 import java.util.List;
 
 @Mapper
 public interface CtopAccountTransactionDetailsMapper {
     //保存交易记录
-    public void saveAccountTransactionDetails(@Param("list") List<TransactionDetails> list, @Param("date")String date);
+    public void saveAccountTransactionDetails(@Param("list") List<TransactionDetails> list, @Param("date") String date);
+
     //根据日期查询当日所有交易订单号
-    public List<String> getTransactionSeq( @Param("date")String date);
+    public List<String> getTransactionSeq(@Param("date") String date);
 }

+ 24 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/mapper/CtopAgentAccountMapper.java

@@ -0,0 +1,24 @@
+package org.jeecg.ctop.finance.agent.mapper;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface CtopAgentAccountMapper {
+    //获取所有账户
+    public List<String> getAllAccountId();
+    //根据账户id修改账户状态
+    public void updateAccountState(@Param("list") List<String> list, @Param("state") int state);
+    //批量插入新增数据
+    public void insertAccountData(@Param("list") List<String> list, @Param("agent_id") String agent_id, @Param("create_time") String create_time);
+    /**
+     * 根据accountId查询
+     *
+     * @param accountId
+     * @return
+     */
+    CtopOauthToken selectByAccountId(Long accountId);
+}

+ 30 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/mapper/xml/CtopAccountTransactionDayMapper.xml

@@ -0,0 +1,30 @@
+<?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.finance.agent.mapper.CtopAccountTransactionDayMapper">
+   <!-- 批量插入新增数据-->
+    <insert id="saveAccountTransactionDay">
+        insert  into ctop_account_transaction_day (advertiser_id,date,balance,cash_cost,cost,frozen,income,reward_cost,
+        shared_wallet_cost,transfer_in,transfer_out,create_time) values
+        <foreach collection="list" item="item" index="index" separator=",">
+            (
+            #{item.advertiserId},
+            #{item.date},
+            #{item.balance},
+            #{item.cashCost},
+            #{item.cost},
+            #{item.frozen},
+            #{item.income},
+            #{item.rewardCost},
+            #{item.sharedWalletCost},
+            #{item.transferIn},
+            #{item.transferOut},
+            #{date}
+            )
+        </foreach>
+    </insert>
+
+    <select id="getAdvertiserIdByDate" parameterType="String" resultType="String">
+        select t.advertiser_id from ctop_account_transaction_day t where t.date=#{date} and t.advertiser_id=#{advertiserId}
+    </select>
+
+</mapper>

+ 2 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/agent/mapper/xml/CtopAccountTransactionDetailsMapper.xml

@@ -1,6 +1,6 @@
 <?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.toutiao.modules.agent.mapper.CtopAccountTransactionDetailsMapper">
+<mapper namespace="org.jeecg.ctop.finance.agent.mapper.CtopAccountTransactionDetailsMapper">
    <!-- 批量插入新增数据-->
     <insert id="saveAccountTransactionDetails">
         insert  into ctop_account_transaction_details (advertiser_id,transaction_type,data_time,amount,cash,grant_amount,return_goods,transaction_seq,
@@ -24,7 +24,7 @@
     </insert>
 
     <select id="getTransactionSeq" parameterType="String" resultType="String">
-        select t.transaction_seq from ctop_account_transaction_details t where t.create_time=#{date}
+        select t.transaction_seq from ctop_account_transaction_details t
     </select>
 
 </mapper>

+ 55 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/mapper/xml/CtopAgentAccountMapper.xml

@@ -0,0 +1,55 @@
+<?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.finance.agent.mapper.CtopAgentAccountMapper">
+    <resultMap id="BaseResultMap" type="cn.com.ctop.common.module.entity.CtopOauthToken">
+        <result column="id" property="id" jdbcType="BIGINT"/>
+        <result column="media_id" property="mediaId" jdbcType="VARCHAR"/>
+        <result column="advertiser_id" property="advertiserId" jdbcType="VARCHAR"/>
+        <result column="account_id" property="accountId" jdbcType="BIGINT"/>
+        <result column="access_token" property="accessToken" jdbcType="VARCHAR"/>
+        <result column="refresh_token" property="refreshToken" jdbcType="VARCHAR"/>
+        <result column="access_token_expires_in" property="accessTokenExpiresIn" jdbcType="TIMESTAMP"/>
+        <result column="refresh_token_expires_in" property="refreshTokenExpiresIn" jdbcType="TIMESTAMP"/>
+        <result column="agent_type" property="agentType" jdbcType="INTEGER"/>
+        <result column="app_id" property="appId" jdbcType="BIGINT"/>
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
+        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,media_id,advertiser_id,account_id,access_token,refresh_token,access_token_expires_in,refresh_token_expires_in,agent_type,app_id,create_time,update_time
+   </sql>
+    <!--获取所有账户-->
+    <select id="getAllAccountId" resultType="String">
+        select account_id from ctop_agent_account where state=0
+    </select>
+   <!-- 根据账户id修改账户状态-->
+    <update id="updateAccountState">
+        update ctop_agent_account set state=#{state} where account_id in
+        <foreach item="item" index="index" collection="list" open="("  close=")" separator=",">
+            #{item}
+        </foreach>
+    </update>
+   <!-- 批量插入新增数据-->
+    <insert id="insertAccountData">
+        insert  into ctop_agent_account (account_id,agent_id,state,create_time) values
+        <foreach collection="list" item="item" index="index" separator=",">
+            (
+            #{item},
+            #{agent_id},
+            0,
+            #{create_time}
+            )
+        </foreach>
+    </insert>
+
+    <select id="selectByAccountId" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from ctop_oauth_token
+        where account_id = #{accountId}
+        order by create_time desc
+        limit 1
+    </select>
+
+</mapper>

+ 28 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/service/AgentManagementService.java

@@ -0,0 +1,28 @@
+package org.jeecg.ctop.finance.agent.service;
+
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.api.vo.Result;
+
+public interface AgentManagementService {
+    //获取TOKEN
+    public String getToken();
+
+    //查询代理商下账户
+    public  JSONObject selectAgentAdvertiser(int pageNum, int pageSize);
+
+
+    //查询账号流水
+    public JSONObject queryAccountTransactionDetails(String AccountId, String transaction_type, int pageNum, int pageSize,String startDate,String endDate);
+
+    //查询账号流水
+    public JSONObject queryAccountTransactionDay(String AccountId, int pageNum, int pageSize,String startDate,String endDate);
+
+    //同步代理商账户入库
+    public Result synchronousAccount();
+
+    //同步账户交易流水
+    public Result synchronousAccountTransactionDetails(String startDate,String endDate);
+
+    //同步账户日流水
+    public Result synchronousAccountTransactionDay(String startDate,String endDate);
+}

+ 481 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/agent/service/impl/AgentManagementServiceImpl.java

@@ -0,0 +1,481 @@
+package org.jeecg.ctop.finance.agent.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.agent.entity.TransactionDay;
+import org.jeecg.ctop.finance.agent.entity.TransactionDetails;
+import org.jeecg.ctop.finance.agent.mapper.CtopAccountTransactionDayMapper;
+import org.jeecg.ctop.finance.agent.mapper.CtopAccountTransactionDetailsMapper;
+import org.jeecg.ctop.finance.agent.mapper.CtopAgentAccountMapper;
+import org.jeecg.ctop.finance.agent.service.AgentManagementService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+import static java.util.stream.Collectors.toList;
+
+/**
+ * 代理商管理
+ *
+ * @author zzy
+ * @create: 2021-07-14
+ */
+@Service
+@Slf4j
+public class AgentManagementServiceImpl implements AgentManagementService {
+
+    private final String OPEN_API_URL_PREFIX = "https://ad.oceanengine.com/open_api/2/";
+    private final String ACCOUNT_LIST_URL = "agent/advertiser/select/";
+    private final String ACCOUNT_TRANSACTION_DETAILS_URL = "advertiser/fund/transaction/get/";
+    private final String ACCOUNT_TRANSACTION_DAY_URL = "advertiser/fund/daily_stat/";
+    private final String ADVERTISER_ID = "73970348172";
+    private final String RECHARGE = "RECHARGE";
+    private final String TRANSFER = "TRANSFER";
+
+    @Resource
+    CtopAgentAccountMapper ctopAgentAccountMapper;
+    @Resource
+    CtopAccountTransactionDetailsMapper ctopAccountTransactionDetailsMapper;
+
+    @Resource
+    CtopAccountTransactionDayMapper ctopAccountTransactionDayMapper;
+
+    /**
+     * 同步代理商下账号
+     *
+     * @author zzy
+     * @create: 2021-07-14
+     */
+
+    @Override
+    public Result synchronousAccount() {
+        log.info("开始同步账号信息");
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
+        List<String> dataList = new ArrayList();
+        Result result = new Result();
+        try {
+            //分页查询第一页数据
+            JSONObject agentAccountList = selectAgentAdvertiser(1, 2000);
+            JSONObject data = (JSONObject) agentAccountList.get("data");
+            //dataList.addAll((List) data.get("list"));
+            if (data.size() > 0) {
+                JSONObject page_info = (JSONObject) data.get("page_info");
+                int total_page = (int) page_info.get("total_page");
+                //查询其他页数据
+                for (int i = 0; i < total_page; i++) {
+                    JSONObject agenttList = selectAgentAdvertiser(i + 1, 2000);
+                    JSONObject agentData = (JSONObject) agenttList.get("data");
+                    List<Long> list = (List<Long>) agentData.get("list");
+                    list.stream().forEach(str -> {
+                        dataList.add(str.toString());
+                    });
+
+                }
+                //查询数据库已存在id
+                List<String> accountIdList = ctopAgentAccountMapper.getAllAccountId();
+                if (!accountIdList.isEmpty()) {
+                    //筛选巨量引擎剔除的用户
+                    List<String> removeList = accountIdList.stream().filter(item -> !dataList.contains(item)).collect(toList());
+                    //筛选巨量引擎新增的用户
+                    List<String> addList = dataList.stream().filter(item -> !accountIdList.contains(item)).collect(toList());
+                    //修改剔除的用户状态
+                    if (!removeList.isEmpty()) {
+                        ctopAgentAccountMapper.updateAccountState(removeList, 1);
+                    }
+                    //保存新增的用户
+                    if (!addList.isEmpty()) {
+                        ctopAgentAccountMapper.insertAccountData(addList, ADVERTISER_ID, df.format(new Date()));
+                    }
+                } else {
+                    ctopAgentAccountMapper.insertAccountData(dataList, ADVERTISER_ID, df.format(new Date()));
+                }
+
+            }
+            result.setSuccess(true);
+            result.setMessage("success");
+            return result;
+        } catch (Exception e) {
+            log.info("同步失败:{}", e.toString());
+            result.error500("同步失败");
+            return result;
+        }
+    }
+
+    /**
+     * 同步账户交易流水
+     *
+     * @author zzy
+     * @create: 2021-07-15
+     */
+    @Override
+    public Result synchronousAccountTransactionDetails(String startDate,String endDate) {
+        log.info("开始同步账号交易流水");
+        Result result = new Result();
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
+        List<TransactionDetails> transactionDetailsList = new ArrayList<>();
+        try {
+            List<String> accountIdList = ctopAgentAccountMapper.getAllAccountId();
+            if (!accountIdList.isEmpty()) {
+                List<String> transactionSeqList = ctopAccountTransactionDetailsMapper.getTransactionSeq(df.format(new Date()));
+                accountIdList.stream().forEach(str -> {
+                    if (!str.isEmpty()) {
+                        //查询账号下充值的交易流水
+                        JSONObject jsonObject = queryAccountTransactionDetails(str, RECHARGE, 1, 1000, startDate,endDate);
+                        int code = (int) jsonObject.get("code");
+                        if(code!=0){
+                            result.setMessage((String) jsonObject.get("message"));
+                            log.info((String) jsonObject.get("message"));
+                            return;
+                        }
+                        JSONObject data = (JSONObject) jsonObject.get("data");
+                        if (data != null) {
+                            List<Object> dataList = (List<Object>) data.get("list");
+                            if (dataList != null && !dataList.isEmpty()) {
+                                //充值类存在记录
+                                //保存第一页数据
+                                dataList.stream().forEach(ob -> {
+                                    TransactionDetails transactionDetails = JSONObject.toJavaObject((JSON) ob, TransactionDetails.class);
+                                    //订单号不存在
+                                    if (transactionSeqList.isEmpty() || !transactionSeqList.contains(transactionDetails.getTransaction_seq())) {
+                                        transactionDetailsList.add(transactionDetails);
+                                    }
+
+                                });
+                                JSONObject page_info = (JSONObject) data.get("page_info");
+                                int total_page = (int) page_info.get("total_page");
+                                //查询其他页数据
+                                if (total_page > 1) {
+                                    for (int i = 2; i <= total_page; i++) {
+                                        JSONObject jo = queryAccountTransactionDetails(str, RECHARGE, i, 1000, startDate,endDate);
+                                        JSONObject accountData = (JSONObject) jo.get("data");
+                                        List<Object> rechargeList = (List<Object>) accountData.get("list");
+                                        rechargeList.stream().forEach(transactionDetails -> {
+                                            TransactionDetails transactionDetailsOther = JSONObject.toJavaObject((JSON) transactionDetails, TransactionDetails.class);
+                                            //订单号不存在
+                                            if (transactionSeqList.isEmpty() || !transactionSeqList.contains(transactionDetailsOther.getTransaction_seq())) {
+                                                transactionDetailsList.add(transactionDetailsOther);
+                                            }
+                                        });
+                                    }
+                                }
+                            }
+                        }
+
+                        //查询账号下转账的交易流水
+                        JSONObject transferJsonObject = queryAccountTransactionDetails(str, TRANSFER, 1, 1000, startDate,endDate);
+                        JSONObject transferData = (JSONObject) transferJsonObject.get("data");
+                        int code1 = (int) jsonObject.get("code");
+                        if(code1!=0){
+                            result.setMessage((String) jsonObject.get("message"));
+                            log.info((String) jsonObject.get("message"));
+                            return;
+                        }
+                        if (transferData != null) {
+                            List<Object> transferDataList = (List<Object>) transferData.get("list");
+                            if (!transferDataList.isEmpty()) {
+                                //转账类存在记录
+                                //保存第一页数据
+                                transferDataList.stream().forEach(ob -> {
+                                    TransactionDetails transactionDetails = JSONObject.toJavaObject((JSON) ob, TransactionDetails.class);
+                                    //订单号不存在
+                                    if (transactionSeqList.isEmpty() || !transactionSeqList.contains(transactionDetails.getTransaction_seq())) {
+                                        transactionDetailsList.add(transactionDetails);
+                                    }
+                                });
+                                JSONObject transferPageInfo = (JSONObject) transferData.get("page_info");
+                                int transferTotalPage = (int) transferPageInfo.get("total_page");
+                                //查询其他页数据
+                                if (transferTotalPage > 1) {
+                                    for (int i = 2; i <= transferTotalPage; i++) {
+                                        JSONObject jo = queryAccountTransactionDetails(str, TRANSFER, i, 1000, startDate,endDate);
+                                        JSONObject accountData = (JSONObject) jo.get("data");
+                                        List<Object> rechargeList = (List<Object>) accountData.get("list");
+                                        rechargeList.stream().forEach(transactionDetails -> {
+                                            TransactionDetails transactionDetailsOther = JSONObject.toJavaObject((JSON) transactionDetails, TransactionDetails.class);
+                                            //订单号不存在
+                                            if (transactionSeqList.isEmpty() || !transactionSeqList.contains(transactionDetailsOther.getTransaction_seq())) {
+                                                transactionDetailsList.add(transactionDetailsOther);
+                                            }
+                                        });
+                                    }
+                                }
+                            }
+                        }
+
+                    }
+                });
+            }
+            //保存数据
+            if (!transactionDetailsList.isEmpty()) {
+                ctopAccountTransactionDetailsMapper.saveAccountTransactionDetails(transactionDetailsList, df.format(new Date()));
+                log.info("新增交易记录:{}条", transactionDetailsList.size());
+            }
+            result.setSuccess(true);
+            result.setMessage("success");
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage("error");
+            log.info("同步失败:{}", e.toString());
+        }
+
+
+        return result;
+    }
+
+    /**
+     * 同步账户日流水
+     *
+     * @author zzy
+     * @create: 2021-07-15
+     */
+    @Override
+    public Result synchronousAccountTransactionDay(String startDate,String endDate) {
+        log.info("开始同步账号日流水");
+        Result result = new Result();
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
+        Calendar ca = Calendar.getInstance();
+        ca.setTime(new Date());
+        ca.add(Calendar.DATE, -1);
+        List<TransactionDay> transactionDetailsList = new ArrayList<>();
+        try {
+            List<String> accountIdList = ctopAgentAccountMapper.getAllAccountId();
+            if (!accountIdList.isEmpty()) {
+                accountIdList.stream().forEach(str -> {
+                    if (!str.isEmpty()) {
+                        //查询账号下充值的交易流水
+                        JSONObject jsonObject = queryAccountTransactionDay(str, 1, 1000, startDate,endDate);
+                        JSONObject data=null;
+                        int code=1;
+                        if(jsonObject!=null){
+                             data = (JSONObject) jsonObject.get("data");
+                             code = (int) jsonObject.get("code");
+                        }else {
+                            log.info("返回数据jsonObject为null:");
+                        }
+                        if(code!=0){
+                            result.setMessage((String) jsonObject.get("message"));
+                            log.info("返回数据:"+jsonObject.toJSONString()+":"+str);
+                        }
+                        if (data != null) {
+                            List<Object> dataList = (List<Object>) data.get("list");
+                            if (dataList != null && !dataList.isEmpty()) {
+                                //充值类存在记录
+                                //保存第一页数据
+                                dataList.stream().forEach(ob -> {
+                                    TransactionDay transactionDay = JSONObject.toJavaObject((JSON) ob, TransactionDay.class);
+                                    List<String> advertiserIdList = ctopAccountTransactionDayMapper.getAdvertiserIdByDate(transactionDay.getDate(),transactionDay.getAdvertiserId());
+                                    //订单号不存在
+                                    if (advertiserIdList.isEmpty() || advertiserIdList.size()<=0) {
+                                        transactionDetailsList.add(transactionDay);
+                                    }
+
+                                });
+                                JSONObject page_info = (JSONObject) data.get("page_info");
+                                int total_page = (int) page_info.get("total_page");
+                                //查询其他页数据
+                                if (total_page > 1) {
+                                    for (int i = 2; i <= total_page; i++) {
+                                        JSONObject jo = queryAccountTransactionDay(str, i, 1000, startDate,endDate);
+                                        JSONObject accountData = (JSONObject) jo.get("data");
+                                        List<Object> rechargeList = (List<Object>) accountData.get("list");
+                                        rechargeList.stream().forEach(obj -> {
+                                            TransactionDay transactionDay = JSONObject.toJavaObject((JSON) obj, TransactionDay.class);
+                                            List<String> advertiserIdList = ctopAccountTransactionDayMapper.getAdvertiserIdByDate(transactionDay.getDate(),transactionDay.getAdvertiserId());
+
+                                            //订单号不存在
+                                            if (advertiserIdList.isEmpty() || advertiserIdList.size()<=0) {
+                                                transactionDetailsList.add(transactionDay);
+                                            }
+                                        });
+                                    }
+                                }
+                            }
+                        }
+                    }
+                });
+            }
+            //保存数据
+            if (!transactionDetailsList.isEmpty()) {
+                ctopAccountTransactionDayMapper.saveAccountTransactionDay(transactionDetailsList, df.format(new Date()));
+                log.info("新增日流水记录:{}条", transactionDetailsList.size());
+            }
+            result.setSuccess(true);
+            result.setMessage("success");
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage("error");
+            log.info("同步失败:{}", e.toString());
+        }
+
+
+        return result;
+    }
+
+    /**
+     * 查询账号流水明细
+     *
+     * @return
+     * @author zzy
+     * @Param AccountId 账户id    transaction_type 流水类型  RECHARGE:充值  TRANSFER:转账     pageNum 当前页    pageSize 每页显示数量
+     * @create: 2021-07-14
+     */
+    @Override
+    public JSONObject queryAccountTransactionDetails(String AccountId, String transaction_type, int pageNum, int pageSize, String startDate,String endDate) {
+        // 请求参数
+        Map data = new HashMap() {
+            {
+                put("advertiser_id", AccountId);
+                put("start_date", startDate);
+                put("end_date", endDate);
+                put("transaction_type", transaction_type);
+                put("page", pageNum);
+                put("page_size", pageSize);
+            }
+        };
+        return sendHttpRequest(data, ACCOUNT_TRANSACTION_DETAILS_URL);
+    }
+
+    /**
+     * 查询账号日流水
+     *
+     * @return
+     * @author zzy
+     * @Param AccountId 账户id       pageNum 当前页    pageSize 每页显示数量
+     * @create: 2021-07-14
+     */
+    @Override
+    public JSONObject queryAccountTransactionDay(String AccountId, int pageNum, int pageSize,String startDate,String endDate) {
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
+        Calendar ca = Calendar.getInstance();
+        ca.setTime(new Date());
+        ca.add(Calendar.DATE, -1);
+            // 请求参数
+            Map data = new HashMap() {
+                {
+                    put("advertiser_id", AccountId);
+                    put("start_date", startDate);
+                    put("end_date", endDate);
+                    put("page", pageNum);
+                    put("page_size", pageSize);
+                }
+            };
+            return sendHttpRequest(data, ACCOUNT_TRANSACTION_DAY_URL);
+
+
+    }
+
+
+    /**
+     * 获取token
+     *
+     * @author zzy
+     * @create: 2021-07-14
+     */
+    @Override
+    public String getToken() {
+        CtopOauthToken ctopOauthToken = ctopAgentAccountMapper.selectByAccountId(Long.parseLong(ADVERTISER_ID));
+        if (ctopOauthToken != null) {
+            return ctopOauthToken.getAccessToken();
+        } else {
+            log.info("未查询到Token");
+            return null;
+        }
+
+    }
+
+    /**
+     * 获取账户列表
+     *
+     * @author zzy
+     * @Param pageNum 当前页    pageSize 每页显示数量
+     * @create: 2021-07-14
+     */
+    @Override
+    public JSONObject selectAgentAdvertiser(int pageNum, int pageSize) {
+        // 请求参数
+        Map data = new HashMap() {
+            {
+                put("advertiser_id", ADVERTISER_ID);
+                put("page", pageNum);
+                put("page_size", pageSize);
+            }
+        };
+        return sendHttpRequest(data, ACCOUNT_LIST_URL);
+    }
+
+
+    /**
+     * 根据地址请求巨量殷勤,返回响应结果
+     *
+     * @author zzy
+     * @Param data 请求参数    apiUrl请求路径
+     * @create: 2021-07-14
+     */
+    public JSONObject sendHttpRequest(Map data, String apiUrl) {
+        String access_token = getToken();
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "GET";
+            }
+        };
+
+        httpEntity.setHeader("Access-Token", access_token);
+
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(OPEN_API_URL_PREFIX + apiUrl));
+            httpEntity.setEntity(new StringEntity(JSONObject.toJSONString(data), ContentType.APPLICATION_JSON));
+
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuffer result = new StringBuffer();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                client.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+}

+ 571 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/CwjsPolicyInfoController.java

@@ -0,0 +1,571 @@
+package org.jeecg.ctop.finance.policy.controller;
+
+import java.text.ParseException;
+import java.util.*;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.com.ctop.common.module.entity.UserCompany;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.mapper.SysUserMapper;
+import cn.com.ctop.common.module.service.IUserCompanyService;
+import cn.com.ctop.common.module.utils.CorpWexinUtils;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.entity.SysUser;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.ctop.finance.policy.entity.*;
+import org.jeecg.ctop.finance.policy.mapper.CwjsCompanyApprovalUserMapper;
+import org.jeecg.ctop.finance.policy.mapper.CwjsCompanySubjectMapper;
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyApprovalLogMapper;
+import org.jeecg.ctop.finance.policy.service.*;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecg.ctop.finance.policy.utils.Check;
+import org.jeecg.ctop.finance.policy.utils.ListPageUtil;
+import org.jeecg.modules.ctop.service.IMaterialReportOverViewService;
+import org.jeecg.modules.system.service.ISysRoleService;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 政策信息表
+ * @author jeecg-boot
+ * @date   2021-07-27
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="政策模块")
+@RestController
+@RequestMapping("/cwjsPolicyInfo")
+public class CwjsPolicyInfoController {
+	@Autowired
+	private ICwjsPolicyInfoService cwjsPolicyInfoService;
+	@Autowired
+	private ICwjsPolicyProductService cwjsPolicyProductService;
+	 @Autowired
+	 private ISysRoleService roleService;
+	 @Resource
+	 IUserCompanyService userCompanyService;
+	 @Autowired
+	 ICwjsPolicyApprovalLogService policyApprovalLogService;
+	 @Autowired
+	 CwjsCompanyApprovalUserMapper companyApprovalUserMapper;
+	 @Resource
+	 CwjsCompanySubjectMapper companySubjectMapper;
+	 @Autowired
+	 ICwjsCompanySubjectService companySubjectService;
+	 @Resource
+	 CwjsPolicyApprovalLogMapper policyApprovalLogMapper;
+	 @Resource
+	 CorpWexinUtils corpWexinUtils;
+	 @Resource
+	 MailLogMapper mailLogMapper;
+
+	 @GetMapping(value = "/queryApprovalRejectReason")
+	 public Result<CwjsPolicyApprovalLog> queryApprovalRejectReason(@RequestParam(name="id",required=true) Integer id){
+		 CwjsPolicyApprovalLog policyApprovalLog = policyApprovalLogService.getOneByPolicyId(id);
+		 if(Check.isNull(policyApprovalLog)){
+			 return Result.successMsg("无审核拒绝的记录",null);
+		 }else{
+			 return Result.successMsg("无审核拒绝的记录",policyApprovalLog);
+		 }
+
+	 }
+
+	 @GetMapping(value = "/policyApproval")
+	 public Result policyApproval(@RequestParam(name="id",required=true) Integer id,
+	 							@RequestParam(name="type",required=true) Integer type,
+								  @RequestParam(name="userId",required=true) String userId,
+								@RequestParam(name="approvalContent",required=false) String approvalContent){
+//		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		CwjsPolicyInfo cwjsPolicyInfoEntity = cwjsPolicyInfoService.getById(id);
+		 if(cwjsPolicyInfoEntity==null) {
+			 return Result.error("参数传递有误");
+		 }
+		 Integer companySubjectId= cwjsPolicyInfoEntity.getCompanySubjectId();
+		 CwjsCompanyApprovalUser cwjsCompanyApprovalUser = companyApprovalUserMapper.queryByCompanySubjectIdAndUserId(companySubjectId, userId);
+		 if(type == 1){	//审核提交	等于新增的时候
+//			 cwjsPolicyInfoEntity.setApprovedStatus(1);
+			if(!Check.isNull(cwjsCompanyApprovalUser)){//当前登录的用户所提交的政策是审核链里的人的提交的  直接状态到2给终审的人员
+				cwjsPolicyInfoEntity.setApprovedStatus(2);
+			}else{	//除了销售总监提交的申请都是-待审核
+				cwjsPolicyInfoEntity.setApprovedStatus(1);
+			}
+			 JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId(cwjsPolicyInfoEntity.getApprovedProgress());
+			 StringBuilder text = new StringBuilder();
+			 text.append("您有一条销售政策需要审核,该客户为:");
+			 text.append(cwjsPolicyInfoEntity.getCompanyName());
+			 text.append(",请及时登录助手平台-销售政策页面进行审核,谢谢!");
+			 corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId,text.toString());
+		}
+		 if(type == 2){	//审核通过  是不是终审,不是就给当前的下一个人发企业微信
+			 CwjsCompanyApprovalUser nextApprovalUser = companyApprovalUserMapper.queryByCompanySubjectIdAndLevel(companySubjectId, cwjsCompanyApprovalUser.getLevel() + 1);
+			 if(!Check.isNull(cwjsCompanyApprovalUser) && Check.isNull(nextApprovalUser)){//没有下一个审核人员,是终审
+				cwjsPolicyInfoEntity.setApprovedStatus(3);
+			}else{	//不是终审
+				cwjsPolicyInfoEntity.setApprovedStatus(2);
+				cwjsPolicyInfoEntity.setApprovedProgress(nextApprovalUser.getApprovalUserId());	//设置一下个人为审核人员
+				 JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId(nextApprovalUser.getApprovalUserId());
+				 StringBuilder text = new StringBuilder();
+				 text.append("您有一条销售政策需要审核,该客户为:");
+				 text.append(cwjsPolicyInfoEntity.getCompanyName());
+				 text.append(",请及时登录助手平台-销售政策页面进行审核,谢谢!");
+				 corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId,text.toString());
+			}
+			CwjsPolicyApprovalLog policyApprovalLog = new CwjsPolicyApprovalLog();
+			policyApprovalLog.setPolicyId(id);
+			policyApprovalLog.setCreateUserId(userId);
+			policyApprovalLog.setApprovalStatus(0);
+			policyApprovalLogService.save(policyApprovalLog);
+
+
+		}
+	 	if(type == 3){	//审核拒绝	给申请人发企业微信
+			cwjsPolicyInfoEntity.setApprovedStatus(4);
+			CwjsPolicyApprovalLog policyApprovalLog = new CwjsPolicyApprovalLog();
+			policyApprovalLog.setPolicyId(id);
+			policyApprovalLog.setCreateUserId(userId);
+			policyApprovalLog.setApprovalContent(approvalContent);
+			policyApprovalLog.setApprovalStatus(1);
+			policyApprovalLogService.save(policyApprovalLog);
+
+			JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId(cwjsPolicyInfoEntity.getCreateUserId());
+			StringBuilder text = new StringBuilder();
+			text.append("您有一条销售政策审核未通过,客户为:");
+			text.append(cwjsPolicyInfoEntity.getCompanyName());
+			text.append(",请及时登录助手平台-销售政策页面进行政策修改,谢谢!");
+			corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId,text.toString());
+		}
+		cwjsPolicyInfoService.updateById(cwjsPolicyInfoEntity);
+	 	return Result.successMsg("成功",cwjsPolicyInfoEntity);
+	 }
+
+	/**
+	  * 分页列表查询
+	 * @param cwjsPolicyInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="政策信息表-分页列表查询", notes="政策信息表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<PageInfo<CwjsPolicyInfo>> queryPageList(CwjsPolicyInfo cwjsPolicyInfo,
+									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+									  @RequestParam(name="userId",required=true) String userId,
+									  HttpServletRequest req) {
+
+        String roleCode = roleService.getRoleCodeByUserId(userId);
+        List<CwjsCompanyApprovalUser> cwjsCompanyApprovalUserList = companyApprovalUserMapper.queryByUserId(userId);
+		List<CwjsPolicyInfo> cwjsPolicyInfoList = cwjsPolicyInfoService.queryPageList(cwjsPolicyInfo);
+		if(Check.isNull(cwjsPolicyInfoList)){
+			PageInfo<CwjsPolicyInfo> pageInfo = new PageInfo<>(cwjsPolicyInfoList);
+			return Result.successMsg("目前没有政策,请新增",pageInfo);
+		}
+        /**如果是管理员,就全部看,该搜索搜索,不搜索就全看*/
+
+        /**如果不是管理员,也不是审核人员。看自己和自己下属的所有政策。*/
+        if(!"admin".equalsIgnoreCase(roleCode) && !"finance".equalsIgnoreCase(roleCode) && Check.isNull(cwjsCompanyApprovalUserList)){
+//			Set<String> userIds= materialReportOverViewService.recursiveQuerySubordinate(userId);
+			List<String> userIds = cwjsPolicyInfoService.getAllSubordinate(userId);
+			List<CwjsPolicyInfo> removeList = new ArrayList<>();
+            cwjsPolicyInfoList.forEach(cwjsPolicy -> {
+                if(!userIds.contains(cwjsPolicy.getCreateUserId())){
+                    removeList.add(cwjsPolicy);
+                }
+            });
+            cwjsPolicyInfoList.removeAll(removeList);
+        }
+        /**如果不是管理员,是审核人员。看自己创建的和自己下属的所有政策、和该自己审核。*/
+        if(!"admin".equalsIgnoreCase(roleCode) && !"finance".equalsIgnoreCase(roleCode) && !Check.isNull(cwjsCompanyApprovalUserList)){
+//			Set<String> userIds= materialReportOverViewService.recursiveQuerySubordinate(userId);
+			List<String> userIds = cwjsPolicyInfoService.getAllSubordinate(userId);
+
+			List<CwjsPolicyInfo> removeList = new ArrayList<>();
+            cwjsPolicyInfoList.forEach(cwjsPolicy -> {
+                if(!userIds.contains(cwjsPolicy.getCreateUserId()) && !userId.equalsIgnoreCase(cwjsPolicy.getApprovedProgress())){
+                    removeList.add(cwjsPolicy);
+                }
+            });
+            cwjsPolicyInfoList.removeAll(removeList);
+        }
+
+
+		cwjsPolicyInfoList.sort((CwjsPolicyInfo o1, CwjsPolicyInfo o2) -> o2.getCreateTime().after(o1.getCreateTime()) ? 1 : -1 );
+		List<CwjsPolicyInfo> cwjsPolicyInfos = ListPageUtil.page(cwjsPolicyInfoList, pageSize, pageNo);
+
+		cwjsPolicyInfos.forEach(cwjsPolicy ->{
+			CwjsPolicyApprovalLog log = policyApprovalLogMapper.getOneByPolicyId(cwjsPolicy.getId());	//添加日志记录最新的第一条
+			if(!Check.isNull(log)){
+				cwjsPolicy.setApprovalContent(log.getApprovalContent());
+			}
+            cwjsPolicy.setOperation("查看");  //所有人只要能看到就能有查看的按钮
+			if(userId.equals(cwjsPolicy.getCreateUserId()) && cwjsPolicy.getApprovedStatus() == 4){ //创建人是自己且状态是审核拒绝的
+                cwjsPolicy.setOperation("查看|编辑|提交审核");
+            }
+
+			if(userId.equals(cwjsPolicy.getApprovedProgress()) && (cwjsPolicy.getApprovedStatus() == 1 || cwjsPolicy.getApprovedStatus() == 2)){
+                cwjsPolicy.setOperation("查看|审核通过|审核拒绝");
+            }
+
+			UserCompany userCompany = userCompanyService.getByUserId(cwjsPolicy.getCreateUserId());
+
+			if(!Check.isNull(userCompany) && Check.isNull(cwjsPolicy.getCreateUserName())){
+				cwjsPolicy.setCreateUserName(userCompany.getUserName());
+			}
+			CwjsCompanySubject cwjsCompanySubject = companySubjectService.getById(cwjsPolicy.getCompanySubjectId());
+			cwjsPolicy.setCompanySubjectName(cwjsCompanySubject.getCompanySubjectName());
+			cwjsPolicy.setAreaInfo(cwjsCompanySubject.getAreaInfo());
+		});
+		PageInfo<CwjsPolicyInfo> pageInfo = new PageInfo<>(cwjsPolicyInfos);
+		pageInfo.setTotal(cwjsPolicyInfoList.size());
+		pageInfo.setPageSize(pageSize);
+		pageInfo.setPageNum(pageNo);
+		return Result.successMsg("成功。",pageInfo);
+	}
+
+
+
+	@ApiOperation(value="政策信息表-获取当前公司的销售", notes="政策信息表-获取当前公司的销售")
+	@GetMapping(value = "/getAllSaleList")
+	public Result getAllSaleList(@RequestParam(name="userId",required=true) String userId){
+        String roleCode = roleService.getRoleCodeByUserId(userId);
+        List<JSONObject> allSaleList;
+        if("admin".equalsIgnoreCase(roleCode) || "finance".equalsIgnoreCase(roleCode)){
+            allSaleList = cwjsPolicyInfoService.getAllSale();
+        }else{
+            allSaleList = cwjsPolicyInfoService.getAllSaleByUserId(userId);
+        }
+		return Result.OK(allSaleList);
+	}
+
+	 /**
+	  * 获取当前用户的公司、区域、和主体
+	  * @param userId
+	  * @return
+	  */
+	 @ApiOperation(value="政策信息表-获取当前用户的公司、区域、和主体", notes="政策信息表-获取当前用户的公司、区域、和主体")
+	 @GetMapping(value = "/queryAeraByUserId")
+	 public Result<JSONArray> queryAeraByUserId(@RequestParam(name="userId",required=true) String userId) {
+		 Result<JSONArray> result = new Result<>();
+		 List<UserCompany> userCompany = userCompanyService.getAllByUserId(userId);
+		 JSONArray res = new JSONArray();
+		 userCompany.forEach(user -> {
+			 List<CwjsCompanySubject> companySubjects = companySubjectMapper.queryAllSubjectName();
+			 JSONObject jsonObject = new JSONObject();
+			 jsonObject.put("UserCompany",userCompany);
+			 jsonObject.put("companySubjects",companySubjects);
+			 res.add(jsonObject);
+		 });
+		 result.setSuccess(true);
+		 result.setResult(res);
+		 return result;
+	 }
+
+	/**
+	  *   添加
+	 * @param cwjsPolicyInfo
+	 * @return
+	 */
+	@ApiOperation(value="政策信息表-添加", notes="政策信息表-添加")
+	@PostMapping(value = "/add")
+	public Result<CwjsPolicyInfo> add(@RequestBody CwjsPolicyInfo cwjsPolicyInfo) {
+		Result<CwjsPolicyInfo> result = new Result<>();
+		try {
+			cwjsPolicyInfo.setApprovedStatus(1);	//新增出来的政策全部都是待审核状态
+			String companySubjectName = cwjsPolicyInfo.getCompanySubjectName();
+			String areaInfo = cwjsPolicyInfo.getAreaInfo();
+			Integer companySubjectId = companySubjectMapper.queryIdBySubjectNameAndArea(companySubjectName, areaInfo);
+			if(Check.isNull(companySubjectId)){
+				return  Result.errorMsg("您选择的区域和公司主体系统不支持,请联系开发人员开放");
+			}
+			cwjsPolicyInfo.setCompanySubjectId(companySubjectId);
+			List<CwjsCompanyApprovalUser> cwjsCompanyApprovalUsers = companyApprovalUserMapper.queryByCompanySubjectId(companySubjectId);
+			if(Check.isNull(cwjsCompanyApprovalUsers)){
+				return Result.errorMsg("此业务线暂时无审核人员,提交审核无效,请联系开发人员添加此区域主体的审核人员");
+			}
+			cwjsCompanyApprovalUsers.forEach(cwjsCompanyApprovalUser -> {
+				if(cwjsCompanyApprovalUser.getLevel() == 0){
+					cwjsPolicyInfo.setApprovedProgress(cwjsCompanyApprovalUser.getApprovalUserId());
+				}
+			});
+			cwjsPolicyInfoService.save(cwjsPolicyInfo);
+			JSONArray products = cwjsPolicyInfo.getPolicyProductName();
+			List<CwjsPolicyProduct> policyProductList = new ArrayList<>();
+			products.forEach(productName -> {
+				CwjsPolicyProduct policyProduct = new CwjsPolicyProduct();
+				policyProduct.setCreateUserId(cwjsPolicyInfo.getCreateUserId());
+				policyProduct.setDelFlag(0);
+				policyProduct.setPolicyProductName((String) productName);
+				policyProduct.setPolicyId(cwjsPolicyInfo.getId());
+				policyProductList.add(policyProduct);
+			});
+			cwjsPolicyProductService.saveBatch(policyProductList);
+			//先给first发企业微信 -- 先注释掉
+			JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId(cwjsPolicyInfo.getApprovedProgress());
+			StringBuilder text = new StringBuilder();
+			text.append("您有一条销售政策需要审核,该客户为:");
+			text.append(cwjsPolicyInfo.getCompanyName());
+			text.append(",请及时登录助手平台-销售政策页面进行审核,谢谢!");
+			corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId,text.toString());
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param cwjsPolicyInfo
+	 * @return
+	 */
+	@ApiOperation(value="政策信息表-编辑", notes="政策信息表-编辑")
+	@PostMapping(value = "/edit")
+	public Result<CwjsPolicyInfo> edit(@RequestBody CwjsPolicyInfo cwjsPolicyInfo) {
+		Result<CwjsPolicyInfo> result = new Result<CwjsPolicyInfo>();
+		CwjsPolicyInfo cwjsPolicyInfoEntity = cwjsPolicyInfoService.getById(cwjsPolicyInfo.getId());
+		if(cwjsPolicyInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			String companySubjectName = cwjsPolicyInfo.getCompanySubjectName();
+			String areaInfo = cwjsPolicyInfo.getAreaInfo();
+			Integer companySubjectId = companySubjectMapper.queryIdBySubjectNameAndArea(companySubjectName, areaInfo);
+			if(Check.isNull(companySubjectId)){
+				return  Result.errorMsg("您要修改的区域和公司主体系统不支持,请联系开发人员开放");
+			}
+			cwjsPolicyInfo.setCompanySubjectId(companySubjectId);
+			//删除旧的产品
+			cwjsPolicyProductService.deleteProductsByPolicyId(cwjsPolicyInfo.getId());
+			//保存新的产品
+			List<CwjsPolicyProduct> policyProductList = new ArrayList<>();
+			JSONArray products = cwjsPolicyInfo.getPolicyProductName();
+			products.forEach(productName -> {
+				CwjsPolicyProduct policyProduct = new CwjsPolicyProduct();
+				policyProduct.setCreateUserId(cwjsPolicyInfo.getCreateUserId());
+				policyProduct.setDelFlag(0);
+				policyProduct.setPolicyProductName((String) productName);
+				policyProduct.setPolicyId(cwjsPolicyInfo.getId());
+				policyProductList.add(policyProduct);
+			});
+			cwjsPolicyProductService.saveBatch(policyProductList);
+
+			boolean ok = cwjsPolicyInfoService.updateById(cwjsPolicyInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="政策信息表-通过id查询", notes="政策信息表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<CwjsPolicyInfo> queryById(@RequestParam(name="id",required=true) Integer id) throws ParseException {
+		Result<CwjsPolicyInfo> result = new Result<>();
+		CwjsPolicyInfo cwjsPolicyInfo = cwjsPolicyInfoService.getById(id);
+		Date startDate = DateUtils.parseDate(cwjsPolicyInfo.getPolicyStartDate(),"yyyy-MM-dd");
+		cwjsPolicyInfo.setPolicyStartDate(DateUtils.formatDate(startDate,"yyyy年MM月dd日"));
+		Date endDate = DateUtils.parseDate(cwjsPolicyInfo.getPolicyEndDate(),"yyyy-MM-dd");
+		cwjsPolicyInfo.setPolicyEndDate(DateUtils.formatDate(endDate,"yyyy年MM月dd日"));
+		List<CwjsPolicyProduct> policyProductList = cwjsPolicyProductService.queryProductsByPolicyId(id);
+		JSONArray jsonArr = new JSONArray();
+		policyProductList.forEach(policyProduct -> {
+			jsonArr.add(policyProduct.getPolicyProductName());
+		});
+		cwjsPolicyInfo.setPolicyProductName(jsonArr);
+		if(cwjsPolicyInfo==null) {
+			result.error500("未找到对应实体");
+		}else if(policyProductList==null){
+			result.error500("此政策的没有绑定产品,或者已绑定的产品被删除");
+		}else {
+			result.setResult(cwjsPolicyInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+
+
+	 /**
+	  *   通过id删除
+	  * @param id
+	  * @return
+	  */
+	 @ApiOperation(value="政策信息表-通过id删除", notes="政策信息表-通过id删除")
+	 @DeleteMapping(value = "/delete")
+	 public Result<?> delete(@RequestParam(name="id") String id) {
+		 try {
+			 cwjsPolicyInfoService.removeById(id);
+		 } catch (Exception e) {
+			 log.error("删除失败",e.getMessage());
+			 return Result.error("删除失败!");
+		 }
+		 return Result.ok("删除成功!");
+	 }
+
+	 /**
+	  *  批量删除
+	  * @param ids
+	  * @return
+	  */
+	 @ApiOperation(value="政策信息表-批量删除", notes="政策信息表-批量删除")
+	 @DeleteMapping(value = "/deleteBatch")
+	 public Result<CwjsPolicyInfo> deleteBatch(@RequestParam(name="ids") String ids) {
+		 Result<CwjsPolicyInfo> result = new Result<>();
+		 if(ids==null || "".equals(ids.trim())) {
+			 result.error500("参数不识别!");
+		 }else {
+			 this.cwjsPolicyInfoService.removeByIds(Arrays.asList(ids.split(",")));
+			 result.success("删除成功!");
+		 }
+		 return result;
+	 }
+
+
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<CwjsPolicyInfo> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              CwjsPolicyInfo cwjsPolicyInfo = JSON.parseObject(deString, CwjsPolicyInfo.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(cwjsPolicyInfo, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<CwjsPolicyInfo> pageList = cwjsPolicyInfoService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "政策信息表列表");
+      mv.addObject(NormalExcelConstants.CLASS, CwjsPolicyInfo.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("政策信息表列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<CwjsPolicyInfo> listCwjsPolicyInfos = ExcelImportUtil.importExcel(file.getInputStream(), CwjsPolicyInfo.class, params);
+              cwjsPolicyInfoService.saveBatch(listCwjsPolicyInfos);
+              return Result.ok("文件导入成功!数据行数:" + listCwjsPolicyInfos.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+
+  @GetMapping(value = "/weiXinNotice")
+  public Result weiXinNotice(){
+	  CwjsPolicyInfo cwjsPolicyInfo = new CwjsPolicyInfo();
+	  cwjsPolicyInfo.setApprovedStatus(1);
+	  //待审核的状态的 政策
+	  List<CwjsPolicyInfo> cwjsPolicyInfoListStatus1 = cwjsPolicyInfoService.queryPageList(cwjsPolicyInfo);
+	  cwjsPolicyInfoListStatus1.forEach(cwjsPolicy -> {
+		  JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId(cwjsPolicy.getApprovedProgress());
+		  StringBuilder text = new StringBuilder();
+		  text.append("您有一条销售政策需要审核,该客户为:");
+		  text.append(cwjsPolicy.getCompanyName());
+		  text.append(",请及时登录助手平台-销售政策页面进行审核,谢谢!");
+		  corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId,text.toString());
+	  });
+
+	  //审核中的状态的政策
+	  cwjsPolicyInfo.setApprovedStatus(2);
+	  List<CwjsPolicyInfo> cwjsPolicyInfoListStatus2 = cwjsPolicyInfoService.queryPageList(cwjsPolicyInfo);
+	  cwjsPolicyInfoListStatus2.forEach(cwjsPolicy -> {
+		  JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId(cwjsPolicy.getApprovedProgress());
+		  StringBuilder text = new StringBuilder();
+		  text.append("您有一条销售政策需要审核,该客户为:");
+		  text.append(cwjsPolicy.getCompanyName());
+		  text.append(",请及时登录助手平台-销售政策页面进行审核,谢谢!");
+		  corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId,text.toString());
+	  });
+
+	  //审核拒绝的状态的政策
+	  cwjsPolicyInfo.setApprovedStatus(4);
+	  List<CwjsPolicyInfo> cwjsPolicyInfoListStatus4 = cwjsPolicyInfoService.queryPageList(cwjsPolicyInfo);
+	  cwjsPolicyInfoListStatus4.forEach(cwjsPolicy -> {
+		  JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId(cwjsPolicy.getCreateUserId());
+		  StringBuilder text = new StringBuilder();
+		  text.append("您有一条销售政策审核未通过,该客户为:");
+		  text.append(cwjsPolicy.getCompanyName());
+		  text.append(",请及时登录助手平台-销售政策页面进行政策修改,谢谢!");
+		  corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId,text.toString());
+	  });
+
+  	return Result.OK();
+  }
+
+}

+ 95 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/DemoController.java

@@ -0,0 +1,95 @@
+package org.jeecg.ctop.finance.policy.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo;
+import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
+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.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ *
+ * @description: demo
+ *
+ * @author: zian Y
+ * @time: 2021/7/26
+ */
+@RestController
+@RequestMapping("/finance/policy")
+@Api(tags="头条-财务结算-demo")
+@Slf4j
+public class DemoController {
+
+
+    @Autowired
+    private ISettlementInfoService settlementInfoService;
+
+
+    @ApiOperation(value="demo", notes="demo")
+    @GetMapping(value = "/demo")
+    public String queryPageList() {
+
+        return "this is test controller!";
+    }
+
+
+
+    /**
+     * @description:测试 注解 @Dict  返回类型 为 IPage
+     *
+     * @return: org.jeecg.common.api.vo.Result<com.baomidou.mybatisplus.core.metadata.IPage<org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo>>
+     * @author: zianY
+     * @time: 2021/7/28 18:36
+     */
+    @ApiOperation(value="test", notes="test")
+    @GetMapping(value = "/test")
+    public Result<IPage<ctopCwjsSettlementInfo>> test(ctopCwjsSettlementInfo SettlementInfoPojo,
+                                                      @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                      @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                                      HttpServletRequest req) {
+        QueryWrapper<ctopCwjsSettlementInfo> queryWrapper = QueryGenerator.initQueryWrapper(SettlementInfoPojo, req.getParameterMap());
+        Page<ctopCwjsSettlementInfo> page = new Page<>(pageNo, pageSize);
+        IPage<ctopCwjsSettlementInfo> list = settlementInfoService.page(page, queryWrapper);
+        return Result.successMsg("chenggong.",list);
+    }
+
+
+    /**
+     *
+     * @description:  注解 @Dict 返回类型 为 PageInfo
+
+     * @return: org.jeecg.common.api.vo.Result<com.github.pagehelper.PageInfo<org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo>>
+     * @author: zianY
+     * @time: 2021/7/28 20:35
+     */
+   /* @ApiOperation(value="test2", notes="test2")
+    @GetMapping(value = "/test2")
+    public Result<PageInfo<ctopCwjsSettlementInfo>> test2(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                        @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
+        PageHelper.startPage(pageNo,pageSize);
+        List<ctopCwjsSettlementInfo> list = settlementInfoService.getSettlementList(null,pageNo,pageSize);
+        PageInfo<ctopCwjsSettlementInfo> pageInfo = new PageInfo<>(list);
+        return Result.successMsg("chenggong.",pageInfo);
+    }
+*/
+
+
+
+
+
+}

+ 61 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsCompanyApprovalUser.java

@@ -0,0 +1,61 @@
+package org.jeecg.ctop.finance.policy.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 政策审核人员配置
+ * @author jeecg-boot
+ * @date   2021-08-09
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_cwjs_company_approval_user")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_cwjs_company_approval_user对象", description="政策审核人员配置")
+public class CwjsCompanyApprovalUser {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**公司id*/
+	@Excel(name = "公司id", width = 15)
+    @ApiModelProperty(value = "公司id")
+	private String companySubjectId;
+	/**审核人员id*/
+	@Excel(name = "审核人员id", width = 15)
+    @ApiModelProperty(value = "审核人员id")
+	private String approvalUserId;
+	/**审核人员姓名*/
+	@Excel(name = "审核人员姓名", width = 15)
+    @ApiModelProperty(value = "审核人员姓名")
+	private String approvalUserName;
+	/**是否是终审(0:不是 ,1:是)*/
+	@Excel(name = "是否是终审(0:不是 ,1:是)", width = 15)
+    @ApiModelProperty(value = "是否是终审(0:不是 ,1:是)")
+	private Integer level;
+	/**删除状态(0,正常,1已删除)*/
+	@Excel(name = "删除状态(0,正常,1已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0,正常,1已删除)")
+	private Integer delFlag;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**更新时间*/
+    @ApiModelProperty(value = "更新时间")
+	private Date updateTime;
+}

+ 61 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsCompanySubject.java

@@ -0,0 +1,61 @@
+package org.jeecg.ctop.finance.policy.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 公司主体表
+ * @author jeecg-boot
+ * @date   2021-07-28
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_cwjs_company_subject")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_cwjs_company_subject对象", description="公司主体表")
+public class CwjsCompanySubject {
+    
+	/**主键自增*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键自增")
+	private Integer id;
+	/**公司id-区域*/
+	@Excel(name = "公司id-区域", width = 15)
+    @ApiModelProperty(value = "公司id-区域")
+	private String companyId;
+	/**公司主体名称*/
+	@Excel(name = "公司主体名称", width = 15)
+    @ApiModelProperty(value = "公司主体名称")
+	private String companySubjectName;
+	/**区域*/
+	@Excel(name = "区域", width = 15)
+	@ApiModelProperty(value = "区域")
+	private String areaInfo;
+	/**删除状态(0,正常,1已删除)*/
+	@Excel(name = "删除状态(0,正常,1已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0,正常,1已删除)")
+	private Integer delFlag;
+	/**创建人id*/
+	@Excel(name = "创建人id", width = 15)
+    @ApiModelProperty(value = "创建人id")
+	private String createUserId;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**更新时间*/
+    @ApiModelProperty(value = "更新时间")
+	private Date updateTime;
+}

+ 57 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyApprovalLog.java

@@ -0,0 +1,57 @@
+package org.jeecg.ctop.finance.policy.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 政策审批记录日志
+ * @author jeecg-boot
+ * @date   2021-07-28
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_cwjs_policy_approval_log")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_cwjs_policy_approval_log对象", description="政策审批记录日志")
+public class CwjsPolicyApprovalLog {
+    
+	/**主键自增*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键自增")
+	private Integer id;
+	/**policyId*/
+	@Excel(name = "policyId", width = 15)
+    @ApiModelProperty(value = "policyId")
+	private Integer policyId;
+	/**审核状态:0-审核通过  1-审核不通过*/
+	@Excel(name = "审核状态:0-审核通过  1-审核不通过", width = 15)
+    @ApiModelProperty(value = "审核状态:0-审核通过  1-审核不通过")
+	private Integer approvalStatus;
+	/**审核意见*/
+	@Excel(name = "审核意见", width = 15)
+    @ApiModelProperty(value = "审核意见")
+	private String approvalContent;
+	/**创建人id*/
+	@Excel(name = "创建人id", width = 15)
+    @ApiModelProperty(value = "创建人id")
+	private String createUserId;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**更新时间*/
+    @ApiModelProperty(value = "更新时间")
+	private Date updateTime;
+}

+ 152 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyInfo.java

@@ -0,0 +1,152 @@
+package org.jeecg.ctop.finance.policy.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 政策信息表
+ * @author jeecg-boot
+ * @date   2021-07-27
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_cwjs_policy_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_cwjs_policy_info对象", description="政策信息表")
+public class CwjsPolicyInfo {
+    
+	/**自增主键*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "自增主键")
+	private Integer id;
+	/**公司名称*/
+	@Excel(name = "公司名称", width = 15)
+    @ApiModelProperty(value = "公司名称")
+	private String companyName;
+	/**广告主id*/
+	@Excel(name = "广告主名称", width = 15)
+    @ApiModelProperty(value = "广告主名称")
+	private String advertiserName;
+	/**媒体类型*/
+	@Excel(name = "媒体类型", width = 15)
+    @ApiModelProperty(value = "媒体类型")
+	private Integer mediaType;
+	/**我司主体*/
+	@Excel(name = "我司主体", width = 15)
+    @ApiModelProperty(value = "我司主体")
+	private Integer companySubjectId;
+	/**集团简称*/
+	@Excel(name = "集团简称", width = 15)
+    @ApiModelProperty(value = "集团简称")
+	private String groupAbbreviation;
+	/**状态 0:待审核 1:审核中 2:审核通过3:审核拒绝*/
+	@Excel(name = "状态 0:待审核 1:审核中 2:审核通过3:审核拒绝", width = 15)
+    @ApiModelProperty(value = "状态 0:待审核 1:审核中 2:审核通过3:审核拒绝")
+	private Integer approvedStatus;
+	@ApiModelProperty(value = "审核进度,当前该谁审核")
+	private String approvedProgress;
+	/**是否预付:0:否  1:是 */
+	@Excel(name = "是否预付:0:否  1:是 ", width = 15)
+    @ApiModelProperty(value = "是否预付:0:否  1:是 ")
+	private Integer advancePay;
+	/**账期*/
+	@Excel(name = "账期", width = 15)
+    @ApiModelProperty(value = "账期")
+	private String accountingPeriod;
+	/**返点类型:0:返现  1:返货   2:返现+返货*/
+	@Excel(name = "返点类型:0:返现  1:返货   2:返现+返货", width = 15)
+    @ApiModelProperty(value = "返点类型:0:返现  1:返货   2:返现+返货")
+	private Integer rebateType;
+	/**返点比例*/
+	@Excel(name = "返点比例", width = 15)
+    @ApiModelProperty(value = "返点比例")
+	private java.math.BigDecimal rebateRate;
+	/**是否垫付:0:否  1:是 */
+	@Excel(name = "是否垫付:0:否  1:是 ", width = 15)
+    @ApiModelProperty(value = "是否垫付:0:否  1:是 ")
+	private Integer isDianPay;
+	/**垫付公司名称*/
+	@Excel(name = "垫付公司名称", width = 15)
+    @ApiModelProperty(value = "垫付公司名称")
+	private String dianPayCompanyName;
+	/**垫付公司返点比例*/
+	@Excel(name = "垫付公司返点比例", width = 15)
+    @ApiModelProperty(value = "垫付公司返点比例")
+	private java.math.BigDecimal dianPayCompanyRebateRate;
+	/**运营方式: 0:自运营  1:代运营*/
+	@Excel(name = "运营方式: 0:自运营  1:代运营", width = 15)
+    @ApiModelProperty(value = "运营方式: 0:自运营  1:代运营")
+	private Integer promotionType;
+	/**政策开始时间*/
+	@Excel(name = "政策开始时间", width = 15)
+    @ApiModelProperty(value = "政策开始时间")
+	private String policyStartDate;
+	/**政策结束时间*/
+	@Excel(name = "政策结束时间", width = 15)
+    @ApiModelProperty(value = "政策结束时间")
+	private String policyEndDate;
+	/**备注:如果没人填的话记录被拒次数*/
+	@Excel(name = "备注", width = 15)
+    @ApiModelProperty(value = "备注")
+	private Object remarks;
+	/**删除状态(0,正常,1已删除)*/
+	@Excel(name = "删除状态(0,正常,1已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0,正常,1已删除)")
+	private Integer delFlag;
+	/**销售人员(信息创建人)*/
+	@Excel(name = "创建人", width = 15)
+	@ApiModelProperty(value = "创建人")
+	private String createUserId;
+	@Excel(name = "创建人名字", width = 15)
+	@ApiModelProperty(value = "创建人名字")
+	private String createUserName;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**更新时间*/
+    @ApiModelProperty(value = "更新时间")
+	private Date updateTime;
+	/**接收前端传递的产品名称array*/
+	@TableField(exist = false)
+    private JSONArray policyProductName;
+	/**后端查询数据库后,sql映射时使用*/
+	@TableField(exist = false)
+	private String productName;
+
+	@TableField(exist = false)
+	private String startTime;
+	@TableField(exist = false)
+	private String endTime;
+	@TableField(exist = false)
+	private List<String> createUserIds;
+	@TableField(exist = false)
+	private List<Integer> companySubjectIds;
+	@TableField(exist = false)
+	private String approvalContent;
+	@TableField(exist = false)
+	private String operation;
+	@TableField(exist = false)
+	private String nickName;
+	@TableField(exist = false)
+	private String companySubjectName;
+
+	/**区域 华北,华南,华东*/
+	@TableField(exist = false)
+	private String areaInfo;
+}

+ 57 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/entity/CwjsPolicyProduct.java

@@ -0,0 +1,57 @@
+package org.jeecg.ctop.finance.policy.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 政策产品关系表
+ * @author jeecg-boot
+ * @date   2021-07-28
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_cwjs_policy_product")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_cwjs_policy_product对象", description="政策产品关系表")
+public class CwjsPolicyProduct {
+    
+	/**主键id*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键id")
+	private Integer id;
+	/**政策id*/
+	@Excel(name = "政策id", width = 15)
+    @ApiModelProperty(value = "政策id")
+	private Integer policyId;
+	/**产品名称*/
+	@Excel(name = "产品名称", width = 15)
+    @ApiModelProperty(value = "产品名称")
+	private String policyProductName;
+	/**删除状态(0,正常,1已删除)*/
+	@Excel(name = "删除状态(0,正常,1已删除)", width = 15)
+    @ApiModelProperty(value = "删除状态(0,正常,1已删除)")
+	private Integer delFlag;
+	/**创建人id*/
+	@Excel(name = "创建人id", width = 15)
+    @ApiModelProperty(value = "创建人id")
+	private String createUserId;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**更新时间*/
+    @ApiModelProperty(value = "更新时间")
+	private Date updateTime;
+}

+ 23 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsCompanyApprovalUserMapper.java

@@ -0,0 +1,23 @@
+package org.jeecg.ctop.finance.policy.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanyApprovalUser;
+
+/**
+ * 政策审核人员配置
+ * @author jeecg-boot
+ * 2021-08-09
+ * @version V1.0
+ */
+public interface CwjsCompanyApprovalUserMapper extends BaseMapper<CwjsCompanyApprovalUser> {
+    CwjsCompanyApprovalUser queryByCompanySubjectIdAndUserId(Integer companySubjectId, String userId);
+
+    List<CwjsCompanyApprovalUser> queryByUserId(String userId);
+
+    List<CwjsCompanyApprovalUser> queryByCompanySubjectId(Integer companySubjectId);
+
+    CwjsCompanyApprovalUser queryByCompanySubjectIdAndLevel(Integer companySubjectId, Integer level);
+}

+ 21 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsCompanySubjectMapper.java

@@ -0,0 +1,21 @@
+package org.jeecg.ctop.finance.policy.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject;
+
+/**
+ * 公司主体表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface CwjsCompanySubjectMapper extends BaseMapper<CwjsCompanySubject> {
+    List<CwjsCompanySubject> queryAllSubjectName();
+
+    List<CwjsCompanySubject>  queryByCompanyId(String companyId);
+
+    Integer queryIdBySubjectNameAndArea(String companySubjectName, String areaInfo);
+}

+ 17 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyApprovalLogMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.ctop.finance.policy.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyApprovalLog;
+
+/**
+ * 政策审批记录日志
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface CwjsPolicyApprovalLogMapper extends BaseMapper<CwjsPolicyApprovalLog> {
+    CwjsPolicyApprovalLog getOneByPolicyId(Integer policyId);
+}

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

@@ -0,0 +1,22 @@
+package org.jeecg.ctop.finance.policy.mapper;
+
+import java.util.List;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 政策信息表
+ * @author jeecg-boot
+ * 2021-07-27
+ * @version V1.0
+ */
+public interface CwjsPolicyInfoMapper extends BaseMapper<CwjsPolicyInfo> {
+    List<CwjsPolicyInfo> selectPolicyInfos(CwjsPolicyInfo policyInfo);
+
+    List<JSONObject> getAllSale();
+
+    List<JSONObject> getAllSaleByUserId(String userId);
+}

+ 19 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/mapper/CwjsPolicyProductMapper.java

@@ -0,0 +1,19 @@
+package org.jeecg.ctop.finance.policy.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
+
+/**
+ * 政策产品关系表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface CwjsPolicyProductMapper extends BaseMapper<CwjsPolicyProduct> {
+    List<CwjsPolicyProduct> queryProductsByPolicyId(Integer policyId);
+
+    void deleteProductsByPolicyId(Integer policyId);
+}

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

@@ -0,0 +1,16 @@
+<?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.finance.policy.mapper.CwjsCompanyApprovalUserMapper">
+    <select id="queryByCompanySubjectIdAndUserId" resultType="org.jeecg.ctop.finance.policy.entity.CwjsCompanyApprovalUser">
+        select * from ctop_cwjs_company_approval_user where company_subject_id = #{companySubjectId} and approval_user_id = #{userId}  limit 1
+    </select>
+    <select id="queryByUserId" resultType="org.jeecg.ctop.finance.policy.entity.CwjsCompanyApprovalUser">
+        select * from ctop_cwjs_company_approval_user where approval_user_id = #{userId}
+    </select>
+    <select id="queryByCompanySubjectId" resultType="org.jeecg.ctop.finance.policy.entity.CwjsCompanyApprovalUser">
+        select * from ctop_cwjs_company_approval_user where company_subject_id = #{companySubjectId}
+    </select>
+    <select id="queryByCompanySubjectIdAndLevel" resultType="org.jeecg.ctop.finance.policy.entity.CwjsCompanyApprovalUser">
+        select * from ctop_cwjs_company_approval_user where company_subject_id = #{companySubjectId} and level = #{level}
+    </select>
+</mapper>

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

@@ -0,0 +1,13 @@
+<?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.finance.policy.mapper.CwjsCompanySubjectMapper">
+    <select id="queryAllSubjectName" resultType="org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject">
+        select distinct company_subject_name from ctop_cwjs_company_subject
+    </select>
+    <select id="queryByCompanyId" resultType="org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject">
+        select * from ctop_cwjs_company_subject where company_id = #{companyId}
+    </select>
+    <select id="queryIdBySubjectNameAndArea" resultType="integer">
+        select id from ctop_cwjs_company_subject where company_subject_name = #{companySubjectName} and area_info = #{areaInfo}
+    </select>
+</mapper>

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

@@ -0,0 +1,7 @@
+<?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.finance.policy.mapper.CwjsPolicyApprovalLogMapper">
+    <select id="getOneByPolicyId" resultType="org.jeecg.ctop.finance.policy.entity.CwjsPolicyApprovalLog">
+        select * from ctop_cwjs_policy_approval_log where policy_id = #{policyId} and approval_status = 1 order by create_time desc LIMIT 1
+    </select>
+</mapper>

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

@@ -0,0 +1,61 @@
+<?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.finance.policy.mapper.CwjsPolicyInfoMapper">
+    <select id="selectPolicyInfos" resultType="org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo">
+        select t1.policy_product_name as productName,t2.* from ctop_cwjs_policy_product t1 LEFT JOIN ctop_cwjs_policy_info t2 on t1.policy_id = t2.id
+        where 1=1
+        <if test="companyName != null and companyName != ''">and t2.company_name like concat(concat('%',#{companyName}),'%')</if>
+        <if test="advertiserName != null and advertiserName != ''">and t2.advertiser_name like concat(concat('%',#{advertiserName}),'%')</if>
+        <if test="productName != null and productName != ''">and t1.policy_product_name like concat(concat('%',#{productName}),'%')</if>
+        <if test="dianPayCompanyName != null and dianPayCompanyName != ''">and t2.dian_pay_company_name like concat(concat('%',#{dianPayCompanyName}),'%')</if>
+        <if test="mediaType != null">and t2.media_type = #{mediaType}</if>
+        <if test="rebateType != null">and t2.rebate_type = #{rebateType}</if>
+        <if test="createUserId != null and createUserId != ''">and t2.create_user_id = #{createUserId}</if>
+        <if test="createUserName != null and createUserName != ''">and t2.create_user_name = #{createUserName}</if>
+        <if test="createUserIds != null and createUserIds != ''">and  t2.create_user_id in
+         <foreach item="item" index="index" collection="createUserIds" open="(" separator="," close=")">
+            #{item}
+        </foreach></if>
+        <if test="companySubjectIds != null and companySubjectIds != ''">and  t2.company_subject_id in
+            <foreach item="item" index="index" collection="companySubjectIds" open="(" separator="," close=")">
+                #{item}
+            </foreach></if>
+        <if test="promotionType != null">and t2.promotion_type = #{promotionType}</if>
+        <if test="approvedStatus != null and approvedStatus != ''">and t2.approved_status = #{approvedStatus}</if>
+        <if test="startTime != null and startTime != ''">and t2.create_time &gt;= #{startTime}</if>
+        <if test="endTime != null and endTime != ''">and t2.create_time &lt;= #{endTime}</if>
+        <if test="approvedProgress != null and approvedProgress != ''">and t2.approved_progress = #{approvedProgress}</if>
+        order by t2.create_time desc
+    </select>
+
+    <select id="getAllSale" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.user_id AS 'userId',
+	LEFT (t1.company_name, 2) AS 'companyName',
+	t3.role_name AS 'ruleName',
+	t1.user_name AS 'userName'
+        FROM
+            user_company t1
+            LEFT JOIN sys_user_role t2
+        ON t1.user_id = t2.user_id
+            LEFT JOIN sys_role t3 ON t2.role_id = t3.id
+        WHERE
+            t3.role_code IN (
+            'externalSale'
+            , 'saleDirector'
+            , 'sale'
+            , 'saleAssistant'
+            , 'salesSupportManager'
+            , 'saleAm'
+            )
+
+    </select>
+
+    <select id="getAllSaleByUserId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.create_user_id AS 'userId',
+	           t1.create_user_name AS 'userName'
+        FROM
+            ctop_cwjs_policy_info t1
+        WHERE
+            t1.approved_progress = #{userId} or t1.create_user_id = #{userId}
+    </select>
+</mapper>

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

@@ -0,0 +1,11 @@
+<?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.finance.policy.mapper.CwjsPolicyProductMapper">
+    <select id="queryProductsByPolicyId" resultType="org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct">
+        select * from ctop_cwjs_policy_product where policy_id = #{policyId} and del_flag = 0
+    </select>
+
+    <delete id="deleteProductsByPolicyId">
+        delete from ctop_cwjs_policy_product where policy_id = #{policyId}
+    </delete>
+</mapper>

+ 14 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsCompanyApprovalUserService.java

@@ -0,0 +1,14 @@
+package org.jeecg.ctop.finance.policy.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanyApprovalUser;
+
+/**
+ * 政策审核人员配置
+ * @author jeecg-boot
+ * 2021-08-09
+ * @version V1.0
+ */
+public interface ICwjsCompanyApprovalUserService extends IService<CwjsCompanyApprovalUser> {
+
+}

+ 14 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsCompanySubjectService.java

@@ -0,0 +1,14 @@
+package org.jeecg.ctop.finance.policy.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject;
+
+/**
+ * 公司主体表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface ICwjsCompanySubjectService extends IService<CwjsCompanySubject> {
+
+}

+ 14 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyApprovalLogService.java

@@ -0,0 +1,14 @@
+package org.jeecg.ctop.finance.policy.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyApprovalLog;
+
+/**
+ * 政策审批记录日志
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface ICwjsPolicyApprovalLogService extends IService<CwjsPolicyApprovalLog> {
+    CwjsPolicyApprovalLog getOneByPolicyId(Integer policyId);
+}

+ 25 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyInfoService.java

@@ -0,0 +1,25 @@
+package org.jeecg.ctop.finance.policy.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.system.entity.SysUser;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 政策信息表
+ * @author jeecg-boot
+ * 2021-07-27
+ * @version V1.0
+ */
+public interface ICwjsPolicyInfoService extends IService<CwjsPolicyInfo> {
+    List<CwjsPolicyInfo> queryPageList(CwjsPolicyInfo policyInfo);
+
+    List<JSONObject> getAllSale();
+
+    List<JSONObject> getAllSaleByUserId(String userId);
+
+    List<String> getAllSubordinate(String userId);
+}

+ 19 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICwjsPolicyProductService.java

@@ -0,0 +1,19 @@
+package org.jeecg.ctop.finance.policy.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
+
+import java.util.List;
+
+/**
+ * 政策产品关系表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+public interface ICwjsPolicyProductService extends IService<CwjsPolicyProduct> {
+
+    List<CwjsPolicyProduct> queryProductsByPolicyId(Integer policyId);
+
+    void deleteProductsByPolicyId(Integer policyId);
+}

+ 19 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsCompanyApprovalUserServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.ctop.finance.policy.service.impl;
+
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanyApprovalUser;
+import org.jeecg.ctop.finance.policy.mapper.CwjsCompanyApprovalUserMapper;
+import org.jeecg.ctop.finance.policy.service.ICwjsCompanyApprovalUserService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 政策审核人员配置
+ * @author jeecg-boot
+ * 2021-08-09
+ * @version V1.0
+ */
+@Service
+public class CwjsCompanyApprovalUserServiceImpl extends ServiceImpl<CwjsCompanyApprovalUserMapper, CwjsCompanyApprovalUser> implements ICwjsCompanyApprovalUserService {
+
+}

+ 19 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsCompanySubjectServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.ctop.finance.policy.service.impl;
+
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject;
+import org.jeecg.ctop.finance.policy.mapper.CwjsCompanySubjectMapper;
+import org.jeecg.ctop.finance.policy.service.ICwjsCompanySubjectService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 公司主体表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+@Service
+public class CwjsCompanySubjectServiceImpl extends ServiceImpl<CwjsCompanySubjectMapper, CwjsCompanySubject> implements ICwjsCompanySubjectService {
+
+}

+ 28 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyApprovalLogServiceImpl.java

@@ -0,0 +1,28 @@
+package org.jeecg.ctop.finance.policy.service.impl;
+
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyApprovalLog;
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyApprovalLogMapper;
+import org.jeecg.ctop.finance.policy.service.ICwjsPolicyApprovalLogService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import javax.annotation.Resource;
+
+/**
+ * 政策审批记录日志
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+@Service
+public class CwjsPolicyApprovalLogServiceImpl extends ServiceImpl<CwjsPolicyApprovalLogMapper, CwjsPolicyApprovalLog> implements ICwjsPolicyApprovalLogService {
+    @Resource
+    CwjsPolicyApprovalLogMapper policyApprovalLogMapper;
+
+    @Override
+    public CwjsPolicyApprovalLog getOneByPolicyId(Integer policyId){
+        return policyApprovalLogMapper.getOneByPolicyId(policyId);
+    }
+
+}

+ 101 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyInfoServiceImpl.java

@@ -0,0 +1,101 @@
+package org.jeecg.ctop.finance.policy.service.impl;
+
+import cn.com.ctop.common.module.mapper.SysUserMapper;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import org.jeecg.common.system.entity.SysUser;
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyInfoMapper;
+import org.jeecg.ctop.finance.policy.service.ICwjsPolicyInfoService;
+import org.jeecg.ctop.finance.policy.utils.Check;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * 政策信息表
+ * @author jeecg-boot
+ * 2021-07-27
+ * @version V1.0
+ */
+@Service
+public class CwjsPolicyInfoServiceImpl extends ServiceImpl<CwjsPolicyInfoMapper, CwjsPolicyInfo> implements ICwjsPolicyInfoService {
+    @Resource
+    CwjsPolicyInfoMapper policyInfoMapper;
+
+    @Override
+    public List<CwjsPolicyInfo> queryPageList(CwjsPolicyInfo policyInfo){
+
+        List<CwjsPolicyInfo> policyInfoList = policyInfoMapper.selectPolicyInfos(policyInfo);
+        List<CwjsPolicyInfo> result = new ArrayList<>();
+        //1.过滤所有已通过审核的政策到结果表中
+        policyInfoList.forEach(policy->{
+            if(policy.getApprovedStatus() == 3){
+                JSONArray policyProductName = new JSONArray();
+                policyProductName.add(policy.getProductName());
+                policy.setPolicyProductName(policyProductName);
+                result.add(policy);
+            }
+        });
+        policyInfoList.removeAll(result);
+        Map<Integer,CwjsPolicyInfo> map = new HashMap<>();
+        //2.未通过审核的政策需要通过政策id来进行聚合,把产品名称放到同一个列表里
+        policyInfoList.forEach(policy->{
+            if(map.containsKey(policy.getId())){
+                map.get(policy.getId()).getPolicyProductName().add(policy.getProductName());
+            }else{
+                JSONArray policyProductName = new JSONArray();
+                policyProductName.add(policy.getProductName());
+                policy.setPolicyProductName(policyProductName);
+                map.put(policy.getId(),policy);
+            }
+        });
+        //3.遍历聚合完成后的map,每一个key对应一条不通过的政策的数据,放入到结果集返回
+        Set<Integer> keys = map.keySet();
+        for(Integer key : keys){
+            result.add(map.get(key));
+        }
+
+
+        return result;
+    }
+
+    @Override
+    public List<JSONObject> getAllSale(){
+        return policyInfoMapper.getAllSale();
+    }
+
+    @Override
+    public List<JSONObject> getAllSaleByUserId(String userId){
+        return policyInfoMapper.getAllSaleByUserId(userId);
+    }
+
+
+    @Autowired
+    private SysUserMapper userMapper;
+    @Override
+    public List<String> getAllSubordinate(String userId){
+        List<SysUser> allList = userMapper.selectAllUser();
+        List<SysUser> mulUserList = treeCategoryData(allList, userId);
+        List<String> userIds = new ArrayList<>();
+        userIds.add(userId);
+        mulUserList.forEach(mulUser -> userIds.add(mulUser.getId()));
+        return userIds;
+    }
+    public List<SysUser> treeCategoryData(List<SysUser> allList, String leaderId) {
+        List<SysUser> mapList = new ArrayList<>();
+        for (SysUser vo : allList) {
+            if (leaderId.equals(vo.getLeaderId())){
+                mapList.add(vo);
+                mapList.addAll(treeCategoryData(allList,vo.getId()));
+            }
+        }
+        return mapList;
+
+    }
+}

+ 34 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CwjsPolicyProductServiceImpl.java

@@ -0,0 +1,34 @@
+package org.jeecg.ctop.finance.policy.service.impl;
+
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyProductMapper;
+import org.jeecg.ctop.finance.policy.service.ICwjsPolicyProductService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 政策产品关系表
+ * @author jeecg-boot
+ * 2021-07-28
+ * @version V1.0
+ */
+@Service
+public class CwjsPolicyProductServiceImpl extends ServiceImpl<CwjsPolicyProductMapper, CwjsPolicyProduct> implements ICwjsPolicyProductService {
+    @Resource
+    CwjsPolicyProductMapper policyProductMapper;
+
+    @Override
+    public List<CwjsPolicyProduct> queryProductsByPolicyId(Integer policyId){
+        return policyProductMapper.queryProductsByPolicyId(policyId);
+    }
+
+
+    @Override
+    public void deleteProductsByPolicyId(Integer policyId){
+        policyProductMapper.deleteProductsByPolicyId(policyId);
+    }
+}

+ 149 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/utils/Check.java

@@ -0,0 +1,149 @@
+package org.jeecg.ctop.finance.policy.utils;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+public class Check {
+    private Check() {
+    }
+
+    public static boolean isNull(List<?> list) {
+        return list == null || list.isEmpty();
+    }
+
+    public static boolean isNull(Long l) {
+        return l == null || l == 0;
+    }
+
+    public static boolean isNull(Collection<?> collection) {
+        return collection == null || collection.isEmpty();
+    }
+
+    public static boolean isNull(JSONArray jsonArray) {
+        return jsonArray == null || jsonArray.isEmpty();
+    }
+
+
+    public static boolean isNull(String str) {
+        return str == null || str.isEmpty();
+    }
+
+    public static boolean isNull(byte[] bytes) {
+        return bytes == null || bytes.length == 0;
+    }
+
+    public static boolean hasNull(Object... objects) {
+        for (Object obj : objects) {
+            if (obj == null) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static boolean allEmpty(String... strs) {
+        for (String str : strs) {
+            if (StringUtils.isNotEmpty(str)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static boolean isNull(Object object) {
+        return object == null;
+    }
+
+    public static boolean isNullMap(Map<?, ?> map) {
+        return map == null || map.isEmpty();
+    }
+
+
+    /**
+     * 移除 JSONObject 中 value 为空的 key
+     * @param
+     * @return
+     */
+    public static JSONObject jsonRemoveEmpty(JSONObject jsonObject){
+        JSONObject jsonResult = new JSONObject();
+        for (Object key :jsonObject.keySet() ) {
+            if (!Check.isNull(jsonObject.get(key)) && !jsonObject.get(key).equals("")){
+                jsonResult.put(key.toString(), jsonObject.get(key));
+            }
+        }
+        return jsonResult;
+    }
+
+
+
+    /**
+     * 将 Map对象转化为JavaBean
+     * @author loulan
+     * @param map
+     * @return Object对象
+     */
+    public static <T> T convertMap2Bean(Map map, Class T) throws Exception {
+        if(map==null || map.size()==0){
+            return null;
+        }
+        BeanInfo beanInfo = Introspector.getBeanInfo(T);
+        T bean = (T)T.newInstance();
+        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+        for (int i = 0, n = propertyDescriptors.length; i <n ; i++) {
+            PropertyDescriptor descriptor = propertyDescriptors[i];
+            String propertyName = descriptor.getName();
+            //将字母大写,这里先注掉,因为本例子直接读取名字匹配即可。
+            //String upperPropertyName = propertyName.toUpperCase();
+            if (map.containsKey(propertyName)) {
+                Object value = map.get(propertyName);
+                //这个方法不会报参数类型不匹配的错误。
+                BeanUtils.copyProperty(bean, propertyName, value);
+                //用这个方法对int等类型会报参数类型不匹配错误,需要我们手动判断类型进行转换,比较麻烦。
+                //descriptor.getWriteMethod().invoke(bean, value);
+                //用这个方法对时间等类型会报参数类型不匹配错误,也需要我们手动判断类型进行转换,比较麻烦。
+                //BeanUtils.setProperty(bean, propertyName, value);
+            }
+        }
+        return bean;
+    }
+
+    /**
+     * 将 List<Map>对象转化为List<JavaBean>
+     * @author loulan
+
+     * @return Object对象
+     */
+    public static <T> List<T> convertListMap2ListBean(List<Map<String,Object>> listMap, Class T) throws Exception {
+        List<T> beanList = new ArrayList<T>();
+        for(int i=0, n=listMap.size(); i<n; i++){
+            Map<String,Object> map = listMap.get(i);
+            T bean = convertMap2Bean(map,T);
+            beanList.add(bean);
+        }
+        return beanList;
+    }
+
+
+    public static void main(String[] args) {
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", "123");
+        params.put("campaign_id", "123");
+        params.put("modify_time", null);
+        System.out.println(jsonRemoveEmpty(params));
+    }
+
+
+
+}

+ 19 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/utils/ListPageUtil.java

@@ -0,0 +1,19 @@
+package org.jeecg.ctop.finance.policy.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ListPageUtil {
+
+    public static <T> List<T> page(List<T> dataList, int pageSize, int currentPage) {
+        List<T> currentPageList = new ArrayList<>();
+        if (dataList != null && dataList.size() > 0) {
+            int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
+            for (int i = 0; i < pageSize && i < dataList.size() - currIdx; i++) {
+                T data = dataList.get(currIdx + i);
+                currentPageList.add(data);
+            }
+        }
+        return currentPageList;
+    }
+}

+ 242 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/DemoReportController.java

@@ -0,0 +1,242 @@
+package org.jeecg.ctop.finance.settlement.controller;
+
+import cn.afterturn.easypoi.cache.manager.POICacheManager;
+import cn.afterturn.easypoi.entity.ImageEntity;
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo;
+import org.jeecg.ctop.finance.settlement.service.IReportSettlementService;
+import org.jeecg.ctop.finance.settlement.service.serviceImpl.FileLoaderImpl;
+import org.jeecg.ctop.finance.utils.SettlementUtil;
+import org.jeecg.ctop.finance.utils.createExcelByTemplate;
+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;
+
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 导出 结算单 利润表
+ * Administrator
+ * 2021/7/28
+ **/
+
+@Slf4j
+@RestController
+@RequestMapping("/exportReportDemoController")
+public class DemoReportController {
+
+    @Autowired
+    private IReportSettlementService reportSettlementService;
+
+    @ApiOperation(value="财务结算-结算单导出", notes="财务结算-结算单导出")
+    @GetMapping(value = "/exportSettlementReport")
+    public Result exportSettlementReport(HttpServletResponse response) {
+
+       // byte[] img = SettlementUtil.getByteImgByUrl("https://media-1301855440.cos.ap-chongqing.myqcloud.com/image/2021-08-05/2-1628129040416.jpg");
+
+        List<SettlementReportBytedanceVo> list = reportSettlementService.getAccountTransactionDayBytedance();
+
+
+
+        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("这是表头", "这是sheet名称"), SettlementReportBytedanceVo.class, list);
+
+
+        try {
+            response.setCharacterEncoding("UTF-8");
+            response.setHeader("content-Type", "application/vnd.ms-excel");
+            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("文件名称.xlsx", "UTF-8"));
+            workbook.write(response.getOutputStream());
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+
+
+       return null;
+    }
+
+
+
+    @ApiOperation(value="财务结算-模板结算单导出", notes="财务结算-模板结算单导出")
+    @GetMapping(value = "/exportImg")
+    public String exportImg(HttpServletResponse response) throws Exception {
+
+       // byte[] img = SettlementUtil.getByteImgByUrl("https://media-1301855440.cos.ap-chongqing.myqcloud.com/image/2021-08-05/2-1628129040416.jpg");
+
+        TemplateExportParams params = new TemplateExportParams("C://Users//Administrator//Desktop//bytedance.xlsx",true);
+       // params.setSheetName("这是sheet名称");
+        params.setSheetName(new String[]{"这是sheet名称1","这是sheet名称2"});
+
+        // 重要代码
+        //POICacheManager.setFileLoader(new FileLoaderImpl());
+        POICacheManager.setFileLoder(new FileLoaderImpl());
+
+        Map<String, Object> map = new HashMap<String, Object>();
+        List<SettlementReportBytedanceVo> list = reportSettlementService.getAccountTransactionDayBytedance();
+        List<Map<String, Object>> pictureList = new ArrayList<Map<String, Object>>() ;
+
+        Map<String,Object> picture1 = new HashMap<String, Object>();
+        Map<String,Object> picture2 = new HashMap<String, Object>();
+       byte[] datas =  SettlementUtil.getByteImgByUrl("https://media-1301855440.cos.ap-chongqing.myqcloud.com/image/2021-08-05/2-1628129040416.jpg");
+        ImageEntity img = new ImageEntity();
+        img.setUrl("https://media-1301855440.cos.ap-chongqing.myqcloud.com/image/2021-08-05/2-1628129040416.jpg");
+        //img.setUrl("C:\\Users\\Administrator\\Desktop\\汇创\\20210507161223.jpg");
+        img.setHeight(1000);
+        img.setWidth(500);
+        picture1.put("imag", img);
+        picture2.put("imag", img);
+        pictureList.add(picture1);
+        pictureList.add(picture2);
+
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("l",list);
+        resultMap.put("p",pictureList);
+
+        try {
+            Workbook workbook = ExcelExportUtil.exportExcel(params, resultMap);
+            response.setCharacterEncoding("UTF-8");
+            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+            response.setHeader("Pragma", "no-cache");
+            response.setHeader("Cache-Control", "no-cache");
+            response.setDateHeader("Expires", 0);
+            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("文件名称.xlsx", "UTF-8"));
+            OutputStream output = response.getOutputStream();
+            BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
+            workbook.write(bufferedOutPut);
+            bufferedOutPut.flush();
+            bufferedOutPut.close();
+            output.close();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+
+       return "123";
+    }
+
+
+    @ApiOperation(value="财务结算-结算单导出", notes="财务结算-结算单导出")
+    @GetMapping(value = "/demo")
+    public String demo(HttpServletResponse response) throws Exception {
+        //第一步创建workbook
+        HSSFWorkbook wb = new HSSFWorkbook();
+
+        HSSFCellStyle style = wb.createCellStyle();
+        style.setAlignment(HorizontalAlignment.CENTER);//水平居中
+
+        HSSFFont font = wb.createFont();
+        font.setFontName("黑体");
+        font.setFontHeightInPoints((short) 12);//设置字体大小
+        style.setFont(font);
+
+        //第二步创建sheet
+        HSSFSheet sheet = wb.createSheet("账户id");
+
+        sheet.autoSizeColumn(1,true);
+
+        HSSFRow row1 = sheet.createRow(0);
+        HSSFCell cell1 = row1.createCell(0);     //第一个单元格
+        cell1.setCellValue("头条");         //设定值
+        CellRangeAddress region = new CellRangeAddress(0, 0, 0, 1);
+        sheet.addMergedRegion(region);
+        cell1.setCellStyle(style);
+
+        //第三步创建行row:添加表头0行
+        HSSFRow row = sheet.createRow(1);
+
+        //第四步创建单元格
+        HSSFCell cell = row.createCell(0);     //第一个单元格
+        cell.setCellValue("测试1");         //设定值
+        cell.setCellStyle(style);          //内容居中
+
+        cell = row.createCell(1);          //第二个单元格
+        cell.setCellValue("测试2");
+        cell.setCellStyle(style);
+
+        List<SettlementReportBytedanceVo> list = reportSettlementService.getAccountTransactionDayBytedance();
+        for (int i = 0; i < list.size(); i++) {
+            SettlementReportBytedanceVo vo = list.get(i);
+            //创建行
+            row = sheet.createRow(i+2);
+            row.setRowStyle(style);
+            //创建单元格并且添加数据
+            row.createCell(0).setCellValue(vo.getAdvertiserId());
+            row.createCell(1).setCellValue(vo.getDate());
+        }
+
+        FileOutputStream fileOut = null;
+        BufferedImage bufferImg = null;
+
+        //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
+        ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
+        //bufferImg = ImageIO.read(new File("C:\\Users\\Administrator\\Desktop\\汇创\\20210507161223.jpg"));
+        //bufferImg = ImageIO.read(new File(URLDecoder.decode("https://media-1301855440.cos.ap-chongqing.myqcloud.com/image/2021-08-05/2-1628129040416.jpg","utf-8")));
+        String imagePath = "https://media-1301855440.cos.ap-chongqing.myqcloud.com/image/2021-08-05/2-1628129040416.jpg";
+        //InputStream is = new FileInputStream(imagePath);
+        InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
+        bufferImg = ImageIO.read(is);
+
+        ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".")+1), byteArrayOut);
+
+        //画图的顶级管理器,一个sheet只能获取一个
+        HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
+        //anchor主要用于设置图片的属性
+        //HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255,(short) 1, 1, (short) 5, 8);
+        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255,(short) 5, list.size()+6, (short) 10, 40);
+        HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255,(short) 5, list.size()+40, (short) 10, 40*2);
+        anchor.setAnchorType(3);
+        //插入图片
+        patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
+        patriarch.createPicture(anchor2, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
+
+
+        response.setCharacterEncoding("UTF-8");
+        response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+        response.setHeader("Pragma", "no-cache");
+        response.setHeader("Cache-Control", "no-cache");
+        response.setDateHeader("Expires", 0);
+        response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("文件名称.xlsx", "UTF-8"));
+        OutputStream output = response.getOutputStream();
+        BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
+        wb.write(bufferedOutPut);
+        bufferedOutPut.flush();
+        bufferedOutPut.close();
+        output.close();
+       return "123";
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        File file1 = new File("C:\\Users\\Administrator\\Desktop\\汇创\\20210507161223.jpg");
+        File file2 = new File("https://media-1301855440.cos.ap-chongqing.myqcloud.com/image/2021-08-05/2-1628129040416.jpg");
+        System.out.println(file1.exists());
+        System.out.println(file2.exists());
+
+        //BufferedImage bufferImg = ImageIO.read(new File("media-1301855440\\u002Ecos\\u002Eap-chongqing\\u002Emyqcloud\\u002Ecom/image/2021-08-05/2-1628129040416.jpg"));
+       //String imagePath = "https:\\/\\/media-1301855440.cos.ap-chongqing.myqcloud.com"+File.separator+"image"+File.separator+"2021-08-05"+File.separator+"2-1628129040416.jpg";
+        String imagePath = "https://media-1301855440.cos.ap-chongqing.myqcloud.com/image/2021-08-05/2-1628129040416.jpg";
+        System.out.println(imagePath);
+        //InputStream is = new FileInputStream(imagePath);
+        InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
+        System.out.println(is);
+
+    }
+
+}

+ 74 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/ExportReportController.java

@@ -0,0 +1,74 @@
+package org.jeecg.ctop.finance.settlement.controller;
+
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
+import org.jeecg.ctop.finance.settlement.service.IReportSettlementService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * 导出 结算单 利润表
+ * Administrator
+ * 2021/7/28
+ **/
+
+@Slf4j
+@RestController
+@RequestMapping("/exportReportController")
+public class ExportReportController {
+
+    @Autowired
+    private IReportSettlementService reportSettlementService;
+
+
+    @ApiOperation(value = "财务结算-结算单导出-头条", notes = "财务结算-结算单导出-头条")
+    @GetMapping(value = "/settlementReportBytedance")
+    public Result settlementReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
+
+        return reportSettlementService.settlementReportBytedance(paramsVo,response);
+
+    }
+
+
+    @ApiOperation(value = "财务结算-结算单导出-快手", notes = "财务结算-结算单导出-快手")
+    @GetMapping(value = "/settlementReportKuaiShou")
+    public Result settlementReportKuaiShou(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
+
+        return reportSettlementService.settlementReportKuaiShou(paramsVo,response);
+
+    }
+
+
+
+    @ApiOperation(value = "财务结算-利润表导出-头条", notes = "财务结算-利润表导出-头条")
+    @GetMapping(value = "/porfitReportBytedance")
+    public Result porfitReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
+
+        return reportSettlementService.porfitReportBytedance(paramsVo,response);
+
+    }
+
+
+    @ApiOperation(value = "财务结算-利润表导出-快手", notes = "财务结算-利润表导出-快手")
+    @GetMapping(value = "/porfitReportKuaiShou")
+    public Result porfitReportKuaiShou(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
+
+        return reportSettlementService.porfitReportKuaiShou(paramsVo,response);
+
+    }
+
+
+    @ApiOperation(value = "财务结算-给运营发送消息", notes = "财务结算-给运营发送消息")
+    @GetMapping(value = "/sendMessageToOperate")
+    public Result sendMessageToOperate(@RequestParam(value = "userId",required = false) String userId) {
+        return reportSettlementService.sendMessageToOperate(userId);
+
+    }
+
+
+}

+ 89 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/SettlementController.java

@@ -0,0 +1,89 @@
+package org.jeecg.ctop.finance.settlement.controller;
+
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.policy.utils.Check;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo;
+
+
+import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
+import org.jeecg.modules.ctop.service.IMaterialReportOverViewService;
+import org.jeecg.modules.system.service.ISysRoleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.HashSet;
+import java.util.Set;
+
+
+/**
+ * Administrator
+ * 2021/7/28
+ **/
+
+@Slf4j
+@RestController
+@RequestMapping("/settLementController")
+public class SettlementController {
+
+    @Autowired
+    private ISettlementInfoService settlementInfoService;
+
+    @Autowired
+    private ISysRoleService sysRoleService;
+
+
+    @Autowired
+    private IMaterialReportOverViewService materialReportOverViewService;
+
+    @ApiOperation(value="财务结算-账户列表查询", notes="财务结算-账户列表查询")
+    @GetMapping(value = "/getSettlementList")
+    public Result getSettlementList(ctopCwjsSettlementInfo settlementInfo,
+                                                                      @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                                      @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
+        //查询用户角色
+        String roleCode = sysRoleService.getRoleCodeByUserId(settlementInfo.getCreateUserId());
+        //普通用户
+        settlementInfo.setUserIds(new HashSet<String>(){{
+            add(settlementInfo.getCreateUserId());
+        }});
+        if ("admin".equals(roleCode)){
+            settlementInfo.setUserIds(null);
+            //销售总监
+        }else if ("saleDirector".equals(roleCode)){
+            //查询所有包含自己的下级
+            Set<String> subordinates= materialReportOverViewService.recursiveQuerySubordinate(settlementInfo.getCreateUserId());
+            settlementInfo.setUserIds(subordinates);
+        }
+       return settlementInfoService.getSettlementList(settlementInfo,pageNo,pageSize);
+    }
+
+
+    @ApiOperation(value="财务结算-修改账户状态账户(0-开 1-关)", notes="财务结算-修改账户状态账户(0-开 1-关)")
+    @GetMapping(value = "/updSettlementStatusById")
+    public Result updSettlementStatusById(@RequestParam Long id,@RequestParam Integer status) {
+       return settlementInfoService.updSettlementStatusById(id,status);
+    }
+
+
+    @ApiOperation(value="财务结算-删除", notes="财务结算-删除")
+    @GetMapping(value = "/deleteSettlementById")
+    public Result deleteSettlementById(@RequestParam Long id) {
+       return settlementInfoService.deleteSettlementById(id);
+    }
+
+
+    @ApiOperation(value="财务结算-上传账户", notes="财务结算-上传账户")
+    @PostMapping("/settlementAccountImport")
+    public Result settlementAccountImport(ctopCwjsSettlementInfo settlementInfo,@RequestParam("file") MultipartFile files) {
+
+        if (files.isEmpty()){
+            return Result.errorMsg("附件不能为空!");
+        }
+        return settlementInfoService.settlementAccountImport(settlementInfo,files);
+    }
+
+
+}

+ 114 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/SettlementFileController.java

@@ -0,0 +1,114 @@
+package org.jeecg.ctop.finance.settlement.controller;
+
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.policy.utils.Check;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementFileInfo;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
+import org.jeecg.ctop.finance.settlement.service.ISettlementFileInfoService;
+import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
+import org.jeecg.modules.ctop.service.IMaterialReportOverViewService;
+import org.jeecg.modules.system.service.ISysRoleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * Administrator
+ * 2021/7/28
+ **/
+
+@Slf4j
+@RestController
+@RequestMapping("/settLementFileController")
+public class SettlementFileController {
+
+    @Autowired
+    private ISettlementFileInfoService settlementFileInfoService;
+
+
+    @Autowired
+    private ISysRoleService sysRoleService;
+
+
+    @Autowired
+    private IMaterialReportOverViewService materialReportOverViewService;
+
+
+
+    @ApiOperation(value="结算单-结算单列表查询", notes="结算单-结算单列表查询")
+    @GetMapping(value = "/getSettlementSheetList")
+    public Result<PageInfo<Map<String,String>>> getSettlementSheetList(SettlementFileParamsVo paramsVo,
+                                                                       @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                                       @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
+        //查询用户角色
+        String roleCode = sysRoleService.getRoleCodeByUserId(paramsVo.getCreateUserId());
+
+        if ("admin".equals(roleCode)){
+            paramsVo.setOperatorUserIds(null);
+            paramsVo.setSaleUserIds(null);
+         //运营经理   touTiaoOperationManager-头条运营经理   kuaishouOperationManager-快手运营经理
+        }else if (roleCode.contains("OperationManager")){
+            //查询所有包含自己的下级
+            Set<String> operatorUserIds= materialReportOverViewService.recursiveQuerySubordinate(paramsVo.getCreateUserId());
+            paramsVo.setOperatorUserIds(operatorUserIds);
+        //运营助理 || 运营专员
+        }else if("operationAssistant".equals(roleCode) || "operator".equals(roleCode)){
+            paramsVo.setOperatorUserIds(new HashSet<String>(){{
+                add(paramsVo.getCreateUserId());
+            }});
+        //销售总监 || 销售支持经理
+        }else if("saleDirector".equals(roleCode) || "salesSupportManager".equals(roleCode)){
+            Set<String> saleUserIds= materialReportOverViewService.recursiveQuerySubordinate(paramsVo.getCreateUserId());
+            paramsVo.setSaleUserIds(saleUserIds);
+            //外部销售 || 销售AM || 销售助理 || 销售
+        }else if ("externalSale".equals(roleCode) || "saleAm".equals(roleCode) || "saleAssistant".equals(roleCode) || "sale".equals(roleCode)){
+            paramsVo.setSaleUserIds(new HashSet<String>(){{
+                add(paramsVo.getCreateUserId());
+            }});
+        }
+       return settlementFileInfoService.getSettlementSheetList(paramsVo,pageNo,pageSize);
+    }
+
+
+    @ApiOperation(value="结算单-删除", notes="结算单-删除")
+    @GetMapping(value = "/deleteSettlementFile")
+    public Result deleteSettlementFile(SettlementFileParamsVo paramsVo) {
+        return settlementFileInfoService.deleteSettlementFile(paramsVo);
+    }
+
+
+
+    @ApiOperation(value="结算单-账户截图上传", notes="结算单-账户截图上传")
+    @PostMapping(value = "/insertAccountImages")
+    public Result insertAccountImages(@RequestBody ctopCwjsSettlementFileInfo settlementFileInfo) {
+        if (Check.isNull(settlementFileInfo.getSettlementList())){
+            return Result.errorMsg("账户截图不能为空!");
+        }
+        return settlementFileInfoService.insertAccountImages(settlementFileInfo);
+    }
+
+
+    @ApiOperation(value="结算单-查询账户数量以及图片数量", notes="结算单-查询账户数量以及图片数量")
+    @PostMapping(value = "/getAccountNumAndImgNum")
+    public Result getAccountNumAndImgNum(@RequestBody SettlementFileParamsVo paramsVo) {
+        return settlementFileInfoService.getAccountNumAndImgNum(paramsVo);
+    }
+
+
+
+
+
+
+
+
+}

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

@@ -0,0 +1,112 @@
+package org.jeecg.ctop.finance.settlement.entity.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 财务结算 结算单信息
+ * zian Y
+ * 2021/7/28
+ **/
+
+@Data
+public class ctopCwjsSettlementFileInfo implements Serializable {
+
+    @TableId(type = IdType.AUTO)
+    /**
+     * 主键id
+     */
+    //@TableField(exist = false)
+    private Long id;
+
+    /**
+     * 广告主公司id
+     */
+    //@Dict(dicCode = "id", dictTable = "ctop_advertiser", dicText = "name")
+    private String advertiserId;
+    @TableField(exist = false)
+    private String advertiserName;
+
+    /**
+     * 产品id
+     */
+    private String productId;
+    @TableField(exist = false)
+    private String productName;
+
+    @TableField(exist = false)
+    private String projectName;
+
+    @TableField(exist = false)
+    private String accountName;
+
+    @TableField(exist = false)
+    private String saleUserId;
+
+    /**
+     * 年-月
+     */
+    private String uploadYears;
+
+    /**
+     * 媒体类型 1-头条 2-快手 3-头条内广 4-快手内广
+     */
+    private Integer mediaId;
+
+    /**
+     * 文件md5
+     */
+    private String signature;
+
+    /**
+     * 文件路径
+     */
+    private String fileUrl;
+
+    /**
+     * 文件名称
+     */
+    private String fileName;
+
+    /**
+     * 账户id
+     */
+    private String accountId;
+
+
+    /**
+     * 删除状态(0,正常,1已删除)
+     */
+    private Integer delFlag;
+
+    /**
+     * 创建人id
+     */
+    private String createUserId;
+    @TableField(exist = false)
+    private String createUserName;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    @TableField(exist = false)
+    private String startTime;
+    @TableField(exist = false)
+    private String endTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private List<ctopCwjsSettlementFileInfo> settlementList;
+
+}

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

@@ -0,0 +1,110 @@
+package org.jeecg.ctop.finance.settlement.entity.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import org.jeecg.common.aspect.annotation.Dict;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * 财务结算 账户信息
+ * zian Y
+ * 2021/7/28
+ **/
+
+@Data
+public class ctopCwjsSettlementInfo implements Serializable {
+
+    @TableId(type = IdType.AUTO)
+    /**
+     * 主键id
+     */
+    //@TableField(exist = false)
+    private Long id;
+
+    /**
+     * 广告主公司id
+     */
+    //@Dict(dicCode = "id", dictTable = "ctop_advertiser", dicText = "name")
+    private String advertiserId;
+    @TableField(exist = false)
+    private String advertiserName;
+
+    /**
+     * 产品id
+     */
+    private String productId;
+    @TableField(exist = false)
+    private String productName;
+
+    /**
+     * 项目id
+     */
+    private String projectId;
+    @TableField(exist = false)
+    private String projectName;
+
+    /**
+     * 媒体类型 1-头条 2-快手 3-头条内广 4-快手内广
+     */
+    private Integer mediaId;
+
+    /**
+     * 运营方式 1-自运营 2-代运营
+     */
+    private Integer operateType;
+
+    /**
+     * 账户id
+     */
+    private String accountId;
+
+    /**
+     * 账户名称
+     */
+    private String accountName;
+
+    /**
+     * 快手id
+     */
+    private String kuaiShouId;
+
+    /**
+     * 账户状态 0-开 1-关
+     */
+    private Integer status;
+
+    /**
+     * 删除状态(0,正常,1已删除)
+     */
+    private Integer delFlag;
+
+    /**
+     * 创建人id
+     */
+    private String createUserId;
+    @TableField(exist = false)
+    private String createUserName;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    @TableField(exist = false)
+    private String startTime;
+    @TableField(exist = false)
+    private String endTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+
+    private Set<String> userIds;
+
+}

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

@@ -0,0 +1,25 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @description: 快手账户 上传 数据 excel
+ * @return:
+ * @author: zianY
+ */
+@Data
+public class AccountImportVo implements Serializable {
+
+    @Excel(name = "快手ID")
+    private String kuaiShouId;
+
+    @Excel(name = "账户ID")
+    private String accountId;
+
+    @Excel(name = "账户名称")
+    private String accountName;
+}

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

@@ -0,0 +1,49 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @description: 头条 利润表
+ * @return:
+ * @author: zianY
+ */
+@Data
+public class ProfitReportBytedanceVo implements Serializable {
+
+    @Excel(name = "广告主公司名称",width = 30)
+    private String advertiserName;
+
+    @Excel(name = "产品名称",width = 25)
+    private String productName;
+
+    @Excel(name = "总消耗",width = 10)
+    private String cost;
+
+    @Excel(name = "现金消耗",width = 10)
+    private String cashCost;
+
+    @Excel(name = "赠款消耗",width = 10)
+    private String rewardCost;
+
+    @Excel(name = "返点类型",width = 10)
+    private String rebateType;
+
+    @Excel(name = "返点比列",width = 10)
+    private String rebateRate;
+
+    @Excel(name = "销售",width = 12)
+    private String saleName;
+
+    @Excel(name = "运营",width = 12)
+    private String operateName;
+
+    @Excel(name = "运营所属区域",width = 12)
+    private String operateArea;
+
+
+
+}

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

@@ -0,0 +1,54 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @description: 快手 利润表
+ * @return:
+ * @author: zianY
+ */
+@Data
+public class ProfitReportKuaiShouVo implements Serializable {
+
+
+    @Excel(name = "账户ID",width = 20)
+    private String accountId;
+
+    @Excel(name = "快手ID",width = 20)
+    private String ksId;
+
+    @Excel(name = "广告主公司名称",width = 30)
+    private String advertiserName;
+
+    @Excel(name = "产品名称",width = 25)
+    private String productName;
+
+    @Excel(name = "总消耗",width = 10)
+    private String cost;
+
+    @Excel(name = "充值花费",width = 10)
+    private String cashCost;
+
+    @Excel(name = "返点类型",width = 10)
+    private String rebateType;
+
+    @Excel(name = "返点比列",width = 10)
+    private String rebateRate;
+
+    @Excel(name = "销售",width = 12)
+    private String saleName;
+
+    @Excel(name = "运营",width = 12)
+    private String operateName;
+
+    @Excel(name = "运营所属区域",width = 12)
+    private String operateArea;
+
+
+
+}

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

@@ -0,0 +1,83 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * 财务结算 结算单信息
+ * zian Y
+ * 2021/7/28
+ **/
+
+@Data
+public class SettlementFileParamsVo implements Serializable {
+
+
+
+    /**
+     * 广告主公司id
+     */
+    //@Dict(dicCode = "id", dictTable = "ctop_advertiser", dicText = "name")
+    private String advertiserId;
+    private String advertiserName;
+
+    /**
+     * 产品id
+     */
+    private String productId;
+    private String productName;
+
+    /**
+     * 项目id
+     */
+    private String projectId;
+    private String projectName;
+
+
+    /**
+     * 账户id
+     */
+    private String accountId;
+    private String accountName;
+
+
+    /**
+     * 年-月
+     */
+    private String uploadYears;
+
+    /**
+     * 媒体类型 1-头条 2-快手 3-头条内广 4-快手内广
+     */
+    private Integer mediaId;
+
+
+    /**
+     * 创建人id
+     */
+    private String createUserId;
+    private String createUserName;
+
+
+    /**
+     * 其他人员
+     */
+    private String otherUserIds;
+
+
+
+    private String startTime;
+    private String endTime;
+
+
+
+    private Set<String> operatorUserIds;
+    private Set<String> saleUserIds;
+
+}

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

@@ -0,0 +1,57 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @description: 头条 结算单
+ * @return:
+ * @author: zianY
+ */
+@Data
+public class SettlementReportBytedanceVo implements Serializable {
+
+    //type 1 是文本, 2 是图片,3 是函数,10 是数字
+    @Excel(name = "广告主ID")
+    private String advertiserId;
+
+    @Excel(name = "日期")
+    private String date;
+
+    @Excel(name = "日终结余(单位元)")
+    private String balance;
+
+    @Excel(name = "现金支出(单位元)")
+    private String cashCost;
+
+    @Excel(name = "总支出(单位元)")
+    private String cost;
+
+    @Excel(name = "冻结(单位元)")
+    private String frozen;
+
+    @Excel(name = "总存入(单位元)")
+    private String income;
+
+    @Excel(name = "赠款支出(单位元)")
+    private String rewardCost;
+
+    @Excel(name = "共享钱包支出(单位元)")
+    private String sharedWalletCost;
+
+    @Excel(name = "总转入(单位元)")
+    private String transferIn;
+
+    @Excel(name = "总转出(单位元)")
+    private String transferOut;
+
+
+    private String accountName;
+
+
+
+
+}

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

@@ -0,0 +1,90 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * @description: 快手 结算单
+ * @return:
+ * @author: zianY
+ */
+@Data
+public class SettlementReportKuaiShouVo implements Serializable {
+
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @ApiModelProperty(value = "账户ID")
+    private String accountId;
+    /**
+     * 时间
+     */
+    @ApiModelProperty(value = "时间")
+    private String date;
+    /**
+     * 总花费(元)
+     */
+    @ApiModelProperty(value = "总花费(元)")
+    private String dailyCharge;
+    /**
+     * 充值话费(元)
+     */
+    @ApiModelProperty(value = "充值花费(元)")
+    private String realCharged;
+    /**
+     * 框返花费(元)
+     */
+    @ApiModelProperty(value = "框返花费(元)")
+    private String contractRebateRealCharged;
+    /**
+     * 激励花费(元)
+     */
+    @ApiModelProperty(value = "激励花费(元)")
+    private String directRebateRealCharged;
+    /**
+     * 转入(元)
+     */
+    @ApiModelProperty(value = "转入(元)")
+    private String dailyTransferIn;
+    /**
+     * 转出(元)
+     */
+    @ApiModelProperty(value = "转出(元)")
+    private String dailyTransferOut;
+    /**
+     * 日终结余(元)
+     */
+    @ApiModelProperty(value = "日终结余(元)")
+    private String balance;
+    /**
+     * 充值转入(元)
+     */
+    @ApiModelProperty(value = "充值转入(元)")
+    private String realRecharged;
+    /**
+     * 框返转入(元)
+     */
+    @org.jeecgframework.poi.excel.annotation.Excel(name = "框返转入(元)", width = 15)
+    @ApiModelProperty(value = "框返转入(元)")
+    private String contractRebateRealRecharged;
+    /**
+     * 激励转入(元)
+     */
+    @ApiModelProperty(value = "激励转入(元)")
+    private String directRebateRealRecharged;
+
+    private String ksId;
+
+
+
+}

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

@@ -0,0 +1,97 @@
+package org.jeecg.ctop.finance.settlement.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import io.lettuce.core.dynamic.annotation.Param;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo;
+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.SettlementReportKuaiShouVo;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ *
+ * @description:
+ *
+ * @return:
+ * @author: zianY
+ * @time: 2021/7/28 17:07
+ */
+public interface ReportSettlementMapper {
+
+    /**
+     *获取头条 账户 日流水信息 根据账户id 和 年月 查询数据
+     * @param
+     * @return
+     */
+    List<SettlementReportBytedanceVo> getAccountTransactionDayBytedance(SettlementFileParamsVo paramsVo);
+
+    /**
+     * 获取快手 账户 日流水信息 根据账户id 和 年月 查询数据
+     * @param paramsVo
+     * @return
+     */
+    List<SettlementReportKuaiShouVo> getAccountTransactionDayKuaiShou(SettlementFileParamsVo paramsVo);
+
+
+    /**
+     * 查询 头条 账户id
+     * @return
+     */
+   List<String> getAccountIdBytedance(SettlementFileParamsVo paramsVo);
+
+    /**
+     * 查询 头条 账户 图片
+     * @param accountId
+     * @return
+     */
+   List<String> getAccountImagesBytedance(String accountId);
+
+
+    /**
+     * 查询 头条利润表 总花费
+     * @return
+     */
+    List<Map<String,Object>> getProfitBytedanceCost(String uploadYears);
+
+    /**
+     * 查询 快手 利润表 总花费
+     * @param uploadYears
+     * @return
+     */
+    List<Map<String,Object>> getProfitKuaiShou(String uploadYears);
+
+    /**
+     * 查询 头条利润表  销售人员姓名 以及 返点类型和比列
+     * @param productId
+     * @return
+     */
+    Map<String,Object> getProfitBytedanceSale(String productId);
+
+    Map<String,Object> getProfitBytedanceOperate(String accountId);
+
+    Map<String,Object> getProfitKuaiShouOperate(String accountId);
+
+
+
+
+
+
+    /**
+     * 查询 所有已绑定用户的运营人员id
+     * @return
+     */
+    List<Map<String,Object>> getAccountOperateUserId();
+
+    /**
+     * 查询运营人员 绑定的账户 以及产品
+     * @return
+     */
+    List<Map<String,Object>> getAccountAndProductByOperate(String userId);
+
+
+
+
+}

+ 45 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/SettlementFileInfoMapper.java

@@ -0,0 +1,45 @@
+package org.jeecg.ctop.finance.settlement.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import io.lettuce.core.dynamic.annotation.Param;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementFileInfo;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ *
+ * @description:
+ *
+ * @return:
+ * @author: zianY
+ * @time: 2021/7/28 17:07
+ */
+public interface SettlementFileInfoMapper extends BaseMapper<ctopCwjsSettlementFileInfo> {
+
+    /**
+     *查询 财务结算-结算单列表
+     * @param paramsVo
+     * @return
+     */
+    List<Map<String,String>> getSettlementSheetList(SettlementFileParamsVo paramsVo);
+
+
+    /**
+     * 删除
+     * @param paramsVo
+     * @return
+     */
+    Integer deleteSettlementFile(SettlementFileParamsVo paramsVo);
+
+
+    /**
+     * 查询账户数量以及图片数量
+     * @param paramsVo
+     * @return
+     */
+    Map<String,String> getAccountNumAndImgNum(SettlementFileParamsVo paramsVo);
+}

+ 40 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/SettlementInfoMapper.java

@@ -0,0 +1,40 @@
+package org.jeecg.ctop.finance.settlement.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import io.lettuce.core.dynamic.annotation.Param;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo;
+
+import java.util.List;
+
+
+/**
+ *
+ * @description:
+ *
+ * @return:
+ * @author: zianY
+ * @time: 2021/7/28 17:07
+ */
+public interface SettlementInfoMapper extends BaseMapper<ctopCwjsSettlementInfo> {
+
+    /**
+     *查询 财务结算-账户列表
+     * @param settlementInfo
+     * @return
+     */
+    List<ctopCwjsSettlementInfo> getSettlementList(ctopCwjsSettlementInfo settlementInfo);
+
+    /**
+     *修改财务结算账户状态
+     * @param id
+     * @param status
+     */
+    void updSettlementStatusById(@Param("id") Long id, @Param("status") Integer status);
+
+    /**
+     * 删除财务结算账户
+     * @param id
+     */
+    void deleteSettlementById(@Param("id") Long id);
+
+}

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

@@ -0,0 +1,236 @@
+<?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.finance.settlement.mapper.ReportSettlementMapper">
+
+    <!-- 获取头条 账户 日流水信息 -->
+    <select id="getAccountTransactionDayBytedance" resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo">
+        select t.*,c.auth_name as accountName from (select id,
+        advertiser_id,
+        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
+         from
+        ctop_account_transaction_day
+        where advertiser_id = #{accountId}
+            )t
+      LEFT JOIN ctop_user_allocation c on t.advertiser_id = c.account_id
+        where uploadYears = #{uploadYears}
+    </select>
+
+    <!-- 查询 头条 账户id-->
+    <select id="getAccountIdBytedance" resultType="java.lang.String">
+        SELECT
+         account_id as accountId
+        FROM
+        ctop_cwjs_settlement_info
+        where del_flag = 0
+        <if test="advertiserId !=null and advertiserId != ''">
+            AND advertiser_id = #{advertiserId}
+        </if>
+        <if test="productId !=null and productId != ''">
+            AND product_id = #{productId}
+        </if>
+        <if test="mediaId !=null and mediaId != ''">
+            AND media_id = #{mediaId}
+        </if>
+
+    </select>
+
+
+    <!-- 查询 头条 账户 图片-->
+    <select id="getAccountImagesBytedance" resultType="java.lang.String">
+        SELECT
+        file_url as fileUrl
+        FROM
+        ctop_cwjs_settlement_file_info
+        where del_flag = 0
+        AND account_id = #{accountId}
+
+    </select>
+
+
+
+
+
+    <!-- 获取快手 账户 日流水信息 -->
+    <select id="getAccountTransactionDayKuaiShou" resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo">
+        select t.*,c.auth_name as accountName,
+               base.user_id as ksId from (select id,
+                                                           account_id,
+                                                        date,DATE_FORMAT(date,'%Y-%m') as uploadYears,
+                                                        daily_charge,real_charged,contract_rebate_real_charged,direct_rebate_real_charged,
+                                                        daily_transfer_in,daily_transfer_out,balance,
+                                                        real_recharged,contract_rebate_real_recharged,direct_rebate_real_recharged,
+                                                      create_time
+                                                    from
+                                                        ctop_kuaishou_daily_flows
+                                                    where account_id = #{accountId}
+                                                   )t
+                                                       LEFT JOIN ctop_user_allocation c on t.account_id = c.account_id
+                                                       LEFT JOIN ctop_kuaishou_advertiser_base_info base on base.account_id = t.account_id
+        where uploadYears = #{uploadYears}
+    </select>
+
+
+
+
+
+    <!-- 查询 头条利润表 总花费-->
+    <select id="getProfitBytedanceCost" resultType="java.util.LinkedHashMap">
+        SELECT
+            d.advertiser_id AS accountId,
+            SUM( d.cost ) AS cost,
+            SUM( d.cash_cost ) AS cashCost,
+            SUM( d.reward_cost ) rewardCost,
+            cwjs.product_id as productId,
+            p.product_name AS productName
+        FROM
+            ctop_account_transaction_day d
+                LEFT JOIN ctop_cwjs_settlement_info cwjs ON d.advertiser_id = cwjs.account_id
+                LEFT JOIN ctop_product p ON cwjs.product_id = p.id
+        WHERE
+            cwjs.del_flag = 0
+        <if test="uploadYears !=null and uploadYears != ''">
+            AND DATE_FORMAT(d.date,'%Y-%m') = #{uploadYears}
+        </if>
+        GROUP BY
+            d.advertiser_id;
+
+    </select>
+
+
+
+    <!-- 查询 头条利润表  销售人员姓名 以及 返点类型和比列-->
+    <select id="getProfitBytedanceSale" resultType="java.util.LinkedHashMap">
+        SELECT
+        pp.create_user_id,
+        su.realname AS saleName,
+        cp.rebate_type AS rebateType,
+        cp.rebate_rate AS rebateRate,
+        cp.approved_status AS approvedStatus,
+        cp.policy_start_date as policyStartDate,
+        DATE_FORMAT(cp.policy_start_date,'%Y-%m') as policyStart,
+        cp.policy_end_date as policyEndDate,
+        DATE_FORMAT(cp.policy_end_date,'%Y-%m') as policyEnd
+        FROM
+        ctop_cwjs_policy_product pp
+        LEFT JOIN sys_user su ON pp.create_user_id = su.id
+        LEFT JOIN ctop_cwjs_policy_info cp ON cp.id = pp.policy_id
+        WHERE
+        pp.del_flag = 0
+        AND cp.del_flag = 0
+        <if test="productId !=null and productId != ''">
+            AND pp.id = #{productId}
+        </if>
+
+
+    </select>
+
+
+
+    <!-- 查询 头条利润表  广告主和运营和运营所属区域-->
+    <select id="getProfitBytedanceOperate" resultType="java.util.LinkedHashMap">
+        select
+        u.advertiser_id,
+        u.advertiser_name as advertiserName,
+        u.user_id,
+        u.user_name as operateName,
+        u.auth_name,
+        IFNULL(p.nick_name,'') as operateArea
+        from
+        ctop_user_allocation u
+        LEFT JOIN user_company p on p.user_id = u.user_id
+          <where>
+              <if test="accountId !=null and accountId != ''">
+                  AND u.account_id = #{accountId}
+              </if>
+          </where>
+    </select>
+
+
+<!-- 查询 快手 利润表 总花费-->
+    <select id="getProfitKuaiShou" resultType="java.util.LinkedHashMap">
+        SELECT
+            d.account_id AS accountId,
+            SUM( d.daily_charge ) AS cost,
+            SUM( d.real_charged ) AS cashCost,
+            cwjs.product_id as productId,
+            p.product_name AS productName
+        FROM
+            ctop_kuaishou_daily_flows d
+                LEFT JOIN ctop_cwjs_settlement_info cwjs ON d.account_id = cwjs.account_id
+                LEFT JOIN ctop_product p ON cwjs.product_id = p.id
+        WHERE
+            cwjs.del_flag = 0
+        <if test="uploadYears !=null and uploadYears != ''">
+          and DATE_FORMAT(d.date,'%Y-%m') = #{uploadYears}
+        </if>
+        GROUP BY
+            d.account_id;
+    </select>
+
+
+
+
+    <!-- 查询 快手 利润表  广告主和运营和运营所属区域-->
+    <select id="getProfitKuaiShouOperate" resultType="java.util.LinkedHashMap">
+        select
+        u.advertiser_id,
+        u.account_id,
+        b.user_id as ksId,
+        u.advertiser_name as advertiserName,
+        u.user_id,
+        u.user_name as operateName,
+        u.auth_name,
+        IFNULL(p.nick_name,'') as operateArea
+        from
+        ctop_user_allocation u
+        LEFT JOIN ctop_kuaishou_advertiser_base_info b on u.account_id = b.account_id
+        LEFT JOIN user_company p on p.user_id = u.user_id
+    <where>
+        <if test="accountId !=null and accountId != ''">
+            AND u.account_id = #{accountId}
+        </if>
+    </where>
+    </select>
+
+
+
+
+
+    <!--  给运营人员发送微信通知 -->
+
+
+<!--  查询 所有已绑定用户的运营人员id -->
+    <select id="getAccountOperateUserId" resultType="java.util.LinkedHashMap">
+        SELECT user_id userId,user_name userName
+        from ctop_user_allocation
+        GROUP BY user_id
+    </select>
+
+    <!-- 查询运营人员 绑定的账户 以及产品 -->
+    <select id="getAccountAndProductByOperate" resultType="java.util.LinkedHashMap">
+        SELECT
+            c.user_id as userId,
+            c.user_name as userName,
+            c.account_id as accountId,
+            c.project_id as projectId,
+            p.product_id as productId,
+            d.product_name as productName
+        FROM
+            ctop_user_allocation c
+                LEFT JOIN ctop_project p ON c.project_id = p.id
+                LEFT JOIN ctop_product d ON p.product_id = d.id
+        WHERE
+            c.account_status = 0
+        AND p.product_id IS NOT NULL
+	AND c.user_id = #{userId}
+    </select>
+
+
+
+
+
+    <!--  给运营人员发送微信通知 -->
+
+
+</mapper>

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

@@ -0,0 +1,150 @@
+<?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.finance.settlement.mapper.SettlementFileInfoMapper">
+
+    <!-- 查询 财务结算-结算单列表-->
+    <select id="getSettlementSheetList" resultType="java.util.LinkedHashMap">
+        SELECT
+           t.*,
+           MAX(t.create_time) as imageCreateTIme
+        from (
+              SELECT
+              f.id,
+              cwjs.id as cwId,
+              f.create_time,
+              f.upload_years as uploadYears,
+              cwjs.advertiser_id as advertiserId,
+              ( SELECT ad.NAME FROM ctop_advertiser ad WHERE ad.id = cwjs.advertiser_id LIMIT 1 ) advertiserName,
+              cwjs.product_id as productId,
+              ( SELECT cp.product_name FROM ctop_product cp WHERE cp.id = cwjs.product_id LIMIT 1 ) productName,
+            cwjs.project_id as projectId,
+            ( SELECT project.project_name FROM ctop_project project WHERE project.id = cwjs.project_id LIMIT 1 ) projectName,
+              cwjs.account_id as accountId,
+              cwjs.account_name as accountName,
+              cwjs.media_id as mediaId,
+              cwjs.operate_type as operateType,
+              cwjs.status as status,
+              cwjs.del_flag as delFlag,
+              cwjs.create_user_id as saleUserId,
+              ( SELECT su.realname FROM sys_user su WHERE su.id = cwjs.create_user_id LIMIT 1 ) saleUserName,
+              f.create_user_id as operateUserId,
+              ( SELECT su.realname FROM sys_user su WHERE su.id = f.create_user_id LIMIT 1 ) operateUserName
+            FROM
+            ctop_cwjs_settlement_info cwjs,
+            ctop_cwjs_settlement_file_info f
+        WHERE
+            cwjs.del_flag = 0
+          and f.del_flag = 0
+          and cwjs.advertiser_id = f.advertiser_id
+          and cwjs.product_id = f.product_id
+          and cwjs.media_id = f.media_id
+        ORDER BY f.create_time DESC LIMIT 999999) t
+
+        <where>
+            <if test="advertiserName !=null and advertiserName != ''">
+                AND advertiserName like concat ('%',#{advertiserName},'%')
+            </if>
+            <if test="productName !=null and productName != ''">
+                AND productName like concat ('%',#{productName},'%')
+            </if>
+            <if test="projectName !=null and projectName != ''">
+                AND projectName like concat ('%',#{projectName},'%')
+            </if>
+            <if test="accountName !=null and accountName != ''">
+                AND accountName like concat ('%',#{accountName},'%')
+            </if>
+            <if test="createUserId !=null and createUserId != ''">
+                AND saleUserId = #{createUserId}
+            </if>
+            <if test="mediaId !=null and mediaId != ''">
+                AND media_id = #{mediaId}
+            </if>
+            <if test="startTime !=null and startTime != ''">
+                AND imageCreateTIme &gt;= #{startTime}
+            </if>
+            <if test="endTime !=null and endTime != ''">
+                AND imageCreateTIme &lt;= #{endTime}
+            </if>
+
+            <if test="operatorUserIds !=null and operatorUserIds != ''">
+                AND operateUserId in
+                <foreach collection="operatorUserIds" item="item" separator=","
+                         open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="saleUserIds !=null and saleUserIds != ''">
+                AND saleUserId in
+                <foreach collection="saleUserIds" item="item" separator=","
+                         open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+
+        </where>
+
+        GROUP BY t.advertiserId,t.productId,t.uploadYears,t.operateUserId
+        ORDER BY imageCreateTIme DESC
+
+    </select>
+
+
+
+    <!-- 删除财务结算图片 -->
+    <update id="deleteSettlementFile">
+        UPDATE ctop_cwjs_settlement_file_info
+        SET del_flag = 1
+        WHERE advertiser_id = #{advertiserId}
+          and product_id = #{productId}
+          and media_id = #{mediaId}
+          and upload_years = #{uploadYears}
+          and create_user_id = #{createUserId}
+    </update>
+
+    <!-- 查询账户数量以及图片数量 -->
+    <select id="getAccountNumAndImgNum" resultType="java.util.Map">
+        SELECT * from
+                     (
+                         SELECT
+                                COUNT(account_id) as accountNum
+                         FROM
+                             ctop_cwjs_settlement_info
+                            where del_flag = 0
+                        <if test="advertiserId !=null and advertiserId != ''">
+                            AND advertiser_id = #{advertiserId}
+                        </if>
+                        <if test="productId !=null and productId != ''">
+                            AND product_id = #{productId}
+                        </if>
+                        <if test="mediaId !=null and mediaId != ''">
+                            AND media_id = #{mediaId}
+                        </if>
+                         ) t1,
+                     (
+                         SELECT
+                                COUNT(DISTINCT account_id) as imageNum
+                            FROM
+                                 ctop_cwjs_settlement_file_info
+                         where del_flag = 0
+                        <if test="advertiserId !=null and advertiserId != ''">
+                            AND advertiser_id = #{advertiserId}
+                        </if>
+                        <if test="productId !=null and productId != ''">
+                            AND product_id = #{productId}
+                        </if>
+                        <if test="mediaId !=null and mediaId != ''">
+                            AND media_id = #{mediaId}
+                        </if>
+                     ) t2
+
+
+
+    </select>
+
+
+
+
+
+</mapper>

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

@@ -0,0 +1,85 @@
+<?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.finance.settlement.mapper.SettlementInfoMapper">
+
+    <!-- 查询 财务结算-账户列表-->
+    <select id="getSettlementList" resultType="org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo">
+        SELECT * from (
+        SELECT
+            id,
+            advertiser_id,
+            ( SELECT ad.NAME FROM ctop_advertiser ad WHERE ad.id = cwjs.advertiser_id LIMIT 1 ) advertiserName,
+            product_id,
+            ( SELECT cp.product_name FROM ctop_product cp WHERE cp.id = cwjs.product_id LIMIT 1 ) productName,
+            project_id,
+            ( SELECT project.project_name FROM ctop_project project WHERE project.id = cwjs.project_id LIMIT 1 ) projectName,
+            media_id,
+            operate_type,
+            account_id,
+            account_name,
+            kuai_shou_id,
+            STATUS,
+            del_flag,
+            create_user_id,
+            ( SELECT su.realname FROM sys_user su WHERE su.id = cwjs.create_user_id LIMIT 1 ) createUserName,
+            create_time,
+            update_time
+        FROM
+            ctop_cwjs_settlement_info cwjs
+        WHERE
+            cwjs.del_flag = 0) t
+        <where>
+            <if test="advertiserName !=null and advertiserName != ''">
+                AND advertiserName like concat ('%',#{advertiserName},'%')
+            </if>
+            <if test="productName !=null and productName != ''">
+                AND productName like concat ('%',#{productName},'%')
+            </if>
+            <if test="projectName !=null and projectName != ''">
+                AND projectName like concat ('%',#{projectName},'%')
+            </if>
+            <if test="accountName !=null and accountName != ''">
+                AND accountName like concat ('%',#{accountName},'%')
+            </if>
+            <if test="createUserName !=null and createUserName != ''">
+                AND createUserName like concat ('%',#{createUserName},'%')
+            </if>
+            <if test="mediaId !=null and mediaId != ''">
+                AND media_id = #{mediaId}
+            </if>
+            <if test="startTime !=null and startTime != ''">
+                AND create_time &gt;= #{startTime}
+            </if>
+            <if test="endTime !=null and endTime != ''">
+                AND create_time &lt;= #{endTime}
+            </if>
+            <if test="userIds !=null and userIds != ''">
+                AND create_user_id in
+              <foreach collection="userIds" item="item" separator=","
+                       open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <!-- 修改财务结算账户状态 -->
+    <update id="updSettlementStatusById">
+        UPDATE ctop_cwjs_settlement_info
+            SET STATUS = #{status}
+        WHERE
+            id = #{id}
+    </update>
+
+
+    <!-- 删除财务结算账户 -->
+    <update id="deleteSettlementById">
+        UPDATE ctop_cwjs_settlement_info
+            SET del_flag = 1
+        WHERE
+            id = #{id}
+    </update>
+
+
+
+</mapper>

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

@@ -0,0 +1,33 @@
+package org.jeecg.ctop.finance.settlement.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+public interface IReportSettlementService {
+
+    List<SettlementReportBytedanceVo> getAccountTransactionDayBytedance();
+
+    Result settlementReportBytedance(SettlementFileParamsVo paramsVo,HttpServletResponse response);
+
+    Result settlementReportKuaiShou(SettlementFileParamsVo paramsVo,HttpServletResponse response);
+
+
+
+
+    Result porfitReportBytedance(SettlementFileParamsVo paramsVo,HttpServletResponse response);
+
+    Result porfitReportKuaiShou(SettlementFileParamsVo paramsVo,HttpServletResponse response);
+
+
+
+
+    Result sendMessageToOperate(String userId);
+
+}

+ 25 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/ISettlementFileInfoService.java

@@ -0,0 +1,25 @@
+package org.jeecg.ctop.finance.settlement.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementFileInfo;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
+
+import java.util.List;
+import java.util.Map;
+
+public interface ISettlementFileInfoService extends IService<ctopCwjsSettlementFileInfo> {
+
+    Result<PageInfo<Map<String,String>>> getSettlementSheetList(SettlementFileParamsVo paramsVo, Integer pageNo, Integer pageSize);
+
+
+    Result deleteSettlementFile(SettlementFileParamsVo paramsVo);
+
+    Result insertAccountImages(ctopCwjsSettlementFileInfo settlementFileInfo);
+
+    Result getAccountNumAndImgNum(SettlementFileParamsVo paramsVo);
+
+
+}

+ 21 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/ISettlementInfoService.java

@@ -0,0 +1,21 @@
+package org.jeecg.ctop.finance.settlement.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+public interface ISettlementInfoService extends IService<ctopCwjsSettlementInfo> {
+
+    Result getSettlementList(ctopCwjsSettlementInfo settlementInfo, Integer pageNo, Integer pageSize);
+
+    Result updSettlementStatusById(Long id,Integer status);
+
+    Result deleteSettlementById(Long id);
+
+    Result settlementAccountImport(ctopCwjsSettlementInfo settlementInfo,MultipartFile file);
+
+}

+ 59 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/ExcelListener.java

@@ -0,0 +1,59 @@
+/*
+package org.jeecg.ctop.finance.settlement.service.serviceImpl;
+
+import cn.afterturn.easypoi.cache.ImageCache;
+import com.google.common.cache.CacheBuilder;
+import org.springframework.boot.context.event.ApplicationReadyEvent;
+import org.springframework.context.ApplicationListener;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.concurrent.TimeUnit;
+
+import javax.imageio.ImageIO;
+
+import org.apache.poi.util.IOUtils;
+import org.springframework.boot.context.event.ApplicationReadyEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.stereotype.Component;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+
+import cn.afterturn.easypoi.cache.ImageCache;
+import cn.afterturn.easypoi.cache.manager.POICacheManager;
+*/
+/**
+ * Administrator
+ * 2021/8/5
+ **//*
+
+@Component
+public class ExcelListener implements ApplicationListener<ApplicationReadyEvent> {
+    @Override
+    public void onApplicationEvent(ApplicationReadyEvent event) {
+        LoadingCache<String, byte[]> loadingCache = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.DAYS)
+                .maximumSize(2000).build(new CacheLoader<String, byte[]>() {
+                    @Override
+                    public byte[] load(String imagePath) throws Exception {
+                        InputStream is = POICacheManager.getFile(imagePath);
+                        BufferedImage bufferImg = ImageIO.read(is);
+                        ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
+                        try {
+                            ImageIO.write(bufferImg,
+                                    imagePath.substring(imagePath.lastIndexOf(".")+1),
+                                    byteArrayOut);
+                            return byteArrayOut.toByteArray();
+                        } finally {
+                            IOUtils.closeQuietly(is);
+                            IOUtils.closeQuietly(byteArrayOut);
+                        }
+                    }
+                });
+        ImageCache.setLoadingCache(loadingCache);
+    }
+}*/

+ 83 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/FileLoaderImpl.java

@@ -0,0 +1,83 @@
+package org.jeecg.ctop.finance.settlement.service.serviceImpl;
+
+import cn.afterturn.easypoi.cache.manager.IFileLoader;
+import cn.afterturn.easypoi.util.PoiPublicUtil;
+import lombok.extern.slf4j.Slf4j;
+import me.zhyd.oauth.log.Log;
+import org.apache.poi.util.IOUtils;
+import org.slf4j.Logger;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * Administrator
+ * 2021/8/5
+ **/
+@Slf4j
+public class FileLoaderImpl implements IFileLoader {
+    @Override
+    public byte[] getFile(String url) {
+        InputStream fileis = null;
+        ByteArrayOutputStream baos = null;
+        try {
+            //判断是否是网络地址
+            if (url.startsWith("http")) {
+                URL urlObj = new URL(url);
+                URLConnection urlConnection = urlObj.openConnection();
+                urlConnection.setConnectTimeout(30);
+                urlConnection.setReadTimeout(60);
+                urlConnection.setDoInput(true);
+                fileis = urlConnection.getInputStream();
+            } else {
+                //先用绝对路径查询,再查询相对路径
+                try {
+                    fileis = new FileInputStream(url);
+                } catch (FileNotFoundException e) {
+                    //获取项目文件
+                    fileis = FileLoaderImpl.class.getClassLoader().getResourceAsStream(url);
+                    // ---------------重新新增代码开始点---------------
+                    if (fileis == null) {
+                        //最后再拿相对文件路径
+                        String path = getWebRootPath(url);
+                        fileis = new FileInputStream(path);
+                    }
+                    // ---------------重新新增代码结束点---------------
+                }
+            }
+            baos = new ByteArrayOutputStream();
+            byte[] buffer = new byte[1024];
+            int len;
+            while ((len = fileis.read(buffer)) > -1) {
+                baos.write(buffer, 0, len);
+            }
+            baos.flush();
+            return baos.toByteArray();
+        } catch (Exception e) {
+            Log.error(e.getMessage(), e);
+        } finally {
+            IOUtils.closeQuietly(fileis);
+            IOUtils.closeQuietly(baos);
+        }
+        Log.error(fileis + "这个路径文件没有找到,请查询");
+        return null;
+    }
+
+
+    public static String getWebRootPath(String filePath) {
+        try {
+            String path = PoiPublicUtil.class.getClassLoader().getResource("").toURI().getPath();
+            path = path.replace("WEB-INF/classes/", "");
+            path = path.replace("file:/", "");
+            return path + filePath;
+        } catch (URISyntaxException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+}

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

@@ -0,0 +1,613 @@
+package org.jeecg.ctop.finance.settlement.service.serviceImpl;
+
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.utils.CorpWexinUtils;
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.JsonObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.ClientAnchor;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.policy.utils.Check;
+import org.jeecg.ctop.finance.settlement.entity.vo.*;
+import org.jeecg.ctop.finance.settlement.mapper.ReportSettlementMapper;
+import org.jeecg.ctop.finance.settlement.service.IReportSettlementService;
+import org.jeecg.ctop.finance.utils.SettlementUtil;
+import org.jeecg.ctop.finance.utils.createExcelByTemplate;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.net.URLEncoder;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+@Slf4j
+@Service
+public class ReportSettlementServiceImpl implements IReportSettlementService {
+
+    @Resource
+    private ReportSettlementMapper reportSettlementMapper;
+
+    @Resource
+    private CorpWexinUtils corpWexinUtils;
+    @Resource
+    private MailLogMapper mailLogMapper;
+
+
+    @Override
+    public List<SettlementReportBytedanceVo> getAccountTransactionDayBytedance() {
+        return reportSettlementMapper.getAccountTransactionDayBytedance(null);
+    }
+
+    @Override
+    public Result settlementReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
+
+        try {
+
+            //第一步创建workbook
+            HSSFWorkbook wb = new HSSFWorkbook();
+
+            //设置样式
+            HSSFCellStyle style = wb.createCellStyle();
+            style.setAlignment(HorizontalAlignment.CENTER);//水平居中
+
+            //设置字体
+            HSSFFont font = wb.createFont();
+            font.setFontName("黑体");
+            font.setFontHeightInPoints((short) 12);//设置字体大小
+            style.setFont(font);
+
+            //查询 账户id
+            List<String> accountIdList = reportSettlementMapper.getAccountIdBytedance(paramsVo);
+
+            if (Check.isNull(accountIdList)){
+                return Result.errorMsg("该广告主和产品下无法查询到绑定的账户信息。");
+            }
+
+            int num = 0;
+
+            for (int k = 0; k < accountIdList.size(); k++) {
+
+                String accountId = accountIdList.get(k);
+                paramsVo.setAccountId(accountId);
+
+                //获取账户 日流水数据  根据账户id 和 年月 查询数据
+                List<SettlementReportBytedanceVo> settlementList = reportSettlementMapper.getAccountTransactionDayBytedance(paramsVo);
+                if (Check.isNull(settlementList)){
+                    num++;
+                    continue;
+                }
+
+                //2:创建sheet 设置sheet名称
+                HSSFSheet sheet = wb.createSheet(accountId);
+
+                //画图的顶级管理器,一个sheet只能获取一个 (插入图片时 使用)
+                HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
+
+                //3:添加 第一行单元格
+                HSSFRow row0 = sheet.createRow(0);
+                HSSFCell cell0 = row0.createCell(0);
+                //设置 第一行 表头
+                cell0.setCellValue(paramsVo.getUploadYears()+"-头条结算单");
+                CellRangeAddress region = new CellRangeAddress(0, 0, 0, 10);
+                sheet.addMergedRegion(region);//合并行
+                cell0.setCellStyle(style);
+
+                //4:添加表头2行
+                HSSFRow row = sheet.createRow(1);
+
+                //5:创建第2行的单元格
+                HSSFCell cell = row.createCell(0);     //第一个单元格
+                cell.setCellValue("   日期   ");         //设定值
+                cell.setCellStyle(style);          //内容居中
+
+                cell = row.createCell(1);
+                cell.setCellValue("      账户名称      ");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(2);
+                cell.setCellValue("      账户ID      ");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(3);
+                cell.setCellValue("      所属代理商名称      ");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(4);
+                cell.setCellValue("      所属代理商ID      ");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(5);
+                cell.setCellValue("账户总支出(¥)");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(6);
+                cell.setCellValue("账户现金支出(¥)");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(7);
+                cell.setCellValue("账户赠款支出(¥)");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(8);
+                cell.setCellValue("账户总存入(¥)");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(9);
+                cell.setCellValue("账户总转入(¥)");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(10);
+                cell.setCellValue("账户总转出(¥)");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(11);
+                cell.setCellValue("账户日终结余(¥)");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(12);
+                cell.setCellValue("冻结(¥)");
+                cell.setCellStyle(style);
+
+
+
+
+                for (int i = 0; i < settlementList.size(); i++) {
+                    SettlementReportBytedanceVo vo = settlementList.get(i);
+                    //创建行 (表头占0-1行 所以 从 2开始)
+                    row = sheet.createRow(i + 2);
+                    sheet.autoSizeColumn(0, true);
+                    sheet.autoSizeColumn(i + 1, true);
+                    //创建单元格并且添加数据
+                    row.createCell(0).setCellValue(vo.getDate());
+                    row.createCell(1).setCellValue(vo.getAccountName());
+                    row.createCell(2).setCellValue(vo.getAdvertiserId());
+                    row.createCell(3).setCellValue("北京汇创思拓数字科技有限公司-ka");
+                    row.createCell(4).setCellValue("73970348172");
+                    row.createCell(5).setCellValue(vo.getCost());
+                    row.createCell(6).setCellValue(vo.getCashCost());
+                    row.createCell(7).setCellValue(vo.getRewardCost());
+                    row.createCell(8).setCellValue(vo.getIncome());
+                    row.createCell(9).setCellValue(vo.getTransferIn());
+                    row.createCell(10).setCellValue(vo.getTransferOut());
+                    row.createCell(11).setCellValue(vo.getBalance());
+                    row.createCell(12).setCellValue(vo.getFrozen());
+                }
+
+                //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
+                ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
+
+                //查询 图片 url
+                List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId);
+
+                if (!Check.isNull(imageUrlList)){
+                    for (int j = 0; j < imageUrlList.size(); j++) {
+                        String imagePath = imageUrlList.get(j);
+                        //通过图片网络地址 获取输入流
+                        InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
+                        BufferedImage bufferImg = ImageIO.read(is);
+                        ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
+                        //anchor主要用于设置图片的属性
+                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 2, settlementList.size() + 6 +(j*40), (short) 10, 90*(j+1));
+                        //HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255, (short) 5, settlementList.size() + 40, (short) 10, 40 * 2);
+                        anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
+                        //插入图片
+                        patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
+                    }
+                }
+
+            }
+
+            if(accountIdList.size() == num){
+                return Result.errorMsg("暂无数据。");
+            }
+
+            response.setCharacterEncoding("UTF-8");
+            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+            response.setHeader("Pragma", "no-cache");
+            response.setHeader("Cache-Control", "no-cache");
+            response.setDateHeader("Expires", 0);
+            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(paramsVo.getUploadYears()+"头条结算单.xlsx", "UTF-8"));
+            OutputStream output = response.getOutputStream();
+            BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
+            wb.write(bufferedOutPut);
+            bufferedOutPut.flush();
+            bufferedOutPut.close();
+            output.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("====>>>>", e.getMessage());
+            return Result.errorMsg(e.getMessage());
+        }
+        return null;
+    }
+
+
+
+    @Override
+    public Result settlementReportKuaiShou(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
+
+        try {
+
+            //第一步创建workbook
+            HSSFWorkbook wb = new HSSFWorkbook();
+
+            //设置样式
+            HSSFCellStyle style = wb.createCellStyle();
+            style.setAlignment(HorizontalAlignment.CENTER);//水平居中
+
+            //设置字体
+            HSSFFont font = wb.createFont();
+            font.setFontName("黑体");
+            font.setFontHeightInPoints((short) 12);//设置字体大小
+            style.setFont(font);
+
+            //查询 账户id
+            List<String> accountIdList = reportSettlementMapper.getAccountIdBytedance(paramsVo);
+
+            if (Check.isNull(accountIdList)){
+                return Result.errorMsg("该广告主和产品下无法查询到绑定的快手账户信息。");
+            }
+
+            int num = 0;
+
+            for (int k = 0; k < accountIdList.size(); k++) {
+
+                String accountId = accountIdList.get(k);
+                paramsVo.setAccountId(accountId);
+
+                //获取账户 日流水数据  根据账户id 和 年月 查询数据
+                List<SettlementReportKuaiShouVo> settlementList = reportSettlementMapper.getAccountTransactionDayKuaiShou(paramsVo);
+                if (Check.isNull(settlementList)){
+                    num++;
+                    continue;
+                }
+
+                //2:创建sheet 设置sheet名称
+                HSSFSheet sheet = wb.createSheet(accountId);
+
+                //画图的顶级管理器,一个sheet只能获取一个 (插入图片时 使用)
+                HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
+
+                //3:添加 第一行单元格
+                HSSFRow row0 = sheet.createRow(0);
+                HSSFCell cell0 = row0.createCell(0);
+                //设置 第一行 表头
+                cell0.setCellValue(paramsVo.getUploadYears()+"-快手结算单");
+                CellRangeAddress region = new CellRangeAddress(0, 0, 0, 10);
+                sheet.addMergedRegion(region);//合并行
+                cell0.setCellStyle(style);
+
+                //4:添加表头2行
+                HSSFRow row = sheet.createRow(1);
+
+                //5:创建第2行的单元格
+                HSSFCell cell = row.createCell(0);     //第一个单元格
+                cell.setCellValue("   日期   ");         //设定值
+                cell.setCellStyle(style);          //内容居中
+
+                cell = row.createCell(1);
+                cell.setCellValue("      账户快手ID      ");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(2);
+                cell.setCellValue("      广告主账户ID      ");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(3);
+                cell.setCellValue("      日总花费      ");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(4);
+                cell.setCellValue("      充值花费      ");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(5);
+                cell.setCellValue("框返花费");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(6);
+                cell.setCellValue("激励花费");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(7);
+                cell.setCellValue("充值转入");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(8);
+                cell.setCellValue("框返转入");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(9);
+                cell.setCellValue("激励转入");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(10);
+                cell.setCellValue("总转入");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(11);
+                cell.setCellValue("转出");
+                cell.setCellStyle(style);
+
+                cell = row.createCell(12);
+                cell.setCellValue("日终结余");
+                cell.setCellStyle(style);
+
+
+
+
+                for (int i = 0; i < settlementList.size(); i++) {
+                    SettlementReportKuaiShouVo vo = settlementList.get(i);
+                    //创建行 (表头占0-1行 所以 从 2开始)
+                    row = sheet.createRow(i + 2);
+                    sheet.autoSizeColumn(0, true);
+                    sheet.autoSizeColumn(i + 1, true);
+                    //创建单元格并且添加数据
+                    row.createCell(0).setCellValue(vo.getDate());
+                    row.createCell(1).setCellValue(vo.getKsId());
+                    row.createCell(2).setCellValue(vo.getAccountId());
+                    row.createCell(3).setCellValue(vo.getDailyCharge());
+                    row.createCell(4).setCellValue(vo.getRealCharged());
+                    row.createCell(5).setCellValue(vo.getContractRebateRealCharged());
+                    row.createCell(6).setCellValue(vo.getDirectRebateRealCharged());
+                    row.createCell(7).setCellValue(vo.getRealRecharged());
+                    row.createCell(8).setCellValue(vo.getContractRebateRealRecharged());
+                    row.createCell(9).setCellValue(vo.getDirectRebateRealRecharged());
+                    row.createCell(10).setCellValue(vo.getDailyTransferIn());
+                    row.createCell(11).setCellValue(vo.getDailyTransferOut());
+                    row.createCell(12).setCellValue(vo.getBalance());
+                }
+
+                //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
+                ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
+
+                //查询 图片 url
+                List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId);
+
+                if (!Check.isNull(imageUrlList)){
+                    for (int j = 0; j < imageUrlList.size(); j++) {
+                        String imagePath = imageUrlList.get(j);
+                        //通过图片网络地址 获取输入流
+                        InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
+                        BufferedImage bufferImg = ImageIO.read(is);
+                        ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
+                        //anchor主要用于设置图片的属性
+                        int startIndex = settlementList.size()+7;
+
+                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 2, startIndex+(5*j)+50*j, (short) 10, startIndex+(5*j)+50*(j+1));
+                        //HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255, (short) 5, settlementList.size() + 40, (short) 10, 40 * 2);
+                        anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
+                        //插入图片
+                        patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
+                    }
+                }
+
+            }
+
+            if(accountIdList.size() == num){
+                return Result.errorMsg("暂无数据。");
+            }
+
+            response.setCharacterEncoding("UTF-8");
+            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+            response.setHeader("Pragma", "no-cache");
+            response.setHeader("Cache-Control", "no-cache");
+            response.setDateHeader("Expires", 0);
+            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(paramsVo.getUploadYears()+"快手结算单.xlsx", "UTF-8"));
+            OutputStream output = response.getOutputStream();
+            BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
+            wb.write(bufferedOutPut);
+            bufferedOutPut.flush();
+            bufferedOutPut.close();
+            output.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("====>>>>", e.getMessage());
+            return Result.errorMsg(e.getMessage());
+        }
+        return null;
+    }
+
+
+
+
+    /**
+     *
+     * @description: 财务结算 利润表导出 头条
+     * @param paramsVo
+     * @param response
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result porfitReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
+
+        try {
+            //查询 头条利润表 总花费
+            List<Map<String,Object>> list = reportSettlementMapper.getProfitBytedanceCost(paramsVo.getUploadYears());
+            if (Check.isNull(list)){
+                return Result.errorMsg("暂无数据。");
+            }
+            List<ProfitReportBytedanceVo> resultList = new ArrayList<>(list.size());
+            for (Map<String, Object> map : list) {
+                ProfitReportBytedanceVo vo = new ProfitReportBytedanceVo();
+                vo.setCost(map.getOrDefault("cost","")+"");//总消耗
+                vo.setCashCost(map.getOrDefault("cashCost","")+"");//现金消耗
+                vo.setRewardCost(map.getOrDefault("rewardCost","")+"");//赠款消耗
+                vo.setProductName(map.getOrDefault("productName","")+"");//产品名称
+                //查询 头条利润表  销售人员姓名 以及 返点类型和比列
+                Map<String,Object> slaeMap = reportSettlementMapper.getProfitBytedanceSale(map.get("productId")+"");
+                if (!Check.isNull(slaeMap)){
+                    vo.setSaleName(slaeMap.getOrDefault("saleName","")+"");//销售
+                    // 当前查询时间 与 销售政策 开始 截至时间 是否匹配
+                    if (SettlementUtil.isEffectiveDate(paramsVo.getUploadYears(),slaeMap.get("policyStart")+"",slaeMap.get("policyEnd")+"")){
+                        //销售政策状态 为 通过 显示 返点类型 和 返点比列
+                        if (StringUtils.equals(slaeMap.getOrDefault("approvedStatus","")+"","3")){
+                            vo.setRebateType(slaeMap.getOrDefault("rebateType","")+"");//返点类型
+                            vo.setRebateRate(slaeMap.getOrDefault("rebateRate","")+"");//返点比列
+                        }
+                    }
+                }
+
+                Map<String,Object> operateMap = reportSettlementMapper.getProfitBytedanceOperate(map.get("accountId")+"");
+                if (!Check.isNull(operateMap)){
+                    vo.setAdvertiserName(operateMap.getOrDefault("advertiserName","")+"");//广告主名称
+                    vo.setOperateName(operateMap.getOrDefault("operateName","")+"");//运营
+                    vo.setOperateArea(operateMap.getOrDefault("operateArea","")+"");//运营所属区域
+                }
+                resultList.add(vo);
+            }
+
+            Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("头条利润单", "头条利润单"), ProfitReportBytedanceVo.class, resultList);
+
+            try {
+                response.setCharacterEncoding("UTF-8");
+                response.setHeader("content-Type", "application/vnd.ms-excel");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("头条利润单.xls", "UTF-8"));
+                workbook.write(response.getOutputStream());
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("====>>>>", e.getMessage());
+            return Result.errorMsg(e.getMessage());
+        }
+        return null;
+    }
+
+
+
+    /**
+     *
+     * @description: 财务结算 利润表导出 快手
+     * @param paramsVo
+     * @param response
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result porfitReportKuaiShou(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
+
+        try {
+            //查询 快手利润表 总花费
+            List<Map<String,Object>> list = reportSettlementMapper.getProfitKuaiShou(paramsVo.getUploadYears());
+            if (Check.isNull(list)){
+                return Result.errorMsg("暂无数据。");
+            }
+            List<ProfitReportKuaiShouVo> resultList = new ArrayList<>(list.size());
+            for (Map<String, Object> map : list) {
+                ProfitReportKuaiShouVo vo = new ProfitReportKuaiShouVo();
+                vo.setAccountId(map.getOrDefault("accountId","")+"");//账户id
+                vo.setCost(map.getOrDefault("cost","")+"");//总消耗
+                vo.setCashCost(map.getOrDefault("cashCost","")+"");//现金消耗
+                vo.setProductName(map.getOrDefault("productName","")+"");//产品名称
+                //查询  销售人员姓名 以及 返点类型和比列
+                Map<String,Object> slaeMap = reportSettlementMapper.getProfitBytedanceSale(map.get("productId")+"");
+                if (!Check.isNull(slaeMap)){
+                    vo.setSaleName(slaeMap.getOrDefault("saleName","")+"");//销售
+                    // 当前查询时间 与 销售政策 开始 截至时间 是否匹配
+                    if (SettlementUtil.isEffectiveDate(paramsVo.getUploadYears(),slaeMap.get("policyStart")+"",slaeMap.get("policyEnd")+"")){
+                        //销售政策状态 为 通过 显示 返点类型 和 返点比列
+                        if (StringUtils.equals(slaeMap.getOrDefault("approvedStatus","")+"","3")){
+                            vo.setRebateType(slaeMap.getOrDefault("rebateType","")+"");//返点类型
+                            vo.setRebateRate(slaeMap.getOrDefault("rebateRate","")+"");//返点比列
+                        }
+                    }
+                }
+
+                Map<String,Object> operateMap = reportSettlementMapper.getProfitKuaiShouOperate(map.get("accountId")+"");
+                if (!Check.isNull(operateMap)){
+                    vo.setKsId(operateMap.getOrDefault("ksId","")+"");//快手id
+                    vo.setAdvertiserName(operateMap.getOrDefault("advertiserName","")+"");//广告主名称
+                    vo.setOperateName(operateMap.getOrDefault("operateName","")+"");//运营
+                    vo.setOperateArea(operateMap.getOrDefault("operateArea","")+"");//运营所属区域
+                }
+                resultList.add(vo);
+            }
+
+            Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("快手利润单", "快手利润单"), ProfitReportKuaiShouVo.class, resultList);
+
+            try {
+                response.setCharacterEncoding("UTF-8");
+                response.setHeader("content-Type", "application/vnd.ms-excel");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("快手利润单.xls", "UTF-8"));
+                workbook.write(response.getOutputStream());
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("====>>>>", e.getMessage());
+            return Result.errorMsg(e.getMessage());
+        }
+        return null;
+    }
+
+
+    /**
+     *
+     * @description: 给运营发送消息
+     *
+     * @param userId
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result sendMessageToOperate(String userId) {
+        int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
+        int productNum = 0;
+        int accountNum = 0;
+        String productInfo = null;
+        String message =  "运营人{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
+
+        //查询所有 运营绑定的账户
+        List<Map<String,Object>> userList = reportSettlementMapper.getAccountOperateUserId();
+        for (Map<String, Object> userMap : userList) {
+             userId = userMap.get("userId").toString();
+            //查询运营下的 账户 和 产品信息
+            List<Map<String,Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(userId);
+            if (Check.isNull(productList)){
+                continue;
+            }
+            //产品名称
+            List product = productList.stream().map(map -> map.get("productName")).distinct().collect(Collectors.toList());
+            productNum = product.size();
+            accountNum = productList.size();
+            productInfo = StringUtils.join(product.toArray(),"、");
+
+            //发送微信通知
+            JSONObject jsonObject =  mailLogMapper.getWChatIdByUserId("f990f815ecef43fab9cbe1bb22bb6d63");
+            String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
+            corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
+        }
+        return Result.successMsg("成功。",null);
+    }
+
+
+    public static void main(String[] args) {
+        String a =  "woshiwoshi{1}woshi{2}111{3}===";
+        String b = MessageFormat.format(a,"测试","我","你","结束");
+        System.out.println(a);
+        System.out.println(b);
+    }
+
+}

+ 162 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/SettlementFileInfoServiceImpl.java

@@ -0,0 +1,162 @@
+package org.jeecg.ctop.finance.settlement.service.serviceImpl;
+
+import cn.afterturn.easypoi.excel.ExcelImportUtil;
+import cn.afterturn.easypoi.excel.entity.ImportParams;
+import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
+import cn.hutool.core.bean.copier.CopyOptions;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.antlr.v4.runtime.misc.Array2DHashSet;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.ctop.finance.policy.utils.Check;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementFileInfo;
+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.SettlementFileParamsVo;
+import org.jeecg.ctop.finance.settlement.mapper.SettlementFileInfoMapper;
+import org.jeecg.ctop.finance.settlement.mapper.SettlementInfoMapper;
+import org.jeecg.ctop.finance.settlement.service.ISettlementFileInfoService;
+import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
+import org.jeecg.ctop.finance.utils.SettlementUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mapping.AccessOptions;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+@Slf4j
+@Service
+public class SettlementFileInfoServiceImpl extends ServiceImpl<SettlementFileInfoMapper, ctopCwjsSettlementFileInfo> implements ISettlementFileInfoService {
+
+    @Resource
+    private SettlementFileInfoMapper settlementFileInfoMapper;
+
+    @Resource
+    private SettlementInfoMapper settlementInfoMapper;
+
+
+    /**
+     *
+     * @description: 查询 财务结算-结算单列表
+     *
+     * @param paramsVo
+     * @param pageNo
+     * @param pageSize
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result<PageInfo<Map<String,String>>> getSettlementSheetList(SettlementFileParamsVo paramsVo, Integer pageNo, Integer pageSize) {
+        Set accountSet = new HashSet();
+        Set imageSet = new HashSet();
+        PageHelper.startPage(pageNo, pageSize);
+        List<Map<String,String>> list = settlementFileInfoMapper.getSettlementSheetList(paramsVo);
+        list.forEach(map -> {
+            //账户数量
+            QueryWrapper<ctopCwjsSettlementInfo> settlementAccountQw = new QueryWrapper<>();
+            //广告主id
+            settlementAccountQw.eq("advertiser_id",map.get("advertiserId"));
+            //产品id
+            settlementAccountQw.eq("product_id",map.get("productId"));
+            //媒体类型 1-头条 2-快手 3-头条内广 4-快手内广
+            settlementAccountQw.eq("media_id",map.get("mediaId"));
+            //账户状态 0-开 1-关
+            settlementAccountQw.eq("status",0);
+            //(0,正常,1已删除)
+            settlementAccountQw.eq("del_flag",0);
+            List<ctopCwjsSettlementInfo> settlementAccountList =  settlementInfoMapper.selectList(settlementAccountQw);
+            List<String>  advertiserList = settlementAccountList.stream().map(ctopCwjsSettlementInfo::getAccountId).collect(Collectors.toList());
+            if (!Check.isNull(advertiserList)){
+                accountSet.addAll(advertiserList);
+            }
+            //图片数量
+            QueryWrapper<ctopCwjsSettlementFileInfo> settlementFileInfoQw = new QueryWrapper<>();
+            //广告主id
+            settlementFileInfoQw.eq("advertiser_id",map.get("advertiserId"));
+            //产品id
+            settlementFileInfoQw.eq("product_id",map.get("productId"));
+            //媒体类型 1-头条 2-快手 3-头条内广 4-快手内广
+            settlementFileInfoQw.eq("media_id",map.get("mediaId"));
+            //上传人 (运营)
+            settlementFileInfoQw.eq("create_user_id",map.get("operateUserId"));
+            //(0,正常,1已删除)
+            settlementFileInfoQw.eq("del_flag",0);
+            List<ctopCwjsSettlementFileInfo> settlementFileList =  settlementFileInfoMapper.selectList(settlementFileInfoQw);
+            List<String>  imageList = settlementFileList.stream().map(ctopCwjsSettlementFileInfo::getAccountId).collect(Collectors.toList());
+            if (!Check.isNull(imageList)){
+                imageSet.addAll(imageList);
+            }
+            map.put("accountCount", Check.isNull(settlementAccountList) ? "0" : String.valueOf(settlementAccountList.size()));
+            map.put("imageCount",Check.isNull(settlementFileList) ? "0" : String.valueOf(settlementFileList.size()));
+        });
+
+        //当前页 账户、图片(去重)总计
+        if (!Check.isNull(list)){
+            list.get(0).put("accountTotal",Check.isNull(accountSet.size()) ? "0" : String.valueOf(accountSet.size()));
+            list.get(0).put("imageTotal",Check.isNull(imageSet.size()) ? "0" : String.valueOf(imageSet.size()));
+        }
+
+        PageInfo<Map<String,String>> pageInfo = new PageInfo<>(list);
+        return Result.successMsg("财务结算-结算单列表查询成功。", pageInfo);
+    }
+
+
+    /**
+     *
+     * @description: 删除
+     *
+     * @param paramsVo
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result deleteSettlementFile(SettlementFileParamsVo paramsVo) {
+        settlementFileInfoMapper.deleteSettlementFile(paramsVo);
+        return Result.successMsg("删除成功。",null);
+    }
+
+
+    /**
+     * @description: 上传账户截图
+     * @param settlementFileInfo
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result insertAccountImages(ctopCwjsSettlementFileInfo settlementFileInfo) {
+        settlementFileInfo.getSettlementList().forEach(settlement -> {
+            settlement.setAccountId(SettlementUtil.subAccountName(settlement.getFileName()));
+            //BeanUtils.copyProperties(settlementFileInfo,settlement,true,CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
+            BeanUtils.copyProperties(settlementFileInfo,settlement,SettlementUtil.getNullPropertyNames(settlementFileInfo));
+            settlementFileInfoMapper.insert(settlement);
+        });
+        return Result.successMsg("账户截图上传成功。",null);
+    }
+
+
+    /**
+     * @description: 查询账户数量以及图片数量
+     * @param paramsVo
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result getAccountNumAndImgNum(SettlementFileParamsVo paramsVo) {
+        Map<String,String> map =  settlementFileInfoMapper.getAccountNumAndImgNum(paramsVo);
+        return Result.successMsg("查询账户数量以及图片数量成功。",map);
+
+    }
+
+
+}

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

@@ -0,0 +1,130 @@
+package org.jeecg.ctop.finance.settlement.service.serviceImpl;
+
+import cn.afterturn.easypoi.excel.ExcelImportUtil;
+import cn.afterturn.easypoi.excel.entity.ImportParams;
+import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.ctop.finance.settlement.entity.pojo.ctopCwjsSettlementInfo;
+import org.jeecg.ctop.finance.settlement.entity.vo.AccountImportVo;
+import org.jeecg.ctop.finance.settlement.mapper.SettlementInfoMapper;
+import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
+import org.jeecg.ctop.finance.utils.SettlementUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+
+@Slf4j
+@Service
+public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper, ctopCwjsSettlementInfo> implements ISettlementInfoService {
+
+    @Resource
+    private SettlementInfoMapper settlementInfoMapper;
+
+
+    /**
+     *
+     * @description: 查询 财务结算-账户列表
+     *
+     * @param settlementInfo
+     * @param pageNo
+     * @param pageSize
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result getSettlementList(ctopCwjsSettlementInfo settlementInfo, Integer pageNo, Integer pageSize) {
+        PageHelper.startPage(pageNo, pageSize);
+        List<ctopCwjsSettlementInfo> list = settlementInfoMapper.getSettlementList(settlementInfo);
+        PageInfo<ctopCwjsSettlementInfo> pageInfo = new PageInfo<>(list);
+        return Result.successMsg("财务结算-账户列表查询成功。", pageInfo);
+    }
+
+    /**
+     * @description: 财务结算-修改账户状态
+     * @param id
+     * @param status 账户状态 0-开 1-关
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result updSettlementStatusById(Long id, Integer status) {
+        settlementInfoMapper.updSettlementStatusById(id,status);
+        return Result.successMsg("财务结算-修改账户状态成功。.", null);
+    }
+
+    /**
+     *
+     * @description: 删除
+     *
+     * @param id
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result deleteSettlementById(Long id) {
+        settlementInfoMapper.deleteSettlementById(id);
+        return Result.successMsg("财务结算-删除成功。.", null);
+    }
+
+
+    /**
+     *
+     * @description:
+     *
+     * @param settlementInfo
+     * @param file
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     * @time: 2021/7/30 16:26
+     */
+    @Override
+    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);
+                //校验数据
+                importParams.setNeedVerfiy(true);
+
+                //校验表头 头条
+                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","账户名称"});
+                }
+                importParams.setNeedCheckOrder(true);
+                ExcelImportResult<AccountImportVo> importResult = ExcelImportUtil.importExcelMore(file.getInputStream(), AccountImportVo.class,importParams);
+                if (importResult.getList().size() < 1){
+                    return Result.error("读取Excel失败,数据不能为空,请重新检查数据并导入。");
+                }
+                importResult.getList().forEach(importVo -> {
+                    BeanUtils.copyProperties(importVo,settlementInfo);
+                    settlementInfoMapper.insert(settlementInfo);
+                });
+
+            }catch (Exception e){
+                e.printStackTrace();
+                return Result.error("账户数据上传失败,请使用正确的模板导入!");
+            }
+            return Result.successMsg("账户数据上传成功。",null);
+        }
+
+}

+ 147 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/utils/SettlementUtil.java

@@ -0,0 +1,147 @@
+package org.jeecg.ctop.finance.utils;
+
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.BeanWrapperImpl;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * zian Y
+ * 2021/8/3
+ **/
+public class SettlementUtil {
+
+
+    /**
+     * 格式:123456-1
+     * 截取 账户 id
+     * @param str
+     * @return
+     */
+    public static String subAccountName(String str){
+        return str.substring(0, str.indexOf("-"));
+    }
+
+    /**
+     * @Description: 忽略null值/只拷贝非null属性
+     */
+    public static String[] getNullPropertyNames (Object source) {
+        final BeanWrapper src = new BeanWrapperImpl(source);
+        java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors();
+        Set<String> emptyNames = new HashSet<String>();
+        for(java.beans.PropertyDescriptor pd : pds) {
+            Object srcValue = src.getPropertyValue(pd.getName());
+            if (srcValue == null) emptyNames.add(pd.getName());
+        }
+        String[] result = new String[emptyNames.size()];
+        return emptyNames.toArray(result);
+    }
+
+
+
+    /**
+     * 获取网络图片转成字节流
+     * @param strUrl 完整图片地址
+     * @return 图片资源数组
+     */
+    public static byte[] getByteImgByUrl(String strUrl) {
+        try {
+            URL url = new URL(strUrl);
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            conn.setRequestMethod("GET");
+            conn.setConnectTimeout(2 * 1000);
+            // 通过输入流获取图片数据
+            InputStream inStream = conn.getInputStream();
+            // 得到图片的二进制数据
+            byte[] btImg = readInputStream(inStream);
+            return btImg;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+
+    /**
+     * 从输入流中获取字节流数据
+     * @param inStream 输入流
+     * @return  图片流
+     */
+    private static byte[] readInputStream(InputStream inStream) throws Exception {
+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+        // 设置每次读取缓存区大小
+        byte[] buffer = new byte[1024*10];
+        int len = 0;
+        while ((len = inStream.read(buffer)) != -1) {
+            outStream.write(buffer, 0, len);
+        }
+        inStream.close();
+        return outStream.toByteArray();
+    }
+
+    /**
+     * 获取日期的年月
+     * @param strDate
+     * @return
+     */
+    public static int getYearMonth(String strDate)throws Exception{
+
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date date = simpleDateFormat.parse(strDate);
+
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);//设置时间
+        int year = cal.get(Calendar.YEAR);//获取年份
+        int month=cal.get(Calendar.MONTH);//获取月份
+        return year*100+month;//返回年份乘以100加上月份的值,因为月份最多2位数,所以年份乘以100可以获取一个唯一的年月数值
+    }
+
+
+
+    /**
+     * 判断当前时间是否在[startTime, endTime]区间
+     * 年-月   2021-08
+     * @param nowStrTime 当前时间
+     * @param startStrTime 开始时间
+     * @param endStrTime 结束时间
+     * @return
+     * @author zian Y
+     */
+    public static boolean isEffectiveDate(String nowStrTime, String startStrTime, String endStrTime) throws Exception {
+       // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+        Date nowTime = simpleDateFormat.parse(nowStrTime);
+        Date startTime = simpleDateFormat.parse(startStrTime);
+        Date endTime = simpleDateFormat.parse(endStrTime);
+
+        if (nowTime.getTime() == startTime.getTime()
+                || nowTime.getTime() == endTime.getTime()) {
+            return true;
+        }
+        Calendar date = Calendar.getInstance();
+        date.setTime(nowTime);
+        Calendar begin = Calendar.getInstance();
+        begin.setTime(startTime);
+        Calendar end = Calendar.getInstance();
+        end.setTime(endTime);
+        if (date.after(begin) && date.before(end)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+
+
+
+
+
+}

+ 54 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/utils/createExcelByTemplate.java

@@ -0,0 +1,54 @@
+package org.jeecg.ctop.finance.utils;
+
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.util.IOUtils;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+/**
+ * zian Y
+ * 2021/8/5
+ **/
+
+@Slf4j
+public class createExcelByTemplate {
+
+
+
+    /**
+     * 根据地址获得数据的输入流
+     * @param strUrl 网络连接地址
+     * @return url的输入流
+     */
+    public static InputStream getInputStreamByUrl(String strUrl){
+        HttpURLConnection conn = null;
+        try {
+            URL url = new URL(strUrl);
+            conn = (HttpURLConnection)url.openConnection();
+            conn.setRequestMethod("GET");
+            conn.setConnectTimeout(20 * 1000);
+            final ByteArrayOutputStream output = new ByteArrayOutputStream();
+            IOUtils.copy(conn.getInputStream(),output);
+            return  new ByteArrayInputStream(output.toByteArray());
+        } catch (Exception e) {
+            log.error(e+"");
+        }finally {
+            try{
+                if (conn != null) {
+                    conn.disconnect();
+                }
+            }catch (Exception e){
+                log.error(e+"");
+            }
+        }
+        return null;
+    }
+
+
+
+}

+ 295 - 0
jeecg-boot-finance/src/main/resources/application-dev.yml

@@ -0,0 +1,295 @@
+server:
+  tomcat:
+    max-swallow-size: -1
+  error:
+    include-exception: true
+    include-stacktrace: ALWAYS
+    include-message: ALWAYS
+
+  compression:
+    enabled: true
+    min-response-size: 1024
+    mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
+management:
+ endpoints:
+  web:
+   exposure:
+    include: metrics,httptrace
+spring:
+  servlet:
+     multipart:
+        max-file-size: 10MB
+        max-request-size: 10MB
+  mail:
+    host: smtp.163.com
+    username: jeecgos@163.com
+    password: ??
+    properties:
+      mail:
+        smtp:
+          auth: true
+          starttls:
+            enable: true
+            required: true
+  #json 时间戳统一转换
+  jackson:
+    date-format:   yyyy-MM-dd HH:mm:ss
+    time-zone:   GMT+8
+  jpa:
+    open-in-view: false
+  activiti:
+    check-process-definitions: false
+    #启用作业执行器
+    async-executor-activate: false
+    #启用异步执行器
+    job-executor-activate: false
+  aop:
+    proxy-target-class: true
+  #配置freemarker
+  freemarker:
+    # 设置模板后缀名
+    suffix: .ftl
+    # 设置文档类型
+    content-type: text/html
+    # 设置页面编码格式
+    charset: UTF-8
+    # 设置页面缓存
+    cache: false
+    prefer-file-system-access: false
+    # 设置ftl文件路径
+    template-loader-path:
+      - classpath:/templates
+  # 设置静态文件路径,js,css等
+  mvc:
+    static-path-pattern: /**
+  resource:
+    static-locations: classpath:/static/,classpath:/public/
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+  datasource:
+    druid:
+      stat-view-servlet:
+        enabled: true
+        loginUsername: admin
+        loginPassword: 123456
+        allow:
+      web-stat-filter:
+        enabled: true
+    dynamic:
+      druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        initial-size: 5
+        min-idle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters: stat,wall,slf4j
+        # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      datasource:
+        master:
+          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          username: hcst
+          password: hcst@2020
+          driver-class-name: com.mysql.jdbc.Driver
+          # 多数据源配置
+          #multi-datasource1:
+          #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          #username: root
+          #password: root
+          #driver-class-name: com.mysql.cj.jdbc.Driver
+  #redis 配置
+  redis:
+    database: 0
+    host: 127.0.0.1
+    lettuce:
+      pool:
+        max-active: 8   #最大连接数据库连接数,设 0 为没有限制
+        max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
+        max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
+        min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
+      shutdown-timeout: 100ms
+    password: ''
+    port: 6379
+#mybatis plus 设置
+mybatis-plus:
+  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:org/jeecg/**/xml/*Mapper.xml,classpath*:cn/com/ctop/**/xml/*Mapper.xml
+  global-config:
+    # 关闭MP3.0自带的banner
+    banner: false
+    db-config:
+      #主键类型  0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
+      id-type: ASSIGN_ID
+      # 默认数据库表下划线命名
+      table-underline: true
+  configuration:
+    # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
+    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    # 返回类型为Map,显示null对应的字段
+    call-setters-on-nulls: true
+#minidao 设置
+minidao :
+  base-package: org.jeecg.modules.jmreport.*
+  db-type: mysql
+#jeecg专用配置
+jeecg :
+  # 本地:local\Minio:minio\阿里云:alioss
+  uploadType: local
+  path :
+    #文件上传根目录 设置
+    upload: D://opt//upFiles
+    #webapp文件路径
+    webapp: D://opt//webapp
+  shiro:
+    excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
+  #阿里云oss存储配置
+  oss:
+    endpoint: oss-cn-beijing.aliyuncs.com
+    accessKey: ??
+    secretKey: ??
+    bucketName: jeecgos
+    staticDomain: ??
+  # ElasticSearch 6设置
+  elasticsearch:
+    cluster-name: jeecg-ES
+    cluster-nodes: 127.0.0.1:9200
+    check-enabled: false
+  # 表单设计器配置
+  desform:
+    # 主题颜色(仅支持 16进制颜色代码)
+    theme-color: "#1890ff"
+    # 文件、图片上传方式,可选项:qiniu(七牛云)、system(跟随系统配置)
+    upload-type: system
+  # 在线预览文件服务器地址配置
+  file-view-domain: 127.0.0.1:8012
+  # minio文件上传
+  minio:
+    minio_url: http://minio.jeecg.com
+    minio_name: ??
+    minio_pass: ??
+    bucketName: otatest
+  #大屏报表参数设置
+  jmreport:
+    mode: dev
+    #数据字典是否进行saas数据隔离,自己看自己的字典
+    saas: false
+    #是否需要校验token
+    is_verify_token: false
+    #必须校验方法
+    verify_methods: remove,delete,save,add,update
+  #Wps在线文档
+  wps:
+    domain: https://wwo.wps.cn/office/
+    appid: ??
+    appsecret: ??
+  #xxl-job配置
+  xxljob:
+    enabled: false
+    adminAddresses: http://127.0.0.1:9080/xxl-job-admin
+    appname: ${spring.application.name}
+    accessToken: ''
+    address: 127.0.0.1:30007
+    ip: 127.0.0.1
+    port: 30007
+    logPath: logs/jeecg/job/jobhandler/
+    logRetentionDays: 30
+   #自定义路由配置 yml nacos database
+  route:
+    config:
+      data-id: jeecg-gateway-router
+      group: DEFAULT_GROUP
+      data-type: yml
+  #分布式锁配置
+  redisson:
+    address: 127.0.0.1:6379
+    password:
+    type: STANDALONE
+    enabled: true
+#cas单点登录
+cas:
+  prefixUrl: http://cas.example.org:8443/cas
+#Mybatis输出sql日志
+logging:
+  level:
+    org.jeecg.modules.system.mapper : info
+#swagger
+knife4j:
+  production: false
+  basic:
+    enable: false
+    username: jeecg
+    password: jeecg1314
+#第三方登录
+justauth:
+  enabled: true
+  type:
+    GITHUB:
+      client-id: ??
+      client-secret: ??
+      redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
+    WECHAT_ENTERPRISE:
+      client-id: ??
+      client-secret: ??
+      redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
+      agent-id: 1000002
+    DINGTALK:
+      client-id: ??
+      client-secret: ??
+      redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
+    WECHAT_OPEN:
+      client-id: ??
+      client-secret: ??
+      redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
+  cache:
+    type: default
+    prefix: 'demo::'
+    timeout: 1h
+
+bytedance:
+  appId: 1635316529903624
+  secret: 0c51523e90d6166418fc8421a4896808e90e26f4
+  url:
+    auth-prefix: https://ad.oceanengine.com/openapi
+    api-prefix: https://ad.oceanengine.com/open_api
+    callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/bytedance
+    refresh-token: /oauth2/refresh_token
+    advertiser-info: /2/advertiser/public_info/
+    ad-get: /2/ad/get/
+    ad-create: /2/ad/create/
+    ad-update: /2/ad/update/
+    ad-update-status: /2/ad/update/status/
+    ad-update-bid: /2/ad/update/bid/
+    ad-update-budget: /2/ad/update/budget/
+    ad-update-reject-reason: 2/ad/reject_reason/
+    campaign-get: /2/campaign/get/
+    campaign-create: /2/campaign/create/
+    campaign-update-status: /2/campaign/update/status/
+    campaign-update: /2/campaign/update/
+    dmp-custom-audience-select: /2/dmp/custom_audience/select/
+    file-video-ad: /2/file/video/ad/
+    file-image-ad: /2/file/image/ad/
+    creative-update-status: /2/creative/update/status/
+    creative-material-get: /2/creative/material/read/
+    creative-create-v2: /2/creative/create_v2/
+    creative-get: /2/creative/get/
+    creative-read: /2/creative/read_v2/
+    creative-update: /2/creative/update_v2/
+    creative-reject-reason: /2/creative/reject_reason/
+    advertiser-report-get: /2/report/advertiser/get/
+    campaign-report-get: /2/report/campaign/get/
+    ad-report-get: /2/report/ad/get/
+    ad-creative-get: /2/report/creative/get/
+    advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/

+ 289 - 0
jeecg-boot-finance/src/main/resources/application-prod.yml

@@ -0,0 +1,289 @@
+server:
+  tomcat:
+    max-swallow-size: -1
+  error:
+    include-exception: true
+    include-stacktrace: ALWAYS
+    include-message: ALWAYS
+
+  compression:
+    enabled: true
+    min-response-size: 1024
+    mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
+management:
+ endpoints:
+  web:
+   exposure:
+    include: metrics,httptrace
+spring:
+  servlet:
+     multipart:
+        max-file-size: 10MB
+        max-request-size: 10MB
+  mail:
+    host: smtp.163.com
+    username: jeecgos@163.com
+    password: ??
+    properties:
+      mail:
+        smtp:
+          auth: true
+          starttls:
+            enable: true
+            required: true
+  #json 时间戳统一转换
+  jackson:
+    date-format:   yyyy-MM-dd HH:mm:ss
+    time-zone:   GMT+8
+  jpa:
+    open-in-view: false
+  activiti:
+    check-process-definitions: false
+    #启用作业执行器
+    async-executor-activate: false
+    #启用异步执行器
+    job-executor-activate: false
+  aop:
+    proxy-target-class: true
+  #配置freemarker
+  freemarker:
+    # 设置模板后缀名
+    suffix: .ftl
+    # 设置文档类型
+    content-type: text/html
+    # 设置页面编码格式
+    charset: UTF-8
+    # 设置页面缓存
+    cache: false
+    prefer-file-system-access: false
+    # 设置ftl文件路径
+    template-loader-path:
+      - classpath:/templates
+  # 设置静态文件路径,js,css等
+  mvc:
+    static-path-pattern: /**
+  resource:
+    static-locations: classpath:/static/,classpath:/public/
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+  datasource:
+    druid:
+      stat-view-servlet:
+        enabled: true
+        loginUsername: admin
+        loginPassword: 123456
+        allow:
+      web-stat-filter:
+        enabled: true
+    dynamic:
+      druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        initial-size: 5
+        min-idle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters: stat,wall,slf4j
+        # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      datasource:
+        master:
+          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          username: data
+          password: hcst@2021
+          driver-class-name: com.mysql.jdbc.Driver
+  #redis 配置
+  redis:
+    database: 0
+    host: 172.30.0.17
+    lettuce:
+      pool:
+        max-active: 8   #最大连接数据库连接数,设 0 为没有限制
+        max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
+        max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
+        min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
+      shutdown-timeout: 100ms
+    password: hcst@2021..
+    port: 6379
+#mybatis plus 设置
+mybatis-plus:
+  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
+  global-config:
+    # 关闭MP3.0自带的banner
+    banner: false
+    db-config:
+      #主键类型  0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
+      id-type: ASSIGN_ID
+      # 默认数据库表下划线命名
+      table-underline: true
+  configuration:
+    # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
+    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    # 返回类型为Map,显示null对应的字段
+    call-setters-on-nulls: true
+#minidao 设置
+minidao :
+  base-package: org.jeecg.modules.jmreport.*
+  db-type: mysql
+#jeecg专用配置
+jeecg :
+  # 本地:local\Minio:minio\阿里云:alioss
+  uploadType: local
+  path :
+    #文件上传根目录 设置
+    upload: D://opt//upFiles
+    #webapp文件路径
+    webapp: D://opt//webapp
+  shiro:
+    excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
+  #阿里云oss存储配置
+  oss:
+    endpoint: oss-cn-beijing.aliyuncs.com
+    accessKey: ??
+    secretKey: ??
+    bucketName: jeecgos
+    staticDomain: ??
+  # ElasticSearch 6设置
+  elasticsearch:
+    cluster-name: jeecg-ES
+    cluster-nodes: 127.0.0.1:9200
+    check-enabled: false
+  # 表单设计器配置
+  desform:
+    # 主题颜色(仅支持 16进制颜色代码)
+    theme-color: "#1890ff"
+    # 文件、图片上传方式,可选项:qiniu(七牛云)、system(跟随系统配置)
+    upload-type: system
+  # 在线预览文件服务器地址配置
+  file-view-domain: 127.0.0.1:8012
+  # minio文件上传
+  minio:
+    minio_url: http://minio.jeecg.com
+    minio_name: ??
+    minio_pass: ??
+    bucketName: otatest
+  #大屏报表参数设置
+  jmreport:
+    mode: dev
+    #数据字典是否进行saas数据隔离,自己看自己的字典
+    saas: false
+    #是否需要校验token
+    is_verify_token: false
+    #必须校验方法
+    verify_methods: remove,delete,save,add,update
+  #Wps在线文档
+  wps:
+    domain: https://wwo.wps.cn/office/
+    appid: ??
+    appsecret: ??
+  #xxl-job配置
+  xxljob:
+    enabled: false
+    adminAddresses: http://127.0.0.1:9080/xxl-job-admin
+    appname: ${spring.application.name}
+    accessToken: ''
+    address: 127.0.0.1:30007
+    ip: 127.0.0.1
+    port: 30007
+    logPath: logs/jeecg/job/jobhandler/
+    logRetentionDays: 30
+   #自定义路由配置 yml nacos database
+  route:
+    config:
+      data-id: jeecg-gateway-router
+      group: DEFAULT_GROUP
+      data-type: yml
+  #分布式锁配置
+  redisson:
+    address: 127.0.0.1:6379
+    password:
+    type: STANDALONE
+    enabled: true
+#cas单点登录
+cas:
+  prefixUrl: http://cas.example.org:8443/cas
+#Mybatis输出sql日志
+logging:
+  level:
+    org.jeecg.modules.system.mapper : info
+#swagger
+knife4j:
+  production: false
+  basic:
+    enable: false
+    username: jeecg
+    password: jeecg1314
+#第三方登录
+justauth:
+  enabled: true
+  type:
+    GITHUB:
+      client-id: ??
+      client-secret: ??
+      redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
+    WECHAT_ENTERPRISE:
+      client-id: ??
+      client-secret: ??
+      redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
+      agent-id: 1000002
+    DINGTALK:
+      client-id: ??
+      client-secret: ??
+      redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
+    WECHAT_OPEN:
+      client-id: ??
+      client-secret: ??
+      redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
+  cache:
+    type: default
+    prefix: 'demo::'
+    timeout: 1h
+
+bytedance:
+  appId: 1635316529903624
+  secret: 0c51523e90d6166418fc8421a4896808e90e26f4
+  url:
+    auth-prefix: https://ad.oceanengine.com/openapi
+    api-prefix: https://ad.oceanengine.com/open_api
+    callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/bytedance
+    refresh-token: /oauth2/refresh_token
+    advertiser-info: /2/advertiser/public_info/
+    ad-get: /2/ad/get/
+    ad-create: /2/ad/create/
+    ad-update: /2/ad/update/
+    ad-update-status: /2/ad/update/status/
+    ad-update-bid: /2/ad/update/bid/
+    ad-update-budget: /2/ad/update/budget/
+    ad-update-reject-reason: 2/ad/reject_reason/
+    campaign-get: /2/campaign/get/
+    campaign-create: /2/campaign/create/
+    campaign-update-status: /2/campaign/update/status/
+    campaign-update: /2/campaign/update/
+    dmp-custom-audience-select: /2/dmp/custom_audience/select/
+    file-video-ad: /2/file/video/ad/
+    file-image-ad: /2/file/image/ad/
+    creative-update-status: /2/creative/update/status/
+    creative-material-get: /2/creative/material/read/
+    creative-create-v2: /2/creative/create_v2/
+    creative-get: /2/creative/get/
+    creative-read: /2/creative/read_v2/
+    creative-update: /2/creative/update_v2/
+    creative-reject-reason: /2/creative/reject_reason/
+    advertiser-report-get: /2/report/advertiser/get/
+    campaign-report-get: /2/report/campaign/get/
+    ad-report-get: /2/report/ad/get/
+    ad-creative-get: /2/report/creative/get/
+    advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/

+ 248 - 0
jeecg-boot-finance/src/main/resources/application-test.yml

@@ -0,0 +1,248 @@
+
+#swagger
+knife4j:
+  production: false
+  basic:
+    enable: false
+    username: jeecg
+    password: jeecg1314
+management:
+  endpoints:
+    web:
+      exposure:
+        include: metrics,httptrace
+spring:
+  servlet:
+    multipart:
+      max-file-size: -1
+      max-request-size: -1
+  mail:
+    host: smtp.163.com
+    username: jeecgos@163.com
+    password: ??
+    properties:
+      mail:
+        smtp:
+          auth: true
+          starttls:
+            enable: true
+            required: true
+  ## quartz定时任务,采用数据库方式
+  #json 时间戳统一转换
+  jackson:
+    date-format:   yyyy-MM-dd HH:mm:ss
+    time-zone:   GMT+8
+  aop:
+    proxy-target-class: true
+  #配置freemarker
+  freemarker:
+    # 设置模板后缀名
+    suffix: .ftl
+    # 设置文档类型
+    content-type: text/html
+    # 设置页面编码格式
+    charset: UTF-8
+    # 设置页面缓存
+    cache: false
+    prefer-file-system-access: false
+    # 设置ftl文件路径
+    template-loader-path:
+      - classpath:/templates
+  # 设置静态文件路径,js,css等
+  mvc:
+    static-path-pattern: /**
+  resource:
+    static-locations: classpath:/static/,classpath:/public/
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+  datasource:
+    url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
+    username: hcst
+    password: hcst@2020
+    driver-class-name: com.mysql.jdbc.Driver
+    druid:
+      stat-view-servlet:
+        loginUsername: admin
+        loginPassword: hcst2016
+        enabled: true
+      web-stat-filter:
+        enabled: true
+    #      remove-abandoned: false
+    dynamic:
+      druid:
+        # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        connection-init-sql: set names utf8mb4
+        initial-size: 5
+        min-idle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters: stat,slf4j
+        # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      datasource:
+        master:
+          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: hcst@2020
+          driver-class-name: com.mysql.jdbc.Driver
+  #redis 配置
+  redis:
+    database: 0
+    #    host: 172.30.0.17
+    host: 127.0.0.1
+    password:
+    port: 6379
+    lettuce:
+      pool:
+        max-active: 8   #最大连接数据库连接数,设 0 为没有限制
+        max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
+        max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
+        min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
+      shutdown-timeout: 100ms
+#mybatis plus 设置
+mybatis-plus:
+  mapper-locations: classpath*:org/jeecg/**/xml/*Mapper.xml,classpath*:cn/com/ctop/**/xml/*Mapper.xml
+  global-config:
+    # 关闭MP3.0自带的banner
+    banner: false
+    db-config:
+      #主键类型  0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
+      id-type: 4
+      # 默认数据库表下划线命名
+      table-underline: true
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+#jeecg专用配置
+jeecg:
+  elasticsearch:
+    address: 127.0.0.1:9200
+    connect-timeout: 1000
+    socket-timeout: 30000
+    connection-request-timeout: 500
+    max-connect-num: 500
+    max-connect-per-route: 100
+    cluster-nodes:
+    check-enabled: false
+  uploadType:
+  oss:
+    endpoint:
+    accessKey:
+    secretKey:
+    bucketName:
+    staticDomain:
+  sms:
+    accessKeyId:
+    accessKeySecret:
+  minio:
+    minio_url:
+    minio_name:
+    minio_pass:
+    bucketName:
+  ffmpeg:
+    bin: ffmpeg
+  path:
+    #文件上传根目录 设置
+    upload: /mnt/upload
+    #webapp文件路径
+    webapp: /mnt/webapp
+    video-upload: /mnt/upload/video/
+    image-upload: D://data//image//
+    kuaishou-agent-image: D://temp.png
+    kuaishou-account-captcha-image: D://captcha.png
+    chrome-driver: D://chromedriver.exe
+    csv-upload: /mnt/upload/csv/
+    bak-database-file: /mnt/data/bak/
+    report-history: D://mnt//reportKs//
+    report-daily: D://mnt//reportKs//
+kuaishou:
+  api-url: https://ad.e.kuaishou.com
+  auth-url: https://ad.e.kuaishou.com
+  appid: 27
+  third-appid: 328
+  oauth-type: agent
+  secret: QovprB1tNhXptgDc
+  third-secret: 1iFTBiMdohkyEQQs
+  callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
+  third-callback-url: http://callback.shyouteng.com.cn/kuaishou
+  apk-sava-path: /mnt/file/apk
+  image-sava-path: /mnt/file/image
+  video-sava-path: /mnt/file/video
+  model-video-src-path: /mnt/data/src/
+  model-video-fill-path: /mnt/data/fill/
+  model-video-final-path: /mnt/data/final/
+  group-control:
+    path: http://39.106.184.70
+    port: 4723
+logging:
+  level:
+    root: info
+  config: classpath:logback-prod.xml
+chrome:
+  script:
+    clean: sh /mnt/webapp/cleanProcess.sh
+cas:
+  prefixUrl:
+oss:
+  replace:
+    replace-value: oss-cn-beijing-internal
+    replace-old-value: oss-cn-beijing
+    download: D://mnt//image//
+zip:
+  local:
+    download-path: D://mnt//data//
+bytedance:
+  appId: 1635316529903624
+  secret: 0c51523e90d6166418fc8421a4896808e90e26f4
+  url:
+    auth-prefix: https://ad.oceanengine.com/openapi
+    api-prefix: https://ad.oceanengine.com/open_api
+    callback-url: http://adsp.c-top.com.cn:8080/jeecg-boot/bytedance
+    refresh-token: /oauth2/refresh_token
+    advertiser-info: /2/advertiser/public_info/
+    ad-get: /2/ad/get/
+    ad-create: /2/ad/create/
+    ad-update: /2/ad/update/
+    ad-update-status: /2/ad/update/status/
+    ad-update-bid: /2/ad/update/bid/
+    ad-update-budget: /2/ad/update/budget/
+    ad-update-reject-reason: 2/ad/reject_reason/
+    campaign-get: /2/campaign/get/
+    campaign-create: /2/campaign/create/
+    campaign-update-status: /2/campaign/update/status/
+    campaign-update: /2/campaign/update/
+    dmp-custom-audience-select: /2/dmp/custom_audience/select/
+    file-video-ad: /2/file/video/ad/
+    file-image-ad: /2/file/image/ad/
+    creative-update-status: /2/creative/update/status/
+    creative-material-get: /2/creative/material/read/
+    creative-create-v2: /2/creative/create_v2/
+    creative-get: /2/creative/get/
+    creative-read: /2/creative/read_v2/
+    creative-update: /2/creative/update_v2/
+    creative-reject-reason: /2/creative/reject_reason/
+    advertiser-report-get: /2/report/advertiser/get/
+    campaign-report-get: /2/report/campaign/get/
+    ad-report-get: /2/report/ad/get/
+    ad-creative-get: /2/report/creative/get/
+    advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+xxl-job:
+  requestUrl: http://jiaoyangapi.shyouteng.com.cn

+ 17 - 0
jeecg-boot-finance/src/main/resources/application.yml

@@ -0,0 +1,17 @@
+server:
+  port: 7005
+  servlet:
+    context-path: /finance
+
+spring:
+  application:
+    name: jeecg-cloud-finance
+  profiles:
+    active: @activatedProperties@
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 127.0.0.1:8848
+        service: jeecg-cloud-finance
+  main:
+    allow-bean-definition-overriding: true

+ 61 - 0
jeecg-boot-finance/src/test/java/org/jeecg/modules/finance/FinanceTest.java

@@ -0,0 +1,61 @@
+package org.jeecg.modules.finance;
+
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.utils.CorpWexinUtils;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.JeecgSystemApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * zian Y
+ * 2021/8/3
+ **/
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,classes = JeecgSystemApplication.class)
+public class FinanceTest {
+    @Resource
+    CorpWexinUtils corpWexinUtils;
+    @Resource
+    MailLogMapper mailLogMapper;
+    @Test
+    public void weixin(){
+        JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId("26bbe90edc5b475ca41ec3f76aa65067");
+        StringBuilder text = new StringBuilder();
+        text.append("您有一条销售政策需要审核,该客户为:");
+        text.append("测试");
+        text.append(",请及时登录助手平台-销售政策页面进行审核,谢谢!");
+        corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId,text.toString());
+    }
+
+
+    @Test
+    public void getAccountId(){
+        String str1 = "123123123-1";
+        String str2 = "123123123-1";
+        String str = str1.substring(0, str1.indexOf("-"));
+        String str3 = str2.substring(0, str2.indexOf("-"));
+
+        System.out.println(str);
+        System.out.println(str3);
+
+    }
+
+
+    public static void main(String[] args) {
+        String str1 = "123123123-1";
+        String str2 = "123123123-1";
+        String str = str1.substring(0, str1.indexOf("-"));
+        String str3 = str2.substring(0, str2.indexOf("-"));
+
+        System.out.println(str);
+        System.out.println(str3);
+    }
+
+}

+ 22 - 0
jeecg-boot-module-demo/pom.xml

@@ -23,6 +23,28 @@
             <groupId>org.jeecgframework.boot</groupId>
             <artifactId>jeecg-system-local-api</artifactId>
         </dependency>
+
+        <!--alink -->
+        <dependency>
+            <groupId>com.alibaba.alink</groupId>
+            <artifactId>alink_core_flink-1.13_2.11</artifactId>
+            <version>1.4.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-streaming-scala_2.11</artifactId>
+            <version>1.13.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-table-planner_2.11</artifactId>
+            <version>1.13.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flink</groupId>
+            <artifactId>flink-clients_2.11</artifactId>
+            <version>1.13.0</version>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 29 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/test/controller/TestAlinkController.java

@@ -0,0 +1,29 @@
+package org.jeecg.modules.demo.test.controller;
+
+import com.alibaba.alink.operator.batch.BatchOperator;
+import com.alibaba.alink.operator.batch.source.CsvSourceBatchOp;
+import com.alibaba.alink.pipeline.Pipeline;
+import com.alibaba.alink.pipeline.clustering.KMeans;
+import com.alibaba.alink.pipeline.dataproc.vector.VectorAssembler;
+
+public class TestAlinkController {
+    public static void main(String[] args) throws Exception {
+        String URL = "https://alink-release.oss-cn-beijing.aliyuncs.com/data-files/iris.csv";
+        String SCHEMA_STR = "sepal_length double, sepal_width double, petal_length double, petal_width double, category string";
+
+        BatchOperator data = new CsvSourceBatchOp().setFilePath(URL).setSchemaStr(SCHEMA_STR);
+
+        VectorAssembler va = new VectorAssembler()
+                .setSelectedCols(new String[]{"sepal_length", "sepal_width", "petal_length", "petal_width"})
+                .setOutputCol("features");
+
+        KMeans kMeans = new KMeans().setVectorCol("features").setK(3)
+                .setPredictionCol("prediction_result")
+                .setPredictionDetailCol("prediction_detail")
+                .setReservedCols("category")
+                .setMaxIter(100);
+
+        Pipeline pipeline = new Pipeline().add(va).add(kMeans);
+        pipeline.fit(data).transform(data).print();
+    }
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/entity/MaterialAscription.java

@@ -40,6 +40,11 @@ public class MaterialAscription {
     private String planId;
     private String planName;
     /**
+     * 设计负责人
+     */
+    private String leaderId;
+    private String leaderName;
+    /**
      * 平面id
      */
     private String planeId;

+ 1 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/entity/UserCompany.java

@@ -57,6 +57,7 @@ public class UserCompany {
     @ApiModelProperty(value = "公司名称")
     private String companyName;
 
+    private String nickName;
 
     private Date createTime;
     private Date updateTime;

Plik diff jest za duży
+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java


+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -126,6 +126,9 @@
         <if test="planId !=null and planId != ''">
             and ascription.plan_id = #{planId}
         </if>
+        <if test="leaderName !=null and leaderName != ''">
+            and ascription.leader_name like concat('%',#{leaderName},'%')
+        </if>
         <if test="status != null">
             and matInfo.status = #{status}
         </if>

+ 12 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml

@@ -7,8 +7,19 @@
 	</select>
 
     <!-- 根据用户名查询 -->
+    <!-- 修改前的版本select * from  sys_user  where username = #{username} and del_flag = 0 -->
     <select id="getUserByName" resultType="org.jeecg.common.system.entity.SysUser">
-		select * from  sys_user  where username = #{username} and del_flag = 0
+
+		SELECT
+            t2.*,
+            t4.role_name
+        FROM
+            sys_user t2
+        LEFT JOIN sys_user_role t3 ON t2.id = t3.user_id
+        LEFT JOIN sys_role t4 ON t3.role_id = t4.id
+        WHERE
+            t2.username = #{username}
+        AND t2.del_flag = 0
 	</select>
 
     <!-- 根据部门Id查询 -->

+ 5 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -81,5 +81,9 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     JSONArray getIdListByProject(Long projectId);
 
-    Map<String, Object> getListByParams(String tagCode, String type, Integer status, String materialName, List<Long> projectIds, String code, String startDate, String endDate, String userId, String clipId, String shotId, String planId, Integer offlineFlag, Integer pageNo, Integer pageSize);
+    Map<String, Object> getListByParams(String tagCode, String type, Integer status, String materialName, List<Long> projectIds, String code, String startDate, String endDate, String userId, String clipId, String shotId, String planId, String leaderName,Integer offlineFlag, Integer pageNo, Integer pageSize);
+
+    void correlationUploadV2(JSONObject json);
+
+    JSONArray checkArrayCode(JSONArray array);
 }

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserCompanyService.java

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.entity.SysUser;
 
+import java.util.List;
+
 /**
  * 用户够公司
  *
@@ -22,6 +24,8 @@ public interface IUserCompanyService extends IService<UserCompany> {
 
     UserCompany getByUserId(String userId);
 
+    List<UserCompany> getAllByUserId(String userId);
+
     Result<Object> allCompany();
 
     JSONObject getCompanyInfoByAccountId(Long accountId);

+ 174 - 12
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -22,7 +22,9 @@ import it.sauronsoftware.jave.EncoderException;
 import it.sauronsoftware.jave.MultimediaInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.MD5Util;
 import org.jeecg.common.util.encryption.AesEncryptUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -453,7 +455,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                         e.printStackTrace();
                     } catch (EncoderException e) {
                         e.printStackTrace();
-
                     } finally {
                         try {
                             if (fis != null) {
@@ -465,8 +466,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                     }
                 }
             }
-
-
         });
     }
 
@@ -500,6 +499,152 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
      * @return
      */
     @Override
+    public void correlationUploadV2(JSONObject json) {
+        String userId = json.getString("userId");
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            String type = json.getString("type");
+            String url = json.getString("url");
+            String code = json.getString("code");
+            MaterialInfo info = new MaterialInfo();
+            Long projectId = json.getLong("projectId");
+            Project project = projectService.getById(projectId);
+            Long productId = project.getProductId();
+
+            info.setId(UUID.randomUUID().toString().replace("-", ""));
+            info.setCode(code);
+            if (!Check.isNull(json.getString("watermarkUrl"))) {
+                info.setWatermarkUrl(json.getString("watermarkUrl"));
+            }
+            info.setUrl(url);
+            info.setUserId(userId);
+            info.setProjectId(projectId);
+            info.setProductId(productId);
+            info.setWatermarkCode(json.getString("watermarkCode"));
+            info.setStatus(0);
+            info.setMaterialName(StringUtils.getFileNameNoEx(json.getString("materialName")));
+            info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
+            info.setMaterialDescribe(json.getString("materialDescribe"));
+            info.setCreateTime(new Date());
+            info.setUpdateTime(new Date());
+            info.setType(type);
+
+            if (!Check.isNull(project.getSupplierCode())) {
+                info.setSupplierCode(project.getSupplierCode());
+            }
+
+            MaterialCutFrame cutFrame = materialCutFrameService.getCutFrameByCode(code);
+            if (Check.isNull(cutFrame)) {
+                String videoUrl = URLDecoder.decode(info.getUrl()).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
+                String loadImage = "cutFrame/" + code + "/zero.jpg";
+                String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
+                info.setCoverUrl(coverUrl);
+                Thread thread = new Thread() {
+                    @Override
+                    public void run() {
+                        try {
+                            log.info("开始抽帧,code:{}", code);
+                            materialCutFrameService.getTencentCutFrame(videoUrl, code, coverUrl);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                };
+                thread.start();
+            } else {
+                info.setCoverUrl(cutFrame.getUrl());
+            }
+            this.save(info);
+            JSONArray imageArr = json.getJSONArray("imageArr");
+            if (!Check.isNull(imageArr)) {
+                JSONObject imageJson = new JSONObject();
+                imageJson.put("videoId", info.getCode());
+                imageJson.put("userId", userId);
+                imageJson.put("imageArr", imageArr);
+                materialImageInfoService.insertImage(imageJson);
+            }
+            Map<String, Object> deleteMap = new HashMap<>();
+            deleteMap.put("material_id", info.getCode());
+            JSONObject ascription = json.getJSONObject("ascription");
+            if (!Check.isNull(ascription)) {
+                MaterialAscription materialAscription = new MaterialAscription();
+                materialAscription.setMaterialId(info.getCode());
+                String clipId = ascription.getString("clipId");
+                if (null != clipId && !"".equals(clipId.trim())) {
+                    materialAscription.setClipId(clipId);
+                }
+                materialAscription.setShotId(ascription.getString("shotId"));
+                materialAscription.setPlanId(ascription.getString("planId"));
+                materialAscription.setPlaneId(ascription.getString("planeId"));
+                materialAscription.setCode(info.getCode());
+                materialAscriptionMapper.deleteByMap(deleteMap);
+                //TODO 需要添加获取设计负责人代码
+                SysUser clip = userService.getById(clipId);
+                String roleCode = userService.getRoleCodeByUserId(clipId);
+                log.info("剪辑人员名称:"+clip.getRealname()+";ID:"+clipId);
+                String leaderName = "";
+                String leaderId = "";
+                if("designTeamLeader".equals(roleCode)){
+                    leaderId = clipId;
+                    leaderName = clip.getRealname();
+                }else{
+                    leaderId = clip.getLeaderId();
+                    leaderName = clip.getLeaderName();
+                }
+                log.info("负责人名称:"+leaderName+";ID:"+leaderId);
+                materialAscription.setLeaderName(leaderName);
+                materialAscription.setLeaderId(leaderId);
+                int result = materialAscriptionMapper.insert(materialAscription);
+                if (result > 0) {
+                    log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
+                }
+            }
+            materialTagInfoService.deleteByCode(code);
+            JSONArray modalityTagList = json.getJSONArray("modalityTagList");
+            insertTagList(code, userId, modalityTagList);
+            JSONArray contentTagList = json.getJSONArray("contentTagList");
+            insertTagList(code, userId, contentTagList);
+            JSONArray senceTagList = json.getJSONArray("senceTagList");
+            insertTagList(code, userId, senceTagList);
+            JSONArray modTagList = json.getJSONArray("modTagList");
+            insertTagList(code, userId, modTagList);
+            getFile(info);
+            ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
+        } catch (Exception e) {
+            ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public JSONArray checkArrayCode(JSONArray array) {
+        if(null == array||array.isEmpty()){
+            return new JSONArray();
+        }
+        Map<String,String> codeMap = new HashMap<>();
+        JSONArray resultArray = new JSONArray();
+        for(int i=0;i<array.size();i++){
+            JSONObject data = array.getJSONObject(i);
+            String url = "https:"+data.getString("url");
+            data.put("url",url);
+            String code = MD5Util.md5ByUrl(url);
+            if(codeMap.containsKey(code)){
+                continue;
+            }
+            codeMap.put(code,code);
+            data.put("code",code);
+            resultArray.add(data);
+        }
+        return resultArray;
+    }
+
+    /**
+     * 素材库关联上传素材 1
+     *
+     * @param json
+     * @return
+     */
+    @Override
     public Map<String, Object> correlationUpload(JSONObject json) {
         String userId = json.getString("userId");
         Map<String, Object> resultMap = new HashMap<>();
@@ -531,13 +676,11 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             info.setCreateTime(new Date());
             info.setUpdateTime(new Date());
             info.setType(type);
-            //TODO 此处逻辑待调整
-            //      Project project = projectService.getById(projectId);
-            if (!Check.isNull(project)) {
-                if (!Check.isNull(project.getSupplierCode())) {
-                    info.setSupplierCode(project.getSupplierCode());
-                }
+
+            if (!Check.isNull(project.getSupplierCode())) {
+                info.setSupplierCode(project.getSupplierCode());
             }
+
             MaterialCutFrame cutFrame = materialCutFrameService.getCutFrameByCode(code);
             if (Check.isNull(cutFrame)) {
                 String videoUrl = URLDecoder.decode(info.getUrl()).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
@@ -583,6 +726,22 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 materialAscription.setPlaneId(ascription.getString("planeId"));
                 materialAscription.setCode(info.getCode());
                 materialAscriptionMapper.deleteByMap(deleteMap);
+                //TODO 需要添加获取设计负责人代码
+                SysUser clip = userService.getById(clipId);
+                String roleCode = userService.getRoleCodeByUserId(clipId);
+                log.info("剪辑人员名称:"+clip.getRealname()+";ID:"+clipId);
+                String leaderName = "";
+                String leaderId = "";
+                if("designTeamLeader".equals(roleCode)){
+                    leaderId = clipId;
+                    leaderName = clip.getRealname();
+                }else{
+                    leaderId = clip.getLeaderId();
+                    leaderName = clip.getLeaderName();
+                }
+                log.info("负责人名称:"+leaderName+";ID:"+leaderId);
+                materialAscription.setLeaderName(leaderName);
+                materialAscription.setLeaderId(leaderId);
                 int result = materialAscriptionMapper.insert(materialAscription);
                 if (result > 0) {
                     log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
@@ -605,6 +764,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         }
         return resultMap;
     }
+    @Autowired
+    private ISysUserService userService;
 
     @Override
     public String platformUploadVideo(JSONObject json) {
@@ -775,12 +936,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
 
     @Override
-    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, String materialName, List<Long> projectIds, String code, String startDate, String endDate, String userId, String clipId, String shotId, String planId, Integer offlineFlag, Integer pageNo, Integer pageSize) {
+    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, String materialName, List<Long> projectIds, String code, String startDate, String endDate, String userId, String clipId, String shotId, String planId, String leaderName,Integer offlineFlag, Integer pageNo, Integer pageSize) {
         Map<String, Object> result = new HashMap<>();
         PageHelper.startPage(pageNo, pageSize);
 
         String ascription = null;
-        if (!Check.isNull(clipId) || !Check.isNull(shotId) || !Check.isNull(planId)) {
+        //剪辑 || 拍摄 || 策划 || 设计
+        if (!Check.isNull(clipId) || !Check.isNull(shotId) || !Check.isNull(planId) || !Check.isNull(leaderName)) {
             ascription = "true";
         }
 
@@ -792,7 +954,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             endDate = endDate + " 23:59:59";
         }
 
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, materialName, code, startDate, endDate, userId, projectIds, ascription, clipId, shotId, planId, offlineFlag);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, materialName, code, startDate, endDate, userId, projectIds, ascription, clipId, shotId, planId,leaderName, offlineFlag);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
         if (null != dailyList && !dailyList.isEmpty()) {

+ 7 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserCompanyServiceImpl.java

@@ -107,6 +107,13 @@ public class UserCompanyServiceImpl extends ServiceImpl<UserCompanyMapper, UserC
     }
 
     @Override
+    public List<UserCompany> getAllByUserId(String userId) {
+        QueryWrapper<UserCompany> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_id", userId);
+        return this.list(queryWrapper);
+    }
+
+    @Override
     public Result<Object> allCompany() {
         List<JSONObject> data = userCompanyMapper.allCompany();
         return Result.ok(data);

+ 1 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java

@@ -23,6 +23,7 @@ public enum StatusCode {
     COMMON_ACCOUNT_ERROR("参数异常", -2, false),
     COMMON_INTERNET_ERROR("网络请求异常", -3, false),
     COMMON_DATA_NOT_EXIST("数据不存在或者已经被删除", -101, false),
+    COMMON_DATA_NO_PERMMISSION("数据权限不足", -101, false),
     BYTEDANCE_PLAN_DATA_NOT_EXIST("此计划不存在或者已经被删除", -101, false),
     BYTEDANCE_ACCOUNT_DATA_NOT_EXIST("此账户尚未绑定或已停投", -101, false),
     COMMON_VERSION_NOT_EXIST("版本号不存在", -102, false),

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

@@ -14,4 +14,6 @@ import java.util.List;
  */
 public interface AiKuaishouUnitLevelOperationRecordMapper extends BaseMapper<AiKuaishouUnitLevelOperationRecord> {
     List<AiKuaishouUnitLevelOperationRecord> selectAllByAccountId(Date startDate, Date endDate);
+    List<Long> selectAllAccountIds(Date startDate, Date endDate);
+    List<AiKuaishouUnitLevelOperationRecord> selectAllByAccountIdAndDate(Long accountId, Date startDate, Date endDate);
 }

+ 7 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouUnitLevelOperationRecordMapper.xml

@@ -4,4 +4,11 @@
     <select id="selectAllByAccountId" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouUnitLevelOperationRecord">
         select distinct account_id,campaign_id,unit_id from ctop_ai_kuaishou_unit_level_operation_record where unit_id is not null and  create_time &gt;= #{startDate} and create_time &lt;= #{endDate} and account_id in (select account_id from ctop_user_allocation where project_id = 458) group by account_id,campaign_id,unit_id
     </select>
+    <select id="selectAllByAccountIdAndDate" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouUnitLevelOperationRecord">
+        select distinct account_id,campaign_id,unit_id from ctop_ai_kuaishou_unit_level_operation_record where unit_id is not null and unit_type = 4 and create_time &gt;= #{startDate} and create_time &lt;= #{endDate} and account_id = #{accountId} group by account_id,campaign_id,unit_id
+    </select>
+
+    <select id="selectAllAccountIds" resultType="long">
+        select distinct account_id from ctop_ai_kuaishou_unit_level_operation_record where unit_id is not null and  create_time &gt;= #{startDate} and create_time &lt;= #{endDate} and account_id in (select account_id from ctop_user_allocation where project_id = 458) group by account_id
+    </select>
 </mapper>

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

@@ -1890,6 +1890,13 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     JSONObject dataJson = resultJson.getJSONObject("data");
                     if (!Check.isNullMap(dataJson)) {
                         JSONObject returnJson = new JSONObject();
+                        returnJson.put("isAdWatch5times",dataJson.getInteger("is_ad_watch_5_times"));
+                        returnJson.put("isAdWatch20times",dataJson.getInteger("is_ad_watch_20_times"));
+                        returnJson.put("isAdWatch10Times",dataJson.getInteger("is_ad_watch_10_times"));
+                        returnJson.put("isSevenDayRoi",dataJson.getInteger("is_seven_day_roi"));
+                        returnJson.put("isAppointJumpClick",dataJson.getInteger("is_appoint_jump_click"));
+                        returnJson.put("isEventWeekPayTimes",dataJson.getInteger("is_event_week_pay_times"));
+                        returnJson.put("isAppointForm",dataJson.getInteger("is_appoint_form"));
                         returnJson.put("isActivate", dataJson.getInteger("is_activate"));
                         returnJson.put("isFormSubmit", dataJson.getInteger("is_form_submit"));
                         returnJson.put("isCreditGrant", dataJson.getInteger("is_credit_grant"));
@@ -1903,10 +1910,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         returnJson.put("isAppInvoked", dataJson.getInteger("is_app_invoked"));
                         returnJson.put("isMultiConversion", dataJson.getInteger("is_multi_conversion"));
                         returnJson.put("isAdWatchTimes", dataJson.getInteger("is_ad_watch_times"));
-                        returnJson.put("isAppInvoked", dataJson.getInteger("is_app_invoked"));
-                        returnJson.put("isMultiConversion", dataJson.getInteger("is_multi_conversion"));
-                        returnJson.put("isAdWatchTimes", dataJson.getInteger("is_ad_watch_times"));
                         returnJson.put("isOrderPaied", dataJson.getInteger("is_order_paied"));
+                        returnJson.put("isKeyAction", dataJson.getInteger("is_key_action"));
 
                         JSONArray deep_conversion_types = dataJson.getJSONArray("deep_conversion_types");
                         JSONArray deepConversionTypes = new JSONArray();

+ 8 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/clean/mapper/KuaishouAccountCleanTemplateMapper.java

@@ -19,24 +19,24 @@ public interface KuaishouAccountCleanTemplateMapper {
     //创建模板
      void saveAccountCleanTemplate(KuaiShouAccountCleanTemplateInfo kuaiShouAccountCleanTemplateInfo);
     //根据id 创建人查询模板列表
-    List<KuaiShouAccountCleanTemplateInfo> getTemplateList(@Param("templateName") String templateName, @Param("createUser") String createUser, @Param("createId") String createId);
+    List<KuaiShouAccountCleanTemplateInfo> getTemplateList(@Param("templateName")String templateName, @Param("createUser")String createUser, @Param("createId")String createId);
     //根据id查询数据
-    KuaiShouAccountCleanTemplateInfo getInfoById(@Param("templateId") String templateId);
+    KuaiShouAccountCleanTemplateInfo getInfoById(@Param("templateId")String templateId);
     //查询账户关联模板个数
-    int getAccountAssociatedSize(@Param("accountId") String accountId);
+    int getAccountAssociatedSize(@Param("accountId")String accountId);
     //推送模板保存关联关系
-    void savePushTemplateAssociated(@Param("templateId") String templateId, @Param("accountId") String accountId, @Param("createTime") String createTime);
+    void savePushTemplateAssociated(@Param("templateId")String templateId,@Param("accountId")String accountId,@Param("createTime")String createTime);
     //修改模板
     void updateTemplate(KuaiShouAccountCleanTemplateInfo kuaiShouAccountCleanTemplateInfo);
     //根据模板id修改模板状态
-    void updateTemplateStatus(@Param("templateId") String templateId, @Param("status") String status);
+    void updateTemplateStatus(@Param("templateId")String templateId,@Param("status")String status);
     //根据id和accountId 删除关联表信息
-    void removeBinding(@Param("templateId") String templateId, @Param("accountId") String accountId);
+    void removeBinding(@Param("templateId")String templateId,@Param("accountId")String accountId);
     //查询清理日志记录
     List<KuaiShouAccountCleanLogInfo> getCleanUpLog(@Param("templateId") String templateId, @Param("userId") String userId);
 
     //根据账户id 运营名称 查询个人模板信息
-    List<KuaiShouAccountCleanTemplateInfo> getMyselfTemplateList(@Param("accountId") String accountId, @Param("userName") String userName, @Param("createId") String createId);
+    List<KuaiShouAccountCleanTemplateInfo> getMyselfTemplateList(@Param("accountId")String accountId, @Param("userName")String userName, @Param("createId")String createId);
 
     //查询所有启用的模板
     List<KuaiShouAccountCleanTemplateInfo> getTemplateListBystatus();
@@ -47,7 +47,7 @@ public interface KuaishouAccountCleanTemplateMapper {
     //保存操作日志
     void saveCleamLog(KuaiShouAccountCleanLogInfo kuaiShouAccountCleanLogInfo);
 
-    Map<String,String> getUserNameByAccountId(@Param("accountId") String accountId);
+    Map<String,String> getUserNameByAccountId(@Param("accountId")String accountId);
 
     String getUserRealName(@Param("userId") String userId);
     /**

+ 36 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/label/controller/LbelController.java

@@ -1,12 +1,14 @@
 package cn.com.ctop.kuaishou.modules.label.controller;
 
-import cn.com.ctop.kuaishou.modules.clean.entity.KuaiShouAccountCleanTemplateInfo;
+import cn.com.ctop.kuaishou.modules.label.service.MaterialLabelService;
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.common.api.vo.Result;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
+
 /**
  * @Description: 标签管理
  * @Author: zzy
@@ -17,14 +19,40 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/label")
 public class LbelController {
 
+
+    @Resource
+    MaterialLabelService materialTagService;
+
+    /**
+     * 查询所有指标数据
+     *
+     * @param
+     * @return
+     */
+    @GetMapping("/filterMaterial")
+    public Result createCleanTemplate(@Param("type") String type) {
+        return materialTagService.filterMaterial(type);
+    }
+
+    /**
+     * 根据指标数据打标签
+     *
+     * @param
+     * @return
+     */
+    @GetMapping("/materialSpecificationLabel")
+    public Result materialSpecificationLabel(@Param("type") String type) {
+        return materialTagService.materialSpecificationLabel(type);
+    }
+
     /**
-     * 查询标签
+     * 同步标签到ES
      *
-     * @param kuaiShouAccountCleanTemplateInfo
+     * @param
      * @return
      */
-    @PostMapping("/createTemplate")
-    public Result createCleanTemplate(@RequestBody KuaiShouAccountCleanTemplateInfo kuaiShouAccountCleanTemplateInfo){
-        return   null;
+    @GetMapping("/SynchronousLabel")
+    public Result SynchronousLabel(@Param("type") String type) {
+        return materialTagService.SynchronousLabel(type);
     }
 }

+ 0 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/label/entity/LabelStandardInfo.java


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików