bug修复,项目管理接口逻辑完善
This commit is contained in:
@ -105,7 +105,9 @@ public class SysDept extends BaseEntity
|
|||||||
@ApiModelProperty("部门管理的项目id")
|
@ApiModelProperty("部门管理的项目id")
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
|
/** 机构的行政级别(3县4镇5村) */
|
||||||
|
@ApiModelProperty("机构的行政级别(3县4镇5村)")
|
||||||
|
private Integer administrativeLevel;
|
||||||
//业务字段-----------------------------------------------------------------------------------------------------------
|
//业务字段-----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
/** 父部门名称 */
|
/** 父部门名称 */
|
||||||
|
@ -64,11 +64,9 @@ public class ProjectDataIsolationInterceptor implements HandlerInterceptor {
|
|||||||
for (Cookie cookie : requestCookies){
|
for (Cookie cookie : requestCookies){
|
||||||
//获取cookie中的projectIds
|
//获取cookie中的projectIds
|
||||||
if ("projectIds".equals(cookie.getName())) {
|
if ("projectIds".equals(cookie.getName())) {
|
||||||
byte[] decode = Base64.decode(cookie.getValue());
|
|
||||||
//转成List集合
|
if (StringUtils.isNotBlank(cookie.getValue())) {
|
||||||
String decodedStr = new String(decode);
|
JSONArray objects = JSONUtil.parseArray(cookie.getValue());
|
||||||
if (StringUtils.isNotBlank(decodedStr)) {
|
|
||||||
JSONArray objects = JSONUtil.parseArray(decodedStr);
|
|
||||||
projectInfo.setProjectIdList(objects.toList(Long.class));
|
projectInfo.setProjectIdList(objects.toList(Long.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,22 +83,6 @@ public class ProjectDataIsolationInterceptor implements HandlerInterceptor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
ProjectHolder.setProjectInfo(projectInfo);
|
ProjectHolder.setProjectInfo(projectInfo);
|
||||||
|
|
||||||
// //获取路径中的查询字符串参数
|
|
||||||
// String projectIds = request.getParameter("projectIds");
|
|
||||||
//
|
|
||||||
// //为空则是超级管理员不做数据隔离
|
|
||||||
// if (StringUtils.isBlank(projectIds)) {
|
|
||||||
// ProjectHolder.setProjectInfo(ProjectInfo.builder().projectId("").build());
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// byte[] decode = Base64.decode(projectIds);
|
|
||||||
// //转成List集合
|
|
||||||
// String decodedStr = new String(decode);
|
|
||||||
// JSONArray objects = JSONUtil.parseArray(decodedStr);
|
|
||||||
// ProjectHolder.setProjectInfo(ProjectInfo.builder()
|
|
||||||
// .projectIdList(objects.toList(Long.class))
|
|
||||||
// .build());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.fastbee.ggroup.domain.vo;
|
package com.fastbee.ggroup.domain.vo;
|
||||||
|
|
||||||
|
import com.fastbee.common.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -13,7 +15,8 @@ public class GGroupSiteVo {
|
|||||||
private String type; // 对应 gs.type
|
private String type; // 对应 gs.type
|
||||||
private String space; // 对应 gs.space
|
private String space; // 对应 gs.space
|
||||||
private String spaceValue; // 对应 gs.space
|
private String spaceValue; // 对应 gs.space
|
||||||
private String areaCode;// 对应 gs.area_code
|
private String areaCode;// 对应 站点行政区划代码
|
||||||
|
private String fullAreaCode;//站点行政区划完整代码
|
||||||
|
|
||||||
|
|
||||||
// Getter 和 Setter
|
// Getter 和 Setter
|
||||||
|
@ -83,7 +83,8 @@ public class GGroupsServiceImpl implements IGGroupsService
|
|||||||
.select(GSiteGroups::getId, GSiteGroups::getParentId, GSiteGroups::getSiteId)
|
.select(GSiteGroups::getId, GSiteGroups::getParentId, GSiteGroups::getSiteId)
|
||||||
// .select(GGroups::getName)//起个别名
|
// .select(GGroups::getName)//起个别名
|
||||||
// .selectAs(GGroups::getName, "parentName")
|
// .selectAs(GGroups::getName, "parentName")
|
||||||
.select(GSites::getName, GSites::getIcon, GSites::getType, GSites::getSpace, GSites::getSpaceValue)
|
.select(GSites::getName, GSites::getIcon, GSites::getType, GSites::getSpace, GSites::getSpaceValue,
|
||||||
|
GSites::getAreaCode,GSites::getFullAreaCode)
|
||||||
.leftJoin(GGroups.class, GGroups::getId, GSiteGroups::getParentId)
|
.leftJoin(GGroups.class, GGroups::getId, GSiteGroups::getParentId)
|
||||||
.leftJoin(GSites.class, GSites::getId, GSiteGroups::getSiteId)
|
.leftJoin(GSites.class, GSites::getId, GSiteGroups::getSiteId)
|
||||||
.eq(GSiteGroups::getParentId, gGroups.getParentId())
|
.eq(GSiteGroups::getParentId, gGroups.getParentId())
|
||||||
@ -175,7 +176,8 @@ public class GGroupsServiceImpl implements IGGroupsService
|
|||||||
public List<GGroupSiteVo> selectGGroupsAllListSites(GGroups gGroups) {
|
public List<GGroupSiteVo> selectGGroupsAllListSites(GGroups gGroups) {
|
||||||
MPJLambdaWrapper<GSiteGroups> gSiteGroupsMPJLambdaWrapper = new MPJLambdaWrapper<GSiteGroups>()
|
MPJLambdaWrapper<GSiteGroups> gSiteGroupsMPJLambdaWrapper = new MPJLambdaWrapper<GSiteGroups>()
|
||||||
.select(GSiteGroups::getId, GSiteGroups::getParentId, GSiteGroups::getSiteId)
|
.select(GSiteGroups::getId, GSiteGroups::getParentId, GSiteGroups::getSiteId)
|
||||||
.select(GSites::getName, GSites::getIcon, GSites::getType, GSites::getSpace, GSites::getSpaceValue,GSites::getAreaCode)
|
.select(GSites::getName, GSites::getIcon, GSites::getType, GSites::getSpace,
|
||||||
|
GSites::getSpaceValue,GSites::getAreaCode,GSites::getFullAreaCode)
|
||||||
.leftJoin(GGroups.class, GGroups::getId, GSiteGroups::getParentId)
|
.leftJoin(GGroups.class, GGroups::getId, GSiteGroups::getParentId)
|
||||||
.leftJoin(GSites.class, GSites::getId, GSiteGroups::getSiteId)
|
.leftJoin(GSites.class, GSites::getId, GSiteGroups::getSiteId)
|
||||||
.in(!ProjectHolder.getProjectInfo().getProjectIdList().isEmpty(),GGroups::getProjectId,ProjectHolder.getProjectInfo().getProjectIdList());
|
.in(!ProjectHolder.getProjectInfo().getProjectIdList().isEmpty(),GGroups::getProjectId,ProjectHolder.getProjectInfo().getProjectIdList());
|
||||||
|
@ -3,6 +3,8 @@ package com.fastbee.ggroup.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +64,7 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
|
|||||||
@Override
|
@Override
|
||||||
public List<GSites> selectGSitesList(GSitesSelectDto gSites) {
|
public List<GSites> selectGSitesList(GSitesSelectDto gSites) {
|
||||||
return new LambdaQueryChainWrapper<>(gSitesMapper)
|
return new LambdaQueryChainWrapper<>(gSitesMapper)
|
||||||
.select(GSites::getId, GSites::getName, GSites::getIcon, GSites::getType)
|
.select(GSites::getId, GSites::getName, GSites::getIcon, GSites::getType,GSites::getAreaCode,GSites::getFullAreaCode)
|
||||||
.eq(GSites::getProjectId, gSites.getProjectId())
|
.eq(GSites::getProjectId, gSites.getProjectId())
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
@ -149,9 +151,9 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
|
|||||||
JSONArray jsonArray = JSONUtil.parseArray(coordinates);
|
JSONArray jsonArray = JSONUtil.parseArray(coordinates);
|
||||||
//判断数组每个元素必须为经度或纬度
|
//判断数组每个元素必须为经度或纬度
|
||||||
for (Object o : jsonArray) {
|
for (Object o : jsonArray) {
|
||||||
if(isLongitudeOrLatitude(o.toString())){
|
/* if(isLongitudeOrLatitude(o.toString())){
|
||||||
throw new ServiceException("coordinates数组元素必须为经度或纬度!");
|
throw new ServiceException("coordinates数组元素必须为经度或纬度!");
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int startIndex = space.indexOf("/profile/upload/");
|
int startIndex = space.indexOf("/profile/upload/");
|
||||||
@ -161,25 +163,26 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断字符串是不是经度或者纬度
|
* 判断字符串是不是经度或者纬度
|
||||||
* @param str 经纬度字符串
|
* @param str 经纬度字符串
|
||||||
* @return true or false
|
* @return true 或 false
|
||||||
*/
|
*/
|
||||||
private boolean isLongitudeOrLatitude(String str) {
|
private boolean isLongitudeOrLatitude(String str) {
|
||||||
String regex = "^[-+]?\\d{1,3}\\.\\d+$";
|
String regex = "^[-+]?\\d{1,3}(\\.\\d+)?$"; // 修改了正则表达式的格式,允许有或无小数部分
|
||||||
double value = Double.parseDouble(str);
|
Pattern pattern = Pattern.compile(regex);
|
||||||
//满足经度值
|
Matcher matcher = pattern.matcher(str);
|
||||||
if (value >= -180 && value <= 180) {
|
|
||||||
return true;
|
// 如果字符串匹配正则表达式且值的范围在经纬度范围内,则返回 true
|
||||||
}
|
return matcher.matches() && isValueInRange(str);
|
||||||
//满足纬度值
|
|
||||||
else if (value >= -90 && value <= 90) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isValueInRange(String str) {
|
||||||
|
double value = Double.parseDouble(str);
|
||||||
|
return value >= -180 && value <= 180; // 经度范围
|
||||||
|
// 如果需要判断纬度,则再添加一行判断逻辑:else if (value >= -90 && value <= 90) return true; 或者根据需要合并到一行判断中。
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改站点
|
* 修改站点
|
||||||
|
@ -168,5 +168,9 @@ public class Project extends BaseEntity
|
|||||||
* 确认密码
|
* 确认密码
|
||||||
*/
|
*/
|
||||||
private String confirmPassword;
|
private String confirmPassword;
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import com.fastbee.common.core.domain.entity.SysUser;
|
|||||||
import com.fastbee.common.exception.ServiceException;
|
import com.fastbee.common.exception.ServiceException;
|
||||||
import com.fastbee.common.holder.ProjectHolder;
|
import com.fastbee.common.holder.ProjectHolder;
|
||||||
import com.fastbee.common.utils.DateUtils;
|
import com.fastbee.common.utils.DateUtils;
|
||||||
|
import com.fastbee.framework.web.domain.server.Sys;
|
||||||
import com.fastbee.iot.model.RegisterUserInput;
|
import com.fastbee.iot.model.RegisterUserInput;
|
||||||
import com.fastbee.iot.model.RegisterUserOutput;
|
import com.fastbee.iot.model.RegisterUserOutput;
|
||||||
import com.fastbee.iot.service.IToolService;
|
import com.fastbee.iot.service.IToolService;
|
||||||
@ -77,17 +78,30 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Project selectProjectByProjectId(Long projectId)
|
public Project selectProjectByProjectId(Long projectId)
|
||||||
{
|
{ //查询项目信息
|
||||||
List<Project> projectList = new LambdaQueryChainWrapper<>(projectMapper)
|
List<Project> projectList = new LambdaQueryChainWrapper<>(projectMapper)
|
||||||
.select(Project::getProjectName, Project::getSysShowName, Project::getCentralCoordinates, Project::getScope,
|
.select(Project::getProjectName, Project::getSysShowName, Project::getCentralCoordinates, Project::getScope,
|
||||||
Project::getAdministrativeAreaCode, Project::getLevel, Project::getDeptId, Project::getDeptName,
|
Project::getAdministrativeAreaCode, Project::getLevel, Project::getDeptId, Project::getDeptName,
|
||||||
Project::getVideoIntroduction, Project::getImage, Project::getLogo, Project::getRemark)
|
Project::getVideoIntroduction, Project::getImage, Project::getLogo, Project::getRemark)
|
||||||
.eq(Project::getId, projectId)
|
.eq(Project::getId, projectId)
|
||||||
.list();
|
.list();
|
||||||
|
//查询项目管理员信息
|
||||||
|
List<SysUser> list = new LambdaQueryChainWrapper<>(sysUserMapper)
|
||||||
|
.select(SysUser::getUserId, SysUser::getUserName, SysUser::getPhonenumber)
|
||||||
|
.eq(SysUser::getDeptId, projectList.get(0).getDeptId())
|
||||||
|
.list();
|
||||||
|
|
||||||
if(projectList.isEmpty()){
|
if(projectList.isEmpty()){
|
||||||
throw new ServiceException("项目不存在!");
|
throw new ServiceException("项目不存在!");
|
||||||
}
|
}
|
||||||
return projectList.get(0);
|
if(list.isEmpty()){
|
||||||
|
throw new ServiceException("项目机构管理员不存在!");
|
||||||
|
}
|
||||||
|
Project project = projectList.get(0);
|
||||||
|
project.setUserName(list.get(0).getUserName());
|
||||||
|
project.setPhoneNumber(list.get(0).getPhonenumber());
|
||||||
|
|
||||||
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,13 +127,6 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertProject(Project project)
|
public int insertProject(Project project)
|
||||||
{
|
{
|
||||||
//判断选择的机构下是否已经绑定项目
|
|
||||||
// List<Project> projectList = new LambdaQueryChainWrapper<>(projectMapper)
|
|
||||||
// .select(Project::getId, Project::getProjectName)
|
|
||||||
// .eq(Project::getDeptId, project.getDeptId()).list();
|
|
||||||
// if(!projectList.isEmpty()){
|
|
||||||
// throw new ServiceException("该机构下已经存在项目");
|
|
||||||
// }
|
|
||||||
//TODO 参数校验
|
//TODO 参数校验
|
||||||
//获取当前时间
|
//获取当前时间
|
||||||
Date nowDate = DateUtils.getNowDate();
|
Date nowDate = DateUtils.getNowDate();
|
||||||
@ -135,7 +142,10 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
newSysDept.setCreateTime(nowDate);
|
newSysDept.setCreateTime(nowDate);
|
||||||
//设置默认机构名称
|
//设置默认机构名称
|
||||||
newSysDept.setDeptName(project.getProjectName());
|
newSysDept.setDeptName(project.getProjectName());
|
||||||
newSysDept.setLeader("admin");
|
//设置默认机构类型
|
||||||
|
newSysDept.setDeptType(3);
|
||||||
|
//设置机构领导
|
||||||
|
newSysDept.setLeader("hanzhen");
|
||||||
|
|
||||||
//设置机构型行政区域信息
|
//设置机构型行政区域信息
|
||||||
newSysDept.setAdministrativeAreaCode(Objects.nonNull(project.getAdministrativeAreaCode())?project.getAdministrativeAreaCode():null);
|
newSysDept.setAdministrativeAreaCode(Objects.nonNull(project.getAdministrativeAreaCode())?project.getAdministrativeAreaCode():null);
|
||||||
@ -150,11 +160,13 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
throw new ServiceException("创建默认机构失败!");
|
throw new ServiceException("创建默认机构失败!");
|
||||||
}
|
}
|
||||||
// 新增机构关联系统账号
|
// 新增机构关联系统账号
|
||||||
|
|
||||||
// 添加管理员角色,给所有权限
|
// 添加管理员角色,给所有权限
|
||||||
SysDept sysDept = deptService.selectDeptById(100L);
|
SysDept sysDept = deptService.selectDeptById(100L);
|
||||||
List<SysMenu> sysMenuList = sysMenuService.selectMenuList(new SysMenu(), sysDept.getDeptUserId());
|
List<SysMenu> sysMenuList = sysMenuService.selectMenuList(new SysMenu(), sysDept.getDeptUserId());
|
||||||
Long[] menuIdList = sysMenuList.stream().map(SysMenu::getMenuId).toArray(Long[]::new);
|
Long[] menuIdList = sysMenuList.stream().map(SysMenu::getMenuId)
|
||||||
|
.filter(menuId-> menuId!=3469L&&menuId!=3L&&menuId!=2L)
|
||||||
|
.
|
||||||
|
toArray(Long[]::new);
|
||||||
SysRole sysRole = new SysRole();
|
SysRole sysRole = new SysRole();
|
||||||
sysRole.setRoleName("管理员");
|
sysRole.setRoleName("管理员");
|
||||||
sysRole.setRoleKey("manager");
|
sysRole.setRoleKey("manager");
|
||||||
@ -168,7 +180,7 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
RegisterUserInput registerUserInput = new RegisterUserInput();
|
RegisterUserInput registerUserInput = new RegisterUserInput();
|
||||||
registerUserInput.setUsername(project.getUserName());
|
registerUserInput.setUsername(project.getUserName());
|
||||||
registerUserInput.setPassword(project.getPassword());
|
registerUserInput.setPassword(project.getPassword());
|
||||||
registerUserInput.setPhonenumber("15666617898");
|
registerUserInput.setPhonenumber(String.valueOf(UUID.randomUUID()).substring(5,9));
|
||||||
registerUserInput.setDeptId(newSysDept.getDeptId());
|
registerUserInput.setDeptId(newSysDept.getDeptId());
|
||||||
registerUserInput.setRoleIds(new Long[]{sysRole.getRoleId()});
|
registerUserInput.setRoleIds(new Long[]{sysRole.getRoleId()});
|
||||||
RegisterUserOutput registerUserOutput = toolService.registerNoCaptcha(registerUserInput);
|
RegisterUserOutput registerUserOutput = toolService.registerNoCaptcha(registerUserInput);
|
||||||
@ -180,21 +192,8 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
// 更新机构管理员角色绑定信息
|
// 更新机构管理员角色绑定信息
|
||||||
deptService.updateDeptUserId(newSysDept.getDeptId(), registerUserOutput.getSysUserId());
|
deptService.updateDeptUserId(newSysDept.getDeptId(), registerUserOutput.getSysUserId());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// //创建该机构的登录账号数据
|
|
||||||
// SysUser newSysUser = new SysUser();
|
|
||||||
// newSysUser.setUserName(project.getUserName());
|
|
||||||
// newSysUser.setPassword(project.getPassword());
|
|
||||||
// newSysUser.setNickName(project.getProjectName()+"管理员");
|
|
||||||
// newSysUser.setDeptId(newSysDept.getDeptId());
|
|
||||||
// newSysUser.setCreateTime(nowDate);
|
|
||||||
// newSysUser.setCreateBy(project.getCreateBy());
|
|
||||||
//
|
|
||||||
// if(sysUserMapper.insertUser(newSysUser)<1){
|
|
||||||
// throw new ServiceException("创建默认机构管理员账号失败!");
|
|
||||||
// }
|
|
||||||
project.setDeptId(newSysDept.getDeptId());
|
project.setDeptId(newSysDept.getDeptId());
|
||||||
|
project.setDeptName(project.getProjectName());
|
||||||
project.setCreateTime(DateUtils.getNowDate());
|
project.setCreateTime(DateUtils.getNowDate());
|
||||||
return projectMapper.insertProject(project);
|
return projectMapper.insertProject(project);
|
||||||
}
|
}
|
||||||
@ -335,28 +334,44 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
.select(SysUser::getUserId, SysUser::getDeptId)
|
.select(SysUser::getUserId, SysUser::getDeptId)
|
||||||
.eq(SysUser::getUserId, userId)
|
.eq(SysUser::getUserId, userId)
|
||||||
.one();
|
.one();
|
||||||
|
//查询机构
|
||||||
|
SysDept sysDept = new LambdaQueryChainWrapper<>(sysDeptMapper)
|
||||||
|
.select(SysDept::getProvinceCode, SysDept::getCityCode, SysDept::getCountyCode,
|
||||||
|
SysDept::getTownCode, SysDept::getVillageCode,SysDept::getAdministrativeLevel,SysDept::getProjectId)
|
||||||
|
.eq(SysDept::getDeptId, sysUser.getDeptId())
|
||||||
|
.one();
|
||||||
|
if(Objects.isNull(sysDept)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
//查询该管理员所管理的项目id以及子项目id列表
|
//查询该管理员所管理的项目id以及子项目id列表
|
||||||
Project project = new LambdaQueryChainWrapper<>(projectMapper)
|
Project project = new LambdaQueryChainWrapper<>(projectMapper)
|
||||||
.select(Project::getId, Project::getProjectName,Project::getLevel,Project::getDeptId
|
.select(Project::getId, Project::getProjectName,Project::getLevel,Project::getDeptId
|
||||||
,Project::getCityCode,Project::getCountyCode)
|
,Project::getCityCode,Project::getCountyCode)
|
||||||
.eq(Project::getDeptId, sysUser.getDeptId())
|
.eq(Project::getId, sysDept.getProjectId())
|
||||||
.one();
|
.one();
|
||||||
if(Objects.isNull(project)){
|
if(Objects.isNull(project)){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询项目对应行政区划的地图轮廓数据
|
//查询项目对应行政区划的地图轮廓数据
|
||||||
List<SysDistrict> sysDistrictList = new LambdaQueryChainWrapper<>(sysDistrictMapper)
|
LambdaQueryChainWrapper<SysDistrict> sysDistrictLambdaQueryChainWrapper = new LambdaQueryChainWrapper<>(sysDistrictMapper)
|
||||||
.select(SysDistrict::getMapOutline, SysDistrict::getMapOutlineUrl,SysDistrict::getLng,SysDistrict::getLat)
|
.select(SysDistrict::getMapOutline, SysDistrict::getMapOutlineUrl, SysDistrict::getLng, SysDistrict::getLat);
|
||||||
.eq(SysDistrict::getAdcode, JSONUtil.parseArray(project.getCountyCode()).get(0))
|
if(sysDept.getAdministrativeLevel() == 3){
|
||||||
|
sysDistrictLambdaQueryChainWrapper.eq(SysDistrict::getAdcode, JSONUtil.parseArray(sysDept.getCountyCode()).get(0));
|
||||||
|
}
|
||||||
|
if(sysDept.getAdministrativeLevel() == 4){
|
||||||
|
sysDistrictLambdaQueryChainWrapper.eq(SysDistrict::getAdcode, JSONUtil.parseArray(sysDept.getTownCode()).get(0));
|
||||||
|
}
|
||||||
|
if(sysDept.getAdministrativeLevel() == 5){
|
||||||
|
sysDistrictLambdaQueryChainWrapper.eq(SysDistrict::getAdcode, JSONUtil.parseArray(sysDept.getVillageCode()).get(0));
|
||||||
|
}
|
||||||
|
List<SysDistrict> sysDistrictList = sysDistrictLambdaQueryChainWrapper
|
||||||
.list();
|
.list();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<Long> projects = getAllProjects(project.getId());
|
|
||||||
//把列表进行Base64编码
|
|
||||||
String projectsBase64 = Base64.encode(projects.toString());
|
|
||||||
HashMap<String , Object> map = new HashMap<>();
|
HashMap<String , Object> map = new HashMap<>();
|
||||||
map.put("projectIds",projectsBase64);
|
ArrayList<Long> projectIds = new ArrayList<>();
|
||||||
|
projectIds.add(project.getId());
|
||||||
|
map.put("projectIds",projectIds.toString());
|
||||||
map.put("projectId",project.getId());
|
map.put("projectId",project.getId());
|
||||||
map.put("projectName", project.getProjectName());
|
map.put("projectName", project.getProjectName());
|
||||||
|
|
||||||
@ -378,7 +393,6 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
map.put("longitude",sysDistrictList.get(0).getLng());
|
map.put("longitude",sysDistrictList.get(0).getLng());
|
||||||
map.put("latitude",sysDistrictList.get(0).getLat());
|
map.put("latitude",sysDistrictList.get(0).getLat());
|
||||||
}
|
}
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,11 +454,6 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
throw new ServiceException("超出行政级别查询范围(1~5级)!");
|
throw new ServiceException("超出行政级别查询范围(1~5级)!");
|
||||||
}
|
}
|
||||||
//查询项目的行政区划信息
|
//查询项目的行政区划信息
|
||||||
// Project project = new LambdaQueryChainWrapper<>(projectMapper)
|
|
||||||
// .select(Project::getProvinceCode, Project::getCityCode, Project::getCountyCode,
|
|
||||||
// Project::getTownCode, Project::getVillageCode)
|
|
||||||
// .eq(Project::getId, projectId)
|
|
||||||
// .one();
|
|
||||||
SysDept sysDept = new LambdaQueryChainWrapper<>(sysDeptMapper)
|
SysDept sysDept = new LambdaQueryChainWrapper<>(sysDeptMapper)
|
||||||
.select(SysDept::getDeptId,SysDept::getProvinceCode, SysDept::getCityCode, SysDept::getCountyCode,
|
.select(SysDept::getDeptId,SysDept::getProvinceCode, SysDept::getCityCode, SysDept::getCountyCode,
|
||||||
SysDept::getTownCode, SysDept::getVillageCode)
|
SysDept::getTownCode, SysDept::getVillageCode)
|
||||||
@ -464,15 +473,13 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
LambdaQueryChainWrapper<SysDistrict> sysDistrictLambdaQueryChainWrapper = new LambdaQueryChainWrapper<>(sysDistrictMapper)
|
LambdaQueryChainWrapper<SysDistrict> sysDistrictLambdaQueryChainWrapper = new LambdaQueryChainWrapper<>(sysDistrictMapper)
|
||||||
.select(SysDistrict::getId, SysDistrict::getParentId, SysDistrict::getName, SysDistrict::getAdcode,
|
.select(SysDistrict::getId, SysDistrict::getParentId, SysDistrict::getName, SysDistrict::getAdcode,
|
||||||
SysDistrict::getLevel, SysDistrict::getFullName, SysDistrict::getName
|
SysDistrict::getLevel, SysDistrict::getFullName, SysDistrict::getName
|
||||||
, SysDistrict::getLng, SysDistrict::getLat);
|
, SysDistrict::getLng, SysDistrict::getLat,SysDistrict::getMapOutline,SysDistrict::getMapOutlineUrl);
|
||||||
|
|
||||||
//限制行政区划级别
|
//限制行政区划级别
|
||||||
projectDistrictList = sysDistrictLambdaQueryChainWrapper
|
projectDistrictList = sysDistrictLambdaQueryChainWrapper
|
||||||
.in(!administrativeCodeList.isEmpty(),SysDistrict::getAdcode,administrativeCodeList)
|
.in(!administrativeCodeList.isEmpty(),SysDistrict::getAdcode,administrativeCodeList)
|
||||||
.list();
|
.list();
|
||||||
|
|
||||||
// System.err.println("项目所属县下面的所有镇、村行政区划列表");
|
|
||||||
// System.err.println(projectDistrictList);
|
|
||||||
//构建树状结构
|
//构建树状结构
|
||||||
return buildTree(projectDistrictList);
|
return buildTree(projectDistrictList);
|
||||||
}
|
}
|
||||||
@ -519,10 +526,6 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
distinctTownCodeList = townCodeList.stream().distinct().collect(Collectors.toList());
|
distinctTownCodeList = townCodeList.stream().distinct().collect(Collectors.toList());
|
||||||
JSONArray villageCodeList = JSONUtil.parseArray(sysDept.getVillageCode());
|
JSONArray villageCodeList = JSONUtil.parseArray(sysDept.getVillageCode());
|
||||||
|
|
||||||
// System.err.println("镇行政区划代码");
|
|
||||||
// System.err.println(distinctTownCodeList);
|
|
||||||
// System.err.println("村行政区划代码");
|
|
||||||
// System.err.println(villageCodeList);
|
|
||||||
//合并省、市、县、镇、村行政区划代码集合
|
//合并省、市、县、镇、村行政区划代码集合
|
||||||
List<Object> administrativeCodeList = new ArrayList<>();
|
List<Object> administrativeCodeList = new ArrayList<>();
|
||||||
int[] startLevels = {1, 2, 3, 4, 5};
|
int[] startLevels = {1, 2, 3, 4, 5};
|
||||||
@ -542,9 +545,9 @@ public class ProjectServiceImpl implements IProjectService
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void isProvinceCodeBlank(SysDept sysDept) {
|
private void isProvinceCodeBlank(SysDept sysDept) {
|
||||||
// if(sysDept.getDeptId().toString().equals("100")){
|
if(sysDept.getDeptId().toString().equals("100")){
|
||||||
// return ;
|
return ;
|
||||||
// }
|
}
|
||||||
if (StringUtils.isBlank(sysDept.getProvinceCode())){
|
if (StringUtils.isBlank(sysDept.getProvinceCode())){
|
||||||
throw new ServiceException("项目省级行政区划信息缺失!");
|
throw new ServiceException("项目省级行政区划信息缺失!");
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<resultMap type="SysDept" id="SysDeptResult">
|
<resultMap type="SysDept" id="SysDeptResult">
|
||||||
<id property="deptId" column="dept_id" />
|
<id property="deptId" column="dept_id" />
|
||||||
<result property="deptUserId" column="dept_user_id" />
|
<result property="deptUserId" column="dept_user_id" />
|
||||||
<result property="parentId" column="parent_id" />
|
<result property="parentId" column="parent_id" />
|
||||||
<result property="ancestors" column="ancestors" />
|
<result property="ancestors" column="ancestors" />
|
||||||
<result property="deptName" column="dept_name" />
|
<result property="deptName" column="dept_name" />
|
||||||
@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDeptVo">
|
<sql id="selectDeptVo">
|
||||||
select d.dept_id, d.dept_user_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, d.dept_type
|
select d.dept_id, d.dept_user_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, d.dept_type,d.administrative_level
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
|
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
|
||||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.dept_type, d.dept_user_id,d.administrative_area_code,
|
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.dept_type, d.dept_user_id,d.administrative_level,d.administrative_area_code,
|
||||||
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
|
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
where d.dept_id = #{deptId}
|
where d.dept_id = #{deptId}
|
||||||
@ -178,6 +178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="townCode != null">town_code,</if>
|
<if test="townCode != null">town_code,</if>
|
||||||
<if test="villageCode != null">village_code,</if>
|
<if test="villageCode != null">village_code,</if>
|
||||||
<if test="projectId != null">project_id,</if>
|
<if test="projectId != null">project_id,</if>
|
||||||
|
<if test="administrativeLevel != null">administrative_level,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="deptUserId != null">#{deptUserId},</if>
|
<if test="deptUserId != null">#{deptUserId},</if>
|
||||||
@ -203,6 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="townCode != null">#{townCode},</if>
|
<if test="townCode != null">#{townCode},</if>
|
||||||
<if test="villageCode != null">#{villageCode},</if>
|
<if test="villageCode != null">#{villageCode},</if>
|
||||||
<if test="projectId != null">#{projectId},</if>
|
<if test="projectId != null">#{projectId},</if>
|
||||||
|
<if test="administrativeLevel != null">#{administrativeLevel},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -250,6 +252,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="townCode != null">town_code = #{townCode},</if>
|
<if test="townCode != null">town_code = #{townCode},</if>
|
||||||
<if test="villageCode != null">village_code = #{villageCode},</if>
|
<if test="villageCode != null">village_code = #{villageCode},</if>
|
||||||
<if test="projectId != null">project_id = #{projectId},</if>
|
<if test="projectId != null">project_id = #{projectId},</if>
|
||||||
|
<if test="administrativeLevel != null">administrative_level = #{administrativeLevel},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where dept_id = #{deptId}
|
where dept_id = #{deptId}
|
||||||
</update>
|
</update>
|
||||||
|
Reference in New Issue
Block a user