diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java index 3f39c2500d..5384a76dbb 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java @@ -2,14 +2,9 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.DefaultGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcNatDTO; import com.epmet.dto.form.AddIcNatFormDTO; import com.epmet.dto.form.MyNatListFormDTO; @@ -17,10 +12,12 @@ import com.epmet.dto.result.MyNatListResultDTO; import com.epmet.dto.result.NatListResultDTO; import com.epmet.service.IcNatService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; -import java.util.Map; /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java index 2da059b99f..50bf30b6f8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java @@ -1,7 +1,6 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcNatDTO; import com.epmet.dto.form.AddIcNatFormDTO; import com.epmet.dto.form.MyNatListFormDTO; @@ -10,7 +9,6 @@ import com.epmet.dto.result.NatListResultDTO; import com.epmet.entity.IcNatEntity; import java.util.List; -import java.util.Map; /** * 核酸上报记录 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java index 400b52f5fd..40e1c49d5c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java @@ -1,37 +1,35 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcNatDao; import com.epmet.dto.IcNatDTO; +import com.epmet.dto.IcNoticeDTO; import com.epmet.dto.form.AddIcNatFormDTO; import com.epmet.dto.form.MyNatListFormDTO; +import com.epmet.dto.form.SendNoticeFormDTO; import com.epmet.dto.result.MyNatListResultDTO; import com.epmet.dto.result.NatListResultDTO; import com.epmet.entity.IcNatEntity; import com.epmet.service.IcNatService; +import com.epmet.service.IcNoticeService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; -import java.util.Map; /** * 核酸上报记录 @@ -42,7 +40,8 @@ import java.util.Map; @Service @Slf4j public class IcNatServiceImpl extends BaseServiceImpl implements IcNatService { - + @Autowired + private IcNoticeService icNoticeService; /** * @Author sun @@ -63,9 +62,15 @@ public class IcNatServiceImpl extends BaseServiceImpl imp //3.新增通知表信息 if (formDTO.getChannel().size() > NumConstant.ZERO) { - //TODO - - + SendNoticeFormDTO dto = new SendNoticeFormDTO(); + List userList = new ArrayList<>(); + userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class)); + dto.setUserList(userList); + dto.setChannel(formDTO.getChannel()); + dto.setOrigin("2"); + dto.setContent(formDTO.getContent()); + dto.setOrgName(agencyInfo.getOrganizationName()); + icNoticeService.sendNotice(dto); } } @@ -122,7 +127,11 @@ public class IcNatServiceImpl extends BaseServiceImpl imp resultDTO = ConvertUtils.sourceToTarget(entity, IcNatDTO.class); //2.查询对应的通知记录信息 - //TODO + IcNoticeDTO dto = icNoticeService.getNotice(entity.getCustomerId(), entity.getIdCard()); + if (null != dto) { + resultDTO.setChannel(dto.getChannelList()); + resultDTO.setContent(dto.getContent()); + } return resultDTO; } @@ -143,7 +152,21 @@ public class IcNatServiceImpl extends BaseServiceImpl imp //3.新增通知表信息 if (formDTO.getChannel().size() > NumConstant.ZERO) { - //TODO + IcNatEntity icNatEntity = baseDao.selectById(formDTO.getIcNatId()); + //1.获取所填居民所属组织缓存信息 + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(icNatEntity.getAgencyId()); + if (null == agencyInfo) { + throw new RenException(String.format("获取组织缓存信息失败%s", icNatEntity.getAgencyId())); + } + SendNoticeFormDTO dto = new SendNoticeFormDTO(); + List userList = new ArrayList<>(); + userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class)); + dto.setUserList(userList); + dto.setChannel(formDTO.getChannel()); + dto.setOrigin("2"); + dto.setContent(formDTO.getContent()); + dto.setOrgName(agencyInfo.getOrganizationName()); + icNoticeService.sendNotice(dto); } }