Commit a4ac552a authored by lixuan's avatar lixuan

Merge branch 'dev' into 'dev-lx'

Dev

See merge request !171
parents 4c1334ea 6867e8c3
...@@ -13,6 +13,7 @@ variables: ...@@ -13,6 +13,7 @@ variables:
IMAGESTREAM: yichengstreet-be #项目英文名 IMAGESTREAM: yichengstreet-be #项目英文名
TAG: $CI_COMMIT_REF_NAME TAG: $CI_COMMIT_REF_NAME
cache: cache:
paths: paths:
- .m2/repository2 - .m2/repository2
...@@ -33,6 +34,7 @@ package: ...@@ -33,6 +34,7 @@ package:
image: hub.eazytec-cloud.com/devops/maven:3.3.9-jdk-8 image: hub.eazytec-cloud.com/devops/maven:3.3.9-jdk-8
only: only:
- main - main
- dev
deploy: deploy:
...@@ -51,6 +53,7 @@ deploy: ...@@ -51,6 +53,7 @@ deploy:
- docker push ${REPO}/${NAMESPACE}/${IMAGE}:${TAG} - docker push ${REPO}/${NAMESPACE}/${IMAGE}:${TAG}
only: only:
- main - main
- dev
# publish: # publish:
# image: hub.eazytec-cloud.com/devops/oc:3.11 # image: hub.eazytec-cloud.com/devops/oc:3.11
......
package com.ruoyi.web.controller.other;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.system.domain.other.MapEntity;
import com.ruoyi.system.service.other.MapEntityService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/map")
@Api(tags = "地图")
public class MapEntityController extends BaseController {
@Autowired
private MapEntityService mapEntityService;
@RequestMapping(value = "/getAllMapEntities",method = RequestMethod.GET)
@ResponseBody
public List<MapEntity> getAllMapEntities(@RequestParam(name = "level") String level) {
return mapEntityService.getAllMapEntitiesByLevel(level);
}
@RequestMapping(value = "/getMapEntityById",method = RequestMethod.GET)
@ResponseBody
public MapEntity getMapEntityById(@RequestParam(name = "id") String id) {
return mapEntityService.getMapEntityById(id);
}
@RequestMapping(value = "/addMapEntity",method = RequestMethod.POST)
@ResponseBody
public MapEntity addMapEntityById(@RequestBody MapEntity mapEntity) {
return mapEntityService.addMapEntityById(mapEntity);
}
@RequestMapping(value = "/updateMapEntity",method = RequestMethod.POST)
@ResponseBody
public MapEntity updateMapEntity(@RequestBody MapEntity mapEntity) {
return mapEntityService.updateMapEntity(mapEntity.getId(), mapEntity);
}
@RequestMapping(value = "/deleteMapEntity",method = RequestMethod.DELETE)
@ResponseBody
public void deleteMapEntity(@RequestParam(name = "id") String id) {
mapEntityService.deleteMapEntity(id);
}
}
...@@ -72,13 +72,14 @@ spring: ...@@ -72,13 +72,14 @@ spring:
# redis 配置 # redis 配置
redis: redis:
# 地址 # 地址
host: redis host: redis-prod.yx-street.svc.cluster.local
# 端口,默认为6379 # 端口,默认为6379
port: 6379 port: 6379
# 数据库索引 # 数据库索引
database: 0 database: 0
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
password: digital
lettuce: lettuce:
pool: pool:
# 连接池中的最小空闲连接 # 连接池中的最小空闲连接
...@@ -95,16 +96,16 @@ spring: ...@@ -95,16 +96,16 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://192.168.70.2:3306/yichengstreet?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 url: jdbc:mysql://mysql-prod.yx-street.svc.cluster.local:3306/yichengstreet?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username: root username: root
password: Zhuo@2023 password: P@44w0rd
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭
enabled: true enabled: true
url: jdbc:mysql://192.168.70.2:3306/yichengstreet-party?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 url: jdbc:mysql://mysql-prod.yx-street.svc.cluster.local:3306/yichengstreet-party?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username: root username: root
password: Zhuo@2023 password: P@44w0rd
# 初始连接数 # 初始连接数
initialSize: 5 initialSize: 5
# 最小连接池数量 # 最小连接池数量
......
...@@ -107,6 +107,18 @@ public class GridRegion implements Serializable { ...@@ -107,6 +107,18 @@ public class GridRegion implements Serializable {
private String status; private String status;
private String pName;
private String pId;
public String getpName(){return pName;}
public void setpName(String pName){this.pName = pName;}
public String getpId(){return pId;}
public void setpId(String pId){this.pId = pId;}
public String getStatus(){return status;} public String getStatus(){return status;}
public void setStatus(String status){this.status=status;} public void setStatus(String status){this.status=status;}
......
package com.ruoyi.system.domain.other;
public class MapEntity {
private String id;
// 类型
private String type;
// 上级主体
private String parentEntity;
// 主体编码
private String entityCode;
// 主体名称
private String entityName;
// 二维码
private String qrCode;
// 主体范围
private String entityScope;
// 坐标地址
private String coordinateAddress;
// 是否有效
private int isValid;
// 主体层级
private int entityLevel;
// Getters 和 Setters 方法
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getParentEntity() {
return parentEntity;
}
public void setParentEntity(String parentEntity) {
this.parentEntity = parentEntity;
}
public String getEntityCode() {
return entityCode;
}
public void setEntityCode(String entityCode) {
this.entityCode = entityCode;
}
public String getEntityName() {
return entityName;
}
public void setEntityName(String entityName) {
this.entityName = entityName;
}
public String getQrCode() {
return qrCode;
}
public void setQrCode(String qrCode) {
this.qrCode = qrCode;
}
public String getEntityScope() {
return entityScope;
}
public void setEntityScope(String entityScope) {
this.entityScope = entityScope;
}
public String getCoordinateAddress() {
return coordinateAddress;
}
public void setCoordinateAddress(String coordinateAddress) {
this.coordinateAddress = coordinateAddress;
}
public int isValid() {
return isValid;
}
public void setValid(int valid) {
isValid = valid;
}
public int getEntityLevel() {
return entityLevel;
}
public void setEntityLevel(int entityLevel) {
this.entityLevel = entityLevel;
}
}
\ No newline at end of file
...@@ -57,4 +57,12 @@ public interface GridRegionMapper { ...@@ -57,4 +57,12 @@ public interface GridRegionMapper {
List<GridRegion> getAllLevelFourByType(@Param("type") String type,@Param("code") String code); List<GridRegion> getAllLevelFourByType(@Param("type") String type,@Param("code") String code);
int changeTreeNodeName(@Param("id") String id, @Param("name") String name); int changeTreeNodeName(@Param("id") String id, @Param("name") String name);
List<GridRegion> getAllLevelTwoByType(@Param("wgCodeLikes")List<String> wgCodeLikes);
String getWgCodeById(String id);
List<GridRegion> selectAllByIdAndWgType(@Param("wgType")String wgType, @Param("wgCode")String wgCode);
int changeTreeNodeNameByCode(@Param("code") String code, @Param("name") String name);
} }
\ No newline at end of file
package com.ruoyi.system.mapper.other;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.other.MapEntity;
import java.util.List;
public interface MapEntityMapper extends BaseMapper<MapEntity> {
}
...@@ -247,7 +247,8 @@ public class GridRegionFacadeService { ...@@ -247,7 +247,8 @@ public class GridRegionFacadeService {
return gridRegion; return gridRegion;
} }
public void getRoles(String wgName, String wgCode, String wgType, String level, String purpose, Integer pageNum, Integer pageSize, AjaxResult result) { public void getRoles(String wgName, String wgCode, String wgType, String level, String purpose, Integer pageNum, Integer pageSize, AjaxResult result, List<String> regions) {
//public void getRoles(String wgName, String wgCode, String wgType, String level, String purpose, Integer pageNum, Integer pageSize, AjaxResult result) {
if (null == pageNum || pageNum <= 0) { if (null == pageNum || pageNum <= 0) {
pageNum = 1; pageNum = 1;
} }
...@@ -284,6 +285,14 @@ public class GridRegionFacadeService { ...@@ -284,6 +285,14 @@ public class GridRegionFacadeService {
} }
} }
//3.20权限bug
if(regions != null && !regions.isEmpty()) {
for (String regionId : regions) {
criteria.andWgCodeLike(regionId + "%");
}
}
//
int count = gridRegionService.countByExample(example); int count = gridRegionService.countByExample(example);
if (count <= 0) { if (count <= 0) {
result.buildSuccess("success", appPageModel); result.buildSuccess("success", appPageModel);
...@@ -295,10 +304,39 @@ public class GridRegionFacadeService { ...@@ -295,10 +304,39 @@ public class GridRegionFacadeService {
result.buildSuccess("success", appPageModel); result.buildSuccess("success", appPageModel);
return; return;
} }
// List<GridRegion> res = new ArrayList<>();
// if(!(regions.size()==1 && regions.get(0).equals("320282001"))){
// Map<String,Integer> map = new HashMap<>();
// for(String region: regions){
// map.put(region, 1);
// }
// for(GridRegion region: roles){
// if(map.containsKey(region.getWgCode())){
// res.add(region);
// }
// }
// }else{
// res = roles;
// }
appPageModel.setCurPage(pageNum); appPageModel.setCurPage(pageNum);
// appPageModel.setRecordCount(res.size());
appPageModel.setRecordCount(count); appPageModel.setRecordCount(count);
appPageModel.setPageCount((long) Math.ceil(1.0 * count / pageSize)); appPageModel.setPageCount((long) Math.ceil(1.0 * count / pageSize));
List<GridRegionWithCompanyItem> itemList = BeanCopyUtil.bathToBean(roles, GridRegionWithCompanyItem.class); if(level!=null && level.equals("3")){
for(GridRegion role : roles) {
String type = role.getWgType();
String code = role.getWgParentId();
List<GridRegion> twoLevel = gridRegionMapper.selectAllByIdAndWgType(type,code);
if(twoLevel != null && !twoLevel.isEmpty()) {
role.setpId(twoLevel.get(0).getId());
role.setpName(twoLevel.get(0).getWgName());
}
}
}
// List<GridRegionWithCompanyItem> itemList = BeanCopyUtil.bathToBean(res, GridRegionWithCompanyItem.class);
List<GridRegionWithCompanyItem> itemList = BeanCopyUtil.bathToBean(roles, GridRegionWithCompanyItem.class);
itemList.forEach( e -> { itemList.forEach( e -> {
GridCompanyLandExample gridCompanyLandExample = new GridCompanyLandExample(); GridCompanyLandExample gridCompanyLandExample = new GridCompanyLandExample();
GridCompanyLandExample.Criteria gridCompanyLandExampleCriteria = gridCompanyLandExample.createCriteria(); GridCompanyLandExample.Criteria gridCompanyLandExampleCriteria = gridCompanyLandExample.createCriteria();
...@@ -769,7 +807,8 @@ public class GridRegionFacadeService { ...@@ -769,7 +807,8 @@ public class GridRegionFacadeService {
return; return;
} }
public List<GridTreeNode> getWsTreeNode(String wgType, List<String> wgList, String isShow) { public List<GridTreeNode> getWsTreeNode(String wgType, List<String> wgList, String isShow, List<String> regions) {
//public List<GridTreeNode> getWsTreeNode(String wgType, List<String> wgList, String isShow) {
GridRegionSearchParam param = new GridRegionSearchParam(); GridRegionSearchParam param = new GridRegionSearchParam();
param.setWgType(wgType); param.setWgType(wgType);
if(!CollectionUtils.isEmpty(wgList)){ if(!CollectionUtils.isEmpty(wgList)){
...@@ -779,7 +818,22 @@ public class GridRegionFacadeService { ...@@ -779,7 +818,22 @@ public class GridRegionFacadeService {
param.setShow(false); param.setShow(false);
} }
List<GridRegion> gridRegionList = gridRegionMapper.getByParams(param); List<GridRegion> gridRegionList = gridRegionMapper.getByParams(param);
return convertFrRegion(gridRegionList, wgList); // return convertFrRegion(gridRegionList, wgList);
List<GridTreeNode> res = convertFrRegion(gridRegionList, wgList);
List<GridTreeNode> degree_second = new ArrayList<>();
if(!(regions.size()==1 && regions.get(0).equals("320282001"))){
Map<String,Integer> map = new HashMap<>();
for(String region: regions){
map.put(region, 1);
}
for(GridTreeNode region: res.get(0).getChild()){
if(map.containsKey(region.getCode())){
degree_second.add(region);
}
}
res.get(0).setChild(degree_second);
}
return res;
} }
private List<GridTreeNode> convertFrRegion(List<GridRegion> gridRegionList, List<String> wgCodes) { private List<GridTreeNode> convertFrRegion(List<GridRegion> gridRegionList, List<String> wgCodes) {
...@@ -1139,7 +1193,8 @@ public class GridRegionFacadeService { ...@@ -1139,7 +1193,8 @@ public class GridRegionFacadeService {
return gridRegionList; return gridRegionList;
} }
public List<GridTreeNode> getWsTreeNodeIncludeTwoPointFive(String wgType, List<String> wgList, String isShow) { public List<GridTreeNode> getWsTreeNodeIncludeTwoPointFive(String wgType, List<String> wgList, String isShow, List<String> regions) {
//public List<GridTreeNode> getWsTreeNodeIncludeTwoPointFive(String wgType, List<String> wgList, String isShow) {
//获取一级树 //获取一级树
List<GridRegion> gridRegionList = gridRegionMapper.getRegionByTypeAndCode("1",new ArrayList<>(),"1"); List<GridRegion> gridRegionList = gridRegionMapper.getRegionByTypeAndCode("1",new ArrayList<>(),"1");
List<GridTreeNode> res = new ArrayList<>(); List<GridTreeNode> res = new ArrayList<>();
...@@ -1237,6 +1292,20 @@ public class GridRegionFacadeService { ...@@ -1237,6 +1292,20 @@ public class GridRegionFacadeService {
gridTreeNode.setChild(secondFiveTree); gridTreeNode.setChild(secondFiveTree);
} }
List<GridTreeNode> degree_second = new ArrayList<>();
if(!(regions.size()==1 && regions.get(0).equals("320282001"))){
Map<String,Integer> map = new HashMap<>();
for(String region: regions){
map.put(region, 1);
}
for(GridTreeNode region: res.get(0).getChild()){
if(map.containsKey(region.getCode())){
degree_second.add(region);
}
}
res.get(0).setChild(degree_second);
}
return res; return res;
} }
...@@ -1248,7 +1317,7 @@ public class GridRegionFacadeService { ...@@ -1248,7 +1317,7 @@ public class GridRegionFacadeService {
firstNode.setName(gridRegion.getWgName()); firstNode.setName(gridRegion.getWgName());
firstNode.setId(gridRegion.getId()); firstNode.setId(gridRegion.getId());
firstNode.setChild(new ArrayList<>()); firstNode.setChild(new ArrayList<>());
firstNode.setParentId(""); firstNode.setParentId(gridRegion.getWgParentId());
firstNode.setWgArea(gridRegion.getWgArea()); firstNode.setWgArea(gridRegion.getWgArea());
firstNode.setWgCoordinate(gridRegion.getWgCoordinate()); firstNode.setWgCoordinate(gridRegion.getWgCoordinate());
firstNode.setWgCentreCoordinate(gridRegion.getWgCentreCoordinate()); firstNode.setWgCentreCoordinate(gridRegion.getWgCentreCoordinate());
......
...@@ -39,4 +39,6 @@ public interface GridRegionService extends BaseService<GridRegion, GridRegionExa ...@@ -39,4 +39,6 @@ public interface GridRegionService extends BaseService<GridRegion, GridRegionExa
List<GridRegion> getByParams(GridRegionSearchParam searchParam); List<GridRegion> getByParams(GridRegionSearchParam searchParam);
List<GridRegion> getGridRegionMapByWgType(String wgType); List<GridRegion> getGridRegionMapByWgType(String wgType);
List<GridRegion> getGridRegionMapByWgCodeAndWgType(String wgCode,String wgType);
} }
...@@ -15,10 +15,7 @@ import org.slf4j.LoggerFactory; ...@@ -15,10 +15,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -176,4 +173,16 @@ public class GridRegionServiceImpl extends BaseServiceImpl<GridRegionMapper, Gri ...@@ -176,4 +173,16 @@ public class GridRegionServiceImpl extends BaseServiceImpl<GridRegionMapper, Gri
return gridRegionService.selectByExample(ex); return gridRegionService.selectByExample(ex);
} }
@Override
public List<GridRegion> getGridRegionMapByWgCodeAndWgType(String wgCode, String wgType) {
GridRegionExample example = new GridRegionExample();
GridRegionExample.Criteria criteria = example.createCriteria();
criteria.andIsValidEqualTo("1");
criteria.andWgTypeEqualTo(wgType);
criteria.andWgCodeNotEqualTo(wgCode);
criteria.andWgCodeLike("%"+wgCode+"%");
criteria.andLevelEqualTo("3");
return gridRegionMapper.selectByExampleWithBLOBs(example);
}
} }
package com.ruoyi.system.service.other;
import com.ruoyi.system.domain.other.MapEntity;
import java.util.List;
public interface MapEntityService {
// 获取所有实体
List<MapEntity> getAllMapEntitiesByLevel(String level);
// 根据 ID 获取实体
MapEntity getMapEntityById(String id);
// 更新实体
MapEntity updateMapEntity(String id, MapEntity mapEntity);
// 删除实体
void deleteMapEntity(String id);
MapEntity addMapEntityById(MapEntity mapEntity);
}
\ No newline at end of file
package com.ruoyi.system.service.other.impl;
import cn.hutool.core.lang.UUID;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.system.domain.grid.GridRegion;
import com.ruoyi.system.domain.grid.GridRegionExample;
import com.ruoyi.system.domain.other.MapEntity;
import com.ruoyi.system.mapper.grid.GridRegionMapper;
import com.ruoyi.system.mapper.other.MapEntityMapper;
import com.ruoyi.system.service.other.MapEntityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class MapEntityServiceImpl implements MapEntityService {
@Autowired
private MapEntityMapper mapEntityMapper;
@Autowired
private GridRegionMapper gridRegionMapper;
@Override
public List<MapEntity> getAllMapEntitiesByLevel(String level) {
// QueryWrapper<MapEntity> queryWrapper = new QueryWrapper<>();
// if(level!=null&& !level.isEmpty()){
// queryWrapper.eq("entity_level", level);
// }
// return mapEntityMapper.selectList(queryWrapper);
GridRegionExample example = new GridRegionExample();
GridRegionExample.Criteria criteria = example.createCriteria();
criteria.andIsValidEqualTo("1");
if(level == null || level.isEmpty()) {
return null;
}
criteria.andLevelEqualTo(level);
criteria.andWgTypeEqualTo("1");
List<GridRegion> gridRegionList = gridRegionMapper.selectByExampleWithBLOBs(example);
List<MapEntity> mapEntityList = new ArrayList<>();
for (GridRegion gridRegion : gridRegionList) {
MapEntity mapEntity = new MapEntity();
mapEntity.setId(gridRegion.getId());
mapEntity.setType(gridRegion.getWgType());
mapEntity.setEntityCode(gridRegion.getWgCode());
mapEntity.setEntityLevel(new Integer(gridRegion.getLevel()));
mapEntity.setEntityName(gridRegion.getWgName());
mapEntity.setParentEntity(gridRegion.getWgParentId());
mapEntity.setEntityScope(gridRegion.getWgCoordinate());
mapEntity.setCoordinateAddress(gridRegion.getWgCentreCoordinate());
mapEntity.setValid(1);
mapEntity.setQrCode(gridRegion.getWgPrincipal());
mapEntityList.add(mapEntity);
}
return mapEntityList;
}
@Override
public MapEntity getMapEntityById(String id) {
return mapEntityMapper.selectById(id);
}
@Override
public MapEntity updateMapEntity(String id, MapEntity mapEntity) {
mapEntity.setId(id);
mapEntityMapper.updateById(mapEntity);
return mapEntity;
}
@Override
public void deleteMapEntity(String id) {
mapEntityMapper.deleteById(id);
}
@Override
public MapEntity addMapEntityById(MapEntity mapEntity) {
mapEntity.setId(UUID.randomUUID().toString());
mapEntityMapper.insert(mapEntity);
return mapEntity;
}
}
\ No newline at end of file
...@@ -682,10 +682,38 @@ ...@@ -682,10 +682,38 @@
and level = 4 and wg_type = #{type} and level = 4 and wg_type = #{type}
and wg_code like CONCAT(#{code}, '%') and wg_code like CONCAT(#{code}, '%')
and wg_code != #{code} and wg_code != #{code}
order by wg_code
</select>
<select id="getAllLevelTwoByType" resultType="com.ruoyi.system.domain.grid.GridRegion">
select
<include refid="Base_Column_List" />
from grid_region where is_valid = '1'
and wg_type = 1
<if test="wgCodeLikes != null and wgCodeLikes.size() > 0">
and (
<foreach collection="wgCodeLikes" item="wgCode" open="(" close=")" separator="or">
wg_code = #{wgCode}
</foreach>
)
</if>
and level = 2
</select>
<select id="getWgCodeById" resultType="java.lang.String">
select wg_code from grid_region where id = #{id}
</select>
<select id="selectAllByIdAndWgType" resultType="com.ruoyi.system.domain.grid.GridRegion">
select
<include refid="Base_Column_List" />
from grid_region where is_valid = '1'
and wg_type = #{wgType}
and wg_code = #{wgCode}
</select> </select>
<update id="changeTreeNodeName"> <update id="changeTreeNodeName">
update grid_region set wg_name=#{name} where id = #{id} update grid_region set wg_name=#{name} where id = #{id}
</update> </update>
<update id="changeTreeNodeNameByCode">
update grid_region set wg_name=#{name} where wg_code = #{code}
</update>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.other.MapEntityMapper">
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment