admin
2019-02-22 e358583d644fa39fc1e93b14b3cafff3644980e4
用户服务修改
3 文件已重命名
2个文件已修改
30个文件已添加
2625 ■■■■■ 已修改文件
fanli-facade-system/src/main/java/org/fanli/facade/system/entity/common/SMSHistory.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-system/src/main/java/org/fanli/facade/system/exception/SMSException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-system/src/main/java/org/fanli/facade/system/service/common/SMSService.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-system/src/main/java/org/fanli/facade/system/util/TencentSMSUtil.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/UserInfoExtra.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/user/UserActiveLog.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/user/UserCustomSettings.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/user/UserRank.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/user/UserRankings.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/account/UserCustomSettingsException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/account/user/UserActiveLogService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/account/user/UserCustomSettingsService.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/account/user/UserRankService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/service/account/user/UserRankingsService.java 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/util/typehandler/UserSettingTypeEnumHandler.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/main/java/org/fanli/facade/user/vo/UserSettingsVO.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-system/src/main/java/com/yeshi/fanli/system/dao/common/SMSHistoryMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-system/src/main/java/com/yeshi/fanli/system/mapping/common/SMSHistoryMapper.xml 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-system/src/main/java/com/yeshi/fanli/system/service/impl/common/SMSServiceImpl.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-system/src/main/java/com/yeshi/fanli/system/utils/SMSRedisManager.java 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/user/UserActiveLogMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/user/UserCustomSettingsMapper.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/user/UserRankMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/user/UserRankRecordMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/user/UserRankingsMapper.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/user/UserActiveLogMapper.xml 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/user/UserCustomSettingsMapper.xml 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/user/UserRankMapper.xml 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/user/UserRankRecordMapper.xml 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/user/UserRankingsMapper.xml 330 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/UserAccountServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/user/UserActiveLogServiceImpl.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/user/UserCustomSettingsServiceImpl.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/user/UserRankServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/user/UserRankingsServiceImpl.java 475 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-system/src/main/java/org/fanli/facade/system/entity/common/SMSHistory.java
New file
@@ -0,0 +1,73 @@
package org.fanli.facade.system.entity.common;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 短信验证码发送历史记录
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_sms_history")
public class SMSHistory {
    public final static int TYPE_LOGIN = 1;// 登录
    public final static int TYPE_BIND = 2;// 绑定
    public final static int TYPE_EXTRACT = 3;// 提现
    @Column(name = "sh_id")
    private Long id;
    @Column(name = "sh_type")
    private Integer type;
    @Column(name = "sh_phone")
    private String phone;
    @Column(name = "sh_content")
    private String content;
    @Column(name = "sh_createtime")
    private Date createTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
fanli-facade-system/src/main/java/org/fanli/facade/system/exception/SMSException.java
New file
@@ -0,0 +1,32 @@
package org.fanli.facade.system.exception;
public class SMSException 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 SMSException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public SMSException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli-facade-system/src/main/java/org/fanli/facade/system/service/common/SMSService.java
New file
@@ -0,0 +1,54 @@
package org.fanli.facade.system.service.common;
import java.math.BigDecimal;
import org.fanli.facade.system.exception.SMSException;
/**
 * 短信服务
 *
 * @author Administrator
 *
 */
public interface SMSService {
    /**
     * 发送登录验证码
     *
     * @param phone
     * @throws SMSException
     */
    public String sendLoginVCode(String phone) throws SMSException;
    /**
     * 发送绑定验证码
     *
     * @param phone
     * @throws SMSException
     */
    public void sendBindVCode(String phone) throws SMSException;
    /**
     * 发送提现验证码
     *
     * @param phone
     * @throws SMSException
     */
    public void sendExtractVCode(String phone) throws SMSException;
    /**
     * 提现成功短信
     *
     * @param phone
     * @param money
     */
    public void sendExtractSuccessMsg(String phone, BigDecimal money) throws SMSException;
    /**
     * 发送提现失败验证码
     *
     * @param phone
     * @param money
     */
    public void sendExtractFailMsg(String phone, BigDecimal money) throws SMSException;
}
fanli-facade-system/src/main/java/org/fanli/facade/system/util/TencentSMSUtil.java
New file
@@ -0,0 +1,46 @@
package org.fanli.facade.system.util;
import java.io.IOException;
import org.fanli.facade.system.exception.SMSException;
import org.json.JSONException;
import com.github.qcloudsms.SmsSingleSender;
import com.github.qcloudsms.SmsSingleSenderResult;
import com.github.qcloudsms.httpclient.HTTPException;
import com.yeshi.fanli.base.Constant;
//腾讯短信发送
public class TencentSMSUtil {
    /**
     * 发送单一短信
     *
     * @param phone
     * @param msg
     */
    public static void sendSingleMsg(String phone, String msg) throws SMSException {
        SmsSingleSender ssender = new SmsSingleSender(Integer.parseInt(Constant.smsConfig.getSmsAppId()),
                Constant.smsConfig.getSmsAppKey());
        SmsSingleSenderResult result = null;
        try {
            result = ssender.send(0, "86", phone, msg, "", "");
        } catch (JSONException e) {
            e.printStackTrace();
        } catch (HTTPException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (result == null)
            throw new SMSException(2, "短信发送失败");
        if (result.result == 1025) {
            throw new SMSException(result.result, "今日验证码发送超限,请明日再试");
        } else if (result.result != 0) {// 发送失败
            throw new SMSException(result.result, "短信发送失败");
        }
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/UserInfoExtra.java
@@ -2,6 +2,7 @@
import java.util.Date;
import org.fanli.facade.user.entity.account.user.UserRank;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/user/UserActiveLog.java
File was renamed from fanli-facade-user/src/main/java/org/fanli/facade/user/entity/UserActiveLog.java
@@ -1,4 +1,4 @@
package org.fanli.facade.user.entity;
package org.fanli.facade.user.entity.account.user;
import java.util.Date;
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/user/UserCustomSettings.java
New file
@@ -0,0 +1,105 @@
package org.fanli.facade.user.entity.account.user;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.base.entity.user.UserInfo;
/**
 * 用户app界面个性化设置
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_custom_settings")
public class UserCustomSettings {
    // 消息类型的枚举
    public enum UserSettingTypeEnum {
        cancelNotice("通知免打扰(20:00-8:00)"), noNewsRedDot("不看消息红点提醒"), noBonusCount("不看奖金统计"),
        noShareRecordAndStorage("不看分享记录和选品库"),noInvitationBonus("不看邀请拿奖金");
        private final String desc;
        private UserSettingTypeEnum(String desc) {
            this.desc = desc;
        }
        public String getDesc() {
            return desc;
        }
    }
    @Column(name = "ucs_id")
    private Long id;
    // 用户id
    @Column(name = "ucs_uid")
    private UserInfo userInfo;
    // 类型
    @Column(name = "ucs_type")
    private UserSettingTypeEnum type;
    // 状态: 默认0  1选中
    @Column(name = "ucs_state")
    private Integer state;
    // 创建时间
    @Column(name = "ucs_create_time")
    private Date createTime;
    // 更新时间
    @Column(name = "ucs_update_time")
    private Date updateTime;
    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 UserSettingTypeEnum getType() {
        return type;
    }
    public void setType(UserSettingTypeEnum type) {
        this.type = type;
    }
    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;
    }
    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/user/UserRank.java
File was renamed from fanli-facade-user/src/main/java/org/fanli/facade/user/entity/UserRank.java
@@ -1,4 +1,4 @@
package org.fanli.facade.user.entity;
package org.fanli.facade.user.entity.account.user;
import java.util.Date;
fanli-facade-user/src/main/java/org/fanli/facade/user/entity/account/user/UserRankings.java
File was renamed from fanli-facade-user/src/main/java/org/fanli/facade/user/entity/UserRankings.java
@@ -1,4 +1,4 @@
package org.fanli.facade.user.entity;
package org.fanli.facade.user.entity.account.user;
import java.math.BigDecimal;
import java.util.Date;
@@ -22,7 +22,7 @@
@Table(name = "yeshi_ec_rankings_record")
@org.yeshi.utils.mybatis.Table("yeshi_ec_rankings_record")
public class UserRankings {
    @Id
    @Column(name = "r_id")
fanli-facade-user/src/main/java/org/fanli/facade/user/exception/account/UserCustomSettingsException.java
New file
@@ -0,0 +1,32 @@
package org.fanli.facade.user.exception.account;
public class UserCustomSettingsException 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 UserCustomSettingsException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public UserCustomSettingsException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/account/user/UserActiveLogService.java
New file
@@ -0,0 +1,27 @@
package org.fanli.facade.user.service.account.user;
import org.fanli.facade.user.entity.account.user.UserActiveLog;
/**
 * 用户活跃日志服务
 *
 * @author Administrator
 *
 */
public interface UserActiveLogService {
    /**
     * 用户活跃日志
     *
     * @param userActiveLog
     */
    public void addUserActiveLog(UserActiveLog userActiveLog);
    /**
     * 获取某个用户的最近一次的活跃信息
     *
     * @param uid
     * @return
     */
    public UserActiveLog getUserLatestActiveInfo(Long uid);
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/account/user/UserCustomSettingsService.java
New file
@@ -0,0 +1,60 @@
package org.fanli.facade.user.service.account.user;
import java.util.List;
import org.fanli.facade.user.entity.account.user.UserCustomSettings;
import org.fanli.facade.user.exception.account.UserCustomSettingsException;
import org.fanli.facade.user.vo.UserSettingsVO;
public interface UserCustomSettingsService {
    /**
     *  更新各项设置状态
     * @param uid
     * @param typeNum
     * @param state
     * @throws UserCustomSettingsException
     */
    public void saveModuleState(Long uid, String type, Integer state) throws UserCustomSettingsException;
    /**
     *  获取我的所有自定义设置
     * @param uid
     * @return
     */
    public List<UserCustomSettings> getSettingsByUid(Long uid) throws UserCustomSettingsException;
    /**
     *  获取设置信息
     * @param uid 用户id
     * @param type 类型
     * @return
     */
    public UserCustomSettings getSettingsByUidAndType(Long uid, String type) throws UserCustomSettingsException;
    /**
     * 设置列表
     * @param uid
     * @return
     * @throws UserCustomSettingsException
     */
    public UserSettingsVO getMySettings(Long uid) throws UserCustomSettingsException;
    /**
     * 推送时判断是否设置免打扰推送
     * @param uid
     * @return
     */
    public boolean validateCancelNoticeByUid(Long uid);
    /**
     * 查询设置免打扰用户
     * @return
     */
    public List<Long> getCancelNoticeUsers();
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/account/user/UserRankService.java
New file
@@ -0,0 +1,15 @@
package org.fanli.facade.user.service.account.user;
import java.util.List;
import org.fanli.facade.user.entity.account.user.UserRank;
public interface UserRankService {
    /**
     * 获取所有等级
     * @return
     */
    public List<UserRank> getAllRank();
}
fanli-facade-user/src/main/java/org/fanli/facade/user/service/account/user/UserRankingsService.java
New file
@@ -0,0 +1,180 @@
package org.fanli.facade.user.service.account.user;
import java.io.File;
import java.util.List;
import org.fanli.facade.user.entity.account.user.UserRankings;
import org.fanli.facade.user.entity.invite.InviteGetMoney;
import org.fanli.facade.user.exception.UserRankingsException;
import org.springframework.web.multipart.MultipartFile;
public interface UserRankingsService {
    /**
     * 插入对象
     *
     * @param record
     * @return
     * @throws UserRankingsException
     */
    public int insertSelective(UserRankings record) throws UserRankingsException;
    /**
     * 更新当前对象所有数据
     *
     * @param record
     * @return
     * @throws UserRankingsException
     */
    public int updateByPrimaryKey(UserRankings record) throws UserRankingsException;
    /**
     * 选择性更新内容——不为空则更新该字段
     *
     * @param record
     * @return
     * @throws UserRankingsException
     */
    public int updateByPrimaryKeySelective(UserRankings record) throws UserRankingsException;
    /**
     * 根据id查找当前对象
     *
     * @param id
     * @return
     * @throws UserRankingsException
     */
    public UserRankings selectByPrimaryKey(Long id) throws UserRankingsException;
    /**
     * 根据id删除
     *
     * @param ids
     */
    public int deleteBatchById(Long id) throws UserRankingsException;
    /**
     * 根据id批量删除
     * @param arrayID
     * @return
     * @throws UserRankingsException
     */
    public int deleteBatchByPrimaryKey(List<Long> arrayID) throws UserRankingsException;
    /**
     * 上传图片
     *
     * @param file
     * @param admin
     * @return
     * @throws UserRankingsException
     */
    public void uploadPicture(MultipartFile file, UserRankings UserRankings) throws Exception;
    /**
     * 保存信息并上传图片文件
     * @param record
     * @return
     * @throws UserRankingsException
     */
    public void insertAndUploadFile(UserRankings record, MultipartFile file) throws Exception;
    /**
     *  根据昵称查询
     * @param nickName
     * @return
     * @throws UserRankingsException
     */
    public List<UserRankings> selectByNickName(String nickName) throws UserRankingsException;
    /**
     *  根据显示ID查询
     * @param nickName
     * @return
     * @throws UserRankingsException
     */
    public List<UserRankings> selectByShowId(String showId) throws UserRankingsException;
    /**
     * 查询所有列表
     * @param pageIndex
     * @param pageSize
     * @param key
     * @param sort
     * @return
     * @throws UserRankingsException
     */
    public List<UserRankings> query(long start, int count, String key, Integer tradeState, Integer shareState, Integer sort) throws UserRankingsException;
    public long queryCount(String key, Integer tradeState, Integer shareState) throws UserRankingsException;
    /**
     * 删除图片
     * @param userRankings
     * @throws Exception
     */
    public void removePicture(UserRankings userRankings) throws Exception;
    /**
     * 批量设置奖金
     * @param idList
     * @param type 1自购奖金  2 分享奖金
     * @param reward
     * @param startReward
     * @param endReward
     * @throws Exception
     */
    public void setRewardtBatch(List<Long> idList, Integer type, Double reward, Double startReward, Double endReward) throws Exception;
    /**
     * 批量修改状态
     * @param idList
     * @param type
     * @param state
     * @throws Exception
     */
    public void setStateBatch(List<Long> idList, Integer type, Integer state) throws Exception;
    public void uploadFile(File file) throws Exception;
    public void updateShowID(File file) throws Exception;
    public void batchUpNickName(File file) throws Exception;
    /**
     * 根据id集合查询对应数据
     * @param ids
     * @return
     * @throws UserRankingsException
     */
    public List<UserRankings> listQueryByIds(List<Long> ids) throws UserRankingsException;
    /**
     * 批量选择更新
     * @param list
     * @return
     * @throws UserRankingsException
     */
    public int updateBatchSelective(List<UserRankings> list) throws UserRankingsException;
    /**
     * 前端排行榜
     * @param start
     * @param count
     * @return
     */
    public List<InviteGetMoney> getRank(long start, int count);
    /**
     *
     * @throws UserRankingsException
     */
    public void updateClearTradeState() throws UserRankingsException;
}
fanli-facade-user/src/main/java/org/fanli/facade/user/util/typehandler/UserSettingTypeEnumHandler.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.account.user.UserCustomSettings.UserSettingTypeEnum;
public class UserSettingTypeEnumHandler extends BaseTypeHandler<UserSettingTypeEnum> {
    @Override
    public UserSettingTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return UserSettingTypeEnum.valueOf(key);
        }
    }
    @Override
    public UserSettingTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return UserSettingTypeEnum.valueOf(key);
        }
    }
    @Override
    public UserSettingTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return UserSettingTypeEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, UserSettingTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}
fanli-facade-user/src/main/java/org/fanli/facade/user/vo/UserSettingsVO.java
New file
@@ -0,0 +1,60 @@
package org.fanli.facade.user.vo;
import java.io.Serializable;
public class UserSettingsVO implements Serializable{
    private static final long serialVersionUID = 1L;
    // 通知免打扰(20:00-8:00)
    private Integer cancelNotice;
    // 不看消息红点提醒
    private Integer noNewsRedDot;
    // 不看奖金统计
    private Integer noBonusCount;
    // 不看分享记录和选品库
    private Integer noShareRecordAndStorage;
    // 不看邀请拿奖金
    private Integer noInvitationBonus;
    public Integer getCancelNotice() {
        return cancelNotice;
    }
    public void setCancelNotice(Integer cancelNotice) {
        this.cancelNotice = cancelNotice;
    }
    public Integer getNoNewsRedDot() {
        return noNewsRedDot;
    }
    public void setNoNewsRedDot(Integer noNewsRedDot) {
        this.noNewsRedDot = noNewsRedDot;
    }
    public Integer getNoBonusCount() {
        return noBonusCount;
    }
    public void setNoBonusCount(Integer noBonusCount) {
        this.noBonusCount = noBonusCount;
    }
    public Integer getNoShareRecordAndStorage() {
        return noShareRecordAndStorage;
    }
    public void setNoShareRecordAndStorage(Integer noShareRecordAndStorage) {
        this.noShareRecordAndStorage = noShareRecordAndStorage;
    }
    public Integer getNoInvitationBonus() {
        return noInvitationBonus;
    }
    public void setNoInvitationBonus(Integer noInvitationBonus) {
        this.noInvitationBonus = noInvitationBonus;
    }
}
fanli-service-system/src/main/java/com/yeshi/fanli/system/dao/common/SMSHistoryMapper.java
New file
@@ -0,0 +1,18 @@
package com.yeshi.fanli.system.dao.common;
import org.fanli.facade.system.entity.common.SMSHistory;
public interface SMSHistoryMapper {
    int deleteByPrimaryKey(Long id);
    int insert(SMSHistory record);
    int insertSelective(SMSHistory record);
    SMSHistory selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(SMSHistory record);
    int updateByPrimaryKey(SMSHistory record);
}
fanli-service-system/src/main/java/com/yeshi/fanli/system/mapping/common/SMSHistoryMapper.xml
New file
@@ -0,0 +1,62 @@
<?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="com.yeshi.fanli.system.dao.common.SMSHistoryMapper">
    <resultMap id="BaseResultMap" type="org.fanli.facade.system.entity.common.SMSHistory">
        <id column="sh_id" property="id" jdbcType="BIGINT" />
        <result column="sh_type" property="type" jdbcType="INTEGER" />
        <result column="sh_phone" property="phone" jdbcType="VARCHAR" />
        <result column="sh_content" property="content" jdbcType="VARCHAR" />
        <result column="sh_createtime" property="createTime" jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">sh_id,sh_type,sh_phone,sh_content,sh_createtime</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_sms_history where sh_id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_sms_history where sh_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="org.fanli.facade.system.entity.common.SMSHistory"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_sms_history
        (sh_id,sh_type,sh_phone,sh_content,sh_createtime) values
        (#{id,jdbcType=BIGINT},#{type,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="org.fanli.facade.system.entity.common.SMSHistory"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_sms_history
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">sh_id,</if>
            <if test="type != null">sh_type,</if>
            <if test="phone != null">sh_phone,</if>
            <if test="content != null">sh_content,</if>
            <if test="createTime != null">sh_createtime,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=INTEGER},</if>
            <if test="phone != null">#{phone,jdbcType=VARCHAR},</if>
            <if test="content != null">#{content,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="org.fanli.facade.system.entity.common.SMSHistory">update
        yeshi_ec_sms_history set sh_type = #{type,jdbcType=INTEGER},sh_phone =
        #{phone,jdbcType=VARCHAR},sh_content =
        #{content,jdbcType=VARCHAR},sh_createtime =
        #{createTime,jdbcType=TIMESTAMP} where sh_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="org.fanli.facade.system.entity.common.SMSHistory">
        update yeshi_ec_sms_history
        <set>
            <if test="type != null">sh_type=#{type,jdbcType=INTEGER},</if>
            <if test="phone != null">sh_phone=#{phone,jdbcType=VARCHAR},</if>
            <if test="content != null">sh_content=#{content,jdbcType=VARCHAR},</if>
            <if test="createTime != null">sh_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
        </set>
        where sh_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli-service-system/src/main/java/com/yeshi/fanli/system/service/impl/common/SMSServiceImpl.java
New file
@@ -0,0 +1,108 @@
package com.yeshi.fanli.system.service.impl.common;
import java.math.BigDecimal;
import java.util.Date;
import javax.annotation.Resource;
import org.fanli.facade.system.entity.common.SMSHistory;
import org.fanli.facade.system.exception.SMSException;
import org.fanli.facade.system.service.common.SMSService;
import org.fanli.facade.system.util.TencentSMSUtil;
import org.springframework.stereotype.Service;
import org.yeshi.utils.StringUtil;
import com.yeshi.fanli.base.Constant;
import com.yeshi.fanli.system.dao.common.SMSHistoryMapper;
import com.yeshi.fanli.system.utils.SMSRedisManager;
@Service
public class SMSServiceImpl implements SMSService {
    @Resource
    private SMSHistoryMapper smsHistoryMapper;
    @Resource
    private SMSRedisManager redisManager;
    private String getVerifyCode(int count) {
        String sts = "0123456789";
        String code = "";
        for (int i = 0; i < count; i++) {
            int p = (int) (Math.random() * 10);
            code += sts.charAt(p);
        }
        return code;
    }
    @Override
    public String sendLoginVCode(String phone) throws SMSException {
        boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
        if (limit)
            throw new SMSException(1001, "请过60秒再试");
        String msgCode = getVerifyCode(6);
        System.out.println(msgCode);
        // 验证码模板
        String msg = Constant.smsConfig.getSmsLogin().replace("[签名]", Constant.smsConfig.getSmsSign()).replace("[验证码]",
                msgCode);
        // 发送短信
        TencentSMSUtil.sendSingleMsg(phone, msg);
        // 缓存
        redisManager.sendSms(phone, SMSHistory.TYPE_LOGIN);
        redisManager.saveSMSVCode(phone, SMSHistory.TYPE_LOGIN, msgCode);
        SMSHistory smsHistory = new SMSHistory();
        smsHistory.setContent(msg);
        smsHistory.setCreateTime(new Date());
        smsHistory.setPhone(phone);
        smsHistory.setType(SMSHistory.TYPE_LOGIN);
        smsHistoryMapper.insertSelective(smsHistory);
        return msgCode;
    }
    @Override
    public void sendBindVCode(String phone) throws SMSException {
        boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_BIND);
        if (limit)
            throw new SMSException(1001, "请过60秒再试");
        String msgCode = StringUtil.getRandomCode(6);
        String msg = Constant.smsConfig.getSmsBind().replace("[签名]", Constant.smsConfig.getSmsSign()).replace("[验证码]",
                msgCode);
        // 发送短信
        TencentSMSUtil.sendSingleMsg(phone, msg);
        // 缓存
        redisManager.sendSms(phone, SMSHistory.TYPE_BIND);
        redisManager.saveSMSVCode(phone, SMSHistory.TYPE_BIND, msgCode);
    }
    @Override
    public void sendExtractVCode(String phone) throws SMSException {
        boolean limit = redisManager.isSmsFrequencyLimit(phone, SMSHistory.TYPE_EXTRACT);
        if (limit)
            throw new SMSException(1001, "请过60秒再试");
        String msgCode = StringUtil.getRandomCode(6);
        String msg = Constant.smsConfig.getSmsExtract().replace("[签名]", Constant.smsConfig.getSmsSign())
                .replace("[验证码]", msgCode);
        // 发送短信
        TencentSMSUtil.sendSingleMsg(phone, msg);
        // 缓存
        redisManager.sendSms(phone, SMSHistory.TYPE_EXTRACT);
        redisManager.saveSMSVCode(phone, SMSHistory.TYPE_EXTRACT, msgCode);
    }
    @Override
    public void sendExtractSuccessMsg(String phone, BigDecimal money) throws SMSException {
        String msg = Constant.smsConfig.getSmsExtractSuccess().replace("[签名]", Constant.smsConfig.getSmsSign())
                .replace("[金额]", money.toString());
        // 发送短信
        TencentSMSUtil.sendSingleMsg(phone, msg);
    }
    @Override
    public void sendExtractFailMsg(String phone, BigDecimal money) throws SMSException {
        String msg = Constant.smsConfig.getSmsExtractFail().replace("[签名]", Constant.smsConfig.getSmsSign())
                .replace("[金额]", money.toString());
        // 发送短信
        TencentSMSUtil.sendSingleMsg(phone, msg);
    }
}
fanli-service-system/src/main/java/com/yeshi/fanli/system/utils/SMSRedisManager.java
New file
@@ -0,0 +1,180 @@
package com.yeshi.fanli.system.utils;
import javax.annotation.Resource;
import org.fanli.facade.system.service.common.ConfigService;
import org.springframework.stereotype.Component;
import org.yeshi.utils.StringUtil;
import com.yeshi.fanli.base.Constant;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
//抢红包采用的redis
@Component
public class SMSRedisManager {
    @Resource
    private JedisPool jedisPool;
    @Resource
    private ConfigService configService;
    /**
     * 缓存字符串
     *
     * @param key
     * @param value
     */
    private void setString(String key, String value) {
        Jedis jedis = jedisPool.getResource();
        try {
            jedis.set(key, value);
        } finally {
            jedisPool.returnResource(jedis);
        }
    }
    /**
     * 删除某个键值
     *
     * @param key
     * @param value
     */
    private void removeKey(String key) {
        Jedis jedis = jedisPool.getResource();
        try {
            jedis.del(key);
        } finally {
            jedisPool.returnResource(jedis);
        }
    }
    /**
     * 缓存字符串
     *
     * @param key
     * @param value
     * @param seconds
     *            -缓存时间(s)
     */
    private void setString(String key, String value, int seconds) {
        Jedis jedis = jedisPool.getResource();
        try {
            jedis.setex(key, seconds, value);
        } finally {
            jedisPool.returnResource(jedis);
        }
    }
    private String getString(String key) {
        Jedis jedis = jedisPool.getResource();
        try {
            return jedis.get(key);
        } finally {
            jedisPool.returnResource(jedis);
        }
    }
    public void cacheCommonString(String key, String value, int seconds) {
        setString(key, value, seconds);
    }
    public void cacheCommonString(String key, String value) {
        setString(key, value);
    }
    public String getCommonString(String key) {
        return getString(key);
    }
    public void removeCommonString(String key) {
        removeKey(key);
    }
    /**
     * 是否限制发送短信
     *
     * @param phone
     * @param type
     * @return
     */
    public boolean isSmsFrequencyLimit(String phone, int type) {
        if (!Constant.IS_OUTNET)
            return false;
        String key = "sms-" + phone + "-" + type;
        String value = getCommonString(key);
        if (StringUtil.isNullOrEmpty(value))
            return false;
        else
            return true;
    }
    /**
     * 设置短信60s倒计时
     *
     * @param phone
     * @param type
     */
    public void sendSms(String phone, int type) {
        if (!Constant.IS_OUTNET)
            return;
        String key = "sms-" + phone + "-" + type;
        setString(key, "1", 10);
    }
    public void clearSMSFrequencyLimit(String phone, int type) {
        if (!Constant.IS_OUTNET)
            return;
        String key = "sms-" + phone + "-" + type;
        removeKey(key);
    }
    /**
     * 保存验证码
     *
     * @param phone
     * @param type
     * @param code
     */
    public void saveSMSVCode(String phone, int type, String code) {
        if (!Constant.IS_OUTNET)
            return;
        String key = "smscode-" + phone + "-" + type;
        // 保存2分钟
        setString(key, code, 120);
    }
    /**
     *
     * @param phone
     * @param type
     * @return
     */
    public String getSMSVCode(String phone, int type) {
        if (!Constant.IS_OUTNET)
            return "";
        String key = "smscode-" + phone + "-" + type;
        // 保存2分钟
        return getString(key);
    }
    /**
     * 清除掉验证码
     *
     * @param phone
     * @param type
     * @param code
     */
    public void clearSMSVCode(String phone, int type) {
        if (!Constant.IS_OUTNET)
            return;
        String key = "smscode-" + phone + "-" + type;
        removeKey(key);
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/user/UserActiveLogMapper.java
New file
@@ -0,0 +1,20 @@
package org.fanli.service.user.dao.account.user;
import org.fanli.facade.user.entity.account.user.UserActiveLog;
public interface UserActiveLogMapper {
    int deleteByPrimaryKey(Long id);
    int insert(UserActiveLog record);
    int insertSelective(UserActiveLog record);
    UserActiveLog selectByPrimaryKey(Long id);
    UserActiveLog selectLatestByUid(Long uid);
    int updateByPrimaryKeySelective(UserActiveLog record);
    int updateByPrimaryKey(UserActiveLog record);
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/user/UserCustomSettingsMapper.java
New file
@@ -0,0 +1,31 @@
package org.fanli.service.user.dao.account.user;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.fanli.facade.user.entity.account.user.UserCustomSettings;
import com.yeshi.fanli.base.BaseMapper;
public interface UserCustomSettingsMapper extends BaseMapper<UserCustomSettings> {
    /**
     *  获取我的所有自定义设置
     * @param uid
     * @return
     */
    List<UserCustomSettings> getSettingsByUid(Long uid);
    /**
     *  获取设置信息
     * @param uid 用户id
     * @param type 类型
     * @return
     */
    UserCustomSettings getSettingsByUidAndType(@Param("uid")Long uid, @Param("type")String type);
    List<Long> getUserID(@Param("type")String type);
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/user/UserRankMapper.java
New file
@@ -0,0 +1,15 @@
package org.fanli.service.user.dao.account.user;
import java.util.List;
import org.fanli.facade.user.entity.account.user.UserRank;
import com.yeshi.fanli.base.BaseMapper;
public interface UserRankMapper extends BaseMapper<UserRank> {
    List<UserRank> getAllRank();
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/user/UserRankRecordMapper.java
New file
@@ -0,0 +1,10 @@
package org.fanli.service.user.dao.account.user;
import org.fanli.facade.user.entity.UserRankRecord;
import com.yeshi.fanli.base.BaseMapper;
public interface UserRankRecordMapper extends BaseMapper<UserRankRecord> {
}
fanli-service-user/src/main/java/org/fanli/service/user/dao/account/user/UserRankingsMapper.java
New file
@@ -0,0 +1,62 @@
package org.fanli.service.user.dao.account.user;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.fanli.facade.user.entity.account.user.UserRankings;
public interface UserRankingsMapper {
    int deleteByPrimaryKey(Long id);
    int insert(UserRankings record);
    int insertSelective(UserRankings record);
    UserRankings selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(UserRankings record);
    int updateByPrimaryKey(UserRankings record);
    /**
     * 批量插入
     * @param list
     * @return
     */
    int insertBatch(List<UserRankings> list);
    /**
     * 批量选择更新
     * @param list
     * @return
     */
    int updateBatchSelective(List<UserRankings> list);
    List<UserRankings> queryAll();
    /**
     * 清空自购榜状态以及金额
     */
    void updateClearTradeState();
    // 根据名称查询
    List<UserRankings> selectByNickName(String nickName);
    // 根据展示ID查询
    List<UserRankings> selectByShowId(String showId);
    // 查询列表
    List<UserRankings> query(@Param("start") long start, @Param("count") int count, @Param("key") String key,
             @Param("tradeState") Integer tradeState, @Param("shareState") Integer shareState, @Param("sort") Integer sort);
    // 查询列表统计
    long queryCount(@Param("key") String key,  @Param("tradeState") Integer tradeState, @Param("shareState") Integer shareState);
    // 奖金榜 随机id查询
    public List<UserRankings> listQueryByIds(List<Long> list);
}
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/user/UserActiveLogMapper.xml
New file
@@ -0,0 +1,103 @@
<?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.user.UserActiveLogMapper">
    <resultMap id="BaseResultMap"
        type="org.fanli.facade.user.entity.account.user.UserActiveLog">
        <id column="lua_id" property="id" jdbcType="BIGINT" />
        <result column="lua_uid" property="uid" jdbcType="BIGINT" />
        <result column="lua_ip" property="ip" jdbcType="VARCHAR" />
        <result column="lua_channel" property="channel" jdbcType="VARCHAR" />
        <result column="lua_version_code" property="versionCode"
            jdbcType="VARCHAR" />
        <result column="lua_createtime" property="createTime" jdbcType="TIMESTAMP" />
        <result column="lua_updatetime" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="lua_device_type" property="deviceType"
            jdbcType="VARCHAR" />
        <result column="lua_os_version" property="osVersion" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List">lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectLatestByUid" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id
        desc limit 1
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert"
        parameterType="org.fanli.facade.user.entity.account.user.UserActiveLog"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_log_user_active
        (lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version)
        values
        (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{ip,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{versionCode,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{deviceType,jdbcType=VARCHAR},#{osVersion,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective"
        parameterType="org.fanli.facade.user.entity.account.user.UserActiveLog"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_log_user_active
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">lua_id,</if>
            <if test="uid != null">lua_uid,</if>
            <if test="ip != null">lua_ip,</if>
            <if test="channel != null">lua_channel,</if>
            <if test="versionCode != null">lua_version_code,</if>
            <if test="createTime != null">lua_createtime,</if>
            <if test="updateTime != null">lua_updatetime,</if>
            <if test="deviceType != null">lua_device_type,</if>
            <if test="osVersion != null">lua_os_version,</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="ip != null">#{ip,jdbcType=VARCHAR},</if>
            <if test="channel != null">#{channel,jdbcType=VARCHAR},</if>
            <if test="versionCode != null">#{versionCode,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="deviceType != null">#{deviceType,jdbcType=VARCHAR},</if>
            <if test="osVersion != null">#{osVersion,jdbcType=VARCHAR}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
        parameterType="org.fanli.facade.user.entity.account.user.UserActiveLog">update
        yeshi_ec_log_user_active set lua_uid =
        #{uid,jdbcType=BIGINT},lua_ip =
        #{ip,jdbcType=VARCHAR},lua_channel =
        #{channel,jdbcType=VARCHAR},lua_version_code =
        #{versionCode,jdbcType=VARCHAR},lua_createtime =
        #{createTime,jdbcType=TIMESTAMP},lua_updatetime =
        #{updateTime,jdbcType=TIMESTAMP} ,lua_device_type
        =#{deviceType,jdbcType=VARCHAR} ,lua_os_version
        =#{osVersion,jdbcType=VARCHAR} where lua_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="org.fanli.facade.user.entity.account.user.UserActiveLog">
        update yeshi_ec_log_user_active
        <set>
            <if test="uid != null">lua_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="ip != null">lua_ip=#{ip,jdbcType=VARCHAR},</if>
            <if test="channel != null">lua_channel=#{channel,jdbcType=VARCHAR},</if>
            <if test="versionCode != null">lua_version_code=#{versionCode,jdbcType=VARCHAR},</if>
            <if test="createTime != null">lua_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">lua_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="id !=null">lua_id =#{id,jdbcType=BIGINT},</if>
            <if test="deviceType !=null">lua_device_type =#{deviceType,jdbcType=VARCHAR},</if>
            <if test="osVersion !=null">lua_os_version =#{osVersion,jdbcType=VARCHAR},</if>
        </set>
        where lua_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/user/UserCustomSettingsMapper.xml
New file
@@ -0,0 +1,102 @@
<?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.user.UserCustomSettingsMapper">
    <resultMap id="BaseResultMap"
        type="org.fanli.facade.user.entity.account.user.UserCustomSettings">
        <id column="ucs_id" property="id" jdbcType="BIGINT" />
        <result column="ucs_type" property="type"
            typeHandler="org.fanli.facade.user.util.typehandler.UserSettingTypeEnumHandler" />
        <result column="ucs_state" property="state" jdbcType="INTEGER" />
        <result column="ucs_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="ucs_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <association property="userInfo" column="ucs_uid"
            javaType="com.yeshi.fanli.base.entity.user.UserInfo">
            <id column="ucs_uid" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">ucs_id,ucs_uid,ucs_type,ucs_state,ucs_create_time,ucs_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_custom_settings where ucs_id =
        #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_user_custom_settings where ucs_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert"
        parameterType="org.fanli.facade.user.entity.account.user.UserCustomSettings"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_user_custom_settings
        (ucs_id,ucs_uid,ucs_type,ucs_state,ucs_create_time,ucs_update_time)
        values
        (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective"
        parameterType="org.fanli.facade.user.entity.account.user.UserCustomSettings"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_user_custom_settings
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">ucs_id,</if>
            <if test="userInfo != null">ucs_uid,</if>
            <if test="type != null">ucs_type,</if>
            <if test="state != null">ucs_state,</if>
            <if test="createTime != null">ucs_create_time,</if>
            <if test="updateTime != null">ucs_update_time,</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="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</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.account.user.UserCustomSettings">update yeshi_ec_user_custom_settings set ucs_uid =
        #{userInfo.id,jdbcType=BIGINT},ucs_type =
        #{type,jdbcType=VARCHAR},ucs_state =
        #{state,jdbcType=INTEGER},ucs_create_time =
        #{createTime,jdbcType=TIMESTAMP},ucs_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where ucs_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="org.fanli.facade.user.entity.account.user.UserCustomSettings">
        update yeshi_ec_user_custom_settings
        <set>
            <if test="userInfo != null">ucs_uid=#{userInfo.id,jdbcType=BIGINT},</if>
            <if test="type != null">ucs_type=#{type,jdbcType=VARCHAR},</if>
            <if test="state != null">ucs_state=#{state,jdbcType=INTEGER},</if>
            <if test="createTime != null">ucs_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">ucs_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where ucs_id = #{id,jdbcType=BIGINT}
    </update>
    <select id="getSettingsByUid" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        SELECT * FROM yeshi_ec_user_custom_settings
        WHERE ucs_uid = #{uid,jdbcType=BIGINT}
    </select>
    <select id="getSettingsByUidAndType" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_user_custom_settings
        WHERE ucs_uid = #{uid} AND ucs_type=#{type}
    </select>
    <select id="getUserID" resultType="java.lang.Long">
        SELECT ucs_uid FROM yeshi_ec_user_custom_settings
        WHERE ucs_state= 1 AND ucs_type=#{type}
    </select>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/user/UserRankMapper.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.account.user.UserRankMapper">
    <resultMap id="BaseResultMap"
        type="org.fanli.facade.user.entity.account.user.UserRank">
        <id column="ur_id" property="id" jdbcType="BIGINT" />
        <result column="ur_name" property="name" jdbcType="VARCHAR" />
        <result column="ur_picture" property="picture" jdbcType="VARCHAR" />
        <result column="ur_icon" property="icon" jdbcType="VARCHAR" />
        <result column="ur_rebate_num" property="rebateNum" jdbcType="INTEGER" />
        <result column="ur_share_num" property="shareNum" jdbcType="INTEGER" />
        <result column="ur_invite_num" property="inviteNum" jdbcType="INTEGER" />
        <result column="ur_orderby" property="orderby" jdbcType="INTEGER" />
        <result column="ur_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="ur_update_time" property="updateTime" jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">ur_id,ur_name,ur_picture,ur_icon,ur_rebate_num,ur_share_num,ur_invite_num,ur_orderby,ur_create_time,ur_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_rank where ur_id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_user_rank where ur_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="org.fanli.facade.user.entity.account.user.UserRank"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_rank
        (ur_id,ur_name,ur_picture,ur_icon,ur_rebate_num,ur_share_num,ur_invite_num,ur_orderby,ur_create_time,ur_update_time)
        values
        (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{rebateNum,jdbcType=INTEGER},#{shareNum,jdbcType=INTEGER},#{inviteNum,jdbcType=INTEGER},#{orderby,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="org.fanli.facade.user.entity.account.user.UserRank"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_user_rank
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">ur_id,</if>
            <if test="name != null">ur_name,</if>
            <if test="picture != null">ur_picture,</if>
            <if test="icon != null">ur_icon,</if>
            <if test="rebateNum != null">ur_rebate_num,</if>
            <if test="shareNum != null">ur_share_num,</if>
            <if test="inviteNum != null">ur_invite_num,</if>
            <if test="orderby != null">ur_orderby,</if>
            <if test="createTime != null">ur_create_time,</if>
            <if test="updateTime != null">ur_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="name != null">#{name,jdbcType=VARCHAR},</if>
            <if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
            <if test="icon != null">#{icon,jdbcType=VARCHAR},</if>
            <if test="rebateNum != null">#{rebateNum,jdbcType=INTEGER},</if>
            <if test="shareNum != null">#{shareNum,jdbcType=INTEGER},</if>
            <if test="inviteNum != null">#{inviteNum,jdbcType=INTEGER},</if>
            <if test="orderby != null">#{orderby,jdbcType=INTEGER},</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.account.user.UserRank">update
        yeshi_ec_user_rank set ur_name = #{name,jdbcType=VARCHAR},ur_picture =
        #{picture,jdbcType=VARCHAR},ur_icon =
        #{icon,jdbcType=VARCHAR},ur_rebate_num =
        #{rebateNum,jdbcType=INTEGER},ur_share_num =
        #{shareNum,jdbcType=INTEGER},ur_invite_num =
        #{inviteNum,jdbcType=INTEGER},ur_orderby =
        #{orderby,jdbcType=INTEGER},ur_create_time =
        #{createTime,jdbcType=TIMESTAMP},ur_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where ur_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="org.fanli.facade.user.entity.account.user.UserRank">
        update yeshi_ec_user_rank
        <set>
            <if test="name != null">ur_name=#{name,jdbcType=VARCHAR},</if>
            <if test="picture != null">ur_picture=#{picture,jdbcType=VARCHAR},</if>
            <if test="icon != null">ur_icon=#{icon,jdbcType=VARCHAR},</if>
            <if test="rebateNum != null">ur_rebate_num=#{rebateNum,jdbcType=INTEGER},</if>
            <if test="shareNum != null">ur_share_num=#{shareNum,jdbcType=INTEGER},</if>
            <if test="inviteNum != null">ur_invite_num=#{inviteNum,jdbcType=INTEGER},</if>
            <if test="orderby != null">ur_orderby=#{orderby,jdbcType=INTEGER},</if>
            <if test="createTime != null">ur_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">ur_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where ur_id = #{id,jdbcType=BIGINT}
    </update>
    <select id="getAllRank" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_rank ORDER BY ur_orderby
    </select>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/user/UserRankRecordMapper.xml
New file
@@ -0,0 +1,60 @@
<?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.user.UserRankRecordMapper">
    <resultMap id="BaseResultMap" type="org.fanli.facade.user.entity.UserRankRecord">
        <id column="urd_id" property="id" jdbcType="BIGINT" />
        <result column="urd_uid" property="uid" jdbcType="BIGINT" />
        <result column="urd_rank_id" property="rankId" jdbcType="BIGINT" />
        <result column="urd_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">urd_id,urd_uid,urd_rank_id,urd_create_time</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_rank_record where urd_id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_user_rank_record where urd_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserRankRecord"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_user_rank_record (urd_id,urd_uid,urd_rank_id,urd_create_time)
        values
        (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{rankId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserRankRecord"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_user_rank_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">urd_id,</if>
            <if test="uid != null">urd_uid,</if>
            <if test="rankId != null">urd_rank_id,</if>
            <if test="createTime != null">urd_create_time,</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="rankId != null">#{rankId,jdbcType=BIGINT},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserRankRecord">update
        yeshi_ec_user_rank_record set urd_uid =
        #{uid,jdbcType=BIGINT},urd_rank_id =
        #{rankId,jdbcType=BIGINT},urd_create_time =
        #{createTime,jdbcType=TIMESTAMP} where urd_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserRankRecord">
        update yeshi_ec_user_rank_record
        <set>
            <if test="uid != null">urd_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="rankId != null">urd_rank_id=#{rankId,jdbcType=BIGINT},</if>
            <if test="createTime != null">urd_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
        </set>
        where urd_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/mapper/account/user/UserRankingsMapper.xml
New file
@@ -0,0 +1,330 @@
<?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.user.UserRankingsMapper">
    <resultMap id="BaseResultMap" type="org.fanli.facade.user.entity.account.user.UserRankings">
        <id column="r_id" property="id" jdbcType="BIGINT" />
        <result column="r_show_id" property="showId" jdbcType="VARCHAR" />
        <result column="r_nick_name" property="nickName" jdbcType="VARCHAR" />
        <result column="r_portrait" property="portrait" jdbcType="VARCHAR" />
        <result column="r_trade_reward" property="tradeReward"
            jdbcType="DECIMAL" />
        <result column="r_share_reward" property="shareReward"
            jdbcType="DECIMAL" />
        <result column="r_trade_state" property="tradeState" jdbcType="INTEGER" />
        <result column="r_share_state" property="shareState" jdbcType="INTEGER" />
        <result column="r_trade_time" property="tradeTime" jdbcType="TIMESTAMP" />
        <result column="r_share_time" property="shareTime" jdbcType="TIMESTAMP" />
        <result column="r_createtime" property="createtime" jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">r_id,r_show_id,r_nick_name,r_portrait,r_trade_reward,r_share_reward,r_trade_state,r_share_state,r_trade_time,r_share_time,r_createtime
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_rankings_record where r_id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_rankings_record where r_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserRankings"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_rankings_record
        (r_id,r_show_id,r_nick_name,r_portrait,r_trade_reward,r_share_reward,r_trade_state,r_share_state,r_trade_time,r_share_time,r_createtime)
        values
        (#{id,jdbcType=BIGINT},#{showId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{tradeReward,jdbcType=DECIMAL},#{shareReward,jdbcType=DECIMAL},#{tradeState,jdbcType=INTEGER},#{shareState,jdbcType=INTEGER},#{tradeTime,jdbcType=TIMESTAMP},#{shareTime,jdbcType=TIMESTAMP},#{createtime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserRankings"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_rankings_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">r_id,</if>
            <if test="showId != null">r_show_id,</if>
            <if test="nickName != null">r_nick_name,</if>
            <if test="portrait != null">r_portrait,</if>
            <if test="tradeReward != null">r_trade_reward,</if>
            <if test="shareReward != null">r_share_reward,</if>
            <if test="tradeState != null">r_trade_state,</if>
            <if test="shareState != null">r_share_state,</if>
            <if test="tradeTime != null">r_trade_time,</if>
            <if test="shareTime != null">r_share_time,</if>
            <if test="createtime != null">r_createtime,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="showId != null">#{showId,jdbcType=VARCHAR},</if>
            <if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if>
            <if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if>
            <if test="tradeReward != null">#{tradeReward,jdbcType=DECIMAL},</if>
            <if test="shareReward != null">#{shareReward,jdbcType=DECIMAL},</if>
            <if test="tradeState != null">#{tradeState,jdbcType=INTEGER},</if>
            <if test="shareState != null">#{shareState,jdbcType=INTEGER},</if>
            <if test="tradeTime != null">#{tradeTime,jdbcType=TIMESTAMP},</if>
            <if test="shareTime != null">#{shareTime,jdbcType=TIMESTAMP},</if>
            <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserRankings">update
        yeshi_ec_rankings_record set r_show_id =
        #{showId,jdbcType=VARCHAR},r_nick_name =
        #{nickName,jdbcType=VARCHAR},r_portrait =
        #{portrait,jdbcType=VARCHAR},r_trade_reward =
        #{tradeReward,jdbcType=DECIMAL},r_share_reward =
        #{shareReward,jdbcType=DECIMAL},r_trade_state =
        #{tradeState,jdbcType=INTEGER},r_share_state =
        #{shareState,jdbcType=INTEGER},r_trade_time =
        #{tradeTime,jdbcType=TIMESTAMP},r_share_time =
        #{shareTime,jdbcType=TIMESTAMP},r_createtime =
        #{createtime,jdbcType=TIMESTAMP} where r_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserRankings">
        update yeshi_ec_rankings_record
        <set>
            <if test="showId != null">r_show_id=#{showId,jdbcType=VARCHAR},</if>
            <if test="nickName != null">r_nick_name=#{nickName,jdbcType=VARCHAR},</if>
            <if test="portrait != null">r_portrait=#{portrait,jdbcType=VARCHAR},</if>
            <if test="tradeReward != null">r_trade_reward=#{tradeReward,jdbcType=DECIMAL},</if>
            <if test="shareReward != null">r_share_reward=#{shareReward,jdbcType=DECIMAL},</if>
            <if test="tradeState != null">r_trade_state=#{tradeState,jdbcType=INTEGER},</if>
            <if test="shareState != null">r_share_state=#{shareState,jdbcType=INTEGER},</if>
            <if test="tradeTime != null">r_trade_time=#{tradeTime,jdbcType=TIMESTAMP},</if>
            <if test="shareTime != null">r_share_time=#{shareTime,jdbcType=TIMESTAMP},</if>
            <if test="createtime != null">r_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
        </set>
        where r_id = #{id,jdbcType=BIGINT}
    </update>
    <select id="selectByNickName" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_rankings_record where r_nick_name =
        #{nickName,jdbcType=VARCHAR}
    </select>
    <select id="selectByShowId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_rankings_record where r_show_id =
        #{showId,jdbcType=VARCHAR}
    </select>
    <update id="updateClearTradeState">
        update yeshi_ec_rankings_record
        <set>
            r_trade_reward = 0,
            r_trade_state = 0
        </set>
        WHERE r_trade_state = 1
    </update>
    <select id="query" resultMap="BaseResultMap">
        <!-- 根据条件查询所有标签 -->
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_rankings_record
        WHERE     <![CDATA[1>0]]>
        <if test='key != null and key != ""'>
            AND (r_show_id like '%#{key}%' OR r_nick_name like '%#{key}%')
        </if>
        <if test='tradeState != null and  tradeState == 1'>
            AND r_trade_state = #{tradeState}
        </if>
        <if test='shareState != null and shareState == 1'>
            AND r_share_state = #{shareState}
        </if>
        <if test='tradeState != null and  tradeState == 0'>
            AND (r_trade_state = #{tradeState} or r_trade_state is null)
        </if>
        <if test='shareState != null and shareState == 0'>
            AND (r_share_state = #{shareState} or r_share_state is null)
        </if>
        ORDER BY
        <if test='sort==1'>
            r_trade_reward,
        </if>
        <if test='sort==2'>
            r_trade_reward desc,
        </if>
        <if test='sort==3'>
            r_share_reward,
        </if>
        <if test='sort==4'>
            r_share_reward desc,
        </if>
        <if test='sort==5'>
            r_trade_time,
        </if>
        <if test='sort==6'>
            r_trade_time desc,
        </if>
        <if test='sort==7'>
            r_share_time,
        </if>
        <if test='sort==8'>
            r_share_time desc,
        </if>
        r_createtime LIMIT ${start},${count}
    </select>
    <select id="queryCount" resultType="java.lang.Long">
        <!-- 根据条件查询所有标签 -->
        SELECT count(r_id) FROM yeshi_ec_rankings_record
        WHERE     <![CDATA[1>0]]>
        <if test='key != null and key != ""'>
            AND (r_show_id like '%#{key}%' OR r_nick_name like '%#{key}%')
        </if>
        <if test='tradeState != null and  tradeState == 1'>
            AND r_trade_state = #{tradeState}
        </if>
        <if test='shareState != null and shareState == 1'>
            AND r_share_state = #{shareState}
        </if>
        <if test='tradeState != null and  tradeState == 0'>
            AND (r_trade_state = #{tradeState} or r_trade_state is null)
        </if>
        <if test='shareState != null and shareState == 0'>
            AND (r_share_state = #{shareState} or r_share_state is null)
        </if>
    </select>
    <insert id="insertBatch" useGeneratedKeys="true" keyProperty="id"
        parameterType="java.util.List">
        insert into yeshi_ec_rankings_record
        (
        <include refid="Base_Column_List" />
        )
        values
        <foreach collection="list" item="item" separator=",">
            (
            #{item.id,jdbcType=BIGINT},
            #{item.showId,jdbcType=VARCHAR},
            #{item.nickName,jdbcType=VARCHAR},
            #{item.portrait,jdbcType=VARCHAR},
            #{item.tradeReward,jdbcType=DECIMAL},
            #{item.shareReward,jdbcType=DECIMAL},
            #{item.tradeState,jdbcType=INTEGER},
            #{item.shareState,jdbcType=INTEGER},
            #{item.tradeTime,jdbcType=TIMESTAMP},
            #{item.shareTime,jdbcType=TIMESTAMP},
            #{item.createtime,jdbcType=TIMESTAMP}
            )
        </foreach>
    </insert>
    <update id="updateBatchSelective" parameterType="java.util.List">
        update yeshi_ec_rankings_record
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="r_show_id =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.showId !=null">
                        when r_id=#{item.id} then #{item.showId}
                    </if>
                </foreach>
            </trim>
            <trim prefix="r_nick_name =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.nickName !=null">
                        when r_id=#{item.id} then #{item.nickName}
                    </if>
                </foreach>
            </trim>
            <trim prefix="r_portrait =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.portrait !=null">
                        when r_id=#{item.id} then #{item.portrait}
                    </if>
                </foreach>
            </trim>
            <trim prefix="r_trade_reward =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.tradeReward !=null">
                        when r_id=#{item.id} then #{item.tradeReward}
                    </if>
                </foreach>
            </trim>
            <trim prefix="r_share_reward =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.shareReward !=null">
                        when r_id=#{item.id} then #{item.shareReward}
                    </if>
                </foreach>
            </trim>
            <trim prefix="r_trade_state =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.tradeState !=null">
                        when r_id=#{item.id} then #{item.tradeState}
                    </if>
                </foreach>
            </trim>
            <trim prefix="r_share_state =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.shareState !=null">
                        when r_id=#{item.id} then #{item.shareState}
                    </if>
                </foreach>
            </trim>
            <trim prefix="r_trade_time =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.tradeTime !=null">
                        when r_id=#{item.id} then #{item.tradeTime}
                    </if>
                </foreach>
            </trim>
            <trim prefix="r_share_time =case" suffix="end,">
                <foreach collection="list" item="item" index="index">
                    <if test="item.shareTime !=null">
                        when r_id=#{item.id} then #{item.shareTime}
                    </if>
                </foreach>
            </trim>
        </trim>
        where r_id in
        <foreach collection="list" index="index" item="item"
            separator="," open="(" close=")">
            #{item.id,jdbcType=BIGINT}
        </foreach>
    </update>
    <select id="queryAll" resultMap="BaseResultMap">
        <!-- 根据条件查询所有标签 -->
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_rankings_record
    </select>
    <select id="listQueryByIds" resultMap="BaseResultMap"
        parameterType="java.util.List">
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_rankings_record
        where r_id in
        <foreach collection="list" index="index" item="item"
            separator="," open="(" close=")">
            #{item,jdbcType=BIGINT}
        </foreach>
    </select>
</mapper>
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/UserAccountServiceImpl.java
@@ -93,7 +93,7 @@
    @Resource
    private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
    @Resource
    private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService;
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/user/UserActiveLogServiceImpl.java
New file
@@ -0,0 +1,42 @@
package org.fanli.service.user.service.impl.account.user;
import java.util.Date;
import javax.annotation.Resource;
import org.fanli.facade.user.entity.account.user.UserActiveLog;
import org.fanli.facade.user.service.account.user.UserActiveLogService;
import org.fanli.service.user.dao.account.user.UserActiveLogMapper;
import org.springframework.stereotype.Service;
@Service
public class UserActiveLogServiceImpl implements UserActiveLogService {
    @Resource
    private UserActiveLogMapper userActiveLogMapper;
    @Override
    public void addUserActiveLog(UserActiveLog userActiveLog) {
        if (userActiveLog == null)
            return;
        if (userActiveLog.getUid() == null || userActiveLog.getUid() == 0)
            return;
        UserActiveLog latestLog = getUserLatestActiveInfo(userActiveLog.getUid());
        // 间隔5分钟以上再记录
        if (latestLog == null || System.currentTimeMillis() - latestLog.getCreateTime().getTime() > 1000 * 60 * 5L) {
            userActiveLog.setCreateTime(new Date());
            userActiveLog.setUpdateTime(new Date());
            userActiveLogMapper.insertSelective(userActiveLog);
        }
    }
    @Override
    public UserActiveLog getUserLatestActiveInfo(Long uid) {
        return userActiveLogMapper.selectLatestByUid(uid);
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/user/UserCustomSettingsServiceImpl.java
New file
@@ -0,0 +1,144 @@
package org.fanli.service.user.service.impl.account.user;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.fanli.facade.user.entity.account.user.UserCustomSettings;
import org.fanli.facade.user.entity.account.user.UserCustomSettings.UserSettingTypeEnum;
import org.fanli.facade.user.exception.account.UserCustomSettingsException;
import org.fanli.facade.user.service.account.user.UserCustomSettingsService;
import org.fanli.facade.user.vo.UserSettingsVO;
import org.fanli.service.user.dao.account.user.UserCustomSettingsMapper;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.base.entity.user.UserInfo;
@Service
public class UserCustomSettingsServiceImpl implements UserCustomSettingsService {
    @Resource
    private UserCustomSettingsMapper userCustomSettingsMapper;
    @Override
    public void saveModuleState(Long uid, String type, Integer state) throws UserCustomSettingsException{
        if (uid == null || type == null || state == null || state > 1 || state < 0) {
            throw new UserCustomSettingsException(1, "传递参数不正确");
        }
        UserSettingTypeEnum  mineTypeNum = null;
        if (type.equals(UserSettingTypeEnum.cancelNotice.name())) {
            mineTypeNum = UserSettingTypeEnum.cancelNotice;
        } else if (type.equals(UserSettingTypeEnum.noNewsRedDot.name())) {
            mineTypeNum = UserSettingTypeEnum.noNewsRedDot;
        } else if (type.equals(UserSettingTypeEnum.noBonusCount.name())) {
            mineTypeNum = UserSettingTypeEnum.noBonusCount;
        } else if (type.equals(UserSettingTypeEnum.noShareRecordAndStorage.name())) {
            mineTypeNum = UserSettingTypeEnum.noShareRecordAndStorage;
        } else if (type.equals(UserSettingTypeEnum.noInvitationBonus.name())) {
            mineTypeNum = UserSettingTypeEnum.noInvitationBonus;
        } else {
            throw new UserCustomSettingsException(1, "参数类型不匹配");
        }
        UserCustomSettings settings = userCustomSettingsMapper.getSettingsByUidAndType(uid, type);
        if (settings != null) {
            // 更新
            UserCustomSettings record = new UserCustomSettings();
            record.setId(settings.getId());
            record.setState(state);
            record.setUpdateTime(new Date());
            userCustomSettingsMapper.updateByPrimaryKeySelective(record);
        } else {
            // 插入
            settings = new UserCustomSettings();
            settings.setState(state);
            settings.setType(mineTypeNum);
            settings.setUserInfo(new UserInfo(uid));
            settings.setUpdateTime(new Date());
            settings.setCreateTime(new Date());
            userCustomSettingsMapper.insertSelective(settings);
        }
    }
    @Override
    public List<UserCustomSettings> getSettingsByUid(Long uid) throws UserCustomSettingsException{
        if (uid == null) {
            throw new UserCustomSettingsException(1, "uid不能为空");
        }
        return userCustomSettingsMapper.getSettingsByUid(uid);
    }
    @Override
    public UserCustomSettings getSettingsByUidAndType(Long uid, String type) throws UserCustomSettingsException{
        if (uid == null || type == null || type.trim().length() == 0 ) {
            throw new UserCustomSettingsException(1, "传递的参数不能为空");
        }
        return userCustomSettingsMapper.getSettingsByUidAndType(uid, type);
    }
    @Override
    public UserSettingsVO getMySettings(Long uid) throws UserCustomSettingsException{
        UserSettingsVO userSettingsVO = new UserSettingsVO();
        List<UserCustomSettings> list = getSettingsByUid(uid);
        if (list != null && list.size() > 0) {
            for (UserCustomSettings userCustomSettings: list) {
                Integer state = userCustomSettings.getState();
                if (state == null) {
                    continue;
                }
                UserSettingTypeEnum typeEnum = userCustomSettings.getType();
                if (typeEnum.equals(UserSettingTypeEnum.cancelNotice) ) {
                    userSettingsVO.setCancelNotice(state);
                } else if (typeEnum.equals(UserSettingTypeEnum.noNewsRedDot)){
                    userSettingsVO.setNoNewsRedDot(state);
                } else if (typeEnum.equals(UserSettingTypeEnum.noBonusCount)){
                    userSettingsVO.setNoBonusCount(state);
                } else if (typeEnum.equals(UserSettingTypeEnum.noShareRecordAndStorage)){
                    userSettingsVO.setNoShareRecordAndStorage(state);
                } else if (typeEnum.equals(UserSettingTypeEnum.noInvitationBonus)){
                    userSettingsVO.setNoInvitationBonus(state);
                }
            }
        }
        return userSettingsVO;
    }
    @Override
    public List<Long> getCancelNoticeUsers(){
        return userCustomSettingsMapper.getUserID(UserSettingTypeEnum.cancelNotice.name());
    }
    @Override
    public boolean validateCancelNoticeByUid(Long uid){
        boolean ispush = true;
        UserCustomSettings settings = userCustomSettingsMapper.getSettingsByUidAndType(uid,
                UserSettingTypeEnum.cancelNotice.name());
        if (settings != null && settings.getState() != null && settings.getState() == 1) {
            ispush = false;
        }
        return ispush;
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/user/UserRankServiceImpl.java
New file
@@ -0,0 +1,22 @@
package org.fanli.service.user.service.impl.account.user;
import java.util.List;
import javax.annotation.Resource;
import org.fanli.facade.user.entity.account.user.UserRank;
import org.fanli.facade.user.service.account.user.UserRankService;
import org.fanli.service.user.dao.account.user.UserRankMapper;
import org.springframework.stereotype.Service;
@Service
public class UserRankServiceImpl implements UserRankService {
    @Resource
    private UserRankMapper userRankMapper;
    @Override
    public List<UserRank> getAllRank(){
        return userRankMapper.getAllRank();
    }
}
fanli-service-user/src/main/java/org/fanli/service/user/service/impl/account/user/UserRankingsServiceImpl.java
New file
@@ -0,0 +1,475 @@
package org.fanli.service.user.service.impl.account.user;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import org.fanli.facade.user.dto.HongBao;
import org.fanli.facade.user.entity.account.user.UserRankings;
import org.fanli.facade.user.entity.invite.InviteGetMoney;
import org.fanli.facade.user.exception.UserRankingsException;
import org.fanli.facade.user.service.account.user.UserRankingsService;
import org.fanli.service.user.dao.account.user.UserRankingsMapper;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.yeshi.utils.StringUtil;
import org.yeshi.utils.tencentcloud.COSManager;
import com.yeshi.fanli.base.entity.user.UserInfo;
@Service
public class UserRankingsServiceImpl implements UserRankingsService {
    @Resource
    private UserRankingsMapper userRankingsMapper;
    @Resource
    private HongBaoService hongBaoService;
    @Override
    public int insertSelective(UserRankings record) throws UserRankingsException {
        // TODO Auto-generated method stub
        return userRankingsMapper.insertSelective(record);
    }
    @Override
    public int updateByPrimaryKey(UserRankings record) throws UserRankingsException {
        return userRankingsMapper.updateByPrimaryKey(record);
    }
    @Override
    public int updateByPrimaryKeySelective(UserRankings record) throws UserRankingsException {
        return userRankingsMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public int updateBatchSelective(List<UserRankings> list) throws UserRankingsException {
        return userRankingsMapper.updateBatchSelective(list);
    }
    @Override
    @Transactional
    public int deleteBatchById(Long id) throws UserRankingsException {
        return userRankingsMapper.deleteByPrimaryKey(id);
    }
    @Override
    public void updateClearTradeState() throws UserRankingsException {
        userRankingsMapper.updateClearTradeState();
    }
    @Override
    @Transactional
    public int deleteBatchByPrimaryKey(List<Long> arrayID) throws UserRankingsException {
        for (Long id : arrayID) {
            UserRankings userRankings = userRankingsMapper.selectByPrimaryKey(id);
            String portrait = userRankings.getPortrait();
            if (!StringUtil.isNullOrEmpty(portrait)) {
                COSManager.getInstance().deleteFile(portrait);
            }
            userRankingsMapper.deleteByPrimaryKey(id);
        }
        return arrayID.size();
    }
    @Override
    public UserRankings selectByPrimaryKey(Long id) throws UserRankingsException {
        // TODO Auto-generated method stub
        return userRankingsMapper.selectByPrimaryKey(id);
    }
    @Override
    public List<UserRankings> selectByNickName(String nickName) throws UserRankingsException {
        // TODO Auto-generated method stub
        return userRankingsMapper.selectByNickName(nickName);
    }
    @Override
    public List<UserRankings> selectByShowId(String id) throws UserRankingsException {
        // TODO Auto-generated method stub
        return userRankingsMapper.selectByShowId(id);
    }
    @Override
    public void insertAndUploadFile(UserRankings record, MultipartFile file) throws Exception {
        // TODO Auto-generated method stub
        record.setCreatetime(new Date());
        userRankingsMapper.insertSelective(record);
        // 上传图片
        if (file != null) {
            uploadPicture(file, record);
        }
    }
    @Override
    public void uploadPicture(MultipartFile file, UserRankings userRankings) throws Exception {
        /* 修改图片时,先删除已存在图片 */
        String portrait = userRankings.getPortrait();
        if (!StringUtil.isNullOrEmpty(portrait)) {
            COSManager.getInstance().deleteFile(portrait);
        }
        String contentType = file.getContentType();
        String type = contentType.substring(contentType.indexOf("/") + 1);
        // 上传文件相对位置
        String fileUrl = "userRankings/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
        InputStream inputStream = file.getInputStream();
        String uploadFilePath = COSManager.getInstance().uploadFile(inputStream, fileUrl).getUrl();
        /* 更新数据库信息 */
        if (!StringUtil.isNullOrEmpty(uploadFilePath)) {
            userRankings.setPortrait(uploadFilePath);
            userRankingsMapper.updateByPrimaryKeySelective(userRankings);
        }
    }
    @Override
    public void removePicture(UserRankings userRankings) throws Exception {
        /* 修改图片时,先删除已存在图片 */
        String portrait = userRankings.getPortrait();
        if (!StringUtil.isNullOrEmpty(portrait)) {
            boolean deleteFile = COSManager.getInstance().deleteFile(portrait);
            if (deleteFile) {
                userRankings.setPortrait(null);
                userRankingsMapper.updateByPrimaryKey(userRankings);
            }
        }
    }
    @Override
    public List<UserRankings> query(long start, int count, String key, Integer tradeState, Integer shareState, Integer sort)
            throws UserRankingsException {
        return userRankingsMapper.query(start, count, key, tradeState, shareState, sort);
    }
    @Override
    public long queryCount(String key, Integer tradeState, Integer shareState) throws UserRankingsException {
        return userRankingsMapper.queryCount(key, tradeState, shareState);
    }
    @Override
    @Transactional
    public void setRewardtBatch(List<Long> idList, Integer type, Double reward, Double startReward, Double endReward) throws Exception {
        for (Long id : idList) {
            UserRankings userRankings = userRankingsMapper.selectByPrimaryKey(id);
            if (userRankings == null) {
                continue;
            }
            Double result = 0.00;
            if (reward != null && reward >= 0) {
                result = reward;
            } else {
                if (startReward != null && endReward != null) {
                    // 随机权重
                    result = startReward + (Math.random() * ((endReward - startReward) + 1));
                } else {
                    break;
                }
            }
            if (type == 1 || type.equals(1)) {
                userRankings.setTradeReward(new BigDecimal(result));
            } else {
                userRankings.setShareReward(new BigDecimal(result));
            }
            userRankingsMapper.updateByPrimaryKeySelective(userRankings);
        }
    }
    @Override
    @Transactional
    public void setStateBatch(List<Long> idList, Integer type, Integer state) throws Exception {
        for (Long id : idList) {
            UserRankings userRankings = userRankingsMapper.selectByPrimaryKey(id);
            if (userRankings == null) {
                continue;
            }
            if (type == 1 || type.equals(1)) {
                userRankings.setTradeState(state);
                if (state != null && state.equals(1)) {
                    userRankings.setTradeTime(new Date());
                }
            } else {
                userRankings.setShareState(state);
                if (state != null && state.equals(1)) {
                    userRankings.setShareTime(new Date());
                }
            }
            userRankingsMapper.updateByPrimaryKey(userRankings);
        }
    }
    @Override
    @Transactional
    public void uploadFile(File file) throws Exception {
        List<UserRankings> list = new ArrayList<UserRankings>();
        File[] files = file.listFiles();
        for (File filePic : files) {// 遍历这个数组
            String name = filePic.getName();
            System.out.println("name" + name);
            String prefix = name.substring(name.lastIndexOf(".") + 1);
            // 上传文件相对位置
            String fileUrl = "userRankings/" + UUID.randomUUID().toString().replace("-", "") + "." + prefix;
            System.out.println(fileUrl);
            FileInputStream is = new FileInputStream(filePic);
            String uploadFilePath = COSManager.getInstance().uploadFile(is, fileUrl).getUrl();
            /* 更新数据库信息 */
            if (!StringUtil.isNullOrEmpty(uploadFilePath)) {
                UserRankings userRankings = new UserRankings();
                userRankings.setPortrait(uploadFilePath);
                userRankings.setCreatetime(new Date());
                list.add(userRankings);
            }
            is.close();
        }
        if (list.size() > 0) {
            userRankingsMapper.insertBatch(list);
        }
    }
    @Override
    @Transactional
    public void updateShowID(File file) throws Exception {
        List<String> listID = new ArrayList<String>();
        BufferedReader br = new BufferedReader(new FileReader(file));// 构造一个BufferedReader类来读取文件
        String s = "";
        while ((s = br.readLine()) != null) {// 使用readLine方法,一次读一行
            listID.add(s);
        }
        br.close();
        int i = 0;
        List<UserRankings> list = userRankingsMapper.queryAll();
        for (UserRankings userRankings : list) {
            String showId = listID.get(i);
            i++;
            userRankings.setShowId(showId);
        }
        userRankingsMapper.updateBatchSelective(list);
    }
    @Override
    @Transactional
    public void batchUpNickName(File file) throws Exception {
        List<String> listID = new ArrayList<String>();
        BufferedReader br = new BufferedReader(new FileReader(file));// 构造一个BufferedReader类来读取文件
        String s = "";
        while ((s = br.readLine()) != null) {// 使用readLine方法,一次读一行
            listID.add(s);
        }
        br.close();
        int i = 0;
        List<UserRankings> list = userRankingsMapper.queryAll();
        for (UserRankings userRankings : list) {
            String nickName = listID.get(i);
            i++;
            userRankings.setNickName(nickName);
        }
        userRankingsMapper.updateBatchSelective(list);
    }
    @Override
    public List<UserRankings> listQueryByIds(List<Long> ids) throws UserRankingsException {
        return userRankingsMapper.listQueryByIds(ids);
    }
    @Override
    public List<InviteGetMoney> getRank(long start, int count) {
        List<InviteGetMoney> resultList = new ArrayList<InviteGetMoney>();
        List<InviteGetMoney> rankingsList = new ArrayList<InviteGetMoney>();
        try {
             List<UserRankings> userRankingsList = query(0, count, null, 1, null, 2);
            for (UserRankings userRankings : userRankingsList) {
                InviteGetMoney invite = new InviteGetMoney();
                String showId = userRankings.getShowId();
                if (StringUtil.isNullOrEmpty(showId)) {
                    showId = "2***5";
                }
                invite.setUid(showId);
                invite.setName(userRankings.getNickName());
                // invite.setIcon(userRankings.getPortrait());
                invite.setPortrait(userRankings.getPortrait());
                invite.setMoney(userRankings.getTradeReward());
                invite.setCreateTime(userRankings.getCreatetime());
                rankingsList.add(invite);
            }
            Calendar calendar = Calendar.getInstance();
            calendar.add(Calendar.DATE, -1);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 设置时间格式
            String defaultDate = sdf.format(calendar.getTime()); // 格式化前一天
            // 真实用户
            List<HongBao> listHongBao = hongBaoService.listShareAndInviteMoney(0, count, defaultDate);
            if (listHongBao != null && listHongBao.size() > 0) {
                HongBao hongBao = listHongBao.get(0);
                BigDecimal maxMoney = hongBao.getShareAndInviteMoney();
                UserRankings userRankings = userRankingsList.get(userRankingsList.size() - 1);
                BigDecimal mminMoney = userRankings.getTradeReward();
                // 真实数据大于最低金额
                if (maxMoney.compareTo(mminMoney) > 0) {
                    for (HongBao hb : listHongBao) {
                        BigDecimal rewardMoney = hb.getShareAndInviteMoney();
                        // 奖金高到低排序,不满足结束循环
                        if (rewardMoney.compareTo(mminMoney) <= 0) {
                            break;
                        }
                        UserInfo userInfo = hb.getUserInfo();
                        if (userInfo != null) {
                            InviteGetMoney invite = new InviteGetMoney();
                            invite.setName(userInfo.getNickName());
                            // invite.setIcon(userRankings.getPortrait());
                            invite.setPortrait(userInfo.getPortrait());
                            invite.setMoney(rewardMoney);
                            invite.setCreateTime(new Date());
                            // 处理id
                            Long id = userInfo.getId();
                            String uid = id + "";
                            String index = uid.substring(0, 1);
                            String end = uid.substring(uid.length() - 1, uid.length());
                            invite.setUid(index + "***" + end);
                            rankingsList.add(invite);
                        }
                    }
                }
            }
            List<InviteGetMoney> list = listSort(rankingsList);
            if (list.size() > count) {
                resultList = list.subList(0, count-1);
            } else {
                resultList = list;
            }
            for (int i = 0 ;i<resultList.size() ; i++) {
                long n = i+1;
                String icon = "";
                if (n == 1) {
                    icon ="http://buxinimg.oss-cn-qingdao.aliyuncs.com/5e75b65b6eca4c74850a7306d7584663.png";
                }
                if (n == 2) {
                    icon ="http://buxinimg.oss-cn-qingdao.aliyuncs.com/442c950dd14a41a8849c0597f643ddd2.png";
                }
                if (n == 3) {
                    icon ="http://buxinimg.oss-cn-qingdao.aliyuncs.com/5c9559905f034541888e674b30dbbeb3.png";
                }
                if (n == 4) {
                    icon ="http://buxinimg.oss-cn-qingdao.aliyuncs.com/531b640cf73042ac929750e5ff610a20.png";
                }
                if (n == 5) {
                    icon ="http://buxinimg.oss-cn-qingdao.aliyuncs.com/2a229650a22c4ce09e3c60e8cddafdd6.png";
                }
                resultList.get(i).setIcon(icon);
                resultList.get(i).setRankIcon("http://ec-1255749512.file.myqcloud.com/resource/rank/rank_icon_3.png");
                resultList.get(i).setId(n);
            }
        } catch (UserRankingsException e) {
            e.printStackTrace();
        }
        return resultList;
    }
    public List<InviteGetMoney> listSort(List<InviteGetMoney> list) {
        Collections.sort(list, new Comparator<InviteGetMoney>() {
            public int compare(InviteGetMoney p1, InviteGetMoney p2) {
                // 按照Person的年龄进行升序排列
                if (p1.getMoney().compareTo(p2.getMoney()) < 0) {
                    return 1;
                }
                if (p1.getMoney().compareTo(p2.getMoney()) == 0) {
                    return 0;
                }
                return -1;
            }
        });
        return list;
    }
}