Commit 48337d47 by kk

刷数据:根据文件指定sku和站点,刷简易视频和精细视频的上传后台状态为已删除

parent d314e7f4
......@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
* </p>
*
* @author guokunkun
* @since 2024-12-25
* @since 2025-02-27
*/
@RestController
@RequestMapping("/spring_simple_operation/video-product")
......
......@@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
* </p>
*
* @author guokunkun
* @since 2024-12-25
* @since 2025-02-27
*/
@Getter
@Setter
......
......@@ -3,6 +3,9 @@ package cn.kk.spring_simple_operation.mapper;
import cn.kk.spring_simple_operation.entity.PhotoProgress;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
......@@ -15,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PhotoProgressMapper extends BaseMapper<PhotoProgress> {
List<PhotoProgress> getListBySku(@Param("skuList") List<String> collect);
}
package cn.kk.spring_simple_operation.mapper;
import cn.kk.spring_simple_operation.entity.VideoProduct;
import cn.kk.spring_simple_operation.model.dto.SkuSiteDTO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -19,4 +20,6 @@ import java.util.List;
public interface VideoProductMapper extends BaseMapper<VideoProduct> {
List<String> selectHaveTask(@Param("skus") List<String> skus);
List<VideoProduct> getListBySkuAndSite(@Param("list") List<SkuSiteDTO> list);
}
package cn.kk.spring_simple_operation.model.dto;
import cn.kk.spring_simple_operation.utils.Excel;
import lombok.Data;
/**
* @author kk
* @date 2025/2/27
*/
@Data
public class SkuSiteDTO {
@Excel(name = "SKU")
private String sku;
@Excel(name = "站点")
private String site;
}
package cn.kk.spring_simple_operation.service;
import cn.kk.spring_simple_operation.entity.PhotoProgress;
import cn.kk.spring_simple_operation.model.dto.SkuSiteDTO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 图片协同系统 服务类
......@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface PhotoProgressService extends IService<PhotoProgress> {
void setUploadStatusIsDeleted(List<SkuSiteDTO> list);
}
package cn.kk.spring_simple_operation.service;
import cn.kk.spring_simple_operation.entity.VideoProduct;
import cn.kk.spring_simple_operation.model.dto.SkuSiteDTO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 视频产品 服务类
* </p>
*
* @author guokunkun
* @since 2024-12-25
* @since 2025-02-27
*/
public interface VideoProductService extends IService<VideoProduct> {
void setUploadStatusIsDeleted(List<SkuSiteDTO> list);
}
......@@ -3,6 +3,8 @@ package cn.kk.spring_simple_operation.service;
import cn.kk.spring_simple_operation.entity.VisualDesignLog;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 视觉操作日志 服务类
......@@ -14,4 +16,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
public interface VisualDesignLogService extends IService<VisualDesignLog> {
void addLog(String operationKey, String operationContent, Long relationId);
void addBatchLog(String operationKey, String operationContent, List<Long> relationIdList);
}
......@@ -2,9 +2,17 @@ package cn.kk.spring_simple_operation.service.impl;
import cn.kk.spring_simple_operation.entity.PhotoProgress;
import cn.kk.spring_simple_operation.mapper.PhotoProgressMapper;
import cn.kk.spring_simple_operation.model.dto.SkuSiteDTO;
import cn.kk.spring_simple_operation.service.PhotoProgressService;
import cn.kk.spring_simple_operation.service.VisualDesignLogService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
......@@ -17,4 +25,21 @@ import org.springframework.stereotype.Service;
@Service
public class PhotoProgressServiceImpl extends ServiceImpl<PhotoProgressMapper, PhotoProgress> implements PhotoProgressService {
@Resource
private VisualDesignLogService visualDesignLogService;
@Override
@Transactional(rollbackFor = Exception.class)
public void setUploadStatusIsDeleted(List<SkuSiteDTO> list) {
List<PhotoProgress> listPhotoProgress = baseMapper.getListBySku(list.stream().map(SkuSiteDTO::getSku).collect(Collectors.toList()));
List<Long> ids = listPhotoProgress.stream()
.filter(t -> t.getSimpleVideoUploadStatus() != 5)
.map(PhotoProgress::getId)
.collect(Collectors.toList());
update(Wrappers.<PhotoProgress>lambdaUpdate().in(PhotoProgress::getId, ids)
.set(PhotoProgress::getSimpleVideoUploadStatus, 5)
);
visualDesignLogService.addBatchLog("photo_progress", "根据文件将sku的视频上传后台状态设置为已删除", ids);
}
}
......@@ -2,9 +2,17 @@ package cn.kk.spring_simple_operation.service.impl;
import cn.kk.spring_simple_operation.entity.VideoProduct;
import cn.kk.spring_simple_operation.mapper.VideoProductMapper;
import cn.kk.spring_simple_operation.model.dto.SkuSiteDTO;
import cn.kk.spring_simple_operation.service.VideoProductService;
import cn.kk.spring_simple_operation.service.VisualDesignLogService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
......@@ -12,9 +20,26 @@ import org.springframework.stereotype.Service;
* </p>
*
* @author guokunkun
* @since 2024-12-25
* @since 2025-02-27
*/
@Service
public class VideoProductServiceImpl extends ServiceImpl<VideoProductMapper, VideoProduct> implements VideoProductService {
@Resource
private VisualDesignLogService visualDesignLogService;
@Override
@Transactional(rollbackFor = Exception.class)
public void setUploadStatusIsDeleted(List<SkuSiteDTO> list) {
List<VideoProduct> listVideoProduct = baseMapper.getListBySkuAndSite(list);
List<Long> ids = listVideoProduct.stream()
.filter(videoProduct -> videoProduct.getVideoIsUploadBackstage() != 5)
.map(VideoProduct::getId)
.collect(Collectors.toList());
update(Wrappers.<VideoProduct>lambdaUpdate().in(VideoProduct::getId, ids)
.set(VideoProduct::getVideoIsUploadBackstage, 5)
);
visualDesignLogService.addBatchLog("video_product", "根据文件将sku和站点的视频上传后台状态设置为已删除", ids);
}
}
......@@ -9,6 +9,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 视觉操作日志 服务实现类
......@@ -37,4 +40,25 @@ public class VisualDesignLogServiceImpl extends ServiceImpl<VisualDesignLogMappe
visualDesignLog.setOperationType("");
this.save(visualDesignLog);
}
@Override
public void addBatchLog(String operationKey, String operationContent, List<Long> relationIdList) {
if(StringUtils.isEmpty(operationContent)){
return;
}
List<VisualDesignLog> logs = relationIdList.stream().map(relationId -> {
VisualDesignLog visualDesignLog = new VisualDesignLog();
visualDesignLog.setId(IdWorker.getId());
visualDesignLog.setOperationKey(operationKey);
visualDesignLog.setCreateId(0);
visualDesignLog.setCreateName("系统");
visualDesignLog.setOperationContent(operationContent);
visualDesignLog.setRelationId(relationId);
visualDesignLog.setFileUrl("");
visualDesignLog.setCreateTime(DateUtils.getCurrentTimeSecond());
visualDesignLog.setOperationType("");
return visualDesignLog;
}).collect(Collectors.toList());
this.saveBatch(logs);
}
}
......@@ -2,4 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.kk.spring_simple_operation.mapper.PhotoProgressMapper">
<select id="getListBySku" resultType="cn.kk.spring_simple_operation.entity.PhotoProgress">
select id, simple_video_upload_status
from photo_progress
where sku in
<foreach collection="skuList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
......@@ -4,17 +4,27 @@
<select id="selectHaveTask" resultType="java.lang.String">
SELECT
vp.sku
vp.sku
FROM
video_product vp
INNER JOIN visual_video_plan vvp ON vvp.id = vp.video_plan_id
video_product vp
INNER JOIN visual_video_plan vvp ON vvp.id = vp.video_plan_id
WHERE
vp.is_delete = 0
AND vvp.is_delete = 0
AND vp.site = 'Amazon.com'
vp.is_delete = 0
AND vvp.is_delete = 0
AND vp.site = 'Amazon.com'
and vp.sku in
<foreach item="sku" collection="skus" open="(" separator="," close=")">
#{sku}
</foreach>
</select>
<select id="getListBySkuAndSite" resultType="cn.kk.spring_simple_operation.entity.VideoProduct">
select id, video_is_upload_backstage
from video_product
where is_delete = 0
and (sku, site) in
<foreach collection="list" item="item" open="(" separator="," close=")">
(#{item.sku}, #{item.site})
</foreach>
</select>
</mapper>
package cn.kk.spring_simple_operation;
import cn.kk.spring_simple_operation.mapper.VisualVideoPlanMapper;
import cn.kk.spring_simple_operation.model.dto.SkuSiteDTO;
import cn.kk.spring_simple_operation.service.PhotoProgressService;
import cn.kk.spring_simple_operation.service.VideoProductService;
import cn.kk.spring_simple_operation.service.VisualPhotographerAPlusService;
import cn.kk.spring_simple_operation.service.VisualVideoPlanService;
import cn.kk.spring_simple_operation.utils.ExcelUtil;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.nio.file.Files;
import java.util.LinkedList;
import java.util.List;
/**
* @author kk
......@@ -16,8 +28,26 @@ public class ApplicationTest {
@Resource
private VisualPhotographerAPlusService visualPhotographerAPlusService;
@Resource
private VideoProductService videoProductService;
@Resource
private PhotoProgressService photoProgressService;
@Test
void contextLoads() {
visualPhotographerAPlusService.brushDataForExecutor();
void contextLoads() throws Exception {
//visualPhotographerAPlusService.brushDataForExecutor();
setUploadStatusIsDeleted();
}
private void setUploadStatusIsDeleted() throws Exception {
File file = new File("已删除页面直接调整视频状态.xlsx");
ExcelUtil<SkuSiteDTO> util = new ExcelUtil<SkuSiteDTO>(SkuSiteDTO.class);
List<SkuSiteDTO> list = util.importExcel("精细视频", Files.newInputStream(file.toPath()));
videoProductService.setUploadStatusIsDeleted(list);
list = util.importExcel("简易视频", Files.newInputStream(file.toPath()));
photoProgressService.setUploadStatusIsDeleted(list);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment