Browse Source

程序调整优化

master
sunyuchao 3 years ago
parent
commit
ffc127b5dd
  1. 4
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java
  2. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  3. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml
  4. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/GridstaffInfoPingyinDao.java
  5. 5
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java
  6. 4
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java
  7. 16
      epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml
  8. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

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

@ -3,6 +3,7 @@ package com.epmet.commons.rocketmq.messages;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 组织网格人员中间库数据上报MQ
@ -21,5 +22,8 @@ public class OrgOrStaffMQMsg implements Serializable {
//删除网格:grid_delete;删除组织:agency_delete
private String type;
//工作人员Id集合
private List<String> staffIdList;
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
@ -55,6 +56,7 @@ import com.epmet.entity.CustomerStaffGridEntity;
import com.epmet.entity.StaffOrgRelationEntity;
import com.epmet.feign.*;
import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerGridService;
import com.epmet.util.ModuleConstant;
@ -112,6 +114,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
private ResiPartyMemberOpenFeignClient resiPartyMemberOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@ -515,10 +519,19 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
validStaffIds.forEach(staffId -> {
CustomerStaffRedis.delStaffInfoFormCache(staffListFormDTO.getCustomerId(), staffId);
});
//22.7.25 网格添加工作人员推送mq 同步工作人员信息到中间库 start
OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg();
mq.setCustomerId(staffListFormDTO.getCustomerId());
mq.setStaffIdList(staffListFormDTO.getSelectedList());
mq.setOrgType("staff");
mq.setType("staff_create");
SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq);
//22.7.25 网格添加工作人员推送mq 同步工作人员信息到中间库 end
return new Result();
}
}
return new Result().error();
}

2
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml

@ -205,7 +205,7 @@
a.user_id gridUserId
FROM
customer_staff_grid a
INNER JOIN customer_grid b ON a.grid_id = b.id AND b.del_flag = '0' AND b.`code` is not null
INNER JOIN customer_grid b ON a.grid_id = b.id AND b.del_flag = '0' AND a.customer_id = b.customer_id AND b.`code`!= '' AND b.`code` is not null
WHERE
a.del_flag = '0'
AND a.customer_id = #{customerId}

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

@ -3,6 +3,7 @@ package com.epmet.opendata.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.opendata.entity.GridstaffInfoPingyinEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 平阴区网格员基础信息
@ -16,4 +17,6 @@ public interface GridstaffInfoPingyinDao extends BaseDao<GridstaffInfoPingyinEnt
void del();
void edit(GridstaffInfoPingyinEntity entity);
GridstaffInfoPingyinEntity selectByCodeAndStaffId(@Param("code") String code, @Param("staffId") String staffId);
}

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

@ -84,10 +84,11 @@ public class OpenDataStaffChangeEventListener implements MessageListenerConcurre
StaffBaseInfoFormDTO dto = new StaffBaseInfoFormDTO();
dto.setCustomerId(obj.getCustomerId());
dto.setType(obj.getType());
List<String> staffIdList = new ArrayList<>();
/*List<String> staffIdList = new ArrayList<>();
staffIdList.add(obj.getOrgId());
dto.setStaffIdList(staffIdList);
//SpringContextUtils.getBean(ExUserService.class).getStaffBaseInfo(dto);
SpringContextUtils.getBean(ExUserService.class).getStaffBaseInfo(dto);*/
dto.setStaffIdList(obj.getStaffIdList());
SpringContextUtils.getBean(GridstaffInfoPingyinService.class).getStaffBaseInfo(dto);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试

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

@ -120,7 +120,9 @@ public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffIn
entity.setIsLeave("N");
entity.setGridUserId(r.getStaffId());
entity.setCardNum(r.getIdCard());
if (!"staff_create".equals(formDTO.getType())) {
//按网格查询人员是否存在,存在更新否则新增
GridstaffInfoPingyinEntity gs = baseDao.selectByCodeAndStaffId(r.getCode(), r.getStaffId());
if (null != gs) {
baseDao.edit(entity);
} else {
insert(entity);

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

@ -19,4 +19,20 @@
delete from gridstaff_info_pingyin
</delete>
<select id="selectByCodeAndStaffId" resultType="com.epmet.opendata.entity.GridstaffInfoPingyinEntity">
SELECT
grid_user_id,
grid_code,
grid_name,
nick_name,
card_num,
phonenumber
FROM
gridstaff_info_pingyin
WHERE
grid_user_id = #{gridUserId}
AND grid_code = #{gridCode}
LIMIT 1
</select>
</mapper>

9
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -43,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -221,7 +222,9 @@ public class CustomerStaffController {
if (result.success()) {
OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg();
mq.setCustomerId(fromDTO.getCustomerId());
mq.setOrgId(result.getData().getUserId());
List<String> st = new ArrayList<>();
st.add(result.getData().getUserId());
mq.setStaffIdList(st);
mq.setOrgType("staff");
mq.setType("staff_create");
SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq);
@ -245,7 +248,9 @@ public class CustomerStaffController {
if (result.success()) {
OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg();
mq.setCustomerId(fromDTO.getCustomerId());
mq.setOrgId(fromDTO.getStaffId());
List<String> st = new ArrayList<>();
st.add(fromDTO.getStaffId());
mq.setStaffIdList(st);
mq.setOrgType("staff");
mq.setType("staff_change");
SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq);

Loading…
Cancel
Save