| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserLotteryRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 用户奖励券
|
| | | * |
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getOrderCouponList", method = RequestMethod.POST)
|
| | | public void getOrderCouponList(AcceptData acceptData, Long uid, String orderNo, PrintWriter out) {
|
| | |
|
| | | if (uid == null || StringUtil.isNullOrEmpty(orderNo)) {
|
| | | out.print(JsonUtil.loadFalseResult("传递参数信息不完整"));
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | | List<CommonOrder> listOrder = commonOrderService.getByOrderNo(uid, orderNo);
|
| | | if (listOrder == null || listOrder.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("订单号不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | boolean valid = false;
|
| | | long limitDate = TimeUtil.convertDateToTemp("2019-09-01");
|
| | | for (CommonOrder commonOrder: listOrder) {
|
| | | Integer wholeOrder = commonOrder.getStateWholeOrder();
|
| | | if (wholeOrder != null && CommonOrder.STATE_WHOLE_ORDER_SHIXIAO == wholeOrder) {
|
| | | out.print(JsonUtil.loadFalseResult("整个订单已失效"));
|
| | | return;
|
| | | }
|
| | | |
| | | Date thirdCreateTime = commonOrder.getThirdCreateTime();
|
| | | if (thirdCreateTime != null && thirdCreateTime.getTime() > limitDate) {
|
| | | valid = true; // 1.6.5上线之后下单
|
| | | }
|
| | | }
|
| | | |
| | | try {
|
| | | |
| | | List<UserSystemCouponVO> resultList = null;
|
| | | if (valid) { |
| | | resultList = UserSystemCouponService.getOrderCouponList(uid);
|
| | | } else {
|
| | | resultList = UserSystemCouponService.listIncludeNotExchange(uid);
|
| | | }
|
| | | |
| | | if (resultList == null) {
|
| | | resultList = new ArrayList<UserSystemCouponVO>();
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("helpLink", configService.get("reward_coupon_help"));
|
| | | data.put("count", resultList.size());
|
| | | data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserSystemCouponException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "查询失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|