Authored by mali

二手

... ... @@ -29,6 +29,16 @@ public class StoragePrice {
private Integer sizeId;
private Integer preSaleFlag; // 库存类型
public Integer getPreSaleFlag() {
return preSaleFlag;
}
public void setPreSaleFlag(Integer preSaleFlag) {
this.preSaleFlag = preSaleFlag;
}
public Integer getId() {
return id;
}
... ...
... ... @@ -13,6 +13,7 @@
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="update_time" jdbcType="INTEGER" property="updateTime"/>
<result column="create_time" jdbcType="INTEGER" property="createTime"/>
<result column="pre_sale_flag" jdbcType="INTEGER" property="preSaleFlag"/>
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from storage_price
... ... @@ -127,7 +128,7 @@
<select id="selectStoragePriceList" resultMap="BaseResultMap">
select sp.id, sp.skup, sp.product_id, s.goods_id, sp.storage_id, sp.depot_num, sp.seller_uid, sp.price, sp.status,
sp.update_time, sp.create_time
sp.update_time, sp.create_time, sp.pre_sale_flag
from storage_price sp, storage s where sp.storage_id = s.id
<include refid="skupPageCondition2"/>
order by sp.id desc limit #{start},#{rows}
... ... @@ -152,17 +153,20 @@
<if test="storagePrice.sizeId != null and storagePrice.sizeId > 0">
and s.size_id = #{storagePrice.sizeId}
</if>
<if test="storagePrice.preSaleFlag != null">
and sp.pre_sale_flag = #{storagePrice.preSaleFlag}
</if>
</sql>
<select id="selectByProductIds" resultMap="BaseResultMap">
select id, skup, product_id, goods_id, storage_id, depot_num, seller_uid, price, status,
update_time, create_time
update_time, create_time, pre_sale_flag
from storage_price
where product_id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
limit 5000 <!-- 防止太多的数据,导致内存扛不住 -->
</foreach> and status = 1
limit 10000 <!-- 防止太多的数据,导致内存扛不住 -->
</select>
<select id="selectProductIdsBySkupInfo" resultType="java.lang.Integer">
select DISTINCT product_id from storage_price where 1 = 1
... ...
... ... @@ -2,7 +2,10 @@ package com.yoho.ufo.controller;
import javax.annotation.Resource;
import com.yoho.product.model.SelfShelvesReq;
import com.yoho.product.model.SelfShelvesRsp;
import com.yohobuy.ufo.model.request.product.ProductRequestBatchBo;
import com.yohobuy.ufo.model.resp.product.SecondDetailResp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.CrossOrigin;
... ... @@ -144,5 +147,12 @@ public class ProductController {
bo.setDuSales("");
return productService.updateSales(bo, 0);
}*/
@RequestMapping(value = "/getSecondDetailBySkup")
public com.yoho.ufo.service.model.ApiResponse getSecondDetailBySkup(ProductRequestBo req) {
LOGGER.info("getSecondDetailBySkup in. req is {}", req);
SecondDetailResp result = productService.getSecondDetailBySkup(req.getSkup());
return new com.yoho.ufo.service.model.ApiResponse.ApiResponseBuilder().code(200).data(result).message("查询成功").build();
}
}
... ...
... ... @@ -3,6 +3,7 @@ package com.yoho.ufo.convert;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.ufo.dal.model.Product;
import com.yoho.ufo.dal.model.StoragePrice;
import com.yohobuy.ufo.model.enums.StorageTypeEnum;
import com.yohobuy.ufo.model.request.product.ProductRequestBo;
import com.yohobuy.ufo.model.resp.product.ProductResponceBo;
import org.springframework.stereotype.Service;
... ... @@ -25,6 +26,7 @@ public class ProductConvertService {
storagePrice.setSkup(bo.getSkup());
storagePrice.setSizeId(bo.getSizeId());
storagePrice.setProductId(bo.getId());
storagePrice.setPreSaleFlag(bo.getPreSaleFlag());
return storagePrice;
}
... ... @@ -41,6 +43,8 @@ public class ProductConvertService {
bo.setSkupCreateTime(DateUtil.getDateStrBySecond(storagePrice.getCreateTime(), DateUtil.DATE_TIME_FORMAT));
bo.setSellerUid(storagePrice.getSellerUid());
bo.setId(storagePrice.getProductId());
bo.setPreSaleFlag(storagePrice.getPreSaleFlag());
bo.setPreSaleFlagStr(StorageTypeEnum.getTypeName(storagePrice.getPreSaleFlag()));
return bo;
}
... ...
package com.yoho.ufo.service;
import com.yohobuy.ufo.model.resp.product.SecondDetailResp;
import org.springframework.web.multipart.MultipartFile;
import com.yoho.core.dal.datasource.annotation.Database;
... ... @@ -39,4 +40,5 @@ public interface IProductService {
ApiResponse<Void> updateSales(ProductRequestBo bo, Integer editUid) throws PlatformException;
SecondDetailResp getSecondDetailBySkup(Integer skup);
}
... ...
... ... @@ -11,6 +11,7 @@ import com.yoho.ufo.model.commoditybasicrole.category.ProductSort;
import com.yoho.ufo.model.commoditybasicrole.color.ProductColor;
import com.yoho.ufo.model.commoditybasicrole.size.Size;
import com.yoho.ufo.util.CollectionUtil;
import com.yohobuy.ufo.model.enums.StorageTypeEnum;
import com.yohobuy.ufo.model.resp.product.ProductResponceBo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
... ... @@ -155,12 +156,17 @@ public class ProductAssistService {
storagePriceList.stream().forEach(item -> {
ProductResponceBo productResponceBo = productMap.get(item.getProductId());
if (ProductConstants.SKUP_STATUS_SALE.equals(item.getStatus())) { // 展示可售状态的库存
productResponceBo.setStorage(null == productResponceBo.getStorage() ? 1 : productResponceBo.getStorage() + 1);
productResponceBo.setCurrentPrice(minPrice(productResponceBo.getCurrentPrice(), item.getPrice())); //最低价是skup中的最低价,只是可售库存
if (StorageTypeEnum.PRE_SALE.getType().equals(item.getPreSaleFlag())) { // 展示可售状态的库存
productResponceBo.setPreSaleStorageNum(null == productResponceBo.getPreSaleStorageNum() ? 1 : productResponceBo.getPreSaleStorageNum() + 1);
} else if (StorageTypeEnum.DEFECT.getType().equals(item.getPreSaleFlag())) {
productResponceBo.setDefectStorageNum(null == productResponceBo.getDefectStorageNum() ? 1 : productResponceBo.getDefectStorageNum() + 1);
} else if (StorageTypeEnum.NORMAL.getType().equals(item.getPreSaleFlag())) {
productResponceBo.setNormalStorageNum(null == productResponceBo.getNormalStorageNum() ? 1 : productResponceBo.getNormalStorageNum() + 1);
} else if (StorageTypeEnum.SECOND.getType().equals(item.getPreSaleFlag())) {
productResponceBo.setSecondStorageNum(null == productResponceBo.getSecondStorageNum() ? 1 : productResponceBo.getSecondStorageNum() + 1);
}
productResponceBo.setStorage(null == productResponceBo.getStorage() ? 1 : productResponceBo.getStorage() + 1);
productResponceBo.setCurrentPrice(minPrice(productResponceBo.getCurrentPrice(), item.getPrice())); //最低价是skup中的最低价,只是可售库存
});
return this;
}
... ...
... ... @@ -13,6 +13,8 @@ import java.util.Set;
import java.util.function.Function;
import com.yoho.ufo.dal.*;
import com.yohobuy.ufo.model.resp.product.SecondDetailResp;
import com.yohobuy.ufo.model.resp.product.SkupImageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.collect.Lists;
... ... @@ -1215,4 +1217,72 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
}
return new ApiResponse<>();
}
public SecondDetailResp getSecondDetailBySkup(Integer skup) {
SecondDetailResp secondDetailResp = new SecondDetailResp();
List<SkupImageInfo> infos = new ArrayList<>();
SkupImageInfo info = new SkupImageInfo();
info.setImageDesc("测试笔 ooo");
info.setImageUrl("http://img11.static.yhbimg.com/goodsimg/2019/04/03/15/01f64fcbd42158d47188ec0d07a3d24938.jpg");
infos.add(info);
SkupImageInfo info1 = new SkupImageInfo();
info1.setImageDesc("测试笔 ooo");
info1.setImageUrl("http://img11.static.yhbimg.com/goodsimg/2019/04/03/15/01f64fcbd42158d47188ec0d07a3d24938.jpg");
infos.add(info1);
SkupImageInfo info2 = new SkupImageInfo();
info2.setImageDesc("测试笔 ooo");
info2.setImageUrl("http://img11.static.yhbimg.com/goodsimg/2019/04/03/15/01f64fcbd42158d47188ec0d07a3d24938.jpg");
infos.add(info2);
SkupImageInfo info3 = new SkupImageInfo();
info3.setImageDesc("测试笔 ooo");
info3.setImageUrl("http://img11.static.yhbimg.com/goodsimg/2019/04/03/15/01f64fcbd42158d47188ec0d07a3d24938.jpg");
infos.add(info3);
SkupImageInfo info4 = new SkupImageInfo();
info4.setImageDesc("测试笔 ooo");
info4.setImageUrl("http://img11.static.yhbimg.com/goodsimg/2019/04/03/15/01f64fcbd42158d47188ec0d07a3d24938.jpg");
infos.add(info4);
SkupImageInfo info5 = new SkupImageInfo();
info5.setImageDesc("测试笔 ooo");
info5.setImageUrl("http://img11.static.yhbimg.com/goodsimg/2019/04/03/15/01f64fcbd42158d47188ec0d07a3d24938.jpg");
infos.add(info5);
SkupImageInfo info6 = new SkupImageInfo();
info6.setImageDesc("测试笔 ooo");
info6.setImageUrl("http://img11.static.yhbimg.com/goodsimg/2019/04/03/15/01f64fcbd42158d47188ec0d07a3d24938.jpg");
infos.add(info6);
SkupImageInfo info7 = new SkupImageInfo();
info7.setImageDesc("测试笔 ooo");
info7.setImageUrl("http://img11.static.yhbimg.com/goodsimg/2019/04/03/15/01f64fcbd42158d47188ec0d07a3d24938.jpg");
infos.add(info7);
SkupImageInfo info8 = new SkupImageInfo();
info8.setImageDesc("测试笔 ooo");
info8.setImageUrl("http://img11.static.yhbimg.com/goodsimg/2019/04/03/15/01f64fcbd42158d47188ec0d07a3d24938.jpg");
infos.add(info8);
SkupImageInfo info9 = new SkupImageInfo();
info9.setImageDesc("测试笔 ooo");
info9.setImageUrl("http://img11.static.yhbimg.com/goodsimg/2019/04/03/15/01f64fcbd42158d47188ec0d07a3d24938.jpg");
infos.add(info9);
secondDetailResp.setImageInfoList(infos);
secondDetailResp.setDesc("测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好测试好");
return secondDetailResp;
}
}
... ...
... ... @@ -20,6 +20,7 @@
<div style="margin-left: 30px;" class="div_search">
<input id="status" type="text"/>
<input id="SKUP" type="text">
<input id="preSaleFlag" type="text">
<input id="sellerUid" type="text">
<input id="storageId" type="text">
<input id="sizeId" type="text">
... ... @@ -88,6 +89,14 @@
textField: "text"
});
$("#preSaleFlag").myCombobox({
prompt: "SKU_P类型",
width: 200,
data: [{id: '0',text: '现货'}, {id: '1',text: '预售'}, {id: '5',text: '全新瑕疵'}, {id: '6',text: '二手'}],
valueField: "id",
textField: "text"
});
$("#SKUP").textbox({
prompt: "SKU_P"
});
... ... @@ -138,6 +147,11 @@
width: 40,
align: "center"
}, {
title: "SKUP类型",
field: "preSaleFlagStr",
width: 80,
align: "center",
}, {
title: "SKU",
field: "storageId",
width: 80,
... ... @@ -181,10 +195,15 @@
width: 120,
align: "center",
formatter: function (value, rowData) {
var button = '';
if (rowData.preSaleFlag == 5 || rowData.preSaleFlag == 6) {
button += "<a role='queryDetail' dataId='" + rowData.skup + "' product_name='" + rowData.productName + "' style='margin-left:10px;background-color: #f0ad4e'>查看二手</a>";
}
if (rowData.status == 1) {
return "<a role='edit' dataId='" + rowData.skup + "' product_name='" + rowData.productName + "' style='margin-left:10px'>取消售卖</a>";
return button + "<a role='edit' dataId='" + rowData.skup + "' product_name='" + rowData.productName + "' style='margin-left:10px'>取消售卖</a>";
} else {
return '';
return button;
}
}
}]],
... ... @@ -203,6 +222,14 @@
editRow(id, $(this).attr("product_name"));
}
});
// 编辑
$(this).myDatagrid("getPanel").find("a[role='queryDetail']").linkbutton({
iconCls: "icon-edit",
onClick: function () {
var id = $(this).attr("dataId");
queryDetail(id, $(this).attr("product_name"));
}
});
}
});
... ... @@ -220,6 +247,7 @@
onClick: function () {
$('#status').combobox('clear');
$('#SKUP').textbox('clear');
$('#preSaleFlag').combobox('clear');
$('#sellerUid').textbox('clear');
$('#storageId').textbox('clear');
$('#sizeId').combobox('clear');
... ... @@ -238,6 +266,7 @@
function getParams() {
var status = $('#status').combobox('getValue');
var skup = $('#SKUP').textbox('getValue');
var preSaleFlag = $('#preSaleFlag').combobox('getValue');
var sellerUid = $('#sellerUid').textbox('getValue');
var storageId = $('#storageId').textbox('getValue');
var sizeId = $('#sizeId').combobox('getValue');
... ... @@ -248,6 +277,9 @@
if (undefined !== skup && null !== skup && "" !== skup) {
param.skup = skup;
}
if (undefined !== preSaleFlag && null !== preSaleFlag && "" !== preSaleFlag) {
param.preSaleFlag = preSaleFlag;
}
if (undefined !== sellerUid && null !== sellerUid && "" !== sellerUid) {
param.sellerUid = sellerUid;
}
... ... @@ -285,6 +317,11 @@
}
});
}
function queryDetail(skup, productName) { // 跳转到二手详情
window.open(contextPath + "/html/goods/storage/storageSecondDetail.html?skup=" + skup + "&time_version=" + new Date().getTime());
}
});
... ...
... ... @@ -227,6 +227,50 @@
return 0;
}
}, {
title: "现货库存",
field: "normalStorageNum",
width: 20,
align: "center",
formatter: function (value, rowData) {
if (value) {
return value;
}
return 0;
}
}, {
title: "预售库存",
field: "preSaleStorageNum",
width: 20,
align: "center",
formatter: function (value, rowData) {
if (value) {
return value;
}
return 0;
}
}, {
title: "全新瑕疵库存",
field: "defectStorageNum",
width: 20,
align: "center",
formatter: function (value, rowData) {
if (value) {
return value;
}
return 0;
}
}, {
title: "二手库存",
field: "secondStorageNum",
width: 20,
align: "center",
formatter: function (value, rowData) {
if (value) {
return value;
}
return 0;
}
}, {
title: "操作",
field: "operations",
width: 40,
... ... @@ -428,7 +472,7 @@
function detailStorage(id, midSortId) {
this.location.href = contextPath + "/html/goods/storage/storageDetail.html?productId=" + id + "&midSortId=" + midSortId;
this.location.href = contextPath + "/html/goods/storage/storageDetail.html?productId=" + id + "&midSortId=" + midSortId + "&time_version=" + new Date().getTime();
}
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js"></script>
<style>
.sub-info th{
font-size: 16px;
text-align: right;
width: 30%;
}
.sub-info td{
font-size: 16px;
width: 70%;
}
</style>
</head>
<body class="easyui-layout">
<div region="north" style="height:90px;">
<script>
document.write(addHead('库存详情', '查看二手信息'));
</script>
</div>
<div id="businessDiv" region="center">
<table id="businessTable" class="sub-info" frame="void" width="80%" cellpadding="16" align="center">
<tr>
<th>图片</th>
<td id="imageListTd"></td>
</tr>
<tr>
<th>描述</th>
<td id="desc"></td>
</tr>
</table>
<br>
<br>
</div>
<div style="display: none">
<div id="dlg" class="datagrid-toolbar" style="padding:5px;">
<img id="simg" src="" alt="" width="800">
</div>
</div>
<script>
$(function() {
var param=window.location.search;
var skup = getQueryString(param, "skup");
getDetailInfo(skup);
//放大图片预览
$(".pimg").click(function(){
var _this = $(this);//将当前的pimg元素作为_this传入函数
var src = _this.attr("src");
//var index = src.indexOf("?");
//src = src.substring(0, index);
//window.open(src);
download(src);
});
});
function download(url) {
$('#dlg').dialog({
title: '预览',
width: 800,
height: 600,
resizable: false,
closed: false,
cache: false,
modal: true
});
$("#simg").attr("src", url);
}
function getDetailInfo(skup){
var form = new FormData();
form.append("skup", skup);
//发送请求
$.ajax({
type: "POST",
url: contextPath + '/product/getSecondDetailBySkup',
data: form,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (result) {
if(result.code == 200) {
$("#desc").html(result.data.desc);
var imageStr = "";
for (var i=0;i<result.data.imageInfoList.length;i++){
imageStr += "<img height='100px;' width='100px;' class='pimg' src='"+result.data.imageInfoList[i].imageUrl+"'/>";
if(i%3==0 && i!=0) {
imageStr += "<br/>"
}
}
$("#imageListTd").html(imageStr);
$.parser.parse($("#imageListTd").parent());
}
else {
$.messager.alert("失败", result.message, "error");
}
}
});
}
function getQueryString(paraPart,name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = paraPart.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
</script>
</body>
</html>
\ No newline at end of file
... ...