fix:打标接口针对网商改动;字段名修改;网商开通回调;大额充值回调

This commit is contained in:
wangff
2025-11-19 14:41:40 +08:00
parent 3ddf965a6c
commit 088ee0a0e5
16 changed files with 88 additions and 36 deletions

View File

@@ -25,6 +25,17 @@ public class WalletPaymentOrderDAO {
walletPaymentOrderMapper.insertSelective(walletPaymentOrderDO); walletPaymentOrderMapper.insertSelective(walletPaymentOrderDO);
} }
/**
* 更新订单状态
*/
public void updateOrderByPaymentId(String storeId, String paymentId, Integer orderStatus) {
Example example = new Example(WalletPaymentOrderDO.class);
example.createCriteria()
.andEqualTo("storeId", storeId)
.andEqualTo("paymentId", paymentId);
walletPaymentOrderMapper.updateByExampleSelective(WalletPaymentOrderDO.builder().orderStatus(orderStatus).build(), example);
}
/** /**
* 查询未支付的充值订单 * 查询未支付的充值订单
*/ */

View File

@@ -57,7 +57,7 @@ public class AccountInfoDTO {
@ApiModelProperty(value = "支行编号", required = true) @ApiModelProperty(value = "支行编号", required = true)
private String bankNo; private String bankNo;
@ApiModelProperty(value = "账户状态 1:待提交 2:待鉴权 3:鉴权中 4:开通", required = true) @ApiModelProperty(value = "账户状态 1:待提交 2:待鉴权 3:鉴权中 4:开通 5:开通失败", required = true)
private Integer accountStatus; private Integer accountStatus;
@ApiModelProperty(value = "账户余额", required = true) @ApiModelProperty(value = "账户余额", required = true)

View File

@@ -17,7 +17,7 @@ import java.util.List;
@Data @Data
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class BillPageDTO { public class BillPageDTO {
private List<BillDTO> data; private List<BillDTO> pageData;
private WalletBasicPageInfo page; private WalletBasicPageInfo page;
} }

View File

@@ -23,5 +23,6 @@ public class AccountBatchQueryRequest {
@ApiModelProperty(value = "分页信息",required = true) @ApiModelProperty(value = "分页信息",required = true)
private WalletBasicPageInfo page; private WalletBasicPageInfo page;
@ApiModelProperty(value = "钱包类型 1.平安 2.网商", required = true)
private Integer walletType;
} }

View File

@@ -4,6 +4,7 @@ import com.cool.store.common.PageBasicInfo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
/** /**
@@ -17,6 +18,7 @@ import java.util.Date;
@Data @Data
public class AccountBillQueryRequest extends PageBasicInfo { public class AccountBillQueryRequest extends PageBasicInfo {
@ApiModelProperty("门店id") @ApiModelProperty("门店id")
@NotNull(message = "门店id不能为空")
private Long shopId; private Long shopId;
@ApiModelProperty("交易开始时间,不传查当月") @ApiModelProperty("交易开始时间,不传查当月")
@@ -25,12 +27,16 @@ public class AccountBillQueryRequest extends PageBasicInfo {
@ApiModelProperty("交易结束时间") @ApiModelProperty("交易结束时间")
private Date endDate; private Date endDate;
@ApiModelProperty(value = "是否签约人账户 0 否 1 是") @ApiModelProperty(value = "钱包类型 1.平安 2.网商", required = true)
@NotNull(message = "钱包类型不能为空")
private Integer walletType;
@ApiModelProperty("是否签约人账户 0 否 1 是")
private Integer isLegal; private Integer isLegal;
@ApiModelProperty(value = "交易类型: 0.全部,1.支出 2.收入") @ApiModelProperty("交易类型: 0.全部,1.支出 2.收入")
private Integer recordType; private Integer recordType;
@ApiModelProperty(value = "费用类型ID", required = true) @ApiModelProperty("费用类型ID")
private Long feeItemId; private Long feeItemId;
} }

View File

@@ -23,8 +23,10 @@ public class BillPageRequest {
private String beginDate; private String beginDate;
@ApiModelProperty(value = "交易结束时间YYYY-MM-DD HH:MM:SS", required = true) @ApiModelProperty(value = "交易结束时间YYYY-MM-DD HH:MM:SS", required = true)
private String endDate; private String endDate;
@ApiModelProperty(value = "钱包类型 1.门店钱包(平安) 2.签约人钱包(平安) 3.返利钱包(网商)", required = true) @ApiModelProperty(value = "钱包类型 1.平安 2.网商", required = true)
private Integer walletType; private Integer walletType;
@ApiModelProperty(value = "是否签约人钱包", required = false)
private Integer isLegal;
@ApiModelProperty(value = "交易类型: 0.全部,1.支出 2.收入", required = false) @ApiModelProperty(value = "交易类型: 0.全部,1.支出 2.收入", required = false)
private Integer recordType; private Integer recordType;
@ApiModelProperty(value = "费用类型ID", required = true) @ApiModelProperty(value = "费用类型ID", required = true)

View File

@@ -2,7 +2,10 @@ package com.cool.store.request.wallet;
import com.sun.istack.NotNull; import com.sun.istack.NotNull;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@@ -12,6 +15,9 @@ import javax.validation.constraints.NotBlank;
* @Version 1.0 * @Version 1.0
*/ */
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CreateStoreRequest { public class CreateStoreRequest {
@ApiModelProperty(value = "CRM门店编号", required = true) @ApiModelProperty(value = "CRM门店编号", required = true)

View File

@@ -27,4 +27,7 @@ public class WalletWithDrawerRequest extends StoreShopRequest {
@NotBlank(message = "支付密码不能为空") @NotBlank(message = "支付密码不能为空")
private String payPwd; private String payPwd;
@ApiModelProperty("钱包类型 1.平安 2.网商")
@NotNull(message = "钱包类型不能为空")
private Integer walletType;
} }

View File

@@ -25,5 +25,7 @@ public class WithDrawerRequest {
private String amount; private String amount;
@ApiModelProperty(value = "提现备注") @ApiModelProperty(value = "提现备注")
private String remark; private String remark;
@ApiModelProperty(value = "钱包类型 1.平安 2.网商", required = true)
private Integer walletType;
} }

View File

@@ -37,6 +37,6 @@ public class AccountInfoVO {
@ApiModelProperty(value = "打标状态 0 未打标 1 已打标") @ApiModelProperty(value = "打标状态 0 未打标 1 已打标")
private Integer labelingStatus; private Integer labelingStatus;
@ApiModelProperty("账户升级失败原因") @ApiModelProperty("平安账户升级/网商开通失败原因")
private String failReason; private String failReason;
} }

View File

@@ -154,7 +154,7 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
private void addTagIfUploadLicense(Long shopId) { private void addTagIfUploadLicense(Long shopId) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId); ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
walletService.addTagIfUploadLicense(shopId, shopInfo.getStoreId()); walletService.addTagIfUploadLicense(shopId, shopInfo.getStoreId(), shopInfo.getLineId());
} }
@Override @Override

View File

@@ -49,7 +49,7 @@ public class WalletApiService {
* @return * @return
*/ */
public AccountNoDTO createStore(CreateStoreRequest request){ public AccountNoDTO createStore(CreateStoreRequest request){
return walletHttpClientRest.postWithSign(walletBaseUrl+"/open/crm/v1/createStoreAndAccount", request, AccountNoDTO.class); return walletHttpClientRest.postWithSign(walletBaseUrl+"/open/crm/account/v1/createStore", request, AccountNoDTO.class);
} }
/** /**

View File

@@ -49,8 +49,9 @@ public interface WalletService {
* 判断营业执照是否已经上传,已上传则调用打标接口 * 判断营业执照是否已经上传,已上传则调用打标接口
* @param shopId 门店shopId * @param shopId 门店shopId
* @param storeId 主数据门店id * @param storeId 主数据门店id
* @param lineId 线索id
*/ */
void addTagIfUploadLicense(Long shopId, String storeId); void addTagIfUploadLicense(Long shopId, String storeId, Long lineId);
/** /**
* 打标成功回调通知 * 打标成功回调通知

View File

@@ -4,10 +4,7 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants; import com.cool.store.constants.CommonConstants;
import com.cool.store.constants.RedisConstant; import com.cool.store.constants.RedisConstant;
import com.cool.store.dao.LineInfoDAO; import com.cool.store.dao.*;
import com.cool.store.dao.RegionDao;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.dao.wallet.WalletPaymentOrderDAO; import com.cool.store.dao.wallet.WalletPaymentOrderDAO;
import com.cool.store.dto.wallet.*; import com.cool.store.dto.wallet.*;
import com.cool.store.entity.*; import com.cool.store.entity.*;
@@ -66,6 +63,7 @@ public class WalletServiceImpl implements WalletService {
private final WalletPaymentOrderDAO walletPaymentOrderDAO; private final WalletPaymentOrderDAO walletPaymentOrderDAO;
private final LineInfoDAO lineInfoDAO; private final LineInfoDAO lineInfoDAO;
private final RedisUtilPool redisUtilPool; private final RedisUtilPool redisUtilPool;
private final QualificationsInfoDAO qualificationsInfoDAO;
private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@@ -73,10 +71,6 @@ public class WalletServiceImpl implements WalletService {
public Boolean accountCreate(AccountCreateRequest request) { public Boolean accountCreate(AccountCreateRequest request) {
ShopInfoDO shopInfo = getAndVerifyShopAndStage(request.getShopId()); ShopInfoDO shopInfo = getAndVerifyShopAndStage(request.getShopId());
// 调用 创建门店签约人账户接口 // 调用 创建门店签约人账户接口
RegionDO regionDO = regionDao.getRegionById(shopInfo.getRegionId());
if (Objects.isNull(regionDO)) {
throw new ServiceException(ErrorCodeEnum.REGION_NOT_EXIST);
}
CreateStoreAndAccountRequest accountRequest = CreateStoreAndAccountRequest.builder() CreateStoreAndAccountRequest accountRequest = CreateStoreAndAccountRequest.builder()
.outStoreId(shopInfo.getStoreId()) .outStoreId(shopInfo.getStoreId())
.phoneNumber(request.getMobile()) .phoneNumber(request.getMobile())
@@ -102,7 +96,7 @@ public class WalletServiceImpl implements WalletService {
if (Objects.nonNull(authentication)) { if (Objects.nonNull(authentication)) {
if (authentication.getAccountStatus().equals(4)) { if (authentication.getAccountStatus().equals(4)) {
// 判断营业执照是否已经上传,已上传则调用打标接口 // 判断营业执照是否已经上传,已上传则调用打标接口
addTagIfUploadLicense(request.getShopId(), shopInfo.getStoreId()); addTagIfUploadLicense(request.getShopId(), shopInfo.getStoreId(), shopInfo.getLineId());
} }
return new AccountAuthenticationVO(authentication.getAccountStatus()); return new AccountAuthenticationVO(authentication.getAccountStatus());
} }
@@ -132,7 +126,7 @@ public class WalletServiceImpl implements WalletService {
shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(), updateSubStageList); shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(), updateSubStageList);
// 判断营业执照是否已经上传,已上传则调用打标接口 // 判断营业执照是否已经上传,已上传则调用打标接口
addTagIfUploadLicense(request.getShopId(), shopInfo.getStoreId()); addTagIfUploadLicense(request.getShopId(), shopInfo.getStoreId(), shopInfo.getLineId());
return true; return true;
} }
@@ -160,23 +154,33 @@ public class WalletServiceImpl implements WalletService {
} }
@Override @Override
public void addTagIfUploadLicense(Long shopId, String storeId) { public void addTagIfUploadLicense(Long shopId, String storeId, Long lineId) {
LicenseTransactDO licenseTransactDO = applyLicenseMapper.selectByShopId(shopId); LicenseTransactDO license = applyLicenseMapper.selectByShopId(shopId);
// 营业执照已上传,调用打标接口 // 营业执照已上传,调用打标接口
if (Objects.nonNull(licenseTransactDO) && StringUtils.isNotBlank(licenseTransactDO.getCreditUrl())) { if (Objects.nonNull(license) && StringUtils.isNotBlank(license.getCreditUrl())) {
try { try {
// 判断一下账户的开通状态 // 判断一下账户的开通状态
if (enableAddTag(storeId)) { if (enableAddTag(storeId)) {
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(lineId);
QualificationsInfoDO qualificationsInfoDO = qualificationsInfoDAO.getByLineId(lineId);
// 调用 签约人账户打标(升级)接口 // 调用 签约人账户打标(升级)接口
log.info("营业执照已上传,账户打标"); log.info("营业执照已上传,账户打标");
AccountAddTagRequest tagRequest = AccountAddTagRequest.builder() AccountAddTagRequest tagRequest = AccountAddTagRequest.builder()
.outStoreId(storeId) .outStoreId(storeId)
.licenseNo(licenseTransactDO.getCreditCode()) .licenseNo(license.getCreditCode())
.licenseName(licenseTransactDO.getBusinessLicense()) .licenseName(license.getBusinessLicense())
// .licenseExpire(Objects.nonNull(licenseTransactDO.getValidity()) ? CoolDateUtils.DateFormat(licenseTransactDO.getValidity(), "yyyy-MM-dd") : "2999-12-31") // .licenseExpire(Objects.nonNull(licenseTransactDO.getValidity()) ? CoolDateUtils.DateFormat(licenseTransactDO.getValidity(), "yyyy-MM-dd") : "2999-12-31")
.legalName(licenseTransactDO.getLicenseLegalPerson()) .legalName(license.getLicenseLegalPerson())
.legalNo(licenseTransactDO.getLicenseLegalIdCardNo()) .legalNo(license.getLicenseLegalIdCardNo())
.legalPhone(licenseTransactDO.getLicenseLegalMobile()) .legalPhone(license.getLicenseLegalMobile())
.certPhotoA(license.getLicenseLegalIdCardFront())
.certPhotoB(license.getLicenseLegalIdCardBack())
.licensePhoto(license.getCreditUrl())
.signatoryName(lineInfoDO.getUsername())
.signatoryNo(qualificationsInfoDO.getIdCardNo())
.signatoryPhone(lineInfoDO.getMobile())
.signatoryPhotoA(qualificationsInfoDO.getFrontOfIdCard())
.signatoryPhotoB(qualificationsInfoDO.getBackOfIdCard())
.build(); .build();
AddTagDTO addTagDTO = walletApiService.addTag(tagRequest); AddTagDTO addTagDTO = walletApiService.addTag(tagRequest);
log.info("打标接口调用成功response:{}", JSONObject.toJSONString(addTagDTO)); log.info("打标接口调用成功response:{}", JSONObject.toJSONString(addTagDTO));
@@ -210,18 +214,33 @@ public class WalletServiceImpl implements WalletService {
redisUtilPool.delKey(key); redisUtilPool.delKey(key);
} }
} catch (Exception e) { } catch (Exception e) {
log.info("回调失败", e); log.info("平安打标回调失败", e);
} }
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override @Override
public Boolean largePaymentCallback(PaymentDTO request) { public Boolean largePaymentCallback(PaymentDTO request) {
try {
walletPaymentOrderDAO.updateOrderByPaymentId(request.getOutStoreId(), request.getPaymentId(), request.getOrderStatus());
} catch (Exception e) {
log.error("大额充值回调失败", e);
}
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override @Override
public Boolean onlineCommercialBankCallback(OnlineCommercialBankCallbackRequest request) { public Boolean onlineCommercialBankCallback(OnlineCommercialBankCallbackRequest request) {
try {
String key = MessageFormat.format(RedisConstant.WALLET_OPEN_FAIL, request.getOutStoreId(), "1");
if (Integer.valueOf(5).equals(request.getAccountStatus())) {
redisUtilPool.setString(key, request.getFailReason());
} else {
redisUtilPool.delKey(key);
}
} catch (Exception e) {
log.info("平安打标回调失败", e);
}
return Boolean.TRUE; return Boolean.TRUE;
} }
@@ -259,14 +278,15 @@ public class WalletServiceImpl implements WalletService {
.outStoreId(shopInfo.getStoreId()) .outStoreId(shopInfo.getStoreId())
.beginDate(DateUtil.format(request.getBeginDate(), "yyyy-MM-dd HH:mm:ss")) .beginDate(DateUtil.format(request.getBeginDate(), "yyyy-MM-dd HH:mm:ss"))
.endDate(DateUtil.format(request.getEndDate(), "yyyy-MM-dd HH:mm:ss")) .endDate(DateUtil.format(request.getEndDate(), "yyyy-MM-dd HH:mm:ss"))
.walletType(CommonConstants.INDEX_ONE.equals(request.getIsLegal()) ? 2 : 1) .walletType(request.getWalletType())
.isLegal(request.getIsLegal())
.recordType(request.getRecordType()) .recordType(request.getRecordType())
.feeItemId(request.getFeeItemId()) .feeItemId(request.getFeeItemId())
.currentPage(request.getPageNum()) .currentPage(request.getPageNum())
.pageSize(request.getPageSize()) .pageSize(request.getPageSize())
.build(); .build();
BillPageDTO billPage = walletApiService.getBillPage(billPageRequest); BillPageDTO billPage = walletApiService.getBillPage(billPageRequest);
return toPageInfo(billPage.getData(), AccountBillListVO.class, billPage.getPage()); return toPageInfo(billPage.getPageData(), AccountBillListVO.class, billPage.getPage());
} }
@Override @Override
@@ -344,7 +364,7 @@ public class WalletServiceImpl implements WalletService {
public Boolean withDrawer(WalletWithDrawerRequest request) { public Boolean withDrawer(WalletWithDrawerRequest request) {
String storeId = getStoreId(request); String storeId = getStoreId(request);
String reqNo = UUIDUtils.get32UUID(); String reqNo = UUIDUtils.get32UUID();
WithDrawerRequest withDrawerRequest = new WithDrawerRequest(storeId, request.getPayPwd(), reqNo, request.getAmount().toString(), "提现"); WithDrawerRequest withDrawerRequest = new WithDrawerRequest(storeId, request.getPayPwd(), reqNo, request.getAmount().toString(), "提现", request.getWalletType());
WithDrawerDTO withdraw = walletApiService.withdraw(withDrawerRequest); WithDrawerDTO withdraw = walletApiService.withdraw(withDrawerRequest);
if ("2".equals(withdraw.getTradeStatus())) { if ("2".equals(withdraw.getTradeStatus())) {
throw new ServiceException(ErrorCodeEnum.WALLET_WITH_DRAWER_FAIL); throw new ServiceException(ErrorCodeEnum.WALLET_WITH_DRAWER_FAIL);

View File

@@ -234,7 +234,7 @@ public class OpenApiController {
return ApiResponse.successByWallet(walletService.largePaymentCallback(request)); return ApiResponse.successByWallet(walletService.largePaymentCallback(request));
} }
@ApiOperation("大额充值通知接口") @ApiOperation("账户交易回调")
@PostMapping("/wallet/accountTradeCallback") @PostMapping("/wallet/accountTradeCallback")
public ApiResponse<Boolean> accountTradeCallback(@RequestBody @Validated AccountTradeCallbackRequest request) { public ApiResponse<Boolean> accountTradeCallback(@RequestBody @Validated AccountTradeCallbackRequest request) {
return ApiResponse.successByWallet(walletService.accountTradeCallback(request)); return ApiResponse.successByWallet(walletService.accountTradeCallback(request));

View File

@@ -61,8 +61,8 @@ public class MiniWalletController {
} }
@ApiOperation("账户流水") @ApiOperation("账户流水")
@GetMapping("/billPage") @PostMapping("/billPage")
public ResponseResult<PageInfo<AccountBillListVO>> getBillPage(AccountBillQueryRequest request) { public ResponseResult<PageInfo<AccountBillListVO>> getBillPage(@Validated AccountBillQueryRequest request) {
return ResponseResult.success(walletService.getBillPage(request)); return ResponseResult.success(walletService.getBillPage(request));
} }