diff --git a/epdc-cloud-client-yushan b/epdc-cloud-client-yushan index d81d0d3..492ca0b 160000 --- a/epdc-cloud-client-yushan +++ b/epdc-cloud-client-yushan @@ -1 +1 @@ -Subproject commit d81d0d313a4556e4c6317e7924f98a8b0f6ce2ff +Subproject commit 492ca0bd1716eca3439b0604c60ebda5910f62f2 diff --git a/epdc-cloud-commons-yushan b/epdc-cloud-commons-yushan index 128c6a4..31d32c8 160000 --- a/epdc-cloud-commons-yushan +++ b/epdc-cloud-commons-yushan @@ -1 +1 @@ -Subproject commit 128c6a4bfb8087999b492a6febfdde984623fe3a +Subproject commit 31d32c81a8018a5c93745bcca1a538cc0bf59e13 diff --git a/epdc-cloud-custom/pom.xml b/epdc-cloud-custom/pom.xml index eca5840..c92c7ad 100644 --- a/epdc-cloud-custom/pom.xml +++ b/epdc-cloud-custom/pom.xml @@ -81,12 +81,12 @@ epdc-commons-tools-wx-ma ${project.version} - - - org.apache.rocketmq - rocketmq-spring-boot-starter - 2.0.3 - + + + + + + com.esua.epdc.yushan epdc-cloud-vim-yushan @@ -186,6 +186,9 @@ 47.104.85.99:9876;114.215.125.123:9876 organizationGroup + organizationGroup + vaccineGroup + vaccineGroup @@ -226,6 +229,9 @@ 192.168.0.59:9876 organizationGroup + organizationGroup + vaccineGroup + vaccineGroup @@ -266,6 +272,9 @@ 172.16.1.242:9876;172.16.1.243:9876 organizationGroup + organizationGroup + vaccineGroup + vaccineGroup diff --git a/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/PersonTestingServiceImpl.java b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/PersonTestingServiceImpl.java index 1cccdc1..5307f9a 100644 --- a/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/PersonTestingServiceImpl.java +++ b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/modules/epidemic/service/impl/PersonTestingServiceImpl.java @@ -21,11 +21,13 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ImportParams; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; import com.elink.esua.epdc.commons.tools.constant.FieldConstant; import com.elink.esua.epdc.commons.tools.constant.NumConstant; +import com.elink.esua.epdc.commons.tools.constant.RocketMqConstant; import com.elink.esua.epdc.commons.tools.enums.UserSexEnum; import com.elink.esua.epdc.commons.tools.exception.RenException; import com.elink.esua.epdc.commons.tools.page.PageData; @@ -42,6 +44,8 @@ import com.elink.esua.epdc.modules.epidemic.excel.PersonTestingImportMoudleExcel import com.elink.esua.epdc.modules.epidemic.feign.OssFeignClient; import com.elink.esua.epdc.modules.epidemic.redis.PersonTestingRedis; import com.elink.esua.epdc.modules.epidemic.service.PersonTestingService; +import com.elink.esua.epdc.rocketmq.dto.PersonTestingModifyDTO; +import com.elink.esua.epdc.rocketmq.producer.PersonTestingModifyProducer; import com.elink.esua.epdc.vaccine.epidemic.dao.EpidemicUserInfoDao; import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInfoEntity; import com.elink.esua.epdc.vaccine.house.dao.PopulationInformationDao; @@ -83,6 +87,9 @@ public class PersonTestingServiceImpl extends BaseServiceImpl page(Map params) { IPage page = getPage(params); @@ -206,11 +213,10 @@ public class PersonTestingServiceImpl extends BaseServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.rocketmq.dto; + +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + + +/** + * 核酸检测记录 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-08-20 + */ +@Data +public class PersonTestingModifyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 姓名 + */ + @NotNull(message = "姓名不能为空") + private String name; + + /** + * 性别 + */ + @NotNull(message = "性别不能为空") + private String sex; + + /** + * 民族 + */ + private String nation; + + /** + * 出生日期 + */ + private Date birthday; + + /** + * 手机号 + */ + private String mobile; + + /** + * 住址 + */ + private String address; + + /** + * 身份证号码 + */ + @NotNull(message = "身份证号码不能为空") + private String idcard; + + /** + * 签发机关 + */ + private String organ; + + /** + * 照片base64编码 + */ + private String imgCode; + + /** + * 照片地址 + */ + private String imgUrl; + + /** + * 核酸接测结果 + */ + private String testingResult; + + /** + * 核酸检测时间 + */ + @NotNull(message = "核酸检测时间不能为空") + private Date testingTime; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 逻辑删除标识 + */ + private String delFlag; + + /** + * 核酸检测点表,主键 + */ + private String testingPointId; + + /** + * 核酸检测点,名称 + */ + private String testingPointName; +} diff --git a/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/rocketmq/producer/PersonTestingModifyProducer.java b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/rocketmq/producer/PersonTestingModifyProducer.java new file mode 100644 index 0000000..c0f8fa6 --- /dev/null +++ b/epdc-cloud-custom/src/main/java/com/elink/esua/epdc/rocketmq/producer/PersonTestingModifyProducer.java @@ -0,0 +1,41 @@ +package com.elink.esua.epdc.rocketmq.producer; + +import lombok.extern.slf4j.Slf4j; +import org.apache.rocketmq.client.producer.SendResult; +import org.apache.rocketmq.common.message.Message; +import org.apache.rocketmq.spring.core.RocketMQTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 接种信息-发送MQ消息 + * + * @author zhy + * @date 2022/4/8 10:20 + */ +@Slf4j +@Component +public class PersonTestingModifyProducer { + + @Autowired + private RocketMQTemplate rocketMQTemplate; + + /** + * 发送消息 + * + * @return void + * @params [topic, tag, keys, body] + * @author liuchuang + * @since 2020/3/6 21:09 + */ + public void sendMessage(String topic, String tag, String keys, String body) { + Message message = new Message(topic, tag, keys, body.getBytes()); + try { + SendResult sendResult = rocketMQTemplate.getProducer().send(message); + log.info("EPDC-CUSTOM-SERVER发送消息结果:{sendStatus:{}, topic:{}, msgId:{}}", sendResult.getSendStatus(), topic, sendResult.getMsgId()); + } catch (Exception e) { + log.error("EPDC-CUSTOM-SERVER发送消息异常:{topic:{}, tag:{}, keys:{}, body:{}}", topic, tag, keys, body); + e.printStackTrace(); + } + } +} diff --git a/epdc-cloud-custom/src/main/resources/application.yml b/epdc-cloud-custom/src/main/resources/application.yml index 55756d9..e85ba0b 100644 --- a/epdc-cloud-custom/src/main/resources/application.yml +++ b/epdc-cloud-custom/src/main/resources/application.yml @@ -105,6 +105,10 @@ rocketmq: name-server: @rocketmq.name.server@ consumer: group: @rocketmq.consumer.group@ + vaccine-group: @rocketmq.consumer.vaccine-group@ + producer: + group: @rocketmq.producer.group@ + vaccine-group: @rocketmq.producer.vaccine-group@ #hystrix的超时时间 hystrix: command: diff --git a/epdc-cloud-vim-yushan/pom.xml b/epdc-cloud-vim-yushan/pom.xml index cd1ea2d..0d9cd56 100644 --- a/epdc-cloud-vim-yushan/pom.xml +++ b/epdc-cloud-vim-yushan/pom.xml @@ -54,7 +54,12 @@ epdc-cloud-admin-client ${epdc-cloud-client.version} - + + + org.apache.rocketmq + rocketmq-spring-boot-starter + 2.0.3 + diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/rocketmq/consumer/PersonTestingModifyConsumer.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/rocketmq/consumer/PersonTestingModifyConsumer.java new file mode 100644 index 0000000..0273f69 --- /dev/null +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/rocketmq/consumer/PersonTestingModifyConsumer.java @@ -0,0 +1,75 @@ +package com.elink.esua.epdc.rocketmq.consumer; + +import com.alibaba.fastjson.JSONObject; +import com.elink.esua.epdc.commons.tools.constant.RocketMqConstant; +import com.elink.esua.epdc.commons.tools.exception.RenException; +import com.elink.esua.epdc.commons.tools.utils.IdentityNoUtils; +import com.elink.esua.epdc.rocketmq.dto.PersonTestingModifyDTO; +import com.elink.esua.epdc.vaccine.epidemic.dao.EpidemicUserInfoDao; +import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInfoEntity; +import lombok.extern.slf4j.Slf4j; +import org.apache.rocketmq.common.message.MessageExt; +import org.apache.rocketmq.spring.annotation.MessageModel; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * 疫苗接种-监听MQ消息 + * + * @author zhy + * @date 2022/4/8 10:49 + */ +@Slf4j +@Component +@RocketMQMessageListener(topic = RocketMqConstant.MQ_TOPIC_VACCINE, consumerGroup = "${rocketmq.consumer.vaccine-group}", messageModel = MessageModel.BROADCASTING) +public class PersonTestingModifyConsumer implements RocketMQListener { + + @Resource + private EpidemicUserInfoDao epidemicUserInfoDao; + + @Override + public void onMessage(MessageExt messageExt) { + log.info("EPDC-CUSTOM-SERVER消费消息START:{topic:{}, msgId:{}}", RocketMqConstant.MQ_TOPIC_VACCINE, messageExt.getMsgId()); + try { + String charset = "UTF-8"; + String body = new String(messageExt.getBody(), charset); + PersonTestingModifyDTO dto = JSONObject.parseObject(body, PersonTestingModifyDTO.class); + + EpidemicUserInfoEntity entity = epidemicUserInfoDao.selectInfoByIdCard(dto.getIdcard()); + if (entity != null) { + entity.setCheckDate(dto.getTestingTime()); + entity.setCheckState("0"); + epidemicUserInfoDao.updateById(entity); + } else { + entity = new EpidemicUserInfoEntity(); + personTestingDTO2EpidemicUserInfoEntityTransfor(dto, entity); + epidemicUserInfoDao.insert(entity); + } + + + log.info("EPDC-CUSTOM-SERVER消费消息END:{topic:{}, msgId:{}, body:{}}", RocketMqConstant.MQ_TOPIC_VACCINE, messageExt.getMsgId(), body); + } catch (Exception e) { + log.info("EPDC-CUSTOM-SERVER消费消息失败:msgId:{}", messageExt.getMsgId()); + e.printStackTrace(); + } + } + + private void personTestingDTO2EpidemicUserInfoEntityTransfor(PersonTestingModifyDTO sDto, EpidemicUserInfoEntity dDto) { + dDto.setUserName(sDto.getName()); + String result = IdentityNoUtils.IdentityNoVerification(sDto.getIdcard()); + if (result != null) { + throw new RenException(result); + } else { + dDto.setGender(IdentityNoUtils.getSex(sDto.getIdcard())); + dDto.setBirthday(IdentityNoUtils.getBirthday(sDto.getIdcard())); + } + dDto.setNation(sDto.getNation()); + dDto.setHouseholdRegisterDetail(sDto.getAddress()); + dDto.setIdCard(sDto.getIdcard()); + dDto.setCheckDate(sDto.getTestingTime()); + dDto.setCheckState("0"); + } +} diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/rocketmq/dto/PersonTestingModifyDTO.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/rocketmq/dto/PersonTestingModifyDTO.java new file mode 100644 index 0000000..8eeb2d0 --- /dev/null +++ b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/rocketmq/dto/PersonTestingModifyDTO.java @@ -0,0 +1,146 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.rocketmq.dto; + +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + + +/** + * 核酸检测记录 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-08-20 + */ +@Data +public class PersonTestingModifyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 姓名 + */ + @NotNull(message = "姓名不能为空") + private String name; + + /** + * 性别 + */ + @NotNull(message = "性别不能为空") + private String sex; + + /** + * 民族 + */ + private String nation; + + /** + * 出生日期 + */ + private Date birthday; + + /** + * 手机号 + */ + private String mobile; + + /** + * 住址 + */ + private String address; + + /** + * 身份证号码 + */ + @NotNull(message = "身份证号码不能为空") + private String idcard; + + /** + * 签发机关 + */ + private String organ; + + /** + * 照片base64编码 + */ + private String imgCode; + + /** + * 照片地址 + */ + private String imgUrl; + + /** + * 核酸接测结果 + */ + private String testingResult; + + /** + * 核酸检测时间 + */ + @NotNull(message = "核酸检测时间不能为空") + private Date testingTime; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 逻辑删除标识 + */ + private String delFlag; + + /** + * 核酸检测点表,主键 + */ + private String testingPointId; + + /** + * 核酸检测点,名称 + */ + private String testingPointName; +}