Browse Source

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

dev_shibei_match
yinzuomei 4 years ago
parent
commit
8e66cde687
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 1
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentRecordFormDTO.java
  3. 15
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java
  4. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcMatterAppointmentRecordDao.java
  5. 40
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java
  6. 15
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcMatterAppointmentRecordDao.xml

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -150,6 +150,9 @@ public enum EpmetErrorCode {
// 删除可预约事项存在预约记录时提示
MATTER_EXISTS_APPOINTMENT_ERROR(8526, "尚有未履行的预约存在,请确认后操作"),
// 预约某事项在某时间段存在记录时
APPOINTMENT_TIME_ERROR(8527, "该时间段已被预约,请选择其他时间段"),
// 该错误不会提示给前端,只是后端传输错误信息用。
ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),
OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"),

1
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentRecordFormDTO.java

@ -21,6 +21,7 @@ public class AppointmentRecordFormDTO implements Serializable {
@NotBlank(message = "matterId不能为空",groups = AppointmentRecordForm.class)
private String matterId;
@NotBlank(message = "date不能为空",groups = AppointmentRecordForm.class)
private String date;
public AppointmentRecordFormDTO() {

15
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java

@ -1,8 +1,11 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -41,4 +44,16 @@ public class AppointmentRecordResultDTO implements Serializable {
* 预约时间
*/
private List<String> appointmentTime;
@JsonIgnore
private String timeId;
public AppointmentRecordResultDTO() {
this.sort = NumConstant.ZERO;
this.matterName = "";
this.appointmentName = "";
this.appointmentPhone = "";
this.remark = "";
this.appointmentTime = new ArrayList<>();
}
}

15
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcMatterAppointmentRecordDao.java

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.AppointmentRecordResultDTO;
import com.epmet.entity.IcMatterAppointmentRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 事项预约记录
@ -29,5 +33,14 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcMatterAppointmentRecordDao extends BaseDao<IcMatterAppointmentRecordEntity> {
/**
* @Description 查询预约列表
* @param matterId
* @param date
* @author zxc
* @date 2021/11/23 1:55 下午
*/
List<AppointmentRecordResultDTO> appointmentRecord(@Param("matterId")String matterId,@Param("date")String date);
}

40
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java

@ -33,7 +33,6 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.PartyServiceCenterConstant;
import com.epmet.dao.IcMatterAppointmentRecordDao;
import com.epmet.dao.IcPartyServiceCenterDao;
@ -60,8 +59,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN;
import java.util.concurrent.atomic.AtomicReference;
/**
* 党群服务中心
@ -233,8 +231,21 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
@Override
public void appointment(AppointmentFormDTO formDTO, TokenDto tokenDto) {
String customerId = tokenDto.getCustomerId();
// TODO 后台认证是不是可以预约
LambdaQueryWrapper<IcMatterAppointmentRecordEntity> 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<IcMatterAppointmentRecordEntity> records = matterAppointmentRecordDao.selectList(l);
if (CollectionUtils.isNotEmpty(records)){
List<String> timeIds = new ArrayList<>();
records.forEach(r -> {
timeIds.addAll(Arrays.asList(r.getTimeId().split(",")));
});
if (timeIds.retainAll(Arrays.asList(formDTO.getTimeId().split(",")))){
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()));
@ -346,7 +357,24 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
*/
@Override
public List<AppointmentRecordResultDTO> appointmentRecord(AppointmentRecordFormDTO formDTO) {
return null;
List<AppointmentRecordResultDTO> result = matterAppointmentRecordDao.appointmentRecord(formDTO.getMatterId(), formDTO.getDate());
if (CollectionUtils.isEmpty(result)){
return new ArrayList<>();
}
IcPartyServiceCenterMatterEntity matter = matterService.selectById(formDTO.getMatterId());
if (null == matter){
throw new RenException("事项不存在...");
}
List<TimeDTO> timeList = getTimeList(matter.getStartTime(), matter.getEndTime(), NumConstant.THIRTY);
AtomicReference<Integer> sort = new AtomicReference<>(NumConstant.ONE);
result.forEach(r -> {
r.setSort(sort.getAndSet(sort.get() + NumConstant.ONE));
List<String> time = new ArrayList<>();
List<String> list = Arrays.asList(r.getTimeId().split(","));
list.forEach(l -> timeList.stream().filter( t -> l.equals(t.getTimeId())).forEach(t -> time.add(t.getTime())));
r.setAppointmentTime(time);
});
return result;
}
public List<TimeDTO> getTimeList(String start,String end,Integer interval){

15
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcMatterAppointmentRecordDao.xml

@ -3,4 +3,19 @@
<mapper namespace="com.epmet.dao.IcMatterAppointmentRecordDao">
<!-- 查询预约列表 -->
<select id="appointmentRecord" resultType="com.epmet.dto.result.AppointmentRecordResultDTO">
SELECT
ar.APPOINTMENT_NAME,
ar.APPOINTMENT_PHONE,
ar.REMARK,
ar.TIME_ID,
cm.MATTER_NAME
FROM ic_matter_appointment_record ar
LEFT JOIN ic_party_service_center_matter cm ON (cm.ID = ar.MATTER_ID AND cm.DEL_FLAG = 0)
WHERE ar.DEL_FLAG = 0
AND ar.MATTER_ID = #{matterId}
AND ar.APPOINTMENT_DATE = #{date}
AND ar.`STATUS` = 'appointing'
</select>
</mapper>
Loading…
Cancel
Save