Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
39d9275dae
20 files changed
+281
-191
No files matched your search
@@ -69,6 +69,7 @@ CREATE TABLE `third_pay_log`
|
||||
`biz_type` varchar(32) NOT NULL COMMENT '支付类型',
|
||||
`biz_id` varchar(2048) DEFAULT NULL COMMENT '支付类型id',
|
||||
`api_url` text DEFAULT NULL COMMENT 'api-url',
|
||||
`header` text DEFAULT NULL COMMENT 'header',
|
||||
`res` text DEFAULT NULL COMMENT 'res',
|
||||
`req` text DEFAULT NULL COMMENT 'req',
|
||||
`error` text DEFAULT NULL COMMENT '调用错误',
|
||||
|
||||
+7
-2
@@ -150,8 +150,13 @@ public class HardAfterSaleController {
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAfterSale_view')")
|
||||
public R getHardAfterSalePage(@ParameterObject Page page, @ParameterObject HardAfterSaleEntity hardAfterSale) {
|
||||
LambdaQueryWrapper<HardAfterSaleEntity> wrapper = Wrappers.lambdaQuery();
|
||||
public R getHardAfterSalePage(@ParameterObject Page page, @ParameterObject HardAfterSaleDto dto) {
|
||||
LambdaQueryWrapper<HardAfterSaleEntity> wrapper = new LambdaQueryWrapper<HardAfterSaleEntity>()
|
||||
.eq(HardAfterSaleEntity::getOrderId, dto.getOrderId())
|
||||
.eq(HardAfterSaleEntity::getUserId, dto.getUserId())
|
||||
.eq(HardAfterSaleEntity::getStatus, dto.getStatus())
|
||||
.orderByDesc(HardAfterSaleEntity::getCreateTime)
|
||||
.orderByDesc(HardAfterSaleEntity::getOrderId);
|
||||
return R.ok(hardAfterSaleService.page(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
+6
-4
@@ -5,6 +5,7 @@ import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.vo.android.HardAdUserVo;
|
||||
import com.bsd.pjcloud.hard.service.HardApiService;
|
||||
@@ -35,10 +36,7 @@ public class HardApiServiceImpl implements HardApiService {
|
||||
UserInfo user = userService.getInnerByUserId(userId).getData();
|
||||
if (ObjectUtil.isEmpty(user)) return null;
|
||||
// 查询钱包
|
||||
// WalletTypeEnum walletType = ObjectUtil.equals(HardTypeEnum.CANTEEN, type) ? WalletTypeEnum.EAT : WalletTypeEnum.PAY;
|
||||
// 默认都使用饭卡钱包
|
||||
WalletTypeEnum walletType = WalletTypeEnum.EAT;
|
||||
|
||||
WalletTypeEnum walletType = ObjectUtil.equals(HardTypeEnum.CANTEEN, type) ? WalletTypeEnum.EAT : WalletTypeEnum.PAY;
|
||||
WalletManageEntity wallet = remoteWalletService.getWallet(userId, walletType).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) return null;
|
||||
SysUser sysUser = user.getSysUser();
|
||||
@@ -67,6 +65,10 @@ public class HardApiServiceImpl implements HardApiService {
|
||||
// 查询钱包
|
||||
WalletManageEntity wallet = remoteWalletService.getWalletByCardNumber(card).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) return null;
|
||||
// 判断钱包是否冻结
|
||||
if (ObjectUtil.equals(wallet.getIsFreeze(), YesNoEnum.YES.getCode())) {
|
||||
throw new RuntimeException("钱包已冻结");
|
||||
}
|
||||
// 查询用户
|
||||
UserInfo user = userService.getInnerByUserId(wallet.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(user)) return null;
|
||||
|
||||
+20
-3
@@ -40,6 +40,7 @@ import com.bsd.pjcloud.hard.mapper.order.HardAfterSaleMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardAfterSaleService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import com.bsd.pjcloud.thirdparty.constant.pay.ThirdPayVoStatusEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeRefundDto;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletRechargeService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeVo;
|
||||
@@ -228,6 +229,11 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
if (ObjectUtil.isEmpty(refundPrice)) {
|
||||
refundPrice = order.getPayPrice();
|
||||
}
|
||||
// 总的退款金额
|
||||
Integer refundTotalPrice = order.getRefundPrice();
|
||||
if (ObjectUtil.isEmpty(refundTotalPrice)) {
|
||||
refundTotalPrice = 0;
|
||||
}
|
||||
WalletRechargeRefundDto hardRefundDto = WalletRechargeRefundDto.builder().walletId(order.getWalletId()).orderId(order.getId()).afterSaleId(afterSale.getId()).refundCode(refundCode).reason("订单退款").price(refundPrice).build();
|
||||
R<WalletRechargeVo> walletRefundResult = walletRechargeService.refund(hardRefundDto);
|
||||
if (walletRefundResult.getCode() != 0 || ObjectUtil.isEmpty(walletRefundResult.getData())) {
|
||||
@@ -239,7 +245,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
.orderStatus(HardOrderStatusEnum.REFUND.getType())
|
||||
.refundStatus(HardRefundStatusEnum.SUCCESS.getStatus())
|
||||
.payRefundId(walletRefund.getId())
|
||||
.refundPrice(refundPrice)
|
||||
.refundPrice(refundTotalPrice + refundPrice)
|
||||
.refundTime(LocalDateTime.now())
|
||||
.build();
|
||||
hardOrderService.updateById(updateObj);
|
||||
@@ -319,8 +325,19 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
throw new RuntimeException("该订单类型不支持退款");
|
||||
}
|
||||
// 校验订单是否已退款
|
||||
if (ObjectUtil.isNotEmpty(order.getPayRefundId())) {
|
||||
throw new RuntimeException("发起退款失败,订单已退款");
|
||||
// if (ObjectUtil.isNotEmpty(order.getPayRefundId())) {
|
||||
// throw new RuntimeException("发起退款失败,订单已退款");
|
||||
// }
|
||||
// 查询所有成功的退款
|
||||
List<HardAfterSaleEntity> afterList = baseMapper.selectList(new LambdaQueryWrapper<HardAfterSaleEntity>()
|
||||
.eq(HardAfterSaleEntity::getOrderId, order.getId())
|
||||
.eq(HardAfterSaleEntity::getType, HardSaleTypeEnum.AFTER_SALE.getType())
|
||||
.in(HardAfterSaleEntity::getStatus, List.of(HardSaleStatusEnum.APPLY.getStatus(), HardSaleStatusEnum.COMPLETE.getStatus()))
|
||||
);
|
||||
// 退款金额
|
||||
int totalPrice = afterList.stream().filter(v -> ObjectUtil.isNotEmpty(v.getRefundPrice())).map(HardAfterSaleEntity::getRefundPrice).reduce(0, Integer::sum);
|
||||
if (totalPrice > order.getPayPrice()) {
|
||||
throw new RuntimeException("退款总金额大于支付总金额");
|
||||
}
|
||||
return orderVo;
|
||||
}
|
||||
|
||||
+32
-11
@@ -196,19 +196,31 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
public Long createOrder(HardCreateOrderDto dto) {
|
||||
MchManageVo mch = validateCreateOrderDto(dto);
|
||||
if (ObjectUtil.isEmpty(mch)) throw new RuntimeException("机器绑定的商户不存在");
|
||||
// 查询用户
|
||||
UserInfo userDetail = userService.getInnerByUserId(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("用户不存在不存在");
|
||||
// 是否需要支付
|
||||
boolean isPay = isPay(dto.getOrderType(), dto.getOrderPayType());
|
||||
// 是否需要核销
|
||||
boolean isVerify = isVerify(dto.getOrderPayType());
|
||||
// 查询用户
|
||||
UserInfo userDetail = null;
|
||||
SysUser sysUser = null;
|
||||
if (isPay || isVerify) {
|
||||
userDetail = userService.getInnerByUserId(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("用户不存在不存在");
|
||||
sysUser = userDetail.getSysUser();
|
||||
}
|
||||
// 是否需要支付额外金额
|
||||
boolean isExtraPrice = isExtraPrice(dto.getSysType());
|
||||
// 默认使用该商户的钱包如果没有就用饭卡钱包
|
||||
WalletManageEntity wallet = null;
|
||||
if (isPay) {
|
||||
if (ObjectUtil.isNotEmpty(mch.getDefaultWalletTypeId())) {
|
||||
R<WalletManageEntity> walletResult = remoteWalletService.getWallet(dto.getUserId(), WalletTypeEnum.EAT);
|
||||
wallet = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));
|
||||
if (ObjectUtil.isEmpty(mch.getDefaultWalletTypeId())) {
|
||||
if (dto.getSysType().equals(HardTypeEnum.CANTEEN)) {
|
||||
R<WalletManageEntity> walletResult = remoteWalletService.getWallet(dto.getUserId(), WalletTypeEnum.EAT);
|
||||
wallet = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));
|
||||
} else {
|
||||
R<WalletManageEntity> walletResult = remoteWalletService.getWallet(dto.getUserId(), WalletTypeEnum.PAY);
|
||||
wallet = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));
|
||||
}
|
||||
} else {
|
||||
R<WalletManageEntity> walletResult = remoteWalletService.getWalletByWalletTypeId(dto.getUserId(), mch.getDefaultWalletTypeId());
|
||||
wallet = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));
|
||||
@@ -216,14 +228,14 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
if (ObjectUtil.isEmpty(wallet)) {
|
||||
throw new RuntimeException("用户钱包不存在");
|
||||
}
|
||||
} else {
|
||||
} else if (isVerify) {
|
||||
// 判断该二维码有没有被核销
|
||||
boolean isCancel = validateCodeIsCancel(dto.getOrderType(), dto.getOrderSourceTypeId());
|
||||
if (isCancel) throw new RuntimeException("该二维码已被核销");
|
||||
}
|
||||
int totalPrice = 0, extraPrice = 0, payPrice = 0;
|
||||
totalPrice = hardCarService.computerCarTotalPrice(dto.getSysType(), dto.getOrderType(), dto.getList());
|
||||
if (isExtraPrice) extraPrice = computeExtraPrice(totalPrice, mch, userDetail.getSysUser());
|
||||
if (isExtraPrice) extraPrice = computeExtraPrice(totalPrice, mch, sysUser);
|
||||
payPrice = totalPrice + extraPrice;
|
||||
if (isPay) {
|
||||
// 如果是支付的话,不能小于等于0
|
||||
@@ -238,8 +250,6 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
// 添加硬件订单
|
||||
HardOrderEntity orderObj = HardOrderEntity.builder()
|
||||
.androidOrderCode(dto.getAndroidOrderCode())
|
||||
.userId(dto.getUserId())
|
||||
.userDeptId(userDetail.getSysUser().getDeptId())
|
||||
.sysType(dto.getSysType().getType())
|
||||
.hourType(String.valueOf(dto.getHourType()))
|
||||
.parentCarId(parentCarId)
|
||||
@@ -258,6 +268,12 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
.isOfflineOrder(YesNoEnum.NO.getCode())
|
||||
.productDesc(subject)
|
||||
.build();
|
||||
if (ObjectUtil.isNotEmpty(sysUser)) {
|
||||
orderObj.setUserId(sysUser.getUserId());
|
||||
orderObj.setUserDeptId(sysUser.getDeptId());
|
||||
} else {
|
||||
orderObj.setUserId(-1L);
|
||||
}
|
||||
if (isPay) {
|
||||
orderObj.setWalletId(wallet.getId());
|
||||
}
|
||||
@@ -266,7 +282,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
getSelf().fastenerInventory(orderObj, YesNoEnum.YES);
|
||||
// 钱包扣款
|
||||
getSelf().fastReduceBalance(orderObj);
|
||||
if (!isPay) {
|
||||
if (isVerify) {
|
||||
// 核销二维码
|
||||
getSelf().cancelCode(orderObj, userDetail);
|
||||
}
|
||||
@@ -837,6 +853,11 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
return true;
|
||||
}
|
||||
|
||||
// 是否需要核销
|
||||
private boolean isVerify(HardPayTypeEnum payType) {
|
||||
return HardPayTypeEnum.isNotPay.contains(payType);
|
||||
}
|
||||
|
||||
// 是否需要额外支付(目前只有食堂需要)
|
||||
private boolean isExtraPrice(HardTypeEnum hardType) {
|
||||
return ObjectUtil.equals(hardType, HardTypeEnum.CANTEEN);
|
||||
|
||||
+53
-38
@@ -35,10 +35,7 @@ import com.bsd.pjcloud.thirdparty.dto.pay.PayDetailDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.PayDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.RefundDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.pay.WaterDto;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayBaseVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayWaterVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.RefundVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.*;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
@@ -185,15 +182,27 @@ public class HardThirdPayServiceImpl implements HardThirdPayService {
|
||||
try {
|
||||
String orderType = getOrderType(soureType);
|
||||
// 订单是否存在
|
||||
long orderCount = hardOrderService.count(new LambdaQueryWrapper<HardOrderEntity>()
|
||||
HardOrderEntity orderEntity = hardOrderService.getOne(new LambdaQueryWrapper<HardOrderEntity>()
|
||||
.eq(HardOrderEntity::getId, dto.getPlatformOrderId())
|
||||
.eq(HardOrderEntity::getOrderType, orderType)
|
||||
.eq(HardOrderEntity::getOrderStatus, HardOrderStatusEnum.PAY.getType())
|
||||
);
|
||||
if (orderCount <= 0) {
|
||||
if (ObjectUtil.isEmpty(orderEntity)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.ORDER_EXIST);
|
||||
return baseVo;
|
||||
}
|
||||
// 查询所有成功的退款
|
||||
List<HardAfterSaleEntity> afterList = hardAfterSaleService.list(new LambdaQueryWrapper<HardAfterSaleEntity>()
|
||||
.eq(HardAfterSaleEntity::getOrderId, orderEntity.getId())
|
||||
.eq(HardAfterSaleEntity::getType, HardSaleTypeEnum.AFTER_SALE.getType())
|
||||
.eq(HardAfterSaleEntity::getStatus, HardSaleStatusEnum.COMPLETE.getStatus())
|
||||
);
|
||||
// 退款金额
|
||||
int totalPrice = afterList.stream().filter(v -> ObjectUtil.isNotEmpty(v.getRefundPrice())).map(HardAfterSaleEntity::getRefundPrice).reduce(0, Integer::sum);
|
||||
int executeTotalPrice = totalPrice + dto.getPrice();
|
||||
if (executeTotalPrice > orderEntity.getPayPrice()) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.REFUND_TOTAL_PRICE);
|
||||
return baseVo;
|
||||
}
|
||||
// 退款id是否重复
|
||||
long refundCount = hardAfterSaleService.count(new LambdaQueryWrapper<HardAfterSaleEntity>()
|
||||
.eq(HardAfterSaleEntity::getNo, dto.getThirdRefundId())
|
||||
@@ -204,21 +213,15 @@ public class HardThirdPayServiceImpl implements HardThirdPayService {
|
||||
baseVo.set(ThirdPayVoStatusEnum.ORDER_HAVE_REFUND);
|
||||
return baseVo;
|
||||
}
|
||||
// 是否已退款
|
||||
HardOrderVo order = hardAfterSaleService.validateOrderCanRefund(Long.valueOf(dto.getPlatformOrderId()));
|
||||
if (ObjectUtil.isEmpty(order)) {
|
||||
baseVo.set(ThirdPayVoStatusEnum.ORDER_HAVE_REFUND);
|
||||
return baseVo;
|
||||
}
|
||||
// 添加售后订单
|
||||
HardAfterSaleEntity saveObj = BeanUtils.toBean(dto, HardAfterSaleEntity.class);
|
||||
saveObj.setType(HardSaleTypeEnum.AFTER_SALE.getType());
|
||||
saveObj.setStatus(HardSaleStatusEnum.COMPLETE.getStatus());
|
||||
saveObj.setNo(dto.getThirdRefundId());
|
||||
saveObj.setWay("10");
|
||||
saveObj.setOrderId(order.getId());
|
||||
saveObj.setOrderId(orderEntity.getId());
|
||||
saveObj.setRefundPrice(dto.getPrice());
|
||||
saveObj.setUserId(order.getUserId());
|
||||
saveObj.setUserId(orderEntity.getUserId());
|
||||
saveObj.setAuditUserId(null);
|
||||
saveObj.setAuditTime(LocalDateTime.now());
|
||||
saveObj.setApplyReason("宁波银行(美好生活)api退款");
|
||||
@@ -228,9 +231,9 @@ public class HardThirdPayServiceImpl implements HardThirdPayService {
|
||||
// 添加售后进度
|
||||
HardAfterSaleLogEntity saveLogObj = HardAfterSaleLogEntity.builder()
|
||||
.afterSaleId(saveObj.getId())
|
||||
.userId(order.getUserId())
|
||||
.userId(orderEntity.getUserId())
|
||||
.operateType(HardAfterSaleOperateTypeEnum.ADMIN_REFUND.getType())
|
||||
.beforeStatus(order.getOrderStatus())
|
||||
.beforeStatus(orderEntity.getOrderStatus())
|
||||
.afterStatus(HardSaleStatusEnum.COMPLETE.getStatus())
|
||||
.content(HardSaleStatusEnum.COMPLETE.getContent())
|
||||
.build();
|
||||
@@ -240,7 +243,7 @@ public class HardThirdPayServiceImpl implements HardThirdPayService {
|
||||
// 返回
|
||||
RefundVo refundVo = new RefundVo();
|
||||
refundVo.setRefundTime(LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
refundVo.setThirdOrderId(order.getOrderNo());
|
||||
refundVo.setThirdOrderId(orderEntity.getOrderNo());
|
||||
refundVo.setThirdRefundId(dto.getThirdRefundId());
|
||||
refundVo.setPlatformOrderId(dto.getPlatformOrderId());
|
||||
refundVo.setPlatformRefundId(String.valueOf(saveObj.getId()));
|
||||
@@ -279,22 +282,18 @@ public class HardThirdPayServiceImpl implements HardThirdPayService {
|
||||
item.setName(v.getUsername());
|
||||
item.setSignPhone(v.getUserMobile());
|
||||
item.setPlatformOrderId(String.valueOf(v.getId()));
|
||||
if (ObjectUtil.isNotEmpty(v.getAfterSaleId())) {
|
||||
item.setPlatformRefundId(String.valueOf(v.getAfterSaleId()));
|
||||
}
|
||||
item.setThirdOrderId(v.getOrderNo());
|
||||
if (ObjectUtil.isNotEmpty(v.getAfterSaleNo())) {
|
||||
item.setThirdRefundId(String.valueOf(v.getAfterSaleNo()));
|
||||
}
|
||||
item.setOrderStatus(v.getOrderStatus());
|
||||
item.setOrderPrice(v.getPayPrice());
|
||||
item.setRefundPrice(v.getRefundPrice());
|
||||
if (ObjectUtil.isNotEmpty(v.getPayTime())) {
|
||||
item.setPayTime(LocalDateTimeUtil.format(v.getPayTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getRefundTime())) {
|
||||
item.setRefundTime(LocalDateTimeUtil.format(v.getRefundTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
// 查询退款列表
|
||||
List<PayRefundVo> refundList = getRefundList(v.getId());
|
||||
// 总退款金额
|
||||
Integer reduce = refundList.stream().filter(i -> ObjectUtil.isNotEmpty(i.getRefundPrice())).map(i -> i.getRefundPrice()).reduce(0, Integer::sum);
|
||||
item.setRefundList(refundList);
|
||||
item.setRefundTotalPrice(reduce);
|
||||
list.add(item);
|
||||
}
|
||||
}
|
||||
@@ -332,22 +331,18 @@ public class HardThirdPayServiceImpl implements HardThirdPayService {
|
||||
item.setName(order.getUsername());
|
||||
item.setSignPhone(order.getUserMobile());
|
||||
item.setPlatformOrderId(String.valueOf(order.getId()));
|
||||
if (ObjectUtil.isNotEmpty(order.getAfterSaleId())) {
|
||||
item.setPlatformRefundId(String.valueOf(order.getAfterSaleId()));
|
||||
}
|
||||
item.setThirdOrderId(order.getOrderNo());
|
||||
if (ObjectUtil.isNotEmpty(order.getAfterSaleNo())) {
|
||||
item.setThirdRefundId(String.valueOf(order.getAfterSaleNo()));
|
||||
}
|
||||
item.setOrderStatus(order.getOrderStatus());
|
||||
item.setOrderPrice(order.getPayPrice());
|
||||
item.setRefundPrice(order.getRefundPrice());
|
||||
if (ObjectUtil.isNotEmpty(order.getPayTime())) {
|
||||
item.setPayTime(LocalDateTimeUtil.format(order.getPayTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(order.getRefundTime())) {
|
||||
item.setRefundTime(LocalDateTimeUtil.format(order.getRefundTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
// 查询退款列表
|
||||
List<PayRefundVo> refundList = getRefundList(order.getId());
|
||||
// 总退款金额
|
||||
Integer reduce = refundList.stream().filter(i -> ObjectUtil.isNotEmpty(i.getRefundPrice())).map(i -> i.getRefundPrice()).reduce(0, Integer::sum);
|
||||
item.setRefundList(refundList);
|
||||
item.setRefundTotalPrice(reduce);
|
||||
baseVo.set(ThirdPayVoStatusEnum.SUCCESS);
|
||||
baseVo.setData(item);
|
||||
return baseVo;
|
||||
@@ -370,6 +365,26 @@ public class HardThirdPayServiceImpl implements HardThirdPayService {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 查询退款列表
|
||||
private List<PayRefundVo> getRefundList(Long orderId) {
|
||||
List<HardAfterSaleEntity> afterList = hardAfterSaleService.list(new LambdaQueryWrapper<HardAfterSaleEntity>()
|
||||
.eq(HardAfterSaleEntity::getOrderId, orderId)
|
||||
.eq(HardAfterSaleEntity::getType, HardSaleTypeEnum.AFTER_SALE.getType())
|
||||
.eq(HardAfterSaleEntity::getStatus, HardSaleStatusEnum.COMPLETE.getStatus())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(afterList)) {
|
||||
return null;
|
||||
}
|
||||
return afterList.stream().map(v -> {
|
||||
PayRefundVo item = new PayRefundVo();
|
||||
item.setPlatformRefundId(String.valueOf(v.getId()));
|
||||
item.setThirdRefundId(v.getNo());
|
||||
item.setRefundPrice(v.getRefundPrice());
|
||||
item.setRefundTime(LocalDateTimeUtil.format(v.getRefundTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
return item;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
private String getOrderType(ThirdPaySoureBizTypeEnum type) {
|
||||
switch (type) {
|
||||
case LB -> {
|
||||
|
||||
+1
@@ -207,6 +207,7 @@
|
||||
and s.no = #{dto.afterSaleNo}
|
||||
</if>
|
||||
</where>
|
||||
group by a.id
|
||||
order by a.create_time desc, a.user_id desc
|
||||
</sql>
|
||||
|
||||
|
||||
+1
@@ -24,6 +24,7 @@ public enum ThirdPayVoStatusEnum {
|
||||
ORDER_HAVE_PAY(506, "订单已支付"),
|
||||
ORDER_HAVE_REFUND(507, "订单已退款"),
|
||||
DETAIL_ITEM_NOT_ONE(508, "查询详情条目不为一"),
|
||||
REFUND_TOTAL_PRICE(509, "退款总金额大于支付总金额"),
|
||||
UNKNOWN_ERROR(599, "未知错误,请联系管理员"),
|
||||
;
|
||||
|
||||
|
||||
+73
-66
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -21,100 +22,106 @@ import java.time.LocalDateTime;
|
||||
public class ThirdPayLogEntity extends Model<ThirdPayLogEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="主键")
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 支付发起方类型id
|
||||
*/
|
||||
@Schema(description="支付发起方类型id")
|
||||
/**
|
||||
* 支付发起方类型id
|
||||
*/
|
||||
@Schema(description = "支付发起方类型id")
|
||||
private String paySourceType;
|
||||
|
||||
/**
|
||||
* 支付类型
|
||||
*/
|
||||
@Schema(description="支付类型")
|
||||
/**
|
||||
* 支付类型
|
||||
*/
|
||||
@Schema(description = "支付类型")
|
||||
private String bizType;
|
||||
|
||||
/**
|
||||
* 支付类型id
|
||||
*/
|
||||
@Schema(description="支付类型id")
|
||||
/**
|
||||
* 支付类型id
|
||||
*/
|
||||
@Schema(description = "支付类型id")
|
||||
private String bizId;
|
||||
|
||||
/**
|
||||
* api-url
|
||||
*/
|
||||
@Schema(description="api-url")
|
||||
/**
|
||||
* api-url
|
||||
*/
|
||||
@Schema(description = "api-url")
|
||||
private String apiUrl;
|
||||
|
||||
/**
|
||||
* res
|
||||
*/
|
||||
@Schema(description="res")
|
||||
/**
|
||||
* header
|
||||
*/
|
||||
@Schema(description = "header")
|
||||
private String header;
|
||||
|
||||
/**
|
||||
* res
|
||||
*/
|
||||
@Schema(description = "res")
|
||||
private String res;
|
||||
|
||||
/**
|
||||
* req
|
||||
*/
|
||||
@Schema(description="req")
|
||||
/**
|
||||
* req
|
||||
*/
|
||||
@Schema(description = "req")
|
||||
private String req;
|
||||
|
||||
/**
|
||||
* 调用错误
|
||||
*/
|
||||
@Schema(description="调用错误")
|
||||
/**
|
||||
* 调用错误
|
||||
*/
|
||||
@Schema(description = "调用错误")
|
||||
private String error;
|
||||
|
||||
/**
|
||||
* 耗时(毫秒)
|
||||
*/
|
||||
@Schema(description="耗时(毫秒)")
|
||||
/**
|
||||
* 耗时(毫秒)
|
||||
*/
|
||||
@Schema(description = "耗时(毫秒)")
|
||||
private String timeConsuming;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="更新人")
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="更新时间")
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="删除时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除时间")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* tenantId
|
||||
*/
|
||||
@Schema(description="tenantId")
|
||||
|
||||
/**
|
||||
* tenantId
|
||||
*/
|
||||
@Schema(description = "tenantId")
|
||||
private Long tenantId;
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.bsd.pjcloud.thirdparty.vo.pay;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PayRefundVo {
|
||||
|
||||
/**
|
||||
* 平台退款id
|
||||
*/
|
||||
private String platformRefundId;
|
||||
|
||||
/**
|
||||
* 第三方退款id
|
||||
*/
|
||||
private String thirdRefundId;
|
||||
|
||||
/**
|
||||
* 退款金额(分)
|
||||
*/
|
||||
private Integer refundPrice;
|
||||
|
||||
/**
|
||||
* 退款时间(yyyy-MM-dd HH:mm:ss格式)
|
||||
*/
|
||||
private String refundTime;
|
||||
|
||||
}
|
||||
+9
-17
@@ -2,6 +2,8 @@ package com.bsd.pjcloud.thirdparty.vo.pay;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PayWaterVo {
|
||||
|
||||
@@ -25,21 +27,11 @@ public class PayWaterVo {
|
||||
*/
|
||||
private String platformOrderId;
|
||||
|
||||
/**
|
||||
* 平台退款id
|
||||
*/
|
||||
private String platformRefundId;
|
||||
|
||||
/**
|
||||
* 第三方订单id
|
||||
*/
|
||||
private String thirdOrderId;
|
||||
|
||||
/**
|
||||
* 第三方退款id
|
||||
*/
|
||||
private String thirdRefundId;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
* 1创建订单(未支付)
|
||||
@@ -53,19 +45,19 @@ public class PayWaterVo {
|
||||
*/
|
||||
private Integer orderPrice;
|
||||
|
||||
/**
|
||||
* 退款金额(分)
|
||||
*/
|
||||
private Integer refundPrice;
|
||||
|
||||
/**
|
||||
* 支付时间(yyyy-MM-dd HH:mm:ss格式)
|
||||
*/
|
||||
private String payTime;
|
||||
|
||||
/**
|
||||
* 退款时间(yyyy-MM-dd HH:mm:ss格式)
|
||||
* 总退款价格(分)
|
||||
*/
|
||||
private String refundTime;
|
||||
private Integer refundTotalPrice;
|
||||
|
||||
/**
|
||||
* 退款列表
|
||||
*/
|
||||
private List<PayRefundVo> refundList;
|
||||
|
||||
}
|
||||
+5
-6
@@ -22,7 +22,6 @@ import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.Validation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -54,7 +53,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
@Override
|
||||
public PayBaseVo<PayVo> walletPay(String json, Map<String, String> headers) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/wallet-pay").bizType(ThirdPayApiBizTypeEnum.PAY.getType()).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).req(json).build();
|
||||
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/wallet-pay").bizType(ThirdPayApiBizTypeEnum.PAY.getType()).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).header(JSONUtil.toJsonStr(headers)).req(json).build();
|
||||
// 开始处理
|
||||
PayBaseVo baseVo = new PayBaseVo<PayVo>();
|
||||
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
|
||||
@@ -106,7 +105,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
@Override
|
||||
public PayBaseVo<RefundVo> walletRefund(String json, Map<String, String> headers) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/wallet-refund").bizType(ThirdPayApiBizTypeEnum.REFUND.getType()).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).req(json).build();
|
||||
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/wallet-refund").bizType(ThirdPayApiBizTypeEnum.REFUND.getType()).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).req(json).header(JSONUtil.toJsonStr(headers)).build();
|
||||
// 开始处理
|
||||
PayBaseVo baseVo = new PayBaseVo<RefundVo>();
|
||||
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
|
||||
@@ -159,7 +158,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
public PayBaseVo<PayWalletInfoVo> getWalletInfo(String json, Map<String, String> headers) {
|
||||
// 日志
|
||||
long startTime = System.currentTimeMillis();
|
||||
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/user-wallet").bizType(ThirdPayApiBizTypeEnum.WALLET_INFO.getType()).req(json).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
|
||||
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/user-wallet").bizType(ThirdPayApiBizTypeEnum.WALLET_INFO.getType()).req(json).header(JSONUtil.toJsonStr(headers)).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
|
||||
// 开始处理
|
||||
PayBaseVo baseVo = new PayBaseVo<PayWalletInfoVo>();
|
||||
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
|
||||
@@ -222,7 +221,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
public PayBaseVo<List<PayWaterVo>> water(String json, Map<String, String> headers) {
|
||||
// 日志
|
||||
long startTime = System.currentTimeMillis();
|
||||
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/water").bizType(ThirdPayApiBizTypeEnum.WATER.getType()).req(json).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
|
||||
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/water").bizType(ThirdPayApiBizTypeEnum.WATER.getType()).req(json).header(JSONUtil.toJsonStr(headers)).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
|
||||
// 开始处理
|
||||
PayBaseVo baseVo = new PayBaseVo<PayWalletInfoVo>();
|
||||
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
|
||||
@@ -273,7 +272,7 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
public PayBaseVo<PayWaterVo> detail(String json, Map<String, String> headers) {
|
||||
// 日志
|
||||
long startTime = System.currentTimeMillis();
|
||||
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/detail").bizType(ThirdPayApiBizTypeEnum.DETAIL.getType()).req(json).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
|
||||
ThirdPayLogEntity logObj = ThirdPayLogEntity.builder().apiUrl("/third/third-pay-api/detail").bizType(ThirdPayApiBizTypeEnum.DETAIL.getType()).req(json).header(JSONUtil.toJsonStr(headers)).paySourceType(ThirdPaySoureBizTypeEnum.LB.getType()).build();
|
||||
// 开始处理
|
||||
PayBaseVo baseVo = new PayBaseVo<PayWaterVo>();
|
||||
ThirdKeyManageEntity keySetting = keyManageService.checkSignAndReturnConfig(json, headers);
|
||||
|
||||
Binary file not shown.
+16
-8
@@ -29,7 +29,8 @@ import java.util.Map;
|
||||
@SpringBootTest(classes = ThirdPartyApp.class)
|
||||
public class PayTest {
|
||||
|
||||
private final String baseUrl = "http://123.156.230.15:8089/api";
|
||||
// private final String baseUrl = "http://123.156.230.15:8089/api";
|
||||
private final String baseUrl = "http://127.0.0.1:9999";
|
||||
|
||||
private final String walletInfoUrl = "/third/third-pay-api/user-wallet";
|
||||
|
||||
@@ -78,8 +79,8 @@ public class PayTest {
|
||||
public void walletPay() throws Exception {
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("userId", 1875049673022279681L);
|
||||
paramsMap.put("thirdOrderId", "5");
|
||||
paramsMap.put("price", 100);
|
||||
paramsMap.put("thirdOrderId", System.currentTimeMillis());
|
||||
paramsMap.put("price", 800);
|
||||
paramsMap.put("products", null);
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
@@ -118,9 +119,9 @@ public class PayTest {
|
||||
public void walletRefund() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("platformOrderId", "1919704180908027905");
|
||||
paramsMap.put("thirdRefundId", "10");
|
||||
paramsMap.put("price", "1000");
|
||||
paramsMap.put("platformOrderId", "1928048358927982594");
|
||||
paramsMap.put("thirdRefundId", System.currentTimeMillis());
|
||||
paramsMap.put("price", "300");
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletRefundUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
@@ -151,14 +152,21 @@ public class PayTest {
|
||||
public void detail() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("thirdOrderId", "");
|
||||
paramsMap.put("thirdRefundId", "10");
|
||||
paramsMap.put("thirdOrderId", "1748517531534");
|
||||
paramsMap.put("thirdRefundId", "");
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + detailUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
String headers = "{\"X-Forwarded-Prefix\":\"/third\",\"sign\":\"c668f17f92907fed5ea62e899c1782c5\",\"User-Agent\":\"okhttp/3.14.9\",\"Accept-Encoding\":\"gzip\",\"UniqueFlowNo\":\"OPENAPI01-20250529100755-437087\",\"Content-Encoding\":\"UTF-8\",\"host\":\"192.168.0.192:6061\",\"X-B3-Sampled\":\"0\",\"X-B3-TraceId\":\"9590477961c17418\",\"Content-Length\":\"75\",\"X-Real-IP\":\"221.12.37.146\",\"timestamp\":\"1748484475\",\"Content-Type\":\"application/json\",\"Accept\":\"*/*\",\"X-B3-ParentSpanId\":\"9590477961c17418\",\"X-Forwarded-Host\":\"123.156.230.15:8089\",\"X-Forwarded-Proto\":\"http,http\",\"app-key\":\"HB0llhHmc56AW9yw\",\"X-Forwarded-Port\":\"8089\",\"x-client-token\":\"eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJqaW5oZmgtbWhzaC1zZXJ2aWNlIiwidXNlcklkIjoiNDA4MyIsIm5hbWUiOiJqaW5oZmgtbWhzaC1zZXJ2aWNlIiwiZXhwIjoyMDYzODQ0MDAwfQ.Woq4L0kiCCbVYFt8PwFj71eBx-u2S3mlX13dq7lEZwR8ILSxJNeLuK6JPoV72YLW82G9hRQHHncMZL3O4UnvmP2CWRIet3ekfW-61_PW82sgEIiKXK3bS5nBiQmk5vEChYG8VQ5Ze6lGkxL0baPujqA-CPV9KiQ0HNXLFKFec0w\",\"NEBULA-DST-SERVICE\":\"iobp-itfin-api\",\"X-B3-SpanId\":\"a9fd27f63a83ff9c\",\"biz-type\":\"10\",\"traceparent\":\"00-4f690c2f2e5c5784a6415a740b5fb80a-d33a2abbf42c407c-01\",\"Forwarded\":\"proto=http;host=\\\"123.156.230.15:8089\\\";for=\\\"127.0.0.1:52440\\\"\",\"X-Forwarded-For\":\"221.12.37.146,127.0.0.1\",\"REQUEST-START-TIME\":\"1748484466443\"}";
|
||||
String params = "{\"price\":1,\"thirdOrderId\":\"202505260000001\",\"userId\":\"1875049673022279681\"}";
|
||||
keyManageService.checkSignAndReturnConfig(params, JSONUtil.toBean(headers, Map.class));
|
||||
}
|
||||
|
||||
private ThirdKeyManageEntity getLbConfig() {
|
||||
return keyManageService.get(ThirdKeyTypeEnum.LB);
|
||||
}
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@
|
||||
<if test="dto.isWalletTransaction != null">
|
||||
AND a.is_wallet_transaction = #{dto.isWalletTransaction}
|
||||
</if>
|
||||
<if test="dto.processStatus != null">
|
||||
<if test="dto.processStatus != null and dto.processStatus != '' ">
|
||||
AND a.process_status = #{dto.processStatus}
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
|
||||
-1
@@ -82,7 +82,6 @@ public class WalletManageEntity extends Model<WalletManageEntity> {
|
||||
private Integer freezePrice;
|
||||
|
||||
/**
|
||||
* @deprecated 已废弃
|
||||
* 是否冻结饭卡
|
||||
*/
|
||||
@Schema(description = "是否冻结饭卡")
|
||||
|
||||
+8
-4
@@ -54,13 +54,14 @@ public class WalletFreezeController {
|
||||
@PostMapping("/app/apply-freeze")
|
||||
@Operation(summary = "申请冻结")
|
||||
public R<Object> appApplyFreeze(@RequestBody WalletFreezeDto dto) {
|
||||
if (ObjectUtil.isEmpty(dto.getWalletId())) {
|
||||
throw new RuntimeException("钱包id不能为空");
|
||||
if (ObjectUtil.isEmpty(dto.getWalletTypeId())) {
|
||||
throw new RuntimeException("钱包类型id不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(dto.getRemark())) {
|
||||
throw new RuntimeException("备注不能为空");
|
||||
}
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
walletFreezeService.applyFreeze(dto, user);
|
||||
return R.ok(true);
|
||||
}
|
||||
@@ -94,7 +95,9 @@ public class WalletFreezeController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_add')")
|
||||
public R save(@RequestBody WalletFreezeDto dto) {
|
||||
return R.ok(walletFreezeService.create(dto));
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
walletFreezeService.applyFreeze(dto, user);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "新增饭卡冻结记录表", description = "新增饭卡冻结记录表")
|
||||
@@ -104,7 +107,8 @@ public class WalletFreezeController {
|
||||
public R appSave(@RequestBody WalletFreezeDto dto) {
|
||||
PjcloudUser loginUser = SecurityUtils.getUser();
|
||||
dto.setUserId(loginUser.getId());
|
||||
return R.ok(walletFreezeService.create(dto));
|
||||
walletFreezeService.applyFreeze(dto, loginUser);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "修改饭卡冻结记录表", description = "修改饭卡冻结记录表")
|
||||
|
||||
+5
-3
@@ -121,9 +121,11 @@ public class MchManageController {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setVisibleMobile(YesNoEnum.YES.getCode());
|
||||
// 如果是食堂判断用户是否能查看到所有食堂
|
||||
boolean isConsumeUser = mchManageService.getIsConsumeUser(user.getId());
|
||||
if (isConsumeUser) {
|
||||
dto.setCanteenIsOpen(YesNoEnum.YES.getCode());
|
||||
if (ObjectUtil.equals(dto.getType(), MerchantTypeEnum.CANTEEN.getType())) {
|
||||
boolean isConsumeUser = mchManageService.getIsConsumeUser(user.getId());
|
||||
if (isConsumeUser) {
|
||||
dto.setCanteenIsOpen(YesNoEnum.YES.getCode());
|
||||
}
|
||||
}
|
||||
return R.ok(mchManageService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
-2
@@ -16,8 +16,6 @@ public interface WalletFreezeService extends IService<WalletFreezeEntity> {
|
||||
|
||||
Page<WalletFreezeVo> scopePageList(Page page, WalletFreezeDto dto);
|
||||
|
||||
Long create(WalletFreezeDto dto);
|
||||
|
||||
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
|
||||
|
||||
void applyFreeze(WalletFreezeDto dto, PjcloudUser user);
|
||||
|
||||
+15
-25
@@ -85,30 +85,6 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long create(WalletFreezeDto dto) {
|
||||
// 查询发起人
|
||||
UserInfo userData = userService.getInnerByUserId(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(userData)) throw new RuntimeException("发起人不存在");
|
||||
// 判断之前有没有在审核的
|
||||
if (isCheckData(dto.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
|
||||
// 查询钱包
|
||||
WalletManageEntity wallet = walletManageService.getWallet(dto.getUserId(), dto.getWalletTypeId());
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("用户钱包不存在");
|
||||
dto.setDeptId(userData.getSysUser().getDeptId());
|
||||
dto.setFreeStatus(YesNoEnum.NO.getCode());
|
||||
dto.setWalletId(wallet.getId());
|
||||
dto.setProcessStatus(TaskCheckStatusEnum.PADDING.getCode());
|
||||
// 查询部门
|
||||
SysDept dept = deptService.getDeptByDeptId(dto.getDeptId()).getData();
|
||||
if (ObjectUtil.isEmpty(dept)) throw new RuntimeException("发起人部门不存在");
|
||||
baseMapper.insert(dto);
|
||||
// 发起审批
|
||||
getSelf().applyFlow(userData, dept, wallet, dto);
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void applyCallback(ProcessNodeRecordAssignUserParamDto dto) {
|
||||
@@ -140,7 +116,7 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void applyFreeze(WalletFreezeDto dto, PjcloudUser user) {
|
||||
WalletManageEntity wallet = walletManageService.getWallet(dto.getWalletId());
|
||||
WalletManageEntity wallet = walletManageService.getWallet(dto.getUserId(), dto.getWalletTypeId());
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("钱包不存在");
|
||||
// 判断之前有没有在审核的
|
||||
if (isCheckData(dto.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
|
||||
@@ -167,6 +143,20 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
dto.setProcessInstanceIdList(walletFreezeList.stream().map(WalletFreezeEntity::getProcessId).toList());
|
||||
remoteFlowEngineService.stopProcessInstance(dto).getData();
|
||||
}
|
||||
for (Long v : list) {
|
||||
WalletFreezeEntity walletFreeze = baseMapper.selectById(v);
|
||||
if (ObjectUtil.isEmpty(walletFreeze)) {
|
||||
continue;
|
||||
}
|
||||
if (ObjectUtil.notEqual(walletFreeze.getProcessStatus(), TaskCheckStatusEnum.RESULT.getCode())) {
|
||||
continue;
|
||||
}
|
||||
// 取消冻结
|
||||
if (ObjectUtil.equals(walletFreeze.getFreeStatus(), YesNoEnum.YES.getCode())) {
|
||||
WalletManageEntity walletUpdateObj = WalletManageEntity.builder().id(walletFreeze.getWalletId()).isFreeze(YesNoEnum.NO.getCode()).build();
|
||||
walletManageService.updateById(walletUpdateObj);
|
||||
}
|
||||
}
|
||||
this.removeByIds(list);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user