Merge branch 'develop_migration' into 'develop_master'
feat: There is no way the, bug #56143 企标相关-- 选择人员后带入的起草责任单位支持三级查询 See merge request LiuChao/foton-slrs-system-rest!547
This commit is contained in:
+8
-2
@@ -105,6 +105,12 @@ public class TsInstitutionController extends BaseController<TsInstitution> {
|
||||
return tsInstitutionService.getNext(institutionId,userName);
|
||||
}
|
||||
|
||||
@ApiOperation("topNum 获取人员上几级部门")
|
||||
@GetMapping("/selectNowInst")
|
||||
public List<TsInstitution> selectNowInst(String institutionId,String userName,String topNum){
|
||||
return tsInstitutionService.selectNowInst(institutionId,userName,topNum);
|
||||
}
|
||||
|
||||
@GetMapping("/getNextTwo")
|
||||
public List<TsInstitution> getNextTwo(String userName){
|
||||
return tsInstitutionService.getNextTwo(userName);
|
||||
@@ -112,8 +118,8 @@ public class TsInstitutionController extends BaseController<TsInstitution> {
|
||||
|
||||
@ApiOperation("获得下一级的部门和人员")
|
||||
@GetMapping("/getNextById")
|
||||
public List<TsUserVO> getNextById(String ids){
|
||||
return tsInstitutionService.getNextById(ids);
|
||||
public List<TsUserVO> getNextById(String ids,Integer topNum){
|
||||
return tsInstitutionService.getNextById(ids,topNum);
|
||||
}
|
||||
|
||||
@ApiOperation("获得第一级部门目录")
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.adc.da.slrs.sarInstitution.entity.TsUserVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,6 +19,7 @@ import java.util.List;
|
||||
* @author zyl
|
||||
* @since 2021-06-22
|
||||
*/
|
||||
@Repository
|
||||
public interface TsInstitutionDao extends BaseMapper<TsInstitution> {
|
||||
/**
|
||||
* 根据部门id查询此部门的子一级部门
|
||||
@@ -37,6 +39,8 @@ public interface TsInstitutionDao extends BaseMapper<TsInstitution> {
|
||||
|
||||
List<TsInstitution> selectNextUsers(@Param("institutionIds") List<String> institutionIds,@Param("userName") String userName);
|
||||
|
||||
List<TsInstitution> selectNowInst(@Param("institutionId") String institutionId,@Param("topNum") String topNum);
|
||||
|
||||
List<TsUserVO> selectNextUserByIds(@Param("ids") List<String> ids);
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,9 @@ public class TsInstitution extends BaseEntity {
|
||||
@ApiModelProperty(value = "子机构")
|
||||
private List<Object> children;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<TsInstitution> topChildren;
|
||||
|
||||
@JsonIgnore
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "人员")
|
||||
|
||||
@@ -126,4 +126,15 @@ public class TsUserVO {
|
||||
@ApiModelProperty(value = "单位Id")
|
||||
@TableField(exist = false)
|
||||
private String unitId;
|
||||
|
||||
@ApiModelProperty(value = "上级单位 根据规则参数 返回上几级单位")
|
||||
@TableField(exist = false)
|
||||
private String topUnit;
|
||||
|
||||
@ApiModelProperty(value = "上级单位Id 根据规则参数 返回上几级单位")
|
||||
@TableField(exist = false)
|
||||
private String topUnitId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<TsInstitution> children;
|
||||
}
|
||||
|
||||
+3
-1
@@ -39,11 +39,13 @@ public interface ITsInstitutionService extends IService<TsInstitution> {
|
||||
*/
|
||||
public List<TsInstitution> getNext(String institutionId,String userName);
|
||||
|
||||
public List<TsInstitution> selectNowInst(String institutionId,String userName,String topNum);
|
||||
|
||||
public List<TsInstitution> getNextTwo(String userName);
|
||||
|
||||
public List<TsInstitution> getInstitutionIdToDept(String institutionIds,String userName);
|
||||
|
||||
public List<TsUserVO> getNextById(String ids);
|
||||
public List<TsUserVO> getNextById(String ids,Integer topNum);
|
||||
|
||||
/**
|
||||
* 获得第一级的部门
|
||||
|
||||
+39
-1
@@ -14,6 +14,9 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bouncycastle.pqc.math.linearalgebra.IntUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -211,6 +214,10 @@ public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsIn
|
||||
return tsUsers;
|
||||
}
|
||||
|
||||
public List<TsInstitution> selectNowInst(String institutionId,String userName,String topNum){
|
||||
return tsInstitutionDao.selectNowInst(institutionId, topNum);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过部门id获得这个部门下的下一级部门
|
||||
* @return
|
||||
@@ -223,6 +230,7 @@ public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsIn
|
||||
for(TsInstitution tsInstitution:tsInstitutions){
|
||||
tsInstitution.setDisabled(true);
|
||||
}
|
||||
|
||||
tsInstitutions.addAll(tsUsers);
|
||||
return tsInstitutions;
|
||||
}
|
||||
@@ -254,10 +262,13 @@ public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsIn
|
||||
return tsInstitutions;
|
||||
}
|
||||
|
||||
public List<TsUserVO> getNextById(String ids){
|
||||
@Override
|
||||
public List<TsUserVO> getNextById(String ids,Integer topNum){
|
||||
List<String> strings=new ArrayList<>(Arrays.asList(ids.split(",")));
|
||||
List<TsUserVO> tsUsers=tsInstitutionDao.selectNextUserByIds(strings);
|
||||
List<TsUserVO> res=new ArrayList<>();
|
||||
List<TsInstitution> list = tsInstitutionDao.selectList(new QueryWrapper<>());
|
||||
|
||||
if (null!=tsUsers && tsUsers.size()>0){
|
||||
Map<String,TsUserVO> middle=new HashMap<>();
|
||||
for (TsUserVO u:tsUsers) {
|
||||
@@ -269,9 +280,36 @@ public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsIn
|
||||
res.add(middle.get(s));
|
||||
});
|
||||
}
|
||||
|
||||
// 新需求 按规则取用户上几级部门
|
||||
if(!res.isEmpty() && topNum != null){
|
||||
Map<String, TsInstitution> map = list.stream().collect(Collectors.toMap(TsInstitution::getId, tsInstitution -> tsInstitution));
|
||||
for (TsUserVO userVO : res) {
|
||||
List<TsInstitution> tsInstitutions = new ArrayList<>();
|
||||
List<TsInstitution> institutions = getTopChild(map,userVO.getInstitutionId(),topNum,tsInstitutions);
|
||||
if(!institutions.isEmpty()){
|
||||
if(institutions.size() >= topNum){
|
||||
userVO.setTopUnitId(institutions.get(topNum).getId());
|
||||
userVO.setTopUnit(institutions.get(topNum).getName());
|
||||
}else {
|
||||
userVO.setTopUnitId(institutions.get(institutions.size()-1).getId());
|
||||
userVO.setTopUnit(institutions.get(institutions.size()-1).getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public List<TsInstitution> getTopChild(Map<String, TsInstitution> map,String id,int topNum,List<TsInstitution> institutions){
|
||||
TsInstitution institution = map.get(id);
|
||||
if( institution != null && StringUtils.isNotBlank(institution.getParentId())){
|
||||
institutions.add(institution);
|
||||
getTopChild(map,institution.getParentId(),topNum,institutions);
|
||||
}
|
||||
return institutions;
|
||||
}
|
||||
|
||||
public List<TsInstitution> getFirst(){
|
||||
//查询第一层机构
|
||||
|
||||
+6
-2
@@ -81,6 +81,11 @@
|
||||
order by ts_institution.id
|
||||
</select>
|
||||
|
||||
<!-- 查询当前用户上几级部门-->
|
||||
<select id="selectNowInst" resultMap="TsInstitution">
|
||||
SELECT * from ts_institution where FIND_IN_SET(id,queryChildrenInstitution(#{institutionId},#{topNum}));
|
||||
</select>
|
||||
|
||||
<!-- 只查询这个部门下的子一级人员-->
|
||||
<select id="selectNextUser" resultMap="TsUser">
|
||||
select ts_user.EMAIL,ts_user.ACCOUNT,ts_user.CREATION_TIME,ts_user.DISABLE_FLAG,ts_user.EXT_INFO,ts_user.USID,
|
||||
@@ -104,13 +109,12 @@
|
||||
ts_user.USER_TYPE,ts_user.VALID_FLAG,ts_user.WORK_NUM,concat(ts_user.UNAME,concat(concat("(",ts_user.ACCOUNT),")")) as uname
|
||||
from ts_user
|
||||
left join ts_institution on ts_user.INSTITUTION_ID=ts_institution.id
|
||||
WHERE 1=1
|
||||
WHERE 1=1
|
||||
<if test="ids != null and ids.size()> 0 ">
|
||||
and ts_user.USID in
|
||||
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user