Browse Source

网格员数据上报 mq

master
sunyuchao 3 years ago
parent
commit
1f787e4262
  1. 7
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/GridUserInfoDTO.java
  2. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java
  3. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  4. 2
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffInfoPingyinDao.java
  5. 4
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java
  6. 7
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffInfoPingyinService.java
  7. 41
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java
  8. 12
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml
  9. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUploadResultDTO.java
  10. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  11. 4
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

7
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/GridUserInfoDTO.java

@ -20,6 +20,7 @@ package com.epmet.dto.user.result;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
@ -78,6 +79,12 @@ public class GridUserInfoDTO implements Serializable {
*/ */
private String sex; private String sex;
/**
* 网格员信息编辑插入更新时间,县市区填写
*/
private Date updateTime;
} }

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java

@ -118,6 +118,7 @@ public class DataReportingServiceImpl implements DataReportingService {
st.setUserType(dto.getWorkType().equals("fulltime") ? "01" : "02"); st.setUserType(dto.getWorkType().equals("fulltime") ? "01" : "02");
st.setPhonenumber(dto.getMobile()); st.setPhonenumber(dto.getMobile());
st.setSex(0 == dto.getGender() ? "9" : dto.getGender().toString()); st.setSex(0 == dto.getGender() ? "9" : dto.getGender().toString());
st.setUpdateTime(dto.getUpdatedTime());
} }
}); });

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -21,8 +21,8 @@ import java.util.Set;
* @author yinzuomei@elink-cn.com * @author yinzuomei@elink-cn.com
* @date 2020/6/4 13:37 * @date 2020/6/4 13:37
*/ */
// @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class, url = "localhost:8092") @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class, url = "localhost:8092")
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class) //@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallbackFactory = GovOrgOpenFeignClientFallbackFactory.class)
public interface GovOrgOpenFeignClient { public interface GovOrgOpenFeignClient {
/** /**

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

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

4
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java

@ -12,6 +12,7 @@ import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO;
import com.epmet.opendata.service.ExUserService; import com.epmet.opendata.service.ExUserService;
import com.epmet.opendata.service.GridstaffInfoPingyinService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
@ -86,7 +87,8 @@ public class OpenDataStaffChangeEventListener implements MessageListenerConcurre
List<String> staffIdList = new ArrayList<>(); List<String> staffIdList = new ArrayList<>();
staffIdList.add(obj.getOrgId()); staffIdList.add(obj.getOrgId());
dto.setStaffIdList(staffIdList); dto.setStaffIdList(staffIdList);
SpringContextUtils.getBean(ExUserService.class).getStaffBaseInfo(dto); //SpringContextUtils.getBean(ExUserService.class).getStaffBaseInfo(dto);
SpringContextUtils.getBean(GridstaffInfoPingyinService.class).getStaffBaseInfo(dto);
} catch (RenException e) { } catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【开放数据事件监听器】-工作人员信息变更-初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e))); logger.error("【开放数据事件监听器】-工作人员信息变更-初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e)));

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

@ -2,6 +2,7 @@ package com.epmet.opendata.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.opendata.dto.form.GridStaffInfoFormDTO; import com.epmet.opendata.dto.form.GridStaffInfoFormDTO;
import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO;
import com.epmet.opendata.entity.GridstaffInfoPingyinEntity; import com.epmet.opendata.entity.GridstaffInfoPingyinEntity;
import java.util.Map; import java.util.Map;
@ -15,4 +16,10 @@ import java.util.Map;
public interface GridstaffInfoPingyinService extends BaseService<GridstaffInfoPingyinEntity> { public interface GridstaffInfoPingyinService extends BaseService<GridstaffInfoPingyinEntity> {
void gridStaffInfo(GridStaffInfoFormDTO formDTO); void gridStaffInfo(GridStaffInfoFormDTO formDTO);
/**
* @Author sun
* @Description 网格员信息中间库同步
**/
void getStaffBaseInfo(StaffBaseInfoFormDTO formDTO);
} }

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

@ -8,10 +8,14 @@ import com.epmet.dto.form.CustomerGridStaffListFormDTO;
import com.epmet.dto.form.GridStaffUploadtFormDTO; import com.epmet.dto.form.GridStaffUploadtFormDTO;
import com.epmet.dto.result.CustomerGridStaffListResultDTO; import com.epmet.dto.result.CustomerGridStaffListResultDTO;
import com.epmet.dto.result.GridStaffUploadResultDTO; import com.epmet.dto.result.GridStaffUploadResultDTO;
import com.epmet.dto.user.result.GridUserInfoDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.opendata.dao.GridstaffInfoPingyinDao; import com.epmet.opendata.dao.GridstaffInfoPingyinDao;
import com.epmet.opendata.dto.form.GridStaffInfoFormDTO; import com.epmet.opendata.dto.form.GridStaffInfoFormDTO;
import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO;
import com.epmet.opendata.entity.ExUserEntity;
import com.epmet.opendata.entity.GridstaffInfoPingyinEntity; import com.epmet.opendata.entity.GridstaffInfoPingyinEntity;
import com.epmet.opendata.service.GridstaffInfoPingyinService; import com.epmet.opendata.service.GridstaffInfoPingyinService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -39,6 +43,8 @@ public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffIn
private GovOrgOpenFeignClient govOrgOpenFeignClient; private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired @Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Override @Override
@ -73,6 +79,7 @@ public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffIn
entity.setQxMc("平阴县"); entity.setQxMc("平阴县");
entity.setGridCode(gs.getGridCode()); entity.setGridCode(gs.getGridCode());
entity.setGridName(gs.getGridName()); entity.setGridName(gs.getGridName());
entity.setIsLeave("N");
entityList.add(entity); entityList.add(entity);
} }
} }
@ -88,4 +95,38 @@ public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffIn
} }
/**
* @Author sun
* @Description 网格员信息中间库同步
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void getStaffBaseInfo(StaffBaseInfoFormDTO formDTO) {
//1.查询网格基础信息
com.epmet.dto.user.form.StaffBaseInfoFormDTO formDTO1 = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.user.form.StaffBaseInfoFormDTO.class);
Result<List<GridUserInfoDTO>> result = dataStatisticalOpenFeignClient.getStaffBaseInfo(formDTO1);
if (!result.success()) {
throw new RenException(result.getInternalMsg());
}
//2.中间库新增/修改数据【基本一个人一条数据,程序按批量处理】
result.getData().forEach(r -> {
GridstaffInfoPingyinEntity entity = ConvertUtils.sourceToTarget(r, GridstaffInfoPingyinEntity.class);
entity.setQxBm("370124");
entity.setQxMc("平阴县");
entity.setGridCode(r.getCode());
entity.setGridName(r.getGridName());
entity.setUserType("01");
entity.setIsLeave("N");
if (!"staff_create".equals(formDTO.getType())) {
baseDao.edit(entity);
}else {
insert(entity);
}
});
}
} }

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

@ -3,6 +3,18 @@
<mapper namespace="com.epmet.opendata.dao.GridstaffInfoPingyinDao"> <mapper namespace="com.epmet.opendata.dao.GridstaffInfoPingyinDao">
<update id="edit">
UPDATE gridstaff_info_pingyin
SET grid_name = #{gridName},
nick_name = #{nickName},
card_num = #{cardNum},
phonenumber = #{phonenumber},
sex = #{sex}
WHERE
grid_user_id = #{gridUserId}
AND grid_code = #{gridCode}
</update>
<delete id="del"> <delete id="del">
delete from gridstaff_info_pingyin delete from gridstaff_info_pingyin
</delete> </delete>

13
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUploadResultDTO.java

@ -1,9 +1,8 @@
package com.epmet.dto.result; package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.Date;
/** /**
* @description: 网格工作人员数据上报-查询客户网格下有效工作人员信息数据 * @description: 网格工作人员数据上报-查询客户网格下有效工作人员信息数据
@ -36,4 +35,14 @@ public class GridStaffUploadResultDTO {
*/ */
private String sex; private String sex;
/**
* 网格员类型符合标准10.3
*/
private String userType;
/**
* 网格员信息编辑插入更新时间,县市区填写
*/
private Date updateTime;
} }

4
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -25,8 +25,8 @@ import java.util.Set;
* @author yinzuomei@elink-cn.com * @author yinzuomei@elink-cn.com
* @date 2020/6/4 13:09 * @date 2020/6/4 13:09
*/ */
//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087")
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) //@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class)
public interface EpmetUserOpenFeignClient { public interface EpmetUserOpenFeignClient {
/** /**

4
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -462,7 +462,9 @@
real_name nickName, real_name nickName,
id_card cardNum, id_card cardNum,
gender sex, gender sex,
mobile phonenumber mobile phonenumber,
IF(work_type = 'fulltime', '01', '02') userType,
updated_time updateTime
FROM FROM
customer_staff customer_staff
WHERE WHERE

Loading…
Cancel
Save