618活动改价
This commit is contained in:
65
src/main/java/com/peanut/modules/job/task/ActivityTask.java
Normal file
65
src/main/java/com/peanut/modules/job/task/ActivityTask.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.peanut.modules.job.task;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.peanut.common.utils.DateUtils;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueEntity;
|
||||
import com.peanut.modules.common.entity.ShopProduct;
|
||||
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||
import com.peanut.modules.master.service.ShopProductService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component("activityTask")
|
||||
public class ActivityTask implements ITask{
|
||||
|
||||
@Autowired
|
||||
private CourseCatalogueService courseCatalogueService;
|
||||
@Autowired
|
||||
private ShopProductService shopProductService;
|
||||
|
||||
@Override
|
||||
public void run(String params) {
|
||||
if ("2025-06-14".equals(DateUtils.format(new Date()))){
|
||||
List<CourseCatalogueEntity> courseCatalogues = courseCatalogueService.list(new LambdaQueryWrapper<CourseCatalogueEntity>()
|
||||
.eq(CourseCatalogueEntity::getFee,268).eq(CourseCatalogueEntity::getHalfFee,168));
|
||||
for (CourseCatalogueEntity courseCatalogueEntity : courseCatalogues) {
|
||||
courseCatalogueEntity.setFee(new BigDecimal(199));
|
||||
}
|
||||
courseCatalogueService.updateBatchById(courseCatalogues);
|
||||
|
||||
List<ShopProduct> shopProducts = shopProductService.list(new LambdaQueryWrapper<ShopProduct>()
|
||||
.eq(ShopProduct::getGoodsType,"05").eq(ShopProduct::getPrice,268));
|
||||
for (ShopProduct shopProduct : shopProducts) {
|
||||
shopProduct.setPrice(new BigDecimal(199));
|
||||
}
|
||||
shopProductService.updateBatchById(shopProducts);
|
||||
}
|
||||
|
||||
if ("2025-06-19".equals(DateUtils.format(new Date()))){
|
||||
List<CourseCatalogueEntity> courseCatalogues = courseCatalogueService.list(new LambdaQueryWrapper<CourseCatalogueEntity>()
|
||||
.eq(CourseCatalogueEntity::getFee,199).eq(CourseCatalogueEntity::getHalfFee,168));
|
||||
for (CourseCatalogueEntity courseCatalogueEntity : courseCatalogues) {
|
||||
courseCatalogueEntity.setFee(new BigDecimal(248));
|
||||
}
|
||||
courseCatalogueService.updateBatchById(courseCatalogues);
|
||||
|
||||
List<ShopProduct> shopProducts = shopProductService.list(new LambdaQueryWrapper<ShopProduct>()
|
||||
.eq(ShopProduct::getGoodsType,"05").eq(ShopProduct::getPrice,199).isNull(ShopProduct::getPageNum));
|
||||
for (ShopProduct shopProduct : shopProducts) {
|
||||
shopProduct.setPrice(new BigDecimal(248));
|
||||
}
|
||||
shopProductService.updateBatchById(shopProducts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user