Commit 644ed526 authored by lings's avatar lings

Merge branch 'master' into lings

parents 001d6c27 d6853aed
# hmit-security-enterprise
\ No newline at end of file
# hmit-security-enterprise
## 订单状态 appointment_order 表 status
***
### status 0 失约/爽约
### status 1 已预约
### status 2 预约已取消
### status 3 已取号
### status 4 消除无效号码
***
***
## 预约时间维护
####数据库中calendar表存放年日期,由于预约时间排除法定节假日
####因此需要按年更新表中节假日信息(定时任务UpdateHoliday 每年1月1号执行)
####只更新当前年份, 也可在定时任务执行时传入年份参数 2021
####截止2021年3月节假日接口只能提前更新一年的信息
#### 表中基本数据维护到2030年12-30日
***
\ No newline at end of file
package io.hmit.modules.appointment.dao;
import io.hmit.common.dao.BaseDao;
import io.hmit.modules.appointment.entity.CalendarrEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CalendarrDao extends BaseDao<CalendarrEntity> {
}
package io.hmit.modules.appointment.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class CalendarrDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String day;
private Integer holiday;
private Integer dow;
}
package io.hmit.modules.appointment.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@TableName("calendar")
public class CalendarrEntity {
private Integer id;
private String day;
private Integer holiday;
private Integer dow;
}
package io.hmit.modules.appointment.service;
import io.hmit.common.service.CrudService;
import io.hmit.modules.appointment.dto.CalendarrDTO;
import io.hmit.modules.appointment.entity.CalendarrEntity;
/**
* 新闻管理
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-01-26
*/
public interface CalendarrService extends CrudService<CalendarrEntity,CalendarrDTO> {
CalendarrEntity selectByDay(String day);
}
\ No newline at end of file
......@@ -23,12 +23,14 @@ public class AppointmentOrderServiceImpl extends CrudServiceImpl<AppointmentOrde
@Override
public QueryWrapper<AppointmentOrderEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String status = null !=params.get("status")?params.get("status").toString():"";
QueryWrapper<AppointmentOrderEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(status), "status", status);
return wrapper;
}
}
\ No newline at end of file
}
package io.hmit.modules.appointment.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.appointment.dao.CalendarrDao;
import io.hmit.modules.appointment.dto.CalendarrDTO;
import io.hmit.modules.appointment.entity.CalendarrEntity;
import io.hmit.modules.appointment.service.CalendarrService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 新闻管理
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-01-26
*/
@Service
public class CalendarrServiceImpl extends CrudServiceImpl<CalendarrDao, CalendarrEntity, CalendarrDTO> implements CalendarrService {
@Override
public QueryWrapper<CalendarrEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<CalendarrEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
@Override
public CalendarrEntity selectByDay(String day) {
CalendarrEntity calendarr= baseDao.selectOne(new QueryWrapper<CalendarrEntity>().like("day",day));
return calendarr;
}
}
\ No newline at end of file
package io.hmit.modules.job.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.Date;
/**
* 定时任务
*
* @author zsh 408538940@qq.com
* @since 1.0.0
*/
@Data
@ApiModel(value = "节假日信息")
public class HolidayJsonDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "星期--中文表示")
private String name;
@ApiModelProperty(value = "节假日类型 0 正常工作日 1,周末 2,法定节假日 3调休")
private Integer type;
@ApiModelProperty(value = "星期--数字表示")
private Integer week;
}
package io.hmit.modules.job.task;
import io.hmit.common.constant.Constant;
import io.hmit.common.utils.DateUtils;
import io.hmit.modules.appointment.service.AppointmentOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 检查是否超出预约时间还未取号
* 是 则将订单状态status改成0 爽约/失约
*
*/
@Component("checkReservationTime")
public class CheckReservationTimeTask implements ITask {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private AppointmentOrderService appointmentOrderService;
@Override
public void run(String params) {
logger.debug("TestTask定时任务正在执行,参数为:{}", params);
Map<String, Object> queryParams = new HashMap<>();
queryParams.put("status", Constant.ReservationStatus.RESERVATION.getValue());
appointmentOrderService.list(queryParams).stream().forEach(item->{
System.out.println("订单状态:"+item.getStatus()+" "+item.getServiceName());
try {
if(DateUtils.compareTime(item.getAppointmentTime())){
item.setStatus(Constant.ReservationStatus.BREAK_APPOINTMENT.getValue());
item.setStatusName(Constant.ReservationStatus.BREAK_APPOINTMENT.getMsg());
item.setUpdateDate(new Date());
appointmentOrderService.update(item);
}
} catch (ParseException e) {
e.printStackTrace();
}
});
}
}
package io.hmit.modules.job.task;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.common.utils.HttpRequestUtil;
import io.hmit.modules.appointment.dto.CalendarrDTO;
import io.hmit.modules.appointment.entity.CalendarrEntity;
import io.hmit.modules.appointment.service.CalendarrService;
import io.hmit.modules.job.dto.HolidayJsonDTO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Calendar;
import java.util.Map;
/**
* 更新每年的节假日信息(后台Calendar 表中的节假日维护到2030年)
* @params
*/
@Component("updateCalendar")
public class UpdateHolidayTask implements ITask {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private CalendarrService calendarrService;
@Override
public void run(String params) {
logger.debug("TestTask定时任务正在执行,参数为:{}", params);
String year = params;
if ("".equals(params) && StringUtils.isBlank(params)) {
Calendar calendar = Calendar.getInstance();
year = String.valueOf(calendar.get(Calendar.YEAR));
}
String url = "http://timor.tech/api/holiday/year";
String jsontest = HttpRequestUtil.sendGet(url, year);
System.out.println(jsontest);
String holidayJson = "";
Map<String, String> map = JSONArray.parseObject(jsontest, Map.class);
for (Map.Entry entry : map.entrySet()) {
String key = entry.getKey().toString();
String value = entry.getValue().toString();
if (key.contains("type")) {
System.out.println(key);
System.out.println(value);
holidayJson = value;
}
}
Map<String, String> map2 = JSONArray.parseObject(holidayJson, Map.class);
for (Map.Entry entry : map2.entrySet()) {
String day = entry.getKey().toString();
String info = entry.getValue().toString();
CalendarrEntity calendarr = calendarrService.selectByDay(day);
//将获取到的节假日json 2023-11-11:{"week":6,"name":"周六","type":1} 转换成实体
HolidayJsonDTO holidayInfo = JSONObject.parseObject(info, HolidayJsonDTO.class);
calendarr.setDay(day);
calendarr.setHoliday(holidayInfo.getType());
CalendarrDTO calendarrDTO = ConvertUtils.sourceToTarget(calendarr, CalendarrDTO.class);
calendarrService.update(calendarrDTO);
}
}
}
\ No newline at end of file
......@@ -5,7 +5,8 @@ spring:
# driver-class-name: com.mysql.cj.jdbc.Driver
driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://112.51.130.215:3306/security_enterprise?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
url: jdbc:mysql://sh-cdb-jsrwe2i2.sql.tencentcdb.com:60548/bl_appointment?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
# url: jdbc:mysql://sh-cdb-jsrwe2i2.sql.tencentcdb.com:60548/bl_appointment?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
url: jdbc:mysql://sh-cdb-jsrwe2i2.sql.tencentcdb.com:60548/fh_appointment?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
username: root
password: Hmit@2020
# #Oracle
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.hmit.modules.appointment.dao.CalendarrDao">
<resultMap type="io.hmit.modules.appointment.entity.CalendarrEntity" id="newsMap">
<result property="id" column="id"/>
<result property="day" column="day"/>
<result property="holiday" column="holiday"/>
<result property="dow" column="dow"/>
</resultMap>
</mapper>
\ No newline at end of file
This diff is collapsed.
......@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.hmit.common.utils.DateUtils;
import io.hmit.interceptor.AuthorizationInterceptor;
import io.hmit.interceptor.CorsInterceptor;
import io.hmit.resolver.LoginUserHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
......@@ -32,6 +33,9 @@ import java.util.TimeZone;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Autowired
private CorsInterceptor corsInterceptor;
@Autowired
private AuthorizationInterceptor authorizationInterceptor;
@Autowired
......@@ -39,7 +43,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 跨域拦截器需放在最上面
registry.addInterceptor(corsInterceptor).addPathPatterns("/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/api/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/app/**");
}
@Override
......@@ -78,4 +86,4 @@ public class WebMvcConfig implements WebMvcConfigurer {
converter.setObjectMapper(mapper);
return converter;
}
}
\ No newline at end of file
}
......@@ -20,9 +20,12 @@ public class ZhelibanAPP {
//手机
public static final String SERVICE_CODE = "blzwfwyyqhxt";
public static final String SERVICE_PASS = "blzwfwyyqhxtpwd";
//北仑的个人认证接入码
// public static final String SERVICE_CODE = "blzwfwyyqhxt";
// public static final String SERVICE_PASS = "blzwfwyyqhxtpwd";
//奉化的个人认证接入码
public static final String SERVICE_CODE = "fhzwfwyyqh";
public static final String SERVICE_PASS = "fhzwfwyyqhpwd";
// public static final String APP_BASE_URL = "https://puser.zjzwfw.gov.cn/sso/servlet/simpleauth?method=";
public static final String APP_BASE_URL = "https://appapi.zjzwfw.gov.cn/sso/servlet/simpleauth?method=";
public static final String VALIDATION_TICKET = "ticketValidation";
......
......@@ -4,6 +4,7 @@ package io.hmit.controller;
import com.baomidou.mybatisplus.extension.api.R;
import io.hmit.annotation.Login;
import io.hmit.common.constant.Constant;
import io.hmit.common.utils.MD5;
import io.hmit.common.utils.Result;
import io.hmit.common.validator.ValidatorUtils;
import io.hmit.config.ZhelibanUtils;
......@@ -16,6 +17,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
......@@ -85,6 +87,9 @@ public class ApiLoginController {
Map<String,Object> user_map = ZhelibanUtils.getUserInfo(map);
System.out.println("UserMap是——————————————————————————————");
System.out.println(user_map);
if ("6001".equals(user_map.get("result"))){
return new Result().error("ticket失效");
}
if (user_map.get("idnum") !=null){
//判断是否已经存在了这条信息
UserEntity oldUser=userService.queryByIdnum(URLEncoder.encode(user_map.get("idnum").toString(), "UTF8"));
......@@ -94,13 +99,24 @@ public class ApiLoginController {
UserEntity user=new UserEntity();
user.setUsername(user_map.get("username").toString());
user.setMobile(URLEncoder.encode(user_map.get("mobile").toString(), "UTF8"));
user.setPassword(URLEncoder.encode(user_map.get("idnum").toString(), "UTF8"));
user.setPassword(URLEncoder.encode(DigestUtils.sha256Hex(user_map.get("idnum").toString()), "UTF8"));
user.setIdCardNo(URLEncoder.encode(user_map.get("idnum").toString(), "UTF8"));
userService.insert(user);
userId = user.getId();
userMap.put("userId",user_map.get("userid").toString());
userMap.put("userNick",user_map.get("username").toString());
userMap.put("username", user.getUsername());
userMap.put("mobile", user.getMobile());
userMap.put("idnum",user.getIdCardNo());
}else{
userId = oldUser.getId();
userMap.put("userId",user_map.get("userid").toString());
userMap.put("userNick",user_map.get("username").toString());
userMap.put("username", oldUser.getUsername());
userMap.put("mobile", oldUser.getMobile());
userMap.put("idnum",oldUser.getIdCardNo());
}
TokenEntity tokenEntity = tokenService.createToken(userId);
userMap.put("token", tokenEntity.getToken());
......
package io.hmit.interceptor;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class CorsInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS");
response.setHeader("Access-Control-Max-Age", "86400");
response.setHeader("Access-Control-Allow-Headers", "*");
/*// 如果是OPTIONS则结束请求
if (HttpMethod.OPTIONS.toString().equals(request.getMethod())) {
response.setStatus(HttpStatus.NO_CONTENT.value());
return false;
}*/
return true;
}
}
......@@ -50,6 +50,7 @@ public class AppointmentServiceController {
return new Result<PageData<AppointmentServiceDTO>>().ok(page);
}
@GetMapping("list")
@ApiOperation("服务树形列表")
public Result<List<AppointmentServiceDTO>> list() {
......
package io.hmit.modules.appointment.dto;
import io.hmit.common.utils.SerialNumberTool;
import io.hmit.entity.UserEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -93,9 +94,12 @@ public class AppointmentOrderDTO implements Serializable {
@ApiModelProperty(value = "等候人数")
private Integer waitNum;
@ApiModelProperty(value = "预约人数")
private Integer rCount;
private YynumberDTO yynumberDTO;
public AppointmentOrderDTO assembleAppointmentOrderDTO(ReservationDTO reservationDTO){
public AppointmentOrderDTO assembleAppointmentOrderDTO(ReservationDTO reservationDTO, UserEntity userEntity){
AppointmentOrderDTO dto = new AppointmentOrderDTO();
// 当天程序重启后标识位会重置,此处可以设置开始的标识位,4标识下一个生成的会是Y00004
......@@ -111,16 +115,17 @@ public class AppointmentOrderDTO implements Serializable {
dto.setServiceName(reservationDTO.getServiceName());
dto.setIsApp(reservationDTO.getIsApp());
dto.setOrderQueueId(reservationDTO.getOrderQueueId());
dto.setAppointmentPerson(reservationDTO.getAppointmentPerson());
dto.setAppointmentPhone(reservationDTO.getAppointmentPhone());
dto.setAppointmentIdCard(reservationDTO.getAppointmentIdCard());
dto.setAppointmentPerson(userEntity.getUsername());
dto.setAppointmentPhone(userEntity.getMobile());
dto.setAppointmentIdCard(userEntity.getIdCardNo());
dto.setAppointmentTime(reservationDTO.getAppointmentTime());
dto.setServiceWindow(reservationDTO.getServiceWindow());
dto.setRemark(reservationDTO.getRemark());
dto.setCreator(userEntity.getId());
dto.setUpdater(userEntity.getId());
dto.setCreateDate(new Date());
dto.setUpdateDate(new Date());
return dto;
}
}
package io.hmit.modules.appointment.dto;
import io.hmit.entity.UserEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -43,10 +44,14 @@ public class AppointmentOrderServiceDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
private Date updateDate;
public AppointmentOrderServiceDTO assembleAppointmentOrderServiceDTO(AppointmentOrderDTO orderDTO){
public AppointmentOrderServiceDTO assembleAppointmentOrderServiceDTO(AppointmentOrderDTO orderDTO, UserEntity userEntity){
AppointmentOrderServiceDTO dto = new AppointmentOrderServiceDTO();
dto.setOrderId(orderDTO.getId());
dto.setServiceId(orderDTO.getServiceId());
dto.setCreator(userEntity.getId());
dto.setUpdater(userEntity.getId());
dto.setCreateDate(new Date());
dto.setUpdateDate(new Date());
return dto;
}
......
......@@ -28,6 +28,8 @@ public interface AppointmentOrderService extends CrudService<AppointmentOrderEnt
Integer waitingNum (String appointmentTime);
Integer reservationAccount (Long serviceId, String appointmentTime);
Integer serviceWaitingNum (Long serviceId);
YynumberDTO findByYuNumber(String sPaperNumber );
......
......@@ -58,11 +58,18 @@ public class AppointmentOrderServiceImpl extends CrudServiceImpl<AppointmentOrde
String id = (String)params.get("id");
String userId = (String)params.get("userId");
String flag = (String)params.get("flag");
String status = (String)params.get("status");
String phone = (String)params.get("appointmentPhone");
String idCard = (String)params.get("appointmentIdCard");
QueryWrapper<AppointmentOrderEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.le(StringUtils.isNotBlank(flag) && "Y".equals(flag), "status", 2);
wrapper.ge(StringUtils.isNotBlank(flag) && "Q".equals(flag), "status", 3);
wrapper.eq(StringUtils.isNotBlank(status), "status", status)
.eq(StringUtils.isNotBlank(phone), "appointment_phone", phone)
.eq(StringUtils.isNotBlank(idCard), "appointment_id_card", idCard);
return wrapper;
......@@ -88,7 +95,8 @@ public class AppointmentOrderServiceImpl extends CrudServiceImpl<AppointmentOrde
List<AppointmentOrderEntity> appointmentOrders = baseDao.selectList(new QueryWrapper<AppointmentOrderEntity>()
.eq(StringUtils.isNotBlank(phone), "appointment_phone", phone)
.eq(StringUtils.isNotBlank(idCard), "appointment_id_card", idCard)
.eq("status","1").like("appointment_time",now));
.eq("status",Constant.ReservationStatus.RESERVATION.getValue())
.like("appointment_time",now));
if(appointmentOrders.size()==0){
return null;
......@@ -143,6 +151,14 @@ public class AppointmentOrderServiceImpl extends CrudServiceImpl<AppointmentOrde
return appointmentOrderDao.waitingNum(appointmentTime);
}
@Override
public Integer reservationAccount(Long serviceId, String appointmentTime) {
Integer account = baseDao.selectCount(new QueryWrapper<AppointmentOrderEntity>()
.eq("service_id",serviceId).eq("appointment_time",appointmentTime));
return account;
}
@Override
public Integer serviceWaitingNum(Long serviceId) {
......@@ -153,9 +169,10 @@ public class AppointmentOrderServiceImpl extends CrudServiceImpl<AppointmentOrde
public YynumberDTO findByYuNumber(String sPaperNumber) {
//调用取号机接口,。
// String url = "http://IP:8223/smartqueue/getpaperwait?sPaperNumber=" +sPaperNumber;
// String url = "http://192.168.1.97:8223/smartqueue/getpaperwait?sPaperNumber=" +sPaperNumber;
// String s = HttpRequestUtil.sendGetAndRetrieveContent(url);
String s = "{\"nStatus\":1,\"sMsg\":\"号码已被呼叫\",\"nWait\":0,\"sCallTime\":\"2021-03-08 16:27:09\",\"sRegTime\":\"2021-03-08 16:26:55\",\"sQueueName\":\"不动产档案查询\",\"listWin\":[\"38号窗口\",\"39号窗口\",\"40号窗口\",\"41号窗口\",\"42号窗口\",\"43号窗口\"]}";
// 北仑 String url = "http://10.35.28.211:8223/smartqueue/getpaperwait?sPaperNumber=" +sPaperNumber;
String url = "http://172.19.240.230:8223/smartqueue/getpaperwait?sPaperNumber=" +sPaperNumber;
String s = HttpRequestUtil.sendGetAndRetrieveContent(url);
// String s = "{\"nStatus\":1,\"sMsg\":\"号码已被呼叫\",\"nWait\":0,\"sCallTime\":\"2021-03-08 16:27:09\",\"sRegTime\":\"2021-03-08 16:26:55\",\"sQueueName\":\"不动产档案查询\",\"listWin\":[\"38号窗口\",\"39号窗口\",\"40号窗口\",\"41号窗口\",\"42号窗口\",\"43号窗口\"]}";
YynumberDTO yynumberDTO = JSONObject.parseObject(s,YynumberDTO.class);
return yynumberDTO;
......
......@@ -85,7 +85,7 @@ public class AppointmentTimeManageServiceImpl extends CrudServiceImpl<Appointmen
List<ReservationTimeDTO> reservationTimeDTOList = new ArrayList<>();
List<CalendarDTO> dayLists = calendarService.weekDayList().subList(0,6);
List<CalendarDTO> dayLists = calendarService.weekDayList().subList(0,7);
dayLists.stream().forEach(item->{
ReservationTimeDTO reservationTime = new ReservationTimeDTO();
reservationTime.setReservationTime(item.getDay());
......
......@@ -38,8 +38,13 @@ public class CalendarServiceImpl extends CrudServiceImpl<CalendarDao, CalendarEn
@Override
public List<CalendarDTO> weekDayList() {
String now = DateUtils.format(new Date());
//获取工作日的日期,用于北仑
// List<CalendarEntity> calendarList = baseDao.selectList(new QueryWrapper<CalendarEntity>().gt("day",now)
// .ne("holiday",1).ne("holiday",2));
//获取包含工作日和周末的日期,用于奉化
List<CalendarEntity> calendarList = baseDao.selectList(new QueryWrapper<CalendarEntity>().gt("day",now)
.ne("holiday",1).ne("holiday",2));
.ne("holiday",2));
return ConvertUtils.sourceToTarget(calendarList,CalendarDTO.class);
}
......
......@@ -4,7 +4,8 @@ spring:
# driver-class-name: com.mysql.cj.jdbc.Driver
driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://112.51.130.215:3306/security_enterprise?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
url: jdbc:mysql://sh-cdb-jsrwe2i2.sql.tencentcdb.com:60548/bl_appointment?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
# url: jdbc:mysql://sh-cdb-jsrwe2i2.sql.tencentcdb.com:60548/bl_appointment?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useSSL=false
url: jdbc:mysql://sh-cdb-jsrwe2i2.sql.tencentcdb.com:60548/fh_appointment?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useSSL=false
username: root
password: Hmit@2020
initial-size: 10
......
......@@ -4,7 +4,7 @@ server:
uri-encoding: UTF-8
max-threads: 1000
min-spare-threads: 30
port: 8081
port: 8082
connection-timeout: 5000ms
servlet:
context-path: /hmit-api
......@@ -64,4 +64,4 @@ mybatis-plus:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
\ No newline at end of file
jdbc-type-for-null: 'null'
......@@ -11,4 +11,4 @@
</resultMap>
</mapper>
\ No newline at end of file
</mapper>
This diff is collapsed.
......@@ -93,12 +93,12 @@ public interface Constant {
String MAIL_CONFIG_KEY = "MAIL_CONFIG_KEY";
/**
* 邮件配置KEY
* 预约时间--上午截止时间
*/
String AM_END_TIME = "11:30";
/**
* 邮件配置KEY
* 预约时间--下午开始时间
*/
String PM_START_TIME = "13:30";
......@@ -189,4 +189,46 @@ public interface Constant {
}
}
/**
* 预约状态
*/
enum ReservationStatus {
/**
* 已预约
*/
RESERVATION(1,"已预约"),
/**
* 预约已取消
*/
CANCEL(2,"预约已取消"),
/**
* 已取号
*/
GET_NUM(3,"已取号"),
/**
* 消除无效号码
*/
ELIMINATE_INVALID_NUM(4,"消除无效号码"),
/**
* 爽约/失约
*/
BREAK_APPOINTMENT(0,"爽约");
private int value;
private String msg;
ReservationStatus(int value,String msg) {
this.value = value;
this.msg = msg;
}
public int getValue() {
return value;
}
public String getMsg() {
return msg;
}
}
}
......@@ -31,4 +31,4 @@ public abstract class BaseEntity implements Serializable {
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
}
\ No newline at end of file
}
......@@ -8,10 +8,7 @@ import org.joda.time.format.DateTimeFormatter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* 日期处理
......@@ -24,6 +21,10 @@ public class DateUtils {
* 时间格式(yyyy-MM-dd)
*/
public final static String DATE_PATTERN = "yyyy-MM-dd";
/**
* 时间格式(HH:mm)
*/
public final static String HOUR_PATTERN = "HH:mm";
/**
* 时间格式(yyyy-MM-dd HH:mm:ss)
*/
......@@ -267,4 +268,32 @@ public class DateUtils {
return timeList;
}
/**
* 将预约时间格式拆分,比较时间大小并返回
*
* @param times 开始时间 传入的时间格式:2021-02-02 08:30-09:00
* @return 当前时间是否大于传入的时间
* @throws ParseException
*/
public static boolean compareTime(String times) throws ParseException {
String [] time = times.split(" ");
String now = format(new Date());
if(now.compareTo(time[0])>0){
System.out.println("当前时间:"+now+" > 传入时间:"+time[0]);
return true;
}
if(now.compareTo(time[0]) == 0){
String hour = format(new Date(),HOUR_PATTERN);
String [] hours = time[1].split("-");
if(hour.compareTo(hours[1]) >0 ){
System.out.println("当前小时:"+hour+" > 传入小时:"+ hours[1]);
}
return true;
}
return false;
}
}
......@@ -45,6 +45,64 @@ public class HttpRequestUtil {
return resultCode;
}
/**
* 获取每年的节假日信息
*
* @param url
* 发送请求的URL
* @param param
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return URL 所代表远程资源的响应结果
*/
public static String sendGet(String url, String param) {
String result = "";
BufferedReader in = null;
try {
String urlNameString = url + "/" + param+"?type=Y&week=Y";
System.out.println(urlNameString);
URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接
URLConnection connection = realUrl.openConnection();
// 设置通用的请求属性
connection.setRequestProperty("accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// 建立实际的连接
connection.connect();
// 获取所有响应头字段
Map<String, List<String>> map = connection.getHeaderFields();
// 遍历所有的响应头字段
for (String key : map.keySet()) {
System.out.println(key + "--->" + map.get(key));
}
// 定义 BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(
connection.getInputStream(),"UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
System.out.println("发送GET请求出现异常!" + e);
e.printStackTrace();
}
// 使用finally块来关闭输入流
finally {
try {
if (in != null) {
in.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
return result;
}
/**
* 向指定浙里办URL发送GET方法的请求
*
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment