From c2de6caf769a533194beec5224b727fda4a5a8a5 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 30 Dec 2021 14:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E9=A2=84=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/AppointmentMiniFormDTO.java | 62 +++++++++++++++++++ .../IcPartyServiceCenterController.java | 7 +++ .../service/IcPartyServiceCenterService.java | 1 + .../impl/IcPartyServiceCenterServiceImpl.java | 57 +++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentMiniFormDTO.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentMiniFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentMiniFormDTO.java new file mode 100644 index 0000000000..30afc1b872 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentMiniFormDTO.java @@ -0,0 +1,62 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/11/22 2:00 下午 + * @DESC + */ +@Data +public class AppointmentMiniFormDTO implements Serializable { + + private static final long serialVersionUID = -7113952715343314153L; + + public interface AppointmentMiniForm{} + + /** + * 事项ID + */ + @NotBlank(message = "matterId不能为空",groups = AppointmentMiniForm.class) + private String matterId; + + /** + * 预约日期 + */ + @NotBlank(message = "appointmentDate不能为空",groups = AppointmentMiniForm.class) + private String appointmentDate; + + /** + * 预约编号 + */ + @NotBlank(message = "timeId不能为空",groups = AppointmentMiniForm.class) + private String timeId; + + /** + * 预约人 + */ + private String appointmentName; + + /** + * 预约电话 + */ + private String appointmentPhone; + + /** + * 备注 + */ + private String remark; + + /** + * 组织ID + */ + private String orgId; + + /** + * 组织类型,grid:网格,agency:组织 + */ + private String orgType; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java index 3b2872a7f3..a2f71aa778 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java @@ -155,6 +155,13 @@ public class IcPartyServiceCenterController { return new Result(); } + @PostMapping("appointmentmini") + public Result appointmentMini(@RequestBody AppointmentMiniFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, AppointmentMiniFormDTO.AppointmentMiniForm.class); + icPartyServiceCenterService.appointmentMini(formDTO,tokenDto); + return new Result(); + } + /** * @Description 党群服务中心列表 * @param formDTO diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java index 37d93ce41a..c8ef99388e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java @@ -133,6 +133,7 @@ public interface IcPartyServiceCenterService extends BaseService page(Map params) { @@ -313,6 +317,59 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl l = new LambdaQueryWrapper<>(); + l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId()) + .eq(IcMatterAppointmentRecordEntity::getAppointmentDate,formDTO.getAppointmentDate()) + .eq(IcMatterAppointmentRecordEntity::getStatus,PartyServiceCenterConstant.APPOINTMENT_STATUS_APPOINTING) + .eq(BaseEpmetEntity::getDelFlag,NumConstant.ZERO); + List records = matterAppointmentRecordDao.selectList(l); + Result userInfoResult = userOpenFeignClient.selectUserBaseInfo(tokenDto); + if (!userInfoResult.success()){ + throw new EpmetException("查询用户信息失败..."); + } + formDTO.setAppointmentName(userInfoResult.getData().getRealName()); + formDTO.setAppointmentPhone(userInfoResult.getData().getMobile()); + if (CollectionUtils.isNotEmpty(records)){ + List timeIds = new ArrayList<>(); + records.forEach(r -> { + timeIds.addAll(Arrays.asList(r.getTimeId().split(","))); + }); + List formTimeId = Arrays.asList(formDTO.getTimeId().split(",")); + int before = timeIds.size() + formTimeId.size(); + List endTimeId = new ArrayList<>(); + endTimeId.addAll(timeIds);endTimeId.addAll(formTimeId); + List collect = endTimeId.stream().distinct().collect(Collectors.toList()); + if (collect.size() < before){ + throw new RenException(EpmetErrorCode.APPOINTMENT_TIME_ERROR.getCode()); + } + } + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId()); + if (null == staffInfo){ + throw new RenException(String.format("查询人员{%s}信息失败",tokenDto.getUserId())); + } + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + if (null == agencyInfo){ + throw new RenException(String.format("查询组织信息失败%s",staffInfo.getAgencyId())); + } + IcMatterAppointmentRecordEntity e = ConvertUtils.sourceToTarget(formDTO, IcMatterAppointmentRecordEntity.class); + e.setCustomerId(customerId); + if (StringUtils.isNotBlank(formDTO.getOrgId())){ + e.setOrgId(formDTO.getOrgId()); + e.setOrgType(formDTO.getOrgType()); + }else { + e.setOrgId(staffInfo.getAgencyId()); + e.setOrgType(PartyServiceCenterConstant.ORG_TYPE_AGENCY); + } + e.setPid(agencyInfo.getPid()); + e.setPids(agencyInfo.getPids()); + e.setStatus(PartyServiceCenterConstant.APPOINTMENT_STATUS_APPOINTING); + matterAppointmentRecordDao.insert(e); + } + /** * @Description 党群服务中心列表 * @param formDTO