fix:打标接口针对网商改动;字段名修改;网商开通回调;大额充值回调
This commit is contained in:
@@ -25,6 +25,17 @@ public class WalletPaymentOrderDAO {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未支付的充值订单
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ public class AccountInfoDTO {
|
||||
@ApiModelProperty(value = "支行编号", required = true)
|
||||
private String bankNo;
|
||||
|
||||
@ApiModelProperty(value = "账户状态 1:待提交 2:待鉴权 3:鉴权中 4:开通", required = true)
|
||||
@ApiModelProperty(value = "账户状态 1:待提交 2:待鉴权 3:鉴权中 4:开通 5:开通失败", required = true)
|
||||
private Integer accountStatus;
|
||||
|
||||
@ApiModelProperty(value = "账户余额", required = true)
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class BillPageDTO {
|
||||
private List<BillDTO> data;
|
||||
private List<BillDTO> pageData;
|
||||
|
||||
private WalletBasicPageInfo page;
|
||||
}
|
||||
|
||||
@@ -23,5 +23,6 @@ public class AccountBatchQueryRequest {
|
||||
@ApiModelProperty(value = "分页信息",required = true)
|
||||
private WalletBasicPageInfo page;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "钱包类型 1.平安 2.网商", required = true)
|
||||
private Integer walletType;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.cool.store.common.PageBasicInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -17,6 +18,7 @@ import java.util.Date;
|
||||
@Data
|
||||
public class AccountBillQueryRequest extends PageBasicInfo {
|
||||
@ApiModelProperty("门店id")
|
||||
@NotNull(message = "门店id不能为空")
|
||||
private Long shopId;
|
||||
|
||||
@ApiModelProperty("交易开始时间,不传查当月")
|
||||
@@ -25,12 +27,16 @@ public class AccountBillQueryRequest extends PageBasicInfo {
|
||||
@ApiModelProperty("交易结束时间")
|
||||
private Date endDate;
|
||||
|
||||
@ApiModelProperty(value = "是否签约人账户 0 否 1 是")
|
||||
@ApiModelProperty(value = "钱包类型 1.平安 2.网商", required = true)
|
||||
@NotNull(message = "钱包类型不能为空")
|
||||
private Integer walletType;
|
||||
|
||||
@ApiModelProperty("是否签约人账户 0 否 1 是")
|
||||
private Integer isLegal;
|
||||
|
||||
@ApiModelProperty(value = "交易类型: 0.全部,1.支出 2.收入")
|
||||
@ApiModelProperty("交易类型: 0.全部,1.支出 2.收入")
|
||||
private Integer recordType;
|
||||
|
||||
@ApiModelProperty(value = "费用类型ID", required = true)
|
||||
@ApiModelProperty("费用类型ID")
|
||||
private Long feeItemId;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,10 @@ public class BillPageRequest {
|
||||
private String beginDate;
|
||||
@ApiModelProperty(value = "交易结束时间YYYY-MM-DD HH:MM:SS", required = true)
|
||||
private String endDate;
|
||||
@ApiModelProperty(value = "钱包类型 1.门店钱包(平安) 2.签约人钱包(平安) 3.返利钱包(网商)", required = true)
|
||||
@ApiModelProperty(value = "钱包类型 1.平安 2.网商", required = true)
|
||||
private Integer walletType;
|
||||
@ApiModelProperty(value = "是否签约人钱包", required = false)
|
||||
private Integer isLegal;
|
||||
@ApiModelProperty(value = "交易类型: 0.全部,1.支出 2.收入", required = false)
|
||||
private Integer recordType;
|
||||
@ApiModelProperty(value = "费用类型ID", required = true)
|
||||
|
||||
@@ -2,7 +2,10 @@ package com.cool.store.request.wallet;
|
||||
|
||||
import com.sun.istack.NotNull;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@@ -12,6 +15,9 @@ import javax.validation.constraints.NotBlank;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CreateStoreRequest {
|
||||
|
||||
@ApiModelProperty(value = "CRM门店编号", required = true)
|
||||
|
||||
@@ -27,4 +27,7 @@ public class WalletWithDrawerRequest extends StoreShopRequest {
|
||||
@NotBlank(message = "支付密码不能为空")
|
||||
private String payPwd;
|
||||
|
||||
@ApiModelProperty("钱包类型 1.平安 2.网商")
|
||||
@NotNull(message = "钱包类型不能为空")
|
||||
private Integer walletType;
|
||||
}
|
||||
|
||||
@@ -25,5 +25,7 @@ public class WithDrawerRequest {
|
||||
private String amount;
|
||||
@ApiModelProperty(value = "提现备注")
|
||||
private String remark;
|
||||
@ApiModelProperty(value = "钱包类型 1.平安 2.网商", required = true)
|
||||
private Integer walletType;
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,6 @@ public class AccountInfoVO {
|
||||
@ApiModelProperty(value = "打标状态 0 未打标 1 已打标")
|
||||
private Integer labelingStatus;
|
||||
|
||||
@ApiModelProperty("账户升级失败原因")
|
||||
@ApiModelProperty("平安账户升级/网商开通失败原因")
|
||||
private String failReason;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
|
||||
|
||||
private void addTagIfUploadLicense(Long shopId) {
|
||||
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
|
||||
walletService.addTagIfUploadLicense(shopId, shopInfo.getStoreId());
|
||||
walletService.addTagIfUploadLicense(shopId, shopInfo.getStoreId(), shopInfo.getLineId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,7 +49,7 @@ public class WalletApiService {
|
||||
* @return
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,8 +49,9 @@ public interface WalletService {
|
||||
* 判断营业执照是否已经上传,已上传则调用打标接口
|
||||
* @param shopId 门店shopId
|
||||
* @param storeId 主数据门店id
|
||||
* @param lineId 线索id
|
||||
*/
|
||||
void addTagIfUploadLicense(Long shopId, String storeId);
|
||||
void addTagIfUploadLicense(Long shopId, String storeId, Long lineId);
|
||||
|
||||
/**
|
||||
* 打标成功回调通知
|
||||
|
||||
@@ -4,10 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.constants.RedisConstant;
|
||||
import com.cool.store.dao.LineInfoDAO;
|
||||
import com.cool.store.dao.RegionDao;
|
||||
import com.cool.store.dao.ShopInfoDAO;
|
||||
import com.cool.store.dao.ShopStageInfoDAO;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dao.wallet.WalletPaymentOrderDAO;
|
||||
import com.cool.store.dto.wallet.*;
|
||||
import com.cool.store.entity.*;
|
||||
@@ -66,6 +63,7 @@ public class WalletServiceImpl implements WalletService {
|
||||
private final WalletPaymentOrderDAO walletPaymentOrderDAO;
|
||||
private final LineInfoDAO lineInfoDAO;
|
||||
private final RedisUtilPool redisUtilPool;
|
||||
private final QualificationsInfoDAO qualificationsInfoDAO;
|
||||
|
||||
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) {
|
||||
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()
|
||||
.outStoreId(shopInfo.getStoreId())
|
||||
.phoneNumber(request.getMobile())
|
||||
@@ -102,7 +96,7 @@ public class WalletServiceImpl implements WalletService {
|
||||
if (Objects.nonNull(authentication)) {
|
||||
if (authentication.getAccountStatus().equals(4)) {
|
||||
// 判断营业执照是否已经上传,已上传则调用打标接口
|
||||
addTagIfUploadLicense(request.getShopId(), shopInfo.getStoreId());
|
||||
addTagIfUploadLicense(request.getShopId(), shopInfo.getStoreId(), shopInfo.getLineId());
|
||||
}
|
||||
return new AccountAuthenticationVO(authentication.getAccountStatus());
|
||||
}
|
||||
@@ -132,7 +126,7 @@ public class WalletServiceImpl implements WalletService {
|
||||
shopStageInfoDAO.batchUpdateShopStageStatus(request.getShopId(), updateSubStageList);
|
||||
|
||||
// 判断营业执照是否已经上传,已上传则调用打标接口
|
||||
addTagIfUploadLicense(request.getShopId(), shopInfo.getStoreId());
|
||||
addTagIfUploadLicense(request.getShopId(), shopInfo.getStoreId(), shopInfo.getLineId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -160,23 +154,33 @@ public class WalletServiceImpl implements WalletService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTagIfUploadLicense(Long shopId, String storeId) {
|
||||
LicenseTransactDO licenseTransactDO = applyLicenseMapper.selectByShopId(shopId);
|
||||
public void addTagIfUploadLicense(Long shopId, String storeId, Long lineId) {
|
||||
LicenseTransactDO license = applyLicenseMapper.selectByShopId(shopId);
|
||||
// 营业执照已上传,调用打标接口
|
||||
if (Objects.nonNull(licenseTransactDO) && StringUtils.isNotBlank(licenseTransactDO.getCreditUrl())) {
|
||||
if (Objects.nonNull(license) && StringUtils.isNotBlank(license.getCreditUrl())) {
|
||||
try {
|
||||
// 判断一下账户的开通状态
|
||||
if (enableAddTag(storeId)) {
|
||||
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(lineId);
|
||||
QualificationsInfoDO qualificationsInfoDO = qualificationsInfoDAO.getByLineId(lineId);
|
||||
// 调用 签约人账户打标(升级)接口
|
||||
log.info("营业执照已上传,账户打标");
|
||||
AccountAddTagRequest tagRequest = AccountAddTagRequest.builder()
|
||||
.outStoreId(storeId)
|
||||
.licenseNo(licenseTransactDO.getCreditCode())
|
||||
.licenseName(licenseTransactDO.getBusinessLicense())
|
||||
.licenseNo(license.getCreditCode())
|
||||
.licenseName(license.getBusinessLicense())
|
||||
// .licenseExpire(Objects.nonNull(licenseTransactDO.getValidity()) ? CoolDateUtils.DateFormat(licenseTransactDO.getValidity(), "yyyy-MM-dd") : "2999-12-31")
|
||||
.legalName(licenseTransactDO.getLicenseLegalPerson())
|
||||
.legalNo(licenseTransactDO.getLicenseLegalIdCardNo())
|
||||
.legalPhone(licenseTransactDO.getLicenseLegalMobile())
|
||||
.legalName(license.getLicenseLegalPerson())
|
||||
.legalNo(license.getLicenseLegalIdCardNo())
|
||||
.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();
|
||||
AddTagDTO addTagDTO = walletApiService.addTag(tagRequest);
|
||||
log.info("打标接口调用成功,response:{}", JSONObject.toJSONString(addTagDTO));
|
||||
@@ -210,18 +214,33 @@ public class WalletServiceImpl implements WalletService {
|
||||
redisUtilPool.delKey(key);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("回调失败", e);
|
||||
log.info("平安打标回调失败", e);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean largePaymentCallback(PaymentDTO request) {
|
||||
try {
|
||||
walletPaymentOrderDAO.updateOrderByPaymentId(request.getOutStoreId(), request.getPaymentId(), request.getOrderStatus());
|
||||
} catch (Exception e) {
|
||||
log.error("大额充值回调失败", e);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -259,14 +278,15 @@ public class WalletServiceImpl implements WalletService {
|
||||
.outStoreId(shopInfo.getStoreId())
|
||||
.beginDate(DateUtil.format(request.getBeginDate(), "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())
|
||||
.feeItemId(request.getFeeItemId())
|
||||
.currentPage(request.getPageNum())
|
||||
.pageSize(request.getPageSize())
|
||||
.build();
|
||||
BillPageDTO billPage = walletApiService.getBillPage(billPageRequest);
|
||||
return toPageInfo(billPage.getData(), AccountBillListVO.class, billPage.getPage());
|
||||
return toPageInfo(billPage.getPageData(), AccountBillListVO.class, billPage.getPage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -344,7 +364,7 @@ public class WalletServiceImpl implements WalletService {
|
||||
public Boolean withDrawer(WalletWithDrawerRequest request) {
|
||||
String storeId = getStoreId(request);
|
||||
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);
|
||||
if ("2".equals(withdraw.getTradeStatus())) {
|
||||
throw new ServiceException(ErrorCodeEnum.WALLET_WITH_DRAWER_FAIL);
|
||||
|
||||
@@ -234,7 +234,7 @@ public class OpenApiController {
|
||||
return ApiResponse.successByWallet(walletService.largePaymentCallback(request));
|
||||
}
|
||||
|
||||
@ApiOperation("大额充值通知接口")
|
||||
@ApiOperation("账户交易回调")
|
||||
@PostMapping("/wallet/accountTradeCallback")
|
||||
public ApiResponse<Boolean> accountTradeCallback(@RequestBody @Validated AccountTradeCallbackRequest request) {
|
||||
return ApiResponse.successByWallet(walletService.accountTradeCallback(request));
|
||||
|
||||
@@ -61,8 +61,8 @@ public class MiniWalletController {
|
||||
}
|
||||
|
||||
@ApiOperation("账户流水")
|
||||
@GetMapping("/billPage")
|
||||
public ResponseResult<PageInfo<AccountBillListVO>> getBillPage(AccountBillQueryRequest request) {
|
||||
@PostMapping("/billPage")
|
||||
public ResponseResult<PageInfo<AccountBillListVO>> getBillPage(@Validated AccountBillQueryRequest request) {
|
||||
return ResponseResult.success(walletService.getBillPage(request));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user