diff --git a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysUserServiceImpl.java b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysUserServiceImpl.java index 942b32b55..7a2d19b04 100644 --- a/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysUserServiceImpl.java +++ b/pjcloud-upms/pjcloud-upms-biz/src/main/java/com/bsd/pjcloud/admin/service/impl/SysUserServiceImpl.java @@ -65,6 +65,7 @@ import com.bsd.pjcloud.common.security.util.SecurityUtils; 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.RemoteWalletService; import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo; @@ -541,6 +542,10 @@ public class SysUserServiceImpl extends ServiceImpl impl String walletAutoCreate = ParamResolver.getStr("WALLET_AUTO_CREATE"); String userDefaultRole = ParamResolver.getStr("USER_DEFAULT_ROLE"); List roleIds = roleList.stream().filter(v -> ObjectUtil.equals(v.getRoleCode(), walletAutoCreate) || ObjectUtil.equals(v.getRoleCode(), userDefaultRole)).map(SysRole::getRoleId).toList(); + // 用户手机号重复判断 + List userPoneList = excelList.stream().map(UserExcelFaceVo::getMobile).toList(); + // 用户名重复判断 + List usernameList = excelList.stream().map(UserExcelFaceVo::getUsername).toList(); // 读取图片 Map images = ExcelTool.getPictureFromExcel(file, 1); for (UserExcelFaceVo v : excelList) { @@ -576,9 +581,20 @@ public class SysUserServiceImpl extends ServiceImpl impl String key = String.valueOf(v.getLineNum() - 1); face = images.getOrDefault(key, null); } - if (ObjectUtil.isEmpty(face)) { - errorMsg.add("人脸照片为空"); + // if (ObjectUtil.isEmpty(face)) { + // errorMsg.add("人脸照片为空"); + // } + + long userPhone = userPoneList.stream().filter(i -> ObjectUtil.equals(i, v.getMobile())).count(); + if (userPhone > 1) { + errorMsg.add("用手机号 <" + v.getMobile() + "> 重复"); } + + long repetitionUsername = usernameList.stream().filter(i -> ObjectUtil.equals(i, v.getUsername())).count(); + if (repetitionUsername > 1) { + errorMsg.add("用户名 <" + v.getUsername() + "> 重复"); + } + if (CollUtil.isEmpty(errorMsg)) { insertExcelUser(v, deptId, roleIds, face); } else { @@ -638,7 +654,10 @@ public class SysUserServiceImpl extends ServiceImpl impl // 插入用户 Long usrId = this.saveUser(userDTO); userDTO.setUserId(usrId); - insertExcelFace(userDTO, face); + // 更新人脸 + if (ObjectUtil.isNotEmpty(face)) { + insertExcelFace(userDTO, face); + } } public void insertExcelFace(UserDTO user, PictureData face) { diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/rule/WalletRuleJoinVo.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/rule/WalletRuleJoinVo.java index 04d489bdb..8dc505024 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/rule/WalletRuleJoinVo.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/vo/rule/WalletRuleJoinVo.java @@ -1,5 +1,6 @@ package com.bsd.pjcloud.wallet.api.vo.rule; +import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface; import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity; import lombok.AllArgsConstructor; import lombok.Builder; @@ -11,7 +12,7 @@ import lombok.NoArgsConstructor; @Builder @AllArgsConstructor @NoArgsConstructor -public class WalletRuleJoinVo extends WalletRuleJoinEntity { +public class WalletRuleJoinVo extends WalletRuleJoinEntity implements BaseDeptInterface { /** * 源钱包类型 @@ -30,4 +31,11 @@ public class WalletRuleJoinVo extends WalletRuleJoinEntity { private String targetUniqueCode; private String targetIcon; + + /** + * 部门 + */ + private Long deptId; + + private String deptName; } diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/rule/WalletRuleJoinController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/rule/WalletRuleJoinController.java index 6298c7ca8..298329fda 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/rule/WalletRuleJoinController.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/rule/WalletRuleJoinController.java @@ -70,7 +70,8 @@ public class WalletRuleJoinController { @PostMapping // @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_add')") public R save(@RequestBody WalletRuleJoinDto dto) { - return R.ok(walletRuleJoinService.create(dto)); + walletRuleJoinService.create(dto); + return R.ok(); } @Operation(summary = "修改钱包规则配置", description = "修改钱包规则配置") diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRuleJoinService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRuleJoinService.java index 0a4660b7e..764dbca75 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRuleJoinService.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletRuleJoinService.java @@ -21,7 +21,7 @@ public interface WalletRuleJoinService extends IService { /** * 新增 */ - Long create(WalletRuleJoinEntity dto); + void create(WalletRuleJoinDto dto); /** * 修改 diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/rule/WalletRuleJoinServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/rule/WalletRuleJoinServiceImpl.java index 9813f3ff6..aff37aab1 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/rule/WalletRuleJoinServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/rule/WalletRuleJoinServiceImpl.java @@ -4,10 +4,16 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +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.util.BeanUtils; +import com.bsd.pjcloud.common.core.util.R; import com.bsd.pjcloud.common.data.datascope.DataScope; import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleJoinDto; import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity; import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity; +import com.bsd.pjcloud.wallet.api.vo.WalletManageVo; import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo; import com.bsd.pjcloud.wallet.mapper.rule.WalletRuleJoinMapper; import com.bsd.pjcloud.wallet.service.WalletRuleJoinService; @@ -18,6 +24,8 @@ import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import java.util.ArrayList; +import java.util.List; +import java.util.Map; /** * 钱包规则配置 @@ -30,31 +38,39 @@ public class WalletRuleJoinServiceImpl extends ServiceImpl scopeJoinPage(Page page, WalletRuleJoinDto dto, DataScope dataScope) { - return baseMapper.scopeJoinPage(page, dto, dataScope); + Page pageList = baseMapper.scopeJoinPage(page, dto, dataScope); + disposeList(pageList.getRecords(), dto); + return pageList; } /** * 新增 */ @Override - public Long create(WalletRuleJoinEntity dto) { - if (existWalletRuleJoin(dto)) { - throw new RuntimeException("绑定类型不能重复"); - } + public void create(WalletRuleJoinDto dto) { if (areWalletIdsDistinct(dto)) { throw new RuntimeException("源钱包类型与目标钱包类型不能重复"); } - WalletTypeEntity targetMch = walletTypeService.getById(dto.getTargetWalletTypeId()); - if (ObjectUtil.isEmpty(targetMch)) { - throw new RuntimeException("目标钱包类型不存在"); + List saveList = new ArrayList<>(); + for (Long v : dto.getTargetDeptIdList()) { + if (ObjectUtil.isEmpty(v)) continue; + WalletRuleJoinEntity item = BeanUtils.toBean(dto, WalletRuleJoinEntity.class); + item.setTargetDeptId(v); + if (existWalletRuleJoin(dto)) { + // 查询部门 + SysDept sysDept = remoteDeptService.getDeptByDeptId(v).getData(); + throw new RuntimeException(sysDept.getName() + "部门绑定类型不能重复"); + } + saveList.add(item); } - baseMapper.insert(dto); - return dto.getId(); + baseMapper.insert(saveList); } /** @@ -118,4 +134,14 @@ public class WalletRuleJoinServiceImpl extends ServiceImpl list, WalletRuleJoinDto dto) { + if (ObjectUtil.isEmpty(list)) return; + // 部门 + List deptIds = list.stream().map(WalletRuleJoinVo::getTargetDeptId).distinct().toList(); + R> deptList = remoteDeptService.getDeptByDeptIds(deptIds); + if (ObjectUtil.isNotEmpty(deptList.getData())) { + DataUtil.convertDeptList(list, deptList.getData()); + } + } } \ No newline at end of file