|
|
@@ -190,21 +190,21 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
|
|
|
|
|
|
List<String> strs = new ArrayList<>();
|
|
|
List<CardCouponPageVo> pageList = iPage.getPageList();
|
|
|
- if (pageList!=null&&pageList.size()>0) {
|
|
|
+ if (pageList != null && pageList.size() > 0) {
|
|
|
for (CardCouponPageVo data : iPage.getPageList()) {
|
|
|
if (!data.getHotelIds().contains(",") || data.getHotelIds().contains("-1")) {
|
|
|
strs.add(data.getHotelIds());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(strs.size() > 0){
|
|
|
+ if (strs.size() > 0) {
|
|
|
String hotelIds = StringUtils.join(strs, ",");
|
|
|
List<CouponModel> coupons = hotelCoupomService.getCoupon(hotelIds);
|
|
|
- if(coupons != null || coupons.size() > 0){
|
|
|
- for (CardCouponPageVo data:iPage.getPageList()) {
|
|
|
- if(!data.getHotelIds().contains(",") || data.getHotelIds().contains("-1")){
|
|
|
- Optional<CouponModel> d =coupons.stream().filter(e -> e.getId().equals(data.getHotelIds())).findFirst();
|
|
|
- if(d != null && d.isPresent()){
|
|
|
+ if (coupons != null && coupons.size() > 0) {
|
|
|
+ for (CardCouponPageVo data : iPage.getPageList()) {
|
|
|
+ if (!data.getHotelIds().contains(",") || data.getHotelIds().contains("-1")) {
|
|
|
+ Optional<CouponModel> d = coupons.stream().filter(e -> e.getId().equals(data.getHotelIds())).findFirst();
|
|
|
+ if (d != null && d.isPresent()) {
|
|
|
data.setTown(d.get().getName());
|
|
|
}
|
|
|
}
|
|
|
@@ -229,7 +229,7 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
|
|
|
*/
|
|
|
public JSONObject couponCollection() {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
- if (page <= 0 || rows <= 0||Func.checkNull(userId)) {
|
|
|
+ if (page <= 0 || rows <= 0 || Func.checkNull(userId)) {
|
|
|
jsonObject.put("code", 400);
|
|
|
jsonObject.put("success", false);
|
|
|
jsonObject.put("message", "未传入page,rows数据---evaluatePage");
|
|
|
@@ -239,7 +239,7 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
|
|
|
|
|
|
|
|
|
String date = DateUtil.getFormatPaternDate(new Date());
|
|
|
- IPage<CouponCollectionVo> iPage = hotelCoupomService.couponCollection(date, page, rows,userId);
|
|
|
+ IPage<CouponCollectionVo> iPage = hotelCoupomService.couponCollection(date, page, rows, userId);
|
|
|
jsonObject.put("code", 200);
|
|
|
jsonObject.put("success", true);
|
|
|
jsonObject.put("message", "成功");
|
|
|
@@ -301,9 +301,9 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
|
|
|
return null;
|
|
|
}
|
|
|
- String userId= hotelCouponStatus.getUserId();
|
|
|
+ String userId = hotelCouponStatus.getUserId();
|
|
|
// 通过优惠券id判断领券的张数是否大于等于每人限领次数,并且剩余张数不能为0
|
|
|
- Boolean quota = hotelCoupomService.quota(complaintId,userId);
|
|
|
+ Boolean quota = hotelCoupomService.quota(complaintId, userId);
|
|
|
if (!quota) {
|
|
|
jsonObject.put("code", 400);
|
|
|
jsonObject.put("success", false);
|
|
|
@@ -337,7 +337,7 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
|
|
|
public JSONObject usefulCoupon() {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
- if (Func.checkNull(hotelId) || Func.checkNull(userId) || totalPrice==null) {
|
|
|
+ if (Func.checkNull(hotelId) || Func.checkNull(userId) || totalPrice == null) {
|
|
|
jsonObject.put("code", 400);
|
|
|
jsonObject.put("success", false);
|
|
|
jsonObject.put("message", "缺少数据hotelId,userId,totalPrice---usefulCoupon");
|
|
|
@@ -353,7 +353,7 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- IPage<UsefulCouponVo> iPage = hotelCoupomService.usefulCoupon(hotelId, userId, page, rows,totalPrice);
|
|
|
+ IPage<UsefulCouponVo> iPage = hotelCoupomService.usefulCoupon(hotelId, userId, page, rows, totalPrice);
|
|
|
|
|
|
jsonObject.put("code", 200);
|
|
|
jsonObject.put("success", true);
|
|
|
@@ -447,8 +447,8 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
|
|
|
} else if (2 == type1) {
|
|
|
// 满减金额
|
|
|
Double meetPrice = hotelCoupon.getMeetPrice();
|
|
|
- if (meetPrice==null||meetPrice<0) {
|
|
|
- meetPrice=0.0;
|
|
|
+ if (meetPrice == null || meetPrice < 0) {
|
|
|
+ meetPrice = 0.0;
|
|
|
}
|
|
|
BigDecimal meetPriceBigDecimal = new BigDecimal(meetPrice);
|
|
|
|
|
|
@@ -464,7 +464,7 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
|
|
|
|
|
|
// 享受的折扣
|
|
|
Double rebatePrice = hotelCoupon.getRebatePrice();
|
|
|
- BigDecimal rebatePriceBigDecimal = new BigDecimal(rebatePrice/10);
|
|
|
+ BigDecimal rebatePriceBigDecimal = new BigDecimal(rebatePrice / 10);
|
|
|
|
|
|
// 最大减免金额
|
|
|
Double maxDeduction = hotelCoupon.getMaxDeduction();
|
|
|
@@ -483,7 +483,7 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
|
|
|
useCouponsVo.setDiscountAmount(subtract1.doubleValue());
|
|
|
} else if (v < v1) {
|
|
|
useCouponsVo.setDiscountAmount(maxDeduction);
|
|
|
- }else if (v==v1){
|
|
|
+ } else if (v == v1) {
|
|
|
useCouponsVo.setDiscountAmount(maxDeduction);
|
|
|
}
|
|
|
|
|
|
@@ -561,7 +561,7 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
|
|
|
hotelCoupon.setReversedNumber(hotelCoupon.getReversedNumber() + 1);
|
|
|
hotelCouponStatus.setStatus(2);
|
|
|
|
|
|
- int i = hotelCoupomService.useCoupons( hotelCoupon, hotelCouponStatus);
|
|
|
+ int i = hotelCoupomService.useCoupons(hotelCoupon, hotelCouponStatus);
|
|
|
if (i > 0) {
|
|
|
jsonObject.put("code", 200);
|
|
|
jsonObject.put("success", true);
|