| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435 |
- package cn.com.lzt.dialogDeal.service.impl;
- import java.io.Serializable;
- import java.text.Collator;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.Comparator;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Locale;
- import java.util.Map;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.daju.common.constants.EleTypeEnum;
- import com.daju.mix.dao.entity.TBArchivesArea;
- import com.daju.mix.dao.entity.TBArchivesPlace;
- import com.daju.mix.dao.entity.TBArchivesRoadSection;
- import com.daju.mix.dao.entity.TBWorkRouteList;
- import com.daju.mix.dao.mapper.TBArchivesAreaMapper;
- import com.daju.mix.dao.service.impl.TBArchivesAreaServiceImpl;
- import com.daju.mix.dao.service.impl.TBArchivesPlaceServiceImpl;
- import com.daju.mix.dao.service.impl.TBArchivesRoadSectionServiceImpl;
- import com.daju.mix.dto.ElementDto;
- import org.jeecgframework.core.common.model.json.DataGrid;
- import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
- import org.jeecgframework.core.constant.Globals;
- import org.jeecgframework.core.util.JeecgDataAutorUtils;
- import org.jeecgframework.core.util.ResourceUtil;
- import org.jeecgframework.web.system.pojo.base.TSDepart;
- import org.jeecgframework.web.system.pojo.base.TSUser;
- 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.dao.UserDepartOrgDealMiniDao;
- import cn.com.lzt.dialogDeal.service.DialogDealServiceI;
- import cn.com.lzt.dialogDeal.service.UserDepartOrgDealServiceI;
- import javax.annotation.Resource;
- @Service("dialogDealService")
- @Transactional
- public class DialogDealServiceImpl extends CommonServiceImpl implements DialogDealServiceI {
- @Autowired
- ArrangeDutyMinidao arrangeDutyMinidao;
-
-
- @Autowired
- MealsSubsidyMiniDao mealsSubsidyMiniDao;
-
- @Autowired
- ProjectDepartMinidao projectDepartMinidao;
-
- @Autowired
- UserOrgMinidao userOrgMinidao;
-
- // 用户和项目关系处理
- @Autowired
- UserDepartOrgDealServiceI userDepartOrgDealServiceI;
-
-
- @Autowired
- UserDepartOrgDealMiniDao userDepartOrgDealMiniDao;
-
- @Resource
- TBArchivesPlaceServiceImpl tbArchivesPlaceService;
- @Resource
- TBArchivesRoadSectionServiceImpl tbArchivesRoadSectionService;
- @Resource
- TBArchivesAreaServiceImpl tbArchivesAreaService;
- @Resource
- TBArchivesAreaMapper tbArchivesAreaMapper;
-
- @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<ProjectDepartDto> getProjectDepartByUserId(){
- TSUser tSUser=ResourceUtil.getSessionUser();
- UserOrgDto userOrgDto=new UserOrgDto();
- userOrgDto.setUserId(tSUser.getId());
- String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- // 根据当前登录用户id查询 用户与组织机构关系表数据
- List<UserOrgDto> userOrgDtoList = userDepartOrgDealServiceI.getUserOrgDtoByUserId(userOrgDto, authSql);
-
- ProjectDepartDto projectDepartDto =new ProjectDepartDto();
-
- List<Map<String, Object>> listMap=new ArrayList<Map<String, Object>>();
- List<String> projectDepartIdList=new ArrayList<String>();
- for (int i = 0; i < userOrgDtoList.size(); i++) {
- List<String> newProjectDepartIdList =userDepartOrgDealServiceI.getProjectDepartId(userOrgDtoList.get(i).getOrgId());
- if(newProjectDepartIdList.size()>0){
- for (int j = 0; j < newProjectDepartIdList.size(); j++) {
- Map<String, Object> myMap=new HashMap<String, Object>();
- myMap.put("projectDepartId", newProjectDepartIdList.get(j));
- myMap.put("ifpluralism", userOrgDtoList.get(i).getIfpluralism());
- myMap.put("status", userOrgDtoList.get(i).getStatus());
- if(!projectDepartIdList.contains(newProjectDepartIdList.get(j))){
- projectDepartIdList.add(newProjectDepartIdList.get(j));
- listMap.add(myMap);
- }
- }
- }
- }
-
- projectDepartDto.getDepartIdList().addAll(projectDepartIdList);
- authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- List<ProjectDepartDto> projectDepartDtoList = userDepartOrgDealServiceI.getProjectDepartByListId(projectDepartDto, authSql);
- for (int i = 0; i < projectDepartDtoList.size(); i++) {
- for (int j = 0; j < listMap.size(); j++) {
- if(projectDepartDtoList.get(i).getId().equals(listMap.get(j).get("projectDepartId"))){
- projectDepartDtoList.get(i).setIfpluralism(listMap.get(j).get("ifpluralism").toString());
- projectDepartDtoList.get(i).setStatus(listMap.get(j).get("status").toString());
- break;
- }
- /*for(Entry<String, Object> entryParam : listMap.get(j).entrySet()){
- //System.out.println("key="+entryParam.getKey()+",value="+entryParam.getValue());
- if(projectDepartDtoList.get(i).getId().equals(entryParam.getValue())){}
- }*/
- }
- }
- return projectDepartDtoList;
- }
-
- /* (non-Javadoc)
- * @see cn.com.lzt.dialogDeal.service.DialogDealServiceI#getProjectDepartChildByUserIdAndLikeDepartName(cn.com.lzt.arrangeduty.dto.ProjectDepartDto)
- */
- @Override
- public List<ProjectDepartDto> getProjectDepartChildByUserIdAndLikeDepartName(ProjectDepartDto projectDepartDto) {
- TSUser tSUser=ResourceUtil.getSessionUser();
- UserOrgDto userOrgDto=new UserOrgDto();
- userOrgDto.setUserId(tSUser.getId());
- String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- // 根据当前登录用户id查询 用户与组织机构关系表数据
- List<UserOrgDto> userOrgDtoList = userDepartOrgDealServiceI.getUserOrgDtoByUserId(userOrgDto, authSql);
- Map<String, String> depargMap = getTSDepartByIdMap();
- List<ProjectDepartDto> projectDepartDtoList = new ArrayList<ProjectDepartDto>();
- for (int i = 0; i < userOrgDtoList.size(); i++) {
- List<ProjectDepartDto> newProjectDepartIdList =userDepartOrgDealServiceI.getAllChildrenList(userOrgDtoList.get(i).getOrgId(),null,null);
- if(newProjectDepartIdList.size()>0){
- for (int j = 0; j < newProjectDepartIdList.size(); j++) {
- if(userOrgDtoList.get(i).getOrgId().equals(newProjectDepartIdList.get(j).getId())) {
- continue;
- }
- String departname = depargMap.get(newProjectDepartIdList.get(j).getId());
- if(departname != null ) {
- newProjectDepartIdList.get(j).setDepartName(departname);
- }
- if(projectDepartDto.getDepartName() != null && departname.indexOf(projectDepartDto.getDepartName())<0) {
- continue;
- }
- projectDepartDtoList.add(newProjectDepartIdList.get(j));
- }
- }
- }
-
- return projectDepartDtoList;
- }
-
- private Map<String, String> getTSDepartByIdMap(){
- //查出部门信息表所有数据,获取主键id和名称
- StringBuffer hql = new StringBuffer(" from TSDepart ");
- List<TSDepart> TSDepartByIdMapList = this.findHql(hql.toString());
- Map<String, String> TSDepartNameByIdMap=new HashMap<String, String>();
-
- for (int i = 0; i < TSDepartByIdMapList.size(); i++) {
- TSDepart depart = TSDepartByIdMapList.get(i);
- String showname = depart.getDepartname();
- if(depart.getTSPDepart() != null && !Globals.SHENQIN_ID.equals(depart.getTSPDepart().getId())) {
- showname = depart.getTSPDepart().getDepartname() + "-" + showname;
- }
- TSDepartNameByIdMap.put(TSDepartByIdMapList.get(i).getId(),showname);
- }
-
- return TSDepartNameByIdMap;
- }
-
- @Override
- public List<ProjectDepartDto> getProjectDepartByUserIdAndLikeDepartName(ProjectDepartDto projectDepartDto){
- TSUser tSUser=ResourceUtil.getSessionUser();
- UserOrgDto userOrgDto=new UserOrgDto();
- userOrgDto.setUserId(tSUser.getId());
- String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- // 根据当前登录用户id查询 用户与组织机构关系表数据
- List<UserOrgDto> userOrgDtoList = userDepartOrgDealServiceI.getUserOrgDtoByUserId(userOrgDto, authSql);
-
- // ProjectDepartDto projectDepartDto =new ProjectDepartDto();
-
- List<Map<String, Object>> listMap=new ArrayList<Map<String, Object>>();
- List<String> projectDepartIdList=new ArrayList<String>();
- for (int i = 0; i < userOrgDtoList.size(); i++) {
- List<String> newProjectDepartIdList =userDepartOrgDealServiceI.getProjectDepartId(userOrgDtoList.get(i).getOrgId());
- if(newProjectDepartIdList.size()>0){
- for (int j = 0; j < newProjectDepartIdList.size(); j++) {
- Map<String, Object> myMap=new HashMap<String, Object>();
- myMap.put("projectDepartId", newProjectDepartIdList.get(j));
- myMap.put("ifpluralism", userOrgDtoList.get(i).getIfpluralism());
- myMap.put("status", userOrgDtoList.get(i).getStatus());
- if(!projectDepartIdList.contains(newProjectDepartIdList.get(j))){
- projectDepartIdList.add(newProjectDepartIdList.get(j));
- listMap.add(myMap);
- }
- }
- }
- }
-
- projectDepartDto.getDepartIdList().addAll(projectDepartIdList);
- authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- List<ProjectDepartDto> projectDepartDtoList = userDepartOrgDealServiceI.getProjectDepartByListId(projectDepartDto, authSql);
- for (int i = 0; i < projectDepartDtoList.size(); i++) {
- for (int j = 0; j < listMap.size(); j++) {
- if(projectDepartDtoList.get(i).getId().equals(listMap.get(j).get("projectDepartId"))){
- projectDepartDtoList.get(i).setIfpluralism(listMap.get(j).get("ifpluralism").toString());
- projectDepartDtoList.get(i).setStatus(listMap.get(j).get("status").toString());
- break;
- }
- /*for(Entry<String, Object> entryParam : listMap.get(j).entrySet()){
- //System.out.println("key="+entryParam.getKey()+",value="+entryParam.getValue());
- if(projectDepartDtoList.get(i).getId().equals(entryParam.getValue())){}
- }*/
- }
- }
- return projectDepartDtoList;
- }
- @Override
- public List<ProjectDepartDto> getProjectDepartAll(
- ProjectDepartDto projectDepartDto) {
- // StringBuffer hql = new StringBuffer(" FROM ArrangeDutyOperateEntity where yearmonth=? ");
- // List<ArrangeDutyOperateEntity> arrangeDutyOperateEntityList = commonService.findHql(hql.toString(),yearmonth);
-
- List<String> orgTypeList=new ArrayList<String>();
- orgTypeList.add(Globals.org_type_3);
- orgTypeList.add(Globals.org_type_5);
- orgTypeList.add(Globals.org_type_2);
- projectDepartDto.getOrgTypeList().addAll(orgTypeList);
-
- String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- List<ProjectDepartDto> projectDepartDtoList=userDepartOrgDealMiniDao.getProjectDepartAll(projectDepartDto, authSql);
- Collections.sort(projectDepartDtoList, new Comparator<ProjectDepartDto>() {
- @Override
- public int compare(ProjectDepartDto o1, ProjectDepartDto o2) {
- String o1name = "";
- String o2name = "";
- if(o1.getDepartName() != null) {
- o1name = o1.getDepartName();
- }
- if(o2.getDepartName() != null) {
- o2name = o2.getDepartName();
- }
- return Collator.getInstance(Locale.CHINESE).compare(o1name,o2name);
- }
-
- });
- return projectDepartDtoList;
- }
- /* (non-Javadoc)
- * @see cn.com.lzt.dialogDeal.service.DialogDealServiceI#getProjectDepartAllWithChild(cn.com.lzt.arrangeduty.dto.ProjectDepartDto)
- */
- @Override
- public List<ProjectDepartDto> getProjectDepartAllWithChildren(ProjectDepartDto projectDepartDto) {
- List<String> orgTypeList=new ArrayList<String>();
- List<ProjectDepartDto> projectDepartDtoList = new ArrayList<ProjectDepartDto>();
- orgTypeList.add(Globals.org_type_2);
- orgTypeList.add(Globals.org_type_3);
- orgTypeList.add(Globals.org_type_5);
- projectDepartDto.getOrgTypeList().addAll(orgTypeList);
- String likename = projectDepartDto.getDepartName();
- projectDepartDto.setDepartName(null);
- Map<String, String> depargMap = getTSDepartByIdMap();
- String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
-
- List<ProjectDepartDto> userOrgDtoList=userDepartOrgDealMiniDao.getProjectDepartAllWithChildren(projectDepartDto, authSql);
- for (int i = 0; i < userOrgDtoList.size(); i++) {
- String departname = depargMap.get(userOrgDtoList.get(i).getId());
- if(likename != null && likename.length() > 0 && departname.indexOf(likename)<0) {
- continue;
- }
- if(departname != null) {
- userOrgDtoList.get(i).setDepartName(departname);
- }
- projectDepartDtoList.add(userOrgDtoList.get(i));
- }
- Collections.sort(projectDepartDtoList, new Comparator<ProjectDepartDto>() {
- @Override
- public int compare(ProjectDepartDto o1, ProjectDepartDto o2) {
- String o1name = "";
- String o2name = "";
- if(o1.getDepartName() != null) {
- o1name = o1.getDepartName();
- }
- if(o2.getDepartName() != null) {
- o2name = o2.getDepartName();
- }
- return Collator.getInstance(Locale.CHINESE).compare(o1name,o2name);
- }
-
- });
- return projectDepartDtoList;
- }
- /*@Override
- public List<ElementDto> getElementAll(ElementDto elementDto) {
- List<ElementDto> elementDtos = new ArrayList<>();
- QueryWrapper<TBArchivesRoadSection> sectionQueryWrapper = new QueryWrapper<>();
- QueryWrapper<TBArchivesPlace> tbArchivesPlaceQueryWrapper = new QueryWrapper<>();
- if(elementDto.getCode()!= null){
- sectionQueryWrapper.lambda().like(TBArchivesRoadSection::getCode, elementDto.getCode());
- tbArchivesPlaceQueryWrapper.lambda().like(TBArchivesPlace::getCode, elementDto.getCode());
- }
- if(elementDto.getName()!= null){
- sectionQueryWrapper.lambda().like(TBArchivesRoadSection::getName, elementDto.getName());
- tbArchivesPlaceQueryWrapper.lambda().like(TBArchivesPlace::getName, elementDto.getName());
- }
- if("".equals(elementDto.getType()) || elementDto.getType() == null){
- List<TBArchivesRoadSection> archivesRoadSectionList = tbArchivesRoadSectionService.list(sectionQueryWrapper);
- archivesRoadSectionList.forEach((item)->{
- ElementDto dto = new ElementDto();
- dto.setCode(item.getCode());
- dto.setName(item.getName());
- dto.setType("路段");
- elementDtos.add(dto);
- });
- List<TBArchivesPlace> archivesPlaceList = tbArchivesPlaceService.list(tbArchivesPlaceQueryWrapper);
- archivesPlaceList.forEach((item)->{
- ElementDto dto = new ElementDto();
- dto.setCode(item.getCode());
- dto.setName(item.getName());
- dto.setType(String.valueOf(item.getType()));
- elementDtos.add(dto);
- });
- }else if("路段".equals(elementDto.getType())){
- List<TBArchivesRoadSection> archivesRoadSectionList = tbArchivesRoadSectionService.list(sectionQueryWrapper);
- archivesRoadSectionList.forEach((item)->{
- ElementDto dto = new ElementDto();
- dto.setCode(item.getCode());
- dto.setName(item.getName());
- dto.setType("路段");
- elementDtos.add(dto);
- });
- }else{
- tbArchivesPlaceQueryWrapper.lambda().eq(TBArchivesPlace::getType,elementDto.getType());
- List<TBArchivesPlace> archivesPlaceList = tbArchivesPlaceService.list(tbArchivesPlaceQueryWrapper);
- archivesPlaceList.forEach((item)->{
- ElementDto dto = new ElementDto();
- dto.setCode(item.getCode());
- dto.setName(item.getName());
- dto.setType(String.valueOf(item.getType()));
- elementDtos.add(dto);
- });
- }
- return elementDtos;
- }*/
- /**
- * 1123 由场所,路段 -> 作业元素表数据 (区域,路段) 1130 -> +场所
- * @param elementDto
- * @return
- */
- @Override
- public List<ElementDto> getElementAll(ElementDto elementDto) {
- List<ElementDto> elementDtos = new ArrayList<>();
- LambdaQueryWrapper<TBArchivesArea> wrapper = new LambdaQueryWrapper<>();
- if(elementDto.getCode() != null){
- wrapper.like(TBArchivesArea::getCode, elementDto.getCode());
- }
- if(elementDto.getName() != null){
- wrapper.like(TBArchivesArea::getName, elementDto.getName());
- }
- if(elementDto.getType() != null){
- wrapper.eq(TBArchivesArea::getAreaType, elementDto.getType());
- }
- List<TBArchivesArea> list = tbArchivesAreaMapper.selectList(wrapper);
- // List<TBArchivesArea> list = tbArchivesAreaService.list(wrapper);
- for (TBArchivesArea li : list) {
- ElementDto dto = new ElementDto();
- dto.setCode(li.getCode());
- dto.setName(li.getName());
- dto.setType(EleTypeEnum.nameForCode(li.getAreaType()));
- elementDtos.add(dto);
- }
- return elementDtos;
- }
- }
|