Commit 223865d0 by kk

19454-视觉改数据

parent 4e786380
package cn.kk.spring_simple_operation.mapper;
import cn.kk.spring_simple_operation.entity.PhotoProgress;
import cn.kk.spring_simple_operation.model.vo.PhotoProgressPhotographerVo;
import cn.kk.spring_simple_operation.model.vo.PhotoSkuInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
......@@ -28,4 +29,10 @@ public interface PhotoProgressMapper extends BaseMapper<PhotoProgress> {
List<PhotoSkuInfo> getPhotoSkuInfo(@Param("skuList") List<String> skuList);
List<PhotoSkuInfo> getPhotoSkuSimpleVideoStatus(@Param("skuList") List<String> l);
List<String> getDevelopers(@Param("developNumList") List<String> developNumList);
List<PhotoProgressPhotographerVo> getPhotoProgressIdByDeveloper(@Param("developNumList") List<String> developers);
void updatePhotography(@Param("visualNumber") String visualNumber, @Param("userName") String userName, @Param("idList") List<Long> idList);
}
......@@ -25,5 +25,11 @@ public class SkuSiteDTO {
@Excel(name = "开发提交修图日期")
private String dataStr;
@Excel(name = "摄影师")
private String photography;
@Excel(name = "开发")
private String developer;
}
package cn.kk.spring_simple_operation.model.vo;
import lombok.Data;
/**
* @author kk
* @date 2025/12/3
*/
@Data
public class PhotoProgressPhotographerVo {
private Long id;
private String sku;
private String photographerName;
private String photographerNum;
}
......@@ -25,4 +25,6 @@ public interface PhotoProgressService extends IService<PhotoProgress> {
void brushSimpleVideoDataPeople(List<SkuSiteDTO> list);
void brushSimpleVideoDataStatus(List<SkuSiteDTO> list);
void updatePhotoProgressPhotographer(List<SkuSiteDTO> list);
}
......@@ -7,6 +7,7 @@ import cn.kk.spring_simple_operation.entity.VisualDesigner;
import cn.kk.spring_simple_operation.enums.StatusEnum;
import cn.kk.spring_simple_operation.mapper.PhotoProgressMapper;
import cn.kk.spring_simple_operation.model.dto.SkuSiteDTO;
import cn.kk.spring_simple_operation.model.vo.PhotoProgressPhotographerVo;
import cn.kk.spring_simple_operation.model.vo.PhotoSkuInfo;
import cn.kk.spring_simple_operation.service.*;
import cn.kk.spring_simple_operation.utils.CommonUtils;
......@@ -21,13 +22,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -373,4 +370,50 @@ public class PhotoProgressServiceImpl extends ServiceImpl<PhotoProgressMapper, P
});
}
@Override
public void updatePhotoProgressPhotographer(List<SkuSiteDTO> list) {
for (SkuSiteDTO dto : list) {
List<String> developers = baseMapper.getDevelopers(Arrays.stream(dto.getDeveloper().split(",")).map(str -> str.replaceAll("\\s+", "")).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(developers)) {
log.error("未查询到开发人员:{}", dto.getDeveloper());
continue;
}
List<VisualDesigner> visualDesigners = visualDesignerService.list(Wrappers.<VisualDesigner>lambdaQuery().eq(VisualDesigner::getUserName, dto.getPhotography().replaceAll("\\s+", ""))
.eq(VisualDesigner::getDepartmentKey, "photographer_group"));
if (CollectionUtils.isEmpty(visualDesigners)) {
log.error("未查询到摄影人员:{}", dto.getPhotography().replaceAll("\\s+", ""));
continue;
}
VisualDesigner visualDesigner = visualDesigners.get(0);
List<PhotoProgressPhotographerVo> voList = baseMapper.getPhotoProgressIdByDeveloper(developers);
List<VisualDesignLog> logList = new ArrayList<>();
Integer currentTimeSecond = DateUtils.getCurrentTimeSecond();
for (PhotoProgressPhotographerVo p : voList) {
logList.add(new VisualDesignLog()
.setId(IdWorker.getId())
.setOperationKey("photo_progress")
.setOperationContent(String.format("图片摄影师由【%s】修改为【%s】", p.getPhotographerName(), visualDesigner.getUserName()) )
.setRelationId(p.getId())
.setOperationType("photographer_name")
.setCreateTime(currentTimeSecond)
.setCreateId(0)
.setCreateName("job")
);
}
transactionTemplate.execute(status -> {
visualDesignLogService.saveBatch(logList);
baseMapper.updatePhotography(visualDesigner.getVisualNumber(), visualDesigner.getUserName(), voList.stream().map(PhotoProgressPhotographerVo::getId).collect(Collectors.toList()));
log.info("已刷完:{}, {}条任务。", visualDesigner.getUserName(), voList.size());
return true;
});
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!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">
<update id="updatePhotography">
UPDATE photo_progress_person
SET photographer_name = #{userName},
photographer_num = #{visualNumber}
WHERE
id IN
<foreach collection="idList" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</update>
<select id="getListBySku" resultType="cn.kk.spring_simple_operation.entity.PhotoProgress">
select id, simple_video_upload_status
......@@ -93,4 +103,39 @@
</foreach>
group by pp.sku
</select>
<select id="getDevelopers" resultType="java.lang.String">
select developer_num
from sync_developer
<where>
is_num_manager = 1
<if test="developNumList != null and developNumList.size() > 0">
and (
<foreach item="item" collection="developNumList" open="(" separator="or" close=")">
developer_num like concat('%', #{item}, '%') or developer_name like concat('%', #{item}, '%')
</foreach>
)
</if>
</where>
</select>
<select id="getPhotoProgressIdByDeveloper"
resultType="cn.kk.spring_simple_operation.model.vo.PhotoProgressPhotographerVo">
SELECT
ppg.id,
ppg.sku,
ppp.photographer_name,
ppp.photographer_num
FROM
photo_progress ppg
INNER JOIN sync_product_audit spa ON ppg.product_id = spa.id
INNER JOIN photo_progress_person ppp ON ppp.id = ppg.id
WHERE
spa.sku > ''
AND spa.developer_num IN
<foreach collection="developNumList" item="developNum" open="(" close=")" separator=",">
#{developNum}
</foreach>
AND ppp.photo_progress IN ( 0 )
AND ppg.sample_status = 0;
</select>
</mapper>
package cn.kk.spring_simple_operation;
import cn.kk.spring_simple_operation.entity.VisualDeveloperPlaneDesignAssignment;
import cn.kk.spring_simple_operation.entity.VisualDeveloperPlaneDesignAssignmentSku;
import cn.kk.spring_simple_operation.mapper.PhotoProgressMapper;
import cn.kk.spring_simple_operation.model.dto.BrandAccountDto;
import cn.kk.spring_simple_operation.model.dto.SkuPeopleNameDto;
import cn.kk.spring_simple_operation.model.dto.SkuSiteDTO;
import cn.kk.spring_simple_operation.model.vo.APlusPlanNoHandlerVo;
import cn.kk.spring_simple_operation.model.vo.PhotoSkuInfo;
import cn.kk.spring_simple_operation.model.vo.PublishInfoVo;
import cn.kk.spring_simple_operation.service.*;
import cn.kk.spring_simple_operation.utils.DateUtils;
import cn.kk.spring_simple_operation.utils.ExcelUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.*;
import java.util.stream.Collectors;
import java.util.List;
/**
* @author kk
......@@ -85,17 +73,26 @@ public class ApplicationTest {
//brushYf2PlaneDesignAssignmentTime();
exportAPlusPlanNoHandlerData();
//exportAPlusPlanNoHandlerData();
updatePhotoProgressPhotographer();
}
private void exportAPlusPlanNoHandlerData() throws Exception {
List<APlusPlanNoHandlerVo> list = aPlusProductService.exportAPlusPlanNoHandlerData();
ExcelUtil<APlusPlanNoHandlerVo> util = new ExcelUtil<>(APlusPlanNoHandlerVo.class);
util.exportExcelFile(list, "18749-视觉导数据+刷数据.xlsx");
private void updatePhotoProgressPhotographer() throws Exception {
File file = new File("摄影-开发对接明细.xlsx");
ExcelUtil<SkuSiteDTO> util = new ExcelUtil<SkuSiteDTO>(SkuSiteDTO.class);
List<SkuSiteDTO> list = util.importExcel("(新)业务调整对接", Files.newInputStream(file.toPath()));
photoProgressService.updatePhotoProgressPhotographer(list);
}
//private void exportAPlusPlanNoHandlerData() throws Exception {
// List<APlusPlanNoHandlerVo> list = aPlusProductService.exportAPlusPlanNoHandlerData();
// ExcelUtil<APlusPlanNoHandlerVo> util = new ExcelUtil<>(APlusPlanNoHandlerVo.class);
// util.exportExcelFile(list, "18749-视觉导数据+刷数据.xlsx");
//}
//private void brushYf2PlaneDesignAssignmentTime() throws Exception {
// File file = new File("2025-10-13_v6tg_研发二部B组-修图安排.xlsx");
// ExcelUtil<SkuSiteDTO> util = new ExcelUtil<SkuSiteDTO>(SkuSiteDTO.class);
......
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