fix 单个课程拷贝

This commit is contained in:
limqhz
2022-02-21 13:11:03 +08:00
parent 276aa88269
commit 0e4a271200
7 changed files with 47 additions and 25 deletions

View File

@@ -32,6 +32,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>

View File

@@ -16,6 +16,7 @@
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/common-default-%d{yyyy-MM-dd}.log
</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
@@ -31,28 +32,13 @@
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/common-error-%d{yyyy-MM-dd}.log
</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<appender name="CONNECTION_APPENDER"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_HOME}/connection.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/connection-%d{yyyy-MM-dd}.log
</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<logger name="com.sv.netty.netty" additivity="false" >
<appender-ref ref="CONNECTION_APPENDER"/>
</logger>
<!-- root -->
<root level="info">
<appender-ref ref="STDOUT" />

View File

@@ -16,6 +16,7 @@
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/common-default-%d{yyyy-MM-dd}.log
</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
@@ -31,6 +32,7 @@
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/common-error-%d{yyyy-MM-dd}.log
</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>

View File

@@ -40,7 +40,7 @@ public class CopyLessonTask {
/**
* 每周一九点
*/
@Scheduled(cron = "0 */1 * * * ?")
// @Scheduled(cron = "0 */1 * * * ?")
public void execute(){
logger.info("开始执行拷贝课程批处理");
LocalTime time = LocalTime.parse("09:00");
@@ -70,7 +70,7 @@ public class CopyLessonTask {
for (VenueLesson venueLesson : allForCopy) {
count ++;
Date copyDate = DateUtilCard.addDays(venueLesson.getDate(), 7 * copyTarget + 7);
venueLessonService.copy(venueLesson.getId(),copyDate,copyDate);
venueLessonService.copyOneLesson(venueLesson.getId(),copyDate);
}
logger.info("拷贝的课程数量为:" + count);
}

View File

@@ -3,9 +3,9 @@ spring:
# url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8
# username: yingdd
# password: Yingdd2015
url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true
url: jdbc:mysql://120.27.209.4:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true
username: root
password: 123456
password: hyty1234
redis:
host: 127.0.0.1
password:

View File

@@ -1,13 +1,23 @@
spring:
datasource:
url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8
username: yingdd
password: Yingdd2015
# url: jdbc:mysql://yingdiandian.mysql.rds.aliyuncs.com:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8
# username: yingdd
# password: Yingdd2015
url: jdbc:mysql://120.27.209.4:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true
username: root
password: 123456
redis:
host: 121.41.101.63
password: yingdiandian2015
host: 127.0.0.1
password:
timeout: 6000
port: 6379
jpa:
show-sql: true
sv:
file:
store:
image: imagetest/
video: videotest/
health: health-docstest/

View File

@@ -335,5 +335,25 @@ public class VenueLessonService extends BaseServiceImpl {
}
}
}
/**
* copy单个课程
* @param lessonId
* @param targetDate
*/
@Transactional(readOnly = false)
public void copyOneLesson(Integer lessonId, Date targetDate) {
VenueLesson x = venueLessonMapper.findById(lessonId);
Integer oldId = x.getId();
x.setId(null);
x.setModifiedId(999);
x.setSaleNum(0);
x.setModifiedTime(new Date());
x.setDate(targetDate);
venueLessonMapper.insert(x);
insertLessonTicket(x);
venueLessonMapper.copyImg(oldId, x.getId());
}
}