添加用户名查询用户信息功能
parent
c240208edf
commit
db11455f6c
|
|
@ -1,15 +1,21 @@
|
|||
package com.zcloud.basic.info.facade;
|
||||
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.basic.info.api.ImgFilesServiceI;
|
||||
import com.zcloud.basic.info.command.convertor.ImgFilesCoConvertor;
|
||||
import com.zcloud.basic.info.domain.utils.Smb;
|
||||
import com.zcloud.basic.info.dto.ImgFilesQryCmd;
|
||||
import com.zcloud.basic.info.dto.clientobject.ImgFilesCO;
|
||||
import com.zcloud.gbscommon.utils.DateUtil;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.request.ZcloudImgFilesQryCmd;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.response.ZcloudImgFilesCO;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
|
@ -32,4 +38,18 @@ public class ZcloudImgFilesFacadeImpl implements ZcloudImgFilesFacade {
|
|||
List<ZcloudImgFilesCO> zcloudImgFilesCo = imgFilesCoConvertor.converCOsToDubboCOs(response.getData());
|
||||
return MultiResponse.of(zcloudImgFilesCo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveFile(MultipartFile multipartFile, String path) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
String filePath = ssoUser.getTenantId().toString() + "/" + DateUtil.getMonth() + "/" + path;
|
||||
// 文件上传并获取上传路径
|
||||
String resultFilePath = null;
|
||||
try {
|
||||
resultFilePath = Smb.saveFile(multipartFile, filePath);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return resultFilePath;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,11 @@ public class UserController {
|
|||
public SingleResponse<UserCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return userService.getInfoById(id);
|
||||
}
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/getInfoByUserName/{userName}")
|
||||
public SingleResponse<UserCO> getInfoByUserName(@PathVariable("userName") String userName) {
|
||||
return userService.getInfoByUserName(userName);
|
||||
}
|
||||
@ApiOperation("获取当前登录人信息")
|
||||
@GetMapping("/getInfo")
|
||||
public SingleResponse<UserCO> getInfo() {
|
||||
|
|
|
|||
|
|
@ -110,6 +110,25 @@ public class UserQueryExe {
|
|||
|
||||
return SingleResponse.of(userCO);
|
||||
}
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
public SingleResponse<UserCO> executeGetInfoByUserName(String userName) {
|
||||
UserDO userDO = userRepository.getInfoByUserName(userName);
|
||||
UserCO userCO = new UserCO();
|
||||
BeanUtils.copyProperties(userDO, userCO);
|
||||
if(AuthContext.getTenantId()==null){
|
||||
UserExpandInfoDO userExpandInfoDO = userExpandInfoRepository.getInfoByPhone(userDO.getPhone());
|
||||
if(userExpandInfoDO!=null){
|
||||
userCO.setFlowFlag(userExpandInfoDO.getFlowFlag());
|
||||
}
|
||||
}
|
||||
|
||||
return SingleResponse.of(userCO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -145,6 +145,10 @@ public class UserServiceImpl implements UserServiceI {
|
|||
public SingleResponse<UserCO> getInfoById(Long id) {
|
||||
return userQueryExe.executeGetInfo(id);
|
||||
}
|
||||
@Override
|
||||
public SingleResponse<UserCO> getInfoByUserName(String userName) {
|
||||
return userQueryExe.executeGetInfoByUserName(userName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response verifyUser(UserVerifyQryCmd userVerifyQryCmd) {
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ public interface UserServiceI {
|
|||
|
||||
|
||||
SingleResponse<UserCO> getInfoById(Long id);
|
||||
|
||||
SingleResponse<UserCO> getInfoByUserName(String userName);
|
||||
Response verifyUser(UserVerifyQryCmd userVerifyQryCmd);
|
||||
|
||||
SingleResponse<UserCO> getInfoBySession();
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public interface UserMapper extends BaseMapper<UserDO> {
|
|||
|
||||
UserDO getInfoById(@Param("id") Long id);
|
||||
|
||||
UserDO getInfoByUserName(@Param("params") Map<String, Object> params);
|
||||
|
||||
List<DepartmentLeaderStatictiscDO> getDepartmentLeaderByDepartmentId(List<Long> departmentIds);
|
||||
|
||||
Integer countUser(@Param("params") Map<String, Object> params);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ public interface UserRepository extends BaseRepository<UserDO> {
|
|||
Boolean checkUserDepartment(Long[] ids);
|
||||
|
||||
UserDO getInfoById(Long id);
|
||||
|
||||
UserDO getInfoByUserName(String userName);
|
||||
Response countUser(Map<String,Object> params);
|
||||
|
||||
List<UserDO> listByPostId(Long postId);
|
||||
|
|
|
|||
|
|
@ -223,6 +223,14 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
return userMapper.getInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDO getInfoByUserName(String username) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("username", username);
|
||||
return userMapper.getInfoByUserName(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response countUser(Map<String, Object> params) {
|
||||
if (!ObjectUtils.isEmpty(params.get("username"))) {
|
||||
|
|
|
|||
|
|
@ -297,17 +297,17 @@
|
|||
u.employment_flag,
|
||||
u.flow_flag,
|
||||
CASE
|
||||
WHEN LENGTH(FROM_BASE64(u.user_id_card)) > 0
|
||||
AND MOD(SUBSTRING(FROM_BASE64(u.user_id_card), 17, 1), 2) = 1 THEN
|
||||
'男'
|
||||
WHEN LENGTH(FROM_BASE64(u.user_id_card)) > 0
|
||||
AND MOD(SUBSTRING(FROM_BASE64(u.user_id_card), 17, 1), 2) = 0 THEN
|
||||
'女'
|
||||
WHEN LENGTH(FROM_BASE64(u.user_id_card)) > 0
|
||||
AND MOD(SUBSTRING(FROM_BASE64(u.user_id_card), 17, 1), 2) = 1 THEN
|
||||
'男'
|
||||
WHEN LENGTH(FROM_BASE64(u.user_id_card)) > 0
|
||||
AND MOD(SUBSTRING(FROM_BASE64(u.user_id_card), 17, 1), 2) = 0 THEN
|
||||
'女'
|
||||
END AS sex,
|
||||
|
||||
CASE
|
||||
WHEN LENGTH(FROM_BASE64(u.user_id_card)) > 0 THEN
|
||||
(YEAR(NOW()) - SUBSTRING(FROM_BASE64(u.user_id_card), 7, 4)) ELSE NULL
|
||||
(YEAR(NOW()) - SUBSTRING(FROM_BASE64(u.user_id_card), 7, 4)) ELSE NULL
|
||||
END AS age,
|
||||
|
||||
cast(substring(FROM_BASE64(u.user_id_card), 7, 8) AS DATE) AS birthday
|
||||
|
|
@ -319,6 +319,90 @@
|
|||
u.id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getInfoByUserName" resultType="com.zcloud.basic.info.persistence.dataobject.UserDO">
|
||||
select
|
||||
d.name as department_name,
|
||||
CASE
|
||||
WHEN c.type IN (3,4, 5) THEN u.post_name
|
||||
ELSE p.post_name
|
||||
END AS post_name,
|
||||
c.corp_name corpinfo_name,
|
||||
u.id,
|
||||
u.password,
|
||||
u.user_id,
|
||||
u.username,
|
||||
u.name,
|
||||
u.corpinfo_id,
|
||||
u.main_corp_flag,
|
||||
u.user_type,
|
||||
u.department_id,
|
||||
u.post_id,
|
||||
u.role_id,
|
||||
u.email,
|
||||
u.phone,
|
||||
u.personnel_type,
|
||||
u.personnel_type_name,
|
||||
u.nation,
|
||||
u.nation_name,
|
||||
u.user_id_card,
|
||||
u.user_avatar_url,
|
||||
u.current_address,
|
||||
u.location_address,
|
||||
u.rank_level,
|
||||
u.rank_level_name,
|
||||
u.sort,
|
||||
u.version,
|
||||
u.create_id,
|
||||
u.create_name,
|
||||
u.create_time,
|
||||
u.update_id,
|
||||
u.update_name,
|
||||
u.update_time,
|
||||
u.remarks,
|
||||
u.delete_enum,
|
||||
u.tenant_id,
|
||||
u.org_id,
|
||||
u.env,
|
||||
u.department_leader_flag,
|
||||
u.deputy_leader_flag,
|
||||
u.cultural_level,
|
||||
u.cultural_level_name,
|
||||
u.marital_status,
|
||||
u.marital_status_name,
|
||||
u.political_affiliation,
|
||||
u.political_affiliation_name,
|
||||
u.employment_flag,
|
||||
u.flow_flag,
|
||||
CASE
|
||||
WHEN LENGTH(FROM_BASE64(u.user_id_card)) > 0
|
||||
AND MOD(SUBSTRING(FROM_BASE64(u.user_id_card), 17, 1), 2) = 1 THEN
|
||||
'男'
|
||||
WHEN LENGTH(FROM_BASE64(u.user_id_card)) > 0
|
||||
AND MOD(SUBSTRING(FROM_BASE64(u.user_id_card), 17, 1), 2) = 0 THEN
|
||||
'女'
|
||||
END AS sex,
|
||||
|
||||
CASE
|
||||
WHEN LENGTH(FROM_BASE64(u.user_id_card)) > 0 THEN
|
||||
(YEAR(NOW()) - SUBSTRING(FROM_BASE64(u.user_id_card), 7, 4)) ELSE NULL
|
||||
END AS age,
|
||||
|
||||
cast(substring(FROM_BASE64(u.user_id_card), 7, 8) AS DATE) AS birthday
|
||||
from user u
|
||||
left join corp_info c on c.id = u.corpinfo_id
|
||||
left join department d on d.id = u.department_id
|
||||
left join post p on p.id = u.post_id
|
||||
<where>
|
||||
<if test="params.corpinfoId != null and params.corpinfoId != ''">
|
||||
and u.corpinfo_id = #{params.corpinfoId}
|
||||
</if>
|
||||
and u.username = #{params.username}
|
||||
and u.delete_enum = 'FALSE'
|
||||
</where>
|
||||
order by u.create_time desc
|
||||
limit 1
|
||||
</select>
|
||||
<select id="getDepartmentLeaderByDepartmentId" resultType="com.zcloud.basic.info.persistence.dataobject.DepartmentLeaderStatictiscDO">
|
||||
select
|
||||
u.department_id AS departmentId,
|
||||
|
|
|
|||
Loading…
Reference in New Issue