fix copy bug & add 拷贝开关字段 1-开启 不拷贝 不是1抽取到的都拷贝(空或者0 都拷贝)

This commit is contained in:
limqhz
2022-02-21 14:41:09 +08:00
parent 0e4a271200
commit 348121af3a
8 changed files with 48 additions and 16 deletions

View File

@@ -163,6 +163,11 @@ public class VenueDTO implements Serializable {
*/ */
private Integer copyTarget; private Integer copyTarget;
/**
* 复制开关 1-关闭,不复制 0-开启,复制
*/
private Integer copyControl;
/** /**
* 场馆图片列表 * 场馆图片列表
*/ */
@@ -624,4 +629,12 @@ public class VenueDTO implements Serializable {
public void setLimitNoWeek(Integer limitNoWeek) { public void setLimitNoWeek(Integer limitNoWeek) {
this.limitNoWeek = limitNoWeek; this.limitNoWeek = limitNoWeek;
} }
public Integer getCopyControl() {
return copyControl;
}
public void setCopyControl(Integer copyControl) {
this.copyControl = copyControl;
}
} }

View File

@@ -47,6 +47,11 @@ public class Venue implements Serializable {
*/ */
private Integer copyTarget; private Integer copyTarget;
/**
* 复制开关 1-关闭,不复制 0-开启,复制
*/
private Integer copyControl;
/** /**
* 地址 * 地址
*/ */
@@ -668,4 +673,12 @@ public class Venue implements Serializable {
public void setLimitNoWeek(Integer limitNoWeek) { public void setLimitNoWeek(Integer limitNoWeek) {
this.limitNoWeek = limitNoWeek; this.limitNoWeek = limitNoWeek;
} }
public Integer getCopyControl() {
return copyControl;
}
public void setCopyControl(Integer copyControl) {
this.copyControl = copyControl;
}
} }

View File

@@ -40,18 +40,18 @@ public class CopyLessonTask {
/** /**
* 每周一九点 * 每周一九点
*/ */
// @Scheduled(cron = "0 */1 * * * ?") @Scheduled(cron = "0 */1 * * * ?")
public void execute(){ public void execute(){
logger.info("开始执行拷贝课程批处理"); logger.info("开始执行拷贝课程批处理");
LocalTime time = LocalTime.parse("09:00"); LocalTime time = LocalTime.now();
LocalDate date = LocalDate.parse("2022-02-21"); LocalDate date = LocalDate.now();
logger.info(time.toString()); logger.info(time.toString());
logger.info(date.toString()); logger.info(date.toString());
int cWeek = date.getDayOfWeek().getValue(); int cWeek = date.getDayOfWeek().getValue();
List<Venue> venueList = venueService.findAlls(); List<Venue> venueList = venueService.findAlls();
for (Venue venue : venueList) { for (Venue venue : venueList) {
if (VenueTypeEnum.BASKETBALL.value != venue.getType() if (VenueTypeEnum.BASKETBALL.value != venue.getType()
&& venue.getCopyWeek() != null && cWeek == venue.getCopyWeek()){ && venue.getCopyWeek() != null && cWeek == venue.getCopyWeek() && !"1".equals(venue.getCopyControl())){
// 非篮球馆有课程 // 非篮球馆有课程
LocalTime copyTime = venue.getCopyTime(); LocalTime copyTime = venue.getCopyTime();
if (checkTime(time,copyTime)){ if (checkTime(time,copyTime)){

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 # 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 # username: yingdd
# password: Yingdd2015 # 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 url: jdbc:mysql://127.0.0.1:3306/smart_venue?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useAffectedRows=true
username: root username: root
password: hyty1234 password: 123456
redis: redis:
host: 127.0.0.1 host: 127.0.0.1
password: password:

View File

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

View File

@@ -6,7 +6,6 @@ import com.sv.dto.api.MemberCardVenuesDTO;
import com.sv.dto.api.VenueDTO; import com.sv.dto.api.VenueDTO;
import com.sv.dto.oms.VenueOmsDTO; import com.sv.dto.oms.VenueOmsDTO;
import com.sv.entity.Venue; import com.sv.entity.Venue;
import com.sv.entity.VenueCard;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;

View File

@@ -1,11 +1,9 @@
package com.sv.service.oms; package com.sv.service.oms;
import com.enums.VenueTypeEnum;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.sv.dto.oms.VenueLessonOmsDTO; import com.sv.dto.oms.VenueLessonOmsDTO;
import com.sv.entity.Platform; import com.sv.entity.Platform;
import com.sv.entity.VenueLesson; import com.sv.entity.VenueLesson;
import com.sv.entity.VenueLessonTag;
import com.sv.entity.VenueLessonTicket; import com.sv.entity.VenueLessonTicket;
import com.sv.exception.oms.OmsException; import com.sv.exception.oms.OmsException;
import com.sv.mapper.VenueLessonMapper; import com.sv.mapper.VenueLessonMapper;
@@ -28,13 +26,11 @@ import org.springframework.dao.DuplicateKeyException;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import redis.clients.jedis.Jedis;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.InputStream; import java.io.InputStream;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Consumer;
import static com.sv.entity.Constants.LESSON_TICKET_LOCK_KEY; import static com.sv.entity.Constants.LESSON_TICKET_LOCK_KEY;
@@ -346,7 +342,7 @@ public class VenueLessonService extends BaseServiceImpl {
VenueLesson x = venueLessonMapper.findById(lessonId); VenueLesson x = venueLessonMapper.findById(lessonId);
Integer oldId = x.getId(); Integer oldId = x.getId();
x.setId(null); x.setId(null);
x.setModifiedId(999); x.setModifiedId(888);
x.setSaleNum(0); x.setSaleNum(0);
x.setModifiedTime(new Date()); x.setModifiedTime(new Date());
x.setDate(targetDate); x.setDate(targetDate);

View File

@@ -35,6 +35,7 @@
<result column="copy_week" property="copyWeek"/> <result column="copy_week" property="copyWeek"/>
<result column="copy_time" property="copyTime"/> <result column="copy_time" property="copyTime"/>
<result column="copy_target" property="copyTarget"/> <result column="copy_target" property="copyTarget"/>
<result column="copy_control" property="copyControl"/>
</resultMap> </resultMap>
<resultMap id="VenueDtoMap" type="com.sv.dto.api.VenueDTO"> <resultMap id="VenueDtoMap" type="com.sv.dto.api.VenueDTO">
@@ -64,6 +65,7 @@
<result column="copy_week" property="copyWeek"/> <result column="copy_week" property="copyWeek"/>
<result column="copy_time" property="copyTime"/> <result column="copy_time" property="copyTime"/>
<result column="copy_target" property="copyTarget"/> <result column="copy_target" property="copyTarget"/>
<result column="copy_control" property="copyControl"/>
<result column="code_url" property="codeUrl"></result> <result column="code_url" property="codeUrl"></result>
<association property="cards" select="com.sv.mapper.VenueCardMapper.findByVenueId" <association property="cards" select="com.sv.mapper.VenueCardMapper.findByVenueId"
column="{venueId = id,venueType=type}"></association> column="{venueId = id,venueType=type}"></association>
@@ -126,7 +128,8 @@
limit_no_week, limit_no_week,
copy_week, copy_week,
copy_time, copy_time,
copy_target copy_target,
copy_control
</sql> </sql>
<!-- 字段值 --> <!-- 字段值 -->
@@ -156,7 +159,8 @@
#{limit_no_week, jdbcType=TINYINT}, #{limit_no_week, jdbcType=TINYINT},
#{copy_week, jdbcType=TINYINT}, #{copy_week, jdbcType=TINYINT},
#{copy_time, jdbcType=TIMESTAMP}, #{copy_time, jdbcType=TIMESTAMP},
#{copy_target, jdbcType=TINYINT} #{copy_target, jdbcType=TINYINT},
#{copy_control, jdbcType=TINYINT}
</sql> </sql>
<!-- 查询全部记录 --> <!-- 查询全部记录 -->
@@ -300,6 +304,9 @@
<if test="copyTarget != null"> <if test="copyTarget != null">
copy_target, copy_target,
</if> </if>
<if test="copyControl != null">
copy_control,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@@ -515,6 +522,9 @@
<if test="copyTarget != null"> <if test="copyTarget != null">
copy_target = #{copyTarget}, copy_target = #{copyTarget},
</if> </if>
<if test="copyControl != null">
copy_control = #{copyControl},
</if>
</set> </set>
WHERE id = #{id} WHERE id = #{id}
</update> </update>
@@ -557,7 +567,8 @@
limit_no_week, limit_no_week,
copy_week, copy_week,
copy_time, copy_time,
copy_target copy_target,
copy_control
FROM FROM
sv_venue sv_venue
WHERE WHERE