feat:第三方查询流水
This commit is contained in:
1 parent
02c011a732
commit
c6231ce4d2
14 files changed
+137
-12
No files matched your search
+3
-2
@@ -7,6 +7,7 @@ import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -70,10 +71,10 @@ public class OfflineOrder {
|
||||
private Double weight;
|
||||
|
||||
@Schema(description = "支付时间")
|
||||
private String payTime;
|
||||
private LocalDateTime payTime;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "购物车列表")
|
||||
private List<OfflineCar> carList;
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.hard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HardOfflinePayDto {
|
||||
|
||||
private List<Long> orderIds;
|
||||
|
||||
}
|
||||
+7
@@ -51,4 +51,11 @@ public class HardOrderVo extends HardOrderEntity implements BaseUserInterface, B
|
||||
* 预约二维码信息
|
||||
*/
|
||||
private String reserveCode;
|
||||
|
||||
/**
|
||||
* 退款相关
|
||||
*/
|
||||
private Long afterSaleId;
|
||||
|
||||
private String afterSaleNo;
|
||||
}
|
||||
+1
-1
@@ -96,7 +96,7 @@ public class HardApiController {
|
||||
|
||||
@PostMapping("/sync-offline-order")
|
||||
@Operation(summary = "同步离线订单")
|
||||
@Idempotent(expireTime = 10, info = "正在处理中,请勿重复操作")
|
||||
@Idempotent(expireTime = 1, info = "正在处理中,请勿重复操作")
|
||||
public R<List<String>> syncOfflineOrder(@Valid @RequestBody SyncOfflineReqVo dto) {
|
||||
return R.ok(hardOrderSyncService.syncOfflineOrder(dto));
|
||||
}
|
||||
|
||||
+11
@@ -28,6 +28,7 @@ import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.app.HardAppCreateOrderScancode;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.CurrentUserHardTypeInfoDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HardOfflinePayDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderPreferencesDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
@@ -37,6 +38,7 @@ import com.bsd.pjcloud.hard.api.vo.order.excel.HardOrderExcelVo;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardManagerService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderSyncService;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
@@ -73,6 +75,7 @@ public class HardOrderController {
|
||||
|
||||
private final HardOrderService hardwareOrderService;
|
||||
private final HardManagerService hardManagerService;
|
||||
private final HardOrderSyncService hardOrderSyncService;
|
||||
|
||||
private final HardOrderMapper hardOrderMapper;
|
||||
|
||||
@@ -227,6 +230,14 @@ public class HardOrderController {
|
||||
return R.ok(hardwareOrderService.join(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "离线订单手动支付", description = "离线订单手动支付")
|
||||
@PostMapping("/offline-pay")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardwareOrder_offlinePay')")
|
||||
public R offlinePay(@RequestBody HardOfflinePayDto dto) {
|
||||
hardOrderSyncService.offlinePay(dto.getOrderIds());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardwareOrder_export')")
|
||||
public void export(HttpServletResponse response, HardOrderDto dto) throws IOException {
|
||||
|
||||
+15
@@ -4,8 +4,10 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardChartLatitudeVo;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderSumAndCountDto;
|
||||
@@ -89,6 +91,19 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
return selectJoinOne(HardOrderVo.class, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询离线订单
|
||||
*/
|
||||
default List<HardOrderEntity> getOfflineOrderList(List<Long> orderIds) {
|
||||
LambdaQueryWrapper<HardOrderEntity> wrapper = new LambdaQueryWrapper<HardOrderEntity>()
|
||||
.in(HardOrderEntity::getId, orderIds)
|
||||
.eq(HardOrderEntity::getOrderStatus, HardOrderStatusEnum.OFFLINE_CREATE.getType())
|
||||
.eq(HardOrderEntity::getIsOfflineOrder, YesNoEnum.YES.getCode())
|
||||
.orderByDesc(HardOrderEntity::getCreateTime)
|
||||
.orderByDesc(HardOrderEntity::getId);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
|
||||
default List<HardOrderEntity> list(HardOrderDto dto) {
|
||||
return selectListByScope(commonWrapper(dto), DataScope.of());
|
||||
}
|
||||
|
||||
+4
@@ -14,4 +14,8 @@ public interface HardOrderSyncService {
|
||||
*/
|
||||
List<String> syncOfflineOrder(@Valid SyncOfflineReqVo dto);
|
||||
|
||||
/**
|
||||
* 离线订单手动支付
|
||||
*/
|
||||
void offlinePay(List<Long> orderIds);
|
||||
}
|
||||
+54
-3
@@ -5,6 +5,8 @@ import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.async.OfflineCar;
|
||||
import com.bsd.pjcloud.hard.api.dto.async.OfflineOrder;
|
||||
@@ -12,11 +14,15 @@ import com.bsd.pjcloud.hard.api.dto.async.SyncOfflineReqVo;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardCarEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardParentCarEntity;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardCarService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderSyncService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import com.bsd.pjcloud.hard.service.HardParentCarService;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletSettingService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
|
||||
@@ -27,7 +33,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 订单同步
|
||||
@@ -40,12 +48,16 @@ public class HardOrderSyncServiceImpl implements HardOrderSyncService {
|
||||
|
||||
static private final String TAG = "订单同步";
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
private final RemoteWalletSettingService walletSettingService;
|
||||
private final HardCarService hardCarService;
|
||||
private final HardParentCarService hardParentCarService;
|
||||
private final HardOrderService orderService;
|
||||
|
||||
private final HardOrderMapper hardOrderMapper;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
private final RemoteWalletSettingService walletSettingService;
|
||||
private final RemoteWalletService walletService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<String> syncOfflineOrder(SyncOfflineReqVo body) {
|
||||
@@ -58,7 +70,7 @@ public class HardOrderSyncServiceImpl implements HardOrderSyncService {
|
||||
if (ObjectUtil.isNotEmpty(setting) && ObjectUtil.isNotEmpty(setting.getOffLineOrderApplyEnable())) {
|
||||
offLineOrderApplyEnable = ObjectUtil.equals(setting.getOffLineOrderApplyEnable(), YesNoEnum.YES.getCode());
|
||||
}
|
||||
List<String> createIdList = List.of();
|
||||
List<String> createIdList = new ArrayList<>();
|
||||
List<OfflineOrder> list = body.getList();
|
||||
for (OfflineOrder i : list) {
|
||||
if (ObjectUtil.isEmpty(i.getCarList())) {
|
||||
@@ -75,6 +87,19 @@ public class HardOrderSyncServiceImpl implements HardOrderSyncService {
|
||||
HardOrderEntity order = parseOrder(i, body.getHardwareId(), body.getMerchantId(), merchant.getDeptId());
|
||||
HardParentCarEntity parentCar = parseParentCar(i, body.getMerchantId());
|
||||
List<HardCarEntity> carList = i.getCarList().stream().map(this::parseCar).toList();
|
||||
|
||||
// 查询钱包
|
||||
WalletManageEntity wallet = null;
|
||||
if (ObjectUtil.isNotEmpty(merchant.getDefaultWalletTypeId())) {
|
||||
wallet = walletService.getWallet(order.getUserId(), WalletTypeEnum.EAT).getData();
|
||||
} else {
|
||||
wallet = walletService.getWalletByWalletTypeId(order.getUserId(), merchant.getDefaultWalletTypeId()).getData();
|
||||
}
|
||||
if (ObjectUtil.isEmpty(wallet)) {
|
||||
log.error("|{}|同步安卓机离线订单,钱包不存在order:{}", TAG, JSON.toJSONString(i));
|
||||
continue;
|
||||
}
|
||||
order.setWalletId(wallet.getId());
|
||||
if (!ObjectUtil.isAllNotEmpty(order, parentCar, carList)) {
|
||||
log.error("|{}|同步安卓机离线订单,order、parentCar、carList任意一个为空order:{}", TAG, JSON.toJSONString(i));
|
||||
continue;
|
||||
@@ -85,6 +110,31 @@ public class HardOrderSyncServiceImpl implements HardOrderSyncService {
|
||||
return createIdList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 离线订单手动支付
|
||||
*/
|
||||
@Override
|
||||
public void offlinePay(List<Long> orderIds) {
|
||||
// 查询离线订单
|
||||
List<HardOrderEntity> list = hardOrderMapper.getOfflineOrderList(orderIds);
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
for (HardOrderEntity v : list) {
|
||||
getSelf().offlinePay(v);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 离线订单手动支付
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void offlinePay(HardOrderEntity order) {
|
||||
// 支付
|
||||
orderService.fastReduceBalance(order);
|
||||
// 标记离线支付成功
|
||||
HardOrderEntity updateObj = HardOrderEntity.builder().id(order.getId()).offlinePaySuccess(YesNoEnum.YES.getCode()).build();
|
||||
orderService.updateById(updateObj);
|
||||
}
|
||||
|
||||
// 同步安卓机单个离线订单 TODO 允许把金额扣为负数
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean createOfflineOrder(HardOrderEntity order, HardParentCarEntity parentCar, List<HardCarEntity> list, OfflineOrder offlineOrder, boolean offLineOrderApplyEnable) {
|
||||
@@ -144,6 +194,7 @@ public class HardOrderSyncServiceImpl implements HardOrderSyncService {
|
||||
HardParentCarEntity res = new HardParentCarEntity();
|
||||
res.setUserId(order.getUserCode());
|
||||
res.setMerchantId(merchantId);
|
||||
res.setHardType(order.getSysType().getType());
|
||||
res.setOrderStatus(HardOrderStatusEnum.OFFLINE_CREATE.getType());
|
||||
return res;
|
||||
}
|
||||
|
||||
+3
-3
@@ -275,11 +275,11 @@ public class HardThirdPayServiceImpl implements HardThirdPayService {
|
||||
PayWaterVo item = new PayWaterVo();
|
||||
item.setUserId(v.getUserId());
|
||||
item.setName(v.getUsername());
|
||||
item.setSignPhone("");
|
||||
item.setSignPhone(v.getUserMobile());
|
||||
item.setPlatformOrderId(String.valueOf(v.getId()));
|
||||
item.setPlatformRefundId(String.valueOf(v.getPayRefundId()));
|
||||
item.setPlatformRefundId(String.valueOf(v.getAfterSaleId()));
|
||||
item.setThirdOrderId(v.getOrderNo());
|
||||
item.setThirdRefundId("");
|
||||
item.setThirdRefundId(String.valueOf(v.getAfterSaleNo()));
|
||||
item.setOrderStatus(v.getOrderStatus());
|
||||
item.setOrderPrice(v.getPayPrice());
|
||||
item.setRefundPrice(v.getRefundPrice());
|
||||
|
||||
+7
-1
@@ -100,6 +100,9 @@
|
||||
<if test="dto.merchantId != null">
|
||||
and a.merchant_id = #{dto.merchantId}
|
||||
</if>
|
||||
<if test="dto.isOfflineOrder != null">
|
||||
and a.is_offline_order = #{dto.isOfflineOrder}
|
||||
</if>
|
||||
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
|
||||
<choose>
|
||||
<when test="dto.isInclude != null and dto.isInclude == true">
|
||||
@@ -180,9 +183,12 @@
|
||||
<include refid="selectA"/>
|
||||
m.name as hardName,
|
||||
m.type as hardType,
|
||||
m.dept_id as hardTypeDeptId
|
||||
m.dept_id as hardTypeDeptId,
|
||||
s.id as afterSaleId,
|
||||
s.no as afterSaleNo
|
||||
from hard_order a
|
||||
left join hard_manager m on m.id = a.hard_id
|
||||
left join hard_after_sale s on s.order_id = a.id
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
<if test="dto.hardTypeCode != null and dto.hardTypeCode != '' ">
|
||||
|
||||
+4
@@ -253,6 +253,10 @@ public class ThirdPayApiServiceImpl implements ThirdPayApiService {
|
||||
payLogService.save(logObj);
|
||||
return baseVo;
|
||||
}
|
||||
// 加密一下手机号
|
||||
for (PayWaterVo item : pageList.getData()) {
|
||||
item.setSignPhone(LbRetailSignUtils.sm4Encrypt(item.getSignPhone(), keySetting.getFieldKey()));
|
||||
}
|
||||
return pageList;
|
||||
} catch (Exception e) {
|
||||
log.error("|{}|流水查询,json|{}|headers|{}|", TAG, json, headers, e);
|
||||
|
||||
+2
-2
@@ -89,8 +89,8 @@ zy:
|
||||
# callback-recognition-url: /third/third-ks/callback/recognition
|
||||
# callback-sku-url: /third/third-ks/callback/sku
|
||||
lb:
|
||||
# base-url: https://elss-sit.nbcb.com.cn
|
||||
base-url: https://elss-sit.nbcb.com.cn/h5/thirdApp
|
||||
base-url: https://elss-sit.nbcb.com.cn
|
||||
# base-url: https://elss-sit.nbcb.com.cn/h5/thirdApp
|
||||
app-id: 7da62b1a9ade473c917f573c5748081e
|
||||
app-secret: 8ffl6b+OKTmdVAt9Qo+2F/HQQMdt/d8GFia0zUOt9l=
|
||||
company-number: 202504673472
|
||||
|
||||
Binary file not shown.
+14
@@ -5,9 +5,12 @@ import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.bsd.pjcloud.thirdparty.ThirdPartyApp;
|
||||
import com.bsd.pjcloud.thirdparty.constant.ThirdKeyTypeEnum;
|
||||
import com.bsd.pjcloud.thirdparty.dto.lb.LbH5LoginDto;
|
||||
import com.bsd.pjcloud.thirdparty.entity.ThirdKeyManageEntity;
|
||||
import com.bsd.pjcloud.thirdparty.service.ThirdKeyManageService;
|
||||
import com.bsd.pjcloud.thirdparty.service.impl.lb.ThirdLbApiServiceImpl;
|
||||
import com.bsd.pjcloud.thirdparty.utils.lb.tool.LbRetailSignUtils;
|
||||
import com.bsd.pjcloud.thirdparty.vo.lb.LbH5LoginVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayBaseVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.pay.PayWalletInfoVo;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -39,6 +42,17 @@ public class PayTest {
|
||||
@Resource
|
||||
private ThirdKeyManageService keyManageService;
|
||||
|
||||
@Resource
|
||||
private ThirdLbApiServiceImpl thirdLbApiService;
|
||||
|
||||
// 宁波银行H5登录
|
||||
@Test
|
||||
public void lbH5login() throws Exception {
|
||||
LbH5LoginDto dto = new LbH5LoginDto();
|
||||
dto.setPhone("17683843144");
|
||||
LbH5LoginVo loginVo = thirdLbApiService.h5Login(dto);
|
||||
}
|
||||
|
||||
// 查询钱包信息
|
||||
@Test
|
||||
public void walletInfo() throws Exception {
|
||||
|
||||
Reference in new issue
Block a user