diff --git a/coolstore-partner-common/src/main/java/com/cool/store/constants/CommonConstants.java b/coolstore-partner-common/src/main/java/com/cool/store/constants/CommonConstants.java index bb98209a9..8081b0051 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/constants/CommonConstants.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/constants/CommonConstants.java @@ -235,4 +235,5 @@ public class CommonConstants { public static final Integer INDEX_ZERO = 0; public static final Integer INDEX_ONE = 1; + public static final Integer INDEX_TWO = 2; } diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopInfoDAO.java b/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopInfoDAO.java index e3c9bff3a..bec865579 100644 --- a/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopInfoDAO.java +++ b/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopInfoDAO.java @@ -31,10 +31,7 @@ import org.springframework.stereotype.Repository; import tk.mybatis.mapper.entity.Example; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -79,6 +76,17 @@ public class ShopInfoDAO { return shopInfoMapper.selectOne(shopInfoDO); } + public List getShopInfoByStoreIds(List storeIds) { + if (CollectionUtils.isEmpty(storeIds)) { + return Collections.emptyList(); + } + Example example = new Example(ShopInfoDO.class); + example.createCriteria() + .andIn("storeId", storeIds) + .andEqualTo("deleted", false); + return shopInfoMapper.selectByExample(example); + } + public List getShopList(Long lineId){ if(Objects.isNull(lineId)){ return new ArrayList<>(); diff --git a/coolstore-partner-model/src/main/java/com/cool/store/dto/wallet/AccountInfoDTO.java b/coolstore-partner-model/src/main/java/com/cool/store/dto/wallet/AccountInfoDTO.java index 3d2ae2e26..e953b4381 100644 --- a/coolstore-partner-model/src/main/java/com/cool/store/dto/wallet/AccountInfoDTO.java +++ b/coolstore-partner-model/src/main/java/com/cool/store/dto/wallet/AccountInfoDTO.java @@ -80,4 +80,7 @@ public class AccountInfoDTO { @ApiModelProperty("失败原因(仅网商在创建失败或激活失败时返回)") private String errMsg; + + @ApiModelProperty("crm门店id") + private String outStoreId; } diff --git a/coolstore-partner-model/src/main/java/com/cool/store/dto/wallet/AddTagDTO.java b/coolstore-partner-model/src/main/java/com/cool/store/dto/wallet/AddTagDTO.java index 7bc352de4..3fc4b9a98 100644 --- a/coolstore-partner-model/src/main/java/com/cool/store/dto/wallet/AddTagDTO.java +++ b/coolstore-partner-model/src/main/java/com/cool/store/dto/wallet/AddTagDTO.java @@ -1,6 +1,7 @@ package com.cool.store.dto.wallet; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -16,4 +17,6 @@ public class AddTagDTO { private Integer addTagType; + @ApiModelProperty("网商状态,1.打标成功 2.打标失败 3.处理中") + private Integer wsStatus; } diff --git a/coolstore-partner-model/src/main/java/com/cool/store/vo/wallet/AccountPageVO.java b/coolstore-partner-model/src/main/java/com/cool/store/vo/wallet/AccountPageVO.java new file mode 100644 index 000000000..df54bbd6a --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/vo/wallet/AccountPageVO.java @@ -0,0 +1,89 @@ +package com.cool.store.vo.wallet; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * 门店签约人账户 + * @Author suzhuhong + * @Date 2025/11/13 16:54 + * @Version 1.0 + */ +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class AccountPageVO { + + @ApiModelProperty(value = "结算卡业务类型 枚举值:1:对公 2:对私", required = true) + private Integer accountType; + + @ApiModelProperty(value = "营业执照号码") + private String licenseNo; + + @ApiModelProperty(value = "工商注册名称") + private String licenseName; + + @ApiModelProperty(value = "法人姓名") + private String legalName; + + @ApiModelProperty(value = "法人证件号码") + private String legalNo; + + @ApiModelProperty(value = "法人联系电话") + private String legalPhone; + + @ApiModelProperty(value = "门店编号", required = true) + private String storeSn; + + @ApiModelProperty(value = "账户编号", required = true) + private String accountNo; + + @ApiModelProperty(value = "账户名称", required = true) + private String accountName; + + @ApiModelProperty(value = "账户别名", required = true) + private String accountAliasName; + + @ApiModelProperty(value = "结算银行卡号", required = true) + private String accountCardNo; + + @ApiModelProperty(value = "结算卡银行预留手机号", required = true) + private String accountPhone; + + @ApiModelProperty(value = "开户支行名称", required = true) + private String bankName; + + @ApiModelProperty(value = "支行编号", required = true) + private String bankNo; + + @ApiModelProperty(value = "总行名称") + private String headBankName; + + @ApiModelProperty(value = "账户状态 1:待提交 2:待鉴权 3:鉴权中 4:开通 5:开通失败", required = true) + private Integer accountStatus; + + @ApiModelProperty(value = "账户余额", required = true) + private String totalAmount; + + @ApiModelProperty(value = "打标状态 0 未打标 1 已打标", required = true) + private Integer labelingStatus; + + @ApiModelProperty(value = "是否签约人账户 0 否 1 是", required = true) + private Integer isLegal; + + @ApiModelProperty("工商类型 1.企业 2.个体工商户 3.小微商户(自然人)") + private Integer businessType; + + @ApiModelProperty("钱包类型 1平安 2网商") + private Integer walletType; + + @ApiModelProperty("失败原因(仅网商在创建失败或激活失败时返回)") + private String errMsg; + + @ApiModelProperty("crm门店id") + private String storeId; + + @ApiModelProperty("门店名称") + private String storeName; +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/vo/wallet/AllAccountInfoVO.java b/coolstore-partner-model/src/main/java/com/cool/store/vo/wallet/AllAccountInfoVO.java new file mode 100644 index 000000000..25d5dc0fd --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/vo/wallet/AllAccountInfoVO.java @@ -0,0 +1,83 @@ +package com.cool.store.vo.wallet; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * 门店签约人账户 + * @Author suzhuhong + * @Date 2025/11/13 16:54 + * @Version 1.0 + */ +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class AllAccountInfoVO { + + @ApiModelProperty(value = "结算卡业务类型 枚举值:1:对公 2:对私", required = true) + private Integer accountType; + + @ApiModelProperty(value = "营业执照号码") + private String licenseNo; + + @ApiModelProperty(value = "工商注册名称") + private String licenseName; + + @ApiModelProperty(value = "法人姓名") + private String legalName; + + @ApiModelProperty(value = "法人证件号码") + private String legalNo; + + @ApiModelProperty(value = "法人联系电话") + private String legalPhone; + + @ApiModelProperty(value = "门店编号", required = true) + private String storeSn; + + @ApiModelProperty(value = "账户编号", required = true) + private String accountNo; + + @ApiModelProperty(value = "账户名称", required = true) + private String accountName; + + @ApiModelProperty(value = "账户别名", required = true) + private String accountAliasName; + + @ApiModelProperty(value = "结算银行卡号", required = true) + private String accountCardNo; + + @ApiModelProperty(value = "结算卡银行预留手机号", required = true) + private String accountPhone; + + @ApiModelProperty(value = "开户支行名称", required = true) + private String bankName; + + @ApiModelProperty(value = "支行编号", required = true) + private String bankNo; + + @ApiModelProperty(value = "总行名称") + private String headBankName; + + @ApiModelProperty(value = "账户状态 1:待提交 2:待鉴权 3:鉴权中 4:开通 5:开通失败", required = true) + private Integer accountStatus; + + @ApiModelProperty(value = "账户余额", required = true) + private String totalAmount; + + @ApiModelProperty(value = "打标状态 0 未打标 1 已打标", required = true) + private Integer labelingStatus; + + @ApiModelProperty(value = "是否签约人账户 0 否 1 是", required = true) + private Integer isLegal; + + @ApiModelProperty("工商类型 1.企业 2.个体工商户 3.小微商户(自然人)") + private Integer businessType; + + @ApiModelProperty("钱包类型 1平安 2网商") + private Integer walletType; + + @ApiModelProperty("失败原因(仅网商在创建失败或激活失败时返回)") + private String errMsg; +} diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/wallet/WalletService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/wallet/WalletService.java index cbac15ec4..e494efcd7 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/wallet/WalletService.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/wallet/WalletService.java @@ -149,7 +149,7 @@ public interface WalletService { * @param request 批量查询账户信息Request * @return 账户信息VO列表 */ - PageInfo getAllAccountList(CoolAccountBatchQueryRequest request); + PageInfo getAllAccountList(CoolAccountBatchQueryRequest request); /** * 批量查询账户交易流水 diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/wallet/impl/WalletServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/wallet/impl/WalletServiceImpl.java index 4341d3db2..d0d318052 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/wallet/impl/WalletServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/wallet/impl/WalletServiceImpl.java @@ -1,5 +1,7 @@ package com.cool.store.service.wallet.impl; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.collection.CollStreamUtil; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import com.cool.store.constants.CommonConstants; @@ -213,8 +215,8 @@ public class WalletServiceImpl implements WalletService { private void executeAddTag(AccountAddTagRequest tagRequest) { AddTagDTO addTagDTO = walletApiService.addTag(tagRequest); log.info("打标接口调用成功,response:{}", JSONObject.toJSONString(addTagDTO)); - // TODO: 如果网商创建失败,缓存标记 - if (false) { + // 如果网商创建失败,缓存标记 + if (CommonConstants.INDEX_TWO.equals(addTagDTO.getWsStatus())) { redisUtilPool.setString(MessageFormat.format(RedisConstant.WALLET_ONLINE_BANK_TAG_FAIL, tagRequest.getOutStoreId()), "1"); } else { // 网商创建成功,记录已激活状态 @@ -457,10 +459,26 @@ public class WalletServiceImpl implements WalletService { } @Override - public PageInfo getAllAccountList(CoolAccountBatchQueryRequest request) { + public PageInfo getAllAccountList(CoolAccountBatchQueryRequest request) { AccountBatchQueryRequest accountBatchQueryRequest = request.convertToAccountBatchQueryRequest(); AccountPageDTO accountList = walletApiService.getAccountList(accountBatchQueryRequest); - return toPageInfo(accountList.getPageData(), AccountInfoDTO.class, accountList.getPage()); + List list = BeanUtil.toList(accountList.getPageData(), AccountPageVO.class, CopyOptions.create().setFieldMapping(Collections.singletonMap("outStoreId", "storeId"))); + PageInfo page = toPageInfo(list, AccountPageVO.class, accountList.getPage()); + List storeIds = CollStreamUtil.toList(page.getList(), AccountPageVO::getStoreId); + Map storeNameMap = getStoreNameMap(storeIds); + page.getList().forEach(v -> v.setStoreName(storeNameMap.get(v.getStoreId()))); + return page; + } + + private Map getStoreNameMap(List storeIds) { + Map storeNameMap = new HashMap<>(); + List stores = storeDao.getEffectiveStoreByStoreIds(storeIds); + Map storeMap = CollStreamUtil.toMap(stores, StoreDO::getStoreId, StoreDO::getStoreName); + storeNameMap.putAll(storeMap); + List shops = shopInfoDAO.getShopInfoByStoreIds(storeIds); + Map shopMap = CollStreamUtil.toMap(shops, ShopInfoDO::getStoreId, ShopInfoDO::getShopName); + storeNameMap.putAll(shopMap); + return storeNameMap; } @Override diff --git a/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/WalletController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/WalletController.java index 2cfa409a1..a489ca900 100644 --- a/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/WalletController.java +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/WalletController.java @@ -8,6 +8,7 @@ import com.cool.store.response.ResponseResult; import com.cool.store.service.wallet.WalletService; import com.cool.store.vo.wallet.AccountBillPageVO; import com.cool.store.vo.wallet.AccountInfoVO; +import com.cool.store.vo.wallet.AccountPageVO; import com.github.pagehelper.PageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -46,7 +47,7 @@ public class WalletController { @ApiOperation("分页查询所有门店账户列表 支持条件查询") @PostMapping("/getAllAccountList") - public ResponseResult> getAllAccountList(@RequestBody CoolAccountBatchQueryRequest request) { + public ResponseResult> getAllAccountList(@RequestBody CoolAccountBatchQueryRequest request) { return ResponseResult.success(walletService.getAllAccountList(request)); }