|
|
|
|
@@ -12,6 +12,8 @@ import net.lab1024.smartadmin.constant.SwaggerTagConst;
|
|
|
|
|
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.CouponGetAllEntity;
|
|
|
|
|
import net.lab1024.smartadmin.module.system.royalcanin.good.constant.OrderResponseCodeConst;
|
|
|
|
|
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderAddress;
|
|
|
|
|
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
|
|
|
|
|
@@ -51,6 +53,9 @@ public class OrderController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private CartService cartService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private CouponService couponService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "微信支付订单", notes = "生成订单")
|
|
|
|
|
@PostMapping("royalcanin/generateOrderWX")
|
|
|
|
|
@@ -76,10 +81,18 @@ public class OrderController {
|
|
|
|
|
orderDatilListEntity.setEcPrice(ordersEntitys.getPayAmount());
|
|
|
|
|
orderDatilListJson.add(orderDatilListEntity);
|
|
|
|
|
if(ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) {
|
|
|
|
|
ordersEntity.setCouponAmount(ordersEntitys.getCouponAmount());
|
|
|
|
|
ordersEntity.setCouponCode(ordersEntitys.getCouponCode());
|
|
|
|
|
ordersEntity.setCouponName(ordersEntitys.getCouponName());
|
|
|
|
|
ordersEntity.setCouponId(ordersEntitys.getCouponId());
|
|
|
|
|
CouponGetAllEntity couponGetAllEntity = new CouponGetAllEntity ();
|
|
|
|
|
couponGetAllEntity.setMemberId(ordersEntitys.getMemberId());
|
|
|
|
|
couponGetAllEntity.setCouponCode(ordersEntitys.getCouponCode());
|
|
|
|
|
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
|
|
|
|
|
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
|
|
|
|
|
JSONObject jsonObjectData = (JSONObject)jsonArray.get(0);
|
|
|
|
|
|
|
|
|
|
ordersEntity.setCouponAmount(jsonObjectData.getString("couponAmount") == null ?jsonObjectData.getString("discount"):jsonObjectData.getString("couponAmount"));
|
|
|
|
|
ordersEntity.setCouponCode(jsonObjectData.getString("couponCode"));
|
|
|
|
|
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
|
|
|
|
|
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
|
|
|
|
|
total_fee = total_fee + orderService.couponTotal(ordersEntitys.getCouponTypeId(),Double.parseDouble(ordersEntitys.getCouponAmount()),Double.parseDouble(ordersEntitys.getPayAmount()),ordersEntitys.getBuyCount());
|
|
|
|
|
}else{
|
|
|
|
|
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount() ;
|
|
|
|
|
@@ -254,7 +267,7 @@ public class OrderController {
|
|
|
|
|
AliPayEntity aliPayEntity = new AliPayEntity();
|
|
|
|
|
ordersEntity.setPayType("2");
|
|
|
|
|
ordersEntity.setOrderStatus("0");
|
|
|
|
|
if (orderService.updateOrder(ordersEntity) == 1) {
|
|
|
|
|
if (orderService.updateOrder(ordersEntity.getOrderNo()) == 1) {
|
|
|
|
|
aliPayEntity.setProduct_code(ordersEntity.getProductCode());
|
|
|
|
|
aliPayEntity.setTotal_amount(ordersEntity.getOrderAmount());
|
|
|
|
|
aliPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
|
|
|
|
|