del:删除用户食堂字段
This commit is contained in:
1 parent
d592a84808
commit
165070fa73
6 files changed
-133
No files matched your search
-3
@@ -40,9 +40,6 @@ import java.util.Set;
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UPMS_SERVICE)
|
||||
public interface RemoteUserService {
|
||||
|
||||
@NoToken
|
||||
@PostMapping("/user/inner/sync-user-canteen")
|
||||
R syncUserCanteen(@RequestParam(required = false) Long userId, @RequestParam(required = false) Long deptId, @RequestParam(required = false) Boolean foure);
|
||||
|
||||
@NoToken
|
||||
@PostMapping("/user/inner-page")
|
||||
|
||||
@@ -237,9 +237,6 @@ public class UserVO implements BaseFacesInterface, Serializable {
|
||||
*/
|
||||
private Boolean isCheckUser = false;
|
||||
|
||||
@Schema(description = "用户所属的商户id")
|
||||
private Long canteenId;
|
||||
|
||||
/**
|
||||
* 商户相关
|
||||
*/
|
||||
|
||||
-19
@@ -23,7 +23,6 @@ import cn.hutool.core.collection.CollUtil;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserDTO;
|
||||
@@ -86,24 +85,6 @@ public class SysUserController {
|
||||
|
||||
/* ************************************* end 回调 end ************************************* */
|
||||
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
|
||||
@Inner()
|
||||
@PostMapping("/inner/sync-user-canteen")
|
||||
public R syncUserCanteen(@RequestParam(required = false) Long userId, @RequestParam(required = false) Long deptId, @RequestParam(required = false) Boolean foure) {
|
||||
if (ObjectUtil.isEmpty(foure)) foure = true;
|
||||
userService.syncUserCanteen(userId, deptId, foure);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/* ************************************* end 远程调用 end ************************************* */
|
||||
|
||||
@Operation(summary = "同步用户食堂信息", description = "同步用户食堂信息")
|
||||
@PostMapping("/sync-user-canteen")
|
||||
public R syncUserCanteen() {
|
||||
userService.syncUserCanteen();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定用户全部信息
|
||||
|
||||
-15
@@ -228,19 +228,4 @@ public interface SysUserService extends IService<SysUser> {
|
||||
* @return
|
||||
*/
|
||||
List<SimpleUserListVO> listUserIdByDeptId(Long deptId, String name);
|
||||
|
||||
/**
|
||||
* 同步所有用户食堂信息
|
||||
*/
|
||||
void syncUserCanteen();
|
||||
|
||||
/**
|
||||
* 按条件同步用户食堂信息
|
||||
*/
|
||||
void syncUserCanteen(Long userId, Long deptId, boolean foure);
|
||||
|
||||
/**
|
||||
* 获取用户食堂id
|
||||
*/
|
||||
Long getUserCanteenId(Long deptId);
|
||||
}
|
||||
-89
@@ -133,7 +133,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
private final RemoteWalletService remoteWalletService;
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
private final SysFileService sysFileService;
|
||||
|
||||
@@ -175,8 +174,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
sysUser.setUpdateBy(userDto.getUsername());
|
||||
sysUser.setPassword(ENCODER.encode(userDto.getPassword()));
|
||||
sysUser.setPasswordModifyTime(LocalDateTime.now());
|
||||
// 获取用户食堂id
|
||||
sysUser.setCanteenId(getUserCanteenId(sysUser.getDeptId()));
|
||||
baseMapper.insert(sysUser);
|
||||
// 保存用户岗位信息
|
||||
Optional.ofNullable(userDto.getPost()).ifPresent(posts -> {
|
||||
@@ -267,16 +264,6 @@ 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();
|
||||
@@ -895,7 +882,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
updateUser.setUserId(detail.getUserId());
|
||||
updateUser.setProcessStatus(processStatus);
|
||||
updateUser.setProcessTime(LocalDateTime.now());
|
||||
if (isConsent) updateUser.setCanteenId(getUserCanteenId(detail.getDeptId()));
|
||||
baseMapper.updateById(updateUser);
|
||||
if (isConsent) {
|
||||
// 创建用户默认钱包
|
||||
@@ -952,79 +938,4 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
.like(StrUtil.isNotBlank(name), SysUser::getName, name));
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按条件同步用户食堂信息
|
||||
*/
|
||||
@Override
|
||||
public void syncUserCanteen(Long userId, Long deptId, boolean foure) {
|
||||
SysUser userDto = new SysUser();
|
||||
userDto.setUserId(userId);
|
||||
userDto.setDeptId(deptId);
|
||||
Long current = 1L;
|
||||
while (true) {
|
||||
boolean result = syncUserCanteenGroup(current, userDto, foure);
|
||||
if (!result) break;
|
||||
current++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户食堂id
|
||||
*/
|
||||
@Override
|
||||
public Long getUserCanteenId(Long deptId) {
|
||||
if (ObjectUtil.isEmpty(deptId)) return -1L;
|
||||
MchManageVo mchDetail = remoteMchService.getFirstMchByDeptId(deptId, MerchantTypeEnum.CANTEEN).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchDetail) && ObjectUtil.isNotEmpty(mchDetail.getTypes()) && ObjectUtil.equals(mchDetail.getTypes(), MerchantTypeEnum.CANTEEN.getType())) {
|
||||
return mchDetail.getId();
|
||||
}
|
||||
return -1L;
|
||||
}
|
||||
|
||||
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;
|
||||
SysUser item = new SysUser();
|
||||
item.setUserId(v.getUserId());
|
||||
Long mchId = getUserCanteenId(v.getDeptId());
|
||||
if (ObjectUtil.equals(mchId, -1L)) {
|
||||
item.setCanteenId(-1L);
|
||||
noneMchUserSum++;
|
||||
} else {
|
||||
item.setCanteenId(mchId);
|
||||
}
|
||||
updateUserList.add(item);
|
||||
}
|
||||
baseMapper.updateById(updateUserList);
|
||||
log.info("|{}|同步用户食堂信息,用户总数量:{},无食堂用户数:{}", TAG, pageList.getCurrent(), noneMchUserSum);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
-4
@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.constant.UserTransactionEnum;
|
||||
import com.bsd.pjcloud.admin.api.dto.SysUserTransactionDto;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserDTO;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUserTransactionEntity;
|
||||
@@ -24,7 +23,6 @@ import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
||||
import com.bsd.pjcloud.common.data.tenant.TenantContextHolder;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.flow.task.api.feign.RemoteFlowEngineService;
|
||||
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
@@ -33,7 +31,6 @@ import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletThirdZyService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
@@ -205,7 +202,6 @@ public class SysUserTransactionServiceImpl extends ServiceImpl<SysUserTransactio
|
||||
SysUser userUpdateObj = new SysUser();
|
||||
userUpdateObj.setUserId(detail.getUserId());
|
||||
userUpdateObj.setDeptId(detail.getTargetDeptId());
|
||||
userUpdateObj.setCanteenId(sysUserService.getUserCanteenId(detail.getTargetDeptId()));
|
||||
sysUserService.updateById(userUpdateObj);
|
||||
// 通知正元
|
||||
if (ObjectUtil.equals(detail.getBizType(), UserTransactionEnum.INNER_TRANSFER.getType())) {
|
||||
|
||||
Reference in new issue
Block a user