Authored by Lixiaodi

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

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