提交代码

dev-discount
胡锐 3 years ago
parent ed66ef1c47
commit c91e5b70c1
  1. 3
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  2. 21
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java
  3. 20
      hai-service/src/main/java/com/hai/config/UnionStagingPayConfig.java
  4. 13
      hai-service/src/main/java/com/hai/service/HighDiscountPackageRecordService.java
  5. 23
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageRecordServiceImpl.java
  6. 48
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  7. 22
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

@ -242,7 +242,7 @@ public class HighOrderController {
if (childOrder.getGoodsType() == 7) { if (childOrder.getGoodsType() == 7) {
// 查询优惠券包 // 查询优惠券包
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(childOrder.getGoodsType().intValue()); HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(childOrder.getGoodsId().intValue());
if (discountPackage == null) { if (discountPackage == null) {
log.error("HighOrderController --> addOrder() error!", ""); log.error("HighOrderController --> addOrder() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到优惠券包"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到优惠券包");
@ -259,6 +259,7 @@ public class HighOrderController {
childOrder.setGoodsName(discountPackage.getTitle()); childOrder.setGoodsName(discountPackage.getTitle());
childOrder.setGoodsImg(discountPackage.getListImg()); childOrder.setGoodsImg(discountPackage.getListImg());
childOrder.setGoodsPrice(discountPackage.getPrice()); childOrder.setGoodsPrice(discountPackage.getPrice());
childOrder.setGoodsActualPrice(discountPackage.getPrice());
childOrder.setGoodsSpecName("默认"); childOrder.setGoodsSpecName("默认");
} }

@ -93,6 +93,12 @@ public class UnionPayController {
@Resource @Resource
private HighDiscountPackageActualService discountPackageActualService; private HighDiscountPackageActualService discountPackageActualService;
@Resource
private HighDiscountPackageService discountPackageService;
@Resource
private HighDiscountPackageRecordService discountPackageRecordService;
@Resource @Resource
private HighDiscountUserRelService highDiscountUserRelService; private HighDiscountUserRelService highDiscountUserRelService;
@ -312,7 +318,22 @@ public class UnionPayController {
for (HighDiscountPackageDiscountActual discount : discountList) { for (HighDiscountPackageDiscountActual discount : discountList) {
highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId()); highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId());
} }
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(actual.getDiscountPackageId());
HighDiscountPackageRecord record = new HighDiscountPackageRecord();
record.setDiscountPackageId(discountPackage.getId());
record.setDiscountPackageTitle(discountPackage.getTitle());
record.setUsingAttribution(discountPackage.getUsingAttribution());
record.setCompanyId(discountPackage.getCompanyId());
record.setOrderId(order.getId().intValue());
record.setChildOrderId(highChildOrder.getId().intValue());
record.setRecordNo(System.currentTimeMillis()+"");
record.setSalesType(1);
record.setPrice(order.getPayPrice());
record.setUserId(order.getMemId().intValue());
discountPackageRecordService.insertRecord(record);
actual.setAllocationTime(new Date());
actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配 actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
} }
} }
} }

@ -53,6 +53,26 @@ public class UnionStagingPayConfig {
return responseParam; return responseParam;
} }
public static JSONObject query(String orderNo, String orgTrace, BigDecimal payPrice, String openId, String notifyUrl) throws Exception {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId());
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode());
paramMap.put("orgTermNo", CommonSysConst.getSysConfig().getUnionStagingPayOrgTermNo());
paramMap.put("orgTrace", orgTrace);
paramMap.put("prodCode", "ISYH");
paramMap.put("signType", "RSA");
Map<String, Object> bizDataMap = new HashMap<>();
bizDataMap.put("transAmt", payPrice.multiply(new BigDecimal("100")).intValue());
bizDataMap.put("openId", openId);
bizDataMap.put("notifyUrl", notifyUrl);
paramMap.put("bizData", bizDataMap);
paramMap.put("sign", generateSign(bizDataMap));
JSONObject responseParam = HttpsUtils.doPost(CommonSysConst.getSysConfig().getUnionStagingPayUrl()+"cashier/trade/query", paramMap, new HashMap<>());
return responseParam;
}
/** /**
* 参数排序 * 参数排序
* @param param * @param param

@ -0,0 +1,13 @@
package com.hai.service;
import com.hai.entity.HighDiscountPackageRecord;
public interface HighDiscountPackageRecordService {
/**
* 增加记录
* @param record
*/
void insertRecord(HighDiscountPackageRecord record);
}

@ -0,0 +1,23 @@
package com.hai.service.impl;
import com.hai.dao.HighDiscountPackageRecordMapper;
import com.hai.entity.HighDiscountPackageRecord;
import com.hai.service.HighDiscountPackageRecordService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
@Service("discountPackageRecordService")
public class HighDiscountPackageRecordServiceImpl implements HighDiscountPackageRecordService {
@Resource
private HighDiscountPackageRecordMapper highDiscountPackageRecordMapper;
@Override
public void insertRecord(HighDiscountPackageRecord record) {
record.setCreatedTime(new Date());
record.setStatus(1);
highDiscountPackageRecordMapper.insert(record);
}
}

@ -74,6 +74,12 @@ public class HighOrderServiceImpl implements HighOrderService {
@Resource @Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService; private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Resource
private HighDiscountPackageService discountPackageService;
@Resource
private HighDiscountPackageRecordService discountPackageRecordService;
@Resource @Resource
private HighMerchantStoreService highMerchantStoreService; private HighMerchantStoreService highMerchantStoreService;
@ -179,6 +185,7 @@ public class HighOrderServiceImpl implements HighOrderService {
if (list == null || list.size() == 0) { if (list == null || list.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_STOCK_INSUFFICIENT, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_STOCK_INSUFFICIENT, "");
} }
list.get(0).setUserId(highOrder.getMemId().intValue());
list.get(0).setChildOrderId(childOrder.getId()); list.get(0).setChildOrderId(childOrder.getId());
list.get(0).setStatus(2); // 状态: 1: 待分配 2:预分配(售卖)3:已分配 list.get(0).setStatus(2); // 状态: 1: 待分配 2:预分配(售卖)3:已分配
discountPackageActualService.updateHighDiscountPackageActual(list.get(0)); discountPackageActualService.updateHighDiscountPackageActual(list.get(0));
@ -339,7 +346,22 @@ public class HighOrderServiceImpl implements HighOrderService {
for (HighDiscountPackageDiscountActual discount : discountList) { for (HighDiscountPackageDiscountActual discount : discountList) {
highDiscountUserRelService.receiveDiscount(highOrder.getMemId(), discount.getAgentDiscountCodeId()); highDiscountUserRelService.receiveDiscount(highOrder.getMemId(), discount.getAgentDiscountCodeId());
} }
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(actual.getDiscountPackageId());
HighDiscountPackageRecord record = new HighDiscountPackageRecord();
record.setDiscountPackageId(discountPackage.getId());
record.setDiscountPackageTitle(discountPackage.getTitle());
record.setUsingAttribution(discountPackage.getUsingAttribution());
record.setCompanyId(discountPackage.getCompanyId());
record.setOrderId(highOrder.getId().intValue());
record.setChildOrderId(highChildOrder.getId().intValue());
record.setRecordNo(System.currentTimeMillis()+"");
record.setSalesType(1);
record.setPrice(highOrder.getPayPrice());
record.setUserId(highOrder.getMemId().intValue());
discountPackageRecordService.insertRecord(record);
actual.setAllocationTime(new Date());
actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配 actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
} }
} }
} }
@ -617,7 +639,22 @@ public class HighOrderServiceImpl implements HighOrderService {
for (HighDiscountPackageDiscountActual discount : discountList) { for (HighDiscountPackageDiscountActual discount : discountList) {
highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId()); highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId());
} }
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(actual.getDiscountPackageId());
HighDiscountPackageRecord record = new HighDiscountPackageRecord();
record.setDiscountPackageId(discountPackage.getId());
record.setDiscountPackageTitle(discountPackage.getTitle());
record.setUsingAttribution(discountPackage.getUsingAttribution());
record.setCompanyId(discountPackage.getCompanyId());
record.setOrderId(order.getId().intValue());
record.setChildOrderId(highChildOrder.getId().intValue());
record.setRecordNo(System.currentTimeMillis()+"");
record.setSalesType(1);
record.setPrice(order.getPayPrice());
record.setUserId(order.getMemId().intValue());
discountPackageRecordService.insertRecord(record);
actual.setAllocationTime(new Date());
actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配 actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
} }
} }
} }
@ -976,6 +1013,17 @@ public class HighOrderServiceImpl implements HighOrderService {
highCouponCodeService.updateCouponCode(couponCode); highCouponCodeService.updateCouponCode(couponCode);
} }
} }
if (highChildOrder.getGoodsType() == 7) {
HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId());
if (actual != null) {
actual.setChildOrderId(null);
actual.setUserId(null);
actual.setStatus(1);
discountPackageActualService.updateHighDiscountPackageActual(actual);
}
}
highChildOrder.setChildOrdeStatus(5); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 highChildOrder.setChildOrdeStatus(5); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
} }

@ -12,6 +12,7 @@ import com.hai.config.CommonSysConst;
import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongConfig;
import com.hai.config.TuanYouConfig; import com.hai.config.TuanYouConfig;
import com.hai.dao.HighCouponCodeOtherMapper; import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighDiscountPackageRecordMapper;
import com.hai.dao.HighGasOrderPushMapper; import com.hai.dao.HighGasOrderPushMapper;
import com.hai.dao.HighUserCouponMapper; import com.hai.dao.HighUserCouponMapper;
import com.hai.entity.*; import com.hai.entity.*;
@ -98,6 +99,12 @@ public class GoodsOrderServiceImpl implements PayService {
@Resource @Resource
private HighDiscountPackageActualService discountPackageActualService; private HighDiscountPackageActualService discountPackageActualService;
@Resource
private HighDiscountPackageService discountPackageService;
@Resource
private HighDiscountPackageRecordService discountPackageRecordService;
@Resource @Resource
private HighDiscountUserRelService highDiscountUserRelService; private HighDiscountUserRelService highDiscountUserRelService;
@ -302,7 +309,22 @@ public class GoodsOrderServiceImpl implements PayService {
for (HighDiscountPackageDiscountActual discount : discountList) { for (HighDiscountPackageDiscountActual discount : discountList) {
highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId()); highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId());
} }
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(actual.getDiscountPackageId());
HighDiscountPackageRecord record = new HighDiscountPackageRecord();
record.setDiscountPackageId(discountPackage.getId());
record.setDiscountPackageTitle(discountPackage.getTitle());
record.setUsingAttribution(discountPackage.getUsingAttribution());
record.setCompanyId(discountPackage.getCompanyId());
record.setOrderId(order.getId().intValue());
record.setChildOrderId(highChildOrder.getId().intValue());
record.setRecordNo(System.currentTimeMillis()+"");
record.setSalesType(1);
record.setPrice(order.getPayPrice());
record.setUserId(order.getMemId().intValue());
discountPackageRecordService.insertRecord(record);
actual.setAllocationTime(new Date());
actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配 actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
} }
} }
} }

Loading…
Cancel
Save