yujian
2019-07-19 4c31405418bdd063605f1e5821d99f85be02f23c
Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
26个文件已修改
1个文件已添加
1090 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/CommonContentController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/LostOrderController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoOrderMapper.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinOriginMapper.java 196 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/common/CommonContentTypeEnum.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgAccountDetail.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/taobao/TaoBaoAuthException.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/UpdateOrderJob.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoOrderMapper.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinOriginMapper.xml 273 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserAccountMsgNotificationServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJBuyGoodsServiceImpl.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoGoodsUpdateServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoOrderServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserAccountMsgNotificationService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoOrderService.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgAccountDetailFactory.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java
@@ -15,8 +15,10 @@
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord;
import com.yeshi.fanli.exception.taobao.TaoBaoAuthException;
import com.yeshi.fanli.exception.user.UserExtraTaoBaoInfoException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.msg.UserAccountMsgNotificationService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionAuthRecordService;
import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.util.AESUtil;
@@ -44,6 +46,9 @@
    @Resource
    private TaoBaoUnionAuthRecordService taoBaoUnionAuthRecordService;
    @Resource
    private UserAccountMsgNotificationService userAccountMsgNotificationService;
    @Resource
    private RedisManager redisManager;
@@ -102,12 +107,20 @@
            } catch (Exception e) {
            }
            final String name = nickName;
             LogHelper.test("uid:" + uid + "\n accessToken:" + accessToken);
            LogHelper.test("uid:" + uid + "\n accessToken:" + accessToken);
            // 获取渠道ID与会员ID
            if ("share".equalsIgnoreCase(source)) {
                String relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                        TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
                String relationId = null;
                try {
                    TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                            TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
                } catch (TaoBaoAuthException e) {
                    if (e.getCode() == TaoBaoAuthException.CODE_NOT_REAL_NAME)
                        userAccountMsgNotificationService.taoBaoAuthFail(uid, name, "淘宝账号未实名");
                }
                if (StringUtil.isNullOrEmpty(relationId))
                    LogHelper.test(uid + "渠道备案失败");
                try {
@@ -121,8 +134,13 @@
                    @Override
                    public void run() {
                        String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                                TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
                        String specialId = null;
                        try {
                            specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                                    TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
                        } catch (TaoBaoAuthException e1) {
                        }
                        if (StringUtil.isNullOrEmpty(specialId))
                            LogHelper.test(uid + "会员备案失败");
@@ -133,10 +151,19 @@
                        }
                    }
                });
                //稍作延迟
                Thread.sleep(50);
            } else if ("zigou".equalsIgnoreCase(source)) {
                String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                        TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
                String specialId = null;
                try {
                    specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                            TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
                } catch (TaoBaoAuthException e) {
                    if (e.getCode() == TaoBaoAuthException.CODE_NOT_REAL_NAME)
                        userAccountMsgNotificationService.taoBaoAuthFail(uid, name, "淘宝账号未实名");
                }
                if (StringUtil.isNullOrEmpty(specialId))
                    LogHelper.test(uid + "会员备案失败");
@@ -152,8 +179,12 @@
                    @Override
                    public void run() {
                        String relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                                TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
                        String relationId = null;
                        try {
                            relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                                    TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
                        } catch (TaoBaoAuthException e1) {
                        } // 渠道ID
                        if (StringUtil.isNullOrEmpty(relationId))
                            LogHelper.test(uid + "渠道备案失败");
                        try {
@@ -163,13 +194,23 @@
                        }
                    }
                });
                //稍作延迟
                Thread.sleep(50);
            } else if ("bind".equalsIgnoreCase(source)) {
                boolean bindInfo = true;
                // 绑定淘宝:V1.5.3
                String relationId = TaoKeApiUtil.getRelationId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
                        TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
                String relationId = null;
                int tbErrorCode = 0;
                try {
                    relationId = TaoKeApiUtil.getRelationId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
                            TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
                } catch (TaoBaoAuthException e) {
                    tbErrorCode = e.getCode();
                }
                if (StringUtil.isNullOrEmpty(relationId)) {
                    LogHelper.test(uid + "渠道备案失败");
                    bindInfo = false;
@@ -177,8 +218,12 @@
                String specialId = null;
                if (bindInfo) {
                    specialId = TaoKeApiUtil.getSpecialId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
                            TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
                    try {
                        specialId = TaoKeApiUtil.getSpecialId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
                                TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
                    } catch (TaoBaoAuthException e) {
                        tbErrorCode = e.getCode();
                    }
                    if (StringUtil.isNullOrEmpty(specialId)) {
                        LogHelper.test(uid + "会员备案失败");
                        bindInfo = false;
@@ -186,6 +231,9 @@
                }
                if (!bindInfo) {
                    if (tbErrorCode == TaoBaoAuthException.CODE_NOT_REAL_NAME) {
                        userAccountMsgNotificationService.taoBaoAuthFail(uid, name, "淘宝账号未实名");
                    }
                    errCode = 5;// 信息获取不全
                } else {
                    try {
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/CommonContentController.java
@@ -88,7 +88,7 @@
        }
        CommonContentResult result = commonTemplateContentService.getContentList(CommonContentTypeEnum.valueOf(key),
                cid, page, Constant.PAGE_SIZE);
                cid, page, 10);
        // 保留暂时不开启,待后续开启
        List<SwiperPicture> bannerList = new ArrayList<>();
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/LostOrderController.java
@@ -85,16 +85,16 @@
                        && order.getResultCode() == LostOrder.RESULT_CODE_SUCCESS) {
                    // 申诉成功
                    json.put("state", 1);
                    json.put("stateDesc", "申诉成功,请在订单列表中查看");
                    json.put("stateDesc", "订单找回成功,请我的-订单中查看");
                } else if (order.getState() == 2 || (order.getState() == 1 && order.getResultCode() != null
                        && order.getResultCode() == LostOrder.RESULT_CODE_FAIL)) {
                    // 申诉失败
                    json.put("state", 2);
                    json.put("stateDesc", "申诉失败");
                    json.put("stateDesc", "订单找回失败");
                } else {
                    // 处理中
                    json.put("state", 0);
                    json.put("stateDesc", "审核中");
                    json.put("stateDesc", "订单找回中");
                }
                data.add(json);
            }
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
@@ -699,11 +699,11 @@
                        acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
                boolean read = false;
                if (state != null && state.getReadTime() != null
                        && list.get(0).getCreateTime().getTime() < state.getReadTime().getTime())
                        && list.get(0).getPushTime().getTime() < state.getReadTime().getTime())
                    read = true;
                commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_recommend.png", "推荐记录",
                        list.get(0).getCreateTime(), UserCommonMsgVO.TYPE_RECOMMEND, list.get(0).getContent(), read,
                        list.get(0).getPushTime(), UserCommonMsgVO.TYPE_RECOMMEND, list.get(0).getContent(), read,
                        jumpDetailV2Service.getByTypeCache("recommend_list"), null, 0));
            }
        }
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoOrderMapper.java
@@ -102,4 +102,23 @@
     * @return
     */
    long countAllOrder(@Param("orderNo") String orderNo);
    /**
     * 根据结算时间拼排序
     *
     * @param start
     * @param count
     * @return
     */
    List<TaoBaoOrder> listBySettlementTime(@Param("minTime") Long minTime, @Param("maxTime") Long maxTime,
            @Param("start") long start, @Param("count") int count);
    /**
     * 根据结算时间计数
     *
     * @param minTime
     * @param maxTime
     * @return
     */
    Long countBySettlementTime(@Param("minTime") Long minTime, @Param("maxTime") Long maxTime);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinOriginMapper.java
@@ -1,95 +1,103 @@
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);
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 date
     * @return
     */
    List<UserTaoLiJinOrigin> getOverdueTaoLiJinByRank(@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/dto/common/CommonContentTypeEnum.java
@@ -2,7 +2,7 @@
public enum CommonContentTypeEnum {
    _9k9("9块9"), haoQuan("高额好券"), chaoSheng("超级省钱"), muYin("母婴精选"), reMai("潮品热卖"), meiShi("优选美食"), juJia(
    _9k9("9块9包邮"), haoQuan("高额好券"), chaoSheng("超级省钱"), muYin("母婴精选"), reMai("潮品热卖"), meiShi("优选美食"), juJia(
            "居家生活"), chuanYiDaPei("穿衣搭配"), meiZhuangGehu("美妆个护"), jingPinXieBao("精品鞋包"), chaoNanReMai(
                    "潮男热卖"), shuMaShouJi("数码手机"), yunDongKuXie("运动酷鞋"), qiCheHuWai("汽车户外"), chaoPinReMai("新款潮品");
    private final String desc;
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgAccountDetail.java
@@ -16,7 +16,7 @@
@Table("yeshi_ec_msg_account")
public class MsgAccountDetail {
    public enum MsgTypeAccountTypeEnum {
        bingding("账号绑定"), cancelBinding("取消绑定"), bingdingChange("绑定更换"), update("账号修改"), level("账号等级"), connect("账号合并");
        bingding("账号绑定"), cancelBinding("取消绑定"), bingdingChange("绑定更换"), update("账号修改"), level("账号等级"), connect("账号合并"),taoBaoAuthFail("账号绑定");
        private final String desc;
        private MsgTypeAccountTypeEnum(String desc) {
fanli/src/main/java/com/yeshi/fanli/exception/taobao/TaoBaoAuthException.java
New file
@@ -0,0 +1,37 @@
package com.yeshi.fanli.exception.taobao;
//淘宝商品下架
public class TaoBaoAuthException extends Exception {
    public static int CODE_NOT_REAL_NAME = 1;// 未实名
    public static int CODE_OUT_OF_RULE = 2;// 违规
    public static int CODE_OTHER = 3;// 其他错误
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public TaoBaoAuthException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public TaoBaoAuthException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java
@@ -1,5 +1,8 @@
package com.yeshi.fanli.job;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
@@ -9,14 +12,19 @@
import com.yeshi.fanli.entity.taobao.ShareHotGoods;
import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.TaoBaoConstant;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
@Component
public class TaoLiJinJob {
@@ -29,6 +37,9 @@
    @Resource
    private TLJBuyGoodsService tljBuyGoodsService;
    @Resource
    private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
    /**
     * 更新报告
@@ -88,9 +99,9 @@
    }
    /**
     * 每天凌晨过3分钟验证
     * 每天凌晨5点过10分钟验证
     */
    @Scheduled(cron = "0 3 0 * * ?")
    @Scheduled(cron = "0 10 5 * * ? ")
    public void updateBuyTLJGoods() {
        if (!Constant.IS_TASK)
            return;
@@ -105,9 +116,63 @@
                    new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
                            TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT));
            if (success) {
                count++;
                count++;
            }
        }
    }
    private void addTLJBuyGoods(List<TaoBaoGoodsBrief> list, String day) {
        for (TaoBaoGoodsBrief goods : list) {
            // 获取商品详情
            try {
                goods = TaoKeApiUtil.searchGoodsDetail(goods.getAuctionId());
            } catch (TaobaoGoodsDownException e) {
                e.printStackTrace();
            }
            if (goods != null && goods.getCouponAmount() != null
                    && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) {
                if (TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(goods.getTkRate())
                        .compareTo(new BigDecimal("143")) >= 0) {
                    goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
                    int totalHongBaoCount = 2000 + (int) (Math.random() * 8000);
                    int leftHongBaoCount = 200 + (int) (Math.random() * 2000);
                    tljBuyGoodsService.addTLJBuyGoods(
                            new TLJBuyGoods(null, day, new Date(), goods, totalHongBaoCount, leftHongBaoCount),
                            TaoBaoConstant.ownBuyApp);
                }
            }
        }
    }
    /**
     * 每天晚上11点50添加淘礼金1个商品,用于兼容Android前端没有商品不显示banner的问题
     */
    @Scheduled(cron = "0 50 23 * * ? ")
    public void autoAddTLJBuyGoods() {
        if (!Constant.IS_TASK)
            return;
        String day = TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd");
        List<TaoBaoGoodsBrief> list = tljBuyGoodsService.listPreGoods(1);
        Collections.shuffle(list);
        if (list.size() > 0)
            list = list.subList(0, 1);
        addTLJBuyGoods(list, day);
    }
    /**
     * 每天凌晨5点过1分开始爬取剩余9个商品
     */
    @Scheduled(cron = "0 1 5 * * ? ")
    public void autoAddTLJBuyGoods2() {
        if (!Constant.IS_TASK)
            return;
        String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
        List<TaoBaoGoodsBrief> list = tljBuyGoodsService.listPreGoods(1);
        Collections.shuffle(list);
        if (list.size() > 20)
            list = list.subList(0, 1);
        addTLJBuyGoods(list, day);
    }
}
fanli/src/main/java/com/yeshi/fanli/job/UpdateOrderJob.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.job;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@@ -471,7 +472,7 @@
    }
    /**
     * 跟新本地订单(凌晨25分更新)
     * 更新本地订单(凌晨25分更新)
     */
    @Scheduled(cron = "25 0 0 * * ? ")
    public void doLocalTaoBaoOrder() {
@@ -496,4 +497,62 @@
        }
    }
    /**
     * 更新最近的本地单(30分钟更新一次)
     */
    @Scheduled(cron = "0 0/30 * * * ? ")
    public void doLatestLocalTaoBaoOrder() {
        if (!Constant.IS_TASK)
            return;
        Long endTime = System.currentTimeMillis() - 1000 * 60 * 10L;
        Long startTime = endTime - 1000 * 60 * 60 * 12L;
        updateLocalTaoBaoOrder(startTime, endTime, 1, 2000);
    }
    public void updateLocalTaoBaoOrder(Long startTime, Long endTime, int page, int count) {
        List<TaoBaoOrder> list = taoBaoOrderService.listBySettlementTime(startTime, endTime, page, count);
        Set<String> orderIds = new HashSet<>();
        for (TaoBaoOrder co : list) {
            orderIds.add(co.getOrderId());
        }
        for (Iterator<String> its = orderIds.iterator(); its.hasNext();) {
            String orderId = its.next();
            // 查询是否有处于订单付款状态的单
            List<CommonOrder> commonOrderList = commonOrderService
                    .listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO, orderId);
            boolean update = false;
            if (commonOrderList != null)
                for (CommonOrder co : commonOrderList) {
                    if (co.getState() == CommonOrder.STATE_FK && co.getPayment().compareTo(new BigDecimal(0)) > 0) {
                        update = true;
                        break;
                    }
                }
            if (update) {
                List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
                Map<String, List<TaoBaoOrder>> orders = new HashMap<>();
                orders.put(orderId, orderList);
                orderProcessService.processOrder(orders);
            }
        }
    }
    @Scheduled(cron = "30 13 3 * * ? ")
    public void doLatest5DayLocalTaoBaoOrder() {
        if (!Constant.IS_TASK)
            return;
        Long endTime = System.currentTimeMillis() - 1000 * 60 * 60 * 12L;
        Long startTime = endTime - 1000 * 60 * 60 * 24 * 5L;
        long count = taoBaoOrderService.countBySettlementTime(startTime, endTime);
        int pageSize = 100;
        long page = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
        for (int i = 0; i < page; i++) {
            updateLocalTaoBaoOrder(startTime, endTime, i + 1, pageSize);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoOrderMapper.xml
@@ -115,6 +115,38 @@
            where to_order_id=#{orderNo}
        </if>
    </select>
    <select id="listBySettlementTime" resultMap="BaseResultMap">
        select * from yeshi_ec_taobao_order
        where 1=1
        <if test="minTime!=null">
          and UNIX_TIMESTAMP(to_settlement_time)*1000>=#{minTime}
        </if>
        <if test="maxTime!=null">
          and #{maxTime}>UNIX_TIMESTAMP(to_settlement_time)*1000
        </if>
        order by to_settlement_time desc
        limit #{start},#{count}
    </select>
    <select id="countBySettlementTime" resultType="java.lang.Long">
        select count(to_id) from yeshi_ec_taobao_order
        where 1=1
        <if test="minTime!=null">
          and UNIX_TIMESTAMP(to_settlement_time)*1000>=#{minTime}
        </if>
        <if test="maxTime!=null">
          and #{maxTime}>UNIX_TIMESTAMP(to_settlement_time)*1000
        </if>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_taobao_order where to_id = #{id,jdbcType=BIGINT}
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinOriginMapper.xml
@@ -1,134 +1,139 @@
<?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
    ORDER BY t.`uto_create_time`
  </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>
<?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 AND t.`uto_origin`<![CDATA[<>]]>'rankWin'
  </select>
  <select id="getOverdueTaoLiJinByRank" 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 AND t.`uto_origin`= 'rankWin'
  </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
    ORDER BY t.`uto_create_time`
  </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/service/impl/hongbao/HongBaoV2ServiceImpl.java
@@ -587,17 +587,20 @@
                    if (notificationMap.get(child.getType()) == null) {
                        HongBaoV2 tempHongBao = new HongBaoV2(child.getId());
                        tempHongBao.setUserInfo(child.getUserInfo());
                        tempHongBao.setMoney(childUpdate.getMoney());
                        tempHongBao
                                .setMoney(childUpdate.getMoney() == null ? new BigDecimal(0) : childUpdate.getMoney());
                        CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                        tempCommonOrder.setPayment(commonOrder.getPayment());
                        notificationMap.put(child.getType(), new HongBaoOrder(tempCommonOrder, tempHongBao));
                    } else {
                        // 增加付款金额与资金
                        HongBaoOrder tempHongBaoOrder = notificationMap.get(child.getType());
                        tempHongBaoOrder.getCommonOrder().setPayment(
                                tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                        tempHongBaoOrder.getHongBaoV2()
                                .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(childUpdate.getMoney()));
                        if (commonOrder.getPayment() != null)
                            tempHongBaoOrder.getCommonOrder().setPayment(
                                    tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                        if (childUpdate.getMoney() != null)
                            tempHongBaoOrder.getHongBaoV2()
                                    .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(childUpdate.getMoney()));
                        notificationMap.put(child.getType(), tempHongBaoOrder);
                    }
@@ -726,7 +729,7 @@
                    firstHongbao.setMoney(
                            MoneyBigDecimalUtil.mul(hongBao.getMoney(), firstRate.divide(new BigDecimal(100))));
                }
                //返利为0的不通知
                // 返利为0的不通知
                if (firstHongbao.getMoney() == null || firstHongbao.getMoney().compareTo(new BigDecimal(0)) <= 0)
                    return;
@@ -777,8 +780,8 @@
                        secondHongbao.setMoney(
                                MoneyBigDecimalUtil.mul(hongBao.getMoney(), secondRate.divide(new BigDecimal(100))));
                    }
                    //返利为0的不统计
                    // 返利为0的不统计
                    if (secondHongbao.getMoney() == null || secondHongbao.getMoney().compareTo(new BigDecimal(0)) <= 0)
                        return;
@@ -1034,9 +1037,9 @@
    public List<HongBaoV2> listChildrenById(Long id) {
        return hongBaoV2Mapper.listChildrenById(id);
    }
    @Override
    public List<Long> getUidByNear30DayShareSucceed(){
    public List<Long> getUidByNear30DayShareSucceed() {
        return hongBaoV2Mapper.getUidByNear30DayShareSucceed();
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserAccountMsgNotificationServiceImpl.java
@@ -66,4 +66,14 @@
        }
    }
    @Override
    public void taoBaoAuthFail(Long uid, String taoBaoNickName, String reason) {
        MsgAccountDetail detail = MsgAccountDetailFactory.createTaoBaoAuthFail(uid, taoBaoNickName, reason);
        try {
            msgAccountDetailService.addMsgAccountDetail(detail);
        } catch (MsgAccountDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -833,8 +833,14 @@
            commonOrder.setCommonOrderGoods(goods);
        }
        CommonOrder oldCommonOrder = commonOrderMapper.selectByOrderNoAndOrderTypeAndOrderBy(commonOrder.getOrderNo(),
                commonOrder.getSourceType(), commonOrder.getOrderBy());
        CommonOrder oldCommonOrder = null;
        if (!StringUtil.isNullOrEmpty(commonOrder.getTradeId()))
            oldCommonOrder = commonOrderMapper.selectBySourceTypeAndTradeId(commonOrder.getSourceType(),
                    commonOrder.getTradeId());
        else
            oldCommonOrder = commonOrderMapper.selectByOrderNoAndOrderTypeAndOrderBy(commonOrder.getOrderNo(),
                    commonOrder.getSourceType(), commonOrder.getOrderBy());
        if (oldCommonOrder == null)// 新增
        {
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJBuyGoodsServiceImpl.java
@@ -62,16 +62,17 @@
    @Cacheable(value = "commonContentCache", key = "'tljBuy-listByDay'+#day")
    @Override
    public List<TLJBuyGoods> listByDay(String day) {
        List<TLJBuyGoods> list = listByDay(day, 30);
        if (list.size() <= 10)
            return list;
        else {
            List<TLJBuyGoods> newList = new ArrayList<>();
            for (int i = 0; i < 10; i++) {
                newList.add(list.get(i));
            }
            return newList;
        }
        List<TLJBuyGoods> list = listByDay(day, 10);
        // if (list.size() <= 10)
        // return list;
        // else {
        // List<TLJBuyGoods> newList = new ArrayList<>();
        // for (int i = 0; i < 10; i++) {
        // newList.add(list.get(i));
        // }
        // return newList;
        // }
        return list;
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoGoodsUpdateServiceImpl.java
@@ -113,6 +113,8 @@
        if (goods.getAuctionId() == null || goods.getAuctionId() == 0)
            throw new TaobaoGoodsUpdateException(2, "商品ID为空");
        // 设置商品正常上线
        goods.setState(0);
        // 更新收藏信息
        try {
            commonGoodsService.updateCommonGoods(CommonGoodsFactory.create(goods));
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoOrderServiceImpl.java
@@ -193,4 +193,15 @@
        return taoBaoOrderMapper.selectByPrimaryKey(id);
    }
    @Override
    public List<TaoBaoOrder> listBySettlementTime(Long minTime, Long maxTime, int page, int pageSize) {
        return taoBaoOrderMapper.listBySettlementTime(minTime, maxTime, (page - 1) * pageSize, pageSize);
    }
    @Override
    public Long countBySettlementTime(Long minTime, Long maxTime) {
        return taoBaoOrderMapper.countBySettlementTime(minTime, maxTime);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java
@@ -2,6 +2,7 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
@@ -225,13 +226,29 @@
    @Override
    public List<DaTaoKeDetailV2> listPreTLJBuyGoods(int page) {
        if (page == 1) {
            DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_DAY, null);
            DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_HOT, null);
            List<DaTaoKeDetailV2> goodsList = new ArrayList<>();
            for (DaTaoKeDetailV2 v2 : result.getGoodsList()) {
                BigDecimal commision = MoneyBigDecimalUtil
                        .div(MoneyBigDecimalUtil.mul(v2.getActualPrice(), v2.getCommissionRate()), new BigDecimal(100));
                if (commision.multiply(new BigDecimal("0.7")).compareTo(new BigDecimal("1.01")) >= 0)
                    goodsList.add(v2);
                if (commision.multiply(new BigDecimal("0.7")).compareTo(new BigDecimal("1.01")) >= 0
                        && v2.getActualPrice().compareTo(new BigDecimal(30)) < 0 && v2.getMonthSales() >= 5000) {
                    Date time = new Date(TimeUtil.convertToTimeTemp(v2.getCouponEndTime(), "yyyy-MM-dd HH:mm:ss"));
                    Date targetTime = new Date(TimeUtil
                            .convertToTimeTemp(TimeUtil.getGernalTime(
                                    System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 2L, "yyyy-MM-dd"), "yyyy-MM-dd")
                            - 1000L);
                    // 如果是凌晨选择的
                    if (Calendar.getInstance().get(Calendar.HOUR_OF_DAY) < 12) {// 上午选择的计算为当天的
                        targetTime = new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(
                                System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 1L, "yyyy-MM-dd"), "yyyy-MM-dd")
                                - 1000L);
                    }
                    if (time.getTime() >= targetTime.getTime())
                        goodsList.add(v2);
                }
            }
            return goodsList;
        } else
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java
@@ -404,31 +404,43 @@
    @Override
    public void overdueHongBao(Long uid) {
        // 15天前过期
        Date date = null;
        if (uid == null) {
            return;
        }
        // 15天前过期- 非等级红包
        try {
            date = DateUtil.reduceDay(14, new Date());
            Date date = DateUtil.reduceDay(14, new Date());
            List<UserTaoLiJinOrigin> list = userTaoLiJinOriginMapper.getOverdueTaoLiJin(uid, date);
            executeOverdueHongBao(uid, date, list);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        
        if (date == null) {
            return;
        // 30天前过期 - 等级红包
        try {
            Date date = DateUtil.reduceDay(29, new Date());
            List<UserTaoLiJinOrigin> list = userTaoLiJinOriginMapper.getOverdueTaoLiJinByRank(uid, date);
            executeOverdueHongBao(uid, date, list);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        List<UserTaoLiJinOrigin> list = userTaoLiJinOriginMapper.getOverdueTaoLiJin(uid, date);
    }
    public void executeOverdueHongBao(Long uid, Date date, List<UserTaoLiJinOrigin> list) {
        if (list == null || list.size() == 0) {
            return;
        }
        BigDecimal total = new BigDecimal(0);
        for (UserTaoLiJinOrigin userTaoLiJinOrigin: list) {
        for (UserTaoLiJinOrigin userTaoLiJinOrigin : list) {
            SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH.mm");
            String time = sd.format(userTaoLiJinOrigin.getCreateTime());
            String time = sd.format(userTaoLiJinOrigin.getCreateTime());
            BigDecimal moneySurplus = userTaoLiJinOrigin.getMoneySurplus();
            total = MoneyBigDecimalUtil.add(total, moneySurplus);
            String rightsId = null;
            boolean refund = false;
            TaoLiJinOriginEnum originEnum = userTaoLiJinOrigin.getOrigin();
@@ -436,13 +448,13 @@
                refund = true;
                rightsId = userTaoLiJinOrigin.getRightsId();
            }
            UserTaoLiJinOrigin origin = new UserTaoLiJinOrigin();
            origin.setId(userTaoLiJinOrigin.getId());
            origin.setMoneySurplus(new BigDecimal(0));
            origin.setUpdateTime(new Date());
            userTaoLiJinOriginMapper.updateByPrimaryKeySelective(origin);
            if (refund) {
                UserTaoLiJinReport report = userTaoLiJinReportService.selectByPrimaryKey(rightsId);
                Date shareTime = null;
@@ -451,17 +463,17 @@
                } else {
                    shareTime = report.getCreateTime();
                }
                // 消息
                MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
                content.setState("红包收回");
                content.setSource("于["+ sd.format(shareTime) + "]创建的分享未被领取部分");
                content.setSource("于[" + sd.format(shareTime) + "]创建的分享未被领取部分");
                content.setTimeDesc("退回于" + time);
                content.setMoney(moneySurplus);
                content.setReason("本笔退回推广红包从退回日起至今并未产生分享记录");
                content.setResult("长期未使用收回");
                userOtherMsgNotificationService.taoLiJinMsg(uid, "如有疑问请联系人工客服", content);
            } else {
                // 消息
                MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
@@ -474,16 +486,16 @@
                userOtherMsgNotificationService.taoLiJinMsg(uid, "如有疑问请联系人工客服", content);
            }
        }
        // 用户剩余淘礼金
        UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid);
        if (userMoneyExtra == null || userMoneyExtra.getTlj() == null) {
            return;
        }
        UserMoneyExtra updateExtra = new UserMoneyExtra();
        updateExtra.setUid(uid);
        BigDecimal tljSelf = userMoneyExtra.getTljSelf();
        if (tljSelf != null && tljSelf.compareTo(new BigDecimal(0)) > 0) { // 剩余淘礼金-- 自购
            BigDecimal sub = MoneyBigDecimalUtil.sub(tljSelf, total);
@@ -492,12 +504,11 @@
            } else {
                updateExtra.setTljSelf(new BigDecimal(0));
            }
        }
        }
        updateExtra.setTlj(MoneyBigDecimalUtil.sub(userMoneyExtra.getTlj(), total));
        updateExtra.setUpdateTime(new Date());
        userMoneyExtraService.updateByPrimaryKeySelective(updateExtra);
        // 插入明细
        UserTaoLiJinDetail detail = new UserTaoLiJinDetail();
        detail.setUid(uid);
@@ -507,7 +518,8 @@
        detail.setCreateTime(new Date());
        userTaoLiJinDetailService.insertSelective(detail);
    }
    @Override
    public List<UserTaoLiJinOrigin> getSurplusLiJin(long uid) {
        return userTaoLiJinOriginMapper.getSurplusLiJin(uid);
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java
@@ -375,7 +375,7 @@
                
                // 使用成功消息
                try {
                    String beizhu = "未被领取/使用的部分将会退回";
                    String beizhu = "未被领取或领取后未使用部分退回";
                    SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH.mm");
                    String time = sd.format(new Date());
                    MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserAccountMsgNotificationService.java
@@ -51,4 +51,13 @@
     */
    public void userRank(Long uid, String orderType, int orderCount, String rankName);
    /**
     * 淘宝授权失败
     *
     * @param uid
     * @param taoBaoNickName
     * @param reason
     */
    public void taoBaoAuthFail(Long uid, String taoBaoNickName, String reason);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoOrderService.java
@@ -87,4 +87,22 @@
     */
    public TaoBaoOrder selectByPrimaryKey(Long id);
    /**
     * 根据结算时间检索
     *
     * @param page
     * @param pageSize
     * @return
     */
    public List<TaoBaoOrder> listBySettlementTime(Long minTime, Long maxTime, int page, int pageSize);
    /**
     * 根据结算时间计数
     *
     * @param minTime
     * @param maxTime
     * @return
     */
    public Long countBySettlementTime(Long minTime, Long maxTime);
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgAccountDetailFactory.java
@@ -7,6 +7,9 @@
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.util.StringUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
public class MsgAccountDetailFactory {
    public final static int TYPE_WX = 1;// 微信
    public final static int TYPE_TB = 2;// 淘宝
@@ -141,4 +144,31 @@
        return detail;
    }
    // 淘宝授权失败
    public static MsgAccountDetail createTaoBaoAuthFail(Long uid, String taoBaoNickName, String reason) {
        if (uid == null || reason == null)
            return null;
        JSONArray msg = new JSONArray();
        JSONObject item = new JSONObject();
        item.put("name", "账号");
        item.put("content", String.format("淘宝昵称[%s]", taoBaoNickName));
        msg.add(item);
        item = new JSONObject();
        item.put("name", "原因");
        item.put("content", reason);
        msg.add(item);
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setBeiZhu("无");
        detail.setContent(msg.toString());
        detail.setTitle("淘宝账号授权失败");
        detail.setType(MsgTypeAccountTypeEnum.taoBaoAuthFail);
        detail.setUser(new UserInfo(uid));
        detail.setCreateTime(new Date());
        detail.setRead(false);
        return detail;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -15,6 +15,7 @@
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
import com.yeshi.fanli.entity.bus.user.BindingAccount;
import com.yeshi.fanli.entity.bus.user.Extract;
@@ -27,6 +28,7 @@
import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
import com.yeshi.fanli.vo.msg.UserMsgVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
public class UserMsgVOFactory {
@@ -79,7 +81,7 @@
        } else {
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", COLOR_TITLE), contentList,true));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", COLOR_TITLE), contentList, true));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("共", COLOR_CONTENT));
@@ -385,13 +387,13 @@
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_order_reward.png",
                    msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
                    items);
        }else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.systemEqualize ) {// 奖励订单
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.systemEqualize) {// 奖励订单
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "", COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("补齐金额", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(msg.getOrderId()+ "", COLOR_CONTENT));
            contentList.add(new ClientTextStyleVO(msg.getOrderId() + "", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("补齐原因", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
@@ -421,7 +423,7 @@
        List<CommonMsgItemVO> items = new ArrayList<>();
        List<ClientTextStyleVO> contentList = new ArrayList<>();
        contentList.add(new ClientTextStyleVO(msg.getType().getDesc() + "", COLOR_CONTENT));
        contentList.add(new ClientTextStyleVO(msg.getTitle() + "", COLOR_CONTENT));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("事项", COLOR_TITLE), contentList));
        // 状态修改
@@ -430,24 +432,36 @@
        int fromIndex = 0;
        int toIndex = 0;
        String stateDesc = msg.getContent();
        while (stateDesc.indexOf("<highlight>") > -1) {
            fromIndex = stateDesc.indexOf("<highlight>");
            toIndex = stateDesc.indexOf("</highlight>");
            String content1 = stateDesc.substring(0, fromIndex);
            String content2 = stateDesc.substring(fromIndex + "<highlight>".length(), toIndex);
            stateDesc = stateDesc.substring(toIndex + "</highlight>".length(), stateDesc.length());
        if (msg.getType() == MsgTypeAccountTypeEnum.taoBaoAuthFail) {// 淘宝授权失败
            JSONArray array = JSONArray.fromObject(stateDesc);
            for (int i = 0; i < array.size(); i++) {
                String name = array.optJSONObject(i).optString("name");
                String content = array.optJSONObject(i).optString("content");
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(content, i > 0 ? COLOR_HIGHLIGHT_CONTENT : COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO(name, COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(content1)) {
                contentList.add(new ClientTextStyleVO(content1, COLOR_CONTENT));
        } else {
            while (stateDesc.indexOf("<highlight>") > -1) {
                fromIndex = stateDesc.indexOf("<highlight>");
                toIndex = stateDesc.indexOf("</highlight>");
                String content1 = stateDesc.substring(0, fromIndex);
                String content2 = stateDesc.substring(fromIndex + "<highlight>".length(), toIndex);
                stateDesc = stateDesc.substring(toIndex + "</highlight>".length(), stateDesc.length());
                if (!StringUtil.isNullOrEmpty(content1)) {
                    contentList.add(new ClientTextStyleVO(content1, COLOR_CONTENT));
                }
                if (!StringUtil.isNullOrEmpty(content2)) {
                    contentList.add(new ClientTextStyleVO(content2, COLOR_HIGHLIGHT_CONTENT));
                }
            }
            if (!StringUtil.isNullOrEmpty(content2)) {
                contentList.add(new ClientTextStyleVO(content2, COLOR_HIGHLIGHT_CONTENT));
            if (!StringUtil.isNullOrEmpty(stateDesc)) {
                contentList.add(new ClientTextStyleVO(stateDesc, COLOR_CONTENT));
            }
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
        }
        if (!StringUtil.isNullOrEmpty(stateDesc)) {
            contentList.add(new ClientTextStyleVO(stateDesc, COLOR_CONTENT));
        }
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
        contentList = new ArrayList<>();
        contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu() + "",
@@ -587,7 +601,7 @@
                contentList.add(new ClientTextStyleVO(dto.getSource() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("来源", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getTimeDesc())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getTimeDesc() + "", COLOR_CONTENT));
@@ -601,19 +615,18 @@
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("面额", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getReason())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getReason() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("原因", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getResult())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getResult() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("结果", COLOR_TITLE), contentList));
            }
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -22,6 +22,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
import com.yeshi.fanli.exception.taobao.TaoBaoAuthException;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.log.LogHelper;
@@ -1646,7 +1647,7 @@
        return null;
    }
    public static String getRelationId(String accessToken, String appKey, String appSecret) {
    public static String getRelationId(String accessToken, String appKey, String appSecret) throws TaoBaoAuthException {
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.sc.publisher.info.save");
        map.put("session", accessToken);
@@ -1662,14 +1663,19 @@
            return resultJSON.optJSONObject("tbk_sc_publisher_info_save_response").optJSONObject("data")
                    .optString("relation_id");
        } catch (TaoKeApiException e) {
            e.printStackTrace();
            LogHelper.error("渠道ID申请出错:" + e.getMsg());
            JSONObject errorJSON = JSONObject.fromObject(e.getMsg()).optJSONObject("error_response");
            if (errorJSON.optInt("code") == 15 && errorJSON.optInt("sub_code") == 1)// 未实名
            {
                throw new TaoBaoAuthException(TaoBaoAuthException.CODE_NOT_REAL_NAME, errorJSON.optString("sub_msg"));
            } else {
                e.printStackTrace();
                LogHelper.error("渠道ID申请出错:" + e.getMsg());
                throw new TaoBaoAuthException(TaoBaoAuthException.CODE_OTHER, errorJSON.optString("sub_msg"));
            }
        }
        return null;
    }
    public static String getSpecialId(String accessToken, String appKey, String appSecret) {
    public static String getSpecialId(String accessToken, String appKey, String appSecret) throws TaoBaoAuthException {
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.sc.publisher.info.save");
        map.put("session", accessToken);
@@ -1685,11 +1691,16 @@
            return resultJSON.optJSONObject("tbk_sc_publisher_info_save_response").optJSONObject("data")
                    .optString("special_id");
        } catch (TaoKeApiException e) {
            e.printStackTrace();
            LogHelper.error("会员运营ID申请出错:" + resultJSON);
            JSONObject errorJSON = JSONObject.fromObject(e.getMsg()).optJSONObject("error_response");
            if (errorJSON.optInt("code") == 15 && errorJSON.optInt("sub_code") == 1)// 未实名
            {
                throw new TaoBaoAuthException(TaoBaoAuthException.CODE_NOT_REAL_NAME, errorJSON.optString("sub_msg"));
            } else {
                e.printStackTrace();
                LogHelper.error("会员运营ID申请出错:" + e.getMsg());
                throw new TaoBaoAuthException(TaoBaoAuthException.CODE_OTHER, errorJSON.optString("sub_msg"));
            }
        }
        return null;
    }
    public static void specialConvertItem(Long auctionId, TaoKeAppInfo app) {