Commit 851f3c52 by kk

刷数据:根据文件指定sku刷A+产品的上传人

parent 13294a90
package cn.kk.spring_simple_operation.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
/**
* <p>
* A+产品
* </p>
*
* @author guokunkun
* @since 2025-03-18
*/
@Getter
@Setter
@Accessors(chain = true)
@TableName("a_plus_product")
@ApiModel(value = "APlusProduct对象", description = "A+产品")
public class APlusProduct implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
@TableId("id")
private Long id;
@ApiModelProperty("站点")
@TableField("site")
private String site;
@ApiModelProperty("sku")
@TableField("sku")
private String sku;
@ApiModelProperty("关联sku")
@TableField("relation_sku")
private String relationSku;
@ApiModelProperty("关联sku站点")
@TableField("relation_sku_site")
private String relationSkuSite;
@ApiModelProperty("A+上传后台30天销量")
@TableField("sale_30")
private Integer sale30;
@ApiModelProperty("A+策划进度,本表中该字段已弃用")
@TableField("a_plus_plan_progress")
private Integer aPlusPlanProgress;
@ApiModelProperty("摄影A+进度,本表中该字段已弃用")
@TableField("photo_a_plus_progress")
private Integer photoAPlusProgress;
@ApiModelProperty("A+是否合格,0-否,1-是\"")
@TableField("is_qualified")
private Integer isQualified;
@ApiModelProperty("A+上传后台状态,0-默认值,1-未完成,2-完成,3-不需要处理")
@TableField("is_upload_backstage")
private Integer isUploadBackstage;
@ApiModelProperty("A+合格备注")
@TableField("qualified_remark")
private String qualifiedRemark;
@ApiModelProperty("A+上传备注")
@TableField("upload_remark")
private String uploadRemark;
@ApiModelProperty("催评原因")
@TableField("urge_reason")
private String urgeReason;
@ApiModelProperty("添加地区")
@TableField("add_region")
private String addRegion;
@ApiModelProperty("是否共享A+,0-否,1-是")
@TableField("is_share_a_plus")
private Integer isShareAPlus;
@ApiModelProperty("传达设计进度,本表中该字段已弃用")
@TableField("communication_design_progress")
private Integer communicationDesignProgress;
@ApiModelProperty("[优化A+]A+优化类型:1-版面重新设计(整版调色、整版改排版),2-老品详情页替换新品。(老品外观变更、老品侵权、批次大货不一致);3-增加新模板设计")
@TableField("a_plus_optimize_type")
private Integer aPlusOptimizeType;
@ApiModelProperty("[优化A+]是否需要A+策划,0-否,1-是")
@TableField("is_a_plus_plan")
private Integer isAPlusPlan;
@ApiModelProperty("[优化A+]是否需要摄影,0-否,1-是")
@TableField("is_photo")
private Integer isPhoto;
@ApiModelProperty("[优化A+]优化备注")
@TableField("optimize_remark")
private String optimizeRemark;
@ApiModelProperty("添加时备注")
@TableField("add_remark")
private String addRemark;
@ApiModelProperty("优化类型:0-原始任务(默认),1-优化任务")
@TableField("optimize_type")
private Integer optimizeType;
@ApiModelProperty("A+策划编号,本表中该字段已弃用")
@TableField("a_plus_plan_number")
private String aPlusPlanNumber;
@ApiModelProperty("A+策划,本表中该字段已弃用")
@TableField("a_plus_plan_name")
private String aPlusPlanName;
@ApiModelProperty("分配A+策划时间,本表中该字段已弃用")
@TableField("a_plus_plan_time")
private Integer aPlusPlanTime;
@ApiModelProperty("A+策划完成时间,本表中该字段已弃用")
@TableField("a_plus_plan_finish_time")
private Integer aPlusPlanFinishTime;
@ApiModelProperty("创建人id")
@TableField("create_id")
private Integer createId;
@ApiModelProperty("创建人")
@TableField("create_name")
private String createName;
@ApiModelProperty("摄影A+的id,visual_photographer_a_plus表id")
@TableField("photographer_a_plus_id")
private Long photographerAPlusId;
@ApiModelProperty("传达设计id,visual_communication_design表id")
@TableField("communication_design_id")
private Long communicationDesignId;
@ApiModelProperty("摄影A+编号,本表中该字段已弃用")
@TableField("photo_a_plus_number")
private String photoAPlusNumber;
@ApiModelProperty("摄影A+,本表中该字段已弃用")
@TableField("photo_a_plus_name")
private String photoAPlusName;
@ApiModelProperty("分配摄影A+时间,本表中该字段已弃用")
@TableField("photo_a_plus_time")
private Long photoAPlusTime;
@ApiModelProperty("摄影A+完成时间,本表中该字段已弃用")
@TableField("photo_a_plus_finish_time")
private Long photoAPlusFinishTime;
@ApiModelProperty("A+上传后台时间")
@TableField("upload_backstage_time")
private Integer uploadBackstageTime;
@ApiModelProperty("A+上传后台人id(inv没有值)")
@TableField("upload_backstage_id")
private Long uploadBackstageId;
@ApiModelProperty("A+上传后台人")
@TableField("upload_backstage_user")
private String uploadBackstageUser;
@ApiModelProperty("A+优先等级")
@TableField("a_plus_level")
private String aPlusLevel;
@ApiModelProperty("传达设计编号,本表中该字段已弃用")
@TableField("communication_design_number")
private String communicationDesignNumber;
@ApiModelProperty("传达设计,本表中该字段已弃用")
@TableField("communication_design_name")
private String communicationDesignName;
@ApiModelProperty("分配传达设计时间,本表中该字段已弃用")
@TableField("communication_design_time")
private Integer communicationDesignTime;
@ApiModelProperty("传达设计完成时间,本表中该字段已弃用")
@TableField("communication_design_finish_time")
private Integer communicationDesignFinishTime;
@ApiModelProperty("visual_a_plus_plan表id")
@TableField("a_plus_plan_id")
private Long aPlusPlanId;
@ApiModelProperty("相关SKU是否同步,-1-暂无,0-否,1-是")
@TableField("is_sync")
private Integer isSync;
@ApiModelProperty("创建时间")
@TableField("create_time")
private Integer createTime;
@ApiModelProperty("创建人类型,0-系统,1-销售,2-策划")
@TableField("create_type")
private Integer createType;
@ApiModelProperty("是否删除,0-否,1-是")
@TableField("is_delete")
@TableLogic
private Integer isDelete;
@ApiModelProperty("是否已做A+优化 0-否 1-是")
@TableField("is_optimize")
private Integer isOptimize;
@ApiModelProperty("商标审核人")
@TableField("trademark_audit_user")
private String trademarkAuditUser;
@ApiModelProperty("商标审核人id")
@TableField("trademark_audit_user_id")
private Integer trademarkAuditUserId;
@ApiModelProperty("商标审核状态 0待审核 1已审核 2商标问题 3拼写问题 4商标+拼写 5无问题")
@TableField("trademark_audit_status")
private Integer trademarkAuditStatus;
@ApiModelProperty("商标审核时间")
@TableField("trademark_audit_time")
private Integer trademarkAuditTime;
@ApiModelProperty("销售等级")
@TableField("sales_level")
private String salesLevel;
@ApiModelProperty("该字段记录的是优化类型5,同站点同sku时,是否是最新的优化")
@TableField("is_newest_optimize")
private Integer isNewestOptimize;
@ApiModelProperty("商标审核备注")
@TableField("trademark_audit_memo")
private String trademarkAuditMemo;
}
package cn.kk.spring_simple_operation.mapper;
import cn.kk.spring_simple_operation.entity.APlusProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* A+产品 Mapper 接口
* </p>
*
* @author guokunkun
* @since 2025-03-18
*/
@Mapper
public interface APlusProductMapper extends BaseMapper<APlusProduct> {
}
package cn.kk.spring_simple_operation.service;
import cn.kk.spring_simple_operation.entity.APlusProduct;
import cn.kk.spring_simple_operation.model.dto.SkuPeopleNameDto;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* A+产品 服务类
* </p>
*
* @author guokunkun
* @since 2025-03-18
*/
public interface APlusProductService extends IService<APlusProduct> {
void setAPlusProductUploadInfo(List<SkuPeopleNameDto> list);
}
package cn.kk.spring_simple_operation.service.impl;
import cn.kk.spring_simple_operation.entity.APlusProduct;
import cn.kk.spring_simple_operation.entity.SyncProductPublish;
import cn.kk.spring_simple_operation.entity.VisualDesigner;
import cn.kk.spring_simple_operation.mapper.APlusProductMapper;
import cn.kk.spring_simple_operation.mapper.SyncProductPublishMapper;
import cn.kk.spring_simple_operation.mapper.VisualDesignerMapper;
import cn.kk.spring_simple_operation.model.dto.SkuPeopleNameDto;
import cn.kk.spring_simple_operation.service.APlusProductService;
import cn.kk.spring_simple_operation.service.VisualDesignLogService;
import cn.kk.spring_simple_operation.utils.DateUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* A+产品 服务实现类
* </p>
*
* @author guokunkun
* @since 2025-03-18
*/
@Service
@Slf4j
public class APlusProductServiceImpl extends ServiceImpl<APlusProductMapper, APlusProduct> implements APlusProductService {
@Resource
private VisualDesignLogService visualDesignLogService;
@Resource
private SyncProductPublishMapper syncProductPublishMapper;
@Resource
private VisualDesignerMapper visualDesignerMapper;
@Override
public void setAPlusProductUploadInfo(List<SkuPeopleNameDto> list) {
Integer currentTimeSecond = DateUtils.getCurrentTimeSecond();
for (SkuPeopleNameDto skuPeopleNameDto : list) {
List<APlusProduct> aPlusProducts = baseMapper.selectList(Wrappers.<APlusProduct>lambdaQuery()
.eq(APlusProduct::getSku, skuPeopleNameDto.getSku())
.eq(APlusProduct::getSite, "Amazon.com")
.select(APlusProduct::getId, APlusProduct::getSku, APlusProduct::getSite)
);
if (CollectionUtils.isEmpty(aPlusProducts)) {
log.error("sku:{}, site:{}, 未找到对应的A+产品", skuPeopleNameDto.getSku(), "Amazon.com");
continue;
}
APlusProduct aPlusProduct = aPlusProducts.get(0);
List<SyncProductPublish> syncProductPublishes = syncProductPublishMapper.selectList(Wrappers.<SyncProductPublish>lambdaQuery()
.eq(SyncProductPublish::getSku, aPlusProduct.getSku())
.eq(SyncProductPublish::getSite, aPlusProduct.getSite())
.select(SyncProductPublish::getThirtyDaySales)
);
if (CollectionUtils.isEmpty(syncProductPublishes)) {
log.error("sku:{}, site:{}, 未找到对应的销量数据", skuPeopleNameDto.getSku(), "Amazon.com");
continue;
}
SyncProductPublish syncProductPublish = syncProductPublishes.get(0);
List<VisualDesigner> visualDesigners = visualDesignerMapper.selectList(Wrappers.<VisualDesigner>lambdaQuery()
.eq(VisualDesigner::getUserName, skuPeopleNameDto.getPeopleName())
.in(VisualDesigner::getDepartmentKey, "a_plus_plan")
);
if (CollectionUtils.isEmpty(visualDesigners)) {
log.error("userName:{}, 未找到对应的视觉设计师", skuPeopleNameDto.getPeopleName());
continue;
}
VisualDesigner visualDesigner = visualDesigners.get(0);
aPlusProduct.setSale30(syncProductPublish.getThirtyDaySales())
.setIsUploadBackstage(2)
.setUploadBackstageId(Long.valueOf(visualDesigner.getUserId()))
.setUploadBackstageUser(visualDesigner.getUserName())
.setUploadBackstageTime(currentTimeSecond)
;
visualDesignLogService.addLog("a_plus_product",
String.format("sku:%s, site:%s, 上传A+产品信息修改为:上传人:%s,上传时间:%s", aPlusProduct.getSku(), aPlusProduct.getSite(), visualDesigner.getUserName(), DateUtils.format10YMD(currentTimeSecond)),
aPlusProduct.getId());
}
}
}
<?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.APlusProductMapper">
</mapper>
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