|
@ -1,6 +1,7 @@ |
|
|
package com.epmet.opendata.service.impl; |
|
|
package com.epmet.opendata.service.impl; |
|
|
|
|
|
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
|
|
import com.epmet.commons.tools.constant.Constant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
@ -10,11 +11,13 @@ import com.epmet.dto.org.result.CustomerAgencyDTO; |
|
|
import com.epmet.dto.org.result.CustomerGridDTO; |
|
|
import com.epmet.dto.org.result.CustomerGridDTO; |
|
|
import com.epmet.feign.DataStatisticalOpenFeignClient; |
|
|
import com.epmet.feign.DataStatisticalOpenFeignClient; |
|
|
import com.epmet.opendata.dao.GridInfoPingyinDao; |
|
|
import com.epmet.opendata.dao.GridInfoPingyinDao; |
|
|
|
|
|
import com.epmet.opendata.dto.constant.DataWorkerConstant; |
|
|
import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO; |
|
|
import com.epmet.opendata.dto.form.ExractGridInfoPingYinFormDTO; |
|
|
import com.epmet.opendata.entity.GridInfoPingyinEntity; |
|
|
import com.epmet.opendata.entity.GridInfoPingyinEntity; |
|
|
import com.epmet.opendata.service.GridInfoPingyinService; |
|
|
import com.epmet.opendata.service.GridInfoPingyinService; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.ListUtils; |
|
|
import org.apache.commons.collections4.ListUtils; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@ -44,6 +47,15 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinD |
|
|
public void exractAgency(ExractGridInfoPingYinFormDTO formDTO) { |
|
|
public void exractAgency(ExractGridInfoPingYinFormDTO formDTO) { |
|
|
// 1.查询组织基础信息,customer_agency.code为空的不抽取
|
|
|
// 1.查询组织基础信息,customer_agency.code为空的不抽取
|
|
|
com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class); |
|
|
com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class); |
|
|
|
|
|
if (DataWorkerConstant.ALL.equals(formDTO.getType())) { |
|
|
|
|
|
formDTO1.setDelFlag("0"); |
|
|
|
|
|
} else if (formDTO.getType().contains(DataWorkerConstant.CREATE)) { |
|
|
|
|
|
formDTO1.setDelFlag(NumConstant.ZERO_STR); |
|
|
|
|
|
} else if (formDTO.getType().contains(DataWorkerConstant.CHANGE)) { |
|
|
|
|
|
formDTO1.setDelFlag(NumConstant.ZERO_STR); |
|
|
|
|
|
} else if (formDTO.getType().contains(DataWorkerConstant.DELETE)) { |
|
|
|
|
|
formDTO1.setDelFlag(NumConstant.ONE_STR); |
|
|
|
|
|
} |
|
|
Result<List<CustomerAgencyDTO>> result = dataStatisticalOpenFeignClient.getAgencyBaseInfo(formDTO1); |
|
|
Result<List<CustomerAgencyDTO>> result = dataStatisticalOpenFeignClient.getAgencyBaseInfo(formDTO1); |
|
|
if (!result.success()) { |
|
|
if (!result.success()) { |
|
|
throw new RenException(result.getInternalMsg()); |
|
|
throw new RenException(result.getInternalMsg()); |
|
@ -59,11 +71,11 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinD |
|
|
entity.setQxMc("平阴县"); |
|
|
entity.setQxMc("平阴县"); |
|
|
entity.setGridCode(ag.getCode()); |
|
|
entity.setGridCode(ag.getCode()); |
|
|
entity.setGridName(ag.getOrganizationName()); |
|
|
entity.setGridName(ag.getOrganizationName()); |
|
|
if ("district".equals(ag.getLevel())) { |
|
|
if (Constant.DISTRICT.equals(ag.getLevel())) { |
|
|
entity.setGridLevel(3); |
|
|
entity.setGridLevel(3); |
|
|
} else if ("street".equals(ag.getLevel())) { |
|
|
} else if (Constant.STREET.equals(ag.getLevel())) { |
|
|
entity.setGridLevel(4); |
|
|
entity.setGridLevel(4); |
|
|
} else if ("community".equals(ag.getLevel())) { |
|
|
} else if (Constant.COMMUNITY.equals(ag.getLevel())) { |
|
|
entity.setGridLevel(6); |
|
|
entity.setGridLevel(6); |
|
|
} |
|
|
} |
|
|
entity.setLat(new BigDecimal(ag.getLatitude())); |
|
|
entity.setLat(new BigDecimal(ag.getLatitude())); |
|
@ -71,7 +83,7 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinD |
|
|
gridInfoList.add(entity); |
|
|
gridInfoList.add(entity); |
|
|
}); |
|
|
}); |
|
|
// 3、初始化传all;新增或者编辑
|
|
|
// 3、初始化传all;新增或者编辑
|
|
|
if ("all".equals(formDTO.getType())) { |
|
|
if (DataWorkerConstant.ALL.equals(formDTO.getType())) { |
|
|
// 全删,全增
|
|
|
// 全删,全增
|
|
|
baseDao.deleteAllAgencyData(); |
|
|
baseDao.deleteAllAgencyData(); |
|
|
// 一次100
|
|
|
// 一次100
|
|
@ -80,11 +92,11 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinD |
|
|
this.insertBatch(list); |
|
|
this.insertBatch(list); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} else if (formDTO.getType().contains("create")) { |
|
|
} else if (formDTO.getType().contains(DataWorkerConstant.CREATE)) { |
|
|
// 单独新增组织
|
|
|
// 单独新增组织
|
|
|
this.insertBatch(gridInfoList); |
|
|
this.insertBatch(gridInfoList); |
|
|
|
|
|
|
|
|
} else if (formDTO.getType().contains("change")) { |
|
|
} else if (formDTO.getType().contains(DataWorkerConstant.CHANGE)) { |
|
|
// 修改组织时,先根据code查询,如果有数据,更新
|
|
|
// 修改组织时,先根据code查询,如果有数据,更新
|
|
|
for (GridInfoPingyinEntity entity : gridInfoList) { |
|
|
for (GridInfoPingyinEntity entity : gridInfoList) { |
|
|
|
|
|
|
|
@ -102,6 +114,16 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinD |
|
|
baseDao.insert(entity); |
|
|
baseDao.insert(entity); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}else if(formDTO.getType().contains(DataWorkerConstant.DELETE)){ |
|
|
|
|
|
// 要删除的组织id
|
|
|
|
|
|
for (GridInfoPingyinEntity entity : gridInfoList) { |
|
|
|
|
|
List<GridInfoPingyinEntity> orginList = baseDao.selectByGridCode(entity.getGridCode()); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(orginList)) { |
|
|
|
|
|
for (GridInfoPingyinEntity oigin : orginList) { |
|
|
|
|
|
baseDao.deleteByCode(oigin.getGridCode()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -115,6 +137,15 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinD |
|
|
public void exractGrid(ExractGridInfoPingYinFormDTO formDTO) { |
|
|
public void exractGrid(ExractGridInfoPingYinFormDTO formDTO) { |
|
|
// 1.查询网格基础信息
|
|
|
// 1.查询网格基础信息
|
|
|
com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class); |
|
|
com.epmet.dto.org.form.GridBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.org.form.GridBaseInfoFormDTO.class); |
|
|
|
|
|
if (StringUtils.isBlank(formDTO.getType())||DataWorkerConstant.ALL.equals(formDTO.getType())) { |
|
|
|
|
|
formDTO1.setDelFlag("0"); |
|
|
|
|
|
} else if (formDTO.getType().contains(DataWorkerConstant.CREATE)) { |
|
|
|
|
|
formDTO1.setDelFlag(NumConstant.ZERO_STR); |
|
|
|
|
|
} else if (formDTO.getType().contains(DataWorkerConstant.CHANGE)) { |
|
|
|
|
|
formDTO1.setDelFlag(NumConstant.ZERO_STR); |
|
|
|
|
|
} else if (formDTO.getType().contains(DataWorkerConstant.DELETE)) { |
|
|
|
|
|
formDTO1.setDelFlag(NumConstant.ONE_STR); |
|
|
|
|
|
} |
|
|
Result<List<CustomerGridDTO>> result = dataStatisticalOpenFeignClient.getGridBaseInfo(formDTO1); |
|
|
Result<List<CustomerGridDTO>> result = dataStatisticalOpenFeignClient.getGridBaseInfo(formDTO1); |
|
|
if (!result.success()) { |
|
|
if (!result.success()) { |
|
|
throw new RenException(result.getInternalMsg()); |
|
|
throw new RenException(result.getInternalMsg()); |
|
@ -145,7 +176,7 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinD |
|
|
gridInfoList.add(entity); |
|
|
gridInfoList.add(entity); |
|
|
}); |
|
|
}); |
|
|
// 3、初始化传all;新增或者编辑
|
|
|
// 3、初始化传all;新增或者编辑
|
|
|
if ("all".equals(formDTO.getType())) { |
|
|
if (DataWorkerConstant.ALL.equals(formDTO.getType())) { |
|
|
// 全删,全增
|
|
|
// 全删,全增
|
|
|
baseDao.deleteAllGridData(); |
|
|
baseDao.deleteAllGridData(); |
|
|
// 一次100
|
|
|
// 一次100
|
|
@ -153,11 +184,11 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinD |
|
|
partition.forEach(list -> { |
|
|
partition.forEach(list -> { |
|
|
this.insertBatch(list); |
|
|
this.insertBatch(list); |
|
|
}); |
|
|
}); |
|
|
} else if (formDTO.getType().contains("create")) { |
|
|
} else if (formDTO.getType().contains(DataWorkerConstant.CREATE)) { |
|
|
// 单独新增组织
|
|
|
// 单独新增组织
|
|
|
this.insertBatch(gridInfoList); |
|
|
this.insertBatch(gridInfoList); |
|
|
|
|
|
|
|
|
} else if (formDTO.getType().contains("change")) { |
|
|
} else if (formDTO.getType().contains(DataWorkerConstant.CHANGE)) { |
|
|
// 修改组织时,先根据code查询,如果有数据,更新
|
|
|
// 修改组织时,先根据code查询,如果有数据,更新
|
|
|
for (GridInfoPingyinEntity entity : gridInfoList) { |
|
|
for (GridInfoPingyinEntity entity : gridInfoList) { |
|
|
|
|
|
|
|
@ -175,6 +206,16 @@ public class GridInfoPingyinServiceImpl extends BaseServiceImpl<GridInfoPingyinD |
|
|
baseDao.insert(entity); |
|
|
baseDao.insert(entity); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}else if(formDTO.getType().contains(DataWorkerConstant.DELETE)){ |
|
|
|
|
|
// 要删除的网格id
|
|
|
|
|
|
for (GridInfoPingyinEntity entity : gridInfoList) { |
|
|
|
|
|
List<GridInfoPingyinEntity> orginList = baseDao.selectByGridCode(entity.getGridCode()); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(orginList)) { |
|
|
|
|
|
for (GridInfoPingyinEntity oigin : orginList) { |
|
|
|
|
|
baseDao.deleteByCode(oigin.getGridCode()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|