admin
2019-08-30 0272ffc3e7037e10c2ddadeea6c597850903878f
Merge remote-tracking branch 'origin/div' into div
11个文件已修改
126 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponMapper.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponRecordMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponRecordMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponRecordServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponRecordService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -623,6 +623,7 @@
    private void searchJDGoods(String key, Integer page, String filter, Integer order, PrintWriter out) {
        JDSearchResult result = null;
        boolean hasCoupon = false;
        String way = configService.get("jd_api_search_key");
        if ("1".equals(way)) {
            JDFilter filterAPI = new JDFilter();
@@ -658,6 +659,7 @@
                JSONObject jsonfilter = JSONObject.fromObject(filter);
                Boolean coupon = jsonfilter.optBoolean("coupon");
                if (coupon != null && coupon) {
                    hasCoupon = true;
                    filterAPI.setIsCoupon(1); // 有券
                }
@@ -713,6 +715,7 @@
                JSONObject jsonfilter = JSONObject.fromObject(filter);
                Boolean coupon = jsonfilter.optBoolean("coupon");
                if (coupon != null && coupon) {
                    hasCoupon = true;
                    jdfilter.setHasCoupon(1); // 有券
                }
@@ -765,8 +768,14 @@
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                for (JDGoods goods : goodsList) {
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate);
                    if (hasCoupon) {
                        if (goodsDetailVO.isHasCoupon()) {
                    array.add(gson.toJson(goodsDetailVO));
                }
                    } else {
                        array.add(gson.toJson(goodsDetailVO));
                    }
                }
            }
        }
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponMapper.java
@@ -10,7 +10,6 @@
public interface UserSystemCouponMapper extends BaseMapper<UserSystemCoupon> {
    
    List<UserSystemCoupon> getUserCouponList(@Param("start") long start, @Param("count") int count, 
            @Param("uid") Long uid);
    
@@ -96,4 +95,12 @@
     */
    List<UserSystemCouponVO> getIncludeNotExchange(@Param("uid") Long uid,@Param("num") int num, @Param("type") String type);
    
    /**
     * 查询正在使用中 超过时间仍未匹配到订单记录
     * @param uid
     * @param seconds
     * @return
     */
    List<UserSystemCoupon> getCouponByUsingTimeOut(@Param("uid") Long uid,@Param("list") List<Long> list, @Param("number") Long number);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponRecordMapper.java
@@ -39,15 +39,6 @@
    
    
    /**
     * 查询正在使用中 超过时间仍未匹配到订单记录
     * @param uid
     * @param seconds
     * @return
     */
    List<UserSystemCouponRecord> getCouponByUsingTimeOut(@Param("uid") Long uid, @Param("number") Long number);
    /**
     * 查询最近使用记录
     * @param userCouponId
     * @return
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml
@@ -195,4 +195,15 @@
    WHERE t.usc_state = 1 AND t.usc_state_activate = 1 AND t.usc_uid = #{uid}
        AND c.`sc_percent` <![CDATA[<>]]> #{num} AND c.`sc_type`= #{type} 
  </select>
  <select id="getCouponByUsingTimeOut" resultMap="BaseResultMap">
    SELECT * FROM `yeshi_ec_user_system_coupon` cp
    WHERE cp.`usc_uid` = #{uid} AND cp.`usc_state` = 2  AND (cp.usc_give = 0 or cp.usc_give is null)
          AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(cp.`usc_use_time`)) <![CDATA[>]]> #{number}
          AND cp.usc_coupon_id in
              <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponRecordMapper.xml
@@ -87,15 +87,6 @@
            separator=",">#{item}</foreach>
  </select>
  
  <select id="getCouponByUsingTimeOut" resultMap="BaseResultMap">
     SELECT * FROM `yeshi_ec_user_system_coupon` cp
    LEFT JOIN `yeshi_ec_user_system_coupon_record` rd ON rd.`ucr_user_coupon_id` = cp.`usc_id`
    WHERE cp.`usc_uid` = #{uid} AND cp.`usc_state` = 2 AND rd.`ucr_state` = 0
          AND (cp.usc_give = 0 or cp.usc_give is null)
          AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(cp.`usc_use_time`)) <![CDATA[>]]> #{number};
  </select>
  <select id="getNearByUserCouponId" resultMap="BaseResultMap">
    SELECT * FROM  `yeshi_ec_user_system_coupon_record`
    WHERE ucr_user_coupon_id = #{userCouponId}
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java
@@ -411,8 +411,8 @@
        msgOther.setSource("一级队员首笔下单,系统奖励邀请人金币");
        msgOther.setNum(addGoldCoin + "金币");
        msgOther.setTotal(goldCoin + "金币");
        msgOther.setExplain("仅一级队员首笔下单奖励(已到账)");
        userOtherMsgNotificationService.firstOrderRewardMsg(uid, "", msgOther);
        msgOther.setExplain("仅一级队员首笔下单奖励");
        userOtherMsgNotificationService.firstOrderRewardMsg(uid, "订单已到账后系统会自动奖励", msgOther);
    }
    
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java
@@ -646,7 +646,7 @@
                MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
                msgOther.setType(MsgOtherGiveContentDTO.TYEP_TLJ);
                msgOther.setTitle("推广红包退回");
                msgOther.setGiveType("你赠送的"+ money.setScale(0) + "元推广红包未被成功领取");
                msgOther.setGiveType("你赠送的¥"+ money + "元推广红包未被领取");
                msgOther.setGiveTime(sd.format(record.getGiveTime()));
                msgOther.setReturnTime(sd.format(new Date()));
                userOtherMsgNotificationService.tokenGiveMsg(record.getGiveUid(), beiZhu, msgOther);
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java
@@ -58,6 +58,7 @@
    private UserInfoService userInfoService;
    @Resource
    @Lazy
    private UserSystemCouponService userSystemCouponService;
    @Resource
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponRecordServiceImpl.java
@@ -54,11 +54,6 @@
    }
    @Override
    public List<UserSystemCouponRecord> getCouponByUsingTimeOut(Long uid, Long seconds) {
        return userSystemCouponRecordMapper.getCouponByUsingTimeOut(uid, seconds);
    }
    @Override
    public boolean isSuccessMianDan(Integer source, String orderId) {
        List<String> orderList = new ArrayList<>();
        orderList.add(orderId);
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -10,7 +10,9 @@
import javax.annotation.Resource;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.DateUtil;
@@ -105,6 +107,7 @@
    private UserSystemCouponRecordService userSystemCouponRecordService;
    @Resource
    @Lazy
    private HongBaoV2Service hongBaoV2Service;
    @Resource
@@ -141,6 +144,7 @@
    private CommonOrderCountService commonOrderCountService;
    
    @Resource
    @Lazy
    private PushCouponService pushCouponService;
    
    @Resource
@@ -1754,9 +1758,11 @@
                    // 可使用、 可赠送
                    userCouponVO.setState(UserSystemCoupon.STATE_USE_GIVE);
                    // 返利奖励券- 跳转至已到账-已收货
                    jumpLink.put("state", "2");
                    jumpLink.put("type", "1");
                    // 订单列表
                    jumpLink.put("state", "2"); // 已收货
                    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"));
@@ -2145,16 +2151,10 @@
        userSystemCoupon.setUseTime(null);
        userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
        userSystemCoupon.setUpdateTime(new Date());
        userSystemCouponMapper.updateByPrimaryKey(userSystemCoupon);
        userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
        
        // 使用记录
        if  (record != null) {
            UserSystemCouponRecord useRecordUpdate = new UserSystemCouponRecord();
            useRecordUpdate.setId(record.getId());
            useRecordUpdate.setState(UserSystemCouponRecord.STATE_WAIT_TIME_OUT);
            useRecordUpdate.setUpdateTime(new Date());
            userSystemCouponRecordService.updateByPrimaryKeySelective(useRecordUpdate);
            if (CouponTypeEnum.welfareFreeCoupon.name().equals(record.getCouponType())) {
                userOtherMsgNotificationService.welfareCouponDrawBack(userSystemCoupon, record.getOrderNo());
            } else if (CouponTypeEnum.freeCoupon.name().equals(record.getCouponType())) {
@@ -2166,27 +2166,44 @@
    }
    
    
    @Async()
    @Transactional
    @Override
    public void sendBackTimeOutCoupon(Long uid) {
        // 超过10分钟   未被匹配的券
        List<UserSystemCouponRecord> list = userSystemCouponRecordService.getCouponByUsingTimeOut(uid, 600L);
        if (list == null || list.size() == 0) {
        // 商品相关的券
        List<SystemCoupon> couponList = systemCouponService.getGoodsCouponList();
        if (couponList == null || couponList.size() == 0) {
            return;
        }
        for (UserSystemCouponRecord couponRecord : list) {
            // 更新状态:匹配超时
            couponRecord.setState(UserSystemCouponRecord.STATE_WAIT_TIME_OUT);
            couponRecord.setUpdateTime(new Date());
            userSystemCouponRecordService.updateByPrimaryKeySelective(couponRecord);
        List<Long> list = new ArrayList<Long>();
        for (SystemCoupon systemCoupon: couponList) {
            list.add(systemCoupon.getId());
        }
        // 超过10分钟   未被匹配的免单券
        List<UserSystemCoupon> listUserCoupon = userSystemCouponMapper.getCouponByUsingTimeOut(uid, list, 600L);
        if (listUserCoupon == null || listUserCoupon.size() == 0) {
            return;
        }
        for (UserSystemCoupon userCoupon : listUserCoupon) {
            // 状态初始化
            UserSystemCoupon userSystemCoupon = couponRecord.getUserSystemCoupon();
            UserSystemCoupon userSystemCoupon = new UserSystemCoupon();
            userSystemCoupon.setId(userCoupon.getId());
            userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
            userSystemCoupon.setUseTime(null);
            userSystemCoupon.setUpdateTime(new Date());
            userSystemCouponMapper.updateByPrimaryKey(userSystemCoupon);
            userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
            UserSystemCouponRecord record = userSystemCouponRecordService.getNearByUserCouponId(userCoupon.getId());
            if (record != null) {
                UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
                couponRecord.setId(record.getId());
                couponRecord.setUpdateTime(new Date());
                couponRecord.setState(UserSystemCouponRecord.STATE_WAIT_TIME_OUT);
                userSystemCouponRecordService.updateByPrimaryKeySelective(couponRecord);
            }
        }
    }
@@ -2241,7 +2258,7 @@
            userSystemCoupon.setUseTime(null);
            userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
            userSystemCoupon.setUpdateTime(new Date());
            userSystemCouponMapper.updateByPrimaryKey(userSystemCoupon);
            userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
            
            // 使用记录
            UserSystemCouponRecord useRecord = userSystemCouponRecordService.getNearByUserCouponId(couponId);
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponRecordService.java
@@ -18,14 +18,6 @@
    public List<UserSystemCouponRecord> getRecordByOrderNoList(Integer source, List<String> list);
    /**
     * 查询正在使用中 超过时间仍未匹配到订单记录
     *
     * @param uid
     * @param seconds
     * @return
     */
    public List<UserSystemCouponRecord> getCouponByUsingTimeOut(Long uid, Long seconds);
    /**
     * 查询状态