Browse Source

单位名修改

tags/24080901
WendyYang 9 months 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.todocenter.constant.WorkNoticeConstant;
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.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
@@ -539,7 +539,7 @@ public class ProjectFileManage {
}
}
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());
}
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;

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

import java.util.List;

@@ -14,15 +14,15 @@ import java.util.List;
*/
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<MhUnitDTO> getChildrenRecursion(Long id);
List<UnitDTO> getChildrenRecursion(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.LoadingCache;
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.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.service.IMhUnitService;
import com.ningdatech.basic.util.CollUtils;
@@ -24,7 +21,6 @@ import org.springframework.stereotype.Component;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

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

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

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

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

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

@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;
if (CollUtil.isEmpty(keys)) {
allUnits = mhUnitService.list();
@@ -84,7 +83,7 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean {
}
return CollUtils.listToMap(allUnits, MhUnit::getId, w -> {
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
public List<MhUnitDTO> all() {
public List<UnitDTO> all() {
return new ArrayList<>(cache.asMap().values());
}

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

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

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

@Override
public List<MhUnitDTO> getChildrenRecursion(Long id) {
public List<UnitDTO> getChildrenRecursion(Long id) {
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.hz.pm.api.common.util.StrUtils;
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.MhUnitUserTreeDTO;
import com.hz.pm.api.user.model.entity.MhUnit;
@@ -44,7 +44,7 @@ public class MhUnitManage {
private final IUserInfoService userInfoService;

public List<MhUnitTreeDTO> getMhUnitTree() {
List<MhUnitDTO> allUnits = mhUnitCache.all();
List<UnitDTO> allUnits = mhUnitCache.all();
List<MhUnitTreeDTO> nodes = BeanUtil.copyToList(allUnits, MhUnitTreeDTO.class);
return TreeUtil.convertToTree(nodes, 0L);
}
@@ -86,7 +86,7 @@ public class MhUnitManage {
}
String rootId = UnitUserNodeType.UNIT + "#" + req.getId();
selectedUnitIds.forEach(w -> {
MhUnitDTO unit = mhUnitCache.getById(w);
UnitDTO unit = mhUnitCache.getById(w);
if (unit != null) {
selectedUnits.add(getMhUnitUserTree(unit));
}
@@ -95,11 +95,11 @@ public class MhUnitManage {
return TreeUtil.convertToTree(selectedUnits, rootId);
} else {
// 如果没有查询指定组织,那么直接查询第一级组织
List<MhUnitDTO> childrenUnits = mhUnitCache.getChildren(0L);
List<UnitDTO> childrenUnits = mhUnitCache.getChildren(0L);
if (childrenUnits.isEmpty()) {
return Collections.emptyList();
}
for (MhUnitDTO unit : childrenUnits) {
for (UnitDTO unit : childrenUnits) {
selectedUnits.add(getMhUnitUserTree(unit));
}
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();
node.setSort(unit.getSort());
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.entity.ExpertDictionary;
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.MhUnit;
import com.hz.pm.api.user.model.entity.UserInfo;
@@ -61,6 +62,7 @@ public class SyncMhUserOrgManage {
private final IMhCompanyService mhCompanyService;
private final DictionaryCache dictionaryCache;
private final IExpertDictionaryService expertDictionaryService;
private final MhUnitCache mhUnitCache;

public void syncUsers(LocalDateTime 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())
.like(StrUtils.isNotBlank(req.getName()), UserInfo::getRealName, req.getName())
.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())
.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
*/
@Data
public class MhUnitDTO {
public class UnitDTO {

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;

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

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


Loading…
Cancel
Save