Browse Source

Merge remote-tracking branch 'origin/dev_pingyin_7_22' into dev_pingyin_7_22

master
jianjun 3 years ago
parent
commit
16df33a455
  1. 1
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java
  2. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  3. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java
  4. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
  5. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
  6. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java
  7. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
  8. 8
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/DataWorkerConstant.java
  9. 2
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java
  10. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java
  11. 59
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java
  12. 5
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml

1
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java

@ -18,6 +18,7 @@ public class OrgOrStaffMQMsg implements Serializable {
//数据类型【组织:agency 网格:grid 人员:staff】
private String orgType;
//操作类型【组织新增:agency_create 组织变更:agency_change 网格新增:grid_create 网格变更:grid_change 人员新增:staff_create 人员变更:staff_change】
//删除网格:grid_delete;删除组织:agency_delete
private String type;

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -49,6 +49,8 @@ public interface NumConstant {
BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100);
BigDecimal ZERO_DECIMAL = new BigDecimal(0);
int ONE_THOUSAND = 1000;
int TEN_THOUSAND = 10000;
int THREE_THOUSAND = 3000;
int MAX = 99999999;
int EIGHTY_EIGHT = 88;

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/form/GridBaseInfoFormDTO.java

@ -28,7 +28,7 @@ public class GridBaseInfoFormDTO implements Serializable {
* 操作类型新增:add 修改删除:edit 初始化所有数据:all
*/
private String type;
private String delFlag;
public interface Grid extends CustomerClientShowGroup {}
}

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

@ -158,8 +158,10 @@
*
FROM
customer_grid
WHERE del_flag = '0'
AND customer_id = #{customerId}
WHERE customer_id = #{customerId}
<if test="delFlag != null and delFlag !=''">
AND del_flag = #{delFlag}
</if>
and CODE is not null
and CODE !=''
and grid_name not like '%专属网格'

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -214,10 +214,12 @@
*
FROM
customer_agency
WHERE del_flag = '0'
AND customer_id = #{customerId}
WHERE customer_id = #{customerId}
and CODE is not null
and CODE !=''
<if test="delFlag != null and delFlag !=''">
AND del_flag = #{delFlag}
</if>
<if test="orgIdList != null and orgIdList.size() > 0">
<foreach collection="orgIdList" item="agencyId" open="AND id IN (" separator="," close=")">
#{agencyId}

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java

@ -201,7 +201,16 @@ public class AgencyController {
public Result removeAgency(@LoginUser TokenDto tokenDTO, @RequestBody RemoveAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
formDTO.setCustomerId(tokenDTO.getCustomerId());
return agencyService.removeAgency(formDTO);
Result result= agencyService.removeAgency(formDTO);
//2021-11-30 推送mq,数据同步到中介库 start
OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg();
mq.setCustomerId(tokenDTO.getCustomerId());
mq.setOrgId(formDTO.getAgencyId());
mq.setOrgType("agency");
mq.setType("agency_delete");
SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq);
//2021-11-30 end
return result;
}
/**

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java

@ -100,7 +100,18 @@ public class GridController {
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_GRID_DELETE)
public Result deleteGrid(@LoginUser TokenDto tokenDto, @RequestBody DeleteGridFormDTO deleteGridFormDTO){
deleteGridFormDTO.setCustomerId(tokenDto.getCustomerId());
return customerGridService.deleteGrid(tokenDto,deleteGridFormDTO);
Result result =customerGridService.deleteGrid(tokenDto,deleteGridFormDTO);
//2021-10-18 推送mq,数据同步到中介库 start
if (result.success()) {
OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg();
mq.setCustomerId(tokenDto.getCustomerId());
mq.setOrgId(deleteGridFormDTO.getGridId());
mq.setOrgType("grid");
mq.setType("grid_delete");
SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq);
}
//2021-10-18 end
return result;
}
/**

8
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/constant/DataWorkerConstant.java

@ -0,0 +1,8 @@
package com.epmet.opendata.dto.constant;
public interface DataWorkerConstant {
String ALL = "all";
String CREATE = "create";
String CHANGE = "change";
String DELETE = "delete";
}

2
epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/ExractGridInfoPingYinFormDTO.java

@ -32,9 +32,9 @@ public class ExractGridInfoPingYinFormDTO implements Serializable {
/**
* 废弃这个不对操作类型新增:add 修改删除:edit 初始化所有数据:all
* 操作类型组织新增:agency_create 组织变更:agency_change 网格新增:grid_create 网格变更:grid_change 人员新增:staff_create 人员变更:staff_change
* 删除网格grid_delete删除组织agency_delete
*/
@NotBlank(message = "操作类型【新增:add 修改删除:edit 初始化所有数据:all】不能为空", groups = {GridInfo.class})
private String type;
}

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridInfoPingyinDao.java

@ -28,4 +28,6 @@ public interface GridInfoPingyinDao extends BaseDao<GridInfoPingyinEntity> {
@Param("gridLevel")Integer gridLevel,
@Param("lng")BigDecimal lng,
@Param("lat")BigDecimal lat);
int deleteByCode(String gridCode);
}

59
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridInfoPingyinServiceImpl.java

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

5
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridInfoPingyinDao.xml

@ -44,4 +44,9 @@
lat = #{lat}
where grid_code = #{gridCode} and is_del = 'N'
</update>
<update id="deleteByCode">
update grid_info_pingyin set is_del = 'Y'
where grid_code = #{gridCode}
</update>
</mapper>

Loading…
Cancel
Save