feat 多商户适配

This commit is contained in:
xxm1995
2023-07-26 17:30:02 +08:00
parent 7758a95960
commit 0fc65aad36
4 changed files with 27 additions and 13 deletions

View File

@@ -43,12 +43,18 @@ public class MerchantInfoController {
return Res.ok();
}
@Operation(summary = "下拉列表")
@Operation(summary = "下拉列表(所有)")
@GetMapping("/dropdown")
public ResResult<List<LabelValue>> dropdown() {
return Res.ok(merchantInfoService.dropdown());
}
@Operation(summary = "下拉列表(可用状态的)")
@GetMapping("/dropdownNormal")
public ResResult<List<LabelValue>> dropdownNormal() {
return Res.ok(merchantInfoService.dropdownNormal());
}
@Operation(summary = "删除")
@DeleteMapping(value = "/delete")
public ResResult<Void> delete(Long id) {

View File

@@ -95,7 +95,7 @@ public class VoucherQueryService {
}
// 判断是否是同一个商户应用下的储值卡
List<String> mchCodes = vouchers.stream()
.map(Voucher::getMchAppCode)
.map(Voucher::getMchCode)
.distinct()
.collect(Collectors.toList());
List<String> mchAppCodes = vouchers.stream()

View File

@@ -1,6 +1,5 @@
package cn.bootx.platform.daxpay.core.merchant.dao;
import cn.bootx.platform.common.core.rest.dto.LabelValue;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
@@ -14,7 +13,6 @@ import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* 商户
@@ -40,19 +38,17 @@ public class MerchantInfoManager extends BaseManager<MerchantInfoMapper, Merchan
Page<MerchantInfo> mpPage = MpUtil.getMpPage(pageParam, MerchantInfo.class);
QueryWrapper<MerchantInfo> wrapper = QueryGenerator.generator(param, this.getEntityClass());
wrapper.select(this.getEntityClass(), MpUtil::excludeBigField)
.orderByDesc(MpUtil.getColumnName(MerchantInfo::getId));
.orderByDesc(MpUtil.getColumnName(MerchantInfo::getId));
return this.page(mpPage, wrapper);
}
/**
* 下拉列表
* 下拉列表 正常可用的
*/
public List<LabelValue> findDropdown() {
return lambdaQuery().select(MerchantInfo::getCode, MerchantInfo::getName)
.list()
.stream()
.map(mch -> new LabelValue(mch.getName(),mch.getCode()))
.collect(Collectors.toList());
public List<MerchantInfo> findAllByState(String state) {
return lambdaQuery()
.eq(MerchantInfo::getState,state)
.list();
}
}

View File

@@ -6,6 +6,7 @@ import cn.bootx.platform.common.core.rest.dto.LabelValue;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.core.util.ResultConvertUtil;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.code.MchAndAppCode;
import cn.bootx.platform.daxpay.core.merchant.dao.MerchantInfoManager;
import cn.bootx.platform.daxpay.core.merchant.entity.MerchantInfo;
import cn.bootx.platform.daxpay.dto.merchant.MerchantInfoDto;
@@ -17,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* 商户
@@ -74,7 +76,17 @@ public class MerchantInfoService {
* 下拉框
*/
public List<LabelValue> dropdown() {
return merchantInfoManager.findDropdown();
return merchantInfoManager.findAll().stream()
.map(mch -> new LabelValue(mch.getName(),mch.getCode()))
.collect(Collectors.toList());
}
/**
* 下拉框(正常商户)
*/
public List<LabelValue> dropdownNormal() {
return merchantInfoManager.findAllByState(MchAndAppCode.MCH_STATE_NORMAL).stream()
.map(mch -> new LabelValue(mch.getName(),mch.getCode()))
.collect(Collectors.toList());
}
/**