Commit 0cbcc83d by kk

导excel数据

parent 6849600f
......@@ -54,7 +54,7 @@ public class CodeGenerator {
.strategyConfig(builder -> {
builder
// 设置需要生成的表名
.addInclude("sync_product_audit")
.addInclude("visual_communication_design")
//entity策略配置
.entityBuilder()
......
package cn.kk.spring_simple_operation.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 视觉设计协同系统-传达设计 前端控制器
* </p>
*
* @author guokunkun
* @since 2025-02-07
*/
@RestController
@RequestMapping("/spring_simple_operation/visual-communication-design")
public class VisualCommunicationDesignController {
}
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 java.math.BigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
/**
* <p>
* 视觉设计协同系统-传达设计
* </p>
*
* @author guokunkun
* @since 2025-02-07
*/
@Getter
@Setter
@Accessors(chain = true)
@TableName("visual_communication_design")
@ApiModel(value = "VisualCommunicationDesign对象", description = "视觉设计协同系统-传达设计")
public class VisualCommunicationDesign implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
@TableId("id")
private Long id;
@ApiModelProperty("标题")
@TableField("title")
private String title;
@ApiModelProperty("状态,0-未完成,1-进行中,2-完成,3-暂停/不需要处理")
@TableField("`status`")
private Integer status;
@ApiModelProperty("执行者编号")
@TableField("executor_number")
private String executorNumber;
@ApiModelProperty("执行者")
@TableField("executor_name")
private String executorName;
@ApiModelProperty("任务完成时间")
@TableField("task_finish_time")
private Integer taskFinishTime;
@ApiModelProperty("备注")
@TableField("remark")
private String remark;
@ApiModelProperty("视频策划备注")
@TableField("video_plan_remark")
private String videoPlanRemark;
@ApiModelProperty("摄影进度")
@TableField("photo_progress")
private Integer photoProgress;
@ApiModelProperty("优先级/紧急程度")
@TableField("priority")
private String priority;
@ApiModelProperty("标签id")
@TableField("vdt_id")
private Long vdtId;
@ApiModelProperty("创建时间")
@TableField("create_time")
private Integer createTime;
@ApiModelProperty("创建人id")
@TableField("create_id")
private Integer createId;
@ApiModelProperty("创建人")
@TableField("create_name")
private String createName;
@ApiModelProperty("任务地区")
@TableField("add_region")
private String addRegion;
@ApiModelProperty("线稿申请id,line_draft_apply表的id[待系统迁移完成,待确定是否去除]")
@TableField("line_draft_apply_id")
private Long lineDraftApplyId;
@ApiModelProperty("visual_video_plan表id[待系统迁移完成,待确定是否去除]")
@TableField("visual_video_plan_id")
private Long visualVideoPlanId;
@ApiModelProperty("visual_a_plus_plan表id[待系统迁移完成,待确定是否去除]")
@TableField("a_plus_plan_id")
private Long aPlusPlanId;
@ApiModelProperty("是否确认排版,0-未确认,1-已确认")
@TableField("is_confirm_typesetting")
private Integer isConfirmTypesetting;
@ApiModelProperty("是否删除,0-否,1-是")
@TableField("is_delete")
@TableLogic
private Integer isDelete;
@ApiModelProperty("分配时间")
@TableField("assign_time")
private Integer assignTime;
@ApiModelProperty("品牌名是否丢失,0-否,1-是")
@TableField("is_lost_brand")
private Integer isLostBrand;
@ApiModelProperty("是否为精品产品,0-否,1-是")
@TableField("is_boutique_product")
private Integer isBoutiqueProduct;
@ApiModelProperty("A+文档[压缩包](account_file)")
@TableField("ap_zip_file_url")
private String apZipFileUrl;
@ApiModelProperty("完整样机图")
@TableField("complete_prototype_pic")
private String completePrototypePic;
@ApiModelProperty("文件URL(上传文件(文档,图片))(appendix_file)")
@TableField("file_url")
private String fileUrl;
@ApiModelProperty("设计文件(上传LOGO素材文档(压缩包))")
@TableField("design_file")
private String designFile;
@ApiModelProperty("设计文件上传时间")
@TableField("design_file_time")
private Integer designFileTime;
@ApiModelProperty("拍摄视频封面文档(visual_file)")
@TableField("cover_file")
private String coverFile;
@ApiModelProperty("关联表id")
@TableField("relation_id")
private Long relationId;
@ApiModelProperty("关联类型,visual_video_plan,visual_a_plus_plan,line_draft_apply,brand_record_tool")
@TableField("relation_type")
private String relationType;
@ApiModelProperty("添加品牌备案人员")
@TableField("add_brand_user")
private String addBrandUser;
@ApiModelProperty("翻译站点")
@TableField("translate_language")
private String translateLanguage;
@ApiModelProperty("是否还样,0-否,1-是")
@TableField("is_return_sample")
private Integer isReturnSample;
@ApiModelProperty("还样时间,是否还样为是时,需要有值")
@TableField("return_sample_time")
private Integer returnSampleTime;
@ApiModelProperty("还样样品状态:1-正,2-次")
@TableField("return_sample_status")
private Integer returnSampleStatus;
@ApiModelProperty("还样样品备注")
@TableField("return_sample_status_remark")
private String returnSampleStatusRemark;
@ApiModelProperty("样品是否给摄影,0-否,1-是")
@TableField("is_photography_sample")
private Integer isPhotographySample;
@ApiModelProperty("样品给摄影的时间,样品是否给摄影为是时,需要有值")
@TableField("photography_sample_time")
private Integer photographySampleTime;
@ApiModelProperty("摄影样品状态::1-正,2-次")
@TableField("photography_sample_status")
private Integer photographySampleStatus;
@ApiModelProperty("摄影样品备注")
@TableField("photography_sample_status_remark")
private String photographySampleStatusRemark;
@ApiModelProperty("logo压缩包链接")
@TableField("logo_file_url")
private String logoFileUrl;
@ApiModelProperty("官网文档压缩包url")
@TableField("official_document_zip_url")
private String officialDocumentZipUrl;
@ApiModelProperty("品牌紧急度")
@TableField("brand_urgency")
private String brandUrgency;
@ApiModelProperty("线稿压缩包url")
@TableField("line_draft_zip_url")
private String lineDraftZipUrl;
@ApiModelProperty("是否套装,0-否,1-是")
@TableField("suit_flag")
private Integer suitFlag;
@ApiModelProperty("通用压缩包url(用于包材标签)")
@TableField("common_zip_url")
private String commonZipUrl;
@ApiModelProperty("创作目的")
@TableField("creative_aims")
private String creativeAims;
@ApiModelProperty("创作独创性")
@TableField("creative_originality")
private String creativeOriginality;
@ApiModelProperty("是否公示logo:0-否,1-是")
@TableField("is_public_logo")
private Integer isPublicLogo;
@ApiModelProperty("权重")
@TableField("weight")
private BigDecimal weight;
@ApiModelProperty("评优图片")
@TableField("appraising_img_url")
private String appraisingImgUrl;
}
......@@ -2,8 +2,10 @@ package cn.kk.spring_simple_operation.mapper;
import cn.kk.spring_simple_operation.entity.SyncProductAudit;
import cn.kk.spring_simple_operation.model.ExportPhotographerNameVO;
import cn.kk.spring_simple_operation.model.PlanSkuInfoVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -25,4 +27,8 @@ public interface SyncProductAuditMapper extends BaseMapper<SyncProductAudit> {
List<ExportPhotographerNameVO> selectIsCustomProdduct();
List<ExportPhotographerNameVO> selectIsCustomProdductPlan();
List<String> planSkuForPublish();
List<PlanSkuInfoVO> listPlanSkuInfo(@Param("skuList") List<String> skuList);
}
......@@ -30,4 +30,6 @@ public interface SyncProductPublishMapper extends BaseMapper<SyncProductPublish>
List<SkuVideoVO> groupSkuSolarTerm_1(@Param("sku") String sku);
List<SkuVideoVO> groupSkuSolarTerm_Q1Q2(@Param("sku") String sku);
List<SkuVideoVO> planSkuForPublishSales(@Param("sku") String sku);
}
package cn.kk.spring_simple_operation.mapper;
import cn.kk.spring_simple_operation.entity.VisualCommunicationDesign;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 视觉设计协同系统-传达设计 Mapper 接口
* </p>
*
* @author guokunkun
* @since 2025-02-07
*/
@Mapper
public interface VisualCommunicationDesignSecondMapper extends BaseMapper<VisualCommunicationDesign> {
}
package cn.kk.spring_simple_operation.model;
import cn.kk.spring_simple_operation.utils.Excel;
import java.math.BigDecimal;
/**
* @author kk
* @date 2025/2/19
*/
public class PlanSkuInfoVO {
@Excel(name = "SKU")
private String sku;
@Excel(name = "策划姓名")
private String planName;
@Excel(name = "策划完成时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
private Integer finishTime;
@Excel(name = "中文标题")
private String title;
@Excel(name = "品类")
private String usRootType;
public String getSku() {
return sku;
}
public void setSku(String sku) {
this.sku = sku;
}
public String getPlanName() {
return planName;
}
public void setPlanName(String planName) {
this.planName = planName;
}
public Integer getFinishTime() {
return finishTime;
}
public void setFinishTime(Integer finishTime) {
this.finishTime = finishTime;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUsRootType() {
return usRootType;
}
public void setUsRootType(String usRootType) {
this.usRootType = usRootType;
}
}
package cn.kk.spring_simple_operation.service;
import cn.kk.spring_simple_operation.entity.VisualCommunicationDesign;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 视觉设计协同系统-传达设计 服务类
* </p>
*
* @author guokunkun
* @since 2025-02-07
*/
public interface VisualCommunicationDesignService extends IService<VisualCommunicationDesign> {
}
package cn.kk.spring_simple_operation.service.impl;
import cn.kk.spring_simple_operation.entity.VisualCommunicationDesign;
import cn.kk.spring_simple_operation.mapper.VisualCommunicationDesignSecondMapper;
import cn.kk.spring_simple_operation.service.VisualCommunicationDesignService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 视觉设计协同系统-传达设计 服务实现类
* </p>
*
* @author guokunkun
* @since 2025-02-07
*/
@Service
public class VisualCommunicationDesignServiceImpl extends ServiceImpl<VisualCommunicationDesignSecondMapper, VisualCommunicationDesign> implements VisualCommunicationDesignService {
}
......@@ -46,7 +46,7 @@
<select id="selectIsCustomProdduct"
resultType="cn.kk.spring_simple_operation.model.ExportPhotographerNameVO">
SELECT
vp.sku,
vvp.sku,
vp2.title,
ssti.solar_term_name solarName,
sd.developer_title developer,
......@@ -66,14 +66,15 @@
AND vp.is_delete = 0
AND vvp.is_have_sample = 1
AND vvp.sample_arrive_time = 0
AND spa.is_custom_product = 1
AND vp.video_is_upload_backstage in (0,1)
GROUP BY
vp.sku
vp2.id
</select>
<select id="selectIsCustomProdductPlan"
resultType="cn.kk.spring_simple_operation.model.ExportPhotographerNameVO">
SELECT
vp.sku,
vvp.sku,
vvp.title,
ssti.solar_term_name solarName,
sd.developer_title developer,
......@@ -90,9 +91,48 @@
AND vp.is_delete = 0
AND vvp.`status` = 3
AND vvp.no_handle_reason = 2
AND spa.is_custom_product = 1
GROUP BY
vp.sku
vvp.id
</select>
<select id="planSkuForPublish" resultType="java.lang.String">
SELECT vapp.sku
FROM visual_a_plus_plan vapp
INNER JOIN visual_communication_design vcd ON vcd.relation_type = 'visual_a_plus_plan'
AND vcd.relation_id = vapp.id
LEFT JOIN sync_product_publish spp ON spp.sku = vapp.sku
WHERE vapp.is_delete = 0
AND vapp.`status` = 2
AND vcd.is_delete = 0
AND vcd.executor_number = ''
AND vcd.`status` = 0
AND vapp.vdt_id = 66
AND spp.solar_term = 1
AND spp.is_delete = 0
AND spp.open_date > 0
AND spp.open_date <![CDATA[<=]]> 1731945600
AND spp.lowest_price
<![CDATA[<=]]> 40
GROUP BY
vapp.sku
</select>
<select id="listPlanSkuInfo" resultType="cn.kk.spring_simple_operation.model.PlanSkuInfoVO">
SELECT
vapp.sku,
vapp.executor_name planName,
vapp.finish_time,
spa.short_title_ch title,
spa.us_root_type
FROM
visual_a_plus_plan vapp
LEFT JOIN sync_product_audit spa ON spa.sku = vapp.sku
WHERE
vapp.is_delete = 0
AND vapp.`status` = 2
AND vapp.sku in
<foreach item="sku" collection="skuList" open="(" separator="," close=")">
#{sku}
</foreach>
</select>
......
......@@ -184,6 +184,21 @@
AND spa.sku > ''
AND (spa.sku = #{sku} or spa.comb_parent_sku = #{sku})
</select>
<select id="planSkuForPublishSales" resultType="cn.kk.spring_simple_operation.model.SkuVideoVO">
SELECT
spa.sku,
spp.thirty_day_sales
FROM
sync_product_audit spa
LEFT JOIN sync_product_publish spp ON spp.sku = spa.sku
WHERE
spp.open_date > 0
AND spp.is_delete = 0
AND spp.solar_term = 1
AND spp.open_date <![CDATA[<=]]> 1731945600
AND spp.lowest_price <![CDATA[<=]]> 40
AND (spa.sku = #{sku} or spa.comb_parent_sku = #{sku})
</select>
</mapper>
<?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.VisualCommunicationDesignSecondMapper">
</mapper>
......@@ -23,7 +23,7 @@ public class ExportPhotographerTest {
void contextLoads() {
List<ExportPhotographerNameVO> list = syncProductAuditMapper.selectIsCustomProdduct();
ExcelUtil<ExportPhotographerNameVO> util = new ExcelUtil<>(ExportPhotographerNameVO.class);
util.exportExcelFile(list, "有样品但是未到样的任务");
util.exportExcelFile(list, "有样品但是未到样&未上传的任务");
}
@Test
......
package cn.kk.spring_simple_operation;
import cn.kk.spring_simple_operation.mapper.SyncProductAuditMapper;
import cn.kk.spring_simple_operation.mapper.SyncProductPublishMapper;
import cn.kk.spring_simple_operation.mapper.VideoProductMapper;
import cn.kk.spring_simple_operation.model.PlanSkuInfoVO;
import cn.kk.spring_simple_operation.model.SkuVideoVO;
import cn.kk.spring_simple_operation.utils.ExcelUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@SpringBootTest
class SimpleAPlusTaskExport {
@Resource
private SyncProductPublishMapper syncProductPublishMapper;
@Resource
private VideoProductMapper videoProductMapper;
@Resource
private SyncProductAuditMapper syncProductAuditMapper;
@Test
void contextLoads() {
}
@Test
void groupSkuSolarTerm_1() {
List<String> motherList = syncProductAuditMapper.planSkuForPublish();
List<String> skuList = new LinkedList<>();
AtomicInteger count = new AtomicInteger(0);
motherList.forEach(sku -> {
if (StringUtils.isEmpty(sku)) {
return;
}
List<SkuVideoVO> skuVideoVOS = syncProductPublishMapper.planSkuForPublishSales(sku);
if (CollectionUtils.isEmpty(skuVideoVOS)) {
return;
}
Integer sum = skuVideoVOS.stream().map(SkuVideoVO::getThirtyDaySales).reduce(Integer::sum).orElse(0);
if (sum >= 100 && sum <= 200) {
//System.out.println(count.incrementAndGet() + "---" + sku + " 销量在100-200之间: " + sum);
skuList.add(sku);
}
});
if (!CollectionUtils.isEmpty(skuList)) {
String originName = "简版A+";
List<PlanSkuInfoVO> list = syncProductAuditMapper.listPlanSkuInfo(skuList);
ExcelUtil<PlanSkuInfoVO> util = new ExcelUtil<>(PlanSkuInfoVO.class);
util.exportExcelFile(list, originName);
}
}
}
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