提交代码

yy_dev
胡锐 2 years ago
parent 07b406e55a
commit f1c44be035
  1. 24
      service/src/main/java/com/hfkj/service/UserDiscountService.java
  2. 12
      service/src/main/java/com/hfkj/service/impl/BsTradeOrderRefundServiceImpl.java
  3. 8
      service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java
  4. 51
      service/src/main/java/com/hfkj/service/impl/UserDiscountServiceImpl.java

@ -0,0 +1,24 @@
package com.hfkj.service;
/**
* @className: UserDiscountService
* @author: HuRui
* @date: 2023/3/29
**/
public interface UserDiscountService {
/**
* 用户优惠券使用
* @param userDiscountId
* @param userPhone
*/
void userDiscountUse(Long userDiscountId,String userPhone);
/**
* 用户优惠券退回
* @param userDiscountId
* @param userPhone
*/
void userDiscountReturn(Long userDiscountId,String userPhone);
}

@ -5,10 +5,7 @@ import com.hfkj.channel.weixin.WeiXinPayService;
import com.hfkj.dao.BsTradeOrderRefundMapper; import com.hfkj.dao.BsTradeOrderRefundMapper;
import com.hfkj.entity.*; import com.hfkj.entity.*;
import com.hfkj.channel.lakala.LaKaLaTradeService; import com.hfkj.channel.lakala.LaKaLaTradeService;
import com.hfkj.service.BsStoreDiscountActivityPartakeUserService; import com.hfkj.service.*;
import com.hfkj.service.BsStoreDiscountActivityService;
import com.hfkj.service.BsTradeOrderRefundService;
import com.hfkj.service.BsTradeOrderService;
import com.hfkj.sysenum.PlatformTypeEnum; import com.hfkj.sysenum.PlatformTypeEnum;
import com.hfkj.sysenum.StoreDiscountActivityPartakeWayEnum; import com.hfkj.sysenum.StoreDiscountActivityPartakeWayEnum;
import com.hfkj.sysenum.TradeOrderStatusEnum; import com.hfkj.sysenum.TradeOrderStatusEnum;
@ -41,6 +38,9 @@ public class BsTradeOrderRefundServiceImpl implements BsTradeOrderRefundService
@Resource @Resource
private CCBTradeService ccbTradeService; private CCBTradeService ccbTradeService;
@Resource
private UserDiscountService userDiscountService;
@Resource @Resource
private WeiXinPayService weiXinPayService; private WeiXinPayService weiXinPayService;
@ -89,6 +89,10 @@ public class BsTradeOrderRefundServiceImpl implements BsTradeOrderRefundService
} }
} }
} }
if (tradeOrder.getUserDiscountId() != null) {
userDiscountService.userDiscountReturn(tradeOrder.getUserDiscountId(), tradeOrder.getUserPhone());
}
} }
return refund; return refund;

@ -1,5 +1,6 @@
package com.hfkj.service.impl; package com.hfkj.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
@ -51,6 +52,9 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService {
@Resource @Resource
private SoundService soundService; private SoundService soundService;
@Resource
private UserDiscountService userDiscountService;
@Override @Override
public void editOrder(BsTradeOrder tradeOrder) { public void editOrder(BsTradeOrder tradeOrder) {
if (tradeOrder.getId() == null) { if (tradeOrder.getId() == null) {
@ -215,6 +219,10 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService {
} }
} }
if (tradeOrder.getUserDiscountId() != null && StringUtils.isNotBlank(tradeOrder.getUserPhone())) {
userDiscountService.userDiscountUse(tradeOrder.getUserDiscountId(), tradeOrder.getUserPhone());
}
// 创建分账 // 创建分账
if (tradeOrder.getProfitSharingStatus().equals(true)) { if (tradeOrder.getProfitSharingStatus().equals(true)) {
tradeOrderProfitSharingService.createProfitSharing(tradeOrder); tradeOrderProfitSharingService.createProfitSharing(tradeOrder);

@ -0,0 +1,51 @@
package com.hfkj.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.config.CommonSysConst;
import com.hfkj.service.UserDiscountService;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* @className: UserDiscountServiceImpl
* @author: HuRui
* @date: 2023/3/29
**/
@Service("userDiscountService")
public class UserDiscountServiceImpl implements UserDiscountService {
@Override
public void userDiscountUse(Long userDiscountId, String userPhone) {
try {
Map<String, Object> param = new HashMap<>();
param.put("userDiscountId", userDiscountId);
param.put("userPhone", userPhone);
JSONObject jsonObject = HttpsUtils.doGet(CommonSysConst.getSysConfig().getHsg_domain_name() + "user/discount/hzfUserDiscountUse", param);
if (!jsonObject.getString("return_code").equals("000000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("return_data"));
}
} catch (Exception e) {
System.out.println(e);
}
}
@Override
public void userDiscountReturn(Long userDiscountId, String userPhone) {
try {
Map<String, Object> param = new HashMap<>();
param.put("userDiscountId", userDiscountId);
param.put("userPhone", userPhone);
JSONObject jsonObject = HttpsUtils.doGet(CommonSysConst.getSysConfig().getHsg_domain_name() + "user/discount/hzfUserDiscountReturn", param);
if (!jsonObject.getString("return_code").equals("000000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("return_data"));
}
} catch (Exception e) {
System.out.println(e);
}
}
}
Loading…
Cancel
Save