admin
2019-11-12 5396bf8f7e14a559f825e275579e0091a9d29e73
Merge remote-tracking branch 'origin/div' into div
1个文件已删除
12个文件已修改
401 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/LostOrderController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ConfigControllerV2.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/TokenRecordMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/RedPackJob.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/TokenRecordMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackGiveRecordServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackGiveRecordService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/TokenRecordService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/LostOrderController.java
@@ -85,7 +85,7 @@
                        && order.getResultCode() == LostOrder.RESULT_CODE_SUCCESS) {
                    // 申诉成功
                    json.put("state", 1);
                    json.put("stateDesc", "订单找回成功,请我的-订单中查看");
                    json.put("stateDesc", "订单找回成功,请到我的-订单中查看");
                } else if (order.getState() == 2 || (order.getState() == 1 && order.getResultCode() != null
                        && order.getResultCode() == LostOrder.RESULT_CODE_FAIL)) {
                    // 申诉失败
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ConfigControllerV2.java
@@ -167,9 +167,19 @@
        for (int i = 0; i < listAD.size(); i++) {
            FloatAD floatAD = listAD.get(i);
            FloatADTypeEnum typeEnum = floatAD.getTypeEnum();
            if (typeEnum == FloatADTypeEnum.newUserRedPack && !redPackWinNewUserService.verifyHasReward(uid)) {
            if (typeEnum == FloatADTypeEnum.newUserRedPack) {
                if (!VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
                listAD.remove(i);
                i--;
                    continue;
                }
                if (!redPackWinNewUserService.verifyHasReward(uid)) {
                    listAD.remove(i);
                    i--;
                    continue;
                }
            }
            
            JumpDetailV2 jumpDetail = floatAD.getJumpDetail();
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/TokenRecordMapper.java
@@ -16,6 +16,14 @@
     */
    TokenRecord getByToken(@Param("token")String token);
    
    /**
     * 失效生成口令
     * @param identify
     * @param type
     * @return
     */
    void invalidByTypeAndIdentify(@Param("list")List<String> list, @Param("identify")String identify);
    
    /**
     * 查询该类型最近生成口令
fanli/src/main/java/com/yeshi/fanli/job/RedPackJob.java
File was deleted
fanli/src/main/java/com/yeshi/fanli/mapping/user/TokenRecordMapper.xml
@@ -61,6 +61,14 @@
    </set> where tr_id = #{id,jdbcType=BIGINT}
  </update>
  
  <update id="invalidByTypeAndIdentify">
      UPDATE yeshi_ec_token_record SET tr_state = 1,tr_update_time = NOW()
    WHERE tr_identify = #{identify}
          AND <foreach collection="list" item="item" open="(" separator="OR" close=")">
                tr_type = #{item}
              </foreach>
  </update>
  <select id="getByToken" resultMap="BaseResultMap">
    SELECT * FROM yeshi_ec_token_record
    WHERE tr_token = #{token}
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackGiveRecordServiceImpl.java
@@ -3,7 +3,6 @@
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
@@ -31,6 +30,7 @@
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TokenUtil;
import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
import com.yeshi.fanli.util.factory.RedPackDetailFactory;
@Service
@@ -68,35 +68,40 @@
    
    
    @Override
    public List<RedPackGiveRecord> overdueList(int count) {
        return redPackGiveRecordMapper.overdueList(count);
    }
    @Override
    @RequestSerializableByKeyService(key = "#id")
    @Transactional(rollbackFor = Exception.class)
    public void overdue(List<RedPackGiveRecord> list) throws Exception {
        if (list == null || list.size() == 0)
    public void overdueByPrimaryKey(Long id) throws Exception {
        if (id == null)
            return;
        
        SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
        RedPackGiveRecord updateRecord = null;
        for (RedPackGiveRecord giveRecord: list) {
            updateRecord = new RedPackGiveRecord();
        RedPackGiveRecord giveRecord = redPackGiveRecordMapper.selectByPrimaryKey(id);
        if (giveRecord == null)
            return;
        if (giveRecord.getState() != null && giveRecord.getState() != RedPackGiveRecord.STATE_INIT )
            return;
        // 赠送记录失效
        RedPackGiveRecord updateRecord = new RedPackGiveRecord();
            updateRecord.setId(giveRecord.getId());
            updateRecord.setState(1);
        updateRecord.setState(RedPackGiveRecord.STATE_OVERDUE);
            redPackGiveRecordMapper.updateByPrimaryKeySelective(updateRecord);
        // 口令失效
        tokenRecordService.invalidByRedPack(id);
            
            // 退回红包
            redPackBalanceService.addRedPack(giveRecord.getGiveUid(), giveRecord.getAmount(), RedPackDetailFactory.createGiveOthersFail(giveRecord));
            
            // 退回消息
        SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
            MsgRedPackGiveContentDTO givedto = new MsgRedPackGiveContentDTO();
            givedto.setTitle("你赠送的红包未被成功领取");
            givedto.setMoney("¥" + giveRecord.getAmount().setScale(2));
            givedto.setTime(sd.format(new Date()));
            givedto.setGiveTime(sd.format(giveRecord.getGiveTime()));
            userMoneyMsgNotificationService.redPackMsg(giveRecord.getGiveUid(), MsgTypeMoneyTypeEnum.redPackGiveBack, new Gson().toJson(givedto), "请到我的-红包查看");
        }
    }
    
    
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java
@@ -617,9 +617,35 @@
            return;
        Date date = new Date();
        for (TokenRecord tokenRecord: list) {
            Integer state = tokenRecord.getState();
            if (state != null && state == 0)
                continue;
            tokenRecord.setState(1);
            tokenRecord.setUpdateTime(date);
            tokenRecordMapper.updateByPrimaryKeySelective(tokenRecord);
        }
    }
    @Override
    public void invalidByRedPack(Long id) {
        if (id == null)
            return;
        List<String> list = new ArrayList<String>();
        list.add(TokenTypeEnum.redPack.name());
        tokenRecordMapper.invalidByTypeAndIdentify(list, id.toString());
    }
    @Override
    public void invalidByCoupon(Long id) {
        if (id == null)
            return;
        List<String> list = new ArrayList<String>();
        list.add(TokenTypeEnum.freeCoupon.name());
        list.add(TokenTypeEnum.rebatePercentCoupon.name());
        tokenRecordMapper.invalidByTypeAndIdentify(list, id.toString());
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -2256,9 +2256,103 @@
        sendBackGiveCoupon(list);
    }
    @Override
    @RequestSerializableByKeyService(key = "#giveid")
    @Transactional(rollbackFor = Exception.class)
    public void sendBackByGiveId(Long giveid) {
        if (giveid == null)
            return;
        UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService.selectByPrimaryKey(giveid);
        if (giveRecord == null)
            return;
        if (giveRecord.getState() != null && giveRecord.getState() != UserSystemCouponGiveRecord.STATE_INIT)
            return;
        // 更新赠送记录
        UserSystemCouponGiveRecord updateRecord = new UserSystemCouponGiveRecord();
        updateRecord.setId(giveid);
        updateRecord.setState(UserSystemCouponGiveRecord.STATE_OVERDUE);
        userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateRecord);
        // 口令失效
        tokenRecordService.invalidByCoupon(giveid);
        Long couponId = giveRecord.getCouponId();
        if (couponId == null)
            return;
        UserSystemCoupon userCoupon = userSystemCouponMapper.selectByPrimaryKey(couponId);
        if (userCoupon == null)
            return;
        Integer state = userCoupon.getState();
        if (state != UserSystemCoupon.STATE_IN_USE)
            return;
        Date now = new Date();
        Date endTime = userCoupon.getEndTime();
        if (endTime != null && endTime.getTime() < now.getTime()) {
            List<UserSystemCoupon> list = new ArrayList<UserSystemCoupon>();
            list.add(userCoupon);
            updateCounponInvalid(list);
            return;
        }
        // 退回券
        UserSystemCoupon userSystemCoupon = new UserSystemCoupon();
        userSystemCoupon.setId(userCoupon.getId());
        userSystemCoupon.setGive(false);
        userSystemCoupon.setUseTime(null);
        userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
        userSystemCoupon.setUpdateTime(new Date());
        userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
        // 使用记录
        UserSystemCouponRecord useRecord = userSystemCouponRecordService.getNearByUserCouponId(couponId);
        if (useRecord != null) {
            UserSystemCouponRecord useRecordUpdate = new UserSystemCouponRecord();
            useRecordUpdate.setId(useRecord.getId());
            useRecordUpdate.setState(UserSystemCouponRecord.STATE_WAIT_TIME_OUT);
            useRecordUpdate.setUpdateTime(new Date());
            userSystemCouponRecordService.updateByPrimaryKeySelective(useRecordUpdate);
        }
        SystemCoupon systemCoupon = userCoupon.getSystemCoupon();
        if (systemCoupon != null)
            systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
        if (systemCoupon == null)
            return;
        // 退回消息
        String couponName = systemCoupon.getName();
        if (CouponTypeEnum.freeCouponGive == systemCoupon.getType()) {
            couponName = "免单券";
        } else if (CouponTypeEnum.rebatePercentCoupon == systemCoupon.getType()) {
            couponName = "奖励券";
        }
        String beiZhu = "请到我的-福利中心查看";
        SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
        MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
        msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
        msgOther.setTitle(couponName + "退回");
        msgOther.setGiveType("你赠送的" + couponName + "未被成功领取");
        msgOther.setGiveTime(sd.format(giveRecord.getGiveTime()));
        msgOther.setReturnTime(sd.format(new Date()));
        userOtherMsgNotificationService.tokenGiveMsg(giveRecord.getGiveUid(), beiZhu, msgOther);
    }
    @Override
    public void sendBackGiveCoupon(List<UserSystemCouponGiveRecord> overdueList) {
        for (UserSystemCouponGiveRecord record : overdueList) {
            if (record.getState() != null && record.getState() != UserSystemCouponGiveRecord.STATE_INIT)
                continue;
            // 更新赠送记录
            UserSystemCouponGiveRecord updateRecord = new UserSystemCouponGiveRecord();
            updateRecord.setId(record.getId());
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackGiveRecordService.java
@@ -1,7 +1,6 @@
package com.yeshi.fanli.service.inter.redpack;
import java.math.BigDecimal;
import java.util.List;
import com.yeshi.fanli.entity.redpack.RedPackGiveRecord;
import com.yeshi.fanli.exception.redpack.RedPackGiveRecordException;
@@ -38,15 +37,13 @@
     */
    public RedPackGiveRecord receiveFriendsGive(Long uid, Long id) throws RedPackGiveRecordException;
    /**
     * 查询需要退回的
     * @param count
     * @return
     */
    public List<RedPackGiveRecord> overdueList(int count);
    // 退回红包
    public void overdue(List<RedPackGiveRecord> list) throws Exception;
    /**
     * 赠送退回
     * @param id
     * @throws Exception
     */
    public void overdueByPrimaryKey(Long id) throws Exception;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/TokenRecordService.java
@@ -52,4 +52,17 @@
     */
    public void overdue(List<TokenRecord> list);
    /**
     * 红包口令失效
     * @param id
     */
    public void invalidByRedPack(Long id);
    /**
     * 券口令失效
     * @param id
     */
    public void invalidByCoupon(Long id);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java
@@ -332,4 +332,10 @@
     */
    public void triggerFreeCouponActivate(Long uid);
    /**
     * 退回券
     * @param giveid
     */
    public void sendBackByGiveId(Long giveid);
}
fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java
@@ -805,12 +805,13 @@
        
        
        try {
            boolean index = true;
            // 画第一张
            for (int i = 0; i < goodsList.size(); i++) {
                CommonGoods goods = goodsList.get(i);
                BigDecimal couplePrice = CommonGoodsUtil.getAfterUseCouplePrice(goods);
                // 第一张图需要有价格信息
                if (i == 0) {
                if (i == 0 || index) {
                    int topX = 50;
                    int topY = 50;
                    
@@ -819,6 +820,9 @@
                    int widht = 650;
                    int height = 650;
                    InputStream goodsPicture = TaoBaoHttpUtil.getAsInputStream(goods.getPicture().replace("_.webp", "").replace("_220x220", ""));
                    if (goodsPicture == null)
                        continue;
                    BufferedImage picImage = ImageIO.read(goodsPicture);
                    picImage = ImageUtil.zoomInImage(picImage, widht, height);
                    g2d.drawImage(picImage, topX, topX, null);
@@ -885,6 +889,8 @@
                        g2d.drawString("¥ " + withNoZera + "", quanBGWidht + 70, quanBGHeight + 48);
                    }
                    index = false;
                } else {
                    // 计算左上角坐标
                    int topX = 0;
@@ -906,8 +912,10 @@
                        topY = 50 + (315 + 20) * 2;
                    // 画大图
                    InputStream goodsPicture = TaoBaoHttpUtil
                            .getAsInputStream(goods.getPicture().replace("_.webp", ""));
                    InputStream goodsPicture = TaoBaoHttpUtil.getAsInputStream(goods.getPicture().replace("_.webp", ""));
                    if (goodsPicture == null)
                        continue;
                    BufferedImage picImage = ImageIO.read(goodsPicture);
                    picImage = ImageUtil.zoomInImage(picImage, 315, 315);
                    g2d.drawImage(picImage, topX, topY, null);
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java
@@ -184,27 +184,36 @@
            goodsInfo.setCouponInfo(coupon);
        }
        if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
            // 店铺信息
            if (!StringUtil.isNullOrEmpty(goods.getSellerName()) && goods.getSellerId() != null) {
        if (!StringUtil.isNullOrEmpty(goods.getSellerName())) {
                ShopInfoVO shop = new ShopInfoVO();
                shop.setShopName(goods.getSellerName());
            if( goods.getSellerId() != null)
                shop.setId(goods.getSellerId().toString());
            if (shopType == null || shopType == 0) {
                shop.setUserType(10);
            } else if (shopType == 1) {
                shop.setUserType(11);
            } else {
                shop.setUserType(goods.getShopType());
            }
                goodsInfo.setShopInfo(shop);
            }
        }
        
        if (Constant.IS_TEST) {
            // 添加标签
            List<ClientTextStyleVO> labels = goodsInfo.getLabels();
            if (labels == null)
                labels = new ArrayList<>();
            labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
            labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
            labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
            goodsInfo.setLabels(labels);
        }
//        if (Constant.IS_TEST) {
//            // 添加标签
//            List<ClientTextStyleVO> labels = goodsInfo.getLabels();
//            if (labels == null)
//                labels = new ArrayList<>();
//
//            labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
//            labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
//            labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
//            goodsInfo.setLabels(labels);
//        }
        
        return goodsInfo;
    }
@@ -280,25 +289,34 @@
        // 店铺信息
        String shopTitle = goods.getShopTitle();
        Long sellerId = goods.getSellerId();
        if (!StringUtil.isNullOrEmpty(shopTitle) && sellerId != null) {
        if (!StringUtil.isNullOrEmpty(shopTitle)) {
            ShopInfoVO shop = new ShopInfoVO();
            shop.setShopName(shopTitle);
            Long sellerId = goods.getSellerId();
            if(sellerId != null)
            shop.setId(goods.getSellerId().toString());
            if (shopType != null && shopType == 1) {
                shop.setUserType(11);
            } else {
                shop.setUserType(10);
            }
            goodsInfo.setShopInfo(shop);
        }
        if (Constant.IS_TEST) {
            // 添加标签
            List<ClientTextStyleVO> labels = goodsInfo.getLabels();
            if (labels == null)
                labels = new ArrayList<>();
            labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
            labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
            labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
            goodsInfo.setLabels(labels);
        }
//        if (Constant.IS_TEST) {
//            // 添加标签
//            List<ClientTextStyleVO> labels = goodsInfo.getLabels();
//            if (labels == null)
//                labels = new ArrayList<>();
//
//            labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
//            labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
//            labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
//            goodsInfo.setLabels(labels);
//        }
        
        return goodsInfo;
    }
@@ -403,10 +421,19 @@
        }
        // 店铺信息
        if (!StringUtil.isNullOrEmpty(goods.getShopTitle()) && goods.getSellerId() != null) {
        if (!StringUtil.isNullOrEmpty(goods.getShopTitle())) {
            ShopInfoVO shop = new ShopInfoVO();
            shop.setShopName(goods.getShopTitle());
            if (goods.getSellerId() != null)
            shop.setId(goods.getSellerId().toString());
            if (shopType != null && shopType == 1) {
                shop.setUserType(11);
            } else {
                shop.setUserType(10);
            }
            goodsInfo.setShopInfo(shop);
        }
@@ -414,17 +441,17 @@
            goodsInfo = loadYuShouInfo(goodsInfo, goods, null, params.getFanLiRate(), params.getShareRate());
        }
        if (Constant.IS_TEST) {
            // 添加标签
            List<ClientTextStyleVO> labels = goodsInfo.getLabels();
            if (labels == null)
                labels = new ArrayList<>();
            labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
            labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
            labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
            goodsInfo.setLabels(labels);
        }
//        if (Constant.IS_TEST) {
//            // 添加标签
//            List<ClientTextStyleVO> labels = goodsInfo.getLabels();
//            if (labels == null)
//                labels = new ArrayList<>();
//
//            labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
//            labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
//            labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
//            goodsInfo.setLabels(labels);
//        }
        
        return goodsInfo;
    }
@@ -545,6 +572,7 @@
            ShopInfoVO shop = new ShopInfoVO();
            shop.setShopName(shopInfo.getShopName());
            shop.setId(shopInfo.getShopId().toString());
            if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) {
                shop.setUserType(20);
            } else {
@@ -660,21 +688,22 @@
            if (goods.getMallId() != null) {
                shop.setId(goods.getMallId().toString());
            }
            shop.setUserType(30);
            goodsInfo.setShopInfo(shop);
        }
        
        if (Constant.IS_TEST) {
            // 添加标签
            List<ClientTextStyleVO> labels = goodsInfo.getLabels();
            if (labels == null)
                labels = new ArrayList<>();
            labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
            labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
            labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
            goodsInfo.setLabels(labels);
        }
//        if (Constant.IS_TEST) {
//            // 添加标签
//            List<ClientTextStyleVO> labels = goodsInfo.getLabels();
//            if (labels == null)
//                labels = new ArrayList<>();
//
//            labels.add(new ClientTextStyleVO("预售", "#FF2B4E"));
//            labels.add(new ClientTextStyleVO("爆款", "#FF2B4E"));
//            labels.add(new ClientTextStyleVO("超级划算", "#FF2B4E"));
//            goodsInfo.setLabels(labels);
//        }
        return goodsInfo;
    }