This commit is contained in:
zjf committed 2025-03-25 14:03:57 +08:00
commit 2ef4076a36
6 files changed
+45 -13

No files matched your search

@@ -6,6 +6,7 @@ public interface CommonRoleConstant {
String DEPT_ADMIN = "DEPT_ADMIN";
// 自动创建钱包
String AUTO_CREATE_WALLET = "WALLET_AUTO_CREATE";
}
@@ -103,6 +103,22 @@
#{v}
</foreach>
</if>
<if test="dto.userDeptIds != null and dto.userDeptIds.size() != 0">
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
and a.user_dept_id IN
</when>
<when test="dto.isInclude != null and dto.isInclude == false">
and a.user_dept_id NOT IN
</when>
<otherwise>
and a.user_dept_id IN
</otherwise>
</choose>
<foreach collection="dto.userDeptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.orderStatusCodes != null and dto.orderStatusCodes.size() != 0">
and a.order_status in
<foreach collection="dto.orderStatusCodes" item="v" open="(" close=")" separator=",">
@@ -219,9 +235,9 @@
#{v}
</foreach>
</if>
<if test="dto.setUserDeptIds != null and dto.setUserDeptIds.size() != 0">
<if test="dto.getUserDeptIds != null and dto.getUserDeptIds.size() != 0">
and a.user_dept_id in
<foreach collection="dto.setUserDeptIds" item="v" open="(" close=")" separator=",">
<foreach collection="dto.getUserDeptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
@@ -59,8 +59,8 @@ public interface MchManageMapper extends PjcloudBaseMapper<MchManageEntity> {
.like(ObjectUtil.isNotEmpty(dto.getName()), MchManageEntity::getName, dto.getName())
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
.in(ObjectUtil.isNotEmpty(dto.getIds()), MchManageEntity::getId, dto.getIds())
.orderByDesc(MchManageEntity::getCreateTime)
.orderByDesc(MchManageEntity::getId);
.orderByDesc(MchManageEntity::getDeptId)
.orderByDesc(MchManageEntity::getCreateTime);
Page list = selectPageByScope(page, wrapper, DataScope.of());
list.setRecords(BeanUtils.toBean(list.getRecords(), MchManageVo.class));
return list;
@@ -78,10 +78,10 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
@Override
@Transactional(rollbackFor = Exception.class)
public Long create(MchManageEntity dto) {
if (existName(dto.getName(), null)) {
if (existName(dto.getName(), dto.getTypes(), null)) {
throw new RuntimeException("商户名不能重复");
}
if (existDeptId(dto.getDeptId(), null)) {
if (existDeptId(dto.getDeptId(), dto.getTypes(), null)) {
throw new RuntimeException("该部门已经绑定过商户");
}
baseMapper.insert(dto);
@@ -109,10 +109,10 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
@Override
// @CacheEvict(value = CacheConstants.WALLET_MCH, key = "#dto.getId()", condition = "#dto.getId() != null")
public void edit(MchManageEntity dto) {
if (existName(dto.getName(), dto.getId())) {
if (existName(dto.getName(), dto.getTypes(), dto.getId())) {
throw new RuntimeException("商户名不能重复");
}
if (existDeptId(dto.getDeptId(), dto.getId())) {
if (existDeptId(dto.getDeptId(), dto.getTypes(), dto.getId())) {
throw new RuntimeException("该部门已经绑定过商户");
}
MchManageEntity mchManage = getSelf().getById(dto.getId());
@@ -266,9 +266,10 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
}
}
private boolean existName(String name, Long id) {
private boolean existName(String name, String types, Long id) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<MchManageEntity>()
.eq(ObjectUtil.isNotEmpty(name), MchManageEntity::getName, name)
.eq(ObjectUtil.isNotEmpty(types), MchManageEntity::getTypes, types)
.ne(ObjectUtil.isNotEmpty(id), MchManageEntity::getId, id)
);
if (ObjectUtil.isNotEmpty(id)) {
@@ -277,9 +278,10 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
return count > 0;
}
private boolean existDeptId(Long deptId, Long id) {
private boolean existDeptId(Long deptId, String types, Long id) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<MchManageEntity>()
.eq(ObjectUtil.isNotEmpty(deptId), MchManageEntity::getDeptId, deptId)
.eq(ObjectUtil.isNotEmpty(types), MchManageEntity::getTypes, types)
.ne(ObjectUtil.isNotEmpty(id), MchManageEntity::getId, id)
);
if (ObjectUtil.isNotEmpty(id)) {
@@ -22,6 +22,7 @@ import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
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.constant.CommonRoleConstant;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
@@ -102,7 +103,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
UserInfo user = null;
if (checkPermission) {
user = userService.getByUserId(userId).getData();
String autoWalletRoleCode = ParamResolver.getStr("WALLET_AUTO_CREATE");
String autoWalletRoleCode = ParamResolver.getStr(CommonRoleConstant.AUTO_CREATE_WALLET);
if (ObjectUtil.isEmpty(autoWalletRoleCode)) {
log.info("|{}|创建用户电子钱包失败,userId:{},WALLET_AUTO_CREATE参数未配置", TAG, userId);
return;
@@ -14,6 +14,7 @@ import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
import com.bsd.pjcloud.admin.api.feign.RemoteRoleService;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.admin.api.vo.UserVO;
import com.bsd.pjcloud.common.core.constant.CommonRoleConstant;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.thirdparty.api.feign.RemoterThirdZyService;
import com.bsd.pjcloud.thirdparty.dto.zy.mer.ZyMerSyncAccClassInfoDto;
@@ -27,11 +28,9 @@ import com.bsd.pjcloud.thirdparty.vo.zy.mer.ZyMerSyncEnterpriseInfoVo;
import com.bsd.pjcloud.wallet.api.constant.WalleCardStatusEnum;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
import com.bsd.pjcloud.wallet.service.MchManageService;
import com.bsd.pjcloud.wallet.service.WalletThirdZyService;
import com.bsd.pjcloud.wallet.service.WalletManageService;
@@ -249,6 +248,19 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
List<ZyMerSyncAccountInfoDto> syncList = new ArrayList<>();
String syncAllMchVersion = getSyncAllMchVersion();
for (UserVO v : userVOList) {
if (ObjectUtil.isEmpty(v) || ObjectUtil.isEmpty(v.getUserId())) {
log.error("|{}|syncAllUserGroup用户不存在WalletManageVo|{}|", TAG, JSONUtil.toJsonStr(v));
continue;
}
if (ObjectUtil.isEmpty(v.getRoleList())) {
log.error("|{}|syncAllUserGroup用户没有自动创建钱包权限|{}|", TAG, JSONUtil.toJsonStr(v));
continue;
}
List<String> roleCodes = v.getRoleList().stream().map(SysRole::getRoleCode).toList();
if (!roleCodes.contains(CommonRoleConstant.AUTO_CREATE_WALLET)) {
log.error("|{}|syncAllUserGroup用户没有自动创建钱包权限|{}|", TAG, JSONUtil.toJsonStr(v));
continue;
}
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId());
// 查询是在商户下
if (ObjectUtil.isEmpty(mch)) {