Browse Source

修改新冠疫苗预约提示,修改每日预约最大值来源。

lighter 4 years ago
parent
commit
b2f9ab5906

+ 6 - 0
src/main/java/thyyxxk/wxservice_server/dao/CovidVaccinateAppointmentDao.java

@@ -31,6 +31,12 @@ public interface CovidVaccinateAppointmentDao {
     int selectValidAppointment(@Param("socialNo") String socialNo,
                                @Param("executeDate") Date executeDate);
 
+    @Select("select value from t_covid_vaccinate_threshold where date=#{date}")
+    Integer selectThresholdByDate(Date date);
+
+    @Insert("insert into t_covid_vaccinate_threshold (date,value) values (#{date}, 150)")
+    void insertNewThresholdByDate(Date date);
+
     @Select("select count(1) from t_covid_vaccinate_appointment where execute_date=#{executeDate} and isnull(del_flag,0)!=1")
     int selectTotalCountByDate(@Param("executeDate") Date executeDate);
 }

+ 13 - 11
src/main/java/thyyxxk/wxservice_server/service/CovidVaccinateAppointmentService.java

@@ -59,28 +59,29 @@ public class CovidVaccinateAppointmentService {
         }
         param.setAge(age);
         param.setSex(IdCardUtil.calSexByIdCard(param.getSocialNo()));
+        String dateFormatted = DateUtil.formatDatetime(param.getExecuteDate(), "yyyy-MM-dd");
         if (dao.selectValidAppointment(param.getSocialNo(), param.getExecuteDate()) > 0) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您在【" +
-                    DateUtil.formatDatetime(param.getExecuteDate(), "yyyy-MM-dd") +
-                    "】已存在有效的预约,请勿重复预约。");
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您在【" + dateFormatted + "】已存在有效的预约,请勿重复预约。");
+        }
+        Integer threshold = dao.selectThresholdByDate(param.getExecuteDate());
+        if (null == threshold) {
+            dao.insertNewThresholdByDate(param.getExecuteDate());
+            threshold = 150;
         }
         int count = dao.selectTotalCountByDate(param.getExecuteDate());
-        if (count >= 150) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【" +
-                    DateUtil.formatDatetime(param.getExecuteDate(), "yyyy-MM-dd") +
-                    "】的预约名额已满,请选择其他预约日期。");
+        if (count >= threshold) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【" + dateFormatted + "】的预约名额已满,请选择其他预约日期。");
         }
         dao.insertNewAppointment(param);
         if (null != param.getPatientId() && !param.getPatientId().trim().equals("")) {
             dao.updatePhoneAndSocialNo(param.getPatientId(), param.getSocialNo(), param.getPhone());
             String msgContent = "{\"touser\":\"\",\"data\":" +
-                    "{\"keyword2\":{\"color\":\"#173177\",\"value\":\"" +
-                    DateUtil.formatDatetime(param.getExecuteDate(), "yyyy-MM-dd") + "\"}," +
+                    "{\"keyword2\":{\"color\":\"#173177\",\"value\":\"" + dateFormatted + "\"}," +
                     "\"keyword1\":{\"color\":\"#173177\",\"value\":\"" + param.getName() + "\"}," +
                     "\"keyword3\":{\"color\":\"#173177\",\"value\":\"" + (++count) + "\"}," +
                     "\"remark\":{\"color\":\"#FF0000\",\"value\":\"感谢您的使用,祝您健康!\"}," +
                     "\"first\":{\"color\":\"#FF0000\",\"value\":\"您已成功预约新冠疫苗接种服务。" +
-                    "请在预约日期当天凭本人身份证在【泰和医院门诊大楼五楼体检中心】接种新冠疫苗。\"}}," +
+                    "请于【" + dateFormatted + "】凭本人身份证在【泰和医院门诊大楼五楼体检中心】接种新冠疫苗。\"}}," +
                     "\"template_id\":\"zVSzbYLmdqq_h1IcTPSwi6X4qFm0j9aTVeLZPxR03Bs\"," +
                     "\"url\":\"\"}";
             PushMessageParam pojo = new PushMessageParam();
@@ -90,6 +91,7 @@ public class CovidVaccinateAppointmentService {
             wxApiService.pushMessage(pojo);
         }
         log.info("预约新冠疫苗接种:{}", JSONObject.toJSONStringWithDateFormat(param, "yyyy-MM-dd HH:mm:ss"));
-        return ResultVoUtil.success("您已成功预约新冠疫苗接种服务。请在预约日期当天凭本人身份证在【泰和医院门诊大楼五楼体检中心】接种新冠疫苗。");
+        return ResultVoUtil.success("您已成功预约新冠疫苗接种服务。请于【" + dateFormatted + "】" +
+                "凭本人身份证在【泰和医院门诊大楼五楼体检中心】接种新冠疫苗。");
     }
 }

+ 1 - 1
src/main/resources/application-prod.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8083
+  port: 8085
   servlet:
     context-path: /wxserver
 spring: