网格数据迁移功能。
This commit is contained in:
parent
466e52648c
commit
e51fb1680b
@ -18,6 +18,7 @@ import com.cm.common.result.SuccessResultData;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.population.config.properties.ProjectProperties;
|
||||
import com.cm.population.pojo.dtos.community.CommunityDTO;
|
||||
import com.cm.population.pojo.dtos.grid.GridDTO;
|
||||
import com.cm.population.pojo.dtos.residential.ResidentialDTO;
|
||||
import com.cm.population.pojo.vos.building.BuildingVO;
|
||||
import com.cm.population.pojo.vos.residential.ReadExcelResidentialModel;
|
||||
@ -29,6 +30,8 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
@ -190,7 +193,7 @@ public class ResidentialController extends AbstractController {
|
||||
@ApiOperation(value = "新增小区管理", notes = "新增小区管理接口")
|
||||
@GetMapping("excel")
|
||||
public SuccessResult excel() {
|
||||
String fileName = "C:\\Users\\29492\\Desktop\\春华社区十分公司建房.xlsx";
|
||||
String fileName = "C:\\Users\\29492\\Desktop\\飞地1-3网格.xls";
|
||||
List<Object> list = EasyExcel.read(fileName, ReadExcelResidentialModel.class,
|
||||
new AnalysisEventListener<ReadExcelResidentialModel>() {
|
||||
|
||||
@ -253,4 +256,14 @@ public class ResidentialController extends AbstractController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "网格数据迁移", notes = "网格数据迁移接口")
|
||||
@GetMapping("dataRemove")
|
||||
@Transactional(readOnly = false)
|
||||
public SuccessResult dataRemove() {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
List<GridDTO> gridDTOList = residentialService.getOldGrid(params);
|
||||
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
}
|
@ -5,6 +5,8 @@ import com.cm.common.exception.SaveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.exception.UpdateException;
|
||||
import com.cm.population.pojo.bos.residential.ResidentialBO;
|
||||
import com.cm.population.pojo.dtos.grid.GridDTO;
|
||||
import com.cm.population.pojo.dtos.grid.GridPointDTO;
|
||||
import com.cm.population.pojo.dtos.house.HouseDTO;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoBaseDTO;
|
||||
import com.cm.population.pojo.dtos.residential.ResidentialDTO;
|
||||
@ -128,4 +130,12 @@ public interface IResidentialDao {
|
||||
PopulationInfoBaseDTO getPopu2(Map<String, Object> params);
|
||||
|
||||
void updateHouse(Map<String, Object> params);
|
||||
|
||||
List<GridDTO> getOldGrid(Map<String, Object> params);
|
||||
|
||||
void gridGrid(Map<String, Object> params);
|
||||
|
||||
List<GridPointDTO> getOldPoint(Map<String, Object> params);
|
||||
|
||||
void gridPoint(Map<String, Object> params);
|
||||
}
|
@ -59,6 +59,8 @@ public class GridDTO implements Serializable {
|
||||
private List<String> relationIdArray;
|
||||
@ApiModelProperty(name = "pointArray", value = "网格点列表")
|
||||
private List<GridPointDTO> pointArray;
|
||||
@ApiModelProperty(name = "areaName", value = "网格编码")
|
||||
private String areaName;
|
||||
|
||||
public String getGridId() {
|
||||
return gridId == null ? "" : gridId.trim();
|
||||
@ -196,6 +198,14 @@ public class GridDTO implements Serializable {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public String getAreaName() {
|
||||
return areaName;
|
||||
}
|
||||
|
||||
public void setAreaName(String areaName) {
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
public List<String> getRelationIdArray() {
|
||||
if (relationIdArray == null) {
|
||||
return new ArrayList<>();
|
||||
|
@ -3,6 +3,7 @@ package com.cm.population.service.residential;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.population.pojo.bos.residential.ResidentialBO;
|
||||
import com.cm.population.pojo.dtos.grid.GridDTO;
|
||||
import com.cm.population.pojo.dtos.residential.ResidentialDTO;
|
||||
import com.cm.population.pojo.pos.residential.ResidentialPO;
|
||||
import com.cm.population.pojo.vos.residential.ResidentialVO;
|
||||
@ -193,4 +194,11 @@ public interface IResidentialService {
|
||||
* 房屋房主信息数据修复
|
||||
*/
|
||||
void dataCover();
|
||||
|
||||
/**
|
||||
* 网格数据迁移
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<GridDTO> getOldGrid(Map<String, Object> params);
|
||||
}
|
@ -6,16 +6,22 @@ import com.cm.common.pojo.bos.UserInfoBO;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.common.token.app.AppTokenManager;
|
||||
import com.cm.common.token.app.entity.AppTokenUser;
|
||||
import com.cm.common.utils.DateUtil;
|
||||
import com.cm.common.utils.HashMapUtil;
|
||||
import com.cm.common.utils.UUIDUtil;
|
||||
import com.cm.population.dao.grid.IGridDao;
|
||||
import com.cm.population.dao.grid.IGridPointDao;
|
||||
import com.cm.population.dao.house.IHouseDao;
|
||||
import com.cm.population.dao.populationinfo.IPopulationInfoDao;
|
||||
import com.cm.population.dao.residential.IResidentialDao;
|
||||
import com.cm.population.pojo.bos.residential.ResidentialBO;
|
||||
import com.cm.population.pojo.dtos.grid.GridDTO;
|
||||
import com.cm.population.pojo.dtos.grid.GridPointDTO;
|
||||
import com.cm.population.pojo.dtos.house.HouseDTO;
|
||||
import com.cm.population.pojo.dtos.populationinfo.PopulationInfoBaseDTO;
|
||||
import com.cm.population.pojo.dtos.residential.ResidentialDTO;
|
||||
import com.cm.population.pojo.pos.residential.ResidentialPO;
|
||||
import com.cm.population.pojo.vos.grid.GridVO;
|
||||
import com.cm.population.pojo.vos.residential.ResidentialVO;
|
||||
import com.cm.population.service.residential.IResidentialService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@ -44,6 +50,10 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
|
||||
private IHouseDao houseDao;
|
||||
@Autowired
|
||||
private IPopulationInfoDao populationInfoDao;
|
||||
@Autowired
|
||||
private IGridDao gridDao;
|
||||
@Autowired
|
||||
private IGridPointDao gridPointDao;
|
||||
|
||||
@Override
|
||||
public void save(ResidentialVO residentialVO) {
|
||||
@ -398,4 +408,53 @@ public class ResidentialServiceImpl extends AbstractService implements IResident
|
||||
executorService.shutdown(); // 关闭线程池
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GridDTO> getOldGrid(Map<String, Object> params) {
|
||||
List<GridDTO> gridDTOList = residentialDao.getOldGrid(params);
|
||||
for (GridDTO gridDTO : gridDTOList) {
|
||||
String areaName = gridDTO.getAreaName();
|
||||
|
||||
if(StringUtils.isNotEmpty(areaName)) {
|
||||
String[] areaNameArr = areaName.split("/");
|
||||
if(null != areaNameArr && areaNameArr.length > 1) {
|
||||
String communityId = this.getCommunityId(areaNameArr[1]);
|
||||
params.put("communityId", communityId);
|
||||
params.put("communityName", areaNameArr[1]);
|
||||
}
|
||||
if("民馨路街道办事处".equals(areaNameArr[0])) {
|
||||
areaNameArr[0] = "民馨路街道";
|
||||
}else if("稀土路街道办事处".equals(areaNameArr[0])) {
|
||||
areaNameArr[0] = "稀土路街道";
|
||||
}
|
||||
String streetId = this.getStreetId(areaNameArr[0]);
|
||||
|
||||
params.put("gridCode", gridDTO.getGridCode());
|
||||
params.put("gridId", gridDTO.getGridId());
|
||||
params.put("gridName", gridDTO.getGridName());
|
||||
params.put("gridSummary", gridDTO.getGridSummary());
|
||||
params.put("gridGroupId", gridDTO.getGridGroupId());
|
||||
params.put("gridDuty", gridDTO.getGridDuty());
|
||||
params.put("streetId", streetId);
|
||||
params.put("streetName", areaNameArr[0]);
|
||||
params.put("fillColor", gridDTO.getFillColor());
|
||||
params.put("creator", 1);
|
||||
params.put("gmtCreate", DateUtil.getTime());
|
||||
params.put("modifier", 1);
|
||||
params.put("gmtModified", DateUtil.getTime());
|
||||
params.put("isDelete", 0);
|
||||
residentialDao.gridGrid(params);
|
||||
}
|
||||
}
|
||||
|
||||
List<GridPointDTO> gridPointDTOList = residentialDao.getOldPoint(params);
|
||||
params = new HashMap<>();
|
||||
for(GridPointDTO gridPointDTO: gridPointDTOList) {
|
||||
params.put("gridId", gridPointDTO.getGridId());
|
||||
params.put("lng", gridPointDTO.getLng());
|
||||
params.put("lat", gridPointDTO.getLat());
|
||||
residentialDao.gridPoint(params);
|
||||
}
|
||||
return gridDTOList;
|
||||
}
|
||||
|
||||
}
|
@ -84,6 +84,34 @@
|
||||
<result column="street_name" property="streetName"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="gridDTO" type="com.cm.population.pojo.dtos.grid.GridDTO">
|
||||
<id column="grid_id" property="gridId"/>
|
||||
<result column="grid_id" property="gridId"/>
|
||||
<result column="grid_name" property="gridName"/>
|
||||
<result column="grid_summary" property="gridSummary"/>
|
||||
<result column="grid_group_id" property="gridGroupId"/>
|
||||
<result column="grid_duty" property="gridDuty"/>
|
||||
<result column="grid_code" property="gridCode"/>
|
||||
<result column="grid_square" property="gridSquare"/>
|
||||
<result column="street_id" property="streetId"/>
|
||||
<result column="street_name" property="streetName"/>
|
||||
<result column="community_id" property="communityId"/>
|
||||
<result column="community_name" property="communityName"/>
|
||||
<result column="housing_estate_id" property="housingEstateId"/>
|
||||
<result column="housing_estate_name" property="housingEstateName"/>
|
||||
<result column="fill_color" property="fillColor"/>
|
||||
<result column="relation_id" property="relationId"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="area_name" property="areaName"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="gridPointDTO" type="com.cm.population.pojo.dtos.grid.GridPointDTO">
|
||||
<id column="grid_id" property="gridId"/>
|
||||
<result column="lng" property="lng"/>
|
||||
<result column="lat" property="lat"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 新增小区管理 -->
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO house_residential(
|
||||
@ -586,4 +614,73 @@
|
||||
</if>-->
|
||||
</update>
|
||||
|
||||
<select id="getOldGrid" resultMap="gridDTO">
|
||||
SELECT * FROM map_grid_old
|
||||
</select>
|
||||
|
||||
<insert id="gridGrid" parameterType="map">
|
||||
INSERT INTO map_grid(
|
||||
grid_id,
|
||||
grid_name,
|
||||
grid_summary,
|
||||
grid_group_id,
|
||||
grid_duty,
|
||||
grid_code,
|
||||
grid_square,
|
||||
street_id,
|
||||
street_name,
|
||||
community_id,
|
||||
community_name,
|
||||
housing_estate_id,
|
||||
housing_estate_name,
|
||||
fill_color,
|
||||
gmt_create,
|
||||
creator,
|
||||
gmt_modified,
|
||||
modifier,
|
||||
is_delete
|
||||
) VALUES(
|
||||
#{gridId},
|
||||
#{gridName},
|
||||
#{gridSummary},
|
||||
#{gridGroupId},
|
||||
#{gridDuty},
|
||||
#{gridCode},
|
||||
#{gridSquare},
|
||||
#{streetId},
|
||||
#{streetName},
|
||||
#{communityId},
|
||||
#{communityName},
|
||||
#{housingEstateId},
|
||||
#{housingEstateName},
|
||||
#{fillColor},
|
||||
#{gmtCreate},
|
||||
#{creator},
|
||||
#{gmtModified},
|
||||
#{modifier},
|
||||
#{isDelete}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="getOldPoint" parameterType="map" resultMap="gridPointDTO">
|
||||
SELECT
|
||||
grid_id,
|
||||
lng,
|
||||
lat
|
||||
FROM
|
||||
map_grid_point_old
|
||||
</select>
|
||||
|
||||
<insert id="gridPoint" parameterType="map">
|
||||
INSERT INTO map_grid_point(
|
||||
grid_id,
|
||||
lng,
|
||||
lat
|
||||
) VALUES(
|
||||
#{gridId},
|
||||
#{lng},
|
||||
#{lat}
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user