Commit 7082e47f by yinyong

skums产品库数据:产品标签

parent b5920fa0
package com.bailuntec.domain.pojo;
import lombok.Data;
@Data
public class GmtProductTag {
private String tagCode;
private String tagValuesName;
private String tagValuesCode;
}
......@@ -440,4 +440,7 @@ public class SkuInfo {
private Integer productType;
private String productTypeDesc;
@JSONField(name = "productTags")
private List<GmtProductTag> tags;
}
......@@ -3,17 +3,16 @@ package com.bailuntec.job;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bailuntec.domain.entity.DcBaseSku;
import com.bailuntec.domain.entity.DcBaseSkuTag;
import com.bailuntec.domain.entity.DcBaseSkuWarehouse;
import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.domain.example.DcBaseSkuExample;
import com.bailuntec.domain.example.DcBaseSkuWarehouseExample;
import com.bailuntec.domain.pojo.SkuInfo;
import com.bailuntec.domain.pojo.SkuMsResponse;
import com.bailuntec.domain.pojo.SkuMsResult;
import com.bailuntec.domain.pojo.WarehouseInfo;
import com.bailuntec.domain.pojo.*;
import com.bailuntec.domain.request.SkuCondition;
import com.bailuntec.domain.request.SkumsRequest;
import com.bailuntec.mapper.DcBaseSkuMapper;
import com.bailuntec.mapper.DcBaseSkuTagMapper;
import com.bailuntec.mapper.DcBaseSkuWarehouseMapper;
import com.bailuntec.mapper.JobPointLogMapper;
import com.bailuntec.support.PointJob;
......@@ -38,7 +37,8 @@ public class SkuMSSyncJob extends PointJob {
@Override
public void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog) {
SkumsRequest skumsRequest = new SkumsRequest();
skumsRequest.setConditionJson(JSON.toJSONString(new SkuCondition(jobPointLog.getStartTime().minusMinutes(3), jobPointLog.getEndTime())));
// skumsRequest.setConditionJson(JSON.toJSONString(new SkuCondition(jobPointLog.getStartTime().minusMinutes(3), jobPointLog.getEndTime())));
skumsRequest.setSearchKeyWord("946357605");
skumsRequest.setPageNumber(jobPointLog.getPageSize());
do {
MediaType mediaType = MediaType.parse("application/json");
......@@ -91,9 +91,11 @@ public class SkuMSSyncJob extends PointJob {
private void handleSkuMsJson(List<SkuInfo> data,JobPointLog jobPointLog) {
DcBaseSku dcBaseSku = new DcBaseSku();
DcBaseSkuWarehouse dcBaseSkuWarehouse = new DcBaseSkuWarehouse();
DcBaseSkuTag dcBaseSkuTag = new DcBaseSkuTag();
try {
DcBaseSkuMapper mapper = SessionUtil.getSession().getMapper(DcBaseSkuMapper.class);
DcBaseSkuWarehouseMapper dcBaseSkuWarehouseMapper = SessionUtil.getSession().getMapper(DcBaseSkuWarehouseMapper.class);
DcBaseSkuTagMapper dcBaseSkuTagMapper = SessionUtil.getSession().getMapper(DcBaseSkuTagMapper.class);
for (SkuInfo skuInfo : data) {
if (StringUtils.isNotBlank(skuInfo.getBailunSku())) {
//逻辑删除仓库
......@@ -121,6 +123,14 @@ public class SkuMSSyncJob extends PointJob {
}
}
}
dcBaseSkuTag.setBailuinSku(skuInfo.getBailunSku());
for(GmtProductTag gmtProductTag : skuInfo.getTags()) {
dcBaseSkuTag.setTagCode(gmtProductTag.getTagCode() == null ? "" : gmtProductTag.getTagCode());
dcBaseSkuTag.setTagValuesCode(gmtProductTag.getTagValuesCode() == null ? "" : gmtProductTag.getTagValuesCode());
dcBaseSkuTag.setTagValuesName(gmtProductTag.getTagValuesName() == null ? "" : gmtProductTag.getTagValuesName());
dcBaseSkuTagMapper.upsertSelective(dcBaseSkuTag);
}
if(skuInfo.getTags() != null) dcBaseSku.setTags(JSONObject.toJSONString(skuInfo.getTags()));
dcBaseSku.setGmtModified(LocalDateTime.now());
if(dcBaseSku.getPushTime().isBefore(LocalDateTime.of(1991, 01, 01, 00, 00, 00))) {
dcBaseSku.setPushTime(LocalDateTime.of(1991, 01, 01, 00, 00, 00));
......
......@@ -656,6 +656,15 @@ public class DcBaseSku {
private String productTypeDesc;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_sku.tags
*
* @mbg.generated
*/
private String tags;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku
*
......@@ -739,6 +748,7 @@ public class DcBaseSku {
sb.append(", brand=").append(brand);
sb.append(", productType=").append(productType);
sb.append(", productTypeDesc=").append(productTypeDesc);
sb.append(", tags=").append(tags);
sb.append("]");
return sb.toString();
}
......@@ -832,7 +842,8 @@ public class DcBaseSku {
&& (this.getCategorySimpleName() == null ? other.getCategorySimpleName() == null : this.getCategorySimpleName().equals(other.getCategorySimpleName()))
&& (this.getBrand() == null ? other.getBrand() == null : this.getBrand().equals(other.getBrand()))
&& (this.getProductType() == null ? other.getProductType() == null : this.getProductType().equals(other.getProductType()))
&& (this.getProductTypeDesc() == null ? other.getProductTypeDesc() == null : this.getProductTypeDesc().equals(other.getProductTypeDesc()));
&& (this.getProductTypeDesc() == null ? other.getProductTypeDesc() == null : this.getProductTypeDesc().equals(other.getProductTypeDesc()))
&& (this.getTags() == null ? other.getTags() == null : this.getTags().equals(other.getTags()));
}
/**
......@@ -917,6 +928,7 @@ public class DcBaseSku {
result = prime * result + ((getBrand() == null) ? 0 : getBrand().hashCode());
result = prime * result + ((getProductType() == null) ? 0 : getProductType().hashCode());
result = prime * result + ((getProductTypeDesc() == null) ? 0 : getProductTypeDesc().hashCode());
result = prime * result + ((getTags() == null) ? 0 : getTags().hashCode());
return result;
}
}
\ No newline at end of file
package com.bailuntec.domain.entity;
import lombok.Data;
@Data
public class DcBaseSkuTag {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_sku_tag.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_sku_tag.bailuin_sku
*
* @mbg.generated
*/
private String bailuinSku;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_sku_tag.tag_code
*
* @mbg.generated
*/
private String tagCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_sku_tag.tag_values_code
*
* @mbg.generated
*/
private String tagValuesCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_sku_tag.tag_values_name
*
* @mbg.generated
*/
private String tagValuesName;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", bailuinSku=").append(bailuinSku);
sb.append(", tagCode=").append(tagCode);
sb.append(", tagValuesCode=").append(tagValuesCode);
sb.append(", tagValuesName=").append(tagValuesName);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
DcBaseSkuTag other = (DcBaseSkuTag) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getBailuinSku() == null ? other.getBailuinSku() == null : this.getBailuinSku().equals(other.getBailuinSku()))
&& (this.getTagCode() == null ? other.getTagCode() == null : this.getTagCode().equals(other.getTagCode()))
&& (this.getTagValuesCode() == null ? other.getTagValuesCode() == null : this.getTagValuesCode().equals(other.getTagValuesCode()))
&& (this.getTagValuesName() == null ? other.getTagValuesName() == null : this.getTagValuesName().equals(other.getTagValuesName()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getBailuinSku() == null) ? 0 : getBailuinSku().hashCode());
result = prime * result + ((getTagCode() == null) ? 0 : getTagCode().hashCode());
result = prime * result + ((getTagValuesCode() == null) ? 0 : getTagValuesCode().hashCode());
result = prime * result + ((getTagValuesName() == null) ? 0 : getTagValuesName().hashCode());
return result;
}
}
\ No newline at end of file
......@@ -5040,6 +5040,76 @@ public class DcBaseSkuExample {
addCriterion("product_type_desc not between", value1, value2, "productTypeDesc");
return (Criteria) this;
}
public Criteria andTagsIsNull() {
addCriterion("tags is null");
return (Criteria) this;
}
public Criteria andTagsIsNotNull() {
addCriterion("tags is not null");
return (Criteria) this;
}
public Criteria andTagsEqualTo(String value) {
addCriterion("tags =", value, "tags");
return (Criteria) this;
}
public Criteria andTagsNotEqualTo(String value) {
addCriterion("tags <>", value, "tags");
return (Criteria) this;
}
public Criteria andTagsGreaterThan(String value) {
addCriterion("tags >", value, "tags");
return (Criteria) this;
}
public Criteria andTagsGreaterThanOrEqualTo(String value) {
addCriterion("tags >=", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLessThan(String value) {
addCriterion("tags <", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLessThanOrEqualTo(String value) {
addCriterion("tags <=", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLike(String value) {
addCriterion("tags like", value, "tags");
return (Criteria) this;
}
public Criteria andTagsNotLike(String value) {
addCriterion("tags not like", value, "tags");
return (Criteria) this;
}
public Criteria andTagsIn(List<String> values) {
addCriterion("tags in", values, "tags");
return (Criteria) this;
}
public Criteria andTagsNotIn(List<String> values) {
addCriterion("tags not in", values, "tags");
return (Criteria) this;
}
public Criteria andTagsBetween(String value1, String value2) {
addCriterion("tags between", value1, value2, "tags");
return (Criteria) this;
}
public Criteria andTagsNotBetween(String value1, String value2) {
addCriterion("tags not between", value1, value2, "tags");
return (Criteria) this;
}
}
/**
......
......@@ -78,6 +78,7 @@
<result column="brand" jdbcType="VARCHAR" property="brand" />
<result column="product_type" jdbcType="INTEGER" property="productType" />
<result column="product_type_desc" jdbcType="VARCHAR" property="productTypeDesc" />
<result column="tags" jdbcType="VARCHAR" property="tags" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -160,7 +161,7 @@
declare_title_cn, pick_title_cn, pick_title_en, product_nature, charger_specifications,
packing_price, packing_name, packing_size, product_size, packing_weight, unit, push_status,
transfer_delivery, source, push_time, has_delete, develop_time, company_id, category_simple_id,
category_simple_name, brand, product_type, product_type_desc
category_simple_name, brand, product_type, product_type_desc, tags
</sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseSkuExample" resultMap="BaseResultMap">
<!--
......@@ -244,8 +245,8 @@
push_status, transfer_delivery, source,
push_time, has_delete, develop_time,
company_id, category_simple_id, category_simple_name,
brand, product_type, product_type_desc
)
brand, product_type, product_type_desc,
tags)
values (#{id,jdbcType=INTEGER}, #{bailunSku,jdbcType=VARCHAR}, #{skuImage,jdbcType=VARCHAR},
#{categoryId,jdbcType=INTEGER}, #{categoryName,jdbcType=VARCHAR}, #{unitPrice,jdbcType=DECIMAL},
#{sellerId,jdbcType=INTEGER}, #{sellerName,jdbcType=VARCHAR}, #{length,jdbcType=DECIMAL},
......@@ -269,8 +270,8 @@
#{pushStatus,jdbcType=TINYINT}, #{transferDelivery,jdbcType=INTEGER}, #{source,jdbcType=TINYINT},
#{pushTime,jdbcType=TIMESTAMP}, #{hasDelete,jdbcType=BIT}, #{developTime,jdbcType=TIMESTAMP},
#{companyId,jdbcType=INTEGER}, #{categorySimpleId,jdbcType=INTEGER}, #{categorySimpleName,jdbcType=VARCHAR},
#{brand,jdbcType=VARCHAR}, #{productType,jdbcType=INTEGER}, #{productTypeDesc,jdbcType=VARCHAR}
)
#{brand,jdbcType=VARCHAR}, #{productType,jdbcType=INTEGER}, #{productTypeDesc,jdbcType=VARCHAR},
#{tags,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseSku">
<!--
......@@ -495,6 +496,9 @@
<if test="productTypeDesc != null">
product_type_desc,
</if>
<if test="tags != null">
tags,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -713,6 +717,9 @@
<if test="productTypeDesc != null">
#{productTypeDesc,jdbcType=VARCHAR},
</if>
<if test="tags != null">
#{tags,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseSkuExample" resultType="java.lang.Long">
......@@ -948,6 +955,9 @@
<if test="record.productTypeDesc != null">
product_type_desc = #{record.productTypeDesc,jdbcType=VARCHAR},
</if>
<if test="record.tags != null">
tags = #{record.tags,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -1030,7 +1040,8 @@
category_simple_name = #{record.categorySimpleName,jdbcType=VARCHAR},
brand = #{record.brand,jdbcType=VARCHAR},
product_type = #{record.productType,jdbcType=INTEGER},
product_type_desc = #{record.productTypeDesc,jdbcType=VARCHAR}
product_type_desc = #{record.productTypeDesc,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -1255,6 +1266,9 @@
<if test="productTypeDesc != null">
product_type_desc = #{productTypeDesc,jdbcType=VARCHAR},
</if>
<if test="tags != null">
tags = #{tags,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
......@@ -1334,7 +1348,8 @@
category_simple_name = #{categorySimpleName,jdbcType=VARCHAR},
brand = #{brand,jdbcType=VARCHAR},
product_type = #{productType,jdbcType=INTEGER},
product_type_desc = #{productTypeDesc,jdbcType=VARCHAR}
product_type_desc = #{productTypeDesc,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcBaseSku">
......@@ -1561,6 +1576,9 @@
<if test="productTypeDesc != null">
product_type_desc,
</if>
<if test="tags != null">
tags,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -1780,6 +1798,9 @@
<if test="productTypeDesc != null">
#{productTypeDesc,jdbcType=VARCHAR},
</if>
<if test="tags != null">
#{tags,jdbcType=VARCHAR},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
......@@ -1999,6 +2020,9 @@
<if test="productTypeDesc != null">
product_type_desc = #{productTypeDesc,jdbcType=VARCHAR},
</if>
<if test="tags != null">
tags = #{tags,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBaseSku">
......@@ -2018,8 +2042,8 @@
declare_title_cn, pick_title_cn, pick_title_en, product_nature, charger_specifications,
packing_price, packing_name, packing_size, product_size, packing_weight, unit,
push_status, transfer_delivery, source, push_time, has_delete, develop_time, company_id,
category_simple_id, category_simple_name, brand, product_type, product_type_desc
)
category_simple_id, category_simple_name, brand, product_type, product_type_desc,
tags)
values
(#{id,jdbcType=INTEGER}, #{bailunSku,jdbcType=VARCHAR}, #{skuImage,jdbcType=VARCHAR},
#{categoryId,jdbcType=INTEGER}, #{categoryName,jdbcType=VARCHAR}, #{unitPrice,jdbcType=DECIMAL},
......@@ -2044,8 +2068,8 @@
#{pushStatus,jdbcType=TINYINT}, #{transferDelivery,jdbcType=INTEGER}, #{source,jdbcType=TINYINT},
#{pushTime,jdbcType=TIMESTAMP}, #{hasDelete,jdbcType=BIT}, #{developTime,jdbcType=TIMESTAMP},
#{companyId,jdbcType=INTEGER}, #{categorySimpleId,jdbcType=INTEGER}, #{categorySimpleName,jdbcType=VARCHAR},
#{brand,jdbcType=VARCHAR}, #{productType,jdbcType=INTEGER}, #{productTypeDesc,jdbcType=VARCHAR}
)
#{brand,jdbcType=VARCHAR}, #{productType,jdbcType=INTEGER}, #{productTypeDesc,jdbcType=VARCHAR},
#{tags,jdbcType=VARCHAR})
on duplicate key update
id = #{id,jdbcType=INTEGER},
bailun_sku = #{bailunSku,jdbcType=VARCHAR},
......@@ -2118,7 +2142,8 @@
category_simple_name = #{categorySimpleName,jdbcType=VARCHAR},
brand = #{brand,jdbcType=VARCHAR},
product_type = #{productType,jdbcType=INTEGER},
product_type_desc = #{productTypeDesc,jdbcType=VARCHAR}
product_type_desc = #{productTypeDesc,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR}
</insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseSkuExample" resultMap="BaseResultMap">
<!--
......
package com.bailuntec.mapper;
import com.bailuntec.domain.entity.DcBaseSkuTag;
import com.bailuntec.domain.example.DcBaseSkuTagExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DcBaseSkuTagMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
long countByExample(DcBaseSkuTagExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
int deleteByExample(DcBaseSkuTagExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
int insert(DcBaseSkuTag record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
int insertSelective(DcBaseSkuTag record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
DcBaseSkuTag selectOneByExample(DcBaseSkuTagExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
List<DcBaseSkuTag> selectByExample(DcBaseSkuTagExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
DcBaseSkuTag selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") DcBaseSkuTag record, @Param("example") DcBaseSkuTagExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
int updateByExample(@Param("record") DcBaseSkuTag record, @Param("example") DcBaseSkuTagExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(DcBaseSkuTag record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
*/
int updateByPrimaryKey(DcBaseSkuTag record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsert(DcBaseSkuTag record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_sku_tag
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsertSelective(DcBaseSkuTag record);
}
\ No newline at end of file
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