yujian
2019-12-07 8c93d2e3b22ac543f8f94c2cf0eb982258fb708b
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;
   /**
    * 用户券列表查询
@@ -119,13 +121,11 @@
            changeJump = true;
         }
         
         long count = 0;
         long count = UserSystemCouponService.countCouponOld(uid);
         List<UserSystemCouponVO> resultList = UserSystemCouponService
               .getUserCouponVOList((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, changeJump);
         if (resultList != null && resultList.size() > 0) {
            count = UserSystemCouponService.countUserCouponList(uid);
         } else if (resultList == null) {
          if (resultList == null) {
            resultList = new ArrayList<UserSystemCouponVO>();
         }
@@ -216,14 +216,18 @@
    * @param out
    */
   @RequestMapping(value = "useFreeCoupon", method = RequestMethod.POST)
   public void useFreeCoupon(AcceptData acceptData, Long uid, Long cid, Long goodId, PrintWriter out) {
   public void useFreeCoupon(AcceptData acceptData, Long uid, Long cid, Long goodId, Integer goodsType, PrintWriter out) {
      if (uid == null) {
         out.print(JsonUtil.loadFalseResult("用户未登录"));
         return;
      }
      if (goodsType == null || goodsType > 3 || goodsType < 1) {
         goodsType = Constant.SOURCE_TYPE_TAOBAO;
      }
      try {
         UserSystemCouponService.useGoodsCoupon(uid, cid, goodId);
         UserSystemCouponService.useGoodsCoupon(uid, cid, goodId, goodsType);
         out.print(JsonUtil.loadTrueResult("使用成功"));
      } catch (UserSystemCouponException e) {
         out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
@@ -287,17 +291,19 @@
         return;
      }
      if (userVIPInfoService.isVIP(uid)) {
         out.print(JsonUtil.loadFalseResult("超级会员不可使用奖励券"));
         return;
      }
      if (goodsType == null || goodsType > 3 || goodsType < 1) {
         goodsType = Constant.SOURCE_TYPE_TAOBAO;
      }
      
      try {
         UserSystemCouponService.useOrderCoupon(uid, cid, orderNo, goodsType);
         JSONObject data = commonOrderService.getRewardJumpInfo(orderNo);
         UserSystemCouponService.useOrderCoupon(uid, cid, orderNo, goodsType, acceptData);
         JSONObject data = commonOrderService.getRewardJumpInfo(orderNo, goodsType);
         out.print(JsonUtil.loadTrueResult(data));
      } catch (UserSystemCouponException e) {
         out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
      } catch (Exception e) {
@@ -314,17 +320,16 @@
    * @param out
    */
   @RequestMapping(value = "getRewardRecord", method = RequestMethod.POST)
   public void getRewardCounponRecord(AcceptData acceptData, String orderNo, PrintWriter out) {
   public void getRewardCounponRecord(AcceptData acceptData, String orderNo, Integer goodsType, PrintWriter out) {
      try {
         UserSystemCouponRecordVO rewardRecord = UserSystemCouponService.getRewardCouponRecord(orderNo);
         if (goodsType == null || goodsType > 3 || goodsType < 1) {
            goodsType = Constant.SOURCE_TYPE_TAOBAO;
         }
         UserSystemCouponRecordVO rewardRecord = UserSystemCouponService.getRewardCouponRecord(orderNo, goodsType);
         JSONObject data = new JSONObject();
         data.put("rewardRecord", rewardRecord);
         out.print(JsonUtil.loadTrueResult(data));
      } catch (UserSystemCouponException e) {
         out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
      } catch (Exception e) {
@@ -341,17 +346,16 @@
    * @param out
    */
   @RequestMapping(value = "getFreeCounponRecord", method = RequestMethod.POST)
   public void getFreeCounponRecord(AcceptData acceptData, String orderNo, PrintWriter out) {
   public void getFreeCounponRecord(AcceptData acceptData, String orderNo, Integer goodsType, PrintWriter out) {
      try {
         UserSystemCouponRecordVO rewardRecord = UserSystemCouponService.getFreeCouponRecord(orderNo);
         if (goodsType == null || goodsType > 3 || goodsType < 1) {
            goodsType = Constant.SOURCE_TYPE_TAOBAO;
         }
         UserSystemCouponRecordVO rewardRecord = UserSystemCouponService.getFreeCouponRecord(orderNo, goodsType);
         JSONObject data = new JSONObject();
         data.put("frreCouponRecord", rewardRecord);
         out.print(JsonUtil.loadTrueResult(data));
      } catch (UserSystemCouponException e) {
         out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
      } catch (Exception e) {
@@ -368,7 +372,7 @@
    * @param uid
    * @param out
    */
   @RequestMapping(value = "getLotteryCount")
   // @RequestMapping(value = "getLotteryCount")
   public void getLotteryCount(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
      try {
         // 1、已登录系统
@@ -423,7 +427,7 @@
    * @param uid
    * @param out
    */
   @RequestMapping(value = "getLotteryResult")
   // @RequestMapping(value = "getLotteryResult")
   public void getLotteryResult(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
      try {
@@ -549,7 +553,7 @@
    * @param uid
    * @param out
    */
   @RequestMapping(value = "getDailyCount")
   // @RequestMapping(value = "getDailyCount")
   public void getDailyCount(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
      try {
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(userLotteryRecordService.getLotteryCountDaily(uid)));
@@ -568,7 +572,7 @@
    * @param uid
    * @param out
    */
   @RequestMapping(value = "getDailyResult")
   // @RequestMapping(value = "getDailyResult")
   public void getDailyResult(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
      try {
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(userLotteryRecordService.executeLotteryDaily(uid)));