Browse Source

Merge remote-tracking branch 'origin/dev_epidemic_situation' into dev_epidemic_situation

dev
wangxianzhang 3 years ago
parent
commit
148da4d60e
  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. 1
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java
  4. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EpidemicPreventionResultDTO.java
  5. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java
  6. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java
  7. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java
  8. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java
  9. 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_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.NotNull;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 行程上报居民端入参
@ -22,6 +24,12 @@ public class IcTripReportFormDTO implements Serializable {
public interface ResiUserRequired extends CustomerClientShowGroup {
}
public interface PcInternalGroup {
}
public interface PcRequired extends CustomerClientShowGroup {
}
public interface IcResiInternalGroup {
}
/**
* 客户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;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = {ResiUserRequired.class})
@NotBlank(message = "手机号不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String mobile;
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class})
@NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class,PcRequired.class})
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;
/**
* 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区
*/
@NotBlank(message = "现居地名称不能为空", groups = {ResiUserRequired.class})
@NotBlank(message = "现居地名称不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String presentAddress;
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空", groups = {ResiUserRequired.class})
@NotBlank(message = "详细地址不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String detailAddress;
/**
* 来源地区编码
*/
@NotBlank(message = "来自地区编码不能为空", groups = {ResiUserRequired.class})
@NotBlank(message = "来自地区编码不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String sourceAddressCode;
/**
* 来源地区地址
*/
@NotBlank(message = "来自地区名称不能为空", groups = {ResiUserRequired.class})
@NotBlank(message = "来自地区名称不能为空", groups = {ResiUserRequired.class,PcRequired.class})
private String sourceAddress;
/**
@ -80,7 +93,7 @@ public class IcTripReportFormDTO implements Serializable {
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@NotNull(message = "来到本地时间不能为空", groups = {ResiUserRequired.class})
@NotNull(message = "来到本地时间不能为空", groups = {ResiUserRequired.class,PcRequired.class})
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;
@NotBlank(message = "网格不能为空", groups = {ResiUserInternalGroup.class})
/**
* userType=icresi时必填,取值居民所属的网格ID
* 居民端小程序上报前端赋值当前用户所在的网格id
*/
@NotBlank(message = "网格不能为空", groups = {ResiUserInternalGroup.class,IcResiInternalGroup.class})
private String gridId;
//后端自己赋值
/**
* 用户id
* 居民端上报时后端自己赋值
* pc录入如果是从居民信息选择此列有值
*/
@NotBlank(message = "userId不能为空", groups = {IcResiInternalGroup.class})
private String userId;
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
* 居民端上报是后端赋值
* pc录入是前端赋值
*/
@NotBlank(message = "数字社区的居民:icresi;其他:other", groups = {PcInternalGroup.class})
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 = "";
}

1
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java

@ -18,6 +18,7 @@ import java.util.List;
public class SendNoticeFormDTO implements Serializable {
private static final long serialVersionUID = 4800907725063604885L;
private String customerId;
private String staffId;
/**
* 用户列表
*/

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EpidemicPreventionResultDTO.java

@ -40,9 +40,9 @@ public class EpidemicPreventionResultDTO implements Serializable {
/**
* 疫苗接种次数
*/
private Double vaccineCount;
private Integer vaccineCount;
/**
* 核酸检测次数
*/
private Double natCount;
private Integer natCount;
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java

@ -6,22 +6,19 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.FileUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.FileUtils;
import com.epmet.commons.tools.utils.Result;
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.constants.ImportTaskConstants;
import com.epmet.dto.IcNatDTO;
import com.epmet.dto.form.AddIcNatFormDTO;
@ -33,8 +30,6 @@ import com.epmet.dto.result.NatListResultDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcNatService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -42,16 +37,14 @@ import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@ -263,6 +256,7 @@ public class IcNatController implements ResultDataResolver {
PageData<NatListResultDTO> data = null;
do {
data = icNucleinService.natList(formDTO);
data.getList().forEach(o->o.setNatResult(NumConstant.ONE_STR.equals(o.getNatResult())?"阳性":"阴性"));
formDTO.setPageNo(++pageNo);
excelWriter.write(data.getList(), writeSheet);
} while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size()==formDTO.getPageSize());

1
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java

@ -74,6 +74,7 @@ public class IcNoticeController {
public Result sendNotice(@LoginUser TokenDto tokenDto, @RequestBody SendNoticeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, DefaultGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
icNoticeService.sendNotice(formDTO);
return new Result();
}

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.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.constant.IcResiUserConstant;
@ -59,16 +58,20 @@ public class IcTripReportRecordController {
/**
* pc: 行程上报-新增
* @param dto
* @param formDTO
* @return
*/
@NoRepeatSubmit
@PostMapping("save")
public Result save(@RequestBody IcTripReportRecordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
icTripReportRecordService.save(dto);
return new Result();
public Result save(@LoginUser TokenDto tokenDto,@RequestBody IcTripReportFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCurrentStaffId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.PcRequired.class,IcTripReportFormDTO.PcInternalGroup.class);
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

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);
/**
* 默认保存
* pc: 行程上报-新增
*
* @param dto
* @return void
* @author generator
* @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.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;
@ -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.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.IcResiUserConstant;
import com.epmet.dao.IcTripReportRecordDao;
import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dto.IcEpidemicSpecialAttentionDTO;
import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.dto.form.IcTripReportFormDTO;
import com.epmet.dto.form.MyReportedTripFormDTO;
import com.epmet.dto.form.PageTripReportFormDTO;
import com.epmet.dto.form.*;
import com.epmet.entity.IcTripReportRecordEntity;
import com.epmet.service.IcEpidemicSpecialAttentionService;
import com.epmet.service.IcNoticeService;
@ -58,10 +59,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
@Override
public PageData<IcTripReportRecordDTO> page(PageTripReportFormDTO formDTO) {
//1.获取工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(formDTO.getCustomerId(),formDTO.getUserId());
formDTO.setAgencyId(staffInfo.getAgencyId());
//2.按条件查询业务数据
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());
}
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
public List<IcTripReportRecordDTO> list(Map<String, Object> params) {
List<IcTripReportRecordEntity> entityList = baseDao.selectList(getWrapper(params));
@ -108,11 +114,69 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
return ConvertUtils.sourceToTarget(entity, IcTripReportRecordDTO.class);
}
/**
* pc: 行程上报-新增
* @param formDTO
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void save(IcTripReportRecordDTO dto) {
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcTripReportRecordEntity.class);
public String save(IcTripReportFormDTO formDTO) {
//如果是单个录入的,默认数据属于当前用户所属组织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);
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

Loading…
Cancel
Save