admin
2021-05-29 e75b0d79535a6bcd147cca4a54632b70b42afdb9
特价完善
34个文件已修改
14个文件已添加
4883 ■■■■■ 已修改文件
fanli/pom.xml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/lijin/GoodsControllerLijin.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/lijin/UserControllerLijin.java 234 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsClassControllerV2.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/h5/H5S11Controller.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/web/WebRecommendController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/SystemConfigMapper.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/user/msg/MsgOverViewsDao.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/SystemEnum.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/SystemFunction.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOverViews.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgTypeEnum.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserAccountBindingHistory.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInfo.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInfoModifyRecord.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/config/SystemConfigKeyEnum.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/system/ConfigKeyEnum.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemConfig.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/user/UserAccountException.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/lijin/dto/TodayLijinCreatedInfo.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/lijin/manager/GoodsLijinMnager.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/lijin/manager/UserLijinMnager.java 177 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/lijin/vo/UserLijinLevelInfoVO.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/lijin/vo/VIPGradeVO.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/lijin/vo/VipRecordVO.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemConfigServiceImpl.java 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/TaoKeGoodsServiceImpl.java 1051 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOverViewsServiceImpl.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java 339 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java 83 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/config/SystemConfigService.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgOverViewsService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserAccountService.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/AliyunOneKeyLoginUtil.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/FilePathEnum.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java 334 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgAccountDetailFactory.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/user/QQUserInfoVO.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/mapping/UserInfoMapper.xml 1479 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/pom.xml
@@ -212,13 +212,13 @@
        <dependency>
            <groupId>com.ks</groupId>
            <artifactId>facade-vip</artifactId>
            <version>0.0.1</version>
            <version>0.0.5</version>
        </dependency>
        <dependency>
            <groupId>com.ks</groupId>
            <artifactId>facade-lijin</artifactId>
            <version>0.0.2</version>
            <version>0.0.3</version>
        </dependency>
        <dependency>
@@ -228,6 +228,18 @@
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
            <version>4.5.2</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-dypnsapi</artifactId>
            <version>1.1.3</version>
        </dependency>
    </dependencies>
    <build>
fanli/src/main/java/com/yeshi/fanli/controller/client/lijin/GoodsControllerLijin.java
@@ -23,6 +23,7 @@
import com.yeshi.fanli.exception.pdd.PDDApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.lijin.manager.GoodsLijinMnager;
import com.yeshi.fanli.lijin.manager.UserLijinMnager;
import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
import com.yeshi.fanli.service.inter.pdd.PDDAuthService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
@@ -80,8 +81,13 @@
    @Resource
    private GoodsLijinMnager goodsLijinMnager;
    @Resource
    private UserLijinMnager userLijinMnager;
    @Resource
    private PIDManager pidManager;
    /**
     * 获取商品详情
@@ -97,9 +103,10 @@
        GoodsDetailVO goodsDetailVO = new GoodsDetailVO();
        GoodsDetailVO.GoodsExtraVO extraVO = new GoodsDetailVO.GoodsExtraVO();
        GoodsMoneyConfigParamsDTO paramsDTO = new GoodsMoneyConfigParamsDTO();
        paramsDTO.setFanLiRate(new BigDecimal("60"));
        paramsDTO.setFanLiRate(goodsLijinMnager.getFanLiRate(uid));
        // 领券人列表
        List<ShamUser> listCouponUser = new ArrayList<>();
        Long goodsIdSuning = null;
        switch (goodsType) {
            case Constant
                    .SOURCE_TYPE_TAOBAO:
@@ -146,6 +153,8 @@
                    .SOURCE_TYPE_SUNING:
                String[] ids = SuningUtil.getGoodsIdDetail(goodsId);
                SuningGoodsInfo suningGoodsInfo = SuningApiUtil.getGoodsDetail(ids[1], ids[0]);
                goodsIdSuning = Long.parseLong(suningGoodsInfo.getCommodityInfo().getCommodityCode());
                goodsDetailVO.setGoods(GoodsDetailVOLijinFactory.convertSuningGoods(suningGoodsInfo, paramsDTO));
                extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_suning.html?id="
                        + suningGoodsInfo.getCommodityInfo().getCommodityCode() + "&supplierCode="
@@ -157,7 +166,7 @@
        //是否收藏
        extraVO.setCollected(false);
        if (uid != null) {
            CollectionGoodsV2 collectionGoodsV2 = collectionGoodsV2Service.findByUidAndAuctionId(uid, Long.parseLong(goodsDetailVO.getGoods().getGoodsId()), goodsType);
            CollectionGoodsV2 collectionGoodsV2 = collectionGoodsV2Service.findByUidAndAuctionId(uid, goodsType == Constant.SOURCE_TYPE_SUNING ? goodsIdSuning : Long.parseLong(goodsDetailVO.getGoods().getGoodsId()), goodsType);
            if (collectionGoodsV2 != null) {
                extraVO.setCollected(true);
            }
@@ -203,6 +212,7 @@
                data.put("type", 1);
                data.put("link", link);
                data.put("native", true);
                data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem()));
                out.print(JsonUtil.loadTrueResult(data));
            } catch (LiJinException e) {
                out.print(JsonUtil.loadFalseResult(e.getMsg()));
@@ -226,7 +236,7 @@
     * @param goodsDetailVO
     */
    private void loadLijinInfo(Long uid, GoodsDetailVO goodsDetailVO) {
        VIPEnum vipRank = goodsLijinMnager.getVIPRank(uid);
        VIPEnum vipRank = userLijinMnager.getVIPRank(uid);
        GoodsDetailVO.GoodsHongBaoListVO.UserLevelVO userLevelVO = goodsLijinMnager.getUserLevel(vipRank);
        if (goodsDetailVO.getGoods().getPriceList() != null && goodsDetailVO.getGoods().getPriceList().size() > 0)
            goodsDetailVO.getGoods().getPriceList().get(0).setUserLevel(userLevelVO);
fanli/src/main/java/com/yeshi/fanli/controller/client/lijin/UserControllerLijin.java
New file
@@ -0,0 +1,234 @@
package com.yeshi.fanli.controller.client.lijin;
import com.ks.vip.exception.VipOrderException;
import com.ks.vip.pojo.DO.VipCenter;
import com.ks.vip.pojo.DO.VipCenterRecord;
import com.ks.vip.pojo.DO.VipCombo;
import com.ks.vip.pojo.Enums.OrderTypeEnum;
import com.ks.vip.pojo.Enums.VIPEnum;
import com.ks.vip.service.VipComboService;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.lijin.dto.TodayLijinCreatedInfo;
import com.yeshi.fanli.lijin.manager.UserLijinMnager;
import com.yeshi.fanli.lijin.vo.VIPGradeVO;
import com.yeshi.fanli.lijin.vo.VipRecordVO;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.Constant;
import net.sf.json.JSONObject;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.MoneyBigDecimalUtil;
import org.yeshi.utils.TimeUtil;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import javax.annotation.Resource;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Controller
@RequestMapping("api/lijin/user")
public class UserControllerLijin {
    @Resource
    private UserLijinMnager userLijinMnager;
    @Resource
    private ConfigService configService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private JedisPool jedisPool;
    /**
     * 获取用户礼金创建状态
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping("getUserLijinCreatedInfo")
    public void getUserLijinCreatedInfo(AcceptData acceptData, Long uid, PrintWriter out) {
        VIPEnum vipEnum = userLijinMnager.getVIPRank(uid);
        VIPEnum defaultRank = userLijinMnager.getDefaultRank();
        boolean canOpenVIP = false;
        //淘礼金会员链接
        String lijinUrl = configService.getValue(ConfigKeyEnum.lijinVIPLink, acceptData.getSystem());
        TodayLijinCreatedInfo info = userLijinMnager.getTodayCreateInfo(uid);
        JSONObject data = new JSONObject();
        data.put("leftCount", info.getLeftCount());
        data.put("leftMoney", info.getLeftMoney());
        JSONObject openInfo = new JSONObject();
        openInfo.put("vipLink", lijinUrl);
        openInfo.put("btnName", "开通会员");
        //今日机会已经用完
        if (info.getLeftCount() <= 0 || info.getCreatedMoney().compareTo(new BigDecimal(1)) < 0) {
            if (vipEnum == defaultRank) {
                //默认等级,开通会员
                canOpenVIP = true;
            } else {
                //今日机会用完了
                canOpenVIP = false;
            }
            if (canOpenVIP)
                data.put("openInfo", openInfo);
        } else {
            //还可创建
        }
        //是否可以开通会员
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 获取会员等级列表
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping("getVIPPriceList")
    public void getVIPPriceList(AcceptData acceptData, Long uid, PrintWriter out) {
        List<VIPGradeVO> voList = new ArrayList<>();
        List<VipCombo> vipComboList = userLijinMnager.getVIPPricelist(VIPEnum.platinum);
        for (VipCombo vipCombo : vipComboList) {
            VIPGradeVO vo = new VIPGradeVO();
            vo.setId(vipCombo.getId() + "");
            vo.setMoney("¥" + MoneyBigDecimalUtil.getWithNoZera(vipCombo.getDiscountPrice()));
            vo.setName(vipCombo.getName());
            vo.setOriginMoney("¥" + MoneyBigDecimalUtil.getWithNoZera(vipCombo.getOriginalPrice()));
            vo.setTag(MoneyBigDecimalUtil.getWithNoZera(vipCombo.getDiscount()) + "折");
            voList.add(vo);
        }
        //获取用户信息
        UserInfo userInfo = userInfoService.selectAvailableByPrimaryKey(uid);
        JSONObject data = new JSONObject();
        if (userInfo != null) {
            VipCenter vipCenter = userLijinMnager.getUserLevelInfo(uid);
            JSONObject userVO = new JSONObject();
            userVO.put("nickName", userInfo.getNickName());
            userVO.put("portrait", userInfo.getPortrait());
            if (vipCenter != null)
                userVO.put("expireDate", TimeUtil.getGernalTime(vipCenter.getEndTime().getTime(), "yyyy-MM-dd HH:mm"));
            data.put("user", userVO);
        }
        data.put("count", vipComboList.size());
        data.put("data", voList);
        out.print(JsonUtil.loadTrueResult(data));
    }
    @RequestMapping("getUserLevel")
    public void getUserLevel(AcceptData acceptData, Long uid, PrintWriter out) {
        VIPEnum vipEnum = userLijinMnager.getVIPRank(uid);
        JSONObject data = new JSONObject();
        data.put("userLevel", vipEnum);
        data.put("lijinVipLink", configService.getValue(ConfigKeyEnum.lijinVIPLink, acceptData.getSystem()));
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 是否可以创建广告订单
     *
     * @param acceptData
     * @param uid
     * @param out
     */
    @RequestMapping("canCreateAdOrder")
    public void canCreateAdOrder(AcceptData acceptData, Long uid, PrintWriter out) {
        boolean canCreatedOrder = userLijinMnager.canCreateADOrder(uid);
        if (!canCreatedOrder) {
            out.print(JsonUtil.loadFalseResult("今日免费领取会员超限,请明日再试"));
            return;
        }
        JSONObject data = new JSONObject();
        data.put("type", "csj");
        data.put("pid", "946119116");
        out.print(JsonUtil.loadTrueResult(data));
    }
    @RequestMapping("createAdOrder")
    public void createAdOrder(AcceptData acceptData, Long uid, PrintWriter out) {
        String key = "watchad-order-" + uid;
        Jedis jedis = jedisPool.getResource();
        Long canAdd = jedis.setnx(key, "1");
        if (canAdd == null) {
            out.print(JsonUtil.loadFalseResult("请稍后再试"));
            return;
        }
        jedis.expire(key, 120);
        try {
            userLijinMnager.createADOrder(uid);
            out.print(JsonUtil.loadTrueResult(""));
        } catch (VipOrderException e) {
            e.printStackTrace();
            out.print(JsonUtil.loadFalseResult(e.getMsg()));
        } finally {
            jedis.del(key);
            jedis.close();
        }
    }
    @RequestMapping("getVIPOrderList")
    public void getVIPOrderList(AcceptData acceptData, Long uid, int page, PrintWriter out) {
        List<VipCenterRecord> list = userLijinMnager.getVipRecordList(uid, page, Constant.PAGE_SIZE);
        List<VipRecordVO> voList = new ArrayList<>();
        for (VipCenterRecord record : list) {
            VipRecordVO vo = new VipRecordVO();
            vo.setCreateTime(TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm"));
            vo.setEndTime(TimeUtil.getGernalTime(record.getEndTime().getTime(), "yyyy.MM.dd HH:mm"));
            vo.setStartTime(TimeUtil.getGernalTime(record.getStartTime().getTime(), "yyyy.MM.dd HH:mm"));
            vo.setOrderId(record.getOrderId() + "");
            String name = "";
            if (record.getVipOrder() != null) {
                if (record.getVipOrder().getType() == OrderTypeEnum.watchVideo) {
                    name = "激励奖励铂金会员";
                } else if (record.getVipOrder().getType() == OrderTypeEnum.buyNewly) {
                    name = "开通铂金会员";
                } else if (record.getVipOrder().getType() == OrderTypeEnum.buyRenew) {
                    name = "续费铂金会员";
                }
            }
            long timespan = record.getEndTime().getTime() - record.getStartTime().getTime();
            int hour = (int) (timespan / (1000 * 60 * 60L));
            if (hour > 24 * 93) {
                name += "-年卡";
            } else if (hour > 24 * 31) {
                name += "-季卡";
            } else if (hour > 24) {
                name += "-月卡";
            } else if (hour == 24) {
                name += "-1天";
            } else {
                name += "-" + hour + "小时";
            }
            vo.setName(name);
            voList.add(vo);
        }
        long count = userLijinMnager.countVipRecord(uid);
        JSONObject data = new JSONObject();
        data.put("list", voList);
        data.put("count", count);
        out.print(JsonUtil.loadTrueResult(data));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java
@@ -9,6 +9,7 @@
import com.yeshi.fanli.entity.SystemFunction;
import com.yeshi.fanli.entity.SystemPIDInfo;
import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException;
import com.yeshi.fanli.lijin.manager.UserLijinMnager;
import com.yeshi.fanli.service.manger.PIDManager;
import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager;
import com.yeshi.fanli.util.SystemInfoUtil;
@@ -97,6 +98,9 @@
    @Resource
    private PIDManager pidManager;
    @Resource
    private UserLijinMnager userLijinMnager;
    private void doTaoLiJinBuy(AcceptData acceptData, Long uid, Long auctionId, PrintWriter out) {
        JSONObject data = new JSONObject();
@@ -331,6 +335,9 @@
            data.put("link", link);
            if (clientTBPid != null)
                data.put("tbPidInfo", clientTBPid);
            data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem()));
            out.print(JsonUtil.loadTrueResult(data));
            TaoKeLogHelper.convertLinkInfo(
@@ -394,6 +401,8 @@
                    data.put("native", true);
                }
                data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem()));
                out.print(JsonUtil.loadTrueResult(data));
            } else {
                out.print(JsonUtil.loadFalseResult(1, "请求失败"));
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -13,6 +13,7 @@
import javax.servlet.http.HttpServletRequest;
import com.yeshi.fanli.entity.SystemPIDInfo;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.service.manger.PIDManager;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -698,7 +699,7 @@
            } else {
                price = taoBaoGoodsBriefExtra.getZkPrice() + "";
            }
            String appName = systemConfigService.get("appName", system);
            String appName = systemConfigService.getValueCache(SystemConfigKeyEnum.appName, acceptData.getSystem());
            data.put("sharePrice", "¥" + price + "元      送" + appName + "红包¥"
                    + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "元 ");
            data.put("shareTitle", taoBaoGoodsBriefExtra.getTitle());
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java
@@ -29,6 +29,7 @@
import com.yeshi.fanli.util.*;
import com.yeshi.fanli.util.account.UserUtil;
import com.yeshi.fanli.util.wx.MyWXLoginUtil;
import com.yeshi.fanli.vo.user.QQUserInfoVO;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -1080,7 +1081,7 @@
     * @param out
     */
    @RequestMapping(value = "loginNew", method = RequestMethod.POST)
    public void loginNew(AcceptData acceptData, String vcode, String phone, String code, int loginType,
    public void loginNew(AcceptData acceptData, String vcode, String phone, String code, String aliAccessToken, int loginType,
                         HttpServletRequest request, PrintWriter out) {
        // 2.0以下版本不允许登录
@@ -1099,7 +1100,7 @@
            UserInfo userInfo = null;
            // 手机登录
            if (loginType == 1) {
                userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, system);
                userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, aliAccessToken, system);
            }
            // 微信登录
@@ -1162,43 +1163,29 @@
     * @param out
     */
    @RequestMapping(value = "bindPhoneNew")
    public void bindPhoneNew(AcceptData acceptData, Long uid, String vcode, String phone, PrintWriter out) {
    public void bindPhoneNew(AcceptData acceptData, Long uid, String vcode, String phone, String aliAccessToken, PrintWriter out) {
        BusinessSystem system = getSystem(acceptData);
        if (system == null) {
            out.print(JsonUtil.loadFalseResult("系统不存在"));
            return;
        }
        if (StringUtil.isNullOrEmpty(vcode)) {
            out.print(JsonUtil.loadFalseResult("验证码不能为空"));
        String mobile = null;
        try {
            mobile = userAccountService.getMobile(vcode, phone, aliAccessToken, acceptData.getSystem(), SMSHistory.TYPE_BIND);
        } catch (UserAccountException e) {
            out.print(JsonUtil.loadFalseResult(e.getMsg()));
            return;
        }
        if (StringUtil.isNullOrEmpty(phone)) {
            out.print(JsonUtil.loadFalseResult("电话号码不能为空"));
            return;
        }
        phone = phone.replaceAll(" ", "");
        String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_BIND);
        if (Constant.IS_OUTNET) {
            if (!vcode.equalsIgnoreCase(oldVCode)) {
                out.print(JsonUtil.loadFalseResult(9001, "验证码错误,重新输入"));
                return;
            }
            redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_BIND);
        }
        try {
            // 绑定用户
            userAccountService.bindPhoneNew(uid, phone);
            userAccountService.bindPhoneNew(uid, mobile);
            UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
            // 判断电话号码是否已经封禁
            ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
                    .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, phone);
                    .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, mobile);
            if (ic != null && ic.getEffective() != null && ic.getEffective()) {
                out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
                // 封禁用户
@@ -1243,7 +1230,7 @@
        }
        try {
            userAccountService.bindWeiXin(acceptData, uid, code);
            userAccountService.bindWeiXin(system, uid, code);
            UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
            // 判断taoBaoUid是否已经封禁
@@ -1267,4 +1254,42 @@
        }
    }
    /**
     * 更改微信
     *
     * @param acceptData
     * @param uid
     * @param qqUser
     * @param out
     */
    @RequestMapping(value = "bindQQ")
    public void bindQQ(AcceptData acceptData, Long uid, String qqUser, PrintWriter out) {
        BusinessSystem system = getSystem(acceptData);
        if (system == null) {
            out.print(JsonUtil.loadFalseResult("系统不存在"));
            return;
        }
        if (StringUtil.isNullOrEmpty(qqUser)) {
            out.print(JsonUtil.loadFalseResult("请上传qqUser"));
            return;
        }
        String qqUserStr = StringUtil.getFromBase64(qqUser);
        QQUserInfoVO qqUserInfo = new Gson().fromJson(qqUserStr, QQUserInfoVO.class);
        try {
            userAccountService.bindQQ(uid, qqUserInfo);
            UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
            JSONObject data = new JSONObject();
            data.put("userInfo", UserUtil.filterForClientUser(user));
            out.print(JsonUtil.loadTrueResult(data));
        } catch (UserAccountException e) {
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsClassControllerV2.java
@@ -194,9 +194,10 @@
        }
        List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsBriefs, paramsDTO);
        for (GoodsDetailVO vo : voList)
        for (GoodsDetailVO vo : voList) {
            vo.setCreatetime(null);
            array.add(gson.toJson(vo));
        }
        JSONObject data = new JSONObject();
        data.put("nav", null);
        data.put("count", counttotal);
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -17,6 +17,7 @@
import com.yeshi.fanli.entity.SystemPIDInfo;
import com.yeshi.fanli.exception.pdd.PDDApiException;
import com.yeshi.fanli.lijin.manager.GoodsLijinMnager;
import com.yeshi.fanli.lijin.manager.UserLijinMnager;
import com.yeshi.fanli.service.inter.pdd.PDDAuthService;
import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.service.manger.PIDManager;
@@ -225,6 +226,9 @@
    @Resource
    private PIDManager pidManager;
    @Resource
    private UserLijinMnager userLijinMnager;
    private GoodsMoneyConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) {
        UserLevelEnum level = UserLevelEnum.daRen;
@@ -1782,6 +1786,7 @@
        }
        JSONObject data = JSONObject.fromObject(new Gson().toJson(vo));
        data.put("native", vo.is_native());
        data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem()));
        out.print(JsonUtil.loadTrueResult(data));
        // 获得金币
@@ -1879,6 +1884,7 @@
        }
        data = JSONObject.fromObject(new Gson().toJson(vo));
        data.put("native", vo.is_native());
        data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem()));
        out.print(JsonUtil.loadTrueResult(data));
        // 获得金币
@@ -1941,6 +1947,7 @@
        JSONObject data = JSONObject.fromObject(new Gson().toJson(vo));
        data.put("native", vo.is_native());
        data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem()));
        out.print(JsonUtil.loadTrueResult(data));
        // 获得金币
        integralGetService.addCouponRebate(uid);
@@ -2006,6 +2013,7 @@
        JSONObject data = JSONObject.fromObject(new Gson().toJson(vo));
        data.put("native", vo.is_native());
        data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem()));
        out.print(JsonUtil.loadTrueResult(data));
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -19,6 +19,7 @@
import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.util.*;
import com.yeshi.fanli.vo.taobao.TaoBaoUser;
import com.yeshi.fanli.vo.user.QQUserInfoVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -182,15 +183,17 @@
     * 新版登录 V1.5.3
     *
     * @param acceptData
     * @param loginType      登录方式: 1-手机登录 2-微信登录 3-手机  4-qq
     * @param vcode
     * @param phone
     * @param code
     * @param loginType  登录方式: 1-手机登录 2-微信登录
     * @param aliAccessToken
     * @param qqUser
     * @param request
     * @param out
     */
    @RequestMapping(value = "login", method = RequestMethod.POST)
    public void login(AcceptData acceptData, int loginType, String vcode, String phone, String code,
    public void login(AcceptData acceptData, int loginType, String vcode, String phone, String code, String aliAccessToken, String qqUser,
                      HttpServletRequest request, PrintWriter out) {
        try {
            BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
@@ -201,27 +204,40 @@
            }
            UserInfo userInfo = null;
            // 手机登录
            if (loginType == 1) {
                userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, system);
            switch (loginType) {
                //电话号码登录
                case 1: {
                    userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, aliAccessToken, system);
                }
                break;
                //微信登录
                case 2: {
                    //需要绑定电话号码
                    if (SystemInfoUtil.hasFunctions(system.getSystem(), SystemFunction.bindPhone))
                        userInfo = userAccountService.loginWeiXinNew(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, code, system);
                        //不需要绑定电话号码
                    else
                        userInfo = userAccountService.loginWeiXin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, code, system);
                }
                break;
                case 4: {
                    QQUserInfoVO qqUserInfo = UserUtil.parseQQUser(qqUser);
                    userInfo = userAccountService.loginQQ(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, qqUserInfo, system);
                }
                break;
            }
            // 微信登录
            if (loginType == 2) {
                //需要绑定电话号码
                if (SystemInfoUtil.hasFunctions(system.getSystem(), SystemFunction.bindPhone))
                    userInfo = userAccountService.loginWeiXinNew(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, code, system);
                    //不需要绑定电话号码
                else
                    userInfo = userAccountService.loginWeiXin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, code, system);
            }
            if (userInfo == null) {
                out.print(JsonUtil.loadFalseResult("登录失败"));
            } else {
                JSONObject data = new JSONObject();
                data.put("userInfo", UserUtil.filterForClientUser(userInfo));
                data.put("inviteCode", userInfoExtraService.getInviteCodeByUid(userInfo.getId()));
                if (SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.inviteCode)) {
                    data.put("inviteCode", userInfoExtraService.getInviteCodeByUid(userInfo.getId()));
                }
                out.print(JsonUtil.loadTrueResult(data));
                final UserInfo uuser = userInfo;
@@ -248,14 +264,14 @@
        } catch (UserAccountException e) {
            int errorCode = e.getCode();
            if (errorCode == 101) { // 需要绑定手机号
            if (errorCode == UserAccountException.CODE_NEED_BIND_PHONE) { // 需要绑定手机号
                JSONObject data = new JSONObject();
                data.put("key", e.getMsg());
                JSONObject object = new JSONObject();
                object.put("code", errorCode);
                object.put("data", data);
                out.print(object.toString());
            } else if (errorCode == 102) { // 需要绑定微信号
            } else if (errorCode == UserAccountException.CODE_NEED_BIND_WX) { // 需要绑定微信号
                JSONObject data = new JSONObject();
                data.put("key", e.getMsg());
                JSONObject object = new JSONObject();
@@ -323,7 +339,7 @@
    }
    /**
     * 绑定电话号码 V2.0.1 微信登录
     * 绑定电话号码 V2.0.1 三方登录
     *
     * @param acceptData
     * @param vcode
@@ -332,7 +348,7 @@
     */
    @RequestSerializableByKey(key = "'bindPhoneLogin-'+#phone")
    @RequestMapping(value = "bindPhoneLogin")
    public void bindPhoneLogin(AcceptData acceptData, String vcode, String phone, String key,
    public void bindPhoneLogin(AcceptData acceptData, String vcode, String phone, String key, String aliAccessToken,
                               HttpServletRequest request, PrintWriter out) {
        BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
                acceptData.getPackages(), acceptData.getSystem());
@@ -341,35 +357,22 @@
            return;
        }
        if (StringUtil.isNullOrEmpty(vcode)) {
            out.print(JsonUtil.loadFalseResult("验证码不能为空"));
            return;
        }
        if (StringUtil.isNullOrEmpty(phone)) {
            out.print(JsonUtil.loadFalseResult("电话号码不能为空"));
            return;
        }
        if (StringUtil.isNullOrEmpty(key)) {
            out.print(JsonUtil.loadFalseResult("key值不能为空"));
            return;
        }
        phone = phone.replaceAll(" ", "");
        String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_BIND);
        if (Constant.IS_OUTNET) {
            if (!vcode.equalsIgnoreCase(oldVCode)) {
                out.print(JsonUtil.loadFalseResult(9001, "验证码错误,重新输入"));
                return;
            }
            redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_BIND);
        String mobile = null;
        try {
            mobile = userAccountService.getMobile(vcode, phone, aliAccessToken, acceptData.getSystem(), SMSHistory.TYPE_BIND);
        } catch (UserAccountException e) {
            out.print(JsonUtil.loadFalseResult(e.getMsg()));
            return;
        }
        try {
            UserInfo userInfo = userAccountService.bindPhoneToLogin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), acceptData, phone, key);
            UserInfo userInfo = userAccountService.bindPhoneToLogin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), acceptData, mobile, key);
            JSONObject data = new JSONObject();
            data.put("userInfo", UserUtil.filterForClientUser(userInfo));
            out.print(JsonUtil.loadTrueResult(data));
@@ -412,6 +415,7 @@
            return;
        }
        try {
            UserInfo userInfo = userAccountService.bindWXToLogin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), acceptData, code, system.getAppid(), key);
            JSONObject data = new JSONObject();
fanli/src/main/java/com/yeshi/fanli/controller/h5/H5S11Controller.java
@@ -70,7 +70,7 @@
        if (StringUtil.isNullOrEmpty(token)) {
            try {
                TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253",
                        "20150318020003259", info.getRelationId());
                        "20150318020005224", info.getRelationId());
                String link = dto.getClick_url();
                if (!StringUtil.isNullOrEmpty(link)) {
@@ -125,7 +125,7 @@
        if (StringUtil.isNullOrEmpty(token)) {
            try {
                TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253",
                        "20150318020003259", info.getRelationId());
                        "20150318020005224", info.getRelationId());
                String link = dto.getClick_url();
                if (!StringUtil.isNullOrEmpty(link)) {
                    token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg", "预售商品付定金,得奖金!",
fanli/src/main/java/com/yeshi/fanli/controller/web/WebRecommendController.java
@@ -6,6 +6,7 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -195,7 +196,7 @@
            } else {
                price = taoBaoGoodsBriefExtra.getZkPrice() + "";
            }
            String appName = systemConfigService.get("appName", system);
            String appName = systemConfigService.getValueCache(SystemConfigKeyEnum.appName, acceptData.getSystem());
            data.put("sharePrice", "¥" + price + "元      送" + appName + "红包¥"
                    + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "元 ");
            data.put("shareTitle", taoBaoGoodsBriefExtra.getTitle());
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/SystemConfigMapper.java
@@ -1,14 +1,13 @@
package com.yeshi.fanli.dao.mybatis;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.system.SystemConfig;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.system.SystemConfig;
public interface SystemConfigMapper extends BaseMapper<SystemConfig> {
public interface SystemConfigMapper extends BaseMapper<SystemConfig>{
    SystemConfig getByKey(@Param("key") String key);
    SystemConfig getByKeyAndSystemId(@Param("key") String key, @Param("systemId") Long systemId);
    public SystemConfig selectByKeyAndSystem(@Param("key") String key,@Param("system") SystemEnum system);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java
@@ -3,6 +3,7 @@
import java.math.BigDecimal;
import java.util.List;
import com.ks.lijin.query.BaseDaoQuery;
import com.yeshi.fanli.entity.SystemEnum;
import org.apache.ibatis.annotations.Param;
@@ -46,48 +47,7 @@
    BigDecimal getMyHB(Long id);
    // 根据AppId与微信unionID获取用户
    /**
     * 根据系统与微信unionId获取用户
     *
     * @param system
     * @param unionId
     * @return
     */
    List<UserInfo> listBySystemAndWXUnionId(@Param("system") SystemEnum system, @Param("unionId") String unionId);
    /**
     * 根据系统与淘宝的openid获取用户
     *
     * @param system
     * @param openId
     * @return
     */
    List<UserInfo> listBySystemAndTaoBaoOpenId(@Param("system") SystemEnum system, @Param("openId") String openId);
    /**
     * 根据系统与电话号码获取用户
     *
     * @param system
     * @param phone
     * @return
     */
    List<UserInfo> listBySystemAndPhone(@Param("system") SystemEnum system, @Param("phone") String phone);
    // 根据获取电话号码有效用户
    UserInfo getEffectiveUserInfoByPhone(@Param("phone") String phone, @Param("system") SystemEnum system);
    // 根据获WXUnionId有效用户
    UserInfo getEffectiveUserInfoByWXUnionId(@Param("unionId") String unionId, @Param("system") SystemEnum system);
    //根据淘宝openId获取有效用户
    UserInfo getEffectiveUserInfoByOpenId(@Param("openId") String openId, @Param("system") SystemEnum system);
    //根据微信openid查询
    UserInfo getEffectiveUserInfoByWXOpenId(@Param("wxOpenId") String wxOpenId, @Param("system") SystemEnum system);
    List<UserInfo> list(@Param("query") DaoQuery query);
    Long getMaxUid();
@@ -254,4 +214,15 @@
     * @return
     */
    List<UserInfo> getAutoExtractUserTo1212(@Param("start") int start, @Param("count") int count);
    public static class DaoQuery extends BaseDaoQuery {
        public String phone;
        public String wxUnionId;
        public String openId;
        public String qqOpenId;
        public SystemEnum system;
        public Integer state;
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/user/msg/MsgOverViewsDao.java
New file
@@ -0,0 +1,48 @@
package com.yeshi.fanli.dao.user.msg;
import com.ks.lijin.query.BaseDaoQuery;
import com.yeshi.common.MongodbBaseDao;
import com.yeshi.fanli.entity.bus.msg.MsgOverViews;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
@Repository
public class MsgOverViewsDao extends MongodbBaseDao<MsgOverViews> {
    private Criteria[] getWheres(DaoQuery daoQuery) {
        List<Criteria> whereList = new ArrayList<>();
        if (daoQuery.uid != null) {
            whereList.add(Criteria.where("uid").is(daoQuery.uid));
        }
        Criteria[] wheres = new Criteria[whereList.size()];
        whereList.toArray(wheres);
        return wheres;
    }
    public List<MsgOverViews> list(DaoQuery daoQuery) {
        Query query = new Query();
        query.addCriteria(new Criteria().andOperator(getWheres(daoQuery)));
        query.skip((int) daoQuery.start);
        query.limit(daoQuery.count);
        query.with(new Sort(Sort.Direction.DESC, "updateTime"));
        return findList(query);
    }
    public long count(DaoQuery daoQuery) {
        Query query = new Query();
        query.addCriteria(new Criteria().andOperator(getWheres(daoQuery)));
        return count(query);
    }
    public static class DaoQuery extends BaseDaoQuery {
        public Long uid;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/SystemEnum.java
@@ -8,10 +8,10 @@
 */
public enum SystemEnum {
    blks("com.yeshi.ec.rebate", "com.xyj.ec.fanli-ios", new String[]{}, new SystemFunction[]{
            SystemFunction.bindPhone, SystemFunction.threeSale, SystemFunction.cloudOrder, SystemFunction.godenCorn, SystemFunction.redPack,SystemFunction.faQuan,SystemFunction.fanli,SystemFunction.vip
            SystemFunction.bindPhone, SystemFunction.threeSale, SystemFunction.cloudOrder, SystemFunction.godenCorn, SystemFunction.redPack,SystemFunction.faQuan,SystemFunction.fanli,SystemFunction.vip,SystemFunction.inviteCode
    }, 1, "板栗快省","板栗快省"),
    flq("com.fanliunion.android", "com.xyj.ec.flq-ios", new String[]{}, new SystemFunction[]{SystemFunction.faQuan,SystemFunction.fanli}, 11, "返利联盟","淘拼团"),
    yhqjx("com.youhuiquan.android","com.youhuiquanjx.ios",new String[]{}, new SystemFunction[]{SystemFunction.faQuan,SystemFunction.lijinSub}, 12, "优惠券精选","淘拼团");
    yhqjx("com.youhuiquan.android","com.youhuiquanjx.ios",new String[]{}, new SystemFunction[]{SystemFunction.faQuan,SystemFunction.fanli,SystemFunction.lijinSub,SystemFunction.bindPhone}, 12, "优惠券精选","淘拼团");
    private String packageName;
    private String bundleId;
    private int systemId;
fanli/src/main/java/com/yeshi/fanli/entity/SystemFunction.java
@@ -6,6 +6,7 @@
public enum SystemFunction {
    bindPhone("绑定电话号码"),
    threeSale("三级分销"),
    inviteCode("邀请码"),
    godenCorn("金币"),
    cloudOrder("云发单"),
    redPack("红包"),
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOverViews.java
New file
@@ -0,0 +1,91 @@
package com.yeshi.fanli.entity.bus.msg;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
/**
 * 信息概览
 */
@Document(collection = "msgOverViews")
public class MsgOverViews {
    @Id
    private String id;
    @Indexed
    private Long uid;
    private MsgTypeEnum msgType;
    private Long identityCode;//主键
    @Indexed
    private Date createTime;
    @Indexed
    private Date updateTime;
    public MsgOverViews() {
    }
    public MsgOverViews(Long uid, MsgTypeEnum msgType, Long identityCode, Date createTime, Date updateTime) {
        this.uid = uid;
        this.msgType = msgType;
        this.identityCode = identityCode;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }
    public static String createId(MsgTypeEnum msgType, Long identityCode) {
        return identityCode + "-" + msgType;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public MsgTypeEnum getMsgType() {
        return msgType;
    }
    public void setMsgType(MsgTypeEnum msgType) {
        this.msgType = msgType;
    }
    public Long getIdentityCode() {
        return identityCode;
    }
    public void setIdentityCode(Long identityCode) {
        this.identityCode = identityCode;
    }
    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/msg/MsgTypeEnum.java
New file
@@ -0,0 +1,11 @@
package com.yeshi.fanli.entity.bus.msg;
public enum MsgTypeEnum {
    account("账户消息"), invite("邀请消息"), money("资金消息"), order("订单消息"), system("系统消息"), lijinVip("礼金会员"), other("其他消息");
    private MsgTypeEnum(String name) {
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserAccountBindingHistory.java
@@ -16,6 +16,7 @@
    public final static int TYPE_WX = 1;
    public final static int TYPE_TB = 2;
    public final static int TYPE_PHONE = 3;
    public final static int TYPE_QQ = 4;
    @Column(name = "uabh_id")
    private Long id;
    @Column(name = "uabh_uid")
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInfo.java
@@ -66,6 +66,13 @@
    @Column(name = "wxPic")
    private String wxPic;
    @Expose
    @Column(name = "qq_open_id")
    private String qqOpenId;
    @Expose
    @Column(name = "qq_nick_name")
    private String qqNickName;
    @Column(name = "portrait")
    @Expose
    private String portrait;// 头像
@@ -456,6 +463,23 @@
        this.erCode = erCode;
    }
    public String getQqOpenId() {
        return qqOpenId;
    }
    public void setQqOpenId(String qqOpenId) {
        this.qqOpenId = qqOpenId;
    }
    public String getQqNickName() {
        return qqNickName;
    }
    public void setQqNickName(String qqNickName) {
        this.qqNickName = qqNickName;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInfoModifyRecord.java
@@ -20,7 +20,7 @@
    private static final long serialVersionUID = 1L;
    
    public enum ModifyTypeEnum {
        bindWeiXin("微信授权"), bindPhone("绑定手机"), bindTaoBao("淘宝授权"), setWeiXinNum("添加微信号"),
        bindWeiXin("微信授权"), bindPhone("绑定手机"), bindTaoBao("淘宝授权"), bindQQ("绑定QQ"), setWeiXinNum("添加微信号"),
        gender("设置性别"), portrait("修改头像"),    nickName("修改昵称"), bindAlipay("绑定支付宝");
        
        private final String desc;
fanli/src/main/java/com/yeshi/fanli/entity/config/SystemConfigKeyEnum.java
New file
@@ -0,0 +1,16 @@
package com.yeshi.fanli.entity.config;
public enum SystemConfigKeyEnum {
    appName("应用名称"),
    wxAppId("微信开放平台的appId"),
    wxAppSecret("微信开放平台的appSecret"),
    defaultNickNamePrefix("默认昵称前缀"),
    defaultPortrait("默认头像")
    ;
    private SystemConfigKeyEnum(String name) {
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/system/ConfigKeyEnum.java
@@ -177,6 +177,8 @@
    inviteRules("invite_rules", "动态-学院文章热搜词"),
    vipLink("vip_link", "超级会员升级链接"), // 转移至VIPConfig 已废弃
    helpLinkVipInfo("help_link_vip_info", "超级会员详情页帮助链接"), // 已废弃
    lijinVIPLink("lijin_vip_link", "礼金会员链接"),
    // 文案转链
    convertDocWebLink("convert_doc_web_link", "文案转链网页"),
    convertDocHelpLink("convert_doc_help_link", "文案转链帮助网页"),
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemConfig.java
@@ -3,6 +3,7 @@
import java.util.HashSet;
import java.util.Set;
import com.yeshi.fanli.entity.SystemEnum;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
@@ -26,12 +27,13 @@
    
    @Column(name = "name")
    private String name;
    @Column(name = "system")
    private SystemEnum system;
    
    @Column(name = "updatetime")
    private Long updatetime;
    private Set<BusinessSystem> systems=new HashSet<BusinessSystem>();
    public SystemConfig() {
    }
@@ -80,11 +82,11 @@
        this.updatetime = updatetime;
    }
    public Set<BusinessSystem> getSystems() {
        return systems;
    public SystemEnum getSystem() {
        return system;
    }
    public void setSystems(Set<BusinessSystem> systems) {
        this.systems = systems;
    public void setSystem(SystemEnum system) {
        this.system = system;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/user/UserAccountException.java
@@ -3,14 +3,20 @@
import com.yeshi.fanli.exception.BaseException;
public class UserAccountException extends BaseException {
    private static final long serialVersionUID = 1L;
    public UserAccountException(int code, String msg) {
        super(code, msg);
    }
    public UserAccountException() {
        super();
    }
    private static final long serialVersionUID = 1L;
    //需要绑定手机号
    public final static int CODE_NEED_BIND_PHONE = 101;
    //需要绑定微信
    public final static int CODE_NEED_BIND_WX = 102;
    public UserAccountException(int code, String msg) {
        super(code, msg);
    }
    public UserAccountException() {
        super();
    }
}
fanli/src/main/java/com/yeshi/fanli/lijin/dto/TodayLijinCreatedInfo.java
New file
@@ -0,0 +1,51 @@
package com.yeshi.fanli.lijin.dto;
import java.math.BigDecimal;
/**
 * 用户今日创建的礼金信息
 */
public class TodayLijinCreatedInfo {
    //创建的数量
    private int createdCount;
    //创建的金额
    private BigDecimal createdMoney;
    //剩余的数量
    private int leftCount;
    //剩余的金额
    private BigDecimal leftMoney;
    public int getCreatedCount() {
        return createdCount;
    }
    public void setCreatedCount(int createdCount) {
        this.createdCount = createdCount;
    }
    public BigDecimal getCreatedMoney() {
        return createdMoney;
    }
    public void setCreatedMoney(BigDecimal createdMoney) {
        this.createdMoney = createdMoney;
    }
    public int getLeftCount() {
        return leftCount;
    }
    public void setLeftCount(int leftCount) {
        this.leftCount = leftCount;
    }
    public BigDecimal getLeftMoney() {
        return leftMoney;
    }
    public void setLeftMoney(BigDecimal leftMoney) {
        this.leftMoney = leftMoney;
    }
}
fanli/src/main/java/com/yeshi/fanli/lijin/manager/GoodsLijinMnager.java
@@ -43,28 +43,32 @@
import com.yeshi.fanli.lijin.vo.GoodsDetailVO.*;
import org.yeshi.utils.MoneyBigDecimalUtil;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
@Component
public class GoodsLijinMnager {
    @Reference(version = "1.0",check = false)
    @Reference(version = "1.0", check = false)
    private LijinCreateService lijinCreateService;
    @Reference(version = "1.0",check = false)
    @Reference(version = "1.0", check = false)
    private VipCenterService vipCenterService;
    @Reference(version = "1.0",check = false)
    @Reference(version = "1.0", check = false)
    private VipGradePotenceService vipGradePotenceService;
    @Reference(version = "1.0",check = false)
    @Reference(version = "1.0", check = false)
    private VipGradeService vipGradeService;
    @Reference(version = "1.0", check = false)
    private LiJinLinkService liJinLinkService;
    @Resource
    private UserLijinMnager userLijinMnager;
    private String getUid(Long uid) {
@@ -384,21 +388,13 @@
     */
    public BigDecimal getFanLiRate(Long uid) {
        //加载返利信息
        VIPEnum rank = getVIPRank(uid);
        VIPEnum rank = userLijinMnager.getVIPRank(uid);
        VipGradePotence potence = vipGradePotenceService.getPotenceByVipEnum(rank);
        //获取返利比例
        BigDecimal fanliRate = potence.getRebatePercent();
        return fanliRate;
    }
    public VIPEnum getVIPRank(Long uid) {
        VIPEnum rank = null;
        if (uid != null)
            rank = vipCenterService.getVIPEnumByUid(getUid(uid));
        if (rank == null)
            rank = vipGradeService.getDefaultGrade().getIdentity();
        return rank;
    }
    public GoodsHongBaoListVO.UserLevelVO getUserLevel(VIPEnum vipRank) {
        GoodsHongBaoListVO.UserLevelVO userLevelVO = new GoodsHongBaoListVO.UserLevelVO();
fanli/src/main/java/com/yeshi/fanli/lijin/manager/UserLijinMnager.java
New file
@@ -0,0 +1,177 @@
package com.yeshi.fanli.lijin.manager;
import com.ks.lijin.service.LiJinExpendRecordService;
import com.ks.lijin.service.LiJinLinkService;
import com.ks.lijin.service.LijinCreateService;
import com.ks.vip.exception.VipOrderException;
import com.ks.vip.pojo.DO.*;
import com.ks.vip.pojo.Enums.VIPEnum;
import com.ks.vip.service.*;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.lijin.dto.TodayLijinCreatedInfo;
import com.yeshi.fanli.lijin.vo.UserLijinLevelInfoVO;
import com.yeshi.fanli.service.inter.config.ConfigService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
@Component
public class UserLijinMnager {
    @Reference(version = "1.0", check = false)
    private LijinCreateService lijinCreateService;
    @Reference(version = "1.0", check = false)
    private VipCenterService vipCenterService;
    @Reference(version = "1.0", check = false)
    private VipCenterRecordService vipCenterRecordService;
    @Reference(version = "1.0", check = false)
    private VipGradePotenceService vipGradePotenceService;
    @Reference(version = "1.0", check = false)
    private VipGradeService vipGradeService;
    @Reference(version = "1.0", check = false)
    private VipComboService vipComboService;
    @Reference(version = "1.0", check = false)
    private LiJinLinkService liJinLinkService;
    @Reference(version = "1.0", check = false)
    private LiJinExpendRecordService liJinExpendRecordService;
    @Reference(version = "1.0", check = false)
    private VipOrederService vipOrederService;
    @Resource
    private ConfigService configService;
    private String getUid(Long uid) {
        if (uid == null)
            return null;
        return "tejia-" + uid;
    }
    public VIPEnum getVIPRank(Long uid) {
        VIPEnum rank = null;
        if (uid != null)
            rank = vipCenterService.getVIPEnumByUid(getUid(uid));
        if (rank == null)
            rank = vipGradeService.getDefaultGrade().getIdentity();
        return rank;
    }
    public VipCenter getUserLevelInfo(Long uid) {
        VipCenter vipCenter = vipCenterService.getByUid(getUid(uid));
        if (vipCenter == null)
            return null;
        if (vipCenter.getGradeId().longValue() == vipGradeService.getDefaultGrade().getId())
            return null;
        return vipCenter;
    }
    /**
     * 获取默认等级
     *
     * @return
     */
    public VIPEnum getDefaultRank() {
        return vipGradeService.getDefaultGrade().getIdentity();
    }
    /**
     * 获取会员套餐列表
     *
     * @param vipEnum
     * @return
     */
    public List<VipCombo> getVIPPricelist(VIPEnum vipEnum) {
        return vipComboService.listValid(vipEnum);
    }
    /**
     * 获取今天的创建信息
     *
     * @param uid
     * @return
     */
    public TodayLijinCreatedInfo getTodayCreateInfo(Long uid) {
        VIPEnum rank = getVIPRank(uid);
        TodayLijinCreatedInfo createdInfo = new TodayLijinCreatedInfo();
        BigDecimal createdMoney = liJinExpendRecordService.countTodayMoneyByExpend(getUid(uid));
        int createNum = liJinExpendRecordService.countTodayNumByExpend(getUid(uid));
        createdInfo.setCreatedCount(createNum);
        createdInfo.setCreatedMoney(createdMoney);
        VipGradePotence potence = vipGradePotenceService.getPotenceByVipEnum(rank);
        createdInfo.setLeftCount(potence.getTaolijinMaxNumber() - createNum);
        createdInfo.setLeftMoney(potence.getTaolijinMaxMoney().subtract(createdMoney));
        return createdInfo;
    }
    /**
     * 获取用户等级信息
     *
     * @param uid
     * @param system
     * @return
     */
    public UserLijinLevelInfoVO getUserLevelInfo(Long uid, SystemEnum system) {
        if (system == SystemEnum.yhqjx) {
            VIPEnum rank = getVIPRank(uid);
            UserLijinLevelInfoVO vo = new UserLijinLevelInfoVO();
            vo.setUserLevel(getVIPRank(uid).name());
            vo.setLoadingAdInfo(new UserLijinLevelInfoVO.ADInfo("gdt2", "9041686956722647"));
            if (rank == getDefaultRank()) {
                //当前为默认等级,可以升级
                vo.setUpgradeRights(new UserLijinLevelInfoVO.UpgradeRights("铂金会员免广告,礼金提高100%", configService.getValue(ConfigKeyEnum.lijinVIPLink, system)));
            }
            return vo;
        }
        return null;
    }
    /**
     * 是否可以创建广告订单
     *
     * @param uid
     * @return
     */
    public boolean canCreateADOrder(Long uid) {
        return vipOrederService.canAddOrderByWatchVideo(getUid(uid));
    }
    /**
     * 创建广告订单
     *
     * @param uid
     * @throws VipOrderException
     */
    public void createADOrder(Long uid) throws VipOrderException {
        VipGrade vipGrade = vipGradeService.getByVipEnum(VIPEnum.platinum);
        vipOrederService.addOrderByWatchVideo(getUid(uid), vipGrade.getId(), 24);
    }
    public List<VipCenterRecord> getVipRecordList(Long uid, int page, int pageSize) {
        List<VipCenterRecord> list = vipCenterRecordService.list(getUid(uid), page, pageSize);
        return list;
    }
    public long countVipRecord(Long uid) {
        return vipCenterRecordService.count(getUid(uid));
    }
}
fanli/src/main/java/com/yeshi/fanli/lijin/vo/UserLijinLevelInfoVO.java
New file
@@ -0,0 +1,94 @@
package com.yeshi.fanli.lijin.vo;
/**
 * 用户礼金的等级信息
 */
public class UserLijinLevelInfoVO {
    //当前的等级
    private String userLevel;
    //升级权益
    private UpgradeRights upgradeRights;
    //加载广告信息
    private ADInfo loadingAdInfo;
    public String getUserLevel() {
        return userLevel;
    }
    public void setUserLevel(String userLevel) {
        this.userLevel = userLevel;
    }
    public UpgradeRights getUpgradeRights() {
        return upgradeRights;
    }
    public void setUpgradeRights(UpgradeRights upgradeRights) {
        this.upgradeRights = upgradeRights;
    }
    public ADInfo getLoadingAdInfo() {
        return loadingAdInfo;
    }
    public void setLoadingAdInfo(ADInfo loadingAdInfo) {
        this.loadingAdInfo = loadingAdInfo;
    }
    public static class ADInfo {
        //csj gdt2
        private String type;
        private String pid;
        public ADInfo(String type, String pid) {
            this.type = type;
            this.pid = pid;
        }
        public String getType() {
            return type;
        }
        public void setType(String type) {
            this.type = type;
        }
        public String getPid() {
            return pid;
        }
        public void setPid(String pid) {
            this.pid = pid;
        }
    }
    public static class UpgradeRights {
        private String desc;
        private String link;
        public UpgradeRights(String desc, String link) {
            this.desc = desc;
            this.link = link;
        }
        public String getDesc() {
            return desc;
        }
        public void setDesc(String desc) {
            this.desc = desc;
        }
        public String getLink() {
            return link;
        }
        public void setLink(String link) {
            this.link = link;
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/lijin/vo/VIPGradeVO.java
New file
@@ -0,0 +1,50 @@
package com.yeshi.fanli.lijin.vo;
public class VIPGradeVO {
    private String id;
    private String name;
    private String tag;
    private String money;
    private String originMoney;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getTag() {
        return tag;
    }
    public void setTag(String tag) {
        this.tag = tag;
    }
    public String getMoney() {
        return money;
    }
    public void setMoney(String money) {
        this.money = money;
    }
    public String getOriginMoney() {
        return originMoney;
    }
    public void setOriginMoney(String originMoney) {
        this.originMoney = originMoney;
    }
}
fanli/src/main/java/com/yeshi/fanli/lijin/vo/VipRecordVO.java
New file
@@ -0,0 +1,49 @@
package com.yeshi.fanli.lijin.vo;
public class VipRecordVO {
    private String name;
    private String orderId;
    private String startTime;
    private String endTime;
    private String createTime;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public String getStartTime() {
        return startTime;
    }
    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }
    public String getEndTime() {
        return endTime;
    }
    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }
    public String getCreateTime() {
        return createTime;
    }
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/config/SystemConfigServiceImpl.java
@@ -1,44 +1,66 @@
package com.yeshi.fanli.service.impl.config;
import javax.annotation.Resource;
import com.ks.lib.common.exception.ParamsException;
import com.yeshi.fanli.dao.mybatis.SystemConfigMapper;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.entity.system.SystemConfig;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.SystemConfigMapper;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.entity.system.SystemConfig;
import com.yeshi.fanli.exception.NotExistObjectException;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import javax.annotation.Resource;
@Service
public class SystemConfigServiceImpl implements SystemConfigService{
public class SystemConfigServiceImpl implements SystemConfigService {
    @Resource
    private SystemConfigMapper systemConfigMapper;
    @Resource
    private SystemConfigMapper systemConfigMapper;
    @Cacheable(value={"childSystemCache"}, key="#p0")
    public String get(String sigkey) throws NotExistObjectException {
         SystemConfig systemConfig = systemConfigMapper.getByKey(sigkey);
         if(systemConfig == null ){
            throw new NotExistObjectException("不存在该参数");
        }
        return systemConfig.getValue();
    }
    @Cacheable(value={"childSystemCache"}, key="#p0+#system.id")
    public String get(String key, BusinessSystem system) {
        if(system==null || system.getId()==0){
            return "";
        }
        SystemConfig systemConfig = systemConfigMapper.getByKeyAndSystemId(key, system.getId());
        if(systemConfig != null){;
            return systemConfig.getValue();
        }
        return "";
    }
    @Override
    public void save(SystemConfig systemConfig) throws ParamsException {
        if (systemConfig == null || systemConfig.getSystem() == null || systemConfig.getKey() == null) {
            throw new ParamsException(1, "参数不完整");
        }
        SystemConfig old = getConfig(SystemConfigKeyEnum.valueOf(systemConfig.getKey()), systemConfig.getSystem());
        if (old != null) {
            SystemConfig update = new SystemConfig();
            update.setId(old.getId());
            update.setValue(systemConfig.getValue());
            update.setUpdatetime(System.currentTimeMillis());
            systemConfigMapper.updateByPrimaryKeySelective(update);
        } else {
            if (systemConfig.getUpdatetime() == null) {
                systemConfig.setUpdatetime(System.currentTimeMillis());
            }
            systemConfigMapper.insertSelective(systemConfig);
        }
    }
    @Override
    public SystemConfig getConfig(SystemConfigKeyEnum key, SystemEnum system) {
        return systemConfigMapper.selectByKeyAndSystem(key.name(), system);
    }
    @Cacheable(value = "systemConfig", key = "'getConfig-'+#key+'-'+#system")
    @Override
    public SystemConfig getConfigCache(SystemConfigKeyEnum key, SystemEnum system) {
        return getConfig(key, system);
    }
    @Cacheable(value = "systemConfig", key = "'getValue-'+#key+'-'+#system")
    @Override
    public String getValueCache(SystemConfigKeyEnum key, SystemEnum system) {
        SystemConfig config = getConfig(key, system);
        if (config == null) {
            return null;
        }
        return config.getValue();
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/TaoKeGoodsServiceImpl.java
@@ -10,6 +10,7 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.lijin.manager.GoodsLijinMnager;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.yeshi.utils.JsonUtil;
@@ -42,657 +43,663 @@
@Service
public class TaoKeGoodsServiceImpl implements TaoKeGoodsService {
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private TaoBaoShopService taoBaoShopService;
    @Resource
    private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
    @Resource
    private QualityGoodsService qualityGoodsService;
    @Resource
    private TaoBaoShopService taoBaoShopService;
    @Cacheable(value = "taoKeMaterialCache", key = "'listByMaterial-'+#materialId +'-'+#pageIndex")
    @Override
    public List<TaoBaoGoodsBrief> listByMaterial(Integer materialId, Integer pageIndex, int pageSize) throws Exception {
    @Resource
    private QualityGoodsService qualityGoodsService;
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
    @Resource
    private GoodsLijinMnager goodsLijinMnager;
        if (result == null) {
            return null;
        }
    @Cacheable(value = "taoKeMaterialCache", key = "'listByMaterial-'+#materialId +'-'+#pageIndex")
    @Override
    public List<TaoBaoGoodsBrief> listByMaterial(Integer materialId, Integer pageIndex, int pageSize) throws Exception {
        return result.getTaoBaoGoodsBriefs();
    }
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
    @Override
    @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsGoods-'+#materialId +'-'+#pageIndex")
    public JSONObject getBrandsGoods(Integer materialId, int pageIndex, int pageSize, SystemEnum system) throws Exception {
        if (result == null) {
            return null;
        }
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
        return result.getTaoBaoGoodsBriefs();
    }
        if (result == null) {
            return null;
        }
    @Override
    @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsGoods-'+#materialId +'-'+#pageIndex")
    public JSONObject getBrandsGoods(Integer materialId, int pageIndex, int pageSize, SystemEnum system) throws Exception {
        List<TaoBaoGoodsBrief> listGoods = result.getTaoBaoGoodsBriefs();
        if (listGoods == null || listGoods.size() == 0) {
            return null;
        }
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
        JSONArray arrayGoods = new JSONArray();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
        if (result == null) {
            return null;
        }
        BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
        List<TaoBaoGoodsBrief> listGoods = result.getTaoBaoGoodsBriefs();
        if (listGoods == null || listGoods.size() == 0) {
            return null;
        }
        listGoods.parallelStream().forEach(taoBaoGoodsBrief -> {
        JSONArray arrayGoods = new JSONArray();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
            // Long sellerId = taoBaoGoodsBrief.getSellerId();
            // String title = taoBaoGoodsBrief.getTitle();
            // Long auctionId = taoBaoGoodsBrief.getAuctionId();
        BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
            // TaoBaoShopInfo shopInfo = TaoBaoShopUtil.getTaoBaoShopInfo(title,
            // sellerId, auctionId);
        listGoods.parallelStream().forEach(taoBaoGoodsBrief -> {
            TaoBaoShopInfo shopInfo = taoBaoShopService.getTaoBaoShopInfo(taoBaoGoodsBrief);
            // Long sellerId = taoBaoGoodsBrief.getSellerId();
            // String title = taoBaoGoodsBrief.getTitle();
            // Long auctionId = taoBaoGoodsBrief.getAuctionId();
            if (shopInfo != null) {
                taoBaoGoodsBrief.setShopTitle(shopInfo.getShopTitle());
                String shopType = shopInfo.getShopType();
                if (shopType.contains("tm")) {
                    taoBaoGoodsBrief.setUserType(1);
                } else {
                    taoBaoGoodsBrief.setUserType(0);
                }
            }
            // TaoBaoShopInfo shopInfo = TaoBaoShopUtil.getTaoBaoShopInfo(title,
            // sellerId, auctionId);
            int count = taoBaoGoodsBrief.getBiz30day();
            if (count >= 10000) {
                double sales = count;
                String salesCountMidea = String.format("%.1f", sales / 10000);
                taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
            } else {
                taoBaoGoodsBrief.setSalesCount(count + "");
            }
            TaoBaoShopInfo shopInfo = taoBaoShopService.getTaoBaoShopInfo(taoBaoGoodsBrief);
            // 改变图片尺寸
            String pictUrl = taoBaoGoodsBrief.getPictUrl();
            if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
                taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
            }
            if (shopInfo != null) {
                taoBaoGoodsBrief.setShopTitle(shopInfo.getShopTitle());
                String shopType = shopInfo.getShopType();
                if (shopType.contains("tm")) {
                    taoBaoGoodsBrief.setUserType(1);
                } else {
                    taoBaoGoodsBrief.setUserType(0);
                }
            }
            arrayGoods.add(
                    gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
            int count = taoBaoGoodsBrief.getBiz30day();
            if (count >= 10000) {
                double sales = count;
                String salesCountMidea = String.format("%.1f", sales / 10000);
                taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
            } else {
                taoBaoGoodsBrief.setSalesCount(count + "");
            }
        });
            // 改变图片尺寸
            String pictUrl = taoBaoGoodsBrief.getPictUrl();
            if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
                taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
            }
        JSONObject data = new JSONObject();
        data.put("count", arrayGoods.size());
        data.put("result_list", arrayGoods);
            arrayGoods.add(
                    gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
        return data;
    }
        });
    @Override
    @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsShops-'+#materialId +'-'+#pageIndex")
    public JSONObject getBrandsShops(Integer materialId, int pageIndex, int pageSize) throws Exception {
        JSONObject data = new JSONObject();
        data.put("count", arrayGoods.size());
        data.put("result_list", arrayGoods);
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
        return data;
    }
        if (result == null) {
            return null;
        }
    @Override
    @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsShops-'+#materialId +'-'+#pageIndex")
    public JSONObject getBrandsShops(Integer materialId, int pageIndex, int pageSize) throws Exception {
        List<TaoBaoGoodsBrief> listGoods = result.getTaoBaoGoodsBriefs();
        if (listGoods == null || listGoods.size() == 0) {
            return null;
        }
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
        if (result == null) {
            return null;
        }
        JSONArray arrayShop = new JSONArray();
        List<TaoBaoGoodsBrief> listGoods = result.getTaoBaoGoodsBriefs();
        if (listGoods == null || listGoods.size() == 0) {
            return null;
        }
        listGoods.parallelStream().forEach(taoBaoGoodsBrief -> {
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
            // Long sellerId = taoBaoGoodsBrief.getSellerId();
            // String title = taoBaoGoodsBrief.getTitle();
            // Long auctionId = taoBaoGoodsBrief.getAuctionId();
        JSONArray arrayShop = new JSONArray();
            // TaoBaoShopInfo shopInfo = TaoBaoShopUtil.getTaoBaoShopInfo(title,
            // sellerId, auctionId);
        listGoods.parallelStream().forEach(taoBaoGoodsBrief -> {
            TaoBaoShopInfo shopInfo = taoBaoShopService.getTaoBaoShopInfo(taoBaoGoodsBrief);
            // Long sellerId = taoBaoGoodsBrief.getSellerId();
            // String title = taoBaoGoodsBrief.getTitle();
            // Long auctionId = taoBaoGoodsBrief.getAuctionId();
            if (shopInfo != null) {
            // TaoBaoShopInfo shopInfo = TaoBaoShopUtil.getTaoBaoShopInfo(title,
            // sellerId, auctionId);
                JSONObject jsonShop = new JSONObject();
                String shopType = shopInfo.getShopType();
                if (shopType.contains("tm")) {
                    shopInfo.setShopType("2");
                } else {
                    shopInfo.setShopType("1");
                }
            TaoBaoShopInfo shopInfo = taoBaoShopService.getTaoBaoShopInfo(taoBaoGoodsBrief);
                jsonShop.put("shopInfo", shopInfo);
                jsonShop.put("auctionId", taoBaoGoodsBrief.getAuctionId());
                arrayShop.add(gson.toJson(jsonShop));
            }
            if (shopInfo != null) {
        });
                JSONObject jsonShop = new JSONObject();
                String shopType = shopInfo.getShopType();
                if (shopType.contains("tm")) {
                    shopInfo.setShopType("2");
                } else {
                    shopInfo.setShopType("1");
                }
        JSONObject data = new JSONObject();
        data.put("count", listGoods.size());
        data.put("result_list", arrayShop);
                jsonShop.put("shopInfo", shopInfo);
                jsonShop.put("auctionId", taoBaoGoodsBrief.getAuctionId());
                arrayShop.add(gson.toJson(jsonShop));
            }
        return data;
    }
        });
    @Override
    @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiao-'+#sf+'-'+system")
    public JSONObject searchWuLiao(SearchFilter sf,SystemEnum system) {
        JSONObject data = new JSONObject();
        data.put("count", listGoods.size());
        data.put("result_list", arrayShop);
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null);
        return data;
    }
        List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
        if (result.getNavList() != null)
            navList.addAll(result.getNavList());
    @Override
    @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiao-'+#sf+'-'+system")
    public JSONObject searchWuLiao(SearchFilter sf, SystemEnum system) {
        Gson gson = new GsonBuilder().create();
        JSONObject data = new JSONObject();
        data.put("nav", gson.toJson(navList));
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf, null, null);
        List<TaoBaoGoodsBriefExtra> re = new ArrayList<TaoBaoGoodsBriefExtra>();
        List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs();
        List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
        if (result.getNavList() != null)
            navList.addAll(result.getNavList());
        int fq = sf.getQuan();
        int fh = sf.getHongbao();
        boolean ft = sf.isTmall();
        Gson gson = new GsonBuilder().create();
        JSONObject data = new JSONObject();
        data.put("nav", gson.toJson(navList));
        BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
        List<TaoBaoGoodsBriefExtra> re = new ArrayList<TaoBaoGoodsBriefExtra>();
        List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs();
        if (fq == 0 && fh == 0 && !ft) {
            if (result != null && result.getTaoBaoGoodsBriefs() != null)
                for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) {
                    int count = bf.getBiz30day();
        int fq = sf.getQuan();
        int fh = sf.getHongbao();
        boolean ft = sf.isTmall();
                    String startBiz30day = sf.getStartBiz30day();
                    if (!StringUtil.isNullOrEmpty(startBiz30day)) {
                        int biz30day = Integer.parseInt(startBiz30day);
                        if (count < biz30day) {
                            continue;
                        }
                    }
        BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
                    if (count >= 10000) { // 对销量数据做处理 页面展示7.3万
                        double sales = count;
                        String salesCountMidea = String.format("%.1f", sales / 10000);
                        bf.setSalesCount(salesCountMidea + "万");
                        re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
                    } else {
                        bf.setSalesCount(count + "");
                        re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
                    }
                }
        } else {
            TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra;
            if (taoBaoGoodsBriefs != null)
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
        if (fq == 0 && fh == 0 && !ft) {
            if (result != null && result.getTaoBaoGoodsBriefs() != null)
                for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) {
                    int count = bf.getBiz30day();
                    int count = taoBaoGoodsBrief.getBiz30day();
                    String startBiz30day = sf.getStartBiz30day();
                    if (!StringUtil.isNullOrEmpty(startBiz30day)) {
                        int biz30day = Integer.parseInt(startBiz30day);
                        if (count < biz30day) {
                            continue;
                        }
                    }
                    String startBiz30day = sf.getStartBiz30day();
                    if (!StringUtil.isNullOrEmpty(startBiz30day)) {
                        int biz30day = Integer.parseInt(startBiz30day);
                        if (count < biz30day) {
                            break;
                        }
                    }
                    if (count >= 10000) { // 对销量数据做处理 页面展示7.3万
                        double sales = count;
                        String salesCountMidea = String.format("%.1f", sales / 10000);
                        bf.setSalesCount(salesCountMidea + "万");
                        re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
                    } else {
                        bf.setSalesCount(count + "");
                        re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
                    }
                }
        } else {
            TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra;
            if (taoBaoGoodsBriefs != null)
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
                    if (count >= 10000) {
                        double sales = count;
                        String salesCountMidea = String.format("%.1f", sales / 10000);
                        taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
                        taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
                                proportion.toString(), "");
                        re.add(taoBaoGoodsBriefExtra);
                    } else {
                        taoBaoGoodsBrief.setSalesCount(count + "");
                        taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
                                proportion.toString(), "");
                        re.add(taoBaoGoodsBriefExtra);
                    }
                }
        }
                    int count = taoBaoGoodsBrief.getBiz30day();
        Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().create();
                    String startBiz30day = sf.getStartBiz30day();
                    if (!StringUtil.isNullOrEmpty(startBiz30day)) {
                        int biz30day = Integer.parseInt(startBiz30day);
                        if (count < biz30day) {
                            break;
                        }
                    }
        data.put("result", gson2.toJson(re));
        data.put("count", result.getTaoBaoHead().getDocsfound());
                    if (count >= 10000) {
                        double sales = count;
                        String salesCountMidea = String.format("%.1f", sales / 10000);
                        taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
                        taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
                                proportion.toString(), "");
                        re.add(taoBaoGoodsBriefExtra);
                    } else {
                        taoBaoGoodsBrief.setSalesCount(count + "");
                        taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
                                proportion.toString(), "");
                        re.add(taoBaoGoodsBriefExtra);
                    }
                }
        }
        return data;
    }
    @Override
    @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoV2-'+#sf+'-'+#platform+'-'+#version+'-'+#system")
    public JSONObject searchWuLiaoV2(SearchFilter sf,String platform,String version,SystemEnum system) {
        Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().create();
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null);
        data.put("result", gson2.toJson(re));
        data.put("count", result.getTaoBaoHead().getDocsfound());
        List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
        if (result.getNavList() != null)
            navList.addAll(result.getNavList());
        return data;
    }
        Gson gson = new GsonBuilder().create();
        JSONObject data = new JSONObject();
        data.put("nav", gson.toJson(navList));
        List<GoodsDetailVO> re = new ArrayList<GoodsDetailVO>();
        List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs();
    @Override
    @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoV2-'+#sf+'-'+#platform+'-'+#version+'-'+#system")
    public JSONObject searchWuLiaoV2(SearchFilter sf, String platform, String version, SystemEnum system) {
        int fq = sf.getQuan();
        int fh = sf.getHongbao();
        boolean ft = sf.isTmall();
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf, null, null);
        GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version,system);
        List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
        if (result.getNavList() != null)
            navList.addAll(result.getNavList());
        if (fq == 0 && fh == 0 && !ft) {
            if (result != null && result.getTaoBaoGoodsBriefs() != null)
                for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) {
                    int count = bf.getBiz30day();
        Gson gson = new GsonBuilder().create();
        JSONObject data = new JSONObject();
        data.put("nav", gson.toJson(navList));
                    String startBiz30day = sf.getStartBiz30day();
                    if (!StringUtil.isNullOrEmpty(startBiz30day)) {
                        int biz30day = Integer.parseInt(startBiz30day);
                        if (count < biz30day) {
                            continue;
                        }
                    }
        List<GoodsDetailVO> re = new ArrayList<GoodsDetailVO>();
        List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs();
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(bf, paramsDTO);
                    re.add(goodsDetailVO);
                }
        } else {
            if (taoBaoGoodsBriefs != null)
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
        int fq = sf.getQuan();
        int fh = sf.getHongbao();
        boolean ft = sf.isTmall();
                    int count = taoBaoGoodsBrief.getBiz30day();
                    String startBiz30day = sf.getStartBiz30day();
                    if (!StringUtil.isNullOrEmpty(startBiz30day)) {
                        int biz30day = Integer.parseInt(startBiz30day);
                        if (count < biz30day) {
                            break;
                        }
                    }
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
                    re.add(goodsDetailVO);
                }
        }
        GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version, system);
        Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().create();
        List<TaoBaoGoodsBrief> goodsBriefList = new ArrayList<>();
        if (fq == 0 && fh == 0 && !ft) {
            if (result != null && result.getTaoBaoGoodsBriefs() != null)
                for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) {
                    int count = bf.getBiz30day();
        data.put("result", gson2.toJson(re));
        data.put("count", result.getTaoBaoHead().getDocsfound());
                    String startBiz30day = sf.getStartBiz30day();
                    if (!StringUtil.isNullOrEmpty(startBiz30day)) {
                        int biz30day = Integer.parseInt(startBiz30day);
                        if (count < biz30day) {
                            continue;
                        }
                    }
        return data;
    }
                    goodsBriefList.add(bf);
                }
        } else {
            if (taoBaoGoodsBriefs != null)
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
    @Override
    @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoList-'+#sf+'-'+system")
    public List<TaoBaoGoodsBrief> searchWuLiaoList(SearchFilter sf,SystemEnum system) {
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null);
        if (result == null)
            return null;
                    int count = taoBaoGoodsBrief.getBiz30day();
                    String startBiz30day = sf.getStartBiz30day();
                    if (!StringUtil.isNullOrEmpty(startBiz30day)) {
                        int biz30day = Integer.parseInt(startBiz30day);
                        if (count < biz30day) {
                            break;
                        }
                    }
                    goodsBriefList.add(taoBaoGoodsBrief);
                }
        }
        Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().create();
        return result.getTaoBaoGoodsBriefs();
    }
        List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(system, null, goodsBriefList, paramsDTO);
        for (GoodsDetailVO vo : voList) {
            re.add(vo);
        }
    @Override
    public JSONObject listByWuLiao(int page, String key, String cateIds, String filterParams, String order,
            String startprice, String endprice, String searchParam,SystemEnum system) {
        SearchFilter sf = new SearchFilter();
        sf.setKey(key);
        sf.setPage(page);
        sf.setCateIds(cateIds);
        data.put("result", gson2.toJson(re));
        data.put("count", result.getTaoBaoHead().getDocsfound());
        if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(startprice)) {
            sf.setStartPrice(new BigDecimal(startprice));
        }
        return data;
    }
        if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(endprice)) {
            sf.setEndPrice(new BigDecimal(endprice));
        }
        if (com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) {
            // 默认销量从高到低排序
            sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
        } else {
            if (Integer.parseInt(order) == 1) {
                sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
            } else if (Integer.parseInt(order) == 2) {
                sf.setSort(TaoBaoUtil.SORT_PRICE_HIGH_TO_LOW);
            } else if (Integer.parseInt(order) == 3) {
                sf.setSort(TaoBaoUtil.SORT_PRICE_LOW_TO_HIGH);
            }
        }
    @Override
    @Cacheable(value = "searchWuLiaoCache", key = "'searchWuLiaoList-'+#sf+'-'+system")
    public List<TaoBaoGoodsBrief> searchWuLiaoList(SearchFilter sf, SystemEnum system) {
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf, null, null);
        if (result == null)
            return null;
        return result.getTaoBaoGoodsBriefs();
    }
    @Override
    public JSONObject listByWuLiao(int page, String key, String cateIds, String filterParams, String order,
                                   String startprice, String endprice, String searchParam, SystemEnum system) {
        SearchFilter sf = new SearchFilter();
        sf.setKey(key);
        sf.setPage(page);
        sf.setCateIds(cateIds);
        if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(startprice)) {
            sf.setStartPrice(new BigDecimal(startprice));
        }
        if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(endprice)) {
            sf.setEndPrice(new BigDecimal(endprice));
        }
        if (com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) {
            // 默认销量从高到低排序
            sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
        } else {
            if (Integer.parseInt(order) == 1) {
                sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
            } else if (Integer.parseInt(order) == 2) {
                sf.setSort(TaoBaoUtil.SORT_PRICE_HIGH_TO_LOW);
            } else if (Integer.parseInt(order) == 3) {
                sf.setSort(TaoBaoUtil.SORT_PRICE_LOW_TO_HIGH);
            }
        }
        if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(filterParams)) {
        if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(filterParams)) {
            Set<String> params = new HashSet<String>();
            Set<String> params = new HashSet<String>();
            JSONArray array = JSONArray.fromObject(filterParams);
            JSONArray array = JSONArray.fromObject(filterParams);
            for (int i = 0; i < array.size(); i++) {
            for (int i = 0; i < array.size(); i++) {
                String type = array.optJSONObject(i).optString("type");
                String type = array.optJSONObject(i).optString("type");
                switch (type) {
                case "shoptype":
                    if (array.optJSONObject(i).optInt("id") == 21) {
                        sf.setTmFlagship(false); // 不筛�?
                    } else {
                        sf.setTmFlagship(true);
                        sf.setTmall(true);
                        sf.setShopTag("b2c");
                    }
                    break;
                switch (type) {
                    case "shoptype":
                        if (array.optJSONObject(i).optInt("id") == 21) {
                            sf.setTmFlagship(false); // 不筛�?
                        } else {
                            sf.setTmFlagship(true);
                            sf.setTmall(true);
                            sf.setShopTag("b2c");
                        }
                        break;
                case "category":
                    sf.setCateIds(array.optJSONObject(i).optString("id"));
                    break;
                    case "category":
                        sf.setCateIds(array.optJSONObject(i).optString("id"));
                        break;
                case "userType":
                    sf.setCateIds(array.optJSONObject(i).optString("id"));
                    break;
                    case "userType":
                        sf.setCateIds(array.optJSONObject(i).optString("id"));
                        break;
                case "baoyou":
                    sf.setBaoYou(true);
                    break;
                    case "baoyou":
                        sf.setBaoYou(true);
                        break;
                case "quantype":
                    sf.setQuan(1);
                    if (sf.isTmFlagship()) {
                        sf.setShopTag(sf.getShopTag() + ",dpyhq");
                    } else {
                        sf.setShopTag("dpyhq");
                    }
                    break;
                    case "quantype":
                        sf.setQuan(1);
                        if (sf.isTmFlagship()) {
                            sf.setShopTag(sf.getShopTag() + ",dpyhq");
                        } else {
                            sf.setShopTag("dpyhq");
                        }
                        break;
                case "hongbaotype":
                    if (array.optJSONObject(i).optInt("id") == 41) {
                        sf.setHongbao(1);
                    } else {
                        sf.setHongbao(2);
                    }
                    break;
                    case "hongbaotype":
                        if (array.optJSONObject(i).optInt("id") == 41) {
                            sf.setHongbao(1);
                        } else {
                            sf.setHongbao(2);
                        }
                        break;
                case "property":
                    String pid = (String) array.optJSONObject(i).opt("pid");
                    String id = (String) array.optJSONObject(i).opt("id");
                    boolean flag = false;
                    String str = null;
                    for (String string : params) {
                        flag = string.contains(pid + ":");
                        if (flag) {
                            str = string;
                            break;
                        }
                    }
                    if (flag) {
                        params.add(str + "," + id);
                        params.remove(str);
                    } else {
                        params.add(pid + ":" + id);
                    }
                    break;
                    case "property":
                        String pid = (String) array.optJSONObject(i).opt("pid");
                        String id = (String) array.optJSONObject(i).opt("id");
                        boolean flag = false;
                        String str = null;
                        for (String string : params) {
                            flag = string.contains(pid + ":");
                            if (flag) {
                                str = string;
                                break;
                            }
                        }
                        if (flag) {
                            params.add(str + "," + id);
                            params.remove(str);
                        } else {
                            params.add(pid + ":" + id);
                        }
                        break;
                case "fahuodi":
                    int provinceId = array.optJSONObject(i).optInt("id");
                    sf.setProvinceId(provinceId);
                    break;
                    case "fahuodi":
                        int provinceId = array.optJSONObject(i).optInt("id");
                        sf.setProvinceId(provinceId);
                        break;
                default:
                    break;
                }
            }
            sf.setParams(params);
        }
                    default:
                        break;
                }
            }
            sf.setParams(params);
        }
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf,null,null);
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf, null, null);
        List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
        if (result.getNavList() != null)
            navList.addAll(result.getNavList());
        List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
        if (result.getNavList() != null)
            navList.addAll(result.getNavList());
        Gson gson = new GsonBuilder().create();
        JSONObject data = new JSONObject();
        data.put("nav", gson.toJson(navList));
        Gson gson = new GsonBuilder().create();
        JSONObject data = new JSONObject();
        data.put("nav", gson.toJson(navList));
        List<TaoBaoGoodsBriefExtra> re = new ArrayList<TaoBaoGoodsBriefExtra>();
        List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs();
        List<TaoBaoGoodsBriefExtra> re = new ArrayList<TaoBaoGoodsBriefExtra>();
        List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs();
        int fq = sf.getQuan();
        int fh = sf.getHongbao();
        boolean ft = sf.isTmall();
        int fq = sf.getQuan();
        int fh = sf.getHongbao();
        boolean ft = sf.isTmall();
        BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
        BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
        if (fq == 0 && fh == 0 && !ft) {
            if (result != null && result.getTaoBaoGoodsBriefs() != null)
                for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) {
                    int count = bf.getBiz30day();
                    if (count >= 10000) { // 对销量数据做处理 页面展示7.3万
                        double sales = count;
                        String salesCountMidea = String.format("%.1f", sales / 10000);
                        bf.setSalesCount(salesCountMidea + "万");
                        re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
                    } else {
                        bf.setSalesCount(count + "");
                        re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
                    }
                }
        } else {
            TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra;
            if (taoBaoGoodsBriefs != null)
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
                    int count = taoBaoGoodsBrief.getBiz30day();
                    if (count >= 10000) {
                        double sales = count;
                        String salesCountMidea = String.format("%.1f", sales / 10000);
                        taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
                        taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
                                proportion.toString(), "");
                        re.add(taoBaoGoodsBriefExtra);
                    } else {
                        taoBaoGoodsBrief.setSalesCount(count + "");
                        taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
                                proportion.toString(), "");
                        re.add(taoBaoGoodsBriefExtra);
                    }
                }
        }
        if (fq == 0 && fh == 0 && !ft) {
            if (result != null && result.getTaoBaoGoodsBriefs() != null)
                for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) {
                    int count = bf.getBiz30day();
                    if (count >= 10000) { // 对销量数据做处理 页面展示7.3万
                        double sales = count;
                        String salesCountMidea = String.format("%.1f", sales / 10000);
                        bf.setSalesCount(salesCountMidea + "万");
                        re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
                    } else {
                        bf.setSalesCount(count + "");
                        re.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
                    }
                }
        } else {
            TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra;
            if (taoBaoGoodsBriefs != null)
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
                    int count = taoBaoGoodsBrief.getBiz30day();
                    if (count >= 10000) {
                        double sales = count;
                        String salesCountMidea = String.format("%.1f", sales / 10000);
                        taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
                        taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
                                proportion.toString(), "");
                        re.add(taoBaoGoodsBriefExtra);
                    } else {
                        taoBaoGoodsBrief.setSalesCount(count + "");
                        taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
                                proportion.toString(), "");
                        re.add(taoBaoGoodsBriefExtra);
                    }
                }
        }
        Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().create();
        Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().create();
        data.put("result", gson2.toJson(re));
        data.put("count", result.getTaoBaoHead().getDocsfound());
        data.put("result", gson2.toJson(re));
        data.put("count", result.getTaoBaoHead().getDocsfound());
        return data;
    }
        return data;
    }
    @Override
    public void setSearchFilter(SearchFilter searchfilter, String filter, String order, String startprice,
            String endprice, String fastFilter, Integer totalSales) {
    @Override
    public void setSearchFilter(SearchFilter searchfilter, String filter, String order, String startprice,
                                String endprice, String fastFilter, Integer totalSales) {
        if (!StringUtil.isNullOrEmpty(startprice)) {
            searchfilter.setStartPrice(new BigDecimal(startprice));
        }
        if (!StringUtil.isNullOrEmpty(startprice)) {
            searchfilter.setStartPrice(new BigDecimal(startprice));
        }
        if (!StringUtil.isNullOrEmpty(endprice)) {
            searchfilter.setEndPrice(new BigDecimal(endprice));
        }
        if (!StringUtil.isNullOrEmpty(endprice)) {
            searchfilter.setEndPrice(new BigDecimal(endprice));
        }
        if (totalSales != null) {
            searchfilter.setStartBiz30day(totalSales + "");
        }
        if (totalSales != null) {
            searchfilter.setStartBiz30day(totalSales + "");
        }
        if (!StringUtil.isNullOrEmpty(fastFilter)) {
            if (!StringUtil.isNullOrEmpty(filter)) {
                JSONArray filterArray = JSONArray.fromObject(filter);
                JSONArray fastFilterArray = JSONArray.fromObject(fastFilter);
                filterArray.addAll(fastFilterArray);
                filter = filterArray.toString();
            } else {
                filter = fastFilter;
            }
        }
        if (!StringUtil.isNullOrEmpty(fastFilter)) {
            if (!StringUtil.isNullOrEmpty(filter)) {
                JSONArray filterArray = JSONArray.fromObject(filter);
                JSONArray fastFilterArray = JSONArray.fromObject(fastFilter);
                filterArray.addAll(fastFilterArray);
                filter = filterArray.toString();
            } else {
                filter = fastFilter;
            }
        }
        if (!StringUtil.isNullOrEmpty(filter)) {
            // 查询淘宝天猫
            JSONArray array = JSONArray.fromObject(filter);
            for (int i = 0; i < array.size(); i++) {
                String type = array.optJSONObject(i).optString("type");
                /* 含券 */
                if ("quantype".equalsIgnoreCase(type)) {
                    searchfilter.setQuan(1);
                    continue;
                }
                /* 搜索天猫 */
                if ("shoptype".equalsIgnoreCase(type)) {
                    searchfilter.setTmall(true);
                    continue;
                }
            }
        }
        if (!StringUtil.isNullOrEmpty(filter)) {
            // 查询淘宝天猫
            JSONArray array = JSONArray.fromObject(filter);
            for (int i = 0; i < array.size(); i++) {
                String type = array.optJSONObject(i).optString("type");
                /* 含券 */
                if ("quantype".equalsIgnoreCase(type)) {
                    searchfilter.setQuan(1);
                    continue;
                }
                /* 搜索天猫 */
                if ("shoptype".equalsIgnoreCase(type)) {
                    searchfilter.setTmall(true);
                    continue;
                }
            }
        }
        if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) {
            if (Integer.parseInt(order) == 1 || Integer.parseInt(order) == 0) {
                searchfilter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
            } else if (Integer.parseInt(order) == 2) {
                searchfilter.setSort(TaoBaoUtil.SORT_PRICE_HIGH_TO_LOW);
            } else if (Integer.parseInt(order) == 3) {
                searchfilter.setSort(TaoBaoUtil.SORT_PRICE_LOW_TO_HIGH);
            } else if (Integer.parseInt(order) == 4) {
                searchfilter.setSort(TaoBaoUtil.SORT_TOTAL_SALES_HIGH_TO_LOW);
            } else if (Integer.parseInt(order) == 5) {
                searchfilter.setSort(TaoBaoUtil.SORT_SALE_LOW_TO_HIGH);
            }
        } else {
            searchfilter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
        }
        if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) {
            if (Integer.parseInt(order) == 1 || Integer.parseInt(order) == 0) {
                searchfilter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
            } else if (Integer.parseInt(order) == 2) {
                searchfilter.setSort(TaoBaoUtil.SORT_PRICE_HIGH_TO_LOW);
            } else if (Integer.parseInt(order) == 3) {
                searchfilter.setSort(TaoBaoUtil.SORT_PRICE_LOW_TO_HIGH);
            } else if (Integer.parseInt(order) == 4) {
                searchfilter.setSort(TaoBaoUtil.SORT_TOTAL_SALES_HIGH_TO_LOW);
            } else if (Integer.parseInt(order) == 5) {
                searchfilter.setSort(TaoBaoUtil.SORT_SALE_LOW_TO_HIGH);
            }
        } else {
            searchfilter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
        }
    }
    }
    @Override
    @Cacheable(value = "qualityCache", key = "'countByQuality-'+#start+'-'+#searchKey+'-'+#systemCid+'-'+#listLabId")
    public List<QualityFactory> queryByQuality(long start, int count, String searchKey, Long systemCid,
            List<Long> listLabId) {
    @Override
    @Cacheable(value = "qualityCache", key = "'countByQuality-'+#start+'-'+#searchKey+'-'+#systemCid+'-'+#listLabId")
    public List<QualityFactory> queryByQuality(long start, int count, String searchKey, Long systemCid,
                                               List<Long> listLabId) {
        /* 1、 精选库筛选 */
        List<QualityFactory> listQuality = null;
        /* 1、 精选库筛选 */
        List<QualityFactory> listQuality = null;
        if (listLabId != null && listLabId.size() > 0) {
            // 含标签
            listQuality = qualityGoodsService.listQueryByKeyAndlabIDs(start, count, searchKey, listLabId, null,
                    systemCid, null, null, null, null, null);
        } else {
            listQuality = qualityGoodsService.listQueryByKey(start, count, searchKey, null, systemCid, null, null, null,
                    null, null);
        }
        if (listLabId != null && listLabId.size() > 0) {
            // 含标签
            listQuality = qualityGoodsService.listQueryByKeyAndlabIDs(start, count, searchKey, listLabId, null,
                    systemCid, null, null, null, null, null);
        } else {
            listQuality = qualityGoodsService.listQueryByKey(start, count, searchKey, null, systemCid, null, null, null,
                    null, null);
        }
        return listQuality;
    }
        return listQuality;
    }
    @Override
    @Cacheable(value = "qualityCache", key = "'countByQuality-'+#searchKey+'-'+#systemCid+'-'+#listLabId")
    public long countByQuality(String searchKey, Long systemCid, List<Long> listLabId) {
    @Override
    @Cacheable(value = "qualityCache", key = "'countByQuality-'+#searchKey+'-'+#systemCid+'-'+#listLabId")
    public long countByQuality(String searchKey, Long systemCid, List<Long> listLabId) {
        long incount = 0;
        long incount = 0;
        if (listLabId != null && listLabId.size() > 0) {
            // 含标签
            incount = qualityGoodsService.countQueryKeyAndlabIDs(searchKey, listLabId, systemCid, null, null, null,
                    null, null);
        } else {
            incount = qualityGoodsService.countQueryByKey(searchKey, systemCid, null, null, null, null, null);
        }
        if (listLabId != null && listLabId.size() > 0) {
            // 含标签
            incount = qualityGoodsService.countQueryKeyAndlabIDs(searchKey, listLabId, systemCid, null, null, null,
                    null, null);
        } else {
            incount = qualityGoodsService.countQueryByKey(searchKey, systemCid, null, null, null, null, null);
        }
        return incount;
    }
        return incount;
    }
    @Override
    public JSONObject listQualityGoods(List<QualityFactory> listQuality, List<TaoBaoGoodsBrief> searchWuLiaoList,
            Map<String, String> map,SystemEnum system) {
    @Override
    public JSONObject listQualityGoods(List<QualityFactory> listQuality, List<TaoBaoGoodsBrief> searchWuLiaoList,
                                       Map<String, String> map, SystemEnum system) {
        JSONArray array = new JSONArray();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
        JSONArray array = new JSONArray();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
        BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
        BigDecimal proportion = hongBaoManageService.getFanLiRate(system);
        /* 遍历列表数据 */
        for (QualityFactory selectionGoods : listQuality) {
        /* 遍历列表数据 */
        for (QualityFactory selectionGoods : listQuality) {
            TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
            TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
            if (taoBaoGoodsBrief == null) {
                continue;
            }
            if (taoBaoGoodsBrief == null) {
                continue;
            }
            int biz30day = taoBaoGoodsBrief.getBiz30day();
            if (biz30day >= 10000) {
                double sales = biz30day;
                String salesCountMidea = String.format("%.1f", sales / 10000);
                taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
            } else {
                taoBaoGoodsBrief.setSalesCount(biz30day + "");
            }
            int biz30day = taoBaoGoodsBrief.getBiz30day();
            if (biz30day >= 10000) {
                double sales = biz30day;
                String salesCountMidea = String.format("%.1f", sales / 10000);
                taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
            } else {
                taoBaoGoodsBrief.setSalesCount(biz30day + "");
            }
            array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
        }
            array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
        }
        if (searchWuLiaoList != null && searchWuLiaoList.size() > 0) {
            /* 遍历列表数据 */
            for (TaoBaoGoodsBrief taoBaoGoodsBrief : searchWuLiaoList) {
        if (searchWuLiaoList != null && searchWuLiaoList.size() > 0) {
            /* 遍历列表数据 */
            for (TaoBaoGoodsBrief taoBaoGoodsBrief : searchWuLiaoList) {
                int biz30day = taoBaoGoodsBrief.getBiz30day();
                int biz30day = taoBaoGoodsBrief.getBiz30day();
                if (biz30day >= 10000) {
                    double sales = biz30day;
                    String salesCountMidea = String.format("%.1f", sales / 10000);
                    taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
                } else {
                    taoBaoGoodsBrief.setSalesCount(biz30day + "");
                }
                if (biz30day >= 10000) {
                    double sales = biz30day;
                    String salesCountMidea = String.format("%.1f", sales / 10000);
                    taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
                } else {
                    taoBaoGoodsBrief.setSalesCount(biz30day + "");
                }
                array.add(gson
                        .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
            }
        }
                array.add(gson
                        .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
            }
        }
        JSONObject data = new JSONObject();
        JSONObject data = new JSONObject();
        List<TaoBaoSearchNav> navList = new ArrayList<TaoBaoSearchNav>();
        Gson gsonBuilder = new GsonBuilder().create();
        data.put("nav", gsonBuilder.toJson(navList));
        data.put("count", 5000);
        data.put("result", array);
        List<TaoBaoSearchNav> navList = new ArrayList<TaoBaoSearchNav>();
        Gson gsonBuilder = new GsonBuilder().create();
        data.put("nav", gsonBuilder.toJson(navList));
        data.put("count", 5000);
        data.put("result", array);
        return data;
    }
        return data;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOverViewsServiceImpl.java
New file
@@ -0,0 +1,47 @@
package com.yeshi.fanli.service.impl.msg;
import com.yeshi.fanli.dao.user.msg.MsgOverViewsDao;
import com.yeshi.fanli.entity.bus.msg.MsgOverViews;
import com.yeshi.fanli.service.inter.msg.MsgOverViewsService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
public class MsgOverViewsServiceImpl implements MsgOverViewsService {
    @Resource
    private MsgOverViewsDao msgOverViewsDao;
    @Override
    public void save(MsgOverViews msgOverViews) {
        if (msgOverViews == null)
            return;
        if (msgOverViews.getMsgType() == null || msgOverViews.getUid() == null || msgOverViews.getIdentityCode() == null)
            return;
        msgOverViews.setId(MsgOverViews.createId(msgOverViews.getMsgType(), msgOverViews.getIdentityCode()));
        if (msgOverViews.getCreateTime() == null) {
            msgOverViews.setCreateTime(new Date());
        }
        msgOverViewsDao.save(msgOverViews);
    }
    @Override
    public List<MsgOverViews> listByUid(Long uid, int page, int pageSize) {
        MsgOverViewsDao.DaoQuery daoQuery = new MsgOverViewsDao.DaoQuery();
        daoQuery.uid = uid;
        daoQuery.start = (page - 1) * pageSize;
        daoQuery.count = pageSize;
        return msgOverViewsDao.list(daoQuery);
    }
    @Override
    public long countByUid(Long uid) {
        MsgOverViewsDao.DaoQuery daoQuery = new MsgOverViewsDao.DaoQuery();
        daoQuery.uid = uid;
        return msgOverViewsDao.count(daoQuery);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -8,11 +8,13 @@
import javax.servlet.http.HttpSession;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SMSConfig;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.util.*;
import com.yeshi.fanli.vo.taobao.TaoBaoUser;
import com.yeshi.fanli.vo.user.QQUserInfoVO;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -123,7 +125,7 @@
        if (first != null && first == true) {
            session.removeAttribute("LAST_LOGIN_USER");
        }
            // 会话中上次登录的用户
        // 会话中上次登录的用户
        if (wxinstall) {// 安装了微信的状态
            UserInfo lastUser = (UserInfo) session.getAttribute("LAST_LOGIN_USER");
            UserInfo userInfo = null;
@@ -795,72 +797,80 @@
                return portrait;
            }
        }
        return user.getPortrait();
    }
    @Override
    public String getMobile(String vcode, String phone, String aliAccessToken, SystemEnum system, int vcodeType) throws UserAccountException {
        if (!StringUtil.isNullOrEmpty(aliAccessToken)) {
            String mobile = AliyunOneKeyLoginUtil.getMobile(aliAccessToken, "");
            if (StringUtil.isNullOrEmpty(mobile)) {
                throw new UserAccountException(1, "手机号获取失败");
            }
            return mobile;
        } else {
            // 空额清理
            if (phone == null || phone.trim().length() == 0) {
                throw new UserAccountException(1, "请输入手机号码");
            }
            phone = phone.replaceAll(" ", "");
            boolean isDemo = false;
            //查询上线测试的号码与验证码
            String demoLogin = configService.getValue(ConfigKeyEnum.demoLoginUser, system);
            if (!StringUtil.isNullOrEmpty(demoLogin)) {
                String demoPhone = demoLogin.split("#")[0];
                String demoCode = demoLogin.split("#")[1];
                if (phone.equalsIgnoreCase(demoPhone) && demoCode.equalsIgnoreCase(vcode)) {
                    isDemo = true;
                }
            }
            // 苹果应用商店上线测试号码
            if (!isDemo) {
                if (StringUtil.isNullOrEmpty(vcode)) {
                    throw new UserAccountException(1, "请输入验证码");
                }
                String oldVcode = redisManager.getSMSVCode(phone, vcodeType);
                LogHelper.test("----------------------登录验证码: " + oldVcode);
                if (!Constant.IS_TEST)
                    if (StringUtil.isNullOrEmpty(oldVcode) || !oldVcode.equalsIgnoreCase(vcode)) {
                        throw new UserAccountException(1, "验证码错误,重新输入");
                    } else {// 验证码输入正确
                        redisManager.clearSMSVCode(phone, vcodeType);
                    }
            }
            return phone;
        }
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UserInfo loginPhone(ProxyIP ipInfo, int loginType, String vcode, String phone, BusinessSystem businessSystem)
    public UserInfo loginPhone(ProxyIP ipInfo, int loginType, String vcode, String phone, String aliAccessToken, BusinessSystem businessSystem)
            throws UserAccountException {
        // 空额清理
        if (phone == null || phone.trim().length() == 0) {
            throw new UserAccountException(1, "请输入手机号码");
        }
        phone = phone.replaceAll(" ", "");
        boolean isDemo=false;
        //查询上线测试的号码与验证码
        String demoLogin = configService.getValue(ConfigKeyEnum.demoLoginUser, businessSystem.getSystem());
        if (!StringUtil.isNullOrEmpty(demoLogin)) {
            String demoPhone = demoLogin.split("#")[0];
            String demoCode = demoLogin.split("#")[1];
            if(phone.equalsIgnoreCase(demoPhone)&&demoCode.equalsIgnoreCase(vcode)){
                isDemo=true;
            }
        }
//        "17316780233".equalsIgnoreCase(phone) && "2581".equalsIgnoreCase(vcode);
        // 苹果应用商店上线测试号码
        if (isDemo) {//测试号码
            ;
        } else {
            if (StringUtil.isNullOrEmpty(vcode)) {
                throw new UserAccountException(1, "请输入验证码");
            }
            String oldVcode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_LOGIN);
            LogHelper.test("----------------------登录验证码: " + oldVcode);
            if (!Constant.IS_TEST)
                if (StringUtil.isNullOrEmpty(oldVcode) || !oldVcode.equalsIgnoreCase(vcode)) {
                    throw new UserAccountException(1, "验证码错误,重新输入");
                } else {// 验证码输入正确
                    redisManager.clearSMSVCode(phone, SMSHistory.TYPE_LOGIN);
                }
        }
        String mobile = getMobile(vcode, phone, aliAccessToken, businessSystem.getSystem(), SMSHistory.TYPE_LOGIN);
        JSONObject logInfo = new JSONObject();
        logInfo.put("appId", businessSystem.getAppid());
        logInfo.put("phone", phone);
        logInfo.put("phone", mobile);
        logInfo.put("loginType", loginType);
        LogHelper.lgoinInfo(logInfo.toString());
        // 判断手机号码是否被封禁
        ForbiddenUserIdentifyCode identifyCode1 = forbiddenUserIdentifyCodeService
                .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, phone);
                .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, mobile);
        if (identifyCode1 != null && identifyCode1.getEffective() != null && identifyCode1.getEffective()) {
            throw new UserAccountException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC);
        }
        // 清空限制
        redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
        redisManager.clearSMSFrequencyLimit(mobile, SMSHistory.TYPE_LOGIN);
        // 清理次数
        String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSLoginCount, phone);
        String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSLoginCount, mobile);
        redisManager.removeCommonString(key);
        // 采用redis事务防止一个手机号多次注册问题
        String watchKey = StringUtil.Md5("REGISTER:" + phone);
        String watchKey = StringUtil.Md5("REGISTER:" + mobile);
        Jedis jedis = redisManager.getJedis();
        try {
            jedis.watch(watchKey);
@@ -874,7 +884,7 @@
            } else {
                // 查询是否存在该电话历史用户
                UserInfo userInfo = userInfoService.getEffectiveUserInfoByPhone(phone, businessSystem.getSystem());
                UserInfo userInfo = userInfoService.getEffectiveUserInfoByPhone(mobile, businessSystem.getSystem());
                if (userInfo != null) {
                    // 更新账户登录信息
                    updateLonginInfo(userInfo, loginType, ipInfo);
@@ -882,7 +892,7 @@
                    userInfo = new UserInfo();
                    userInfo.setAppId(businessSystem.getAppid());
                    userInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
                    userInfo.setPhone(phone);
                    userInfo.setPhone(mobile);
                    userInfo.setLoginType(loginType);
                    userInfo.setState(UserInfo.STATE_NORMAL);
                    userInfo.setSystem(businessSystem.getSystem());
@@ -895,7 +905,7 @@
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    userInfoModifyRecordService.addModifyRecord(userInfo.getId(), ModifyTypeEnum.bindPhone, phone);
                    userInfoModifyRecordService.addModifyRecord(userInfo.getId(), ModifyTypeEnum.bindPhone, mobile);
                }
                return userInfo;
            }
@@ -1158,9 +1168,35 @@
        UserInfo userInfo = userInfoService.getEffectiveUserInfoByWXUnionId(weiXinUser.getUnionid(), businessSystem.getSystem());
        if (userInfo == null) {
            String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey,
                    StringUtil.Md5("WXLogin:" + weiXinUser.getUnionid()));
                    "WXLogin#" + StringUtil.Md5(weiXinUser.getUnionid()));
            redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
            throw new UserAccountException(101, key);
            throw new UserAccountException(UserAccountException.CODE_NEED_BIND_PHONE, key);
        }
        // 更新账户登录信息
        updateLonginInfo(userInfo, loginType, ipInfo);
        Long uid = userInfo.getId();
        ThreadUtil.run(new Runnable() {
            public void run() {
                // 删除邀请分享图
                spreadUserImgService.deleteImgUrl(uid);
            }
        });
        return userInfo;
    }
    @Override
    public UserInfo loginQQ(ProxyIP ipInfo, int loginType, QQUserInfoVO qqUserInfo, BusinessSystem businessSystem) throws UserAccountException {
        // 通过Code换取信息
        if (qqUserInfo == null) {
            throw new UserAccountException(1, "QQ信息为空");
        }
        UserInfo userInfo = userInfoService.getEffectiveUserInfoByQQOpenId(qqUserInfo.getOpenid(), businessSystem.getSystem());
        if (userInfo == null) {
            String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey,
                    "QQLogin#" + StringUtil.Md5(qqUserInfo.getOpenid()));
            redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(qqUserInfo), 60 * 20);
            throw new UserAccountException(UserAccountException.CODE_NEED_BIND_PHONE, key);
        }
        // 更新账户登录信息
        updateLonginInfo(userInfo, loginType, ipInfo);
@@ -1233,9 +1269,8 @@
    @Transactional(rollbackFor = UserAccountException.class)
    @Override
    public void bindWeiXin(AcceptData acceptData, Long uid, String code) throws UserAccountException {
        WXAccountInfoDTO wxAccount = Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion());
        WeiXinUser weiXinUser = WXAppLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret());
    public void bindWeiXin(BusinessSystem system, Long uid, String code) throws UserAccountException {
        WeiXinUser weiXinUser = WXAppLoginUtil.getWeiXinUser(code, system.getWxAppId(), system.getWxAppSecret());
        if (weiXinUser == null) {
            throw new UserAccountException(2, "微信帐号授权失败");
        }
@@ -1334,6 +1369,73 @@
    }
    @Override
    public void bindQQ(Long uid, QQUserInfoVO qqUser) throws UserAccountException {
        UserInfo user = userInfoService.selectAvailableByPrimaryKey(uid);
        if (user == null) {
            throw new UserAccountException(1, "用户不存在");
        }
        if (qqUser == null || StringUtil.isNullOrEmpty(qqUser.getOpenid())) {
            throw new UserAccountException(2, "qq用户信息为空");
        }
        String qqOpenIdExist = user.getQqOpenId();
        if (StringUtil.isNullOrEmpty(qqOpenIdExist)) {
            UserInfo newUser = userInfoService.getEffectiveUserInfoByQQOpenId(qqUser.getOpenid(), user.getSystem());
            if (newUser != null) {
                throw new UserAccountException(4, "该QQ号已被其他帐号绑定");
            }
        } else if (qqUser.getOpenid().equalsIgnoreCase(qqOpenIdExist)) {
            throw new UserAccountException(3, "QQ帐号一致无需更换");
        }
        if (StringUtil.isNullOrEmpty(user.getPhone())) {
            throw new UserAccountException(5, "该帐号没有绑定手机号码,需绑定手机号码才能完成QQ更换");
        }
        UserInfo updateUserInfo = new UserInfo(uid);
        updateUserInfo.setQqNickName(qqUser.getNickname());
        updateUserInfo.setQqOpenId(qqUser.getOpenid());
        // 将默认昵称替换成微信昵称
        String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
        if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(qqUser.getNickname())) {
            defaultNickName = defaultNickName + uid;
            if ((defaultNickName.equals(user.getNickName()) || "板栗快省".equals(user.getNickName()))) {
                updateUserInfo.setNickName(qqUser.getNickname());
            }
        }
        // 将默认头像替换成QQ头像
        String defaultPortrait = Constant.systemCommonConfig.getDefaultPortrait();
        if (!StringUtil.isNullOrEmpty(qqUser.getFigureurl_2()) && !StringUtil.isNullOrEmpty(defaultPortrait)
                && defaultPortrait.equals(user.getPortrait())) {
            String headimgurl = qqUser.getFigureurl_2();
            updateUserInfo.setPortrait(headimgurl);
        }
        userInfoService.updateByPrimaryKeySelective(updateUserInfo);
        // 加入绑定记录
        UserAccountBindingHistory history = new UserAccountBindingHistory();
        history.setContent(qqUser.getOpenid());
        history.setType(UserAccountBindingHistory.TYPE_QQ);
        history.setUid(uid);
        // 之前已经绑定电话号码
        if (!StringUtil.isNullOrEmpty(user.getQqOpenId()))
            history.setFirst(false);
        else
            history.setFirst(true);
        userAccountBindingHistoryService.addUserAccountBindingHistory(history);
        userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_QQ);
        userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindQQ, user.getQqOpenId());
    }
    @Override
    public UserInfo bindPhoneToLogin(ProxyIP ipinfo, AcceptData acceptData, String phone, String key)
            throws UserAccountException {
@@ -1343,32 +1445,77 @@
        if (identifyCode1 != null && identifyCode1.getEffective() != null && identifyCode1.getEffective())
            throw new UserAccountException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC);
        int loginType = 0;
        String loginName = "";
        if (key.contains("QQLogin#")) {
            //qq登录
            loginType = 4;
            loginName = "QQ";
        } else {
            //微信登录
            loginType = 2;
            loginName = "微信";
        }
        String value = redisManager.getCommonString(key);
        if (StringUtil.isNullOrEmpty(value))
            throw new UserAccountException(1, "微信授权失效,请使用微信重新登录");
        WeiXinUser weiXinUser = JsonUtil.getSimpleGson().fromJson(value, WeiXinUser.class);
        if (weiXinUser == null)
            throw new UserAccountException(1, "微信授权失效,请使用微信重新登录");
            throw new UserAccountException(1, String.format("%s授权失效,请使用%s重新登录", loginName, loginName));
        SystemEnum system = SystemInfoUtil.getSystem(acceptData);
        String thirdPortrait;
        String thirdCode;
        String thirdNickName;
        QQUserInfoVO qqUser = null;
        WeiXinUser weiXinUser = null;
        if (loginType == 4) {
            qqUser = JsonUtil.getSimpleGson().fromJson(value, QQUserInfoVO.class);
        UserInfo userInfo = userInfoService.getEffectiveUserInfoByWXUnionId(weiXinUser.getUnionid(), system);
        // 直接用的微信登录
        if (userInfo != null)
            throw new UserAccountException(10, "该微信号已被占用");
            if (qqUser == null)
                throw new UserAccountException(1, "QQ授权失效,请使用QQ重新授权登录");
            thirdPortrait = qqUser.getFigureurl_2();
            thirdCode = qqUser.getOpenid();
            thirdNickName = qqUser.getNickname();
            UserInfo userInfo = userInfoService.getEffectiveUserInfoByQQOpenId(qqUser.getOpenid(), system);
            // 直接用的QQ登录
            if (userInfo != null)
                throw new UserAccountException(10, "该QQ号已被占用");
        } else {
            weiXinUser = JsonUtil.getSimpleGson().fromJson(value, WeiXinUser.class);
            if (weiXinUser == null)
                throw new UserAccountException(1, "三方授权失效,请使用三方重新授权登录");
            thirdPortrait = weiXinUser.getHeadimgurl();
            thirdCode = weiXinUser.getUnionid();
            thirdNickName = weiXinUser.getNickname();
            UserInfo userInfo = userInfoService.getEffectiveUserInfoByWXUnionId(weiXinUser.getUnionid(), system);
            // 直接用的微信登录
            if (userInfo != null)
                throw new UserAccountException(10, "该微信号已被占用");
        }
        String portrait = null;
        if (!StringUtil.isNullOrEmpty(weiXinUser.getHeadimgurl())) {
            InputStream asInputStream = HttpUtil.getAsInputStream(weiXinUser.getHeadimgurl());
        if (!StringUtil.isNullOrEmpty(thirdPortrait)) {
            InputStream asInputStream = HttpUtil.getAsInputStream(thirdPortrait);
            if (asInputStream != null) {
                FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream,
                        String.format(FilePathEnum.userWXPortrait.getPath() + "%s_%s.jpg", weiXinUser.getUnionid(),
                                System.currentTimeMillis() + ""));
                String path = "";
                if (loginType == 4) {
                    path = String.format(FilePathEnum.userQQPortrait.getPath() + "%s_%s.jpg", thirdCode,
                            System.currentTimeMillis() + "");
                } else {
                    path = String.format(FilePathEnum.userWXPortrait.getPath() + "%s_%s.jpg", thirdCode,
                            System.currentTimeMillis() + "");
                }
                FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream, path);
                if (result != null && !StringUtil.isNullOrEmpty(result.getUrl()))
                    portrait = result.getUrl();
            } else {
                portrait = weiXinUser.getHeadimgurl();
                portrait = thirdPortrait;
            }
        }
@@ -1377,17 +1524,32 @@
        // 是否需要创建新账户
        UserInfo phoneUser = userInfoService.getEffectiveUserInfoByPhone(phone, system);
        UserInfo userInfo = null;
        if (phoneUser != null) {
            // 绑定微信
            if (StringUtil.isNullOrEmpty(phoneUser.getWxUnionId())) {
                try {
                    bindWeiXin(phoneUser.getId(), weiXinUser);
                } catch (Exception e) {
                    throw new UserAccountException(1, "微信绑定失败");
            if (weiXinUser != null) {
                if (StringUtil.isNullOrEmpty(phoneUser.getWxUnionId())) {
                    try {
                        bindWeiXin(phoneUser.getId(), weiXinUser);
                    } catch (Exception e) {
                        throw new UserAccountException(1, "微信绑定失败");
                    }
                } else {
                    throw new UserAccountException(1, "该微信已被绑定");
                }
            } else {
                throw new UserAccountException(1, "该微信已被绑定");
            }
            if (qqUser != null) {
                if (StringUtil.isNullOrEmpty(phoneUser.getQqOpenId())) {
                    try {
                        bindQQ(phoneUser.getId(), qqUser);
                    } catch (Exception e) {
                        throw new UserAccountException(1, "QQ绑定失败");
                    }
                } else {
                    throw new UserAccountException(1, "该QQ已被绑定");
                }
            }
            userInfo = userInfoService.selectAvailableByPrimaryKey(phoneUser.getId());
        } else {
            // 创建新账户
@@ -1395,13 +1557,21 @@
            userInfo.setPhone(phone);
            userInfo.setPortrait(portrait);
            userInfo.setAppId(null);
            userInfo.setNickName(weiXinUser.getNickname());
            userInfo.setWxName(weiXinUser.getNickname());
            userInfo.setWxOpenId(weiXinUser.getOpenid());
            userInfo.setWxUnionId(weiXinUser.getUnionid());
            userInfo.setWxPic(weiXinUser.getHeadimgurl());
            if (weiXinUser != null) {
                userInfo.setNickName(weiXinUser.getNickname());
                userInfo.setWxName(weiXinUser.getNickname());
                userInfo.setWxOpenId(weiXinUser.getOpenid());
                userInfo.setWxUnionId(weiXinUser.getUnionid());
                userInfo.setWxPic(weiXinUser.getHeadimgurl());
                userInfo.setLoginType(2);
            }
            if (qqUser != null) {
                userInfo.setQqOpenId(qqUser.getOpenid());
                userInfo.setQqNickName(qqUser.getNickname());
                userInfo.setLoginType(4);
            }
            userInfo.setLastLoginTime(System.currentTimeMillis());
            userInfo.setLoginType(2);
            userInfo.setLastLoginIp(ipinfo.getIp());
            userInfo.setState(UserInfo.STATE_NORMAL);
            userInfo.setSystem(system);
@@ -1409,6 +1579,8 @@
        }
        Long uid = userInfo.getId();
        final WeiXinUser tempWeiXinUser = weiXinUser;
        final QQUserInfoVO tempQQUser = qqUser;
        ThreadUtil.run(new Runnable() {
            public void run() {
                try {
@@ -1427,7 +1599,10 @@
                userAccountBindingHistoryService.addUserAccountBindingHistory(history);
                userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindPhone, phone);
                userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindWeiXin, weiXinUser.getUnionid());
                if (tempWeiXinUser != null)
                    userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindWeiXin, tempWeiXinUser.getUnionid());
                if (tempQQUser != null)
                    userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindQQ, tempQQUser.getOpenid());
            }
        });
        // 删除缓存
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java
@@ -104,11 +104,16 @@
    public UserInfo getUserByLoginTypeAndOpenId(int loginType, String openid, SystemEnum sysetm) {
        List<UserInfo> list = null;
        UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery();
        daoQuery.system = sysetm;
        daoQuery.count = 1000;
        if (loginType == 1) {
            list = userInfoMapper.listBySystemAndTaoBaoOpenId(sysetm, openid);
            daoQuery.openId = openid;
        } else {
            list = userInfoMapper.listBySystemAndWXUnionId(sysetm, openid);
            daoQuery.wxUnionId = openid;
        }
        list = userInfoMapper.list(daoQuery);
        if (list != null)
            for (int i = 0; i < list.size(); i++) {
@@ -265,16 +270,16 @@
    @Override
    public long countInfo(Integer userState, String key, Integer keyType, String userRank, Integer days,
                          String startTime, String endTime, Integer userType, String level, Integer activeCode,SystemEnum system) {
        return userInfoMapper.countInfo(userState, key, keyType, userRank, days, startTime, endTime, userType, level, activeCode,system);
                          String startTime, String endTime, Integer userType, String level, Integer activeCode, SystemEnum system) {
        return userInfoMapper.countInfo(userState, key, keyType, userRank, days, startTime, endTime, userType, level, activeCode, system);
    }
    @Override
    public List<UserInfoVO> queryInfo(long start, int count, Integer userState, String key, Integer keyType,
                                      String userRank, Integer days, String startTime, String endTime, Integer userType, String level, Integer activeCode,SystemEnum system) {
                                      String userRank, Integer days, String startTime, String endTime, Integer userType, String level, Integer activeCode, SystemEnum system) {
        List<UserInfoVO> userList = userInfoMapper.queryInfo(start, count, userState, key, keyType, userRank, days,
                startTime, endTime, userType, level, activeCode,system);
                startTime, endTime, userType, level, activeCode, system);
        if (userList == null || userList.size() == 0) {
            return null;
@@ -323,17 +328,30 @@
    @Override
    public List<UserInfo> listBySystemAndWXUnionId(SystemEnum system, String unionId) {
        return userInfoMapper.listBySystemAndWXUnionId(system, unionId);
        UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery();
        daoQuery.system = system;
        daoQuery.count = 1000;
        daoQuery.wxUnionId = unionId;
        return userInfoMapper.list(daoQuery);
    }
    @Override
    public List<UserInfo> listBySystemAndTaoBaoOpenId(SystemEnum system, String openId) {
        return userInfoMapper.listBySystemAndTaoBaoOpenId(system, openId);
        UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery();
        daoQuery.system = system;
        daoQuery.count = 1000;
        daoQuery.openId = openId;
        return userInfoMapper.list(daoQuery);
    }
    @Override
    public List<UserInfo> listBySystemAndPhone(SystemEnum system, String phone) {
        return userInfoMapper.listBySystemAndPhone(system, phone);
        UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery();
        daoQuery.system = system;
        daoQuery.count = 1000;
        daoQuery.phone = phone;
        return userInfoMapper.list(daoQuery);
    }
    @Override
@@ -354,17 +372,17 @@
    @Override
    public long queryCount(Integer userState, String key, Integer keyType, String userRank, Integer days,
                           String startTime, String endTime, Integer userType, String level, Integer activeCode,SystemEnum system) {
        return userInfoMapper.queryCount(userState, key, keyType, userRank, days, startTime, endTime, userType, level, activeCode,system);
                           String startTime, String endTime, Integer userType, String level, Integer activeCode, SystemEnum system) {
        return userInfoMapper.queryCount(userState, key, keyType, userRank, days, startTime, endTime, userType, level, activeCode, system);
    }
    @Override
    public List<UserInfoVO> query(long start, int count, Integer userState, String key, Integer keyType,
                                  String userRank, Integer days, String startTime, String endTime, Integer orderField, Integer orderMode,
                                  Integer userType, String level, Integer activeCode,SystemEnum system) {
                                  Integer userType, String level, Integer activeCode, SystemEnum system) {
        List<UserInfoVO> userList = userInfoMapper.query(start, count, userState, key, keyType, userRank, days,
                startTime, endTime, orderField, orderMode, userType, level, activeCode,system);
                startTime, endTime, orderField, orderMode, userType, level, activeCode, system);
        if (userList == null || userList.size() == 0) {
            return null;
@@ -569,17 +587,50 @@
    @Override
    public UserInfo getEffectiveUserInfoByPhone(String phone, SystemEnum system) {
        return userInfoMapper.getEffectiveUserInfoByPhone(phone, system);
        UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery();
        daoQuery.system = system;
        daoQuery.count = 1000;
        daoQuery.phone = phone;
        daoQuery.state = UserInfo.STATE_NORMAL;
        List<UserInfo> userInfoList = userInfoMapper.list(daoQuery);
        return userInfoList != null && userInfoList.size() > 0 ? userInfoList.get(0) : null;
    }
    @Override
    public UserInfo getEffectiveUserInfoByWXUnionId(String unionId, SystemEnum system) {
        return userInfoMapper.getEffectiveUserInfoByWXUnionId(unionId, system);
        UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery();
        daoQuery.system = system;
        daoQuery.count = 1000;
        daoQuery.wxUnionId = unionId;
        daoQuery.state = UserInfo.STATE_NORMAL;
        List<UserInfo> userInfoList = userInfoMapper.list(daoQuery);
        return userInfoList != null && userInfoList.size() > 0 ? userInfoList.get(0) : null;
    }
    @Override
    public UserInfo getEffectiveUserInfoByQQOpenId(String opneId, SystemEnum sysetm) {
        UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery();
        daoQuery.system = sysetm;
        daoQuery.count = 1000;
        daoQuery.qqOpenId = opneId;
        daoQuery.state = UserInfo.STATE_NORMAL;
        List<UserInfo> userInfoList = userInfoMapper.list(daoQuery);
        return userInfoList != null && userInfoList.size() > 0 ? userInfoList.get(0) : null;
    }
    @Override
    public UserInfo getEffectiveUserInfoByOpenId(String openId, SystemEnum sysetm) {
        return userInfoMapper.getEffectiveUserInfoByOpenId(openId,sysetm);
        UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery();
        daoQuery.system = sysetm;
        daoQuery.count = 1000;
        daoQuery.openId = openId;
        daoQuery.state = UserInfo.STATE_NORMAL;
        List<UserInfo> userInfoList = userInfoMapper.list(daoQuery);
        return userInfoList != null && userInfoList.size() > 0 ? userInfoList.get(0) : null;
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/inter/config/SystemConfigService.java
@@ -1,12 +1,21 @@
package com.yeshi.fanli.service.inter.config;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.exception.NotExistObjectException;
import com.ks.lib.common.exception.ParamsException;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.entity.system.SystemConfig;
/**
 * 系统配置信息(后台可见,不输出给前端)
 */
public interface SystemConfigService {
    public String get(String key) throws NotExistObjectException;
    public String get(String key, BusinessSystem system);
    public void save(SystemConfig systemConfig) throws ParamsException;
    public SystemConfig getConfig(SystemConfigKeyEnum key, SystemEnum system);
    public SystemConfig getConfigCache(SystemConfigKeyEnum key, SystemEnum system);
    public String getValueCache(SystemConfigKeyEnum key, SystemEnum system);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgOverViewsService.java
New file
@@ -0,0 +1,23 @@
package com.yeshi.fanli.service.inter.msg;
import com.yeshi.fanli.entity.bus.msg.MsgOverViews;
import java.util.List;
public interface MsgOverViewsService {
    /**
     * 保存消息
     *
     * @param msgOverViews
     */
    public void save(MsgOverViews msgOverViews);
    public List<MsgOverViews> listByUid(Long uid, int page, int pageSize);
    public long countByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserAccountService.java
@@ -7,6 +7,7 @@
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.exception.user.UserAccountException;
import com.yeshi.fanli.vo.taobao.TaoBaoUser;
import com.yeshi.fanli.vo.user.QQUserInfoVO;
import org.yeshi.utils.entity.ProxyIP;
import org.yeshi.utils.entity.wx.WeiXinUser;
@@ -18,6 +19,9 @@
 * @author Administrator
 */
public interface UserAccountService {
    public String getMobile(String vcode, String phone, String aliAccessToken, SystemEnum system,int vcodeType) throws UserAccountException;
    /**
     * 用户登录
     *
@@ -166,14 +170,14 @@
     * @throws UserAccountException
     */
    @Deprecated
    public UserInfo loginPhone(ProxyIP ipInfo, int loginType, String vcode, String phone, BusinessSystem businessSystem)
    public UserInfo loginPhone(ProxyIP ipInfo, int loginType, String vcode, String phone, String aliAccessToken, BusinessSystem businessSystem)
            throws UserAccountException;
    /**
     * 淘宝登录
     *
     * @param ipInfo
     * @param taoBaoUser -淘宝信息
     * @param taoBaoUser     -淘宝信息
     * @param businessSystem
     * @return
     * @throws UserAccountException
@@ -210,7 +214,7 @@
     * @param code
     * @throws UserAccountException
     */
    public void bindWeiXin(AcceptData acceptData, Long uid, String code) throws UserAccountException;
    public void bindWeiXin(BusinessSystem system, Long uid, String code) throws UserAccountException;
    /**
@@ -221,6 +225,16 @@
     * @throws UserAccountException
     */
    public void bindWeiXin(Long uid, WeiXinUser wxUser) throws UserAccountException;
    /**
     * 绑定QQ
     *
     * @param uid
     * @param qqUser
     * @throws UserAccountException
     */
    public void bindQQ( Long uid, QQUserInfoVO qqUser) throws UserAccountException;
    /**
@@ -269,6 +283,19 @@
    public UserInfo loginWeiXinNew(ProxyIP ipInfo, int loginType, String wxCode,
                                   BusinessSystem businessSystem) throws UserAccountException;
    /**
     * QQ登录
     * @param ipInfo
     * @param loginType
     * @param qqUserInfo
     * @param businessSystem
     * @return
     * @throws UserAccountException
     */
    public UserInfo loginQQ(ProxyIP ipInfo, int loginType, QQUserInfoVO qqUserInfo,
                                   BusinessSystem businessSystem) throws UserAccountException;
    /**
     * 未注册之前绑定手机号
     *
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java
@@ -161,6 +161,15 @@
    /**
     * 根据QQ获取有效用户
     * @param opneId
     * @param sysetm
     * @return
     */
    public UserInfo getEffectiveUserInfoByQQOpenId(String opneId, SystemEnum sysetm);
    /**
     * 获取有效用户(根据淘宝OpenId)
     * @param openId
     * @param sysetm
fanli/src/main/java/com/yeshi/fanli/util/AliyunOneKeyLoginUtil.java
New file
@@ -0,0 +1,43 @@
package com.yeshi.fanli.util;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dypnsapi.model.v20170525.GetMobileRequest;
import com.aliyuncs.dypnsapi.model.v20170525.GetMobileResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.profile.DefaultProfile;
import com.google.gson.Gson;
public class AliyunOneKeyLoginUtil {
    private final static String ACCESS_KEY = "LTAI4FwmTxVCuzTaoZtDiV8z";
    private final static String ACESS_SCRET = "ixWg90QbYFKP6ae5xpAo2P1qwIyll5";
    public static String getMobile(String accessToken, String outId) {
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", ACCESS_KEY, ACESS_SCRET);
        IAcsClient client = new DefaultAcsClient(profile);
        GetMobileRequest request = new GetMobileRequest();
        request.setAccessToken(accessToken);
        if (!StringUtil.isNullOrEmpty(outId))
            request.setOutId(outId);
        try {
            GetMobileResponse response = client.getAcsResponse(request);
            System.out.println(new Gson().toJson(response));
            if (response.getGetMobileResultDTO() != null) {
                String mobile = response.getGetMobileResultDTO().getMobile();
                return mobile;
            }
            System.out.println(new Gson().toJson(response));
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            System.out.println("ErrCode:" + e.getErrCode());
            System.out.println("ErrMsg:" + e.getErrMsg());
            System.out.println("RequestId:" + e.getRequestId());
        }
        return null;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/FilePathEnum.java
@@ -5,6 +5,7 @@
    userPortrait("/user/img/portrait/", "用户头像"),
    userPreview("/user/img/preview/", "用户预览头像"),
    userWXPortrait("/user/img/portrait_wx/", "用户微信头像"),
    userQQPortrait("/user/img/portrait_qq/", "用户QQ头像"),
    userERcode("/user/img/ercode/", "用户上传微信二维码"),
    userComplaint("/user/img/user_complaint/", "用户吐槽图片"),
    activityUserPortrait("/user/img/dynamic/portrait/", "动态用户头像"),
fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java
@@ -5,6 +5,8 @@
import java.util.ArrayList;
import java.util.List;
import com.google.gson.Gson;
import com.yeshi.fanli.vo.user.QQUserInfoVO;
import org.apache.commons.beanutils.PropertyUtils;
import org.yeshi.utils.HttpUtil;
@@ -15,188 +17,204 @@
public class UserUtil {
    /**
     * 处理输出给客户端的用户信息
     *
     * @param user
     * @return
     */
    public static UserInfo filterForClientUser(UserInfo user) {
        if (user == null)
            return user;
    /**
     * 处理输出给客户端的用户信息
     *
     * @param user
     * @return
     */
    public static UserInfo filterForClientUser(UserInfo user) {
        if (user == null)
            return user;
        UserInfo newUser = new UserInfo();
        try {
            PropertyUtils.copyProperties(newUser, user);
        } catch (IllegalAccessException e1) {
            e1.printStackTrace();
        } catch (InvocationTargetException e1) {
            e1.printStackTrace();
        } catch (NoSuchMethodException e1) {
            e1.printStackTrace();
        }
        UserInfo newUser = new UserInfo();
        try {
            PropertyUtils.copyProperties(newUser, user);
        } catch (IllegalAccessException e1) {
            e1.printStackTrace();
        } catch (InvocationTargetException e1) {
            e1.printStackTrace();
        } catch (NoSuchMethodException e1) {
            e1.printStackTrace();
        }
        if (!StringUtil.isNullOrEmpty(user.getPhone())) {
            if (user.getPhone().length() > 5) {
                String phone = user.getPhone().substring(0, 3);
                phone += "******";
                phone += user.getPhone().substring(user.getPhone().length() - 2, user.getPhone().length());
                newUser.setPhone(phone);
            }
        }
        if (!StringUtil.isNullOrEmpty(user.getPhone())) {
            if (user.getPhone().length() > 5) {
                String phone = user.getPhone().substring(0, 3);
                phone += "******";
                phone += user.getPhone().substring(user.getPhone().length() - 2, user.getPhone().length());
                newUser.setPhone(phone);
            }
        }
        if (user != null) {
            newUser.setRankIcon(UserUtil.getRankIcon(user.getRank()));
            newUser.setRankNamePicture(UserUtil.getRankNamePicture(user.getRank()));
        }
        if (user != null) {
            newUser.setRankIcon(UserUtil.getRankIcon(user.getRank()));
            newUser.setRankNamePicture(UserUtil.getRankNamePicture(user.getRank()));
        }
        return newUser;
    }
        return newUser;
    }
    public static String getRankIcon(Integer rank) {
        if (rank == null)
            return "";
        if (rank == 0)
            return "";
        else
            return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_icon_%s.png", rank + "");
    }
    public static String getRankIcon(Integer rank) {
        if (rank == null)
            return "";
        if (rank == 0)
            return "";
        else
            return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_icon_%s.png", rank + "");
    }
    public static String getRankNamePicture(Integer rank) {
        if (rank == null)
            rank = 0;
    public static String getRankNamePicture(Integer rank) {
        if (rank == null)
            rank = 0;
        return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_picture_%s.png", rank + "");
    }
        return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_picture_%s.png", rank + "");
    }
    public static String getInviteShortLink(Long uid) {
        return HttpUtil.getShortLink(
                "http://" + Constant.wxGZConfig.getLoginHost() + "/" + Constant.systemCommonConfig.getProjectName()
                        + "/client/threeShareNew?uid=" + uid + "&_=" + java.lang.System.currentTimeMillis());
    }
    public static String getInviteShortLink(Long uid) {
        return HttpUtil.getShortLink(
                "http://" + Constant.wxGZConfig.getLoginHost() + "/" + Constant.systemCommonConfig.getProjectName()
                        + "/client/threeShareNew?uid=" + uid + "&_=" + java.lang.System.currentTimeMillis());
    }
    public static String getInviteCode(int base, Long uid) {
    public static String getInviteCode(int base, Long uid) {
        long num = base * 100000000L + uid;
        long num = base * 100000000L + uid;
        return convert10To36(num);
    }
        return convert10To36(num);
    }
    private static String convert10To36(Long num) {
        String numbers = "YE9VFA3N6KG7JZH4LD5IO2RBS0QTMPU1WC8X";
        BigDecimal numBig = new BigDecimal(num);
    private static String convert10To36(Long num) {
        String numbers = "YE9VFA3N6KG7JZH4LD5IO2RBS0QTMPU1WC8X";
        BigDecimal numBig = new BigDecimal(num);
        int ge = numBig.divideAndRemainder(new BigDecimal(36))[1].intValue();
        int n = 1;
        String result = "";
        result += numbers.charAt(ge);
        int ge = numBig.divideAndRemainder(new BigDecimal(36))[1].intValue();
        int n = 1;
        String result = "";
        result += numbers.charAt(ge);
        while (numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].compareTo(new BigDecimal(0)) > 0) {
            int w = numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].divideAndRemainder(new BigDecimal(36))[1]
                    .intValue();
            result = numbers.charAt(w) + result;
            n++;
        }
        return result;
    }
        while (numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].compareTo(new BigDecimal(0)) > 0) {
            int w = numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].divideAndRemainder(new BigDecimal(36))[1]
                    .intValue();
            result = numbers.charAt(w) + result;
            n++;
        }
        return result;
    }
    /**
     * 过滤支付宝账号,中间用*代替
     *
     * @param bindingAccountList
     * @return
     */
    public static List<BindingAccount> filterBindingAccount(List<BindingAccount> bindingAccountList) {
        List<BindingAccount> accountList = new ArrayList<>();
    /**
     * 过滤支付宝账号,中间用*代替
     *
     * @param bindingAccountList
     * @return
     */
    public static List<BindingAccount> filterBindingAccount(List<BindingAccount> bindingAccountList) {
        List<BindingAccount> accountList = new ArrayList<>();
        if (bindingAccountList != null)
            for (BindingAccount bindingAccount : bindingAccountList) {
                accountList.add(filterBindingAccount(bindingAccount));
            }
        return accountList;
    }
        if (bindingAccountList != null)
            for (BindingAccount bindingAccount : bindingAccountList) {
                accountList.add(filterBindingAccount(bindingAccount));
            }
        return accountList;
    }
    public static BindingAccount filterBindingAccount(BindingAccount bindingAccount) {
    public static BindingAccount filterBindingAccount(BindingAccount bindingAccount) {
        BindingAccount dest = new BindingAccount();
        try {
            PropertyUtils.copyProperties(dest, bindingAccount);
            if (!StringUtil.isNullOrEmpty(dest.getAccount()) && !StringUtil.isNullOrEmpty(dest.getName())) {
                String name = "";
                if ((dest.getName() + "").length() > 2)
                    for (int i = 0; i < (dest.getName() + "").length(); i++) {
                        if (i == 0)
                            name += dest.getName().charAt(i);
                        else
                            name += "*";
                    }
                else
                    name = dest.getName().charAt(0) + "*";
                dest.setName(name);
        BindingAccount dest = new BindingAccount();
        try {
            PropertyUtils.copyProperties(dest, bindingAccount);
            if (!StringUtil.isNullOrEmpty(dest.getAccount()) && !StringUtil.isNullOrEmpty(dest.getName())) {
                String name = "";
                if ((dest.getName() + "").length() > 2)
                    for (int i = 0; i < (dest.getName() + "").length(); i++) {
                        if (i == 0)
                            name += dest.getName().charAt(i);
                        else
                            name += "*";
                    }
                else
                    name = dest.getName().charAt(0) + "*";
                dest.setName(name);
                String account = filterAlipayAccount(dest.getAccount());
                String account = filterAlipayAccount(dest.getAccount());
                dest.setAccount(account);
            }
        } catch (Exception e) {
        }
                dest.setAccount(account);
            }
        } catch (Exception e) {
        }
        return dest;
    }
        return dest;
    }
    public static String filterAlipayAccount(String alipayAccount) {
        String account = "";
        if (alipayAccount.indexOf("@") > -1) {// 邮箱
            int index = alipayAccount.indexOf("@");
    public static String filterAlipayAccount(String alipayAccount) {
        String account = "";
        if (alipayAccount.indexOf("@") > -1) {// 邮箱
            int index = alipayAccount.indexOf("@");
            for (int i = 0; i < alipayAccount.length(); i++) {
                if (i < 3 || i >= index)
                    account += alipayAccount.charAt(i);
                else
                    account += "*";
            }
        } else if (StringUtil.isMobile(alipayAccount)) {// 电话
            account = alipayAccount.substring(0, 3) + "*****"
                    + alipayAccount.substring(alipayAccount.length() - 2, alipayAccount.length());
            for (int i = 0; i < alipayAccount.length(); i++) {
                if (i < 3 || i >= index)
                    account += alipayAccount.charAt(i);
                else
                    account += "*";
            }
        } else if (StringUtil.isMobile(alipayAccount)) {// 电话
            account = alipayAccount.substring(0, 3) + "*****"
                    + alipayAccount.substring(alipayAccount.length() - 2, alipayAccount.length());
        } else {// 其他
            if (alipayAccount.length() >= 6) {
                for (int i = 0; i < alipayAccount.length(); i++) {
                    if (i < 3 || i >= alipayAccount.length() - 2)
                        account += alipayAccount.charAt(i);
                    else
                        account += "*";
                }
            } else {
                for (int i = 0; i < alipayAccount.length(); i++) {
                    if (i < 1 || i >= alipayAccount.length() - 1)
                        account += alipayAccount.charAt(i);
                    else
                        account += "*";
                }
            }
        }
        return account;
    }
        } else {// 其他
            if (alipayAccount.length() >= 6) {
                for (int i = 0; i < alipayAccount.length(); i++) {
                    if (i < 3 || i >= alipayAccount.length() - 2)
                        account += alipayAccount.charAt(i);
                    else
                        account += "*";
                }
            } else {
                for (int i = 0; i < alipayAccount.length(); i++) {
                    if (i < 1 || i >= alipayAccount.length() - 1)
                        account += alipayAccount.charAt(i);
                    else
                        account += "*";
                }
            }
        }
        return account;
    }
    public static String filterAlipayName(String name) {
        String st = "";
        for (int i = 0; i < name.length(); i++) {
            if (i == 0)
                st += name.charAt(i);
            else
                st += "*";
        }
        return st;
    }
    public static String filterAlipayName(String name) {
        String st = "";
        for (int i = 0; i < name.length(); i++) {
            if (i == 0)
                st += name.charAt(i);
            else
                st += "*";
        }
        return st;
    }
    public static String filterOrderId(String orderId) {
        if (orderId == null || orderId.length() <= 6)
            return orderId;
        if (orderId.length() <= 16) {// 隐藏2位
            return orderId.substring(0, orderId.length() - 2) + "**";
        } else {// 隐藏6位
            return orderId.substring(0, orderId.length() - 6) + "******";
        }
    }
    public static String filterOrderId(String orderId) {
        if (orderId == null || orderId.length() <= 6)
            return orderId;
        if (orderId.length() <= 16) {// 隐藏2位
            return orderId.substring(0, orderId.length() - 2) + "**";
        } else {// 隐藏6位
            return orderId.substring(0, orderId.length() - 6) + "******";
        }
    }
    /**
     * 解析QQ用户信息
     *
     * @param qqUserBase64
     * @return
     */
    public static QQUserInfoVO parseQQUser(String qqUserBase64) {
        if (StringUtil.isNullOrEmpty(qqUserBase64))
            return null;
        String qqUserStr = StringUtil.getFromBase64(qqUserBase64);
        if (StringUtil.isNullOrEmpty(qqUserStr))
            return null;
        QQUserInfoVO qqUserInfo = new Gson().fromJson(qqUserStr, QQUserInfoVO.class);
        return qqUserInfo;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgAccountDetailFactory.java
@@ -17,6 +17,7 @@
    public final static int TYPE_WX = 1;// 微信
    public final static int TYPE_TB = 2;// 淘宝
    public final static int TYPE_PHONE = 3;// 电话
    public final static int TYPE_QQ = 4;// 电话
    public final static int WAY_BIND = 1;// 绑定
    public final static int WAY_CHANGE = 2;// 更换
fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java
@@ -13,7 +13,7 @@
import java.util.List;
import java.util.Map;
import com.sun.istack.NotNull;
import com.sun.istack.internal.NotNull;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java
@@ -226,6 +226,27 @@
        return null;
    }
    public static VIPConvertResultDTO convertLinkByUrl(String url, String tag) {
        JSONObject taskParams = new JSONObject();
        JSONArray urlArray = new JSONArray();
        urlArray.add(url);
        taskParams.put("urlList", urlArray);
        if (tag != null) {
            taskParams.put("chanTag", tag);
        }
        taskParams.put("requestId", System.currentTimeMillis() + "_" + UUID.randomUUID());
        String result = baseRequest("com.vip.adp.api.open.service.UnionUrlService", "genByVIPUrl",
                JSONObject.fromObject(taskParams));
        System.out.println(result);
        JSONObject resultJSON = JSONObject.fromObject(result);
        if (resultJSON.optInt("returnCode") == 0) {
            String re = resultJSON.optJSONObject("result").optJSONArray("urlInfoList").optJSONObject(0).toString();
            return new Gson().fromJson(re, VIPConvertResultDTO.class);
        }
        return null;
    }
    /**
     * 根据商品ID获取商品详情
     *
@@ -292,9 +313,7 @@
    }
    public static void main(String[] args) {
        convertLink("6919237495414585303","437032");
        convertLinkByUrl("https://t.vip.com/T7RyKKCJLj9", "437032");
    }
}
fanli/src/main/java/com/yeshi/fanli/vo/user/QQUserInfoVO.java
New file
@@ -0,0 +1,96 @@
package com.yeshi.fanli.vo.user;
public class QQUserInfoVO {
    private String openid;
    private String nickname;
    private String gender;
    private int gender_type;
    private String province;
    private String city;
    private String year;
    private String figureurl;
    private String figureurl_1;
    private String figureurl_2;
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
    public String getNickname() {
        return nickname;
    }
    public void setNickname(String nickname) {
        this.nickname = nickname;
    }
    public String getGender() {
        return gender;
    }
    public void setGender(String gender) {
        this.gender = gender;
    }
    public int getGender_type() {
        return gender_type;
    }
    public void setGender_type(int gender_type) {
        this.gender_type = gender_type;
    }
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getYear() {
        return year;
    }
    public void setYear(String year) {
        this.year = year;
    }
    public String getFigureurl() {
        return figureurl;
    }
    public void setFigureurl(String figureurl) {
        this.figureurl = figureurl;
    }
    public String getFigureurl_1() {
        return figureurl_1;
    }
    public void setFigureurl_1(String figureurl_1) {
        this.figureurl_1 = figureurl_1;
    }
    public String getFigureurl_2() {
        return figureurl_2;
    }
    public void setFigureurl_2(String figureurl_2) {
        this.figureurl_2 = figureurl_2;
    }
}
fanli/src/main/resource/mapping/UserInfoMapper.xml
@@ -2,184 +2,194 @@
<!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.UserInfoMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfo">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="identifycode" property="openid" jdbcType="VARCHAR" />
        <result column="login_type" property="loginType" jdbcType="INTEGER" />
        <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" />
        <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" />
        <result column="nick_name" property="nickName" jdbcType="VARCHAR" />
        <result column="tbName" property="tbName" jdbcType="VARCHAR" />
        <result column="tbPic" property="tbPic" jdbcType="VARCHAR" />
        <result column="wxName" property="wxName" jdbcType="VARCHAR" />
        <result column="wxPic" property="wxPic" jdbcType="VARCHAR" />
        <result column="portrait" property="portrait" jdbcType="VARCHAR" />
        <result column="createtime" property="createtime" jdbcType="BIGINT" />
        <result column="last_logintime" property="lastLoginTime"
            jdbcType="BIGINT" />
        <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" />
        <result column="type" property="type" jdbcType="INTEGER" />
        <result column="appid" property="appId" jdbcType="VARCHAR" />
        <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" />
        <result column="pay_password" property="payPassword" jdbcType="VARCHAR" />
        <result column="rank" property="rank" jdbcType="INTEGER" />
        <result column="phone" property="phone" jdbcType="VARCHAR" />
        <result column="state" property="state" jdbcType="INTEGER" />
        <result column="state_desc" property="stateDesc" jdbcType="VARCHAR" />
        <result column="system" property="system" jdbcType="VARCHAR" />
    </resultMap>
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfo">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="identifycode" property="openid" jdbcType="VARCHAR"/>
        <result column="login_type" property="loginType" jdbcType="INTEGER"/>
        <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR"/>
        <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR"/>
        <result column="nick_name" property="nickName" jdbcType="VARCHAR"/>
        <result column="qq_open_id" property="qqOpenId" jdbcType="VARCHAR"/>
        <result column="qq_nick_name" property="qqNickName" jdbcType="VARCHAR"/>
        <result column="tbName" property="tbName" jdbcType="VARCHAR"/>
        <result column="tbPic" property="tbPic" jdbcType="VARCHAR"/>
        <result column="wxName" property="wxName" jdbcType="VARCHAR"/>
        <result column="wxPic" property="wxPic" jdbcType="VARCHAR"/>
        <result column="portrait" property="portrait" jdbcType="VARCHAR"/>
        <result column="createtime" property="createtime" jdbcType="BIGINT"/>
        <result column="last_logintime" property="lastLoginTime"
                jdbcType="BIGINT"/>
        <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR"/>
        <result column="type" property="type" jdbcType="INTEGER"/>
        <result column="appid" property="appId" jdbcType="VARCHAR"/>
        <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL"/>
        <result column="pay_password" property="payPassword" jdbcType="VARCHAR"/>
        <result column="rank" property="rank" jdbcType="INTEGER"/>
        <result column="phone" property="phone" jdbcType="VARCHAR"/>
        <result column="state" property="state" jdbcType="INTEGER"/>
        <result column="state_desc" property="stateDesc" jdbcType="VARCHAR"/>
        <result column="system" property="system" jdbcType="VARCHAR"/>
    </resultMap>
    <resultMap id="BaseResultMapVO" type="com.yeshi.fanli.vo.user.UserInfoVO">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="identifycode" property="openid" jdbcType="VARCHAR" />
        <result column="login_type" property="loginType" jdbcType="INTEGER" />
        <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" />
        <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" />
        <result column="nick_name" property="nickName" jdbcType="VARCHAR" />
        <result column="uiet_taobao_nick_name" property="tbName"
            jdbcType="VARCHAR" />
        <result column="tbPic" property="tbPic" jdbcType="VARCHAR" />
        <result column="wxName" property="wxName" jdbcType="VARCHAR" />
        <result column="wxPic" property="wxPic" jdbcType="VARCHAR" />
        <result column="portrait" property="portrait" jdbcType="VARCHAR" />
        <result column="createtime" property="createtime" jdbcType="BIGINT" />
        <result column="last_logintime" property="lastLoginTime"
            jdbcType="BIGINT" />
        <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" />
        <result column="type" property="type" jdbcType="INTEGER" />
        <result column="appid" property="appId" jdbcType="VARCHAR" />
        <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" />
        <result column="pay_password" property="payPassword" jdbcType="VARCHAR" />
        <result column="rank" property="rank" jdbcType="INTEGER" />
        <result column="phone" property="phone" jdbcType="VARCHAR" />
        <result column="state" property="state" jdbcType="INTEGER" />
        <result column="state_desc" property="stateDesc" jdbcType="VARCHAR" />
    <resultMap id="BaseResultMapVO" type="com.yeshi.fanli.vo.user.UserInfoVO">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="identifycode" property="openid" jdbcType="VARCHAR"/>
        <result column="login_type" property="loginType" jdbcType="INTEGER"/>
        <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR"/>
        <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR"/>
        <result column="qq_open_id" property="qqOpenId" jdbcType="VARCHAR"/>
        <result column="qq_nick_name" property="qqNickName" jdbcType="VARCHAR"/>
        <result column="nick_name" property="nickName" jdbcType="VARCHAR"/>
        <result column="uiet_taobao_nick_name" property="tbName"
                jdbcType="VARCHAR"/>
        <result column="tbPic" property="tbPic" jdbcType="VARCHAR"/>
        <result column="wxName" property="wxName" jdbcType="VARCHAR"/>
        <result column="wxPic" property="wxPic" jdbcType="VARCHAR"/>
        <result column="portrait" property="portrait" jdbcType="VARCHAR"/>
        <result column="createtime" property="createtime" jdbcType="BIGINT"/>
        <result column="last_logintime" property="lastLoginTime"
                jdbcType="BIGINT"/>
        <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR"/>
        <result column="type" property="type" jdbcType="INTEGER"/>
        <result column="appid" property="appId" jdbcType="VARCHAR"/>
        <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL"/>
        <result column="pay_password" property="payPassword" jdbcType="VARCHAR"/>
        <result column="rank" property="rank" jdbcType="INTEGER"/>
        <result column="phone" property="phone" jdbcType="VARCHAR"/>
        <result column="state" property="state" jdbcType="INTEGER"/>
        <result column="state_desc" property="stateDesc" jdbcType="VARCHAR"/>
        <result column="ur_id" property="rankId" jdbcType="BIGINT" />
        <result column="ur_name" property="rankName" jdbcType="VARCHAR" />
        <result column="ur_picture" property="rankPicture" jdbcType="VARCHAR" />
        <result column="ur_id" property="rankId" jdbcType="BIGINT"/>
        <result column="ur_name" property="rankName" jdbcType="VARCHAR"/>
        <result column="ur_picture" property="rankPicture" jdbcType="VARCHAR"/>
        <result column="totalOrder" property="totalOrder" jdbcType="BIGINT" />
        <result column="monthOrder" property="monthOrder" jdbcType="BIGINT" />
        <result column="totalOrder" property="totalOrder" jdbcType="BIGINT"/>
        <result column="monthOrder" property="monthOrder" jdbcType="BIGINT"/>
        <result column="uiet_special_id" property="tbSpecialId"
            jdbcType="VARCHAR" />
        <result column="uiet_relation_id" property="tbRelationId"
            jdbcType="VARCHAR" />
        <result column="uiet_taobao_uid" property="taoBaoUid" jdbcType="VARCHAR" />
        <result column="uiet_special_id" property="tbSpecialId"
                jdbcType="VARCHAR"/>
        <result column="uiet_relation_id" property="tbRelationId"
                jdbcType="VARCHAR"/>
        <result column="uiet_taobao_uid" property="taoBaoUid" jdbcType="VARCHAR"/>
        <result column="wxUnionIdInvalid" property="wxUnionIdInvalid"
            jdbcType="VARCHAR" />
        <result column="taobaoUidInvalid" property="taobaoUidInvalid"
            jdbcType="VARCHAR" />
        <result column="phoneInvalid" property="phoneInvalid" jdbcType="VARCHAR" />
        <result column="alipayAccountInvalid" property="alipayAccountInvalid"
            jdbcType="VARCHAR" />
        <result column="wxUnionIdInvalid" property="wxUnionIdInvalid"
                jdbcType="VARCHAR"/>
        <result column="taobaoUidInvalid" property="taobaoUidInvalid"
                jdbcType="VARCHAR"/>
        <result column="phoneInvalid" property="phoneInvalid" jdbcType="VARCHAR"/>
        <result column="alipayAccountInvalid" property="alipayAccountInvalid"
                jdbcType="VARCHAR"/>
        <result column="tuls_level" property="userLevel" jdbcType="VARCHAR" />
        <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
        <result column="uie_mark" property="mark" jdbcType="VARCHAR" />
        <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR" />
        <result column="uie_invite_code_vip" property="inviteCodeVip" jdbcType="VARCHAR" />
        <result column="uie_weixin" property="wxId" jdbcType="VARCHAR" />
    </resultMap>
        <result column="tuls_level" property="userLevel" jdbcType="VARCHAR"/>
        <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER"/>
        <result column="uie_mark" property="mark" jdbcType="VARCHAR"/>
        <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/>
        <result column="uie_invite_code_vip" property="inviteCodeVip" jdbcType="VARCHAR"/>
        <result column="uie_weixin" property="wxId" jdbcType="VARCHAR"/>
    </resultMap>
    <resultMap id="ChartMap" type="com.yeshi.fanli.dto.ChartTDO">
        <result column="showDate" property="showDate" jdbcType="VARCHAR" />
        <result column="showValue" property="showValue" jdbcType="VARCHAR" />
    </resultMap>
    <resultMap id="ChartMap" type="com.yeshi.fanli.dto.ChartTDO">
        <result column="showDate" property="showDate" jdbcType="VARCHAR"/>
        <result column="showValue" property="showValue" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,system,rank,phone,state,state_desc
    <sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,system,rank,phone,state,state_desc,qq_open_id,qq_nick_name
    </sql>
    <!-- 不能查询缓存 -->
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long" flushCache="true" useCache="false">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user where id = #{id,jdbcType=BIGINT}
    </select>
    <!-- 不能查询缓存 -->
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
            parameterType="java.lang.Long" flushCache="true" useCache="false">
        select
        <include refid="Base_Column_List"/>
        from yeshi_ec_user where id = #{id,jdbcType=BIGINT}
    </select>
    <!-- 不能查询缓存 -->
    <select id="selectAvailableByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long" flushCache="true" useCache="false">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user where id = #{id,jdbcType=BIGINT} and `state`=0
    </select>
    <!-- 不能查询缓存 -->
    <select id="selectAvailableByPrimaryKey" resultMap="BaseResultMap"
            parameterType="java.lang.Long" flushCache="true" useCache="false">
        select
        <include refid="Base_Column_List"/>
        from yeshi_ec_user where id = #{id,jdbcType=BIGINT} and `state`=0
    </select>
    <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user where id = #{id,jdbcType=BIGINT} for update
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
    <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
            parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List"/>
        from yeshi_ec_user where id = #{id,jdbcType=BIGINT} for update
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_user where id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user
        (id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,system,rank,phone,state,state_desc,platform)
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"
            useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user
        (id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,system,rank,phone,state,state_desc,platform,qq_open_id,qq_nick_name)
        values
        (#{id,jdbcType=BIGINT},#{openid,jdbcType=VARCHAR},#{loginType,jdbcType=INTEGER},#{wxOpenId,jdbcType=VARCHAR},#{wxUnionId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{tbName,jdbcType=VARCHAR},#{tbPic,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPic,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createtime,jdbcType=BIGINT},#{lastLoginTime,jdbcType=BIGINT},#{lastLoginIp,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{appId,jdbcType=VARCHAR},#{myHongBao,jdbcType=DECIMAL},#{payPassword,jdbcType=VARCHAR},#{system,jdbcType=VARCHAR},#{rank,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR},#{platform,jdbcType=VARCHAR})
        (#{id,jdbcType=BIGINT},#{openid,jdbcType=VARCHAR},#{loginType,jdbcType=INTEGER},#{wxOpenId,jdbcType=VARCHAR},#{wxUnionId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{tbName,jdbcType=VARCHAR},#{tbPic,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPic,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createtime,jdbcType=BIGINT},#{lastLoginTime,jdbcType=BIGINT},#{lastLoginIp,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{appId,jdbcType=VARCHAR},#{myHongBao,jdbcType=DECIMAL},#{payPassword,jdbcType=VARCHAR},#{system,jdbcType=VARCHAR},#{rank,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR},#{platform,jdbcType=VARCHAR},#{qqOpenId,jdbcType=VARCHAR},#{qqNickName,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_user
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="openid != null">identifycode,</if>
            <if test="loginType != null">login_type,</if>
            <if test="wxOpenId != null">wx_open_id,</if>
            <if test="wxUnionId != null">wx_union_id,</if>
            <if test="nickName != null">nick_name,</if>
            <if test="tbName != null">tbName,</if>
            <if test="tbPic != null">tbPic,</if>
            <if test="wxName != null">wxName,</if>
            <if test="wxPic != null">wxPic,</if>
            <if test="portrait != null">portrait,</if>
            <if test="createtime != null">createtime,</if>
            <if test="lastLoginTime != null">last_logintime,</if>
            <if test="lastLoginIp != null">loginip,</if>
            <if test="type != null">type,</if>
            <if test="appId != null">appid,</if>
            <if test="myHongBao != null">my_hongBao,</if>
            <if test="payPassword != null">pay_password,</if>
            <if test="system != null">system,</if>
            <if test="rank != null">rank,</if>
            <if test="phone != null">phone,</if>
            <if test="state != null">state,</if>
            <if test="stateDesc != null">state_desc,</if>
            <if test="platform != null">platform,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="openid != null">#{openid,jdbcType=VARCHAR},</if>
            <if test="loginType != null">#{loginType,jdbcType=INTEGER},</if>
            <if test="wxOpenId != null">#{wxOpenId,jdbcType=VARCHAR},</if>
            <if test="wxUnionId != null">#{wxUnionId,jdbcType=VARCHAR},</if>
            <if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if>
            <if test="tbName != null">#{tbName,jdbcType=VARCHAR},</if>
            <if test="tbPic != null">#{tbPic,jdbcType=VARCHAR},</if>
            <if test="wxName != null">#{wxName,jdbcType=VARCHAR},</if>
            <if test="wxPic != null">#{wxPic,jdbcType=VARCHAR},</if>
            <if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if>
            <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if>
            <if test="lastLoginTime != null">#{lastLoginTime,jdbcType=BIGINT},</if>
            <if test="lastLoginIp != null">#{lastLoginIp,jdbcType=VARCHAR},</if>
            <if test="type != null">#{type,jdbcType=INTEGER},</if>
            <if test="appId != null">#{appId,jdbcType=VARCHAR},</if>
            <if test="myHongBao != null">#{myHongBao,jdbcType=DECIMAL},</if>
            <if test="payPassword != null">#{payPassword,jdbcType=VARCHAR},</if>
            <if test="system != null">#{system,jdbcType=VARCHAR},</if>
            <if test="rank != null">#{rank,jdbcType=INTEGER},</if>
            <if test="phone != null">#{phone,jdbcType=VARCHAR},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR}</if>
            <if test="platform != null">#{platform,jdbcType=VARCHAR}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo">update
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"
            useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_user
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="openid != null">identifycode,</if>
            <if test="loginType != null">login_type,</if>
            <if test="wxOpenId != null">wx_open_id,</if>
            <if test="wxUnionId != null">wx_union_id,</if>
            <if test="nickName != null">nick_name,</if>
            <if test="tbName != null">tbName,</if>
            <if test="tbPic != null">tbPic,</if>
            <if test="wxName != null">wxName,</if>
            <if test="wxPic != null">wxPic,</if>
            <if test="portrait != null">portrait,</if>
            <if test="createtime != null">createtime,</if>
            <if test="lastLoginTime != null">last_logintime,</if>
            <if test="lastLoginIp != null">loginip,</if>
            <if test="type != null">type,</if>
            <if test="appId != null">appid,</if>
            <if test="myHongBao != null">my_hongBao,</if>
            <if test="payPassword != null">pay_password,</if>
            <if test="system != null">system,</if>
            <if test="rank != null">rank,</if>
            <if test="phone != null">phone,</if>
            <if test="state != null">state,</if>
            <if test="stateDesc != null">state_desc,</if>
            <if test="platform != null">platform,</if>
            <if test="qqOpenId != null">qq_open_id,</if>
            <if test="qqNickName != null">qq_nick_name,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="openid != null">#{openid,jdbcType=VARCHAR},</if>
            <if test="loginType != null">#{loginType,jdbcType=INTEGER},</if>
            <if test="wxOpenId != null">#{wxOpenId,jdbcType=VARCHAR},</if>
            <if test="wxUnionId != null">#{wxUnionId,jdbcType=VARCHAR},</if>
            <if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if>
            <if test="tbName != null">#{tbName,jdbcType=VARCHAR},</if>
            <if test="tbPic != null">#{tbPic,jdbcType=VARCHAR},</if>
            <if test="wxName != null">#{wxName,jdbcType=VARCHAR},</if>
            <if test="wxPic != null">#{wxPic,jdbcType=VARCHAR},</if>
            <if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if>
            <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if>
            <if test="lastLoginTime != null">#{lastLoginTime,jdbcType=BIGINT},</if>
            <if test="lastLoginIp != null">#{lastLoginIp,jdbcType=VARCHAR},</if>
            <if test="type != null">#{type,jdbcType=INTEGER},</if>
            <if test="appId != null">#{appId,jdbcType=VARCHAR},</if>
            <if test="myHongBao != null">#{myHongBao,jdbcType=DECIMAL},</if>
            <if test="payPassword != null">#{payPassword,jdbcType=VARCHAR},</if>
            <if test="system != null">#{system,jdbcType=VARCHAR},</if>
            <if test="rank != null">#{rank,jdbcType=INTEGER},</if>
            <if test="phone != null">#{phone,jdbcType=VARCHAR},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if>
            <if test="platform != null">#{platform,jdbcType=VARCHAR},</if>
            <if test="qqOpenId != null">#{qqOpenId,jdbcType=VARCHAR},</if>
            <if test="qqNickName != null">#{qqNickName,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo">update
        yeshi_ec_user set identifycode = #{openid,jdbcType=VARCHAR},login_type
        = #{loginType,jdbcType=INTEGER},wx_open_id =
        #{wxOpenId,jdbcType=VARCHAR},wx_union_id =
@@ -197,479 +207,452 @@
        #{payPassword,jdbcType=VARCHAR},system =
        #{system,jdbcType=VARCHAR},rank = #{rank,jdbcType=INTEGER} ,phone
        =#{phone,jdbcType=VARCHAR} ,state =#{state,jdbcType=INTEGER}
        ,state_desc =#{stateDesc,jdbcType=VARCHAR} where id =
        ,state_desc =#{stateDesc,jdbcType=VARCHAR}
        ,qq_open_id =#{qqOpenId,jdbcType=VARCHAR}
        ,qq_nick_name =#{qqNickName,jdbcType=VARCHAR}
         where id =
        #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo">
        update yeshi_ec_user
        <set>
            <if test="openid != null">identifycode=#{openid,jdbcType=VARCHAR},</if>
            <if test="loginType != null">login_type=#{loginType,jdbcType=INTEGER},</if>
            <if test="wxOpenId != null">wx_open_id=#{wxOpenId,jdbcType=VARCHAR},</if>
            <if test="wxUnionId != null">wx_union_id=#{wxUnionId,jdbcType=VARCHAR},</if>
            <if test="nickName != null">nick_name=#{nickName,jdbcType=VARCHAR},</if>
            <if test="tbName != null">tbName=#{tbName,jdbcType=VARCHAR},</if>
            <if test="tbPic != null">tbPic=#{tbPic,jdbcType=VARCHAR},</if>
            <if test="wxName != null">wxName=#{wxName,jdbcType=VARCHAR},</if>
            <if test="wxPic != null">wxPic=#{wxPic,jdbcType=VARCHAR},</if>
            <if test="portrait != null">portrait=#{portrait,jdbcType=VARCHAR},</if>
            <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if>
            <if test="lastLoginTime != null">last_logintime=#{lastLoginTime,jdbcType=BIGINT},</if>
            <if test="lastLoginIp != null">loginip=#{lastLoginIp,jdbcType=VARCHAR},</if>
            <if test="type != null">type=#{type,jdbcType=INTEGER},</if>
            <if test="appId != null">appid=#{appId,jdbcType=VARCHAR},</if>
            <if test="myHongBao != null">my_hongBao=#{myHongBao,jdbcType=DECIMAL},</if>
            <if test="payPassword != null">pay_password=#{payPassword,jdbcType=VARCHAR},</if>
            <if test="system != null">system=#{system,jdbcType=VARCHAR},</if>
            <if test="rank != null">rank=#{rank,jdbcType=INTEGER},</if>
            <if test="phone !=null">phone =#{phone,jdbcType=VARCHAR},</if>
            <if test="state !=null">state =#{state,jdbcType=INTEGER},</if>
            <if test="stateDesc !=null">state_desc =#{stateDesc,jdbcType=VARCHAR},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="subHongBaoByUid">update yeshi_ec_user set my_hongBao=
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo">
        update yeshi_ec_user
        <set>
            <if test="openid != null">identifycode=#{openid,jdbcType=VARCHAR},</if>
            <if test="loginType != null">login_type=#{loginType,jdbcType=INTEGER},</if>
            <if test="wxOpenId != null">wx_open_id=#{wxOpenId,jdbcType=VARCHAR},</if>
            <if test="wxUnionId != null">wx_union_id=#{wxUnionId,jdbcType=VARCHAR},</if>
            <if test="nickName != null">nick_name=#{nickName,jdbcType=VARCHAR},</if>
            <if test="qqNickName != null">qq_nick_name=#{qqNickName,jdbcType=VARCHAR},</if>
            <if test="qqOpenId != null">qq_open_id=#{qqOpenId,jdbcType=VARCHAR},</if>
            <if test="tbName != null">tbName=#{tbName,jdbcType=VARCHAR},</if>
            <if test="tbPic != null">tbPic=#{tbPic,jdbcType=VARCHAR},</if>
            <if test="wxName != null">wxName=#{wxName,jdbcType=VARCHAR},</if>
            <if test="wxPic != null">wxPic=#{wxPic,jdbcType=VARCHAR},</if>
            <if test="portrait != null">portrait=#{portrait,jdbcType=VARCHAR},</if>
            <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if>
            <if test="lastLoginTime != null">last_logintime=#{lastLoginTime,jdbcType=BIGINT},</if>
            <if test="lastLoginIp != null">loginip=#{lastLoginIp,jdbcType=VARCHAR},</if>
            <if test="type != null">type=#{type,jdbcType=INTEGER},</if>
            <if test="appId != null">appid=#{appId,jdbcType=VARCHAR},</if>
            <if test="myHongBao != null">my_hongBao=#{myHongBao,jdbcType=DECIMAL},</if>
            <if test="payPassword != null">pay_password=#{payPassword,jdbcType=VARCHAR},</if>
            <if test="system != null">system=#{system,jdbcType=VARCHAR},</if>
            <if test="rank != null">rank=#{rank,jdbcType=INTEGER},</if>
            <if test="phone !=null">phone =#{phone,jdbcType=VARCHAR},</if>
            <if test="state !=null">state =#{state,jdbcType=INTEGER},</if>
            <if test="stateDesc !=null">state_desc =#{stateDesc,jdbcType=VARCHAR},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="subHongBaoByUid">update yeshi_ec_user set my_hongBao=
        my_hongBao-#{money,jdbcType=DECIMAL} where id = #{uid,jdbcType=BIGINT}
    </update>
    <update id="addHongBaoByUid">update yeshi_ec_user set my_hongBao=
    <update id="addHongBaoByUid">update yeshi_ec_user set my_hongBao=
        my_hongBao+#{money,jdbcType=DECIMAL} where id = #{uid,jdbcType=BIGINT}
    </update>
    <!-- 清除手势密码 -->
    <delete id="cleanPassword">DELETE FROM `yeshi_ec_extract_record` WHERE uid =
    <!-- 清除手势密码 -->
    <delete id="cleanPassword">DELETE FROM `yeshi_ec_extract_record` WHERE uid =
        #{id};
    </delete>
    <!-- 查询新人红包 -->
    <select id="getNewPeopleHB" resultType="BigDecimal">SELECT sum(hb.`money`)
    <!-- 查询新人红包 -->
    <select id="getNewPeopleHB" resultType="BigDecimal">SELECT sum(hb.`money`)
        FROM `yeshi_ec_hongbao` hb WHERE hb.`uid` = #{id} AND hb.`type` = '4';
    </select>
    <!-- 查询我的红包 -->
    <select id="getMyHB" resultType="BigDecimal">SELECT SUM(hb.`money`) FROM
    <!-- 查询我的红包 -->
    <select id="getMyHB" resultType="BigDecimal">SELECT SUM(hb.`money`) FROM
        `yeshi_ec_hongbao` hb WHERE hb.`uid` = #{id};
    </select>
    <!-- 根据系统与微信unionID获取用户 -->
    <select id="listBySystemAndWXUnionId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user where system=#{system} and wx_union_id=#{unionId}
    </select>
    <!-- 根据系统与淘宝OpenId获取用户 -->
    <select id="listBySystemAndTaoBaoOpenId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user where  system=#{system} and identifycode=#{openId}
    </select>
    <!-- 根据系统与电话号码获取用户 -->
    <select id="listBySystemAndPhone" resultMap="BaseResultMap"
        useCache="false" flushCache="true">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user where  system=#{system} and phone=#{phone}
    </select>
    <sql id="listWhereSQL">
        <if test="query.phone!=null">and phone=#{query.phone}</if>
        <if test="query.wxUnionId!=null">and wx_union_id=#{query.wxUnionId}</if>
        <if test="query.openId!=null">and identifycode=#{query.openId}</if>
        <if test="query.qqOpenId!=null">and qq_open_id=#{query.qqOpenId}</if>
        <if test="query.system!=null">and system=#{query.system}</if>
        <if test="query.state!=null">and state=#{query.state}</if>
    </sql>
    <!-- 查询列表 -->
    <select id="list" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from yeshi_ec_user where 1=1
        <include refid="listWhereSQL"></include>
        limit #{query.start},#{query.count}
    </select>
    <select id="getEffectiveUserInfoByPhone" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user
        where phone=#{phone} AND system=#{system} AND state = 0
        LIMIT 1
    </select>
    <select id="getEffectiveUserInfoByWXUnionId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user
        where wx_union_id=#{unionId} AND system=#{system}  AND state = 0
        LIMIT 1
    </select>
    <select id="getEffectiveUserInfoByOpenId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user
        where identifycode=#{openId} AND system=#{system}  AND state = 0
        LIMIT 1
    </select>
    <select id="getEffectiveUserInfoByWXOpenId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user
        where wx_open_id=#{wxOpenId} AND system=#{system}  AND state = 0
        LIMIT 1
    </select>
    <select id="getMaxUid" resultType="java.lang.Long">select max(id) from
    <select id="getMaxUid" resultType="java.lang.Long">select max(id) from
        yeshi_ec_user
    </select>
    <select id="queryInfo" resultMap="BaseResultMapVO">
    SELECT * FROM yeshi_ec_user u
    LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
    LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
    LEFT JOIN  yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id
    <if test="keyType == 4 || level != null">
        LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid`
    </if>
    WHERE 1=1 AND u.system=#{system}
        <if test="userState != null">
            AND u.`state` = #{userState}
        </if>
        <if test="userType!=null">
            AND u.type=#{userType}
        </if>
        <if test="startTime != null and startTime !='' ">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]>
            DATE_FORMAT(#{startTime},'%Y%m%d')
        </if>
        <if test="endTime != null and endTime !=''">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]>
            DATE_FORMAT(#{endTime},'%Y%m%d')
        </if>
        <if test="userRank != null">
            AND rak.ur_name = #{userRank}
        </if>
        <if test = "level != null and level != ''">
            AND lc.tuls_level = #{level}
        </if>
        <if test="activeCode == 0">
            AND (ext.`uie_invite_code` is null OR ext.`uie_invite_code`='')
        </if>
        <if test="activeCode == 1">
            AND (ext.`uie_invite_code` is not null OR ext.`uie_invite_code`<![CDATA[<>]]>'')
        </if>
        <if test="key != null and key !='' ">
            <if test="keyType == 1">
                AND u.id = #{key}
            </if>
            <if test="keyType == 2">
                AND u.`nick_name` LIKE '%${key}%'
            </if>
            <if test="keyType == 3">
                AND u.`phone` = #{key}
            </if>
            <if test="keyType == 4">
                AND b.`account` = #{key}
            </if>
            <if test="keyType == 5">
                AND (ext.`uie_invite_code` =  #{key} OR ext.`uie_invite_code_vip`= #{key})
            </if>
        </if>
        ORDER BY u.id DESC
        LIMIT ${start},${count}
    </select>
    <select id="queryInfo" resultMap="BaseResultMapVO">
        SELECT * FROM yeshi_ec_user u
        LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
        LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
        LEFT JOIN yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id
        <if test="keyType == 4 || level != null">
            LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid`
        </if>
        WHERE 1=1 AND u.system=#{system}
        <if test="userState != null">
            AND u.`state` = #{userState}
        </if>
        <if test="userType!=null">
            AND u.type=#{userType}
        </if>
        <if test="startTime != null and startTime !='' ">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]>
            DATE_FORMAT(#{startTime},'%Y%m%d')
        </if>
        <if test="endTime != null and endTime !=''">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]>
            DATE_FORMAT(#{endTime},'%Y%m%d')
        </if>
        <if test="userRank != null">
            AND rak.ur_name = #{userRank}
        </if>
        <if test="level != null and level != ''">
            AND lc.tuls_level = #{level}
        </if>
        <if test="activeCode == 0">
            AND (ext.`uie_invite_code` is null OR ext.`uie_invite_code`='')
        </if>
        <if test="activeCode == 1">
            AND (ext.`uie_invite_code` is not null OR ext.`uie_invite_code`<![CDATA[<>]]>'')
        </if>
        <if test="key != null and key !='' ">
            <if test="keyType == 1">
                AND u.id = #{key}
            </if>
            <if test="keyType == 2">
                AND u.`nick_name` LIKE '%${key}%'
            </if>
            <if test="keyType == 3">
                AND u.`phone` = #{key}
            </if>
            <if test="keyType == 4">
                AND b.`account` = #{key}
            </if>
            <if test="keyType == 5">
                AND (ext.`uie_invite_code` = #{key} OR ext.`uie_invite_code_vip`= #{key})
            </if>
        </if>
        ORDER BY u.id DESC
        LIMIT ${start},${count}
    </select>
    <select id="countInfo" resultType="java.lang.Long">
        SELECT IFNULL(count(u.id),0) FROM yeshi_ec_user u
        LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
        LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
        LEFT JOIN  yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id
        <if test="keyType == 4">
            LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid`
        </if>
        where 1=1  AND u.system=#{system}
        <if test="userState != null">
            AND u.`state` = #{userState}
        </if>
        <if test="userType!=null">
            AND u.type=#{userType}
        </if>
        <if test="startTime != null and startTime !='' ">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]>
            DATE_FORMAT(#{startTime},'%Y%m%d')
        </if>
        <if test="endTime != null and endTime !=''">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]>
            DATE_FORMAT(#{endTime},'%Y%m%d')
        </if>
        <if test="userRank != null">
            AND rak.ur_name = #{userRank}
        </if>
        <if test = "level != null and level != ''">
            AND lc.tuls_level = #{level}
        </if>
        <if test="activeCode == 0">
            AND (ext.`uie_invite_code` is null OR ext.`uie_invite_code`='')
        </if>
        <if test="activeCode == 1">
            AND (ext.`uie_invite_code` is not null OR ext.`uie_invite_code`<![CDATA[<>]]>'')
        </if>
        <if test="key != null and key !='' ">
            <if test="keyType == 1">
                AND u.id = #{key}
            </if>
            <if test="keyType == 2">
                AND u.`nick_name` LIKE '%${key}%'
            </if>
            <if test="keyType == 3">
                AND u.`phone` = #{key}
            </if>
            <if test="keyType == 4">
                AND b.`account` = #{key}
            </if>
            <if test="keyType == 5">
                AND (ext.`uie_invite_code` =  #{key} OR ext.`uie_invite_code_vip`= #{key})
            </if>
        </if>
    </select>
    <select id="countInfo" resultType="java.lang.Long">
        SELECT IFNULL(count(u.id),0) FROM yeshi_ec_user u
        LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
        LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
        LEFT JOIN yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id
        <if test="keyType == 4">
            LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid`
        </if>
        where 1=1 AND u.system=#{system}
        <if test="userState != null">
            AND u.`state` = #{userState}
        </if>
        <if test="userType!=null">
            AND u.type=#{userType}
        </if>
        <if test="startTime != null and startTime !='' ">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]>
            DATE_FORMAT(#{startTime},'%Y%m%d')
        </if>
        <if test="endTime != null and endTime !=''">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]>
            DATE_FORMAT(#{endTime},'%Y%m%d')
        </if>
        <if test="userRank != null">
            AND rak.ur_name = #{userRank}
        </if>
        <if test="level != null and level != ''">
            AND lc.tuls_level = #{level}
        </if>
        <if test="activeCode == 0">
            AND (ext.`uie_invite_code` is null OR ext.`uie_invite_code`='')
        </if>
        <if test="activeCode == 1">
            AND (ext.`uie_invite_code` is not null OR ext.`uie_invite_code`<![CDATA[<>]]>'')
        </if>
        <if test="key != null and key !='' ">
            <if test="keyType == 1">
                AND u.id = #{key}
            </if>
            <if test="keyType == 2">
                AND u.`nick_name` LIKE '%${key}%'
            </if>
            <if test="keyType == 3">
                AND u.`phone` = #{key}
            </if>
            <if test="keyType == 4">
                AND b.`account` = #{key}
            </if>
            <if test="keyType == 5">
                AND (ext.`uie_invite_code` = #{key} OR ext.`uie_invite_code_vip`= #{key})
            </if>
        </if>
    </select>
    <select id="query" resultMap="BaseResultMapVO">
        SELECT *
        ,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb
        WHERE
        hb.hb_uid = u.id AND hb.hb_type = 1 )AS totalOrder <!-- 累计订单 -->
        ,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb
        WHERE hb.hb_uid
        = u.id AND hb.hb_type = 1
        AND DATE_FORMAT(hb.`hb_create_time`,'%Y%m') =
        DATE_FORMAT(CURDATE(),'%Y%m'))AS monthOrder <!-- 累计本月订单 -->
        ,(SELECT COUNT(tr.`id`) FROM `yeshi_ec_threesale` tr  <!-- 队员 -->
        WHERE tr.`boss_id`=u.id AND tr.state = 1) AS totalPlayers,
        tuls_level As userLevel, ext.uie_invite_code AS inviteCode
        FROM
        yeshi_ec_user u
        LEFT JOIN yeshi_ec_binding_account b ON u.`id` =
        b.`uid`
        LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
        LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
        LEFT
        JOIN yeshi_ec_user_info_extra_taobao tb ON tb.`uiet_uid` = u.id
        LEFT JOIN  yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id
        <if test="userState == 2">
            LEFT JOIN
            (SELECT A.uid AS buid,MAX(A.f_wxUnionId) AS
            wxUnionIdInvalid
            ,MAX(A.f_taobaoUid) AS
            taobaoUidInvalid,MAX(A.f_phone) AS
            phoneInvalid,MAX(A.f_alipayAccount) AS alipayAccountInvalid FROM
            (SELECT u.`id`AS uid,b.account AS alipayAccount,b.name AS
            alipayAccountName,fu.* FROM yeshi_ec_user u
            LEFT JOIN
            yeshi_ec_binding_account b ON b.`uid` = u.`id`
            LEFT JOIN
            yeshi_ec_user_info_extra_taobao tb ON tb.`uiet_uid` = u.id
            LEFT JOIN
            (SELECT fc.fuc_effective,IF(fc.`fuc_type` =
            'wxUnionId',fc.`fuc_identify_code`,NULL)AS f_wxUnionId,
            IF(fc.`fuc_type` = 'taobaoUid',fc.`fuc_identify_code`,NULL)AS
            f_taobaoUid,
            IF(fc.`fuc_type` = 'phone',fc.`fuc_identify_code`,NULL)AS
            f_phone,
            IF(fc.`fuc_type` =
            'alipayAccount',fc.`fuc_identify_code`,NULL)AS f_alipayAccount
            FROM
            yeshi_ec_forbidden_user_identify_code fc WHERE fc.fuc_effective
            = 1
            )fu ON (fu.f_wxUnionId = u.`wx_union_id` OR fu.f_taobaoUid =
            tb.`uiet_taobao_uid` OR fu.f_phone = u.`phone` OR fu.f_alipayAccount
            = b.`account`)
            WHERE u.`state` =2
            )A GROUP BY A.uid) B ON u.id= B.buid
        </if>
        where 1=1 AND u.system=#{system}
        <if test="userState == 1">
            AND u.`state` <![CDATA[<>]]>2 <!-- 未被封禁用户 -->
        </if>
        <if test="userState == 2">
            AND u.`state` =2   <!-- 封禁用户 -->
        </if>
        <if test="userType!=null">
            AND u.type=#{userType}
        </if>
        <if test="startTime != null and startTime !='' ">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]>
            DATE_FORMAT(#{startTime},'%Y%m%d')
        </if>
        <if test="endTime != null and endTime !=''">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]>
            DATE_FORMAT(#{endTime},'%Y%m%d')
        </if>
        <if test="userRank != null">
            AND rak.ur_name = #{userRank}
        </if>
        <if test = "level != null and level != ''">
            AND lc.tuls_level = #{level}
        </if>
        <if test="activeCode == 0">
            AND (ext.`uie_invite_code` is null OR ext.`uie_invite_code`='')
        </if>
        <if test="activeCode == 1">
            AND (ext.`uie_invite_code` is not null OR ext.`uie_invite_code`<![CDATA[<>]]>'')
        </if>
        <if test="days != null">
            <!-- 注册时间 -->
            AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]>
        </if>
        <if test="key != null and key !='' ">
            <if test="keyType == 1">
                AND u.id = #{key}
            </if>
            <if test="keyType == 2">
                AND u.`nick_name` LIKE '%${key}%'
            </if>
            <if test="keyType == 3">
                AND u.`phone` = #{key}
            </if>
            <if test="keyType == 4">
                AND b.`account` = #{key}
            </if>
        </if>
        ORDER BY
        <if test="orderField == 1">
            totalOrder,
        </if>
        <if test="orderField == 2">
            totalOrder DESC,
        </if>
        <if test="orderField == 3">
            monthOrder,
        </if>
        <if test="orderField == 4">
            monthOrder DESC,
        </if>
        <if test="orderField == 5">
            totalPlayers,
        </if>
        <if test="orderField == 6">
            totalPlayers DESC,
        </if>
        u.createtime DESC
        LIMIT ${start},${count}
    </select>
    <select id="queryCount" resultType="java.lang.Long">
        SELECT IFNULL(count(u.id),0) FROM yeshi_ec_user u
        LEFT JOIN
        yeshi_ec_binding_account b ON u.`id` = b.`uid`
        LEFT JOIN
        yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
        LEFT JOIN
        yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
        LEFT JOIN  yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id
        where 1=1  AND u.system=#{system}
        <if test="userState == 1">
            AND u.`state` <![CDATA[<>]]>
            2 <!-- 正常用户 -->
        </if>
        <if test="userState == 2">
            AND u.`state` =2   <!-- 封禁用户 -->
        </if>
        <if test="userType!=null">
            AND u.type=#{userType}
        </if>
        <if test="startTime != null and startTime !='' ">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]>
            DATE_FORMAT(#{startTime},'%Y%m%d')
        </if>
        <if test="endTime != null and endTime !=''">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]>
            DATE_FORMAT(#{endTime},'%Y%m%d')
        </if>
        <if test="userRank != null">
            AND rak.ur_name = #{userRank}
        </if>
        <if test = "level != null and level != ''">
            AND lc.tuls_level = #{level}
        </if>
        <if test="activeCode == 0">
            AND (ext.`uie_invite_code` is null OR ext.`uie_invite_code`='')
        </if>
        <if test="activeCode == 1">
            AND (ext.`uie_invite_code` is not null OR ext.`uie_invite_code`<![CDATA[<>]]>'')
        </if>
        <if test="days != null">  <!-- 注册时间 -->
            AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]>
        </if>
        <if test="key != null and key !='' ">
            <if test="keyType == 1">
                AND u.id = #{key}
            </if>
            <if test="keyType == 2">
                AND u.`nick_name` LIKE '%${key}%'
            </if>
            <if test="keyType == 3">
                AND u.`phone` = #{key}
            </if>
            <if test="keyType == 4">
                AND b.`account` = #{key}
            </if>
        </if>
    </select>
    <select id="querySumMoney" resultType="java.lang.Double">
        SELECT COALESCE(sum(u.my_hongBao),0) FROM yeshi_ec_user u
        LEFT JOIN
        yeshi_ec_binding_account b ON u.`id` = b.`uid`
        where <![CDATA[ 1>0 ]]>
        <if test="key != null and key !='' ">
            AND (u.id LIKE '%${key}%' OR u.`phone` LIKE '%${key}%' OR
            u.`wxName`
            LIKE '%${key}%'
            OR u.`nick_name` LIKE '%${key}%' OR
            u.`tbName` LIKE '%${key}%' OR
            b.`account` LIKE '%${key}%')
        </if>
        <if test="startTime != null and startTime !='' ">
                   <![CDATA[ AND FROM_UNIXTIME(createtime/1000) >= '${startTime}' ]]>
        </if>
        <if test="endTime != null and endTime !=''">
                   <![CDATA[ AND FROM_UNIXTIME(createtime/1000) < '${endTime}'  ]]>
        </if>
        <if test="userType != null">
            AND u.rank = #{userType}
        </if>
        <if test="days != null">
            <!-- 时间 -->
            AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(createtime/1000)]]>
        </if>
    </select>
    <select id="query" resultMap="BaseResultMapVO">
        SELECT *
        ,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb
        WHERE
        hb.hb_uid = u.id AND hb.hb_type = 1 )AS totalOrder <!-- 累计订单 -->
        ,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb
        WHERE hb.hb_uid
        = u.id AND hb.hb_type = 1
        AND DATE_FORMAT(hb.`hb_create_time`,'%Y%m') =
        DATE_FORMAT(CURDATE(),'%Y%m'))AS monthOrder <!-- 累计本月订单 -->
        ,(SELECT COUNT(tr.`id`) FROM `yeshi_ec_threesale` tr  <!-- 队员 -->
        WHERE tr.`boss_id`=u.id AND tr.state = 1) AS totalPlayers,
        tuls_level As userLevel, ext.uie_invite_code AS inviteCode
        FROM
        yeshi_ec_user u
        LEFT JOIN yeshi_ec_binding_account b ON u.`id` =
        b.`uid`
        LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
        LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
        LEFT
        JOIN yeshi_ec_user_info_extra_taobao tb ON tb.`uiet_uid` = u.id
        LEFT JOIN yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id
        <if test="userState == 2">
            LEFT JOIN
            (SELECT A.uid AS buid,MAX(A.f_wxUnionId) AS
            wxUnionIdInvalid
            ,MAX(A.f_taobaoUid) AS
            taobaoUidInvalid,MAX(A.f_phone) AS
            phoneInvalid,MAX(A.f_alipayAccount) AS alipayAccountInvalid FROM
            (SELECT u.`id`AS uid,b.account AS alipayAccount,b.name AS
            alipayAccountName,fu.* FROM yeshi_ec_user u
            LEFT JOIN
            yeshi_ec_binding_account b ON b.`uid` = u.`id`
            LEFT JOIN
            yeshi_ec_user_info_extra_taobao tb ON tb.`uiet_uid` = u.id
            LEFT JOIN
            (SELECT fc.fuc_effective,IF(fc.`fuc_type` =
            'wxUnionId',fc.`fuc_identify_code`,NULL)AS f_wxUnionId,
            IF(fc.`fuc_type` = 'taobaoUid',fc.`fuc_identify_code`,NULL)AS
            f_taobaoUid,
            IF(fc.`fuc_type` = 'phone',fc.`fuc_identify_code`,NULL)AS
            f_phone,
            IF(fc.`fuc_type` =
            'alipayAccount',fc.`fuc_identify_code`,NULL)AS f_alipayAccount
            FROM
            yeshi_ec_forbidden_user_identify_code fc WHERE fc.fuc_effective
            = 1
            )fu ON (fu.f_wxUnionId = u.`wx_union_id` OR fu.f_taobaoUid =
            tb.`uiet_taobao_uid` OR fu.f_phone = u.`phone` OR fu.f_alipayAccount
            = b.`account`)
            WHERE u.`state` =2
            )A GROUP BY A.uid) B ON u.id= B.buid
        </if>
    <select id="countNewUser" resultType="java.lang.Long">
        SELECT COALESCE(count(id),0) FROM `yeshi_ec_user`
        WHERE 1=1
        <if test="isToday != null and isToday == 1">
            AND TO_DAYS(FROM_UNIXTIME(createtime/1000)) =
            TO_DAYS(NOW())
        </if>
        <if test="isMonth != null and isMonth == 1">
            AND DATE_FORMAT( FROM_UNIXTIME(createtime/1000), '%Y%m' )
            =
            DATE_FORMAT(CURDATE() , '%Y%m' )
        </if>
    </select>
        where 1=1 AND u.system=#{system}
        <if test="userState == 1">
            AND u.`state` <![CDATA[<>]]>2 <!-- 未被封禁用户 -->
        </if>
        <if test="userState == 2">
            AND u.`state` =2   <!-- 封禁用户 -->
        </if>
    <select id="countRank" resultType="java.lang.Long">
        <!-- 等级统计 -->
        SELECT COALESCE(count(id),0) FROM `yeshi_ec_user` WHERE rank = #{rank}
    </select>
        <if test="userType!=null">
            AND u.type=#{userType}
        </if>
        <if test="startTime != null and startTime !='' ">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]>
            DATE_FORMAT(#{startTime},'%Y%m%d')
        </if>
        <if test="endTime != null and endTime !=''">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]>
            DATE_FORMAT(#{endTime},'%Y%m%d')
        </if>
        <if test="userRank != null">
            AND rak.ur_name = #{userRank}
        </if>
        <if test="level != null and level != ''">
            AND lc.tuls_level = #{level}
        </if>
    <select id="countAllMoney" resultType="java.math.BigDecimal">
        <!-- 金额统计 -->
        SELECT CAST(SUM(my_hongBao)AS DECIMAL(19,2)) FROM `yeshi_ec_user`
        WHERE 1=1
        <if test="minMoney != null">
            AND <![CDATA[ my_hongBao >= #{minMoney}]]>
        </if>
    </select>
        <if test="activeCode == 0">
            AND (ext.`uie_invite_code` is null OR ext.`uie_invite_code`='')
        </if>
    <select id="countShareAndInviteMoney" resultMap="BaseResultMap">
        <if test="activeCode == 1">
            AND (ext.`uie_invite_code` is not null OR ext.`uie_invite_code`<![CDATA[<>]]>'')
        </if>
        <if test="days != null">
            <!-- 注册时间 -->
            AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]>
        </if>
        <if test="key != null and key !='' ">
            <if test="keyType == 1">
                AND u.id = #{key}
            </if>
            <if test="keyType == 2">
                AND u.`nick_name` LIKE '%${key}%'
            </if>
            <if test="keyType == 3">
                AND u.`phone` = #{key}
            </if>
            <if test="keyType == 4">
                AND b.`account` = #{key}
            </if>
        </if>
        ORDER BY
        <if test="orderField == 1">
            totalOrder,
        </if>
        <if test="orderField == 2">
            totalOrder DESC,
        </if>
        <if test="orderField == 3">
            monthOrder,
        </if>
        <if test="orderField == 4">
            monthOrder DESC,
        </if>
        <if test="orderField == 5">
            totalPlayers,
        </if>
        <if test="orderField == 6">
            totalPlayers DESC,
        </if>
        u.createtime DESC
        LIMIT ${start},${count}
    </select>
    <select id="queryCount" resultType="java.lang.Long">
        SELECT IFNULL(count(u.id),0) FROM yeshi_ec_user u
        LEFT JOIN
        yeshi_ec_binding_account b ON u.`id` = b.`uid`
        LEFT JOIN
        yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
        LEFT JOIN
        yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
        LEFT JOIN yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id
        where 1=1 AND u.system=#{system}
        <if test="userState == 1">
            AND u.`state` <![CDATA[<>]]>
            2 <!-- 正常用户 -->
        </if>
        <if test="userState == 2">
            AND u.`state` =2   <!-- 封禁用户 -->
        </if>
        <if test="userType!=null">
            AND u.type=#{userType}
        </if>
        <if test="startTime != null and startTime !='' ">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]>
            DATE_FORMAT(#{startTime},'%Y%m%d')
        </if>
        <if test="endTime != null and endTime !=''">
            AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]>
            DATE_FORMAT(#{endTime},'%Y%m%d')
        </if>
        <if test="userRank != null">
            AND rak.ur_name = #{userRank}
        </if>
        <if test="level != null and level != ''">
            AND lc.tuls_level = #{level}
        </if>
        <if test="activeCode == 0">
            AND (ext.`uie_invite_code` is null OR ext.`uie_invite_code`='')
        </if>
        <if test="activeCode == 1">
            AND (ext.`uie_invite_code` is not null OR ext.`uie_invite_code`<![CDATA[<>]]>'')
        </if>
        <if test="days != null">  <!-- 注册时间 -->
            AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]>
        </if>
        <if test="key != null and key !='' ">
            <if test="keyType == 1">
                AND u.id = #{key}
            </if>
            <if test="keyType == 2">
                AND u.`nick_name` LIKE '%${key}%'
            </if>
            <if test="keyType == 3">
                AND u.`phone` = #{key}
            </if>
            <if test="keyType == 4">
                AND b.`account` = #{key}
            </if>
        </if>
    </select>
    <select id="querySumMoney" resultType="java.lang.Double">
        SELECT COALESCE(sum(u.my_hongBao),0) FROM yeshi_ec_user u
        LEFT JOIN
        yeshi_ec_binding_account b ON u.`id` = b.`uid`
        where <![CDATA[ 1>0 ]]>
        <if test="key != null and key !='' ">
            AND (u.id LIKE '%${key}%' OR u.`phone` LIKE '%${key}%' OR
            u.`wxName`
            LIKE '%${key}%'
            OR u.`nick_name` LIKE '%${key}%' OR
            u.`tbName` LIKE '%${key}%' OR
            b.`account` LIKE '%${key}%')
        </if>
        <if test="startTime != null and startTime !='' ">
            <![CDATA[ AND FROM_UNIXTIME(createtime/1000) >= '${startTime}' ]]>
        </if>
        <if test="endTime != null and endTime !=''">
            <![CDATA[ AND FROM_UNIXTIME(createtime/1000) < '${endTime}'  ]]>
        </if>
        <if test="userType != null">
            AND u.rank = #{userType}
        </if>
        <if test="days != null">
            <!-- 时间 -->
            AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(createtime/1000)]]>
        </if>
    </select>
    <select id="countNewUser" resultType="java.lang.Long">
        SELECT COALESCE(count(id),0) FROM `yeshi_ec_user`
        WHERE 1=1
        <if test="isToday != null and isToday == 1">
            AND TO_DAYS(FROM_UNIXTIME(createtime/1000)) =
            TO_DAYS(NOW())
        </if>
        <if test="isMonth != null and isMonth == 1">
            AND DATE_FORMAT( FROM_UNIXTIME(createtime/1000), '%Y%m' )
            =
            DATE_FORMAT(CURDATE() , '%Y%m' )
        </if>
    </select>
    <select id="countRank" resultType="java.lang.Long">
        <!-- 等级统计 -->
        SELECT COALESCE(count(id),0) FROM `yeshi_ec_user` WHERE rank = #{rank}
    </select>
    <select id="countAllMoney" resultType="java.math.BigDecimal">
        <!-- 金额统计 -->
        SELECT CAST(SUM(my_hongBao)AS DECIMAL(19,2)) FROM `yeshi_ec_user`
        WHERE 1=1
        <if test="minMoney != null">
            AND <![CDATA[ my_hongBao >= #{minMoney}]]>
        </if>
    </select>
    <select id="countShareAndInviteMoney" resultMap="BaseResultMap">
        SELECT IFNULL(SUM(h.`money`),0),h.`uid` FROM `yeshi_ec_hongbao` h
        WHERE DATE_FORMAT(FROM_UNIXTIME(h.`createtime`/1000), '%Y-%m-%d' )=
        '2018-08-02'
@@ -682,19 +665,20 @@
        LIMIT ${start},${count}
    </select>
    <select id="longTimeNoLogin" resultType="java.lang.Long">
    <select id="longTimeNoLogin" resultType="java.lang.Long">
        SELECT u.`id` FROM `yeshi_ec_user` u
        WHERE u.`id` IN
        <foreach item="item" collection="list" open="(" separator=","
            close=")">#{item}</foreach>
        AND <![CDATA[ (DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`last_logintime`/1000))
        SELECT u.`id` FROM `yeshi_ec_user` u
        WHERE u.`id` IN
        <foreach item="item" collection="list" open="(" separator=","
                 close=")">#{item}
        </foreach>
        AND <![CDATA[ (DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`last_logintime`/1000))
            OR (u.`last_logintime` IS NULL 
                AND DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`createTime`/1000)))) ]]>
    </select>
    </select>
    <select id="countLoseUser" resultType="java.lang.Long">
    <select id="countLoseUser" resultType="java.lang.Long">
        SELECT COUNT(DISTINCT t.`id` ) FROM `yeshi_ec_user` t
        LEFT JOIN
        `yeshi_ec_user_money_detail` d ON d.`umd_uid` = t.`id`
@@ -706,7 +690,7 @@
        DATE(d.`umd_createtime`)
    </select>
    <select id="countHasOrderUser" resultType="java.lang.Long">
    <select id="countHasOrderUser" resultType="java.lang.Long">
        SELECT COUNT(DISTINCT
        h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h
        WHERE (h.`hb_type`=1 or
@@ -714,135 +698,134 @@
    </select>
    <select id="countNewUserByDate" resultMap="ChartMap">
        SELECT COUNT(DISTINCT h.`id`) AS showValue,
        <if test="type == 1">
            FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS
            'showDate'
        </if>
        <if test="type == 2">
            FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'showDate'
        </if>
        <if test="type == 3">
            FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'showDate'
        </if>
        FROM yeshi_ec_user h
        <if test="channel != null and  channel != 'all' ">
            left join (SELECT a.`lua_uid` AS uid FROM
            `yeshi_ec_log_user_active` a
            WHERE a.`lua_channel`='${channel}' GROUP
            BY a.`lua_uid`)a ON
            h.`id`=a.uid
        </if>
        WHERE 1=1
        <if test="channel != null and  channel != 'all' ">
            AND a.uid is not null
        </if>
        <if test="startTime != null and startTime != '' ">
            AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
        </if>
        <if test="endTime != null and endTime != '' ">
            AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
            '${endTime}'
        </if>
        <if test="years != null and years != '' ">
            AND FROM_UNIXTIME(h.`createtime`/1000,'%Y') = '${years}'
        </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
            GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
            GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y')
        </if>
        ORDER BY h.`createtime`
    </select>
    <select id="countNewUserByDate" resultMap="ChartMap">
        SELECT COUNT(DISTINCT h.`id`) AS showValue,
        <if test="type == 1">
            FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS
            'showDate'
        </if>
        <if test="type == 2">
            FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'showDate'
        </if>
        <if test="type == 3">
            FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'showDate'
        </if>
        FROM yeshi_ec_user h
        <if test="channel != null and  channel != 'all' ">
            left join (SELECT a.`lua_uid` AS uid FROM
            `yeshi_ec_log_user_active` a
            WHERE a.`lua_channel`='${channel}' GROUP
            BY a.`lua_uid`)a ON
            h.`id`=a.uid
        </if>
        WHERE 1=1
        <if test="channel != null and  channel != 'all' ">
            AND a.uid is not null
        </if>
        <if test="startTime != null and startTime != '' ">
            AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
        </if>
        <if test="endTime != null and endTime != '' ">
            AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
            '${endTime}'
        </if>
        <if test="years != null and years != '' ">
            AND FROM_UNIXTIME(h.`createtime`/1000,'%Y') = '${years}'
        </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
            GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
            GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y')
        </if>
        ORDER BY h.`createtime`
    </select>
    <select id="getTodayHasOrder" resultMap="ChartMap">
        SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'showValue',
        <if test="type == 1">
            FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS
            'showDate'
        </if>
        <if test="type == 2">
            FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate'
        </if>
        <if test="type == 3">
            FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate'
        </if>
    <select id="getTodayHasOrder" resultMap="ChartMap">
        SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'showValue',
        <if test="type == 1">
            FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS
            'showDate'
        </if>
        <if test="type == 2">
            FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate'
        </if>
        <if test="type == 3">
            FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate'
        </if>
        FROM yeshi_ec_user u
        <if test="channel != null and channel != 'all' ">
            LEFT JOIN (SELECT a.`lua_uid` AS uid FROM
            `yeshi_ec_log_user_active` a
            WHERE a.`lua_channel`='${channel}' GROUP
            BY a.`lua_uid`) a ON u.`id`=a.uid
        </if>
        LEFT JOIN `yeshi_ec_hongbao_v2` h ON h.`hb_uid`= u.`id`
        WHERE
        (h.`hb_type`=1 OR h.`hb_type`=20)
        <if test="channel != null and  channel != 'all' ">
            AND a.uid is not null
        </if>
        <!-- 当日下单 -->
        AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') =
        DATE_FORMAT(h.hb_create_time,'%Y-%m-%d')
        FROM yeshi_ec_user u
        <if test="channel != null and channel != 'all' ">
            LEFT JOIN (SELECT a.`lua_uid` AS uid FROM
            `yeshi_ec_log_user_active` a
            WHERE a.`lua_channel`='${channel}' GROUP
            BY a.`lua_uid`) a ON u.`id`=a.uid
        </if>
        LEFT JOIN `yeshi_ec_hongbao_v2` h ON h.`hb_uid`= u.`id`
        WHERE
        (h.`hb_type`=1 OR h.`hb_type`=20)
        <if test="channel != null and  channel != 'all' ">
            AND a.uid is not null
        </if>
        <!-- 当日下单 -->
        AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') =
        DATE_FORMAT(h.hb_create_time,'%Y-%m-%d')
        <if test="startTime != null and startTime != '' ">
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
        </if>
        <if test="endTime != null and endTime != '' ">
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
            '${endTime}'
        </if>
        <if test="years != null and years != '' ">
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
        </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y')
        </if>
        ORDER BY u.`createtime`
    </select>
        <if test="startTime != null and startTime != '' ">
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
        </if>
        <if test="endTime != null and endTime != '' ">
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
            '${endTime}'
        </if>
        <if test="years != null and years != '' ">
            AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
        </if>
        <if test="type == 1">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
        </if>
        <if test="type == 2">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m')
        </if>
        <if test="type == 3">
            GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y')
        </if>
        ORDER BY u.`createtime`
    </select>
    <select id="getWeekHasOrder" resultMap="ChartMap">
        SELECT COUNT(DISTINCT hb.uid) AS
        showValue,FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
        FROM (SELECT COUNT(v2.`hb_id`) AS num,v2.hb_uid AS uid
        FROM
        yeshi_ec_hongbao_v2 v2
        WHERE (v2.`hb_type`=1 OR v2.`hb_type`=20)
        AND
        DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ >= ]]>'${startTime}'
        AND DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
        GROUP BY v2.hb_uid HAVING num >= ${orderNum})hb
        LEFT JOIN yeshi_ec_user
        u ON u.id = hb.uid
        <if test="channel != null and channel != 'all' ">
            LEFT JOIN (SELECT a.`lua_uid` AS uid FROM
            `yeshi_ec_log_user_active` a
            WHERE a.`lua_channel`='${channel}' GROUP
            BY a.`lua_uid`) a ON u.`id`=a.uid
        </if>
        WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '${startTime}'
        <if test="channel != null and  channel != 'all' ">
            AND a.uid is not null
        </if>
        GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
        ORDER BY
        u.`createtime`
    </select>
    <select id="getWeekHasOrder" resultMap="ChartMap">
        SELECT COUNT(DISTINCT hb.uid) AS
        showValue,FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
        FROM (SELECT COUNT(v2.`hb_id`) AS num,v2.hb_uid AS uid
        FROM
        yeshi_ec_hongbao_v2 v2
        WHERE (v2.`hb_type`=1 OR v2.`hb_type`=20)
        AND
        DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ >= ]]>'${startTime}'
        AND DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
        GROUP BY v2.hb_uid HAVING num >= ${orderNum})hb
        LEFT JOIN yeshi_ec_user
        u ON u.id = hb.uid
        <if test="channel != null and channel != 'all' ">
            LEFT JOIN (SELECT a.`lua_uid` AS uid FROM
            `yeshi_ec_log_user_active` a
            WHERE a.`lua_channel`='${channel}' GROUP
            BY a.`lua_uid`) a ON u.`id`=a.uid
        </if>
        WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '${startTime}'
        <if test="channel != null and  channel != 'all' ">
            AND a.uid is not null
        </if>
        GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
        ORDER BY
        u.`createtime`
    </select>
    <select id="getUserInfoByInviteCode" resultMap="BaseResultMap">
    <select id="getUserInfoByInviteCode" resultMap="BaseResultMap">
        SELECT * FROM
        yeshi_ec_user u
        LEFT JOIN yeshi_ec_user_info_extra uf ON uf.`uie_uid` =
@@ -853,13 +836,13 @@
    </select>
    <select id="countAvaiableUser" resultType="java.lang.Long">
    <select id="countAvaiableUser" resultType="java.lang.Long">
        SELECT count(*) FROM
        yeshi_ec_user u
        where u.state=0
    </select>
    <select id="getAutoExtractUser" resultMap="BaseResultMap">
    <select id="getAutoExtractUser" resultMap="BaseResultMap">
        SELECT u.* FROM `yeshi_ec_user_info_extra` t
        LEFT JOIN `yeshi_ec_user`
        u ON u.`id` = t.`uie_uid`
@@ -878,7 +861,7 @@
        LIMIT #{start},#{count}
    </select>
    <select id="getAutoExtractUserTo1212" resultMap="BaseResultMap">
    <select id="getAutoExtractUserTo1212" resultMap="BaseResultMap">
        SELECT u.* FROM (SELECT v2.`hb_uid` FROM `yeshi_ec_hongbao_v2` v2
        WHERE <![CDATA[v2.`hb_create_time` > '2019-01-01' AND v2.`hb_create_time` < '2019-06-18']]>
        GROUP BY hb_uid)h
@@ -895,13 +878,13 @@
    </select>
    <select id="listByType" resultMap="BaseResultMap">
    <select id="listByType" resultMap="BaseResultMap">
        select * from yeshi_ec_user u
        where u.type=#{type} limit #{start},#{count}
    </select>
    <select id="countByType" resultType="java.lang.Long"
        parameterType="java.lang.Integer">
    <select id="countByType" resultType="java.lang.Long"
            parameterType="java.lang.Integer">
        select count(*) from
        yeshi_ec_user u where u.type=#{0}
    </select>