@@ -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.common.model.constant.BizConst; | ||||
import com.hz.pm.api.sys.model.entity.UserRole; | import com.hz.pm.api.sys.model.entity.UserRole; | ||||
import java.util.Collection; | |||||
import java.util.Collections; | |||||
import java.util.List; | import java.util.List; | ||||
/** | /** | ||||
@@ -34,6 +36,7 @@ public interface IUserRoleService extends IService<UserRole> { | |||||
* @author WendyYang | * @author WendyYang | ||||
**/ | **/ | ||||
List<Long> listUserIdByRoleId(Long roleId); | List<Long> listUserIdByRoleId(Long roleId); | ||||
List<Long> listUserIdByRoleIds(Collection<Long> roleId); | |||||
default UserRole getOne(Long userId, Long roleId) { | default UserRole getOne(Long userId, Long roleId) { | ||||
LambdaQueryWrapper<UserRole> eq = Wrappers.lambdaQuery(UserRole.class) | LambdaQueryWrapper<UserRole> eq = Wrappers.lambdaQuery(UserRole.class) | ||||
@@ -1,6 +1,7 @@ | |||||
package com.hz.pm.api.sys.service.impl; | package com.hz.pm.api.sys.service.impl; | ||||
import cn.hutool.http.HttpStatus; | import cn.hutool.http.HttpStatus; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
import com.ningdatech.basic.exception.BaseUncheckedException; | import com.ningdatech.basic.exception.BaseUncheckedException; | ||||
@@ -15,6 +16,8 @@ import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
import java.util.Collection; | |||||
import java.util.Collections; | |||||
import java.util.List; | import java.util.List; | ||||
/** | /** | ||||
@@ -35,6 +38,10 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i | |||||
private final RoleMapper roleMapper; | private final RoleMapper roleMapper; | ||||
private LambdaQueryWrapper<UserRole> roleIdsQuery(Collection<Long> roleIds) { | |||||
return Wrappers.lambdaQuery(UserRole.class).in(UserRole::getRoleId,roleIds); | |||||
} | |||||
@Override | @Override | ||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
public boolean initAdmin(Long userId) { | public boolean initAdmin(Long userId) { | ||||
@@ -52,8 +59,14 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i | |||||
@Override | @Override | ||||
public List<Long> listUserIdByRoleId(Long roleId) { | 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); | return CollUtils.fieldList(userRoles, UserRole::getUserId); | ||||
} | } | ||||
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.ListUtil; | |||||
import cn.hutool.core.date.DateUtil; | import cn.hutool.core.date.DateUtil; | ||||
import cn.hutool.core.date.LocalDateTimeUtil; | import cn.hutool.core.date.LocalDateTimeUtil; | ||||
import cn.hutool.core.util.NumberUtil; | import cn.hutool.core.util.NumberUtil; | ||||
import cn.hutool.core.util.PhoneUtil; | |||||
import cn.hutool.core.util.StrUtil; | import cn.hutool.core.util.StrUtil; | ||||
import cn.hutool.json.JSONUtil; | import cn.hutool.json.JSONUtil; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
@@ -68,6 +69,8 @@ public class SyncMhUserOrgManage { | |||||
if (CollUtil.isEmpty(mhUsers)) { | if (CollUtil.isEmpty(mhUsers)) { | ||||
return; | return; | ||||
} | } | ||||
List<MhUnit> units = mhUnitService.list(); | |||||
Map<Long, MhUnit> unitMap = CollUtils.listToMap(units, MhUnit::getId); | |||||
Integer batchSize = syncMhUserProperties.getBatchSize(); | Integer batchSize = syncMhUserProperties.getBatchSize(); | ||||
List<List<MhUserDTO>> mhUserParts = ListUtil.partition(mhUsers, batchSize); | List<List<MhUserDTO>> mhUserParts = ListUtil.partition(mhUsers, batchSize); | ||||
for (List<MhUserDTO> part : mhUserParts) { | for (List<MhUserDTO> part : mhUserParts) { | ||||
@@ -80,10 +83,9 @@ public class SyncMhUserOrgManage { | |||||
} | } | ||||
UserInfo userInfo = new UserInfo(); | UserInfo userInfo = new UserInfo(); | ||||
userInfo.setMhUserId(mhUser.getUserId()); | 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()); | UserAvailableEnum userStatus = getUserAvailable(mhUser.getStatus()); | ||||
userInfo.setAvailable(userStatus.name()); | userInfo.setAvailable(userStatus.name()); | ||||
@@ -91,6 +93,13 @@ public class SyncMhUserOrgManage { | |||||
userInfo.setUsername(mhUser.getAccount()); | userInfo.setUsername(mhUser.getAccount()); | ||||
userInfo.setId(userIdMap.get(mhUser.getUserId())); | userInfo.setId(userIdMap.get(mhUser.getUserId())); | ||||
userInfo.setRegionCode("330100"); | 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()); | userInfo.setMhUnitId(mhUser.getMhUnitId()); | ||||
savedList.add(userInfo); | savedList.add(userInfo); | ||||
} | } | ||||
@@ -34,6 +34,7 @@ import com.hz.pm.api.user.util.LoginUserUtil; | |||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.ningdatech.basic.model.GenericResult; | import com.ningdatech.basic.model.GenericResult; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | |||||
import com.ningdatech.zwdd.ZwddIntegrationProperties; | import com.ningdatech.zwdd.ZwddIntegrationProperties; | ||||
import com.ningdatech.zwdd.client.ZwddClient; | import com.ningdatech.zwdd.client.ZwddClient; | ||||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | ||||
@@ -68,8 +69,6 @@ public class UserInfoManage { | |||||
private final ZwddClient zwddClient; | private final ZwddClient zwddClient; | ||||
public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO req) { | public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO req) { | ||||
PageVo<ResUserInfoListVO> pageVo = new PageVo<>(); | |||||
String phoneNo = req.getPhoneNo(); | String phoneNo = req.getPhoneNo(); | ||||
String orgCode = req.getOrgCode(); | String orgCode = req.getOrgCode(); | ||||
String name = req.getName(); | String name = req.getName(); | ||||
@@ -77,10 +76,8 @@ public class UserInfoManage { | |||||
Long regionId = req.getRegionId(); | Long regionId = req.getRegionId(); | ||||
List<Long> userIdList = getRoleCompliantUserIdList(req.getUserRoleList()); | 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) | LambdaQueryWrapper<UserInfo> wrapper = Wrappers.lambdaQuery(UserInfo.class) | ||||
@@ -92,7 +89,7 @@ public class UserInfoManage { | |||||
.eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode) | .eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode) | ||||
.orderByDesc(UserInfo::getUpdateOn); | .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(); | List<UserInfo> records = page.getRecords(); | ||||
long total = page.getTotal(); | long total = page.getTotal(); | ||||
List<ResUserInfoListVO> result = new ArrayList<>(); | List<ResUserInfoListVO> result = new ArrayList<>(); | ||||
@@ -127,9 +124,7 @@ public class UserInfoManage { | |||||
result.add(item); | result.add(item); | ||||
}); | }); | ||||
} | } | ||||
pageVo.setTotal(total); | |||||
pageVo.setRecords(result); | |||||
return pageVo; | |||||
return PageVo.of(result, total); | |||||
} | } | ||||
private List<String> getCompliantOrgEmpCodeList(String orgName, String orgCode) { | private List<String> getCompliantOrgEmpCodeList(String orgName, String orgCode) { | ||||
@@ -187,15 +182,13 @@ public class UserInfoManage { | |||||
*/ | */ | ||||
private List<Long> getRoleCompliantUserIdList(List<UserRoleVO> userRoleList) { | private List<Long> getRoleCompliantUserIdList(List<UserRoleVO> userRoleList) { | ||||
if (CollUtil.isNotEmpty(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)) { | 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)) { | if (CollUtil.isEmpty(compliantUserIdList)) { | ||||
return new ArrayList<>(); | return new ArrayList<>(); | ||||
} | } | ||||
@@ -8,8 +8,12 @@ import java.time.LocalDateTime; | |||||
import java.util.List; | import java.util.List; | ||||
/** | /** | ||||
* @author liuxinxin | |||||
* @date 2023/2/13 上午9:10 | |||||
* <p> | |||||
* ResUserInfoListVO | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 15:24 2024/1/10 | |||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel("用户管理查询 请求response") | @ApiModel("用户管理查询 请求response") | ||||
@@ -23,6 +23,6 @@ public class SyncMhUnitProperties { | |||||
private Boolean open = true; | private Boolean open = true; | ||||
private Integer batchSize = 2000; | |||||
private Integer batchSize = 5000; | |||||
} | } |
@@ -76,8 +76,8 @@ mybatis-plus: | |||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | ||||
global-config: | global-config: | ||||
db-config: | db-config: | ||||
logic-delete-value: true | |||||
logic-not-delete-value: false | |||||
logic-delete-value: 1 | |||||
logic-not-delete-value: 0 | |||||
logging: | logging: | ||||
config: classpath:logback-spring.xml | config: classpath:logback-spring.xml | ||||
#日志配置 | #日志配置 | ||||
@@ -76,8 +76,8 @@ mybatis-plus: | |||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | ||||
global-config: | global-config: | ||||
db-config: | db-config: | ||||
logic-delete-value: true | |||||
logic-not-delete-value: false | |||||
logic-delete-value: 1 | |||||
logic-not-delete-value: 0 | |||||
logging: | logging: | ||||
config: classpath:logback-spring.xml | 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 | delete-all-url: http://10.53.168.41:38088/open/api/v1/project-receive/delete-all | ||||
login: | login: | ||||
phone-verify-code: | phone-verify-code: | ||||
skip: false | |||||
skip: true | |||||
url: http://60.188.225.145/login | url: http://60.188.225.145/login | ||||
web: | web: | ||||
url: http://60.188.225.145 | url: http://60.188.225.145 | ||||
@@ -1,12 +1,12 @@ | |||||
#浙政钉 | |||||
#专有钉钉 | |||||
integration: | integration: | ||||
zwdd: | 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 | #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 | ||||
tenantId: 196729 | |||||
domain: openplatform-pro.ding.zj.gov.cn | |||||
tenantId: 31141 | |||||
domain: openplatform.dg-work.cn |