feat:用户商户部门
This commit is contained in:
1 parent
4360790f68
commit
360fcf8c98
15 files changed
+109
-30
No files matched your search
+2
-2
@@ -36,9 +36,9 @@ public interface RemoteMchService {
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/mch-manage/get-first-mch")
|
||||
R<MchManageVo> getFirstMch(@RequestParam List<Long> deptIds);
|
||||
R<MchManageVo> getFirstMch(@RequestParam List<Long> deptIds, @RequestParam MerchantTypeEnum mchType);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/mch-manage/get-first-mch-by-dept-id")
|
||||
R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId);
|
||||
R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId, @RequestParam MerchantTypeEnum mchType);
|
||||
}
|
||||
+4
-4
@@ -90,16 +90,16 @@ public class MchManageController {
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-first-mch")
|
||||
public R<MchManageVo> getFirstMch(@RequestParam List<Long> deptIds) {
|
||||
MchManageVo mchManage = mchManageService.getFirstMch(deptIds);
|
||||
public R<MchManageVo> getFirstMch(@RequestParam List<Long> deptIds, @RequestParam MerchantTypeEnum mchType) {
|
||||
MchManageVo mchManage = mchManageService.getFirstMch(deptIds, mchType);
|
||||
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
|
||||
return R.ok(mchManage);
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-first-mch-by-dept-id")
|
||||
public R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId) {
|
||||
MchManageVo mchManage = mchManageService.getFirstMchByDeptId(deptId);
|
||||
public R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId, @RequestParam MerchantTypeEnum mchType) {
|
||||
MchManageVo mchManage = mchManageService.getFirstMchByDeptId(deptId, mchType);
|
||||
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
|
||||
return R.ok(mchManage);
|
||||
}
|
||||
|
||||
+2
-2
@@ -37,9 +37,9 @@ public interface MchManageService extends IService<MchManageEntity> {
|
||||
|
||||
MchManageVo getByDeptId(Long deptId, MerchantTypeEnum type);
|
||||
|
||||
MchManageVo getFirstMch(List<Long> deptIds);
|
||||
MchManageVo getFirstMch(List<Long> deptIds, MerchantTypeEnum mchType);
|
||||
|
||||
MchManageVo getFirstMchByDeptId(Long deptId);
|
||||
MchManageVo getFirstMchByDeptId(Long deptId, MerchantTypeEnum mchType);
|
||||
|
||||
/**
|
||||
* 刷新商户二维码
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
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.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
@@ -159,7 +160,7 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
public void createAndActiveCard(WalletManageEntity wallet) {
|
||||
if (ObjectUtil.isEmpty(wallet) || ObjectUtil.isNotEmpty(wallet.getCardNumber())) return;
|
||||
// 查询用户所属于的商户
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(wallet.getDeptId());
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(wallet.getDeptId(), MerchantTypeEnum.CANTEEN);
|
||||
if (ObjectUtil.isEmpty(mch)) return;
|
||||
LambdaQueryWrapper<WalletActiveEntity> wrapper = new LambdaQueryWrapper<WalletActiveEntity>()
|
||||
.isNull(WalletActiveEntity::getUserId)
|
||||
|
||||
+3
-2
@@ -23,6 +23,7 @@ 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.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
@@ -461,8 +462,8 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
.eq(WalletManageEntity::getUserId, sysUser.getUserId())
|
||||
);
|
||||
// 修改钱包冻结开卡商户
|
||||
// 查询用户所属于的商户
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(sysUser.getDeptId());
|
||||
// 查询用户所属于的食堂商户
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(sysUser.getDeptId(), MerchantTypeEnum.CANTEEN);
|
||||
if (ObjectUtil.isNotEmpty(mch)) {
|
||||
walletActiveService.update(new LambdaUpdateWrapper<WalletActiveEntity>()
|
||||
.set(WalletActiveEntity::getMerchantId, mch.getId())
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ import com.bsd.pjcloud.admin.api.dto.DeptAllListDto;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.wallet.api.dto.mch.MchDeptDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptEntity;
|
||||
@@ -57,7 +58,7 @@ public class MchDeptServiceImpl extends ServiceImpl<MchDeptUserMapper, MchDeptEn
|
||||
item.setDeptId(v.getDeptId());
|
||||
// 查询所属的商户
|
||||
try {
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId());
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId(), MerchantTypeEnum.CANTEEN);
|
||||
if (ObjectUtil.isEmpty(mch)) continue;
|
||||
item.setMchId(mch.getId());
|
||||
} catch (Exception e) {
|
||||
|
||||
+16
-6
@@ -46,6 +46,8 @@ import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -53,7 +55,7 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* 商户管理
|
||||
@@ -274,13 +276,21 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public MchManageVo getFirstMch(List<Long> deptIds) {
|
||||
List<MchManageEntity> merchantList = baseMapper.selectList(new LambdaQueryWrapper<MchManageEntity>());
|
||||
public MchManageVo getFirstMch(List<Long> deptIds, MerchantTypeEnum mchType) {
|
||||
List<MchManageEntity> merchantList = baseMapper.selectList(new LambdaQueryWrapper<MchManageEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(mchType), MchManageEntity::getTypes, mchType.getType())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(merchantList)) return null;
|
||||
for (Long id : deptIds) {
|
||||
for (MchManageEntity merchant : merchantList) {
|
||||
if (ObjectUtil.equals(merchant.getDeptId(), id)) {
|
||||
return BeanUtils.toBean(merchant, MchManageVo.class);
|
||||
if (ObjectUtil.isNotEmpty(mchType)) {
|
||||
if (ObjectUtil.equals(merchant.getTypes(), mchType.getType())) {
|
||||
return BeanUtils.toBean(merchant, MchManageVo.class);
|
||||
}
|
||||
} else {
|
||||
return BeanUtils.toBean(merchant, MchManageVo.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,13 +298,13 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public MchManageVo getFirstMchByDeptId(Long deptId) {
|
||||
public MchManageVo getFirstMchByDeptId(Long deptId, MerchantTypeEnum mchType) {
|
||||
List<SysDept> parentDeptIdList = remoteDeptService.getParentDeptList(deptId).getData();
|
||||
if (ObjectUtil.isEmpty(parentDeptIdList)) {
|
||||
return null;
|
||||
}
|
||||
List<Long> deptIds = parentDeptIdList.stream().map(SysDept::getDeptId).toList();
|
||||
return getFirstMch(deptIds);
|
||||
return getFirstMch(deptIds, mchType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-2
@@ -15,6 +15,7 @@ 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.MerchantTypeEnum;
|
||||
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;
|
||||
@@ -115,7 +116,7 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
|
||||
public void syncAllDept(Long deptId, Boolean isDel) {
|
||||
MchManageDto dto = new MchManageDto();
|
||||
if (ObjectUtil.isNotEmpty(deptId)) {
|
||||
MchManageVo mchManageVo = mchManageService.getFirstMchByDeptId(deptId);
|
||||
MchManageVo mchManageVo = mchManageService.getFirstMchByDeptId(deptId, MerchantTypeEnum.CANTEEN);
|
||||
if (ObjectUtil.isNotEmpty(mchManageVo)) {
|
||||
dto.setDeptId(mchManageVo.getDeptId());
|
||||
}
|
||||
@@ -268,7 +269,7 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
|
||||
log.error("|{}|syncAllUserGroup用户没有自动创建钱包权限|{}|", TAG, JSONUtil.toJsonStr(v));
|
||||
continue;
|
||||
}
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId());
|
||||
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId(), MerchantTypeEnum.CANTEEN);
|
||||
// 查询是在商户下
|
||||
if (ObjectUtil.isEmpty(mch)) {
|
||||
log.error("|{}|syncAllUserGroup用户部门商户id为空WalletManageVo|{}|", TAG, JSONUtil.toJsonStr(v));
|
||||
|
||||
Reference in new issue
Block a user