Authored by caoyan

二手

... ... @@ -7,6 +7,8 @@ public class SecondhandImages {
private Integer type;
private Integer code;
private String isDefault;
private String imageUrl;
... ... @@ -35,6 +37,14 @@ public class SecondhandImages {
this.type = type;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getIsDefault() {
return isDefault;
}
... ...
... ... @@ -5,21 +5,22 @@
<id column="id" jdbcType="INTEGER" property="id" />
<result column="skup" jdbcType="INTEGER" property="skup" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="code" jdbcType="INTEGER" property="code" />
<result column="is_default" jdbcType="CHAR" property="isDefault" />
<result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
</resultMap>
<insert id="insertBatch">
insert into secondhand_images (skup, type, is_default, image_url)
insert into secondhand_images (skup, type, code, is_default, image_url)
values
<foreach collection="records" item="item" separator=",">
(#{item.skup,jdbcType=INTEGER}, #{item.type,jdbcType=INTEGER},
(#{item.skup,jdbcType=INTEGER}, #{item.type,jdbcType=INTEGER}, #{item.code,jdbcType=INTEGER},
#{item.isDefault,jdbcType=CHAR}, #{item.imageUrl,jdbcType=VARCHAR})
</foreach>
</insert>
<select id="selectBySkup" resultMap="BaseResultMap">
select id, skup, type, is_default, image_url
select id, skup, type, code, is_default, image_url
from secondhand_images where skup = #{skup,jdbcType=INTEGER};
</select>
</mapper>
\ No newline at end of file
... ...
package com.yohoufo.order.service.impl;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohobuy.ufo.model.request.product.SecondhandImagesBo;
import com.yohobuy.ufo.model.request.product.SecondhandInfoReqBo;
import com.yohobuy.ufo.model.response.store.StoreInfoBo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.caller.UfoServiceCaller;
... ... @@ -17,10 +27,6 @@ import com.yohoufo.order.model.response.OrderSubmitResponse;
import com.yohoufo.order.model.response.PaymentResponse;
import com.yohoufo.order.service.IOfflineShoppingService;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("offlineShoppingService")
public class OfflineShoppingServiceImpl extends ShoppingServiceImpl implements IOfflineShoppingService {
... ... @@ -78,7 +84,19 @@ public class OfflineShoppingServiceImpl extends ShoppingServiceImpl implements I
//查询门店信息
private StoreInfoBo queryStoreInfo(int storeId) {
ApiResponse resp = ufoServiceCaller.call("ufo.store.queryStoreInfoById", ApiResponse.class, storeId);
SecondhandInfoReqBo bo = new SecondhandInfoReqBo();
bo.setSkup(3);
bo.setFlawId("2,18");
bo.setDescribeInfo("穿着舒适");
List<SecondhandImagesBo> imageList = Lists.newArrayList();
SecondhandImagesBo image = new SecondhandImagesBo();
image.setSkup(3);
image.setType(1);
image.setIsDefault("Y");
image.setImageUrl("http://baidu.com");
imageList.add(image);
bo.setImageList(imageList);
ApiResponse resp = ufoServiceCaller.call("ufo.secondhand.save", ApiResponse.class, bo);
if (resp != null && resp.getCode()==200) {
if (resp.getData() != null) {
return (StoreInfoBo)resp.getData();
... ...
... ... @@ -9,5 +9,6 @@ public interface SecondhandProductService {
List<SecondhandFlaw> queryFlawListByType(Integer type);
int saveSkupInfo(Integer skup, String flawId, String flawAttr, String describeInfo, List<SecondhandImagesBo> list);
int saveSkupInfo(Integer skup, String flawId, String flawAttr, String describeInfo,
List<SecondhandImagesBo> list, List<SecondhandImagesBo> flawImageList);
}
... ...
package com.yohoufo.product.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
... ... @@ -39,7 +41,8 @@ public class SecondhandProductServiceImpl implements SecondhandProductService {
}
@Override
public int saveSkupInfo(Integer skup, String flawId, String flawAttr, String describeInfo, List<SecondhandImagesBo> imageList) {
public int saveSkupInfo(Integer skup, String flawId, String flawAttr, String describeInfo,
List<SecondhandImagesBo> imageList, List<SecondhandImagesBo> flawImageList) {
//保存图片
List<SecondhandImages> list = Lists.newArrayList();
for(SecondhandImagesBo bo : imageList) {
... ... @@ -52,9 +55,11 @@ public class SecondhandProductServiceImpl implements SecondhandProductService {
return num;
}
List<Integer> qualityFlawIdList = flawImageList.stream().map(SecondhandImagesBo::getCode).collect(Collectors.toList());
SecondhandInfo record = new SecondhandInfo();
record.setSkup(skup);
record.setFlawId(flawId);
record.setFlawId(flawId + "," + StringUtils.join(qualityFlawIdList, ","));
record.setFlawAttr(flawAttr);
record.setDescribeInfo(describeInfo);
... ...