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-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java index 0d038cf71a..c4113e4f9b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java +++ b/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; /** * 用户列表 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java index eb40b5fe23..b0b8a31553 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java +++ b/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(); } 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/dao/IcNatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java index 4ac7359f2e..97b365bb6f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java @@ -36,4 +36,10 @@ public interface IcNatDao extends BaseDao { * @Description 删除/取消同步操作--物理删除业务数据 **/ int delById(@Param("icNatId") String icNatId); + + /** + * 插入或者更新 + * @param e + */ + void insertOrUpdate(IcNatEntity e); } 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 imp * @param entities */ public void batchPersist(List entities) { - insertBatch(entities); + //insertBatch(entities); + String currentUserId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); + entities.forEach(e -> { + String id = IdWorker.getIdStr(e); + e.setId(id); + e.setUpdatedBy(currentUserId); + baseDao.insertOrUpdate(e); + }); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java index 19f57c0a73..44f3355497 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java +++ b/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 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 diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.28__nat_add_uniquekey.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.28__nat_add_uniquekey.sql new file mode 100644 index 0000000000..5cf24b3bec --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.28__nat_add_uniquekey.sql @@ -0,0 +1 @@ +alter table ic_nat add index unq_nat(ID_CARD, NAT_TIME) \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml index 1f325c92e3..28b4129229 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml @@ -67,4 +67,22 @@ DELETE FROM ic_nat WHERE id = #{icNatId} + + INSERT INTO epmet_user.ic_nat + (ID, CUSTOMER_ID, AGENCY_ID, PIDS, USER_ID, + USER_TYPE, NAME, MOBILE, ID_CARD, NAT_TIME, NAT_RESULT, NAT_ADDRESS, FILE_NAME, ATTACHMENT_TYPE, ATTACHMENT_URL, + DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) + VALUES (#{id}, #{customerId}, #{agencyId}, #{pids}, #{userId}, + #{userType}, #{name}, #{mobile}, #{idCard}, #{natTime}, + #{natResult}, #{natAddress}, #{fileName}, #{attachmentType}, #{attachmentUrl}, + #{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy}, + #{updatedTime}) + ON DUPLICATE KEY update + NAME=#{name}, + MOBILE=#{mobile}, + NAT_ADDRESS=#{natAddress}, + NAT_RESULT=#{natResult}, + UPDATED_BY=#{updatedBy}, + UPDATED_TIME=NOW() +