From db2eba863dd0e6a6eb85752e5ad31d08f5e9548a Mon Sep 17 00:00:00 2001 From: yangjun <1173114630@qq.com> Date: Wed, 24 Dec 2025 10:43:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A8=E9=80=81=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nursing-unit-admin/nu-admin-biz/pom.xml | 2 +- .../impl/NuBizSuppliersApplyServiceImpl.java | 47 ++++++++- .../SuppliersMQExceptionHandler.java | 20 ++++ .../listener/SuppliersMQListener.java | 99 +++++++++++++++++++ .../java/com/nu/dto/SuppliersInfoMQDto.java | 73 ++++++++++++++ 5 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/suppliers/exceptionhandler/SuppliersMQExceptionHandler.java create mode 100644 nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/suppliers/listener/SuppliersMQListener.java create mode 100644 nursing-unit-common/src/main/java/com/nu/dto/SuppliersInfoMQDto.java diff --git a/nursing-unit-admin/nu-admin-biz/pom.xml b/nursing-unit-admin/nu-admin-biz/pom.xml index d165514..640da75 100644 --- a/nursing-unit-admin/nu-admin-biz/pom.xml +++ b/nursing-unit-admin/nu-admin-biz/pom.xml @@ -41,6 +41,6 @@ nursing-unit-common ${nursingunit.version} - + diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/bizSuppliers/service/impl/NuBizSuppliersApplyServiceImpl.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/bizSuppliers/service/impl/NuBizSuppliersApplyServiceImpl.java index 0edc294..1d06678 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/bizSuppliers/service/impl/NuBizSuppliersApplyServiceImpl.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/bizSuppliers/service/impl/NuBizSuppliersApplyServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.nu.dto.SuppliersInfoMQDto; import com.nu.entity.EmployeesAdvisoryInfoEntity; import com.nu.entity.SuppliersApplyEntity; import com.nu.entity.SuppliersOrgAllEntity; @@ -17,6 +18,7 @@ import com.nu.modules.bizSuppliers.service.INuBizSuppliersApplyService; import com.nu.modules.orgapplyinfo.entity.OrgAllInfo; import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity; import com.nu.modules.suppliers.ISuppliersApi; +import com.nu.utils.RabbitMQUtil; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -40,6 +42,9 @@ public class NuBizSuppliersApplyServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); @@ -108,6 +113,22 @@ public class NuBizSuppliersApplyServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("status", "2"); + queryWrapper.eq("iz_history", "N"); + List list = nuBizSuppliersOrgMapper.selectList(queryWrapper); + for(NuBizSuppliersOrg nuBizSuppliersOrg:list){ + //todo 修改对应机构的供应商数据 + SuppliersInfoMQDto suppliersInfoMQDto = new SuppliersInfoMQDto(); + suppliersInfoMQDto.setSuppliersName(nuBizSuppliersApply.getSuppliersName()); + suppliersInfoMQDto.setSuppliersNature(nuBizSuppliersApply.getSuppliersNature()); + suppliersInfoMQDto.setSuppliersAddress(nuBizSuppliersApply.getSuppliersAddress()); + suppliersInfoMQDto.setPersonInCharge(nuBizSuppliersApply.getPersonInCharge()); + suppliersInfoMQDto.setContactNumber(nuBizSuppliersApply.getContactNumber()); + suppliersInfoMQDto.setSupplyState(nuBizSuppliersApply.getSupplyState()); + suppliersInfoMQDto.setOpeningBank(nuBizSuppliersApply.getOpeningBank()); + suppliersInfoMQDto.setOpeningBankNo(nuBizSuppliersApply.getOpeningBankNo()); + suppliersInfoMQDto.setImgPath(nuBizSuppliersApply.getImgPath()); +// suppliersInfoMQDto.setApplyStatus("1"); + suppliersInfoMQDto.setSysOrgCode(nuBizSuppliersOrg.getOrgCode()); + suppliersInfoMQDto.setSuppliersId(nuBizSuppliersApply.getId()); + rabbitMQUtil.sendToExchange("nu.suppliers.editSuppliersApply", nuBizSuppliersOrg.getOrgCode() + ".suppliers.editSuppliersApply", suppliersInfoMQDto); + } + + BeanUtils.copyProperties(nuBizSuppliersApply, suppliersApplyEntity); return suppliersApplyEntity; diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/suppliers/exceptionhandler/SuppliersMQExceptionHandler.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/suppliers/exceptionhandler/SuppliersMQExceptionHandler.java new file mode 100644 index 0000000..595ae3c --- /dev/null +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/suppliers/exceptionhandler/SuppliersMQExceptionHandler.java @@ -0,0 +1,20 @@ +package com.nu.mq.suppliers.exceptionhandler; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.AmqpRejectAndDontRequeueException; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.listener.api.RabbitListenerErrorHandler; +import org.springframework.amqp.rabbit.support.ListenerExecutionFailedException; +import org.springframework.stereotype.Component; + +@Slf4j +@Component("suppliersMQExceptionHandler") +public class SuppliersMQExceptionHandler implements RabbitListenerErrorHandler { + + @Override + public Object handleError(Message message, org.springframework.messaging.Message message1, ListenerExecutionFailedException e) { + log.error("MQ消息处理失败 | 消息体: {} | 异常原因: {}", new String(message.getBody()), e.getCause().getMessage()); + throw new AmqpRejectAndDontRequeueException("消息处理失败且禁止重试", e); + } + +} diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/suppliers/listener/SuppliersMQListener.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/suppliers/listener/SuppliersMQListener.java new file mode 100644 index 0000000..aaa9748 --- /dev/null +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/suppliers/listener/SuppliersMQListener.java @@ -0,0 +1,99 @@ +package com.nu.mq.suppliers.listener; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.google.common.collect.Maps; +import com.nu.dto.SuppliersInfoMQDto; +import com.nu.dto.WorkOrderMQDto; +import com.nu.entity.NuWxNoticeEntity; +import com.nu.entity.WxNoticeEntity; +import com.nu.enums.WxClientType; +import com.nu.modules.bizSuppliers.entity.NuBizSuppliersOrg; +import com.nu.modules.bizSuppliers.service.INuBizSuppliersOrgService; +import com.nu.modules.wxnotice.IWxNoticeApi; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.springframework.amqp.core.ExchangeTypes; +import org.springframework.amqp.rabbit.annotation.Exchange; +import org.springframework.amqp.rabbit.annotation.Queue; +import org.springframework.amqp.rabbit.annotation.QueueBinding; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Map; + +@Slf4j +@Component +public class SuppliersMQListener { + + @Autowired + private INuBizSuppliersOrgService nuBizSuppliersOrgService; + + @Autowired + private IWxNoticeApi wxNoticeApi; + + /** + * 工单回执 + */ + @AutoLog(value = "供应商-供应商审核回执") + @RabbitListener( + bindings = @QueueBinding( + value = @Queue(name = "nu.suppliers.suppliersApplyStatus"), + exchange = @Exchange(name = "nu.suppliers.suppliersApplyStatus", type = ExchangeTypes.DIRECT), + key = "nu.suppliers.suppliersApplyStatus" + ), + errorHandler = "suppliersMQExceptionHandler" + ) + public void suppliersApplyStatus(SuppliersInfoMQDto suppliersInfoMQDto) { + log.info("供应商审核回执"); + log.info("供应商审核回执: {}", suppliersInfoMQDto); + log.info("业务处理"); + + NuBizSuppliersOrg nuBizSuppliersOrg = new NuBizSuppliersOrg(); + nuBizSuppliersOrg.setId(suppliersInfoMQDto.getApplyId()); + nuBizSuppliersOrg.setStatus(suppliersInfoMQDto.getApplyStatus()); + nuBizSuppliersOrg.setAuditContent(suppliersInfoMQDto.getApplyContent()); + nuBizSuppliersOrgService.updateById(nuBizSuppliersOrg); + + nuBizSuppliersOrg = nuBizSuppliersOrgService.getById(nuBizSuppliersOrg.getId()); + + + + String content1 = ""; + String content2 = ""; +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("org_code", nuBizSuppliersOrg.getOrgCode()); +// SysDepart dto = sysDepartService.getOne(queryWrapper); + //审核通过 + if(StringUtils.equals("2",nuBizSuppliersOrg.getStatus())){ + content1 = "您好,您提交的入驻信息已通过"; + content2 = "审核通过"; + }else if(StringUtils.equals("3",nuBizSuppliersOrg.getStatus())){ + content1 = "您好,您提交的入驻信息已驳回"; + content2 = "审核驳回"; + } + NuWxNoticeEntity nuWxNotice = new NuWxNoticeEntity(); + nuWxNotice.setOpenId(nuBizSuppliersOrg.getOpenId()); + nuWxNotice.setIzRead("N"); + nuWxNotice.setOrgCode(nuBizSuppliersOrg.getOrgCode()); + nuWxNotice.setTitle("入驻机构审批"); + nuWxNotice.setContent(content1); + nuWxNotice.setType("suppliers_status"); + Map extend = Maps.newHashMap(); + extend.put("orgCode", nuBizSuppliersOrg.getOrgCode()); + extend.put("dataId", nuBizSuppliersOrg.getSuppliersId()); + nuWxNotice.setExtend(JSONObject.toJSONString(extend)); + nuWxNotice.setClientType(WxClientType.ELDER.getCode()); + wxNoticeApi.addNotice(nuWxNotice); + WxNoticeEntity wxNotice = new WxNoticeEntity(); + wxNotice.setPageRoute("pages/supplierindex/index"); + wxNotice.setThing1("供应商入驻审核"); + wxNotice.setThing4(content2); + wxNotice.setLogMainInfo("供应商入驻审核"); + wxNoticeApi.sendWechartMessage_SHENHE(wxNotice, nuWxNotice); + + } + +} diff --git a/nursing-unit-common/src/main/java/com/nu/dto/SuppliersInfoMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/SuppliersInfoMQDto.java new file mode 100644 index 0000000..9519cd4 --- /dev/null +++ b/nursing-unit-common/src/main/java/com/nu/dto/SuppliersInfoMQDto.java @@ -0,0 +1,73 @@ +package com.nu.dto; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.TableLogic; +import org.jeecg.common.constant.ProvinceCityArea; +import org.jeecg.common.util.SpringContextUtils; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: nu_config_suppliers_apply + * @Author: jeecg-boot + * @Date: 2025-12-23 + * @Version: V1.0 + */ +@Data +public class SuppliersInfoMQDto implements Serializable { + private static final long serialVersionUID = 1L; + + /**id*/ + @ApiModelProperty(value = "id") + private String id; + /**供应商名称*/ + private String suppliersName; + /**供应商性质 1代理商 2批发商 3制造商*/ + private String suppliersNature; + /**供应商地址*/ + private String suppliersAddress; + /**负责人*/ + private String personInCharge; + /**联系电话*/ + private String contactNumber; + /**供应状态 1正常供应 2暂停供应*/ + private String supplyState; + /**开户行*/ + private String openingBank; + /**开户行账号*/ + private String openingBankNo; + /**微信账号*/ + private String wechartId; + /**资质照片*/ + private String imgPath; + /**创建人*/ + private String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date createTime; + /**所属部门*/ + private String sysOrgCode; + /**审核状态*/ + @Excel(name = "审核状态", width = 15) + private String applyStatus; + /**审核备注*/ + private String applyContent; + /**申请id*/ + private String applyId; + /**供应商id*/ + private String suppliersId; +}