欣影管理平台时间任务修改新增删除
parent
834eccbfbe
commit
cb0a6a2c8b
@ -0,0 +1,44 @@
|
|||||||
|
package com.shxy.xymanager_common.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Time;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间任务列表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "时间任务列表", description = "获取时间任务列表信息")
|
||||||
|
public class TerminalScheduleRuleListModel implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "时间任务列表", example = "[]")
|
||||||
|
private List<ScheduleRuleBean> list;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class ScheduleRuleBean {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务编号", example = "123456")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务名称", example = "123456")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "间隔", example = "213")
|
||||||
|
private Integer span;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开始时间", example = "2022-06-08")
|
||||||
|
private Time startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结束时间", example = "2022-06-08")
|
||||||
|
private Time endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注", example = "erwsafsasa")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.shxy.xymanager_common.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Time;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间任务列表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "时间任务", description = "获取时间任务信息")
|
||||||
|
public class TerminalScheduleRuleModel implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务编号", example = "123456")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务名称", example = "123456")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "间隔", example = "213")
|
||||||
|
private Integer span;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开始时间", example = "2022-06-08")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结束时间", example = "2022-06-08")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注", example = "erwsafsasa")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,157 @@
|
|||||||
|
package com.shxy.xymanager_common.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
|
import java.lang.management.ManagementFactory;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间工具类
|
||||||
|
*
|
||||||
|
* @author 晶晶
|
||||||
|
*/
|
||||||
|
public class MyDateUtils extends DateUtil {
|
||||||
|
public static String YYYY = "yyyy";
|
||||||
|
|
||||||
|
public static String YYYY_MM = "yyyy-MM";
|
||||||
|
|
||||||
|
public static String YYYY_MM_DD = "yyyy-MM-dd";
|
||||||
|
|
||||||
|
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||||
|
|
||||||
|
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
public static String[] parsePatterns = {
|
||||||
|
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy年MM月dd日",
|
||||||
|
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "HH时mm分", "HH:mm","HH:mm:ss",
|
||||||
|
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM","yyyyMMdd"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前Date型日期
|
||||||
|
*
|
||||||
|
* @return Date() 当前日期
|
||||||
|
*/
|
||||||
|
public static Date getNowDate() {
|
||||||
|
return new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前日期, 默认格式为yyyy-MM-dd
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public static String getDate() {
|
||||||
|
return dateTimeNow(YYYY_MM_DD);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String getTime() {
|
||||||
|
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String dateTimeNow() {
|
||||||
|
return dateTimeNow(YYYYMMDDHHMMSS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String dateTimeNow(final String format) {
|
||||||
|
return parseDateToStr(format, new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String dateTime(final Date date) {
|
||||||
|
return parseDateToStr(YYYY_MM_DD, date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String parseDateToStr(final String format, final Date date) {
|
||||||
|
return new SimpleDateFormat(format).format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Date dateTime(final String format, final String ts) {
|
||||||
|
try {
|
||||||
|
return new SimpleDateFormat(format).parse(ts);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期路径 即年/月/日 如2018/08/08
|
||||||
|
*/
|
||||||
|
public static final String datePath() {
|
||||||
|
Date now = new Date();
|
||||||
|
return DateFormatUtils.format(now, "yyyy/MM/dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期路径 即年/月/日 如20180808
|
||||||
|
*/
|
||||||
|
public static final String dateTime() {
|
||||||
|
Date now = new Date();
|
||||||
|
return DateFormatUtils.format(now, "yyyyMMdd");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期型字符串转化为日期 格式
|
||||||
|
*/
|
||||||
|
public static Date myparseDate(Object str) {
|
||||||
|
if (str == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return parse(str.toString(), parsePatterns);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期型转化为HH:mm 格式
|
||||||
|
*/
|
||||||
|
public static String parseHourAndMin(Date str) {
|
||||||
|
if (str == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return format(str, "HH:mm");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 日期型转化为"MM/dd" 格式
|
||||||
|
*/
|
||||||
|
public static String parseMonthAndDay(Date str) {
|
||||||
|
if (str == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return format(str, "MM/dd");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取服务器启动时间
|
||||||
|
*/
|
||||||
|
public static Date getServerStartDate() {
|
||||||
|
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||||
|
return new Date(time);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 日期型转化为"yyyy-MM-dd HH:mm" 格式
|
||||||
|
*/
|
||||||
|
public static String formatYmdHmTime(Date date) {
|
||||||
|
return null == date ? null : DatePattern.NORM_DATETIME_MINUTE_FORMAT.format(date);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 计算两个时间差
|
||||||
|
*/
|
||||||
|
public static String getDatePoor(Date endDate, Date nowDate) {
|
||||||
|
long nd = 1000 * 24 * 60 * 60;
|
||||||
|
long nh = 1000 * 60 * 60;
|
||||||
|
long nm = 1000 * 60;
|
||||||
|
// long ns = 1000;
|
||||||
|
// 获得两个时间的毫秒时间差异
|
||||||
|
long diff = endDate.getTime() - nowDate.getTime();
|
||||||
|
// 计算差多少天
|
||||||
|
long day = diff / nd;
|
||||||
|
// 计算差多少小时
|
||||||
|
long hour = diff % nd / nh;
|
||||||
|
// 计算差多少分钟
|
||||||
|
long min = diff % nd % nh / nm;
|
||||||
|
// 计算差多少秒//输出结果
|
||||||
|
// long sec = diff % nd % nh % nm / ns;
|
||||||
|
return day + "天" + hour + "小时" + min + "分钟";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.shxy.xymanager_common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "任务规则编号列表", description = "任务规则编号列表描述")
|
||||||
|
public class TerminalRuleIdListVo {
|
||||||
|
@NotEmpty(message = "不能传入空值")
|
||||||
|
@ApiModelProperty(value = "任务规则对象数组", required = true, example = "A0001")
|
||||||
|
private List<TerminalRuleIdVo> list;
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.shxy.xymanager_common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "任务规则编号对象", description = "任务规则编号对象描述")
|
||||||
|
public class TerminalRuleIdVo {
|
||||||
|
|
||||||
|
@NotNull(message = "规则编号不能缺少")
|
||||||
|
@ApiModelProperty(value = "规则编号", example = "123455")
|
||||||
|
private Integer id;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.shxy.xymanager_common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "任务规则对象列表", description = "任务规则对象列表描述")
|
||||||
|
public class TerminalRuleListVo {
|
||||||
|
@NotEmpty(message = "不能传入空值")
|
||||||
|
@ApiModelProperty(value = "任务规则对象数组", required = true, example = "A0001")
|
||||||
|
private List<TerminalRuleVo> list;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.shxy.xymanager_common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "任务规则对象", description = "任务规则对象描述")
|
||||||
|
public class TerminalRuleVo {
|
||||||
|
@ApiModelProperty(value = "任务规则编号", example = "名称名称")
|
||||||
|
@NotBlank(message = "任务编号不能缺少")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务规则名称", example = "名称名称")
|
||||||
|
@NotBlank(message = "任务规则名称不能缺少")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开始时间", example = "单位")
|
||||||
|
@NotBlank(message = "开始时间不能缺少")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结束时间", example = "型号型号")
|
||||||
|
@NotBlank(message = "结束时间不能缺少")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "时间间隔", example = "型号型号")
|
||||||
|
@NotBlank(message = "时间间隔不能缺少")
|
||||||
|
private Integer span;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注", example = "型号型号")
|
||||||
|
@NotBlank(message = "时间间隔不能缺少")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -1,17 +1,24 @@
|
|||||||
package com.shxy.xymanager_dao.dao;
|
package com.shxy.xymanager_dao.dao;
|
||||||
|
|
||||||
import com.shxy.xymanager_common.entity.TerminalScheduleRule;
|
import com.shxy.xymanager_common.entity.TerminalScheduleRule;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
public interface TerminalScheduleRuleDao {
|
import java.util.Date;
|
||||||
int deleteByPrimaryKey(Integer id);
|
import java.util.List;
|
||||||
|
|
||||||
int insert(TerminalScheduleRule record);
|
public interface TerminalScheduleRuleDao {
|
||||||
|
|
||||||
int insertSelective(TerminalScheduleRule record);
|
int insertSelective(TerminalScheduleRule record);
|
||||||
|
|
||||||
|
int insertList(@Param("list") List<TerminalScheduleRule> record, @Param("status") Integer status, @Param("createat") Date create, @Param("updateat") Date update);
|
||||||
|
|
||||||
TerminalScheduleRule selectByPrimaryKey(Integer id);
|
TerminalScheduleRule selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(TerminalScheduleRule record);
|
List<TerminalScheduleRule> selectAll(@Param("status") Integer status);
|
||||||
|
|
||||||
|
int deleteById(@Param("list") List<TerminalScheduleRule> record, @Param("status") Integer status,@Param("updateat") Date update);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(@Param("data") TerminalScheduleRule record,@Param("updateat") Date update);
|
||||||
|
|
||||||
int updateByPrimaryKey(TerminalScheduleRule record);
|
int updateByPrimaryKey(TerminalScheduleRule record);
|
||||||
}
|
}
|
Loading…
Reference in New Issue