Browse Source

网格员数据

master
sunyuchao 3 years ago
parent
commit
d8fb33602d
  1. 17
      epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/form/GridStaffInfoFormDTO.java
  2. 17
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridstaffInfoPingyinController.java
  3. 1
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffInfoPingyinDao.java
  4. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffInfoPingyinService.java
  5. 73
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java
  6. 33
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml

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

@ -0,0 +1,17 @@
package com.epmet.opendata.dto.form;
import lombok.Data;
import java.io.Serializable;
@Data
public class GridStaffInfoFormDTO implements Serializable {
private static final long serialVersionUID = -5277855973512833181L;
/**
* 客户Id
*/
private String customerId;
}

17
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridstaffInfoPingyinController.java

@ -8,10 +8,15 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.form.CustomerGridStaffListFormDTO;
import com.epmet.dto.result.CustomerGridStaffListResultDTO;
import com.epmet.opendata.dto.form.GridStaffInfoFormDTO;
import com.epmet.opendata.service.GridstaffInfoPingyinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@ -25,6 +30,18 @@ import java.util.Map;
@RequestMapping("gridstaffInfoPingyin")
public class GridstaffInfoPingyinController {
@Autowired
private GridstaffInfoPingyinService gridstaffInfoPingyinService;
/**
* @Author sun
* @Description 网格员基本信息同步
**/
@PostMapping(value = "gridstaffinfo")
public Result gridStaffInfo(@RequestBody GridStaffInfoFormDTO formDTO) {
gridstaffInfoPingyinService.gridStaffInfo(formDTO);
return new Result();
}
}

1
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffInfoPingyinDao.java

@ -13,4 +13,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GridstaffInfoPingyinDao extends BaseDao<GridstaffInfoPingyinEntity> {
void del();
}

2
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffInfoPingyinService.java

@ -1,6 +1,7 @@
package com.epmet.opendata.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.opendata.dto.form.GridStaffInfoFormDTO;
import com.epmet.opendata.entity.GridstaffInfoPingyinEntity;
import java.util.Map;
@ -13,4 +14,5 @@ import java.util.Map;
*/
public interface GridstaffInfoPingyinService extends BaseService<GridstaffInfoPingyinEntity> {
void gridStaffInfo(GridStaffInfoFormDTO formDTO);
}

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

@ -1,10 +1,29 @@
package com.epmet.opendata.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerGridStaffListFormDTO;
import com.epmet.dto.form.GridStaffUploadtFormDTO;
import com.epmet.dto.result.CustomerGridStaffListResultDTO;
import com.epmet.dto.result.GridStaffUploadResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.opendata.dao.GridstaffInfoPingyinDao;
import com.epmet.opendata.dto.form.GridStaffInfoFormDTO;
import com.epmet.opendata.entity.GridstaffInfoPingyinEntity;
import com.epmet.opendata.service.GridstaffInfoPingyinService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 平阴区网格员基础信息
@ -13,6 +32,60 @@ import org.springframework.stereotype.Service;
* @since v1.0.0 2022-07-22
*/
@Service
@Slf4j
public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffInfoPingyinDao, GridstaffInfoPingyinEntity> implements GridstaffInfoPingyinService {
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
@Transactional(rollbackFor = Exception.class)
public void gridStaffInfo(GridStaffInfoFormDTO formDTO) {
//1.查询客户网格下工作人员
CustomerGridStaffListFormDTO org = new CustomerGridStaffListFormDTO();
org.setCustomerId(formDTO.getCustomerId());
Result<List<CustomerGridStaffListResultDTO>> orgList = govOrgOpenFeignClient.gridStaff(org);
if (!orgList.success()) {
throw new RenException("查询客户网格下工作人员列表信息失败:".concat(orgList.toString()));
}
log.info(String.format("网格员数据同步,查询到网格下工作人员记录共%s条", orgList.getData().size()));
//2.查询客户工作人员基础信息
GridStaffUploadtFormDTO user = new GridStaffUploadtFormDTO();
user.setCustomerId(formDTO.getCustomerId());
Result<List<GridStaffUploadResultDTO>> userList = epmetUserOpenFeignClient.customerStaff(user);
if (!userList.success()) {
throw new RenException("查询客户下工作人员基础信息失败:".concat(userList.toString()));
}
log.info(String.format("网格员数据同步,查询到客户下工作人员基础信息记录共%s条", userList.getData().size()));
Map<String, GridStaffUploadResultDTO> map = userList.getData().stream().collect(Collectors.toMap(GridStaffUploadResultDTO::getGridUserId, m -> m, (k1, k2) -> k1));
//3.拼装数据
List<GridstaffInfoPingyinEntity> entityList = new ArrayList();
if (!CollectionUtils.isEmpty(orgList.getData()) && !CollectionUtils.isEmpty(userList.getData())) {
for (CustomerGridStaffListResultDTO gs : orgList.getData()) {
if (map.containsKey(gs.getGridUserId())) {
GridstaffInfoPingyinEntity entity = ConvertUtils.sourceToTarget(map.get(gs.getGridUserId()), GridstaffInfoPingyinEntity.class);
entity.setQxBm("370124");
entity.setQxMc("平阴县");
entity.setGridCode(gs.getGridCode());
entity.setGridName(gs.getGridName());
entityList.add(entity);
}
}
}
//4.删除表中历史数据
baseDao.del();
//5.批量新增数据
log.info(String.format("网格员数据同步,本次共同步%s条记录", entityList.size()));
insertBatch(entityList);
}
}

33
epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml

@ -3,35 +3,8 @@
<mapper namespace="com.epmet.opendata.dao.GridstaffInfoPingyinDao">
<resultMap type="com.epmet.opendata.entity.GridstaffInfoPingyinEntity" id="gridstaffInfoPingyinMap">
<result property="id" column="id"/>
<result property="qxBm" column="qx_bm"/>
<result property="qxMc" column="qx_mc"/>
<result property="gridUserId" column="grid_user_id"/>
<result property="gridCode" column="grid_code"/>
<result property="gridName" column="grid_name"/>
<result property="nickName" column="nick_name"/>
<result property="cardNum" column="card_num"/>
<result property="userType" column="user_type"/>
<result property="phonenumber" column="phonenumber"/>
<result property="sex" column="sex"/>
<result property="nation" column="nation"/>
<result property="paerty" column="paerty"/>
<result property="birthday" column="birthday"/>
<result property="education" column="education"/>
<result property="entryDate" column="ENTRY_DATE"/>
<result property="isLeave" column="IS_LEAVE"/>
<result property="leaveDate" column="LEAVE_DATE"/>
<result property="income" column="INCOME"/>
<result property="isCommittee" column="IS_COMMITTEE"/>
<result property="isCommunityWorkers" column="IS_COMMUNITY_WORKERS"/>
<result property="isSocialWorker" column="IS_SOCIAL_WORKER"/>
<result property="isVillageLeader" column="IS_VILLAGE_LEADER"/>
<result property="isPoliceAssistant" column="IS_POLICE_ASSISTANT"/>
<result property="isMediator" column="IS_MEDIATOR"/>
<result property="updateTime" column="update_time"/>
<result property="recoredInsertTime" column="recored_insert_time"/>
</resultMap>
<delete id="del">
delete from gridstaff_info_pingyin
</delete>
</mapper>
Loading…
Cancel
Save