|
|
@ -1,22 +1,26 @@
|
|
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import com.ruoyi.common.constant.UserConstants;
|
|
|
|
import com.ruoyi.common.constant.UserConstants;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
import com.ruoyi.common.utils.DictUtils;
|
|
|
|
import com.ruoyi.common.utils.DictUtils;
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
import com.ruoyi.system.mapper.SysDictDataMapper;
|
|
|
|
import com.ruoyi.system.mapper.SysDictDataMapper;
|
|
|
|
import com.ruoyi.system.mapper.SysDictTypeMapper;
|
|
|
|
import com.ruoyi.system.mapper.SysDictTypeMapper;
|
|
|
|
|
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
|
import com.ruoyi.system.service.ISysDictTypeService;
|
|
|
|
import com.ruoyi.system.service.ISysDictTypeService;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 字典 业务层处理
|
|
|
|
* 字典 业务层处理
|
|
|
@ -32,6 +36,9 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private SysDictDataMapper dictDataMapper;
|
|
|
|
private SysDictDataMapper dictDataMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ISysDeptService deptService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 项目启动时,初始化字典到缓存
|
|
|
|
* 项目启动时,初始化字典到缓存
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -111,6 +118,28 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
|
|
|
return dictTypeMapper.selectDictTypeByType(dictType);
|
|
|
|
return dictTypeMapper.selectDictTypeByType(dictType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 添加隐患时,若当前账号是乡镇街道,那么企业地址为本乡镇街道
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<SysDictData> getAdminArea() {
|
|
|
|
|
|
|
|
// 获取登录账号部门名称
|
|
|
|
|
|
|
|
Long deptId = SecurityUtils.getLoginUser().getDeptId();
|
|
|
|
|
|
|
|
String deptName = deptService.selectDeptById(deptId).getDeptName();
|
|
|
|
|
|
|
|
// 获取乡镇街道名称集合
|
|
|
|
|
|
|
|
String dictType = "area_id";
|
|
|
|
|
|
|
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
|
|
|
|
|
|
|
List<String> deptNameList = dictDatas.stream().map(SysDictData::getDictLabel).collect(Collectors.toList());
|
|
|
|
|
|
|
|
// 如果当前登录账号是乡镇街道的话
|
|
|
|
|
|
|
|
if (deptNameList.contains(deptName)) {
|
|
|
|
|
|
|
|
List<SysDictData> collect = dictDatas.stream()
|
|
|
|
|
|
|
|
.filter(item -> Objects.equals(item.getDictLabel(), deptName))
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
return collect;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return dictDatas;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 批量删除字典类型信息
|
|
|
|
* 批量删除字典类型信息
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -220,4 +249,5 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return UserConstants.UNIQUE;
|
|
|
|
return UserConstants.UNIQUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|