admin
2019-02-21 7e57a20c0ccde504c2f2b2b9fd4a9fd7c89d5e92
框架修改
69个文件已添加
7个文件已修改
1 文件已重命名
7935 ■■■■■ 已修改文件
fanli-common/src/main/java/com/yeshi/fanli/base/Constant.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-common/src/main/java/com/yeshi/fanli/base/entity/user/UserInfo.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/.classpath 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/lib/alipay-sdk-java20170324180803.jar 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/pom.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/dto/HongBao.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/dto/money/AlipayTransferResultInfo.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/UserActiveLog.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/BindingAccount.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/BindingAccountService.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/ForbiddenUserIdentifyCode.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/UserConnectHistory.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/TaoBaoWeiQuanDrawBack.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/UserMoneyDetail.java 190 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/extract/AlipayAccountValidNormalHistory.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/extract/Extract.java 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/extract/ExtractAuditRecord.java 184 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/extract/ExtractRecord.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/extract/PayInfo.java 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/msg/MsgMoneyDetail.java 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/taobao/PidUser.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/taobao/TBPid.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/AdminLimitException.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/account/BindingAccountException.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/account/ForbiddenUserIdentifyCodeException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/money/AlipayAccountException.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/money/AlipayTransferException.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/money/ExtractException.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/money/MsgMoneyDetailException.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/money/UserMoneyDetailException.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/account/ForbiddenUserIdentifyCodeService.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/ExtractAuditRecordService.java 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/ExtractRecordService.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/ExtractService.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/MsgMoneyDetailService.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/PayInfoService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/UserMoneyDetailService.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/msg/UserMoneyMsgNotificationService.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/util/ExtractCMQManager.java 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/util/factory/MsgMoneyDetailFactory.java 283 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/util/factory/UserMoneyDetailFactory.java 593 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/util/typehandler/MsgTypeMoneyTypeEnumHandler.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/util/typehandler/UserMoneyDetailTypeEnumHandler.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/vo/UserMoneyDetailHistoryVO.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/vo/UserMoneyStatisticVO.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/vo/UserMonthMoneyVO.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/pom.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/ForbiddenUserIdentifyCodeMapper.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/UserInfoMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/AlipayAccountValidNormalHistoryMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/BindingAccountMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/ExtractAuditRecordMapper.java 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/ExtractMapper.java 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/ExtractRecordMapper.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/PayInfoMapper.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/UserMoneyDetailMapper.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/msg/MsgMoneyDetailMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/BindingAccountMapper.xml 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/ForbiddenUserIdentifyCodeMapper.xml 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/UserInfoMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/AlipayAccountValidNormalHistoryMapper.xml 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/ExtractAuditRecordMapper.xml 363 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/ExtractMapper.xml 421 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/ExtractRecordMapper.xml 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/PayInfoMapper.xml 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/UserMoneyDetailMapper.xml 302 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/msg/MsgMoneyDetailMapper.xml 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/BindingAccountServiceImpl.java 253 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/ForbiddenUserIdentifyCodeServiceImpl.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/UserAccountServiceImpl.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/ExtractAuditRecordServiceImpl.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/ExtractRecordServiceImpl.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/ExtractServiceImpl.java 659 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/PayInfoServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/UserMoneyDetailServiceImpl.java 201 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/msg/MsgMoneyDetailServiceImpl.java 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/msg/UserMoneyMsgNotificationServiceImpl.java 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-common/src/main/java/com/yeshi/fanli/base/Constant.java
@@ -78,6 +78,14 @@
    public static final String TAOBAO_RELATION_PID_DEFAULT = "mm_124933865_56750082_87140050199";
    public static final String TAOBAO_SPECIAL_PID_DEFAULT = "mm_124933865_56750082_89555600043";
    // 返回给客户端的账号封禁提示语
    public static final String FORBIDDEN_USER_REASON_DESC = "你的账号或绑定的第三方账号已被封禁,封禁原因可在帮助中心的相关规则中参看,如有疑问或申诉解除封禁请联系客服";
    // 用户被封禁
    public static final int CODE_FORBIDDEN_USER = 80001;
    // 来源-淘宝
    public static final int SOURCE_TYPE_TAOBAO = 1;
    // 来源-京东
fanli-common/src/main/java/com/yeshi/fanli/base/entity/user/UserInfo.java
@@ -1,9 +1,16 @@
package com.yeshi.fanli.base.entity.user;
import com.google.gson.annotations.Expose;
import javax.persistence.*;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.google.gson.annotations.Expose;
/**
 * 用户信息
@@ -18,6 +25,7 @@
    public static int STATE_NORMAL = 0;// 正常状态
    public static int STATE_DELETE = 1;// 删除状态
    public static int STATE_FORBIDDEN = 2;// 封禁状态
    public static int STATE_DELETE_OUT_OF_DATE = 4;// 用户长期不活跃被删除
    @Id
    // @GeneratedValue(strategy = GenerationType.SEQUENCE)
@@ -144,6 +152,16 @@
    @Transient
    @Expose
    private String rankNamePicture;// 等级名称图片 
    @Transient
    private String taoBaoUid;// 淘宝的用户ID
    public String getTaoBaoUid() {
        return taoBaoUid;
    }
    public void setTaoBaoUid(String taoBaoUid) {
        this.taoBaoUid = taoBaoUid;
    }
    public Integer getState() {
        return state;
fanli-facade-user/.classpath
@@ -23,5 +23,6 @@
            <attribute name="org.eclipse.jst.component.nondependency" value=""/>
        </attributes>
    </classpathentry>
    <classpathentry kind="lib" path="lib/alipay-sdk-java20170324180803.jar"/>
    <classpathentry kind="output" path="target/classes"/>
</classpath>
fanli-facade-user/lib/alipay-sdk-java20170324180803.jar
Binary files differ
fanli-facade-user/pom.xml
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.yeshi.fanli</groupId>
@@ -26,6 +27,21 @@
            <artifactId>fanli-common-config</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.yeshi.fanli</groupId>
            <artifactId>fanli-facade-system</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <!-- 本地JAR -->
        <dependency>
            <groupId>alipaysdk</groupId>
            <artifactId>alipaysdk</artifactId>
            <version>1.0.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/alipay-sdk-java20170324180803.jar</systemPath>
        </dependency>
  </dependencies>
  <build>
        <finalName>fanli-facade-user</finalName>
fanli-facade-user/src/main/java/org/fanli/facade/user/dto/HongBao.java
New file
@@ -0,0 +1,46 @@
package org.fanli.facade.user.dto;
import java.math.BigDecimal;
import com.yeshi.fanli.base.entity.user.UserInfo;
public class HongBao {
    private Long id;
    private BigDecimal money;
    private UserInfo userInfo;
    private String beizhu;
    public String getBeizhu() {
        return beizhu;
    }
    public void setBeizhu(String beizhu) {
        this.beizhu = beizhu;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public BigDecimal getMoney() {
        return money;
    }
    public void setMoney(BigDecimal money) {
        this.money = money;
    }
    public UserInfo getUserInfo() {
        return userInfo;
    }
    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/dto/money/AlipayTransferResultInfo.java
New file
@@ -0,0 +1,55 @@
package org.fanli.facade.user.dto.money;
import org.fanli.facade.user.entity.money.extract.Extract;
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
import com.yeshi.fanli.base.entity.admin.AdminUser;
/**
 * 支付宝转账信息
 *
 * @author Administrator
 *
 */
public class AlipayTransferResultInfo {
    private Extract extract;
    private AlipayFundTransToaccountTransferResponse alipayFundTransToaccountTransferResponse;
    private AdminUser adminUser;
    public AlipayTransferResultInfo() {
    }
    public AlipayTransferResultInfo(Extract extract,
            AlipayFundTransToaccountTransferResponse alipayFundTransToaccountTransferResponse, AdminUser adminUser) {
        this.extract = extract;
        this.alipayFundTransToaccountTransferResponse = alipayFundTransToaccountTransferResponse;
        this.adminUser = adminUser;
    }
    public AdminUser getAdminUser() {
        return adminUser;
    }
    public void setAdminUser(AdminUser adminUser) {
        this.adminUser = adminUser;
    }
    public Extract getExtract() {
        return extract;
    }
    public void setExtract(Extract extract) {
        this.extract = extract;
    }
    public AlipayFundTransToaccountTransferResponse getAlipayFundTransToaccountTransferResponse() {
        return alipayFundTransToaccountTransferResponse;
    }
    public void setAlipayFundTransToaccountTransferResponse(
            AlipayFundTransToaccountTransferResponse alipayFundTransToaccountTransferResponse) {
        this.alipayFundTransToaccountTransferResponse = alipayFundTransToaccountTransferResponse;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/UserActiveLog.java
New file
@@ -0,0 +1,108 @@
package org.fanli.facade.user.entity;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 用户活跃日志
 *
 * @author Administrator
 *
 *
 */
@Table("yeshi_ec_log_user_active")
public class UserActiveLog {
    @Column(name = "ual_id")
    private Long id;
    @Column(name = "ual_uid")
    private Long uid;
    @Column(name = "lua_ip")
    private String ip;
    @Column(name = "lua_channel")
    private String channel;
    @Column(name = "lua_version_code")
    private String versionCode;
    @Column(name = "lua_createtime")
    private Date createTime;
    @Column(name = "lua_updatetime")
    private Date updateTime;
    @Column(name = "lua_device_type")
    private String deviceType;
    @Column(name = "lua_os_version")
    private String osVersion;
    public String getDeviceType() {
        return deviceType;
    }
    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }
    public String getOsVersion() {
        return osVersion;
    }
    public void setOsVersion(String osVersion) {
        this.osVersion = osVersion;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public String getIp() {
        return ip;
    }
    public void setIp(String ip) {
        this.ip = ip;
    }
    public String getChannel() {
        return channel;
    }
    public void setChannel(String channel) {
        this.channel = channel;
    }
    public String getVersionCode() {
        return versionCode;
    }
    public void setVersionCode(String versionCode) {
        this.versionCode = versionCode;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/BindingAccount.java
New file
@@ -0,0 +1,92 @@
package org.fanli.facade.user.entity.account;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.base.entity.user.UserInfo;
/**
 * 绑定提现的账户
 * @author cxx
 *
 * @date 2018年1月29日
 */
@Entity
@Table(name="yeshi_ec_binding_account")
@org.yeshi.utils.mybatis.Table("yeshi_ec_binding_account")
public class BindingAccount {
    public static final int TYPE_ALIPAY=1;
    public static final int TYPE_WXPAY=2;
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="`id`")
    @Expose
    @org.yeshi.utils.mybatis.Column(name="id")
    private Long id;
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "uid")
    @org.yeshi.utils.mybatis.Column(name="uid")
    private UserInfo userInfo;
    @Expose
    @org.yeshi.utils.mybatis.Column(name="account")
    private String account;
    @Expose
    @org.yeshi.utils.mybatis.Column(name="type")
    private Integer type;  //1.支付宝  2.微信
    @Expose
    @org.yeshi.utils.mybatis.Column(name="name")
    private String name;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public UserInfo getUserInfo() {
        return userInfo;
    }
    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }
    public String getAccount() {
        return account;
    }
    public void setAccount(String account) {
        this.account = account;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/BindingAccountService.java
New file
@@ -0,0 +1,95 @@
package org.fanli.facade.user.entity.account;
import java.util.List;
import org.fanli.facade.user.exception.account.BindingAccountException;
import org.fanli.facade.user.exception.money.AlipayAccountException;
import org.fanli.facade.user.exception.money.AlipayTransferException;
import com.alipay.api.AlipayApiException;
public interface BindingAccountService {
    /**
     * 获取当前用户绑定的账�?
     *
     * @param uid
     *            用户id
     * @return �?��账号
     */
    public List<BindingAccount> getBindingAccountByUid(long uid);
    /**
     * 添加提现账号
     *
     * @param addAccount
     * @throws BindingAccountException
     */
    public void addBindingAccount(BindingAccount addAccount) throws BindingAccountException;
    /**
     * 删除提现账号
     *
     * @param account
     * @return
     */
    public Integer deleteBindingAccount(BindingAccount account);
    /**
     * 获取提现账号
     *
     * @param uid
     *            用户id
     * @param type
     *            账户类型
     * @return BindingAccount
     */
    public BindingAccount getBindingAccountByUidAndType(long uid, int type);
    /**
     * 更换绑定的支付宝的账号
     *
     * @param uid
     * @param name
     * @param account
     * @return
     */
    public BindingAccount changeAlipayBinding(Long uid, String name, String account);
    /**
     * 更换绑定的支付宝的账号(需要验证支付宝的正确性)
     *
     * @param uid
     * @param name
     * @param account
     * @return
     */
    public BindingAccount changeAlipayBindingWithVerify(Long uid, String name, String account)   throws AlipayTransferException,AlipayApiException,AlipayAccountException;
    /**
     * 根据ids删除绑定信息
     *
     * @param id
     * @return
     */
    public int deleteByPrimaryKey(Long id);
    /**
     * 验证支付宝账户是否可用
     *
     * @param uid
     * @param account
     *            -支付宝账号
     * @param name
     *            -支付宝真实姓名
     * @throws AlipayTransferException
     */
    public void validAlipayAccount(Long uid, String account, String name) throws AlipayTransferException,AlipayApiException,AlipayAccountException;
    /**
     * 是否能验证支付宝绑定
     * @param uid
     * @return
     */
    public boolean canVerifyAlipayAccount(Long uid) throws BindingAccountException;
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/ForbiddenUserIdentifyCode.java
New file
@@ -0,0 +1,101 @@
package org.fanli.facade.user.entity.account;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 禁止用户的标识
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_forbidden_user_identify_code")
public class ForbiddenUserIdentifyCode {
    public enum ForbiddenUserIdentifyCodeTypeEnum {
        wxUnionId("微信unionId"), taobaoUid("淘宝ID"), phone("手机号"), alipayAccount("支付宝账号");
        private final String desc;
        private ForbiddenUserIdentifyCodeTypeEnum(String desc) {
            this.desc = desc;
        }
        public String getDesc() {
            return desc;
        }
    }
    @Column(name = "fuc_id")
    private Long id;
    @Column(name = "fuc_type")
    private ForbiddenUserIdentifyCodeTypeEnum type;
    @Column(name = "fuc_identify_code")
    private String identifyCode;
    @Column(name = "fuc_effective")
    private Boolean effective;// 是否生效
    @Column(name = "fuc_beizhu")
    private String beiZhu;
    @Column(name = "fuc_create_time")
    private Date createTime;
    @Column(name = "fuc_update_time")
    private Date updateTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public ForbiddenUserIdentifyCodeTypeEnum getType() {
        return type;
    }
    public void setType(ForbiddenUserIdentifyCodeTypeEnum type) {
        this.type = type;
    }
    public String getIdentifyCode() {
        return identifyCode;
    }
    public void setIdentifyCode(String identifyCode) {
        this.identifyCode = identifyCode;
    }
    public Boolean getEffective() {
        return effective;
    }
    public void setEffective(Boolean effective) {
        this.effective = effective;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getBeiZhu() {
        return beiZhu;
    }
    public void setBeiZhu(String beiZhu) {
        this.beiZhu = beiZhu;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/UserConnectHistory.java
New file
@@ -0,0 +1,69 @@
package org.fanli.facade.user.entity.account;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.base.entity.user.UserInfo;
/**
 * 用户账号打通记录
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_connect_history")
public class UserConnectHistory {
    @Column(name = "uch_id")
    private Long id;
    @Column(name = "uch_main_uid")
    private UserInfo mainUser;// 主账户
    @Column(name = "uch_less_uid")
    private UserInfo lessUser;// 次账户
    @Column(name = "uch_log_url")
    private String logUrl;// 日志链接
    @Column(name = "uch_createtime")
    private Date createTime;// 创建时间
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public UserInfo getMainUser() {
        return mainUser;
    }
    public void setMainUser(UserInfo mainUser) {
        this.mainUser = mainUser;
    }
    public UserInfo getLessUser() {
        return lessUser;
    }
    public void setLessUser(UserInfo lessUser) {
        this.lessUser = lessUser;
    }
    public String getLogUrl() {
        return logUrl;
    }
    public void setLogUrl(String logUrl) {
        this.logUrl = logUrl;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/TaoBaoWeiQuanDrawBack.java
New file
@@ -0,0 +1,83 @@
package org.fanli.facade.user.entity.money;
import java.math.BigDecimal;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.base.entity.user.UserInfo;
/**
 * 淘宝维权订单退款
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_taobao_weiquan_drawback")
public class TaoBaoWeiQuanDrawBack {
    @Column(name = "twd_id")
    private Long id;
    @Column(name = "twd_order_id")
    private String orderId;
    @Column(name = "twd_order_item_id")
    private String orderItemId;
    @Column(name = "twd_uid")
    private UserInfo user;
    @Column(name = "twd_order_drawback_money")
    private BigDecimal drawBackMoney;
    @Column(name = "twd_createtime")
    private Date createTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public UserInfo getUser() {
        return user;
    }
    public void setUser(UserInfo user) {
        this.user = user;
    }
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public String getOrderItemId() {
        return orderItemId;
    }
    public void setOrderItemId(String orderItemId) {
        this.orderItemId = orderItemId;
    }
    public BigDecimal getDrawBackMoney() {
        return drawBackMoney;
    }
    public void setDrawBackMoney(BigDecimal drawBackMoney) {
        this.drawBackMoney = drawBackMoney;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/UserMoneyDetail.java
New file
@@ -0,0 +1,190 @@
package org.fanli.facade.user.entity.money;
import java.math.BigDecimal;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.base.entity.user.UserInfo;
/**
 * 用户账目明细(用于替换AccountDetails)
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_money_detail")
public class UserMoneyDetail {
    public enum UserMoneyDetailTypeEnum {
        share("分享奖金", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_share.png", ""), invite("邀请奖金", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_invite.png", ""), inviteAndShare("奖金收入", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_share.png", ""), fanli("返利到账", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_fanli.png",
                ""), fanliWeiQuan("返利扣除", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_fanli.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), inviteWeiQuan("邀请奖金扣除", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_invite.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), shareWeiQuan("分享奖金扣除", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_share.png",
                        "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), weiQuan("售后订单扣款", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_fanli.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), systemEqualize("系统补齐", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_system.png", ""), scoreConvert("积分兑换", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_score.png",
                                ""), hongbao("官方红包", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_hongbao.png", ""), hongbaoDeduct("红包退款", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_hongbao.png",
                                        ""), buyScore("购买积分", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_score.png", ""), extract("提现", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_extract.png",
                                                ""), extractVerify("提现验证", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_extract.png", ""), extractReject("提现被拒", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_extract.png", "");
        private final String desc;
        private final String picture;
        private final String helpUrl;
        private UserMoneyDetailTypeEnum(String desc, String picture, String helpUrl) {
            this.desc = desc;
            this.picture = picture;
            this.helpUrl = helpUrl;
        }
        public String getDesc() {
            return desc;
        }
        public String getPicture() {
            return picture;
        }
        public String getHelpUrl() {
            return helpUrl;
        }
    }
    @Expose
    @Column(name = "umd_id")
    private Long id;
    @Column(name = "umd_uid")
    private UserInfo userInfo;
    @Expose
    @Column(name = "umd_money")
    private BigDecimal money;
    @Expose
    @Column(name = "umd_type")
    private UserMoneyDetailTypeEnum type;
    @Expose
    @Column(name = "umd_title")
    private String title;// 标题
    @Expose
    @Column(name = "umd_sub_title")
    private String subTitle;// 子标题
    @Expose
    @Column(name = "umd_desc_info")
    private String descInfo;// 简要信息
    @Column(name = "umd_source_identify_id")
    private Long sourceIdentifyId;// 来源方唯一标识ID(返利,邀请赚与分享赚不存在该属性)
    @Column(name = "umd_identify_code")
    private String identifyCode;// 唯一标识
    @Column(name = "umd_beizhu")
    private String beiZhu;// 备注信息
    @Expose
    @Column(name = "umd_createtime")
    private Date createTime;
    @Column(name = "umd_updatetime")
    private Date updateTime;
    private Integer state;//老版明细适用该字段
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public UserInfo getUserInfo() {
        return userInfo;
    }
    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }
    public BigDecimal getMoney() {
        return money;
    }
    public void setMoney(BigDecimal money) {
        this.money = money;
    }
    public UserMoneyDetailTypeEnum getType() {
        return type;
    }
    public void setType(UserMoneyDetailTypeEnum type) {
        this.type = type;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getSubTitle() {
        return subTitle;
    }
    public void setSubTitle(String subTitle) {
        this.subTitle = subTitle;
    }
    public String getDescInfo() {
        return descInfo;
    }
    public void setDescInfo(String descInfo) {
        this.descInfo = descInfo;
    }
    public Long getSourceIdentifyId() {
        return sourceIdentifyId;
    }
    public void setSourceIdentifyId(Long sourceIdentifyId) {
        this.sourceIdentifyId = sourceIdentifyId;
    }
    public String getIdentifyCode() {
        return identifyCode;
    }
    public void setIdentifyCode(String identifyCode) {
        this.identifyCode = identifyCode;
    }
    public String getBeiZhu() {
        return beiZhu;
    }
    public void setBeiZhu(String beiZhu) {
        this.beiZhu = beiZhu;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/extract/AlipayAccountValidNormalHistory.java
New file
@@ -0,0 +1,84 @@
package org.fanli.facade.user.entity.money.extract;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 支付宝账号验证转账成功记录
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_alipayaccount_valid_normal_history")
public class AlipayAccountValidNormalHistory {
    @Column(name = "avnh_id")
    private Long id;
    @Column(name = "avnh_uid")
    private Long uid;
    @Column(name = "avnh_account")
    private String account;
    @Column(name = "avnh_name")
    private String name;
    @Column(name = "avnh_state")
    private Integer state;
    @Column(name = "avnh_createtime")
    private Date createTime;
    public AlipayAccountValidNormalHistory(Long id) {
        this.id = id;
    }
    public AlipayAccountValidNormalHistory() {
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public String getAccount() {
        return account;
    }
    public void setAccount(String account) {
        this.account = account;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/extract/Extract.java
New file
@@ -0,0 +1,185 @@
package org.fanli.facade.user.entity.money.extract;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.fanli.facade.system.entity.common.SystemManage;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.base.entity.user.UserInfo;
/**
 * 提现记录
 *
 * @author cxx
 *
 * @date 2018年1月29日
 */
@Entity
@Table(name = "yeshi_ec_extract")
public class Extract {
    public static int STATE_NOT_PROCESS = 0;// 未处理
    public static int STATE_PASS = 1;// 通过
    public static int STATE_REJECT = 2;// 拒绝
    public static int STATE_PROCESSING = 3;// 正在处理
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "`id`")
    private Long id;
    public Extract(Long id) {
        this.id = id;
    }
    public Extract() {
    }
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "uid")
    @org.yeshi.utils.mybatis.Column(name = "uid")
    private UserInfo userInfo;// 用户
    private String account;// 庄户
    private String name;// 提现名称
    private Integer type;// 提现类型
    private BigDecimal money;// 提现金额
    private Long extractTime;
    private String ip;
    private Integer state;
    private String reason;
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "sid")
    private SystemManage system;
    @Column(name = "adminId")
    @Expose
    @org.yeshi.utils.mybatis.Column(name = "adminId")
    private Long adminId; // 任务id 目前默认值
    // TODO 等待添加字段
    private Date receiveTime;// 到账时间
    public Date getReceiveTime() {
        return receiveTime;
    }
    public void setReceiveTime(Date receiveTime) {
        this.receiveTime = receiveTime;
    }
    public Long getAdminId() {
        return adminId;
    }
    public void setAdminId(Long adminId) {
        this.adminId = adminId;
    }
    public SystemManage getSystem() {
        return system;
    }
    public void setSystem(SystemManage system) {
        this.system = system;
    }
    public String getReason() {
        return reason;
    }
    public void setReason(String reason) {
        this.reason = reason;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Long getExtractTime() {
        return extractTime;
    }
    public void setExtractTime(Long extractTime) {
        this.extractTime = extractTime;
    }
    public String getIp() {
        return ip;
    }
    public void setIp(String ip) {
        this.ip = ip;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public UserInfo getUserInfo() {
        return userInfo;
    }
    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }
    public String getAccount() {
        return account;
    }
    public void setAccount(String account) {
        this.account = account;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public BigDecimal getMoney() {
        return money;
    }
    public void setMoney(BigDecimal money) {
        this.money = money;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/extract/ExtractAuditRecord.java
New file
@@ -0,0 +1,184 @@
package org.fanli.facade.user.entity.money.extract;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.base.entity.admin.AdminUser;
/**
 * 提现审批记录
 *
 * @author yj
 *
 * @date 2018年6月14日
 */
@Entity
@Table(name = "yeshi_ec_extract_audit_record")
@org.yeshi.utils.mybatis.Table("yeshi_ec_extract_audit_record")
public class ExtractAuditRecord {
    @Id
    @Column(name = "`id`")
    @GeneratedValue(strategy = GenerationType.AUTO)
    @org.yeshi.utils.mybatis.Column(name = "id")
    private Long id;
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "aid")
    @org.yeshi.utils.mybatis.Column(name = "aid")
    private AdminUser adminUser;// 审核用户
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "extractId")
    @org.yeshi.utils.mybatis.Column(name = "extractId")
    private Extract extract; // 申请记录id
    @Column(name = "beforeMoney")
    @Expose
    @org.yeshi.utils.mybatis.Column(name = "beforeMoney")
    private BigDecimal beforeMoney;// 提现之前余额
    @Column(name = "afterMoney")
    @Expose
    @org.yeshi.utils.mybatis.Column(name = "afterMoney")
    private BigDecimal afterMoney;// 提现之后余额
    @Column(name = "countMoney")
    @Expose
    @org.yeshi.utils.mybatis.Column(name = "countMoney")
    private BigDecimal countMoney;// 累计提现金额
    @Column(name = "countNum")
    @Expose
    @org.yeshi.utils.mybatis.Column(name = "countNum")
    private Long countNum; // 累计提现次数
    @Column(name = "`auditTime`")
    @Expose
    @org.yeshi.utils.mybatis.Column(name = "auditTime")
    private Long auditTime;// 审核时间
    @Column(name = "orderNum")
    @Expose
    @org.yeshi.utils.mybatis.Column(name = "orderNum")
    private Long orderNum; // 累计提现次数
    @Column(name = "cancelOrderNum")
    @Expose
    @org.yeshi.utils.mybatis.Column(name = "cancelOrderNum")
    private Long cancelOrderNum; // 维权订单
    @Column(name = "auditRole")
    @Expose
    @org.yeshi.utils.mybatis.Column(name = "auditRole")
    private String auditRole; // 审核人
    @Expose // 风险等级
    private int warnLevel;
    public String getAuditRole() {
        return auditRole;
    }
    public void setAuditRole(String auditRole) {
        this.auditRole = auditRole;
    }
    public Long getCancelOrderNum() {
        return cancelOrderNum;
    }
    public void setCancelOrderNum(Long cancelOrderNum) {
        this.cancelOrderNum = cancelOrderNum;
    }
    public Long getOrderNum() {
        return orderNum;
    }
    public void setOrderNum(Long orderNum) {
        this.orderNum = orderNum;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public AdminUser getAdminUser() {
        return adminUser;
    }
    public void setAdminUser(AdminUser adminUser) {
        this.adminUser = adminUser;
    }
    public Extract getExtract() {
        return extract;
    }
    public void setExtract(Extract extract) {
        this.extract = extract;
    }
    public BigDecimal getBeforeMoney() {
        return beforeMoney;
    }
    public void setBeforeMoney(BigDecimal beforeMoney) {
        this.beforeMoney = beforeMoney;
    }
    public BigDecimal getAfterMoney() {
        return afterMoney;
    }
    public void setAfterMoney(BigDecimal afterMoney) {
        this.afterMoney = afterMoney;
    }
    public BigDecimal getCountMoney() {
        return countMoney;
    }
    public void setCountMoney(BigDecimal countMoney) {
        this.countMoney = countMoney;
    }
    public Long getCountNum() {
        return countNum;
    }
    public void setCountNum(Long countNum) {
        this.countNum = countNum;
    }
    public Long getAuditTime() {
        return auditTime;
    }
    public void setAuditTime(Long auditTime) {
        this.auditTime = auditTime;
    }
    public int getWarnLevel() {
        return warnLevel;
    }
    public void setWarnLevel(int warnLevel) {
        this.warnLevel = warnLevel;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/extract/ExtractRecord.java
New file
@@ -0,0 +1,89 @@
package org.fanli.facade.user.entity.money.extract;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.yeshi.fanli.base.entity.user.UserInfo;
/**
 * 每日的提现记录
 *
 * @author cxx
 *
 * @date 2018年1月29日
 */
@Entity
@Table(name = "yeshi_ec_extract_record")
@org.yeshi.utils.mybatis.Table("yeshi_ec_extract_record")
public class ExtractRecord {
    @org.yeshi.utils.mybatis.Column(name = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "`id`")
    private Long id;
    @org.yeshi.utils.mybatis.Column(name = "uid")
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "uid")
    private UserInfo userInfo;
    @org.yeshi.utils.mybatis.Column(name = "count")
    private Integer count;
    @org.yeshi.utils.mybatis.Column(name = "money")
    private BigDecimal money;
    @org.yeshi.utils.mybatis.Column(name = "createTime")
    private Long createTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public UserInfo getUserInfo() {
        return userInfo;
    }
    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }
    public Integer getCount() {
        return count;
    }
    public void setCount(Integer count) {
        this.count = count;
    }
    public BigDecimal getMoney() {
        return money;
    }
    public void setMoney(BigDecimal money) {
        this.money = money;
    }
    public Long getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/extract/PayInfo.java
New file
@@ -0,0 +1,120 @@
package org.fanli.facade.user.entity.money.extract;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
 * 支付宝转账结果记录
 *
 * @author Administrator
 *
 */
@Entity
@Table(name = "`yeshi_ec_payinfo`")
@org.yeshi.utils.mybatis.Table("yeshi_ec_payinfo")
public class PayInfo {
    @org.yeshi.utils.mybatis.Column(name = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;
    @org.yeshi.utils.mybatis.Column(name = "eid")
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "`eid`")
    private Extract extract;
    @org.yeshi.utils.mybatis.Column(name = "state")
    @Column(name = "state", length = 2)
    private Integer state; // 转账状态 1.成功 2.失败
    @org.yeshi.utils.mybatis.Column(name = "info")
    private String info; // 错误信息
    @org.yeshi.utils.mybatis.Column(name = "biz_no")
    @Column(name = "biz_no")
    private String bizno;
    @org.yeshi.utils.mybatis.Column(name = "orderId")
    private String orderId;
    @org.yeshi.utils.mybatis.Column(name = "createtime")
    private Date createtime;
    @org.yeshi.utils.mybatis.Column(name = "ordertime")
    private String ordertime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Extract getExtract() {
        return extract;
    }
    public void setExtract(Extract extract) {
        this.extract = extract;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public String getInfo() {
        return info;
    }
    public void setInfo(String info) {
        this.info = info;
    }
    public String getBizno() {
        return bizno;
    }
    public void setBizno(String bizno) {
        this.bizno = bizno;
    }
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public Date getCreatetime() {
        return createtime;
    }
    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }
    public String getOrdertime() {
        return ordertime;
    }
    public void setOrdertime(String ordertime) {
        this.ordertime = ordertime;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/money/msg/MsgMoneyDetail.java
New file
@@ -0,0 +1,185 @@
package org.fanli.facade.user.entity.money.msg;
import java.math.BigDecimal;
import java.util.Date;
import org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory;
import org.fanli.facade.user.entity.money.extract.Extract;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.base.entity.user.UserInfo;
/**
 * 奖金到账记录
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_msg_money")
public class MsgMoneyDetail {
    public enum MsgTypeMoneyTypeEnum {
        share("分享奖金"), invite("邀请奖金"), fanli("返利到账"), extract("提现"), extractValid("提现账号验证"), shareWeiQuan(
                "分享奖金扣除"), inviteWeiQuan("邀请奖金扣除"), fanliWeiQuan("返利扣除");
        private final String desc;
        private MsgTypeMoneyTypeEnum(String desc) {
            this.desc = desc;
        }
        public String getDesc() {
            return desc;
        }
    }
    @Column(name = "mm_id")
    private Long id;
    @Column(name = "mm_uid")
    private UserInfo user;
    @Column(name = "mm_type")
    private MsgTypeMoneyTypeEnum msgType;// 消息类型
    @Column(name = "mm_order_count")
    private Integer orderCount;// 订单数(奖金适用)
    @Column(name = "mm_goods_count")
    private Integer goodsCount;// 商品数
    @Column(name = "mm_order_id")
    private String orderId;// 订单号(返利适用)
    @Column(name = "mm_source_id")
    private Extract extract;// 提现详情
    private AlipayAccountValidNormalHistory alipayAccountValid;// 提现账号验证详情
    @Column(name = "mm_money")
    private BigDecimal money;// 到账资金
    @Column(name = "mm_balance")
    private BigDecimal balance;// 账户余额
    @Column(name = "mm_state_desc")
    private String stateDesc;// 状态说明
    @Column(name = "mm_beizhu")
    private String beiZhu;// 备注
    @Column(name = "mm_create_time")
    private Date createTime;
    @Column(name = "mm_update_time")
    private Date updateTime;
    @Column(name = "mm_read")
    private Boolean read;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public UserInfo getUser() {
        return user;
    }
    public void setUser(UserInfo user) {
        this.user = user;
    }
    public String getStateDesc() {
        return stateDesc;
    }
    public void setStateDesc(String stateDesc) {
        this.stateDesc = stateDesc;
    }
    public MsgTypeMoneyTypeEnum getMsgType() {
        return msgType;
    }
    public void setMsgType(MsgTypeMoneyTypeEnum msgType) {
        this.msgType = msgType;
    }
    public Integer getOrderCount() {
        return orderCount;
    }
    public void setOrderCount(Integer orderCount) {
        this.orderCount = orderCount;
    }
    public Integer getGoodsCount() {
        return goodsCount;
    }
    public void setGoodsCount(Integer goodsCount) {
        this.goodsCount = goodsCount;
    }
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public Extract getExtract() {
        return extract;
    }
    public void setExtract(Extract extract) {
        this.extract = extract;
    }
    public BigDecimal getMoney() {
        return money;
    }
    public void setMoney(BigDecimal money) {
        this.money = money;
    }
    public BigDecimal getBalance() {
        return balance;
    }
    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }
    public String getBeiZhu() {
        return beiZhu;
    }
    public void setBeiZhu(String beiZhu) {
        this.beiZhu = beiZhu;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Boolean getRead() {
        return read;
    }
    public void setRead(Boolean read) {
        this.read = read;
    }
    public AlipayAccountValidNormalHistory getAlipayAccountValid() {
        return alipayAccountValid;
    }
    public void setAlipayAccountValid(AlipayAccountValidNormalHistory alipayAccountValid) {
        this.alipayAccountValid = alipayAccountValid;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/taobao/PidUser.java
New file
@@ -0,0 +1,60 @@
package org.fanli.facade.user.entity.taobao;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
@Table("yeshi_ec_pid_user")
public class PidUser {
    // 商品分享PID
    public final static int TYPE_SHARE_GOODS = 0;
    // 商品返利-Android
    public final static int TYPE_FANLI_ANDROID = 1;
    // 商品返利-IOS
    public final static int TYPE_FANLI_IOS = 2;
    @Column(name = "id")
    private Long id;
    @Column(name = "uid")
    private Long uid;
    @Column(name = "pid")
    private String pid;
    @Column(name = "pid_type")
    private Integer type;
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public String getPid() {
        return pid;
    }
    public void setPid(String pid) {
        this.pid = pid;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/taobao/TBPid.java
New file
@@ -0,0 +1,68 @@
package org.fanli.facade.user.entity.taobao;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.yeshi.utils.mybatis.Column;
@Entity
@Table(name = "yeshi_ec_pid")
@org.yeshi.utils.mybatis.Table("yeshi_ec_pid")
public class TBPid {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;
    @Column(name = "name")
    private String name;
    @Column(name = "pid")
    private String pid;
    @Column(name = "createtime")
    private Long createtime;
    @Column(name = "used")
    private Boolean used;
    public Boolean getUsed() {
        return used;
    }
    public void setUsed(Boolean used) {
        this.used = used;
    }
    public Long getCreatetime() {
        return createtime;
    }
    public void setCreatetime(Long createtime) {
        this.createtime = createtime;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPid() {
        return pid;
    }
    public void setPid(String pid) {
        this.pid = pid;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/AdminLimitException.java
New file
@@ -0,0 +1,12 @@
package org.fanli.facade.user.exception;
public class AdminLimitException extends Exception {
    private static final long serialVersionUID = -7171484784026293384L;
    public AdminLimitException() {
    }
    public AdminLimitException(String msg) {
        super(msg);
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/account/BindingAccountException.java
New file
@@ -0,0 +1,37 @@
package org.fanli.facade.user.exception.account;
public class BindingAccountException extends Exception {
    private static final long serialVersionUID = 9044535997260029818L;
    // 账户不可抵达
    public static int CODE_ACCOUNT_UNARRIVE = 1;
    // 账户出错
    public static int CODE_ACCOUNT_ERROR = 2;
    // 其他未知错误
    public static int CODE_OTHER_ERROR = 3;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public BindingAccountException() {
    }
    public BindingAccountException(String msg) {
        super(msg);
    }
    public BindingAccountException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/account/ForbiddenUserIdentifyCodeException.java
New file
@@ -0,0 +1,32 @@
package org.fanli.facade.user.exception.account;
public class ForbiddenUserIdentifyCodeException extends Exception {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public ForbiddenUserIdentifyCodeException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public ForbiddenUserIdentifyCodeException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/money/AlipayAccountException.java
New file
@@ -0,0 +1,45 @@
package org.fanli.facade.user.exception.money;
public class AlipayAccountException extends Exception {
    // 无余额
    public static int CODE_NO_MONEY = 1;
    // 提现次数超限
    public static int CODE_TIMES_LIMIT = 2;
    // 参数错误
    public static int CODE_NO_PARAMS = 3;
    // 已经被绑定
    public static int CODE_ALREADY_BIND = 4;
    /**
     * 支付宝账号异常
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public AlipayAccountException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public AlipayAccountException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/money/AlipayTransferException.java
New file
@@ -0,0 +1,39 @@
package org.fanli.facade.user.exception.money;
public class AlipayTransferException extends Exception {
    public AlipayTransferException() {
    }
    /**
     * 支付宝转账异常
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String subCode;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public String getSubCode() {
        return subCode;
    }
    public AlipayTransferException(int code, String subCode, String msg) {
        this.code = code;
        this.msg = msg;
        this.subCode = subCode;
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/money/ExtractException.java
New file
@@ -0,0 +1,30 @@
package org.fanli.facade.user.exception.money;
public class ExtractException extends Exception {
    private static final long serialVersionUID = 572112205824229000L;
    private int code;
    private String msg;
    public ExtractException() {
    }
    public ExtractException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/money/MsgMoneyDetailException.java
New file
@@ -0,0 +1,33 @@
package org.fanli.facade.user.exception.money;
public class MsgMoneyDetailException extends Exception {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public MsgMoneyDetailException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public MsgMoneyDetailException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/money/UserMoneyDetailException.java
New file
@@ -0,0 +1,30 @@
package org.fanli.facade.user.exception.money;
public class UserMoneyDetailException extends Exception {
    private static final long serialVersionUID = 572112205824229000L;
    private int code;
    private String msg;
    public UserMoneyDetailException() {
    }
    public UserMoneyDetailException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/account/ForbiddenUserIdentifyCodeService.java
New file
@@ -0,0 +1,39 @@
package org.fanli.facade.user.service.account;
import org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode;
import org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import org.fanli.facade.user.exception.account.ForbiddenUserIdentifyCodeException;
public interface ForbiddenUserIdentifyCodeService {
    /**
     * 添加禁止标识
     *
     * @param identifyCode
     * @throws ForbiddenUserIdentifyCodeException
     */
    public void addIdentifyCode(ForbiddenUserIdentifyCode identifyCode) throws ForbiddenUserIdentifyCodeException;
    /**
     * 通过类型与唯一标识获取列表
     *
     * @param type
     * @param identifyCode
     * @return
     */
    public ForbiddenUserIdentifyCode listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum type,
            String identifyCode);
    /**
     *
     * @param identifyCode
     */
    public void update(ForbiddenUserIdentifyCode identifyCode);
    /**
     *
     * @param identifyCode
     */
    public void delete(ForbiddenUserIdentifyCode identifyCode);
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/ExtractAuditRecordService.java
New file
@@ -0,0 +1,155 @@
package org.fanli.facade.user.service.money;
import java.util.List;
import java.util.Map;
import org.fanli.facade.user.entity.money.extract.ExtractAuditRecord;
public interface ExtractAuditRecordService {
    /**
     * 查询所有提现记录信息
     *
     * @param start
     * @param count
     * @param title
     * @param startTime
     * @param endTime
     * @return
     */
    public List<ExtractAuditRecord> getList(int pageIndex, int pageSize, String key, String startTime, String endTime);
    /**
     * 查询所有提现记录信息总行数
     *
     * @param title
     * @param startTime
     * @param endTime
     * @return
     */
    public int getCount(String key, String startTime, String endTime);
    /**
     * 查询当前客服审批的所有记录
     *
     * @param start
     * @param count
     * @param title
     * @param state
     * @return
     */
    public List<ExtractAuditRecord> getMyAuditedAllList(int pageIndex, int pageSize, String key, Integer state, Long adminId);
    /**
     * 当前客服审批总数
     *
     * @param title
     * @param state
     * @param adminId
     * @return
     */
    public int getMyAuditedAllCount(String key, Integer state, Long adminId);
    /**
     * 查询当前客服审批的时间段内记录
     *
     * @param start
     * @param count
     * @param title
     * @param state
     * @return
     */
    public List<ExtractAuditRecord> getMyAuditedTimeSlotList(int pageIndex, int pageSize, String key, Integer state, Long adminId, Integer days);
    /**
     * 查询当前客服审批的时间段内总条数
     *
     * @param title
     * @param state
     * @param adminId
     * @return
     */
    public int getMyAuditedTimeSlotCount(String key, Integer state, Long adminId, Integer days);
    /**
     * 查询当前客服累计本周
     *
     * @param adminId
     * @return
     */
    public int getMyAuditedCountWeek(Long adminId);
    /**
     * 查询当前客服累计本月
     *
     * @param adminId
     * @return
     */
    public int getMyAuditedCountMonth(Long adminId);
    /**
     * 查询当前客服当日处理累计
     *
     * @param adminId
     * @return
     */
    public int getMyAuditedCountToday(Long adminId);
    /**
     * 查询当前用户所有
     *
     * @param pageIndex
     * @param pageSize
     * @param key
     * @return
     */
    public List<ExtractAuditRecord> getByUidList(int pageIndex, int pageSize, Long key);
    public int getByUidCount(Long key);
    public List<ExtractAuditRecord> getListbyExtractId(Long extractId);
    public List<ExtractAuditRecord> getbyExtractId(Long extractId);
    /**
     * 统计审核次数
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Map<String, Object>>countAuditTotal(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception;
    /**
     * 统计申请提的现总金额
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Map<String, Object>> countExtractApplyMoney(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception;
    /**
     * 统计申请提的现总次数
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Map<String, Object>> countExtractApplyNumber(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception;
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/ExtractRecordService.java
New file
@@ -0,0 +1,21 @@
package org.fanli.facade.user.service.money;
import org.fanli.facade.user.entity.money.extract.Extract;
import org.fanli.facade.user.entity.money.extract.ExtractRecord;
import org.fanli.facade.user.exception.AdminLimitException;
public interface ExtractRecordService {
    void setExtractRecord(Extract extract) throws AdminLimitException;
    void deleteExtractRecord();
    /**
     * 获取用户今日的提现记录
     *
     * @param uid
     * @return
     */
    ExtractRecord getExtractRecordByUid(Long uid);
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/ExtractService.java
New file
@@ -0,0 +1,103 @@
package org.fanli.facade.user.service.money;
import java.util.List;
import java.util.Map;
import org.fanli.facade.user.dto.money.AlipayTransferResultInfo;
import org.fanli.facade.user.entity.money.extract.Extract;
import org.fanli.facade.user.exception.money.ExtractException;
import com.yeshi.fanli.base.entity.admin.AdminUser;
import com.yeshi.fanli.base.exception.NotExistObjectException;
import com.yeshi.fanli.base.exception.ObjectStateException;
public interface ExtractService {
    public List<Extract> getExtractInfoByUid(long uid);
    /**
     * 提现申请
     *
     * @param extract
     * @return 返回如果为null,则提现申请提交成功。如果为1�?,已超过当日提现次数或提现金额!如果�?,提现金额大于我的红包!
     */
    public Integer addExtract(Extract extract);
    public List<Extract> getExtractList(int i);
    public int getCount();
    /**
     * 通过
     *
     * @param id
     * @return
     */
    public Integer passExtract(long id, AdminUser admin);
    /**
     * 拒绝
     *
     * @param id
     * @param reason
     * @throws ObjectStateException
     * @throws NotExistObjectException
     */
    public void rejectExtract(long id, String reason, long extractTime, AdminUser adminUser)
            throws ObjectStateException, NotExistObjectException;
    /**
     *
     * 方法说明: 根据提现记录id获取用户uid
     *
     * @author mawurui createTime 2018年3月14日 下午3:43:22
     * @param id
     * @return
     */
    public Extract getExtractById(long id);
    /**
     * 用户提现校验
     *
     * @param uid
     * @return
     */
    public void checkExtract(String uid) throws ExtractException ;
    public Extract selectByPrimaryKey(Long id);
    /**
     * 查询当前客服待处理
     *
     * @return
     */
    public Extract getMyTaskInfo(Long adminId);
    public List<Map<String, Object>> getFinishRecord(int pageIndex, int pageSize, String key, String startTime,
            String endTime);
    /*
     * 更新提现记录
     */
    public int updateByPrimaryKeySelective(Extract record);
    public Extract getNewTaskInfo();
    /**
     * 处理提现结果
     *
     * @param info
     */
    public void processExtractResult(AlipayTransferResultInfo info);
    public void testExtractSuccess(Long id);
    /**
     * 统计今日提现
     * @param uid
     * @return
     */
    public double countTodayMoney(Long uid);
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/MsgMoneyDetailService.java
New file
@@ -0,0 +1,40 @@
package org.fanli.facade.user.service.money;
import java.util.List;
import org.fanli.facade.user.entity.money.msg.MsgMoneyDetail;
import org.fanli.facade.user.exception.money.MsgMoneyDetailException;
public interface MsgMoneyDetailService {
    /**
     * 添加到资金消息
     *
     * @param detail
     * @throws MsgMoneyDetailException
     */
    public void addMsgMoneyDetail(MsgMoneyDetail detail) throws MsgMoneyDetailException;
    /**
     * 资金消息列表
     *
     * @param uid
     * @param page
     * @return
     */
    public List<MsgMoneyDetail> listMsgMoneyDetail(Long uid, int page);
    /**
     * 资金消息数
     *
     * @param uid
     * @return
     */
    public long countMsgMoneyDetail(Long uid);
    /**
     * 设置所有消息已读
     *
     * @param uid
     */
    public void readMsgByUid(Long uid);
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/PayInfoService.java
New file
@@ -0,0 +1,9 @@
package org.fanli.facade.user.service.money;
import org.fanli.facade.user.entity.money.extract.PayInfo;
public interface PayInfoService {
    public void save(PayInfo payInfo);
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/UserMoneyDetailService.java
New file
@@ -0,0 +1,70 @@
package org.fanli.facade.user.service.money;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.fanli.facade.user.entity.money.UserMoneyDetail;
import org.fanli.facade.user.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
import org.fanli.facade.user.vo.UserMoneyDetailHistoryVO;
/**
 * 用户账目明细记录
 *
 * @author Administrator
 *
 */
public interface UserMoneyDetailService {
    /**
     * 客户端查询用户的资金记录
     *
     * @param uid
     * @param userMoneyDetailId
     * @param maxTime
     * @return
     */
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Date maxTime);
    /**
     * 客户端查询用户的资金记录的条数(计算月统计)
     *
     * @param uid
     * @param userMoneyDetailId
     * @param maxTime
     * @return
     */
    public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Date maxTime);
    /**
     * 资金明细详情列表(老版本)
     *
     * @param uid
     * @param page
     * @param pageSize
     * @return
     */
    public List<UserMoneyDetail> listByUidWithState(Long uid, int page, int pageSize);
    /**
     * 资金明细详情总数(老版本)
     *
     * @param uid
     * @return
     */
    public long countByUidWithState(Long uid);
    /**
     * 分类型与时间统计用户的资金总和
     *
     * @param uid
     * @param typeList
     * @param minDate
     * @param maxDate
     * @return
     */
    public BigDecimal statisticUserTypeMoneyWithDate(Long uid, List<UserMoneyDetailTypeEnum> typeList, Date minDate,
            Date maxDate);
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/money/msg/UserMoneyMsgNotificationService.java
New file
@@ -0,0 +1,109 @@
package org.fanli.facade.user.service.money.msg;
import java.math.BigDecimal;
import org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory;
import org.fanli.facade.user.entity.money.extract.Extract;
/**
 * 用户资金消息通知
 *
 * @author Administrator
 *
 */
public interface UserMoneyMsgNotificationService {
    /**
     * 提现申请
     *
     * @param extract
     */
    public void extractApplay(Extract extract);
    /**
     * 提现失败
     *
     * @param extract
     * @param stateDesc
     */
    public void extractFail(Extract extract, String stateDesc);
    /**
     * 提现成功
     *
     * @param extract
     */
    public void extractSuccess(Extract extract);
    /**
     * 支付宝账号验证
     *
     * @param history
     */
    public void alipayAccountValid(AlipayAccountValidNormalHistory history);
    /**
     * 返利订单到账
     *
     * @param uid
     * @param orderId
     * @param goodsCount
     * @param money
     * @param balance
     */
    public void fanliOrderReceived(Long uid, String orderId, int goodsCount, BigDecimal money, BigDecimal balance);
    /**
     * 返利订单维权
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     */
    public void fanliOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance);
    /**
     * 分享赚订单被统计
     *
     * @param uid
     * @param orderCount
     * @param goodsCount
     * @param money
     * @param balance
     */
    public void shareOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance);
    /**
     * 分享订单维权
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     */
    public void shareOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance);
    /**
     * 邀请赚订单被统计
     *
     * @param uid
     * @param orderCount
     * @param goodsCount
     * @param money
     * @param balance
     */
    public void inviteOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance);
    /**
     * 邀请订单维权
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     */
    public void inviteOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance);
}
fanli-facade-user/src/main/java/org/fanli/facade/user/util/ExtractCMQManager.java
New file
@@ -0,0 +1,88 @@
package org.fanli.facade.user.util;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.fanli.facade.user.dto.money.AlipayTransferResultInfo;
import org.fanli.facade.user.entity.money.extract.Extract;
import org.yeshi.utils.CMQUtil;
import org.yeshi.utils.StringUtil;
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
import com.google.gson.Gson;
import com.qcloud.cmq.Message;
import com.yeshi.fanli.base.Constant;
import com.yeshi.fanli.base.entity.admin.AdminUser;
public class ExtractCMQManager {
    private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25";
    private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo";
    private static ExtractCMQManager cmqManager;
    private static CMQUtil cmqUtil;
    // 提现结果处理队列
    public static String EXTRACT_RESULT = "extract-result";
    static {
        if (Constant.IS_TEST) {
            EXTRACT_RESULT = "test-" + EXTRACT_RESULT;
        }
        EXTRACT_RESULT += "-" + Constant.systemCommonConfig.getProjectName();
        cmqUtil = CMQUtil.getInstance(secretId, secretKey);
        // 最大消息为1M
        cmqUtil.createQueue(EXTRACT_RESULT);
    }
    public static ExtractCMQManager getInstance() {
        if (cmqManager == null)
            cmqManager = new ExtractCMQManager();
        return cmqManager;
    }
    /**
     * 添加提现结果消息
     *
     * @param extract
     * @param response
     */
    public void addExtractResultMsg(Extract extract, AlipayFundTransToaccountTransferResponse response,
            AdminUser adminUser) {
        String content = new Gson().toJson(new AlipayTransferResultInfo(extract, response, adminUser));
        cmqUtil.sendMsg(EXTRACT_RESULT, content);
    }
    /**
     * 消费提现结果消息
     *
     * @param count
     * @return
     */
    public Map<String, AlipayTransferResultInfo> consumeExtractResultMsg(int count) {
        List<Message> list = cmqUtil.recieveMsg(count, EXTRACT_RESULT);
        Map<String, AlipayTransferResultInfo> map = new HashMap<>();
        if (list != null)
            for (Message msg : list) {
                String result = msg.msgBody;
                if (!StringUtil.isNullOrEmpty(result)) {
                    AlipayTransferResultInfo alipayTransferResultInfo = new Gson().fromJson(result,
                            AlipayTransferResultInfo.class);
                    map.put(msg.receiptHandle, alipayTransferResultInfo);
                }
            }
        return map;
    }
    /**
     * 删除提现结果消息
     *
     * @param receiptHandle
     */
    public void deleteExtractResultMsg(String receiptHandle) {
        cmqUtil.deleteMsg(EXTRACT_RESULT, receiptHandle);
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/util/factory/MsgMoneyDetailFactory.java
New file
@@ -0,0 +1,283 @@
package org.fanli.facade.user.util.factory;
import java.math.BigDecimal;
import java.util.Date;
import org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory;
import org.fanli.facade.user.entity.money.extract.Extract;
import org.fanli.facade.user.entity.money.msg.MsgMoneyDetail;
import org.fanli.facade.user.entity.money.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
import org.yeshi.utils.MoneyBigDecimalUtil;
import com.yeshi.fanli.base.entity.user.UserInfo;
public class MsgMoneyDetailFactory {
    /**
     * 提现申请消息
     *
     * @param extract
     * @param uid
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createExtractApplyMsg(Extract extract, Long uid, String beiZhu) {
        if (extract == null || uid == null)
            return null;
        MsgMoneyDetail detail = new MsgMoneyDetail();
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setExtract(extract);
        detail.setMoney(extract.getMoney());
        detail.setMsgType(MsgTypeMoneyTypeEnum.extract);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        detail.setStateDesc("人工审核中");
        return detail;
    }
    /**
     * 提现成功消息
     *
     * @param extract
     * @param uid
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createExtractSuccessMsg(Extract extract, Long uid, String beiZhu) {
        if (extract == null || uid == null)
            return null;
        MsgMoneyDetail detail = new MsgMoneyDetail();
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setExtract(extract);
        detail.setMoney(extract.getMoney());
        detail.setMsgType(MsgTypeMoneyTypeEnum.extract);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        detail.setStateDesc("提现成功");
        return detail;
    }
    /**
     * 提现失败消息
     *
     * @param extract
     * @param uid
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createExtractFailMsg(Extract extract, Long uid, String beiZhu) {
        if (extract == null || uid == null)
            return null;
        MsgMoneyDetail detail = new MsgMoneyDetail();
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setExtract(extract);
        detail.setMoney(extract.getMoney());
        detail.setMsgType(MsgTypeMoneyTypeEnum.extract);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        detail.setStateDesc("提现失败");
        return detail;
    }
    /**
     * 账号验证消息
     *
     * @param valid
     * @param uid
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createAlipayAccountValidMsg(AlipayAccountValidNormalHistory valid, Long uid,
            String company, BigDecimal money, String beiZhu) {
        if (valid == null || uid == null || company == null)
            return null;
        MsgMoneyDetail detail = new MsgMoneyDetail();
        detail.setAlipayAccountValid(valid);
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setMoney(money);
        detail.setStateDesc(String
                .format("已向你的提现支付宝转入一笔来自于“%s”总额为%s元的转账,收到即提现帐号验证成功。", company, MoneyBigDecimalUtil.getWithNoZera(money))
                .toString());
        detail.setMsgType(MsgTypeMoneyTypeEnum.extractValid);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 返利到账
     *
     * @param money
     * @param balance
     * @param orderId
     * @param goodsCount
     * @param uid
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createFailiMsg(BigDecimal money, BigDecimal balance, String orderId, int goodsCount,
            Long uid, String beiZhu) {
        if (money == null || balance == null || orderId == null || uid == null)
            return null;
        MsgMoneyDetail detail = new MsgMoneyDetail();
        detail.setBalance(balance);
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setGoodsCount(goodsCount);
        detail.setMoney(money);
        detail.setMsgType(MsgTypeMoneyTypeEnum.fanli);
        detail.setOrderId(orderId);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 返利维权
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createFailiWeiQuanMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
            String beiZhu) {
        if (money == null || orderId == null || money == null || uid == null)
            return null;
        MsgMoneyDetail detail = new MsgMoneyDetail();
        detail.setBalance(balance);
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setMoney(money);
        detail.setMsgType(MsgTypeMoneyTypeEnum.fanliWeiQuan);
        detail.setOrderId(orderId);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 邀请赚到账
     *
     * @param money
     * @param balance
     * @param orderCount
     * @param goodsCount
     * @param uid
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createInviteMsg(BigDecimal money, BigDecimal balance, int orderCount, int goodsCount,
            Long uid, String beiZhu) {
        if (money == null || balance == null || uid == null)
            return null;
        MsgMoneyDetail detail = new MsgMoneyDetail();
        detail.setBalance(balance);
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setGoodsCount(goodsCount);
        detail.setMoney(money);
        detail.setMsgType(MsgTypeMoneyTypeEnum.invite);
        detail.setOrderCount(orderCount);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 邀请赚维权
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createInviteWeiQuanMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
            String beiZhu) {
        if (money == null || orderId == null || money == null || uid == null)
            return null;
        MsgMoneyDetail detail = new MsgMoneyDetail();
        detail.setBalance(balance);
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setMoney(money);
        detail.setMsgType(MsgTypeMoneyTypeEnum.inviteWeiQuan);
        detail.setOrderId(orderId);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 分享赚到账
     *
     * @param money
     * @param balance
     * @param orderCount
     * @param goodsCount
     * @param uid
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createShareMsg(BigDecimal money, BigDecimal balance, int orderCount, int goodsCount,
            Long uid, String beiZhu) {
        if (money == null || balance == null || uid == null)
            return null;
        MsgMoneyDetail detail = new MsgMoneyDetail();
        detail.setBalance(balance);
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setGoodsCount(goodsCount);
        detail.setMoney(money);
        detail.setMsgType(MsgTypeMoneyTypeEnum.share);
        detail.setOrderCount(orderCount);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 分享赚维权
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createShareWeiQuanMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
            String beiZhu) {
        if (money == null || orderId == null || money == null || uid == null)
            return null;
        MsgMoneyDetail detail = new MsgMoneyDetail();
        detail.setBalance(balance);
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setMoney(money);
        detail.setMsgType(MsgTypeMoneyTypeEnum.shareWeiQuan);
        detail.setOrderId(orderId);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/util/factory/UserMoneyDetailFactory.java
New file
@@ -0,0 +1,593 @@
package org.fanli.facade.user.util.factory;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import org.fanli.facade.user.dto.HongBao;
import org.fanli.facade.user.entity.money.TaoBaoWeiQuanDrawBack;
import org.fanli.facade.user.entity.money.UserMoneyDetail;
import org.fanli.facade.user.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
import org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory;
import org.fanli.facade.user.entity.money.extract.Extract;
import org.fanli.facade.user.exception.money.UserMoneyDetailException;
import org.yeshi.utils.StringUtil;
import org.yeshi.utils.TimeUtil;
import com.yeshi.fanli.base.entity.user.UserInfo;
public class UserMoneyDetailFactory {
    /**
     * 返利资金记录
     *
     * @param hongBaoList
     * @return
     */
    public static UserMoneyDetail createFanLi(Long uid, String orderId, int orderType,Long hbId, BigDecimal money)
            throws UserMoneyDetailException {
        if (StringUtil.isNullOrEmpty(orderId))
            throw new UserMoneyDetailException(1, "订单号为空");
        if (money == null)
            throw new UserMoneyDetailException(1, "返利金额为空");
        if (uid == null)
            throw new UserMoneyDetailException(1, "UID为空");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(
                StringUtil.Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId+"-"+hbId));
        detail.setMoney(money);
        detail.setTitle(UserMoneyDetailTypeEnum.fanli.getDesc());
        detail.setType(UserMoneyDetailTypeEnum.fanli);
        detail.setDescInfo("订单号:" + orderId);
        detail.setUpdateTime(new Date());
        detail.setUserInfo(new UserInfo(uid));
        return detail;
    }
    /**
     * 原有返利数据同步
     *
     * @param uid
     * @param orderId
     * @param orderType
     * @param money
     * @return
     * @throws UserMoneyDetailException
     */
//    public static UserMoneyDetail createOldFanLi(Long uid, AccountDetails accountDetails, BigDecimal money)
//            throws UserMoneyDetailException {
//        int orderType = 1;
//        String orderId = null;
//        if (accountDetails.getOrderItem() == null)
//            orderId = accountDetails.getId() + "";
//        else
//            orderId = accountDetails.getId() + "-" + accountDetails.getOrderItem().getOrderId();
//
//        if (money == null)
//            throw new UserMoneyDetailException(1, "返利金额为空");
//
//        if (uid == null)
//            throw new UserMoneyDetailException(1, "UID为空");
//
//        UserMoneyDetail detail = new UserMoneyDetail();
//        detail.setCreateTime(
//                new Date(TimeUtil.convertToTimeTemp(accountDetails.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
//        detail.setIdentifyCode(
//                StringUtil.Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId));
//        detail.setMoney(money);
//        detail.setTitle(UserMoneyDetailTypeEnum.fanli.getDesc());
//        detail.setType(UserMoneyDetailTypeEnum.fanli);
//        if (accountDetails.getOrderItem() != null)
//            detail.setDescInfo("订单号:" + accountDetails.getOrderItem().getOrderId());
//        detail.setUpdateTime(new Date());
//        detail.setUserInfo(new UserInfo(uid));
//        return detail;
//    }
    /**
     * 分享奖金到账
     *
     * @param uid
     * @param validCount
     * @param weiQuanCount
     * @param invalidCount
     * @param money
     * @param time
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createShare(Long uid, int validCount, int weiQuanCount, int invalidCount,
            BigDecimal money, Date time) throws UserMoneyDetailException {
        if (money == null)
            throw new UserMoneyDetailException(1, "返利金额为空");
        if (uid == null)
            throw new UserMoneyDetailException(1, "UID为空");
        if (time == null)
            throw new UserMoneyDetailException(1, "发生时间为空");
        Calendar ca = Calendar.getInstance();
        ca.setTime(time);
        ca.add(Calendar.MONTH, -1);
        String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.share.name() + "-" + uid + "-" + timeF));
        detail.setMoney(money);
        detail.setTitle(timeF + UserMoneyDetailTypeEnum.share.getDesc());
        detail.setType(UserMoneyDetailTypeEnum.share);
        detail.setDescInfo(String.format("有效订单:%s笔  维权订单:%s笔  失效订单:%s笔", validCount, weiQuanCount, invalidCount));
        detail.setUpdateTime(new Date());
        detail.setUserInfo(new UserInfo(uid));
        return detail;
    }
    /**
     * 邀请奖金到账
     *
     * @param uid
     * @param validCount
     * @param weiQuanCount
     * @param invalidCount
     * @param money
     * @param time
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createInvite(Long uid, int validCount, int weiQuanCount, int invalidCount,
            BigDecimal money, Date time) throws UserMoneyDetailException {
        if (money == null)
            throw new UserMoneyDetailException(1, "返利金额为空");
        if (uid == null)
            throw new UserMoneyDetailException(1, "UID为空");
        if (time == null)
            throw new UserMoneyDetailException(1, "发生时间为空");
        Calendar ca = Calendar.getInstance();
        ca.setTime(time);
        ca.add(Calendar.MONTH, -1);
        String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.invite.name() + "-" + uid + "-" + timeF));
        detail.setMoney(money);
        detail.setTitle(timeF + UserMoneyDetailTypeEnum.invite.getDesc());
        detail.setType(UserMoneyDetailTypeEnum.invite);
        if (validCount != 0 || weiQuanCount != 0 || invalidCount != 0)
            detail.setDescInfo(String.format("有效订单:%s笔   维权订单:%s笔   失效订单:%s笔", validCount, weiQuanCount, invalidCount));
        detail.setUpdateTime(new Date());
        detail.setUserInfo(new UserInfo(uid));
        return detail;
    }
    /**
     * 老版本的分享和邀请赚到账记录
     *
     * @param uid
     * @param money
     * @param time
     * @return
     * @throws UserMoneyDetailException
     */
//    public static UserMoneyDetail createShareAndInvite(AccountDetails accountDetail) throws UserMoneyDetailException {
//        if (accountDetail.getMoney() == null)
//            throw new UserMoneyDetailException(1, "返利金额为空");
//
//        if (accountDetail.getUserInfo() == null)
//            throw new UserMoneyDetailException(1, "UID为空");
//
//        if (accountDetail.getCreateTime() == null)
//            throw new UserMoneyDetailException(1, "发生时间为空");
//
//        Date time = new Date(TimeUtil.convertToTimeTemp(accountDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
//
//        Calendar ca = Calendar.getInstance();
//        ca.setTime(time);
//        ca.add(Calendar.MONTH, -1);
//
//        String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
//
//        UserMoneyDetail detail = new UserMoneyDetail();
//        detail.setCreateTime(
//                new Date(TimeUtil.convertToTimeTemp(accountDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
//        detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.inviteAndShare.name() + "-"
//                + accountDetail.getUserInfo().getId() + "-" + accountDetail.getId()));
//        detail.setMoney(new BigDecimal(accountDetail.getMoney()));
//        detail.setTitle(timeF + UserMoneyDetailTypeEnum.inviteAndShare.getDesc());
//        detail.setType(UserMoneyDetailTypeEnum.inviteAndShare);
//        detail.setUpdateTime(new Date());
//        detail.setUserInfo(accountDetail.getUserInfo());
//        return detail;
//    }
    /**
     * 返利维权
     *
     * @param uid
     * @param drawBack
     * @param money
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createFanLiWeiQuan(Long uid, TaoBaoWeiQuanDrawBack drawBack, BigDecimal money)
            throws UserMoneyDetailException {
        if (drawBack == null)
            throw new UserMoneyDetailException(1, "退款为空");
        if (drawBack.getId() == null)
            throw new UserMoneyDetailException(1, "退款ID为空");
        if (StringUtil.isNullOrEmpty(drawBack.getOrderId()))
            throw new UserMoneyDetailException(1, "订单号为空");
        if (StringUtil.isNullOrEmpty(drawBack.getOrderItemId()))
            throw new UserMoneyDetailException(1, "子订单号为空");
        if (money == null)
            throw new UserMoneyDetailException(1, "退款金额为空");
        if (uid == null)
            throw new UserMoneyDetailException(1, "UID为空");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(StringUtil
                .Md5(UserMoneyDetailTypeEnum.fanliWeiQuan.name() + "-" + uid + "-" + drawBack.getOrderItemId()));
        detail.setMoney(new BigDecimal("0").subtract(money));
        detail.setTitle(UserMoneyDetailTypeEnum.fanliWeiQuan.getDesc());
        detail.setSubTitle("订单维权");
        detail.setType(UserMoneyDetailTypeEnum.fanliWeiQuan);
        detail.setSourceIdentifyId(drawBack.getId());
        detail.setDescInfo("订单号:" + drawBack.getOrderId());
        detail.setUpdateTime(new Date());
        detail.setUserInfo(new UserInfo(uid));
        return detail;
    }
    /**
     * 分享赚维权
     *
     * @param uid
     * @param drawBack
     * @param money
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createShareWeiQuan(Long uid, TaoBaoWeiQuanDrawBack drawBack, BigDecimal money)
            throws UserMoneyDetailException {
        if (drawBack == null)
            throw new UserMoneyDetailException(1, "退款为空");
        if (drawBack.getId() == null)
            throw new UserMoneyDetailException(1, "退款ID为空");
        if (StringUtil.isNullOrEmpty(drawBack.getOrderId()))
            throw new UserMoneyDetailException(1, "订单号为空");
        if (StringUtil.isNullOrEmpty(drawBack.getOrderItemId()))
            throw new UserMoneyDetailException(1, "子订单号为空");
        if (money == null)
            throw new UserMoneyDetailException(1, "退款金额为空");
        if (uid == null)
            throw new UserMoneyDetailException(1, "UID为空");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(StringUtil
                .Md5(UserMoneyDetailTypeEnum.shareWeiQuan.name() + "-" + uid + "-" + drawBack.getOrderItemId()));
        detail.setMoney(new BigDecimal("0").subtract(money));
        detail.setTitle(UserMoneyDetailTypeEnum.shareWeiQuan.getDesc());
        detail.setSubTitle("订单维权");
        detail.setType(UserMoneyDetailTypeEnum.shareWeiQuan);
        detail.setSourceIdentifyId(drawBack.getId());
        detail.setDescInfo("订单号:" + drawBack.getOrderId());
        detail.setUpdateTime(new Date());
        detail.setUserInfo(new UserInfo(uid));
        return detail;
    }
    /**
     * 邀请赚维权
     *
     * @param uid
     * @param drawBack
     * @param money
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createInviteWeiQuan(Long uid, TaoBaoWeiQuanDrawBack drawBack, BigDecimal money)
            throws UserMoneyDetailException {
        if (drawBack == null)
            throw new UserMoneyDetailException(1, "退款为空");
        if (drawBack.getId() == null)
            throw new UserMoneyDetailException(1, "退款ID为空");
        if (StringUtil.isNullOrEmpty(drawBack.getOrderId()))
            throw new UserMoneyDetailException(1, "订单号为空");
        if (StringUtil.isNullOrEmpty(drawBack.getOrderItemId()))
            throw new UserMoneyDetailException(1, "子订单号为空");
        if (money == null)
            throw new UserMoneyDetailException(1, "退款金额为空");
        if (uid == null)
            throw new UserMoneyDetailException(1, "UID为空");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(StringUtil
                .Md5(UserMoneyDetailTypeEnum.inviteWeiQuan.name() + "-" + uid + "-" + drawBack.getOrderItemId()));
        detail.setMoney(new BigDecimal("0").subtract(money));
        detail.setTitle(UserMoneyDetailTypeEnum.inviteWeiQuan.getDesc());
        detail.setSubTitle("订单维权");
        detail.setType(UserMoneyDetailTypeEnum.inviteWeiQuan);
        detail.setSourceIdentifyId(drawBack.getId());
        detail.setDescInfo("订单号:" + drawBack.getOrderId());
        detail.setUpdateTime(new Date());
        detail.setUserInfo(new UserInfo(uid));
        return detail;
    }
    /**
     * 提现资金记录
     *
     * @param extract
     * @return
     */
    public static UserMoneyDetail createExtract(Extract extract) throws UserMoneyDetailException {
        if (extract == null)
            throw new UserMoneyDetailException(1, "提现记录不能为空");
        if (extract.getId() == null)
            throw new UserMoneyDetailException(1, "提现记录主键不能为空");
        if (extract.getMoney() == null)
            throw new UserMoneyDetailException(1, "提现金额不能为空");
        if (extract.getUserInfo() == null || extract.getUserInfo().getId() == null)
            throw new UserMoneyDetailException(1, "提现用户不能为空");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extract.name() + ":" + extract.getId()));
        detail.setMoney(new BigDecimal("0").subtract(extract.getMoney()));
        detail.setSourceIdentifyId(extract.getId());
        detail.setTitle(UserMoneyDetailTypeEnum.extract.getDesc());
        detail.setType(UserMoneyDetailTypeEnum.extract);
        detail.setUpdateTime(new Date());
        detail.setUserInfo(extract.getUserInfo());
        return detail;
    }
    /**
     * 提现账号验证记录
     *
     * @param aa
     * @param money
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createExtractAccountValid(AlipayAccountValidNormalHistory aa, BigDecimal money)
            throws UserMoneyDetailException {
        if (aa == null)
            throw new UserMoneyDetailException(1, "验证记录不能为空");
        if (aa.getUid() == null)
            throw new UserMoneyDetailException(1, "UID不能为空");
        if (money == null)
            throw new UserMoneyDetailException(1, "金额不能为空");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extractVerify.name() + ":" + aa.getId()));
        detail.setMoney(new BigDecimal("0").subtract(money));
        detail.setSourceIdentifyId(aa.getId());
        detail.setTitle(UserMoneyDetailTypeEnum.extractVerify.getDesc());
        detail.setType(UserMoneyDetailTypeEnum.extractVerify);
        detail.setUpdateTime(new Date());
        detail.setUserInfo(new UserInfo(aa.getUid()));
        return detail;
    }
    /**
     * 提现拒绝
     *
     * @param extract
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createExtractReject(Extract extract) throws UserMoneyDetailException {
        if (extract == null)
            throw new UserMoneyDetailException(1, "提现记录不能为空");
        if (extract.getId() == null)
            throw new UserMoneyDetailException(1, "提现记录主键不能为空");
        if (extract.getMoney() == null)
            throw new UserMoneyDetailException(1, "提现金额不能为空");
        if (extract.getUserInfo() == null || extract.getUserInfo().getId() == null)
            throw new UserMoneyDetailException(1, "提现用户不能为空");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extractReject.name() + ":" + extract.getId()));
        detail.setMoney(extract.getMoney());
        detail.setSourceIdentifyId(extract.getId());
        detail.setSubTitle("原路退回");
        detail.setTitle(UserMoneyDetailTypeEnum.extractReject.getDesc());
        detail.setType(UserMoneyDetailTypeEnum.extractReject);
        detail.setUpdateTime(new Date());
        detail.setUserInfo(extract.getUserInfo());
        return detail;
    }
    /**
     * 系统红包
     *
     * @param hb
     * @return
     * @throws UserMoneyDetailException
     */
    private static UserMoneyDetail createHongBao(HongBao hb, String subTitle) throws UserMoneyDetailException {
        if (hb == null)
            throw new UserMoneyDetailException(1, "红包不能为空");
        if (hb.getUserInfo() == null)
            throw new UserMoneyDetailException(1, "用户不能为空");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(
                StringUtil.Md5(UserMoneyDetailTypeEnum.hongbao.name() + "-" + subTitle + "-" + hb.getId()));
        detail.setMoney(hb.getMoney());
        detail.setSourceIdentifyId(hb.getId());
        detail.setTitle(UserMoneyDetailTypeEnum.hongbao.getDesc());
        detail.setSubTitle(subTitle);
        detail.setType(UserMoneyDetailTypeEnum.hongbao);
        detail.setUpdateTime(new Date());
        detail.setUserInfo(hb.getUserInfo());
        return detail;
    }
    private static UserMoneyDetail createHongBaoDeduct(HongBao hb, String subTitle) throws UserMoneyDetailException {
        if (hb == null)
            throw new UserMoneyDetailException(1, "红包不能为空");
        if (hb.getUserInfo() == null)
            throw new UserMoneyDetailException(1, "用户不能为空");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.hongbaoDeduct.name() + "-" + subTitle + "-"
                + hb.getBeizhu() + "-" + hb.getId()));
        detail.setMoney(hb.getMoney());
        detail.setSourceIdentifyId(hb.getId());
        detail.setTitle(UserMoneyDetailTypeEnum.hongbaoDeduct.getDesc());
        detail.setSubTitle(subTitle);
        detail.setType(UserMoneyDetailTypeEnum.hongbaoDeduct);
        detail.setUpdateTime(new Date());
        detail.setUserInfo(hb.getUserInfo());
        return detail;
    }
    /**
     * 新人红包
     *
     * @param hb
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createNewerHongBao(HongBao hb) throws UserMoneyDetailException {
        return createHongBao(hb, "新人红包");
    }
    /**
     * 新人红包扣除
     *
     * @param hb
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createNewerHongBaoDeduct(HongBao hb) throws UserMoneyDetailException {
        return createHongBaoDeduct(hb, "新人红包扣除");
    }
    /**
     * 老版本的新人红包退款
     *
     * @param hb
     * @return
     * @throws UserMoneyDetailException
     */
//    public static UserMoneyDetail createOldNewerHongBaoDeduct(AccountDetails accountDetails)
//            throws UserMoneyDetailException {
//        HongBao hb = new HongBao();
//        hb.setId(accountDetails.getId());
//        hb.setBeizhu("老版本");
//        hb.setMoney(new BigDecimal(accountDetails.getMoney()));
//        hb.setUserInfo(accountDetails.getUserInfo());
//        UserMoneyDetail userMoneyDetail = createHongBaoDeduct(hb, "新人红包扣除");
//        userMoneyDetail.setId(accountDetails.getId());
//        return userMoneyDetail;
//    }
    /**
     * 老版本售后订单扣款
     *
     * @param accountDetails
     * @return
     * @throws UserMoneyDetailException
     */
//    public static UserMoneyDetail createOldWeiQuan(AccountDetails accountDetails) throws UserMoneyDetailException {
//        if (accountDetails == null)
//            throw new UserMoneyDetailException(1, "详情不能为空");
//        if (accountDetails.getUserInfo() == null)
//            throw new UserMoneyDetailException(1, "用户不能为空");
//
//        UserMoneyDetail detail = new UserMoneyDetail();
//        detail.setCreateTime(new Date());
//        detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.weiQuan.name() + "-" + accountDetails.getId()));
//        detail.setMoney(new BigDecimal(accountDetails.getMoney()));
//        detail.setTitle(UserMoneyDetailTypeEnum.weiQuan.getDesc());
//        detail.setType(UserMoneyDetailTypeEnum.weiQuan);
//        detail.setUpdateTime(new Date());
//        detail.setUserInfo(accountDetails.getUserInfo());
//        detail.setId(accountDetails.getId());
//        return detail;
//    }
    /**
     * 新人红包
     *
     * @param accountDetails
     * @return
     * @throws UserMoneyDetailException
     */
//    public static UserMoneyDetail createOldNewerHongBao(AccountDetails accountDetails) throws UserMoneyDetailException {
//
//        if (accountDetails == null)
//            throw new UserMoneyDetailException(1, "详情不能为空");
//        if (accountDetails.getUserInfo() == null)
//            throw new UserMoneyDetailException(1, "用户不能为空");
//
//        UserMoneyDetail detail = new UserMoneyDetail();
//        detail.setCreateTime(new Date());
//        detail.setIdentifyCode(StringUtil
//                .Md5(UserMoneyDetailTypeEnum.hongbao.name() + "-" + "老版本新人红包" + "-" + accountDetails.getId()));
//        detail.setMoney(new BigDecimal(accountDetails.getMoney()));
//        detail.setTitle(UserMoneyDetailTypeEnum.hongbao.getDesc());
//        detail.setSubTitle("新人红包");
//        detail.setType(UserMoneyDetailTypeEnum.hongbao);
//        detail.setUpdateTime(new Date());
//        detail.setUserInfo(accountDetails.getUserInfo());
//        detail.setId(accountDetails.getId());
//        return detail;
//    }
    /**
     * 老版本提现账号验证
     *
     * @param accountDetails
     * @return
     * @throws UserMoneyDetailException
     */
//    public static UserMoneyDetail createOldExtractAccountValid(AccountDetails accountDetails)
//            throws UserMoneyDetailException {
//
//        if (accountDetails == null)
//            throw new UserMoneyDetailException(1, "验证记录不能为空");
//        if (accountDetails.getUserInfo() == null)
//            throw new UserMoneyDetailException(1, "UID不能为空");
//        if (accountDetails.getMoney() == null)
//            throw new UserMoneyDetailException(1, "金额不能为空");
//
//        UserMoneyDetail detail = new UserMoneyDetail();
//        detail.setCreateTime(new Date());
//        detail.setIdentifyCode(StringUtil
//                .Md5(UserMoneyDetailTypeEnum.extractVerify.name() + "-" + "老版本" + "-" + accountDetails.getId()));
//        detail.setMoney(new BigDecimal(accountDetails.getMoney()));
//        detail.setTitle(UserMoneyDetailTypeEnum.extractVerify.getDesc());
//        detail.setType(UserMoneyDetailTypeEnum.extractVerify);
//        detail.setUpdateTime(new Date());
//        detail.setUserInfo(accountDetails.getUserInfo());
//        detail.setId(accountDetails.getId());
//        return detail;
//    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/util/typehandler/MsgTypeMoneyTypeEnumHandler.java
New file
@@ -0,0 +1,52 @@
package org.fanli.facade.user.util.typehandler;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.fanli.facade.user.entity.money.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
public class MsgTypeMoneyTypeEnumHandler extends BaseTypeHandler<MsgTypeMoneyTypeEnum> {
    @Override
    public MsgTypeMoneyTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return MsgTypeMoneyTypeEnum.valueOf(key);
        }
    }
    @Override
    public MsgTypeMoneyTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeMoneyTypeEnum.valueOf(key);
        }
    }
    @Override
    public MsgTypeMoneyTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeMoneyTypeEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, MsgTypeMoneyTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/util/typehandler/UserMoneyDetailTypeEnumHandler.java
New file
@@ -0,0 +1,52 @@
package org.fanli.facade.user.util.typehandler;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.fanli.facade.user.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
public class UserMoneyDetailTypeEnumHandler extends BaseTypeHandler<UserMoneyDetailTypeEnum> {
    @Override
    public UserMoneyDetailTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return UserMoneyDetailTypeEnum.valueOf(key);
        }
    }
    @Override
    public UserMoneyDetailTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return UserMoneyDetailTypeEnum.valueOf(key);
        }
    }
    @Override
    public UserMoneyDetailTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return UserMoneyDetailTypeEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, UserMoneyDetailTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/vo/UserMoneyDetailHistoryVO.java
New file
@@ -0,0 +1,28 @@
package org.fanli.facade.user.vo;
import org.fanli.facade.user.entity.money.UserMoneyDetail;
import com.google.gson.annotations.Expose;
public class UserMoneyDetailHistoryVO {
    @Expose
    private UserMonthMoneyVO month;
    @Expose
    private UserMoneyDetail detail;
    public UserMonthMoneyVO getMonth() {
        return month;
    }
    public void setMonth(UserMonthMoneyVO month) {
        this.month = month;
    }
    public UserMoneyDetail getDetail() {
        return detail;
    }
    public void setDetail(UserMoneyDetail detail) {
        this.detail = detail;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/vo/UserMoneyStatisticVO.java
New file
@@ -0,0 +1,105 @@
package org.fanli.facade.user.vo;
import java.math.BigDecimal;
public class UserMoneyStatisticVO {
    private BigDecimal balanceMoney;// 账户余额
    private BigDecimal monthRecievedMoney;// 本月到账
    private BigDecimal monthExtractMoney;// 本月提现
    private BigDecimal lastMonthRecievedMoney;// 上月到账
    private BigDecimal lastMonthExtractMoney;// 上月提现
    private BigDecimal latestThreeMonthRecievedMoney;// 近三月到账
    private BigDecimal totalRecievedMoney;// 累计到账
    private BigDecimal totalShareMoney;// 累计分享奖金
    private BigDecimal totalInviteMoney;// 累计邀请奖金
    private BigDecimal monthUnRecievedMoney;// 本月未到账
    private BigDecimal totalUnRecievedMoney; // 全部未到账
    public BigDecimal getMonthUnRecievedMoney() {
        return monthUnRecievedMoney;
    }
    public void setMonthUnRecievedMoney(BigDecimal monthUnRecievedMoney) {
        this.monthUnRecievedMoney = monthUnRecievedMoney;
    }
    public BigDecimal getTotalUnRecievedMoney() {
        return totalUnRecievedMoney;
    }
    public void setTotalUnRecievedMoney(BigDecimal totalUnRecievedMoney) {
        this.totalUnRecievedMoney = totalUnRecievedMoney;
    }
    public BigDecimal getBalanceMoney() {
        return balanceMoney;
    }
    public void setBalanceMoney(BigDecimal balanceMoney) {
        this.balanceMoney = balanceMoney;
    }
    public BigDecimal getMonthRecievedMoney() {
        return monthRecievedMoney;
    }
    public void setMonthRecievedMoney(BigDecimal monthRecievedMoney) {
        this.monthRecievedMoney = monthRecievedMoney;
    }
    public BigDecimal getMonthExtractMoney() {
        return monthExtractMoney;
    }
    public void setMonthExtractMoney(BigDecimal monthExtractMoney) {
        this.monthExtractMoney = monthExtractMoney;
    }
    public BigDecimal getLastMonthRecievedMoney() {
        return lastMonthRecievedMoney;
    }
    public void setLastMonthRecievedMoney(BigDecimal lastMonthRecievedMoney) {
        this.lastMonthRecievedMoney = lastMonthRecievedMoney;
    }
    public BigDecimal getLastMonthExtractMoney() {
        return lastMonthExtractMoney;
    }
    public void setLastMonthExtractMoney(BigDecimal lastMonthExtractMoney) {
        this.lastMonthExtractMoney = lastMonthExtractMoney;
    }
    public BigDecimal getLatestThreeMonthRecievedMoney() {
        return latestThreeMonthRecievedMoney;
    }
    public void setLatestThreeMonthRecievedMoney(BigDecimal latestThreeMonthRecievedMoney) {
        this.latestThreeMonthRecievedMoney = latestThreeMonthRecievedMoney;
    }
    public BigDecimal getTotalRecievedMoney() {
        return totalRecievedMoney;
    }
    public void setTotalRecievedMoney(BigDecimal totalRecievedMoney) {
        this.totalRecievedMoney = totalRecievedMoney;
    }
    public BigDecimal getTotalShareMoney() {
        return totalShareMoney;
    }
    public void setTotalShareMoney(BigDecimal totalShareMoney) {
        this.totalShareMoney = totalShareMoney;
    }
    public BigDecimal getTotalInviteMoney() {
        return totalInviteMoney;
    }
    public void setTotalInviteMoney(BigDecimal totalInviteMoney) {
        this.totalInviteMoney = totalInviteMoney;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/vo/UserMonthMoneyVO.java
New file
@@ -0,0 +1,65 @@
package org.fanli.facade.user.vo;
import com.google.gson.annotations.Expose;
public class UserMonthMoneyVO {
    @Expose
    private int year;// 年份
    @Expose
    private int month;// 月
    @Expose
    private String expend;// 支出
    @Expose
    private String income;// 收入
    private String dateFormate;
    public String getDateFormate() {
        return dateFormate;
    }
    public void setDateFormate(String dateFormate) {
        this.dateFormate = dateFormate;
    }
    public UserMonthMoneyVO(int year, int month) {
        this.year = year;
        this.month = month;
    }
    public UserMonthMoneyVO() {
    }
    public int getYear() {
        return year;
    }
    public void setYear(int year) {
        this.year = year;
    }
    public int getMonth() {
        return month;
    }
    public void setMonth(int month) {
        this.month = month;
    }
    public String getExpend() {
        return expend;
    }
    public void setExpend(String expend) {
        this.expend = expend;
    }
    public String getIncome() {
        return income;
    }
    public void setIncome(String income) {
        this.income = income;
    }
}
fanli-service-user/pom.xml
@@ -29,10 +29,5 @@
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.yeshi.fanli</groupId>
            <artifactId>fanli-facade-system</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/ForbiddenUserIdentifyCodeMapper.java
New file
@@ -0,0 +1,23 @@
package org.fanli.service.user.dao.account;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode;
import org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import com.yeshi.fanli.base.BaseMapper;
public interface ForbiddenUserIdentifyCodeMapper extends BaseMapper<ForbiddenUserIdentifyCode> {
    /**
     * 通过类型与唯一标识获取
     *
     * @param type
     * @param identifyCode
     * @return
     */
    List<ForbiddenUserIdentifyCode> listByTypeAndIdentifyCode(@Param("type") ForbiddenUserIdentifyCodeTypeEnum type,
            @Param("identifyCode") String identifyCode);
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/UserInfoMapper.java
@@ -32,18 +32,20 @@
    // 增加用户红包金额
    int addHongBaoByUid(@Param("uid") long uid, @Param("money") BigDecimal money);
    void cleanPassword(long id);
    BigDecimal getNewPeopleHB(Long id);
    BigDecimal getMyHB(Long id);
    // 根据AppId与微信unionID获取用户
    UserInfo getUserInfoByAppIdAndWXUnionId(@Param("appId") String appId, @Param("unionId") String unionId);
    List<UserInfo> listByAppIdAndWXUnionId(@Param("appId") String appId, @Param("unionId") String unionId);
    // 根据AppId与淘宝OpenId获取用户
    UserInfo getUserInfoByAppIdAndTaoBaoOpenId(@Param("appId") String appId, @Param("openId") String openId);
    List<UserInfo> listByAppIdAndTaoBaoOpenId(@Param("appId") String appId, @Param("openId") String openId);
    // 根据AppId与电话号码获取用户
    UserInfo getUserInfoByAppIdAndPhone(@Param("appId") String appId, @Param("phone") String phone);
    List<UserInfo> listByAppIdAndPhone(@Param("appId") String appId, @Param("phone") String phone);
    Long getMaxUid();
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/AlipayAccountValidNormalHistoryMapper.java
New file
@@ -0,0 +1,20 @@
package org.fanli.service.user.dao.money;
import org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory;
public interface AlipayAccountValidNormalHistoryMapper {
    int deleteByPrimaryKey(Long id);
    int insert(AlipayAccountValidNormalHistory record);
    int insertSelective(AlipayAccountValidNormalHistory record);
    AlipayAccountValidNormalHistory selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(AlipayAccountValidNormalHistory record);
    int updateByPrimaryKey(AlipayAccountValidNormalHistory record);
    AlipayAccountValidNormalHistory selectLatestByUid(Long uid);
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/BindingAccountMapper.java
New file
@@ -0,0 +1,27 @@
package org.fanli.service.user.dao.money;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.fanli.facade.user.entity.account.BindingAccount;
public interface BindingAccountMapper {
    int deleteByPrimaryKey(Long id);
    int insert(BindingAccount record);
    int insertSelective(BindingAccount record);
    BindingAccount selectByPrimaryKey(Long id);
    List<BindingAccount> selectByAccount(String account);
    BindingAccount selectByUidAndType(@Param("uid") Long uid, @Param("type") int type);
    List<BindingAccount> selectByUid(Long uid);
    int updateByPrimaryKeySelective(BindingAccount record);
    int updateByPrimaryKey(BindingAccount record);
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/ExtractAuditRecordMapper.java
New file
@@ -0,0 +1,176 @@
package org.fanli.service.user.dao.money;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.fanli.facade.user.entity.money.extract.ExtractAuditRecord;
public interface ExtractAuditRecordMapper {
    int deleteByPrimaryKey(Long id);
    int insert(ExtractAuditRecord record);
    int insertSelective(ExtractAuditRecord record);
    ExtractAuditRecord selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(ExtractAuditRecord record);
    int updateByPrimaryKey(ExtractAuditRecord record);
    List<ExtractAuditRecord> getbyExtractId(Long extractId);
    List<ExtractAuditRecord> getListbyExtractId(Long extractId);
    /**
     * 查询所有提现记录信息
     *
     * @param start
     * @param count
     * @param title
     * @param startTime
     * @param endTime
     * @return
     */
    List<ExtractAuditRecord> getList(@Param("start") long start,
            @Param("count") int count, @Param("key") String title,
            @Param("startTime") String startTime,
            @Param("endTime") String endTime);
    /**
     * 查询所有提现记录信息总行数
     *
     * @param title
     * @param startTime
     * @param endTime
     * @return
     */
    int getCount(@Param("key") String title,
            @Param("startTime") String startTime,
            @Param("endTime") String endTime);
    /**
     * 查询当前客服审批的所有记录
     *
     * @param start
     * @param count
     * @param title
     * @param state
     * @return
     */
    List<ExtractAuditRecord> getMyAuditedAllList(@Param("start") int start,
            @Param("count") int count, @Param("key") String title,
            @Param("state") Integer state, @Param("adminId") Long adminId);
    /**
     * 当前客服审批总数
     *
     * @param title
     * @param state
     * @param adminId
     * @return
     */
    int getMyAuditedAllCount(@Param("key") String title,
            @Param("state") Integer state, @Param("adminId") Long adminId);
    /**
     * 查询当前客服审批的时间段内记录
     *
     * @param start
     * @param count
     * @param title
     * @param state
     * @return
     */
    List<ExtractAuditRecord> getMyAuditedTimeSlotList(@Param("start") int start, @Param("count") int count,
            @Param("key") String title,    @Param("state") Integer state, @Param("adminId") Long adminId,
            @Param("days") Integer days);
    /**
     * 查询当前客服审批的时间段内总条数
     * @param title
     * @param state
     * @param adminId
     * @return
     */
    int getMyAuditedTimeSlotCount(@Param("key") String title, @Param("state") Integer state,
            @Param("adminId") Long adminId,@Param("days") Integer days);
    /**
     * 查询当前客服累计本周
     * @param adminId
     * @return
     */
    int getMyAuditedCountWeek(@Param("adminId") Long adminId);
    /**
     * 查询当前客服累计本月
     * @param adminId
     * @return
     */
    int getMyAuditedCountMonth(@Param("adminId") Long adminId);
    /**
     * 查询当前客服当日处理累计
     * @param adminId
     * @return
     */
    int getMyAuditedCountToday(@Param("adminId") Long adminId);
    /**
     * 查询账户提现记录信息
     *
     */
    List<ExtractAuditRecord> getByUidList(@Param("start") int start,
            @Param("count") int count, @Param("uid") Long uid);
    /**
     * 查询账户提现记录信息
     *
     */
    int getByUidCount(@Param("uid") Long uid);
    /**
     * 统计审核次数
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> countAuditTotal(@Param("state")Integer state, @Param("type")Integer type,
        @Param("years")String years, @Param("startTime")String startTime, @Param("endTime")String endTime);
    /**
     * 统计申请提的现总金额
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> countExtractMoney(@Param("state")Integer state, @Param("type")Integer type,
        @Param("years")String years, @Param("startTime")String startTime, @Param("endTime")String endTime);
    /**
     * 统计申请提的现总次数
     * @param state
     * @param type
     * @param years
     * @param startTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> countExtractApplyNumber(@Param("state")Integer state, @Param("type")Integer type,
        @Param("years")String years, @Param("startTime")String startTime, @Param("endTime")String endTime);
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/ExtractMapper.java
New file
@@ -0,0 +1,119 @@
package org.fanli.service.user.dao.money;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.fanli.facade.user.entity.money.extract.Extract;
public interface ExtractMapper {
    int deleteByPrimaryKey(Long configId);
    int insert(Extract record);
    int insertSelective(Extract record);
    Extract selectByPrimaryKey(Long configId);
    Extract selectByPrimaryKeyForUpdate(Long configId);
    int updateByPrimaryKeySelective(Extract record);
    int updateByPrimaryKey(Extract record);
    List<Integer> checkExtract(String uid);
    Map<String, Object> getTodayCount();
    /**
     * 统计今日提现成功金额
     */
    BigDecimal getTodayTotalSuccessMoney();
    /**
     * 统计成功的次数、总金额
     *
     * @return
     */
    Map<String, Object> countTotalSuccess();
    /**
     * 查询当前客服待处理
     *
     * @param start
     * @param count
     * @param title
     * @param state
     * @return
     */
    Extract getMyTaskInfo(@Param("adminId") Long adminId);
    /**
     * 查询当前客服新处理任务
     *
     * @param start
     * @param count
     * @param title
     * @param state
     * @return
     */
    Extract getNewTaskInfo();
    /**
     * 查询当前客服待处理
     *
     * @param start
     * @param count
     * @param title
     * @param state
     * @return
     */
    Map<String, Object> countRecordsByUid(@Param("uid") Long uid);
    double countSuccessMoneysByUid(@Param("uid") Long uid);
    long countSuccessByUid(@Param("uid") Long uid);
    List<Map<String, Object>> getFinishRecord(@Param("start") long start, @Param("count") int count,
            @Param("key") String key, @Param("startTime") String startTime, @Param("endTime") String endTime);
    /**
     * 统计今日提现申请次数
     *
     * @return
     */
    int countTodayApply();
    /**
     * 统计今日已处理提现数量
     *
     * @return
     */
    int countTodayComplete();
    double countTodayMoney(@Param("uid") Long uid);
    /**
     * 根据用户ID和state查询
     * @param uid
     * @param stateList
     * @return
     */
    List<Extract> listByUidAndState(@Param("uid") Long uid, @Param("stateList") List<Integer> stateList);
    /**
     * 获取所有的提现列表
     * @param start
     * @param count
     * @return
     */
    List<Extract> listAll(@Param("start") long start,@Param("count") int count);
    /**
     * 提现的数量
     * @return
     */
    long countAll();
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/ExtractRecordMapper.java
New file
@@ -0,0 +1,30 @@
package org.fanli.service.user.dao.money;
import java.util.List;
import org.fanli.facade.user.entity.money.extract.ExtractRecord;
public interface ExtractRecordMapper {
    int deleteByPrimaryKey(Long id);
    int insert(ExtractRecord record);
    int insertSelective(ExtractRecord record);
    ExtractRecord selectByPrimaryKey(Long id);
    List<ExtractRecord> selectByUid(Long uid);
    List<ExtractRecord> selectByUidAndToday(Long uid);
    int updateByPrimaryKeySelective(ExtractRecord record);
    int updateByPrimaryKey(ExtractRecord record);
    /**
     * 删除所有
     * @return
     */
    int deleteAll();
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/PayInfoMapper.java
New file
@@ -0,0 +1,24 @@
package org.fanli.service.user.dao.money;
import java.util.List;
import org.fanli.facade.user.entity.money.extract.PayInfo;
public interface PayInfoMapper {
    int deleteByPrimaryKey(Long id);
    int insert(PayInfo record);
    int insertSelective(PayInfo record);
    PayInfo selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(PayInfo record);
    int updateByPrimaryKey(PayInfo record);
    List<PayInfo> getListbyExtractId(Long eId);
    double sumMoneyByUid(Long Uid);
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/UserMoneyDetailMapper.java
New file
@@ -0,0 +1,96 @@
package org.fanli.service.user.dao.money;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.fanli.facade.user.entity.money.UserMoneyDetail;
import org.fanli.facade.user.vo.UserMonthMoneyVO;
import com.yeshi.fanli.base.BaseMapper;
public interface UserMoneyDetailMapper extends BaseMapper<UserMoneyDetail> {
    /**
     * 通过用户ID和返回的最大时间的详情ID来获取下一页的数据
     *
     * @param uid
     * @param id
     * @param count
     * @return
     */
    List<UserMoneyDetail> selectByUidWithIndexId(@Param("uid") Long uid, @Param("id") Long id,
            @Param("count") int count);
    /**
     * 获取用户总共有多少记录数据
     *
     * @param uid
     * @return
     */
    Long selectCountByUid(@Param("uid") Long uid);
    /**
     * 按最大的创建时间和用户ID检索列表
     *
     * @param uid
     * @param date
     * @return
     */
    List<UserMoneyDetail> selectByMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date,
            @Param("count") int count);
    /**
     * 按最大的创建时间和用户ID检索数量
     *
     * @param uid
     * @param date
     * @return
     */
    Long selectCountByUidAndMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date);
    /**
     * 按用户ID和最大时间检索月份的数量
     *
     * @param uid
     * @param maxDate
     * @return
     */
    int selectMonthCountByUid(@Param("uid") Long uid, @Param("date") Date maxDate);
    /**
     * 统计某个月份的收入与支出
     *
     * @param uid
     * @param dateFormat
     * @return
     */
    List<UserMonthMoneyVO> selectMonthMoneyByUid(@Param("uid") Long uid, @Param("dateFormat") List<String> dateFormat);
    /**
     * 根据用户ID获取资金明细(老版)
     *
     * @param uid
     * @param start
     * @param count
     * @return
     */
    List<UserMoneyDetail> selectByUidWithState(@Param("uid") Long uid, @Param("start") long start,
            @Param("count") int count);
    Long selectCountByUidWithState(@Param("uid") Long uid);
    /**
     * 统计某个用户某段时间内产生的明细之和
     *
     * @param uid
     * @param typeList
     * @param minDate
     * @param maxDate
     * @return
     */
    BigDecimal getTotalMoneyByTypeAndUidWithDate(@Param("uid") Long uid, @Param("typeList") List<String> typeList,
            @Param("minDate") Date minDate, @Param("maxDate") Date maxDate);
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/money/msg/MsgMoneyDetailMapper.java
New file
@@ -0,0 +1,26 @@
package org.fanli.service.user.dao.money.msg;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.fanli.facade.user.entity.money.msg.MsgMoneyDetail;
import org.fanli.facade.user.entity.money.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
import com.yeshi.fanli.base.BaseMapper;
public interface MsgMoneyDetailMapper extends BaseMapper<MsgMoneyDetail> {
    MsgMoneyDetail selectBySourceIdAndMsgType(@Param("sourceId") Long sourceId,
            @Param("type") MsgTypeMoneyTypeEnum type);
    List<MsgMoneyDetail> listByUid(@Param("uid") Long uid, @Param("start") long start, @Param("count") int count);
    Long countByUid(@Param("uid") Long uid);
    /**
     * 设置消息已读时
     *
     * @param uid
     */
    void setMsgReadByUid(Long uid);
}
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/BindingAccountMapper.xml
New file
@@ -0,0 +1,95 @@
<?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.fanli.service.user.dao.money.BindingAccountMapper">
    <resultMap id="BaseResultMap"
        type="org.fanli.facade.user.entity.account.BindingAccount">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="account" property="account" jdbcType="VARCHAR" />
        <result column="type" property="type" jdbcType="INTEGER" />
        <result column="name" property="name" jdbcType="VARCHAR" />
        <association property="userInfo" column="uid"
            javaType="com.yeshi.fanli.base.entity.user.UserInfo">
            <id column="uid" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">id,uid,account,type,name</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_binding_account where id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByUid" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_binding_account where uid = #{0}
    </select>
    <select id="selectByUidAndType" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_binding_account where uid = #{uid} and `type`=#{type}
        limit 1
    </select>
    <select id="selectByAccount" resultMap="BaseResultMap"
        parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_binding_account where `account`=#{0}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_binding_account where id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="org.fanli.facade.user.entity.account.BindingAccount"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_binding_account (id,uid,account,type,name) values
        (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{account,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{name,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="org.fanli.facade.user.entity.account.BindingAccount"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_binding_account
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="userInfo != null">uid,</if>
            <if test="account != null">account,</if>
            <if test="type != null">type,</if>
            <if test="name != null">name,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if>
            <if test="account != null">#{account,jdbcType=VARCHAR},</if>
            <if test="type != null">#{type,jdbcType=INTEGER},</if>
            <if test="name != null">#{name,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="org.fanli.facade.user.entity.account.BindingAccount">update
        yeshi_ec_binding_account set uid =
        #{userInfo.id,jdbcType=BIGINT},account =
        #{account,jdbcType=VARCHAR},type = #{type,jdbcType=INTEGER},name =
        #{name,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="org.fanli.facade.user.entity.account.BindingAccount">
        update yeshi_ec_binding_account
        <set>
            <if test="userInfo != null">uid=#{userInfo.id,jdbcType=BIGINT},</if>
            <if test="account != null">account=#{account,jdbcType=VARCHAR},</if>
            <if test="type != null">type=#{type,jdbcType=INTEGER},</if>
            <if test="name != null">name=#{name,jdbcType=VARCHAR},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/ForbiddenUserIdentifyCodeMapper.xml
New file
@@ -0,0 +1,98 @@
<?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.fanli.service.user.dao.account.ForbiddenUserIdentifyCodeMapper">
    <resultMap id="BaseResultMap"
        type="org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode">
        <id column="fuc_id" property="id" jdbcType="BIGINT" />
        <result column="fuc_type" property="type"
            typeHandler="com.yeshi.fanli.util.mybatishandler.ForbiddenUserIdentifyCodeTypeEnumHandler" />
        <result column="fuc_uid" property="user" jdbcType="VARCHAR" />
        <result column="fuc_identify_code" property="identifyCode"
            jdbcType="VARCHAR" />
        <result column="fuc_effective" property="effective" jdbcType="BOOLEAN" />
        <result column="fuc_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="fuc_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">fuc_id,fuc_type,fuc_identify_code,fuc_effective,fuc_create_time,fuc_update_time,fuc_beizhu
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_forbidden_user_identify_code where fuc_id =
        #{id,jdbcType=BIGINT}
    </select>
    <select id="listByTypeAndIdentifyCode" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_forbidden_user_identify_code where fuc_type =
        #{type} and
        fuc_identify_code=#{identifyCode}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_forbidden_user_identify_code where fuc_id =
        #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert"
        parameterType="org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_forbidden_user_identify_code
        (fuc_id,fuc_type,fuc_identify_code,fuc_effective,fuc_create_time,fuc_update_time,fuc_beizhu)
        values
        (#{id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{identifyCode,jdbcType=VARCHAR},#{effective,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{beiZhu,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective"
        parameterType="org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_forbidden_user_identify_code
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">fuc_id,</if>
            <if test="type != null">fuc_type,</if>
            <if test="identifyCode != null">fuc_identify_code,</if>
            <if test="effective != null">fuc_effective,</if>
            <if test="createTime != null">fuc_create_time,</if>
            <if test="updateTime != null">fuc_update_time,</if>
            <if test="beiZhu != null">fuc_beizhu,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="identifyCode != null">#{identifyCode,jdbcType=VARCHAR},</if>
            <if test="effective != null">#{effective,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
        parameterType="org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode">update yeshi_ec_forbidden_user_identify_code set
        fuc_type = #{type,jdbcType=VARCHAR},fuc_identify_code =
        #{identifyCode,jdbcType=VARCHAR},fuc_effective =
        #{effective,jdbcType=BOOLEAN},fuc_create_time =
        #{createTime,jdbcType=TIMESTAMP},fuc_update_time =
        #{updateTime,jdbcType=TIMESTAMP},fuc_beizhu=
        #{beiZhu,jdbcType=VARCHAR}
         where fuc_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode">
        update yeshi_ec_forbidden_user_identify_code
        <set>
            <if test="type != null">fuc_type=#{type,jdbcType=VARCHAR},</if>
            <if test="identifyCode != null">fuc_identify_code=#{identifyCode,jdbcType=VARCHAR},</if>
            <if test="effective != null">fuc_effective=#{effective,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">fuc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">fuc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="beiZhu != null">fuc_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
        </set>
        where fuc_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/UserInfoMapper.xml
@@ -183,24 +183,22 @@
        `yeshi_ec_hongbao` hb WHERE hb.`uid` = #{id};
    </select>
    <!-- 根据AppId与微信unionID获取用户 -->
    <select id="getUserInfoByAppIdAndWXUnionId" resultMap="BaseResultMap">
    <select id="listByAppIdAndWXUnionId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user where appid=#{appId} and wx_union_id=#{unionId}
        limit 1
    </select>
    <!-- 根据AppId与淘宝OpenId获取用户 -->
    <select id="getUserInfoByAppIdAndTaoBaoOpenId" resultMap="BaseResultMap">
    <select id="listByAppIdAndTaoBaoOpenId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user where appid=#{appId} and identifycode=#{openId}
        limit 1
    </select>
    <!-- 根据AppId与电话号码获取用户 -->
    <select id="getUserInfoByAppIdAndPhone" resultMap="BaseResultMap">
    <select id="listByAppIdAndPhone" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user where appid=#{appId} and phone=#{phone} limit 1
        from yeshi_ec_user where appid=#{appId} and phone=#{phone}
    </select>
    <select id="getMaxUid" resultType="java.lang.Long">select max(id) from
        yeshi_ec_user
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/AlipayAccountValidNormalHistoryMapper.xml
New file
@@ -0,0 +1,92 @@
<?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.fanli.service.user.dao.money.AlipayAccountValidNormalHistoryMapper">
    <resultMap id="BaseResultMap"
        type="org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory">
        <id column="avnh_id" property="id" jdbcType="BIGINT" />
        <result column="avnh_uid" property="uid" jdbcType="BIGINT" />
        <result column="avnh_account" property="account" jdbcType="VARCHAR" />
        <result column="avnh_name" property="name" jdbcType="VARCHAR" />
        <result column="avnh_state" property="state" jdbcType="INTEGER" />
        <result column="avnh_createtime" property="createTime"
            jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">avnh_id,avnh_uid,avnh_account,avnh_name,avnh_state,avnh_createtime
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_alipayaccount_valid_normal_history where avnh_id =
        #{id,jdbcType=BIGINT} order by avnh_createtime desc limit 1
    </select>
    <select id="selectLatestByUid" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_alipayaccount_valid_normal_history where avnh_uid =
        #{0}
        order by avnh_createtime desc limit 1 for update
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_alipayaccount_valid_normal_history where avnh_id =
        #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert"
        parameterType="org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_alipayaccount_valid_normal_history
        (avnh_id,avnh_uid,avnh_account,avnh_name,avnh_state,avnh_createtime)
        values
        (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{account,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective"
        parameterType="org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_alipayaccount_valid_normal_history
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">avnh_id,</if>
            <if test="uid != null">avnh_uid,</if>
            <if test="account != null">avnh_account,</if>
            <if test="name != null">avnh_name,</if>
            <if test="state != null">avnh_state,</if>
            <if test="createTime != null">avnh_createtime,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
            <if test="account != null">#{account,jdbcType=VARCHAR},</if>
            <if test="name != null">#{name,jdbcType=VARCHAR},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
        parameterType="org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory">update yeshi_ec_alipayaccount_valid_normal_history set
        avnh_uid = #{uid,jdbcType=BIGINT},avnh_account =
        #{account,jdbcType=VARCHAR},avnh_name =
        #{name,jdbcType=VARCHAR},avnh_state =
        #{state,jdbcType=INTEGER},avnh_createtime =
        #{createTime,jdbcType=TIMESTAMP} where avnh_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory">
        update yeshi_ec_alipayaccount_valid_normal_history
        <set>
            <if test="uid != null">avnh_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="account != null">avnh_account=#{account,jdbcType=VARCHAR},</if>
            <if test="name != null">avnh_name=#{name,jdbcType=VARCHAR},</if>
            <if test="state != null">avnh_state=#{state,jdbcType=INTEGER},</if>
            <if test="createTime != null">avnh_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
        </set>
        where avnh_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/ExtractAuditRecordMapper.xml
New file
@@ -0,0 +1,363 @@
<?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.fanli.service.user.dao.money.ExtractAuditRecordMapper">
  <resultMap id="BaseResultMap" type="org.fanli.facade.user.entity.money.extract.ExtractAuditRecord">
    <id column="id" property="id" jdbcType="BIGINT"/>
    <result column="beforeMoney" property="beforeMoney" jdbcType="DECIMAL"/>
    <result column="afterMoney" property="afterMoney" jdbcType="DECIMAL"/>
    <result column="countMoney" property="countMoney" jdbcType="DECIMAL"/>
    <result column="countNum" property="countNum" jdbcType="BIGINT"/>
    <result column="orderNum" property="orderNum" jdbcType="BIGINT"/>
     <result column="auditRole" property="auditRole" jdbcType="VARCHAR"/>
    <result column="cancelOrderNum" property="cancelOrderNum" jdbcType="BIGINT"/>
    <result column="auditTime" property="auditTime" jdbcType="BIGINT"/>
     <!-- TODO整改 -->
    <association property="adminUser" column="aid"
        select="com.yeshi.fanli.dao.mybatis.AdminUserMapper.selectByPrimaryKey">
    </association>
    <association property="extract" column="extractId"
        select="org.fanli.service.user.dao.money.ExtractMapper.selectByPrimaryKey">
    </association>
  </resultMap>
  <sql id="Base_Column_List">id,aid,extractId,beforeMoney,afterMoney,countMoney,countNum,orderNum,cancelOrderNum,auditTime,auditRole</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_extract_audit_record where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
      delete from yeshi_ec_extract_audit_record where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="org.fanli.facade.user.entity.money.extract.ExtractAuditRecord"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_extract_audit_record (id,aid,extractId,beforeMoney,afterMoney,countMoney,countNum,auditTime)
      values (#{id,jdbcType=BIGINT},#{adminUser.id,jdbcType=BIGINT},#{extract.id,jdbcType=BIGINT},
      #{beforeMoney,jdbcType=DECIMAL},#{afterMoney,jdbcType=DECIMAL},#{countMoney,jdbcType=DECIMAL},#{auditRole,jdbcType=VARCHAR})
      #{countNum,jdbcType=BIGINT},#{orderNum,jdbcType=BIGINT},#{cancelOrderNum,jdbcType=BIGINT},#{auditTime,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="org.fanli.facade.user.entity.money.extract.ExtractAuditRecord"
       useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_extract_audit_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="adminUser != null">aid,</if>
      <if test="extract != null">extractId,</if>
      <if test="beforeMoney != null">beforeMoney,</if>
      <if test="afterMoney != null">afterMoney,</if>
      <if test="countMoney != null">countMoney,</if>
      <if test="countNum != null">countNum,</if>
      <if test="countNum != null">orderNum,</if>
       <if test="auditTime != null">cancelOrderNum,</if>
      <if test="auditTime != null">auditTime,</if>
       <if test="auditTime != null">auditRole,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="adminUser != null">#{adminUser.id,jdbcType=BIGINT},</if>
      <if test="extract != null">#{extract.id,jdbcType=BIGINT},</if>
      <if test="beforeMoney != null">#{beforeMoney,jdbcType=DECIMAL},</if>
      <if test="afterMoney != null">#{afterMoney,jdbcType=DECIMAL},</if>
      <if test="countMoney != null">#{countMoney,jdbcType=DECIMAL},</if>
      <if test="countNum != null">#{countNum,jdbcType=BIGINT},</if>
      <if test="countNum != null">#{orderNum,jdbcType=BIGINT},</if>
      <if test="countNum != null">#{cancelOrderNum,jdbcType=BIGINT},</if>
      <if test="auditTime != null">#{auditTime,jdbcType=BIGINT},</if>
       <if test="auditTime != null">#{auditRole,jdbcType=VARCHAR},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="org.fanli.facade.user.entity.money.extract.ExtractAuditRecord">
      update yeshi_ec_extract_audit_record set aid = #{adminUser.id,jdbcType=BIGINT},
      extractId = #{extract.id,jdbcType=BIGINT},beforeMoney = #{beforeMoney,jdbcType=DECIMAL},
      afterMoney = #{afterMoney,jdbcType=DECIMAL},countMoney = #{countMoney,jdbcType=DECIMAL},
      countNum = #{countNum,jdbcType=BIGINT},auditRole = #{auditRole,jdbcType=VARCHAR},
      orderNum = #{orderNum,jdbcType=BIGINT},cancelOrderNum = #{cancelOrderNum,jdbcType=BIGINT},
      auditTime = #{auditTime,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="org.fanli.facade.user.entity.money.extract.ExtractAuditRecord">
      update yeshi_ec_extract_audit_record
    <set>
      <if test="adminUser != null">aid=#{adminUser.id,jdbcType=BIGINT},</if>
      <if test="extract != null">extractId=#{extract.id,jdbcType=BIGINT},</if>
      <if test="beforeMoney != null">beforeMoney=#{beforeMoney,jdbcType=DECIMAL},</if>
      <if test="afterMoney != null">afterMoney=#{afterMoney,jdbcType=DECIMAL},</if>
      <if test="countMoney != null">countMoney=#{countMoney,jdbcType=DECIMAL},</if>
      <if test="countNum != null">countNum=#{countNum,jdbcType=BIGINT},</if>
       <if test="countNum != null">orderNum=#{orderNum,jdbcType=BIGINT},</if>
       <if test="countNum != null">cancelOrderNum=#{cancelOrderNum,jdbcType=BIGINT},</if>
      <if test="auditTime != null">auditTime=#{auditTime,jdbcType=BIGINT},</if>
       <if test="auditTime != null">auditRole=#{auditRole,jdbcType=VARCHAR},</if>
    </set> where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="getListbyExtractId" resultMap="BaseResultMap">
      <!-- 查询最近一次提现记录 -->
      SELECT * FROM yeshi_ec_extract_audit_record  ear
          WHERE ear.`extractId` = #{extractId,jdbcType=BIGINT}
          and auditTime is not null and auditTime > 0  ORDER BY ear.`auditTime`
  </select>
  <select id="getbyExtractId" resultMap="BaseResultMap">
      <!-- 查询提现时已记录信息 -->
      SELECT * FROM yeshi_ec_extract_audit_record  ear
          WHERE ear.`extractId` = #{extractId,jdbcType=BIGINT}
          and (auditTime is  null or auditTime = 0)  ORDER BY ear.`auditTime` desc
  </select>
  <select id="getList" resultMap="BaseResultMap">
    SELECT   *   FROM yeshi_ec_extract_audit_record ar
        LEFT JOIN yeshi_ec_extract ex ON ar.extractId=ex.id
    WHERE
      <![CDATA[
        auditTime is not null and auditTime > 0  AND
        FROM_UNIXTIME(ex.extractTime/1000)  >= #{startTime}
           AND  FROM_UNIXTIME(ex.extractTime/1000) <= #{endTime}
       ]]>
       <if test='key != null and key != ""'>
               AND (ex.uid like '%${key}%' OR ar.aid like '%${key}%')
           </if>
        ORDER BY ex.extractTime DESC  LIMIT ${start},${count}
   </select>
   <select id="getCount" resultType="java.lang.Integer">
     SELECT count(ar.id) FROM yeshi_ec_extract_audit_record ar
     LEFT JOIN yeshi_ec_extract ex ON ar.extractId=ex.id
       WHERE
      <![CDATA[
         auditTime is not null and auditTime > 0  AND
         FROM_UNIXTIME(ex.`extractTime`/1000)  >= #{startTime}
           AND  FROM_UNIXTIME(ex.`extractTime`/1000) <= #{endTime}
       ]]>
       <if test='key != null and key != ""'>
               AND (ex.uid like '%${key}%' OR ar.aid like '%${key}%')
           </if>
    </select>
   <select id="getMyAuditedAllList" resultMap="BaseResultMap">
        SELECT   *  FROM yeshi_ec_extract_audit_record ar
            LEFT JOIN yeshi_ec_extract ex ON ar.extractId=ex.id
        WHERE ar.aid = ${adminId}
       <if test='key != null and key != ""'>
               AND ex.uid like '%${key}%'
           </if>
           <if test='state != null'>
               AND ex.state = #{state}
           </if>
        ORDER BY ex.extractTime DESC  LIMIT ${start},${count}
   </select>
    <select id="getMyAuditedAllCount" resultType="java.lang.Integer">
        SELECT  count(ar.id)  FROM yeshi_ec_extract_audit_record ar
            LEFT JOIN yeshi_ec_extract ex ON ar.extractId=ex.id
        WHERE ar.aid = ${adminId}
       <if test='key != null and key != ""'>
               AND ex.uid like '%${key}%'
           </if>
           <if test='state != null'>
               AND ex.state = #{state}
           </if>
   </select>
   <select id="getMyAuditedTimeSlotList" resultMap="BaseResultMap">
        SELECT  ar.*,(CASE WHEN ex.state = 2 THEN 1  WHEN ex.state =1 THEN 1  ELSE 0 END) AS stateOrde  FROM yeshi_ec_extract_audit_record ar
            LEFT JOIN yeshi_ec_extract ex ON ar.extractId=ex.id
        WHERE  <![CDATA[1>0]]>
          <if test="adminId != null">
            AND ar.aid = ${adminId}
          </if>
          <if test='key != null and key != ""'>
               AND ex.uid  like '%${key}%'
          </if>
          <if test="days != null">
            <![CDATA[ AND DATE_SUB(CURDATE(), INTERVAL ${days}  DAY) <= FROM_UNIXTIME(ex.extractTime/1000) ]]>
          </if>
          <if test='state != null'>
                   AND ex.state = #{state}
          </if>
          ORDER BY stateOrde,ex.`extractTime` DESC LIMIT ${start},${count}
   </select>
    <select id="getMyAuditedTimeSlotCount" resultType="java.lang.Integer">
        SELECT  count(ar.id)  FROM yeshi_ec_extract_audit_record ar
            LEFT JOIN yeshi_ec_extract ex ON ar.extractId=ex.id
        WHERE  <![CDATA[1>0]]>
          <if test="adminId != null">
            AND ar.aid = ${adminId}
          </if>
          <if test='key != null and key != ""'>
               AND ex.uid  like '%${key}%'
          </if>
          <if test="days != null">
            <![CDATA[ AND DATE_SUB(CURDATE(), INTERVAL ${days}  DAY) <= FROM_UNIXTIME(ex.extractTime/1000) ]]>
          </if>
          <if test='state != null'>
                   AND ex.state = #{state}
          </if>
   </select>
   <select id="getMyAuditedCountWeek" resultType="java.lang.Integer">
       SELECT COUNT(id) FROM yeshi_ec_extract_audit_record     WHERE aid = ${adminId}
       <![CDATA[
           AND YEARWEEK(DATE_FORMAT(FROM_UNIXTIME(auditTime/1000),'%Y-%m-%d')) = YEARWEEK(NOW());
       ]]>
   </select>
    <select id="getMyAuditedCountMonth" resultType="java.lang.Integer">
       SELECT COUNT(id) FROM yeshi_ec_extract_audit_record     WHERE aid = ${adminId}
       <![CDATA[
           AND DATE_FORMAT(FROM_UNIXTIME(auditTime/1000),'%Y-%m')=DATE_FORMAT(NOW(),'%Y-%m')
       ]]>
   </select>
   <select id="getMyAuditedCountToday" resultType="java.lang.Integer">
       SELECT COUNT(id) FROM yeshi_ec_extract_audit_record     WHERE aid = ${adminId}
       <![CDATA[
           AND TO_DAYS(FROM_UNIXTIME(auditTime/1000)) = TO_DAYS(NOW())
       ]]>
   </select>
     <!-- 查询历史提现申请记录 -->
   <select id="getByUidList" resultMap="BaseResultMap">
    SELECT *  FROM yeshi_ec_extract_audit_record ar
        LEFT JOIN yeshi_ec_extract ex ON ar.extractId=ex.id
    WHERE ex.uid = ${uid}
            <![CDATA[and ar.auditTime > 0 and ar.auditTime is not null ]]>
        ORDER BY ex.extractTime DESC  LIMIT ${start},${count}
   </select>
   <select id="getByUidCount" resultType="java.lang.Integer">
       SELECT COUNT(ar.id)  FROM yeshi_ec_extract_audit_record ar
         LEFT JOIN yeshi_ec_extract ex ON ar.extractId=ex.id
       WHERE ex.uid = ${uid} <![CDATA[and ar.auditTime > 0 and ar.auditTime is not null ]]>
    </select>
    <select id="countAuditTotal" resultType="java.util.HashMap">
        SELECT COALESCE(COUNT(tr.id),0) AS 'showValue',
            <if test="type == 1">
                 FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d') AS 'showDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(tr.`auditTime`/1000,'%m') AS 'showDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(tr.`auditTime`/1000,'%Y') AS 'showDate'
            </if>
        FROM `yeshi_ec_extract_audit_record` tr
         <if test="state != null and state != 0">
            LEFT JOIN `yeshi_ec_extract` t ON t.`id` = tr.`extractId`
         </if>
        WHERE tr.`auditTime` IS NOT NULL
            <if test="startTime != null and startTime != '' ">
                 AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
            </if>
            <if test="years != null and years != '' ">
                 AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y') = '${years}'
            </if>
            <if test="state != null and state != 3">
                 AND t.`state` = ${state}
            </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(tr.`auditTime`/1000,'%Y')
        </if>
        ORDER BY tr.`auditTime`
    </select>
    <select id="countExtractMoney" resultType="java.util.HashMap">
        SELECT CAST(SUM(t.`money`)AS DECIMAL(19,2)) AS showValue,
            <if test="type == 1">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') AS 'showDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%m') AS 'showDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%Y') AS 'showDate'
            </if>
        FROM `yeshi_ec_extract` t
        WHERE t.`extractTime` IS NOT NULL
            <if test="startTime != null and startTime != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
            </if>
            <if test="years != null and years != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y') = '${years}'
            </if>
            <if test="state != null">
                 AND t.`state` = ${state}
            </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y')
        </if>
        ORDER BY t.`extractTime`
    </select>
    <select id="countExtractApplyNumber" resultType="java.util.HashMap">
        SELECT COUNT(t.id) AS showValue,
            <if test="type == 1">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') AS 'showDate'
            </if>
            <if test="type == 2">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%m') AS 'showDate'
            </if>
            <if test="type == 3">
                 FROM_UNIXTIME(t.`extractTime`/1000,'%Y') AS 'showDate'
            </if>
        FROM `yeshi_ec_extract` t
        WHERE t.`extractTime` IS NOT NULL
            <if test="startTime != null and startTime != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
            </if>
            <if test="endTime != null and endTime != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
            </if>
            <if test="years != null and years != '' ">
                 AND FROM_UNIXTIME(t.`extractTime`/1000,'%Y') = '${years}'
            </if>
            <if test="state != null">
                 AND t.`state` = ${state}
            </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
             GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
             GROUP BY FROM_UNIXTIME(t.`extractTime`/1000,'%Y')
        </if>
        ORDER BY t.`extractTime`
    </select>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/ExtractMapper.xml
New file
@@ -0,0 +1,421 @@
<?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.fanli.service.user.dao.money.ExtractMapper">
    <resultMap id="BaseResultMap"
        type="org.fanli.facade.user.entity.money.extract.Extract">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="account" property="account" jdbcType="VARCHAR" />
        <result column="extractTime" property="extractTime" jdbcType="BIGINT" />
        <result column="receiveTime" property="receiveTime" jdbcType="TIMESTAMP" />
        <result column="ip" property="ip" jdbcType="VARCHAR" />
        <result column="money" property="money" jdbcType="DECIMAL" />
        <result column="name" property="name" jdbcType="VARCHAR" />
        <result column="reason" property="reason" jdbcType="VARCHAR" />
        <result column="state" property="state" jdbcType="INTEGER" />
        <result column="type" property="type" jdbcType="INTEGER" />
        <result column="adminId" property="adminId" jdbcType="BIGINT" />
        <association property="userInfo" column="uid"
            select="org.fanli.service.user.dao.account.UserInfoMapper.selectByPKey">
        </association>
        <!-- TODO整改 -->
        <association property="system" column="sid"
            select="com.yeshi.fanli.dao.mybatis.SystemMapper.selectByPrimaryKey">
        </association>
    </resultMap>
    <sql id="Base_Column_List">
        id,account,extractTime,ip,money,name,reason,state,type,uid,sid,adminId,receiveTime
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_extract
        where id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_extract
        where id = #{id,jdbcType=BIGINT} for update
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete from
        yeshi_ec_extract
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="org.fanli.facade.user.entity.money.extract.Extract"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_extract (id,
        account,extractTime,ip,money,name,reason,state,type,uid,sid,adminId,receiveTime)
        values
        (#{id,jdbcType=BIGINT},
        #{account,jdbcType=VARCHAR},
        #{extractTime,jdbcType=BIGINT},
        #{ip,jdbcType=VARCHAR},
        #{money,jdbcType=DECIMAL},
        #{name,jdbcType=VARCHAR},
        #{reason,jdbcType=VARCHAR},
        #{state,jdbcType=INTEGER},
        #{type,jdbcType=INTEGER},
        #{userInfo.id,jdbcType=BIGINT},
        #{system.id,jdbcType=BIGINT}
        #{adminId,jdbcType=BIGINT},
        #{receiveTime,jdbcType=TIMESTAMP}
        )
    </insert>
    <insert id="insertSelective" parameterType="org.fanli.facade.user.entity.money.extract.Extract"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_extract
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="account != null">
                account,
            </if>
            <if test="extractTime != null">
                extractTime,
            </if>
            <if test="ip != null">
                ip,
            </if>
            <if test="money != null">
                money,
            </if>
            <if test="name != null">
                name,
            </if>
            <if test="reason != null">
                reason,
            </if>
            <if test="state != null">
                state,
            </if>
            <if test="type != null">
                type,
            </if>
            <if test="userInfo != null">
                uid,
            </if>
            <if test="system != null">
                sid,
            </if>
            <if test="system != null">
                adminId,
            </if>
            <if test="receiveTime != null">
                receiveTime,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="account != null">
                #{account,jdbcType=VARCHAR},
            </if>
            <if test="extractTime != null">
                #{extractTime,jdbcType=BIGINT},
            </if>
            <if test="ip != null">
                #{ip,jdbcType=VARCHAR},
            </if>
            <if test="money != null">
                #{money,jdbcType=DECIMAL},
            </if>
            <if test="name != null">
                #{name,jdbcType=VARCHAR},
            </if>
            <if test="reason != null">
                #{reason,jdbcType=VARCHAR},
            </if>
            <if test="state != null">
                #{state,jdbcType=INTEGER},
            </if>
            <if test="type != null">
                #{type,jdbcType=INTEGER},
            </if>
            <if test="userInfo != null">
                #{userInfo.id,jdbcType=BIGINT},
            </if>
            <if test="system != null">
                #{system.id,jdbcType=BIGINT},
            </if>
            <if test="system != null">
                #{adminId,jdbcType=BIGINT},
            </if>
            <if test="receiveTime != null">
                #{receiveTime,jdbcType=TIMESTAMP},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="org.fanli.facade.user.entity.money.extract.Extract">
        update yeshi_ec_extract
        <set>
            <if test="account != null">
                account = #{account,jdbcType=VARCHAR},
            </if>
            <if test="extractTime != null">
                extractTime =
                #{extractTime,jdbcType=BIGINT},
            </if>
            <if test="ip != null">
                ip =
                #{ip,jdbcType=VARCHAR},
            </if>
            <if test="money != null">
                money =
                #{money,jdbcType=DECIMAL},
            </if>
            <if test="name != null">
                name =
                #{name,jdbcType=VARCHAR},
            </if>
            <if test="reason != null">
                reason = #{reason,jdbcType=VARCHAR},
            </if>
            <if test="state != null">
                state =
                #{state,jdbcType=INTEGER},
            </if>
            <if test="type != null">
                type =
                #{type,jdbcType=INTEGER},
            </if>
            <if test="userInfo != null">
                uid =
                #{userInfo.id,jdbcType=BIGINT},
            </if>
            <if test="system != null">
                sid = #{system.id,jdbcType=BIGINT},
            </if>
            <if test="system != null">
                adminId = #{adminId,jdbcType=BIGINT},
            </if>
            <if test="receiveTime != null">
                receiveTime=#{receiveTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="org.fanli.facade.user.entity.money.extract.Extract">
        update
        yeshi_ec_extract
        set
        account = #{account,jdbcType=VARCHAR},
        extractTime =
        #{extractTime,jdbcType=BIGINT},
        ip =
        #{ip,jdbcType=VARCHAR},
        money =
        #{money,jdbcType=DECIMAL},
        name =
        #{name,jdbcType=VARCHAR},
        reason
        =#{reason,jdbcType=VARCHAR},
        state
        =#{state,jdbcType=INTEGER},
        type
        =#{type,jdbcType=INTEGER},
        uid
        =#{userInfo.id,jdbcType=BIGINT},
        adminId
        =#{adminId,jdbcType=BIGINT},
        sid
        =
        #{system.id,jdbcType=BIGINT},
        receiveTime
        =#{receiveTime,jdbcType=TIMESTAMP}
        where id =
        #{id,jdbcType=BIGINT}
    </update>
    <select id="checkExtract" resultType="java.lang.Integer">
        <![CDATA[
         SELECT ABS(ttt.totalmoney-ttt.hbmoney)<0.001
         ]]>
        FROM
        (
        SELECT u.my_hongBao,s.uid AS uid,s.money AS hbmoney,IF(ss.money
        IS NOT
        NULL,ss.money,0) + u.my_hongBao+IF( dd.`money` IS NOT
        NULL,dd.money,0)
        +IF( cc.`money` IS NOT NULL,cc.money,0) AS totalmoney
        FROM
        yeshi_ec_user u
        LEFT JOIN (SELECT h.hb_uid as uid,SUM(h.hb_money)
        AS money FROM yeshi_ec_hongbao_v2 h
        WHERE h.hb_state=3 AND h.hb_uid =
        #{uid,jdbcType=BIGINT} GROUP BY h.hb_uid)s ON
        u.id=s.uid
        LEFT JOIN
        (SELECT SUM(t.`money`)AS money,t.uid FROM yeshi_ec_extract t
        WHERE
        (t.state=0 OR t.state=1) AND t.`uid`=#{uid,jdbcType=BIGINT}
        GROUP BY
        t.uid)ss ON ss.uid=u.id
        LEFT JOIN (SELECT ABS (SUM(d.money)) AS
        money,d.`uid` FROM
        yeshi_ec_account_details d WHERE (d.type=10 OR
        d.type=9 ) AND d.uid=
        #{uid,jdbcType=BIGINT} GROUP BY d.`uid`) dd ON
        dd.uid=u.`id`
        LEFT JOIN (SELECT SUM(c.ecc_money) AS money,c.`ecc_uid`
        AS uid FROM
        `yeshi_ec_extract_check_compensate` c WHERE
        c.ecc_uid=#{uid,jdbcType=BIGINT} GROUP BY c.ecc_uid) cc ON
        cc.uid=u.`id`
        WHERE s.uid IS NOT NULL AND s.money!= u.my_hongbao) ttt
        LEFT JOIN yeshi_ec_user u ON ttt.uid=u.`id` WHERE
        ttt.hbmoney!=ttt.totalmoney
    </select>
    <select id="getTodayCount" resultType="java.util.HashMap">
        SELECT
        IFNULL(COUNT(et.id), 0)AS total,IFNULL(SUM(CASE WHEN et.state =
        1 THEN
        1 ELSE 0 END),0) AS succeed,IFNULL(SUM(CASE WHEN et.state = 2
        THEN 1
        ELSE 0 END),0) AS fails
        FROM yeshi_ec_extract et
        LEFT JOIN
        `yeshi_ec_extract_audit_record` ar ON ar.`extractId` = et.`id`
        WHERE
        ar.`id` IS NOT NULL
        AND FROM_UNIXTIME(ar.`auditTime`/1000,'%y%m%d') = CURDATE()
    </select>
    <select id="getTodayTotalSuccessMoney" resultType="java.math.BigDecimal">
        SELECT
        IFNULL(CAST(SUM(et.money)AS DECIMAL(19,2)),0) AS moneys
        FROM
        yeshi_ec_extract et
        LEFT JOIN `yeshi_ec_extract_audit_record` ar ON ar.`extractId` = et.`id`
        WHERE et.state=1 AND ar.`id` IS NOT NULL
        AND FROM_UNIXTIME(ar.`auditTime`/1000,'%y%m%d') = CURDATE()
    </select>
    <select id="countTotalSuccess" resultType="java.util.HashMap">
        <!-- 提现成功 次数、总金额 -->
        SELECT CAST(SUM(et.money)AS DECIMAL(19,2)) AS totalmoney,
        IFNULL(COUNT(et.id),0) AS totalamount FROM yeshi_ec_extract et
        WHERE et.state=1
    </select>
    <select id="getMyTaskInfo" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_extract
        WHERE adminId = ${adminId} and state=0 ORDER BY
        extractTime LIMIT 0,1
    </select>
    <select id="getNewTaskInfo" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_extract
        WHERE state=0 ORDER BY extractTime LIMIT 0,1
    </select>
    <select id="countRecordsByUid" resultType="java.util.HashMap">
        SELECT
        IFNULL(COUNT(et.id), 0) AS totalamount,IFNULL(SUM(CASE WHEN et.state
        =
        1 THEN 1 ELSE 0 END),0) AS succeed,
        IFNULL(SUM(CASE WHEN et.state = 2
        THEN 1 ELSE 0 END),0) AS fail
        FROM yeshi_ec_extract
        et WHERE (et.state=1
        OR et.state= 2) AND et.uid = ${uid}
    </select>
    <select id="countSuccessMoneysByUid" resultType="java.lang.Double">
        SELECT
        IFNULL(ROUND(SUM(et.money),2),0) AS moneys FROM yeshi_ec_extract et
        WHERE et.state=1 AND et.uid = ${uid}
    </select>
    <select id="countSuccessByUid" resultType="java.lang.Long">
        SELECT COUNT(et.id)
        FROM yeshi_ec_extract et
        WHERE et.state=1 AND et.uid = ${uid}
    </select>
    <select id="getFinishRecord" resultType="java.util.Map">
        SELECT ex.*,ar.* FROM yeshi_ec_extract ex LEFT JOIN
        yeshi_ec_extract_audit_record ar ON ar.extractId=ex.id
        WHERE
      <![CDATA[
            FROM_UNIXTIME(ex.extractTime/1000)  >= #{startTime}
               AND  FROM_UNIXTIME(ex.extractTime/1000) <= #{endTime}
       ]]>
        <if test='key != null and key != ""'>
            AND (ex.uid = #{key} OR ar.aid = #{key})
        </if>
        ORDER BY ex.extractTime DESC LIMIT ${start},${count}
    </select>
    <select id="countTodayApply" resultType="java.lang.Integer">
        SELECT count(id) FROM yeshi_ec_extract
        WHERE  <![CDATA[ FROM_UNIXTIME(extractTime/1000) >=CURDATE() ]]>
    </select>
    <select id="countTodayComplete" resultType="java.lang.Integer">
        SELECT count(id) FROM yeshi_ec_extract
        WHERE (state=1 OR state= 2) <![CDATA[AND  FROM_UNIXTIME(extractTime/1000) >=CURDATE() ]]>
    </select>
    <select id="countTodayMoney" resultType="java.lang.Double">
        SELECT IFNULL(SUM(t.`money`),0) FROM yeshi_ec_extract t
        WHERE t.`uid` = #{uid} AND t.state = 1
        AND <![CDATA[TO_DAYS( FROM_UNIXTIME(t.extractTime/1000)) = TO_DAYS(NOW())]]>
    </select>
    <select id="listByUidAndState" resultMap="BaseResultMap">
        select * from yeshi_ec_extract where uid=#{uid}
        <foreach collection="stateList" item="state" open=" and ("
            separator=" or " close=")">
            state=#{state}
        </foreach>
    </select>
    <select id="listAll" resultMap="BaseResultMap">
        select * from yeshi_ec_extract
        order by id desc limit #{start},#{count}
    </select>
    <select id="countAll" resultType="java.lang.Long">
        select count(id) from
        yeshi_ec_extract
    </select>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/ExtractRecordMapper.xml
New file
@@ -0,0 +1,94 @@
<?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.fanli.service.user.dao.money.ExtractRecordMapper">
    <resultMap id="BaseResultMap"
        type="org.fanli.facade.user.entity.money.extract.ExtractRecord">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="count" property="count" jdbcType="INTEGER" />
        <result column="money" property="money" jdbcType="DECIMAL" />
        <result column="createTime" property="createTime" jdbcType="BIGINT" />
        <!-- <result column="uid" property="userInfo"/> -->
        <!-- <association property="userInfo" column="uid" resultMap="com.yeshi.fanli.entity.dao.mybatis.UserInfoMapper.BaseResultMap"/> -->
    </resultMap>
    <sql id="Base_Column_List">id,uid,count,money,createTime</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_extract_record where id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByUid" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_extract_record where uid = #{0}
    </select>
    <select id="selectByUidAndToday" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_extract_record er where er.uid = #{0} <![CDATA[
         ANd FROM_UNIXTIME(er.createTime/1000) >= CURDATE()
     ]]>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_extract_record where id = #{id,jdbcType=BIGINT}
    </delete>
    <delete id="deleteAll">delete from
        yeshi_ec_extract_record
    </delete>
    <insert id="insert"
        parameterType="org.fanli.facade.user.entity.money.extract.ExtractRecord"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_extract_record (id,uid,count,money,createTime,id) values
        (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{money,jdbcType=DECIMAL},#{createTime,jdbcType=BIGINT},#{id,jdbcType=BIGINT})
    </insert>
    <insert id="insertSelective"
        parameterType="org.fanli.facade.user.entity.money.extract.ExtractRecord"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_extract_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="userInfo != null">uid,</if>
            <if test="count != null">count,</if>
            <if test="money != null">money,</if>
            <if test="createTime != null">createTime,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if>
            <if test="count != null">#{count,jdbcType=INTEGER},</if>
            <if test="money != null">#{money,jdbcType=DECIMAL},</if>
            <if test="createTime != null">#{createTime,jdbcType=BIGINT}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
        parameterType="org.fanli.facade.user.entity.money.extract.ExtractRecord">update
        yeshi_ec_extract_record set uid =
        #{userInfo.id,jdbcType=BIGINT},count
        = #{count,jdbcType=INTEGER},money
        = #{money,jdbcType=DECIMAL}
        ,createTime =#{createTime,jdbcType=BIGINT}
        where id =
        #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="org.fanli.facade.user.entity.money.extract.ExtractRecord">
        update yeshi_ec_extract_record
        <set>
            <if test="userInfo != null">uid=#{userInfo.id,jdbcType=BIGINT},</if>
            <if test="count != null">count=#{count,jdbcType=INTEGER},</if>
            <if test="money != null">money=#{money,jdbcType=DECIMAL},</if>
            <if test="createTime !=null">createTime =#{createTime,jdbcType=BIGINT},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/PayInfoMapper.xml
New file
@@ -0,0 +1,90 @@
<?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.fanli.service.user.dao.money.PayInfoMapper">
    <resultMap id="BaseResultMap" type="org.fanli.facade.user.entity.money.extract.PayInfo">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="state" property="state" jdbcType="INTEGER" />
        <result column="info" property="info" jdbcType="VARCHAR" />
        <result column="biz_no" property="bizno" jdbcType="VARCHAR" />
        <result column="orderId" property="orderId" jdbcType="VARCHAR" />
        <result column="createtime" property="createtime" jdbcType="DATE" />
        <result column="ordertime" property="ordertime" jdbcType="VARCHAR" />
        <association property="extract" column="eid"
            resultMap="org.fanli.service.user.dao.money.ExtractMapper.BaseResultMap" />
    </resultMap>
    <sql id="Base_Column_List">id,eid,state,info,biz_no,orderId,createtime,ordertime</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_payinfo where id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_payinfo where id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="org.fanli.facade.user.entity.money.extract.PayInfo"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_payinfo
        (id,eid,state,info,biz_no,orderId,createtime,ordertime) values
        (#{id,jdbcType=BIGINT},#{extract.id,jdbcType=BIGINT},#{state,jdbcType=INTEGER},#{info,jdbcType=VARCHAR},#{bizno,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR},#{createtime,jdbcType=DATE},#{ordertime,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="org.fanli.facade.user.entity.money.extract.PayInfo"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_payinfo
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="extract != null">eid,</if>
            <if test="state != null">state,</if>
            <if test="info != null">info,</if>
            <if test="bizno != null">biz_no,</if>
            <if test="orderId != null">orderId,</if>
            <if test="createtime != null">createtime,</if>
            <if test="ordertime != null">ordertime,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="extract != null">#{extract.id,jdbcType=BIGINT},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="info != null">#{info,jdbcType=VARCHAR},</if>
            <if test="bizno != null">#{bizno,jdbcType=VARCHAR},</if>
            <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
            <if test="createtime != null">#{createtime,jdbcType=DATE},</if>
            <if test="ordertime != null">#{ordertime,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="org.fanli.facade.user.entity.money.extract.PayInfo">update
        yeshi_ec_payinfo set eid = #{extract.id,jdbcType=BIGINT},state =
        #{state,jdbcType=INTEGER},info = #{info,jdbcType=VARCHAR},biz_no =
        #{bizno,jdbcType=VARCHAR},orderId =
        #{orderId,jdbcType=VARCHAR},createtime =
        #{createtime,jdbcType=DATE},ordertime = #{ordertime,jdbcType=VARCHAR}
        where id = #{id,jdbcType=BIGINT}</update>
    <update id="updateByPrimaryKeySelective" parameterType="org.fanli.facade.user.entity.money.extract.PayInfo">
        update yeshi_ec_payinfo
        <set>
            <if test="extract != null">eid=#{extract.id,jdbcType=BIGINT},</if>
            <if test="state != null">state=#{state,jdbcType=INTEGER},</if>
            <if test="info != null">info=#{info,jdbcType=VARCHAR},</if>
            <if test="bizno != null">biz_no=#{bizno,jdbcType=VARCHAR},</if>
            <if test="orderId != null">orderId=#{orderId,jdbcType=VARCHAR},</if>
            <if test="createtime != null">createtime=#{createtime,jdbcType=DATE},</if>
            <if test="ordertime != null">ordertime=#{ordertime,jdbcType=VARCHAR},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <select id="getListbyExtractId" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_payinfo where state=1 AND eid = #{eid,jdbcType=BIGINT}
    </select>
    <select id="sumMoneyByUid" resultType="java.lang.Double" parameterType="java.lang.Long">
       <!--  统计个人提现成功金额  -->
         SELECT COALESCE(SUM(ex.`money`),0) FROM `yeshi_ec_payinfo` p
             LEFT JOIN `yeshi_ec_extract` ex ON p.`eid`=ex.`id`
         WHERE p.`state` = 1 AND ex.uid = #{uid}
    </select>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/UserMoneyDetailMapper.xml
New file
@@ -0,0 +1,302 @@
<?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.fanli.service.user.dao.money.UserMoneyDetailMapper">
    <resultMap id="BaseResultMap" type="org.fanli.facade.user.entity.money.UserMoneyDetail">
        <id column="umd_id" property="id" jdbcType="BIGINT" />
        <result column="umd_money" property="money" jdbcType="DECIMAL" />
        <result column="umd_type" property="type"
            typeHandler="org.fanli.facade.user.util.typehandler.UserMoneyDetailTypeEnumHandler" />
        <result column="umd_title" property="title" jdbcType="VARCHAR" />
        <result column="umd_sub_title" property="subTitle" jdbcType="VARCHAR" />
        <result column="umd_desc_info" property="descInfo" jdbcType="VARCHAR" />
        <result column="umd_source_identify_id" property="sourceIdentifyId"
            jdbcType="BIGINT" />
        <result column="umd_identify_code" property="identifyCode"
            jdbcType="VARCHAR" />
        <result column="umd_beizhu" property="beiZhu" jdbcType="VARCHAR" />
        <result column="umd_createtime" property="createTime" jdbcType="TIMESTAMP" />
        <result column="umd_updatetime" property="updateTime" jdbcType="TIMESTAMP" />
        <!-- 老版明细适用该字段 -->
        <result column="state" property="state" jdbcType="INTEGER" />
        <association property="userInfo" column="umd_uid"
            javaType="com.yeshi.fanli.base.entity.user.UserInfo">
            <id column="umd_uid" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <resultMap id="UserMonthMoneyMap" type="org.fanli.facade.user.vo.UserMonthMoneyVO">
        <result column="expend" property="expend" jdbcType="DECIMAL" />
        <result column="income" property="income" jdbcType="DECIMAL" />
        <result column="dateFormate" property="dateFormate" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List">umd_id,umd_uid,umd_money,umd_type,umd_title,umd_sub_title,umd_desc_info,umd_source_identify_id,umd_identify_code,umd_beizhu,umd_createtime,umd_updatetime
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_money_detail where umd_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByUidWithIndexId" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_user_money_detail d WHERE d.`umd_createtime`
        <![CDATA[
            <=
        ]]>
        (SELECT
        d.`umd_createtime` FROM yeshi_ec_user_money_detail d WHERE
        d.`umd_id`=#{id}) and d.umd_uid=#{uid} order by d.`umd_createtime`
        desc,d.umd_id desc limit #{count}
    </select>
    <select id="selectCountByUid" resultType="java.lang.Long"
        parameterType="java.lang.Long">
        SELECT count(umd_id) FROM yeshi_ec_user_money_detail
        where umd_uid=#{uid}
    </select>
    <select id="selectByMaxCreateTime" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_user_money_detail d WHERE d.umd_uid=#{uid} and
        d.`umd_createtime`
        <![CDATA[
            <=
        ]]>
        #{date}
        order by d.`umd_createtime` desc,d.umd_id desc limit #{count}
    </select>
    <select id="selectCountByUidAndMaxCreateTime" resultType="java.lang.Long">
        SELECT count(umd_id) FROM yeshi_ec_user_money_detail
        where
        umd_uid=#{uid} and `umd_createtime`
        <![CDATA[
            <=
        ]]>
        #{date}
    </select>
    <select id="selectMonthCountByUid" resultType="java.lang.Integer">
        SELECT COUNT(*) FROM (SELECT * FROM yeshi_ec_user_money_detail d WHERE
        d.`umd_uid`=#{uid} and d.`umd_createtime` <![CDATA[<=]]>
        #{date} group by DATE_FORMAT(d.`umd_createtime`,'%y-%m')) a
    </select>
    <select id="selectMonthMoneyByUid" resultMap="UserMonthMoneyMap">
        <foreach collection="dateFormat" index="index" item="item"
            separator="UNION ALL">
            <trim prefix="(" suffix=")">
                SELECT
                c.time as dateFormate , if(a.money is null,0,a.money) as
                income ,if(b.money is null,0,b.money) as expend
                FROM
                (select #{item} as `time`) c
                left join
                (
                SELECT
                DATE_FORMAT(
                d.`umd_createtime`,'%Y-%m') AS
                `time`,SUM(d.`umd_money`)
                AS money
                FROM
                `yeshi_ec_user_money_detail`
                d
                WHERE d.`umd_uid`=#{uid}
                AND
                d.`umd_money`>=0 AND DATE_FORMAT(
                d.`umd_createtime`,'%Y-%m')=#{item} GROUP BY DATE_FORMAT(
                d.`umd_createtime`,'%Y-%m')
                ) a
                on a.time=c.time
                LEFT JOIN
                (
                SELECT DATE_FORMAT(
                d.`umd_createtime`,'%Y-%m') AS
                `time`,SUM(d.`umd_money`) AS money
                FROM
                `yeshi_ec_user_money_detail`
                d
                WHERE d.`umd_uid`=#{uid} AND
                d.`umd_money` <![CDATA[<0]]>
                AND DATE_FORMAT(
                d.`umd_createtime`,'%Y-%m')=#{item} GROUP BY
                DATE_FORMAT(
                d.`umd_createtime`,'%Y-%m')
                ) b ON c.time=b.time
            </trim>
        </foreach>
    </select>
    <select id="selectByUidWithState" resultMap="BaseResultMap">
        SELECT a.* FROM
        ((SELECT d.*,-1 AS state FROM
        `yeshi_ec_user_money_detail` d
        WHERE
        d.`umd_uid`=#{uid} AND (d.`umd_type`!='extract' AND
        d.`umd_type`!='extractReject')
        )
        UNION ALL(
        SELECT d.*,-1 AS
        state
        FROM
        `yeshi_ec_user_money_detail` d LEFT JOIN
        `yeshi_ec_extract` e
        ON
        e.`id`=d.umd_source_identify_id WHERE d.`umd_uid`=#{uid} AND
        d.umd_type='extractReject'
        )
        UNION ALL(
        SELECT
        d.*,e.state FROM
        `yeshi_ec_user_money_detail` d LEFT JOIN
        `yeshi_ec_extract` e ON
        e.`id`=d.`umd_source_identify_id` WHERE d.`umd_uid`=#{uid} AND
        d.umd_type='extract'
        )) a ORDER BY a.umd_createtime DESC LIMIT
        #{start},#{count}
    </select>
    <select id="selectCountByUidWithState" resultType="java.lang.Long">
        SELECT
        count(*) FROM
        ((SELECT d.*,-1 AS state FROM
        `yeshi_ec_user_money_detail` d
        WHERE
        d.`umd_uid`=#{uid} AND
        (d.`umd_type`!='extract' AND d.`umd_type`!='extractReject')
        )
        UNION ALL(
        SELECT d.*,-1 AS
        state
        FROM `yeshi_ec_user_money_detail` d LEFT JOIN
        `yeshi_ec_extract` e
        ON
        e.`id`=d.umd_source_identify_id WHERE
        d.`umd_uid`=#{uid} AND
        d.umd_type='extractReject'
        )
        UNION ALL(
        SELECT
        d.*,e.state FROM `yeshi_ec_user_money_detail` d LEFT JOIN
        `yeshi_ec_extract` e ON e.`id`=d.`umd_source_identify_id` WHERE
        d.`umd_uid`=#{uid} AND
        d.umd_type='extract'
        )) a
    </select>
    <select id="getTotalMoneyByTypeAndUidWithDate" resultType="java.math.BigDecimal">
        select sum(umd_money) from yeshi_ec_user_money_detail where
        umd_uid=#{uid} and umd_createtime>=#{minDate} and
        umd_createtime<![CDATA[<]]>#{maxDate}
        <foreach collection="typeList" item="item" open=" and ("
            separator=" or " close=")">
            umd_type=#{item}
        </foreach>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_user_money_detail where umd_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="org.fanli.facade.user.entity.money.UserMoneyDetail"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_user_money_detail
        (umd_id,umd_uid,umd_money,umd_type,umd_title,umd_sub_title,umd_desc_info,umd_source_identify_id,umd_identify_code,umd_beizhu,umd_createtime,umd_updatetime)
        values
        (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{subTitle,jdbcType=VARCHAR},#{descInfo,jdbcType=VARCHAR},#{sourceIdentifyId,jdbcType=BIGINT},#{identifyCode,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="org.fanli.facade.user.entity.money.UserMoneyDetail"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_user_money_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">umd_id,</if>
            <if test="userInfo != null">umd_uid,</if>
            <if test="money != null">umd_money,</if>
            <if test="type != null">umd_type,</if>
            <if test="title != null">umd_title,</if>
            <if test="subTitle != null">umd_sub_title,</if>
            <if test="descInfo != null">umd_desc_info,</if>
            <if test="sourceIdentifyId != null">umd_source_identify_id,</if>
            <if test="identifyCode != null">umd_identify_code,</if>
            <if test="beiZhu != null">umd_beizhu,</if>
            <if test="createTime != null">umd_createtime,</if>
            <if test="updateTime != null">umd_updatetime,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if>
            <if test="money != null">#{money,jdbcType=DECIMAL},</if>
            <if test="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="title != null">#{title,jdbcType=VARCHAR},</if>
            <if test="subTitle != null">#{subTitle,jdbcType=VARCHAR},</if>
            <if test="descInfo != null">#{descInfo,jdbcType=VARCHAR},</if>
            <if test="sourceIdentifyId != null">#{sourceIdentifyId,jdbcType=BIGINT},</if>
            <if test="identifyCode != null">#{identifyCode,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="org.fanli.facade.user.entity.money.UserMoneyDetail">update
        yeshi_ec_user_money_detail set umd_uid =
        #{userInfo.id,jdbcType=BIGINT},umd_money =
        #{money,jdbcType=DECIMAL},umd_type =
        #{type,jdbcType=VARCHAR},umd_title =
        #{title,jdbcType=VARCHAR},umd_sub_title =
        #{subTitle,jdbcType=VARCHAR},umd_desc_info =
        #{descInfo,jdbcType=VARCHAR},umd_source_identify_id =
        #{sourceIdentifyId,jdbcType=BIGINT},umd_identify_code =
        #{identifyCode,jdbcType=VARCHAR},umd_beizhu =
        #{beiZhu,jdbcType=VARCHAR},umd_createtime =
        #{createTime,jdbcType=TIMESTAMP},umd_updatetime =
        #{updateTime,jdbcType=TIMESTAMP} where umd_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="org.fanli.facade.user.entity.money.UserMoneyDetail">
        update yeshi_ec_user_money_detail
        <set>
            <if test="userInfo != null">umd_uid=#{userInfo.id,jdbcType=BIGINT},</if>
            <if test="money != null">umd_money=#{money,jdbcType=DECIMAL},</if>
            <if test="type != null">umd_type=#{type,jdbcType=VARCHAR},</if>
            <if test="title != null">umd_title=#{title,jdbcType=VARCHAR},</if>
            <if test="subTitle != null">umd_sub_title=#{subTitle,jdbcType=VARCHAR},</if>
            <if test="descInfo != null">umd_desc_info=#{descInfo,jdbcType=VARCHAR},</if>
            <if test="sourceIdentifyId != null">umd_source_identify_id=#{sourceIdentifyId,jdbcType=BIGINT},
            </if>
            <if test="identifyCode != null">umd_identify_code=#{identifyCode,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">umd_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="createTime != null">umd_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">umd_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where umd_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/money/msg/MsgMoneyDetailMapper.xml
New file
@@ -0,0 +1,156 @@
<?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.fanli.service.user.dao.money.msg.MsgMoneyDetailMapper">
    <resultMap id="BaseResultMap" type="org.fanli.facade.user.entity.money.msg.MsgMoneyDetail">
        <id column="mm_id" property="id" jdbcType="BIGINT" />
        <result column="mm_type" property="msgType"
            typeHandler="org.fanli.facade.user.util.typehandler.MsgTypeMoneyTypeEnumHandler" />
        <result column="mm_order_count" property="orderCount" jdbcType="INTEGER" />
        <result column="mm_goods_count" property="goodsCount" jdbcType="INTEGER" />
        <result column="mm_order_id" property="orderId" jdbcType="VARCHAR" />
        <result column="mm_money" property="money" jdbcType="DECIMAL" />
        <result column="mm_balance" property="balance" jdbcType="DECIMAL" />
        <result column="mm_state_desc" property="stateDesc" jdbcType="VARCHAR" />
        <result column="mm_beizhu" property="beiZhu" jdbcType="VARCHAR" />
        <result column="mm_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="mm_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="mm_read" property="read" jdbcType="BOOLEAN" />
        <association property="user" column="mm_uid"  javaType="com.yeshi.fanli.base.entity.user.UserInfo">
            <id column="mm_uid" property="id" jdbcType="BIGINT" />
        </association>
        <association property="extract" column="mm_source_id_extract"
            select="org.fanli.service.user.dao.money.ExtractMapper.selectByPrimaryKey">
        </association>
        <association property="alipayAccountValid" column="mm_source_id_alipayvalid"
            select="org.fanli.service.user.dao.money.AlipayAccountValidNormalHistoryMapper.selectByPrimaryKey">
        </association>
    </resultMap>
    <sql id="Base_Column_List">mm_id,mm_uid,mm_type,mm_order_count,mm_goods_count,mm_order_id,mm_source_id,mm_money,mm_balance,mm_state_desc,mm_beizhu,mm_create_time,mm_update_time,mm_read
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_money where mm_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectBySourceIdAndMsgType" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_money where mm_source_id =
        #{sourceId,jdbcType=BIGINT} and mm_type=#{type}
    </select>
    <select id="listByUid" resultMap="BaseResultMap" >
        select
        <include refid="Base_Column_List" />,
        mm_source_id as mm_source_id_extract,
        mm_source_id as mm_source_id_alipayvalid
        from yeshi_ec_msg_money where mm_uid = #{uid,jdbcType=BIGINT} order by
        mm_update_time desc limit #{start},#{count}
    </select>
    <select id="countByUid" resultType="java.lang.Long"
        parameterType="java.lang.Long">
        select
        count(mm_id)
        from yeshi_ec_msg_money where mm_uid =
        #{uid,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_msg_money where mm_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="org.fanli.facade.user.entity.money.msg.MsgMoneyDetail"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_money
        (mm_id,mm_uid,mm_type,mm_order_count,mm_goods_count,mm_order_id,mm_source_id,mm_money,mm_balance,mm_state_desc,mm_beizhu,mm_create_time,mm_update_time,mm_read)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{msgType,jdbcType=VARCHAR},#{orderCount,jdbcType=INTEGER},#{goodsCount,jdbcType=INTEGER},#{orderId,jdbcType=VARCHAR},#{extract.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{balance,jdbcType=DECIMAL},#{stateDesc,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{read,jdbcType=BOOLEAN})
    </insert>
    <insert id="insertSelective" parameterType="org.fanli.facade.user.entity.money.msg.MsgMoneyDetail"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_msg_money
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">mm_id,</if>
            <if test="user != null">mm_uid,</if>
            <if test="msgType != null">mm_type,</if>
            <if test="orderCount != null">mm_order_count,</if>
            <if test="goodsCount != null">mm_goods_count,</if>
            <if test="orderId != null">mm_order_id,</if>
            <if test="extract != null">mm_source_id,</if>
            <if test="alipayAccountValid != null">mm_source_id,</if>
            <if test="money != null">mm_money,</if>
            <if test="balance != null">mm_balance,</if>
            <if test="stateDesc != null">mm_state_desc,</if>
            <if test="beiZhu != null">mm_beizhu,</if>
            <if test="createTime != null">mm_create_time,</if>
            <if test="updateTime != null">mm_update_time,</if>
            <if test="read != null">mm_read,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
            <if test="msgType != null">#{msgType,jdbcType=VARCHAR},</if>
            <if test="orderCount != null">#{orderCount,jdbcType=INTEGER},</if>
            <if test="goodsCount != null">#{goodsCount,jdbcType=INTEGER},</if>
            <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
            <if test="extract != null">#{extract.id,jdbcType=BIGINT},</if>
            <if test="alipayAccountValid != null">#{alipayAccountValid.id,jdbcType=BIGINT},</if>
            <if test="money != null">#{money,jdbcType=DECIMAL},</if>
            <if test="balance != null">#{balance,jdbcType=DECIMAL},</if>
            <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="read != null">#{read,jdbcType=BOOLEAN},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="org.fanli.facade.user.entity.money.msg.MsgMoneyDetail">update
        yeshi_ec_msg_money set mm_uid = #{user.id,jdbcType=BIGINT},mm_type =
        #{msgType,jdbcType=VARCHAR},mm_order_count =
        #{orderCount,jdbcType=INTEGER},mm_goods_count =
        #{goodsCount,jdbcType=INTEGER},mm_order_id =
        #{orderId,jdbcType=VARCHAR},mm_source_id =
        #{extract.id,jdbcType=BIGINT},mm_money =
        #{money,jdbcType=DECIMAL},mm_balance =
        #{balance,jdbcType=DECIMAL},mm_state_desc =
        #{stateDesc,jdbcType=VARCHAR},mm_beizhu =
        #{beiZhu,jdbcType=VARCHAR},mm_create_time =
        #{createTime,jdbcType=TIMESTAMP},mm_update_time =
        #{updateTime,jdbcType=TIMESTAMP},mm_read = #{read,jdbcType=BOOLEAN}
        where mm_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="org.fanli.facade.user.entity.money.msg.MsgMoneyDetail">
        update yeshi_ec_msg_money
        <set>
            <if test="user != null">mm_uid=#{user.id,jdbcType=BIGINT},</if>
            <if test="msgType != null">mm_type=#{msgType,jdbcType=VARCHAR},</if>
            <if test="orderCount != null">mm_order_count=#{orderCount,jdbcType=INTEGER},</if>
            <if test="goodsCount != null">mm_goods_count=#{goodsCount,jdbcType=INTEGER},</if>
            <if test="orderId != null">mm_order_id=#{orderId,jdbcType=VARCHAR},</if>
            <if test="extract != null">mm_source_id=#{extract.id,jdbcType=BIGINT},</if>
            <if test="alipayAccountValid != null">mm_source_id=#{alipayAccountValid.id,jdbcType=BIGINT},
            </if>
            <if test="money != null">mm_money=#{money,jdbcType=DECIMAL},</if>
            <if test="balance != null">mm_balance=#{balance,jdbcType=DECIMAL},</if>
            <if test="stateDesc != null">mm_state_desc=#{stateDesc,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">mm_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="createTime != null">mm_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">mm_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="read != null">mm_read=#{read,jdbcType=BOOLEAN},</if>
        </set>
        where mm_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="setMsgReadByUid" parameterType="java.lang.Long">
        update
        yeshi_ec_msg_money set mm_read=1 where mm_uid=#{0}
    </update>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/BindingAccountServiceImpl.java
New file
@@ -0,0 +1,253 @@
package org.fanli.service.user.service.impl.account;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import javax.annotation.Resource;
import org.fanli.facade.user.entity.account.BindingAccount;
import org.fanli.facade.user.entity.account.BindingAccountService;
import org.fanli.facade.user.entity.money.UserMoneyDetail;
import org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory;
import org.fanli.facade.user.exception.account.BindingAccountException;
import org.fanli.facade.user.exception.money.AlipayAccountException;
import org.fanli.facade.user.exception.money.AlipayTransferException;
import org.fanli.facade.user.exception.money.UserMoneyDetailException;
import org.fanli.facade.user.util.factory.UserMoneyDetailFactory;
import org.fanli.service.user.dao.account.UserInfoMapper;
import org.fanli.service.user.dao.money.AlipayAccountValidNormalHistoryMapper;
import org.fanli.service.user.dao.money.BindingAccountMapper;
import org.fanli.service.user.dao.money.UserMoneyDetailMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.StringUtil;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
import com.yeshi.fanli.base.Constant;
import com.yeshi.fanli.base.entity.user.UserInfo;
import com.yeshi.fanli.base.log.LogHelper;
import net.sf.json.JSONObject;
@Service
public class BindingAccountServiceImpl implements BindingAccountService {
    @Resource
    private BindingAccountMapper bindingAccountMapper;
    @Resource
    private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
    @Resource
    private UserInfoMapper userInfoMapper;
    @Resource
    private UserMoneyDetailMapper userMoneyDetailMapper;
    public List<BindingAccount> getBindingAccountByUid(long uid) {
        return bindingAccountMapper.selectByUid(uid);
    }
    public void addBindingAccount(BindingAccount addAccount) throws BindingAccountException {
        BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(addAccount.getUserInfo().getId(),
                addAccount.getType());
        if (bindingAccount == null) {
            bindingAccountMapper.insertSelective(addAccount);
        } else {
            throw new BindingAccountException(Constant.BA_EXIST);
        }
    }
    public Integer deleteBindingAccount(BindingAccount account) {
        BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(account.getUserInfo().getId(),
                account.getType());
        if (bindingAccount != null) {
            bindingAccountMapper.deleteByPrimaryKey(bindingAccount.getId());
            return 1;
        } else
            return 0;
    }
    public BindingAccount getBindingAccountByUidAndType(long uid, int type) {
        return bindingAccountMapper.selectByUidAndType(uid, type);
    }
    @Override
    public BindingAccount changeAlipayBinding(Long uid, String name, String account) {
        BindingAccount bindingAccount = getBindingAccountByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
        if (bindingAccount == null)// 创建账号
        {
            bindingAccount = new BindingAccount();
            bindingAccount.setAccount(account);
            bindingAccount.setName(name);
            bindingAccount.setType(BindingAccount.TYPE_ALIPAY);
            bindingAccount.setUserInfo(new UserInfo(uid));
            bindingAccountMapper.insertSelective(bindingAccount);
        } else {
            BindingAccount update = new BindingAccount();
            update.setId(bindingAccount.getId());
            update.setName(name);
            update.setAccount(account);
            bindingAccountMapper.updateByPrimaryKeySelective(update);
            bindingAccount.setName(name);
            bindingAccount.setAccount(account);
        }
        return bindingAccount;
    }
    @Override
    public int deleteByPrimaryKey(Long id) {
        return bindingAccountMapper.deleteByPrimaryKey(id);
    }
    @Transactional
    @Override
    public void validAlipayAccount(Long uid, String account, String name)
            throws AlipayTransferException, AlipayApiException, AlipayAccountException {
        if (uid == null)
            throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "用户ID不能为空");
        if (StringUtil.isNullOrEmpty(account))
            throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "账号不能为空");
        if (StringUtil.isNullOrEmpty(name))
            throw new AlipayAccountException(AlipayAccountException.CODE_NO_PARAMS, "真实姓名不能为空");
        //
        List<BindingAccount> bindingAccountList = bindingAccountMapper.selectByAccount(account);
        if (bindingAccountList != null && bindingAccountList.size() > 0) {
            if (bindingAccountList.get(0).getUserInfo().getId().longValue() != uid)
                throw new AlipayAccountException(AlipayAccountException.CODE_ALREADY_BIND,
                        "该支付宝账号已被其他账号绑定,请更换其他的支付宝账号来绑定");
        }
        // TODO 做频率验证-每月验证一次
        AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
        if (latest != null) {
            Calendar caLatest = Calendar.getInstance();
            caLatest.setTimeInMillis(latest.getCreateTime().getTime());
            Calendar nowLatest = Calendar.getInstance();
            if (caLatest.get(Calendar.MONTH) == nowLatest.get(Calendar.MONTH))// 上次更改和现在是同一个月
                throw new AlipayAccountException(AlipayAccountException.CODE_TIMES_LIMIT, "每月只能更换绑定一次支付宝账号,请次月再试。");
        }
        UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
        if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0)
            throw new AlipayAccountException(AlipayAccountException.CODE_NO_MONEY, "你的账户目前没有余额,无需绑定提现帐号。");
        // 需要转账验证
        BigDecimal money = new BigDecimal("0.1");
        transferAlipayWithVerify(account, name);
        // 扣款
        userInfoMapper.subHongBaoByUid(uid, money);
        // 转账成功
        // 插入转账成功表
        AlipayAccountValidNormalHistory history = new AlipayAccountValidNormalHistory();
        history.setAccount(account);
        history.setCreateTime(new Date());
        history.setName(name);
        history.setUid(uid);
        alipayAccountValidNormalHistoryMapper.insertSelective(history);
        // 新版资金
        try {
            UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractAccountValid(history, money);
            userMoneyDetailMapper.insertSelective(userMoneyDetail);
        } catch (UserMoneyDetailException e) {
            try {
                LogHelper.errorDetailInfo(e);
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
        // userNotificationService.alipayAccountValidRight(uid, money, account);
    }
    private void transferAlipayWithVerify(String account, String name)
            throws AlipayTransferException, AlipayApiException {
        String privateKey = Constant.alipayConfig.getPrivateKey();
        AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",
                Constant.alipayConfig.getAppId(), privateKey, "json", "gbk", null, "RSA2");
        AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String appName = Constant.systemCommonConfig.getProjectChineseName();
        JSONObject json = new JSONObject();
        json.put("out_biz_no", uuid);
        json.put("payee_type", "ALIPAY_LOGONID");
        json.put("payee_account", account);
        json.put("amount", "0.1");
        json.put("payer_show_name", appName + "支付宝验证");
        json.put("payee_real_name", name);
        json.put("remark", "来自" + appName + "的支付宝验证打款");
        request.setBizContent(json.toString());
        AlipayFundTransToaccountTransferResponse response = null;
        response = alipayClient.execute(request);
        // 成功转账
        if (response != null && response.isSuccess() && "10000".equals(response.getCode())) {
            return;
        } else// 转账失败
        {
            throw new AlipayTransferException(Integer.parseInt(response.getCode()), response.getSubCode(),
                    response.getSubMsg());
        }
    }
    @Transactional
    @Override
    public BindingAccount changeAlipayBindingWithVerify(Long uid, String name, String account)
            throws AlipayTransferException, AlipayApiException, AlipayAccountException {
        try {
            validAlipayAccount(uid, account, name);
        } catch (AlipayTransferException e1) {
            throw new AlipayTransferException(e1.getCode(), e1.getSubCode(), e1.getMsg());
        } catch (AlipayApiException e1) {
            throw new AlipayApiException(e1.getErrCode(), e1.getErrMsg());
        } catch (AlipayAccountException e1) {
            throw new AlipayAccountException(e1.getCode(), e1.getMsg());
        }
        BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
        if (bindingAccount == null)// 创建账号
        {
            bindingAccount = new BindingAccount();
            bindingAccount.setAccount(account);
            bindingAccount.setName(name);
            bindingAccount.setType(BindingAccount.TYPE_ALIPAY);
            bindingAccount.setUserInfo(new UserInfo(uid));
            bindingAccountMapper.insertSelective(bindingAccount);
        } else {
            BindingAccount updateBindingAccount = new BindingAccount();
            updateBindingAccount.setId(bindingAccount.getId());
            updateBindingAccount.setName(name);
            updateBindingAccount.setAccount(account);
            bindingAccountMapper.updateByPrimaryKeySelective(updateBindingAccount);
            bindingAccount.setName(updateBindingAccount.getName());
            bindingAccount.setAccount(updateBindingAccount.getAccount());
        }
        return bindingAccount;
    }
    @Override
    public boolean canVerifyAlipayAccount(Long uid) throws BindingAccountException {
        UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
        if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0)
            throw new BindingAccountException(1, "你的账户目前没有余额,无需绑定提现帐号。");
        AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
        if (latest != null) {
            Calendar caLatest = Calendar.getInstance();
            caLatest.setTimeInMillis(latest.getCreateTime().getTime());
            Calendar nowLatest = Calendar.getInstance();
            if (caLatest.get(Calendar.MONTH) == nowLatest.get(Calendar.MONTH))// 上次更改和现在是同一个月
                throw new BindingAccountException(2, "每月仅可修改1次提现账号,请下月再试吧。");
        }
        return true;
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/ForbiddenUserIdentifyCodeServiceImpl.java
New file
@@ -0,0 +1,64 @@
package org.fanli.service.user.service.impl.account;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode;
import org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import org.fanli.facade.user.exception.account.ForbiddenUserIdentifyCodeException;
import org.fanli.facade.user.service.account.ForbiddenUserIdentifyCodeService;
import org.fanli.service.user.dao.account.ForbiddenUserIdentifyCodeMapper;
import org.springframework.stereotype.Service;
import org.yeshi.utils.StringUtil;
@Service
public class ForbiddenUserIdentifyCodeServiceImpl implements ForbiddenUserIdentifyCodeService {
    @Resource
    private ForbiddenUserIdentifyCodeMapper forbiddenUserIdentifyCodeMapper;
    @Override
    public void addIdentifyCode(ForbiddenUserIdentifyCode identifyCode) throws ForbiddenUserIdentifyCodeException {
        if (identifyCode == null || identifyCode.getType() == null
                || StringUtil.isNullOrEmpty(identifyCode.getIdentifyCode()))
            throw new ForbiddenUserIdentifyCodeException(1, "信息不完整");
        ForbiddenUserIdentifyCode old = listByTypeAndIdentifyCode(identifyCode.getType(),
                identifyCode.getIdentifyCode());
        if (old != null)
            throw new ForbiddenUserIdentifyCodeException(2, "信息已存在");
        identifyCode.setCreateTime(new Date());
        identifyCode.setEffective(true);
        forbiddenUserIdentifyCodeMapper.insertSelective(identifyCode);
    }
    @Override
    public ForbiddenUserIdentifyCode listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum type,
            String identifyCode) {
        List<ForbiddenUserIdentifyCode> list = forbiddenUserIdentifyCodeMapper.listByTypeAndIdentifyCode(type,
                identifyCode);
        if (list != null && list.size() > 0)
            return list.get(0);
        else
            return null;
    }
    @Override
    public void update(ForbiddenUserIdentifyCode identifyCode) {
        if (identifyCode == null)
            return;
        identifyCode.setUpdateTime(new Date());
        forbiddenUserIdentifyCodeMapper.updateByPrimaryKeySelective(identifyCode);
    }
    @Override
    public void delete(ForbiddenUserIdentifyCode identifyCode) {
        if (identifyCode == null || identifyCode.getId() == null)
            return;
        forbiddenUserIdentifyCodeMapper.deleteByPrimaryKey(identifyCode.getId());
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/UserAccountServiceImpl.java
File was renamed from fanli-service-user/src/main/java/org/fanli/service/user/service/impl/UserAccountServiceImpl.java
@@ -1,4 +1,4 @@
package org.fanli.service.user.service.impl;
package org.fanli.service.user.service.impl.account;
import java.io.File;
import java.io.FileWriter;
@@ -12,11 +12,17 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.fanli.facade.user.dto.HongBao;
import org.fanli.facade.user.dto.account.LoginResult;
import org.fanli.facade.user.dto.wx.WeiXinUser;
import org.fanli.facade.user.entity.account.BindingAccount;
import org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode;
import org.fanli.facade.user.entity.account.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import org.fanli.facade.user.entity.account.UserConnectHistory;
import org.fanli.facade.user.entity.account.msg.UserAccountMsgNotificationService;
import org.fanli.facade.user.entity.invite.ThreeSale;
import org.fanli.facade.user.exception.UserAccountException;
import org.fanli.facade.user.service.account.ForbiddenUserIdentifyCodeService;
import org.fanli.facade.user.service.account.UserAccountService;
import org.fanli.facade.user.service.invite.SpreadUserImgService;
import org.fanli.facade.user.service.taobao.UserExtraTaoBaoInfoService;
@@ -24,6 +30,7 @@
import org.fanli.facade.user.util.wx.WXLoginUtil;
import org.fanli.service.user.dao.account.UserInfoMapper;
import org.fanli.service.user.dao.invite.ThreeSaleMapper;
import org.fanli.service.user.dao.money.BindingAccountMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.FileUtil;
@@ -32,6 +39,7 @@
import org.yeshi.utils.TimeUtil;
import org.yeshi.utils.tencentcloud.COSManager;
import com.alipay.api.domain.OrderItem;
import com.google.gson.Gson;
import com.qcloud.cos.model.COSObjectSummary;
import com.qcloud.cos.model.ObjectListing;
@@ -73,6 +81,7 @@
    @Resource
    private AccountMessageMapper accountMessageMapper;
    @Resource
    private MoneyRecordMapper moneyRecordMapper;
@@ -84,6 +93,9 @@
    @Resource
    private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
    @Resource
    private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService;
    @Transactional
    @Override
@@ -109,7 +121,20 @@
            WeiXinUser weiXinUser = null;
            switch (loginType) {
            case 1:// 淘宝
                    // 判断淘宝是否被封禁
                if (!StringUtil.isNullOrEmpty(tbUserInfo.getTaoBaoUid())) {
                    ForbiddenUserIdentifyCode identifyCode = forbiddenUserIdentifyCodeService.listByTypeAndIdentifyCode(
                            ForbiddenUserIdentifyCodeTypeEnum.taobaoUid, tbUserInfo.getTaoBaoUid());
                    if (identifyCode != null && identifyCode.getEffective() != null && identifyCode.getEffective())
                        throw new UserAccountException(Constant.CODE_FORBIDDEN_USER,
                                Constant.FORBIDDEN_USER_REASON_DESC);
                }
                userInfo = getUserInfoByTaoBaoOpenId(appId, tbUserInfo.getOpenid());
                // 判断用户是否被删除
                if (userInfo != null && userInfo.getState() != null
                        && (userInfo.getState() == UserInfo.STATE_DELETE_OUT_OF_DATE
                                || userInfo.getState() == UserInfo.STATE_DELETE))
                    userInfo = null;
                if (userInfo == null) {// 原先的账号不存在
                    userInfo = new UserInfo();
                    userInfo.setAppId(appId);
@@ -141,7 +166,18 @@
                if (weiXinUser == null)
                    throw new UserAccountException(1001, "无法获取到微信个人信息");
                LogHelper.test("微信授权用户信息:" + new Gson().toJson(weiXinUser));
                // 判断微信unionid是否被封禁
                ForbiddenUserIdentifyCode identifyCode = forbiddenUserIdentifyCodeService.listByTypeAndIdentifyCode(
                        ForbiddenUserIdentifyCodeTypeEnum.wxUnionId, weiXinUser.getUnionid());
                if (identifyCode != null && identifyCode.getEffective() != null && identifyCode.getEffective())
                    throw new UserAccountException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC);
                userInfo = getUserInfoByWXUnionId(appId, weiXinUser.getUnionid());
                // 判断用户是否被删除
                if (userInfo != null && userInfo.getState() != null
                        && (userInfo.getState() == UserInfo.STATE_DELETE_OUT_OF_DATE
                                || userInfo.getState() == UserInfo.STATE_DELETE))
                    userInfo = null;
                // 直接用的微信登录
                if (lastUser == null) {
                    if (userInfo != null) {
@@ -267,7 +303,19 @@
                    }
                }
            case 3:// 手机号码
                    // 判断手机号码是否被封禁
                ForbiddenUserIdentifyCode identifyCode1 = forbiddenUserIdentifyCodeService
                        .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, phone);
                if (identifyCode1 != null && identifyCode1.getEffective() != null && identifyCode1.getEffective())
                    throw new UserAccountException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC);
                userInfo = getUserInfoByPhone(appId, phone);
                // 判断用户是否被删除
                if (userInfo != null && userInfo.getState() != null
                        && (userInfo.getState() == UserInfo.STATE_DELETE_OUT_OF_DATE
                                || userInfo.getState() == UserInfo.STATE_DELETE))
                    userInfo = null;
                if (userInfo == null) {// 原先的账号不存在
                    userInfo = new UserInfo();
                    userInfo.setAppId(appId);
@@ -538,7 +586,19 @@
        if (StringUtil.isNullOrEmpty(unionId))
            throw new UserAccountException(2, "unionId为空");
        return userInfoMapper.getUserInfoByAppIdAndWXUnionId(appId, unionId);
        List<UserInfo> list = userInfoMapper.listByAppIdAndWXUnionId(appId, unionId);
        // 剔除被删除掉的用户
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getState() == UserInfo.STATE_DELETE
                    || list.get(i).getState() == UserInfo.STATE_DELETE_OUT_OF_DATE) {
                list.remove(i);
                i--;
            }
        }
        if (list.size() > 0)
            return list.get(list.size() - 1);
        else
            return null;
    }
    /**
@@ -553,7 +613,20 @@
            throw new UserAccountException(1, "appId为空");
        if (StringUtil.isNullOrEmpty(openId))
            throw new UserAccountException(2, "openId为空");
        return userInfoMapper.getUserInfoByAppIdAndTaoBaoOpenId(appId, openId);
        List<UserInfo> list = userInfoMapper.listByAppIdAndTaoBaoOpenId(appId, openId);
        // 剔除被删除掉的用户
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getState() == UserInfo.STATE_DELETE
                    || list.get(i).getState() == UserInfo.STATE_DELETE_OUT_OF_DATE) {
                list.remove(i);
                i--;
            }
        }
        if (list.size() > 0)
            return list.get(list.size() - 1);
        else
            return null;
    }
    /**
@@ -568,7 +641,21 @@
            throw new UserAccountException(1, "appId为空");
        if (StringUtil.isNullOrEmpty(phone))
            throw new UserAccountException(2, "phone为空");
        return userInfoMapper.getUserInfoByAppIdAndPhone(appId, phone);
        List<UserInfo> list = userInfoMapper.listByAppIdAndPhone(appId, phone);
        // 剔除被删除掉的用户
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getState() == UserInfo.STATE_DELETE
                    || list.get(i).getState() == UserInfo.STATE_DELETE_OUT_OF_DATE) {
                list.remove(i);
                i--;
            }
        }
        if (list.size() > 0)
            return list.get(list.size() - 1);
        else
            return null;
    }
    private void updateLatestLoginTime(Long uid) {
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/ExtractAuditRecordServiceImpl.java
New file
@@ -0,0 +1,108 @@
package org.fanli.service.user.service.impl.money;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.fanli.facade.user.entity.money.extract.ExtractAuditRecord;
import org.fanli.facade.user.service.money.ExtractAuditRecordService;
import org.fanli.service.user.dao.money.ExtractAuditRecordMapper;
import org.springframework.stereotype.Service;
@Service
public class ExtractAuditRecordServiceImpl implements ExtractAuditRecordService {
    @Resource
    private ExtractAuditRecordMapper extractAuditRecordMapper;
    @Override
    public List<ExtractAuditRecord> getList(int pageIndex, int pageSize, String key, String startTime, String endTime) {
        return extractAuditRecordMapper.getList((pageIndex - 1) * pageSize, pageSize, key, startTime, endTime);
    }
    @Override
    public int getCount(String key, String startTime, String endTime) {
        return extractAuditRecordMapper.getCount(key, startTime, endTime);
    }
    @Override
    public List<ExtractAuditRecord> getMyAuditedAllList(int pageIndex, int pageSize, String key, Integer state,
            Long adminId) {
        return extractAuditRecordMapper.getMyAuditedAllList((pageIndex - 1) * pageSize, pageSize, key, state, adminId);
    }
    @Override
    public int getMyAuditedAllCount(String key, Integer state, Long adminId) {
        return extractAuditRecordMapper.getMyAuditedAllCount(key, state, adminId);
    }
    @Override
    public List<ExtractAuditRecord> getMyAuditedTimeSlotList(int pageIndex, int pageSize, String key, Integer state,
            Long adminId, Integer days) {
        return extractAuditRecordMapper.getMyAuditedTimeSlotList((pageIndex - 1) * pageSize, pageSize, key, state,
                adminId, days);
    }
    @Override
    public int getMyAuditedTimeSlotCount(String key, Integer state, Long adminId, Integer days) {
        return extractAuditRecordMapper.getMyAuditedTimeSlotCount(key, state, adminId, days);
    }
    @Override
    public int getMyAuditedCountWeek(Long adminId) {
        return extractAuditRecordMapper.getMyAuditedCountWeek(adminId);
    }
    @Override
    public int getMyAuditedCountMonth(Long adminId) {
        return extractAuditRecordMapper.getMyAuditedCountMonth(adminId);
    }
    @Override
    public int getMyAuditedCountToday(Long adminId) {
        return extractAuditRecordMapper.getMyAuditedCountToday(adminId);
    }
    @Override
    public List<ExtractAuditRecord> getByUidList(int pageIndex, int pageSize, Long uid) {
        return extractAuditRecordMapper.getByUidList((pageIndex - 1) * pageSize, pageSize, uid);
    }
    @Override
    public int getByUidCount(Long key) {
        return extractAuditRecordMapper.getByUidCount(key);
    }
    @Override
    public List<ExtractAuditRecord> getListbyExtractId(Long extractId) {
        return extractAuditRecordMapper.getListbyExtractId(extractId);
    }
    @Override
    public List<ExtractAuditRecord> getbyExtractId(Long extractId) {
        return extractAuditRecordMapper.getbyExtractId(extractId);
    }
    @Override
    public List<Map<String, Object>> countAuditTotal(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception{
         return extractAuditRecordMapper.countAuditTotal(state, type, years, startTime, endTime);
    }
    @Override
    public List<Map<String, Object>> countExtractApplyMoney(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception{
        return extractAuditRecordMapper.countExtractMoney(state, type, years, startTime, endTime);
    }
    @Override
    public List<Map<String, Object>> countExtractApplyNumber(Integer state, Integer type, String years, String startTime,
            String endTime) throws Exception{
        return extractAuditRecordMapper.countExtractApplyNumber(state, type, years, startTime, endTime);
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/ExtractRecordServiceImpl.java
New file
@@ -0,0 +1,74 @@
package org.fanli.service.user.service.impl.money;
import java.math.BigDecimal;
import java.util.List;
import javax.annotation.Resource;
import org.fanli.facade.system.service.common.ConfigService;
import org.fanli.facade.user.entity.money.extract.Extract;
import org.fanli.facade.user.entity.money.extract.ExtractRecord;
import org.fanli.facade.user.exception.AdminLimitException;
import org.fanli.facade.user.service.money.ExtractRecordService;
import org.fanli.service.user.dao.money.ExtractRecordMapper;
import org.springframework.stereotype.Service;
import org.yeshi.utils.MoneyBigDecimalUtil;
import com.yeshi.fanli.base.entity.user.UserInfo;
@Service
public class ExtractRecordServiceImpl implements ExtractRecordService {
    @Resource
    private ExtractRecordMapper extractRecordMapper;
    @Resource
    private ConfigService configService;
    public void setExtractRecord(Extract extract) throws AdminLimitException {
        long uid = extract.getUserInfo().getId();
        BigDecimal money = extract.getMoney();
        List<ExtractRecord> extractRecordList = extractRecordMapper.selectByUid(uid);
        if (extractRecordList.size() == 0) {
            ExtractRecord er = new ExtractRecord();
            er.setCount(1);
            er.setMoney(money);
            er.setUserInfo(new UserInfo(uid));
            extractRecordMapper.insertSelective(er);
        } else {
            ExtractRecord er = extractRecordList.get(0);
            int count = er.getCount();
            String maxCount = configService.get("extract_count_day");
            int maxCountInt = Integer.parseInt(maxCount);
            if (count >= maxCountInt) {
                throw new AdminLimitException("超出每日最大提现次数!");
            }
            BigDecimal oldMoney = er.getMoney();
            BigDecimal sumMoney = MoneyBigDecimalUtil.add(money, oldMoney);
            String maxMoney = configService.get("extract_money_day");
            BigDecimal maxMoneyDou = new BigDecimal(maxMoney);
            if (maxMoneyDou.compareTo(sumMoney) == -1) {
                BigDecimal exceedMoney = MoneyBigDecimalUtil.sub(sumMoney, maxMoneyDou);
                throw new AdminLimitException("超出每日最大提现金额!超出金额为:" + exceedMoney + "元");
            }
            er.setCount(count + 1);
            er.setMoney(sumMoney);
            extractRecordMapper.updateByPrimaryKeySelective(er);
        }
    }
    // 定时删除ExtractRecord记录
    public void deleteExtractRecord() {
        extractRecordMapper.deleteAll();
    }
    @Override
    public ExtractRecord getExtractRecordByUid(Long uid) {
        List<ExtractRecord> extractRecordList = extractRecordMapper.selectByUid(uid);
        if (extractRecordList == null || extractRecordList.size() == 0)
            return null;
        else
            return extractRecordList.get(0);
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/ExtractServiceImpl.java
New file
@@ -0,0 +1,659 @@
package org.fanli.service.user.service.impl.money;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.annotation.Resource;
import org.fanli.facade.system.service.common.ConfigService;
import org.fanli.facade.system.service.common.SystemConfigService;
import org.fanli.facade.user.dto.HongBao;
import org.fanli.facade.user.dto.money.AlipayTransferResultInfo;
import org.fanli.facade.user.entity.money.UserMoneyDetail;
import org.fanli.facade.user.entity.money.extract.Extract;
import org.fanli.facade.user.entity.money.extract.ExtractAuditRecord;
import org.fanli.facade.user.entity.money.extract.ExtractRecord;
import org.fanli.facade.user.entity.money.extract.PayInfo;
import org.fanli.facade.user.exception.money.ExtractException;
import org.fanli.facade.user.exception.money.UserMoneyDetailException;
import org.fanli.facade.user.service.account.UserInfoService;
import org.fanli.facade.user.service.money.ExtractRecordService;
import org.fanli.facade.user.service.money.ExtractService;
import org.fanli.facade.user.service.money.msg.UserMoneyMsgNotificationService;
import org.fanli.facade.user.util.ExtractCMQManager;
import org.fanli.facade.user.util.factory.UserMoneyDetailFactory;
import org.fanli.service.user.dao.account.UserInfoMapper;
import org.fanli.service.user.dao.money.AlipayAccountValidNormalHistoryMapper;
import org.fanli.service.user.dao.money.ExtractAuditRecordMapper;
import org.fanli.service.user.dao.money.ExtractMapper;
import org.fanli.service.user.dao.money.ExtractRecordMapper;
import org.fanli.service.user.dao.money.PayInfoMapper;
import org.fanli.service.user.dao.money.UserMoneyDetailMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.GsonUtil;
import org.yeshi.utils.MoneyBigDecimalUtil;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
import com.google.gson.Gson;
import com.yeshi.fanli.base.Constant;
import com.yeshi.fanli.base.entity.admin.AdminUser;
import com.yeshi.fanli.base.entity.user.UserInfo;
import com.yeshi.fanli.base.exception.NotExistObjectException;
import com.yeshi.fanli.base.exception.ObjectStateException;
import com.yeshi.fanli.base.log.LogHelper;
import net.sf.json.JSONObject;
@Service
public class ExtractServiceImpl implements ExtractService {
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private ConfigService configService;
    @Resource
    private ExtractRecordService extractRecordService;
    @Resource
    private SystemConfigService systemConfigService;
    @Resource
    private ExtractMapper extractMapper;
    @Resource
    private ExtractAuditRecordMapper extractAuditRecordMapper;
    @Resource
    private UserInfoMapper userInfoMapper;
    @Resource
    private PayInfoMapper payInfoMapper;
    @Resource
    private ExtractRecordMapper extractRecordMapper;
    @Resource
    private UserMoneyDetailMapper userMoneyDetailMapper;
    @Resource
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    @Resource
    private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
    public List<Extract> getExtractInfoByUid(long uid) {
        List<Integer> stateList = new ArrayList<>();
        stateList.add(Extract.STATE_NOT_PROCESS);
        stateList.add(Extract.STATE_PASS);
        stateList.add(Extract.STATE_PROCESSING);
        return extractMapper.listByUidAndState(uid, stateList);
    }
    @Transactional
    public Integer addExtract(Extract extract) {
        Integer integer = extract(extract);
        return integer;
    }
    public List<Extract> getExtractList(int index) {
        int start = index * Constant.PAGE_SIZE;
        return extractMapper.listAll(start, Constant.PAGE_SIZE);
    }
    public int getCount() {
        Long lcount = extractMapper.countAll();
        return lcount.intValue();
    }
    @Transactional
    public Integer passExtract(final long id, AdminUser admin) {
        Extract find = extractMapper.selectByPrimaryKeyForUpdate(id);
        if (find == null)
            return Constant.NOT_EXIST_OBJACT;
        if (find.getState() != Extract.STATE_NOT_PROCESS) {
            return Constant.OBJECT_STATE_EXCEPTION;
        }
        // 更改提现状态为处理中
        Extract updateExtract = new Extract();
        updateExtract.setId(id);
        updateExtract.setState(Extract.STATE_PROCESSING);
        extractMapper.updateByPrimaryKeySelective(updateExtract);
        transfer(find, admin); // 提现通过,支付宝转账
        return null;
    }
    @Transactional
    public synchronized void rejectExtract(long id, String reason, long extractTime, AdminUser admin)
            throws ObjectStateException, NotExistObjectException {
        Extract find = extractMapper.selectByPrimaryKey(id);
        if (find == null) {
            throw new NotExistObjectException("不存在该对象");
        }
        if (find.getState() != Constant.EXTRACT_DEFUALT) {
            throw new ObjectStateException("该状态不等于不为初始状态");
        }
        UserInfo user = find.getUserInfo();
        userInfoMapper.addHongBaoByUid(user.getId(), find.getMoney());
        // 更新原来的状态
        Extract updateExtract = new Extract();
        updateExtract.setId(id);
        updateExtract.setState(Constant.EXTRACT_REJECT);
        updateExtract.setReason(reason);
        extractMapper.updateByPrimaryKeySelective(updateExtract);
        long auditTime = java.lang.System.currentTimeMillis();
        // 更新审核记录
        ExtractAuditRecord auditRecord = new ExtractAuditRecord();
        List<ExtractAuditRecord> records = extractAuditRecordMapper.getbyExtractId(id);
        if (records != null && records.size() > 0) {
            auditRecord = records.get(0);
        }
        // 角色默认:客服
        auditRecord.setAuditRole("客服");
        // 审核人
        auditRecord.setAdminUser(admin);
        // 提现之后金额 不变
        auditRecord.setAfterMoney(auditRecord.getBeforeMoney());
        // 审核时间
        auditRecord.setAuditTime(auditTime);
        // 历史提现金额
        Long uid = user.getId();
        double countSuccessMoneys = extractMapper.countSuccessMoneysByUid(uid);
        auditRecord.setCountMoney(new BigDecimal(countSuccessMoneys));
        // 历史提现次数
        long countSuccess = extractMapper.countSuccessByUid(uid);
        auditRecord.setCountNum(countSuccess);
        // 更新提现记录审核表
        extractAuditRecordMapper.updateByPrimaryKeySelective(auditRecord);
        // 新版资金详情
        try {
            UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractReject(find);
            userMoneyDetailMapper.insertSelective(userMoneyDetail);
        } catch (UserMoneyDetailException e2) {
            try {
                LogHelper.errorDetailInfo(e2);
            } catch (Exception e3) {
                e3.printStackTrace();
            }
        }
        // try {
        // userNotificationService.extractWrong(user.getId(), find,
        // TimeUtil.getGernalTime(find.getExtractTime(), "yyyy-MM-dd HH:mm"));
        // } catch (Exception e) {
        // e.printStackTrace();
        // }
        // 新版通知
        userMoneyMsgNotificationService.extractFail(find, reason);
    }
    /**
     * 提现申请
     *
     * @param extract
     * @return
     */
    @Transactional
    private Integer extract(Extract extract) {
        final String autoExtract = configService.get("extract_way"); // 是否自动转账
        final String maxCount = configService.get("extract_count_day");
        final String maxMoney = configService.get("extract_money_day");
        UserInfo user = userInfoMapper.selectByPrimaryKeyForUpdate(extract.getUserInfo().getId());
        // 余额不足
        if (user.getMyHongBao().compareTo(extract.getMoney()) < 0) {
            return 3;
        }
        Integer type = setExtractRecord(extract, maxCount, maxMoney);
        if (type != 0) {
            return type;
        }
        extractMapper.insertSelective(extract);
        ExtractAuditRecord auditRecord = new ExtractAuditRecord();
        auditRecord.setBeforeMoney(user.getMyHongBao());
        auditRecord.setExtract(extract);
        extractAuditRecordMapper.insertSelective(auditRecord);
        // 减去账户资金
        userInfoMapper.subHongBaoByUid(extract.getUserInfo().getId(), extract.getMoney());
        // 新版资金详情
        try {
            UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtract(extract);
            userMoneyDetailMapper.insertSelective(userMoneyDetail);
        } catch (UserMoneyDetailException e2) {
            try {
                LogHelper.errorDetailInfo(e2);
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
        // userNotificationService.extractApply(extract.getUserInfo().getId());
        // 添加新版通知
        userMoneyMsgNotificationService.extractApplay(extract);
        if ("是".equals(autoExtract)) {
            LogHelper.userInfo("uid=" + user.getId() + ",提交转账申请!");
        } else {// 暂时不自动提现
            transfer(extract, null);
        }
        return null;
    }
    /**
     * 转账
     *
     * @param extract
     * @param session
     */
    @Transactional
    private void transfer(Extract extract, AdminUser adminUser) {
        Integer type = extract.getType();
        if (Constant.ZHIFUBAO == type) {
            extractByZhiFuBao(extract, adminUser);
        } else {
            LogHelper.userInfo("提现类型错误:" + type);
        }
    }
    /**
     * 增加提现记录
     *
     * @param extract
     * @param maxCount
     *            最多提现次数
     * @param maxMoney
     *            最大提现金额
     * @param session
     * @return 如果为0,则增加成功。为1,则超过每日最多提现次数。为2,则超过每日最多提现金额
     */
    @Transactional
    public Integer setExtractRecord(Extract extract, String maxCount, String maxMoney) {
        long uid = extract.getUserInfo().getId();
        BigDecimal money = extract.getMoney();
        List<ExtractRecord> extractRecordList = extractRecordMapper.selectByUidAndToday(uid);
        if (extractRecordList.size() == 0) {
            ExtractRecord er = new ExtractRecord();
            er.setCount(1);
            er.setMoney(money);
            er.setUserInfo(new UserInfo(uid));
            er.setCreateTime(java.lang.System.currentTimeMillis());
            extractRecordMapper.insertSelective(er);
        } else {
            ExtractRecord er = extractRecordList.get(0);
            int count = er.getCount();
            int maxCountInt = Integer.parseInt(maxCount);
            if (count >= maxCountInt) {
                return 1;
            }
            BigDecimal oldMoney = er.getMoney();
            BigDecimal sumMoney = MoneyBigDecimalUtil.add(money, oldMoney);
            BigDecimal maxMoneyDou = new BigDecimal(maxMoney);
            if (maxMoneyDou.compareTo(sumMoney) == -1) {
                return 2;
            }
            ExtractRecord updateER = new ExtractRecord();
            updateER.setId(er.getId());
            updateER.setCount(count + 1);
            updateER.setMoney(sumMoney);
            er.setCreateTime(java.lang.System.currentTimeMillis());
            extractRecordMapper.updateByPrimaryKeySelective(updateER);
        }
        return 0;
    }
    /**
     * 提现到支付宝
     *
     * @param extract
     * @param session
     */
    @Transactional
    private void extractByZhiFuBao(Extract extract, AdminUser adminUser) {
        String privateKey = Constant.alipayConfig.getPrivateKey();
        AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",
                Constant.alipayConfig.getAppId(), privateKey, "json", "gbk", null, "RSA2");
        AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String appName = systemConfigService.get("appName", extract.getSystem());
        JSONObject json = new JSONObject();
        json.put("out_biz_no", uuid);
        json.put("payee_type", "ALIPAY_LOGONID");
        json.put("payee_account", extract.getAccount());
        json.put("amount", extract.getMoney());
        json.put("payer_show_name", appName + "提现");
        json.put("payee_real_name", extract.getName());
        json.put("remark", "来自" + appName + "的提现");
        request.setBizContent(json.toString());
        AlipayFundTransToaccountTransferResponse response = null;
        try {
            response = alipayClient.execute(request);
        } catch (AlipayApiException e) {
            e.printStackTrace();
            LogHelper.userErrorInfo("支付宝提现异常:" + response + ",提现信息" + GsonUtil.toJson(extract));
        }
        try {
            ExtractCMQManager.getInstance().addExtractResultMsg(extract, response, adminUser);
        } catch (Exception e) {
            LogHelper.userErrorInfo("支付宝提现CMQ异常:" + new Gson().toJson(response) + ",提现信息" + GsonUtil.toJson(extract));
        }
    }
    /**
     * 提现失败
     *
     * @param extract
     * @param msg
     * @param session
     */
    @Transactional
    private void extractFail(Extract extract, String msg) {
        UserInfo user = extract.getUserInfo();
        // MoneyRecord moneyRecord = new MoneyRecord(user, null, extract
        // .getMoney(), "提现", "提现失败", new Date().getTime(), 3);
        if ("付款方余额不足".equals(msg)) {
            Extract updateExtract = new Extract();
            updateExtract.setId(extract.getId());
            updateExtract.setState(Constant.EXTRACT_DEFUALT);
            updateExtract.setReason(msg);
            extractMapper.updateByPrimaryKeySelective(updateExtract);
        } else {
            // 老版本功能
            // List<MoneyRecord> list = moneyRecordDao.list("from MoneyRecord mr
            // where mr.extract.id =" + extract.getId());
            // if (list.size() > 0) {
            // MoneyRecord moneyRecord = list.get(0);
            // moneyRecordMapper.deleteByPrimaryKey(moneyRecord.getId());
            // }
            Extract updateExtract = new Extract();
            updateExtract.setId(extract.getId());
            updateExtract.setState(Constant.EXTRACT_REJECT);
            updateExtract.setReason(msg);
            extractMapper.updateByPrimaryKeySelective(updateExtract);
            userInfoMapper.addHongBaoByUid(user.getId(), extract.getMoney());
            // 新版资金详情
            try {
                UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractReject(extract);
                userMoneyDetailMapper.insertSelective(userMoneyDetail);
            } catch (UserMoneyDetailException e2) {
                try {
                    LogHelper.errorDetailInfo(e2);
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
            try {
                // userNotificationService.extractTransferFail(user.getId(),
                // TimeUtil.getGernalTime(extract.getExtractTime(), "yyyy-MM-dd
                // HH:mm"));
                LogHelper.userInfo("支付宝转账失败:[提现IP:" + extract.getIp() + ",所转账号:" + extract.getAccount() + ",真实姓名:"
                        + extract.getName() + ",所转金额:" + extract.getMoney() + ",失败原因" + extract.getReason() + "]");
            } catch (Exception e) {
                e.printStackTrace();
            }
            // 新版提现
            userMoneyMsgNotificationService.extractFail(extract, null);
        }
    }
    /**
     * 提现成功
     *
     * @param extract
     * @param session
     */
    @Transactional
    private void extractSuccess(Extract extract) {
        // 老版本功能
        // List<MoneyRecord> list = moneyRecordDao.list("from MoneyRecord mr
        // where mr.extract.id = " + extract.getId());
        // MoneyRecord moneyRecord = list.get(0);
        // moneyRecord.setType(3);
        // MoneyRecord updateMoneyRecord = new MoneyRecord();
        // updateMoneyRecord.setId(moneyRecord.getId());
        // updateMoneyRecord.setType(3);
        // moneyRecordMapper.updateByPrimaryKeySelective(updateMoneyRecord);
        Extract updateExtract = new Extract();
        updateExtract.setId(extract.getId());
        updateExtract.setState(Constant.EXTRACT_PASS);
        updateExtract.setReceiveTime(new Date());
        updateExtract.setReason("提现成功");
        extractMapper.updateByPrimaryKeySelective(updateExtract);
        // try {
        // userNotificationService.extractSuccess(extract.getUserInfo().getId(),
        // extract,
        // TimeUtil.getGernalTime(extract.getExtractTime(), "yyyy-MM-dd
        // HH:mm"));
        //
        // LogHelper.userInfo("支付宝转账成功:[提现IP:" + extract.getIp() + ",所转账号:" +
        // extract.getAccount() + ",真实姓名:"
        // + extract.getName() + ",所转金额:" + extract.getMoney() + "]");
        // } catch (Exception e) {
        // e.printStackTrace();
        // }
        // 新版通知
        userMoneyMsgNotificationService.extractSuccess(extract);
    }
    /**
     * 根据提现记录id获取用户uid
     */
    @Override
    public Extract getExtractById(long id) {
        return extractMapper.selectByPrimaryKey(id);
    }
    @Override
    public void checkExtract(String uid) throws ExtractException {
        Long count = hongBaoV2Mapper.countByUidAndState(Long.parseLong(uid), HongBao.STATE_YILINGQU);
        if (count == null || count == 0)
            throw new ExtractException(1, "没有已到账的红包");
        List<Integer> list = extractMapper.checkExtract(uid);
        if (list != null && list.size() > 0 && list.get(0) == 0)
            throw new ExtractException(2, "结算资金异常");
    }
    @Override
    public Extract selectByPrimaryKey(Long id) {
        return extractMapper.selectByPrimaryKey(id);
    }
    @Override
    public Extract getMyTaskInfo(Long adminId) {
        return extractMapper.getMyTaskInfo(adminId);
    }
    @Override
    public Extract getNewTaskInfo() {
        return extractMapper.getNewTaskInfo();
    }
    @Override
    public List<Map<String, Object>> getFinishRecord(int pageIndex, int pageSize, String key, String startTime,
            String endTime) {
        return extractMapper.getFinishRecord((pageIndex - 1) * pageSize, pageSize, key, startTime, endTime);
    }
    @Override
    public int updateByPrimaryKeySelective(Extract record) {
        return extractMapper.updateByPrimaryKeySelective(record);
    }
    @Transactional
    @Override
    public void processExtractResult(AlipayTransferResultInfo info) {
        if (info == null)
            return;
        AlipayFundTransToaccountTransferResponse response = info.getAlipayFundTransToaccountTransferResponse();
        Extract extract = info.getExtract();
        AdminUser admin = info.getAdminUser();
        if (response == null)
            return;
        if (extract == null)
            return;
        extract = extractMapper.selectByPrimaryKey(info.getExtract().getId());
        LogHelper.test("提现结果:code-" + response.getCode() + " 信息:" + response.getMsg());
        long uid = extract.getUserInfo().getId();
        if (response.isSuccess()) {
            String code = response.getCode();
            if ("10000".equals(code)) {
                extractSuccess(extract);
            } else {
                extractFail(extract, response.getSubMsg());
            }
        } else {
            extractFail(extract, response.getSubMsg());
        }
        PayInfo payInfo = new PayInfo();
        payInfo.setBizno(response.getOutBizNo());
        payInfo.setCreatetime(new Date());
        payInfo.setExtract(extract);
        if ("10000".equals(response.getCode())) {
            payInfo.setState(1);
        } else {
            payInfo.setState(2);
        }
        payInfo.setOrderId(response.getOrderId());
        payInfo.setOrdertime(response.getPayDate());
        payInfo.setInfo(response.getSubMsg());
        payInfoMapper.insertSelective(payInfo);
        // 更新审核记录
        ExtractAuditRecord auditRecord = null;
        List<ExtractAuditRecord> records = extractAuditRecordMapper.getbyExtractId(extract.getId());
        if (records != null && records.size() > 0) {
            auditRecord = records.get(0);
        }
        if (auditRecord != null) {
            // 提现付款记录
            List<PayInfo> paylist = payInfoMapper.getListbyExtractId(extract.getId());
            if (paylist != null && paylist.size() > 0) {
                // 提现成功 : 提现之前总金额:提现时金额减去提现金额
                BigDecimal exceedMoney = MoneyBigDecimalUtil.sub(auditRecord.getBeforeMoney(), extract.getMoney());
                // 提现之后金额
                auditRecord.setAfterMoney(exceedMoney);
            } else {
                // 提现失败:付款方余额不足、账户信息错误 提现之后金额 不变
                auditRecord.setAfterMoney(auditRecord.getBeforeMoney());
            }
            // 历史提现金额
            double countSuccessMoneys = extractMapper.countSuccessMoneysByUid(uid);
            auditRecord.setCountMoney(new BigDecimal(countSuccessMoneys));
            // 历史提现次数
            long countSuccess = extractMapper.countSuccessByUid(uid);
            auditRecord.setCountNum(countSuccess);
            // 角色默认:客服
            auditRecord.setAuditRole("客服");
            // 审核人
            auditRecord.setAdminUser(admin);
            // 审核时间
            auditRecord.setAuditTime(java.lang.System.currentTimeMillis());
            // 更新提现记录审核表
            extractAuditRecordMapper.updateByPrimaryKeySelective(auditRecord);
        }
    }
    @Transactional
    @Override
    public void testExtractSuccess(Long id) {
        Extract extract = extractMapper.selectByPrimaryKey(id);
        extractSuccess(extract);
        Long uid = extract.getUserInfo().getId();
        // 更新审核记录
        ExtractAuditRecord auditRecord = null;
        List<ExtractAuditRecord> records = extractAuditRecordMapper.getbyExtractId(extract.getId());
        if (records != null && records.size() > 0) {
            auditRecord = records.get(0);
        }
        if (auditRecord != null) {
            // 提现付款记录
            List<PayInfo> paylist = payInfoMapper.getListbyExtractId(extract.getId());
            if (paylist != null && paylist.size() > 0) {
                // 提现成功 : 提现之前总金额:提现时金额减去提现金额
                BigDecimal exceedMoney = MoneyBigDecimalUtil.sub(auditRecord.getBeforeMoney(), extract.getMoney());
                // 提现之后金额
                auditRecord.setAfterMoney(exceedMoney);
            } else {
                // 提现失败:付款方余额不足、账户信息错误 提现之后金额 不变
                auditRecord.setAfterMoney(auditRecord.getBeforeMoney());
            }
            // 历史提现金额
            double countSuccessMoneys = extractMapper.countSuccessMoneysByUid(uid);
            auditRecord.setCountMoney(new BigDecimal(countSuccessMoneys));
            // 历史提现次数
            long countSuccess = extractMapper.countSuccessByUid(uid);
            auditRecord.setCountNum(countSuccess);
            // 角色默认:客服
            auditRecord.setAuditRole("客服");
            // 审核人
            auditRecord.setAdminUser(new AdminUser(3L));
            // 审核时间
            auditRecord.setAuditTime(java.lang.System.currentTimeMillis());
            // 更新提现记录审核表
            extractAuditRecordMapper.updateByPrimaryKeySelective(auditRecord);
        }
    }
    @Override
    public double countTodayMoney(Long uid) {
        return extractMapper.countTodayMoney(uid);
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/PayInfoServiceImpl.java
New file
@@ -0,0 +1,20 @@
package org.fanli.service.user.service.impl.money;
import javax.annotation.Resource;
import org.fanli.facade.user.entity.money.extract.PayInfo;
import org.fanli.facade.user.service.money.PayInfoService;
import org.fanli.service.user.dao.money.PayInfoMapper;
import org.springframework.stereotype.Service;
@Service
public class PayInfoServiceImpl implements PayInfoService {
    @Resource
    private PayInfoMapper payInfoMapper;
    public void save(PayInfo payInfo) {
        payInfoMapper.insertSelective(payInfo);
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/UserMoneyDetailServiceImpl.java
New file
@@ -0,0 +1,201 @@
package org.fanli.service.user.service.impl.money;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import javax.annotation.Resource;
import org.fanli.facade.user.entity.money.UserMoneyDetail;
import org.fanli.facade.user.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
import org.fanli.facade.user.service.money.UserMoneyDetailService;
import org.fanli.facade.user.vo.UserMoneyDetailHistoryVO;
import org.fanli.facade.user.vo.UserMonthMoneyVO;
import org.fanli.service.user.dao.money.UserMoneyDetailMapper;
import org.springframework.stereotype.Service;
import org.yeshi.utils.TimeUtil;
@Service
public class UserMoneyDetailServiceImpl implements UserMoneyDetailService {
    @Resource
    private UserMoneyDetailMapper userMoneyDetailMapper;
    @Override
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Date maxTime) {
        List<UserMoneyDetailHistoryVO> finalList = new ArrayList<>();
        List<UserMoneyDetail> list = null;
        if (userMoneyDetailId == null) {// 首次请求
            if (maxTime == null)// 没有筛选时间
            {
                list = userMoneyDetailMapper.selectByMaxCreateTime(uid,
                        new Date(System.currentTimeMillis() + 1000 * 60 * 60L), 20);
            } else {// 筛选了时间
                list = userMoneyDetailMapper.selectByMaxCreateTime(uid, maxTime, 20);
            }
            if (list != null && list.size() > 0) {
                Calendar calendar = Calendar.getInstance();
                calendar.setTimeInMillis(list.get(0).getCreateTime().getTime());
                UserMoneyDetailHistoryVO vo = new UserMoneyDetailHistoryVO();
                vo.setMonth(new UserMonthMoneyVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1));
                finalList.add(vo);
            } else {
                if (maxTime != null) {//
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(maxTime.getTime());
                    UserMoneyDetailHistoryVO vo = new UserMoneyDetailHistoryVO();
                    vo.setMonth(new UserMonthMoneyVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1));
                    vo.getMonth().setExpend("0");
                    vo.getMonth().setIncome("0");
                    finalList.add(vo);
                }
            }
        } else {// 二次请求
            int size = 21;
            List<UserMoneyDetail> tempList = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size);
            Set<Date> dateSet = new HashSet<>();// 用于储存是否在同一时间上面(精确到秒)
            if (tempList.size() > 0) {
                for (UserMoneyDetail umd : tempList) {
                    dateSet.add(umd.getCreateTime());
                }
                List<UserMoneyDetail> tempList2 = new ArrayList<>();
                while (dateSet.size() == 1 && tempList2.size() != tempList.size() && size < 40) {// 只有一个时间点的数据
                    tempList = tempList2;
                    size += 10;
                    tempList2 = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size);
                    dateSet.clear();
                    for (UserMoneyDetail umd : tempList2) {
                        dateSet.add(umd.getCreateTime());
                    }
                }
                if (tempList2.size() > 0)
                    tempList = tempList2;
            }
            for (int i = 0; i < tempList.size(); i++) {
                if (tempList.get(i).getId().longValue() == userMoneyDetailId) {
                    tempList.remove(i);
                    break;
                } else {
                    tempList.remove(i);
                    i--;
                }
            }
            list = tempList;
        }
        if (list != null) {
            if (userMoneyDetailId != null && list.size() > 0) {
                UserMoneyDetail umd = userMoneyDetailMapper.selectByPrimaryKey(userMoneyDetailId);
                if (!TimeUtil.getGernalTime(umd.getCreateTime().getTime(), "yyyy-MM")
                        .equalsIgnoreCase(TimeUtil.getGernalTime(list.get(0).getCreateTime().getTime(), "yyyy-MM"))) {
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(list.get(0).getCreateTime().getTime());
                    UserMoneyDetailHistoryVO vo = new UserMoneyDetailHistoryVO();
                    vo.setMonth(new UserMonthMoneyVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1));
                    finalList.add(vo);
                }
            }
            for (int i = 0; i < list.size(); i++) {
                if (i > 0 && !TimeUtil.getGernalTime(list.get(i - 1).getCreateTime().getTime(), "yyyy-MM")
                        .equalsIgnoreCase(TimeUtil.getGernalTime(list.get(i).getCreateTime().getTime(), "yyyy-MM"))) {// 本条数据与上条数据不是同一月则插入月份
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(list.get(i).getCreateTime().getTime());
                    UserMoneyDetailHistoryVO vo = new UserMoneyDetailHistoryVO();
                    vo.setMonth(new UserMonthMoneyVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1));
                    finalList.add(vo);
                }
                UserMoneyDetailHistoryVO vo = new UserMoneyDetailHistoryVO();
                vo.setDetail(list.get(i));
                finalList.add(vo);
            }
        }
        // 统计月资金
        Map<Integer, UserMoneyDetailHistoryVO> monthMap = new TreeMap<>();
        if (finalList.size() > 1)
            for (int i = 0; i < finalList.size(); i++) {
                if (finalList.get(i).getMonth() != null)
                    monthMap.put(i, finalList.get(i));
            }
        if (!monthMap.isEmpty()) {
            List<String> dateFormat = new ArrayList<>();
            Iterator<Integer> keys = monthMap.keySet().iterator();
            while (keys.hasNext()) {
                Integer key = keys.next();
                String date = "";
                date += monthMap.get(key).getMonth().getYear();
                date += "-";
                date += (monthMap.get(key).getMonth().getMonth() + "").length() < 2
                        ? "0" + monthMap.get(key).getMonth().getMonth() : monthMap.get(key).getMonth().getMonth();
                dateFormat.add(date);
            }
            List<UserMonthMoneyVO> voList = userMoneyDetailMapper.selectMonthMoneyByUid(uid, dateFormat);
            int p = 0;
            keys = monthMap.keySet().iterator();
            while (keys.hasNext()) {
                Integer key = keys.next();
                // 去除支出负号
                finalList.get(key).getMonth().setExpend(voList.get(p).getExpend().replace("-", ""));
                finalList.get(key).getMonth().setIncome(voList.get(p).getIncome());
                p++;
            }
        }
        return finalList;
    }
    @Override
    public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Date maxTime) {
        long monthCount = 0L;
        long detailCount = 0L;
        // 未通过时间筛选,查询所有
        if (maxTime == null) {
            detailCount = userMoneyDetailMapper.selectCountByUid(uid);
            // 用于表示当前所有
            monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid,
                    new Date(System.currentTimeMillis() + 1000 * 60 * 60L));
        } else {// 通过时间筛选了的,需要查询所有
            detailCount = userMoneyDetailMapper.selectCountByUidAndMaxCreateTime(uid, maxTime);
            monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid, maxTime);
        }
        return monthCount + detailCount;
    }
    @Override
    public List<UserMoneyDetail> listByUidWithState(Long uid, int page, int pageSize) {
        return userMoneyDetailMapper.selectByUidWithState(uid, (page - 1) * pageSize, pageSize);
    }
    @Override
    public long countByUidWithState(Long uid) {
        return userMoneyDetailMapper.selectCountByUidWithState(uid);
    }
    @Override
    public BigDecimal statisticUserTypeMoneyWithDate(Long uid, List<UserMoneyDetailTypeEnum> typeList, Date minDate,
            Date maxDate) {
        List<String> list = new ArrayList<>();
        if (typeList != null)
            for (UserMoneyDetailTypeEnum type : typeList) {
                list.add(type.name());
            }
        BigDecimal money = userMoneyDetailMapper.getTotalMoneyByTypeAndUidWithDate(uid, list, minDate, maxDate);
        return money == null ? new BigDecimal(0) : money;
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/msg/MsgMoneyDetailServiceImpl.java
New file
@@ -0,0 +1,116 @@
package org.fanli.service.user.service.impl.money.msg;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.fanli.facade.system.service.msg.UserMsgReadStateService;
import org.fanli.facade.user.entity.money.msg.MsgMoneyDetail;
import org.fanli.facade.user.entity.money.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
import org.fanli.facade.user.exception.money.MsgMoneyDetailException;
import org.fanli.facade.user.service.money.MsgMoneyDetailService;
import org.fanli.service.user.dao.money.msg.MsgMoneyDetailMapper;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.base.Constant;
@Service
public class MsgMoneyDetailServiceImpl implements MsgMoneyDetailService {
    @Resource
    private MsgMoneyDetailMapper msgMoneyDetailMapper;
    @Resource
    private UserMsgReadStateService userMsgReadStateService;
    @Override
    public void addMsgMoneyDetail(MsgMoneyDetail detail) throws MsgMoneyDetailException {
        if (detail == null)
            throw new MsgMoneyDetailException(1, "消息为空");
        if (detail.getMsgType() == MsgTypeMoneyTypeEnum.extract) {
            if (detail.getExtract() == null || detail.getUser() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            MsgMoneyDetail msg = msgMoneyDetailMapper.selectBySourceIdAndMsgType(detail.getExtract().getId(),
                    MsgTypeMoneyTypeEnum.extract);
            if (msg == null) {
                detail.setCreateTime(new Date());
                detail.setUpdateTime(new Date());
                detail.setRead(false);
                msgMoneyDetailMapper.insertSelective(detail);
            } else {
                MsgMoneyDetail update = new MsgMoneyDetail();
                update.setId(msg.getId());
                update.setUpdateTime(new Date());
                update.setRead(false);
                update.setStateDesc(detail.getStateDesc());
                msgMoneyDetailMapper.updateByPrimaryKeySelective(update);
            }
        } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.extractValid) {
            if (detail.getAlipayAccountValid() == null || detail.getUser() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            MsgMoneyDetail msg = msgMoneyDetailMapper.selectBySourceIdAndMsgType(detail.getAlipayAccountValid().getId(),
                    MsgTypeMoneyTypeEnum.extractValid);
            if (msg == null) {
                detail.setCreateTime(new Date());
                detail.setUpdateTime(new Date());
                detail.setRead(false);
                msgMoneyDetailMapper.insertSelective(detail);
            } else {
                MsgMoneyDetail update = new MsgMoneyDetail();
                update.setId(msg.getId());
                update.setUpdateTime(new Date());
                update.setRead(false);
                update.setStateDesc(detail.getStateDesc());
                msgMoneyDetailMapper.updateByPrimaryKeySelective(update);
            }
        } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.fanli) {
            if (detail.getMoney() == null || detail.getGoodsCount() == null || detail.getOrderId() == null
                    || detail.getBalance() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            detail.setCreateTime(new Date());
            detail.setUpdateTime(new Date());
            detail.setRead(false);
            msgMoneyDetailMapper.insertSelective(detail);
        } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.invite
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.share) {
            if (detail.getMoney() == null || detail.getGoodsCount() == null || detail.getOrderCount() == null
                    || detail.getBalance() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            detail.setCreateTime(new Date());
            detail.setUpdateTime(new Date());
            detail.setRead(false);
            msgMoneyDetailMapper.insertSelective(detail);
        } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.fanliWeiQuan
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.inviteWeiQuan
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.shareWeiQuan) {
            if (detail.getMoney() == null || detail.getOrderId() == null || detail.getBalance() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            detail.setCreateTime(new Date());
            detail.setUpdateTime(new Date());
            detail.setRead(false);
            msgMoneyDetailMapper.insertSelective(detail);
        }
        userMsgReadStateService.addMoneyMsgUnReadCount(detail.getUser().getId(), 1);
    }
    @Override
    public List<MsgMoneyDetail> listMsgMoneyDetail(Long uid, int page) {
        return msgMoneyDetailMapper.listByUid(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
    }
    @Override
    public long countMsgMoneyDetail(Long uid) {
        return msgMoneyDetailMapper.countByUid(uid);
    }
    @Override
    public void readMsgByUid(Long uid) {
        msgMoneyDetailMapper.setMsgReadByUid(uid);
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/money/msg/UserMoneyMsgNotificationServiceImpl.java
New file
@@ -0,0 +1,133 @@
package org.fanli.service.user.service.impl.money.msg;
import java.math.BigDecimal;
import javax.annotation.Resource;
import org.fanli.facade.user.entity.money.extract.AlipayAccountValidNormalHistory;
import org.fanli.facade.user.entity.money.extract.Extract;
import org.fanli.facade.user.entity.money.msg.MsgMoneyDetail;
import org.fanli.facade.user.exception.money.MsgMoneyDetailException;
import org.fanli.facade.user.service.money.MsgMoneyDetailService;
import org.fanli.facade.user.service.money.msg.UserMoneyMsgNotificationService;
import org.fanli.facade.user.util.factory.MsgMoneyDetailFactory;
import org.springframework.stereotype.Service;
@Service
public class UserMoneyMsgNotificationServiceImpl implements UserMoneyMsgNotificationService {
    @Resource
    private MsgMoneyDetailService msgMoneyDetailService;
    @Override
    public void extractApplay(Extract extract) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractApplyMsg(extract, extract.getUserInfo().getId(),
                null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void extractFail(Extract extract, String stateDesc) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractFailMsg(extract, extract.getUserInfo().getId(),
                stateDesc);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void extractSuccess(Extract extract) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractSuccessMsg(extract, extract.getUserInfo().getId(),
                null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void alipayAccountValid(AlipayAccountValidNormalHistory history) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createAlipayAccountValidMsg(history, history.getUid(),
                "重庆椰视网络有限公司", new BigDecimal("0.1"), null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void fanliOrderReceived(Long uid, String orderId, int goodsCount, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createFailiMsg(money, balance, orderId, goodsCount, uid, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void fanliOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createFailiWeiQuanMsg(uid, orderId, money, balance, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void shareOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createShareMsg(money, balance, orderCount, goodsCount, uid, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void shareOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createShareWeiQuanMsg(uid, orderId, money, balance, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void inviteOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteMsg(money, balance, orderCount, goodsCount, uid,
                null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void inviteOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteWeiQuanMsg(uid, orderId, money, balance, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
}