feat:商户类表默认钱包

This commit is contained in:
dzc committed 2025-03-10 15:48:29 +08:00
1 parent 47fd0aec1d
commit 423275f0eb
2 files changed
+31 -1

No files matched your search

@@ -2,11 +2,21 @@ package com.bsd.pjcloud.wallet.api.vo;
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.vo.base.BaseWalletTypeInterface;
import lombok.Data;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
@Data
public class MchManageVo extends MchManageEntity implements BaseDeptInterface {
public class MchManageVo extends MchManageEntity implements BaseDeptInterface, BaseWalletTypeInterface {
private String deptName;
private Long walletTypeId;
private String walletTypeName;
private String walletTypeUniqueCode;
private String walletTypeIcon;
}
@@ -15,15 +15,22 @@ import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.admin.api.utils.DataUtil;
import com.bsd.pjcloud.common.core.constant.CacheConstants;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.common.core.util.QRCodeImageGenerator;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
import com.bsd.pjcloud.wallet.api.vo.code.MchCollectionCodeVo;
import com.bsd.pjcloud.wallet.mapper.MchManageMapper;
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
import com.bsd.pjcloud.wallet.service.MchManageService;
import com.bsd.pjcloud.wallet.service.WalletThirdZyService;
import com.bsd.pjcloud.wallet.service.WalletTypeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheEvict;
@@ -58,8 +65,10 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
private final RemoteUserService remoteUserService;
private final RemoteDeptService remoteDeptService;
private final RemoteFileService remoteFileService;
@Lazy
private final WalletThirdZyService walletThirdZyService;
private final WalletTypeMapper walletTypeMapper;
private final StringRedisTemplate redisTemplate;
@@ -155,6 +164,17 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
}
}
// 饭卡类型
List<Long> walletTypeIds = list.getRecords().stream().map(MchManageVo::getDefaultWalletTypeId).distinct().toList();
if (ObjectUtil.isNotEmpty(walletTypeIds)) {
WalletTypeDto walletTypeDto = new WalletTypeDto();
walletTypeDto.setWalletTypeIds(walletTypeIds);
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
if (ObjectUtil.isNotEmpty(walletTypeList)) {
list.getRecords().forEach(v -> v.setWalletTypeId(v.getDefaultWalletTypeId()));
WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
}
}
}
return list;
}