Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
2024-08-29 14:52:11 +08:00
2 changed files with 27 additions and 21 deletions

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.chaozhanggui.system.cashierservice.bean.TableStateEnum;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.model.ScanPayReq;
import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
import com.chaozhanggui.system.cashierservice.mybatis.MpShopTableMapper;
@@ -14,6 +15,7 @@ import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.thirdpay.resp.MainScanResp;
import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderReturnResp;
import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderStatusQueryResp;
import com.chaozhanggui.system.cashierservice.thirdpay.resp.PublicResp;
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
@@ -331,7 +333,7 @@ public class MemberService {
String orderNo = DateUtils.getSsdfTimes();
PublicResp<MainScanResp> publicResp = thirdPayService.mainScan(url, thirdApply.getAppId(), "会员充值", "会员充值", amount.setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), wechatpay.equals("wxpay") ? thirdApply.getSmallAppid() : null, authCode, DateUtils.getSsdfTimes(), thirdApply.getStoreId(), callBack, thirdApply.getAppToken());
PublicResp<MainScanResp> publicResp = thirdPayService.mainScan(url, thirdApply.getAppId(), "会员充值", "会员充值", amount.setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), wechatpay.equals("wxpay") ? thirdApply.getSmallAppid() : null, authCode, orderNo, thirdApply.getStoreId(), callBack, thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) {
MainScanResp mainScanResp = publicResp.getObjData();
@@ -355,6 +357,7 @@ public class MemberService {
flow.setAmount(amount);
flow.setBalance(shopUser.getAmount());
flow.setCreateTime(new Date());
flow.setRemark(orderNo);
tbShopUserFlowMapper.insert(flow);
BigDecimal fl=null;
@@ -761,24 +764,26 @@ public class MemberService {
}
if("scanMemberIn".equals(flow.getBizCode())){
PublicResp<OrderStatusQueryResp> orderstatus = thirdPayService.queryOrder(url, thirdApply.getAppId(),flow.getAmount().toPlainString(), null, thirdApply.getAppToken());
if (ObjectUtil.isNotNull(orderstatus) && ObjectUtil.isNotEmpty(orderstatus)) {
if ("000000".equals(orderstatus.getCode())) {
if ("TRADE_SUCCESS".equals(orderstatus.getObjData().getState())) {
user.setAmount(user.getAmount().subtract(flow.getAmount()));
user.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKey(user);
if("scanMemberIn".equals(flow.getBizCode())) {
flow.setIsReturn("1");
flow.setRemark(remark);
tbShopUserFlowMapper.updateByPrimaryKey(flow);
return Result.success(CodeEnum.SUCCESS);
String no=DateUtils.getSsdfTimes();
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(),no , flow.getRemark(), null, "充值退款", flow.getAmount().setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) {
if (!"SUCCESS".equals(publicResp.getObjData().getState()) && !publicResp.getObjData().getState().equals("ING")) {
MsgException.check(true, "退款渠道调用失败");
}
} else {
MsgException.check(true, "退款渠道调用失败");
}
}
}else if("cashMemberIn".equals(flow.getBizCode())){
} else if ("cashMemberIn".equals(flow.getBizCode())) {
} else {
return Result.fail(CodeEnum.OPARETIONERROR);
}
user.setAmount(user.getAmount().subtract(flow.getAmount()));
user.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKey(user);
@@ -786,14 +791,12 @@ public class MemberService {
flow.setIsReturn("1");
flow.setRemark(remark);
tbShopUserFlowMapper.updateByPrimaryKey(flow);
return Result.success(CodeEnum.SUCCESS);
}else {
return Result.fail(CodeEnum.OPARETIONERROR);
}
return Result.fail(CodeEnum.FAIL);
}