人员查询

This commit is contained in:
YY
2025-08-11 10:31:26 +08:00
parent 1f5fd22a5a
commit 918a214a9d
7 changed files with 148 additions and 11 deletions

View File

@ -0,0 +1,14 @@
package com.chinaunicom.zyhy.ebtp.supplier.base.service;
import com.chinaunicom.mall.ebtp.common.base.entity.SysUser;
import java.util.List;
import java.util.Map;
public interface UserService {
Map<String, SysUser> getMapUserByIds(List<String> userIds);
List<SysUser> getUserListByUserIds(List<String> userIds);
}

View File

@ -0,0 +1,39 @@
package com.chinaunicom.zyhy.ebtp.supplier.base.service.impl;
import com.chinaunicom.mall.ebtp.common.base.client.SystemClient;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
import com.chinaunicom.mall.ebtp.common.base.entity.SysUser;
import com.chinaunicom.zyhy.ebtp.supplier.base.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private SystemClient systemClient;
public Map<String, SysUser> getMapUserByIds(List<String> userIds){
List<SysUser> userListByUserIds = getUserListByUserIds(userIds);
if(userListByUserIds.isEmpty()){
return new HashMap<>();
}
// 使用Stream API将列表转换为Map
return userListByUserIds.stream()
.filter(user -> user != null && user.getUserId() != null)
.collect(Collectors.toMap(SysUser::getUserId, user -> user));
}
public List<SysUser> getUserListByUserIds(List<String> userIds){
BaseResponse<List<SysUser>> usersByIds = systemClient.getUsersByIds(userIds);
return usersByIds.getData();
}
}

View File

@ -73,6 +73,8 @@ public class CoscoPortalsCustomerQanda extends BaseEntity {
private Long status;
private Long isPublished;
private Long isTop;
@ApiModelProperty(value = "分页对象信息")

View File

@ -3,11 +3,13 @@ package com.chinaunicom.zyhy.ebtp.supplier.portals.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
import com.chinaunicom.mall.ebtp.common.base.entity.SysUser;
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
import com.chinaunicom.mall.ebtp.common.base.util.TokenUtil;
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.CustomerQandaConstant;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.UpConstant;
import com.chinaunicom.zyhy.ebtp.supplier.base.service.UserService;
import com.chinaunicom.zyhy.ebtp.supplier.portals.dao.CoscoPortalsCustomerQandaMapper;
import com.chinaunicom.zyhy.ebtp.supplier.portals.entity.CoscoPortalsCustomerQanda;
import com.chinaunicom.zyhy.ebtp.supplier.portals.service.ICoscoPortalsCustomerQandaService;
@ -18,6 +20,8 @@ import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 中远门户_用户提问_问答Service业务层处理
@ -31,6 +35,9 @@ public class CoscoPortalsCustomerQandaServiceImpl extends BaseServiceImpl<CoscoP
private CoscoPortalsCustomerQandaMapper coscoPortalsCustomerQandaMapper;
@Autowired
private ICoscoPortalsHelpcenterQandaService coscoPortalsHelpcenterQandaService;
@Autowired
private UserService userService;
/**
* 查询中远门户_用户提问_问答
@ -70,7 +77,7 @@ public class CoscoPortalsCustomerQandaServiceImpl extends BaseServiceImpl<CoscoP
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
coscoPortalsCustomerQanda.setCreateBy(currentUser.getUserId());
coscoPortalsCustomerQandaMapper.insertCoscoPortalsCustomerQanda(coscoPortalsCustomerQanda);
if(UpConstant.RELEASE.equals(coscoPortalsCustomerQanda.getStatus())){
if (UpConstant.RELEASE.equals(coscoPortalsCustomerQanda.getStatus())) {
coscoPortalsHelpcenterQandaService.addHelpcenterQanda(coscoPortalsCustomerQanda);
}
return 1;
@ -88,14 +95,16 @@ public class CoscoPortalsCustomerQandaServiceImpl extends BaseServiceImpl<CoscoP
coscoPortalsCustomerQanda.setUpdateTime(date);
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
coscoPortalsCustomerQanda.setUpdateBy(currentUser.getUserId());
if(coscoPortalsCustomerQanda.getAnswerContent()!=null && coscoPortalsCustomerQanda.getAnswerContent().length()>0){
coscoPortalsCustomerQanda.setStatus(coscoPortalsCustomerQanda.getIsPublished());
if (coscoPortalsCustomerQanda.getAnswerContent() != null && coscoPortalsCustomerQanda.getAnswerContent().length() > 0) {
coscoPortalsCustomerQanda.setIsAnswer(CustomerQandaConstant.REPLY.getStatus());
coscoPortalsCustomerQanda.setAnswerBy(currentUser.getUserId());
coscoPortalsCustomerQanda.setAnswerTime(date);
}
coscoPortalsCustomerQandaMapper.updateCoscoPortalsCustomerQanda(coscoPortalsCustomerQanda);
if(UpConstant.RELEASE.equals(coscoPortalsCustomerQanda.getStatus())){
coscoPortalsHelpcenterQandaService.addHelpcenterQanda(coscoPortalsCustomerQanda);
if (UpConstant.RELEASE.equals(coscoPortalsCustomerQanda.getStatus())) {
CoscoPortalsCustomerQanda show = coscoPortalsCustomerQandaMapper.selectCoscoPortalsCustomerQandaById(coscoPortalsCustomerQanda.getId());
coscoPortalsHelpcenterQandaService.addHelpcenterQanda(show);
}
return 1;
}
@ -147,7 +156,20 @@ public class CoscoPortalsCustomerQandaServiceImpl extends BaseServiceImpl<CoscoP
public IPage<CoscoPortalsCustomerQanda> getPage(CoscoPortalsCustomerQanda coscoPortalsCustomerQanda) {
IPage<CoscoPortalsCustomerQanda> p = new Page<>(coscoPortalsCustomerQanda.getBasePageRequest().getPageNo(),
coscoPortalsCustomerQanda.getBasePageRequest().getPageSize());
return coscoPortalsCustomerQandaMapper.getPageList(p,coscoPortalsCustomerQanda);
IPage<CoscoPortalsCustomerQanda> pageList = coscoPortalsCustomerQandaMapper.getPageList(p, coscoPortalsCustomerQanda);
List<String> createByList = pageList.getRecords().stream()
.map(CoscoPortalsCustomerQanda::getAnswerBy)
.collect(Collectors.toList());
if (!createByList.isEmpty()) {
Map<String, SysUser> mapUserByIds = userService.getMapUserByIds(createByList);
pageList.getRecords().forEach(coscoPortalsDownloads -> {
SysUser sysUser = mapUserByIds.get(coscoPortalsDownloads.getAnswerBy());
if (sysUser != null) {
coscoPortalsDownloads.setAnswerBy(sysUser.getName());
}
});
}
return pageList;
}
/**

View File

@ -3,14 +3,19 @@ package com.chinaunicom.zyhy.ebtp.supplier.portals.service.impl;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaunicom.mall.ebtp.common.base.client.SystemClient;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
import com.chinaunicom.mall.ebtp.common.base.entity.SysUser;
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
import com.chinaunicom.mall.ebtp.common.base.util.TokenUtil;
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.UserConstant;
import com.chinaunicom.zyhy.ebtp.supplier.base.service.UserService;
import com.chinaunicom.zyhy.ebtp.supplier.common.CoscoDateUtils;
import com.chinaunicom.zyhy.ebtp.supplier.common.PublicStatus;
import com.chinaunicom.zyhy.ebtp.supplier.portals.dao.CoscoPortalsCustomerQandaMapper;
@ -30,16 +35,32 @@ import org.springframework.stereotype.Service;
* @date 2025-06-16
*/
@Service
public class CoscoPortalsDownloadsServiceImpl extends BaseServiceImpl<CoscoPortalsDownloadsMapper, CoscoPortalsDownloads> implements ICoscoPortalsDownloadsService {
public class CoscoPortalsDownloadsServiceImpl extends BaseServiceImpl<CoscoPortalsDownloadsMapper, CoscoPortalsDownloads> implements ICoscoPortalsDownloadsService {
@Autowired
private CoscoPortalsDownloadsMapper coscoPortalsDownloadsMapper;
@Autowired
private UserService userService;
@Override
public IPage<CoscoPortalsDownloads> getPage(CoscoPortalsDownloads vo) {
IPage<CoscoPortalsDownloads> p = new Page<>(vo.getPageNo(),
vo.getPageSize());
return coscoPortalsDownloadsMapper.selectPageList(p,vo);
IPage<CoscoPortalsDownloads> coscoPortalsDownloadsIPage = coscoPortalsDownloadsMapper.selectPageList(p, vo);
List<CoscoPortalsDownloads> records = coscoPortalsDownloadsIPage.getRecords();
List<String> createByList = records.stream()
.map(CoscoPortalsDownloads::getCreateBy)
.collect(Collectors.toList());
if (!createByList.isEmpty()) {
Map<String, SysUser> mapUserByIds = userService.getMapUserByIds(createByList);
records.forEach(coscoPortalsDownloads -> {
SysUser sysUser = mapUserByIds.get(coscoPortalsDownloads.getCreateBy());
if (sysUser != null) {
coscoPortalsDownloads.setCreateBy(sysUser.getName());
}
});
}
return coscoPortalsDownloadsIPage;
}
/**
@ -93,8 +114,8 @@ public class CoscoPortalsDownloadsServiceImpl extends BaseServiceImpl<CoscoPort
public int updateCoscoPortalsDownloads(CoscoPortalsDownloads coscoPortalsDownloads) {
Date date = new Date();
BaseCacheUser currentUser = TokenUtil.getCurrentUser();
if(coscoPortalsDownloads.getStatus() != null){
if(PublicStatus.STATUS_SJ.equals(coscoPortalsDownloads.getStatus())){//上架
if (coscoPortalsDownloads.getStatus() != null) {
if (PublicStatus.STATUS_SJ.equals(coscoPortalsDownloads.getStatus())) {//上架
coscoPortalsDownloads.setPublishBy(currentUser.getUserId());
coscoPortalsDownloads.setPublishTime(date);
}

View File

@ -2,14 +2,18 @@ package com.chinaunicom.zyhy.ebtp.supplier.portals.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
import com.chinaunicom.mall.ebtp.common.base.entity.SysUser;
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
import com.chinaunicom.mall.ebtp.common.base.util.TokenUtil;
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.UserConstant;
import com.chinaunicom.zyhy.ebtp.supplier.base.service.UserService;
import com.chinaunicom.zyhy.ebtp.supplier.common.CoscoDateUtils;
import com.chinaunicom.zyhy.ebtp.supplier.common.PublicStatus;
import com.chinaunicom.zyhy.ebtp.supplier.portals.dao.CoscoPortalsLinksMapper;
@ -33,12 +37,27 @@ import org.springframework.stereotype.Service;
public class CoscoPortalsNoticeServiceImpl extends BaseServiceImpl<CoscoPortalsNoticeMapper, CoscoPortalsNotice> implements ICoscoPortalsNoticeService {
@Autowired
private CoscoPortalsNoticeMapper coscoPortalsNoticeMapper;
@Autowired
private UserService userService;
@Override
public IPage<CoscoPortalsNotice> getPage(CoscoPortalsNotice vo) {
IPage<CoscoPortalsNotice> p = new Page<>(vo.getPageNo(),
vo.getPageSize());
return coscoPortalsNoticeMapper.selectPageList(p,vo);
IPage<CoscoPortalsNotice> coscoPortalsNoticeIPage = coscoPortalsNoticeMapper.selectPageList(p, vo);
List<String> createByList = coscoPortalsNoticeIPage.getRecords().stream()
.map(CoscoPortalsNotice::getCreateBy)
.collect(Collectors.toList());
if (!createByList.isEmpty()) {
Map<String, SysUser> mapUserByIds = userService.getMapUserByIds(createByList);
coscoPortalsNoticeIPage.getRecords().forEach(coscoPortalsDownloads -> {
SysUser sysUser = mapUserByIds.get(coscoPortalsDownloads.getCreateBy());
if (sysUser != null) {
coscoPortalsDownloads.setCreateBy(sysUser.getName());
}
});
}
return coscoPortalsNoticeIPage;
}

View File

@ -3,12 +3,15 @@ package com.chinaunicom.zyhy.ebtp.supplier.portals.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
import com.chinaunicom.mall.ebtp.common.base.entity.SysUser;
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
import com.chinaunicom.mall.ebtp.common.base.util.TokenUtil;
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.UpConstant;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.UserConstant;
import com.chinaunicom.zyhy.ebtp.supplier.base.service.UserService;
import com.chinaunicom.zyhy.ebtp.supplier.portals.dao.CoscoPortalsRegulationsMapper;
import com.chinaunicom.zyhy.ebtp.supplier.portals.entity.CoscoPortalsNotice;
import com.chinaunicom.zyhy.ebtp.supplier.portals.entity.CoscoPortalsRegulations;
import com.chinaunicom.zyhy.ebtp.supplier.portals.service.ICoscoPortalsRegulationsService;
import com.chinaunicom.zyhy.ebtp.supplier.portals.vo.RegulationsCountVo;
@ -17,6 +20,8 @@ import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 中远门户_政策法规Service业务层处理
@ -28,6 +33,8 @@ import java.util.List;
public class CoscoPortalsRegulationsServiceImpl extends BaseServiceImpl<CoscoPortalsRegulationsMapper, CoscoPortalsRegulations> implements ICoscoPortalsRegulationsService {
@Autowired
private CoscoPortalsRegulationsMapper coscoPortalsRegulationsMapper;
@Autowired
private UserService userService;
/**
* 查询中远门户_政策法规
@ -113,7 +120,20 @@ public class CoscoPortalsRegulationsServiceImpl extends BaseServiceImpl<CoscoPor
public IPage<CoscoPortalsRegulations> getPage(CoscoPortalsRegulations coscoPortalsRegulations) {
IPage<CoscoPortalsRegulations> p = new Page<>(coscoPortalsRegulations.getBasePageRequest().getPageNo(),
coscoPortalsRegulations.getBasePageRequest().getPageSize());
return coscoPortalsRegulationsMapper.getPageList(p,coscoPortalsRegulations);
IPage<CoscoPortalsRegulations> pageList = coscoPortalsRegulationsMapper.getPageList(p, coscoPortalsRegulations);
List<String> createByList = pageList.getRecords().stream()
.map(CoscoPortalsRegulations::getCreateBy)
.collect(Collectors.toList());
if (!createByList.isEmpty()) {
Map<String, SysUser> mapUserByIds = userService.getMapUserByIds(createByList);
pageList.getRecords().forEach(coscoPortalsDownloads -> {
SysUser sysUser = mapUserByIds.get(coscoPortalsDownloads.getCreateBy());
if (sysUser != null) {
coscoPortalsDownloads.setCreateBy(sysUser.getName());
}
});
}
return pageList;
}
/**