admin
2019-08-26 dee14e78ad573d7488975a990476e16990bb6376
Merge branch 'mater-1.6.0' into div

Conflicts:
fanli/src/test/java/org/fanli/TaoKeTest.java
5个文件已修改
89 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMoneyController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2Mapper.xml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/test/java/org/fanli/TaoKeTest.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMoneyController.java
@@ -265,13 +265,15 @@
        Calendar ca = Calendar.getInstance();
        ca.setTime(new Date(timeStamp));
        ca.add(Calendar.MONTH, 1);
        maxDate = new Date(ca.getTimeInMillis());
        maxDate = new Date(
                TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy-MM"), "yyyy-MM"));
        // 本月未到账
        vo.setMonthUnRecievedMoney(hongBaoV2Service.getUnRecievedMoneyWithPreGetTime(uid, minDate, maxDate));
        // 全部未到账
        minDate = new Date(0);
        maxDate=new Date(timeStamp);
        vo.setTotalUnRecievedMoney(hongBaoV2Service.getUnRecievedMoneyWithCreateTime(uid, minDate, maxDate));
        GsonBuilder builder = new GsonBuilder();
        builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java
@@ -127,8 +127,16 @@
     * @param count
     * @return
     */
    List<HongBaoV2> listCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid,
    List<HongBaoV2> listCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid,@Param("start") long start,
            @Param("count") int count);
    /**
     * 计算可以结算红包的数量
     * @param type
     * @param uid
     * @return
     */
    long countCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid);
    /**
     * 根据用户ID,订单状态和结算时间统计邀请赚的订单数量
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2Mapper.xml
@@ -221,8 +221,27 @@
        hb_pre_get_time IS NOT NULL AND
        hb_pre_get_time>0 AND
        NOW()>=hb_pre_get_time limit
        #{count}
        #{start},#{count}
    </select>
    <select id="countCanBalanceHongBaoByTypeAndUid" resultType="java.lang.Long">
        select
        count(hb_id)
        from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and `hb_version`=2
        <foreach collection="types" item="type" open=" and ("
            separator=" or " close=")">
            hb_type =
            #{type}
        </foreach>
        and
        (hb_state=1 or hb_state=2) and
        hb_pre_get_time IS NOT NULL AND
        hb_pre_get_time>0 AND
        NOW()>=hb_pre_get_time
    </select>
    <select id="countInviteOrderCountByUidAndSettleTime" resultType="java.lang.Long">
        SELECT COUNT(h.hb_id) FROM yeshi_ec_hongbao_v2 h LEFT JOIN
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -574,7 +574,16 @@
        List<Integer> types = new ArrayList<>();
        types.add(HongBaoV2.TYPE_YIJI);
        types.add(HongBaoV2.TYPE_ERJI);
        List<HongBaoV2> hongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, 1000);
        long count=    hongBaoV2Mapper.countCanBalanceHongBaoByTypeAndUid(types, uid);
        List<HongBaoV2> hongBaoList =new ArrayList<>();
        //1000条数据为1页
        int page=(int)    (count%1000==0?count/1000:count/1000+1);
        for(int i=0;i<page;i++)
        {
            List<HongBaoV2> tempHongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, i*1000,1000);
            if(tempHongBaoList!=null&&tempHongBaoList.size()>0)
                hongBaoList.addAll(tempHongBaoList);
        }
        // 灰度测试中,京东/拼多多订单分享/邀请订单不返利
        for (int i = 0; i < hongBaoList.size(); i++) {
            HongBaoV2 item = hongBaoList.get(i);
@@ -591,7 +600,7 @@
                        hongBaoList.remove(i);
                        i--;
                    } else {// 上级用户不是正常用户,订单均不能到账
                        UserInfo userInfo = userInfoMapper.selectByPrimaryKey(item.getUserInfo().getId());
                        UserInfo userInfo = userInfoMapper.selectByPrimaryKey(co.getUserInfo().getId());
                        if (userInfo == null || userInfo.getState() != UserInfo.STATE_NORMAL) {
                            hongBaoList.remove(i);
                            i--;
@@ -651,7 +660,8 @@
        types.clear();
        types.add(HongBaoV2.TYPE_SHARE_YIJI);
        types.add(HongBaoV2.TYPE_SHARE_ERJI);
        List<HongBaoV2> hbList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, 10000);
        //TODO 需要处理超过1w条数据的订单
        List<HongBaoV2> hbList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid,0, 10000);
        if (hbList != null && hbList.size() > 0)
            totalHongBaoList.addAll(hbList);
@@ -735,7 +745,8 @@
        // 查询UID的分享赚订单
        types.clear();
        types.add(HongBaoV2.TYPE_SHARE_GOODS);
        List<HongBaoV2> hongBaoShareList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, 10000);
        //TODO 需要处理超过10000条数据的订单
        List<HongBaoV2> hongBaoShareList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid,0, 10000);
        for (HongBaoV2 hongBao : hongBaoShareList) {
            hongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBao.getId());
            hongBao = filterWeiQuanINGHongBao(hongBao);
fanli/src/test/java/org/fanli/TaoKeTest.java
@@ -4,7 +4,9 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -20,6 +22,8 @@
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoLink;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
@@ -44,7 +48,7 @@
    @Test
    public void test1() {
         TaoKeApiUtil.taoKeContent();
    }
    @Test
@@ -58,24 +62,19 @@
    @Test
    public void test3() {
        // try {
        // EmergencyUtil.baoJin("monitor-error-tb-app-limit-24980167",
        // "淘宝APPKey请求限制【24980167】", new String[] { "18581318252" });
        // } catch (Exception e1) {
        //
        // }
        // 0K6TBHS%2F84vpYy%2FzKPWwH6J7%2BkHL3AEW
        // 2PlyMHAEtzjJX3K6R73L5KJ7%2BkHL3AEW
        Long[] auctionIds = new Long[] { 528561708277L, 563689377074L, 570752677800L, 569281626446L, 567165767332L,
                555437572417L, 534857332052L, 565233575889L, 565536124572L };
        Long auctionId = 598165623087L;
        String appKey = "27821872";
        String appSecret = "9277b7c40b753e142303eeabc1936c80";
        String pid = "mm_491980152_690500060_109327900051";
        TaoKeAppInfo app=new TaoKeAppInfo(appKey, appSecret, pid);
        // TaoKeApiUtil.getLiJinXG();
        // String
        // url="https://uland.taobao.com/taolijin/edetail?eh=aIrBfHZGd4iZuQF0XRz0iAXoB+DaBK5LQS0Flu/fbSp4QsdWMikAalrisGmre1Id0BFAqRODu114yl7QZ1qFyc7LbOC0oAuo+MUwzxYlSKECGml30RY8PBx5jSVkulpmRQIlrKaDNziGVmobyGguP+jgTFwOoHsRe9593cvcC9QGQASttHIRqdGO5qxVOPQ2buEoHk5wx6hxhsv5QYr1rbcOQrCzclRfPTIk7Z0myMWxZvcNeMU+E+L71lQF+6uZp7DLcYmoygrjfjYOW9fVleIg09jheaZgonv6QcvcARY=&union_lens=lensId:0b0b4505_0c2a_16af789993f_0880;traffic_flag=lm";
        // String token=
        // TaoKeApiUtil.getTKToken("https://img.alicdn.com/imgextra/i4/2256112408/O1CN01EKNifJ1TeuF9x4it9_!!2256112408.jpg_400x400.jpg",
        // "旗睿电风扇台式家用12寸16寸静音学生宿舍摇头定时节能台扇落地扇", url);
        // System.out.println(token);
        try {
            TaoKeApiUtil.createTaoLiJin(auctionId, "淘礼金", new BigDecimal(1), 1, new Date(),
                    new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 12L), new Date(),
                    new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 12L), app);
        } catch (TaoKeApiException e) {
            e.printStackTrace();
        }
    }
    @Test