From 04fe3352698cb7de97167d0131d0315ef0323e8a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 29 Mar 2022 17:58:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E7=A8=8B=E4=B8=8A=E6=8A=A5=E5=8F=91?= =?UTF-8?q?=E9=80=81=E9=80=9A=E7=9F=A5=EF=BC=8C=E6=A0=B8=E7=AE=97=E5=85=B3?= =?UTF-8?q?=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/constant/IcResiUserConstant.java | 1 + .../epmet/dto/form/IcTripReportFormDTO.java | 70 +++++++++++++--- .../IcTripReportRecordController.java | 17 ++-- .../service/IcTripReportRecordService.java | 4 +- .../impl/IcTripReportRecordServiceImpl.java | 82 +++++++++++++++++-- 5 files changed, 144 insertions(+), 30 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java index aedf4def93..4d956d1fca 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java +++ b/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"; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java index 0088bb3183..45fc03e76b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java +++ b/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 channel = new ArrayList<>(); + /** + * pc录入时用 + * 通知内容 + */ + private String content = ""; + + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java index 45fe80dc05..0e7ee6b100 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java +++ b/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 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java index 001b3d65e4..5c8142cfbe 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java @@ -50,14 +50,14 @@ public interface IcTripReportRecordService extends BaseService 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 data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage()) @@ -86,6 +84,14 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl list(Map params) { List entityList = baseDao.selectList(getWrapper(params)); @@ -108,11 +114,69 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) { + SendNoticeFormDTO dto = new SendNoticeFormDTO(); + List 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 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