Browse Source

禅道4689: 党群服务中心服务事项增加自定义选项功能开发

feature/evaluate
sunyuchao 3 years ago
parent
commit
10814fd0e3
  1. 35
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  2. 7
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcPartyServiceCenterMatterDTO.java
  3. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/MatterListDTO.java
  4. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java
  5. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcPartyServiceCenterMatterEntity.java
  6. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java
  7. 7
      epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.47__alter_ic_party_service_center_matter.sql
  8. 4
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml

35
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -1077,4 +1077,39 @@ public class DateUtils {
calendar.add(Calendar.DAY_OF_MONTH, day);
return calendar.getTime();
}
/**
* @Description 获取自定义周几对应的日期
* num=7str="1,2" 表示获取未来周天周一出现的日期两个总共出现七次
* 比如今天1号是周一则得到的值是1号7号8号14号15号21号22号7次的日期
*/
public static List<String> getCustomDay(Date startDate, int num, String str) {
List<String> result = new ArrayList<>();
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(startDate);
rightNow.add(Calendar.DATE,-1);
startDate = rightNow.getTime();
Date tomorrow;
Integer tag = 1;
while (tag <= num){
tomorrow = getTomorrow(startDate);
// 返回周末
if (isContain(tomorrow, str)) {
result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow));
tag++;
}
startDate = tomorrow;
}
return result;
}
/**
* @Description 判断日期对应的周几在字符串是否包含
* 当前时间为22.11.28为周一对应是一周的第二天判断2在str字符串是否包含
*/
private static boolean isContain(Date date, String str) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return str.contains(String.valueOf(cal.get(Calendar.DAY_OF_WEEK)));
}
}

7
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcPartyServiceCenterMatterDTO.java

@ -50,10 +50,15 @@ public class IcPartyServiceCenterMatterDTO implements Serializable {
private String matterName;
/**
* 预约类型每天everyDay工作日workDay周末weekend
* 预约类型每天everyDay工作日workDay周末weekend 自定义custom
*/
private String appointmentType;
/**
* 类型为自定义时选择的周一~周末的时间1-7逗号分割
*/
private String customDay;
/**
* 可预约开始时间
*/

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/MatterListDTO.java

@ -40,6 +40,8 @@ public class MatterListDTO implements Serializable {
private String matterImg;
private String customDay;
public MatterListDTO() {
this.sort = NumConstant.ZERO;
this.matterName = "";

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java

@ -16,5 +16,6 @@ public interface PartyServiceCenterConstant {
String APPOINTMENT_TYPE_EVERY_DAY = "everyDay";
String APPOINTMENT_TYPE_WORK_DAY = "workDay";
String APPOINTMENT_TYPE_WEEKEND = "weekend";
String APPOINTMENT_TYPE_CUSTOM = "custom";
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcPartyServiceCenterMatterEntity.java

@ -46,10 +46,15 @@ public class IcPartyServiceCenterMatterEntity extends BaseEpmetEntity {
private String matterName;
/**
* 预约类型每天everyDay工作日workDay周末weekend
* 预约类型每天everyDay工作日workDay周末weekend 自定义custom
*/
private String appointmentType;
/**
* 类型为自定义时选择的周一~周末的时间1-7逗号分割
*/
private String customDay;
/**
* 可预约开始时间
*/

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

@ -327,7 +327,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
if (null == entity){
throw new EpmetException("不存在此预约事项");
}
List<String> dateList = getDateList(entity.getAppointmentType());
List<String> dateList = getDateList(entity.getAppointmentType(), entity.getCustomDay());
Boolean s = false;
for (String d : dateList) {
if (d.equals(formDTO.getAppointmentDate())){
@ -388,7 +388,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
if (null == entity){
throw new EpmetException("不存在此预约事项");
}
List<String> dateList = getDateList(entity.getAppointmentType());
List<String> dateList = getDateList(entity.getAppointmentType(), entity.getCustomDay());
Boolean s = false;
for (String d : dateList) {
if (d.equals(formDTO.getAppointmentDate())){
@ -499,7 +499,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
throw new RenException("事项不存在...");
}
result.setAppointmentType(matter.getAppointmentType());
result.setDateList(getDateList(result.getAppointmentType()));
result.setDateList(getDateList(result.getAppointmentType(), matter.getCustomDay()));
LambdaQueryWrapper<IcMatterAppointmentRecordEntity> l = new LambdaQueryWrapper<>();
l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId())
.eq(IcMatterAppointmentRecordEntity::getAppointmentDate,formDTO.getDate())
@ -564,14 +564,16 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ
return result;
}
public List<String> getDateList(String type) {
public List<String> getDateList(String type, String customDay) {
List<String> result = new ArrayList<>();
if (type.equals(PartyServiceCenterConstant.APPOINTMENT_TYPE_EVERY_DAY)){
result = DateUtils.getEveryDayList(new Date(),NumConstant.SEVEN);
}else if (type.equals(PartyServiceCenterConstant.APPOINTMENT_TYPE_WORK_DAY)){
result = DateUtils.getWorkDayList(new Date(),NumConstant.SEVEN);
}else {
}else if (type.equals(PartyServiceCenterConstant.APPOINTMENT_TYPE_WEEKEND)){
result = DateUtils.getWeekendDayList(new Date(),NumConstant.SEVEN);
}else if (type.equals(PartyServiceCenterConstant.APPOINTMENT_TYPE_CUSTOM)){
result = DateUtils.getCustomDay(new Date(),NumConstant.SEVEN, customDay);
}
return result;
}

7
epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.47__alter_ic_party_service_center_matter.sql

@ -0,0 +1,7 @@
ALTER TABLE `ic_party_service_center_matter`
MODIFY COLUMN `APPOINTMENT_TYPE` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '预约类型,每天:everyDay,工作日:workDay,周末:weekend , 自定义:custom' AFTER `MATTER_NAME`,
ADD COLUMN `CUSTOM_DAY` varchar(32) NULL COMMENT '类型为自定义时选择的周一~周末的时间(1-7逗号分割)' AFTER `APPOINTMENT_TYPE`;

4
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml

@ -27,8 +27,10 @@
case when cm.APPOINTMENT_TYPE = 'everyDay' THEN CONCAT('每天',' ', cm.START_TIME,'-',cm.END_TIME)
when cm.APPOINTMENT_TYPE = 'workDay' THEN CONCAT('工作日',' ', cm.START_TIME,'-',cm.END_TIME)
when cm.APPOINTMENT_TYPE = 'weekend' THEN CONCAT('周末',' ', cm.START_TIME,'-',cm.END_TIME)
when cm.APPOINTMENT_TYPE = 'custom' THEN CONCAT('自定义',' ', cm.START_TIME,'-',cm.END_TIME)
ELSE CONCAT(cm.START_TIME,'-',cm.END_TIME) END AS allowTime,
IFNULL(cm.MATTER_IMG,'') AS matterImg
IFNULL(cm.MATTER_IMG,'') AS matterImg,
cm.custom_day AS customDay
from ic_party_service_center_matter cm
where del_flag = 0
and PARTY_SERVICE_CENTER_ID = #{partyServiceCenterId}

Loading…
Cancel
Save