Commit 3e8a0fae authored by mengmeng's avatar mengmeng

线上测试运行版本V1

parent b6930e3c
# 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 消除无效号码
***
......@@ -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.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();
}
});
}
}
......@@ -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
}
......@@ -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;
......@@ -85,6 +86,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 +98,20 @@ 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(MD5.md5(user_map.get("idnum").toString()), "UTF8"));
user.setIdCardNo(URLEncoder.encode(user_map.get("idnum").toString(), "UTF8"));
userService.insert(user);
userId = user.getId();
userMap.put("username", user.getUsername());
userMap.put("mobile", user.getMobile());
userMap.put("idnum",user.getIdCardNo());
}else{
userId = oldUser.getId();
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());
......
......@@ -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;
......@@ -95,7 +96,7 @@ public class AppointmentOrderDTO implements Serializable {
private YynumberDTO yynumberDTO;
public AppointmentOrderDTO assembleAppointmentOrderDTO(ReservationDTO reservationDTO){
public AppointmentOrderDTO assembleAppointmentOrderDTO(ReservationDTO reservationDTO, UserEntity userEntity){
AppointmentOrderDTO dto = new AppointmentOrderDTO();
// 当天程序重启后标识位会重置,此处可以设置开始的标识位,4标识下一个生成的会是Y00004
......@@ -111,13 +112,15 @@ 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());
......
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;
}
......
......@@ -58,11 +58,13 @@ 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");
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);
return wrapper;
......@@ -88,7 +90,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;
......
......@@ -4,7 +4,7 @@ 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
username: root
password: Hmit@2020
initial-size: 10
......
......@@ -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;
}
}
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