Merge pull request !242 from Admin/LTL_20220314
This commit is contained in:
Admin 2022-03-18 02:52:38 +00:00 committed by Gitee
commit b55269b686
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 4 additions and 27 deletions

View File

@ -7,6 +7,7 @@ import net.lab1024.smartadmin.module.system.royalcanin.coupon.*;
import net.lab1024.smartadmin.util.MapRemoveNullUtil; import net.lab1024.smartadmin.util.MapRemoveNullUtil;
import net.lab1024.smartadmin.util.SmartDateUtil; import net.lab1024.smartadmin.util.SmartDateUtil;
import net.lab1024.smartadmin.util.SmartHttpUtil; import net.lab1024.smartadmin.util.SmartHttpUtil;
import net.lab1024.smartadmin.util.SmartStringUtil;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -64,10 +65,10 @@ public class CouponService {
Date compareDate = SmartDateUtil.parseYMD(jsonResult.get("fValidTo").toString()); Date compareDate = SmartDateUtil.parseYMD(jsonResult.get("fValidTo").toString());
//优惠券有效开始时间 //优惠券有效开始时间
Date startDate = SmartDateUtil.parseYMD(jsonResult.get("fValidFrom").toString()); Date startDate = SmartDateUtil.parseYMD(jsonResult.get("fValidFrom").toString());
if ("H5".equals(jsonResult.getString("udf2"))&&"".equals(productCode)) { if ("H5".equals(jsonResult.getString("udf2"))&& SmartStringUtil.isBlank(couponGetAllEntity.getProductCodes())) {
afterFilterArrary.add(jsonResult); afterFilterArrary.add(jsonResult);
}else if ("H5".equals(jsonResult.getString("udf2"))&&!"".equals(productCode)&&compareDate.compareTo(currentDate)!=-1 }else if ("H5".equals(jsonResult.getString("udf2"))&& SmartStringUtil.isNotBlank(couponGetAllEntity.getProductCodes()) &&compareDate.compareTo(currentDate)!=-1
&& startDate.compareTo(nowDate) != 1){ && startDate.compareTo(nowDate) != 1 && compareDate.compareTo(nowDate) != -1){
for(int g = 0 ;g<productCode.length;g++) { for(int g = 0 ;g<productCode.length;g++) {
if ((jsonResult.get("productCodes") != null ? jsonResult.get("productCodes").toString().indexOf(productCode[g]) : "".indexOf(productCode[g])) != -1 || jsonResult.get("productCodes") == null) { if ((jsonResult.get("productCodes") != null ? jsonResult.get("productCodes").toString().indexOf(productCode[g]) : "".indexOf(productCode[g])) != -1 || jsonResult.get("productCodes") == null) {
afterFilterArrary.add(jsonResult); afterFilterArrary.add(jsonResult);

View File

@ -138,14 +138,6 @@ public class OrderController {
ordersEntity.setCouponName(jsonObjectData.getString("couponName")); ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
ordersEntity.setCouponId(jsonObjectData.getString("couponId")); ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId")); ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId"));
//通过传优惠券码锁定优惠券
CouponCosumeEntity couponCosumeEntity = new CouponCosumeEntity();
couponCosumeEntity.setCouponCode(jsonObjectData.getString("couponCode"));
String result = couponService.couponCosume(couponCosumeEntity);
JSONObject couponJsonResult = JSONObject.parseObject(result);
if(!"0".equals(couponJsonResult.getString("code"))){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee); total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
} }
ordersEntity.setOrderAddress(orderAddress); ordersEntity.setOrderAddress(orderAddress);
@ -256,14 +248,6 @@ public class OrderController {
ordersEntity.setCouponName(jsonObjectData.getString("couponName")); ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
ordersEntity.setCouponId(jsonObjectData.getString("couponId")); ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId")); ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId"));
//通过传优惠券码锁定优惠券
CouponCosumeEntity couponCosumeEntity = new CouponCosumeEntity();
couponCosumeEntity.setCouponCode(jsonObjectData.getString("couponCode"));
String result = couponService.couponCosume(couponCosumeEntity);
JSONObject couponJsonResult = JSONObject.parseObject(result);
if(!"0".equals(couponJsonResult.getString("code"))){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee); total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
} }
ordersEntity.setOrderAddress(orderAddress); ordersEntity.setOrderAddress(orderAddress);
@ -373,14 +357,6 @@ public class OrderController {
ordersEntity.setCouponName(jsonObjectData.getString("couponName")); ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
ordersEntity.setCouponId(jsonObjectData.getString("couponId")); ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId")); ordersEntity.setCouponTypeId(jsonObjectData.getString("couponTypeId"));
//通过传优惠券码锁定优惠券
CouponCosumeEntity couponCosumeEntity = new CouponCosumeEntity();
couponCosumeEntity.setCouponCode(jsonObjectData.getString("couponCode"));
String result = couponService.couponCosume(couponCosumeEntity);
JSONObject couponJsonResult = JSONObject.parseObject(result);
if(!"0".equals(couponJsonResult.getString("code"))){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee); total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
} }
ordersEntity.setOrderAddress(orderAddress); ordersEntity.setOrderAddress(orderAddress);