war包修改 时间表查询修改 时间表下发时间偏移

master
liuguijing 2 years ago
parent fba6b5f0ff
commit 616abf302a

@ -139,6 +139,15 @@
<version>5.9.0</version> <version>5.9.0</version>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>javax.servlet</groupId>-->
<!-- <artifactId>javax.servlet-api</artifactId>-->
<!-- <version>4.0.1</version>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>

@ -13,7 +13,7 @@
<name>xymanager_admin</name> <name>xymanager_admin</name>
<description>Demo project for Spring Boot</description> <description>Demo project for Spring Boot</description>
<!-- <packaging>war</packaging>--> <packaging>war</packaging>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
</properties> </properties>
@ -39,6 +39,7 @@
<scope>test</scope> <scope>test</scope>
<version>2.5.6</version> <version>2.5.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.shxy</groupId> <groupId>com.shxy</groupId>
<artifactId>xymanager_framework</artifactId> <artifactId>xymanager_framework</artifactId>
@ -84,17 +85,17 @@
</plugin> </plugin>
</plugins> </plugins>
<!-- <resources>--> <resources>
<!-- <resource>--> <resource>
<!-- <directory>src/main/resources</directory>--> <directory>src/main/resources</directory>
<!-- 打包时排除src/main/resources下的所有以.properties .yml .xml为后缀的配置文件--> <!-- 打包时排除src/main/resources下的所有以.properties .yml .xml为后缀的配置文件-->
<!-- <excludes>--> <excludes>
<!-- <exclude>**/*.properties</exclude>--> <exclude>**/*.properties</exclude>
<!-- <exclude>**/*.yml</exclude>--> <exclude>**/*.yml</exclude>
<!-- <exclude>**/*.xml</exclude>--> <!-- <exclude>**/*.xml</exclude>-->
<!-- </excludes>--> </excludes>
<!-- </resource>--> </resource>
<!-- </resources>--> </resources>
<finalName>xymanager-admin</finalName> <finalName>xymanager-admin</finalName>
</build> </build>

@ -1,12 +1,12 @@
package com.shxy.xymanager_admin; //package com.shxy.xymanager_admin;
//
import org.springframework.boot.builder.SpringApplicationBuilder; //import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; //import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
//
public class SpringBootStartApplication extends SpringBootServletInitializer { //public class SpringBootStartApplication extends SpringBootServletInitializer {
@Override // @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { // protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
// 注意这里要指向原先用main方法执行的Application启动类 // // 注意这里要指向原先用main方法执行的Application启动类
return builder.sources(XymanagerAdminApplication.class); // return builder.sources(XymanagerAdminApplication.class);
} // }
} //}

@ -19,7 +19,7 @@ import org.springframework.core.env.Environment;
@Slf4j @Slf4j
@EnableConfigurationProperties @EnableConfigurationProperties
@ComponentScan(basePackages = {"com.shxy"}) @ComponentScan(basePackages = {"com.shxy"})
public class XymanagerAdminApplication { public class XymanagerAdminApplication extends SpringBootServletInitializer{
public static void main(String[] args) { public static void main(String[] args) {
try { try {
@ -34,5 +34,8 @@ public class XymanagerAdminApplication {
log.error("error>>>>>>>>>>>>>>>>>>>>>>>>>>>", e); log.error("error>>>>>>>>>>>>>>>>>>>>>>>>>>>", e);
} }
} }
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application){
return application.sources(XymanagerAdminApplication.class);
}
} }

@ -1 +1 @@
#org.springframework.boot.env.EnvironmentPostProcessor=com.shxy.xymanager_framework.config.MyEnvironmentPostProcessor org.springframework.boot.env.EnvironmentPostProcessor=com.shxy.xymanager_framework.config.MyEnvironmentPostProcessor

@ -15,6 +15,8 @@ public class TerminalSchedule implements Serializable {
private Integer scheduleId; private Integer scheduleId;
private Integer offset;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;

@ -6,11 +6,12 @@
<result column="term_id" jdbcType="INTEGER" property="termId"/> <result column="term_id" jdbcType="INTEGER" property="termId"/>
<result column="channel_id" jdbcType="TINYINT" property="channelId"/> <result column="channel_id" jdbcType="TINYINT" property="channelId"/>
<result column="schedule_id" jdbcType="INTEGER" property="scheduleId"/> <result column="schedule_id" jdbcType="INTEGER" property="scheduleId"/>
<result column="offset" jdbcType="INTEGER" property="offset"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, term_id, channel_id, schedule_id, create_time, update_time id, term_id, channel_id, schedule_id, `offset`,create_time, update_time
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select

@ -40,13 +40,35 @@
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <exclusion>--> <!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>--> <!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>--> <!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
<!-- </exclusion>--> <!-- <scope>provided</scope>-->
</exclusions> <!-- </dependency>-->
</dependency>
<!--打war包引入的下面依赖-->
<!-- <dependency>-->
<!-- <groupId>javax.servlet</groupId>-->
<!-- <artifactId>javax.servlet-api</artifactId>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.tomcat</groupId>-->
<!-- <artifactId>tomcat-servlet-api</artifactId>-->
<!-- <version>8.0.36</version>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<!-- SpringBoot 拦截器 --> <!-- SpringBoot 拦截器 -->
<dependency> <dependency>
@ -77,15 +99,6 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!--打war包引入的下面依赖-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>com.shxy</groupId> <groupId>com.shxy</groupId>
<artifactId>xymanager_common</artifactId> <artifactId>xymanager_common</artifactId>

@ -1,19 +1,11 @@
package com.shxy.xymanager_framework.interaction; package com.shxy.xymanager_framework.interaction;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.StrUtil;
import com.shxy.xymanager_common.annotation.JwtIgnore;
import com.shxy.xymanager_common.entity.UserSession;
import com.shxy.xymanager_common.enums.HttpMethod;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_service.service.SysUserService; import com.shxy.xymanager_service.service.SysUserService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;

@ -357,6 +357,10 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
public ServiceBody<TerminalScheduleRuleTimeListModel> getChannelSchelduleRule(TerminalAndChannelIdVo vo) { public ServiceBody<TerminalScheduleRuleTimeListModel> getChannelSchelduleRule(TerminalAndChannelIdVo vo) {
TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel(); TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel();
TerminalSchedule mapper = terminalScheduleDao.selectByChannelId(vo.getChannelid(), vo.getTerminalid()); TerminalSchedule mapper = terminalScheduleDao.selectByChannelId(vo.getChannelid(), vo.getTerminalid());
Integer offset = mapper.getOffset();
if (offset == null) {
offset = 0;
}
if (mapper == null) { if (mapper == null) {
model.setList(new ArrayList<>()); model.setList(new ArrayList<>());
} else { } else {
@ -372,8 +376,15 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
ArrayList<TerminalScheduleRuleModel.ScheduleRuleBean> detailsBeans = ScheduleListUtils.getScheduleDetailsBeans(list); ArrayList<TerminalScheduleRuleModel.ScheduleRuleBean> detailsBeans = ScheduleListUtils.getScheduleDetailsBeans(list);
ArrayList<String> timestrlist = new ArrayList<>(); ArrayList<String> timestrlist = new ArrayList<>();
for (TerminalScheduleRuleModel.ScheduleRuleBean item : detailsBeans) { for (TerminalScheduleRuleModel.ScheduleRuleBean item : detailsBeans) {
Time startTime = item.getStartTime(); DateTime startTime = MyDateUtils.offsetMinute(item.getStartTime(), offset);
Time endTime = item.getEndTime(); if (startTime.isAfterOrEquals(MyDateUtils.endOfDay(item.getStartTime()))) {
startTime = MyDateUtils.endOfDay(item.getStartTime());
}
DateTime endTime = MyDateUtils.offsetMinute(item.getEndTime(), offset);
if (endTime.isAfterOrEquals(MyDateUtils.endOfDay(item.getEndTime()))) {
endTime = MyDateUtils.endOfDay(item.getEndTime());
}
Integer span = item.getSpan(); Integer span = item.getSpan();
List<DateTime> dateTimes = MyDateUtils.rangeToList(startTime, endTime, DateField.MINUTE, span); List<DateTime> dateTimes = MyDateUtils.rangeToList(startTime, endTime, DateField.MINUTE, span);
for (DateTime data : dateTimes) { for (DateTime data : dateTimes) {

Loading…
Cancel
Save