yujian
2020-01-18 f4a0f2acc63d7785eab108419a4e16f5f688cb95
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java
@@ -19,8 +19,8 @@
import com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.UserLotteryRecord;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.entity.system.SystemCoupon;
import com.yeshi.fanli.exception.user.UserInfoExtraException;
import com.yeshi.fanli.exception.user.UserLotteryRecordException;
import com.yeshi.fanli.exception.user.UserSystemCouponException;
import com.yeshi.fanli.service.inter.config.ConfigService;
@@ -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;
   /**
    * 用户券列表查询
@@ -103,7 +105,7 @@
         // 福利中心图片
         String topPicture = null;
         if (page == 1) {
            List<SwiperPicture> listswiper = swiperPictureService.getByBannerCard("welfare_top");
            List<SwiperPicture> listswiper = swiperPictureService.getByBannerCardAndVersion("welfare_top",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
            if (listswiper != null && listswiper.size() > 0) {
               topPicture = listswiper.get(0).getSrc();
            }
@@ -142,14 +144,11 @@
                  UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                  // 未读券是否大于0
                  if (userInfoExtra != null && userInfoExtra.getCouponNews() > 0) {
                     userInfoExtra.setCouponNews(0);
                     try {
                        userInfoExtraService.saveUserInfoExtra(userInfoExtra);
                     } catch (UserInfoExtraException e) {
                        e.printStackTrace();
                     }
                     UserInfoExtra extra = new UserInfoExtra();
                     extra.setId(userInfoExtra.getId());
                     extra.setCouponNews(0);
                     userInfoExtraService.updateByPrimaryKeySelective(extra);
                  }
               }
            });
         }
@@ -186,11 +185,11 @@
         }
         JSONObject dataTip = new JSONObject();
         dataTip.put("content", configService.get("free_coupon_tip"));
         dataTip.put("content", configService.get(ConfigKeyEnum.freeCouponTip.getKey()));
         dataTip.put("fontColor", "#F14242");
         JSONObject data = new JSONObject();
         data.put("helpLink", configService.get("free_coupon_help"));
         data.put("helpLink", configService.get(ConfigKeyEnum.freeCouponHelp.getKey()));
         data.put("tip", dataTip);
         data.put("count", resultList.size());
         data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
@@ -259,7 +258,7 @@
         }
         JSONObject data = new JSONObject();
         data.put("helpLink", configService.get("reward_coupon_help"));
         data.put("helpLink", configService.get(ConfigKeyEnum.rewardCouponHelp.getKey()));
         data.put("count", resultList.size());
         data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
@@ -289,13 +288,18 @@
         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()));
@@ -365,7 +369,7 @@
    * @param uid
    * @param out
    */
   @RequestMapping(value = "getLotteryCount")
   // @RequestMapping(value = "getLotteryCount")
   public void getLotteryCount(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
      try {
         // 1、已登录系统
@@ -399,7 +403,7 @@
            count = count - list.size();
         }
         // 抽奖规则
         String lotteryRule = configService.get("lottery_rule_newbies");
         String lotteryRule = configService.get(ConfigKeyEnum.lotteryRuleNewbies.getKey());
         
         JSONObject data = new JSONObject();
         data.put("count", count);
@@ -420,7 +424,7 @@
    * @param uid
    * @param out
    */
   @RequestMapping(value = "getLotteryResult")
   // @RequestMapping(value = "getLotteryResult")
   public void getLotteryResult(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
      try {
@@ -546,7 +550,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)));
@@ -565,7 +569,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)));