feat:正元同步

This commit is contained in:
dzc committed 2025-09-01 19:28:45 +08:00
1 parent c2d52f9c03
commit 169edc5fd3
8 files changed
+20 -19

No files matched your search

@@ -23,7 +23,6 @@ import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -106,7 +105,7 @@ public class HardAfterSaleController {
@PostMapping(value = "/admin-refund")
@Operation(summary = "后台退款")
@Idempotent(expireTime = 10, info = "正在退款中,请勿重复操作")
@Idempotent(expireTime = 5, info = "正在退款中,请勿重复操作")
@PreAuthorize("@pms.hasPermission('hard_hardAfterSale_adminRefund')")
public R<Boolean> adminRefund(@RequestBody HardAdminRefundDto dto) {
PjcloudUser user = SecurityUtils.getUser();
@@ -115,7 +114,7 @@ public class HardAfterSaleController {
@PostMapping(value = "/admin-reinforce-refund")
@Operation(summary = "后台强化退款")
@Idempotent(expireTime = 10, info = "正在退款中,请勿重复操作")
@Idempotent(expireTime = 5, info = "正在退款中,请勿重复操作")
@PreAuthorize("@pms.hasPermission('hard_hardAfterSale_adminRefund')")
public R<Boolean> adminReinforceRefund(@RequestBody HardAdminRefundReinforceDto dto) {
PjcloudUser user = SecurityUtils.getUser();
@@ -107,7 +107,7 @@ public class MchManageController {
@Inner
@GetMapping("/get-first-mch")
public R<MchManageVo> getFirstMch(@RequestParam List<Long> deptIds, @RequestParam MerchantTypeEnum mchType) {
MchManageVo mchManage = mchManageService.getFirstMch(deptIds, mchType);
MchManageVo mchManage = mchManageService.getFirstMch(deptIds, List.of(mchType));
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
return R.ok(mchManage);
}
@@ -115,7 +115,7 @@ public class MchManageController {
@Inner
@GetMapping("/get-first-mch-by-dept-id")
public R<MchManageVo> getFirstMchByDeptId(@RequestParam Long deptId, @RequestParam MerchantTypeEnum mchType) {
MchManageVo mchManage = mchManageService.getFirstMchByDeptId(deptId, mchType);
MchManageVo mchManage = mchManageService.getFirstMchByDeptId(deptId, List.of(mchType));
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
return R.ok(mchManage);
}
@@ -37,9 +37,9 @@ public interface MchManageService extends IService<MchManageEntity> {
MchManageVo getByDeptId(Long deptId, MerchantTypeEnum type);
MchManageVo getFirstMch(List<Long> deptIds, MerchantTypeEnum mchType);
MchManageVo getFirstMch(List<Long> deptIds, List<MerchantTypeEnum> mchTypeList);
MchManageVo getFirstMchByDeptId(Long deptId, MerchantTypeEnum mchType);
MchManageVo getFirstMchByDeptId(Long deptId, List<MerchantTypeEnum> mchTypeList);
/**
* 刷新商户二维码
@@ -160,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(), MerchantTypeEnum.CANTEEN);
MchManageVo mch = mchManageService.getFirstMchByDeptId(wallet.getDeptId(), List.of(MerchantTypeEnum.CANTEEN));
if (ObjectUtil.isEmpty(mch)) return;
LambdaQueryWrapper<WalletActiveEntity> wrapper = new LambdaQueryWrapper<WalletActiveEntity>()
.isNull(WalletActiveEntity::getUserId)
@@ -489,7 +489,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
);
// 修改钱包冻结开卡商户
// 查询用户所属于的食堂商户
MchManageVo mch = mchManageService.getFirstMchByDeptId(sysUser.getDeptId(), MerchantTypeEnum.CANTEEN);
MchManageVo mch = mchManageService.getFirstMchByDeptId(sysUser.getDeptId(), List.of(MerchantTypeEnum.CANTEEN));
if (ObjectUtil.isNotEmpty(mch)) {
walletActiveService.update(new LambdaUpdateWrapper<WalletActiveEntity>()
.set(WalletActiveEntity::getMerchantId, mch.getId())
@@ -552,7 +552,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
if (ObjectUtil.isNotEmpty(list)) {
// 用户
List<Long> userIds = list.stream().map(WalletManageVo::getUserId).distinct().toList();
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
R<List<SysUser>> userList = userService.getInnerUserById(new ArrayList<>(userIds));
if (ObjectUtil.isNotEmpty(userList.getData())) {
DataUtil.convertUserList(list, CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
}
@@ -58,7 +58,7 @@ public class MchDeptServiceImpl extends ServiceImpl<MchDeptUserMapper, MchDeptEn
item.setDeptId(v.getDeptId());
// 查询所属的商户
try {
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId(), MerchantTypeEnum.CANTEEN);
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId(), List.of(MerchantTypeEnum.OTHER_CANTEEN, MerchantTypeEnum.CANTEEN));
if (ObjectUtil.isEmpty(mch)) continue;
item.setMchId(mch.getId());
} catch (Exception e) {
@@ -278,16 +278,18 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
}
@Override
public MchManageVo getFirstMch(List<Long> deptIds, MerchantTypeEnum mchType) {
public MchManageVo getFirstMch(List<Long> deptIds, List<MerchantTypeEnum> mchTypeList) {
List<String> mchTypeStrList = mchTypeList.stream().map(MerchantTypeEnum::getType).toList();
List<MchManageEntity> merchantList = baseMapper.selectList(new LambdaQueryWrapper<MchManageEntity>()
.eq(ObjectUtil.isNotEmpty(mchType), MchManageEntity::getTypes, mchType.getType())
.in(ObjectUtil.isNotEmpty(mchTypeList), MchManageEntity::getTypes, mchTypeStrList)
);
if (ObjectUtil.isEmpty(merchantList)) return null;
for (Long id : deptIds) {
for (MchManageEntity merchant : merchantList) {
if (ObjectUtil.equals(merchant.getDeptId(), id)) {
if (ObjectUtil.isNotEmpty(mchType)) {
if (ObjectUtil.equals(merchant.getTypes(), mchType.getType())) {
if (ObjectUtil.isNotEmpty(mchTypeStrList)) {
if (mchTypeStrList.contains(merchant.getTypes())) {
return BeanUtils.toBean(merchant, MchManageVo.class);
}
} else {
@@ -300,13 +302,13 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
}
@Override
public MchManageVo getFirstMchByDeptId(Long deptId, MerchantTypeEnum mchType) {
public MchManageVo getFirstMchByDeptId(Long deptId, List<MerchantTypeEnum> mchTypeList) {
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, mchType);
return getFirstMch(deptIds, mchTypeList);
}
/**
@@ -116,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, MerchantTypeEnum.CANTEEN);
MchManageVo mchManageVo = mchManageService.getFirstMchByDeptId(deptId, List.of(MerchantTypeEnum.OTHER_CANTEEN, MerchantTypeEnum.CANTEEN));
if (ObjectUtil.isNotEmpty(mchManageVo)) {
dto.setDeptId(mchManageVo.getDeptId());
}
@@ -269,7 +269,7 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
log.error("|{}|syncAllUserGroup用户没有自动创建钱包权限|{}|", TAG, JSONUtil.toJsonStr(v));
continue;
}
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId(), MerchantTypeEnum.CANTEEN);
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId(), List.of(MerchantTypeEnum.OTHER_CANTEEN, MerchantTypeEnum.CANTEEN));
// 查询是在商户下
if (ObjectUtil.isEmpty(mch)) {
log.error("|{}|syncAllUserGroup用户部门商户id为空WalletManageVo|{}|", TAG, JSONUtil.toJsonStr(v));