Commit b6c765ad by kk

20532-视觉刷数据

parent 223865d0
...@@ -31,6 +31,9 @@ public class PhotoProgressPerson implements Serializable { ...@@ -31,6 +31,9 @@ public class PhotoProgressPerson implements Serializable {
@TableId("id") @TableId("id")
private Long id; private Long id;
@TableField(exist = false)
private String sku;
@ApiModelProperty("审核产品id") @ApiModelProperty("审核产品id")
@TableField("product_id") @TableField("product_id")
private Integer productId; private Integer productId;
......
package cn.kk.spring_simple_operation.mapper; package cn.kk.spring_simple_operation.mapper;
import cn.kk.spring_simple_operation.entity.PhotoProgress; import cn.kk.spring_simple_operation.entity.PhotoProgress;
import cn.kk.spring_simple_operation.entity.PhotoProgressPerson;
import cn.kk.spring_simple_operation.model.vo.PhotoProgressPhotographerVo; import cn.kk.spring_simple_operation.model.vo.PhotoProgressPhotographerVo;
import cn.kk.spring_simple_operation.model.vo.PhotoSkuInfo; import cn.kk.spring_simple_operation.model.vo.PhotoSkuInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -35,4 +36,6 @@ public interface PhotoProgressMapper extends BaseMapper<PhotoProgress> { ...@@ -35,4 +36,6 @@ public interface PhotoProgressMapper extends BaseMapper<PhotoProgress> {
List<PhotoProgressPhotographerVo> getPhotoProgressIdByDeveloper(@Param("developNumList") List<String> developers); List<PhotoProgressPhotographerVo> getPhotoProgressIdByDeveloper(@Param("developNumList") List<String> developers);
void updatePhotography(@Param("visualNumber") String visualNumber, @Param("userName") String userName, @Param("idList") List<Long> idList); void updatePhotography(@Param("visualNumber") String visualNumber, @Param("userName") String userName, @Param("idList") List<Long> idList);
List<PhotoProgressPerson> getPhotoSkuSimpleVideoPhotography(@Param("skuList") List<String> skuList);
} }
...@@ -28,6 +28,9 @@ public class SkuSiteDTO { ...@@ -28,6 +28,9 @@ public class SkuSiteDTO {
@Excel(name = "摄影师") @Excel(name = "摄影师")
private String photography; private String photography;
@Excel(name = "简易视频摄影师")
private String simpleVideoPhotography;
@Excel(name = "开发") @Excel(name = "开发")
private String developer; private String developer;
......
...@@ -27,4 +27,6 @@ public interface PhotoProgressService extends IService<PhotoProgress> { ...@@ -27,4 +27,6 @@ public interface PhotoProgressService extends IService<PhotoProgress> {
void brushSimpleVideoDataStatus(List<SkuSiteDTO> list); void brushSimpleVideoDataStatus(List<SkuSiteDTO> list);
void updatePhotoProgressPhotographer(List<SkuSiteDTO> list); void updatePhotoProgressPhotographer(List<SkuSiteDTO> list);
void updatePhotoProgressSimplePhotographer(List<SkuSiteDTO> list);
} }
...@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
...@@ -416,4 +417,64 @@ public class PhotoProgressServiceImpl extends ServiceImpl<PhotoProgressMapper, P ...@@ -416,4 +417,64 @@ public class PhotoProgressServiceImpl extends ServiceImpl<PhotoProgressMapper, P
} }
} }
@Override
public void updatePhotoProgressSimplePhotographer(List<SkuSiteDTO> list) {
if (CollectionUtils.isEmpty(list)) return;
Integer currentTimeSecond = DateUtils.getCurrentTimeSecond();
//List<String> skuList = list.stream().map(SkuSiteDTO::getSku).collect(Collectors.toList());
List<String> photographers = list.stream().map(SkuSiteDTO::getSimpleVideoPhotography).distinct().collect(Collectors.toList());
List<VisualDesigner> visualDesigners = visualDesignerService.list(Wrappers.<VisualDesigner>lambdaQuery().in(VisualDesigner::getUserName, photographers));
Map<String, String> photoMap = visualDesigners.stream().collect(Collectors.toMap(VisualDesigner::getUserName, VisualDesigner::getVisualNumber, (a, b) -> b));
List<String> errorSkuList = new LinkedList<>();
Lists.partition(list, 500).forEach(l -> {
List<VisualDesignLog> logList = new ArrayList<>();
List<PhotoProgressPerson> photoProgressPersonList = new ArrayList<>();
List<String> skuList = l.stream().map(SkuSiteDTO::getSku).collect(Collectors.toList());
List<PhotoProgressPerson> personList = baseMapper.getPhotoSkuSimpleVideoPhotography(skuList);
Map<String, PhotoProgressPerson> personMap = personList.stream().collect(Collectors.toMap(PhotoProgressPerson::getSku, Function.identity(), (a, b) -> b));
l.forEach(p -> {
PhotoProgressPerson photoProgressPerson = personMap.get(p.getSku());
if (Objects.isNull(photoProgressPerson)) {
errorSkuList.add(p.getSku());
return;
}
String number = photoMap.get(p.getSimpleVideoPhotography());
if (StringUtils.isEmpty(number)) {
errorSkuList.add(p.getSku() + "--" + p.getSimpleVideoPhotography());
return;
}
logList.add(new VisualDesignLog()
.setId(IdWorker.getId())
.setOperationKey("photo_progress")
.setOperationContent(String.format("简易视频摄影摄影师由[%s]修改为[%s]", photoProgressPerson.getSimpleVideoPhotographerName(), p.getSimpleVideoPhotography()))
.setRelationId(photoProgressPerson.getId())
.setOperationType("simple_video_photographer_num")
.setCreateTime(currentTimeSecond)
.setCreateId(0)
.setCreateName("job")
);
photoProgressPerson.setSimpleVideoPhotographerNum(number)
.setSimpleVideoPhotographerName(p.getSimpleVideoPhotography());
photoProgressPersonList.add(photoProgressPerson);
});
if (!CollectionUtils.isEmpty(photoProgressPersonList)) {
photoProgressPersonService.updateBatchById(photoProgressPersonList);
visualDesignLogService.saveBatch(logList);
log.info("本次修改简易视频摄影摄影师成功,共修改{}条数据!", photoProgressPersonList.size());
}
});
if (!CollectionUtils.isEmpty(errorSkuList)) {
log.error("更新失败的sku:{}", String.join(" ;", errorSkuList));
}
}
} }
...@@ -138,4 +138,20 @@ ...@@ -138,4 +138,20 @@
AND ppp.photo_progress IN ( 0 ) AND ppp.photo_progress IN ( 0 )
AND ppg.sample_status = 0; AND ppg.sample_status = 0;
</select> </select>
<select id="getPhotoSkuSimpleVideoPhotography"
resultType="cn.kk.spring_simple_operation.entity.PhotoProgressPerson">
SELECT
ppg.id,
ppg.sku,
ppp.simple_video_photographer_num,
ppp.simple_video_photographer_name
FROM
photo_progress ppg
INNER JOIN photo_progress_person ppp ON ppp.id = ppg.id
WHERE
ppg.sku IN
<foreach collection="skuList" item="sku" open="(" close=")" separator=",">
#{sku}
</foreach>
</select>
</mapper> </mapper>
...@@ -75,18 +75,27 @@ public class ApplicationTest { ...@@ -75,18 +75,27 @@ public class ApplicationTest {
//exportAPlusPlanNoHandlerData(); //exportAPlusPlanNoHandlerData();
updatePhotoProgressPhotographer(); //updatePhotoProgressPhotographer();
updatePhotoProgressSimplePhotographer();
} }
private void updatePhotoProgressPhotographer() throws Exception { private void updatePhotoProgressSimplePhotographer() throws Exception {
File file = new File("摄影-开发对接明细.xlsx"); File file = new File("图片协同简易视频摄影师刷成江雯洁.xlsx");
ExcelUtil<SkuSiteDTO> util = new ExcelUtil<SkuSiteDTO>(SkuSiteDTO.class); ExcelUtil<SkuSiteDTO> util = new ExcelUtil<SkuSiteDTO>(SkuSiteDTO.class);
List<SkuSiteDTO> list = util.importExcel("(新)业务调整对接", Files.newInputStream(file.toPath())); List<SkuSiteDTO> list = util.importExcel("导出全部", Files.newInputStream(file.toPath()));
photoProgressService.updatePhotoProgressPhotographer(list); photoProgressService.updatePhotoProgressSimplePhotographer(list);
} }
//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 { //private void exportAPlusPlanNoHandlerData() throws Exception {
// List<APlusPlanNoHandlerVo> list = aPlusProductService.exportAPlusPlanNoHandlerData(); // List<APlusPlanNoHandlerVo> list = aPlusProductService.exportAPlusPlanNoHandlerData();
// ExcelUtil<APlusPlanNoHandlerVo> util = new ExcelUtil<>(APlusPlanNoHandlerVo.class); // ExcelUtil<APlusPlanNoHandlerVo> util = new ExcelUtil<>(APlusPlanNoHandlerVo.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