Authored by Lixiaodi

Merge branch 'master' of http://git.yoho.cn/ufo/ufo-platform

Showing 28 changed files with 983 additions and 156 deletions
package com.yoho.ufo.restapi;
import com.alibaba.fastjson.JSON;
import com.yoho.core.common.utils.MD5;
import com.yoho.error.GatewayError;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import java.util.ArrayList;
/**
* API 响应格式
* /**
* 响应为:
* <pre>
* {
* "code": 200,
* "message": "\u767b\u5f55\u6210\u529f",
* "data": {
* "uid": "10216497",
* "profile": "18751986615",
* "session_key": "fa31d3a5d069c6c98cd8c38c3a5f89e6",
* "vip": 0
* },
* "md5": "fa5b07f95a0bf95c26ac50abf0024eed"
* }
* Created by chang@yoho.cn on 2015/11/3.
*/
public class ApiResponse {
public static String DEFAULT_MSG = "操作成功";
public static int DEFAULT_CODE = 200;
private int code;
private String message;
private String md5;
private Object data;
public ApiResponse() {
this(200, DEFAULT_MSG, null);
}
public ApiResponse(Object data) {
this();
this.data = data;
}
public ApiResponse(int code, String message) {
this(code, message, null);
}
public ApiResponse(int code, String message, Object data) {
this.code = code;
if (StringUtils.isNotEmpty(message)) {
this.message = message;
}
this.data = data;
}
public int getCode() {
return code;
}
public ApiResponse setCode(int code) {
this.code = code;
return this;
}
public String getMessage() {
return message;
}
public ApiResponse setMessage(String message) {
this.message = message;
return this;
}
public String getMd5() {
return md5;
}
public ApiResponse setMd5(String md5) {
this.md5 = md5;
return this;
}
public Object getData() {
return data;
}
public ApiResponse setData(Object data) {
this.data = data;
return this;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
/**
* 构造响应。 使用方式:
* <p/>
* <pre>
* ApiResponse.ApiResponseBuilder builder = new ApiResponse.ApiResponseBuilder();
* ApiResponse apiResponse = builder.code(200).message("coupons total").data(new Total("0")).build();
* </pre>
*/
public static class ApiResponseBuilder {
ApiResponse apiResponse;
public ApiResponseBuilder() {
apiResponse = new ApiResponse();
}
/**
* 设置错误码。默认200
*
* @param code 错误码
* @return ApiResponseBuilder
*/
public ApiResponseBuilder code(int code) {
apiResponse.code = code;
return this;
}
/**
* 设置消息。默认[操作成功]
*
* @param message 错误消息
* @return ApiResponseBuilder
*/
public ApiResponseBuilder message(String message) {
apiResponse.message = message;
return this;
}
/**
* 从Errorcode中设置错误码和错误消息
*
* @param gatewayError
* @return
*/
public ApiResponseBuilder code(GatewayError gatewayError) {
apiResponse.code = gatewayError.getCode();
apiResponse.message = gatewayError.getMessage();
return this;
}
/**
* 设置响应的具体内容
*
* @param data 响应的具体内容
* @return 内容
*/
public ApiResponseBuilder data(Object data) {
apiResponse.data = data;
return this;
}
/**
* 构造响应
*
* @return 响应
*/
public ApiResponse build() {
//参数校验, 并且设置默认值
if (this.apiResponse.code <= 0) {
this.apiResponse.code = DEFAULT_CODE;
}
if (StringUtils.isEmpty(apiResponse.message)) {
this.apiResponse.message = DEFAULT_MSG;
}
//构造JSON
apiResponse.md5 = getMd5();
return apiResponse;
}
//计算MD5
private String getMd5() {
if (this.apiResponse.data == null) {
this.apiResponse.data = new ArrayList<>(0);
}
String json = JSON.toJSONString(this.apiResponse.data);
return MD5.md5(json);
}
}
}
... ...
package com.yoho.ufo.service.model;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by yoho on 2017/2/15.
*/
public class BaseBO implements Serializable {
public static final String NORMAL_FORMAT = "yyyy-MM-dd";
private static final long serialVersionUID = 1759153128139236954L;
public BaseBO() {
}
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
public static String getDateFormatFromInt(long intTime, String... formats) {
if(intTime <= 0L) {
return null;
} else {
Date date = new Date(intTime * 1000L);
return getDateFormatFromDate(date, formats);
}
}
public static String getDateFormatFromDate(Date date, String... formats) {
if(date == null) {
return null;
} else {
String format = "yyyy-MM-dd";
if(null != formats && formats.length > 0) {
format = null == formats[0]?"yyyy-MM-dd":formats[0];
}
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(date);
}
}
}
\ No newline at end of file
... ...
package com.yoho.ufo.service.model;
/**
* Created by yoho on 2017/2/15.
*/
public class PageRequestBO extends BaseBO {
private static final long serialVersionUID = -4026346032261456086L;
private int page = 1;
private int size = 10;
private int start = 0;
private Integer rows = Integer.valueOf(10);
public PageRequestBO() {
}
public int getStart() {
if(this.page > 0 && this.size > 0) {
this.start = (this.page - 1) * this.size;
} else {
this.start = 0;
}
return this.start;
}
public void setStart(int start) {
this.start = start;
}
public int getPage() {
return this.page;
}
public void setPage(int page) {
if(page <= 1) {
page = 1;
}
this.page = page;
}
public int getSize() {
return this.size;
}
public void setSize(int size) {
this.size = size;
}
public void checkCurrentPage(int count) {
int totalPage = count % this.size == 0?count / this.size:count / this.size + 1;
if(this.page > totalPage) {
this.page = Math.max(totalPage, 1);
}
}
public Integer getRows() {
return this.rows;
}
public void setRows(Integer rows) {
this.rows = rows;
}
}
\ No newline at end of file
... ...
package com.yoho.ufo.service.model;
import java.util.ArrayList;
import java.util.List;
/**
* Created by yoho on 2017/2/15.
*/
public class PageResponseBO<T> extends BaseBO {
private static final long serialVersionUID = -6835515582292217174L;
private int total;
private int page;
private int size;
private int totalPage;
private List<T> list = new ArrayList();
public PageResponseBO() {
}
public int getTotal() {
return this.total;
}
public void setTotal(int total) {
this.total = total;
this.dealTotalPage();
}
private void dealTotalPage() {
if(this.total > 0 && this.size > 0) {
int totalPage = this.total % this.size == 0?this.total / this.size:this.total / this.size + 1;
this.setTotalPage(totalPage);
}
}
public int getPage() {
return this.page;
}
public void setPage(int page) {
this.page = page;
}
public List<T> getList() {
return this.list;
}
public void setList(List<T> list) {
this.list = list;
}
public int getSize() {
return this.size;
}
public void setSize(int size) {
this.size = size;
this.dealTotalPage();
}
public int getTotalPage() {
return this.totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
}
\ No newline at end of file
... ...
... ... @@ -28,11 +28,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>order-service-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-common</artifactId>
</dependency>
... ...
... ... @@ -2,6 +2,11 @@ package com.yoho.order.dal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yoho.order.model.BuyerOrder;
import com.yoho.order.model.BuyerOrderReq;
/**
* Created by caoyan on 2018/9/12.
*/
... ... @@ -9,7 +14,7 @@ public interface BuyerOrderMapper {
int selectCountByStatus(List<Byte> statusList);
// int selectTotalByCondition(BuyerOrderListReq req);
int selectTotalByCondition(@Param("buyerOrderReq") BuyerOrderReq req);
// List<BuyerOrder> selectByCondition(BuyerOrderListReq req);
List<BuyerOrder> selectByCondition(@Param("buyerOrderReq") BuyerOrderReq req);
}
... ...
package com.yoho.order.model;
import java.util.List;
import com.yoho.ufo.service.model.PageRequestBO;
/**
* Created by caoyan.
*/
public class BuyerOrderReq extends PageRequestBO{
/**
*
*/
private static final long serialVersionUID = 1620427808531296022L;
private List<Byte> statusList;
public List<Byte> getStatusList() {
return statusList;
}
public void setStatusList(List<Byte> statusList) {
this.statusList = statusList;
}
@Override
public String toString() {
return "BuyerOrderListReq{" +
"statusList=" + statusList +
'}';
}
}
... ...
... ... @@ -36,11 +36,4 @@ public interface UfoProductDetailsMapper {
List<ProductDetails> getProductDetailsPageList(@Param("productDetails") ProductDetails productDetails, @Param("page") PageModel pageModel);
/**
* 根据主键逻辑删除商品信息
* @param id
* @return
*/
int deleteProductById(Integer id);
}
... ...
... ... @@ -23,14 +23,6 @@ public interface UfoProductPoolDetailMapper {
int deleteProductPoolDetailsByPoolId(Integer poolId);
/**
* 根据条件查询商品池详情数量
*
* @param productPoolDetails
* @return
*/
int selectProductPoolDetailsCount(@Param("productPoolDetails") ProductPoolDetails productPoolDetails);
/**
* 批量插入商品池详情数据
... ... @@ -39,16 +31,6 @@ public interface UfoProductPoolDetailMapper {
*/
int batchInsertProductPoolDetails(List<ProductPoolDetails> productPoolDetails);
/**
* 根据条件查询商品池详情分页数据
*
* @param productPoolDetails
* @param pageModel
* @return
*/
List<ProductPoolDetails> getProductPoolDetailsPageList(@Param("productPoolDetails") ProductPoolDetails productPoolDetails, @Param("page") PageModel pageModel);
/**
* 根据商品池id和商品id物理删除商品池和商品关联表数据
* @param productPoolId
... ...
... ... @@ -38,29 +38,29 @@
</select>
<sql id="Query_Order_Sql" >
<if test="statusList != null and statusList.size() > 0">
<if test="buyerOrderReq.statusList != null and buyerOrderReq.statusList.size() > 0">
and status in
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
<foreach collection="buyerOrderReq.statusList" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
</if>
</sql>
<select id="selectTotalByCondition" resultType="java.lang.Integer">
<select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.BuyerOrderReq">
select count(1)
from buyer_order
where 1=1
<include refid="Query_Order_Sql" />
</select>
<select id="selectByCondition" resultMap="BaseResultMap">
<select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.order.model.BuyerOrderReq">
select <include refid="Base_Column_List" />
from buyer_order
where 1=1
<include refid="Query_Order_Sql" />
order by create_time desc
<if test="start!=null and size != null">
limit #{start},#{size}
<if test="buyerOrderReq.start!=null and buyerOrderReq.size != null">
limit #{buyerOrderReq.start},#{buyerOrderReq.size}
</if>
</select>
... ...
... ... @@ -6,7 +6,7 @@
</resultMap>
<sql id="queryColumns">
product.id, product.product_code, product.product_name, product.product_code, brand.brand_name, product_sort.sort_name, product.del_status
product.id, product.product_code, product.product_name, product.product_code, brand.brand_name, CONCAT(IFNULL(CONCAT(sort2.sort_name,'/'),''),sort1.sort_name) AS sortName, product.del_status
</sql>
<select id="queryProductIdsByProductIds" parameterType="java.util.Set" resultType="integer">
... ... @@ -18,18 +18,18 @@
</select>
<sql id="queryParam">
WHERE product.del_status=0 and pool_detail.pool_id = #{productDetails.poolId}
WHERE pool_detail.pool_id = #{productDetails.poolId}
<if test="productDetails.productCode != null and productDetails.productCode != ''">
and product.product_code like concat('%',#{productDetails.productCode}, '%')
</if>
<if test="productDetails.productName != null and productDetails.productName != ''">
and pool.pool_name like concat('%', #{productDetails.productName}, '%')
and product.product_name like concat('%', #{productDetails.productName}, '%')
</if>
<if test="productDetails.brandName != null and productDetails.brandName != ''">
and brand.brand_name like concat('%', #{productDetails.brandName}, '%')
</if>
<if test="productDetails.sortName != null and productDetails.sortName != ''">
and product_sort.sort_name like concat('%', #{productDetails.sortName}, '%')
and sort1.sort_name like concat('%', #{productDetails.sortName}, '%')
</if>
</sql>
... ... @@ -41,8 +41,10 @@
ON pool_detail.product_id = product.id
LEFT JOIN brand
ON product.brand_id = brand.id
LEFT JOIN product_sort
ON product.series_id = product_sort.id
LEFT JOIN product_sort sort1
ON product.series_id = sort1.id
LEFT JOIN product_sort sort2
ON sort1.parent_id=sort2.id
</sql>
<select id="selectProductDetailsCount" resultType="integer">
... ... @@ -58,7 +60,4 @@
limit #{page.startIndex}, #{page.pageSize}
</select>
<update id="deleteProductById">
update product set del_status = 1, update_time = UNIX_TIMESTAMP(NOW()) where id = #{id}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -9,46 +9,6 @@
product.id, product.product_code, product.product_name, product.product_code, brand.brand_name, product_sort.sort_name
</sql>
<sql id="queryParam">
WHERE product.del_status=0
<if test="productPoolDetails.productCode != null and productPoolDetails.productCode != ''">
and product.product_code like concat('%',#{productPoolDetails.productCode}, '%')
</if>
<if test="productPoolDetails.productName != null and productPoolDetails.productName != ''">
and pool.pool_name like concat('%', #{productPoolDetails.productName}, '%')
</if>
<if test="productPoolDetails.brandName != null and productPoolDetails.brandName != ''">
and brand.brand_name like concat('%', #{productPoolDetails.brandName}, '%')
</if>
<if test="productPoolDetails.sortName != null and productPoolDetails.sortName != ''">
and product_sort.sort_name like concat('%', #{productPoolDetails.sortName}, '%')
</if>
</sql>
<sql id="queryTable">
FROM product_pool pool
LEFT JOIN product_pool_detail pool_detail
ON pool.id = pool_detail.pool_id
LEFT JOIN product
ON pool_detail.product_id = product.id
LEFT JOIN brand
ON product.brand_id = brand.id
LEFT JOIN product_sort
ON product.series_id = product_sort.id
</sql>
<select id="selectProductPoolDetailsCount" resultType="integer">
SELECT COUNT(*)
<include refid="queryTable"/>
<include refid="queryParam"/>
</select>
<select id="getProductPoolDetailsPageList" resultMap="productPoolDetails">
select <include refid="queryColumns"/>
<include refid="queryTable"/>
<include refid="queryParam"/>
limit #{page.startIndex}, #{page.pageSize}
</select>
<insert id="batchInsertProductPoolDetails" parameterType="list">
... ...
... ... @@ -12,7 +12,7 @@
</resultMap>
<sql id="queryColumns">
size.id, size.size_name, sort.sort_name as sortName
size.id, size.size_name, CONCAT(IFNULL(CONCAT(sort2.sort_name,'/'),''),sort1.sort_name) AS sortName, size.order_by
</sql>
<insert id="insertSize" parameterType="com.yoho.ufo.model.commoditybasicrole.size.Size">
... ... @@ -52,27 +52,28 @@
<sql id="queryPage">
LEFT JOIN product_sort sort
ON size.sort_id = sort.id
from size
LEFT JOIN product_sort sort1
ON size.sort_id = sort1.id
left join product_sort sort2
on sort1.parent_id = sort2.id
<where>
<if test="size.sortName != null and size.sortName != ''">
sort.sort_name like concat('%', #{size.sortName}, '%')
sort1.sort_name like concat('%', #{size.sortName}, '%') or sort2.sort_name like concat('%', #{size.sortName}, '%')
</if>
<if test="size.sizeName != null and size.sizeName !=''">
size.size_name like concat('%', #{size.sizeName}, '%')
and size.size_name like concat('%', #{size.sizeName}, '%')
</if>
</where>
</sql>
<select id="selectSizeCount" resultType="integer">
select count(*)
from size
<include refid="queryPage"/>
</select>
<select id="getSizePageList" resultMap="sizeMap">
select <include refid="queryColumns"/>
from size
<include refid="queryPage"/>
order by size.update_time desc
limit #{page.startIndex}, #{page.pageSize}
... ...
... ... @@ -23,6 +23,10 @@
<dependencies>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>order-ufo-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-dal</artifactId>
</dependency>
... ... @@ -30,6 +34,10 @@
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-common</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>order-ufo-model</artifactId>
</dependency>
</dependencies>
</project>
... ...
... ... @@ -8,8 +8,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yoho.order.model.BuyerOrderReq;
import com.yoho.ufo.order.service.IBuyerOrderService;
import com.yoho.ufo.service.model.ApiResponse;
import com.yoho.ufo.service.model.PageResponseBO;
import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
@RestController
@RequestMapping(value = "/buyerOrder")
... ... @@ -27,10 +30,10 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(map).build();
}
// @RequestMapping(value = "/queryOrderList")
// public ApiResponse queryOrderList(BuyerOrderListReq req) {
// LOGGER.info("queryOrderList in. req is {}", req);
// PageResponseBO<BuyerOrderResp> result = buyerOrderService.queryOrderList(req);
// return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
// }
@RequestMapping(value = "/queryOrderList")
public ApiResponse queryOrderList(BuyerOrderReq req) {
LOGGER.info("queryOrderList in. req is {}", req);
PageResponseBO<BuyerOrderResp> result = buyerOrderService.queryOrderList(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
}
}
... ...
... ... @@ -2,6 +2,10 @@ package com.yoho.ufo.order.service;
import java.util.Map;
import com.yoho.order.model.BuyerOrderReq;
import com.yoho.ufo.service.model.PageResponseBO;
import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
/**
* @author caoyan
* @date 2018/9/13
... ... @@ -9,5 +13,5 @@ import java.util.Map;
public interface IBuyerOrderService {
Map<String, Integer> getCountByJudgeStatus();
// PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderListReq req);
PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req);
}
... ...
... ... @@ -14,11 +14,11 @@ import org.springframework.stereotype.Service;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.order.dal.BuyerOrderMapper;
import com.yoho.order.model.BuyerOrder;
import com.yoho.order.model.BuyerOrderReq;
import com.yoho.ufo.order.constant.Constant;
import com.yoho.ufo.order.service.IBuyerOrderService;
import com.yohobuy.ufo.model.order.req.BuyerOrderListReq;
import com.yoho.ufo.service.model.PageResponseBO;
import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
import com.yohobuy.ufo.model.order.resp.PageResponseBO;
/**
* @author caoyan
... ... @@ -50,36 +50,35 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
return resultMap;
}
// public PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderListReq req) {
// int total = buyerOrderMapper.selectTotalByCondition(req);
// if(total == 0) {
// return null;
// }
//
// List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req);
// if(CollectionUtils.isEmpty(orderList)) {
// return null;
// }
//
// List<BuyerOrderResp> respList = Lists.newArrayList();
// for(BuyerOrder item : orderList) {
// BuyerOrderResp resp = new BuyerOrderResp();
// resp.setOrderCode(item.getOrderCode());
// resp.setStatus(item.getStatus());
// resp.setCreateTimeStr(DateUtil.long2DateStr(item.getCreateTime()*1000, "yyyy-MM-dd HH:mm:ss"));
//
// respList.add(resp);
// }
//
// PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
// result.setList(respList);
// result.setPage(req.getPage());
// result.setSize(req.getSize());
// result.setTotal(total);
//
// return result;
public PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req) {
int total = buyerOrderMapper.selectTotalByCondition(req);
if(total == 0) {
return null;
}
List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req);
if(CollectionUtils.isEmpty(orderList)) {
return null;
}
// }
List<BuyerOrderResp> respList = Lists.newArrayList();
for(BuyerOrder item : orderList) {
BuyerOrderResp resp = new BuyerOrderResp();
resp.setOrderCode(item.getOrderCode());
resp.setStatus(item.getStatus());
resp.setCreateTimeStr(DateUtil.long2DateStr(item.getCreateTime()*1000, "yyyy-MM-dd HH:mm:ss"));
respList.add(resp);
}
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
result.setList(respList);
result.setPage(req.getPage());
result.setSize(req.getSize());
result.setTotal(total);
return result;
}
}
... ...
... ... @@ -28,7 +28,11 @@
<artifactId>product-ufo-model</artifactId>
<version>${ufo.model.version}</version>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>order-ufo-model</artifactId>
<version>${ufo.model.version}</version>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-dal</artifactId>
... ...
... ... @@ -26,6 +26,13 @@ public class ProductPoolDetailsController {
@Resource
private IProductPoolDetailsService productPoolDetailsService;
/**
* 商品池详情删除功能,只删除商品池和商品的关联表数据(product_pool_detail)
*
* @param productId
* @param poolId
* @return
*/
@RequestMapping(value = "/deleteProductById", method = RequestMethod.POST)
public ApiResponse<Void> deleteProductById(Integer productId, Integer poolId) {
LOGGER.info("deleteProductById param productId = {}, productPoolId = {}", productId, poolId);
... ...
... ... @@ -4,12 +4,12 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.ufo.dal.BrandMapper;
import com.yoho.ufo.model.brand.Brand;
import com.yoho.ufo.service.IBrandService;
import com.yoho.ufo.util.OrikaUtils;
import com.yohobuy.ufo.model.common.PageModel;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.brand.BrandRequestBo;
import com.yohobuy.ufo.model.request.brand.BrandResponseBo;
import com.yoho.ufo.service.IBrandService;
import com.yoho.ufo.util.OrikaUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
... ... @@ -35,8 +35,7 @@ public class BrandServiceImpl implements IBrandService {
LOGGER.info("insertOrUpdateBrand param = {}", brandRequestBo);
Brand brand = OrikaUtils.map(brandRequestBo, Brand.class);
brand.setEditTime(DateUtil.currentTimeSeconds());
// TODO
brand.setEditPid(10086);
brand.setEditPid(getUserId());
if (brand.getId() == null || brand.getId() == 0) {
// 默认开启状态
brand.setStatus(1);
... ... @@ -85,11 +84,15 @@ public class BrandServiceImpl implements IBrandService {
LOGGER.info("updateBrandStatus param = {}", requestBo);
Brand brand = OrikaUtils.map(requestBo, Brand.class);
brand.setEditTime(DateUtil.currentTimeSeconds());
// TODO
brand.setEditPid(1111111);
brand.setEditPid(getUserId());
return brandMapper.updateBrandStatus(brand);
}
private Integer getUserId() {
Integer userId = (new UserHelper()).getUserId();
return userId == null ? 0 : userId;
}
@Override
public List<JSONObject> getBrandIdAndName() {
// TODO 可以添加缓存
... ...
... ... @@ -13,7 +13,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
... ... @@ -49,11 +48,9 @@ public class ProductPoolDetailsServiceImpl implements IProductPoolDetailsService
return new PageResponseBO<>(count, responseBos, pageModel.getCurrentPage(), pageModel.getPageSize());
}
@Transactional(rollbackFor = Exception.class)
@Override
public int deleteProductById(Integer productId, Integer productPoolId) {
LOGGER.info("deleteProductById productId = {}, productPoolId = {}", productId, productPoolId);
ufoProductPoolDetailMapper.deleteProductPoolDetail(productPoolId, productId);
return ufoProductDetailsMapper.deleteProductById(productId);
return ufoProductPoolDetailMapper.deleteProductPoolDetail(productPoolId, productId);
}
}
... ...
... ... @@ -34,6 +34,10 @@ public class ProductSortServiceImpl implements IProductSortService {
*/
private static final Integer PRODUCT_SORT_LEVEL_1 = 1;
/**
* 二级层级
*/
private static final Integer PRODUCT_SORT_LEVEL_2 = 2;
/**
* 顶级id
... ... @@ -55,6 +59,8 @@ public class ProductSortServiceImpl implements IProductSortService {
// 一级层级
productSort.setLevel(PRODUCT_SORT_LEVEL_1);
productSort.setParentId(TOP_PARENT_ID);
} else {
productSort.setLevel(PRODUCT_SORT_LEVEL_2);
}
productSort.setStatus(0);
productSort.setCreateTime(DateUtil.currentTimeSeconds());
... ...
... ... @@ -12,6 +12,7 @@
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/common/ok.jsp</url-pattern>
<url-pattern>/common/productId.xlsx</url-pattern>
</servlet-mapping>
... ...
No preview for this file type
... ... @@ -102,7 +102,12 @@
title: "所属分类",
field: "sortName",
width: 100,
align: "center",
align: "center"
}, {
title: "排序值",
field: "orderBy",
width: 100,
align: "center"
}, {
title: "操作",
field: "operations",
... ...
... ... @@ -60,11 +60,6 @@
$(function () {
var poolId = parseURL(window.location.href).poolId;
console.log(parseURL(window.location.href).poolId);
/* $('#goodsPoolId').val(window.self.paramObject.poolId);
console.log(window.self.paramObject.poolId);
console.log($('#goodsPoolId').val());*/
$("#productCode").textbox({
prompt: "商品编码"
... ... @@ -158,13 +153,13 @@
interval: 500,
text: ""
});
$.post(contextPath + "/productPoolDetails/deleteProductById", {"id": id, "poolId":poolId}, function (data) {
$.post(contextPath + "/productPoolDetails/deleteProductById", {"productId": id, "poolId":poolId}, function (data) {
$.messager.progress("close");
if (data.code == 200) {
$("#productPoolDetailsTable").datagrid("reload");
$.messager.show({
title: "提示",
msg: "删除区域成功!"
msg: "删除商品详情成功!"
});
} else {
$.messager.alert("失败", data.message, "error");
... ... @@ -183,18 +178,18 @@
var productName = $('#productName').textbox('getValue');
var brandName = $('#brandName').textbox('getValue');
var sortName = $('#sortName').textbox('getValue');
var param = {};
var param = {"poolId": poolId};
if (undefined !== productCode && null !== productCode && "" !== productCode) {
param.id = productCode;
param.productCode = productCode;
}
if (undefined !== productName && null !== productName && "" !== productName) {
param.poolName = productName;
param.productName = productName;
}
if (undefined !== brandName && null !== brandName && "" !== brandName) {
param.id = brandName;
param.brandName = brandName;
}
if (undefined !== sortName && null !== sortName && "" !== sortName) {
param.poolName = sortName;
param.sortName = sortName;
}
return param;
}
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js"></script>
<script src="/ufoPlatform/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="height: 230px">
<script>
document.write(addHead('库存详情', ''));
</script>
<style>
.div_search input {margin-top: 20px;}
.div_search .textbox {margin-top: 20px;}
.div_search .easyui-linkbutton {margin-top: 20px;}
</style>
<div style="margin-left: 30px;" class="div_search">
<input id="status" type="text"/>
<input id="SKUP" type="text">
<input id="sellerUid" type="text">
<input id="storageId" type="text">
<a id="searchLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">筛选</a>
<a id="searchAllLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">全部</a>
</div>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px;height: 660px">
<table id="skupTable"></table>
</div>
</div>
<script type="text/javascript">
var brandId;
$(function () {
$("#status").myCombobox({
prompt: "请选择",
width: 200,
data: [{id: '1',text: '待付保证金'}, {id: '2',text: '卖家取消支付'}, {id: '2',text: '卖家支付超时'}, {id: '2',text: '出售中'}
, {id: '2',text: '卖家取消出售'}, {id: '2',text: '平台取消出售'}, {id: '2',text: '已出售'}],
valueField: "id",
textField: "text"
});
$("#SKUP").textbox({
prompt: "SKU_P"
});
$("#sellerUid").textbox({
prompt: "卖家UID"
});
$("#storageId").textbox({
prompt: "SKU"
});
$("#skupTable").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/brand/getBrandPageList",
method: 'POST',
/*queryParams: {
'brandName':'',
'status':''
},*/
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "SKU_P",
field: "skup",
width: 40,
align: "center"
}, {
title: "SKU",
field: "storageId",
width: 80,
align: "center",
}, {
title: "颜色",
field: "colorName",
width: 100,
align: "center"
}, {
title: "尺码",
field: "sizeName",
width: 80,
align: "center"
}, {
title: "卖家UID",
field: "sellerUid",
width: 200,
align: "center"
}, {
title: "销售价",
field: "price",
width: 50,
align: "center",
}, {
title: "状态",
field: "status",
width: 50,
align: "center",
formatter: function (value, rowData) {
if (value == 1) {
return '开启';
}
return '关闭';
},
}, {
title: "创建时间",
field: "createTime",
width: 130,
align: "center"
}, {
title: "操作",
field: "operations",
width: 120,
align: "center",
formatter: function (value, rowData) {
var str = "<a role='edit' dataId='" + rowData.skup + "' style='margin-left:10px'>取消售卖</a>";
return str;
}
}]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: false,
checkOnSelect: false,
onLoadSuccess: function () {
// 编辑
$(this).myDatagrid("getPanel").find("a[role='edit']").linkbutton({
iconCls: "icon-edit",
onClick: function () {
var id = $(this).attr("dataId");
editRow(id);
}
});
}
});
// 搜索
$("#searchLinkButton").linkbutton({
onClick: function () {
var param = getParams();
$("#skupTable").myDatagrid("load", param);
}
});
// 搜索全部
$("#searchAllLinkButton").linkbutton({
onClick: function () {
$('#status').combobox('clear');
$('#SKUP').combobox('clear');
$('#sellerUid').textbox('clear');
$('#storageId').textbox('clear');
var param = {};
$("#skupTable").myDatagrid("load", param);
}
});
/**
* 提取出搜索参数
* <input id="status" type="text"/>
<input id="SKUP" type="text">
<input id="sellerUid" type="text">
<input id="storageId" type="text">
*/
function getParams() {
var status = $('#status').combobox('getValue');
var skup = $('#SKUP').textbox('getValue');
var sellerUid = $('#sellerUid').textbox('getValue');
var storageId = $('#storageId').textbox('getValue');
var param = {};
if (undefined !== status && null !== status && "" !== status) {
param.status = status;
}
if (undefined !== skup && null !== skup && "" !== skup) {
param.skup = skup;
}
if (undefined !== sellerUid && null !== sellerUid && "" !== sellerUid) {
param.sellerUid = sellerUid;
}if (undefined !== storageId && null !== storageId && "" !== storageId) {
param.storageId = storageId;
}
return param;
}
function editRow(id) {
var skup = id;
var div = $("<div>").appendTo($(document.body));
var message = "确定要取消售卖此件商品吗?商品取消售卖后,卖家的该件商品强制下架,退还卖家保证金";
window.top.$.messager.confirm("取消售卖提醒", message, function (flag) {
if (flag) {
window.top.$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
$.post(contextPath + "/brand/updateBrandStatus",{"skup":skup}, function (data) {
window.top.$.messager.progress("close");
if (data.code == 200) {
$("#skupTable").myDatagrid("reload");
window.top.$.messager.show({title: "提示", msg: '操作成功', height: 120});
} else {
window.top.$.messager.alert("失败", '操作失败', "error");
}
}, "json");
}
});
}
});
</script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js"></script>
<script src="/ufoPlatform/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="height: 230px">
<script>
document.write(addHead('商品库存信息', ''));
</script>
<style>
.div_search input {margin-top: 20px; }
.div_search .textbox {margin-top: 20px;}
.div_search .easyui-linkbutton {margin-top: 20px;}
</style>
<div style="margin-left: 30px;" class="div_search">
<input id="id" type="text">
<input id="productName" type="text">
<input id="productSort" type="text">
<input id="brandName" type="text">
<input id="sellerUid" type="text">
<input id="storageNum" type="text">
<input id="storageId" type="text">
<input id="skup" type="text">
<a id="searchLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">筛选</a>
<a id="searchAllLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">全部</a>
</div>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px;height: 660px">
<table id="productTable"></table>
</div>
</div>
<script type="text/javascript">
var brandId;
$(function () {
$.ajax({
contentType: "application/json",
dataType: "json",
type: "GET",
url: contextPath + '/brand/getBrandName',
success: function (data) {
if (data.code != 200 || !data.data || data.data.length == 0) {
return;
}
$("#brandName").myCombobox({
prompt: "选择名称",
width: 200,
data: data.data,
valueField: "id",
textField: "text"
});
}
});
$("#storage_num").myCombobox({
prompt: "请选择",
width: 200,
data: [{id: '1',text: '有库存'}, {id: '2',text: '无库存'}],
valueField: "id",
textField: "text"
});
$("#productTable").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/brand/getBrandPageList",
method: 'POST',
/*queryParams: {
'brandName':'',
'status':''
},*/
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "商品编码",
field: "id",
width: 40,
align: "center"
}, {
title: "商品名称",
field: "productName",
width: 80,
align: "center",
}, {
title: "品牌",
field: "brandName",
width: 100,
align: "center"
}, {
title: "最低价",
field: "price",
width: 80,
align: "center"
}, {
title: "可售库存",
field: "storageNum",
width: 200,
align: "center"
}, {
title: "操作",
field: "operations",
width: 120,
align: "center",
formatter: function (value, rowData) {
var str = "<a role='edit' dataId='" + rowData.id + "' style='margin-left:10px'>库存详情</a>";
return str;
}
}]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: false,
checkOnSelect: false,
onLoadSuccess: function () {
$(this).myDatagrid("getPanel").find("a[role='edit']").linkbutton({
iconCls: "icon-edit",
onClick: function () {
var id = $(this).attr("dataId");
detailStorage(id);
}
});
}
});
// 搜索
$("#searchLinkButton").linkbutton({
onClick: function () {
var param = getParams();
$("#productTable").myDatagrid("load", param);
}
});
$("#id").textbox({
prompt: "商品编码"
});
$("#productName").textbox({
prompt: "商品名称"
});
$("#sellerUid").textbox({
prompt: "卖家UID"
});
$("#storageId").textbox({
prompt: "SKU"
});
$("#skup").textbox({
prompt: "SKU-p"
});
// 搜索全部
$("#searchAllLinkButton").linkbutton({
onClick: function () {
$('#brandName').combobox('clear');
$('#storageNum').combobox('clear');
$('#id').textbox('clear');
$('#productName').textbox('clear');
$('#sellerUid').textbox('clear');
$('#storageId').textbox('clear');
$('#skup').textbox('clear');
var param = {};
$("#productTable").myDatagrid("load", param);
}
});
/**
* 提取出搜索参数
*/
function getParams() {
var brandName = $('#brandName').combobox('getValue');
var storageNum = $('#storageNum').combobox('getValue');
var id = $('#id').textbox('getValue');
var productName = $('#productName').textbox('getValue');
var sellerUid = $('#sellerUid').textbox('getValue');
var storageId = $('#storageId').textbox('getValue');
var skup = $('#skup').textbox('getValue');
var param = {};
if (undefined !== brandName && null !== brandName && "" !== brandName) {
param.brandName = brandName;
}
if (undefined !== storageNum && null !== storageNum && "" !== storageNum) {
param.storageNum = storageNum;
}
if (undefined !== id && null !== id && "" !== id) {
param.id = id;
}
if (undefined !== productName && null !== productName && "" !== productName) {
param.productName = productName;
}
if (undefined !== sellerUid && null !== sellerUid && "" !== sellerUid) {
param.sellerUid = sellerUid;
}
if (undefined !== storageId && null !== storageId && "" !== storageId) {
param.storageId = storageId;
}
if (undefined !== skup && null !== skup && "" !== skup) {
param.skup = skup;
}
return param;
}
function detailStorage(id) {
this.location.href = contextPath + "/html/goods/storage/storageDetail.html?productId=" + id;
}
});
</script>
</body>
</html>
\ No newline at end of file
... ...