fix:集合非空校验,数据库update脚本修改
This commit is contained in:
@@ -7,6 +7,7 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@@ -51,4 +52,6 @@ public class FPerformProjectInfo {
|
||||
private LocalDate projectEndDate;
|
||||
|
||||
private String subClassifyName;
|
||||
|
||||
private LocalDateTime preSaleTime;
|
||||
}
|
||||
|
||||
@@ -59,9 +59,9 @@ public class PullDataFromFWDJob {
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
/**
|
||||
* 定时任务 每日2点爬取芬玩岛数据演出列表数据
|
||||
* 定时任务 每日1点爬取芬玩岛数据演出列表数据
|
||||
*/
|
||||
@Scheduled(cron = "0 0 2 1/1 * ?")
|
||||
@Scheduled(cron = "0 0 1 1/1 * ?")
|
||||
@PostMapping("/pullProjectsDataJob")
|
||||
public void pullProjectsDataJob() {
|
||||
ProjectsResp showProjectsFromHttp = performServiceHttp.getShowProjectsFromHttp();
|
||||
@@ -96,8 +96,12 @@ public class PullDataFromFWDJob {
|
||||
projectInfo.setShortCity(project.getShortCity());
|
||||
projectInfo.setVenueName(project.getVenueName());
|
||||
projectInfo.setLowestPrice(project.getLowestPrice());
|
||||
if (StringUtils.isNotBlank(projectInfoFromHttp.getPreSaleTime())) {
|
||||
projectInfo.setPreSaleTime(DateUtils.getDateTimeFromStr(projectInfoFromHttp.getPreSaleTime()));
|
||||
}
|
||||
performProjectInfoMapper.update(projectInfo);
|
||||
List<FPerformSeatInfo> fPerformSeatInfoInsertList = Lists.newArrayList();
|
||||
if (CollectionUtils.isNotEmpty(performsByProjectIdFromHttp.getPerformInfos())) {
|
||||
for (PerformInfo performInfo : performsByProjectIdFromHttp.getPerformInfos()) {
|
||||
if (CollectionUtils.isNotEmpty(performInfo.getPerformInfo())) {
|
||||
for (PerformDetail performDetail : performInfo.getPerformInfo()) {
|
||||
@@ -142,6 +146,8 @@ public class PullDataFromFWDJob {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(fPerformSeatInfoInsertList)) {
|
||||
performSeatInfoMapper.batchSave(fPerformSeatInfoInsertList);
|
||||
}
|
||||
@@ -167,9 +173,13 @@ public class PullDataFromFWDJob {
|
||||
fPerformProjectInfo.setShortCity(project.getShortCity());
|
||||
fPerformProjectInfo.setVenueName(project.getVenueName());
|
||||
fPerformProjectInfo.setLowestPrice(project.getLowestPrice());
|
||||
if (StringUtils.isNotBlank(projectInfoFromHttp.getPreSaleTime())) {
|
||||
fPerformProjectInfo.setPreSaleTime(DateUtils.getDateTimeFromStr(projectInfoFromHttp.getPreSaleTime()));
|
||||
}
|
||||
performProjectInfoMapper.insert(fPerformProjectInfo);
|
||||
|
||||
List<FPerformSeatInfo> fPerformSeatInfos = Lists.newArrayList();
|
||||
if (CollectionUtils.isNotEmpty(performsByProjectIdFromHttp.getPerformInfos())) {
|
||||
for (PerformInfo performInfo : performsByProjectIdFromHttp.getPerformInfos()) {
|
||||
if (CollectionUtils.isNotEmpty(performInfo.getPerformInfo())) {
|
||||
for (PerformDetail performDetail : performInfo.getPerformInfo()) {
|
||||
@@ -206,6 +216,8 @@ public class PullDataFromFWDJob {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(fPerformSeatInfos)) {
|
||||
performSeatInfoMapper.batchSave(fPerformSeatInfos);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,10 @@
|
||||
project_end_date,
|
||||
</if>
|
||||
<if test="null != subClassifyName and '' != subClassifyName">
|
||||
sub_classify_name
|
||||
sub_classify_name,
|
||||
</if>
|
||||
<if test="null != preSaleTime">
|
||||
pre_sale_time
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@@ -157,7 +160,10 @@
|
||||
#{projectEndDate},
|
||||
</if>
|
||||
<if test="null != subClassifyName and '' != subClassifyName">
|
||||
#{subClassifyName}
|
||||
#{subClassifyName},
|
||||
</if>
|
||||
<if test="null != preSaleTime">
|
||||
#{preSaleTime}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
@@ -182,7 +188,8 @@
|
||||
<if test="null != projectPrice ">project_price = #{projectPrice},</if>
|
||||
<if test="null != projectStartDate ">project_start_date = #{projectStartDate},</if>
|
||||
<if test="null != projectEndDate ">project_end_date = #{projectEndDate},</if>
|
||||
<if test="null != subClassifyName and '' != subClassifyName">sub_classify_name = #{subClassifyName}</if>
|
||||
<if test="null != subClassifyName and '' != subClassifyName">sub_classify_name = #{subClassifyName},</if>
|
||||
<if test="null != preSaleTime">pre_sale_time = #{preSaleTime}</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
Reference in New Issue
Block a user