Browse Source

单位名修改

tags/24082201
WendyYang 1 year ago
parent
commit
a01303e63d
8 changed files with 32 additions and 31 deletions
  1. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java
  2. +5
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java
  3. +14
    -15
      hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java
  4. +6
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java
  5. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java
  6. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java
  7. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java
  8. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserInfoListReq.java

+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java View File

@@ -52,7 +52,7 @@ import com.hz.pm.api.staging.enums.MsgTypeEnum;
import com.hz.pm.api.sys.manage.NoticeManage; import com.hz.pm.api.sys.manage.NoticeManage;
import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; import com.hz.pm.api.todocenter.constant.WorkNoticeConstant;
import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.model.dto.MhUnitDTO;
import com.hz.pm.api.user.model.dto.UnitDTO;
import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil; import com.hz.pm.api.user.util.LoginUserUtil;
@@ -539,7 +539,7 @@ public class ProjectFileManage {
} }
} }
if (StrUtils.isNotBlank(vo.getApplyBorrowOrgCode())) { if (StrUtils.isNotBlank(vo.getApplyBorrowOrgCode())) {
MhUnitDTO mhUnit = mhUnitCache.getById(Long.parseLong(vo.getApplyBorrowOrgCode()));
UnitDTO mhUnit = mhUnitCache.getById(Long.parseLong(vo.getApplyBorrowOrgCode()));
vo.setApplyBorrowOrgName(mhUnit.getName()); vo.setApplyBorrowOrgName(mhUnit.getName());
} }
if (Objects.nonNull(vo.getProjectId())) { if (Objects.nonNull(vo.getProjectId())) {


+ 5
- 5
hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java View File

@@ -1,6 +1,6 @@
package com.hz.pm.api.user.helper; package com.hz.pm.api.user.helper;


import com.hz.pm.api.user.model.dto.MhUnitDTO;
import com.hz.pm.api.user.model.dto.UnitDTO;


import java.util.List; import java.util.List;


@@ -14,15 +14,15 @@ import java.util.List;
*/ */
public interface MhUnitCache { public interface MhUnitCache {


List<MhUnitDTO> all();
List<UnitDTO> all();


MhUnitDTO getById(Long id);
UnitDTO getById(Long id);


List<MhUnitDTO> getChildren(Long id);
List<UnitDTO> getChildren(Long id);


List<Long> getChildrenIds(Long id); List<Long> getChildrenIds(Long id);


List<MhUnitDTO> getChildrenRecursion(Long id);
List<UnitDTO> getChildrenRecursion(Long id);


List<Long> getChildrenIdsRecursion(Long id); List<Long> getChildrenIdsRecursion(Long id);




+ 14
- 15
hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java View File

@@ -7,11 +7,8 @@ import com.github.benmanes.caffeine.cache.CacheLoader;
import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache; import com.github.benmanes.caffeine.cache.LoadingCache;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hz.pm.api.meta.assembler.MetaTagAssembler;
import com.hz.pm.api.meta.model.dto.TagDTO;
import com.hz.pm.api.meta.model.dto.TagTreeDTO;
import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.model.dto.MhUnitDTO;
import com.hz.pm.api.user.model.dto.UnitDTO;
import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.model.entity.MhUnit;
import com.hz.pm.api.user.service.IMhUnitService; import com.hz.pm.api.user.service.IMhUnitService;
import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.CollUtils;
@@ -24,7 +21,6 @@ import org.springframework.stereotype.Component;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;


/** /**
* <p> * <p>
@@ -42,7 +38,7 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean {
private static final Long ALL = -1L; private static final Long ALL = -1L;


private final IMhUnitService mhUnitService; private final IMhUnitService mhUnitService;
private LoadingCache<Long, MhUnitDTO> cache;
private LoadingCache<Long, UnitDTO> cache;


private final Map<Long, List<Long>> childIdMap = new ConcurrentHashMap<>(); private final Map<Long, List<Long>> childIdMap = new ConcurrentHashMap<>();


@@ -58,19 +54,22 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean {
public void afterPropertiesSet() { public void afterPropertiesSet() {
cache = Caffeine.newBuilder() cache = Caffeine.newBuilder()
.refreshAfterWrite(7, TimeUnit.DAYS) .refreshAfterWrite(7, TimeUnit.DAYS)
.build(new CacheLoader<Long, MhUnitDTO>() {
.build(new CacheLoader<Long, UnitDTO>() {


@Override @Override
public MhUnitDTO load(@NonNull Long key) {
public UnitDTO load(@NonNull Long key) {
log.info("刷新当前标签树:{}", key); log.info("刷新当前标签树:{}", key);
// 查询全部 // 查询全部
MhUnit unit = mhUnitService.getById(key); MhUnit unit = mhUnitService.getById(key);
if (unit == null) {
return null;
}
putToChildIdMap(unit.getId(), unit.getParentId()); putToChildIdMap(unit.getId(), unit.getParentId());
return BeanUtil.copyProperties(unit, MhUnitDTO.class);
return BeanUtil.copyProperties(unit, UnitDTO.class);
} }


@Override @Override
public @NonNull Map<Long, MhUnitDTO> loadAll(@NonNull Iterable<? extends @NonNull Long> keys) {
public @NonNull Map<Long, UnitDTO> loadAll(@NonNull Iterable<? extends @NonNull Long> keys) {
List<MhUnit> allUnits; List<MhUnit> allUnits;
if (CollUtil.isEmpty(keys)) { if (CollUtil.isEmpty(keys)) {
allUnits = mhUnitService.list(); allUnits = mhUnitService.list();
@@ -84,7 +83,7 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean {
} }
return CollUtils.listToMap(allUnits, MhUnit::getId, w -> { return CollUtils.listToMap(allUnits, MhUnit::getId, w -> {
putToChildIdMap(w.getId(), w.getParentId()); putToChildIdMap(w.getId(), w.getParentId());
return BeanUtil.copyProperties(w, MhUnitDTO.class);
return BeanUtil.copyProperties(w, UnitDTO.class);
}); });
} }
}); });
@@ -93,17 +92,17 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean {
} }


@Override @Override
public List<MhUnitDTO> all() {
public List<UnitDTO> all() {
return new ArrayList<>(cache.asMap().values()); return new ArrayList<>(cache.asMap().values());
} }


@Override @Override
public MhUnitDTO getById(Long id) {
public UnitDTO getById(Long id) {
return cache.get(id); return cache.get(id);
} }


@Override @Override
public List<MhUnitDTO> getChildren(Long id) {
public List<UnitDTO> getChildren(Long id) {
return CollUtils.convert(childIdMap.get(id), cache::get); return CollUtils.convert(childIdMap.get(id), cache::get);
} }


@@ -113,7 +112,7 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean {
} }


@Override @Override
public List<MhUnitDTO> getChildrenRecursion(Long id) {
public List<UnitDTO> getChildrenRecursion(Long id) {
return CollUtils.convert(getChildrenIdsRecursion(id), cache::get); return CollUtils.convert(getChildrenIdsRecursion(id), cache::get);
} }




+ 6
- 6
hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java View File

@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.model.dto.MhUnitDTO;
import com.hz.pm.api.user.model.dto.UnitDTO;
import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; import com.hz.pm.api.user.model.dto.MhUnitTreeDTO;
import com.hz.pm.api.user.model.dto.MhUnitUserTreeDTO; import com.hz.pm.api.user.model.dto.MhUnitUserTreeDTO;
import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.model.entity.MhUnit;
@@ -44,7 +44,7 @@ public class MhUnitManage {
private final IUserInfoService userInfoService; private final IUserInfoService userInfoService;


public List<MhUnitTreeDTO> getMhUnitTree() { public List<MhUnitTreeDTO> getMhUnitTree() {
List<MhUnitDTO> allUnits = mhUnitCache.all();
List<UnitDTO> allUnits = mhUnitCache.all();
List<MhUnitTreeDTO> nodes = BeanUtil.copyToList(allUnits, MhUnitTreeDTO.class); List<MhUnitTreeDTO> nodes = BeanUtil.copyToList(allUnits, MhUnitTreeDTO.class);
return TreeUtil.convertToTree(nodes, 0L); return TreeUtil.convertToTree(nodes, 0L);
} }
@@ -86,7 +86,7 @@ public class MhUnitManage {
} }
String rootId = UnitUserNodeType.UNIT + "#" + req.getId(); String rootId = UnitUserNodeType.UNIT + "#" + req.getId();
selectedUnitIds.forEach(w -> { selectedUnitIds.forEach(w -> {
MhUnitDTO unit = mhUnitCache.getById(w);
UnitDTO unit = mhUnitCache.getById(w);
if (unit != null) { if (unit != null) {
selectedUnits.add(getMhUnitUserTree(unit)); selectedUnits.add(getMhUnitUserTree(unit));
} }
@@ -95,11 +95,11 @@ public class MhUnitManage {
return TreeUtil.convertToTree(selectedUnits, rootId); return TreeUtil.convertToTree(selectedUnits, rootId);
} else { } else {
// 如果没有查询指定组织,那么直接查询第一级组织 // 如果没有查询指定组织,那么直接查询第一级组织
List<MhUnitDTO> childrenUnits = mhUnitCache.getChildren(0L);
List<UnitDTO> childrenUnits = mhUnitCache.getChildren(0L);
if (childrenUnits.isEmpty()) { if (childrenUnits.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }
for (MhUnitDTO unit : childrenUnits) {
for (UnitDTO unit : childrenUnits) {
selectedUnits.add(getMhUnitUserTree(unit)); selectedUnits.add(getMhUnitUserTree(unit));
} }
selectedUnits.sort(selectedUnits.get(0).comparator()); selectedUnits.sort(selectedUnits.get(0).comparator());
@@ -107,7 +107,7 @@ public class MhUnitManage {
} }
} }


private MhUnitUserTreeDTO getMhUnitUserTree(MhUnitDTO unit) {
private MhUnitUserTreeDTO getMhUnitUserTree(UnitDTO unit) {
MhUnitUserTreeDTO node = new MhUnitUserTreeDTO(); MhUnitUserTreeDTO node = new MhUnitUserTreeDTO();
node.setSort(unit.getSort()); node.setSort(unit.getSort());
node.setName(unit.getName()); node.setName(unit.getName());


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

@@ -19,6 +19,7 @@ import com.hz.pm.api.meta.helper.DictionaryCache;
import com.hz.pm.api.meta.model.dto.DictionaryDTO; import com.hz.pm.api.meta.model.dto.DictionaryDTO;
import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.model.entity.ExpertDictionary;
import com.hz.pm.api.meta.service.IExpertDictionaryService; import com.hz.pm.api.meta.service.IExpertDictionaryService;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.model.entity.MhCompany; import com.hz.pm.api.user.model.entity.MhCompany;
import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.model.entity.MhUnit;
import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.entity.UserInfo;
@@ -61,6 +62,7 @@ public class SyncMhUserOrgManage {
private final IMhCompanyService mhCompanyService; private final IMhCompanyService mhCompanyService;
private final DictionaryCache dictionaryCache; private final DictionaryCache dictionaryCache;
private final IExpertDictionaryService expertDictionaryService; private final IExpertDictionaryService expertDictionaryService;
private final MhUnitCache mhUnitCache;


public void syncUsers(LocalDateTime syncDateTime) { public void syncUsers(LocalDateTime syncDateTime) {
MhRetDTO<List<MhUserDTO>> mhRet = mhApiClient.queryUsers(syncDateTime); MhRetDTO<List<MhUserDTO>> mhRet = mhApiClient.queryUsers(syncDateTime);


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

@@ -63,7 +63,7 @@ public class UserInfoManage {
.eq(StrUtils.isNotBlank(req.getPhoneNo()), UserInfo::getMobile, req.getPhoneNo()) .eq(StrUtils.isNotBlank(req.getPhoneNo()), UserInfo::getMobile, req.getPhoneNo())
.like(StrUtils.isNotBlank(req.getName()), UserInfo::getRealName, req.getName()) .like(StrUtils.isNotBlank(req.getName()), UserInfo::getRealName, req.getName())
.in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) .in(Objects.nonNull(userIdList), UserInfo::getId, userIdList)
.like(StrUtils.isNotBlank(req.getMhUnitName()), UserInfo::getMhUnitName, req.getMhUnitName())
.like(StrUtils.isNotBlank(req.getOrgName()), UserInfo::getMhUnitName, req.getOrgName())
.eq(Objects.nonNull(req.getMhUnitId()), UserInfo::getMhUnitId, req.getMhUnitId()) .eq(Objects.nonNull(req.getMhUnitId()), UserInfo::getMhUnitId, req.getMhUnitId())
.orderByDesc(UserInfo::getUpdateOn); .orderByDesc(UserInfo::getUpdateOn);




hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitDTO.java → hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java View File

@@ -11,7 +11,7 @@ import lombok.Data;
* @since 15:29 2024/1/10 * @since 15:29 2024/1/10
*/ */
@Data @Data
public class MhUnitDTO {
public class UnitDTO {


private Long id; private Long id;



+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserInfoListReq.java View File

@@ -25,7 +25,7 @@ public class UserInfoListReq extends PagePo {
private String phoneNo; private String phoneNo;


@ApiModelProperty("所在单位") @ApiModelProperty("所在单位")
private String mhUnitName;
private String orgName;


@ApiModelProperty("所在单位Code") @ApiModelProperty("所在单位Code")
private Long mhUnitId; private Long mhUnitId;


Loading…
Cancel
Save