update:修改bug
This commit is contained in:
@@ -59,6 +59,7 @@ public class LoginRestController {
|
||||
@RequestParam @NotNull(message = "请输入密码") String password,
|
||||
@RequestParam(value = "isRememberMe", defaultValue = "false") Boolean isRememberMe, String verifyCode) throws UnsupportedEncodingException {
|
||||
UserEO userEO = userService.getUserByLoginNameNotDeleted(username);
|
||||
userEO.setInstitutionNameDepartment(userService.getName(userEO.getInstitutionId()));
|
||||
if (null == userEO) {
|
||||
log.info("用户[{}]身份验证失败", username);
|
||||
return Result.error("r0011", "您输入的帐号或密码有误");
|
||||
|
||||
+6
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarInstitution.controller;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TreeVo;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsUserVO;
|
||||
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
|
||||
@@ -104,6 +105,11 @@ public class TsInstitutionController extends BaseController<TsInstitution> {
|
||||
return tsInstitutionService.getNext(institutionId,userName);
|
||||
}
|
||||
|
||||
@GetMapping("/getNextTwo")
|
||||
public List<TsInstitution> getNextTwo(String userName){
|
||||
return tsInstitutionService.getNextTwo(userName);
|
||||
}
|
||||
|
||||
@ApiOperation("获得下一级的部门和人员")
|
||||
@GetMapping("/getNextById")
|
||||
public List<TsUserVO> getNextById(String ids){
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.adc.da.slrs.sarInstitution.dao;
|
||||
|
||||
import com.adc.da.slrs.sarInstitution.entity.InstitutionAndUser;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TreeVo;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsUserVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@@ -24,6 +25,10 @@ public interface TsInstitutionDao extends BaseMapper<TsInstitution> {
|
||||
*/
|
||||
List<TsInstitution> selectNextInstitution(String institutionId);
|
||||
|
||||
List<TsUserVO> selectPreviousInstitution(@Param("userName") String name);
|
||||
|
||||
List<TsInstitution> selectInstitution(@Param("pId") List<String> pId);
|
||||
|
||||
/**
|
||||
* 根据部门id查询此部门的子一级人员
|
||||
* @return
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.adc.da.slrs.sarInstitution.entity;
|
||||
|
||||
import com.adc.da.slrs.sarPosition.entity.TsPosition;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: qk
|
||||
* @Date: 2022/5/20 0020 10:54
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class TreeVo {
|
||||
|
||||
public interface disable{
|
||||
}
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "上级机构")
|
||||
@TableField("parent_id")
|
||||
private String parentId;
|
||||
|
||||
@ApiModelProperty(value = "机构层级")
|
||||
@TableField("level")
|
||||
private Integer level;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("是否是机构")
|
||||
private Boolean disabled;
|
||||
|
||||
@TableField("has_child")
|
||||
@ApiModelProperty("是否有子节点(1有,0没有)")
|
||||
private String hasChild;
|
||||
|
||||
@ApiModelProperty(value = "帐户")
|
||||
@TableField("ACCOUNT")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "密码")
|
||||
@TableField("PASSWORD")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "用户姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "用户性别(1为男,2为女)")
|
||||
@TableField("SEX")
|
||||
private String sex;
|
||||
|
||||
@ApiModelProperty(value = "用户来源")
|
||||
@TableField("USER_SOURCE")
|
||||
private String userSource;
|
||||
|
||||
@ApiModelProperty(value = "用户手机号")
|
||||
@TableField("PHONE")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "用户状态")
|
||||
@TableField("STATE")
|
||||
private String state;
|
||||
|
||||
@ApiModelProperty(value = "用户邮箱")
|
||||
@TableField("EMAIL")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "所属部门名称")
|
||||
@TableField("INSTITUTION_NAME")
|
||||
private String institutionName;
|
||||
|
||||
@ApiModelProperty(value = "所属部门ID")
|
||||
@TableField("INSTITUTION_ID")
|
||||
private String institutionId;
|
||||
|
||||
@ApiModelProperty(value = "岗位名")
|
||||
@TableField("POSITION_NAME")
|
||||
private String positionName;
|
||||
|
||||
@ApiModelProperty(value = "岗位ID")
|
||||
@TableField("POSITION_ID")
|
||||
private String positionId;
|
||||
|
||||
@ApiModelProperty(value = "工号")
|
||||
@TableField("WORK_NUM")
|
||||
private String workNum;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
@TableField("EXT_INFO")
|
||||
private String extInfo;
|
||||
|
||||
@TableField("OPER_USER")
|
||||
private String operUser;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField("CREATION_TIME")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp creationTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField("MODIFY_TIME")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp modifyTime;
|
||||
|
||||
@ApiModelProperty(value = "是否有效")
|
||||
@TableField("VALID_FLAG")
|
||||
private String validFlag;
|
||||
|
||||
@ApiModelProperty(value = "是否禁用(0为未禁用,1为已禁用)")
|
||||
@NotNull(message = "disableFlag不能为空",groups = {TsUserVO.disable.class})
|
||||
@TableField("DISABLE_FLAG")
|
||||
private String disableFlag;
|
||||
|
||||
@ApiModelProperty(value = "是否锁定")
|
||||
@TableField("UNLOCK_FLAG")
|
||||
private String unlockFlag;
|
||||
|
||||
@ApiModelProperty(value = "用户类型")
|
||||
@TableField("USER_TYPE")
|
||||
private String userType;
|
||||
|
||||
@ApiModelProperty(value = "对接单点登录用户ID")
|
||||
@TableField("SSO_ID")
|
||||
private String ssoId;
|
||||
|
||||
@ApiModelProperty(value = "岗位")
|
||||
@TableField(exist = false)
|
||||
private List<TsPosition> positions;
|
||||
|
||||
@ApiModelProperty(value = "单位")
|
||||
@TableField(exist = false)
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty(value = "单位Id")
|
||||
@TableField(exist = false)
|
||||
private String unitId;
|
||||
|
||||
}
|
||||
+3
@@ -1,5 +1,6 @@
|
||||
package com.adc.da.slrs.sarInstitution.service;
|
||||
|
||||
import com.adc.da.slrs.sarInstitution.entity.TreeVo;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsUserVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -38,6 +39,8 @@ public interface ITsInstitutionService extends IService<TsInstitution> {
|
||||
*/
|
||||
public List<TsInstitution> getNext(String institutionId,String userName);
|
||||
|
||||
public List<TsInstitution> getNextTwo(String userName);
|
||||
|
||||
public List<TsInstitution> getInstitutionIdToDept(String institutionIds,String userName);
|
||||
|
||||
public List<TsUserVO> getNextById(String ids);
|
||||
|
||||
+28
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarInstitution.service.impl;
|
||||
|
||||
import com.adc.da.slrs.sarInstitution.dao.TsInstitutionDao;
|
||||
import com.adc.da.slrs.sarInstitution.entity.SyncInstitution;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TreeVo;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
|
||||
import com.adc.da.slrs.sarInstitution.entity.TsUserVO;
|
||||
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
|
||||
@@ -226,6 +227,33 @@ public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsIn
|
||||
return tsInstitutions;
|
||||
}
|
||||
|
||||
public List<TsInstitution> getNextTwo(String userName){
|
||||
List<TsInstitution> tsInstitutions = new ArrayList<>();
|
||||
List<TsUserVO> tsUser = tsInstitutionDao.selectPreviousInstitution(userName);
|
||||
if(tsUser.size() != 0){
|
||||
|
||||
List<String> pId = new ArrayList<>();
|
||||
for (TsUserVO t:tsUser) {
|
||||
pId.add(t.getInstitutionId());
|
||||
}
|
||||
tsInstitutions = tsInstitutionDao.selectInstitution(pId);
|
||||
|
||||
for(TsInstitution tsInstitution:tsInstitutions){
|
||||
tsInstitution.setDisabled(true);
|
||||
}
|
||||
for (TsInstitution t:tsInstitutions){
|
||||
List<Object> uers = new ArrayList<>();
|
||||
for (TsUserVO user:tsUser) {
|
||||
if(t.getId().equals(user.getInstitutionId())){
|
||||
uers.add(user);
|
||||
}
|
||||
t.setChildren(uers);
|
||||
}
|
||||
}
|
||||
}
|
||||
return tsInstitutions;
|
||||
}
|
||||
|
||||
public List<TsUserVO> getNextById(String ids){
|
||||
List<String> strings=new ArrayList<>(Arrays.asList(ids.split(",")));
|
||||
List<TsUserVO> tsUsers=tsInstitutionDao.selectNextUserByIds(strings);
|
||||
|
||||
@@ -21,6 +21,15 @@
|
||||
<result column="name" property="name"/>
|
||||
<result column="has_child" property="hasChild"/>
|
||||
</resultMap>
|
||||
<resultMap id="TreeVoMap" type="com.adc.da.slrs.sarInstitution.entity.TreeVo">
|
||||
<result column="USID" property="id"/>
|
||||
<result column="INSTITUTION_ID" property="parentId"/>
|
||||
<result column="UNAME" property="name"/>
|
||||
</resultMap>
|
||||
<resultMap id="TreeVoMap2" type="com.adc.da.slrs.sarInstitution.entity.TreeVo">
|
||||
<result column="id" property="id"/>
|
||||
<result column="name" property="name"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="TsUser" type="com.adc.da.slrs.sarInstitution.entity.TsUserVO">
|
||||
<result column="usid" property="id"/>
|
||||
@@ -35,6 +44,23 @@
|
||||
WHERE parent_id=#{institutionId}
|
||||
</select>
|
||||
|
||||
<select id="selectPreviousInstitution" resultMap="TsUser">
|
||||
select * from ts_user
|
||||
<where>
|
||||
<if test="userName != null and userName != '' ">
|
||||
( ts_user.ACCOUNT like concat(concat('%',#{userName}),'%') or ts_user.UNAME like concat(concat('%',#{userName}),'%') )
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectInstitution" resultType="com.adc.da.slrs.sarInstitution.entity.TsInstitution">
|
||||
select * from ts_institution
|
||||
WHERE
|
||||
id IN
|
||||
<foreach collection="pId" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectNextUsers" resultMap="TsUser">
|
||||
select ts_user.EMAIL,ts_user.ACCOUNT,ts_user.CREATION_TIME,ts_user.DISABLE_FLAG,ts_user.EXT_INFO,ts_user.USID,
|
||||
ts_user.INSTITUTION_ID,t2.name as INSTITUTION_NAME,ts_user.MODIFY_TIME,ts_user.OPER_USER,ts_user.PASSWORD,ts_user.PHONE,
|
||||
|
||||
@@ -120,8 +120,17 @@
|
||||
</select>
|
||||
|
||||
<select id="selectDeptByDY" resultMap="UserPosition">
|
||||
select ts_user.USID,ts_user.INSTITUTION_ID,ts_institution.name as institution_name from ts_user
|
||||
left join ts_institution on ts_institution.id=ts_user.INSTITUTION_ID
|
||||
select ts_user.USID,ts_user.INSTITUTION_ID,
|
||||
concat(
|
||||
t3.`name`,
|
||||
concat(
|
||||
'_',
|
||||
concat(
|
||||
t2.`name`,
|
||||
concat( '_', t1.`name` )))) as institution_name from ts_user
|
||||
left join ts_institution t1 on t1.id=ts_user.INSTITUTION_ID
|
||||
LEFT JOIN ts_institution t2 ON t1.parent_id = t2.id
|
||||
LEFT JOIN ts_institution t3 ON t2.parent_id = t3.id
|
||||
where ts_user.USID in
|
||||
<foreach item="msgId" collection="list" open="(" separator="," close=")" index="index">
|
||||
#{msgId}
|
||||
|
||||
@@ -177,4 +177,6 @@ public interface UserEODao extends BaseMapper<UserEO> {
|
||||
//手机端接口 只查人
|
||||
List<UserPhoneDTO> getUserByName(@Param("name") String name,@Param("page")Integer page);
|
||||
|
||||
String getName (@Param("id") String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public class UserEO extends BaseEntity implements Serializable {
|
||||
private String institutionId;
|
||||
private String ssoId;
|
||||
private String token;
|
||||
private String institutionNameDepartment;
|
||||
/**
|
||||
* java字段名转换为原始数据库列名。<b>如果不存在则返回null</b><br>
|
||||
* <p>字段列表:</p>
|
||||
|
||||
@@ -81,5 +81,7 @@ public interface IUserEOService extends IService<UserEO> {
|
||||
//手机端接口 只查人
|
||||
List<UserPhoneDTO> getUserByName(String name,Integer page);
|
||||
|
||||
String getName(String name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -521,4 +521,9 @@ public class UserEOServiceImpl extends ServiceImpl<UserEODao, UserEO> implements
|
||||
return this.baseMapper.getUserByName(name,page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(String id) {
|
||||
return this.baseMapper.getName(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@
|
||||
WHERE
|
||||
VALID_FLAG ='0'
|
||||
AND USER_ID = #{userId}
|
||||
AND COLLECT_RES_ID =
|
||||
AND COLLECT_RES_ID IN
|
||||
|
||||
(
|
||||
SELECT
|
||||
|
||||
@@ -815,4 +815,21 @@
|
||||
limit ${(page-1)*20},${20}
|
||||
</select>
|
||||
|
||||
<select id="getName" resultType="java.lang.String">
|
||||
SELECT
|
||||
concat(
|
||||
t3.`name`,
|
||||
concat(
|
||||
'_',
|
||||
concat(
|
||||
t2.`name`,
|
||||
concat( '_', t1.`name` ))))
|
||||
FROM
|
||||
ts_institution t1
|
||||
LEFT JOIN ts_institution t2 ON t1.parent_id = t2.id
|
||||
LEFT JOIN ts_institution t3 ON t2.parent_id = t3.id
|
||||
WHERE
|
||||
t1.id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user