| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- package cn.com.lzt.dialogDeal.service.impl;
- import java.io.Serializable;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
- import org.jeecgframework.core.constant.Globals;
- import org.jeecgframework.core.util.JeecgDataAutorUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import cn.com.lzt.arrangeduty.dao.ArrangeDutyMinidao;
- import cn.com.lzt.arrangeduty.dao.MealsSubsidyMiniDao;
- import cn.com.lzt.arrangeduty.dao.ProjectDepartMinidao;
- import cn.com.lzt.arrangeduty.dao.UserOrgMinidao;
- import cn.com.lzt.arrangeduty.dto.ProjectDepartDto;
- import cn.com.lzt.arrangeduty.dto.UserOrgDto;
- import cn.com.lzt.arrangeduty.entity.ArrangeDutyEntity;
- import cn.com.lzt.dialogDeal.service.UserDepartOrgDealServiceI;
- @Service("userDepartOrgDealServiceI")
- @Transactional
- public class UserDepartOrgDealServiceImpl extends CommonServiceImpl implements UserDepartOrgDealServiceI {
-
- @Autowired
- ProjectDepartMinidao projectDepartMinidao;
-
- @Autowired
- UserOrgMinidao userOrgMinidao;
-
- @Override
- public void delete(ArrangeDutyEntity entity) throws Exception {
- // TODO Auto-generated method stub
-
- }
- @Override
- public Serializable save(ArrangeDutyEntity entity) throws Exception {
- // TODO Auto-generated method stub
- return null;
- }
- @Override
- public void saveOrUpdate(ArrangeDutyEntity entity) throws Exception {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public List<UserOrgDto> getUserOrgDtoByUserId(UserOrgDto userOrgDto,
- String authSql) {
- // TODO Auto-generated method stub
- return userOrgMinidao.getUserOrgDtoByUserId(userOrgDto, authSql);
- }
- /**
- * 根据用户与组织机构关系表中的组织id查询项目id;
- * 业务逻辑
- * 任意层节点的zTree,每一层有一个父id,顶级节点父节点为null,一个组织类型orgType,随机给一层的主键id,找到项目id,特征是orgType=3/5;
- * 根据是否是顶级父id判断是自上而下还是自下而上查找,当自下而上找到null时,再进行自下而上;
- * @author zbw
- * 2017-11-15
- * @param projectDepartId
- * @return
- */
- @Override
- public List<String> getProjectDepartId(String projectDepartId){
- // String newProjectDepartId="";
- List<String> newProjectDepartIdList=new ArrayList<String>();
- ProjectDepartDto projectDepartDto=new ProjectDepartDto();
- projectDepartDto.getDepartIdList().add(projectDepartId);
- String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- // 根据部门信息表id查询部门信息表数据
- List<ProjectDepartDto> projectDepartDtoList = getProjectDepartByListId(projectDepartDto, authSql);
-
- if(projectDepartDtoList.get(0).getParentdepartid()!=null){
- if(!projectDepartDtoList.get(0).getOrgType().equals(Globals.org_type_3)&&!projectDepartDtoList.get(0).getOrgType().equals(Globals.org_type_5)){
- //获取某个父节点下面的所有子节点
- List<ProjectDepartDto> childList = getAllChildrenList(projectDepartId, null, null);
- for (int i = 0; i < childList.size(); i++) {
- if(childList.get(i).getOrgType().equals(Globals.org_type_3)||childList.get(i).getOrgType().equals(Globals.org_type_5)){
- // newProjectDepartId=childList.get(i).getId();
-
- if(!newProjectDepartIdList.contains(childList.get(i).getId())){
- newProjectDepartIdList.add(childList.get(i).getId());
- }
-
- }
- }
- if(newProjectDepartIdList.size()==0){
- //获取某个子节点上面的所有父节点
- List<ProjectDepartDto> parentList = getAllParentList(projectDepartDtoList.get(0).getParentdepartid(), null, null);
- for (int i = 0; i < parentList.size(); i++) {
- if(parentList.get(i).getOrgType().equals(Globals.org_type_3)||parentList.get(i).getOrgType().equals(Globals.org_type_5)){
- // newProjectDepartId=parentList.get(i).getId();
-
- if(!newProjectDepartIdList.contains(parentList.get(i).getId())){
- newProjectDepartIdList.add(parentList.get(i).getId());
- }
- }
- }
- }
- }else{
- newProjectDepartIdList.add(projectDepartDtoList.get(0).getId());
- // newProjectDepartId=projectDepartDtoList.get(0).getId();
- }
- }
-
- // List<PostEntity> childList = getAllChildrenList(post.getId(), null, null);
- // List<PostEntity> childList = getAllParentList(post.getParentPostid(), null, null);
-
- return newProjectDepartIdList;
- }
-
-
- /**
- * 根据用户与组织机构关系表中的组织id查询项目id;
- * 业务逻辑
- * 任意层节点的zTree,每一层有一个父id,顶级节点父节点为null,一个组织类型orgType,随机给一层的主键id,找到项目id,特征是orgType=3/5;
- * 根据是否是顶级父id判断是自上而下还是自下而上查找,当自下而上找到null时,再进行自下而上;
- * @author zbw
- * 2017-11-15
- * @param projectDepartId
- * @return
- */
- @Override
- public String getProjectDepartParentId(String projectDepartId){
- String newProjectDepartId="";
- ProjectDepartDto projectDepartDto=new ProjectDepartDto();
- projectDepartDto.getDepartIdList().add(projectDepartId);
- //String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- // 根据部门信息表id查询部门信息表数据
- List<ProjectDepartDto> projectDepartDtoList = getProjectDepartByListId(projectDepartDto, null);
-
- if(projectDepartDtoList.get(0).getParentdepartid()!=null){
- if(!projectDepartDtoList.get(0).getOrgType().equals(Globals.org_type_3)&&!projectDepartDtoList.get(0).getOrgType().equals(Globals.org_type_5)){
- //获取某个父节点下面的所有子节点
- /*List<ProjectDepartDto> childList = getAllChildrenList(projectDepartId, null, null);
- for (int i = 0; i < childList.size(); i++) {
- if(childList.get(i).getOrgType().equals(Globals.org_type_3)||childList.get(i).getOrgType().equals(Globals.org_type_5)){
- newProjectDepartId=childList.get(i).getId();
- // break;
- }
- }*/
- if(newProjectDepartId.length()==0){
- //获取某个子节点上面的所有父节点
- List<ProjectDepartDto> parentList = getAllParentList(projectDepartDtoList.get(0).getParentdepartid(), null, null);
- for (int i = 0; i < parentList.size(); i++) {
- if(parentList.get(i).getOrgType().equals(Globals.org_type_3)||parentList.get(i).getOrgType().equals(Globals.org_type_5)){
- newProjectDepartId=parentList.get(i).getId();
- // break;
- }
- }
- }
- }else{
- newProjectDepartId=projectDepartDtoList.get(0).getId();
- }
- }else{
- newProjectDepartId=null;
- }
-
- // List<PostEntity> childList = getAllChildrenList(post.getId(), null, null);
- // List<PostEntity> childList = getAllParentList(post.getParentPostid(), null, null);
-
- return newProjectDepartId;
- }
-
-
- @Override
- public List<ProjectDepartDto> getProjectDepartByListId(
- ProjectDepartDto projectDepartDto, String authSql) {
- // TODO Auto-generated method stub
- return projectDepartMinidao.getProjectDepartByListId(projectDepartDto, authSql);
- }
-
-
- /**
- * 获取某个父节点下面的所有子节点
- *
- * @param pid 父ID
- * @param entryList 当前节点的所有子节点列表(for循环用)
- * @param childList 所有子节点列表
- * @return
- */
- @Override
- public List<ProjectDepartDto> getAllChildrenList(String pid, List<ProjectDepartDto> entryList, List<ProjectDepartDto> childList) {
- if(childList == null){
- childList = new ArrayList<ProjectDepartDto>();
- }
- ProjectDepartDto projectDepartDto=new ProjectDepartDto();
- projectDepartDto.getParentDepartIdList().add(pid);
- String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- entryList = getProjectDepartByListParentId(projectDepartDto, authSql);
- // final String hql = "from PostEntity where parentPostid=? ";
- // entryList = postService.findHql(hql, pid);
- for (ProjectDepartDto entry : entryList) {
- // 遍历出父id等于参数的id,add进子节点集合
- if (entry.getParentdepartid().equals(pid)) {
- // 递归遍历下一级
- getAllChildrenList(entry.getId(), entryList, childList);
- childList.add(entry);
- }
- }
- return childList;
- }
-
- /**
- * 获取某个子节点上面的所有父节点
- *
- * @param childId 父ID
- * @param entryList 当前节点的所有父节点列表(for循环用)
- * @param childList 所有父节点列表
- * @return
- */
- @Override
- public List<ProjectDepartDto> getAllParentList(String pid, List<ProjectDepartDto> entryList, List<ProjectDepartDto> parentList) {
- if(parentList == null){
- parentList = new ArrayList<ProjectDepartDto>();
- }
- ProjectDepartDto projectDepartDto=new ProjectDepartDto();
- projectDepartDto.getChildDepartIdList().add(pid);
- //String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- entryList = getProjectDepartByListChildId(projectDepartDto, null);
- // final String hql = "from PostEntity where id=? ";
- // entryList = postService.findHql(hql, pid);
- for (ProjectDepartDto entry : entryList) {
- // 遍历出父id等于参数的id,add进父节点集合
- if (entry.getId().equals(pid)) {
- // 递归遍历下一级
- getAllParentList(entry.getParentdepartid(), entryList, parentList);
- parentList.add(entry);
- }
- }
- return parentList;
- }
-
-
- @Override
- public List<ProjectDepartDto> getProjectDepartByListParentId(
- ProjectDepartDto projectDepartDto, String authSql) {
- // TODO Auto-generated method stub
- return projectDepartMinidao.getProjectDepartByListParentId(projectDepartDto, authSql);
- }
-
-
- @Override
- public List<ProjectDepartDto> getProjectDepartByListChildId(
- ProjectDepartDto projectDepartDto, String authSql) {
- // TODO Auto-generated method stub
- return projectDepartMinidao.getProjectDepartByListChildId(projectDepartDto, authSql);
- }
-
-
-
- @Override
- public List<String> getParentChildIdByProjectDepartId(String projectDepartId) {
- List<String> parentChildIdList=new ArrayList<String>();
- parentChildIdList.add(projectDepartId);
- ProjectDepartDto projectDepartDto=new ProjectDepartDto();
- projectDepartDto.getDepartIdList().add(projectDepartId);
- String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- List<ProjectDepartDto> projectDepartDtoList = getProjectDepartByListId(projectDepartDto, authSql);
- if(projectDepartDtoList.get(0).getParentdepartid()!=null){
- //获取某个父节点下面的所有子节点
- List<ProjectDepartDto> childList = getAllChildrenList(projectDepartId, null, null);
- for (int i = 0; i < childList.size(); i++) {
- parentChildIdList.add(childList.get(i).getId());
- }
-
- //获取某个子节点上面的所有父节点
- List<ProjectDepartDto> parentList = getAllParentList(projectDepartDtoList.get(0).getParentdepartid(), null, null);
- for (int i = 0; i < parentList.size(); i++) {
- parentChildIdList.add(parentList.get(i).getId());
- }
- }else{
- //获取某个父节点下面的所有子节点
- List<ProjectDepartDto> childList = getAllChildrenList(projectDepartId, null, null);
- for (int i = 0; i < childList.size(); i++) {
- parentChildIdList.add(childList.get(i).getId());
- }
- }
-
- return parentChildIdList;
- }
-
-
-
-
- @Override
- public List<String> getChildIdByProjectDepartId(String projectDepartId) {
- List<String> parentChildIdList=new ArrayList<String>();
- parentChildIdList.add(projectDepartId);
- //获取某个父节点下面的所有子节点
- List<ProjectDepartDto> childList = getAllChildrenList(projectDepartId, null, null);
- for (int i = 0; i < childList.size(); i++) {
- parentChildIdList.add(childList.get(i).getId());
- }
-
- return parentChildIdList;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
|