Browse Source

加上通知

dev
zxc 3 years ago
parent
commit
2a2328e9f3
  1. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java
  2. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java
  3. 49
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java

4
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java

@ -83,9 +83,9 @@ public class IcEpidemicSpecialAttentionController {
*/ */
@PostMapping("vaccination-update") @PostMapping("vaccination-update")
@NoRepeatSubmit @NoRepeatSubmit
public Result vaccinationUpdate(@RequestBody IcEpidemicSpecialAttentionDTO formDTO){ public Result vaccinationUpdate(@RequestBody IcEpidemicSpecialAttentionDTO formDTO,@LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, IcEpidemicSpecialAttentionDTO.IcEpidemicSpecialAttentionUpdate.class); ValidatorUtils.validateEntity(formDTO, IcEpidemicSpecialAttentionDTO.IcEpidemicSpecialAttentionUpdate.class);
icEpidemicSpecialAttentionService.vaccinationUpdate(formDTO); icEpidemicSpecialAttentionService.vaccinationUpdate(formDTO,tokenDto);
return new Result(); return new Result();
} }

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java

@ -104,7 +104,7 @@ public interface IcEpidemicSpecialAttentionService extends BaseService<IcEpidemi
* @author zxc * @author zxc
* @date 2022/3/28 13:45 * @date 2022/3/28 13:45
*/ */
void vaccinationUpdate(IcEpidemicSpecialAttentionDTO formDTO); void vaccinationUpdate(IcEpidemicSpecialAttentionDTO formDTO,TokenDto tokenDto);
/** /**
* Desc: 取消关注 * Desc: 取消关注

49
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java

@ -22,10 +22,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constants.ImportTaskConstants; import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcEpidemicSpecialAttentionDao; import com.epmet.dao.IcEpidemicSpecialAttentionDao;
import com.epmet.dto.IcEpidemicSpecialAttentionDTO; import com.epmet.dto.IcEpidemicSpecialAttentionDTO;
import com.epmet.dto.form.CancelAttentionPackageFormDTO; import com.epmet.dto.form.*;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.VaccinationAddFormDTO;
import com.epmet.dto.form.VaccinationListFormDTO;
import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.dto.result.VaccinationListResultDTO; import com.epmet.dto.result.VaccinationListResultDTO;
import com.epmet.entity.IcEpidemicSpecialAttentionEntity; import com.epmet.entity.IcEpidemicSpecialAttentionEntity;
@ -35,6 +32,7 @@ import com.epmet.excel.error.EpidemicSpecialAttentionErrorModel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.OssFeignClient; import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcEpidemicSpecialAttentionService; import com.epmet.service.IcEpidemicSpecialAttentionService;
import com.epmet.service.IcNoticeService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -71,6 +69,8 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Autowired @Autowired
private OssFeignClient ossFeignClient; private OssFeignClient ossFeignClient;
@Autowired
private IcNoticeService noticeService;
@Override @Override
public PageData<IcEpidemicSpecialAttentionDTO> page(Map<String, Object> params) { public PageData<IcEpidemicSpecialAttentionDTO> page(Map<String, Object> params) {
@ -207,7 +207,19 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
e.setCustomerId(formDTO.getCustomerId()); e.setCustomerId(formDTO.getCustomerId());
}); });
insertBatch(entities); insertBatch(entities);
//TODO 发送通知 //新增通知表信息
List<IcEpidemicSpecialAttentionDTO> needSedNotice = formDTO.getList().stream().filter(l -> CollectionUtils.isNotEmpty(l.getChannel())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(needSedNotice)) {
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userListBeans = ConvertUtils.sourceToTarget(needSedNotice, SendNoticeFormDTO.UserListBean.class);
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserList(userListBeans);
dto.setChannel(needSedNotice.get(NumConstant.ZERO).getChannel());
dto.setOrigin(needSedNotice.get(NumConstant.ZERO).getAttentionType().toString());
dto.setContent(needSedNotice.get(NumConstant.ZERO).getContent());
dto.setStaffId(formDTO.getUserId());
noticeService.sendNotice(dto);
}
} }
/** /**
@ -220,7 +232,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void vaccinationUpdate(IcEpidemicSpecialAttentionDTO formDTO) { public void vaccinationUpdate(IcEpidemicSpecialAttentionDTO formDTO,TokenDto tokenDto) {
LambdaQueryWrapper<IcEpidemicSpecialAttentionEntity> w = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcEpidemicSpecialAttentionEntity> w = new LambdaQueryWrapper<>();
IcEpidemicSpecialAttentionEntity e = new IcEpidemicSpecialAttentionEntity(); IcEpidemicSpecialAttentionEntity e = new IcEpidemicSpecialAttentionEntity();
w.eq(IcEpidemicSpecialAttentionEntity::getIdCard,formDTO.getIdCard()) w.eq(IcEpidemicSpecialAttentionEntity::getIdCard,formDTO.getIdCard())
@ -229,7 +241,17 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
e.setReason(formDTO.getReason()); e.setReason(formDTO.getReason());
e.setRemark(formDTO.getRemark()); e.setRemark(formDTO.getRemark());
update(e,w); update(e,w);
//TODO 通知 if (CollectionUtils.isNotEmpty(formDTO.getChannel())){
SendNoticeFormDTO dto = new SendNoticeFormDTO();
SendNoticeFormDTO.UserListBean userListBean = ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserList(Arrays.asList(userListBean));
dto.setChannel(formDTO.getChannel());
dto.setOrigin(formDTO.getAttentionType().toString());
dto.setContent(formDTO.getContent());
dto.setStaffId(tokenDto.getUserId());
noticeService.sendNotice(dto);
}
} }
/** /**
@ -330,6 +352,19 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
e.setCustomerId(tokenDto.getCustomerId()); e.setCustomerId(tokenDto.getCustomerId());
}); });
insertBatch(entities); insertBatch(entities);
// send msg
List<ImportEpidemicSpecialAttention> needSendList = needInsert.stream().filter(l -> CollectionUtils.isNotEmpty(l.getChannel())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(needSendList)) {
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userListBeans = ConvertUtils.sourceToTarget(needSendList, SendNoticeFormDTO.UserListBean.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserList(userListBeans);
dto.setChannel(needSendList.get(NumConstant.ZERO).getChannel());
dto.setOrigin(needSendList.get(NumConstant.ZERO).getAttentionType().toString());
dto.setContent(needSendList.get(NumConstant.ZERO).getContent());
dto.setStaffId(tokenDto.getUserId());
noticeService.sendNotice(dto);
}
} }
if (CollectionUtils.isNotEmpty(errorInfo)){ if (CollectionUtils.isNotEmpty(errorInfo)){
String url = importOssUpload(errorInfo, EpidemicSpecialAttentionErrorModel.class); String url = importOssUpload(errorInfo, EpidemicSpecialAttentionErrorModel.class);

Loading…
Cancel
Save