Browse Source

行程上报发送通知,核算关注

dev
yinzuomei 3 years ago
parent
commit
04fe335269
  1. 1
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java
  2. 70
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java
  3. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java
  4. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java
  5. 82
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java

1
epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java

@ -13,4 +13,5 @@ public interface IcResiUserConstant {
*/ */
String USER_TYPE_RESI="resi"; String USER_TYPE_RESI="resi";
String USER_TYPE_IC_RESI="icresi"; String USER_TYPE_IC_RESI="icresi";
String USER_TYPE_OTHER="other";
} }

70
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java

@ -9,7 +9,9 @@ import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 行程上报居民端入参 * 行程上报居民端入参
@ -22,6 +24,12 @@ public class IcTripReportFormDTO implements Serializable {
public interface ResiUserRequired extends CustomerClientShowGroup { public interface ResiUserRequired extends CustomerClientShowGroup {
} }
public interface PcInternalGroup {
}
public interface PcRequired extends CustomerClientShowGroup {
}
public interface IcResiInternalGroup {
}
/** /**
* 客户Id * 客户Id
*/ */
@ -30,49 +38,54 @@ public class IcTripReportFormDTO implements Serializable {
/** /**
* 姓名 * 姓名
*/ */
@NotBlank(message = "姓名不能为空", groups = {ResiUserRequired.class}) @NotBlank(message = "姓名不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String name; private String name;
/** /**
* 手机号 * 手机号
*/ */
@NotBlank(message = "手机号不能为空", groups = {ResiUserRequired.class}) @NotBlank(message = "手机号不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String mobile; private String mobile;
/** /**
* 身份证号 * 身份证号
*/ */
@NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class}) @NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String idCard; private String idCard;
/**
* 是否添加到核算检测关注名单,true加入默认false不加入
*/
@NotNull(message = "是否添加到核算检测关注名单", groups = {PcRequired.class})
private Boolean heSuanCheck;
/** /**
* 现居地编码 * 现居地编码
*/ */
@NotBlank(message = "现居地编码不能为空", groups = {ResiUserRequired.class}) @NotBlank(message = "现居地编码不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String presentAddressCode; private String presentAddressCode;
/** /**
* 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区 * 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区
*/ */
@NotBlank(message = "现居地名称不能为空", groups = {ResiUserRequired.class}) @NotBlank(message = "现居地名称不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String presentAddress; private String presentAddress;
/** /**
* 详细地址 * 详细地址
*/ */
@NotBlank(message = "详细地址不能为空", groups = {ResiUserRequired.class}) @NotBlank(message = "详细地址不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String detailAddress; private String detailAddress;
/** /**
* 来源地区编码 * 来源地区编码
*/ */
@NotBlank(message = "来自地区编码不能为空", groups = {ResiUserRequired.class}) @NotBlank(message = "来自地区编码不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String sourceAddressCode; private String sourceAddressCode;
/** /**
* 来源地区地址 * 来源地区地址
*/ */
@NotBlank(message = "来自地区名称不能为空", groups = {ResiUserRequired.class}) @NotBlank(message = "来自地区名称不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String sourceAddress; private String sourceAddress;
/** /**
@ -80,7 +93,7 @@ public class IcTripReportFormDTO implements Serializable {
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@NotNull(message = "来到本地时间不能为空", groups = {ResiUserRequired.class}) @NotNull(message = "来到本地时间不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private Date arriveDate; private Date arriveDate;
/** /**
@ -93,23 +106,56 @@ public class IcTripReportFormDTO implements Serializable {
/** /**
* 备注信息 * 备注信息
*/ */
@Length(max = 500, message = "备注最多可输入500字", groups = {ResiUserRequired.class}) @Length(max = 500, message = "备注最多可输入500字", groups = {ResiUserRequired.class,PcRequired.class})
private String remark; private String remark;
@NotBlank(message = "网格不能为空", groups = {ResiUserInternalGroup.class}) /**
* userType=icresi时必填,取值居民所属的网格ID
* 居民端小程序上报前端赋值当前用户所在的网格id
*/
@NotBlank(message = "网格不能为空", groups = {ResiUserInternalGroup.class,IcResiInternalGroup.class})
private String gridId; private String gridId;
//后端自己赋值
/** /**
* 用户id * 用户id
* 居民端上报时后端自己赋值
* pc录入如果是从居民信息选择此列有值
*/ */
@NotBlank(message = "userId不能为空", groups = {IcResiInternalGroup.class})
private String userId; private String userId;
/** /**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other * 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
* 居民端上报是后端赋值
* pc录入是前端赋值
*/ */
@NotBlank(message = "数字社区的居民:icresi;其他:other", groups = {PcInternalGroup.class})
private String userType; private String userType;
/**
* userType=icresi时必填
* 居民所属的组织id
*/
@NotBlank(message = "agencyId不能为空", groups = {IcResiInternalGroup.class})
private String agencyId;
/**
* pc录入时用
*/
private String currentStaffId;
/**
* pc录入时用
* 通知渠道 0小程序通知1短信通知
*/
private List<String> channel = new ArrayList<>();
/**
* pc录入时用
* 通知内容
*/
private String content = "";
} }

17
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java

@ -8,7 +8,6 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils; 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.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.IcResiUserConstant; import com.epmet.constant.IcResiUserConstant;
@ -59,16 +58,20 @@ public class IcTripReportRecordController {
/** /**
* pc: 行程上报-新增 * pc: 行程上报-新增
* @param dto * @param formDTO
* @return * @return
*/ */
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("save") @PostMapping("save")
public Result save(@RequestBody IcTripReportRecordDTO dto){ public Result save(@LoginUser TokenDto tokenDto,@RequestBody IcTripReportFormDTO formDTO){
//效验数据 formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); formDTO.setCurrentStaffId(tokenDto.getUserId());
icTripReportRecordService.save(dto); ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.PcRequired.class,IcTripReportFormDTO.PcInternalGroup.class);
return new Result(); if(IcResiUserConstant.USER_TYPE_IC_RESI.equals(formDTO.getUserType())){
ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.IcResiInternalGroup.class);
}
String id=icTripReportRecordService.save(formDTO);
return new Result().ok(id);
} }
@NoRepeatSubmit @NoRepeatSubmit

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java

@ -50,14 +50,14 @@ public interface IcTripReportRecordService extends BaseService<IcTripReportRecor
IcTripReportRecordDTO get(String id); IcTripReportRecordDTO get(String id);
/** /**
* 默认保存 * pc: 行程上报-新增
* *
* @param dto * @param dto
* @return void * @return void
* @author generator * @author generator
* @date 2022-03-25 * @date 2022-03-25
*/ */
void save(IcTripReportRecordDTO dto); String save(IcTripReportFormDTO dto);
/** /**
* 默认更新 * 默认更新

82
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java

@ -3,6 +3,7 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; 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.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
@ -12,12 +13,12 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.IcResiUserConstant;
import com.epmet.dao.IcTripReportRecordDao; import com.epmet.dao.IcTripReportRecordDao;
import com.epmet.dao.UserBaseInfoDao; import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dto.IcEpidemicSpecialAttentionDTO;
import com.epmet.dto.IcTripReportRecordDTO; import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.dto.form.IcTripReportFormDTO; import com.epmet.dto.form.*;
import com.epmet.dto.form.MyReportedTripFormDTO;
import com.epmet.dto.form.PageTripReportFormDTO;
import com.epmet.entity.IcTripReportRecordEntity; import com.epmet.entity.IcTripReportRecordEntity;
import com.epmet.service.IcEpidemicSpecialAttentionService; import com.epmet.service.IcEpidemicSpecialAttentionService;
import com.epmet.service.IcNoticeService; import com.epmet.service.IcNoticeService;
@ -58,10 +59,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
@Override @Override
public PageData<IcTripReportRecordDTO> page(PageTripReportFormDTO formDTO) { public PageData<IcTripReportRecordDTO> page(PageTripReportFormDTO formDTO) {
//1.获取工作人员缓存信息 //1.获取工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(formDTO.getCustomerId(),formDTO.getUserId());
if (null == staffInfo) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
formDTO.setAgencyId(staffInfo.getAgencyId()); formDTO.setAgencyId(staffInfo.getAgencyId());
//2.按条件查询业务数据 //2.按条件查询业务数据
PageInfo<IcTripReportRecordDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) PageInfo<IcTripReportRecordDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage())
@ -86,6 +84,14 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
return new PageData(list, data.getTotal()); return new PageData(list, data.getTotal());
} }
private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId);
if (null == staffInfo) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
return staffInfo;
}
@Override @Override
public List<IcTripReportRecordDTO> list(Map<String, Object> params) { public List<IcTripReportRecordDTO> list(Map<String, Object> params) {
List<IcTripReportRecordEntity> entityList = baseDao.selectList(getWrapper(params)); List<IcTripReportRecordEntity> entityList = baseDao.selectList(getWrapper(params));
@ -108,11 +114,69 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
return ConvertUtils.sourceToTarget(entity, IcTripReportRecordDTO.class); return ConvertUtils.sourceToTarget(entity, IcTripReportRecordDTO.class);
} }
/**
* pc: 行程上报-新增
* @param formDTO
*/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(IcTripReportRecordDTO dto) { public String save(IcTripReportFormDTO formDTO) {
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcTripReportRecordEntity.class); //如果是单个录入的,默认数据属于当前用户所属组织id
if(IcResiUserConstant.USER_TYPE_OTHER.equals(formDTO.getUserType())){
//获取当前登录用户所属组织id
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(formDTO.getCustomerId(),formDTO.getCurrentStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
}
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcTripReportRecordEntity.class);
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(entity.getAgencyId());
if (null == agencyInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询组织信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
entity.setPids(agencyInfoCache.getPids());
//1.插入行程记录表
insert(entity); insert(entity);
if(formDTO.getHeSuanCheck()){
// 2.加入核算检测关注名单
vaccinationAdd(formDTO);
}
//3.新增通知表信息
if (formDTO.getChannel().size() > NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) {
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>();
//注意这里的userId是指的pc平台的居民
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class));
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserList(userList);
dto.setChannel(formDTO.getChannel());
//通知来源 0 行程上报,1 疫苗接种,2 核酸检测
dto.setOrigin(NumConstant.ZERO_STR);
dto.setContent(formDTO.getContent());
dto.setOrgName(agencyInfoCache.getOrganizationName());
icNoticeService.sendNotice(dto);
}
return entity.getId();
}
/**
* 加入核算检测关注
* @param formDTO
*/
private void vaccinationAdd(IcTripReportFormDTO formDTO) {
VaccinationAddFormDTO vaccinationAddFormDTO=new VaccinationAddFormDTO();
vaccinationAddFormDTO.setCustomerId(formDTO.getCustomerId());
vaccinationAddFormDTO.setUserId(formDTO.getCurrentStaffId());
List<IcEpidemicSpecialAttentionDTO> list =new ArrayList<>();
IcEpidemicSpecialAttentionDTO dto=new IcEpidemicSpecialAttentionDTO();
dto.setName(formDTO.getName());
dto.setIdCard(formDTO.getIdCard());
dto.setMobile(formDTO.getMobile());
//避免再发通知,赋值个空集合吧
dto.setChannel(Collections.emptyList());
//关注类型,核酸检测:2,疫苗接种:1;行程上报:0
dto.setAttentionType(NumConstant.ZERO);
list.add(dto);
vaccinationAddFormDTO.setList(list);
epidemicSpecialAttentionService.vaccinationAdd( vaccinationAddFormDTO);
} }
@Override @Override

Loading…
Cancel
Save