Просмотр исходного кода

Merge branch 'release_toaliyun_real_20230315' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real_20230315

release_toaliyun_real
lin 3 лет назад
Родитель
Сommit
9cc8fa33d1
6 измененных файлов: 70 добавлений и 40 удалений
  1. +12
    -2
      mallinkBApi/src/main/java/com/iformall/controller/WxCardInfoController.java
  2. +1
    -0
      mallinkBApi/src/main/java/com/iformall/controller/WxCardPayController.java
  3. +0
    -2
      mallinkBApi/src/main/java/com/iformall/controller/WxPayAccountController.java
  4. +4
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumCardSpendStatus.java
  5. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  6. +52
    -34
      mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java

+ 12
- 2
mallinkBApi/src/main/java/com/iformall/controller/WxCardInfoController.java Просмотреть файл

@@ -90,7 +90,7 @@ public class WxCardInfoController extends BaseController {
@GetMapping("detail")
@ApiImplicitParams({
@ApiImplicitParam(name = "dynamicId", value = "动态码ID", dataType = "String", paramType = "query", required = true)})
public ResultData detail(String dynamicId) {
public ResultData detail(String dynamicId,Integer type) {
if (StringUtils.isBlank(dynamicId) || dynamicId.equalsIgnoreCase(Constant.UNDEFINED)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardId不能为空");
}
@@ -111,7 +111,17 @@ public class WxCardInfoController extends BaseController {
map.put("amount", cardInfo.getAmount());
map.put("remainAmount", cardInfo.getRemainingAmount());
map.put("cardType", cardInfo.getType());
}else {
}else if(type != null && type.intValue() == 0){
isECard = true;
cardInfo = wxCardInfoService.getById(Long.parseLong(cardIdStr));
if (null == cardInfo) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "未查询到卡:"+cardIdStr);
}
map.put("cardId", cardInfo.getId());
map.put("amount", cardInfo.getAmount());
map.put("remainAmount", cardInfo.getRemainingAmount());
map.put("cardType", cardInfo.getType());
}else{
Long couponPasswordId = Long.parseLong(cardIdStr);
//实体卡
WxCouponPassword password = couponPasswordService.getById(couponPasswordId);


+ 1
- 0
mallinkBApi/src/main/java/com/iformall/controller/WxCardPayController.java Просмотреть файл

@@ -185,6 +185,7 @@ public class WxCardPayController extends BaseController {
if (cUserId != null && !cardInfo.getOwnerUserId().equals(cUserId)) {
return new ResultData(ErrorCode.CARD_TRANSFERED);
}
cUserId = cardInfo.getOwnerUserId();
return saveCardPayOrder(cUserId,cardInfo,merchantBUser,totalFeeStr,cardPayType);
}


+ 0
- 2
mallinkBApi/src/main/java/com/iformall/controller/WxPayAccountController.java Просмотреть файл

@@ -33,8 +33,6 @@ public class WxPayAccountController extends BaseController {
@Autowired
private WxAppinfoService wxAppinfoService;



@ApiOperation(value = "获取支付设置", notes = "")
@PostMapping("/getPayAccount")
public ResultData getPayAccount(@RequestBody Map<String, String> paramMap) {


+ 4
- 1
mallinkService/src/main/java/com/iformall/enums/EnumCardSpendStatus.java Просмотреть файл

@@ -7,10 +7,13 @@ public enum EnumCardSpendStatus {

// 0-未支付;1-已分账;2:已人工分账;

NOT_PAY(0, "支付,开始记录"),
NOT_PAY(0, "支付,开始记录"),
PS_SHARED(1, "已分账"),
MANUAL_PAY(2, "已人工分账"),
PREV_PAY(10, "预支付(POS短期内占用)"),

PENDING_REFUND(3, "待退款"),//占库存
REFUND_SUCCESS(4,"已退款"),
;

public static EnumCardSpendStatus getEnum(Integer code) {


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java Просмотреть файл

@@ -294,7 +294,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
record.setSubsidy(subsidyFee);
wxCardSpendMapper.insert(record);
} catch (Exception e) {
logger.error("card spend insert error");
logger.error("card spend insert error",e.getMessage());
return new ResultData(ErrorCode.DB_FAIL.getCode(), "card spend 插入出错!");
}


+ 52
- 34
mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java Просмотреть файл

@@ -1178,6 +1178,18 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
throw new MallinkException(ErrorCode.DB_FAIL);
}

WxCardSpend cardSpendUpd = new WxCardSpend();
cardSpendUpd.setId(cardSend.getId());
cardSpendUpd.updateTenantInfo(cardSend);
cardSpendUpd.setPayStatus(EnumCardSpendStatus.PENDING_REFUND.getCode());
cardSpendUpd.setUpdateDate(currentDate);
try {
wxCardSpendMapper.updateById(cardSpendUpd);
} catch (Exception e) {
logger.error("卡退款订单修改出错: " + record.toString());
throw new MallinkException(ErrorCode.DB_FAIL);
}

refundCardOrderSuccess(record,wxOrder);

return new ResultData();
@@ -1188,7 +1200,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
public ResultData refundCardOrderSuccess(WxRefundOrder refundOrder,WxOrder wxOrder) {
Long cardSpendId = Long.parseLong(refundOrder.getPayOrderNo());
WxCardSpend cardSend = wxCardSpendMapper.selectById(cardSpendId);
if(cardSend == null || EnumPayType.PAY_PAYMENT.getCode().equals(cardSend.getPayType())){
if(cardSend == null){
logger.error("付款订单未找到, e:");
throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND);
}
@@ -1243,7 +1255,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
record.setCardRemainAmount(remaingAmount);
record.setCardBeforeRealAmount(cardInfo.getRemainingShareFeeAmount());
record.setCardRemainRealAmount(remain_real_pament);
record.setPayStatus(EnumCardSpendStatus.PS_SHARED.getCode());//已退款
record.setPayStatus(EnumCardSpendStatus.REFUND_SUCCESS.getCode());//已退款

record.setCreateDate(currentDate);
record.setUpdateDate(currentDate);
@@ -1276,6 +1288,18 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
throw new MallinkException(ErrorCode.ORDER_UPDATE_ERR);
}

WxCardSpend cardSpendUpd = new WxCardSpend();
cardSpendUpd.setId(cardSend.getId());
cardSpendUpd.updateTenantInfo(cardSend);
cardSpendUpd.setPayStatus(EnumCardSpendStatus.REFUND_SUCCESS.getCode());
cardSpendUpd.setUpdateDate(currentDate);
try {
wxCardSpendMapper.updateById(cardSpendUpd);
} catch (Exception e) {
logger.error("卡退款订单修改出错: " + record.toString());
throw new MallinkException(ErrorCode.DB_FAIL);
}


WxCardInfo updateCardInfo = new WxCardInfo();
updateCardInfo.setId(cardInfo.getId());
@@ -1304,42 +1328,36 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService {
//退补贴
Double subsidyD = 1.0 * cardSend.getSubsidy() * refundFee / cardSend.getDeductionAmount();
subsidyFee = subsidyD.intValue();
if(subsidyFee > 0){
int iSubChargeFee = PayUtils.getPayRate(subsidyFee, payAccount.getRealRate(), false);
Integer realSubsidyFee = subsidyFee - iSubChargeFee;

WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy();
merchantSubsidy.setId(idWorker.nextId());
merchantSubsidy.updateTenantInfo(record);
merchantSubsidy.setOrderId(wxOrder.getId());
merchantSubsidy.setOrderType(EnumOrderType.PREPAIDCARD.getCode());
merchantSubsidy.setMerchantId(record.getMerchantId());
merchantSubsidy.setBTenantId(record.getTenantId());
merchantSubsidy.setCouponOrderId(cardInfo.getId());
merchantSubsidy.setCouponType(EnumCouponType.CARD_MULTIMCH.getCode());
merchantSubsidy.setOrderPayment(0-record.getDeductionAmount());
merchantSubsidy.setReceiverPayment(0-refund);
merchantSubsidy.setRealPayment(0-real_refund);
merchantSubsidy.setSubsidy(0-subsidyFee);
merchantSubsidy.setRealSubsidy(0-realSubsidyFee);
merchantSubsidy.setStatus(EnumMerchantSubsidyStatus.NOT_SUBSIDY.getCode());

merchantSubsidy.setType(EnumMerchantSubsidyType.MANUAL.getCode());
merchantSubsidy.setSource(EnumMerchantSubsidySource.CARD.getCode());

//如果是有价卡,并且有补贴,则该记录不能显示在卡消费列表里面
if (cardInfo.getSaleAmount()>0 && subsidyFee > 0) {
merchantSubsidy.setCardSpendListShow(0);
}

merchantSubsidy.setCreateDate(currentDate);
merchantSubsidy.setUpdateDate(currentDate);
WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy();
merchantSubsidy.updateTenantInfo(record);
merchantSubsidy.setOrderId(wxOrder.getId());
merchantSubsidy.setOrderType(EnumOrderType.PREPAIDCARD.getCode());
WxMerchantSubsidy wxMerchantSubsidy = wxMerchantSubsidyMapper.selectOne(new QueryWrapper<>(merchantSubsidy));
if(wxMerchantSubsidy == null){
logger.error("未找到补贴数据 error");
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "未找到补贴数据 插入出错!");
}

Double realSubsidyD = 1.0 * cardSend.getRealPayment() * refundFee / cardSend.getDeductionAmount();
Integer realSubsidyFee = realSubsidyD.intValue();

if(EnumMerchantSubsidyStatus.NOT_SUBSIDY.getCode().equals(wxMerchantSubsidy.getStatus())){
wxMerchantSubsidy.setOrderPayment(wxMerchantSubsidy.getOrderPayment()-record.getDeductionAmount());
wxMerchantSubsidy.setReceiverPayment(wxMerchantSubsidy.getReceiverPayment()-refund);
wxMerchantSubsidy.setRealPayment(wxMerchantSubsidy.getRealPayment()-real_refund);
wxMerchantSubsidy.setSubsidy(wxMerchantSubsidy.getSubsidy()-subsidyFee);
wxMerchantSubsidy.setRealSubsidy(wxMerchantSubsidy.getRealSubsidy()-realSubsidyFee);
wxMerchantSubsidy.setUpdateDate(currentDate);
try {
wxMerchantSubsidyMapper.insert(merchantSubsidy);
wxMerchantSubsidyMapper.updateById(wxMerchantSubsidy);
} catch (Exception e) {
logger.error("merchantSubsidy info insert error");
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "merchantSubsidy info 插入出错!");
logger.error("退补贴数据 修改失败info update error");
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "merchantSubsidy info 修改出错!");
}
}else{
logger.error("补贴数据已结算 无法退款 error");
throw new MallinkException(ErrorCode.SYS_METHOD_NOT_SUPPORT.getCode(), "补贴数据已结算");
}
}



Загрузка…
Отмена
Сохранить