Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2025-05-14 19:25:39 +08:00
commit a2b4f95ec0
12 files changed
+120 -20

No files matched your search

@@ -245,4 +245,7 @@ public class SysUser extends Model<SysUser> implements Serializable {
@Schema(description = "是否为全局人脸")
private String isGlobalFace;
@Schema(description = "用户所属的商户id")
private Long canteenId;
}
@@ -237,4 +237,11 @@ public class UserVO implements BaseFacesInterface, Serializable {
*/
private Boolean isCheckUser = false;
@Schema(description = "用户所属的商户id")
private Long canteenId;
/**
* 商户相关
*/
private String merchantName;
}
@@ -86,6 +86,13 @@ public class SysUserController {
/* ************************************* end 回调 end ************************************* */
@Operation(summary = "同步用户食堂信息", description = "同步用户食堂信息")
@PostMapping("/sync-user-canteen")
public R syncUserCanteen() {
userService.syncUserCanteen();
return R.ok();
}
/**
* 获取指定用户全部信息
*
@@ -227,4 +227,9 @@ public interface SysUserService extends IService<SysUser> {
* @return
*/
List<SimpleUserListVO> listUserIdByDeptId(Long deptId, String name);
/**
* 同步用户食堂信息
*/
void syncUserCanteen();
}
@@ -67,7 +67,10 @@ import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
import com.bsd.pjcloud.flow.task.dto.TaskDto;
import com.bsd.pjcloud.wallet.api.dto.recharge.excel.WalletRechargeExcelDto;
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo;
import cn.hutool.extra.spring.SpringUtil;
@@ -129,6 +132,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private final CacheManager cacheManager;
private final RemoteWalletService remoteWalletService;
private final RemoteMchService remoteMchService;
private final SysFileService sysFileService;
@@ -258,6 +262,16 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
List<SysUserFaceVo> faceList = sysUserFaceMapper.groupConcatFaces(faceDto);
DataUtil.convertFacesList(list.getRecords(), CollectionUtils.convertMap(faceList, SysUserFaceVo::getUserId));
}
// 商户列表
List<Long> mchIds = list.getRecords().stream().map(UserVO::getCanteenId).distinct().toList();
if (ObjectUtil.isNotEmpty(mchIds)) {
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
if (ObjectUtil.isNotEmpty(mchList)) {
for (UserVO v : list.getRecords()) {
mchList.stream().filter(m -> ObjectUtil.equals(m.getId(), v.getCanteenId())).findFirst().ifPresent(mch -> v.setMerchantName(mch.getName()));
}
}
}
// 审批流程
if (userDTO.getIsFindCheckUser()) {
List<String> processInstanceIds = list.getRecords().stream().map(UserVO::getProcessId).filter(ObjectUtil::isNotEmpty).distinct().toList();
@@ -933,4 +947,48 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return com.bsd.pjcloud.common.core.util.BeanUtils.toBean(sysUsers, SimpleUserListVO.class);
}
/**
* 同步用户食堂信息
*/
@Override
public void syncUserCanteen() {
SysUser userDto = new SysUser();
Long current = 1L;
while (true) {
boolean result = syncUserCanteenGroup(current, userDto, true);
if (!result) break;
current++;
}
}
public boolean syncUserCanteenGroup(Long current, SysUser userDto, boolean foure) {
Page page = new Page<>();
page.setCurrent(current);
page.setSize(100);
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<SysUser>()
.eq(ObjectUtil.isNotEmpty(userDto.getUserId()), SysUser::getUserId, userDto.getUserId())
.eq(ObjectUtil.isNotEmpty(userDto.getDeptId()), SysUser::getDeptId, userDto.getDeptId());
Page<SysUser> pageList = baseMapper.selectPageByScope(page, wrapper, null);
boolean result = pageList.getRecords().size() == page.getSize();
if (ObjectUtil.isEmpty(pageList.getRecords())) return result;
int noneMchUserSum = 0;
List<SysUser> updateUserList = new ArrayList<>();
for (SysUser v : pageList.getRecords()) {
if (!foure && ObjectUtil.isNotEmpty(v.getCanteenId())) continue;
MchManageVo mchDetail = remoteMchService.getFirstMchByDeptId(v.getDeptId()).getData();
if (ObjectUtil.isEmpty(mchDetail)) {
noneMchUserSum++;
continue;
}
SysUser item = new SysUser();
item.setUserId(v.getUserId());
item.setCanteenId(mchDetail.getId());
updateUserList.add(item);
}
baseMapper.updateById(updateUserList);
log.info("|{}|同步用户食堂信息,用户总数量:{},无食堂用户数:{}", TAG, pageList.getCurrent(), noneMchUserSum);
return result;
}
}
@@ -170,6 +170,7 @@
u.name,
u.email,
u.is_global_face,
u.canteen_id,
d.name dept_name
FROM
sys_user u
@@ -1,8 +1,24 @@
package com.bsd.pjcloud.wallet.api.vo;
import com.bsd.pjcloud.wallet.api.entity.WalletSettingEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class WalletSettingVo extends WalletSettingEntity {
/**
* (跨单位)每一餐的上限(分)
*/
@Schema(description = "(跨单位)每一餐的上限(分)")
private Integer deptPayAmountMealLimit;
/**
* (跨单位)每一餐的倍数
*/
@Schema(description = "(跨单位)每一餐的倍数")
private BigDecimal deptPayAmountMealTimes;
}
@@ -7,14 +7,14 @@ public interface BaseMchInterface {
*/
Long getMerchantId();
void setMerchantId(Long dchId);
void setMerchantId(Long merchantId);
/**
* 商户名
*/
String getMerchantName();
void setMerchantName(String dchName);
void setMerchantName(String merchantName);
/**
* 商户logo
@@ -10,7 +10,7 @@ import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.dto.mch.MchRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
import com.bsd.pjcloud.wallet.service.MchRuleJoinControllerService;
import com.bsd.pjcloud.wallet.service.MchRuleJoinService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -31,35 +31,35 @@ import java.util.List;
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class MchRuleJoinController {
private final MchRuleJoinControllerService mchRuleJoinControllerService;
private final MchRuleJoinService mchRuleJoinService;
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
public R getWalletRuleMchConfigPage(@ParameterObject Page page, @ParameterObject MchRuleJoinDtoEntity walletRuleMchConfig) {
LambdaQueryWrapper<MchRuleJoinDtoEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(mchRuleJoinControllerService.page(page, wrapper));
return R.ok(mchRuleJoinService.page(page, wrapper));
}
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
@GetMapping("/page-join")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
public R pageJoin(@ParameterObject Page page, @ParameterObject MchRuleJoinDto dto) {
return R.ok(mchRuleJoinControllerService.pageScopeList(page, dto, DataScope.of()));
return R.ok(mchRuleJoinService.pageScopeList(page, dto, DataScope.of()));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
public R getById(@PathVariable("id") Long id) {
return R.ok(mchRuleJoinControllerService.getById(id));
return R.ok(mchRuleJoinService.getById(id));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("join-detail/{id}")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
public R joinDetail(@PathVariable("id") Long id) {
return R.ok(mchRuleJoinControllerService.joinDetail(id));
return R.ok(mchRuleJoinService.joinDetail(id));
}
@Operation(summary = "新增商户规格配置表", description = "新增商户规格配置表")
@@ -67,7 +67,7 @@ public class MchRuleJoinController {
@PostMapping
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_add')")
public R save(@RequestBody MchRuleJoinDtoEntity dto) {
return R.ok(mchRuleJoinControllerService.create(dto));
return R.ok(mchRuleJoinService.create(dto));
}
@Operation(summary = "修改商户规格配置表", description = "修改商户规格配置表")
@@ -75,7 +75,7 @@ public class MchRuleJoinController {
@PutMapping
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_edit')")
public R updateById(@RequestBody MchRuleJoinDtoEntity dto) {
return R.ok(mchRuleJoinControllerService.edit(dto));
return R.ok(mchRuleJoinService.edit(dto));
}
@Operation(summary = "通过id删除商户规格配置表", description = "通过id删除商户规格配置表")
@@ -83,7 +83,7 @@ public class MchRuleJoinController {
@DeleteMapping
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_del')")
public R removeById(@RequestBody Long[] ids) {
mchRuleJoinControllerService.delByIds(CollUtil.toList(ids));
mchRuleJoinService.delByIds(CollUtil.toList(ids));
return R.ok();
}
@@ -91,6 +91,6 @@ public class MchRuleJoinController {
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_export')")
public List<MchRuleJoinDtoEntity> export(MchRuleJoinDtoEntity walletRuleMchConfig, Long[] ids) {
return mchRuleJoinControllerService.list(Wrappers.lambdaQuery(walletRuleMchConfig).in(ArrayUtil.isNotEmpty(ids), MchRuleJoinDtoEntity::getId, ids));
return mchRuleJoinService.list(Wrappers.lambdaQuery(walletRuleMchConfig).in(ArrayUtil.isNotEmpty(ids), MchRuleJoinDtoEntity::getId, ids));
}
}
@@ -9,7 +9,7 @@ import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
import java.util.ArrayList;
public interface MchRuleJoinControllerService extends IService<MchRuleJoinDtoEntity> {
public interface MchRuleJoinService extends IService<MchRuleJoinDtoEntity> {
/**
* 权限分页查询
@@ -3,22 +3,22 @@ package com.bsd.pjcloud.wallet.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.common.core.constant.CacheConstants;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.wallet.api.dto.WalletSettingDto;
import com.bsd.pjcloud.wallet.api.entity.WalletSettingEntity;
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
import com.bsd.pjcloud.wallet.mapper.WalletSettingMapper;
import com.bsd.pjcloud.wallet.service.MchRuleJoinService;
import com.bsd.pjcloud.wallet.service.WalletRuleJoinService;
import com.bsd.pjcloud.wallet.service.WalletSettingService;
import lombok.Data;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.util.List;
/**
* 支付设置
@@ -26,6 +26,9 @@ import java.util.List;
* @author dzc
* @date 2025-01-06 10:52:31
*/
@Validated
@Slf4j
@RequiredArgsConstructor
@Service
public class WalletSettingServiceImpl extends ServiceImpl<WalletSettingMapper, WalletSettingEntity> implements WalletSettingService {
@@ -13,7 +13,7 @@ import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
import com.bsd.pjcloud.wallet.mapper.mch.WalletRuleMchConfigMapper;
import com.bsd.pjcloud.wallet.service.MchManageService;
import com.bsd.pjcloud.wallet.service.MchRuleJoinControllerService;
import com.bsd.pjcloud.wallet.service.MchRuleJoinService;
import com.bsd.pjcloud.wallet.service.WalletRulePriceConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -27,7 +27,7 @@ import java.util.ArrayList;
@Slf4j
@RequiredArgsConstructor
@Service
public class MchRuleJoinControllerServiceImpl extends ServiceImpl<WalletRuleMchConfigMapper, MchRuleJoinDtoEntity> implements MchRuleJoinControllerService {
public class MchRuleJoinControllerServiceImpl extends ServiceImpl<WalletRuleMchConfigMapper, MchRuleJoinDtoEntity> implements MchRuleJoinService {
private final MchManageService mchManageService;
private final WalletRulePriceConfigService rulePriceConfigService;