add file
This commit is contained in:
16
pluss-api-page/src/main/resources/application-dev.yml
Normal file
16
pluss-api-page/src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://60.205.224.68:3306/chaozhanggui?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: CZGmysqlroot@123
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
parameter:
|
||||
### 这个根据自己的情况配置
|
||||
domain:
|
||||
|
||||
swagger:
|
||||
### 生产环境不允许访问swagger
|
||||
production: false
|
||||
|
||||
logging:
|
||||
config: classpath:log4j2-dev.xml
|
||||
16
pluss-api-page/src/main/resources/application-prod.yml
Normal file
16
pluss-api-page/src/main/resources/application-prod.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
spring:
|
||||
datasource:
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
|
||||
rabbitmq:
|
||||
enabled: true
|
||||
|
||||
swagger:
|
||||
### 生产环境不允许访问swagger
|
||||
production: true
|
||||
|
||||
logging:
|
||||
config: classpath:log4j2-prod.xml
|
||||
14
pluss-api-page/src/main/resources/application-test.yml
Normal file
14
pluss-api-page/src/main/resources/application-test.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
# 测试服务器上的数据库连接
|
||||
spring:
|
||||
datasource:
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
|
||||
parameter:
|
||||
domain:
|
||||
|
||||
swagger:
|
||||
### 生产环境不允许访问swagger
|
||||
production: true
|
||||
27
pluss-api-page/src/main/resources/application.yml
Normal file
27
pluss-api-page/src/main/resources/application.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
spring:
|
||||
output:
|
||||
ansi:
|
||||
enabled: always
|
||||
profiles:
|
||||
### 将一些固定的配置放到下级文件夹下的yml文件中
|
||||
include: common, ryx, ys
|
||||
active: dev
|
||||
mvc:
|
||||
view:
|
||||
prefix: /WEB-INF/jsp/
|
||||
suffix: .jsp
|
||||
resources:
|
||||
static-locations: classpath:/static
|
||||
datasource:
|
||||
druid:
|
||||
break-after-acquire-failure: true
|
||||
connection-error-retry-attempts: 1
|
||||
task:
|
||||
execution:
|
||||
pool:
|
||||
max-size: 20
|
||||
|
||||
server:
|
||||
servlet:
|
||||
context-path: /api
|
||||
port: 7004
|
||||
67
pluss-api-page/src/main/resources/log4j2-dev.xml
Normal file
67
pluss-api-page/src/main/resources/log4j2-dev.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
|
||||
<!--Configuration后面的status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出-->
|
||||
<!--monitorInterval:Log4j能够自动检测修改配置 文件和重新配置本身,设置间隔秒数-->
|
||||
<configuration status="WARN" monitorInterval="30">
|
||||
<!--先定义所有的appender-->
|
||||
<appenders>
|
||||
<!--这个输出控制台的配置-->
|
||||
<console name="Console" target="SYSTEM_OUT">
|
||||
<!--输出日志的格式-->
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p - %c{1.} - %m%n"/>
|
||||
</console>
|
||||
<!--文件会打印出所有信息,这个log每次运行程序会自动清空,由append属性决定,这个也挺有用的,适合临时测试用-->
|
||||
<File name="log" fileName="${sys:user.home}/manage/logs/manage.log" append="false">
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %c{1.} - %msg%xEx%n" />
|
||||
</File>
|
||||
<!--<File name="log" fileName="d:/crystal/logs/manage.log" append="false">
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %c - %msg%xEx%n" />
|
||||
</File>-->
|
||||
<!-- 这个会打印出所有的info及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
|
||||
<RollingFile name="RollingFileInfo" fileName="${sys:user.home}/syb/logs/info.log"
|
||||
filePattern="${sys:user.home}/syb/logs/$${date:yyyy-MM}/info-%d{yyyy-MM-dd}-%i.log">
|
||||
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
|
||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss:SSS} %p - %c{1.} - %m%n"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy modulate="true" interval="1"/>
|
||||
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
<RollingFile name="RollingFileWarn" fileName="${sys:user.home}/syb/logs/warn.log"
|
||||
filePattern="${sys:user.home}/syb/logs/$${date:yyyy-MM}/warn-%d{yyyy-MM-dd}-%i.log">
|
||||
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss:SSS} %p - %c{1.} - %m%n"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy modulate="true" interval="1"/>
|
||||
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||
</Policies>
|
||||
<!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件,这里设置了20 -->
|
||||
<DefaultRolloverStrategy max="20"/>
|
||||
</RollingFile>
|
||||
<RollingFile name="RollingFileError" fileName="${sys:user.home}/syb/logs/error.log"
|
||||
filePattern="${sys:user.home}/syb/logs/$${date:yyyy-MM}/error-%d{yyyy-MM-dd}-%i.log">
|
||||
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss:SSS} %p - %c{1.} - %m%n"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy modulate="true" interval="1"/>
|
||||
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
</appenders>
|
||||
<!--然后定义logger,只有定义了logger并引入的appender,appender才会生效-->
|
||||
<loggers>
|
||||
<!--过滤掉spring和mybatis的一些无用的DEBUG信息-->
|
||||
<logger name="cn.pluss.platform.mapper" level="DEBUG"></logger>
|
||||
<logger name="cn.pluss.platform.ryx" level="DEBUG"></logger>
|
||||
<logger name="cn.pluss.platform.ys" level="DEBUG"></logger>
|
||||
<logger name="org.apache.http.impl.conn.PoolingHttpClientConnectionManager" level="INFO"></logger>
|
||||
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="Console"/>
|
||||
<appender-ref ref="RollingFileInfo"/>
|
||||
<appender-ref ref="RollingFileWarn"/>
|
||||
<appender-ref ref="RollingFileError"/>
|
||||
</root>
|
||||
</loggers>
|
||||
</configuration>
|
||||
72
pluss-api-page/src/main/resources/log4j2-prod.xml
Normal file
72
pluss-api-page/src/main/resources/log4j2-prod.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
|
||||
<!--Configuration后面的status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出-->
|
||||
<!--monitorInterval:Log4j能够自动检测修改配置 文件和重新配置本身,设置间隔秒数-->
|
||||
<configuration status="WARN" monitorInterval="30">
|
||||
<!--先定义所有的appender-->
|
||||
<appenders>
|
||||
<!--这个输出控制台的配置-->
|
||||
<console name="Console" target="SYSTEM_OUT">
|
||||
<!--输出日志的格式-->
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p - %c{1.} - %m%n"/>
|
||||
</console>
|
||||
<!--文件会打印出所有信息,这个log每次运行程序会自动清空,由append属性决定,这个也挺有用的,适合临时测试用-->
|
||||
<File name="log" fileName="${sys:user.home}/manage/logs/manage.log" append="false">
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %c{1.} - %msg%xEx%n" />
|
||||
</File>
|
||||
<!--<File name="log" fileName="d:/crystal/logs/manage.log" append="false">
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %c - %msg%xEx%n" />
|
||||
</File>-->
|
||||
<!-- 这个会打印出所有的info及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
|
||||
<RollingFile name="RollingFileInfo" fileName="${sys:user.home}/syb/logs/info.log"
|
||||
filePattern="${sys:user.home}/syb/logs/$${date:yyyy-MM}/info-%d{yyyy-MM-dd}-%i.log">
|
||||
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
|
||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss:SSS} %p - %c{1.} - %m%n"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy modulate="true" interval="1"/>
|
||||
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
<RollingFile name="RollingFileWarn" fileName="${sys:user.home}/syb/logs/warn.log"
|
||||
filePattern="${sys:user.home}/syb/logs/$${date:yyyy-MM}/warn-%d{yyyy-MM-dd}-%i.log">
|
||||
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss:SSS} %p - %c{1.} - %m%n"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy modulate="true" interval="1"/>
|
||||
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||
</Policies>
|
||||
<!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件,这里设置了20 -->
|
||||
<DefaultRolloverStrategy max="20"/>
|
||||
</RollingFile>
|
||||
<RollingFile name="RollingFileError" fileName="${sys:user.home}/syb/logs/error.log"
|
||||
filePattern="${sys:user.home}/syb/logs/$${date:yyyy-MM}/error-%d{yyyy-MM-dd}-%i.log">
|
||||
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss:SSS} %p - %c{1.} - %m%n"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy modulate="true" interval="1"/>
|
||||
<SizeBasedTriggeringPolicy size="100 MB"/>
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
</appenders>
|
||||
<!--然后定义logger,只有定义了logger并引入的appender,appender才会生效-->
|
||||
<loggers>
|
||||
<!--过滤掉spring和mybatis的一些无用的DEBUG信息-->
|
||||
<!-- <logger name="org.apache.shiro" level="INFO"></logger>-->
|
||||
<!-- <logger name="org.springframework" level="INFO"></logger>-->
|
||||
<!-- <logger name="com.baomidou.mybatisplus.core.MybatisConfiguration" level="INFO"></logger>-->
|
||||
<!-- <logger name="com.baomidou.mybatisplus.core.MybatisConfiguration" level="INFO"></logger>-->
|
||||
<!-- <logger name="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean" level="INFO"></logger>-->
|
||||
<!-- <logger name="org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor" level="INFO"></logger>-->
|
||||
<!-- <logger name="org.mybatis" level="INFO" ></logger>-->
|
||||
<!-- <logger name="cn.pluss.platform.mapper" level="DEBUG"></logger>-->
|
||||
<!-- <logger name="org.apache.http.wire" level="INFO"></logger>-->
|
||||
<!-- <logger name="org.apache.http.headers" level="INFO"></logger>-->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="Console"/>
|
||||
<!-- <appender-ref ref="RollingFileInfo"/>-->
|
||||
<!-- <appender-ref ref="RollingFileWarn"/>-->
|
||||
<!-- <appender-ref ref="RollingFileError"/>-->
|
||||
</root>
|
||||
</loggers>
|
||||
</configuration>
|
||||
104
pluss-api-page/src/main/resources/mapper/ImgReflectMapper.xml
Normal file
104
pluss-api-page/src/main/resources/mapper/ImgReflectMapper.xml
Normal file
@@ -0,0 +1,104 @@
|
||||
<?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.pluss.platform.mapper.ImgReflectMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.pluss.platform.entity.ImgReflect">
|
||||
<id column="id" property="id" />
|
||||
<result column="localUrl" property="localUrl" />
|
||||
<result column="ossUrl" property="ossUrl" />
|
||||
<result column="createTime" property="createTime" />
|
||||
<result column="updateTime" property="updateTime" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectIdCardUrl" resultType="java.util.Map">
|
||||
SELECT ic.id, ic.imgPositive, ic.imgNegative, ir.ossUrl imgPositiveOSS, ir2.ossUrl imgNegativeOSS
|
||||
FROM tb_pluss_id_card ic
|
||||
LEFT JOIN tb_pluss_img_reflect ir ON ir.localUrl = ic.imgPositive
|
||||
LEFT JOIN tb_pluss_img_reflect ir2 ON ir2.localUrl = ic.imgNegative
|
||||
WHERE NOT ((
|
||||
INSTR(imgPositive, "C:/") > 0
|
||||
AND imgPositive IS NOT NULL
|
||||
) OR (
|
||||
INSTR(imgNegative, "C:/") > 0
|
||||
AND imgNegative IS NOT NULL
|
||||
))
|
||||
AND NOT (INSTR(imgPositive, "https://syb-resource") > 0 AND INSTR(imgNegative, "https://syb-resource") > 0)
|
||||
AND (ir.ossUrl IS NULL OR ir2.ossUrl IS NULL)
|
||||
</select>
|
||||
|
||||
<select id="selectBankCardUrl" resultType="java.util.Map">
|
||||
SELECT
|
||||
bc.id,
|
||||
bc.imgUrl,
|
||||
ir.ossUrl imgUrlOSS
|
||||
FROM
|
||||
tb_pluss_bank_card bc
|
||||
LEFT JOIN tb_pluss_img_reflect ir ON ir.localUrl = bc.imgUrl
|
||||
WHERE
|
||||
NOT (
|
||||
INSTR( bc.imgUrl, "C:/" ) > 0
|
||||
AND bc.imgUrl IS NOT NULL
|
||||
) AND (
|
||||
INSTR( bc.imgUrl, "https://syb-resource" ) = 0
|
||||
AND bc.imgUrl IS NOT NULL
|
||||
AND bc.imgUrl != ''
|
||||
) AND ir.ossUrl IS NULL
|
||||
UNION
|
||||
SELECT
|
||||
bc.id,
|
||||
bc.licenseUrl imgUrl,
|
||||
ir.ossUrl imgUrlOSS
|
||||
FROM
|
||||
tb_pluss_bank_card bc
|
||||
LEFT JOIN tb_pluss_img_reflect ir ON ir.localUrl = bc.licenseUrl
|
||||
WHERE
|
||||
NOT (
|
||||
INSTR( bc.licenseUrl, "C:/" ) > 0
|
||||
AND bc.licenseUrl IS NOT NULL
|
||||
)
|
||||
AND (
|
||||
INSTR( bc.licenseUrl, "https://syb-resource" ) = 0
|
||||
AND bc.licenseUrl IS NOT NULL
|
||||
AND bc.licenseUrl != ''
|
||||
) AND ir.ossUrl IS NULL
|
||||
</select>
|
||||
|
||||
<select id="selectStoreImgUrl" resultType="java.util.Map">
|
||||
SELECT
|
||||
mi.id,
|
||||
mi.picUrl imgUrl,
|
||||
ir.ossUrl imgUrlOSS
|
||||
FROM
|
||||
tb_pluss_merchant_image mi
|
||||
LEFT JOIN tb_pluss_img_reflect ir ON ir.localUrl = mi.picUrl
|
||||
WHERE
|
||||
NOT (
|
||||
INSTR( mi.picUrl, "C:/" ) > 0
|
||||
AND mi.picUrl IS NOT NULL
|
||||
) AND (
|
||||
INSTR( mi.picUrl, "https://syb-resource" ) = 0
|
||||
AND mi.picUrl IS NOT NULL
|
||||
AND mi.picUrl != ''
|
||||
) AND ir.ossUrl IS NULL
|
||||
</select>
|
||||
|
||||
<select id="selectUserLogo" resultType="java.util.Map">
|
||||
SELECT
|
||||
ua.id,
|
||||
ua.logo imgUrl,
|
||||
ir.ossUrl imgUrlOSS
|
||||
FROM
|
||||
tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_img_reflect ir ON ir.localUrl = ua.logo
|
||||
WHERE
|
||||
NOT (
|
||||
INSTR( ua.logo, "C:/" ) > 0
|
||||
AND ua.logo IS NOT NULL
|
||||
) AND (
|
||||
INSTR( ua.logo, "https://syb-resource" ) = 0
|
||||
AND ua.logo IS NOT NULL
|
||||
AND ua.logo != ''
|
||||
) AND ir.ossUrl IS NULL
|
||||
</select>
|
||||
</mapper>
|
||||
523
pluss-api-page/src/main/resources/mapper/SpreadMapper.xml
Normal file
523
pluss-api-page/src/main/resources/mapper/SpreadMapper.xml
Normal file
@@ -0,0 +1,523 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.pluss.platform.mapper.SpreadMapper">
|
||||
|
||||
<select id="selectDirectUser" resultType="cn.pluss.platform.entity.UserApp">
|
||||
SELECT
|
||||
ua.userId,
|
||||
ua.parentId,
|
||||
ui.loginName,
|
||||
IFNULL(mr.rate, 38) rate,
|
||||
ui.phone,
|
||||
ua.userName,
|
||||
ua.createDt,
|
||||
mbi.alias,
|
||||
ua.agentStaffId,
|
||||
ua.`level`,
|
||||
ua.`logo`,
|
||||
mcs.remark auditReason,
|
||||
IF (
|
||||
(ua.bankStatus != 3 OR ua.bankStatus IS NULL), 1,
|
||||
CASE mcs.`status`
|
||||
WHEN '1' THEN IF(mcs.`thirdStatus` = '5', 6, 3)
|
||||
WHEN '8' THEN 6
|
||||
WHEN '2' THEN 4
|
||||
WHEN '5' THEN 4
|
||||
WHEN '3' THEN 5
|
||||
WHEN '4' THEN 5
|
||||
ELSE IF(mcs.`thirdStatus` = -100, 4, 2) END
|
||||
) `status`
|
||||
FROM
|
||||
tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_merchant_rate mr ON ua.userId = mr.userId
|
||||
LEFT JOIN tb_pluss_user_info ui ON ui.id = ua.userId
|
||||
LEFT JOIN tb_pluss_merchant_base_info mbi ON ua.merchantCode = mbi.merchantCode
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT mcs.merchantCode, mcs.remark, mcs.`status`, mcs.`thirdStatus` FROM tb_pluss_merchant_channel_status mcs
|
||||
LEFT JOIN (
|
||||
SELECT merchantCode, MAX(valid) maxValid, MIN(id) minId FROM tb_pluss_merchant_channel_status mcs
|
||||
GROUP BY merchantCode
|
||||
) t ON mcs.merchantCode = t.merchantCode AND mcs.valid = t.maxValid
|
||||
WHERE (t.maxValid = 1) OR
|
||||
(t.maxValid = 0 AND t.minId = mcs.id)
|
||||
) mcs ON mcs.merchantCode = ua.merchantCode
|
||||
<where>
|
||||
ua.parentId = #{condition.userId}
|
||||
AND LOCATE('@', ui.loginName) = 0
|
||||
AND LENGTH(ui.loginName) = 11
|
||||
<if test="condition.agentStaffIds != null and condition.agentStaffIds.size() > 0">
|
||||
AND ua.agentStaffId IN
|
||||
<foreach collection="condition.agentStaffIds" open="(" separator="," close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="condition.alias != null and condition.alias != ''">
|
||||
AND mbi.alias LIKE CONCAT('%', #{condition.alias}, '%')
|
||||
</if>
|
||||
<if test="condition.userName != null and condition.userName != ''">
|
||||
AND ua.userName LIKE CONCAT('%', #{condition.userName}, '%')
|
||||
</if>
|
||||
<if test="condition.phone != null and condition.phone != ''">
|
||||
AND ui.phone LIKE CONCAT('%', #{condition.phone}, '%')
|
||||
</if>
|
||||
<if test="condition.startTime != null and condition.startTime != ''">
|
||||
AND ua.createDt >= #{condition.startTime}
|
||||
</if>
|
||||
<if test="condition.endTime != null and condition.endTime != ''">
|
||||
AND ua.createDt < #{condition.endTime}
|
||||
</if>
|
||||
<if test="condition.status != null and condition.status != ''">
|
||||
<choose>
|
||||
<when test='condition.status == "1"'>
|
||||
AND (
|
||||
ua.bankStatus != 3
|
||||
OR ua.bankStatus IS NULL
|
||||
)
|
||||
</when>
|
||||
<when test='condition.status == "3"'>
|
||||
AND mcs.`status` = '1'
|
||||
</when>
|
||||
<when test='condition.status == "4"'>
|
||||
AND (
|
||||
mcs.`status` = '2'
|
||||
OR (mcs.`status` = '0' AND mcs.`thirdStatus` != '-100')
|
||||
OR mcs.`status` = '5'
|
||||
)
|
||||
</when>
|
||||
<when test='condition.status == "5"'>
|
||||
AND (
|
||||
mcs.`status` = '3'
|
||||
OR mcs.`status` = '4'
|
||||
)
|
||||
</when>
|
||||
<when test='condition.status == "2"'>
|
||||
AND (
|
||||
ua.bankStatus = 3
|
||||
AND
|
||||
(
|
||||
mcs.`status` = '0'
|
||||
OR mcs.`status` IS NULL
|
||||
)
|
||||
)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ua.createDt DESC
|
||||
</select>
|
||||
|
||||
<select id="selectPmtSubUser" resultType="cn.pluss.platform.entity.UserApp">
|
||||
SELECT
|
||||
ua.userId,
|
||||
ui.loginName,
|
||||
ua.parentId,
|
||||
IFNULL(mr.rate, 38) rate,
|
||||
ui.phone,
|
||||
ua.userName,
|
||||
ua.createDt,
|
||||
mbi.alias,
|
||||
ua.agentStaffId,
|
||||
ua.`level`,
|
||||
ua.`logo`,
|
||||
mcs.remark auditReason,
|
||||
IF (
|
||||
(ua.bankStatus != 3 OR ua.bankStatus IS NULL), 1,
|
||||
CASE mcs.`status`
|
||||
WHEN '1' THEN IF(mcs.`thirdStatus` = '5', 6, 3)
|
||||
WHEN '8' THEN 6
|
||||
WHEN '2' THEN 4
|
||||
WHEN '5' THEN 4
|
||||
WHEN '3' THEN 5
|
||||
WHEN '4' THEN 5
|
||||
ELSE IF(mcs.`thirdStatus` = -100, 4, 2) END
|
||||
) `status`
|
||||
FROM
|
||||
(
|
||||
(
|
||||
SELECT ua1.userId
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_user_app ua1
|
||||
ON ua.userId = ua1.parentId
|
||||
WHERE ua.parentId = #{condition.userId}
|
||||
)
|
||||
UNION
|
||||
(
|
||||
SELECT ua2.userId
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_user_app ua1
|
||||
ON ua.userId = ua1.parentId
|
||||
LEFT JOIN tb_pluss_user_app ua2
|
||||
ON ua1.userId = ua2.parentId
|
||||
WHERE ua.parentId = #{condition.userId}
|
||||
)
|
||||
) userIdList
|
||||
LEFT JOIN tb_pluss_user_app ua ON ua.userId = userIdList.userId
|
||||
LEFT JOIN tb_pluss_merchant_rate mr ON ua.userId = mr.userId
|
||||
LEFT JOIN tb_pluss_user_info ui ON ui.id = ua.userId
|
||||
LEFT JOIN tb_pluss_merchant_base_info mbi ON ua.merchantCode = mbi.merchantCode
|
||||
LEFT JOIN tb_pluss_merchant_channel_status mcs ON mcs.merchantCode = ua.merchantCode
|
||||
<where>
|
||||
LOCATE('@', ui.loginName) = 0
|
||||
AND LENGTH(ui.loginName) = 11
|
||||
<if test="condition.agentStaffIds != null and condition.agentStaffIds.size() > 0">
|
||||
AND ua.agentStaffId IN
|
||||
<foreach collection="condition.agentStaffIds" open="(" separator="," close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="condition.alias != null and condition.alias != ''">
|
||||
AND mbi.alias LIKE CONCAT('%', #{condition.alias}, '%')
|
||||
</if>
|
||||
<if test="condition.userName != null and condition.userName != ''">
|
||||
AND ua.userName LIKE CONCAT('%', #{condition.userName}, '%')
|
||||
</if>
|
||||
<if test="condition.phone != null and condition.phone != ''">
|
||||
AND ui.phone LIKE CONCAT('%', #{condition.phone}, '%')
|
||||
</if>
|
||||
<if test="condition.startTime != null and condition.startTime != ''">
|
||||
AND ua.createDt >= #{condition.startTime}
|
||||
</if>
|
||||
<if test="condition.endTime != null and condition.endTime != ''">
|
||||
AND ua.createDt < #{condition.endTime}
|
||||
</if>
|
||||
<if test="condition.status != null and condition.status != ''">
|
||||
<choose>
|
||||
<when test='condition.status == "1"'>
|
||||
AND (
|
||||
ua.bankStatus != 3
|
||||
OR ua.bankStatus IS NULL
|
||||
)
|
||||
</when>
|
||||
<when test='condition.status == "3"'>
|
||||
AND mcs.`status` = '1'
|
||||
</when>
|
||||
<when test='condition.status == "4"'>
|
||||
AND (
|
||||
mcs.`status` = '2'
|
||||
OR mcs.`status` = '5'
|
||||
)
|
||||
</when>
|
||||
<when test='condition.status == "5"'>
|
||||
AND (
|
||||
mcs.`status` = '3'
|
||||
OR mcs.`status` = '4'
|
||||
)
|
||||
</when>
|
||||
<when test='condition.status == "2"'>
|
||||
AND (
|
||||
ua.bankStatus = 3
|
||||
AND (
|
||||
mcs.`status` = '0'
|
||||
OR mcs.`status` IS NULL
|
||||
)
|
||||
)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ua.createDt DESC
|
||||
</select>
|
||||
|
||||
<select id="selectAgentSubUser" resultType="cn.pluss.platform.entity.UserApp">
|
||||
SELECT
|
||||
ua.userId,
|
||||
ua.parentId,
|
||||
ui.loginName,
|
||||
IFNULL(mr.rate, 38) rate,
|
||||
ui.phone,
|
||||
ua.userName,
|
||||
ua.createDt,
|
||||
mbi.alias,
|
||||
ua.agentStaffId,
|
||||
ua.`level`,
|
||||
ua.`logo`,
|
||||
mcs.remark auditReason,
|
||||
IF (
|
||||
(ua.bankStatus != 3 OR ua.bankStatus IS NULL), 1,
|
||||
CASE mcs.`status`
|
||||
WHEN '1' THEN 3
|
||||
WHEN '2' THEN 4
|
||||
WHEN '3' THEN 5
|
||||
ELSE 2 END
|
||||
) `status`
|
||||
FROM
|
||||
(
|
||||
(
|
||||
SELECT ua1.userId
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_user_app ua1
|
||||
ON ua.userId = ua1.parentId
|
||||
WHERE ua.parentId = #{condition.userId}
|
||||
AND ua.userType = 'agent'
|
||||
AND LOCATE(#{condition.userId}, ua.pIdArr ) > 0
|
||||
)
|
||||
UNION
|
||||
(
|
||||
SELECT ua1.userId
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_user_app ua1
|
||||
ON ua.userId = ua1.parentId
|
||||
WHERE ua.parentId = #{condition.userId}
|
||||
AND ua.userType = 'promoter'
|
||||
)
|
||||
UNION
|
||||
(
|
||||
SELECT ua2.userId
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_user_app ua1
|
||||
ON ua.userId = ua1.parentId
|
||||
LEFT JOIN tb_pluss_user_app ua2
|
||||
ON ua1.userId = ua2.parentId
|
||||
WHERE ua.parentId = #{condition.userId}
|
||||
AND ua.userType = 'promoter'
|
||||
)
|
||||
) userIdList
|
||||
LEFT JOIN tb_pluss_user_app ua ON ua.userId = userIdList.userId
|
||||
LEFT JOIN tb_pluss_merchant_rate mr ON ua.userId = mr.userId
|
||||
LEFT JOIN tb_pluss_user_info ui ON ui.id = ua.userId
|
||||
LEFT JOIN tb_pluss_merchant_base_info mbi ON ua.merchantCode = mbi.merchantCode
|
||||
LEFT JOIN tb_pluss_merchant_channel_status mcs ON mcs.merchantCode = ua.merchantCode
|
||||
<where>
|
||||
LOCATE('@', ui.loginName) = 0
|
||||
AND LENGTH(ui.loginName) = 11
|
||||
<if test="condition.agentStaffIds != null and condition.agentStaffIds.size() > 0">
|
||||
AND ua.agentStaffId IN
|
||||
<foreach collection="condition.agentStaffIds" open="(" separator="," close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="condition.alias != null and condition.alias != ''">
|
||||
AND mbi.alias LIKE CONCAT('%', #{condition.alias}, '%')
|
||||
</if>
|
||||
<if test="condition.userName != null and condition.userName != ''">
|
||||
AND ua.userName LIKE CONCAT('%', #{condition.userName}, '%')
|
||||
</if>
|
||||
<if test="condition.phone != null and condition.phone != ''">
|
||||
AND ui.phone LIKE CONCAT('%', #{condition.phone}, '%')
|
||||
</if>
|
||||
<if test="condition.startTime != null and condition.startTime != ''">
|
||||
AND ua.createDt >= #{condition.startTime}
|
||||
</if>
|
||||
<if test="condition.endTime != null and condition.endTime != ''">
|
||||
AND ua.createDt < #{condition.endTime}
|
||||
</if>
|
||||
<if test="condition.status != null and condition.status != ''">
|
||||
<choose>
|
||||
<when test='condition.status == "1"'>
|
||||
AND (
|
||||
ua.bankStatus != 3
|
||||
OR ua.bankStatus IS NULL
|
||||
)
|
||||
</when>
|
||||
<when test='condition.status == "3"'>
|
||||
AND mcs.`status` = '1'
|
||||
</when>
|
||||
<when test='condition.status == "4"'>
|
||||
AND (
|
||||
mcs.`status` = '2'
|
||||
OR mcs.`status` = '5'
|
||||
)
|
||||
</when>
|
||||
<when test='condition.status == "5"'>
|
||||
AND (
|
||||
mcs.`status` = '3'
|
||||
OR mcs.`status` = '4'
|
||||
)
|
||||
</when>
|
||||
<when test='condition.status == "2"'>
|
||||
AND (
|
||||
ua.bankStatus = 3
|
||||
AND (
|
||||
mcs.`status` = '0'
|
||||
OR mcs.`status` IS NULL
|
||||
)
|
||||
)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ua.createDt DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询团队交易数据 -->
|
||||
<select id="userTemaAchiePage" resultType="cn.pluss.platform.vo.UserTeamAchieVO">
|
||||
SELECT
|
||||
<choose>
|
||||
<when test="condition.dataType == null or condition.dataType == 1">
|
||||
<if test="condition.dateType == null or condition.dateType == 1">
|
||||
SUM(ownTransFlow) as tradeAmt ,SUM(transNum) as tradeNum,profitDate as `date`,userId, 1 as dateType
|
||||
</if>
|
||||
<if test="condition.dateType == 2">
|
||||
SUM(ownTransFlow) as tradeAmt,SUM(transNum) as tradeNum,profitMonth as `date`,userId,2 as dateType
|
||||
</if>
|
||||
<if test="condition.dateType == 3">
|
||||
SUM(ownTransFlow) as tradeAmt,SUM(transNum) as tradeNum,DATE_FORMAT(profitDate,'%Y') as `date`,userId,3 as dateType
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="condition.dateType == null or condition.dateType == 1">
|
||||
(teamTransFlow) as tradeAmt ,transNum as tradeNum,profitDate as `date`,userId, 1 as dateType
|
||||
</if>
|
||||
<if test="condition.dateType == 2">
|
||||
SUM(teamTransFlow) as tradeAmt,SUM(transNum) as tradeNum,profitMonth as `date`,userId,2 as dateType
|
||||
</if>
|
||||
<if test="condition.dateType == 3">
|
||||
SUM(teamTransFlow) as tradeAmt,SUM(transNum) as tradeNum,DATE_FORMAT(profitDate,'%Y') as `date`,userId,3 as dateType
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
from tb_pluss_user_profit where
|
||||
<choose>
|
||||
<when test="condition.dataType == null or condition.dataType == 1">
|
||||
parentId = #{condition.userId} and ownTransFlow != 0 and teamTransFlow = 0
|
||||
</when>
|
||||
<otherwise>
|
||||
userId = #{condition.userId}
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="condition.dateType == null or condition.dateType == 1">
|
||||
group by profitDate
|
||||
</if>
|
||||
<if test="condition.dateType == 2">
|
||||
group by profitMonth
|
||||
</if>
|
||||
<if test="condition.dateType == 3">
|
||||
group by DATE_FORMAT(profitDate,'%Y')
|
||||
</if>
|
||||
order by
|
||||
<if test="condition.dateType == null or condition.dateType == 1">
|
||||
profitDate
|
||||
</if>
|
||||
<if test="condition.dateType == 2">
|
||||
profitMonth
|
||||
</if>
|
||||
<if test="condition.dateType == 3">
|
||||
DATE_FORMAT(profitDate,'%Y')
|
||||
</if>
|
||||
desc
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectTodaySpreadData" resultType="cn.pluss.platform.vo.SpreadData">
|
||||
SELECT
|
||||
IFNULL(SUM(IF(mo.`status` = 1, mo.consumeFee, IF(mo.`status` = 2, -mo.consumeFee, 0))), 0.00) ownAmt,
|
||||
COUNT(DISTINCT IF(mo.`status` = 1, mo.orderNumber, 0)) ownBillCount,
|
||||
COUNT(DISTINCT IF(mo.`status` = 1 || mo.`status` = 2, mo.merchantCode, 0)) ownActiveCount,
|
||||
COUNT(DISTINCT IF(ua.createDt > CURRENT_DATE, ua.userId, 0)) ownNewCount,
|
||||
CURRENT_DATE date
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_user_app sua ON ua.userId = sua.parentId
|
||||
LEFT JOIN tb_pluss_merchant_order mo ON mo.merchantCode = ua.merchantCode AND mo.createDate = CURRENT_DATE
|
||||
WHERE ua.parentId = #{userId} AND ua.userType = 'promoter' AND ua.userType = 'promoter'
|
||||
</select>
|
||||
|
||||
<select id="pageDaySpreadPageData" resultType="cn.pluss.platform.vo.SpreadData">
|
||||
SELECT startDate date, COUNT(DISTINCT IF(createDate <= startDate, merchantCode, NULL)) ownActiveCount
|
||||
, COUNT(DISTINCT IF(createDate = startDate, merchantCode, NULL)) ownNewCount
|
||||
, SUM(amount) ownAmt, SUM(count) ownBillCount
|
||||
FROM (
|
||||
SELECT DISTINCT DATE_FORMAT(ua.createDt, '%Y-%m-%d') createDate, ua.merchantCode, ua.userId, mbs.amount, mbs.count, mbs.startDate
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_merchant_channel_status mcs ON ua.merchantCode = mcs.merchantCode
|
||||
LEFT JOIN tb_pluss_merchant_bill_statistics mbs ON mbs.userId = ua.userId
|
||||
WHERE ua.parentId = #{userId} AND mbs.type = 1 AND mcs.status = 3
|
||||
) t GROUP BY startDate
|
||||
</select>
|
||||
|
||||
<select id="pageMonthSpreadPageData" resultType="cn.pluss.platform.vo.SpreadData">
|
||||
SELECT startDate month, COUNT(DISTINCT IF(createDate <= startDate, merchantCode, NULL)) ownActiveCount, SUM(amount) ownAmt, SUM(count) ownBillCount
|
||||
, COUNT(DISTINCT IF(createDate = startDate, merchantCode, NULL)) ownNewCount
|
||||
FROM (
|
||||
SELECT DISTINCT DATE_FORMAT(ua.createDt, '%Y-%m') createDate, ua.merchantCode, ua.userId, mbs.amount, mbs.count, DATE_FORMAT(mbs.startDate, '%Y-%m') startDate
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_merchant_channel_status mcs ON ua.merchantCode = mcs.merchantCode
|
||||
LEFT JOIN tb_pluss_merchant_bill_statistics mbs ON mbs.userId = ua.userId
|
||||
WHERE ua.parentId = #{userId} AND mbs.type = 1 AND mcs.status = 3
|
||||
) t GROUP BY startDate
|
||||
</select>
|
||||
|
||||
<select id="pageYearSpreadPageData" resultType="cn.pluss.platform.vo.SpreadData">
|
||||
SELECT startDate year, COUNT(DISTINCT IF(createDate <= startDate, merchantCode, NULL)) ownActiveCount, SUM(amount) ownAmt, SUM(count) ownBillCount
|
||||
, COUNT(DISTINCT IF(createDate = startDate, merchantCode, NULL)) ownNewCount
|
||||
FROM (
|
||||
SELECT DISTINCT DATE_FORMAT(ua.createDt, '%Y') createDate, ua.merchantCode, ua.userId, mbs.amount, mbs.count, DATE_FORMAT(mbs.startDate, '%Y') startDate
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_merchant_channel_status mcs ON ua.merchantCode = mcs.merchantCode
|
||||
LEFT JOIN tb_pluss_merchant_bill_statistics mbs ON mbs.userId = ua.userId
|
||||
WHERE ua.parentId = #{userId} AND mbs.type = 1 AND mcs.status = 3
|
||||
) t GROUP BY startDate
|
||||
</select>
|
||||
|
||||
<select id="pageTeamDaySpreadPageData" resultType="cn.pluss.platform.vo.SpreadData">
|
||||
SELECT startDate date, COUNT(DISTINCT IF(createDate < startDate, merchantCode, NULL)) teamActiveCount, SUM(amount) teamAmt, SUM(count) teamBillCount
|
||||
, COUNT(DISTINCT IF(createDate = startDate, merchantCode, NULL)) teamNewCount
|
||||
FROM (
|
||||
SELECT DISTINCT DATE_FORMAT(ua2.createDt, '%Y-%m-%d') createDate, ua2.merchantCode, ua2.userId, mbs.amount, mbs.count, mbs.startDate FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_user_app ua2 ON ua2.parentId = ua.userId
|
||||
LEFT JOIN tb_pluss_merchant_channel_status mcs ON ua.merchantCode = mcs.merchantCode
|
||||
LEFT JOIN tb_pluss_merchant_bill_statistics mbs ON mbs.userId = ua.userId
|
||||
WHERE ua.parentId = #{userId} AND mbs.type = 1 AND mcs.status = 3
|
||||
) t GROUP BY startDate
|
||||
</select>
|
||||
|
||||
<select id="pageTeamMonthSpreadPageData" resultType="cn.pluss.platform.vo.SpreadData">
|
||||
SELECT startDate month, COUNT(DISTINCT IF(createDate < startDate, merchantCode, NULL)) teamActiveCount, SUM(amount) teamAmt, SUM(count) teamBillCount
|
||||
, COUNT(DISTINCT IF(createDate = startDate, merchantCode, NULL)) teamNewCount
|
||||
FROM (
|
||||
SELECT DISTINCT DATE_FORMAT(ua2.createDt, '%Y-%m') createDate, ua2.merchantCode, ua2.userId, mbs.amount, mbs.count, DATE_FORMAT(mbs.startDate, '%Y-%m') startDate
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_user_app ua2 ON ua2.parentId = ua.userId
|
||||
LEFT JOIN tb_pluss_merchant_channel_status mcs ON ua.merchantCode = mcs.merchantCode
|
||||
LEFT JOIN tb_pluss_merchant_bill_statistics mbs ON mbs.userId = ua.userId
|
||||
WHERE ua.parentId = #{userId} AND mbs.type = 1 AND mcs.status = 3
|
||||
) t GROUP BY startDate
|
||||
</select>
|
||||
|
||||
<select id="pageTeamYearSpreadPageData" resultType="cn.pluss.platform.vo.SpreadData">
|
||||
SELECT startDate year, COUNT(DISTINCT IF(createDate < startDate, merchantCode, NULL)) teamActiveCount, SUM(amount) teamAmt, SUM(count) teamBillCount
|
||||
, COUNT(DISTINCT IF(createDate = startDate, merchantCode, NULL)) teamNewCount
|
||||
FROM (
|
||||
SELECT DISTINCT DATE_FORMAT(ua2.createDt, '%Y') createDate, ua2.merchantCode, ua2.userId, mbs.amount, mbs.count, DATE_FORMAT(mbs.startDate, '%Y') startDate
|
||||
FROM tb_pluss_user_app ua
|
||||
LEFT JOIN tb_pluss_user_app ua2 ON ua2.parentId = ua.userId
|
||||
LEFT JOIN tb_pluss_merchant_channel_status mcs ON ua.merchantCode = mcs.merchantCode
|
||||
LEFT JOIN tb_pluss_merchant_bill_statistics mbs ON mbs.userId = ua.userId
|
||||
WHERE ua.parentId = #{userId} AND mbs.type = 1 AND mcs.status = 3
|
||||
) t GROUP BY startDate
|
||||
</select>
|
||||
|
||||
<select id="getAppUserTeanFlow" parameterType="cn.pluss.platform.vo.UserTeamAchieVO" resultType="cn.pluss.platform.vo.UserTeamAchieVO">
|
||||
SELECT
|
||||
<choose>
|
||||
<when test="dataType == null or dataType == 1">
|
||||
SUM(ownTransFlow) as tradeAmt,SUM(transNum) as tradeNum
|
||||
</when>
|
||||
<otherwise>
|
||||
SUM(teamTransFlow) as tradeAmt ,SUM(transNum) as tradeNum
|
||||
</otherwise>
|
||||
</choose>
|
||||
from tb_pluss_user_profit
|
||||
where
|
||||
<choose>
|
||||
<when test="dataType == null or dataType == 1">
|
||||
parentId = #{userId} and ownTransFlow != 0 and teamTransFlow = 0
|
||||
</when>
|
||||
<otherwise>
|
||||
userId = #{userId}
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="dateType == null or dateType == 1">
|
||||
and profitDate = #{date}
|
||||
</if>
|
||||
<if test="dateType == 2">
|
||||
and profitMonth = #{date}
|
||||
</if>
|
||||
<if test="dateType == 3">
|
||||
and DATE_FORMAT(profitDate,'%Y') = #{date}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user