提交代码

dev-discount
袁野 3 years ago
commit 8ced2e2758
  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. 11
      hai-service/src/main/java/com/hai/service/HighDiscountPackageRecordService.java
  5. 20
      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) {
// 查询优惠券包
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(childOrder.getGoodsType().intValue());
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(childOrder.getGoodsId().intValue());
if (discountPackage == null) {
log.error("HighOrderController --> addOrder() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到优惠券包");
@ -259,6 +259,7 @@ public class HighOrderController {
childOrder.setGoodsName(discountPackage.getTitle());
childOrder.setGoodsImg(discountPackage.getListImg());
childOrder.setGoodsPrice(discountPackage.getPrice());
childOrder.setGoodsActualPrice(discountPackage.getPrice());
childOrder.setGoodsSpecName("默认");
}

@ -93,6 +93,12 @@ public class UnionPayController {
@Resource
private HighDiscountPackageActualService discountPackageActualService;
@Resource
private HighDiscountPackageService discountPackageService;
@Resource
private HighDiscountPackageRecordService discountPackageRecordService;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@ -312,7 +318,22 @@ public class UnionPayController {
for (HighDiscountPackageDiscountActual discount : discountList) {
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:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
}
}
}

@ -53,6 +53,26 @@ public class UnionStagingPayConfig {
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

@ -2,6 +2,7 @@ package com.hai.service;
import com.hai.entity.HighDiscountPackageRecord;
<<<<<<< HEAD
import java.util.List;
import java.util.Map;
@ -23,4 +24,14 @@ public interface HighDiscountPackageRecordService {
* @return java.util.List<com.hai.entity.HighDiscountPackageRecord>
*/
List<HighDiscountPackageRecord> getDiscountPackageRecord(Map<String , Object> map);
=======
public interface HighDiscountPackageRecordService {
/**
* 增加记录
* @param record
*/
void insertRecord(HighDiscountPackageRecord record);
>>>>>>> c91e5b70c15cdb86ee69f2771ce00208b0bbf4cb
}

@ -2,6 +2,7 @@ package com.hai.service.impl;
import com.hai.dao.HighDiscountPackageRecordMapper;
import com.hai.entity.HighDiscountPackageRecord;
<<<<<<< HEAD
import com.hai.entity.HighDiscountPackageRecordExample;
import com.hai.service.HighDiscountPackageRecordService;
import org.apache.commons.collections4.MapUtils;
@ -51,5 +52,24 @@ public class HighDiscountPackageRecordServiceImpl implements HighDiscountPackage
example.setOrderByClause("created_time");
return discountPackageRecordMapper.selectByExample(example);
=======
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);
>>>>>>> c91e5b70c15cdb86ee69f2771ce00208b0bbf4cb
}
}

@ -74,6 +74,12 @@ public class HighOrderServiceImpl implements HighOrderService {
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Resource
private HighDiscountPackageService discountPackageService;
@Resource
private HighDiscountPackageRecordService discountPackageRecordService;
@Resource
private HighMerchantStoreService highMerchantStoreService;
@ -179,6 +185,7 @@ public class HighOrderServiceImpl implements HighOrderService {
if (list == null || list.size() == 0) {
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).setStatus(2); // 状态: 1: 待分配 2:预分配(售卖)3:已分配
discountPackageActualService.updateHighDiscountPackageActual(list.get(0));
@ -339,7 +346,22 @@ public class HighOrderServiceImpl implements HighOrderService {
for (HighDiscountPackageDiscountActual discount : discountList) {
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:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
}
}
}
@ -617,7 +639,22 @@ public class HighOrderServiceImpl implements HighOrderService {
for (HighDiscountPackageDiscountActual discount : discountList) {
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:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
}
}
}
@ -976,6 +1013,17 @@ public class HighOrderServiceImpl implements HighOrderService {
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.已取消
}

@ -12,6 +12,7 @@ import com.hai.config.CommonSysConst;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.TuanYouConfig;
import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighDiscountPackageRecordMapper;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.dao.HighUserCouponMapper;
import com.hai.entity.*;
@ -98,6 +99,12 @@ public class GoodsOrderServiceImpl implements PayService {
@Resource
private HighDiscountPackageActualService discountPackageActualService;
@Resource
private HighDiscountPackageService discountPackageService;
@Resource
private HighDiscountPackageRecordService discountPackageRecordService;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@ -302,7 +309,22 @@ public class GoodsOrderServiceImpl implements PayService {
for (HighDiscountPackageDiscountActual discount : discountList) {
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:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
}
}
}

Loading…
Cancel
Save