admin
2019-11-29 32f8ab2806fb088335e24983477f5179064ada9d
Merge remote-tracking branch 'origin/div' into div

Conflicts:
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java
41个文件已修改
9个文件已添加
1964 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/BrandShopAdminController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMoneyController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java 334 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandInfoMapper.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/money/UserMoneyDetailMapper.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/vip/UserVipConfigMapper.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandInfo.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/UserVipConfig.java 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/user/vip/UserVipConfigException.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/ShameUserInviteCodePublishJOB.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandInfoMapper.xml 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/money/UserMoneyDetailMapper.xml 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/vip/UserVipConfigMapper.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/money/UserMoneyDetailServiceImpl.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/ExtractServiceImpl.java 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/CodePublishRecordServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVipConfigServiceImpl.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandInfoService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/money/UserMoneyDetailService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/money/extract/ExtractService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVIPInfoService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVipConfigService.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/order/OrderCountVO.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/user/UserVipRateVO.java 160 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/mongo.properties 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/redis.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/rocketmq.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/rocketmq.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/test/java/org/fanli/TaoKeTest.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/BrandShopAdminController.java
@@ -526,7 +526,7 @@
     */
    @RequestMapping(value = "queryBrand")
    public void queryBrand(String callback, Integer pageIndex, Integer pageSize, String key, Long cid, Integer state,
            PrintWriter out) {
            Integer showState, PrintWriter out) {
        if (pageIndex == null || pageIndex < 1) {
            pageIndex = 1;
@@ -536,8 +536,19 @@
            pageSize = Constant.PAGE_SIZE;
        }
        
        List<String> keys = null;
        if (!StringUtil.isNullOrEmpty(key)) {
            String[] array = key.split("\\s+");
            if (array != null && array.length > 0) {
                keys = new ArrayList<String>();
                for (int i= 0; i < array.length; i++) {
                    keys.add(array[i].toString());
                }
            }
        }
        try {
            List<BrandInfo> list = brandInfoService.listQuery((pageIndex - 1) * pageSize, pageSize, key, cid, state);
            List<BrandInfo> list = brandInfoService.listQuery((pageIndex - 1) * pageSize, pageSize, keys, cid, state, showState);
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
@@ -554,7 +565,7 @@
                }
            }
            long count = brandInfoService.countQuery(key, cid, state);
            long count = brandInfoService.countQuery(keys, cid, state, showState);
            int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
            PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
@@ -1117,7 +1117,8 @@
    @RequestMapping(value = "downAutoExtractTxt")
    public void downAutoExtractTxt(String callback, HttpServletResponse response, PrintWriter out) {
        try {
            List<String> list = extractService.getAutoExtractOpenIds();
            //List<String> list = extractService.getAutoExtractOpenIds();
            List<String> list = extractService.getAutoExtractOpenIdsTo1212();
            if (list == null || list.size() <= 1) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件"));
                return;
@@ -1195,7 +1196,8 @@
    @RequestMapping(value = "preAutoUser")
    public void preAutoUser(String callback, Integer pageIndex, PrintWriter out) {
        try {
            List<UserInfo> list = extractService.preAutoUser();
            //List<UserInfo> list = extractService.preAutoUser();
            List<UserInfo> list = extractService.preAutoUserTo1212();
            if (list == null || list.isEmpty()) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件"));
                return;
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java
@@ -31,6 +31,7 @@
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserLotteryRecordService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.vo.user.UserSystemCouponRecordVO;
import com.yeshi.fanli.vo.user.UserSystemCouponVO;
@@ -78,7 +79,8 @@
    @Resource
    private UserLotteryRecordService userLotteryRecordService;
    
    @Resource
    private UserVIPInfoService userVIPInfoService;
    /**
     * 用户券列表查询
@@ -289,6 +291,11 @@
            return;
        }
        if (userVIPInfoService.isVIP(uid)) {
            out.print(JsonUtil.loadFalseResult("超级会员不可使用奖励券"));
            return;
        }
        if (goodsType == null || goodsType > 3 || goodsType < 1) {
            goodsType = Constant.SOURCE_TYPE_TAOBAO;
        }
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMoneyController.java
@@ -110,8 +110,8 @@
            date = new Date(ca.getTimeInMillis() - 1);
        }
        List<UserMoneyDetailHistoryVO> list = userMoneyDetailService.listUserMoneyDetailForClient(uid, index, 0, date);
        long count = userMoneyDetailService.countUserMoneyDetailForClient(uid, index, 0, date);
        List<UserMoneyDetailHistoryVO> list = userMoneyDetailService.listUserMoneyDetailForClient(uid, index, type, date);
        long count = userMoneyDetailService.countUserMoneyDetailForClient(uid, index, type, date);
        GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
        gsonBuilder.registerTypeAdapter(UserMoneyDetailTypeEnum.class, new TypeAdapter<UserMoneyDetailTypeEnum>() {
            @Override
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -4,7 +4,9 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@@ -16,6 +18,7 @@
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.taobao.TbImgUtil;
import com.google.gson.Gson;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.jd.JDCategoryInfo;
import com.yeshi.fanli.dto.jd.JDCouponInfo;
@@ -28,6 +31,7 @@
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.entity.jd.JDGoodsClass;
import com.yeshi.fanli.entity.system.BusinessSystem;
@@ -98,6 +102,7 @@
import com.yeshi.fanli.vo.tlj.ReduceHongBao;
import com.yeshi.fanli.vo.tlj.SpreadHongBao;
import net.sf.json.JSON;
import net.sf.json.JSONObject;
@Controller
@@ -706,7 +711,8 @@
        if (couponInfo != null) {
            // 券链接处理
            String materialId = "https://item.jd.com/" + id + ".html";
            String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON + "", null);
            String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(),
                    JDApiUtil.POSITION_COUPON + "", null);
            couponInfo.setLink(url);
        }
@@ -1181,9 +1187,11 @@
            if (couponInfo != null) {
                couponUrl = couponInfo.getLink();
            }
            jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
            jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
                    uid + "");
        } else {
            jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
            jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
                    uid + "");
        }
        JSONObject data = new JSONObject();
@@ -1318,4 +1326,92 @@
        }
        out.print(JsonUtil.loadTrueResult(data));
    }
    @RequestMapping(value = "listSimpleGoods", method = RequestMethod.POST)
    public void listSimpleGoods(AcceptData acceptData, String goodsInfo, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(goodsInfo)) {
            out.print(JsonUtil.loadFalseResult(1, "商品信息为空"));
            return;
        }
        net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(goodsInfo);
        List<CommonGoods> commonGoodsList = new ArrayList<>();
        for (int i = 0; i < array.size(); i++) {
            JSONObject obj = array.optJSONObject(i);
            CommonGoods cg = new CommonGoods();
            cg.setGoodsId(obj.optLong("goodsId"));
            cg.setGoodsType(obj.optInt("goodsType"));
            commonGoodsList.add(cg);
        }
        if (commonGoodsList.size() > 9) {
            out.print(JsonUtil.loadFalseResult(1, "最多同时获取9条数据"));
            return;
        }
        // 分离各个平台的商品信息
        List<Long> tbGoodsList = new ArrayList<>();
        List<Long> jdGoodsList = new ArrayList<>();
        List<Long> pddGoodsList = new ArrayList<>();
        List<String> keyList = new ArrayList<>();
        for (CommonGoods cg : commonGoodsList) {
            keyList.add(cg.getGoodsId() + "-" + cg.getGoodsType());
            if (cg.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
                tbGoodsList.add(cg.getGoodsId());
            } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_JD) {
                jdGoodsList.add(cg.getGoodsId());
            } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_PDD) {
                pddGoodsList.add(cg.getGoodsId());
            }
        }
        Map<String, GoodsDetailVO> tempGoodsList = new HashMap<>();
        ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
                hongBaoManageService.getShareRate(), new BigDecimal(80));
        if (tbGoodsList.size() > 0) {
            List<TaoBaoGoodsBrief> goodsList = null;
            try {
                goodsList = TaoKeApiUtil.getBatchGoodsInfo(tbGoodsList);
            } catch (TaobaoGoodsDownException e) {
                e.printStackTrace();
            } catch (TaoKeApiException e) {
                e.printStackTrace();
            }
            if (goodsList != null)
                for (TaoBaoGoodsBrief goods : goodsList) {
                    goods.setTkRate(new BigDecimal(0));
                    tempGoodsList.put(goods.getAuctionId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
                            GoodsDetailVOFactory.convertTaoBao(goods, params));
                }
        }
        if (jdGoodsList.size() > 0) {
            List<JDGoods> goodsList = JDApiUtil.getGoodsDetail(jdGoodsList);
            for (JDGoods goods : goodsList) {
                tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
                        GoodsDetailVOFactory.convertJDGoods(goods, params));
            }
        }
        if (pddGoodsList.size() > 0) {
            List<PDDGoodsDetail> goodsList = PinDuoDuoApiUtil.listGoodsDetail(pddGoodsList);
            for (PDDGoodsDetail goods : goodsList) {
                tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
                        GoodsDetailVOFactory.convertPDDGoods(goods, params));
            }
        }
        List<GoodsDetailVO> voList = new ArrayList<>();
        Gson gson = JsonUtil.getApiCommonGson();
        for (String key : keyList) {
            GoodsDetailVO vo = tempGoodsList.get(key);
            if (vo != null) {
                voList.add(vo);
            }
        }
        out.print(JsonUtil.loadTrueResult(gson.toJson(voList)));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -2,7 +2,10 @@
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
@@ -16,6 +19,7 @@
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.SMSHistory;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
import com.yeshi.fanli.entity.push.DeviceActive;
import com.yeshi.fanli.entity.shop.BanLiShopOrder;
@@ -44,6 +48,7 @@
import com.yeshi.fanli.service.inter.user.UserAccountBindingHistoryService;
import com.yeshi.fanli.service.inter.user.UserAccountService;
import com.yeshi.fanli.service.inter.user.UserInfoDeleteRecordService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoModifyRecordService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
@@ -51,6 +56,7 @@
import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.RedisManager;
@@ -58,6 +64,7 @@
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.account.UserUtil;
import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
import com.yeshi.fanli.vo.user.UserVipRateVO;
import net.sf.json.JSONObject;
@@ -160,6 +167,12 @@
    @Resource
    private ConfigService configService;
    @Resource
    private UserVipConfigService userVipConfigService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    
    /**
     * 新版登录 V1.5.3
@@ -348,61 +361,61 @@
            return;
        }
        
        JSONObject data = new JSONObject();
        data.put("id", uid);
        data.put("nickName", userInfo.getNickName());
        data.put("portrait", userInfo.getPortrait());
        UserVipRateVO vo = new UserVipRateVO();
        vo.setId(uid);
        vo.setNickName(userInfo.getNickName());
        vo.setPortrait(userInfo.getPortrait());
        vo.setHelpLink(userVipConfigService.getValueByKey("help_link_vip_h5"));
    
        UserVIPInfo userVIPInfo = userVIPInfoService.selectByUid(uid);
        boolean vip = false;
        if (userVIPInfo != null && userVIPInfo.getState() != null
                && userVIPInfo.getState() == UserVIPInfo.STATE_SUCCESS) {
            vip = true;
            data.put("applyTime", userVIPInfo.getSuccessTime());
        }
        data.put("vip", vip);
        // 省钱 -自购产生返利   
        BigDecimal rewardPurchase = hongBaoV2CountService.getRewardMoneyBySelf(uid);
        data.put("rurchaseReward", rewardPurchase.setScale(2));
        BigDecimal conserveMoney = rewardPurchase;
        if (!vip) { // 少省钱:  自购产生返利  * 5/12
            BigDecimal rate1 = new BigDecimal(5);
            BigDecimal rate2 = new BigDecimal(12);
            conserveMoney = MoneyBigDecimalUtil.mul2(rewardPurchase,  MoneyBigDecimalUtil.div(rate1, rate2));
        }
        data.put("conserveMoney", conserveMoney.setScale(2));
        BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid);
        // 分享赚
        BigDecimal rewardShare = hongBaoV2CountService.getRewardMoneyByShare(uid);
        // 邀请赚
        BigDecimal rewardInvite = hongBaoV2CountService.getRewardMoneyByInvite(uid);        
        BigDecimal earnMoney = rewardShare;
        if (vip) { // 赚钱=分享+邀请
            earnMoney = MoneyBigDecimalUtil.add(rewardShare, rewardInvite );
        } else { // 少赚钱: 分享赚* 5/12
        UserVIPInfo userVIPInfo = userVIPInfoService.selectByUid(uid);
        if (userVIPInfo != null && userVIPInfo.getState() != null
                && userVIPInfo.getState() == UserVIPInfo.STATE_SUCCESS) { // VIP
            SimpleDateFormat format = new SimpleDateFormat("yyyy.mm.dd");
            vo.setVip(true);
            vo.setSuccessTime(format.format(userVIPInfo.getSuccessTime()));
            vo.setConserveMoney(finishMoney.setScale(2));
            vo.setEarnMoney(MoneyBigDecimalUtil.add(rewardShare, rewardInvite).setScale(2));
        } else {
            BigDecimal rate1 = new BigDecimal(5);
            BigDecimal rate2 = new BigDecimal(12);
            earnMoney = MoneyBigDecimalUtil.mul2(rewardShare,  MoneyBigDecimalUtil.div(rate1, rate2));
            vo.setConserveMoney(MoneyBigDecimalUtil.mul2(finishMoney,  MoneyBigDecimalUtil.div(rate1, rate2)).setScale(2));
            vo.setEarnMoney( MoneyBigDecimalUtil.mul2(rewardShare,  MoneyBigDecimalUtil.div(rate1, rate2)).setScale(2));
        }
        data.put("earnMoney", earnMoney.setScale(2));
        vo.setFinishMoney(finishMoney.setScale(2));
        
        // 注:1.有效一级队员定义:2019年1月1日起,自购或分享1笔且付款总金额不小于1元(退款为失效);
        long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid, "2019-01-01", new BigDecimal(1));
        data.put("teamNum", teamNum);
        // 累计金币
        BigDecimal goldCoin = integralDetailService.getCumulativeMoney(uid);
        data.put("goldCoin", goldCoin.setScale(0));
        // 帮助链接
        data.put("helpLink", configService.get("help_link_vip_info"));
        // 使用红包次数
        // 会员规则执行时间
        String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
        Date executeDate = null;
        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");
            executeDate = format.parse(limtDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        List<Integer> list = new ArrayList<Integer>();
        list.add(BanLiShopOrder.STATE_SUCCESS);
        data.put("shopNum", banLiShopOrderService.countByUidAndState(uid, list));
        out.print(JsonUtil.loadTrueResult(data));
        BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
        vo.setFinishGoldCoin(integralDetailService.getCumulativeMoney(uid));
        vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid, executeDate.getTime(), payMoney));
        vo.setFinishHongBao(banLiShopOrderService.countByUidAndState(uid, list));
        UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
        if (extra !=null && (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime())) {
            vo.setLimitTeam(Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_old_user")));
        } else {
            vo.setLimitTeam(Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_new_user")));
        }
        vo.setLimitHongBao(Long.parseLong(userVipConfigService.getValueByKey("require_shop_buy")));
        vo.setLimitMoney(new BigDecimal(userVipConfigService.getValueByKey("require_fan_money")));
        vo.setLimitgoldCoin(new BigDecimal(userVipConfigService.getValueByKey("require_gold_coin")));
        out.print(JsonUtil.loadTrueResult(vo));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java
@@ -28,6 +28,7 @@
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserLotteryRecordService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
@@ -76,6 +77,8 @@
    @Resource
    private UserLotteryRecordService userLotteryRecordService;
    
    @Resource
    private UserVIPInfoService userVIPInfoService;
    /**
     * 用户券列表查询
@@ -185,12 +188,15 @@
     */
    @RequestMapping(value = "getOrderCouponList", method = RequestMethod.POST)
    public void getOrderCouponList(AcceptData acceptData, Long uid, String orderNo, PrintWriter out) {
        if (uid == null || StringUtil.isNullOrEmpty(orderNo)) {
            out.print(JsonUtil.loadFalseResult("传递参数信息不完整"));
            return;
        }
        
        if (userVIPInfoService.isVIP(uid)) {
            out.print(JsonUtil.loadFalseResult("超级会员不可使用奖励券"));
            return;
        }
        
        List<CommonOrder> listOrder = commonOrderService.getByOrderNo(uid, orderNo);
        if (listOrder == null || listOrder.size() == 0) {
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java
New file
@@ -0,0 +1,334 @@
package com.yeshi.fanli.controller.client.v2;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.DateUtil;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.exception.order.CommonOrderException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.account.UserUtil;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.order.OrderCountVO;
import com.yeshi.fanli.vo.user.UserInfoExtraVO;
import com.yeshi.fanli.vo.user.UserSettingsVO;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("api/v2/user/order")
public class UserOrderControllerV2 {
    @Resource
    private ConfigService configService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private CommonOrderService commonOrderService;
    @Resource
    private HongBaoV2CountService hongBaoV2CountService;
    @Resource
    private RedisManager redisManager;
    @Resource
    private UserCustomSettingsService userCustomSettingsService;
    /**
     * 订单列表
     *
     * @param acceptData
     * @param page
     * @param uid
     * @param state
     *            状态:0全部 1-未到账 2-已到账 3-已失效 4已收货
     * @param type
     *            类型:1-返利订单 2-分享订单 3-邀请订单
     * @param orderState
     *            1有效订单 2 维权订单 3失效订单
     * @param orderNo
     *            订单号
     * @param startTime
     *            起始时间
     * @param endTime
     *            结束时间
     * @param slotTime
     *            时间段:1-最近三天 2-最近七天 3最近半月 4本月 5近三月 6近半年
     * @param dateType
     *            1-今日 2-昨天 3-本月 4-上个月 |
     * @param needCount
     * @param out
     */
    @RequestMapping(value = "getOrderList", method = RequestMethod.POST)
    public void getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, String type,
            Integer orderState, String orderNo,    String startTime, String endTime, Integer slotTime,
            Integer dateType, Integer goodsType, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        // 转换状态
        if (state != null) {
            if (state == 0) {
                state = null; // 所有
            } else if (state == 4) {
                state = null;
                orderState = 4; // 已收货
            } else if (state == 5) {
                state = null;
                orderState = 2; // 已维权
            }
        }
        if (state != null && orderState != null && (orderState == 2 || orderState == 3)) {
            state = null;
        }
        // 订单类型
        Integer orderType = null;
        if (StringUtil.isNullOrEmpty(type)) {
            orderType = null;
        } else if ("0".equalsIgnoreCase(type)){
            orderType = Integer.parseInt(type);
        }
        // 筛选时间
        if (slotTime != null) {
            SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
            try {
                endTime = sd.format(new Date());
                startTime = convertDate(slotTime, endTime);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (endTime != null && endTime.trim().length() > 0) {
            endTime += " 23:59:59";
        }
        try {
            // 筛选结果顶部统计
            String validMoney = "0.00";
            String invalidMoney = "0.00";
            if (dateType != null) {
                BigDecimal predictMoney = hongBaoV2CountService.getRewardMoneyByDate(uid, dateType, orderType, 1);
                if (predictMoney != null)
                    validMoney = predictMoney.setScale(2, BigDecimal.ROUND_DOWN).toString();
                BigDecimal postSaleMoney = hongBaoV2CountService.getRewardMoneyByDate(uid, dateType, orderType, 2);
                if (postSaleMoney != null)
                    invalidMoney = postSaleMoney.setScale(2, BigDecimal.ROUND_DOWN).toString();
                if (dateType == 4)
                    dateType = 5; // 新版查询本月到账
            }
            // 查询列表
            List<CommonOrderVO> list = commonOrderService.getOrderByUid(acceptData, page, uid, state, orderType, orderState,
                    orderNo, startTime, endTime, dateType, goodsType);
            // 统计总数
            long count = commonOrderService.countGroupOrderNoByUid(uid, state, orderType, orderState, orderNo, startTime,
                    endTime, dateType, goodsType);
            // 判断是否需要显示订单找回提示   8秒内请求3次触发
            String orderFindUrl = null;
            if (state ==null && page == 1) {
                if (redisManager.frequencyLimit("orderlist-" + acceptData.getDevice(), 8, 4)||count==0L) {
                    orderFindUrl = configService.get("order_find_notify_url");
                }
            }
            JSONObject data = new JSONObject();
            data.put("count", count);
            data.put("result_list", JsonUtil.getApiCommonGson().toJson(list));
            data.put("helpUrl", configService.get("order_list_help"));
            data.put("validMoney", "¥" + validMoney);
            data.put("invalidMoney", "¥" + invalidMoney);
            data.put("findOrderHelpUrl", orderFindUrl);
            out.print(JsonUtil.loadTrueResult(data));
        } catch (CommonOrderException e) {
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult(1, "查询失败"));
            LogHelper.errorDetailInfo(e);
        }
    }
    /**
     * 时间转换
     *
     * @param slotTime
     * @param startTime
     * @return
     * @throws Exception
     */
    private String convertDate(Integer slotTime, String endTime) throws Exception {
        String startTime = null;
        switch (slotTime) {
        case 1: // 最近三天
            startTime = DateUtil.reduceDay(2, endTime);
            break;
        case 2: // 最近七天
            startTime = DateUtil.reduceDay(6, endTime);
            break;
        case 3: // 最近15天 (半月)
            startTime = DateUtil.reduceDay(14, endTime);
            break;
        case 4: // 最近三十天 (本月)
            startTime = DateUtil.reduceDay(29, endTime);
            break;
        case 5: // 最近九十天(近三月)
            startTime = DateUtil.reduceDay(3 * 30 - 1, endTime);
            break;
        case 6: // 最近一百八十天(近半年)
            startTime = DateUtil.reduceDay(6 * 30 - 1, endTime);
            break;
        default:
            break;
        }
        return startTime;
    }
    /**
     * 用户订单统计
     *
     * @param acceptData
     * @param uid
     *            用户id
     * @param out
     */
    @RequestMapping(value = "getOrderCount", method = RequestMethod.POST)
    public void getOrderCount(AcceptData acceptData, Long uid, Integer type, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "请求参数不正确"));
            return;
        }
        try {
            UserInfo user = userInfoService.selectByPKey(uid);
            if (user == null) {
                out.print(JsonUtil.loadFalseResult(1, "用户不存在"));
                return;
            }
            UserInfo userInfo = UserUtil.filterForClientUser(user);
            UserInfoExtraVO userInfoExtra = userInfoExtraService.getInfoExtraVOByUid(user.getId());
            if (userInfoExtra != null && userInfoExtra.getUserRank() != null) {
                userInfo.setRankIcon(userInfoExtra.getUserRank().getIcon());
                userInfo.setRankNamePicture(userInfoExtra.getUserRank().getPicture());
            }
            JSONObject data = new JSONObject();
            data.put("userInfo", userInfo);
            if (type == null || type == 0) {
                OrderCountVO total = commonOrderService.getOrderCount(uid, null, type);
                data.put("total", total.getSelf() + total.getShared() + total.getInvite());
                data.put("self", total.getSelf());
                data.put("shared", total.getShared());
                data.put("invite", total.getInvite());
            } else {
                data.put("total", 0);
                data.put("self", 0);
                data.put("shared", 0);
                data.put("invite", 0);
            }
            // 今天
            OrderCountVO today = commonOrderService.getOrderCount(uid, 1, type);
            today.setTotal(today.getSelf() + today.getShared() + today.getInvite());
            // 昨天
            OrderCountVO yesterday = commonOrderService.getOrderCount(uid, 2, type);
            yesterday.setTotal(yesterday.getSelf() + yesterday.getShared() + yesterday.getInvite());
            // 本月
            OrderCountVO thisMonth = commonOrderService.getOrderCount(uid, 3, type);
            thisMonth.setTotal(thisMonth.getSelf() + thisMonth.getShared() + thisMonth.getInvite());
            // 上月
            OrderCountVO lastMonth = commonOrderService.getOrderCount(uid, 4, type);
            lastMonth.setTotal(lastMonth.getSelf() + lastMonth.getShared() + lastMonth.getInvite());
            data.put("today", today);
            data.put("yesterday", yesterday);
            data.put("thisMonth", thisMonth);
            data.put("lastMonth", lastMonth);
            out.print(JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult(1, "获取信息失败"));
            e.printStackTrace();
        }
    }
    /**
     * 统计奖金
     * @param acceptData
     * @param uid
     * @param dateType  1-今日 2-昨天 3-本月 4-上个月
     * @param out
     */
    @RequestMapping(value = "getBonusCount", method = RequestMethod.POST)
    public void getBonusCount(AcceptData acceptData, Long uid, Integer dateType, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        boolean show = false;
        UserSettingsVO settings = null;
        try {
            settings = userCustomSettingsService.getMySettings(uid);
        } catch (Exception e) {
        }
        // 验证是否显示模块
        if (settings != null && settings.getNoBonusCount()!= null) {
            if(settings.getNoBonusCount() == 1) {
                show = false;
            } else if(settings.getNoBonusCount() == 0) {
                show = true;
            }
        } else {
            show = hongBaoV2CountService.getHongBaoCount(uid, null) > 0;
        }
        BigDecimal selfMoney = hongBaoV2CountService.getRewardMoneyByDate(uid, dateType, 1, null);
        BigDecimal shareMoney = hongBaoV2CountService.getRewardMoneyByDate(uid, dateType, 2, null);
        BigDecimal inviteMoney = hongBaoV2CountService.getRewardMoneyByDate(uid, dateType, 3, null);
        JSONObject data = new JSONObject();
        data.put("show", show);
        data.put("selfMoney", selfMoney.setScale(2,BigDecimal.ROUND_DOWN).toString());
        data.put("shareMoney", shareMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
        data.put("inviteMoney", inviteMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
        out.print(JsonUtil.loadTrueResult(data));
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java
@@ -101,6 +101,10 @@
    // 累计提成订单数量(包含无效订单)
    int getTotalTiChengCount(Long uid);
    // 累计提成红包数量(包含无效)
    long getHongBaoCount(@Param("uid") Long uid, @Param("type") Integer type);
    /**
     * 统计未失效订单数量
@@ -203,7 +207,19 @@
     * @param list 类型
     * @return
     */
    long countValidOrderTeamUserByUid(@Param("uid") Long uid, @Param("date") String date,
    long countValidOrderTeamUserByUid(@Param("uid") Long uid, @Param("time") Long time,
            @Param("payment") BigDecimal payment);
    /**
     * 查询用户个类型预计奖金
     * @param uid
     * @param dateType 日期类型
     * @param hbType   红包类型
     * @return
     */
    BigDecimal getRewardMoneyByDate(@Param("uid") Long uid, @Param("day")Integer dateType,
            @Param("type") Integer hbType, @Param("orderState") Integer orderState);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java
@@ -206,6 +206,7 @@
     * @param count
     * @return
     */
    List<UserInfo> getAutoExtractUser(@Param("start") int start, @Param("count") int count,
            @Param("money") BigDecimal money, @Param("beganDate") String beganDate, @Param("endDate") String endDate);
@@ -219,4 +220,12 @@
    List<UserInfo> listByType(@Param("type")int type,@Param("start") long start, @Param("count")int count);
    long countByType(int type);
    /**
     * 查询满足自动提现用户
     * @param start
     * @param count
     * @return
     */
    List<UserInfo> getAutoExtractUserTo1212(@Param("start") int start, @Param("count") int count);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandInfoMapper.java
@@ -5,7 +5,6 @@
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.brand.BrandClass;
import com.yeshi.fanli.entity.brand.BrandInfo;
import com.yeshi.fanli.vo.brand.BrandInfoVO;
@@ -19,10 +18,10 @@
     * @param state
     * @return
     */
    List<BrandInfo> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key,
            @Param("cid")Long cid, @Param("state") Integer state);
    List<BrandInfo> listQuery(@Param("start") long start, @Param("count") int count, @Param("keys") List<String> keys,
            @Param("cid")Long cid, @Param("state") Integer state,  @Param("showState")Integer showState);
    
    long countQuery(@Param("key") String key, @Param("cid") Long cid, @Param("state") Integer state);
    long countQuery(@Param("keys") List<String> keys, @Param("cid") Long cid, @Param("state") Integer state,  @Param("showState")Integer showState);
    
     
    int deleteBatchByPrimaryKey(List<Long> list);
@@ -76,5 +75,7 @@
     * @return
     */
    long countValidByCidToApp(@Param("cid") Long cid);
    BrandInfo selectByUniqueName(@Param("name") String name, @Param("cid") Long cid, @Param("id") Long id);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/money/UserMoneyDetailMapper.java
@@ -21,7 +21,7 @@
     * @return
     */
    List<UserMoneyDetail> selectByUidWithIndexId(@Param("uid") Long uid, @Param("id") Long id,
            @Param("count") int count);
            @Param("count") int count, @Param("type") Integer type);
    /**
     * 获取用户总共有多少记录数据
@@ -29,7 +29,7 @@
     * @param uid
     * @return
     */
    Long selectCountByUid(@Param("uid") Long uid);
    Long selectCountByUid(@Param("uid") Long uid, @Param("type") Integer type);
    /**
     * 按最大的创建时间和用户ID检索列表
@@ -39,7 +39,7 @@
     * @return
     */
    List<UserMoneyDetail> selectByMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date,
            @Param("count") int count);
            @Param("count") int count, @Param("type") Integer type);
    /**
     * 按最大的创建时间和用户ID检索数量
@@ -48,7 +48,7 @@
     * @param date
     * @return
     */
    Long selectCountByUidAndMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date);
    Long selectCountByUidAndMaxCreateTime(@Param("uid") Long uid, @Param("date") Date date, @Param("type") Integer type);
    /**
     * 按用户ID和最大时间检索月份的数量
@@ -57,7 +57,7 @@
     * @param maxDate
     * @return
     */
    int selectMonthCountByUid(@Param("uid") Long uid, @Param("date") Date maxDate);
    int selectMonthCountByUid(@Param("uid") Long uid, @Param("date") Date maxDate, @Param("type") Integer type);
    /**
     * 统计某个月份的收入与支出
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java
@@ -10,6 +10,7 @@
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.order.OrderCountVO;
public interface CommonOrderMapper extends BaseMapper<CommonOrder> {
@@ -79,6 +80,14 @@
    Map<String, BigDecimal> countHistoryOrder(@Param("uid") Long uid, @Param("day") Integer day,
            @Param("source") Integer source);
    /**
     * 统计有效订单数量
     * @param uid
     * @return
     */
    OrderCountVO getOrderCount(@Param("uid") Long uid, @Param("day")Integer day, @Param("source") Integer source);
    /**
     * 昨日总订单-根据红包类型 自购 邀请 分享
     * 
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/vip/UserVipConfigMapper.java
New file
@@ -0,0 +1,38 @@
package com.yeshi.fanli.dao.mybatis.user.vip;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.user.vip.UserVipConfig;
public interface UserVipConfigMapper extends BaseMapper<UserVipConfig> {
    /**
     * 根据key值查询
     * @param key
     * @return
     */
    UserVipConfig getByKey(@Param("key") String key,@Param("startTime")Date startTime);
    /**
     * 列表查询
     *
     * @param key
     * @param state
     * @param count
     * @return
     */
    List<UserVipConfig> query(@Param("start") long start,@Param("count") int count, @Param("key") String key);
    /**
     * 计数
     *
     * @param key
     * @param state
     * @return
     */
    long count(@Param("key") String key);
}
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandInfo.java
@@ -59,7 +59,10 @@
    private Integer shopTotal; // 拥有商品数量
    @Column(name = "bf_weight")
    private Double weight; // 权重:值越大越前
    private Double weight; // 排序:值越大越前
    @Column(name = "bf_order")
    private Integer order;// 排序:值越小越前
    @Column(name = "bf_state")
    private Integer state;// 状态:0停用 1启用
@@ -204,4 +207,12 @@
    public void setShopTotal(Integer shopTotal) {
        this.shopTotal = shopTotal;
    }
    public Integer getOrder() {
        return order;
    }
    public void setOrder(Integer order) {
        this.order = order;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/UserVipConfig.java
New file
@@ -0,0 +1,114 @@
package com.yeshi.fanli.entity.bus.user.vip;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 配置信息
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_vip_config")
public class UserVipConfig {
    @Column(name = "uvc_id")
    private Long id;
    @Column(name = "uvc_name")
    private String name; // 名称
    @Column(name = "uvc_key")
    private String key; // 唯一值
    @Column(name = "uvc_value")
    private String value; // 值
    @Column(name = "uvc_remark")
    private String remark; // 备注
    @Column(name = "uvc_start_time")
    private Date startTime; // 开始使用时间
    @Column(name = "uvc_create_time")
    private Date createTime;
    @Column(name = "uvc_update_time")
    private Date updateTime;
    private String validTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getValidTime() {
        return validTime;
    }
    public void setValidTime(String validTime) {
        this.validTime = validTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/user/vip/UserVipConfigException.java
New file
@@ -0,0 +1,23 @@
package com.yeshi.fanli.exception.user.vip;
import com.yeshi.fanli.exception.BaseException;
/**
 * 用户VIP信息异常
 * @author Administrator
 *
 */
public class UserVipConfigException extends BaseException {
    private static final long serialVersionUID = 1L;
    public UserVipConfigException(int code, String msg) {
        super(code, msg);
    }
    public UserVipConfigException() {
        super();
    }
}
fanli/src/main/java/com/yeshi/fanli/job/ShameUserInviteCodePublishJOB.java
@@ -32,9 +32,11 @@
    // 7点到23点每10分钟执行一次
    @Scheduled(cron = "0 0/10 7-23 * * ? ")
    public void publish() {
        // if (!Constant.IS_TASK)
        // return;
        long time = System.currentTimeMillis();
        int day = TimeUtil.getDayDifferenceCount(new Date(),
                new Date(TimeUtil.convertToTimeTemp("2019-11-28", "yyyy-MM-dd")));
        int day = TimeUtil.getDayDifferenceCount(new Date(TimeUtil.convertToTimeTemp("2019-11-28", "yyyy-MM-dd")),
                new Date());
        int count = (day + 1) * 3;
        if (count > 33)
            count = 33;
@@ -71,7 +73,6 @@
                codePublishRecordService.publishInviteCode(userList.get(0).getId());
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
@@ -717,6 +717,19 @@
        AND u.`wx_open_id` NOT LIKE 'o_b9%'
        LIMIT #{start},#{count}
    </select>
    <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
        LEFT JOIN `yeshi_ec_user_info_extra` t ON t.`uie_uid` = h.hb_uid
        LEFT JOIN  `yeshi_ec_user` u ON u.`id` = t.`uie_uid`
        WHERE <![CDATA[ t.uie_active_time < '2019-06-19']]> AND (t.`uie_mark` IS NULL OR t.`uie_mark` = '')
            AND u.`state` = 0 AND u.`my_hongBao`<![CDATA[> 1]]>
            AND u.`wx_open_id` IS NOT NULL AND <![CDATA[LENGTH(TRIM(u.`wx_open_id`)) > 0]]>
            AND u.`wx_open_id` NOT LIKE 'o_b9%'
        LIMIT #{start},#{count}
    </select>
    <select id="listByType" resultMap="BaseResultMap">
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandInfoMapper.xml
@@ -15,16 +15,16 @@
    <result column="bf_goods_total" property="goodsTotal" jdbcType="INTEGER"/>
    <result column="bf_shop_total" property="shopTotal" jdbcType="INTEGER"/>
    <result column="bf_weight" property="weight" jdbcType="DOUBLE"/>
    <result column="bf_order" property="order" jdbcType="INTEGER"/>
    <result column="bf_state" property="state" jdbcType="INTEGER"/>
    <result column="bf_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="bf_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association column="bf_cid" property="brandClass" javaType="com.yeshi.fanli.entity.brand.BrandClass">
        <id column="bf_cid" property="id" jdbcType="BIGINT" />    
    </association>
  </resultMap>
  
  <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.brand.BrandInfoVO">
   <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.brand.BrandInfoVO">
    <id column="bf_id" property="id" jdbcType="BIGINT"/>
    <result column="bf_name" property="name" jdbcType="VARCHAR"/>
    <result column="bf_icon" property="icon" jdbcType="VARCHAR"/>
@@ -37,6 +37,7 @@
    <result column="bf_goods_total" property="goodsTotal" jdbcType="INTEGER"/>
    <result column="bf_shop_total" property="shopTotal" jdbcType="INTEGER"/>
    <result column="bf_weight" property="weight" jdbcType="DOUBLE"/>
    <result column="bf_order" property="order" jdbcType="INTEGER"/>
    <result column="bf_state" property="state" jdbcType="INTEGER"/>
    <result column="bf_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="bf_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
@@ -46,14 +47,12 @@
    </association>
  </resultMap>
  
  <sql id="Base_Column_List">bf_id,bf_cid,bf_name,bf_icon,bf_shop_key,bf_search_key,bf_shop_key_jd,bf_search_key_jd,bf_shop_key_pdd,bf_search_key_pdd,bf_goods_total,bf_shop_total,bf_weight,bf_state,bf_create_time,bf_update_time</sql>
  <sql id="Base_Column_List">bf_id,bf_cid,bf_name,bf_icon,bf_shop_key,bf_search_key,bf_shop_key_jd,bf_search_key_jd,bf_shop_key_pdd,bf_search_key_pdd,bf_goods_total,bf_shop_total,bf_weight,bf_order,bf_state,bf_create_time,bf_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_brand_info where bf_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_brand_info where bf_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info (bf_id,bf_cid,bf_name,bf_icon,bf_shop_key,bf_search_key,bf_shop_key_jd,bf_search_key_jd,bf_shop_key_pdd,bf_search_key_pdd,bf_goods_total,bf_shop_total,bf_weight,bf_state,bf_create_time,bf_update_time) values (#{id,jdbcType=BIGINT},#{brandClass.id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{shopKey,jdbcType=VARCHAR},#{searchKey,jdbcType=VARCHAR},#{shopKeyJD,jdbcType=VARCHAR},#{searchKeyJD,jdbcType=VARCHAR},#{shopKeyPDD,jdbcType=VARCHAR},#{searchKeyPDD,jdbcType=VARCHAR},#{goodsTotal,jdbcType=INTEGER},#{shopTotal,jdbcType=INTEGER},#{weight,jdbcType=DOUBLE},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info (bf_id,bf_cid,bf_name,bf_icon,bf_shop_key,bf_search_key,bf_shop_key_jd,bf_search_key_jd,bf_shop_key_pdd,bf_search_key_pdd,bf_goods_total,bf_shop_total,bf_weight,bf_order,bf_state,bf_create_time,bf_update_time) values (#{id,jdbcType=BIGINT},#{brandClass.id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{shopKey,jdbcType=VARCHAR},#{searchKey,jdbcType=VARCHAR},#{shopKeyJD,jdbcType=VARCHAR},#{searchKeyJD,jdbcType=VARCHAR},#{shopKeyPDD,jdbcType=VARCHAR},#{searchKeyPDD,jdbcType=VARCHAR},#{goodsTotal,jdbcType=INTEGER},#{shopTotal,jdbcType=INTEGER},#{weight,jdbcType=DOUBLE},#{order,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">bf_id,</if>
@@ -69,6 +68,7 @@
      <if test="goodsTotal != null">bf_goods_total,</if>
      <if test="shopTotal != null">bf_shop_total,</if>
      <if test="weight != null">bf_weight,</if>
      <if test="order != null">bf_order,</if>
      <if test="state != null">bf_state,</if>
      <if test="createTime != null">bf_create_time,</if>
      <if test="updateTime != null">bf_update_time,</if>
@@ -87,12 +87,13 @@
      <if test="goodsTotal != null">#{goodsTotal,jdbcType=INTEGER},</if>
      <if test="shopTotal != null">#{shopTotal,jdbcType=INTEGER},</if>
      <if test="weight != null">#{weight,jdbcType=DOUBLE},</if>
      <if test="order != null">#{order,jdbcType=INTEGER},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info set bf_cid = #{brandClass.id,jdbcType=BIGINT},bf_name = #{name,jdbcType=VARCHAR},bf_icon = #{icon,jdbcType=VARCHAR},bf_shop_key = #{shopKey,jdbcType=VARCHAR},bf_search_key = #{searchKey,jdbcType=VARCHAR},bf_shop_key_jd = #{shopKeyJD,jdbcType=VARCHAR},bf_search_key_jd = #{searchKeyJD,jdbcType=VARCHAR},bf_shop_key_pdd = #{shopKeyPDD,jdbcType=VARCHAR},bf_search_key_pdd = #{searchKeyPDD,jdbcType=VARCHAR},bf_goods_total = #{goodsTotal,jdbcType=INTEGER},bf_shop_total = #{shopTotal,jdbcType=INTEGER},bf_weight = #{weight,jdbcType=DOUBLE},bf_state = #{state,jdbcType=INTEGER},bf_create_time = #{createTime,jdbcType=TIMESTAMP},bf_update_time = #{updateTime,jdbcType=TIMESTAMP} where bf_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info set bf_cid = #{brandClass.id,jdbcType=BIGINT},bf_name = #{name,jdbcType=VARCHAR},bf_icon = #{icon,jdbcType=VARCHAR},bf_shop_key = #{shopKey,jdbcType=VARCHAR},bf_search_key = #{searchKey,jdbcType=VARCHAR},bf_shop_key_jd = #{shopKeyJD,jdbcType=VARCHAR},bf_search_key_jd = #{searchKeyJD,jdbcType=VARCHAR},bf_shop_key_pdd = #{shopKeyPDD,jdbcType=VARCHAR},bf_search_key_pdd = #{searchKeyPDD,jdbcType=VARCHAR},bf_goods_total = #{goodsTotal,jdbcType=INTEGER},bf_shop_total = #{shopTotal,jdbcType=INTEGER},bf_weight = #{weight,jdbcType=DOUBLE},bf_order = #{order,jdbcType=INTEGER},bf_state = #{state,jdbcType=INTEGER},bf_create_time = #{createTime,jdbcType=TIMESTAMP},bf_update_time = #{updateTime,jdbcType=TIMESTAMP} where bf_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info
    <set>
      <if test="brandClass != null">bf_cid=#{brandClass.id,jdbcType=BIGINT},</if>
@@ -107,6 +108,7 @@
      <if test="goodsTotal != null">bf_goods_total=#{goodsTotal,jdbcType=INTEGER},</if>
      <if test="shopTotal != null">bf_shop_total=#{shopTotal,jdbcType=INTEGER},</if>
      <if test="weight != null">bf_weight=#{weight,jdbcType=DOUBLE},</if>
      <if test="order != null">bf_order=#{order,jdbcType=INTEGER},</if>
      <if test="state != null">bf_state=#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">bf_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">bf_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
@@ -123,7 +125,7 @@
      SELECT * FROM yeshi_ec_brand_info d
    WHERE d.`bf_state` = 1 AND d.bf_goods_total <![CDATA[>=]]> 3  AND d.bf_shop_total <![CDATA[>]]> 0
         <if test="cid != null">AND d.`bf_cid` = #{cid} </if>
    ORDER BY d.`bf_weight`
    ORDER BY d.`bf_weight` DESC
    LIMIT ${start},${count}
  </select>
  
@@ -137,7 +139,7 @@
      SELECT * FROM yeshi_ec_brand_info d
    WHERE d.`bf_state` = 1 AND d.`bf_cid` = #{cid}  AND d.bf_goods_total <![CDATA[>=]]>3
          AND d.bf_shop_total <![CDATA[>]]> 0
    ORDER BY d.`bf_weight`
    ORDER BY d.`bf_order`
  </select>
  
  <select id="countValidByCid" resultType="Long">
@@ -161,27 +163,45 @@
  <select id="listQuery" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_brand_info
      WHERE 1=1 
          <if test="key != null and key !='' ">
              AND (bf_name LIKE '%${key}%' or bf_search_key LIKE '%${key}%')
          <if test="keys != null">
              AND
              <foreach collection="keys" item="key" open="(" separator="OR" close=")">
                  bf_name LIKE '%${key}%'
              </foreach>
          </if>
          <if test="state != null">
               AND bf_state = #{state}
          </if>
          <if test="showState == 0">
               AND bf_goods_total <![CDATA[<]]> 3  AND bf_shop_total <![CDATA[<=]]> 0
          </if>
          <if test="showState == 1">
              AND bf_state = 1 AND bf_goods_total <![CDATA[>=]]> 3  AND bf_shop_total <![CDATA[>]]> 0
          </if>
          <if test="cid != null">
               AND bf_cid = #{cid}
          </if>
      ORDER BY bf_weight
      ORDER BY bf_order
      LIMIT ${start},${count}
  </select>
  
  <select id="countQuery" resultType="java.lang.Long">
      SELECT IFNULL(COUNT(bf_id),0) FROM yeshi_ec_brand_info
      WHERE 1=1 
          <if test="key != null and key !='' ">
              AND (bf_name LIKE '%${key}%' or bf_search_key LIKE '%${key}%')
          <if test="keys != null">
              AND
              <foreach collection="keys" item="key" open="(" separator="OR" close=")">
                  bf_name LIKE '%${key}%'
              </foreach>
          </if>
          <if test="state != null">
               AND bf_state = #{state}
          </if>
          <if test="showState == 0">
              AND bf_goods_total <![CDATA[<]]> 3  AND bf_shop_total <![CDATA[<=]]> 0
          </if>
          <if test="showState == 1">
              AND bf_state = 1 AND bf_goods_total <![CDATA[>=]]> 3  AND bf_shop_total <![CDATA[>]]> 0
          </if>
          <if test="cid != null">
               AND bf_cid = #{cid}
@@ -192,14 +212,24 @@
        SELECT * FROM yeshi_ec_brand_info
        WHERE bf_cid = #{cid}
        <if test="type == -1">
            AND bf_weight <![CDATA[<]]> #{order}
            ORDER BY bf_weight desc
            AND bf_order <![CDATA[<]]> #{order}
            ORDER BY bf_order desc
        </if>
        
        <if test="type == 1">
            AND bf_weight <![CDATA[>]]> #{order}
            ORDER BY bf_weight
            AND bf_order <![CDATA[>]]> #{order}
            ORDER BY bf_order
        </if>
        LIMIT 1
   </select>
  <select id="selectByUniqueName" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_brand_info
      WHERE bf_name = #{name} AND bf_cid = #{cid}
          <if test="id != null">
               AND bf_id <![CDATA[<>]]> #{id}
          </if>
      LIMIT 1
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -196,6 +196,21 @@
        OR h.`hb_type`=6
        OR h.`hb_type`=7)
    </select>
    <select id="getHongBaoCount" resultType="Long">
        SELECT IFNULL(count(v2.`hb_id`),0) FROM `yeshi_ec_hongbao_v2` v
        WHERE v.`hb_uid`=#{uid}
        <if test="type == 1"> <!-- 自购订单 -->
            AND (v.hb_type =1 or v.hb_type =2)
        </if>
        <if test="type == 2"> <!-- 分享订单 -->
            AND v.`hb_type` = 20
        </if>
        <if test="type == 3"> <!-- 邀请订单 -->
            AND (v.`hb_type` = 5 OR v.`hb_type` = 6 OR v.`hb_type` = 7 OR v.`hb_type` = 21 OR v.`hb_type` = 22)
        </if>
    </select>
    <select id="countValidNumberByUid" resultType="java.lang.Long">
        <!--统计有效订单数量 -->
@@ -388,13 +403,62 @@
    </select>
        
    <select id="countValidOrderTeamUserByUid" resultType="Long">
        SELECT IFNULL(COUNT(*),0) FROM (SELECT DISTINCT co.`co_uid` FROM `yeshi_ec_common_order` co
    SELECT IFNULL(COUNT(*),0) FROM
    (
        SELECT DISTINCT co.`co_uid` FROM `yeshi_ec_common_order` co
        LEFT JOIN `yeshi_ec_hongbao_order` ho  ON co.`co_id` = ho.`ho_order_id`
        LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.`hb_pid` = ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.`hb_pid` = ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_hongbao_v2 t2 ON t2.`hb_id` = v2.`hb_pid`
        WHERE v2.`hb_uid` = #{uid} AND co.`co_payment` <![CDATA[>=]]> #{payment} AND t2.`hb_state` = 3
            AND v2.`hb_create_time` > #{date}
            AND (t2.`hb_type` = 1 OR t2.`hb_type` = 20))A
        WHERE v2.`hb_uid` = ${uid} AND co.`co_payment`<![CDATA[>=]]> #{payment} AND t2.`hb_state` = 3
        AND (t2.`hb_type` = 1 OR t2.`hb_type` = 20)
        AND t2.`hb_uid` IN (SELECT tr.`worker_id` FROM `yeshi_ec_threesale` tr
                            WHERE tr.`state` = 1 AND tr.`boss_id` = ${uid} AND tr.`succeedTime` <![CDATA[>=]]> #{time})
     )A
    </select>
    <select id="getRewardMoneyByDate" resultType="BigDecimal">
        SELECT COALESCE(SUM(v2.`hb_money`),0)AS totalmoney FROM (
            SELECT * FROM yeshi_ec_hongbao_v2 v
            WHERE v.hb_state <![CDATA[<>]]> 4 AND v.`hb_uid`= #{uid}
            <if test="type == 1"> <!-- 自购订单 -->
                AND (v.hb_type =1 or v.hb_type =2)
            </if>
            <if test="type == 2"> <!-- 分享订单 -->
                AND v.`hb_type` = 20
            </if>
            <if test="type == 3"> <!-- 邀请订单 -->
                AND (v.`hb_type` = 5 OR v.`hb_type` = 6 OR v.`hb_type` = 7 OR v.`hb_type` = 21 OR v.`hb_type` = 22)
            </if>
            <if test="type == 2 and day == 4"> <!-- 本月月将要到账 -->
                AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v.`hb_pre_get_time`, '%Y%m')) = 1
            </if>
            <if test="type == 3 and day == 4"> <!-- 本月将要到账 -->
                AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v.`hb_pre_get_time`, '%Y%m')) = 1
            </if>
        )v2
        LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id`
        WHERE co.`co_state`<![CDATA[<>]]> 4
        <if test="day == 1"> <!-- 今天产生-->
            AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW())
        </if>
        <if test="day == 2"> <!-- 昨天产生-->
            AND TO_DAYS(NOW()) - TO_DAYS(co.`co_third_create_time`) = 1
        </if>
        <if test="day == 3"> <!-- 本月产生 -->
            AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        <if test="day == 4 and type == 1"> <!-- 上月产生自购 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(co.`co_third_create_time`, '%Y%m')) = 1
        </if>
        <if test="orderState ==  1"> <!-- 有效订单: 整个订单有效 -->
            AND <![CDATA[co.`co_state` <> 3]]>
            AND (co.co_state_whole_order = 1 or co.co_state_whole_order = 2)
        </if>
        <if test="orderState ==  2"> <!-- 维权订单 -->
            AND co.co_state = 3
        </if>
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/money/UserMoneyDetailMapper.xml
@@ -47,32 +47,39 @@
            <=
        ]]>
        (SELECT d.`umd_createtime` FROM yeshi_ec_user_money_detail d WHERE
        d.`umd_id`=#{id}) and d.umd_uid=#{uid}  and d.umd_show=1 order by d.`umd_createtime`
        d.`umd_id`=#{id}) and d.umd_uid=#{uid}  and d.umd_show=1
        <if test="type == 1">and d.umd_money<![CDATA[>]]>0</if>
        <if test="type == 2">and d.umd_money<![CDATA[<=]]>0</if>
        order by d.`umd_createtime`
        desc,d.umd_id desc limit #{count}
    </select>
    <select id="selectCountByUid" resultType="java.lang.Long"
        parameterType="java.lang.Long">SELECT count(umd_id) FROM yeshi_ec_user_money_detail
        where umd_uid=#{uid} and umd_show=1 </select>
        where umd_uid=#{uid} and umd_show=1
        <if test="type == 1">and umd_money<![CDATA[>]]>0</if>
        <if test="type == 2">and umd_money<![CDATA[<=]]>0</if>
    </select>
    <select id="selectByMaxCreateTime" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_user_money_detail d WHERE d.umd_uid=#{uid} and d.umd_show=1 and
        d.`umd_createtime`<![CDATA[
            <=
        ]]>
        #{date} order by d.`umd_createtime` desc,d.umd_id desc limit #{count}
        FROM yeshi_ec_user_money_detail d WHERE d.umd_uid=#{uid} and d.umd_show=1 and d.`umd_createtime`<![CDATA[<=]]>#{date}
        <if test="type == 1">and d.umd_money<![CDATA[>]]>0</if>
        <if test="type == 2">and d.umd_money<![CDATA[<=]]>0</if>
        order by d.`umd_createtime` desc,d.umd_id desc limit ${count}
    </select>
    <select id="selectCountByUidAndMaxCreateTime" resultType="java.lang.Long">SELECT
        count(umd_id) FROM yeshi_ec_user_money_detail where umd_uid=#{uid}  and umd_show=1  and
        `umd_createtime`<![CDATA[
            <=
        ]]>
        #{date}
        `umd_createtime`<![CDATA[<=]]>#{date}
        <if test="type == 1">and umd_money<![CDATA[>]]>0</if>
        <if test="type == 2">and umd_money<![CDATA[<=]]>0</if>
    </select>
    <select id="selectMonthCountByUid" resultType="java.lang.Integer">SELECT
        COUNT(*) FROM (SELECT * FROM yeshi_ec_user_money_detail d WHERE
        d.`umd_uid`=#{uid} and d.umd_show=1  and d.`umd_createtime` <![CDATA[<=]]>
        #{date} group by DATE_FORMAT(d.`umd_createtime`,'%y-%m')) a
        #{date}
        <if test="type == 1">and d.umd_money<![CDATA[>]]>0</if>
        <if test="type == 2">and d.umd_money<![CDATA[<=]]>0</if>
        group by DATE_FORMAT(d.`umd_createtime`,'%y-%m')) a
    </select>
    <select id="selectMonthMoneyByUid" resultMap="UserMonthMoneyMap">
        <foreach collection="dateFormat" index="index" item="item"
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -159,6 +159,12 @@
            select="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.selectByPrimaryKey" />
    </resultMap>
    <resultMap id="OrderCountMap" type="com.yeshi.fanli.vo.order.OrderCountVO" >
        <result column="self" property="self" jdbcType="BIGINT" />
        <result column="shared" property="shared" jdbcType="BIGINT" />
        <result column="invite" property="invite" jdbcType="BIGINT" />
    </resultMap>
    <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id,co_state_desc
    </sql>
    
@@ -390,28 +396,28 @@
        </if>
        <if test="day != null and day == 3">
            <!-- 本月 -->
            AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') =
            DATE_FORMAT(CURDATE(),'%Y%m')
            AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        <if test="day != null and day == 4">
            <!-- 上月 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),
            DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),    DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1
        </if>
    </sql>
    <sql id="SELECT_PARAM_HONGBAO_TYPE">
        <if test="type != null and type == 1">
            <!-- 自购订单 -->
        <if test="type != null and type == 1"> <!-- 自购订单 -->
            AND (v2.hb_type =1 or v2.hb_type =2)
        </if>
        <if test="type != null and type == 2">
            <!-- 分享订单 -->
        <if test="type != null and type == 2"> <!-- 分享订单 -->
            AND v2.`hb_type` = 20
        </if>
        <if test="type != null and type == 3">
            <!-- 邀请订单 -->
            AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR
            v2.`hb_type` = 21 OR v2.`hb_type` = 22)
        <if test="type != null and type == 3"> <!-- 邀请订单 -->
            AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR v2.`hb_type` = 21 OR v2.`hb_type` = 22)
        </if>
        <if test="type == 2 and day == 5"> <!-- 本月月将要到账 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v2.`hb_pre_get_time`, '%Y%m')) = 1
        </if>
        <if test="type == 3 and day == 5"> <!-- 本月将要到账 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v2.`hb_pre_get_time`, '%Y%m')) = 1
        </if>
    </sql>
    <sql id="SELECT_PARAM_HONGBAO_STATE">
@@ -604,6 +610,53 @@
        GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A
    </select>
    <sql id="OrderCountQuery">
        WHERE co.`co_state_whole_order`<![CDATA[<>]]>3
        <if test="day == 1"> <!-- 今天 -->
            AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW())
        </if>
        <if test="day == 2"> <!-- 昨天 -->
            AND TO_DAYS(NOW()) - TO_DAYS(co.`co_third_create_time`) = 1
        </if>
        <if test="day == 3"> <!-- 本月 -->
            AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        <if test="day == 4"> <!-- 上月 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1
        </if>
        <!-- 订单来源 -->
        <if test="source != null and source != 0">AND co.co_source_type = #{source}</if>
    </sql>
    <select id="getOrderCount" resultMap="OrderCountMap">
        SELECT sum(self) as self,sum(shared) as shared,sum(invite) as invite from
        (
            SELECT IFNULL(COUNT(co_order_no),0)AS self,0 AS shared,0 AS invite FROM
                (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`= ${uid} AND v.`hb_type` = 1)v2
                LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)
                LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id`
                <include refid="OrderCountQuery"></include>
                GROUP BY co.`co_order_no`,co.`co_source_type`)A
            UNION ALL
            SELECT 0 AS self,IFNULL(COUNT(co_order_no),0)AS shared,0 AS invite FROM
                (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`= ${uid} AND v.`hb_type` = 20)v2
                LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)
                LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id`
                <include refid="OrderCountQuery"></include>
                GROUP BY co.`co_order_no`,co.`co_source_type`)A
            UNION ALL
            SELECT 0 AS self,0 AS shared,IFNULL(COUNT(co_order_no),0)AS invite FROM
                (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v
                     WHERE v.`hb_uid`= ${uid}
                     AND (v.`hb_type` = 5 OR v.`hb_type` = 6 OR v.`hb_type` = 7 OR v.`hb_type` = 21 OR v.`hb_type` = 22))v2
                LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)
                LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id`
                <include refid="OrderCountQuery"></include>
                GROUP BY co.`co_order_no`,co.`co_source_type`)A
        )B
    </select>
    <select id="countUserOrderToApp" resultType="Long">
            <!-- 有效订单 -->
fanli/src/main/java/com/yeshi/fanli/mapping/user/vip/UserVipConfigMapper.xml
New file
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.user.vip.UserVipConfigMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.vip.UserVipConfig">
    <id column="uvc_id" property="id" jdbcType="BIGINT"/>
    <result column="uvc_name" property="name" jdbcType="VARCHAR"/>
    <result column="uvc_key" property="key" jdbcType="VARCHAR"/>
    <result column="uvc_value" property="value" jdbcType="VARCHAR"/>
    <result column="uvc_remark" property="remark" jdbcType="VARCHAR"/>
    <result column="uvc_start_time" property="startTime" jdbcType="TIMESTAMP"/>
    <result column="uvc_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uvc_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">uvc_id,uvc_name,uvc_key,uvc_value,uvc_remark,uvc_start_time,uvc_create_time,uvc_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_vip_config where uvc_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_vip_config where uvc_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVipConfig" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_vip_config (uvc_id,uvc_name,uvc_key,uvc_value,uvc_remark,uvc_start_time,uvc_create_time,uvc_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVipConfig" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_vip_config
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">uvc_id,</if>
      <if test="name != null">uvc_name,</if>
      <if test="key != null">uvc_key,</if>
      <if test="value != null">uvc_value,</if>
      <if test="remark != null">uvc_remark,</if>
      <if test="startTime != null">uvc_start_time,</if>
      <if test="createTime != null">uvc_create_time,</if>
      <if test="updateTime != null">uvc_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="key != null">#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">#{value,jdbcType=VARCHAR},</if>
      <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
      <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVipConfig">update yeshi_ec_user_vip_config set uvc_name = #{name,jdbcType=VARCHAR},uvc_key = #{key,jdbcType=VARCHAR},uvc_value = #{value,jdbcType=VARCHAR},uvc_remark = #{remark,jdbcType=VARCHAR},uvc_start_time = #{startTime,jdbcType=TIMESTAMP},uvc_create_time = #{createTime,jdbcType=TIMESTAMP},uvc_update_time = #{updateTime,jdbcType=TIMESTAMP} where uvc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVipConfig">update yeshi_ec_user_vip_config
    <set>
      <if test="name != null">uvc_name=#{name,jdbcType=VARCHAR},</if>
      <if test="key != null">uvc_key=#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">uvc_value=#{value,jdbcType=VARCHAR},</if>
      <if test="remark != null">uvc_remark=#{remark,jdbcType=VARCHAR},</if>
      <if test="startTime != null">uvc_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">uvc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">uvc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where uvc_id = #{id,jdbcType=BIGINT}
  </update>
  <select id="getByKey" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_user_vip_config t
      WHERE t.`uvc_key` = #{key} and #{startTime} >= uvc_start_time
      ORDER BY uvc_start_time DESC
      LIMIT 1
  </select>
  <select id="query" resultMap="BaseResultMap">
    SELECT * FROM `yeshi_ec_user_vip_config` t
    WHERE t.`uvc_name` LIKE '${key}%' OR t.`uvc_value` LIKE '${key}%'
    LIMIT #{start},#{count}
  </select>
  <select id="count" resultType="Long">
       SELECT IFNULL(COUNT(t.uvc_id),0) FROM yeshi_ec_user_vip_config t
     WHERE t.`uvc_name` LIKE '${key}%' OR t.`uvc_value` LIKE '${key}%'
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -86,13 +86,9 @@
        if (brandClass ==null || brandClass.getId() == null)
            throw new BrandInfoException(1, "分类不能为空");
        
        String shopKey = record.getShopKey();
        if (StringUtil.isNullOrEmpty(shopKey))
            record.setShopKey(name);
        String searchKey = record.getSearchKey();
        if (StringUtil.isNullOrEmpty(searchKey))
            record.setSearchKey(name);
        BrandInfo existBrand = brandInfoMapper.selectByUniqueName(name.trim(), brandClass.getId(), record.getId());
        if (existBrand != null)
            throw new BrandInfoException(1, "该分类中已存在:" + name.trim());
        
        Integer state = record.getState();
        if (state == null) {
@@ -109,6 +105,7 @@
            }
        }
        record.setName(name.trim());
        Long id = record.getId();
        if (id == null) {
            record.setCreateTime(new Date());
@@ -119,7 +116,8 @@
            
            BrandInfo resultObj = new BrandInfo();
            resultObj.setId(record.getId());
            resultObj.setWeight(Double.valueOf(record.getId()));
            resultObj.setOrder(Integer.valueOf(record.getId().toString()));
            resultObj.setWeight(500.00);
            brandInfoMapper.updateByPrimaryKeySelective(resultObj);
        } else {
            BrandInfo resultObj = brandInfoMapper.selectByPrimaryKey(id);
@@ -145,6 +143,7 @@
                record.setShopTotal(resultObj.getShopTotal());
            }
            
            record.setOrder(resultObj.getOrder());
            record.setWeight(resultObj.getWeight());
            record.setCreateTime(resultObj.getCreateTime());
            record.setUpdateTime(new Date());
@@ -226,18 +225,18 @@
        if (resultObj == null) 
            throw new BrandInfoException(1, "操作数据已不存在");
        
        Double oldOrder = resultObj.getWeight();
        Integer oldOrder = resultObj.getOrder();
        BrandInfo changeObj = brandInfoMapper.getByAdjoinOrder(resultObj.getBrandClass().getId(),oldOrder, moveType);
        if (changeObj == null )
            throw new BrandInfoException(1, "已经在最边缘,无可交换的位置");
        
        BrandInfo changeObj1 = new BrandInfo();
        changeObj1.setId(id);
        changeObj1.setWeight(changeObj.getWeight());
        changeObj1.setOrder(changeObj.getOrder());
        
        BrandInfo changeObj2 = new BrandInfo();
        changeObj2.setId(changeObj.getId());
        changeObj2.setWeight(oldOrder);
        changeObj2.setOrder(oldOrder);
        
        brandInfoMapper.updateByPrimaryKeySelective(changeObj1);
        brandInfoMapper.updateByPrimaryKeySelective(changeObj2);
@@ -245,13 +244,13 @@
    
    @Override
    public List<BrandInfo> listQuery(long start, int count, String key, Long cid, Integer state) {
        return brandInfoMapper.listQuery(start, count, key, cid, state);
    public List<BrandInfo> listQuery(long start, int count, List<String> keys, Long cid, Integer state, Integer showState) {
        return brandInfoMapper.listQuery(start, count, keys, cid, state,showState);
    }
    @Override
    public long countQuery(String key, Long cid, Integer state) {
        return brandInfoMapper.countQuery(key, cid, state);
    public long countQuery(List<String> keys, Long cid, Integer state, Integer showState) {
        return brandInfoMapper.countQuery(keys, cid, state, showState);
    }
    @Override
@@ -370,6 +369,7 @@
            brandInfo.setGoodsTotal(numInfo.getGoodsTotal());
            brandInfo.setShopTotal(numInfo.getShopTotal());
            brandInfo.setUpdateTime(new Date());
            brandInfo.setWeight(Math.random() * 1000);
            brandInfoMapper.updateByPrimaryKeySelective(brandInfo);
        }
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java
@@ -238,6 +238,11 @@
    public int getTotalTiChengCount(Long uid) {
        return hongBaoV2CountMapper.getTotalTiChengCount(uid);
    }
    @Override
    public long getHongBaoCount(Long uid,Integer type) {
        return hongBaoV2CountMapper.getHongBaoCount(uid, type);
    }
    @Override
    public long countValidNumberByUid(Long uid, Integer dateType) {
@@ -334,7 +339,13 @@
    }
    
    @Override
    public long countValidOrderTeamUserByUid(Long uid, String date, BigDecimal payment) {
        return hongBaoV2CountMapper.countValidOrderTeamUserByUid(uid, date, payment);
    public long countValidOrderTeamUserByUid(Long uid, Long time, BigDecimal payment) {
        return hongBaoV2CountMapper.countValidOrderTeamUserByUid(uid, time, payment);
    }
    @Override
    public BigDecimal getRewardMoneyByDate(Long uid, Integer dateType, Integer hbType, Integer orderState) {
        return hongBaoV2CountMapper.getRewardMoneyByDate(uid, dateType, hbType, orderState);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/money/UserMoneyDetailServiceImpl.java
@@ -39,17 +39,18 @@
    }
    @Override
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,int type, Date maxTime) {
        //TODO 增加type筛选
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Integer type, Date maxTime) {
        List<UserMoneyDetailHistoryVO> finalList = new ArrayList<>();
        List<UserMoneyDetail> list = null;
        if (userMoneyDetailId == null) {// 首次请求
            if (maxTime == null)// 没有筛选时间
            {
                list = userMoneyDetailMapper.selectByMaxCreateTime(uid,
                        new Date(System.currentTimeMillis() + 1000 * 60 * 60L), 20);
                Date date = new Date(System.currentTimeMillis() + 1000 * 60 * 60L);
                list = userMoneyDetailMapper.selectByMaxCreateTime(uid,    date, 20, type);
                System.out.println("maxTime == null");
            } else {// 筛选了时间
                list = userMoneyDetailMapper.selectByMaxCreateTime(uid, maxTime, 20);
                System.out.println("maxTime != null");
                list = userMoneyDetailMapper.selectByMaxCreateTime(uid, maxTime, 20, type);
            }
            if (list != null && list.size() > 0) {
@@ -73,7 +74,7 @@
        } else {// 二次请求
            int size = 21;
            List<UserMoneyDetail> tempList = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size);
            List<UserMoneyDetail> tempList = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size, type);
            Set<Date> dateSet = new HashSet<>();// 用于储存是否在同一时间上面(精确到秒)
            if (tempList.size() > 0) {
                for (UserMoneyDetail umd : tempList) {
@@ -84,7 +85,7 @@
                while (dateSet.size() == 1 && tempList2.size() != tempList.size() && size < 40) {// 只有一个时间点的数据
                    tempList = tempList2;
                    size += 10;
                    tempList2 = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size);
                    tempList2 = userMoneyDetailMapper.selectByUidWithIndexId(uid, userMoneyDetailId, size, type);
                    dateSet.clear();
                    for (UserMoneyDetail umd : tempList2) {
                        dateSet.add(umd.getCreateTime());
@@ -192,19 +193,19 @@
    }
    @Override
    public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,int type, Date maxTime) {
    public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,Integer type, Date maxTime) {
        //TODO 增加type筛选
        long monthCount = 0L;
        long detailCount = 0L;
        // 未通过时间筛选,查询所有
        if (maxTime == null) {
            detailCount = userMoneyDetailMapper.selectCountByUid(uid);
            detailCount = userMoneyDetailMapper.selectCountByUid(uid, type);
            // 用于表示当前所有
            monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid,
                    new Date(System.currentTimeMillis() + 1000 * 60 * 60L));
                    new Date(System.currentTimeMillis() + 1000 * 60 * 60L), type);
        } else {// 通过时间筛选了的,需要查询所有
            detailCount = userMoneyDetailMapper.selectCountByUidAndMaxCreateTime(uid, maxTime);
            monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid, maxTime);
            detailCount = userMoneyDetailMapper.selectCountByUidAndMaxCreateTime(uid, maxTime, type);
            monthCount = userMoneyDetailMapper.selectMonthCountByUid(uid, maxTime, type);
        }
        return monthCount + detailCount;
fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/ExtractServiceImpl.java
@@ -1086,6 +1086,112 @@
        }
        return listOpendIDs;
    }
    @Override
    public List<UserInfo> preAutoUserTo1212() throws Exception {
        int page = 0;
        int pageSize = 100;
        int maxSize = 300;
        Date nowDate = new Date();
        // 条件3:距离上一次成功领取微信红包已经超过了30天时间,可在第31天再次下发;
        String receivedDate = DateUtil.reduceDayTostring(30, nowDate);
        // 条件4:距离上一次未成功领取微信红包已经超过了15天时间,可在第16天再次下发;
        String refundDate = DateUtil.reduceDayTostring(15, nowDate);
        // 余额最低限制
        List<UserInfo> list = new ArrayList<UserInfo>();
        while (true) {
            // 查询满足条件 1、2 的uid
            List<UserInfo> listUser = userInfoService.getAutoExtractUserTo1212(page * pageSize, pageSize);
            if (listUser == null || listUser.isEmpty())
                break;
            List<Long> listId = new ArrayList<Long>();
            for (UserInfo userInfo : listUser) {
                listId.add(userInfo.getId());
            }
            // 查询记录是否满足
            List<Long> listValid = extractWeiXinRecordService.getValidUsers(listId, receivedDate, refundDate);
            if (listValid == null || listValid.isEmpty()) {
                page++;
                continue;
            }
            for (Long uid : listValid) {
                if (list.size() >= maxSize)
                    break;
                for (UserInfo userInfo : listUser) {
                    if (list.size() >= maxSize)
                        break;
                    if (userInfo.getId().longValue() == uid.longValue()) {
                        list.add(userInfo);
                        break;
                    }
                }
            }
            if (list.size() >= maxSize)
                break;
            page++;
        }
        return list;
    }
    @Override
    public List<String> getAutoExtractOpenIdsTo1212() throws Exception {
        int page = 0;
        int pageSize = 100;
        int maxSize = 301; // appId + 实际openid300个
        Date nowDate = new Date();
        // 条件3:距离上一次成功领取微信红包已经超过了30天时间,可在第31天再次下发;
        String receivedDate = DateUtil.reduceDayTostring(30, nowDate);
        // 条件4:距离上一次未成功领取微信红包已经超过了15天时间,可在第16天再次下发;
        String refundDate = DateUtil.reduceDayTostring(15, nowDate);
        // 提现金额
        BigDecimal money = BigDecimal.valueOf(1);
        List<String> listOpendIDs = new ArrayList<String>();
        // 首行appID
        listOpendIDs.add(Constant.getWXAccount(null, null).getAppId());
        while (true) {
            // 查询满足条件 1、2 的uid
            List<UserInfo> listUser = userInfoService.getAutoExtractUserTo1212(page * pageSize, pageSize);
            if (listUser == null || listUser.isEmpty())
                break;
            List<Long> listId = new ArrayList<Long>();
            for (UserInfo userInfo : listUser) {
                listId.add(userInfo.getId());
            }
            // 查询记录是否满足
            List<Long> listValid = extractWeiXinRecordService.getValidUsers(listId, receivedDate, refundDate);
            if (listValid == null || listValid.isEmpty()) {
                page++;
                continue;
            }
            for (Long uid : listValid) {
                UserInfo userInfo = subHongBaoByUid(uid, money, money);
                if (userInfo != null) {
                    listOpendIDs.add(userInfo.getWxOpenId());
                    if (listOpendIDs.size() >= maxSize)
                        break;
                }
            }
            if (listOpendIDs.size() >= maxSize)
                break;
            page++;
        }
        return listOpendIDs;
    }
    @Transactional(rollbackFor = Exception.class)
    private UserInfo subHongBaoByUid(Long uid, BigDecimal money, BigDecimal minSurplus) {
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -72,6 +72,7 @@
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import com.yeshi.fanli.vo.order.CommonOrderGoodsVO;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.order.OrderCountVO;
import com.yeshi.fanli.vo.order.WeiQuanInfo;
import net.sf.json.JSONObject;
@@ -214,7 +215,7 @@
     */
    public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, boolean exchangeCoupon,
            Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList,
            AcceptData acceptData) {
            Long uid, AcceptData acceptData) {
        // 是否免单商品
        boolean freeOrder = false;
@@ -283,10 +284,11 @@
                rewardOrder = true; // 奖励成功 2.0.2 消失
            }
        } else if (hasRewardCoupon && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType
                && HongBaoV2.STATE_YILINGQU == hongBaoState) {
            // 有可用的奖励券 、非免单订单 、且已到账的 、返利订单
            type = 2;
            rewardOrder = true;
                && HongBaoV2.STATE_YILINGQU == hongBaoState) { // 有可用的奖励券 、非免单订单 、且已到账的 、返利订单
            if (!userVIPInfoService.isVIP(uid)) { // 非会员可使用奖励券
                type = 2;
                rewardOrder = true;
            }
        }
        if (rewardOrder) {
@@ -771,16 +773,16 @@
                // 奖励订单、免单 使用记录
                if (sourceType == null) {
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, null,
                            signList, acceptData);
                            signList, uid, acceptData);
                } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
                            listRecordTB, signList, acceptData);
                            listRecordTB, signList, uid, acceptData);
                } else if (sourceType == Constant.SOURCE_TYPE_JD) {
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
                            listRecordJD, signList, acceptData);
                            listRecordJD, signList, uid, acceptData);
                } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
                    setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
                            listRecordPDD, signList, acceptData);
                            listRecordPDD, signList, uid, acceptData);
                }
            }
@@ -798,6 +800,11 @@
    public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day, Integer source) {
        return commonOrderMapper.countHistoryOrder(uid, day, source);
    }
    @Override
    public OrderCountVO getOrderCount(Long uid, Integer day, Integer source) {
        return commonOrderMapper.getOrderCount(uid, day, source);
    }
    @Override
    public long countBonusOrderNumber(Long uid, Integer type, Integer day, String startTime, String endTime,
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java
@@ -666,4 +666,9 @@
        return userInfoMapper.countByType(type);
    }
    @Override
    public List<UserInfo> getAutoExtractUserTo1212(int start, int count) {
        return userInfoMapper.getAutoExtractUserTo1212(start, count);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -26,7 +26,6 @@
import com.aliyun.openservices.ons.api.transaction.LocalTransactionExecuter;
import com.aliyun.openservices.ons.api.transaction.TransactionProducer;
import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
import com.google.gson.Gson;
import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper;
import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
@@ -75,6 +74,7 @@
import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.RedisManager;
@@ -179,6 +179,9 @@
    
    @Resource(name = "producer")
    private Producer producer;
    @Resource
    private UserVIPInfoService userVIPInfoService;
    
@@ -1877,18 +1880,20 @@
                    jumpBtn.put("params", jumpLink);
                    jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("web"));
                } else if (CouponTypeEnum.rebatePercentCoupon == type) {
                    // 可使用、 可赠送
                    userCouponVO.setState(UserSystemCoupon.STATE_USE_GIVE);
                    // 订单列表
                    jumpLink.put("state", "2"); // 已收货
                    jumpLink.put("showNav", false); // 不显示上方统计信息
                    jumpLink.put("type", "1"); // 返利订单
                    jumpLink.put("title", "返利订单"); // 标题名
                    jumpLink.put("goodsType", "0"); // 订单来源
                    jumpBtn = new HashMap<String, Object>();
                    jumpBtn.put("params", jumpLink);
                    jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("order_screen_list"));
                    if (userVIPInfoService.isVIP(uid)) { // 会员只可赠送
                        userCouponVO.setState(UserSystemCoupon.STATE_GIVE_ONLY);
                    } else {// 可使用 可赠送
                        userCouponVO.setState(UserSystemCoupon.STATE_USE_GIVE);
                        jumpLink.put("state", "2"); // 已收货
                        jumpLink.put("showNav", false); // 不显示上方统计信息
                        jumpLink.put("type", "1"); // 返利订单
                        jumpLink.put("title", "返利订单"); // 标题名
                        jumpLink.put("goodsType", "0"); // 订单来源
                        jumpBtn = new HashMap<String, Object>();
                        jumpBtn.put("params", jumpLink);
                        jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("order_screen_list"));
                    }
                }
            } else if (UserSystemCoupon.STATE_IN_USE == state && give) {
                userCouponVO.setCouponEffect("赠送中");
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/CodePublishRecordServiceImpl.java
@@ -82,14 +82,14 @@
            codePublishRecord.setNickName(nickName);
            UserInfo user = userInfoService.selectByPKey(codePublishRecord.getUid());
            long firstTeam = threeSaleSerivce.countFirstTeam(codePublishRecord.getUid(), 1);
            long secondTeam = threeSaleSerivce.countSecondTeam(codePublishRecord.getUid(), 1);
            codePublishRecord.setTeam(firstTeam + secondTeam);
            if (user != null && user.getType() == 1) {// 假用户
                long s = Integer
                        .parseInt((206 * (6365705L - codePublishRecord.getUid()) / (6365705L - 6315822L) + 82) + "");
                codePublishRecord.setTeam(s);
            } else {// 真用户
                long firstTeam = threeSaleSerivce.countFirstTeam(codePublishRecord.getUid(), 1);
                long secondTeam = threeSaleSerivce.countSecondTeam(codePublishRecord.getUid(), 1);
                codePublishRecord.setTeam(firstTeam + secondTeam);
                codePublishRecord.setTeam(s + codePublishRecord.getTeam());
            }
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java
@@ -1,5 +1,8 @@
package com.yeshi.fanli.service.impl.user.vip;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -12,15 +15,38 @@
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPInfoMapper;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
import com.yeshi.fanli.entity.shop.BanLiShopOrder;
import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
@Service
public class UserVIPInfoServiceImpl implements UserVIPInfoService {
    @Resource
    private UserVIPInfoMapper userVIPInfoMapper;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private UserVipConfigService userVipConfigService;
    @Resource
    private HongBaoV2CountService hongBaoV2CountService;
    @Resource
    private IntegralDetailService integralDetailService;
    @Resource
    private BanLiShopOrderService banLiShopOrderService;
    @Override
    public void addUserVIPInfo(UserVIPInfo info) throws UserVIPInfoException {
@@ -129,4 +155,61 @@
        return map;
    }
    @Override
    public boolean verifyConform(Long uid) {
        if (uid == null || uid <= 0)
            return false;
        UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
        if (extra == null)
            return false;
        String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
        Date executeDate = null;
        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");
            executeDate = format.parse(limtDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        if (executeDate == null)
            return false;
        // 1、直接粉丝(从 2020 年 1 月 1 日起直接粉丝产生有效订单)
        BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
        long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid, executeDate.getTime(), payMoney);
        if (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime()) {
            long limitNum = Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_old_user"));
            if (teamNum < limitNum)
                return false;
        } else {
            long limitNum = Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_new_user"));
            if (teamNum < limitNum)
                return false;
        }
        // 2、累计自购返利≥100 元(从注册板栗快省起);
        BigDecimal fanMoney = new BigDecimal(userVipConfigService.getValueByKey("require_fan_money"));
        BigDecimal purchase = hongBaoV2CountService.getRewardMoneyBySelf(uid);
        if (purchase.compareTo(fanMoney) < 0)
            return false;
        // 3、累计金币≥10000 枚(从注册板栗快省起);
        BigDecimal goldCoin = integralDetailService.getCumulativeMoney(uid);
        BigDecimal limitGoldCoin = new BigDecimal(userVipConfigService.getValueByKey("require_gold_coin"));
        if (goldCoin.compareTo(limitGoldCoin) < 0)
            return false;
        // 4、使用红包≥1 次
        List<Integer> list = new ArrayList<Integer>();
        list.add(BanLiShopOrder.STATE_SUCCESS);
        long useHongBao = banLiShopOrderService.countByUidAndState(uid, list);
        long limitHongBao = Long.parseLong(userVipConfigService.getValueByKey("require_shop_buy"));
        if (useHongBao < limitHongBao)
            return false;
        // 符合条件
        return true;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVipConfigServiceImpl.java
New file
@@ -0,0 +1,101 @@
package com.yeshi.fanli.service.impl.user.vip;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.user.vip.UserVipConfigMapper;
import com.yeshi.fanli.entity.bus.user.vip.UserVipConfig;
import com.yeshi.fanli.exception.user.vip.UserVipConfigException;
import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class UserVipConfigServiceImpl implements UserVipConfigService {
    @Resource
    private UserVipConfigMapper userVipConfigMapper;
    @Override
    public UserVipConfig getByKey(String key) {
        return userVipConfigMapper.getByKey(key, new Date());
    }
    @Override
    @Cacheable(value = "vipconfigCache", key = "'getValueByKey-' + #key")
    public String getValueByKey(String key) {
        UserVipConfig config = userVipConfigMapper.getByKey(key, new Date());
        if (config != null) {
            return config.getValue();
        }
        return null;
    }
    @Override
    public UserVipConfig getByKey(String key, Date date) {
        if (date == null)
            return getByKey(key);
        return userVipConfigMapper.getByKey(key, date);
    }
    @Override
    public String getValueByKey(String key, Date date) {
        if (date == null)
            return getValueByKey(key);
        UserVipConfig config = userVipConfigMapper.getByKey(key, date);
        if (config != null) {
            return config.getValue();
        }
        return null;
    }
    @Override
    public List<UserVipConfig> query(int page, int pageSize, String key) {
        return userVipConfigMapper.query((page - 1) * pageSize, pageSize, key);
    }
    @Override
    public long count(String key) {
        return userVipConfigMapper.count(key);
    }
    @Override
    public void save(UserVipConfig record) throws UserVipConfigException {
        String name = record.getName();
        if (StringUtil.isNullOrEmpty(name))
            throw new UserVipConfigException(1, "名称不能为空");
        if (StringUtil.isNullOrEmpty(record.getValue()))
            throw new UserVipConfigException(1, "值不能为空");
        if (StringUtil.isNullOrEmpty(record.getKey()))
            throw new UserVipConfigException(1, "标识不能为空");
        record.setUpdateTime(new Date());
        if (record.getId() == null) {
            record.setCreateTime(new Date());
            userVipConfigMapper.insert(record);
        } else {
            UserVipConfig resultObj = userVipConfigMapper.selectByPrimaryKey(record.getId());
            if (resultObj == null)
                throw new UserVipConfigException(1, "修改内容已不存在");
            record.setCreateTime(resultObj.getCreateTime());
            userVipConfigMapper.updateByPrimaryKey(record);
        }
    }
    @Override
    public void delete(List<Long> idsList) {
        if (idsList != null)
            for (Long id : idsList)
                userVipConfigMapper.deleteByPrimaryKey(id);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandInfoService.java
@@ -44,9 +44,9 @@
     * @param state
     * @return
     */
    public List<BrandInfo> listQuery(long start, int count, String key, Long cid, Integer state);
    public List<BrandInfo> listQuery(long start, int count, List<String> keys, Long cid, Integer state, Integer showState);
    public long countQuery(String key, Long cid, Integer state);
    public long countQuery(List<String> keys, Long cid, Integer state, Integer showState);
    /**
     * 查询品牌返回前端
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java
@@ -229,6 +229,23 @@
     * @param payment
     * @return
     */
    public long countValidOrderTeamUserByUid(Long uid, String date, BigDecimal payment);
    public long countValidOrderTeamUserByUid(Long uid, Long time, BigDecimal payment);
    /**
     * 统计不同时间:奖励
     * @param uid
     * @param dateType
     * @param hbType
     * @return
     */
    public BigDecimal getRewardMoneyByDate(Long uid, Integer dateType, Integer hbType, Integer orderState);
    /**
     * 统计红包个数
     * @param uid
     * @param type 红包类型
     * @return
     */
    public long getHongBaoCount(Long uid, Integer type);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/money/UserMoneyDetailService.java
@@ -33,7 +33,7 @@
     * @param maxTime
     * @return
     */
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, int type, Date maxTime);
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Integer type, Date maxTime);
    /**
     * 客户端查询用户的资金记录的条数(计算月统计)
@@ -43,7 +43,7 @@
     * @param maxTime
     * @return
     */
    public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,int type, Date maxTime);
    public long countUserMoneyDetailForClient(Long uid, Long userMoneyDetailId,Integer type, Date maxTime);
    /**
     * 资金明细详情列表(老版本)
fanli/src/main/java/com/yeshi/fanli/service/inter/money/extract/ExtractService.java
@@ -134,5 +134,9 @@
     * @throws Exception
     */
    public List<UserInfo> preAutoUser() throws Exception;
    public List<String> getAutoExtractOpenIdsTo1212() throws Exception;
    public List<UserInfo> preAutoUserTo1212() throws Exception;
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java
@@ -13,6 +13,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.exception.order.CommonOrderException;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.order.OrderCountVO;
import net.sf.json.JSONObject;
@@ -353,4 +354,13 @@
     */
    public long count24HValidOrderByUid(Long uid, Date minTime);
    /**
     * 订单统计有效数量
     * @param uid
     * @param day
     * @param source
     * @return
     */
    public OrderCountVO getOrderCount(Long uid, Integer day, Integer source);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java
@@ -209,4 +209,12 @@
     */
    public long countByType(int type);
    /**
     * 双12预售开启时,开启对休眠老用户的唤醒工作,在2019.1.1到2019.6.18期间产生过订单,并且2019.6.18号后未再活跃,并且账户余额大于1元,并且绑定了微信的用户有2468人
     * @param start
     * @param count
     * @return
     */
    public List<UserInfo> getAutoExtractUserTo1212(int start, int count);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVIPInfoService.java
@@ -69,4 +69,11 @@
     */
    public Map<Long,Boolean> listByUids(List<Long> uid);
    /**
     * 验证是否满足会员条件
     * @param uid
     * @return
     */
    public boolean verifyConform(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVipConfigService.java
New file
@@ -0,0 +1,41 @@
package com.yeshi.fanli.service.inter.user.vip;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.bus.user.vip.UserVipConfig;
import com.yeshi.fanli.exception.user.vip.UserVipConfigException;
public interface UserVipConfigService {
    /**
     * 根据key值查询
     *
     * @param key
     * @return
     */
    public UserVipConfig getByKey(String key);
    /**
     * 根据key值 获取value
     *
     * @param key
     * @return
     */
    public String getValueByKey(String key);
    public UserVipConfig getByKey(String key, Date date);
    public String getValueByKey(String key, Date date);
    public void delete(List<Long> idsList);
    public List<UserVipConfig> query(int page, int pageSize, String key);
    public long count(String key);
    public void save(UserVipConfig record) throws UserVipConfigException;
}
fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java
@@ -124,6 +124,17 @@
        return new PDDGoodsResult(totalCount, goodsList);
    }
    public static List<PDDGoodsDetail> listGoodsDetail(List<Long> goodsIds) {
        PDDSearchFilter filter = new PDDSearchFilter();
        Long[] ids = new Long[goodsIds.size()];
        goodsIds.toArray(ids);
        filter.setGoodsIdList(ids);
        PDDGoodsResult result = searchGoods(filter);
        if (result != null)
            return result.getGoodsList();
        return null;
    }
    /**
     * 运营频道商品查询API
     * 
@@ -435,36 +446,36 @@
        return null;
    }
    /**
     * 获取商品详情
     * 
     * @param goodsId
     */
    public static PDDShopResult getShopList(Integer page,Long catId) {
    public static PDDShopResult getShopList(Integer page, Long catId) {
        JSONArray arrayType = new JSONArray();
        arrayType.add(3);
        Map<String, String> map = new HashMap<>();
        map.put("type", "pdd.ddk.merchant.list.get");
        if (catId != null)
            map.put("cat_id", catId +"");
            map.put("cat_id", catId + "");
        if (page != null)
            map.put("page_number", page +"");
            map.put("page_number", page + "");
        if (page != null)
            map.put("page_number", page +"");
            map.put("page_number", page + "");
        map.put("merchant_type_list", arrayType.toString());
        String result = baseRequest(map);
        JSONObject resultJson = JSONObject.fromObject(result);
        JSONObject root = resultJson.optJSONObject("merchant_list_response");
        if (root != null) {
            int totalCount = root.optInt("total");
            JSONArray array = root.optJSONArray("mall_search_info_vo_list");
            Type type = new TypeToken<List<PDDShopDetail>>() {}.getType();
            Type type = new TypeToken<List<PDDShopDetail>>() {
            }.getType();
            List<PDDShopDetail> listShop = new Gson().fromJson(array.toString(), type);
            return new PDDShopResult(totalCount, listShop);
        }
fanli/src/main/java/com/yeshi/fanli/vo/order/OrderCountVO.java
New file
@@ -0,0 +1,34 @@
package com.yeshi.fanli.vo.order;
public class OrderCountVO {
    // 总计
    private long total;
    private long self;
    private long shared;
    private long invite;
    public long getTotal() {
        return total;
    }
    public void setTotal(long total) {
        this.total = total;
    }
    public long getSelf() {
        return self;
    }
    public void setSelf(long self) {
        this.self = self;
    }
    public long getShared() {
        return shared;
    }
    public void setShared(long shared) {
        this.shared = shared;
    }
    public long getInvite() {
        return invite;
    }
    public void setInvite(long invite) {
        this.invite = invite;
    }
}
fanli/src/main/java/com/yeshi/fanli/vo/user/UserVipRateVO.java
New file
@@ -0,0 +1,160 @@
package com.yeshi.fanli.vo.user;
import java.io.Serializable;
import java.math.BigDecimal;
public class UserVipRateVO implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    // 用户信息
    private Long id;
    private String nickName;
    private String portrait;
    private boolean vip;
    private String successTime;
    private BigDecimal earnMoney;
    private BigDecimal conserveMoney;
    private String helpLink;
    private long finishTeam;
    private long finishHongBao;
    private BigDecimal finishGoldCoin;
    private BigDecimal finishMoney;
    private BigDecimal limitMoney;
    private BigDecimal limitgoldCoin;
    private long limitTeam;
    private long limitHongBao;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getNickName() {
        return nickName;
    }
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }
    public String getPortrait() {
        return portrait;
    }
    public void setPortrait(String portrait) {
        this.portrait = portrait;
    }
    public boolean isVip() {
        return vip;
    }
    public void setVip(boolean vip) {
        this.vip = vip;
    }
    public String getSuccessTime() {
        return successTime;
    }
    public void setSuccessTime(String successTime) {
        this.successTime = successTime;
    }
    public BigDecimal getEarnMoney() {
        return earnMoney;
    }
    public void setEarnMoney(BigDecimal earnMoney) {
        this.earnMoney = earnMoney;
    }
    public BigDecimal getConserveMoney() {
        return conserveMoney;
    }
    public void setConserveMoney(BigDecimal conserveMoney) {
        this.conserveMoney = conserveMoney;
    }
    public String getHelpLink() {
        return helpLink;
    }
    public void setHelpLink(String helpLink) {
        this.helpLink = helpLink;
    }
    public long getFinishTeam() {
        return finishTeam;
    }
    public void setFinishTeam(long finishTeam) {
        this.finishTeam = finishTeam;
    }
    public long getFinishHongBao() {
        return finishHongBao;
    }
    public void setFinishHongBao(long finishHongBao) {
        this.finishHongBao = finishHongBao;
    }
    public BigDecimal getFinishGoldCoin() {
        return finishGoldCoin;
    }
    public void setFinishGoldCoin(BigDecimal finishGoldCoin) {
        this.finishGoldCoin = finishGoldCoin;
    }
    public BigDecimal getFinishMoney() {
        return finishMoney;
    }
    public void setFinishMoney(BigDecimal finishMoney) {
        this.finishMoney = finishMoney;
    }
    public BigDecimal getLimitMoney() {
        return limitMoney;
    }
    public void setLimitMoney(BigDecimal limitMoney) {
        this.limitMoney = limitMoney;
    }
    public BigDecimal getLimitgoldCoin() {
        return limitgoldCoin;
    }
    public void setLimitgoldCoin(BigDecimal limitgoldCoin) {
        this.limitgoldCoin = limitgoldCoin;
    }
    public long getLimitTeam() {
        return limitTeam;
    }
    public void setLimitTeam(long limitTeam) {
        this.limitTeam = limitTeam;
    }
    public long getLimitHongBao() {
        return limitHongBao;
    }
    public void setLimitHongBao(long limitHongBao) {
        this.limitHongBao = limitHongBao;
    }
}
fanli/src/main/resource/env-dev/mongo.properties
@@ -1,13 +1,13 @@
mongo.dbname=flq
mongo.port=27017
mongo.port=27016
#开发环境
mongo.host=192.168.1.253
mongo.username=admin
mongo.password=123456
#mongo.host=192.168.1.253
#mongo.username=admin
#mongo.password=123456
#mongo.host=193.112.35.168
#mongo.username=yeshi
#mongo.password=Yeshi2016@
mongo.host=193.112.35.168
mongo.username=yeshi
mongo.password=Yeshi2016@
mongo.connectionsPerHost=8
mongo.threadsAllowedToBlockForConnectionMultiplier=4
fanli/src/main/resource/env-dev/redis.properties
@@ -1,4 +1,4 @@
redis.addr=193.112.34.40
redis.addr=192.168.1.253
redis.port=6379
redis.auth=123456
redis.max_total=1024
fanli/src/main/resource/env-dev/rocketmq.properties
@@ -2,6 +2,6 @@
rocketmq.SecretKey=ixWg90QbYFKP6ae5xpAo2P1qwIyll5
#测试  http://MQ_INST_1205444665315884_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80
#正式 http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
rocketmq.NAMESRV_ADDR=http://MQ_INST_1205444665315884_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80
rocketmq.NAMESRV_ADDR=http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
fanli/src/main/resource/env-dev/rocketmq.xml
@@ -2,8 +2,10 @@
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <!--
    <import resource="classpath:/rocket/consumer.xml" />
    <import resource="classpath:/rocket/system-coupon-consumer.xml"/>
     -->
    <import resource="classpath:/rocket/producer.xml" />
    <import resource="classpath:/rocket/transactionProducer.xml" />
</beans>
fanli/src/test/java/org/fanli/TaoKeTest.java
@@ -48,12 +48,21 @@
    public static int count = 0;
    @Test
    public void test1() {
//        List<TaoBaoGoodsBrief> list=    TaoKeApiUtil.guessLikeByAuctionId(550439753563L,6);
//        System.out.println(list);
     TaoBaoUtil.getTBDetailImageWithSize(597016140493L);
//        System.out.println(goods);
//        DaTaoKeApiUtil.getGoodsDetailByGoodsId(558195316187L);
    public void test1() {
        // List<TaoBaoGoodsBrief> list=
        // TaoKeApiUtil.guessLikeByAuctionId(550439753563L,6);
        // System.out.println(list);
        // TaoBaoUtil.getTBDetailImageWithSize(597016140493L);
        // System.out.println(goods);
        // DaTaoKeApiUtil.getGoodsDetailByGoodsId(558195316187L);
        try {
            TaoKeApiUtil.specialConvertCoupon(608512721647L, new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                    TaoBaoConstant.TAOBAO_AUTH_APPSECRET, TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    @Test