Browse Source

用户单位修改

tags/24080901
WendyYang 10 months ago
parent
commit
8f4fec6b94
9 changed files with 59 additions and 37 deletions
  1. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java
  2. +15
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/UserRoleServiceImpl.java
  3. +13
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java
  4. +9
    -16
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java
  5. +6
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java
  6. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/task/SyncMhUnitProperties.java
  7. +2
    -2
      hz-pm-api/src/main/resources/application-prod.yml
  8. +3
    -3
      hz-pm-api/src/main/resources/application-test.yml
  9. +7
    -7
      hz-pm-api/src/main/resources/integration/zwdd-test.yml

+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java View File

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.sys.model.entity.UserRole;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
@@ -34,6 +36,7 @@ public interface IUserRoleService extends IService<UserRole> {
* @author WendyYang
**/
List<Long> listUserIdByRoleId(Long roleId);
List<Long> listUserIdByRoleIds(Collection<Long> roleId);

default UserRole getOne(Long userId, Long roleId) {
LambdaQueryWrapper<UserRole> eq = Wrappers.lambdaQuery(UserRole.class)


+ 15
- 2
hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/UserRoleServiceImpl.java View File

@@ -1,6 +1,7 @@
package com.hz.pm.api.sys.service.impl;

import cn.hutool.http.HttpStatus;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.basic.exception.BaseUncheckedException;
@@ -15,6 +16,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
@@ -35,6 +38,10 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i

private final RoleMapper roleMapper;

private LambdaQueryWrapper<UserRole> roleIdsQuery(Collection<Long> roleIds) {
return Wrappers.lambdaQuery(UserRole.class).in(UserRole::getRoleId,roleIds);
}

@Override
@Transactional(rollbackFor = Exception.class)
public boolean initAdmin(Long userId) {
@@ -52,8 +59,14 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i

@Override
public List<Long> listUserIdByRoleId(Long roleId) {
List<UserRole> userRoles = this.list(Wrappers.<UserRole>lambdaQuery()
.eq(UserRole::getRoleId, roleId));
return listUserIdByRoleIds(Collections.singletonList(roleId));
}

@Override
public List<Long> listUserIdByRoleIds(Collection<Long> roleIds) {
LambdaQueryWrapper<UserRole> wrapper = roleIdsQuery(roleIds)
.select(UserRole::getUserId);
List<UserRole> userRoles = this.list(wrapper);
return CollUtils.fieldList(userRoles, UserRole::getUserId);
}



+ 13
- 4
hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java View File

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -68,6 +69,8 @@ public class SyncMhUserOrgManage {
if (CollUtil.isEmpty(mhUsers)) {
return;
}
List<MhUnit> units = mhUnitService.list();
Map<Long, MhUnit> unitMap = CollUtils.listToMap(units, MhUnit::getId);
Integer batchSize = syncMhUserProperties.getBatchSize();
List<List<MhUserDTO>> mhUserParts = ListUtil.partition(mhUsers, batchSize);
for (List<MhUserDTO> part : mhUserParts) {
@@ -80,10 +83,9 @@ public class SyncMhUserOrgManage {
}
UserInfo userInfo = new UserInfo();
userInfo.setMhUserId(mhUser.getUserId());
if (Boolean.TRUE.equals(mhUser.getIsZzdAccount())) {
if (NumberUtil.isNumber(mhUser.getAccountId())) {
userInfo.setAccountId(Long.parseLong(mhUser.getAccountId()));
}
if (Boolean.TRUE.equals(mhUser.getIsZzdAccount())
&& (NumberUtil.isNumber(mhUser.getAccountId()))) {
userInfo.setAccountId(Long.parseLong(mhUser.getAccountId()));
}
UserAvailableEnum userStatus = getUserAvailable(mhUser.getStatus());
userInfo.setAvailable(userStatus.name());
@@ -91,6 +93,13 @@ public class SyncMhUserOrgManage {
userInfo.setUsername(mhUser.getAccount());
userInfo.setId(userIdMap.get(mhUser.getUserId()));
userInfo.setRegionCode("330100");
MhUnit unit = unitMap.get(mhUser.getMhUnitId());
if (unit != null) {
userInfo.setEmpPosUnitName(unit.getName());
}
if (PhoneUtil.isMobile(mhUser.getAccount())) {
userInfo.setMobile(mhUser.getAccount());
}
userInfo.setMhUnitId(mhUser.getMhUnitId());
savedList.add(userInfo);
}


+ 9
- 16
hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java View File

@@ -34,6 +34,7 @@ import com.hz.pm.api.user.util.LoginUserUtil;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.GenericResult;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.zwdd.ZwddIntegrationProperties;
import com.ningdatech.zwdd.client.ZwddClient;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
@@ -68,8 +69,6 @@ public class UserInfoManage {
private final ZwddClient zwddClient;

public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO req) {
PageVo<ResUserInfoListVO> pageVo = new PageVo<>();

String phoneNo = req.getPhoneNo();
String orgCode = req.getOrgCode();
String name = req.getName();
@@ -77,10 +76,8 @@ public class UserInfoManage {
Long regionId = req.getRegionId();

List<Long> userIdList = getRoleCompliantUserIdList(req.getUserRoleList());
if (userIdList != null && userIdList.size() == 0) {
pageVo.setRecords(new ArrayList<>());
pageVo.setTotal(0L);
return pageVo;
if (userIdList != null && userIdList.isEmpty()) {
return PageVo.empty();
}

LambdaQueryWrapper<UserInfo> wrapper = Wrappers.lambdaQuery(UserInfo.class)
@@ -92,7 +89,7 @@ public class UserInfoManage {
.eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode)
.orderByDesc(UserInfo::getUpdateOn);

Page<UserInfo> page = iUserInfoService.page(new Page<>(req.getPageNumber(), req.getPageSize()), wrapper);
Page<UserInfo> page = iUserInfoService.page(req.page(), wrapper);
List<UserInfo> records = page.getRecords();
long total = page.getTotal();
List<ResUserInfoListVO> result = new ArrayList<>();
@@ -127,9 +124,7 @@ public class UserInfoManage {
result.add(item);
});
}
pageVo.setTotal(total);
pageVo.setRecords(result);
return pageVo;
return PageVo.of(result, total);
}

private List<String> getCompliantOrgEmpCodeList(String orgName, String orgCode) {
@@ -187,15 +182,13 @@ public class UserInfoManage {
*/
private List<Long> getRoleCompliantUserIdList(List<UserRoleVO> userRoleList) {
if (CollUtil.isNotEmpty(userRoleList)) {
userRoleList = userRoleList.stream().filter(r -> Objects.nonNull(r.getId())).collect(Collectors.toList());
userRoleList.removeIf(r -> Objects.isNull(r.getId()));
}
if (CollUtil.isEmpty(userRoleList)) {
return Collections.emptyList();
return null;
}
List<Long> roleIdList = userRoleList.stream().map(UserRoleVO::getId).collect(Collectors.toList());

List<Long> compliantUserIdList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class)
.in(UserRole::getRoleId, roleIdList)).stream().map(UserRole::getUserId).distinct().collect(Collectors.toList());
List<Long> roleIdList = CollUtils.fieldList(userRoleList, UserRoleVO::getId);
List<Long> compliantUserIdList = iUserRoleService.listUserIdByRoleIds(roleIdList);
if (CollUtil.isEmpty(compliantUserIdList)) {
return new ArrayList<>();
}


+ 6
- 2
hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java View File

@@ -8,8 +8,12 @@ import java.time.LocalDateTime;
import java.util.List;

/**
* @author liuxinxin
* @date 2023/2/13 上午9:10
* <p>
* ResUserInfoListVO
* </p>
*
* @author WendyYang
* @since 15:24 2024/1/10
*/
@Data
@ApiModel("用户管理查询 请求response")


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/user/task/SyncMhUnitProperties.java View File

@@ -23,6 +23,6 @@ public class SyncMhUnitProperties {

private Boolean open = true;

private Integer batchSize = 2000;
private Integer batchSize = 5000;

}

+ 2
- 2
hz-pm-api/src/main/resources/application-prod.yml View File

@@ -76,8 +76,8 @@ mybatis-plus:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
logic-delete-value: true
logic-not-delete-value: false
logic-delete-value: 1
logic-not-delete-value: 0
logging:
config: classpath:logback-spring.xml
#日志配置


+ 3
- 3
hz-pm-api/src/main/resources/application-test.yml View File

@@ -76,8 +76,8 @@ mybatis-plus:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
logic-delete-value: true
logic-not-delete-value: false
logic-delete-value: 1
logic-not-delete-value: 0
logging:
config: classpath:logback-spring.xml
#日志配置
@@ -238,7 +238,7 @@ project:
delete-all-url: http://10.53.168.41:38088/open/api/v1/project-receive/delete-all
login:
phone-verify-code:
skip: false
skip: true
url: http://60.188.225.145/login
web:
url: http://60.188.225.145


+ 7
- 7
hz-pm-api/src/main/resources/integration/zwdd-test.yml View File

@@ -1,12 +1,12 @@
#浙政
#专有钉
integration:
zwdd:
#扫码
app-auth-key: ls_project_managment_din-b1Y3I1g7Rr94yX76KfFkpp18Uy4WHtU0b6rINJ3
app-auth-secret: 75e8PMHv984KYF0Mcy6v4pxt480y73dbD7kB65dD
app-auth-key: ls-rebuild_dingoa-rgeWs3YVr26z
app-auth-secret: 37qCe6ylNMW0N8K2741z0c2b9vJP2gtuMRQQtZ9P
#免登/获取信息
app-key: ls_project-c32LNu87v60UiANZVja
app-secret: R14QgbBr21751LTGml3Vt8oX9doPl4Lk1ROzZNfG
app-key: ls_rebuild-10c8n5X0707yFV7jURr
app-secret: gN8J3WazyXLMWKDuFmx6C4yaH5lFUY41x8rYLLo6
#专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729
tenantId: 196729
domain: openplatform-pro.ding.zj.gov.cn
tenantId: 31141
domain: openplatform.dg-work.cn

Loading…
Cancel
Save