yujian
2019-06-25 b7b8f2a4fe9059ef7b5470a68bb1b34787bc92b2
淘礼金相关
17个文件已修改
35个文件已添加
4644 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/HomeNavbarAdminController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/SpecialCardAdminController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java 537 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsClassMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/HomeNavbarMapper.java 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/SpecialMapper.java 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinDetailMapper.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinOriginMapper.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinRecordMapper.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinReportMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserMoneyExtraMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinDetail.java 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinOrigin.java 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinRecord.java 173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinReport.java 163 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserMoneyExtra.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/tlj/UserTaoLiJinOriginException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/tlj/UserTaoLiJinRecordException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/GoodsClassMapper.xml 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/HomeNavbarMapper.xml 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/SpecialMapper.xml 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinDetailMapper.xml 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinOriginMapper.xml 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinRecordMapper.xml 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinReportMapper.xml 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserMoneyExtraMapper.xml 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/HomeNavbarServiceImpl.java 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialCardServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinDetailServiceImpl.java 224 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java 462 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java 386 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinReportServiceImpl.java 137 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserMoneyExtraServiceImpl.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsClassService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/HomeNavbarService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/SpecialService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinDetailService.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinOriginService.java 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinRecordService.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinReportService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserMoneyExtraService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/tlj/TaoLiJinDetailTypeEnumHandler.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/tlj/TaoLiJinOriginEnumHandler.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/tlj/SpreadHongBao.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/tlj/TaoLiJinDetailVO.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/tlj/TaoLiJinMonthVO.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/user/UserTaoLiJinRecordVO.java 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java
@@ -51,10 +51,10 @@
    private BusinessSystemService businessSystemService;
    @RequestMapping(value = "queryAll")
    public void listquery(String callback, PrintWriter out) {
    public void listquery(String callback, Integer sex, PrintWriter out) {
        try {
            List<GoodsClass> goodsClassList = goodsClassService.listquery();
            List<GoodsClass> goodsClassList = goodsClassService.listquery(sex);
            if (goodsClassList == null || goodsClassList.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/HomeNavbarAdminController.java
@@ -69,9 +69,9 @@
     * @param out
     */
    @RequestMapping(value = "updateOrder")
    public void updateOrder(String callback, Long id, Integer moveType, PrintWriter out) {
    public void updateOrder(String callback, Long id, Integer moveType, Integer sex, PrintWriter out) {
        try {
            homeNavbarService.updateOrder(id, moveType);
            homeNavbarService.updateOrder(id, moveType, sex);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (HomeNavbarException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
@@ -92,7 +92,7 @@
     * @param out
     */
    @RequestMapping(value = "query")
    public void query(String callback, Integer pageIndex, Integer pageSize, String key, PrintWriter out) {
    public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer sex, PrintWriter out) {
        if (pageIndex == null || pageIndex < 1) {
            pageIndex = 1;
@@ -103,14 +103,14 @@
        }
        try {
            List<HomeNavbar> list = homeNavbarService.listQuery((pageIndex - 1) * pageSize, pageSize, key);
            List<HomeNavbar> list = homeNavbarService.listQuery((pageIndex - 1) * pageSize, pageSize, key, sex);
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
            }
            
            long count = homeNavbarService.countlistQuery(key);
            long count = homeNavbarService.countlistQuery(key, sex);
            
            int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
            PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/SpecialCardAdminController.java
@@ -225,13 +225,10 @@
     * @param out
     */
    @RequestMapping(value = "saveSpecialOrder")
    public void saveSpecialOrder(String callback, Long id,Integer moveType, PrintWriter out) {
    public void saveSpecialOrder(String callback, Long id, Integer moveType, Integer sex, PrintWriter out) {
        try {
            specialService.updateOrder(id, moveType);
            specialService.updateOrder(id, moveType, sex);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (SpecialException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
@@ -249,7 +246,8 @@
     * @param out
     */
    @RequestMapping(value = "querySpecial")
    public void querySpecial(String callback, Integer pageIndex, Integer pageSize, String key, Long cardId, PrintWriter out) {
    public void querySpecial(String callback, Integer pageIndex, Integer pageSize, String key,
        Long cardId, Integer sex, PrintWriter out) {
        if (pageIndex == null || pageIndex < 1) {
            pageIndex = 1;
@@ -266,14 +264,14 @@
        
        try {
            
            List<Special> list = specialService.listQueryByCard((pageIndex - 1) * pageSize, pageSize, cardId, key);
            List<Special> list = specialService.listQueryByCard((pageIndex - 1) * pageSize, pageSize, cardId, key, sex);
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
            }
            
            long count = specialService.countlistQueryByCard(cardId, key);
            long count = specialService.countlistQueryByCard(cardId, key, sex);
            
            int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
            PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java
@@ -79,8 +79,8 @@
     * @param out
     */
    @RequestMapping(value = "gettaobaolink")
    public void getTaoBaoLink(AcceptData acceptData, Long uid, Long auctionId, String from, HttpServletRequest request,
            PrintWriter out) {
    public void getTaoBaoLink(AcceptData acceptData, Long uid, Long auctionId, String from, String source,
            HttpServletRequest request,    PrintWriter out) {
        if (uid == null || uid <= 0) {
            out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
            return;
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java
New file
@@ -0,0 +1,537 @@
package com.yeshi.fanli.controller.client.v2;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.lable.QualityFactory;
import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
import com.yeshi.fanli.entity.bus.user.UserRank;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
import com.yeshi.fanli.service.inter.goods.ShareGoodsTextTemplateService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
import com.yeshi.fanli.service.inter.monitor.BusinessEmergent110Service;
import com.yeshi.fanli.service.inter.monitor.MonitorService;
import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService;
import com.yeshi.fanli.service.inter.tlj.GoodsTaoLiJinRateService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserMoneyExtraService;
import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import com.yeshi.fanli.vo.tlj.TaoLiJinDetailVO;
import com.yeshi.fanli.vo.user.UserTaoLiJinRecordVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("api/v2/taolijin")
public class TaoLiJinControllerV2 {
    @Resource
    private UserTaoLiJinRecordService userTaoLiJinRecordService;
    @Resource
    private ConfigService configService;
    @Resource
    private ShareGoodsService shareGoodsService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserShareGoodsRecordService userShareGoodsRecordService;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private ShareGoodsTextTemplateService shareGoodsTextTemplateService;
    @Resource
    private BusinessEmergent110Service businessEmergent110Service;
    @Resource
    private MonitorService monitorService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
    @Resource
    private UserTaoLiJinOriginService userTaoLiJinOriginService;
    @Resource
    private UserTaoLiJinDetailService userTaoLiJinDetailService;
    @Resource
    private UserMoneyExtraService userMoneyExtraService;
    @Resource
    private ConfigTaoLiJinService configTaoLiJinService;
    @Resource
    private QualityGoodsService qualityGoodsService;
    @Resource
    private GoodsTaoLiJinRateService goodsTaoLiJinRateService;
    @Resource
    private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService;
    @Resource
    private JumpDetailV2Service jumpDetailV2Service;
    /**
     * 获取淘礼金分享记录
     *
     * @param acceptData
     * @param uid
     * @param page
     * @param out
     */
    @RequestMapping(value = "getShareRecord", method = RequestMethod.POST)
    public void getShareRecord(AcceptData acceptData, Long uid, Integer page, PrintWriter out) {
        if (uid == null || uid <= 0) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        if (page == null || page < 1) {
            page = 1;
        }
        long count = 0;
        int pageSize = Constant.PAGE_SIZE;
        List<UserTaoLiJinRecordVO> list = userTaoLiJinRecordService.getRecordByUid((page - 1) * pageSize, pageSize,    uid);
        if (list == null) {
            list = new ArrayList<UserTaoLiJinRecordVO>();
        } else if (list.size() > 0) {
            count = userTaoLiJinRecordService.countRecordByUid(uid);
        }
        GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
        gsonBuilder.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
            @Override
            public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
                if (value == null) {
                    return new JsonPrimitive("");
                } else {
                    return new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "yyyy.MM.dd HH:mm"));
                }
            }
        });
        Gson gson = gsonBuilder.create();
        JSONObject data = new JSONObject();
        data.put("count", count);
        data.put("list", gson.toJson(list));
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 统计淘礼金
     * @param acceptData
     * @param uid
     * @param out
     */
    @RequestMapping(value = "countHongBao", method = RequestMethod.POST)
    public void countHongBao(AcceptData acceptData, Long uid, PrintWriter out) {
        if (uid == null || uid <= 0) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        // 过期
        userTaoLiJinOriginService.overdueHongBao(uid);
        // 我的淘礼金
        BigDecimal tlj = null;
        UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid);
        if (userMoneyExtra != null) {
            tlj = userMoneyExtra.getTlj();
        } else {
            tlj = new BigDecimal(0);
        }
        // 今日分享个数
        long countShare = userTaoLiJinRecordService.countTodayNum(uid);
        // 获得
        BigDecimal todayWin = userTaoLiJinOriginService.countMoneyByDate(uid, 1);
        BigDecimal yesterdayWin = userTaoLiJinOriginService.countMoneyByDate(uid, 2);
        BigDecimal thisMonthWin = userTaoLiJinOriginService.countMoneyByDate(uid, 3);
        BigDecimal lastMonthWin = userTaoLiJinOriginService.countMoneyByDate(uid, 4);
        // 消耗
        BigDecimal todayUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 1);
        BigDecimal yesterdayUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 2);
        BigDecimal thisMonthUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 3);
        BigDecimal lastMonthUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 4);
        // 问号链接
        String helpLink = configTaoLiJinService.getValueByKey("hongbao_help_link");
        JSONObject data = new JSONObject();
        data.put("tlj",  tlj.setScale(2).toString());
        data.put("helpLink", helpLink);
        data.put("countShare", countShare);
        data.put("todayWin", todayWin.setScale(2).toString());
        data.put("yesterdayWin", yesterdayWin.setScale(2).toString());
        data.put("thisMonthWin", thisMonthWin.setScale(2).toString());
        data.put("lastMonthWin", lastMonthWin.setScale(2).toString());
        data.put("todayUse", todayUse.setScale(2).toString().replaceAll("-", ""));
        data.put("yesterdayUse", yesterdayUse.setScale(2).toString().replaceAll("-", ""));
        data.put("thisMonthUse", thisMonthUse.setScale(2).toString().replaceAll("-", ""));
        data.put("lastMonthUse", lastMonthUse.setScale(2).toString().replaceAll("-", ""));
        // IOS 分享个数
        ClientTextStyleVO textVo1 = new ClientTextStyleVO();
        textVo1.setContent("今日创建分享");
        textVo1.setColor("#888888");
        ClientTextStyleVO textVo2 = new ClientTextStyleVO();
        textVo2.setContent(countShare + "");
        textVo2.setColor("#E5005C");
        ClientTextStyleVO textVo3 = new ClientTextStyleVO();
        textVo3.setContent("个");
        textVo3.setColor("#888888");
        List<ClientTextStyleVO> listCountShare = new ArrayList<ClientTextStyleVO>();
        listCountShare.add(textVo1);
        listCountShare.add(textVo2);
        listCountShare.add(textVo3);
        data.put("listShare", listCountShare);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 获取淘礼金明细详情
     *
     * @param acceptData
     * @param uid
     * @param index
     *            List最末的主键ID
     * @param year
     *            年份
     * @param month
     *            月份
     * @param out
     */
    @RequestMapping(value = "getMoneyDetails")
    public void getMoneyDetails(AcceptData acceptData, Long uid, Long index, Integer year, Integer month,
            PrintWriter out) {
        if (uid == null || uid == 0) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        if ((year == null && month != null) || (year != null && month == null)) {
            out.print(JsonUtil.loadFalseResult(1, "日期不完整"));
            return;
        }
        Date date = null;
        if (year != null && month != null) {
            date = new Date(TimeUtil.convertToTimeTemp(year + "-" + month, "yyyy-M"));
            Calendar ca = Calendar.getInstance();
            ca.setTime(date);
            ca.add(Calendar.MONTH, 1);
            date = new Date(ca.getTimeInMillis() - 1);
        }
        // 查询列表
        List<TaoLiJinDetailVO> list = userTaoLiJinDetailService.listUserMoneyDetailForClient(uid, index, date);
        // 统计总条数
        long count = userTaoLiJinDetailService.countUserMoneyDetailForClient(uid, index, date);
        GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
        gsonBuilder.registerTypeAdapter(TaoLiJinDetailTypeEnum.class, new TypeAdapter<TaoLiJinDetailTypeEnum>() {
            @Override
            public TaoLiJinDetailTypeEnum read(JsonReader arg0) throws IOException {
                return null;
            }
            @Override
            public void write(JsonWriter out, TaoLiJinDetailTypeEnum arg1) throws IOException {
                out.beginObject();
                out.name("portrait").value(arg1.getPicture());
                out.endObject();
            }
        }).registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
            @Override
            public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
                if (value == null) {
                    return new JsonPrimitive("");
                } else {
                    return new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "yyyy.MM.dd HH:mm"));
                }
            }
        });
        Gson gson = gsonBuilder.create();
        JSONObject data = new JSONObject();
        data.put("count", count);
        data.put("data", gson.toJson(list));
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     *   红包领取详情
     * @param acceptData
     * @param uid
     * @param type
     * @param out
     */
    @RequestMapping(value = "getHongbaoDetails", method = RequestMethod.POST)
    public void getHongbaoDetails(AcceptData acceptData, Long uid, String type, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(type)) {
            out.print(JsonUtil.loadFalseResult(1, "类型不能为空"));
            return;
        }
        // 用户未登录时  设备领取新红包
        if (uid == null || uid <= 0) {
            BigDecimal money = null;
            DeviceTaoLiJinRecord deviceRecord = deviceTaoLiJinRecordService.getByDevice(acceptData.getDevice());
            if (deviceRecord != null) {
                // 已领取
                money = deviceRecord.getMoney();
            } else {
                String value = configTaoLiJinService.getValueByKey("hongbao_newbies");
                if (StringUtil.isNullOrEmpty(value)) {
                    out.print(JsonUtil.loadFalseResult(1, "系统红包不存在"));
                    return;
                }
                money = new BigDecimal(value);
                deviceTaoLiJinRecordService.save(acceptData.getDevice(), money);
            }
            JSONObject data = new JSONObject();
            data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon"));
            data.put("title", "新人红包");
            data.put("content", "自购直接抵现,优惠真实可见!");
            data.put("type", 1);
            data.put("money", money.setScale(2).toString());
            data.put("usage", "领取成功,去“首页-分享爆款”使用>");
            data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_taolijin_goods"));
            data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip"));
            data.put("rules", configTaoLiJinService.getValueByKey("taolijin_rules"));
            out.print(JsonUtil.loadTrueResult(data));
            return;
        }
        // 登录用户
        JSONObject data = new JSONObject();
        data.put("rules", configTaoLiJinService.getValueByKey("taolijin_rules"));
        data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon"));
        if (type.equals(TaoLiJinOriginEnum.newbiesWin.name())) {
            BigDecimal hasMoney = null;
            UserTaoLiJinOrigin userTaoLiJin = userTaoLiJinOriginService.getByUidAndOrigin(uid, type);
            if (userTaoLiJin != null) { // 已领取
                hasMoney = userTaoLiJin.getMoney();
            } else {
                try {
                    UserTaoLiJinOrigin origin = userTaoLiJinOriginService.addNewbiesWinMoney(uid);
                    hasMoney = origin.getMoney();
                } catch (UserTaoLiJinOriginException e) {
                    out.print(JsonUtil.loadFalseResult(e.getMsg()));
                    return;
                }
            }
            data.put("title", "新人红包");
            data.put("content", "自购直接抵现,优惠真实可见!");
            data.put("type", 1);
            data.put("money", hasMoney.setScale(2).toString());
            data.put("usage", "领取成功,去“首页-分享爆款”使用>");
            data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_taolijin_goods"));
            data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip"));
        } else if(type.equals(TaoLiJinOriginEnum.rankWin.name())) {
            boolean isRank = false;
            BigDecimal hasMoney = null;
            UserTaoLiJinOrigin userTaoLiJin = userTaoLiJinOriginService.getRankByThisMonth(uid, type);
            if (userTaoLiJin != null) { // 已领取
                isRank = true;
                hasMoney = userTaoLiJin.getMoney();
            } else {
                isRank = false;
                UserRank userRank = userInfoExtraService.gerUserRank(uid);
                if (userRank != null) {
                    try {
                        isRank = true;
                        UserTaoLiJinOrigin origin = userTaoLiJinOriginService.addRankWinMoney(uid, userRank);
                        hasMoney = origin.getMoney();
                    } catch (UserTaoLiJinOriginException e) {
                        if (e.getCode() != 2) {
                            out.print(JsonUtil.loadFalseResult(e.getMsg()));
                            return;
                        }
                    }
                }
            }
            // 等级不足
            if (!isRank) {
                data.put("title", "账户等级福利");
                data.put("content", "推广红包,好友福利!");
                data.put("type", 2);
                data.put("money", "本月账户等级未达到\r\n继续加油");
                data.put("usage", "去“我的-账户等级”查看 >");
                data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_rank"));
                data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip"));
                out.print(JsonUtil.loadTrueResult(data));
                return;
            } else {
                data.put("title", "账户等级福利");
                data.put("content", "推广红包,好友福利!");
                data.put("type", 1);
                data.put("money", hasMoney.setScale(2).toString());
                data.put("usage", "已存入“我的-推广红包”,去查看 >");
                data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_taolijin"));
                data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip"));
            }
        } else {
            out.print(JsonUtil.loadFalseResult(1, "类型不匹配"));
            return;
        }
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 分享爆款商品-限于淘礼金
     * @param acceptData
     * @param uid
     * @param out
     */
    @RequestMapping(value = "getShareGoods", method = RequestMethod.POST)
    public void getShareGoods(AcceptData acceptData, Long uid, Integer page, PrintWriter out) {
        if (uid == null || uid <= 0) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        if (page == null || page < 1) {
            page = 1;
        }
        int pageSize = 10;
        List<QualityFactory> listFreeGoods = qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize);
        if (listFreeGoods == null) {
            listFreeGoods = new ArrayList<QualityFactory>();
        }
        long count = listFreeGoods.size();
        JSONArray array = new JSONArray();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
        boolean isNewUser = userInfoExtraService.isNewUser(uid);
        BigDecimal proportion = hongBaoManageService.getFanLiRate();
        for (QualityFactory qualityFactory : listFreeGoods) {
            TaoBaoGoodsBrief taoBaoGoodsBrief = qualityFactory.getTaoBaoGoodsBrief();
            if (taoBaoGoodsBrief == null) {
                continue;
            }
            TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null);
            // 显示类型
            if (isNewUser) {
                extra.setMoneyType(1);
            } else {
                extra.setMoneyType(2);
            }
            // 去掉标签
            extra.setLabels(null);
            BigDecimal spreadMoney = goodsTaoLiJinRateService.getGoodsSpreadMoney(taoBaoGoodsBrief);
            // 推广红包 不能小于1
            if (spreadMoney.compareTo(new BigDecimal(1)) < 0) {
                continue;
            }
            extra.setSpreadMoney("推广红包 ¥"+ spreadMoney);
            array.add(gson.toJson(extra));
        }
        // 过期
        userTaoLiJinOriginService.overdueHongBao(uid);
        JSONObject data = new JSONObject();
        data.put("count", count);
        data.put("list", array);
        out.print(JsonUtil.loadTrueResult(data));
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsClassMapper.java
@@ -47,7 +47,7 @@
    GoodsClass getByAdjoinOrder(@Param("order") Integer order, @Param("type") Integer type);
    
    
    List<GoodsClass> getGoodsClassAll();
    List<GoodsClass> getGoodsClassAll(@Param("sex")Integer sex);
    
    /**
     * 获取最大排序值
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/HomeNavbarMapper.java
@@ -18,11 +18,27 @@
    int deleteBatchByPrimaryKey(List<Long> list);
    
    /**
     * 获取最大的排序值
     *   默认最大的排序值
     * @param card
     * @return
     */
    int getMaxOrder();
    int getDefaultMaxOrder();
    /**
     *   默认最大的排序值
     * @param card
     * @return
     */
    int getManMaxOrder();
    /**
     *   默认最大的排序值
     * @param card
     * @return
     */
    int getWomanMaxOrder();
    
    /**
     * 查询交换排序对象
@@ -30,7 +46,26 @@
     * @param order 排序值
     * @return
     */
    HomeNavbar getChangeOrder(@Param("type") Integer type, @Param("order") Integer order);
    HomeNavbar getDefaultChangeOrder(@Param("type") Integer type, @Param("order") Integer order);
    /**
     * 查询交换排序对象
     * @param type
     * @param order 排序值
     * @return
     */
    HomeNavbar getManChangeOrder(@Param("type") Integer type, @Param("order") Integer order);
    /**
     * 查询交换排序对象
     * @param type
     * @param order 排序值
     * @return
     */
    HomeNavbar getWomanChangeOrder(@Param("type") Integer type, @Param("order") Integer order);
    
    /**
     * 后端列表查询
@@ -39,9 +74,9 @@
     * @param key
     * @return
     */
    List<HomeNavbar> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key);
    List<HomeNavbar> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key, @Param("sex") Integer sex);
    
    long countListQuery(@Param("key") String key);
    long countListQuery(@Param("key") String key, @Param("sex") Integer sex);
    
    /**
     * 查询有效导航栏
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/SpecialMapper.java
@@ -34,20 +34,47 @@
     * @param order
     * @return
     */
    Special getOrderByCardID(@Param("cardId") Long cardId, @Param("type") Integer type,@Param("order") Integer order);
    Special getOrderByCardID(@Param("cardId") Long cardId, @Param("type") Integer type,
            @Param("order") Integer order, @Param("sex")Integer sex);
    
    List<Special> listQueryByCard(@Param("start") long start, @Param("count") int count,
            @Param("cardId") Long card, @Param("key") String key);
    long countlistQueryByCard(@Param("cardId") Long card, @Param("key") String key);
    
    /**
     * 获取最大的排序值
     * 后端查询列表
     * @param start
     * @param count
     * @param card
     * @param key
     * @param sex
     * @return
     */
    List<Special> listQueryByCard(@Param("start") long start, @Param("count") int count,
            @Param("cardId") Long card, @Param("key") String key, @Param("sex")Integer sex);
    long countlistQueryByCard(@Param("cardId") Long card, @Param("key") String key, @Param("sex")Integer sex);
    /**
     *   默认最大的排序值
     * @param card
     * @return
     */
    int getMaxOrderByCard(@Param("cardId") Long cardId);
    int getDefaultMaxOrder(@Param("cardId") Long cardId);
    /**
     *   默认最大的排序值
     * @param card
     * @return
     */
    int getManMaxOrder(@Param("cardId") Long cardId);
    /**
     *   默认最大的排序值
     * @param card
     * @return
     */
    int getWomanMaxOrder(@Param("cardId") Long cardId);
    
    /**
     * 根据标识、系统查询启用专题
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinDetailMapper.java
New file
@@ -0,0 +1,91 @@
package com.yeshi.fanli.dao.mybatis.tlj;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail;
import com.yeshi.fanli.vo.tlj.TaoLiJinMonthVO;
public interface UserTaoLiJinDetailMapper extends BaseMapper<UserTaoLiJinDetail> {
    /**
     * 统计条数
     * @param uid
     * @param dateType 1今日 、2昨日、3本月、4上月
     * @return
     */
    long countDetail(@Param("uid")long uid);
    /**
     * 根据日期类型统计消耗金额
     * @param uid
     * @param dateType 1今日 、2昨日、3本月、4上月
     * @return
     */
    BigDecimal countUseMoneyByDate(@Param("uid")long uid, @Param("dateType")int dateType);
    /**
     * 按最大的创建时间和用户ID检索列表
     *
     * @param uid
     * @param date
     * @return
     */
    List<UserTaoLiJinDetail> selectByMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date, @Param("count") int count);
    /**
     * 通过用户ID和返回的最大时间的详情ID来获取下一页的数据
     *
     * @param uid
     * @param id
     * @param count
     * @return
     */
    List<UserTaoLiJinDetail> selectByUidWithIndexId(@Param("uid") Long uid, @Param("id") Long id, @Param("count") int count);
    /**
     * 统计某个月份的收入与支出
     *
     * @param uid
     * @param dateFormat
     * @return
     */
    List<TaoLiJinMonthVO> selectMonthMoneyByUid(@Param("uid") Long uid, @Param("dateFormat") List<String> dateFormat);
    /**
     * 获取用户总共有多少记录数据
     *
     * @param uid
     * @return
     */
    Long selectCountByUid(@Param("uid") Long uid);
    /**
     * 按用户ID和最大时间检索月份的数量
     *
     * @param uid
     * @param maxDate
     * @return
     */
    int selectMonthCountByUid(@Param("uid") Long uid, @Param("date") Date maxDate);
    /**
     * 按最大的创建时间和用户ID检索数量
     *
     * @param uid
     * @param date
     * @return
     */
    Long selectCountByUidAndMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinOriginMapper.java
New file
@@ -0,0 +1,95 @@
package com.yeshi.fanli.dao.mybatis.tlj;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
public interface UserTaoLiJinOriginMapper extends BaseMapper<UserTaoLiJinOrigin> {
    /**
     * 根据日期类型统计金额
     * @param uid
     * @param dateType 1今日 、2昨日、3本月、4上月
     * @return
     */
    BigDecimal countMoneyByDate(@Param("uid")long uid, @Param("dateType")int dateType);
    /**
     * 根据用户、来源统计
     * @param uid
     * @param origin
     * @return
     */
    long countByUidAndOrigin(@Param("uid")long uid, @Param("origin")String origin);
    /**
     * 根据用户、来源统计
     * @param uid
     * @param origin
     * @return
     */
    UserTaoLiJinOrigin getByUidAndOrigin(@Param("uid")long uid, @Param("origin")String origin);
    /**
     *  统计本月等级红包
     * @param uid
     * @param origin
     * @return
     */
    long countRankByThisMonth(@Param("uid")long uid);
    /**
     *  统计本月等级红包
     * @param uid
     * @param origin
     * @return
     */
    UserTaoLiJinOrigin  getRankByThisMonth(@Param("uid")long uid, @Param("type")String type);
    /**
     * 查询过期的红包
     * @param date
     * @return
     */
    List<UserTaoLiJinOrigin> getOverdueTaoLiJin(@Param("uid")long uid, @Param("date")Date date);
    /**
     * 查询剩余淘礼金
     * @param uid
     * @return
     */
    List<UserTaoLiJinOrigin> getSurplusLiJin(@Param("uid")long uid);
    /**
     * 统计用户红包记录
     * @param uid
     * @return
     */
    long countByUidAndType(@Param("uid")long uid, @Param("type")String type);
    /**
     * 统计金额
     * @param rightsId
     * @param origin
     * @return
     */
    BigDecimal countMoneyByOrigin(@Param("rightsId")String rightsId, @Param("origin")String origin);
    /**
     * 根据淘礼金id查询
     * @param rightsId
     * @return
     */
    UserTaoLiJinOrigin getOriginByRightsId(@Param("rightsId")String rightsId);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinRecordMapper.java
New file
@@ -0,0 +1,45 @@
package com.yeshi.fanli.dao.mybatis.tlj;
import java.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord;
import com.yeshi.fanli.vo.user.UserTaoLiJinRecordVO;
public interface UserTaoLiJinRecordMapper extends BaseMapper<UserTaoLiJinRecord> {
    /**
     * 查询分享记录
     * @return
     */
    List<UserTaoLiJinRecordVO> getRecordByUid(@Param("start")long start,@Param("count")int count, @Param("uid")long uid);
    long countRecordByUid(@Param("uid")Long uid);
    /**
     * 今日创建分享红包个数
     * @param uid
     * @return
     */
    long countTodayNum(@Param("uid")Long uid);
    /**
     * 查询用户分享
     * @param uid
     * @param goodsId
     * @return
     */
    BigDecimal getShareHongBaoByUidAndGoodsId(@Param("uid")Long uid, @Param("goodsId")Long goodsId);
    /**
     * 根据淘礼金id查询
     * @param rightsId
     * @return
     */
    UserTaoLiJinRecord getByRightsId(@Param("rightsId")String rightsId);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinReportMapper.java
New file
@@ -0,0 +1,20 @@
package com.yeshi.fanli.dao.mybatis.tlj;
import java.util.List;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport;
public interface UserTaoLiJinReportMapper extends BaseMapper<UserTaoLiJinReport> {
    int deleteByPrimaryKey(String id);
    UserTaoLiJinReport selectByPrimaryKey(String id);
    /**
     * 查询更新的报告
     * @return
     */
    List<UserTaoLiJinReport> needUpdateReport();
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserMoneyExtraMapper.java
New file
@@ -0,0 +1,8 @@
package com.yeshi.fanli.dao.mybatis.user;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
public interface UserMoneyExtraMapper extends BaseMapper<UserMoneyExtra> {
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinDetail.java
New file
@@ -0,0 +1,138 @@
package com.yeshi.fanli.entity.bus.tlj;
import java.math.BigDecimal;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.google.gson.annotations.Expose;
/**
 *   用户淘礼金明细
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_taolijin_detail")
public class UserTaoLiJinDetail {
    public enum TaoLiJinDetailTypeEnum {
        add("红包增加", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
        reduce("成功使用扣除", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
        sendBack("长期未使用收回", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
        refund("未使用成功退回", "http://img.flqapp.com/img/tlj/icon_tlj.png");
        private final String desc;
        private final String picture;
        private TaoLiJinDetailTypeEnum(String desc, String picture) {
            this.desc = desc;
            this.picture = picture;
        }
        public String getDesc() {
            return desc;
        }
        public String getPicture() {
            return picture;
        }
    }
    @Expose
    @Column(name = "utd_id")
    private Long id;
    @Column(name = "utd_uid")
    private Long uid; // 用户id
    @Expose
    @Column(name = "utd_money")
    private BigDecimal money; // 获得金额
    @Expose
    @Column(name = "utd_title")
    private String title; // 操作内容
    @Expose
    @Column(name = "utd_type")
    private TaoLiJinDetailTypeEnum type; //
    @Expose
    @Column(name = "utd_desc_info")
    private String descInfo; // 详细信息
    @Expose
    @Column(name = "utd_remark")
    private String remark; // 备注
    @Expose
    @Column(name = "utd_create_time")
    private Date createTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public BigDecimal getMoney() {
        return money;
    }
    public void setMoney(BigDecimal money) {
        this.money = money;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public TaoLiJinDetailTypeEnum getType() {
        return type;
    }
    public void setType(TaoLiJinDetailTypeEnum type) {
        this.type = type;
    }
    public String getDescInfo() {
        return descInfo;
    }
    public void setDescInfo(String descInfo) {
        this.descInfo = descInfo;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinOrigin.java
New file
@@ -0,0 +1,142 @@
package com.yeshi.fanli.entity.bus.tlj;
import java.math.BigDecimal;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 *   用户淘礼金获得记录
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_taolijin_origin")
public class UserTaoLiJinOrigin {
    public enum TaoLiJinOriginEnum {
        newbiesWin("新人红包"), shareWin("推广红包福利"), rankWin("账户等级福利"), inviteWin("邀请队员奖励"), refund("失效回退");
        private final String desc;
        private TaoLiJinOriginEnum(String desc) {
            this.desc = desc;
        }
        public String getDesc() {
            return desc;
        }
    }
    @Column(name = "uto_id")
    private Long id;
    @Column(name = "uto_uid")
    private Long uid; // 用户id
    @Column(name = "uto_rights_id")
    private String rightsId; // 淘礼金id
    @Column(name = "uto_money")
    private BigDecimal money; // 获得金额
    @Column(name = "uto_money_surplus")
    private BigDecimal moneySurplus; // 剩余-未核销
    @Column(name = "uto_type")
    private Integer type; //  类型:1仅分享、2均可以
    @Column(name = "uto_origin")
    private TaoLiJinOriginEnum origin; // 来源
    @Column(name = "uto_remark")
    private String remark; // 备注
    @Column(name = "uto_create_time")
    private Date createTime;
    @Column(name = "uto_update_time")
    private Date updateTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public BigDecimal getMoney() {
        return money;
    }
    public void setMoney(BigDecimal money) {
        this.money = money;
    }
    public BigDecimal getMoneySurplus() {
        return moneySurplus;
    }
    public void setMoneySurplus(BigDecimal moneySurplus) {
        this.moneySurplus = moneySurplus;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public TaoLiJinOriginEnum getOrigin() {
        return origin;
    }
    public void setOrigin(TaoLiJinOriginEnum origin) {
        this.origin = origin;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getRightsId() {
        return rightsId;
    }
    public void setRightsId(String rightsId) {
        this.rightsId = rightsId;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinRecord.java
New file
@@ -0,0 +1,173 @@
package com.yeshi.fanli.entity.bus.tlj;
import java.math.BigDecimal;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 用户创建淘礼金记录
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_taolijin_record")
public class UserTaoLiJinRecord {
    @Column(name = "utlj_id")
    private Long id;
    @Column(name = "utlj_uid")
    private Long uid; // 用户id
    @Column(name = "utlj_goods_id")
    private Long goodsId; // 商品id
    @Column(name = "utlj_total_num")
    private Integer totalNum; // 淘礼金总个数
    @Column(name = "utlj_name")
    private String name; // 淘礼金名称
    @Column(name = "utlj_per_face")
    private BigDecimal perFace; // 单个淘礼金面额,单位元
    @Column(name = "utlj_send_start_time")
    private Date sendStartTime; // 发放开始时间
    @Column(name = "utlj_send_end_time")
    private Date sendEndTime; // 发放截止时间
    @Column(name = "utlj_use_start_time")
    private Date useStartTime; // 使用开始日期
    @Column(name = "utlj_use_end_time")
    private Date useEndTime; // 使用结束日期
    @Column(name = "utlj_rights_id")
    private String rightsId; // 淘礼金Id
    @Column(name = "utlj_send_url")
    private String sendUrl; // 淘礼金领取url
    @Column(name = "utlj_create_time")
    private Date createTime;
    // 剩余余额
    private BigDecimal surplusMoney;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public Long getGoodsId() {
        return goodsId;
    }
    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }
    public Integer getTotalNum() {
        return totalNum;
    }
    public void setTotalNum(Integer totalNum) {
        this.totalNum = totalNum;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public BigDecimal getPerFace() {
        return perFace;
    }
    public void setPerFace(BigDecimal perFace) {
        this.perFace = perFace;
    }
    public Date getSendStartTime() {
        return sendStartTime;
    }
    public void setSendStartTime(Date sendStartTime) {
        this.sendStartTime = sendStartTime;
    }
    public Date getSendEndTime() {
        return sendEndTime;
    }
    public void setSendEndTime(Date sendEndTime) {
        this.sendEndTime = sendEndTime;
    }
    public Date getUseStartTime() {
        return useStartTime;
    }
    public void setUseStartTime(Date useStartTime) {
        this.useStartTime = useStartTime;
    }
    public Date getUseEndTime() {
        return useEndTime;
    }
    public void setUseEndTime(Date useEndTime) {
        this.useEndTime = useEndTime;
    }
    public String getRightsId() {
        return rightsId;
    }
    public void setRightsId(String rightsId) {
        this.rightsId = rightsId;
    }
    public String getSendUrl() {
        return sendUrl;
    }
    public void setSendUrl(String sendUrl) {
        this.sendUrl = sendUrl;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public BigDecimal getSurplusMoney() {
        return surplusMoney;
    }
    public void setSurplusMoney(BigDecimal surplusMoney) {
        this.surplusMoney = surplusMoney;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinReport.java
New file
@@ -0,0 +1,163 @@
package com.yeshi.fanli.entity.bus.tlj;
import java.math.BigDecimal;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 用户创建淘礼金记录
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_taolijin_report")
public class UserTaoLiJinReport {
    @Column(name = "utr_id")
    private String id; // 淘礼金Id
    @Column(name = "utr_unfreeze_amount")
    private BigDecimal unfreezeAmount; // 解冻金额
    @Column(name = "utr_unfreeze_num")
    private Integer unfreezeNum; // 解冻红包个数
    @Column(name = "utr_refund_amount")
    private BigDecimal refundAmount; // 失效回退金额
    @Column(name = "utr_refund_num")
    private Integer refundNum; // 失效回退红包个数
    @Column(name = "utr_alipay_amount")
    private BigDecimal alipayAmount; // 引导成交金额
    @Column(name = "utr_use_amount")
    private BigDecimal useAmount; // 红包核销金额
    @Column(name = "utr_use_num")
    private Integer useNum; // 红包核销个数
    @Column(name = "utr_win_amount")
    private BigDecimal winAmount; // 红包领取金额
    @Column(name = "utr_win_num")
    private Integer winNum; // 红包领取个数
    @Column(name = "utr_pre_commission_amount")
    private BigDecimal preCommissionAmount; // 引导预估佣金金额
    @Column(name = "utr_create_time")
    private Date createTime;
    @Column(name = "utr_update_time")
    private Date updateTime;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public BigDecimal getUnfreezeAmount() {
        return unfreezeAmount;
    }
    public void setUnfreezeAmount(BigDecimal unfreezeAmount) {
        this.unfreezeAmount = unfreezeAmount;
    }
    public Integer getUnfreezeNum() {
        return unfreezeNum;
    }
    public void setUnfreezeNum(Integer unfreezeNum) {
        this.unfreezeNum = unfreezeNum;
    }
    public BigDecimal getRefundAmount() {
        return refundAmount;
    }
    public void setRefundAmount(BigDecimal refundAmount) {
        this.refundAmount = refundAmount;
    }
    public Integer getRefundNum() {
        return refundNum;
    }
    public void setRefundNum(Integer refundNum) {
        this.refundNum = refundNum;
    }
    public BigDecimal getAlipayAmount() {
        return alipayAmount;
    }
    public void setAlipayAmount(BigDecimal alipayAmount) {
        this.alipayAmount = alipayAmount;
    }
    public BigDecimal getUseAmount() {
        return useAmount;
    }
    public void setUseAmount(BigDecimal useAmount) {
        this.useAmount = useAmount;
    }
    public Integer getUseNum() {
        return useNum;
    }
    public void setUseNum(Integer useNum) {
        this.useNum = useNum;
    }
    public BigDecimal getWinAmount() {
        return winAmount;
    }
    public void setWinAmount(BigDecimal winAmount) {
        this.winAmount = winAmount;
    }
    public Integer getWinNum() {
        return winNum;
    }
    public void setWinNum(Integer winNum) {
        this.winNum = winNum;
    }
    public BigDecimal getPreCommissionAmount() {
        return preCommissionAmount;
    }
    public void setPreCommissionAmount(BigDecimal preCommissionAmount) {
        this.preCommissionAmount = preCommissionAmount;
    }
    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/src/main/java/com/yeshi/fanli/entity/bus/user/UserMoneyExtra.java
New file
@@ -0,0 +1,76 @@
package com.yeshi.fanli.entity.bus.user;
import java.math.BigDecimal;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 *   用户其他金额类型
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_money_extra")
public class UserMoneyExtra {
    @Column(name = "um_uid")
    private Long uid; // 用户id
    @Column(name = "um_tlj")
    private BigDecimal tlj; // 淘礼金余额
    @Column(name = "um_tlj_self")
    private BigDecimal tljSelf; // 可自购淘礼金
    @Column(name = "um_create_time")
    private Date createTime;
    @Column(name = "um_update_time")
    private Date updateTime;
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public BigDecimal getTlj() {
        return tlj;
    }
    public void setTlj(BigDecimal tlj) {
        this.tlj = tlj;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public BigDecimal getTljSelf() {
        return tljSelf;
    }
    public void setTljSelf(BigDecimal tljSelf) {
        this.tljSelf = tljSelf;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/tlj/UserTaoLiJinOriginException.java
New file
@@ -0,0 +1,32 @@
package com.yeshi.fanli.exception.tlj;
public class UserTaoLiJinOriginException 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 UserTaoLiJinOriginException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public UserTaoLiJinOriginException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/tlj/UserTaoLiJinRecordException.java
New file
@@ -0,0 +1,32 @@
package com.yeshi.fanli.exception.tlj;
public class UserTaoLiJinRecordException 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 UserTaoLiJinRecordException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public UserTaoLiJinRecordException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java
New file
@@ -0,0 +1,44 @@
package com.yeshi.fanli.job;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService;
import com.yeshi.fanli.util.Constant;
@Component
public class TaoLiJinJob {
    @Resource
    private UserTaoLiJinReportService userTaoLiJinReportService;
    /**
     *  更新报告
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void insetDynamicInfo() {
        if (!Constant.IS_TASK) {
            return;
        }
        try {
            userTaoLiJinReportService.needUpdateReport();
        } catch (Exception e) {
            try {
                LogHelper.errorDetailInfo(e);
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/GoodsClassMapper.xml
@@ -117,8 +117,22 @@
        </if>
        LIMIT 1
    </select>
    <select id="getGoodsClassAll" resultMap="BaseResultMap">SELECT * FROM
        yeshi_ec_class rs ORDER BY rs.`orderby`
    <select id="getGoodsClassAll" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_class c
        where 1=1
         <!-- 通用版 -->
        <if test="sex == 0">
            AND (c.`sex`= 120 OR c.`sex` = 0 OR c.`sex` = 10 OR c.`sex` = 20)
        </if>
        <!-- 女版 -->
        <if test="sex == 1">
            AND (c.`sex`= 120 OR c.`sex` = 1 OR c.`sex` = 10 OR c.`sex` = 12)
        </if>
        <!-- 男版 -->
        <if test="sex == 2">
            AND (c.`sex`= 120 OR c.`sex` = 2 OR c.`sex` = 20 OR c.`sex` = 12)
        </if>
        ORDER BY c.orderby
    </select>
    <select id="listByName" resultMap="BaseResultMap">SELECT * from yeshi_ec_class
        rs WHERE rs.name like '%#{name}%' LIMIT ${start},${count}</select>
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/HomeNavbarMapper.xml
@@ -33,41 +33,116 @@
    <include refid="Base_Column_List"/>from yeshi_ec_home_navbar where br_id = #{id,jdbcType=BIGINT}
  </select>
  
  <select id="getMaxOrder" resultType="java.lang.Integer">
        SELECT IFNULL(MAX(br_orderby),0) FROM yeshi_ec_home_navbar
  <select id="getDefaultMaxOrder" resultType="java.lang.Integer">
       SELECT IFNULL(MAX(br_orderby),0) FROM yeshi_ec_home_navbar
       order by br_orderby desc
  </select>
  
  <select id="getChangeOrder" resultMap="BaseResultMap">
        SELECT  <include refid="Base_Column_List" /> FROM yeshi_ec_home_navbar
        WHERE 1=1
        <if test="type == -1">
            <![CDATA[and br_orderby < #{order}]]>
            order by br_orderby desc
  <select id="getManMaxOrder" resultType="java.lang.Integer">
       SELECT IFNULL(MAX(br_order_man),0) FROM yeshi_ec_home_navbar
       order by br_order_man desc
  </select>
  <select id="getWomanMaxOrder" resultType="java.lang.Integer">
       SELECT IFNULL(MAX(br_order_woman),0) FROM yeshi_ec_home_navbar
       order by br_order_woman desc
  </select>
   <select id="getDefaultChangeOrder" resultType="java.lang.Integer">
       SELECT h.* FROM yeshi_ec_home_navbar h
       LEFT JOIN `yeshi_ec_class` c ON c.`id` = h.`br_class_id`
    WHERE 1=1 and h.br_orderby is not null
        <if test="type == -1">
               <![CDATA[and h.br_orderby < #{order}]]>
               order by h.br_orderby  desc
        </if>
        <if test="type == 1">
            <![CDATA[and br_orderby > #{order} ]]>
            order by br_orderby
            <![CDATA[and h.br_orderby > #{order}]]>
            order by h.br_orderby
        </if>
         LIMIT 1
   </select>
     LIMIT 1
  </select>
  <select id="getManChangeOrder" resultType="java.lang.Integer">
       SELECT h.* FROM yeshi_ec_home_navbar h
       LEFT JOIN `yeshi_ec_class` c ON c.`id` = h.`br_class_id`
    WHERE 1=1 and h.br_order_man is  not null
        <if test="type == -1">
               <![CDATA[and h.br_order_man < #{order}]]>
               order by h.br_order_man  desc
        </if>
        <if test="type == 1">
            <![CDATA[and h.br_order_man > #{order}]]>
            order by h.br_order_man
        </if>
     LIMIT 1
  </select>
  <select id="getWomanChangeOrder" resultType="java.lang.Integer">
       SELECT h.* FROM yeshi_ec_home_navbar h
       LEFT JOIN `yeshi_ec_class` c ON c.`id` = h.`br_class_id`
    WHERE 1=1 and h.br_order_woman is not null
        <if test="type == -1">
               <![CDATA[and h.br_order_woman < #{order}]]>
               order by h.br_order_woman  desc
        </if>
        <if test="type == 1">
            <![CDATA[and h.br_order_woman > #{order}]]>
            order by h.br_order_woman
        </if>
     LIMIT 1
  </select>
   
   <select id="listQuery" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_home_navbar
        SELECT h.*,c.sex AS sex  FROM yeshi_ec_home_navbar h
        LEFT JOIN `yeshi_ec_class` c ON c.`id` = h.`br_class_id`
        WHERE 1=1
           <if test='key != null and key != ""'>
                  AND (br_name like '%${key}%')
                  AND (h.br_name like '%${key}%')
           </if>
           ORDER BY br_orderby
           <!-- 通用版 -->
            <if test="sex == 0">
                AND (c.`id` is null OR (c.`sex`= 120 OR c.`sex` = 0 OR c.`sex` = 10 OR c.`sex` = 20))
                ORDER BY h.br_orderby
            </if>
            <!-- 女版 -->
            <if test="sex == 1">
                AND (c.`id` is null OR (c.`sex`= 120 OR c.`sex` = 1 OR c.`sex` = 10 OR c.`sex` = 12))
                ORDER BY h.br_order_woman
            </if>
            <!-- 男版 -->
            <if test="sex == 2">
                AND (c.`id` is null OR (c.`sex`= 120 OR c.`sex` = 2 OR c.`sex` = 20 OR c.`sex` = 12))
                ORDER BY h.br_order_man
            </if>
        LIMIT ${start},${count}
   </select>
   
   <select id="countListQuery" resultType="java.lang.Long">
        SELECT IFNULL(count(br_id),0)  FROM yeshi_ec_home_navbar
        SELECT IFNULL(count(br_id),0)  FROM yeshi_ec_home_navbar h
        LEFT JOIN `yeshi_ec_class` c ON c.`id` = h.`br_class_id`
        WHERE 1=1
           <if test='key != null and key != ""'>
                  AND (br_name like '%${key}%')
                  AND (h.br_name like '%${key}%')
           </if>
           <!-- 通用版 -->
            <if test="sex == 0">
                AND (c.`id` is null OR (c.`sex`= 120 OR c.`sex` = 0 OR c.`sex` = 10 OR c.`sex` = 20))
                ORDER BY h.br_orderby
            </if>
            <!-- 女版 -->
            <if test="sex == 1">
                AND (c.`id` is null OR (c.`sex`= 120 OR c.`sex` = 1 OR c.`sex` = 10 OR c.`sex` = 12))
                ORDER BY h.br_order_woman
            </if>
            <!-- 男版 -->
            <if test="sex == 2">
                AND (c.`id` is null OR (c.`sex`= 120 OR c.`sex` = 2 OR c.`sex` = 20 OR c.`sex` = 12))
                ORDER BY h.br_order_man
            </if>
   </select>
      
   <select id="listQueryEffective" resultMap="BaseResultMap">
@@ -86,24 +161,19 @@
      WHERE h.br_state = 1 AND br_is_default = 1
              AND IF(h.br_start_time IS NULL,TRUE, h.br_start_time<![CDATA[<=]]> NOW()) 
              AND IF(h.br_end_time IS NULL,TRUE, h.br_end_time <![CDATA[>=]]> NOW())
              <!-- 全部使用 -->
            <if test="sex == null">
                AND c.`sex`= 120
                ORDER BY h.br_orderby
            </if>
            <!-- 通用版 -->
               <!-- 通用版 -->
            <if test="sex == 0">
                AND (c.`sex`= 120 OR c.`sex` = 0 OR c.`sex` = 10 OR c.`sex` = 20)
                AND (c.`id` is null OR (c.`sex`= 120 OR c.`sex` = 0 OR c.`sex` = 10 OR c.`sex` = 20))
                ORDER BY h.br_orderby 
            </if>
            <!-- 女版 -->
            <if test="sex == 1">
                AND (c.`sex`= 120 OR c.`sex` = 1 OR c.`sex` = 10 OR c.`sex` = 12)
                AND (c.`id` is null OR (c.`sex`= 120 OR c.`sex` = 1 OR c.`sex` = 10 OR c.`sex` = 12))
                ORDER BY h.br_order_woman
            </if>
            <!-- 男版 -->
            <if test="sex == 2">
                AND (c.`sex`= 120 OR c.`sex` = 2 OR c.`sex` = 20 OR c.`sex` = 12)
                AND (c.`id` is null OR (c.`sex`= 120 OR c.`sex` = 2 OR c.`sex` = 20 OR c.`sex` = 12))
                ORDER BY h.br_order_man  
            </if>
   </select>
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/SpecialMapper.xml
@@ -104,6 +104,25 @@
    </set> where b_id = #{id,jdbcType=BIGINT}
  </update>
  
  <sql id="Sex_Screen">
    <!-- 通用版 -->
    <if test="sex == 0">
        AND (sp.`b_sex`= 120 OR sp.`b_sex`= 0 OR sp.`b_sex` = 10 OR sp.`b_sex` = 20)
        ORDER BY sp.`b_orderby`
    </if>
    <!-- 女版 -->
    <if test="sex == 1">
        AND (sp.`b_sex`= 120 OR sp.`b_sex`= 1 OR sp.`b_sex` = 10 OR sp.`b_sex` = 12)
        ORDER BY sp.`b_order_woman`
    </if>
    <!-- 男版 -->
    <if test="sex == 2">
        AND (sp.`b_sex`= 120 OR sp.`b_sex`= 2 OR sp.`b_sex` = 20 OR sp.`b_sex` = 12)
        ORDER BY sp.`b_order_man`
    </if>
  </sql>
  <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
        delete from yeshi_ec_special WHERE b_id in
        <foreach collection="list" item="item" open="(" close=")"
@@ -131,40 +150,80 @@
   </select>
   
   <select id="listQueryByCard" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" /> FROM  `yeshi_ec_special` pp
        WHERE pp.`b_card_id` = #{cardId}
        SELECT <include refid="Base_Column_List" /> FROM  `yeshi_ec_special` sp
        WHERE sp.`b_card_id` = #{cardId}
           <if test='key != null and key != ""'>
                  AND b_name like '%${key}%'
                  AND sp.b_name like '%${key}%'
           </if>
        ORDER BY pp.b_orderby
           <include refid="Sex_Screen"/>
        LIMIT ${start},${count}
   </select>
   
   <select id="countlistQueryByCard" resultType="java.lang.Long">
        SELECT IFNULL(count(b_id),0) FROM  `yeshi_ec_special` pp
        WHERE pp.`b_card_id` = #{cardId}
        SELECT IFNULL(count(b_id),0) FROM  `yeshi_ec_special` sp
        WHERE sp.`b_card_id` = #{cardId}
           <if test='key != null and key != ""'>
                  AND b_name like '%${key}%'
                  AND sp.b_name like '%${key}%'
           </if>
           <include refid="Sex_Screen"/>
   </select>
  
   <select id="getMaxOrderByCard" resultType="java.lang.Integer">
   <select id="getDefaultMaxOrder" resultType="java.lang.Integer">
        SELECT IFNULL(MAX(pp.b_orderby),0) FROM yeshi_ec_special pp 
        WHERE pp.`b_card_id` = #{cardId}
   </select>
  
  <select id="getManMaxOrder" resultType="java.lang.Integer">
        SELECT IFNULL(MAX(pp.b_order_man),0) FROM yeshi_ec_special pp
        WHERE pp.`b_card_id` = #{cardId}
   </select>
  <select id="getWomanMaxOrder" resultType="java.lang.Integer">
        SELECT IFNULL(MAX(pp.b_order_woman),0) FROM yeshi_ec_special pp
        WHERE pp.`b_card_id` = #{cardId}
   </select>
   <select id="getOrderByCardID" resultMap="BaseResultMap">
        SELECT  <include refid="Base_Column_List" /> FROM yeshi_ec_special
        WHERE b_card_id = #{cardId}
        <if test="type == -1">
            <![CDATA[and b_orderby < #{order}]]>
            order by b_orderby desc
        </if>
        <if test="type == 1">
            <![CDATA[and b_orderby > #{order} ]]>
            order by b_orderby
        </if>
        SELECT  <include refid="Base_Column_List" /> FROM yeshi_ec_special sp
        WHERE sp.b_card_id = #{cardId}
        <!-- 通用版 -->
        <if test="sex == 0 or sex == 120">
            AND (sp.`b_sex`= 120 OR sp.`b_sex`= 0 OR sp.`b_sex` = 10 OR sp.`b_sex` = 20)
            <if test="type == -1">
                <![CDATA[and sp.b_orderby < #{order}]]>
                order by sp.b_orderby desc
            </if>
            <if test="type == 1">
                <![CDATA[and sp.b_orderby > #{order} ]]>
                order by sp.b_orderby
            </if>
        </if>
        <!-- 女版 -->
        <if test="sex == 1">
            AND (sp.`b_sex`= 120 OR sp.`b_sex`= 1 OR sp.`b_sex` = 10 OR sp.`b_sex` = 12)
            <if test="type == -1">
                <![CDATA[and sp.b_order_woman < #{order}]]>
                order by sp.b_order_woman desc
            </if>
            <if test="type == 1">
                <![CDATA[and sp.b_order_woman > #{order} ]]>
                order by sp.b_order_woman
            </if>
        </if>
        <!-- 男版 -->
        <if test="sex == 2">
            AND (sp.`b_sex`= 120 OR sp.`b_sex`= 2 OR sp.`b_sex` = 20 OR sp.`b_sex` = 12)
            <if test="type == -1">
                <![CDATA[and sp.b_order_man < #{order}]]>
                order by sp.b_order_man desc
            </if>
            <if test="type == 1">
                <![CDATA[and sp.b_order_man > #{order} ]]>
                order by sp.b_order_man
            </if>
        </if>
        limit 1
   </select>
   
@@ -194,26 +253,7 @@
            AND IF(c.`cd_end_time` IS NULL,TRUE,c.`cd_end_time`<![CDATA[>=]]>NOW())
            AND pc.`sp_key` = #{placeKey}
            LIMIT 1)c ON  sp.`b_card_id` = c.`cd_id`
        WHERE sp.`b_state` = 0
            <!-- 全部使用 -->
            <if test="sex == null">
                AND sp.`b_sex`= 120
                ORDER BY sp.`b_orderby`
            </if>
            <!-- 通用版 -->
            <if test="sex == 0">
                AND (sp.`b_sex`= 120 OR sp.`b_sex`= 0 OR sp.`b_sex` = 10 OR sp.`b_sex` = 20)
                ORDER BY sp.`b_orderby`
            </if>
            <!-- 女版 -->
            <if test="sex == 1">
                AND (sp.`b_sex`= 120 OR sp.`b_sex`= 1 OR sp.`b_sex` = 10 OR sp.`b_sex` = 12)
                ORDER BY sp.`b_order_woman`
            </if>
            <!-- 男版 -->
            <if test="sex == 2">
                AND (sp.`b_sex`= 120 OR sp.`b_sex`= 2 OR sp.`b_sex` = 20 OR sp.`b_sex` = 12)
                ORDER BY sp.`b_order_man`
            </if>
        WHERE sp.`b_state` = 0
            <include refid="Sex_Screen"/>
   </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinDetailMapper.xml
New file
@@ -0,0 +1,140 @@
<?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.dao.mybatis.tlj.UserTaoLiJinDetailMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail">
    <id column="utd_id" property="id" jdbcType="BIGINT"/>
    <result column="utd_uid" property="uid" jdbcType="BIGINT"/>
    <result column="utd_money" property="money" jdbcType="DECIMAL"/>
    <result column="utd_title" property="title" jdbcType="VARCHAR"/>
    <result column="utd_type" property="type" typeHandler="com.yeshi.fanli.util.mybatishandler.tlj.TaoLiJinDetailTypeEnumHandler"/>
    <result column="utd_desc_info" property="descInfo" jdbcType="VARCHAR"/>
    <result column="utd_remark" property="remark" jdbcType="INTEGER"/>
    <result column="utd_create_time" property="createTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <resultMap id="UserMonthMoneyMap" type="com.yeshi.fanli.vo.tlj.TaoLiJinMonthVO">
        <result column="expend" property="expend" jdbcType="DECIMAL" />
        <result column="income" property="income" jdbcType="DECIMAL" />
        <result column="dateFormate" property="dateFormate" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List">utd_id,utd_uid,utd_money,utd_title,utd_type,utd_desc_info,utd_remark,utd_create_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_taolijin_detail where utd_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_taolijin_detail where utd_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_detail (utd_id,utd_uid,utd_money,utd_title,utd_type,utd_desc_info,utd_remark,utd_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{title,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR},#{descInfo,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_detail
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">utd_id,</if>
      <if test="uid != null">utd_uid,</if>
      <if test="money != null">utd_money,</if>
      <if test="title != null">utd_title,</if>
      <if test="type != null">utd_type,</if>
      <if test="descInfo != null">utd_desc_info,</if>
      <if test="remark != null">utd_remark,</if>
      <if test="createTime != null">utd_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="money != null">#{money,jdbcType=DECIMAL},</if>
      <if test="title != null">#{title,jdbcType=VARCHAR},</if>
      <if test="type != null">#{type,jdbcType=VARCHAR},</if>
      <if test="descInfo != null">#{descInfo,jdbcType=VARCHAR},</if>
      <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail">update yeshi_ec_user_taolijin_detail set utd_uid = #{uid,jdbcType=BIGINT},utd_money = #{money,jdbcType=DECIMAL},utd_title = #{title,jdbcType=VARCHAR},utd_type = #{type,jdbcType=VARCHAR},utd_desc_info = #{descInfo,jdbcType=VARCHAR},utd_remark = #{remark,jdbcType=VARCHAR},utd_create_time = #{createTime,jdbcType=TIMESTAMP} where utd_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail">update yeshi_ec_user_taolijin_detail
    <set>
      <if test="uid != null">utd_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="money != null">utd_money=#{money,jdbcType=DECIMAL},</if>
      <if test="title != null">utd_title=#{title,jdbcType=VARCHAR},</if>
      <if test="type != null">utd_type=#{type,jdbcType=VARCHAR},</if>
      <if test="descInfo != null">utd_desc_info=#{descInfo,jdbcType=VARCHAR},</if>
      <if test="remark != null">utd_remark=#{remark,jdbcType=VARCHAR},</if>
      <if test="createTime != null">utd_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
    </set> where utd_id = #{id,jdbcType=BIGINT}
  </update>
  <select id="countDetail" resultType="Long">
      SELECT IFNULL(count(t.utd_id),0) FROM `yeshi_ec_user_taolijin_detail` t
    WHERE t.`utd_uid` = #{uid}
  </select>
  <select id="countUseMoneyByDate" resultType="java.math.BigDecimal">
      SELECT IFNULL(SUM(t.`utd_money`),0) FROM `yeshi_ec_user_taolijin_detail` t
    WHERE t.`utd_uid` = #{uid} AND t.`utd_type` <![CDATA[<>]]>'overdue'
          AND t.`utd_money` <![CDATA[<]]> 0
        <if test="dateType == 1"> <!-- 今日  -->
            AND TO_DAYS(t.`utd_create_time`) =  TO_DAYS(NOW());
        </if>
        <if test="dateType == 2"> <!-- 昨日  -->
          AND TO_DAYS(NOW()) - TO_DAYS(t.`utd_create_time`) = 1
        </if>
           <if test="dateType == 3"> <!-- 本月  -->
          AND DATE_FORMAT(t.`utd_create_time`, '%Y%m') =DATE_FORMAT(CURDATE(), '%Y%m')
        </if>
        <if test="dateType == 4"> <!--上月  -->
          AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(t.`utd_create_time`, '%Y%m')) = 1
        </if>
  </select>
  <select id="selectByMaxCreateTime" resultMap="BaseResultMap">
    SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_user_taolijin_detail t
    WHERE t.`utd_uid`=#{uid} AND t.`utd_create_time`<![CDATA[<=]]> #{date}
    ORDER BY t.`utd_create_time` DESC,t.utd_id DESC
    LIMIT #{count}
  </select>
  <select id="selectByUidWithIndexId" resultMap="BaseResultMap">
    SELECT <include refid="Base_Column_List" />    FROM yeshi_ec_user_taolijin_detail t
    WHERE t.`utd_uid`=#{uid}
        AND t.`utd_create_time`<![CDATA[<=]]>(SELECT utd_create_time FROM yeshi_ec_user_taolijin_detail WHERE utd_id =#{id})
    ORDER BY t.`utd_create_time` DESC,t.utd_id DESC
    LIMIT #{count}
  </select>
  <select id="selectMonthMoneyByUid" resultMap="UserMonthMoneyMap">
        <foreach collection="dateFormat" index="index" item="item"
            separator="UNION ALL">
            <trim prefix="(" suffix=")">
                SELECT c.time AS dateFormate , IF(a.money IS NULL,0,a.money) AS income ,IF(b.money IS NULL,0,b.money) AS expend
                FROM (SELECT  #{item} AS `time`) c
                LEFT JOIN (SELECT DATE_FORMAT(d.`utd_create_time`,'%Y-%m') AS `time`,SUM(d.`utd_money`)AS money
                               FROM `yeshi_ec_user_taolijin_detail` d
                               WHERE d.`utd_uid`=#{uid} AND  d.`utd_money`<![CDATA[>=]]>0 AND DATE_FORMAT(d.`utd_create_time`,'%Y-%m')=#{item}
                               GROUP BY DATE_FORMAT(d.`utd_create_time`,'%Y-%m')
                               ) a ON a.time=c.time
                LEFT JOIN(SELECT DATE_FORMAT(d.`utd_create_time`,'%Y-%m') AS `time`,SUM(d.`utd_money`) AS money
                              FROM `yeshi_ec_user_taolijin_detail` d
                            WHERE d.`utd_uid`=#{uid} AND d.`utd_money` <![CDATA[<]]>0 AND DATE_FORMAT(d.`utd_create_time`,'%Y-%m')=#{item}
                              GROUP BY DATE_FORMAT(d.`utd_create_time`,'%Y-%m')
                              ) b ON c.time=b.time
           </trim>
       </foreach>
  </select>
  <select id="selectCountByUid" resultType="java.lang.Long"  parameterType="java.lang.Long">
    SELECT count(utd_id) FROM yeshi_ec_user_taolijin_detail
    WHERE utd_uid=#{uid}
  </select>
  <select id="selectMonthCountByUid" resultType="java.lang.Integer">
    SELECT COUNT(*) FROM
            (SELECT * FROM yeshi_ec_user_taolijin_detail d
             WHERE d.`utd_uid`=#{uid} AND d.`utd_create_time` <![CDATA[<=]]> #{date}
             GROUP BY DATE_FORMAT(d.`utd_create_time`,'%y-%m')
             ) a
  </select>
  <select id="selectCountByUidAndMaxCreateTime" resultType="java.lang.Long">
    SELECT count(utd_id) FROM yeshi_ec_user_taolijin_detail
    WHERE utd_uid=#{uid} and `utd_create_time`<![CDATA[<=]]>#{date}
 </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinOriginMapper.xml
New file
@@ -0,0 +1,133 @@
<?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.dao.mybatis.tlj.UserTaoLiJinOriginMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin">
    <id column="uto_id" property="id" jdbcType="BIGINT"/>
    <result column="uto_uid" property="uid" jdbcType="BIGINT"/>
    <result column="uto_rights_id" property="rightsId" jdbcType="VARCHAR"/>
    <result column="uto_money" property="money" jdbcType="DECIMAL"/>
    <result column="uto_money_surplus" property="moneySurplus" jdbcType="DECIMAL"/>
    <result column="uto_type" property="type" jdbcType="INTEGER"/>
    <result column="uto_origin" property="origin" typeHandler="com.yeshi.fanli.util.mybatishandler.tlj.TaoLiJinOriginEnumHandler"/>
    <result column="uto_remark" property="remark" jdbcType="VARCHAR"/>
    <result column="uto_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uto_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">uto_id,uto_uid,uto_rights_id,uto_money,uto_money_surplus,uto_type,uto_origin,uto_remark,uto_create_time,uto_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_taolijin_origin where uto_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_taolijin_origin where uto_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_origin (uto_id,uto_uid,uto_rights_id,uto_money,uto_money_surplus,uto_type,uto_origin,uto_remark,uto_create_time,uto_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{rightsId,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{moneySurplus,jdbcType=DECIMAL},#{type,jdbcType=INTEGER},#{origin,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_origin
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">uto_id,</if>
      <if test="uid != null">uto_uid,</if>
      <if test="rightsId != null">uto_rights_id,</if>
      <if test="money != null">uto_money,</if>
      <if test="moneySurplus != null">uto_money_surplus,</if>
      <if test="type != null">uto_type,</if>
      <if test="origin != null">uto_origin,</if>
      <if test="remark != null">uto_remark,</if>
      <if test="createTime != null">uto_create_time,</if>
      <if test="updateTime != null">uto_update_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="rightsId != null">#{rightsId,jdbcType=VARCHAR},</if>
      <if test="money != null">#{money,jdbcType=DECIMAL},</if>
      <if test="moneySurplus != null">#{moneySurplus,jdbcType=DECIMAL},</if>
      <if test="type != null">#{type,jdbcType=INTEGER},</if>
      <if test="origin != null">#{origin,jdbcType=VARCHAR},</if>
      <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin">update yeshi_ec_user_taolijin_origin set uto_uid = #{uid,jdbcType=BIGINT},uto_rights_id = #{rightsId,jdbcType=VARCHAR},uto_money = #{money,jdbcType=DECIMAL},uto_money_surplus = #{moneySurplus,jdbcType=DECIMAL},uto_type = #{type,jdbcType=INTEGER},uto_origin = #{origin,jdbcType=VARCHAR},uto_remark = #{remark,jdbcType=VARCHAR},uto_create_time = #{createTime,jdbcType=TIMESTAMP},uto_update_time = #{updateTime,jdbcType=TIMESTAMP} where uto_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin">update yeshi_ec_user_taolijin_origin
    <set>
      <if test="uid != null">uto_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="rightsId != null">uto_rights_id=#{rightsId,jdbcType=VARCHAR},</if>
      <if test="money != null">uto_money=#{money,jdbcType=DECIMAL},</if>
      <if test="moneySurplus != null">uto_money_surplus=#{moneySurplus,jdbcType=DECIMAL},</if>
      <if test="type != null">uto_type=#{type,jdbcType=INTEGER},</if>
      <if test="origin != null">uto_origin=#{origin,jdbcType=VARCHAR},</if>
      <if test="remark != null">uto_remark=#{remark,jdbcType=VARCHAR},</if>
      <if test="createTime != null">uto_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">uto_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where uto_id = #{id,jdbcType=BIGINT}
  </update>
  <select id="countMoneyByDate" resultType="java.math.BigDecimal">
      SELECT IFNULL(SUM(t.`uto_money`),0) FROM `yeshi_ec_user_taolijin_origin` t
    WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` <![CDATA[<>]]>'refund'
        <if test="dateType == 1"> <!-- 今日  -->
            AND TO_DAYS(t.`uto_create_time`) =  TO_DAYS(NOW());
        </if>
        <if test="dateType == 2"> <!-- 昨日  -->
          AND TO_DAYS(NOW()) - TO_DAYS(t.`uto_create_time`) = 1
        </if>
           <if test="dateType == 3"> <!-- 本月  -->
          AND DATE_FORMAT(t.`uto_create_time`, '%Y%m') =DATE_FORMAT(CURDATE(), '%Y%m')
        </if>
        <if test="dateType == 4"> <!--上月  -->
          AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(t.`uto_create_time`, '%Y%m')) = 1
        </if>
  </select>
  <select id="countByUidAndOrigin" resultType="Long">
     SELECT IFNULL(COUNT(t.`uto_id`),0) FROM yeshi_ec_user_taolijin_origin t
    WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` = #{origin}
  </select>
   <select id="getByUidAndOrigin" resultMap="BaseResultMap">
     SELECT * FROM yeshi_ec_user_taolijin_origin t
    WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` = #{origin}
    LIMIT 1
  </select>
  <select id="countRankByThisMonth" resultType="Long">
     SELECT IFNULL(COUNT(t.`uto_id`),0) FROM yeshi_ec_user_taolijin_origin t
    WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` = 'rankWin'
          AND DATE_FORMAT(t.`uto_create_time`, '%Y%m') =DATE_FORMAT(CURDATE(), '%Y%m')
  </select>
   <select id="getRankByThisMonth" resultMap="BaseResultMap">
     SELECT * FROM yeshi_ec_user_taolijin_origin t
    WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` = #{type}
          AND DATE_FORMAT(t.`uto_create_time`, '%Y%m') =DATE_FORMAT(CURDATE(), '%Y%m')
    LIMIT 1
  </select>
  <select id="getOverdueTaoLiJin" resultMap="BaseResultMap" >
     SELECT * FROM yeshi_ec_user_taolijin_origin t
    WHERE t.`uto_uid` = #{uid} AND t.`uto_create_time`<![CDATA[<=]]> #{date}
          AND t.`uto_money_surplus`<![CDATA[>]]> 0
  </select>
  <select id="getSurplusLiJin" resultMap="BaseResultMap" >
     SELECT * FROM yeshi_ec_user_taolijin_origin t
    WHERE t.`uto_uid` = #{uid} AND t.`uto_money_surplus`<![CDATA[>]]> 0
  </select>
  <select id="countByUidAndType" resultType="Long">
     SELECT IFNULL(COUNT(t.`uto_id`),0) FROM yeshi_ec_user_taolijin_origin t
    WHERE t.`uto_uid` = #{uid} AND t.`uto_origin` = #{type}
  </select>
  <select id="countMoneyByOrigin" resultType="java.math.BigDecimal">
     SELECT IFNULL(SUM(t.`uto_money`),0) FROM yeshi_ec_user_taolijin_origin t
    WHERE t.`uto_rights_id` = #{rightsId}  AND t.`uto_origin` = #{origin}
  </select>
  <select id="getOriginByRightsId" resultMap="BaseResultMap" >
     SELECT * FROM yeshi_ec_user_taolijin_origin t
    WHERE t.`uto_rights_id` = #{rightsId}
    LIMIT 1
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinRecordMapper.xml
New file
@@ -0,0 +1,120 @@
<?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.dao.mybatis.tlj.UserTaoLiJinRecordMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord">
    <id column="utlj_id" property="id" jdbcType="BIGINT"/>
    <result column="utlj_uid" property="uid" jdbcType="BIGINT"/>
    <result column="utlj_goods_id" property="goodsId" jdbcType="BIGINT"/>
    <result column="utlj_total_num" property="totalNum" jdbcType="INTEGER"/>
    <result column="utlj_name" property="name" jdbcType="VARCHAR"/>
    <result column="utlj_per_face" property="perFace" jdbcType="DECIMAL"/>
    <result column="utlj_send_start_time" property="sendStartTime" jdbcType="TIMESTAMP"/>
    <result column="utlj_send_end_time" property="sendEndTime" jdbcType="TIMESTAMP"/>
    <result column="utlj_use_start_time" property="useStartTime" jdbcType="TIMESTAMP"/>
    <result column="utlj_use_end_time" property="useEndTime" jdbcType="TIMESTAMP"/>
    <result column="utlj_rights_id" property="rightsId" jdbcType="VARCHAR"/>
    <result column="utlj_send_url" property="sendUrl" jdbcType="VARCHAR"/>
    <result column="utlj_create_time" property="createTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.user.UserTaoLiJinRecordVO">
    <result column="utlj_goods_id" property="auctionId" jdbcType="BIGINT"/>
    <result column="utlj_total_num" property="totalNum" jdbcType="INTEGER"/>
    <result column="utlj_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="utr_refund_num" property="refundNum" jdbcType="INTEGER"/>
    <result column="utr_use_num" property="useNum" jdbcType="INTEGER"/>
    <result column="utr_win_num" property="winNum" jdbcType="INTEGER"/>
    <result column="utr_pre_commission_amount" property="commission" jdbcType="DECIMAL"/>
  </resultMap>
  <sql id="Base_Column_List">utlj_id,utlj_uid,utlj_goods_id,utlj_total_num,utlj_name,utlj_per_face,utlj_send_start_time,utlj_send_end_time,utlj_use_start_time,utlj_use_end_time,utlj_rights_id,utlj_send_url,utlj_create_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_taolijin_record where utlj_id = #{id,jdbcType=BIGINT}
  </select>
  <select id="getRecordByUid" resultMap="ResultVOMap">
      SELECT * FROM yeshi_ec_user_taolijin_record d
    LEFT JOIN yeshi_ec_user_taolijin_report p ON d.`utlj_rights_id` = p.`utr_id`
    WHERE d.`utlj_uid` = #{uid}
    ORDER BY d.`utlj_create_time` DESC
    LIMIT ${start},${count}
  </select>
  <select id="countRecordByUid" resultType="Long">
      SELECT IFNULL(COUNT(d.`utlj_id`),0) FROM yeshi_ec_user_taolijin_record d
    WHERE d.`utlj_uid` = #{uid}
  </select>
  <select id="countTodayNum" resultType="Long">
      SELECT  IFNULL(count(d.utlj_id),0) FROM `yeshi_ec_user_taolijin_record` d
    WHERE   d.`utlj_uid` = #{uid} AND TO_DAYS(d.`utlj_create_time`) = TO_DAYS(NOW());
  </select>
  <select id="getShareHongBaoByUidAndGoodsId" resultType="java.math.BigDecimal">
      SELECT utlj_per_face FROM `yeshi_ec_user_taolijin_record` d
    WHERE d.`utlj_uid` =#{uid}  AND d.`utlj_goods_id`=#{goodsId}
    LIMIT 1
  </select>
  <select id="getByRightsId" resultMap="ResultVOMap">
      SELECT * FROM `yeshi_ec_user_taolijin_record` d
    WHERE d.`utlj_rights_id` =#{rightsId}
    LIMIT 1
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_taolijin_record where utlj_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_record (utlj_id,utlj_uid,utlj_goods_id,utlj_total_num,utlj_name,utlj_per_face,utlj_send_start_time,utlj_send_end_time,utlj_use_start_time,utlj_use_end_time,utlj_rights_id,utlj_send_url,utlj_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{goodsId,jdbcType=BIGINT},#{totalNum,jdbcType=INTEGER},#{name,jdbcType=VARCHAR},#{perFace,jdbcType=DECIMAL},#{sendStartTime,jdbcType=TIMESTAMP},#{sendEndTime,jdbcType=TIMESTAMP},#{useStartTime,jdbcType=TIMESTAMP},#{useEndTime,jdbcType=TIMESTAMP},#{rightsId,jdbcType=VARCHAR},#{sendUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">utlj_id,</if>
      <if test="uid != null">utlj_uid,</if>
      <if test="goodsId != null">utlj_goods_id,</if>
      <if test="totalNum != null">utlj_total_num,</if>
      <if test="name != null">utlj_name,</if>
      <if test="perFace != null">utlj_per_face,</if>
      <if test="sendStartTime != null">utlj_send_start_time,</if>
      <if test="sendEndTime != null">utlj_send_end_time,</if>
      <if test="useStartTime != null">utlj_use_start_time,</if>
      <if test="useEndTime != null">utlj_use_end_time,</if>
      <if test="rightsId != null">utlj_rights_id,</if>
      <if test="sendUrl != null">utlj_send_url,</if>
      <if test="createTime != null">utlj_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="goodsId != null">#{goodsId,jdbcType=BIGINT},</if>
      <if test="totalNum != null">#{totalNum,jdbcType=INTEGER},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="perFace != null">#{perFace,jdbcType=DECIMAL},</if>
      <if test="sendStartTime != null">#{sendStartTime,jdbcType=TIMESTAMP},</if>
      <if test="sendEndTime != null">#{sendEndTime,jdbcType=TIMESTAMP},</if>
      <if test="useStartTime != null">#{useStartTime,jdbcType=TIMESTAMP},</if>
      <if test="useEndTime != null">#{useEndTime,jdbcType=TIMESTAMP},</if>
      <if test="rightsId != null">#{rightsId,jdbcType=VARCHAR},</if>
      <if test="sendUrl != null">#{sendUrl,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord">update yeshi_ec_user_taolijin_record set utlj_uid = #{uid,jdbcType=BIGINT},utlj_goods_id = #{goodsId,jdbcType=BIGINT},utlj_total_num = #{totalNum,jdbcType=INTEGER},utlj_name = #{name,jdbcType=VARCHAR},utlj_per_face = #{perFace,jdbcType=DECIMAL},utlj_send_start_time = #{sendStartTime,jdbcType=TIMESTAMP},utlj_send_end_time = #{sendEndTime,jdbcType=TIMESTAMP},utlj_use_start_time = #{useStartTime,jdbcType=TIMESTAMP},utlj_use_end_time = #{useEndTime,jdbcType=TIMESTAMP},utlj_rights_id = #{rightsId,jdbcType=VARCHAR},utlj_send_url = #{sendUrl,jdbcType=VARCHAR},utlj_create_time = #{createTime,jdbcType=TIMESTAMP} where utlj_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord">update yeshi_ec_user_taolijin_record
    <set>
      <if test="uid != null">utlj_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="goodsId != null">utlj_goods_id=#{goodsId,jdbcType=BIGINT},</if>
      <if test="totalNum != null">utlj_total_num=#{totalNum,jdbcType=INTEGER},</if>
      <if test="name != null">utlj_name=#{name,jdbcType=VARCHAR},</if>
      <if test="perFace != null">utlj_per_face=#{perFace,jdbcType=DECIMAL},</if>
      <if test="sendStartTime != null">utlj_send_start_time=#{sendStartTime,jdbcType=TIMESTAMP},</if>
      <if test="sendEndTime != null">utlj_send_end_time=#{sendEndTime,jdbcType=TIMESTAMP},</if>
      <if test="useStartTime != null">utlj_use_start_time=#{useStartTime,jdbcType=TIMESTAMP},</if>
      <if test="useEndTime != null">utlj_use_end_time=#{useEndTime,jdbcType=TIMESTAMP},</if>
      <if test="rightsId != null">utlj_rights_id=#{rightsId,jdbcType=VARCHAR},</if>
      <if test="sendUrl != null">utlj_send_url=#{sendUrl,jdbcType=VARCHAR},</if>
      <if test="createTime != null">utlj_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
    </set> where utlj_id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinReportMapper.xml
New file
@@ -0,0 +1,81 @@
<?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.dao.mybatis.tlj.UserTaoLiJinReportMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport">
    <id column="utr_id" property="id" jdbcType="VARCHAR"/>
    <result column="utr_unfreeze_amount" property="unfreezeAmount" jdbcType="DECIMAL"/>
    <result column="utr_unfreeze_num" property="unfreezeNum" jdbcType="INTEGER"/>
    <result column="utr_refund_amount" property="refundAmount" jdbcType="DECIMAL"/>
    <result column="utr_refund_num" property="refundNum" jdbcType="INTEGER"/>
    <result column="utr_alipay_amount" property="alipayAmount" jdbcType="DECIMAL"/>
    <result column="utr_use_amount" property="useAmount" jdbcType="DECIMAL"/>
    <result column="utr_use_num" property="useNum" jdbcType="INTEGER"/>
    <result column="utr_win_amount" property="winAmount" jdbcType="DECIMAL"/>
    <result column="utr_win_num" property="winNum" jdbcType="INTEGER"/>
    <result column="utr_pre_commission_amount" property="preCommissionAmount" jdbcType="DECIMAL"/>
    <result column="utr_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="utr_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">utr_id,utr_unfreeze_amount,utr_unfreeze_num,utr_refund_amount,utr_refund_num,utr_alipay_amount,utr_use_amount,utr_use_num,utr_win_amount,utr_win_num,utr_pre_commission_amount,utr_create_time,utr_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_taolijin_report where utr_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_taolijin_report where utr_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_report (utr_id,utr_unfreeze_amount,utr_unfreeze_num,utr_refund_amount,utr_refund_num,utr_alipay_amount,utr_use_amount,utr_use_num,utr_win_amount,utr_win_num,utr_pre_commission_amount,utr_create_time,utr_update_time) values (#{id,jdbcType=VARCHAR},#{unfreezeAmount,jdbcType=DECIMAL},#{unfreezeNum,jdbcType=INTEGER},#{refundAmount,jdbcType=DECIMAL},#{refundNum,jdbcType=INTEGER},#{alipayAmount,jdbcType=DECIMAL},#{useAmount,jdbcType=DECIMAL},#{useNum,jdbcType=INTEGER},#{winAmount,jdbcType=DECIMAL},#{winNum,jdbcType=INTEGER},#{preCommissionAmount,jdbcType=DECIMAL},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_report
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">utr_id,</if>
      <if test="unfreezeAmount != null">utr_unfreeze_amount,</if>
      <if test="unfreezeNum != null">utr_unfreeze_num,</if>
      <if test="refundAmount != null">utr_refund_amount,</if>
      <if test="refundNum != null">utr_refund_num,</if>
      <if test="alipayAmount != null">utr_alipay_amount,</if>
      <if test="useAmount != null">utr_use_amount,</if>
      <if test="useNum != null">utr_use_num,</if>
      <if test="winAmount != null">utr_win_amount,</if>
      <if test="winNum != null">utr_win_num,</if>
      <if test="preCommissionAmount != null">utr_pre_commission_amount,</if>
      <if test="createTime != null">utr_create_time,</if>
      <if test="updateTime != null">utr_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=VARCHAR},</if>
      <if test="unfreezeAmount != null">#{unfreezeAmount,jdbcType=DECIMAL},</if>
      <if test="unfreezeNum != null">#{unfreezeNum,jdbcType=INTEGER},</if>
      <if test="refundAmount != null">#{refundAmount,jdbcType=DECIMAL},</if>
      <if test="refundNum != null">#{refundNum,jdbcType=INTEGER},</if>
      <if test="alipayAmount != null">#{alipayAmount,jdbcType=DECIMAL},</if>
      <if test="useAmount != null">#{useAmount,jdbcType=DECIMAL},</if>
      <if test="useNum != null">#{useNum,jdbcType=INTEGER},</if>
      <if test="winAmount != null">#{winAmount,jdbcType=DECIMAL},</if>
      <if test="winNum != null">#{winNum,jdbcType=INTEGER},</if>
      <if test="preCommissionAmount != null">#{preCommissionAmount,jdbcType=DECIMAL},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport">update yeshi_ec_user_taolijin_report set utr_unfreeze_amount = #{unfreezeAmount,jdbcType=DECIMAL},utr_unfreeze_num = #{unfreezeNum,jdbcType=INTEGER},utr_refund_amount = #{refundAmount,jdbcType=DECIMAL},utr_refund_num = #{refundNum,jdbcType=INTEGER},utr_alipay_amount = #{alipayAmount,jdbcType=DECIMAL},utr_use_amount = #{useAmount,jdbcType=DECIMAL},utr_use_num = #{useNum,jdbcType=INTEGER},utr_win_amount = #{winAmount,jdbcType=DECIMAL},utr_win_num = #{winNum,jdbcType=INTEGER},utr_pre_commission_amount = #{preCommissionAmount,jdbcType=DECIMAL},utr_create_time = #{createTime,jdbcType=TIMESTAMP},utr_update_time = #{updateTime,jdbcType=TIMESTAMP} where utr_id = #{id,jdbcType=VARCHAR}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport">update yeshi_ec_user_taolijin_report
    <set>
      <if test="unfreezeAmount != null">utr_unfreeze_amount=#{unfreezeAmount,jdbcType=DECIMAL},</if>
      <if test="unfreezeNum != null">utr_unfreeze_num=#{unfreezeNum,jdbcType=INTEGER},</if>
      <if test="refundAmount != null">utr_refund_amount=#{refundAmount,jdbcType=DECIMAL},</if>
      <if test="refundNum != null">utr_refund_num=#{refundNum,jdbcType=INTEGER},</if>
      <if test="alipayAmount != null">utr_alipay_amount=#{alipayAmount,jdbcType=DECIMAL},</if>
      <if test="useAmount != null">utr_use_amount=#{useAmount,jdbcType=DECIMAL},</if>
      <if test="useNum != null">utr_use_num=#{useNum,jdbcType=INTEGER},</if>
      <if test="winAmount != null">utr_win_amount=#{winAmount,jdbcType=DECIMAL},</if>
      <if test="winNum != null">utr_win_num=#{winNum,jdbcType=INTEGER},</if>
      <if test="preCommissionAmount != null">utr_pre_commission_amount=#{preCommissionAmount,jdbcType=DECIMAL},</if>
      <if test="createTime != null">utr_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">utr_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where utr_id = #{id,jdbcType=VARCHAR}
  </update>
  <select id="needUpdateReport" resultMap="BaseResultMap">
      SELECT * FROM  yeshi_ec_user_taolijin_report t
    WHERE DATE_SUB(CURDATE(), INTERVAL 3 DAY) <![CDATA[<=]]>DATE(t.`utr_create_time`)
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserMoneyExtraMapper.xml
New file
@@ -0,0 +1,43 @@
<?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.dao.mybatis.user.UserMoneyExtraMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserMoneyExtra">
    <id column="um_uid" property="uid" jdbcType="BIGINT"/>
    <result column="um_tlj" property="tlj" jdbcType="DECIMAL"/>
    <result column="um_tlj_self" property="tljSelf" jdbcType="DECIMAL"/>
    <result column="um_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="um_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">um_uid,um_tlj,um_tlj_self,um_create_time,um_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_money_extra where um_uid = #{uid,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_money_extra where um_uid = #{uid,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserMoneyExtra" useGeneratedKeys="true" keyProperty="uid">insert into yeshi_ec_user_money_extra (um_uid,um_tlj,um_tlj_self,um_create_time,um_update_time) values (#{uid,jdbcType=BIGINT},#{tlj,jdbcType=DECIMAL},#{tljSelf,jdbcType=DECIMAL},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserMoneyExtra" useGeneratedKeys="true" keyProperty="uid">insert into yeshi_ec_user_money_extra
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="uid != null">um_uid,</if>
      <if test="tlj != null">um_tlj,</if>
      <if test="tljSelf != null">um_tlj_self,</if>
      <if test="createTime != null">um_create_time,</if>
      <if test="updateTime != null">um_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
      <if test="tlj != null">#{tlj,jdbcType=DECIMAL},</if>
      <if test="tljSelf != null">#{tljSelf,jdbcType=DECIMAL},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserMoneyExtra">update yeshi_ec_user_money_extra set um_tlj = #{tlj,jdbcType=DECIMAL},um_tlj_self = #{tljSelf,jdbcType=DECIMAL},um_create_time = #{createTime,jdbcType=TIMESTAMP},um_update_time = #{updateTime,jdbcType=TIMESTAMP} where um_uid = #{uid,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserMoneyExtra">update yeshi_ec_user_money_extra
    <set>
      <if test="tlj != null">um_tlj=#{tlj,jdbcType=DECIMAL},</if>
      <if test="tljSelf != null">um_tlj_self=#{tljSelf,jdbcType=DECIMAL},</if>
      <if test="createTime != null">um_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">um_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where um_uid = #{uid,jdbcType=BIGINT}
  </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java
@@ -81,9 +81,9 @@
    }
    @Override
    public List<GoodsClass> listquery() throws Exception {
    public List<GoodsClass> listquery(Integer sex) throws Exception {
        List<GoodsClass> list = goodsClassMapper.getGoodsClassAll();
        List<GoodsClass> list = goodsClassMapper.getGoodsClassAll(sex);
        if (list != null && list.size() == 0) {
            return list;
@@ -135,7 +135,7 @@
    }
    public List<GoodsClass> getGoodsClassAll() {
        return goodsClassMapper.getGoodsClassAll();
        return goodsClassMapper.getGoodsClassAll(null);
    }
    @Override
@@ -146,7 +146,12 @@
        if (name == null || name.trim().length() == 0) {
            throw new GoodsClassException(1, "分类名称不能为空");
        }
        Integer sex = record.getSex();
        if (sex == null) {
            throw new GoodsClassException(1, "性别设置不能为空");
        }
        // 图片上传
        String picture = null;
        if (file != null) {
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/HomeNavbarServiceImpl.java
@@ -73,14 +73,24 @@
            throw new HomeNavbarException(1, "控制时间不能为空");
        }
        
        Integer sex = null;
        NavbarTypeEnum type = record.getType();
        if (NavbarTypeEnum.category.equals(type)) {
            Long classId = record.getClassId();
            if (classId == null) {
                throw new HomeNavbarException(1, "请选择分类");
            }
            record.setUrl(null);
            
            GoodsClass goodsClass = goodsClassService.getGoodsClass(record.getClassId());
            if (goodsClass == null) {
                throw new HomeNavbarException(1, "分类不存在");
            }
            sex = goodsClass.getSex();
            if (sex == null) {
                throw new HomeNavbarException(1, "分类未指定适用版本");
            }
            record.setUrl(null);
        } else if(NavbarTypeEnum.weex.equals(type) || NavbarTypeEnum.web.equals(type)) {
            String url = record.getUrl();
            if (url == null || url.trim().length() == 0) {
@@ -115,8 +125,11 @@
            if (state == null) {
                record.setState(0);
            }
            int maxOrder = homeNavbarMapper.getMaxOrder();
            record.setOrderby(maxOrder + 1);
            record.setOrderby(homeNavbarMapper.getDefaultMaxOrder() + 1);
            record.setOrderMan(homeNavbarMapper.getManMaxOrder() + 1);
            record.setOrderWoman(homeNavbarMapper.getWomanMaxOrder() + 1);
            record.setIsFixed(false);//目前无固定项
            homeNavbarMapper.insert(record);
        } else {
@@ -136,14 +149,16 @@
            }
            
            record.setOrderby(resultObj.getOrderby());
            record.setOrderMan(resultObj.getOrderMan());
            record.setOrderWoman(resultObj.getOrderWoman());
            record.setCreatetime(resultObj.getCreatetime());
            record.setUpdatetime(new Date());
            record.setIsFixed(false);//目前无固定项
            homeNavbarMapper.updateByPrimaryKey(record);
        }
    }
    /**
     * 上传图片
     * @param file
@@ -208,7 +223,7 @@
    }
    
    @Override
    public void updateOrder(Long id, Integer moveType) throws HomeNavbarException, Exception{
    public void updateOrder(Long id, Integer moveType, Integer sex) throws HomeNavbarException, Exception{
        if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
            throw new HomeNavbarException(1, "传递的类型不正确");
@@ -218,32 +233,54 @@
            throw new HomeNavbarException(1, "ID不能为空");
        }
        
        HomeNavbar resultObj = homeNavbarMapper.selectByPrimaryKey(id);
        if (resultObj == null) {
            throw new HomeNavbarException(1, "操作数据已不存在");
        }
            
        Integer oldOrder = resultObj.getOrderby();
        HomeNavbar changeObj = homeNavbarMapper.getChangeOrder(moveType, oldOrder);
        if (sex == null) {
            sex = GoodsClass.SEX_DEFAULT;
        }
        HomeNavbar changeObj = null;
        if (GoodsClass.SEX_ALL == sex || GoodsClass.SEX_DEFAULT == sex) {
            changeObj = homeNavbarMapper.getDefaultChangeOrder(moveType,  resultObj.getOrderby());
            if (changeObj == null ) {
                throw new HomeNavbarException(1, "已经在最边缘,无可交换的位置");
            }
            resultObj.setOrderby(changeObj.getOrderby());
            changeObj.setOrderby(resultObj.getOrderby());
        } else if (GoodsClass.SEX_MAN == sex) {
            changeObj = homeNavbarMapper.getManChangeOrder(moveType,  resultObj.getOrderMan());
            if (changeObj == null ) {
                throw new HomeNavbarException(1, "已经在最边缘,无可交换的位置");
            }
            resultObj.setOrderMan(changeObj.getOrderMan());
            changeObj.setOrderMan( resultObj.getOrderMan());
        } else if (GoodsClass.SEX_WOMAN == sex) {
            changeObj = homeNavbarMapper.getWomanChangeOrder(moveType,  resultObj.getOrderWoman());
            if (changeObj == null ) {
                throw new HomeNavbarException(1, "已经在最边缘,无可交换的位置");
            }
            resultObj.setOrderWoman(changeObj.getOrderWoman());
            changeObj.setOrderWoman( resultObj.getOrderWoman());
        }
        
        if (changeObj == null ) {
            throw new HomeNavbarException(1, "已经在最边缘,无可交换的位置");
            throw new HomeNavbarException(1, "无可交换的位置");
        }
        // 交换排序序号
        resultObj.setOrderby(changeObj.getOrderby());
        changeObj.setOrderby(oldOrder);
        
        homeNavbarMapper.updateByPrimaryKeySelective(changeObj);
        homeNavbarMapper.updateByPrimaryKeySelective(resultObj);
    }
    
    @Override
    public List<HomeNavbar> listQuery(long start, int count, String key) {
    public List<HomeNavbar> listQuery(long start, int count, String key, Integer sex) {
        
        List<HomeNavbar> listObj = homeNavbarMapper.listQuery(start, count, key);
        List<HomeNavbar> listObj = homeNavbarMapper.listQuery(start, count, key, sex);
        if (listObj == null || listObj.size() == 0) {
            return null;
        }
@@ -297,8 +334,8 @@
    }
    
    @Override
    public long countlistQuery(String key) {
        return homeNavbarMapper.countListQuery(key);
    public long countlistQuery(String key, Integer sex) {
        return homeNavbarMapper.countListQuery(key, sex);
    }
    @Override
@@ -313,8 +350,6 @@
    public List<HomeNavbar> listQueryDefaultNavbar(Integer sex) {
        return homeNavbarMapper.listQueryDefaultNavbar(sex);
    }
    
    
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialCardServiceImpl.java
@@ -184,7 +184,7 @@
        }
        
        for (SpecialCard specialCard: listObj) {
            long totalSpecial= specialService.countlistQueryByCard(specialCard.getId(), null);
            long totalSpecial= specialService.countlistQueryByCard(specialCard.getId(), null, null);
            specialCard.setTotalSpecial(totalSpecial);
            
            Date startTime = specialCard.getStartTime();
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java
@@ -68,7 +68,12 @@
        if (name == null || name.trim().length() == 0) {
            throw new SpecialException(1, "专题名称不能为空");
        }
        Integer sex = record.getSex();
        if (sex == null) {
            throw new SpecialException(1, "性别不能为空");
        }
        String params = record.getParams();
        if (params == null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) {
            record.setParams(null);
@@ -76,6 +81,8 @@
            throw new SpecialException(1, "跳转参数非JSON格式");
        }
        if (!StringUtil.isNullOrEmpty(jumpType)) {
            List<JumpDetailV2> listByType = jumpDetailV2Service.listByType(jumpType);
            if (listByType != null && listByType.size() > 0) {
@@ -111,10 +118,12 @@
            record.setIcon(icon);
            record.setPicture(picture);
            record.setSubPicture(subPicture);
            int maxOrder = specialMapper.getMaxOrderByCard(cardId);
            record.setOrderby(maxOrder + 1);
            // 排序
            record.setOrderby(specialMapper.getDefaultMaxOrder(cardId) + 1);
            record.setOrderMan(specialMapper.getManMaxOrder(cardId) + 1);
            record.setOrderWoman(specialMapper.getWomanMaxOrder(cardId) + 1);
            record.setCreatetime(new Date());
            record.setUpdatetime(new Date());
            specialMapper.insert(record);
@@ -168,9 +177,12 @@
            } else {
                record.setIcon(resultObj.getIcon());
            }
            record.setOrderby(resultObj.getOrderby());
            record.setOrderMan(resultObj.getOrderMan());
            record.setOrderWoman(resultObj.getOrderWoman());
            record.setCreatetime(resultObj.getCreatetime());
            record.setUpdatetime(new Date());
            specialMapper.updateByPrimaryKey(record);
        }
@@ -212,9 +224,9 @@
    @Override
    @Transactional
    public void updateOrder(Long id, Integer moveType) throws SpecialException {
    public void updateOrder(Long id, Integer moveType, Integer sex) throws SpecialException {
        if (id == null || moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
        if (id == null || moveType == null || (!moveType.equals(1) && !moveType.equals(-1)) || sex == null) {
            throw new SpecialException(1, "请传递正确参数");
        }
@@ -223,22 +235,41 @@
            throw new SpecialException(1, "此内容已不存在");
        }
        Integer order = resultObj.getOrderby();
        Long cardId = resultObj.getCardId();
        // 获取交换对象
        Special exchangeObject = specialMapper.getOrderByCardID(cardId, moveType, order);
        if (exchangeObject == null) {
            if (moveType == 1) {
                throw new SpecialException(1, "在相同使用地方中优先级已经最低了");
            } else {
                throw new SpecialException(1, "在相同使用地方中优先级已经最高了");
        Special exchangeObject = null;
        if (Special.SEX_ALL == sex || Special.SEX_DEFAULT == sex) {
            Integer orderby = resultObj.getOrderby();
            exchangeObject = specialMapper.getOrderByCardID(cardId, moveType, orderby, sex);
            if (exchangeObject == null) {
                throw new SpecialException(1, "没有找到可交换的位置");
            }
            resultObj.setOrderby(exchangeObject.getOrderby());
            exchangeObject.setOrderby(orderby);
        } else if (Special.SEX_MAN == sex ) {
            Integer orderMan = resultObj.getOrderMan();
            exchangeObject = specialMapper.getOrderByCardID(cardId, moveType, orderMan, sex);
            if (exchangeObject == null) {
                throw new SpecialException(1, "没有找到可交换的位置");
            }
            resultObj.setOrderMan(exchangeObject.getOrderMan());
            exchangeObject.setOrderMan(orderMan);
        } else if (Special.SEX_WOMAN == sex ) {
            Integer orderWoman = resultObj.getOrderWoman();
            exchangeObject = specialMapper.getOrderByCardID(cardId, moveType, orderWoman, sex);
            if (exchangeObject == null) {
                throw new SpecialException(1, "没有找到可交换的位置");
            }
            resultObj.setOrderWoman(exchangeObject.getOrderWoman());
            exchangeObject.setOrderWoman(orderWoman);
        } else {
            throw new SpecialException(1, "sex参数不正确");
        }
        resultObj.setOrderby(exchangeObject.getOrderby());
        exchangeObject.setOrderby(order);
        specialMapper.updateByPrimaryKey(resultObj);
        specialMapper.updateByPrimaryKey(exchangeObject);
    }
@@ -280,9 +311,9 @@
    }
    @Override
    public List<Special> listQueryByCard(long start, int count, Long card, String key) {
    public List<Special> listQueryByCard(long start, int count, Long card, String key, Integer sex) {
        List<Special> list = specialMapper.listQueryByCard(start, count, card, key);
        List<Special> list = specialMapper.listQueryByCard(start, count, card, key, sex);
        if (list == null || list.size() == 0) {
            return list;
        }
@@ -312,8 +343,8 @@
    }
    @Override
    public long countlistQueryByCard(Long card, String key) {
        return specialMapper.countlistQueryByCard(card, key);
    public long countlistQueryByCard(Long card, String key, Integer sex) {
        return specialMapper.countlistQueryByCard(card, key, sex);
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinDetailServiceImpl.java
New file
@@ -0,0 +1,224 @@
package com.yeshi.fanli.service.impl.tlj;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinDetailMapper;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.vo.tlj.TaoLiJinDetailVO;
import com.yeshi.fanli.vo.tlj.TaoLiJinMonthVO;
@Service
public class UserTaoLiJinDetailServiceImpl implements UserTaoLiJinDetailService{
    @Resource
    private UserTaoLiJinDetailMapper userTaoLiJinDetailMapper;
    @Override
    public void insertSelective(UserTaoLiJinDetail record) {
        userTaoLiJinDetailMapper.insertSelective(record);
    }
    @Override
    public Long countDetail(long uid) {
        return userTaoLiJinDetailMapper.countDetail(uid);
    }
    @Override
    public BigDecimal countUseMoneyByDate(long uid, int dateType) {
        return userTaoLiJinDetailMapper.countUseMoneyByDate(uid, dateType);
    }
    @Override
    public List<TaoLiJinDetailVO> listUserMoneyDetailForClient(Long uid, Long detailId, Date maxTime) {
        List<TaoLiJinDetailVO> finalList = new ArrayList<>();
        List<UserTaoLiJinDetail> list = null;
        if (detailId == null) {// 首次请求
            if (maxTime == null)// 没有筛选时间
            {
                list = userTaoLiJinDetailMapper.selectByMaxCreateTime(uid,
                        new Date(System.currentTimeMillis() + 1000 * 60 * 60L), 20);
            } else {// 筛选了时间
                list = userTaoLiJinDetailMapper.selectByMaxCreateTime(uid, maxTime, 20);
            }
            if (list != null && list.size() > 0) {
                Calendar calendar = Calendar.getInstance();
                calendar.setTimeInMillis(list.get(0).getCreateTime().getTime());
                TaoLiJinDetailVO vo = new TaoLiJinDetailVO();
                vo.setMonth(new TaoLiJinMonthVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1));
                finalList.add(vo);
            } else {
                if (maxTime != null) {//
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(maxTime.getTime());
                    TaoLiJinDetailVO vo = new TaoLiJinDetailVO();
                    vo.setMonth(new TaoLiJinMonthVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1));
                    vo.getMonth().setExpend("0");
                    vo.getMonth().setIncome("0");
                    finalList.add(vo);
                }
            }
        } else {// 二次请求
            int size = 21;
            List<UserTaoLiJinDetail> tempList = userTaoLiJinDetailMapper.selectByUidWithIndexId(uid, detailId, size);
            Set<Date> dateSet = new HashSet<>();// 用于储存是否在同一时间上面(精确到秒)
            if (tempList.size() > 0) {
                for (UserTaoLiJinDetail umd : tempList) {
                    dateSet.add(umd.getCreateTime());
                }
                List<UserTaoLiJinDetail> tempList2 = new ArrayList<>();
                while (dateSet.size() == 1 && tempList2.size() != tempList.size() && size < 40) {// 只有一个时间点的数据
                    tempList = tempList2;
                    size += 10;
                    tempList2 = userTaoLiJinDetailMapper.selectByUidWithIndexId(uid, detailId, size);
                    dateSet.clear();
                    for (UserTaoLiJinDetail umd : tempList2) {
                        dateSet.add(umd.getCreateTime());
                    }
                }
                if (tempList2.size() > 0)
                    tempList = tempList2;
            }
            for (int i = 0; i < tempList.size(); i++) {
                if (tempList.get(i).getId().longValue() == detailId) {
                    tempList.remove(i);
                    break;
                } else {
                    tempList.remove(i);
                    i--;
                }
            }
            list = tempList;
        }
        if (list != null) {
            if (detailId != null && list.size() > 0) {
                UserTaoLiJinDetail umd = userTaoLiJinDetailMapper.selectByPrimaryKey(detailId);
                if (!TimeUtil.getGernalTime(umd.getCreateTime().getTime(), "yyyy-MM")
                        .equalsIgnoreCase(TimeUtil.getGernalTime(list.get(0).getCreateTime().getTime(), "yyyy-MM"))) {
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(list.get(0).getCreateTime().getTime());
                    TaoLiJinDetailVO vo = new TaoLiJinDetailVO();
                    vo.setMonth(new TaoLiJinMonthVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1));
                    finalList.add(vo);
                }
            }
            for (int i = 0; i < list.size(); i++) {
                if (i > 0 && !TimeUtil.getGernalTime(list.get(i - 1).getCreateTime().getTime(), "yyyy-MM")
                        .equalsIgnoreCase(TimeUtil.getGernalTime(list.get(i).getCreateTime().getTime(), "yyyy-MM"))) {// 本条数据与上条数据不是同一月则插入月份
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(list.get(i).getCreateTime().getTime());
                    TaoLiJinDetailVO vo = new TaoLiJinDetailVO();
                    vo.setMonth(new TaoLiJinMonthVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1));
                    finalList.add(vo);
                }
                TaoLiJinDetailVO vo = new TaoLiJinDetailVO();
                vo.setDetail(list.get(i));
                finalList.add(vo);
            }
        }
        // 统计月资金
        Map<Integer, TaoLiJinDetailVO> monthMap = new TreeMap<>();
        if (finalList.size() > 1)
            for (int i = 0; i < finalList.size(); i++) {
                if (finalList.get(i).getMonth() != null)
                    monthMap.put(i, finalList.get(i));
            }
        if (!monthMap.isEmpty()) {
            List<String> dateFormat = new ArrayList<>();
            Iterator<Integer> keys = monthMap.keySet().iterator();
            while (keys.hasNext()) {
                Integer key = keys.next();
                String date = "";
                date += monthMap.get(key).getMonth().getYear();
                date += "-";
                date += (monthMap.get(key).getMonth().getMonth() + "").length() < 2
                        ? "0" + monthMap.get(key).getMonth().getMonth() : monthMap.get(key).getMonth().getMonth();
                dateFormat.add(date);
            }
            List<TaoLiJinMonthVO> voList = userTaoLiJinDetailMapper.selectMonthMoneyByUid(uid, dateFormat);
            int p = 0;
            keys = monthMap.keySet().iterator();
            while (keys.hasNext()) {
                Integer key = keys.next();
                // 去除支出负号
                finalList.get(key).getMonth().setExpend(voList.get(p).getExpend().replace("-", ""));
                finalList.get(key).getMonth().setIncome(voList.get(p).getIncome());
                p++;
            }
        }
        return finalList;
    }
    @Override
    public long countUserMoneyDetailForClient(Long uid, Long detailId, Date maxTime) {
        long monthCount = 0L;
        long detailCount = 0L;
        // 未通过时间筛选,查询所有
        if (maxTime == null) {
            detailCount = userTaoLiJinDetailMapper.selectCountByUid(uid);
            // 用于表示当前所有
            monthCount = userTaoLiJinDetailMapper.selectMonthCountByUid(uid, new Date(System.currentTimeMillis() + 1000 * 60 * 60L));
        } else {// 通过时间筛选了的,需要查询所有
            detailCount = userTaoLiJinDetailMapper.selectCountByUidAndMaxCreateTime(uid, maxTime);
            monthCount = userTaoLiJinDetailMapper.selectMonthCountByUid(uid, maxTime);
        }
        return monthCount + detailCount;
    }
    @Override
    public void createAddDetail(UserTaoLiJinOrigin taoLiJinOrigin) {
        UserTaoLiJinDetail detail = new UserTaoLiJinDetail();
        detail.setUid(taoLiJinOrigin.getUid());
        detail.setMoney(taoLiJinOrigin.getMoney());
        // 红包退回
        if (taoLiJinOrigin.getOrigin().equals(TaoLiJinOriginEnum.refund)) {
            detail.setType(TaoLiJinDetailTypeEnum.reduce);
            detail.setTitle(TaoLiJinDetailTypeEnum.reduce.getDesc());
        } else {
            detail.setType(TaoLiJinDetailTypeEnum.add);
            detail.setTitle(TaoLiJinDetailTypeEnum.add.getDesc());
            String desc = taoLiJinOrigin.getOrigin().getDesc();
            if (taoLiJinOrigin.getOrigin().equals(TaoLiJinOriginEnum.newbiesWin) && taoLiJinOrigin.getType() == 1) {
                desc = "分享红包"; // 老用户看到的是分享红包
            }
            detail.setDescInfo("来源:" + desc);
        }
        detail.setCreateTime(new Date());
        userTaoLiJinDetailMapper.insertSelective(detail);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java
New file
@@ -0,0 +1,462 @@
package com.yeshi.fanli.service.impl.tlj;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinOriginMapper;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.UserRank;
import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserMoneyExtraService;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.StringUtil;
@Service
public class UserTaoLiJinOriginServiceImpl implements UserTaoLiJinOriginService{
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource
    private UserTaoLiJinOriginMapper userTaoLiJinOriginMapper;
    @Resource
    private UserMoneyExtraService userMoneyExtraService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private UserTaoLiJinDetailService userTaoLiJinDetailService;
    @Resource
    private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService;
    @Resource
    private UserOtherMsgNotificationService userOtherMsgNotificationService;
    @Resource
    private ConfigTaoLiJinService configTaoLiJinService;
    @Resource
    private UserTaoLiJinRecordService userTaoLiJinRecordService;
    @Override
    public void updateByPrimaryKeySelective(UserTaoLiJinOrigin record) {
        userTaoLiJinOriginMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public BigDecimal countMoneyByDate(long uid, int dateType) {
        return userTaoLiJinOriginMapper.countMoneyByDate(uid, dateType);
    }
    @Override
    public long countByUidAndOrigin(long uid, String origin) {
        return userTaoLiJinOriginMapper.countByUidAndOrigin(uid, origin);
    }
    @Override
    public UserTaoLiJinOrigin getByUidAndOrigin(long uid, String origin) {
        return userTaoLiJinOriginMapper.getByUidAndOrigin(uid, origin);
    }
    @Override
    public UserTaoLiJinOrigin getRankByThisMonth(long uid, String type) {
        return userTaoLiJinOriginMapper.getRankByThisMonth(uid, type);
    }
    @Override
    public boolean hasRankHongBao(long uid) {
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra == null) {
            return false;
        }
        // 等级验证
        UserRank userRank = userInfoExtra.getUserRank();
        if (userRank == null || userRank.getId() <= 1) {
            return false;
        }
        // 是否已领取
        long countRan = userTaoLiJinOriginMapper.countRankByThisMonth(uid);
        if (countRan > 0) {
            return false;
        }
        return true;
    }
    @Override
    public void synchDeviceHongbao(long uid, String device) {
        // 是否已领取
        long count = userTaoLiJinOriginMapper.countByUidAndType(uid, TaoLiJinOriginEnum.newbiesWin.name());
        if (count > 0) {
            return;
        }
        // 设备是否已领取
        DeviceTaoLiJinRecord record = deviceTaoLiJinRecordService.getByDevice(device);
        if (record == null) {
            return;
        }
        try {
            addNewbiesWinMoney(uid);
        } catch (UserTaoLiJinOriginException e) {
            LogHelper.errorDetailInfo(e);
        }
    }
    @Override
    @Transactional
    public UserTaoLiJinOrigin addNewbiesWinMoney(Long uid) throws UserTaoLiJinOriginException{
        if (uid == null) {
            throw new UserTaoLiJinOriginException(1, "参数不能为空");
        }
        String value = configTaoLiJinService.getValueByKey("hongbao_newbies");
        if (StringUtil.isNullOrEmpty(value)) {
            throw new UserTaoLiJinOriginException(1, "系统红包不存在");
        }
        BigDecimal money = new BigDecimal(value);
        // 是否可以自购
        boolean canSelfBuy = userInfoExtraService.isNewUser(uid);
        // 添加用户红包
        userMoneyExtraService.addTaoLiJin(uid, money, canSelfBuy);
        // 添加新增记录
        UserTaoLiJinOrigin origin = saveOrigin(uid, canSelfBuy?2:1, money, TaoLiJinOriginEnum.newbiesWin);
        // 红包明细
        userTaoLiJinDetailService.createAddDetail(origin);
        // 消息
        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    String source = "";
                    if(canSelfBuy) {
                        source = "新人红包";
                    } else {
                        source = "分享红包";
                    }
                    MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
                    content.setState("红包增加");
                    content.setSource(source);
                    content.setMoney(money);
                    userOtherMsgNotificationService.taoLiJinMsg(uid, "", content);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
            }
        });
        return origin;
    }
    @Override
    @Transactional
    public UserTaoLiJinOrigin  addRankWinMoney(Long uid, UserRank userRank) throws UserTaoLiJinOriginException{
        if (uid == null || userRank == null) {
            throw new UserTaoLiJinOriginException(1, "参数不能为空");
        }
        String key = "";
        if (userRank.getId() == 2) {
            key = "hongbao_rank_silver";
        } else if (userRank.getId() == 3) {
            key = "hongbao_rank_gold";
        } else if (userRank.getId() == 4) {
            key = "hongbao_rank_platinum";
        } else {
            throw new UserTaoLiJinOriginException(2, "用户等级不足");
        }
        String value = configTaoLiJinService.getValueByKey(key);
        if (StringUtil.isNullOrEmpty(value)) {
            throw new UserTaoLiJinOriginException(1, "系统红包不存在");
        }
        BigDecimal money = new BigDecimal(value);
        // 添加红包余额
        userMoneyExtraService.addTaoLiJin(uid, money, false);
        // 添加新增记录
        UserTaoLiJinOrigin origin = saveOrigin(uid, 1, money, TaoLiJinOriginEnum.rankWin);
        // 红包明细
        userTaoLiJinDetailService.createAddDetail(origin);
        // 消息
        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    String beizhu = "上月账户等级" + userRank.getName();
                    MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
                    content.setState("红包增加");
                    content.setSource("账户等级福利");
                    content.setMoney(money);
                    userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
            }
        });
        return origin;
    }
    @Override
    @Transactional
    public UserTaoLiJinOrigin addInviteWinMoney(Long uid, String inviteName) throws UserTaoLiJinOriginException{
        if (uid == null || StringUtil.isNullOrEmpty(inviteName)) {
            throw new UserTaoLiJinOriginException(1, "参数不能为空");
        }
        String value = configTaoLiJinService.getValueByKey("hongbao_invite");
        if (StringUtil.isNullOrEmpty(value)) {
            throw new UserTaoLiJinOriginException(1, "系统红包不存在");
        }
        BigDecimal money = new BigDecimal(value);
        // 添加用户红包
        userMoneyExtraService.addTaoLiJin(uid, money, false);
        // 添加新增记录
        UserTaoLiJinOrigin origin = saveOrigin(uid, 1, money, TaoLiJinOriginEnum.inviteWin);
        // 红包明细
        userTaoLiJinDetailService.createAddDetail(origin);
        // 消息
        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    String beizhu = "成功邀请队员" + inviteName;
                    MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
                    content.setState("红包增加");
                    content.setSource("邀请队员奖励");
                    content.setMoney(money);
                    userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
            }
        });
        return origin;
    }
    @Override
    @Transactional
    public UserTaoLiJinOrigin addShareWinMoney(Long uid) throws UserTaoLiJinOriginException{
        if (uid == null) {
            throw new UserTaoLiJinOriginException(1, "用户未登录");
        }
        String value = configTaoLiJinService.getValueByKey("hongbao_share");
        if (StringUtil.isNullOrEmpty(value)) {
            throw new UserTaoLiJinOriginException(1, "系统红包不存在");
        }
        BigDecimal money = new BigDecimal(value);
        // 添加用户红包
        userMoneyExtraService.addTaoLiJin(uid, money, false);
        // 添加新增记录
        UserTaoLiJinOrigin origin = saveOrigin(uid, 1, money, TaoLiJinOriginEnum.shareWin);
        // 红包明细
        userTaoLiJinDetailService.createAddDetail(origin);
        // 消息
        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    String beizhu = "近30天产生过分享(仅一次奖励)";
                    MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
                    content.setState("红包增加");
                    content.setSource("分享订单奖励");
                    content.setMoney(money);
                    userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
            }
        });
        return origin;
    }
    // 添加新增记录
    public UserTaoLiJinOrigin saveOrigin(Long uid, int type, BigDecimal money, TaoLiJinOriginEnum originEnum) {
        UserTaoLiJinOrigin taoLiJinOrigin = new UserTaoLiJinOrigin();
        taoLiJinOrigin.setUid(uid);
        taoLiJinOrigin.setType(type);
        taoLiJinOrigin.setOrigin(originEnum);
        taoLiJinOrigin.setMoney(money);
        taoLiJinOrigin.setMoneySurplus(money);
        taoLiJinOrigin.setCreateTime(new Date());
        taoLiJinOrigin.setUpdateTime(new Date());
        taoLiJinOrigin.setRemark(originEnum.getDesc());
        userTaoLiJinOriginMapper.insertSelective(taoLiJinOrigin);
        return taoLiJinOrigin;
    }
    @Override
    @Transactional
    public void  refundMoney(UserTaoLiJinReport report) throws UserTaoLiJinOriginException{
        if (report == null) {
            throw new UserTaoLiJinOriginException(1, "参数不能为空");
        }
        String rightsId = report.getId();
        BigDecimal refundAmount = report.getRefundAmount();
        // 已退回的金额
        BigDecimal moneyOrigin = userTaoLiJinOriginMapper.countMoneyByOrigin(rightsId, TaoLiJinOriginEnum.refund.name());
        if (refundAmount.compareTo(moneyOrigin) < 1) {
            return;
        }
        // 查询用户信息
        UserTaoLiJinRecord record = userTaoLiJinRecordService.getByRightsId(rightsId);
        if (record == null) {
            return;
        }
        Long uid = record.getUid();
        // 计算本次退回的金额
        BigDecimal money = MoneyBigDecimalUtil.sub(refundAmount, moneyOrigin);
        // 添加用户红包
        userMoneyExtraService.addTaoLiJin(uid, money, false);
        // 添加新增记录
        UserTaoLiJinOrigin taoLiJinOrigin = new UserTaoLiJinOrigin();
        taoLiJinOrigin.setUid(uid);
        taoLiJinOrigin.setType(1);
        taoLiJinOrigin.setRightsId(rightsId);
        taoLiJinOrigin.setMoney(money);
        taoLiJinOrigin.setMoneySurplus(money);
        taoLiJinOrigin.setOrigin(TaoLiJinOriginEnum.refund);
        taoLiJinOrigin.setRemark(TaoLiJinOriginEnum.refund.getDesc());
        taoLiJinOrigin.setCreateTime(new Date());
        taoLiJinOrigin.setUpdateTime(new Date());
        userTaoLiJinOriginMapper.insertSelective(taoLiJinOrigin);
        // 红包明细
        userTaoLiJinDetailService.createAddDetail(taoLiJinOrigin);
        // 消息
        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    String beizhu = "共创建:" + record.getTotalNum() + "个,已领取"+report.getWinNum()+"个,剩余"+report.getRefundNum()+ "个退回";
                    SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd hh.mm");
                    String time = sd.format(record.getCreateTime());
                    MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
                    content.setState("红包退回");
                    content.setSource(time + " 创建的分享记录");
                    content.setMoney(money);
                    userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
            }
        });
    }
    @Override
    public void overdueHongBao(Long uid) {
        // 15天前过期
        Date date = null;
        try {
            date = DateUtil.reduceDay(15, new Date());
        } catch (ParseException e) {
            e.printStackTrace();
        }
        if (date == null) {
            return;
        }
        List<UserTaoLiJinOrigin> list = userTaoLiJinOriginMapper.getOverdueTaoLiJin(uid, date);
        if (list == null || list.size() == 0) {
            return;
        }
        BigDecimal total = new BigDecimal(0);
        for (UserTaoLiJinOrigin userTaoLiJinOrigin: list) {
            UserTaoLiJinOrigin origin = new UserTaoLiJinOrigin();
            origin.setId(userTaoLiJinOrigin.getId());
            origin.setMoneySurplus(new BigDecimal(0));
            origin.setUpdateTime(new Date());
            userTaoLiJinOriginMapper.updateByPrimaryKeySelective(origin);
            total = MoneyBigDecimalUtil.add(total, userTaoLiJinOrigin.getMoneySurplus());
        }
        // 插入明细
        UserTaoLiJinDetail detail = new UserTaoLiJinDetail();
        detail.setUid(uid);
        detail.setMoney(new BigDecimal("-" + total.toString()));
        detail.setTitle(TaoLiJinDetailTypeEnum.sendBack.getDesc());
        detail.setType(TaoLiJinDetailTypeEnum.sendBack);
        detail.setCreateTime(date);
        userTaoLiJinDetailService.insertSelective(detail);
        // 消息
        final BigDecimal totalMoney = total;
        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
                    content.setState("红包扣除");
                    content.setSource("15天内未产生过推广红包分享记录");
                    content.setMoney(totalMoney);
                    userOtherMsgNotificationService.taoLiJinMsg(uid, "清除后无法恢复", content);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
            }
        });
    }
    @Override
    public List<UserTaoLiJinOrigin> getSurplusLiJin(long uid) {
        return userTaoLiJinOriginMapper.getSurplusLiJin(uid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java
New file
@@ -0,0 +1,386 @@
package com.yeshi.fanli.service.impl.tlj;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.BigDecimalUtil;
import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinRecordMapper;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.dto.taobao.TaoLiJinDTO;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord;
import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
import com.yeshi.fanli.service.inter.tlj.GoodsTaoLiJinRateService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService;
import com.yeshi.fanli.service.inter.user.UserMoneyExtraService;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.factory.CommonGoodsFactory;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import com.yeshi.fanli.vo.user.UserTaoLiJinRecordVO;
@Service
public class UserTaoLiJinRecordServiceImpl implements UserTaoLiJinRecordService {
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource
    private RedisManager redisManager;
    @Resource
    private UserTaoLiJinRecordMapper userTaoLiJinRecordMapper;
    @Resource
    private CommonGoodsService commonGoodsService;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private UserMoneyExtraService userMoneyExtraService;
    @Resource
    private UserTaoLiJinReportService userTaoLiJinReportService;
    @Resource
    private UserTaoLiJinDetailService userTaoLiJinDetailService;
    @Resource
    private UserTaoLiJinOriginService userTaoLiJinOriginService;
    @Resource
    private GoodsTaoLiJinRateService goodsTaoLiJinRateService;
    @Resource
    private UserOtherMsgNotificationService userOtherMsgNotificationService;
    @Override
    public UserTaoLiJinRecord  selectByPrimaryKey(Long id){
        return userTaoLiJinRecordMapper.selectByPrimaryKey(id);
    }
    @Override
    public UserTaoLiJinRecord createSelfBuyTaoLiJin(Long uid, int totalNum, TaoBaoGoodsBrief goods) throws UserTaoLiJinRecordException{
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String date_str = format.format(date);
        String sendEndTime_str = date_str + " 22:00:00";
        String useEndTime_str = date_str + " 23:59:59";
        /* 创建淘礼金 */
        String name = "自购淘礼金红包";
        // 发放开始时间
        Date sendStartTime = date;
        // 发放截止时间 - 分享当日22:00
        Date sendEndTime = null;
        // 使用结束日期 - 分享当日 23:59
        Date useEndTime = null;
        try {
            sendEndTime = formatStr.parse(sendEndTime_str);
            useEndTime = formatStr.parse(useEndTime_str);
        } catch (ParseException e2) {
            e2.printStackTrace();
        }
        BigDecimal perface = goodsTaoLiJinRateService.getGoodsSpreadMoney(goods);
        return createUserTaoLiJin(1, uid, goods.getAuctionId(), perface, 1, name, sendStartTime,
                    sendEndTime, null, useEndTime);
    }
    @Override
    public UserTaoLiJinRecord createShareTaoLiJin(Long uid, int totalNum, TaoBaoGoodsBrief goods) throws UserTaoLiJinRecordException{
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String date_str = format.format(date);
        String sendEndTime_str = date_str + " 22:00:00";
        String useEndTime_str = date_str + " 23:59:59";
        /* 创建淘礼金 */
        String name = "分享淘礼金红包";
        // 发放开始时间
        Date sendStartTime = date;
        // 发放截止时间 - 分享当日22:00
        Date sendEndTime = null;
        // 使用结束日期 - 分享当日 23:59
        Date useEndTime = null;
        try {
            sendEndTime = formatStr.parse(sendEndTime_str);
            useEndTime = formatStr.parse(useEndTime_str);
        } catch (ParseException e2) {
            e2.printStackTrace();
        }
        BigDecimal perface = goodsTaoLiJinRateService.getGoodsSpreadMoney(goods);
        return createUserTaoLiJin(2, uid, goods.getAuctionId(), perface, totalNum, name, sendStartTime,
                    sendEndTime, null, useEndTime);
    }
    @Override
    @Transactional
    public UserTaoLiJinRecord createUserTaoLiJin(int origin, Long uid, Long auctionId, BigDecimal perface, int totalNum, String name,
            Date sendStartTime, Date sendEndTime, Date useStartTime, Date useEndTime) throws UserTaoLiJinRecordException{
        // 用户剩余可以淘礼金验证
        UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid);
        if (userMoneyExtra == null || userMoneyExtra.getTlj() == null) {
            throw new UserTaoLiJinRecordException(101, "红包余额不足");
        }
        // 过期
        userTaoLiJinOriginService.overdueHongBao(uid);
        BigDecimal tlj = userMoneyExtra.getTlj();
        BigDecimal totalMoney = MoneyBigDecimalUtil.mul(perface, new BigDecimal(totalNum));
        if (totalMoney.compareTo(tlj) > 0) {
            throw new UserTaoLiJinRecordException(101, "红包余额不足");
        }
        // 创建淘礼金红包
        TaoLiJinDTO taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(auctionId, name, perface, totalNum, sendStartTime, sendEndTime, useStartTime, useEndTime);
        if (taoLiJinDTO == null) {
            throw new UserTaoLiJinRecordException(101, "红包创建失败");
        }
        //  保存记录
        UserTaoLiJinRecord record = new UserTaoLiJinRecord();
        record.setUid(uid);
        record.setGoodsId(auctionId);
        record.setName(name);
        record.setPerFace(perface);
        record.setTotalNum(totalNum);
        record.setSendStartTime(sendStartTime);
        record.setSendEndTime(sendEndTime);
        record.setUseStartTime(useStartTime);
        record.setUseEndTime(useEndTime);
        record.setRightsId(taoLiJinDTO.getRightsId());
        record.setSendUrl(taoLiJinDTO.getSendUrl());
        record.setCreateTime(new Date());
        userTaoLiJinRecordMapper.insertSelective(record);
        // 剩余淘礼金
        BigDecimal surplusTlj = MoneyBigDecimalUtil.sub(tlj, totalMoney);
        UserMoneyExtra updateExtra = new UserMoneyExtra();
        updateExtra.setUid(uid);
        updateExtra.setTlj(surplusTlj);
        updateExtra.setUpdateTime(new Date());
        userMoneyExtraService.updateByPrimaryKeySelective(updateExtra);
        record.setSurplusMoney(surplusTlj);
        // 异步
        String rightsId = taoLiJinDTO.getRightsId();
        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    // 插入明细
                    UserTaoLiJinDetail detail = new UserTaoLiJinDetail();
                    detail.setUid(uid);
                    detail.setMoney(new BigDecimal("-" + totalMoney));
                    detail.setTitle(TaoLiJinDetailTypeEnum.reduce.getDesc());
                    detail.setType(TaoLiJinDetailTypeEnum.reduce);
                    detail.setCreateTime(new Date());
                    userTaoLiJinDetailService.insertSelective(detail);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
                // 成功使用红包
                try {
                    BigDecimal total = totalMoney;
                    BigDecimal lastMoney = null;
                    BigDecimal zero = new BigDecimal(0);
                    // 修改余额
                    List<UserTaoLiJinOrigin> list = userTaoLiJinOriginService.getSurplusLiJin(uid);
                    if (list != null && list.size() > 0) {
                        for (UserTaoLiJinOrigin taoLiJinOrigin: list) {
                            if (total.compareTo(zero) < 1 ) {
                                break;
                            }
                            BigDecimal moneySurplus = taoLiJinOrigin.getMoneySurplus();
                            lastMoney = total;
                            total = MoneyBigDecimalUtil.sub(total, moneySurplus);
                            if (total.compareTo(zero) >= 0 ) {
                                moneySurplus = zero;
                            } else {
                                moneySurplus = MoneyBigDecimalUtil.sub(moneySurplus, lastMoney);
                            }
                            UserTaoLiJinOrigin usertlj = new UserTaoLiJinOrigin();
                            usertlj.setId(taoLiJinOrigin.getId());
                            usertlj.setMoneySurplus(moneySurplus);
                            usertlj.setUpdateTime(new Date());
                            userTaoLiJinOriginService.updateByPrimaryKeySelective(usertlj);
                        }
                    }
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
                // 使用成功消息
                try {
                    String beizhu = "未被领取/使用的部分将会退回";
                    SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd hh.mm");
                    String time = sd.format(new Date());
                    MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
                    content.setState("红包扣除");
                    content.setSource(time + " 创建的分享记录");
                    content.setMoney(totalMoney);
                    userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
                // 创建报告
                try {
                    userTaoLiJinReportService.insertDefault(rightsId);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
                // 检测商品是否存在
                try {
                    CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(auctionId, CommonGoods.GOODS_TYPE_TB);
                    if (commonGoods == null) {
                        TaoBaoGoodsBrief taoBaoGoodsBrief = redisManager.getTaoBaoGoodsBrief(auctionId);
                        if (taoBaoGoodsBrief != null) {
                            commonGoodsService.addCommonGoods(CommonGoodsFactory.create(taoBaoGoodsBrief));
                        }
                    }
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
            }
        });
        return record;
    }
    @Override
    public List<UserTaoLiJinRecordVO> getRecordByUid(long start, int count, Long uid){
        List<UserTaoLiJinRecordVO> list = userTaoLiJinRecordMapper.getRecordByUid(start, count, uid);
        if (list == null || list.size() == 0) {
            return list;
        }
        List<Long> listGoodsId = new ArrayList<Long>();
        for (UserTaoLiJinRecordVO userTaoLiJinRecordVO: list) {
            listGoodsId.add(userTaoLiJinRecordVO.getAuctionId());
        }
        if (listGoodsId.size() == 0) {
            return null;
        }
        List<CommonGoods> listGoods = commonGoodsService.getByListGoodsId(listGoodsId);
        if (listGoods == null || listGoods.size() == 0) {
            return null;
        }
        // 组织相关数据
        for (UserTaoLiJinRecordVO userTaoLiJinRecordVO: list) {
            long auctionId = userTaoLiJinRecordVO.getAuctionId().longValue();
            // 商品信息
            for (int i = 0; i< listGoods.size(); i++) {
                CommonGoods commonGoods = listGoods.get(i);
                long goodsId = commonGoods.getGoodsId().longValue();
                if (auctionId == goodsId) {
                    userTaoLiJinRecordVO.setTitle(commonGoods.getTitle());
                    userTaoLiJinRecordVO.setPictUrl(commonGoods.getPicture());
                    if(CommonGoods.SHOP_TYPE_TB == commonGoods.getShopType()) {
                        userTaoLiJinRecordVO.setUserType(0);
                    } else {
                        userTaoLiJinRecordVO.setUserType(1);
                    }
                    listGoods.remove(i);
                    break;
                }
            }
            // 计算剩余未领取数量
            int winNum = userTaoLiJinRecordVO.getWinNum();
            int totalNum = userTaoLiJinRecordVO.getTotalNum();
            userTaoLiJinRecordVO.setSurplusNum(totalNum - winNum);
            // 计算分享奖金
            BigDecimal shareMoney = new BigDecimal(0);
            BigDecimal commission = userTaoLiJinRecordVO.getCommission();
            if (commission != null && commission.compareTo(shareMoney) > 1) {
                BigDecimal shareRate = hongBaoManageService.getShareRate();
                shareMoney = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(commission, new BigDecimal("0.01")), MoneyBigDecimalUtil.div(shareRate, new BigDecimal(100)));
                shareMoney = BigDecimalUtil.getWithNoZera(shareMoney);
            }
            ClientTextStyleVO desc = new ClientTextStyleVO();
            desc.setColor("#FFFFFF");
            desc.setContent("预估分享奖金:¥" + shareMoney);
            desc.setBottomColor("#E8AE48");
            userTaoLiJinRecordVO.setDesc(desc);
        }
        return list;
    }
    @Override
    public long countRecordByUid(Long uid) {
        return userTaoLiJinRecordMapper.countRecordByUid(uid);
    }
    @Override
    public long countTodayNum(Long uid) {
        return userTaoLiJinRecordMapper.countTodayNum(uid);
    }
    @Override
    public BigDecimal getShareHongBaoByUidAndGoodsId(Long uid, Long goodsId) {
        return userTaoLiJinRecordMapper.getShareHongBaoByUidAndGoodsId(uid, goodsId);
    }
    @Override
    public UserTaoLiJinRecord getByRightsId(String rightsId) {
        return userTaoLiJinRecordMapper.getByRightsId(rightsId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinReportServiceImpl.java
New file
@@ -0,0 +1,137 @@
package com.yeshi.fanli.service.impl.tlj;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinReportMapper;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport;
import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
@Service
public class UserTaoLiJinReportServiceImpl implements UserTaoLiJinReportService{
    @Resource
    private UserTaoLiJinReportMapper userTaoLiJinReportMapper;
    @Resource
    private UserTaoLiJinOriginService userTaoLiJinOriginService;
    @Override
    public void insertDefault(String rightsId) {
        if (StringUtil.isNullOrEmpty(rightsId)) {
            return;
        }
        UserTaoLiJinReport report = new UserTaoLiJinReport();
        report.setId(rightsId);
        report.setUnfreezeAmount(new BigDecimal(0));
        report.setUnfreezeNum(0);
        report.setRefundAmount(new BigDecimal(0));
        report.setRefundNum(0);
        report.setAlipayAmount(new BigDecimal(0));
        report.setUseAmount(new BigDecimal(0));
        report.setUseNum(0);
        report.setWinAmount(new BigDecimal(0));
        report.setWinNum(0);
        report.setPreCommissionAmount(new BigDecimal(0));
        report.setCreateTime(new Date());
        report.setUpdateTime(new Date());
        userTaoLiJinReportMapper.insertSelective(report);
    }
    @Override
    public void updateByPrimaryKeySelective(UserTaoLiJinReport record) {
        if (record == null || record.getId() == null) {
            return;
        }
        record.setUpdateTime(new Date());
        userTaoLiJinReportMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public void needUpdateReport() {
        List<UserTaoLiJinReport> list = userTaoLiJinReportMapper.needUpdateReport();
        if (list == null || list.size() == 0) {
            return;
        }
        for (UserTaoLiJinReport report: list) {
            UserTaoLiJinReport taoLiJinReport = null;
            try {
                taoLiJinReport = TaoKeApiUtil.getTaoLiJinEffective(report.getId());
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
                continue;
            }
            if (taoLiJinReport == null) {
                continue;
            }
            // 是否需要更新
            boolean needUpdate = false;
            if(taoLiJinReport.getWinNum() != report.getWinNum()){
                needUpdate = true;
            }
            if(taoLiJinReport.getWinAmount() != report.getWinAmount()){
                needUpdate = true;
            }
            if(taoLiJinReport.getUnfreezeNum() != report.getUnfreezeNum()){
                needUpdate = true;
            }
            if(taoLiJinReport.getUnfreezeAmount() != report.getUnfreezeAmount()){
                needUpdate = true;
            }
            if(taoLiJinReport.getPreCommissionAmount() != report.getPreCommissionAmount()){
                needUpdate = true;
            }
            if(taoLiJinReport.getUseNum() != report.getUseNum()){
                needUpdate = true;
            }
            if(taoLiJinReport.getUseAmount() != report.getUseAmount()){
                needUpdate = true;
            }
            if(taoLiJinReport.getAlipayAmount() != report.getAlipayAmount()){
                needUpdate = true;
            }
            if(taoLiJinReport.getRefundNum() != report.getRefundNum()){
                needUpdate = true;
            }
            // 失效退回金额发生变化
            BigDecimal refundAmount = taoLiJinReport.getRefundAmount();
            if(refundAmount.compareTo(report.getRefundAmount()) > 0) {
                needUpdate = true;
                try {
                    userTaoLiJinOriginService.refundMoney(taoLiJinReport);
                } catch (UserTaoLiJinOriginException e) {
                    e.printStackTrace();
                }
            }
            // 更新报告
            if(needUpdate) {
                taoLiJinReport.setUpdateTime(new Date());
                userTaoLiJinReportMapper.updateByPrimaryKeySelective(taoLiJinReport);
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserMoneyExtraServiceImpl.java
New file
@@ -0,0 +1,67 @@
package com.yeshi.fanli.service.impl.user;
import java.math.BigDecimal;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.user.UserMoneyExtraMapper;
import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
import com.yeshi.fanli.service.inter.user.UserMoneyExtraService;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
@Service
public class UserMoneyExtraServiceImpl implements UserMoneyExtraService {
    @Resource
    private UserMoneyExtraMapper userMoneyExtraMapper;
    @Override
    public UserMoneyExtra selectByPrimaryKey(Long uid) {
        return userMoneyExtraMapper.selectByPrimaryKey(uid);
    }
    @Override
    public void updateByPrimaryKeySelective(UserMoneyExtra record) {
        userMoneyExtraMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public void addTaoLiJin(Long uid, BigDecimal money, boolean canSelf) {
        if (uid == null || money == null) {
            return;
        }
        UserMoneyExtra record = new UserMoneyExtra();
        record.setUid(uid);
        UserMoneyExtra existExtra = userMoneyExtraMapper.selectByPrimaryKey(record.getUid());
        if (existExtra == null) {
            record.setTlj(money);
            if (canSelf) {
                record.setTljSelf(money);
            } else {
                record.setTljSelf(new BigDecimal(0));
            }
            record.setCreateTime(new Date());
            record.setUpdateTime(new Date());
            userMoneyExtraMapper.insertSelective(record);
        } else {
            BigDecimal tlj = existExtra.getTlj();
            record.setTlj(MoneyBigDecimalUtil.add(tlj, money));
            if (canSelf) {
                BigDecimal tljSelf = existExtra.getTljSelf();
                record.setTljSelf(MoneyBigDecimalUtil.add(tljSelf, money));
            }
            record.setUpdateTime(new Date());
            userMoneyExtraMapper.updateByPrimaryKeySelective(record);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsClassService.java
@@ -47,7 +47,7 @@
    public void removePicture(GoodsClass record) throws Exception;
    
    
    public List<GoodsClass> listquery() throws Exception;
    public List<GoodsClass> listquery(Integer sex) throws Exception;
    
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/HomeNavbarService.java
@@ -42,7 +42,7 @@
     * @throws HomeNavbarException
     * @throws Exception
     */
    public void updateOrder(Long id, Integer moveType) throws HomeNavbarException, Exception;
    public void updateOrder(Long id, Integer moveType, Integer sex) throws HomeNavbarException, Exception;
    
    /**
@@ -52,9 +52,9 @@
     * @param key
     * @return
     */
    public List<HomeNavbar> listQuery(long start, int count, String key);
    public List<HomeNavbar> listQuery(long start, int count, String key,  Integer sex);
    
    public long countlistQuery(String key);
    public long countlistQuery(String key,  Integer sex);
    
    
    /**
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/SpecialService.java
@@ -22,9 +22,9 @@
    public Special selectByPrimaryKey(Long id);
    public List<Special> listQueryByCard(long start, int count, Long card, String key);
    public List<Special> listQueryByCard(long start, int count, Long card, String key, Integer sex);
    public long countlistQueryByCard(Long card, String key);
    public long countlistQueryByCard(Long card, String key, Integer sex);
    /**
@@ -78,7 +78,7 @@
     * @param moveType
     * @throws SpecialException
     */
    public void updateOrder(Long id, Integer moveType) throws SpecialException;
    public void updateOrder(Long id, Integer moveType, Integer sex) throws SpecialException;
    /**
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinDetailService.java
New file
@@ -0,0 +1,51 @@
package com.yeshi.fanli.service.inter.tlj;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
import com.yeshi.fanli.vo.tlj.TaoLiJinDetailVO;
public interface UserTaoLiJinDetailService {
    /**
     * 根据日期类型统计消耗金额
     * @param uid
     * @param dateType 1今日 、2昨日、3本月、4上月
     * @return
     */
    public BigDecimal countUseMoneyByDate(long uid, int dateType);
    /**
     * 查询明细记录
     * @param uid
     * @param detailId
     * @param maxTime
     * @return
     */
    public List<TaoLiJinDetailVO> listUserMoneyDetailForClient(Long uid, Long detailId, Date maxTime);
    public long countUserMoneyDetailForClient(Long uid, Long detailId, Date maxTime);
    /**
     *  创建明细
     * @param record
     */
    public void insertSelective(UserTaoLiJinDetail record);
    /**
     * 创建新增明细
     * @param taoLiJinOrigin
     */
    public void createAddDetail(UserTaoLiJinOrigin taoLiJinOrigin);
    /**
     * 统计个数
     * @param uid
     */
    public Long countDetail(long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinOriginService.java
New file
@@ -0,0 +1,122 @@
package com.yeshi.fanli.service.inter.tlj;
import java.math.BigDecimal;
import java.util.List;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport;
import com.yeshi.fanli.entity.bus.user.UserRank;
import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
public interface UserTaoLiJinOriginService {
    /**
     * 根据日期类型统计金额
     * @param uid
     * @param dateType 1今日 、2昨日、3本月、4上月
     * @return
     */
    public BigDecimal countMoneyByDate(long uid, int dateType);
    /**
     * 统计类型个数
     * @param uid
     * @param origin
     * @return
     */
    public long countByUidAndOrigin(long uid, String origin);
    /**
     * 判断本月红包领取个数
     * @param uid
     * @return
     */
    public boolean hasRankHongBao(long uid);
    /**
     * 使红包过期
     * @param uid
     */
    public void overdueHongBao(Long uid);
    /**
     * 获取类型
     * @param uid
     * @param origin
     * @return
     */
    public UserTaoLiJinOrigin getByUidAndOrigin(long uid, String origin);
    /**
     * 当月等级红包
     * @param uid
     * @return
     */
    public UserTaoLiJinOrigin getRankByThisMonth(long uid, String type);
    /**
     * 查询剩余淘礼金
     * @param uid
     * @return
     */
    public List<UserTaoLiJinOrigin> getSurplusLiJin(long uid);
    /**
     * 更新
     * @param record
     */
    public void updateByPrimaryKeySelective(UserTaoLiJinOrigin record);
    /**
     * 新人红包设备同步
     * @param uid
     * @param device
     */
    public void synchDeviceHongbao(long uid, String device);
    /**
     * 获得新人红包
     * @param uid
     * @param money
     * @throws UserTaoLiJinOriginException
     */
    public UserTaoLiJinOrigin addNewbiesWinMoney(Long uid) throws UserTaoLiJinOriginException;
    /**
     * 等级红包
     * @param uid
     * @param money
     * @param userRank
     * @throws UserTaoLiJinOriginException
     */
    public UserTaoLiJinOrigin addRankWinMoney(Long uid, UserRank userRank) throws UserTaoLiJinOriginException;
    /**
     * 邀请红包
     * @param uid
     * @param money
     * @param inviteName
     * @throws UserTaoLiJinOriginException
     */
    public UserTaoLiJinOrigin addInviteWinMoney(Long uid, String inviteName) throws UserTaoLiJinOriginException;
    /**
     * 分享红包
     * @param uid
     * @param money
     * @throws UserTaoLiJinOriginException
     */
    public UserTaoLiJinOrigin addShareWinMoney(Long uid) throws UserTaoLiJinOriginException;
    /**
     * 退回
     * @param uid
     * @param money
     * @param total
     * @param report
     * @throws UserTaoLiJinOriginException
     */
    public void refundMoney(UserTaoLiJinReport report) throws UserTaoLiJinOriginException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinRecordService.java
New file
@@ -0,0 +1,92 @@
package com.yeshi.fanli.service.inter.tlj;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException;
import com.yeshi.fanli.vo.user.UserTaoLiJinRecordVO;
public interface UserTaoLiJinRecordService {
    /**
     *  创建淘礼金
     * @param origin 用户使用类型: 1 自购 、 2 分享
     * @param uid
     * @param auctionId
     * @param totalNum
     * @param perface
     * @throws UserTaoLiJinRecordException
     */
    public UserTaoLiJinRecord createUserTaoLiJin(int origin, Long uid, Long auctionId, BigDecimal perface, int totalNum, String name, Date sendStartTime,
            Date sendEndTime, Date useStartTime, Date useEndTime) throws UserTaoLiJinRecordException;
    /**
     * 查询用户分享淘礼金记录
     * @param start
     * @param count
     * @param uid
     * @return
     * @throws UserTaoLiJinRecordException
     */
    public List<UserTaoLiJinRecordVO> getRecordByUid(long start, int count, Long uid);
    /**
     * 统计创建次数
     * @param uid
     * @return
     */
    public long countRecordByUid(Long uid);
    /**
     * 今日创建分享红包个数
     * @param uid
     * @return
     */
    public long countTodayNum(Long uid);
    /**
     * 查询推广红包
     * @param uid
     * @param goodsId
     * @return
     */
    public BigDecimal getShareHongBaoByUidAndGoodsId(Long uid, Long goodsId);
    /**
     * 根据红包id 查询
     * @param rightsId
     * @return
     */
    public UserTaoLiJinRecord getByRightsId(String rightsId);
    public UserTaoLiJinRecord selectByPrimaryKey(Long id);
    /**
     * 自购创建红包
     * @param uid
     * @param totalNum
     * @param goods
     * @return
     * @throws UserTaoLiJinRecordException
     */
    public UserTaoLiJinRecord createSelfBuyTaoLiJin(Long uid, int totalNum, TaoBaoGoodsBrief goods)
            throws UserTaoLiJinRecordException;
    /**
     * 分享创建红包
     * @param uid
     * @param totalNum
     * @param goods
     * @return
     * @throws UserTaoLiJinRecordException
     */
    public UserTaoLiJinRecord createShareTaoLiJin(Long uid, int totalNum, TaoBaoGoodsBrief goods)
            throws UserTaoLiJinRecordException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinReportService.java
New file
@@ -0,0 +1,25 @@
package com.yeshi.fanli.service.inter.tlj;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport;
public interface UserTaoLiJinReportService {
    /**
     * 保存或更新报告信息
     * @param record
     */
    public void insertDefault(String rightsId);
    /**
     * 更新报告
     * @param record
     */
    public void updateByPrimaryKeySelective(UserTaoLiJinReport record);
    /**
     * 报告更新
     * @return
     */
    public void needUpdateReport();
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserMoneyExtraService.java
New file
@@ -0,0 +1,29 @@
package com.yeshi.fanli.service.inter.user;
import java.math.BigDecimal;
import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
public interface UserMoneyExtraService {
    /**
     * 查询用户额外金额
     * @param uid
     * @return
     */
    public UserMoneyExtra selectByPrimaryKey(Long uid);
    /**
     * 更新信息
     * @param record
     */
    public void updateByPrimaryKeySelective(UserMoneyExtra record);
    /**
     * 用户获得推广金
     * @param uid
     * @param money
     * @param canSelf
     */
    public void addTaoLiJin(Long uid, BigDecimal money, boolean canSelf);
}
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/tlj/TaoLiJinDetailTypeEnumHandler.java
New file
@@ -0,0 +1,54 @@
package com.yeshi.fanli.util.mybatishandler.tlj;
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 com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
public class TaoLiJinDetailTypeEnumHandler extends BaseTypeHandler<TaoLiJinDetailTypeEnum> {
    @Override
    public TaoLiJinDetailTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return TaoLiJinDetailTypeEnum.valueOf(key);
        }
    }
    @Override
    public TaoLiJinDetailTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return TaoLiJinDetailTypeEnum.valueOf(key);
        }
    }
    @Override
    public TaoLiJinDetailTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return TaoLiJinDetailTypeEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, TaoLiJinDetailTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/tlj/TaoLiJinOriginEnumHandler.java
New file
@@ -0,0 +1,54 @@
package com.yeshi.fanli.util.mybatishandler.tlj;
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 com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
public class TaoLiJinOriginEnumHandler extends BaseTypeHandler<TaoLiJinOriginEnum> {
    @Override
    public TaoLiJinOriginEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return TaoLiJinOriginEnum.valueOf(key);
        }
    }
    @Override
    public TaoLiJinOriginEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return TaoLiJinOriginEnum.valueOf(key);
        }
    }
    @Override
    public TaoLiJinOriginEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return TaoLiJinOriginEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, TaoLiJinOriginEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}
fanli/src/main/java/com/yeshi/fanli/vo/tlj/SpreadHongBao.java
New file
@@ -0,0 +1,23 @@
package com.yeshi.fanli.vo.tlj;
import com.google.gson.annotations.Expose;
public class SpreadHongBao {
    @Expose
    private String money;
    @Expose
    private String tip;
    public String getMoney() {
        return money;
    }
    public void setMoney(String money) {
        this.money = money;
    }
    public String getTip() {
        return tip;
    }
    public void setTip(String tip) {
        this.tip = tip;
    }
}
fanli/src/main/java/com/yeshi/fanli/vo/tlj/TaoLiJinDetailVO.java
New file
@@ -0,0 +1,27 @@
package com.yeshi.fanli.vo.tlj;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail;
public class TaoLiJinDetailVO {
    @Expose
    private TaoLiJinMonthVO month;
    @Expose
    private UserTaoLiJinDetail detail;
    public TaoLiJinMonthVO getMonth() {
        return month;
    }
    public void setMonth(TaoLiJinMonthVO month) {
        this.month = month;
    }
    public UserTaoLiJinDetail getDetail() {
        return detail;
    }
    public void setDetail(UserTaoLiJinDetail detail) {
        this.detail = detail;
    }
}
fanli/src/main/java/com/yeshi/fanli/vo/tlj/TaoLiJinMonthVO.java
New file
@@ -0,0 +1,65 @@
package com.yeshi.fanli.vo.tlj;
import com.google.gson.annotations.Expose;
public class TaoLiJinMonthVO {
    @Expose
    private int year;// 年份
    @Expose
    private int month;// 月
    @Expose
    private String expend;// 支出
    @Expose
    private String income;// 收入
    private String dateFormate;
    public String getDateFormate() {
        return dateFormate;
    }
    public void setDateFormate(String dateFormate) {
        this.dateFormate = dateFormate;
    }
    public TaoLiJinMonthVO(int year, int month) {
        this.year = year;
        this.month = month;
    }
    public TaoLiJinMonthVO() {
    }
    public int getYear() {
        return year;
    }
    public void setYear(int year) {
        this.year = year;
    }
    public int getMonth() {
        return month;
    }
    public void setMonth(int month) {
        this.month = month;
    }
    public String getExpend() {
        return expend;
    }
    public void setExpend(String expend) {
        this.expend = expend;
    }
    public String getIncome() {
        return income;
    }
    public void setIncome(String income) {
        this.income = income;
    }
}
fanli/src/main/java/com/yeshi/fanli/vo/user/UserTaoLiJinRecordVO.java
New file
@@ -0,0 +1,150 @@
package com.yeshi.fanli.vo.user;
import java.math.BigDecimal;
import java.util.Date;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
public class UserTaoLiJinRecordVO {
    // 商品id
    @Expose
    private Long auctionId;
    // 商品
    @Expose
    private String title;
    // 商品图片
    @Expose
    private String pictUrl;
    // 商品类型
    @Expose
    private int userType;
    // 淘礼金创建时间
    @Expose
    private Date createTime;
    // 已领取个数
    @Expose
    private int winNum;
    // 已使用个数
    @Expose
    private int useNum;
    // 已退回
    @Expose
    private int refundNum;
    // 总个数
    @Expose
    private int totalNum;
    // 剩余个数
    @Expose
    private int surplusNum;
    // 佣金
    private BigDecimal commission;
    // 预估奖金
    @Expose
    private ClientTextStyleVO desc;
    public Long getAuctionId() {
        return auctionId;
    }
    public void setAuctionId(Long auctionId) {
        this.auctionId = auctionId;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getPictUrl() {
        return pictUrl;
    }
    public void setPictUrl(String pictUrl) {
        this.pictUrl = pictUrl;
    }
    public int getUserType() {
        return userType;
    }
    public void setUserType(int userType) {
        this.userType = userType;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public int getWinNum() {
        return winNum;
    }
    public void setWinNum(int winNum) {
        this.winNum = winNum;
    }
    public int getUseNum() {
        return useNum;
    }
    public void setUseNum(int useNum) {
        this.useNum = useNum;
    }
    public int getRefundNum() {
        return refundNum;
    }
    public void setRefundNum(int refundNum) {
        this.refundNum = refundNum;
    }
    public int getTotalNum() {
        return totalNum;
    }
    public void setTotalNum(int totalNum) {
        this.totalNum = totalNum;
    }
    public int getSurplusNum() {
        return surplusNum;
    }
    public void setSurplusNum(int surplusNum) {
        this.surplusNum = surplusNum;
    }
    public BigDecimal getCommission() {
        return commission;
    }
    public void setCommission(BigDecimal commission) {
        this.commission = commission;
    }
    public ClientTextStyleVO getDesc() {
        return desc;
    }
    public void setDesc(ClientTextStyleVO desc) {
        this.desc = desc;
    }
}