Commit 8ffa328e authored by shiyu's avatar shiyu

盲盒专区

parent f6560013
...@@ -11,7 +11,7 @@ import lombok.Data; ...@@ -11,7 +11,7 @@ import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2024/09/11 * @date 2024/11/14
*/ */
@Data @Data
public class DistributionOrder implements Entity { public class DistributionOrder implements Entity {
...@@ -182,6 +182,11 @@ public class DistributionOrder implements Entity { ...@@ -182,6 +182,11 @@ public class DistributionOrder implements Entity {
*/ */
private Boolean isMultiple; private Boolean isMultiple;
/**
* 备注
*/
private String remark;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Override @Override
...@@ -224,6 +229,7 @@ public class DistributionOrder implements Entity { ...@@ -224,6 +229,7 @@ public class DistributionOrder implements Entity {
sb.append(", channelAmount=").append(channelAmount); sb.append(", channelAmount=").append(channelAmount);
sb.append(", channelRebate=").append(channelRebate); sb.append(", channelRebate=").append(channelRebate);
sb.append(", isMultiple=").append(isMultiple); sb.append(", isMultiple=").append(isMultiple);
sb.append(", remark=").append(remark);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
...@@ -274,7 +280,8 @@ public class DistributionOrder implements Entity { ...@@ -274,7 +280,8 @@ public class DistributionOrder implements Entity {
&& (this.getIntroducerId() == null ? other.getIntroducerId() == null : this.getIntroducerId().equals(other.getIntroducerId())) && (this.getIntroducerId() == null ? other.getIntroducerId() == null : this.getIntroducerId().equals(other.getIntroducerId()))
&& (this.getChannelAmount() == null ? other.getChannelAmount() == null : this.getChannelAmount().equals(other.getChannelAmount())) && (this.getChannelAmount() == null ? other.getChannelAmount() == null : this.getChannelAmount().equals(other.getChannelAmount()))
&& (this.getChannelRebate() == null ? other.getChannelRebate() == null : this.getChannelRebate().equals(other.getChannelRebate())) && (this.getChannelRebate() == null ? other.getChannelRebate() == null : this.getChannelRebate().equals(other.getChannelRebate()))
&& (this.getIsMultiple() == null ? other.getIsMultiple() == null : this.getIsMultiple().equals(other.getIsMultiple())); && (this.getIsMultiple() == null ? other.getIsMultiple() == null : this.getIsMultiple().equals(other.getIsMultiple()))
&& (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()));
} }
@Override @Override
...@@ -315,6 +322,7 @@ public class DistributionOrder implements Entity { ...@@ -315,6 +322,7 @@ public class DistributionOrder implements Entity {
result = prime * result + ((getChannelAmount() == null) ? 0 : getChannelAmount().hashCode()); result = prime * result + ((getChannelAmount() == null) ? 0 : getChannelAmount().hashCode());
result = prime * result + ((getChannelRebate() == null) ? 0 : getChannelRebate().hashCode()); result = prime * result + ((getChannelRebate() == null) ? 0 : getChannelRebate().hashCode());
result = prime * result + ((getIsMultiple() == null) ? 0 : getIsMultiple().hashCode()); result = prime * result + ((getIsMultiple() == null) ? 0 : getIsMultiple().hashCode());
result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
return result; return result;
} }
...@@ -359,7 +367,8 @@ public class DistributionOrder implements Entity { ...@@ -359,7 +367,8 @@ public class DistributionOrder implements Entity {
introducerId("introducer_id", "introducerId", "BIGINT", false), introducerId("introducer_id", "introducerId", "BIGINT", false),
channelAmount("channel_amount", "channelAmount", "BIGINT", false), channelAmount("channel_amount", "channelAmount", "BIGINT", false),
channelRebate("channel_rebate", "channelRebate", "DECIMAL", false), channelRebate("channel_rebate", "channelRebate", "DECIMAL", false),
isMultiple("is_multiple", "isMultiple", "BIT", false); isMultiple("is_multiple", "isMultiple", "BIT", false),
remark("remark", "remark", "VARCHAR", false);
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
......
...@@ -4736,6 +4736,148 @@ public class DistributionOrderExample { ...@@ -4736,6 +4736,148 @@ public class DistributionOrderExample {
addCriterion("is_multiple not between", value1, value2, "isMultiple"); addCriterion("is_multiple not between", value1, value2, "isMultiple");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemarkEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("remark = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemarkNotEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("remark <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemarkGreaterThanColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("remark > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemarkGreaterThanOrEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("remark >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemarkLessThanColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("remark < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemarkLessThanOrEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("remark <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
...@@ -145,6 +145,11 @@ public class DistributionOrderRequestDto extends BaseRequestDto implements Entit ...@@ -145,6 +145,11 @@ public class DistributionOrderRequestDto extends BaseRequestDto implements Entit
*/ */
private List<Integer> filterStateList; private List<Integer> filterStateList;
/**
* 盲袋订单,存放盲袋编码,多个用逗号分割
*/
private String remark;
/** /**
* 微信支付订单号 * 微信支付订单号
*/ */
......
...@@ -4,7 +4,6 @@ import com.wwdz.ch.db.bean.DistributionOrderNum; ...@@ -4,7 +4,6 @@ import com.wwdz.ch.db.bean.DistributionOrderNum;
import com.wwdz.ch.db.domain.distribution.DistributionOrder; import com.wwdz.ch.db.domain.distribution.DistributionOrder;
import com.wwdz.ch.db.domain.distribution.DistributionOrderExample; import com.wwdz.ch.db.domain.distribution.DistributionOrderExample;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<result column="channel_amount" jdbcType="BIGINT" property="channelAmount" /> <result column="channel_amount" jdbcType="BIGINT" property="channelAmount" />
<result column="channel_rebate" jdbcType="DECIMAL" property="channelRebate" /> <result column="channel_rebate" jdbcType="DECIMAL" property="channelRebate" />
<result column="is_multiple" jdbcType="BIT" property="isMultiple" /> <result column="is_multiple" jdbcType="BIT" property="isMultiple" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -101,7 +102,7 @@ ...@@ -101,7 +102,7 @@
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time, receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
signed_time, finish_time, update_time, share_record_id, `state`, logistics_state, signed_time, finish_time, update_time, share_record_id, `state`, logistics_state,
`type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount, `type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount,
channel_rebate, is_multiple channel_rebate, is_multiple, remark
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultMap="BaseResultMap">
select select
...@@ -141,7 +142,7 @@ ...@@ -141,7 +142,7 @@
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time, receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
signed_time, finish_time, update_time, share_record_id, `state`, logistics_state, signed_time, finish_time, update_time, share_record_id, `state`, logistics_state,
`type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount, `type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount,
channel_rebate, is_multiple channel_rebate, is_multiple, remark
</otherwise> </otherwise>
</choose> </choose>
from distribution_order from distribution_order
...@@ -177,7 +178,7 @@ ...@@ -177,7 +178,7 @@
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time, receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
signed_time, finish_time, update_time, share_record_id, `state`, logistics_state, signed_time, finish_time, update_time, share_record_id, `state`, logistics_state,
`type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount, `type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount,
channel_rebate, is_multiple channel_rebate, is_multiple, remark
</otherwise> </otherwise>
</choose> </choose>
from distribution_order from distribution_order
...@@ -207,8 +208,8 @@ ...@@ -207,8 +208,8 @@
update_time, share_record_id, `state`, update_time, share_record_id, `state`,
logistics_state, `type`, supply_price, logistics_state, `type`, supply_price,
introduce_amount, introduce_rebate, introducer_id, introduce_amount, introduce_rebate, introducer_id,
channel_amount, channel_rebate, is_multiple channel_amount, channel_rebate, is_multiple,
) remark)
values (#{distributionOrderId,jdbcType=VARCHAR}, #{prepayId,jdbcType=VARCHAR}, #{transactionId,jdbcType=VARCHAR}, values (#{distributionOrderId,jdbcType=VARCHAR}, #{prepayId,jdbcType=VARCHAR}, #{transactionId,jdbcType=VARCHAR},
#{itemId,jdbcType=BIGINT}, #{itemNum,jdbcType=INTEGER}, #{buyerId,jdbcType=BIGINT}, #{itemId,jdbcType=BIGINT}, #{itemNum,jdbcType=INTEGER}, #{buyerId,jdbcType=BIGINT},
#{buyerOpenid,jdbcType=VARCHAR}, #{shopId,jdbcType=BIGINT}, #{sellerId,jdbcType=BIGINT}, #{buyerOpenid,jdbcType=VARCHAR}, #{shopId,jdbcType=BIGINT}, #{sellerId,jdbcType=BIGINT},
...@@ -219,8 +220,8 @@ ...@@ -219,8 +220,8 @@
#{updateTime,jdbcType=TIMESTAMP}, #{shareRecordId,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{shareRecordId,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER},
#{logisticsState,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{supplyPrice,jdbcType=BIGINT}, #{logisticsState,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{supplyPrice,jdbcType=BIGINT},
#{introduceAmount,jdbcType=BIGINT}, #{introduceRebate,jdbcType=DECIMAL}, #{introducerId,jdbcType=BIGINT}, #{introduceAmount,jdbcType=BIGINT}, #{introduceRebate,jdbcType=DECIMAL}, #{introducerId,jdbcType=BIGINT},
#{channelAmount,jdbcType=BIGINT}, #{channelRebate,jdbcType=DECIMAL}, #{isMultiple,jdbcType=BIT} #{channelAmount,jdbcType=BIGINT}, #{channelRebate,jdbcType=DECIMAL}, #{isMultiple,jdbcType=BIT},
) #{remark,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrder"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrder">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
...@@ -327,6 +328,9 @@ ...@@ -327,6 +328,9 @@
<if test="isMultiple != null"> <if test="isMultiple != null">
is_multiple, is_multiple,
</if> </if>
<if test="remark != null">
remark,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="distributionOrderId != null"> <if test="distributionOrderId != null">
...@@ -428,6 +432,9 @@ ...@@ -428,6 +432,9 @@
<if test="isMultiple != null"> <if test="isMultiple != null">
#{isMultiple,jdbcType=BIT}, #{isMultiple,jdbcType=BIT},
</if> </if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultType="java.lang.Long">
...@@ -541,6 +548,9 @@ ...@@ -541,6 +548,9 @@
<if test="record.isMultiple != null"> <if test="record.isMultiple != null">
is_multiple = #{record.isMultiple,jdbcType=BIT}, is_multiple = #{record.isMultiple,jdbcType=BIT},
</if> </if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -581,7 +591,8 @@ ...@@ -581,7 +591,8 @@
introducer_id = #{record.introducerId,jdbcType=BIGINT}, introducer_id = #{record.introducerId,jdbcType=BIGINT},
channel_amount = #{record.channelAmount,jdbcType=BIGINT}, channel_amount = #{record.channelAmount,jdbcType=BIGINT},
channel_rebate = #{record.channelRebate,jdbcType=DECIMAL}, channel_rebate = #{record.channelRebate,jdbcType=DECIMAL},
is_multiple = #{record.isMultiple,jdbcType=BIT} is_multiple = #{record.isMultiple,jdbcType=BIT},
remark = #{record.remark,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -688,6 +699,9 @@ ...@@ -688,6 +699,9 @@
<if test="isMultiple != null"> <if test="isMultiple != null">
is_multiple = #{isMultiple,jdbcType=BIT}, is_multiple = #{isMultiple,jdbcType=BIT},
</if> </if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -725,7 +739,8 @@ ...@@ -725,7 +739,8 @@
introducer_id = #{introducerId,jdbcType=BIGINT}, introducer_id = #{introducerId,jdbcType=BIGINT},
channel_amount = #{channelAmount,jdbcType=BIGINT}, channel_amount = #{channelAmount,jdbcType=BIGINT},
channel_rebate = #{channelRebate,jdbcType=DECIMAL}, channel_rebate = #{channelRebate,jdbcType=DECIMAL},
is_multiple = #{isMultiple,jdbcType=BIT} is_multiple = #{isMultiple,jdbcType=BIT},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultMap="BaseResultMap">
...@@ -766,7 +781,7 @@ ...@@ -766,7 +781,7 @@
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time, receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
signed_time, finish_time, update_time, share_record_id, `state`, logistics_state, signed_time, finish_time, update_time, share_record_id, `state`, logistics_state,
`type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount, `type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount,
channel_rebate, is_multiple channel_rebate, is_multiple, remark
</otherwise> </otherwise>
</choose> </choose>
from distribution_order from distribution_order
...@@ -778,6 +793,7 @@ ...@@ -778,6 +793,7 @@
</if> </if>
limit 1 limit 1
</select> </select>
<select id="countGroupByStateForDistributor" parameterType="java.lang.Long" resultType="com.wwdz.ch.db.bean.DistributionOrderNum"> <select id="countGroupByStateForDistributor" parameterType="java.lang.Long" resultType="com.wwdz.ch.db.bean.DistributionOrderNum">
select state, count(distribution_order_id) as num from distribution_order where seller_id = #{sellerId} and type != 7 group by state select state, count(distribution_order_id) as num from distribution_order where seller_id = #{sellerId} and type != 7 group by state
</select> </select>
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution" <javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/> targetProject="ch-dao/src/main/java"/>
<table tableName="item_sku" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"> <table tableName="distribution_order" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" /> <generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table> </table>
......
package com.wwdz.ch.wx.entity.vo.distribution;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class BlindBoxBuyRecordVo implements Entity {
/**
* 用户id
*/
private Long userId;
/**
* 用户名称
*/
private String userName;
/**
* 用户头像
*/
private String avatar;
/**
* 购买时间
*/
private Date payTime;
/**
* 购买的盲袋编号,顿号分割
*/
private String boxCodes;
}
...@@ -2,10 +2,56 @@ package com.wwdz.ch.wx.entity.vo.distribution; ...@@ -2,10 +2,56 @@ package com.wwdz.ch.wx.entity.vo.distribution;
import com.xxdxxs.entity.Entity; import com.xxdxxs.entity.Entity;
import lombok.Data; import lombok.Data;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Data @Data
public class BlindBoxDetailVo implements Entity { public class BlindBoxDetailVo implements Entity {
/**
* 名称
*/
private String name;
/**
* 价格
*/
private String price;
/**
* 盲盒中sku信息
*/
List<ItemSkuVo> itemSkuVoList;
/**
* 福袋视频
*/
private List<String> videos;
/**
* 福袋图片
*/
private List<String> images;
/**
* 盲盒总sku数量
*/
private Long totalNum;
/**
* 剩下sku数量
*/
private Long remainNum;
/**
* 盲盒对应编号是否售卖出去
*/
private List<Map<String, Object>> isSelledRecords;
/**
* 盲袋购买记录
*/
private List<BlindBoxBuyRecordVo> buyRecordList;
} }
package com.wwdz.ch.wx.entity.vo.distribution;
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class ItemSkuVo implements Entity {
/**
* sku编码
*/
private String skuCode;
/**
* 名称
*/
private String name;
/**
* 默认图
*/
private String defaultImage;
/**
* 价格,单位元
*/
private String price;
}
package com.wwdz.ch.wx.impl.distribution; package com.wwdz.ch.wx.impl.distribution;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.consts.DistributionEnum; import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.CacheUtil; import com.wwdz.ch.core.util.CacheUtil;
...@@ -15,9 +16,9 @@ import com.wwdz.ch.db.domain.distribution.ItemSku; ...@@ -15,9 +16,9 @@ import com.wwdz.ch.db.domain.distribution.ItemSku;
import com.wwdz.ch.db.domain.distribution.SupplierItem; import com.wwdz.ch.db.domain.distribution.SupplierItem;
import com.wwdz.ch.db.dto.request.distribution.ItemSkuRequestDto; import com.wwdz.ch.db.dto.request.distribution.ItemSkuRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto; import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.wwdz.ch.wx.entity.vo.distribution.BlindBoxInfoVo; import com.wwdz.ch.wx.entity.vo.distribution.*;
import com.wwdz.ch.wx.entity.vo.distribution.BlindBoxVo;
import com.wwdz.ch.wx.service.distribution.BlindBoxService; import com.wwdz.ch.wx.service.distribution.BlindBoxService;
import com.xxdxxs.utils.EntityMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -25,9 +26,7 @@ import org.springframework.stereotype.Service; ...@@ -25,9 +26,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
@Service @Service
public class BlindBoxServiceImpl implements BlindBoxService { public class BlindBoxServiceImpl implements BlindBoxService {
...@@ -103,7 +102,7 @@ public class BlindBoxServiceImpl implements BlindBoxService { ...@@ -103,7 +102,7 @@ public class BlindBoxServiceImpl implements BlindBoxService {
blindBoxInfoVo.setPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice())); blindBoxInfoVo.setPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
blindBoxInfoVo.setTotalNum(pageInfo.getTotal()); blindBoxInfoVo.setTotalNum(pageInfo.getTotal());
blindBoxInfoVo.setRemainNum(supplierItem.getStock().longValue()); blindBoxInfoVo.setRemainNum(supplierItem.getStock().longValue());
//查询最近的购买记录 //查询购买记录
List<DistributionOrder> distributionOrderList = distributionOrderDao.findBuyRecordByItemId(itemId); List<DistributionOrder> distributionOrderList = distributionOrderDao.findBuyRecordByItemId(itemId);
if (!CollectionUtils.isEmpty(distributionOrderList)) { if (!CollectionUtils.isEmpty(distributionOrderList)) {
DistributionOrder lastedRecord = distributionOrderList.get(0); DistributionOrder lastedRecord = distributionOrderList.get(0);
...@@ -136,27 +135,78 @@ public class BlindBoxServiceImpl implements BlindBoxService { ...@@ -136,27 +135,78 @@ public class BlindBoxServiceImpl implements BlindBoxService {
@Override @Override
public Result findDetail(SupplierItemRequestDto dto) { public Result findDetail(SupplierItemRequestDto dto) {
try { try {
List<List<String>> itemList = new ArrayList<>(); long itemId = dto.getId();
dto.setType(DistributionEnum.DistributionTypeEnum.BLACK_COLLECTION.getCode()); BlindBoxDetailVo blindBoxDetailVo = new BlindBoxDetailVo();
dto.setStock(0); SupplierItem supplierItem = supplierItemDao.findById(dto.getItemId());
dto.setIsDeleted(false);
List<SupplierItem> supplierItemList = supplierItemDao.findList(dto);
for (SupplierItem supplierItem : supplierItemList) {
long itemId = supplierItem.getId();
ItemSkuRequestDto itemSkuRequestDto = new ItemSkuRequestDto(); ItemSkuRequestDto itemSkuRequestDto = new ItemSkuRequestDto();
itemSkuRequestDto.setItemId(itemId); itemSkuRequestDto.setItemId(itemId);
itemSkuRequestDto.setLimit(5); itemSkuRequestDto.setLimit(500);
List<ItemSku> itemSkuList = itemSkuDao.findByPage(itemSkuRequestDto); List<ItemSku> itemSkuList = itemSkuDao.findByPage(itemSkuRequestDto);
List<String> imageList = new ArrayList<>(); PageInfo pageInfo = new PageInfo<>(itemSkuList);
List<ItemSkuVo> itemSkuVoList = new ArrayList<>();
for (ItemSku itemSku : itemSkuList) { for (ItemSku itemSku : itemSkuList) {
imageList.add(itemSku.getDefaultImage()); ItemSkuVo itemSkuVo = new ItemSkuVo();
EntityMapper.copyAttribute(itemSku, itemSkuVo);
itemSkuVo.setPrice(PriceUtil.convertPriceFenToYuan(itemSku.getPrice()));
itemSkuVoList.add(itemSkuVo);
} }
itemList.add(imageList); blindBoxDetailVo.setItemSkuVoList(itemSkuVoList);
if (StringUtils.hasLength(supplierItem.getImages())) {
blindBoxDetailVo.setImages(Arrays.asList(supplierItem.getImages().split(";")));
} }
BlindBoxVo blindBoxVo = new BlindBoxVo(); if (StringUtils.hasLength(supplierItem.getVideos())) {
blindBoxVo.setSellActivity("全场限时立减五元"); blindBoxDetailVo.setVideos(Arrays.asList(supplierItem.getVideos().split(";")));
blindBoxVo.setItemList(itemList); }
return Result.success(blindBoxVo); blindBoxDetailVo.setName(supplierItem.getName());
blindBoxDetailVo.setPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
blindBoxDetailVo.setTotalNum(pageInfo.getTotal());
blindBoxDetailVo.setRemainNum(supplierItem.getStock().longValue());
//查询购买记录
//盲袋的编码
List<String> codes = new ArrayList<>();
List<BlindBoxBuyRecordVo> blindBoxBuyRecordVoList = new ArrayList<>();
List<DistributionOrder> distributionOrderList = distributionOrderDao.findBuyRecordByItemId(itemId);
for (DistributionOrder distributionOrder : distributionOrderList) {
BlindBoxBuyRecordVo blindBoxBuyRecordVo = new BlindBoxBuyRecordVo();
blindBoxBuyRecordVo.setUserId(distributionOrder.getBuyerId());
User user = cacheUtil.appletUserInfoCache.get(distributionOrder.getBuyerId()).get();
blindBoxBuyRecordVo.setUserName(StringUtils.hasLength(user.getNickname()) ? user.getNickname() : "微信用户");
blindBoxBuyRecordVo.setAvatar(StringUtils.hasLength(user.getAvatar()) ? user.getAvatar() : CommConsts.DEFAULT_AVATAR);
blindBoxBuyRecordVo.setPayTime(distributionOrder.getPayTime());
//购买记录中,盲袋的编号
String remark = distributionOrder.getRemark();
StringBuffer stringBuffer = new StringBuffer();
if (StringUtils.hasLength(remark)) {
for (String code : remark.split(",")) {
stringBuffer.append(code + "号福袋");
stringBuffer.append("、");
codes.add(code);
}
}
if (stringBuffer.length() > 0) {
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
}
blindBoxBuyRecordVo.setBoxCodes(stringBuffer.toString());
blindBoxBuyRecordVoList.add(blindBoxBuyRecordVo);
}
blindBoxDetailVo.setBuyRecordList(blindBoxBuyRecordVoList);
//盲袋对应编码是否被购买
List<Map<String, Object>> codeList = new ArrayList<>();
for (int i = 1; i <= pageInfo.getTotal(); i++) {
HashMap<String, Object> codeMap = new HashMap<>();
codeMap.put("code", i);
codeMap.put("flag", false);
if (codes.contains(String.valueOf(i))) {
codeMap.put("flag", true);
}
codeList.add(codeMap);
}
blindBoxDetailVo.setIsSelledRecords(codeList);
return Result.success();
} catch (Exception e) { } catch (Exception e) {
logger.error("查询盲袋商品列表 error : {}", e); logger.error("查询盲袋商品列表 error : {}", e);
} }
......
...@@ -213,7 +213,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -213,7 +213,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrder.setReceiverPhone(dto.getReceiverPhone()); distributionOrder.setReceiverPhone(dto.getReceiverPhone());
distributionOrder.setCreateTime(new Date()); distributionOrder.setCreateTime(new Date());
distributionOrder.setUpdateTime(new Date()); distributionOrder.setUpdateTime(new Date());
distributionOrder.setType(DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode()); distributionOrder.setType(dto.getType() == null ? DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode() : dto.getType());
distributionOrder.setRemark(dto.getRemark());
distributionOrder.setState(DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode()); distributionOrder.setState(DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode());
distributionOrderDao.insert(distributionOrder); distributionOrderDao.insert(distributionOrder);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
...@@ -477,7 +478,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -477,7 +478,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrder.setReceiverPhone(dto.getReceiverPhone()); distributionOrder.setReceiverPhone(dto.getReceiverPhone());
distributionOrder.setCreateTime(new Date()); distributionOrder.setCreateTime(new Date());
distributionOrder.setUpdateTime(new Date()); distributionOrder.setUpdateTime(new Date());
distributionOrder.setType(DistributionEnum.DistributionTypeEnum.COLLECT.getCode()); distributionOrder.setType(dto.getType() == null ? DistributionEnum.DistributionTypeEnum.COLLECT.getCode() : dto.getType());
distributionOrder.setRemark(dto.getRemark());
distributionOrder.setState(DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode()); distributionOrder.setState(DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode());
distributionOrderDao.insert(distributionOrder); distributionOrderDao.insert(distributionOrder);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
......
...@@ -89,12 +89,12 @@ public class WxPayServiceTest { ...@@ -89,12 +89,12 @@ public class WxPayServiceTest {
@Test @Test
public void refund() { public void refund() {
List<String> list = Arrays.asList("DA2411091934133307007"); List<String> list = Arrays.asList("DA2411061130292824378", "DA2411050940309904308", "DA2411040955234251934");
list.forEach(orderId ->{ list.forEach(orderId ->{
DistributionOrderRequestDto dto = new DistributionOrderRequestDto(); DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setDistributionOrderId(orderId); dto.setDistributionOrderId(orderId);
dto.setAmount("20"); dto.setAmount("1");
dto.setRefundPrice("20"); dto.setRefundPrice("1");
Result result = wxPayServiceApi.refund(dto); Result result = wxPayServiceApi.refund(dto);
logger.info("申请微信支付退款:{}", result); logger.info("申请微信支付退款:{}", result);
}); });
......
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