mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
commit
0ebe725aa5
@ -56,13 +56,19 @@ public class CouponService {
|
||||
JSONObject jsonObjectResult = JSONObject.parseObject(result);
|
||||
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObjectResult.getString("data"));
|
||||
com.alibaba.fastjson.JSONArray afterFilterArrary = new JSONArray();
|
||||
Date nowDate =SmartDateUtil.parseYMD(SmartDateUtil.formatYMD(new Date()));
|
||||
for(int i = 0;i < jsonArray.size();i ++){
|
||||
JSONObject jsonResult = (JSONObject)jsonArray.get(i);
|
||||
if(jsonResult.getString("udf2") != null) {
|
||||
//优惠券有效过期时间
|
||||
Date compareDate = SmartDateUtil.parseYMD(jsonResult.get("fValidTo").toString());
|
||||
if ("H5".equals(jsonResult.getString("udf2"))&&"".equals(productCode)&&compareDate.compareTo(currentDate)!=-1) {
|
||||
//优惠券有效开始时间
|
||||
Date startDate = SmartDateUtil.parseYMD(jsonResult.get("fValidFrom").toString());
|
||||
if ("H5".equals(jsonResult.getString("udf2"))&&"".equals(productCode)&&compareDate.compareTo(currentDate)!=-1
|
||||
&& startDate.compareTo(nowDate) != 1) {
|
||||
afterFilterArrary.add(jsonResult);
|
||||
}else if ("H5".equals(jsonResult.getString("udf2"))&&!"".equals(productCode)&&compareDate.compareTo(currentDate)!=-1){
|
||||
}else if ("H5".equals(jsonResult.getString("udf2"))&&!"".equals(productCode)&&compareDate.compareTo(currentDate)!=-1
|
||||
&& startDate.compareTo(nowDate) != 1){
|
||||
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) {
|
||||
afterFilterArrary.add(jsonResult);
|
||||
|
@ -13,6 +13,7 @@ import net.lab1024.smartadmin.module.system.alipay.AliPayService;
|
||||
import net.lab1024.smartadmin.module.system.alipay.alipayModel.AliPayEntity;
|
||||
import net.lab1024.smartadmin.module.system.alipay.conf.AlipayConfig;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.CouponService;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.coupon.CouponCosumeEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.coupon.CouponGetAllEntity;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.constant.OrderResponseCodeConst;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderAddress;
|
||||
@ -137,6 +138,14 @@ public class OrderController {
|
||||
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
|
||||
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
|
||||
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);
|
||||
}
|
||||
ordersEntity.setOrderAddress(orderAddress);
|
||||
@ -247,6 +256,14 @@ public class OrderController {
|
||||
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
|
||||
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
|
||||
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);
|
||||
}
|
||||
ordersEntity.setOrderAddress(orderAddress);
|
||||
@ -356,6 +373,14 @@ public class OrderController {
|
||||
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
|
||||
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
|
||||
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);
|
||||
}
|
||||
ordersEntity.setOrderAddress(orderAddress);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.lab1024.smartadmin.module.system.royalcanin.good.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import net.lab1024.smartadmin.common.domain.ResponseDTO;
|
||||
@ -253,6 +254,10 @@ public class OrderService {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
String afterDecodeResult = AESUtil.decryptLinux(jsonObject.getString("data"), AESUtil.KEY);
|
||||
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(afterDecodeResult);
|
||||
//获取的是接收的数据
|
||||
jsonObject.put("data", jsonArray);
|
||||
result = JSONObject.toJSONString(jsonObject);
|
||||
|
||||
for (int i = 0; i < jsonArray.size();i++){
|
||||
JSONObject jsonObjectResult = (JSONObject)jsonArray.get(i);
|
||||
OrderEntity orderEntity = ordersDao.findByOrderId(jsonObjectResult.getString("orderNumber"));
|
||||
@ -277,6 +282,7 @@ public class OrderService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//记录服务响应时间
|
||||
addOperatreFullData(url+"orderMaster/query",queryEntity.toString(),result, startTime,elapsedTime,acceptTime);
|
||||
|
||||
@ -335,4 +341,5 @@ public class OrderService {
|
||||
public int updateOrder(String orderNumber){
|
||||
return ordersDao.updateByOrderNumber(orderNumber);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user