Authored by caoyan

自助尺码

  1 +package com.yoho.product.dal;
  2 +
  3 +
  4 +import java.util.List;
  5 +
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import com.yoho.product.model.SelfSize;
  9 +import com.yoho.product.model.SelfSizeReq;
  10 +
  11 +public interface SelfSizeMapper {
  12 + int selectTotalByCondition(@Param("selfSizeReq")SelfSizeReq selfSizeReq);
  13 +
  14 + List<SelfSize> selectByCondition(@Param("selfSizeReq")SelfSizeReq selfSizeReq);
  15 +
  16 + SelfSize selectByPrimaryKey(@Param("id") Integer id);
  17 +
  18 + int upadteAuditResult(@Param("id") Integer id, @Param("status") Integer status, @Param("auditUid") Integer auditUid);
  19 +}
  1 +package com.yoho.product.dal;
  2 +
  3 +
  4 +import java.util.List;
  5 +
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import com.yoho.product.model.SelfSizeUid;
  9 +
  10 +public interface SelfSizeUidMapper {
  11 +
  12 + List<Integer> selectUidByProductIdAndSizeId(@Param("productId")Integer productId, @Param("sizeId") Integer sizeId);
  13 +
  14 + SelfSizeUid selectByPrimaryKey(@Param("id") Integer id);
  15 +
  16 + List<SelfSizeUid> selectByPrdIdList(@Param("prdIdList") List<Integer> prdIdList);
  17 +
  18 +}
  1 +package com.yoho.product.model;
  2 +
  3 +public class SelfSize {
  4 + private Integer id;
  5 +
  6 + private Integer productId;
  7 +
  8 + private Integer goodsId;
  9 +
  10 + private Integer sizeId;
  11 +
  12 + private Integer auditTime;
  13 +
  14 + private Integer auditUid;
  15 +
  16 + private Integer status;
  17 +
  18 + public Integer getId() {
  19 + return id;
  20 + }
  21 +
  22 + public void setId(Integer id) {
  23 + this.id = id;
  24 + }
  25 +
  26 + public Integer getProductId() {
  27 + return productId;
  28 + }
  29 +
  30 + public void setProductId(Integer productId) {
  31 + this.productId = productId;
  32 + }
  33 +
  34 + public Integer getGoodsId() {
  35 + return goodsId;
  36 + }
  37 +
  38 + public void setGoodsId(Integer goodsId) {
  39 + this.goodsId = goodsId;
  40 + }
  41 +
  42 + public Integer getSizeId() {
  43 + return sizeId;
  44 + }
  45 +
  46 + public void setSizeId(Integer sizeId) {
  47 + this.sizeId = sizeId;
  48 + }
  49 +
  50 + public Integer getAuditTime() {
  51 + return auditTime;
  52 + }
  53 +
  54 + public void setAuditTime(Integer auditTime) {
  55 + this.auditTime = auditTime;
  56 + }
  57 +
  58 + public Integer getAuditUid() {
  59 + return auditUid;
  60 + }
  61 +
  62 + public void setAuditUid(Integer auditUid) {
  63 + this.auditUid = auditUid;
  64 + }
  65 +
  66 + public Integer getStatus() {
  67 + return status;
  68 + }
  69 +
  70 + public void setStatus(Integer status) {
  71 + this.status = status;
  72 + }
  73 +
  74 +}
  1 +package com.yoho.product.model;
  2 +
  3 +import com.yoho.ufo.service.model.PageRequestBO;
  4 +
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +import lombok.NoArgsConstructor;
  8 +import lombok.experimental.Builder;
  9 +
  10 +/**
  11 + * Created by caoyan.
  12 + */
  13 +@Data
  14 +@Builder
  15 +@AllArgsConstructor
  16 +@NoArgsConstructor
  17 +public class SelfSizeReq extends PageRequestBO{
  18 +
  19 + /**
  20 + *
  21 + */
  22 + private static final long serialVersionUID = 1620427808531296022L;
  23 +
  24 + private Integer id;
  25 +
  26 + private String productName;
  27 +
  28 + private String productCode;
  29 +
  30 + private Integer status;
  31 +
  32 +}
  1 +package com.yoho.product.model;
  2 +
  3 +import com.yoho.ufo.service.model.PageRequestBO;
  4 +
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +import lombok.NoArgsConstructor;
  8 +import lombok.experimental.Builder;
  9 +
  10 +/**
  11 + * Created by caoyan.
  12 + */
  13 +@Data
  14 +@Builder
  15 +@AllArgsConstructor
  16 +@NoArgsConstructor
  17 +public class SelfSizeRsp extends PageRequestBO{
  18 +
  19 + /**
  20 + *
  21 + */
  22 + private static final long serialVersionUID = 1620427808531296022L;
  23 +
  24 + private Integer id;
  25 +
  26 + private String brandName;
  27 +
  28 + private String productName;
  29 +
  30 + private String productCode;
  31 +
  32 + private Integer productId;
  33 +
  34 + private String applySizeName;
  35 +
  36 + private String sellingSizeName;
  37 +
  38 + private String applyUid;
  39 +
  40 + private String statusStr;
  41 +
  42 + private Integer status;
  43 +
  44 +}
  1 +package com.yoho.product.model;
  2 +
  3 +public class SelfSizeUid {
  4 + private Integer id;
  5 +
  6 + private Integer productId;
  7 +
  8 + private Integer goodsId;
  9 +
  10 + private Integer sizeId;
  11 +
  12 + private Integer uid;
  13 +
  14 + public Integer getId() {
  15 + return id;
  16 + }
  17 +
  18 + public void setId(Integer id) {
  19 + this.id = id;
  20 + }
  21 +
  22 + public Integer getProductId() {
  23 + return productId;
  24 + }
  25 +
  26 + public void setProductId(Integer productId) {
  27 + this.productId = productId;
  28 + }
  29 +
  30 + public Integer getGoodsId() {
  31 + return goodsId;
  32 + }
  33 +
  34 + public void setGoodsId(Integer goodsId) {
  35 + this.goodsId = goodsId;
  36 + }
  37 +
  38 + public Integer getSizeId() {
  39 + return sizeId;
  40 + }
  41 +
  42 + public void setSizeId(Integer sizeId) {
  43 + this.sizeId = sizeId;
  44 + }
  45 +
  46 + public Integer getUid() {
  47 + return uid;
  48 + }
  49 +
  50 + public void setUid(Integer uid) {
  51 + this.uid = uid;
  52 + }
  53 +
  54 +}
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yoho.product.dal.SelfSizeMapper" >
  4 + <resultMap id="BaseResultMap" type="com.yoho.product.model.SelfSize" >
  5 + <id column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="product_id" property="productId" jdbcType="INTEGER" />
  7 + <result column="goods_id" property="goodsId" jdbcType="INTEGER" />
  8 + <result column="size_id" property="sizeId" jdbcType="INTEGER" />
  9 + <result column="audit_time" property="auditTime" jdbcType="INTEGER" />
  10 + <result column="audit_uid" property="auditUid" jdbcType="INTEGER" />
  11 + <result column="status" property="status" jdbcType="INTEGER" />
  12 + </resultMap>
  13 + <sql id="Base_Column_List" >
  14 + id, product_id, goods_id, size_id, audit_time, audit_uid, status
  15 + </sql>
  16 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  17 + select
  18 + <include refid="Base_Column_List" />
  19 + from self_size
  20 + where id = #{id,jdbcType=INTEGER}
  21 + </select>
  22 +
  23 + <sql id="Query_Sql" >
  24 + <if test="selfSizeReq.productName != null and selfSizeReq.productName != '' ">
  25 + <bind name="pattern" value="'%' + selfSizeReq.productName + '%'" />
  26 + and product_name like #{pattern}
  27 + </if>
  28 + <if test="selfSizeReq.productCode != null and selfSizeReq.productCode != '' ">
  29 + and product_code=#{selfSizeReq.productCode}
  30 + </if>
  31 + <if test="selfSizeReq.status != null">
  32 + and status=#{selfSizeReq.status}
  33 + </if>
  34 + </sql>
  35 +
  36 + <select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.product.model.SelfSizeReq">
  37 + select count(1)
  38 + from self_size
  39 + where 1=1
  40 + <include refid="Query_Sql"></include>
  41 + </select>
  42 +
  43 + <select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.product.model.SelfSizeReq">
  44 + select <include refid="Base_Column_List"></include>
  45 + from self_size
  46 + where 1=1
  47 + <include refid="Query_Sql"></include>
  48 + order by id desc
  49 + <if test="selfSizeReq.start!=null and selfSizeReq.size != null">
  50 + limit #{selfSizeReq.start},#{selfSizeReq.size}
  51 + </if>
  52 + </select>
  53 +
  54 + <update id="upadteAuditResult">
  55 + update self_size set status=#{status}, audit_time=unix_timestamp(), audit_uid=#{auditUid}
  56 + where id=#{id}
  57 + </update>
  58 +
  59 +</mapper>
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yoho.product.dal.SelfSizeUidMapper" >
  4 + <resultMap id="BaseResultMap" type="com.yoho.product.model.SelfSizeUid" >
  5 + <id column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="product_id" property="productId" jdbcType="INTEGER" />
  7 + <result column="goods_id" property="goodsId" jdbcType="INTEGER" />
  8 + <result column="size_id" property="sizeId" jdbcType="INTEGER" />
  9 + <result column="uid" property="uid" jdbcType="INTEGER" />
  10 + </resultMap>
  11 + <sql id="Base_Column_List" >
  12 + id, product_id, goods_id, size_id, uid
  13 + </sql>
  14 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  15 + select
  16 + <include refid="Base_Column_List" />
  17 + from self_size_uid
  18 + where id = #{id,jdbcType=INTEGER}
  19 + </select>
  20 +
  21 + <select id="selectUidByProductIdAndSizeId" resultType="java.lang.Integer">
  22 + select uid from self_size_uid
  23 + where product_id=#{productId} and size_id=#{sizeId}
  24 + </select>
  25 +
  26 + <select id="selectByPrdIdList" resultMap="BaseResultMap">
  27 + select <include refid="Base_Column_List"></include>
  28 + from self_size_uid
  29 + where product_id in
  30 + <foreach collection="prdIdList" item="prdId" open="(" close=")" separator=",">
  31 + #{prdId}
  32 + </foreach>
  33 + </select>
  34 +</mapper>
  1 +package com.yoho.ufo.controller.product;
  2 +
  3 +import org.slf4j.Logger;
  4 +import org.slf4j.LoggerFactory;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RestController;
  8 +
  9 +import com.yoho.product.model.SelfShelvesReq;
  10 +import com.yoho.product.model.SelfShelvesRsp;
  11 +import com.yoho.product.model.SelfSizeReq;
  12 +import com.yoho.product.model.SelfSizeRsp;
  13 +import com.yoho.ufo.exception.PlatformException;
  14 +import com.yoho.ufo.service.ISelfSizeService;
  15 +import com.yoho.ufo.service.model.ApiResponse;
  16 +import com.yoho.ufo.service.model.PageResponseBO;
  17 +
  18 +@RestController
  19 +@RequestMapping(value = "/selfSize")
  20 +public class SellerSelfSizeController {
  21 +
  22 + private static final Logger LOGGER = LoggerFactory.getLogger(SellerSelfSizeController.class);
  23 +
  24 + @Autowired
  25 + private ISelfSizeService selfSizeService;
  26 +
  27 + @RequestMapping(value = "/queryList")
  28 + public ApiResponse queryList(SelfSizeReq req) {
  29 + LOGGER.info("queryList in. req is {}", req);
  30 + PageResponseBO<SelfSizeRsp> result = selfSizeService.queryList(req);
  31 + return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
  32 + }
  33 +
  34 + @RequestMapping(value = "/getDetailById")
  35 + public ApiResponse getDetailById(SelfSizeReq req) {
  36 + LOGGER.info("getDetailById in. req is {}", req);
  37 + SelfSizeRsp result = selfSizeService.getDetail(req);
  38 + return new ApiResponse.ApiResponseBuilder().code(200).data(result).message("保存成功").build();
  39 + }
  40 +
  41 + @RequestMapping(value = "/updateAuditInfoById")
  42 + public ApiResponse updateAuditInfoById(SelfSizeReq req) {
  43 + LOGGER.info("updateAuditInfoById in. req is {}", req);
  44 + int result;
  45 + try {
  46 + result = selfSizeService.updateAuditResult(req);
  47 + } catch (PlatformException e) {
  48 + return new ApiResponse.ApiResponseBuilder().code(500).message(e.getMessage()).build();
  49 + }
  50 + if(result>0) {
  51 + return new ApiResponse.ApiResponseBuilder().code(200).data(result).message("保存成功").build();
  52 + }else {
  53 + return new ApiResponse.ApiResponseBuilder().code(500).data(result).message("保存失败").build();
  54 + }
  55 +
  56 + }
  57 +
  58 +}
  1 +package com.yoho.ufo.service;
  2 +
  3 +import com.yoho.product.model.SelfSizeReq;
  4 +import com.yoho.product.model.SelfSizeRsp;
  5 +import com.yoho.ufo.exception.PlatformException;
  6 +import com.yoho.ufo.service.model.PageResponseBO;
  7 +
  8 +public interface ISelfSizeService {
  9 +
  10 + PageResponseBO<SelfSizeRsp> queryList(SelfSizeReq req);
  11 +
  12 + SelfSizeRsp getDetail(SelfSizeReq req);
  13 +
  14 + int updateAuditResult(SelfSizeReq req) throws PlatformException;
  15 +}
  1 +package com.yoho.ufo.service.impl;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +import java.util.Map.Entry;
  6 +import java.util.Set;
  7 +import java.util.stream.Collectors;
  8 +
  9 +import org.apache.commons.collections.CollectionUtils;
  10 +import org.apache.commons.lang3.StringUtils;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.slf4j.helpers.MessageFormatter;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.stereotype.Service;
  16 +
  17 +import com.google.common.collect.Lists;
  18 +import com.google.common.collect.Maps;
  19 +import com.google.common.collect.Sets;
  20 +import com.yoho.product.dal.SelfSizeMapper;
  21 +import com.yoho.product.dal.SelfSizeUidMapper;
  22 +import com.yoho.product.model.SelfSize;
  23 +import com.yoho.product.model.SelfSizeReq;
  24 +import com.yoho.product.model.SelfSizeRsp;
  25 +import com.yoho.product.model.SelfSizeUid;
  26 +import com.yoho.ufo.dal.BrandMapper;
  27 +import com.yoho.ufo.dal.ProductMapper;
  28 +import com.yoho.ufo.dal.StorageMapper;
  29 +import com.yoho.ufo.dal.UfoSizeMapper;
  30 +import com.yoho.ufo.dal.model.Product;
  31 +import com.yoho.ufo.dal.model.Storage;
  32 +import com.yoho.ufo.exception.PlatformException;
  33 +import com.yoho.ufo.model.brand.Brand;
  34 +import com.yoho.ufo.model.commoditybasicrole.size.Size;
  35 +import com.yoho.ufo.service.ISelfSizeService;
  36 +import com.yoho.ufo.service.UserProxyService;
  37 +import com.yoho.ufo.service.model.PageResponseBO;
  38 +
  39 +/**
  40 + * @author caoyan
  41 + * @date 2019/3/19
  42 + */
  43 +@Service
  44 +public class SelfSizeServiceImpl implements ISelfSizeService {
  45 +
  46 + private static final Logger LOGGER = LoggerFactory.getLogger(SelfSizeServiceImpl.class);
  47 +
  48 + @Autowired
  49 + private SelfSizeMapper selfSizeMapper;
  50 +
  51 + @Autowired
  52 + private SelfSizeUidMapper selfSizeUidMapper;
  53 +
  54 + @Autowired
  55 + private ProductMapper productMapper;
  56 +
  57 + @Autowired
  58 + private BrandMapper brandMapper;
  59 +
  60 + @Autowired
  61 + private UfoSizeMapper ufoSizeMapper;
  62 +
  63 + @Autowired
  64 + private StorageMapper storageMapper;
  65 +
  66 + @Autowired
  67 + private InboxServiceImpl inboxService;
  68 +
  69 + @Autowired
  70 + private UserProxyService userProxyService;
  71 +
  72 + @Override
  73 + public PageResponseBO<SelfSizeRsp> queryList(SelfSizeReq req){
  74 + int total = selfSizeMapper.selectTotalByCondition(req);
  75 + if(total == 0) {
  76 + return null;
  77 + }
  78 +
  79 + List<SelfSize> list = selfSizeMapper.selectByCondition(req);
  80 + if(CollectionUtils.isEmpty(list)) {
  81 + return null;
  82 + }
  83 +
  84 + List<Integer> productIdList = list.stream().map(SelfSize::getProductId).collect(Collectors.toList());
  85 + List<Product> productList = productMapper.selectProductListByIds(productIdList);
  86 + Map<Integer, Product> productMap = productList.stream().collect(Collectors.toMap(Product::getId, p->p));
  87 + List<Integer> brandIdList = productList.stream().map(Product::getBrandId).collect(Collectors.toList());
  88 + List<Brand> brandList = brandMapper.selectBrandByIdList(brandIdList);
  89 + Map<Integer, String> brandIdNameMap = brandList.stream().collect(Collectors.toMap(Brand::getId, Brand::getBrandName));
  90 + List<Integer> sizeIdList = list.stream().map(SelfSize::getSizeId).collect(Collectors.toList());
  91 + List<Size> sizeList = ufoSizeMapper.selectByIdList(sizeIdList);
  92 + Map<Integer, String> sizeIdNameMap = sizeList.stream().collect(Collectors.toMap(Size::getId, Size::getSizeName));
  93 + List<Integer> goodsIdList = list.stream().map(SelfSize::getGoodsId).collect(Collectors.toList());
  94 + Map<Integer, String> goodsIdSizeNameMap = getSellingSizeNameMap(goodsIdList);
  95 + List<SelfSizeUid> uidInfoList = selfSizeUidMapper.selectByPrdIdList(productIdList);
  96 + Map<Integer, List<SelfSizeUid>> selfSizeUidMap = uidInfoList.stream().collect(Collectors.groupingBy(SelfSizeUid::getSizeId));
  97 +
  98 +
  99 + List<SelfSizeRsp> rspList = Lists.newArrayList();
  100 + for(SelfSize item : list) {
  101 + SelfSizeRsp rsp = new SelfSizeRsp();
  102 + rsp.setId(item.getId());
  103 + rsp.setBrandName(brandIdNameMap.get(productMap.get(item.getProductId()).getBrandId()));
  104 + rsp.setProductName(productMap.get(item.getProductId()).getProductName());
  105 + rsp.setProductCode(productMap.get(item.getProductId()).getProductCode());
  106 + rsp.setProductId(item.getProductId());
  107 + rsp.setApplySizeName(sizeIdNameMap.get(item.getSizeId()));
  108 + rsp.setStatus(item.getStatus());
  109 + rsp.setStatusStr(getStatusStr(item.getStatus()));
  110 + rsp.setSellingSizeName(goodsIdSizeNameMap.get(item.getGoodsId()));
  111 + List<SelfSizeUid> selfSizeUids = selfSizeUidMap.get(item.getSizeId());
  112 + List<Integer> applyUidList = selfSizeUids.stream().map(SelfSizeUid::getUid).collect(Collectors.toList());
  113 + rsp.setApplyUid(getApplyUidStr(applyUidList));
  114 +
  115 + rspList.add(rsp);
  116 + }
  117 +
  118 + PageResponseBO<SelfSizeRsp> result=new PageResponseBO<>();
  119 + result.setList(rspList);
  120 + result.setPage(req.getPage());
  121 + result.setSize(req.getSize());
  122 + result.setTotal(total);
  123 +
  124 + return result;
  125 + }
  126 +
  127 + private String getApplyUidStr(List<Integer> uidList) {
  128 + Set<String> uidStrSet = Sets.newHashSet();
  129 + for(Integer uid : uidList) {
  130 + uidStrSet.add(String.valueOf(uid));
  131 + }
  132 +
  133 + return String.join("、", uidStrSet);
  134 + }
  135 +
  136 + private Map<Integer, String> getSellingSizeNameMap(List<Integer> goodsIdList){
  137 + List<Storage> storageList = storageMapper.selectByGoodsIdList(goodsIdList);
  138 + Map<Integer, List<Storage>> goodsIdMap = storageList.stream().collect(Collectors.groupingBy(Storage::getGoodsId));
  139 + List<Integer> sizeIdList = storageList.stream().map(Storage::getSizeId).collect(Collectors.toList());
  140 + List<Size> sizeList = ufoSizeMapper.selectByIdList(sizeIdList);
  141 + Map<Integer, String> sizeIdNameMap = sizeList.stream().collect(Collectors.toMap(Size::getId, Size::getSizeName));
  142 + Map<Integer, String> result = Maps.newHashMap();
  143 + for(Entry<Integer, List<Storage>> entry : goodsIdMap.entrySet()) {
  144 + List<Integer> sizeIds = entry.getValue().stream().map(Storage::getSizeId).collect(Collectors.toList());
  145 + List<String> sizeNameList = Lists.newArrayList();
  146 + for(Integer sizeId : sizeIds) {
  147 + sizeNameList.add(sizeIdNameMap.get(sizeId));
  148 + }
  149 + result.put(entry.getKey(), String.join("、", sizeNameList));
  150 + }
  151 +
  152 + return result;
  153 + }
  154 +
  155 + private String getStatusStr(Integer status) {
  156 + if(status.intValue() == 0) {
  157 + return "待审核";
  158 + }else if(status.intValue() == 1) {
  159 + return "已通过";
  160 + }else if(status.intValue() == 2) {
  161 + return "不通过";
  162 + }else {
  163 + return "";
  164 + }
  165 + }
  166 +
  167 + @Override
  168 + public SelfSizeRsp getDetail(SelfSizeReq req) {
  169 + SelfSize selfSize = selfSizeMapper.selectByPrimaryKey(req.getId());
  170 + if(null == selfSize) {
  171 + return null;
  172 + }
  173 +
  174 + Product product = productMapper.selectByPrimaryKey(selfSize.getProductId());
  175 + Brand brand = brandMapper.selectOneById(product.getBrandId());
  176 + Size size = ufoSizeMapper.selectOneById(selfSize.getSizeId());
  177 + List<Storage> storageList = storageMapper.selectByGoodsId(selfSize.getGoodsId());
  178 + List<Integer> sizeIdList = storageList.stream().map(Storage::getSizeId).collect(Collectors.toList());
  179 + List<Size> sizeList = ufoSizeMapper.selectByIdList(sizeIdList);
  180 + List<String> sizeNameList = sizeList.stream().map(Size::getSizeName).collect(Collectors.toList());
  181 + List<Integer> uidList = selfSizeUidMapper.selectUidByProductIdAndSizeId(selfSize.getProductId(), selfSize.getSizeId());
  182 +
  183 + SelfSizeRsp rsp = new SelfSizeRsp();
  184 + rsp.setBrandName(brand.getBrandName());
  185 + rsp.setProductName(product.getProductName());
  186 + rsp.setProductId(product.getId());
  187 + rsp.setProductCode(product.getProductCode());
  188 + rsp.setApplySizeName(size.getSizeName());
  189 + rsp.setSellingSizeName(String.join("、", sizeNameList));
  190 + List<String> uidStrList = Lists.newArrayList();
  191 + for(Integer uid : uidList) {
  192 + uidStrList.add(String.valueOf(uid));
  193 + }
  194 + rsp.setApplyUid(String.join("、", uidStrList));
  195 + return rsp;
  196 + }
  197 +
  198 + @Override
  199 + public int updateAuditResult(SelfSizeReq req) throws PlatformException {
  200 + SelfSize selfSize = selfSizeMapper.selectByPrimaryKey(req.getId());
  201 + if(null == selfSize) {
  202 + throw new PlatformException("记录不存在", 400);
  203 + }
  204 +
  205 + UserHelper userInfo = new UserHelper();
  206 + int num = selfSizeMapper.upadteAuditResult(req.getId(), req.getStatus(), userInfo.getUserId());
  207 + if(num > 0 && req.getStatus().intValue() == 1) {//审核通过
  208 + //发送站内信
  209 +// inboxService.addInboxForPlatform(pss.getUid(), InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_SELF_SHELVES_AUDIT_PASS.getType(),
  210 +// InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_SELF_SHELVES_AUDIT_PASS.getBusinessType(), buildParams(pss.getBrand(), pss.getProductName(), pss.getProductCode()));
  211 +// //发送短信
  212 +// SmsMessageReq smsReq = new SmsMessageReq();
  213 +// //获取手机号
  214 +// String mobile = userProxyService.getMobile(pss.getUid());
  215 +// smsReq.setMobileList(Lists.newArrayList(mobile));
  216 +// smsReq.setContent(getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_SELF_SHELVES_AUDIT_PASS.getContent(), pss.getBrand(), pss.getProductName(), pss.getProductCode()));
  217 +// inboxService.sendSmsMessage(smsReq);
  218 + }
  219 + return num;
  220 + }
  221 +
  222 + private String getReplacedContent(String content ,Object... params) {
  223 + return MessageFormatter.arrayFormat(content, params).getMessage();
  224 + }
  225 +
  226 + public static String buildParams(Object... objects) {
  227 + if (objects == null) {
  228 + return null;
  229 + }
  230 +
  231 + if (objects.length == 1) {
  232 + return objects[0].toString();
  233 + }
  234 +
  235 + String params = StringUtils.join(objects, ",");
  236 + return params;
  237 + }
  238 +
  239 + private String getAuditStatusStr(int status) {
  240 + if(status == 0) {
  241 + return "待审核";
  242 + }else if(status == 1) {
  243 + return "已上架";
  244 + }else if(status == 2) {
  245 + return "不通过";
  246 + }else if(status == 3) {
  247 + return "待上架";
  248 + }
  249 + return "";
  250 + }
  251 +}
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta charset="UTF-8"/>
  5 + <title>Yoho!Buy运营平台</title>
  6 + <script src="/ufoPlatform/js/include.js?version=6.9.3"></script>
  7 + <style>
  8 + .sub-info th{
  9 + font-size: 16px;
  10 + text-align: right;
  11 + width: 30%;
  12 + }
  13 + .sub-info td{
  14 + font-size: 16px;
  15 + width: 70%;
  16 + }
  17 + </style>
  18 +</head>
  19 +<body class="easyui-layout">
  20 +<div region="north" style="height:90px;">
  21 + <script>
  22 + document.write(addHead('商品管理', '卖家自主尺码申请'));
  23 + </script>
  24 +</div>
  25 +
  26 +<div id="businessDiv" region="center">
  27 + <table id="businessTable" class="sub-info" frame="void" width="80%" cellpadding="16" align="center">
  28 + <tr>
  29 + <th>品牌</th>
  30 + <td id="brandName"></td>
  31 + </tr>
  32 + <tr>
  33 + <th>商品名称</th>
  34 + <td id="productName"></td>
  35 + </tr>
  36 + <tr>
  37 + <th>SKN</th>
  38 + <td id="productId"></td>
  39 + </tr>
  40 + <tr>
  41 + <th>货号</th>
  42 + <td id="productCode"></td>
  43 + </tr>
  44 + <tr>
  45 + <th>申请尺码</th>
  46 + <td id="applySizeName"></td>
  47 + </tr>
  48 + <tr>
  49 + <th>出售中尺码</th>
  50 + <td id="sellingSizeName"></td>
  51 + </tr>
  52 + <tr>
  53 + <th>申请人UID</th>
  54 + <td id="applyUid"></td>
  55 + </tr>
  56 + </table>
  57 + <div id="btnList" style="text-align:center;">
  58 + <a id="rejectBtn" class="btn-long" style="background-color: rgba(217, 0, 27, 1);">不通过</a>
  59 + <a id="passBtn" class="btn-long" style="background-color: rgba(2, 125, 180, 1);">已添加尺码并审核通过</a>
  60 + </div>
  61 + <br>
  62 + <br>
  63 +</div>
  64 +<script>
  65 +$(function() {
  66 + var param=window.location.search;
  67 + var id = getQueryString(param, "id");
  68 +
  69 + getDetailInfo(id);
  70 +
  71 + $("#rejectBtn").linkbutton({
  72 + text: "不通过",
  73 + iconCls: "icon-ok",
  74 + onClick: function () {
  75 + updateAudit(id, 2);
  76 + }
  77 + });
  78 + $("#passBtn").linkbutton({
  79 + text: "通过",
  80 + iconCls: "icon-ok",
  81 + onClick: function () {
  82 + updateAudit(id, 1);
  83 + }
  84 + });
  85 +
  86 +});
  87 +
  88 +function updateAudit(id, status){
  89 + $.post(contextPath + "/selfSize/updateAuditInfoById", {
  90 + id : id,
  91 + status : status
  92 + }, function(data) {
  93 + if (data.code == 200) {
  94 + document.getElementById("btnList").style.display= "none";
  95 + window.self.$.messager.show({
  96 + title : "提示",
  97 + msg : "审核成功!"
  98 + });
  99 + }else {
  100 + window.self.$.messager.alert("失败", "失败!", "error");
  101 + }
  102 + });
  103 +}
  104 +
  105 +function getDetailInfo(id){
  106 + var form = new FormData();
  107 + form.append("id", id);
  108 +
  109 + //发送请求
  110 + $.ajax({
  111 + type: "POST",
  112 + url: contextPath + '/selfSize/getDetailById',
  113 + data: form,
  114 + async: false,
  115 + cache: false,
  116 + contentType: false,
  117 + processData: false,
  118 + dataType: 'json',
  119 + success: function (result) {
  120 + if(result.code == 200) {
  121 + $("#brandName").html(replacexss(result.data.brandName));
  122 + $("#productName").html(replacexss(result.data.productName));
  123 + $("#productId").html(result.data.productId);
  124 + $("#productCode").html(result.data.productCode);
  125 + $("#applySizeName").html(result.data.applySizeName);
  126 + $("#sellingSizeName").html(result.data.sellingSizeName);
  127 + $("#applyUid").html(result.data.applyUid);
  128 + }
  129 + else {
  130 + $.messager.alert("失败", result.message, "error");
  131 + }
  132 + }
  133 + });
  134 +}
  135 +
  136 +function getQueryString(paraPart,name) {
  137 + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  138 + var r = paraPart.substr(1).match(reg);
  139 + if (r != null) return unescape(r[2]);
  140 + return null;
  141 +}
  142 +
  143 +</script>
  144 +</body>
  145 +</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?version=6.9.3"></script>
  7 +</head>
  8 +<body class="easyui-layout">
  9 +<div region="north" style="height:230px;">
  10 + <script>
  11 + document.write(addHead('商品管理', '卖家自助尺码申请'));
  12 + </script>
  13 + <div style="margin-left: 10px;margin-top: 30px">
  14 + <div style="border:1px solid #ddd;border-radius:5px 5px 5px 5px;">
  15 + <div style="margin-left: 10px;margin-top: 20px;margin-bottom: 20px">
  16 + <input id="productName" name="productName" />
  17 + <input id="productCode" name="productCode" />
  18 + <input id="status" name="status" />
  19 + <a id="searchBtn" class="btn-info">筛选</a>
  20 + <a id="allBtn" class="btn-success">全部</a>
  21 + </div>
  22 + </div>
  23 + </div>
  24 +</div>
  25 +
  26 +<div id="sizeList" region="center">
  27 + <table id="mainListTable"></table>
  28 +</div>
  29 +<script>
  30 +var listUrl = contextPath + "/selfSize/queryList";
  31 +var viewUrl = contextPath + "/html/sellerSelfSize/view.html";
  32 +var auditUrl = contextPath + "/html/sellerSelfSize/audit.html";
  33 +$(function() {
  34 + $("#productName").textbox({
  35 + prompt: "名称",
  36 + width: 200
  37 + });
  38 +
  39 + $("#productCode").textbox({
  40 + prompt: "货号",
  41 + width: 200
  42 + });
  43 +
  44 + $("#status").combobox({
  45 + prompt: "审核状态",
  46 + width: 150,
  47 + editable : false,
  48 + data: [
  49 + {"text" : "待审核", "value" : 1},
  50 + {"text" : "已通过", "value" : 2},
  51 + {"text" : "已拒绝", "value" : 3}
  52 + ]
  53 + });
  54 +
  55 + $("#searchBtn").linkbutton({
  56 + iconCls : "icon-search",
  57 + onClick : function() {
  58 + var status = $("#status").myCombobox("getValue")-1;
  59 + $("#mainListTable").datagrid("load", {
  60 + productName : $("#productName").val(),
  61 + productCode : $("#productCode").val(),
  62 + status : status == -1 ? null : status
  63 + });
  64 + }
  65 + });
  66 +
  67 + //全部按钮
  68 + $("#allBtn").linkbutton({
  69 + iconCls: "icon-import",
  70 + onClick: function () {
  71 + $("#productName").textbox('setValue','');
  72 + $("#productCode").textbox('setValue','');
  73 + $("#status").combobox('setValue','');
  74 + $("#mainListTable").datagrid("load", {});
  75 + }
  76 + });
  77 +
  78 + loadMainList();
  79 +});
  80 +
  81 +function loadMainList(){
  82 + $("#mainListTable").myDatagrid({
  83 + fit: true,
  84 + fitColumns: true,
  85 + striped: true,
  86 + url: listUrl,
  87 + method: 'POST',
  88 + loadFilter: function (data) {
  89 + var temp = defaultLoadFilter(data);
  90 + temp=null==temp?[]:temp;
  91 + temp.rows = temp.list;
  92 + return temp;
  93 + },
  94 + columns: [[{
  95 + title: "品牌",
  96 + field: "brandName",
  97 + width: 20,
  98 + align: "center"
  99 + }, {
  100 + title: "商品名称",
  101 + field: "productName",
  102 + width: 20,
  103 + align: "center"
  104 + }, {
  105 + title: "SKN",
  106 + field: "productId",
  107 + width: 20,
  108 + align: "center"
  109 + }, {
  110 + title: "货号",
  111 + field: "productCode",
  112 + width: 30,
  113 + align: "center"
  114 + }, {
  115 + title: "申请尺码",
  116 + field: "applySizeName",
  117 + width: 20,
  118 + align: "center"
  119 + }, {
  120 + title: "出售中尺码",
  121 + field: "sellingSizeName",
  122 + width: 20,
  123 + align: "center"
  124 + }, {
  125 + title: "申请人UID",
  126 + field: "applyUid",
  127 + width: 10,
  128 + align: "center"
  129 + }, {
  130 + title: "状态",
  131 + field: "statusStr",
  132 + width: 20,
  133 + align: "center"
  134 + }, {
  135 + title: "操作",
  136 + field: "asdf",
  137 + width: 30,
  138 + align: "center",
  139 + formatter: function (value, rowData, rowIndex) {
  140 + var str = "";
  141 + if(rowData.status==0){
  142 + str = "<a role='audit' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>审核</a>" + str;
  143 + }else{
  144 + str = "<a role='detail' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #428bca !important;'>查看</a>";
  145 + }
  146 + return str;
  147 + }
  148 + }]],
  149 + cache: false,
  150 + pagination: true,
  151 + pageSize: 10,
  152 + idField: "id",
  153 + singleSelect: true,
  154 + onLoadSuccess: function (data) {
  155 + $(this).datagrid("getPanel").find("a[role='detail']").linkbutton({
  156 + onClick: function () {
  157 + var id = $(this).attr("dataId");
  158 + window.open(viewUrl + "?id=" + id + "&ver=" + new Date().getTime())
  159 + }
  160 + });
  161 +
  162 + $(this).datagrid("getPanel").find("a[role='audit']").linkbutton({
  163 + onClick: function () {
  164 + var id = $(this).attr("dataId");
  165 + window.open(auditUrl + "?id=" + id + "&ver=" + new Date().getTime()); }
  166 + });
  167 + }
  168 + });
  169 +}
  170 +
  171 +</script>
  172 +</body>
  173 +</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?version=6.9.3"></script>
  7 + <style>
  8 + .sub-info th{
  9 + font-size: 16px;
  10 + text-align: right;
  11 + width: 30%;
  12 + }
  13 + .sub-info td{
  14 + font-size: 16px;
  15 + width: 70%;
  16 + }
  17 + </style>
  18 +</head>
  19 +<body class="easyui-layout">
  20 +<div region="north" style="height:90px;">
  21 + <script>
  22 + document.write(addHead('商品管理', '卖家自主尺码申请'));
  23 + </script>
  24 +</div>
  25 +
  26 +<div id="businessDiv" region="center">
  27 + <table id="businessTable" class="sub-info" frame="void" width="80%" cellpadding="16" align="center">
  28 + <tr>
  29 + <th>品牌</th>
  30 + <td id="brandName"></td>
  31 + </tr>
  32 + <tr>
  33 + <th>商品名称</th>
  34 + <td id="productName"></td>
  35 + </tr>
  36 + <tr>
  37 + <th>SKN</th>
  38 + <td id="productId"></td>
  39 + </tr>
  40 + <tr>
  41 + <th>货号</th>
  42 + <td id="productCode"></td>
  43 + </tr>
  44 + <tr>
  45 + <th>申请尺码</th>
  46 + <td id="applySizeName"></td>
  47 + </tr>
  48 + <tr>
  49 + <th>出售中尺码</th>
  50 + <td id="sellingSizeName"></td>
  51 + </tr>
  52 + <tr>
  53 + <th>申请人UID</th>
  54 + <td id="applyUid"></td>
  55 + </tr>
  56 + </table>
  57 + <br>
  58 + <br>
  59 +</div>
  60 +<script>
  61 +$(function() {
  62 + var param=window.location.search;
  63 + var id = getQueryString(param, "id");
  64 +
  65 + getDetailInfo(id);
  66 +
  67 +});
  68 +
  69 +function getDetailInfo(id){
  70 + var form = new FormData();
  71 + form.append("id", id);
  72 +
  73 + //发送请求
  74 + $.ajax({
  75 + type: "POST",
  76 + url: contextPath + '/selfSize/getDetailById',
  77 + data: form,
  78 + async: false,
  79 + cache: false,
  80 + contentType: false,
  81 + processData: false,
  82 + dataType: 'json',
  83 + success: function (result) {
  84 + if(result.code == 200) {
  85 + $("#brandName").html(replacexss(result.data.brandName));
  86 + $("#productName").html(replacexss(result.data.productName));
  87 + $("#productId").html(result.data.productId);
  88 + $("#productCode").html(result.data.productCode);
  89 + $("#applySizeName").html(result.data.applySizeName);
  90 + $("#sellingSizeName").html(result.data.sellingSizeName);
  91 + $("#applyUid").html(result.data.applyUid);
  92 + }
  93 + else {
  94 + $.messager.alert("失败", result.message, "error");
  95 + }
  96 + }
  97 + });
  98 +}
  99 +
  100 +function getQueryString(paraPart,name) {
  101 + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  102 + var r = paraPart.substr(1).match(reg);
  103 + if (r != null) return unescape(r[2]);
  104 + return null;
  105 +}
  106 +
  107 +</script>
  108 +</body>
  109 +</html>