课程自动复制,往下下周开始复制

This commit is contained in:
limqhz
2022-02-13 22:30:23 +08:00
parent 99a4cd94aa
commit b96514a86f
4 changed files with 130 additions and 11 deletions

View File

@@ -136,6 +136,16 @@ public class VenueDTO implements Serializable {
*/
private Integer limitWeek;
/**
* 每天预约限制
*/
private Integer limitNoDay;
/**
* 每周预约限制
*/
private Integer limitNoWeek;
/**
* 复制周几
*/
@@ -148,6 +158,11 @@ public class VenueDTO implements Serializable {
@JsonSerialize(using = LocalTimeSerializer.class)
private LocalTime copyTime;
/**
* 向后复制多少
*/
private Integer copyTarget;
/**
* 场馆图片列表
*/
@@ -585,4 +600,28 @@ public class VenueDTO implements Serializable {
public void setCopyTime(LocalTime copyTime) {
this.copyTime = copyTime;
}
public Integer getCopyTarget() {
return copyTarget;
}
public void setCopyTarget(Integer copyTarget) {
this.copyTarget = copyTarget;
}
public Integer getLimitNoDay() {
return limitNoDay;
}
public void setLimitNoDay(Integer limitNoDay) {
this.limitNoDay = limitNoDay;
}
public Integer getLimitNoWeek() {
return limitNoWeek;
}
public void setLimitNoWeek(Integer limitNoWeek) {
this.limitNoWeek = limitNoWeek;
}
}

View File

@@ -42,6 +42,11 @@ public class Venue implements Serializable {
@JsonSerialize(using = LocalTimeSerializer.class)
private LocalTime copyTime;
/**
* 向后复制多少
*/
private Integer copyTarget;
/**
* 地址
*/
@@ -174,6 +179,17 @@ public class Venue implements Serializable {
private Integer limitWeek;
/**
* 每天预约限制
*/
private Integer limitNoDay;
/**
* 每周预约限制
*/
private Integer limitNoWeek;
/**
* 设置
*
@@ -628,4 +644,28 @@ public class Venue implements Serializable {
public void setCopyTime(LocalTime copyTime) {
this.copyTime = copyTime;
}
public Integer getCopyTarget() {
return copyTarget;
}
public void setCopyTarget(Integer copyTarget) {
this.copyTarget = copyTarget;
}
public Integer getLimitNoDay() {
return limitNoDay;
}
public void setLimitNoDay(Integer limitNoDay) {
this.limitNoDay = limitNoDay;
}
public Integer getLimitNoWeek() {
return limitNoWeek;
}
public void setLimitNoWeek(Integer limitNoWeek) {
this.limitNoWeek = limitNoWeek;
}
}

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.now();
@@ -62,10 +62,14 @@ public class CopyLessonTask {
List<VenueLesson> allForCopy = venueLessonService.findAllForCopy(startTime, endTime);
if (allForCopy!= null && allForCopy.size()>0){
logger.info("需要操作的课程数为:" + allForCopy.size());
Integer copyTarget = venue.getCopyTarget();
if (copyTarget == null){
copyTarget = 1;
}
int count = 0;
for (VenueLesson venueLesson : allForCopy) {
count ++;
Date copyDate = DateUtilCard.addDays(venueLesson.getDate(), 7);
Date copyDate = DateUtilCard.addDays(venueLesson.getDate(), 7 * copyTarget + 7);
venueLessonService.copy(venueLesson.getId(),copyDate,copyDate);
}
logger.info("拷贝的课程数量为:" + count);

View File

@@ -30,8 +30,11 @@
<result column="deleted" property="deleted"/>
<result column="limit_day" property="limitDay"/>
<result column="limit_week" property="limitWeek"/>
<result column="limit_no_day" property="limitNoDay"/>
<result column="limit_no_week" property="limitNoWeek"/>
<result column="copy_week" property="copyWeek"/>
<result column="copy_time" property="copyTime"/>
<result column="copy_target" property="copyTarget"/>
</resultMap>
<resultMap id="VenueDtoMap" type="com.sv.dto.api.VenueDTO">
@@ -56,8 +59,11 @@
<result column="deleted" property="deleted"/>
<result column="limit_day" property="limitDay"/>
<result column="limit_week" property="limitWeek"/>
<result column="limit_no_day" property="limitNoDay"/>
<result column="limit_no_week" property="limitNoWeek"/>
<result column="copy_week" property="copyWeek"/>
<result column="copy_time" property="copyTime"/>
<result column="copy_target" property="copyTarget"/>
<result column="code_url" property="codeUrl"></result>
<association property="cards" select="com.sv.mapper.VenueCardMapper.findByVenueId"
column="{venueId = id,venueType=type}"></association>
@@ -116,8 +122,11 @@
deleted,
limit_day,
limit_week,
limit_no_day,
limit_no_week,
copy_week,
copy_time
copy_time,
copy_target
</sql>
<!-- 字段值 -->
@@ -140,11 +149,14 @@
#{modifiedId, jdbcType=INTEGER},
#{createdTime, jdbcType=TIMESTAMP},
#{modifiedTime, jdbcType=TIMESTAMP},
#{deleted, jdbcType=TINYINT}
#{limit_day, jdbcType=TINYINT}
#{limit_week, jdbcType=TINYINT}
#{copy_week, jdbcType=TINYINT}
#{copy_time, jdbcType=TIMESTAMP}
#{deleted, jdbcType=TINYINT},
#{limit_day, jdbcType=TINYINT},
#{limit_week, jdbcType=TINYINT},
#{limit_no_day, jdbcType=TINYINT},
#{limit_no_week, jdbcType=TINYINT},
#{copy_week, jdbcType=TINYINT},
#{copy_time, jdbcType=TIMESTAMP},
#{copy_target, jdbcType=TINYINT}
</sql>
<!-- 查询全部记录 -->
@@ -273,12 +285,21 @@
<if test="limitWeek != null">
limit_week,
</if>
<if test="limitNoDay != null">
limit_no_day,
</if>
<if test="limitNoWeek != null">
limit_no_week,
</if>
<if test="copyWeek != null">
copy_week,
</if>
<if test="copyTime != null">
copy_time,
</if>
<if test="copyTarget != null">
copy_target,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -365,6 +386,9 @@
<if test="copyTime != null">
#{copyTime},
</if>
<if test="copyTarget != null">
#{copyTarget},
</if>
</trim>
</insert>
@@ -476,12 +500,21 @@
<if test="limitWeek != null">
limit_week = #{limitWeek},
</if>
<if test="limitNoDay != null">
limit_no_day = #{limitNoDay},
</if>
<if test="limitNoWeek != null">
limit_no_week = #{limitNoWeek},
</if>
<if test="copyWeek != null">
copy_week = #{copyWeek},
</if>
<if test="copyTime != null">
copy_time = #{copyTime},
</if>
<if test="copyTarget != null">
copy_target = #{copyTarget},
</if>
</set>
WHERE id = #{id}
</update>
@@ -520,8 +553,11 @@
card_content,
limit_day,
limit_week,
limit_no_day,
limit_no_week,
copy_week,
copy_time
copy_time,
copy_target
FROM
sv_venue
WHERE