Преглед изворни кода

新增品牌绑定供应商

赵冬冬 пре 4 година
родитељ
комит
cc8befc5f0
21 измењених фајлова са 345 додато и 121 уклоњено
  1. 25 0
      forest-admin/admin-mbg/src/main/java/com/hwrj/cloud/admin/model/PmsBrand.java
  2. 130 0
      forest-admin/admin-mbg/src/main/java/com/hwrj/cloud/admin/model/PmsBrandExample.java
  3. 50 14
      forest-admin/admin-mbg/src/main/resources/com/hwrj/cloud/admin/mapper/PmsBrandMapper.xml
  4. 6 64
      forest-admin/admin-server/src/main/java/com/hwrj/cloud/admin/dto/PmsBrandParam.java
  5. 6 0
      forest-admin/admin-server/src/main/java/com/hwrj/cloud/admin/service/impl/PmsBrandServiceImpl.java
  6. 6 2
      forest-admin/admin-server/src/main/java/com/hwrj/cloud/admin/service/impl/UmsCompanyShareServiceImpl.java
  7. 7 6
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/controller/OmePreItemController.java
  8. 4 1
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/controller/UmsCompanyInfoController.java
  9. 13 0
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/dao/PmsProductDao.java
  10. 1 1
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/dao/UmsMemberDao.java
  11. 18 0
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/domain/BrandVO.java
  12. 2 0
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/domain/OmsPreItemDto.java
  13. 3 0
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/domain/UmsCompanyInfoDto.java
  14. 2 4
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/service/PmsPortalProductService.java
  15. 10 5
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/service/impl/PmsPortalProductServiceImpl.java
  16. 22 19
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/service/impl/PortalProductPulishServiceImpl.java
  17. 4 2
      forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/service/impl/UmsMemberServiceImpl.java
  18. 12 1
      forest-portal/portal-server/src/main/resources/dao/OmsPreItemDao.xml
  19. 12 0
      forest-portal/portal-server/src/main/resources/dao/PmsProductDao.xml
  20. 1 1
      forest-portal/portal-server/src/main/resources/dao/UmsOwnDataDao.xml
  21. 11 1
      sql/forest-mall-cloud/更新sql.sql

+ 25 - 0
forest-admin/admin-mbg/src/main/java/com/hwrj/cloud/admin/model/PmsBrand.java

@@ -7,6 +7,13 @@ import java.util.Date;
 public class PmsBrand implements Serializable {
     private Long id;
 
+    @ApiModelProperty(value = "供应商id")
+    private Long compId;
+
+    @ApiModelProperty(value = "供应商名称")
+    private String compName;
+
+    @ApiModelProperty(value = "品牌名称")
     private String name;
 
     @ApiModelProperty(value = "首字母")
@@ -58,6 +65,22 @@ public class PmsBrand implements Serializable {
         this.id = id;
     }
 
+    public Long getCompId() {
+        return compId;
+    }
+
+    public void setCompId(Long compId) {
+        this.compId = compId;
+    }
+
+    public String getCompName() {
+        return compName;
+    }
+
+    public void setCompName(String compName) {
+        this.compName = compName;
+    }
+
     public String getName() {
         return name;
     }
@@ -177,6 +200,8 @@ public class PmsBrand implements Serializable {
         sb.append(" [");
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
+        sb.append(", compId=").append(compId);
+        sb.append(", compName=").append(compName);
         sb.append(", name=").append(name);
         sb.append(", firstLetter=").append(firstLetter);
         sb.append(", sort=").append(sort);

+ 130 - 0
forest-admin/admin-mbg/src/main/java/com/hwrj/cloud/admin/model/PmsBrandExample.java

@@ -165,6 +165,136 @@ public class PmsBrandExample {
             return (Criteria) this;
         }
 
+        public Criteria andCompIdIsNull() {
+            addCriterion("comp_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdIsNotNull() {
+            addCriterion("comp_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdEqualTo(Long value) {
+            addCriterion("comp_id =", value, "compId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdNotEqualTo(Long value) {
+            addCriterion("comp_id <>", value, "compId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdGreaterThan(Long value) {
+            addCriterion("comp_id >", value, "compId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("comp_id >=", value, "compId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdLessThan(Long value) {
+            addCriterion("comp_id <", value, "compId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdLessThanOrEqualTo(Long value) {
+            addCriterion("comp_id <=", value, "compId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdIn(List<Long> values) {
+            addCriterion("comp_id in", values, "compId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdNotIn(List<Long> values) {
+            addCriterion("comp_id not in", values, "compId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdBetween(Long value1, Long value2) {
+            addCriterion("comp_id between", value1, value2, "compId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompIdNotBetween(Long value1, Long value2) {
+            addCriterion("comp_id not between", value1, value2, "compId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameIsNull() {
+            addCriterion("comp_name is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameIsNotNull() {
+            addCriterion("comp_name is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameEqualTo(String value) {
+            addCriterion("comp_name =", value, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameNotEqualTo(String value) {
+            addCriterion("comp_name <>", value, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameGreaterThan(String value) {
+            addCriterion("comp_name >", value, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameGreaterThanOrEqualTo(String value) {
+            addCriterion("comp_name >=", value, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameLessThan(String value) {
+            addCriterion("comp_name <", value, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameLessThanOrEqualTo(String value) {
+            addCriterion("comp_name <=", value, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameLike(String value) {
+            addCriterion("comp_name like", value, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameNotLike(String value) {
+            addCriterion("comp_name not like", value, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameIn(List<String> values) {
+            addCriterion("comp_name in", values, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameNotIn(List<String> values) {
+            addCriterion("comp_name not in", values, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameBetween(String value1, String value2) {
+            addCriterion("comp_name between", value1, value2, "compName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCompNameNotBetween(String value1, String value2) {
+            addCriterion("comp_name not between", value1, value2, "compName");
+            return (Criteria) this;
+        }
+
         public Criteria andNameIsNull() {
             addCriterion("name is null");
             return (Criteria) this;

+ 50 - 14
forest-admin/admin-mbg/src/main/resources/com/hwrj/cloud/admin/mapper/PmsBrandMapper.xml

@@ -3,6 +3,8 @@
 <mapper namespace="com.hwrj.cloud.admin.mapper.PmsBrandMapper">
   <resultMap id="BaseResultMap" type="com.hwrj.cloud.admin.model.PmsBrand">
     <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="comp_id" jdbcType="BIGINT" property="compId" />
+    <result column="comp_name" jdbcType="VARCHAR" property="compName" />
     <result column="name" jdbcType="VARCHAR" property="name" />
     <result column="first_letter" jdbcType="VARCHAR" property="firstLetter" />
     <result column="sort" jdbcType="INTEGER" property="sort" />
@@ -79,8 +81,8 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, name, first_letter, sort, factory_status, show_status, product_count, product_comment_count, 
-    logo, big_pic, create_id, create_time, update_id, update_time
+    id, comp_id, comp_name, name, first_letter, sort, factory_status, show_status, product_count, 
+    product_comment_count, logo, big_pic, create_id, create_time, update_id, update_time
   </sql>
   <sql id="Blob_Column_List">
     brand_story
@@ -137,16 +139,18 @@
     <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
       SELECT LAST_INSERT_ID()
     </selectKey>
-    insert into pms_brand (name, first_letter, sort, 
-      factory_status, show_status, product_count, 
-      product_comment_count, logo, big_pic, 
-      create_id, create_time, update_id, 
-      update_time, brand_story)
-    values (#{name,jdbcType=VARCHAR}, #{firstLetter,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, 
-      #{factoryStatus,jdbcType=INTEGER}, #{showStatus,jdbcType=INTEGER}, #{productCount,jdbcType=INTEGER}, 
-      #{productCommentCount,jdbcType=INTEGER}, #{logo,jdbcType=VARCHAR}, #{bigPic,jdbcType=VARCHAR}, 
-      #{createId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateId,jdbcType=BIGINT}, 
-      #{updateTime,jdbcType=TIMESTAMP}, #{brandStory,jdbcType=LONGVARCHAR})
+    insert into pms_brand (comp_id, comp_name, name, 
+      first_letter, sort, factory_status, 
+      show_status, product_count, product_comment_count, 
+      logo, big_pic, create_id, 
+      create_time, update_id, update_time, 
+      brand_story)
+    values (#{compId,jdbcType=BIGINT}, #{compName,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
+      #{firstLetter,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{factoryStatus,jdbcType=INTEGER}, 
+      #{showStatus,jdbcType=INTEGER}, #{productCount,jdbcType=INTEGER}, #{productCommentCount,jdbcType=INTEGER}, 
+      #{logo,jdbcType=VARCHAR}, #{bigPic,jdbcType=VARCHAR}, #{createId,jdbcType=BIGINT}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{updateId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, 
+      #{brandStory,jdbcType=LONGVARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.hwrj.cloud.admin.model.PmsBrand">
     <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@@ -154,6 +158,12 @@
     </selectKey>
     insert into pms_brand
     <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="compId != null">
+        comp_id,
+      </if>
+      <if test="compName != null">
+        comp_name,
+      </if>
       <if test="name != null">
         name,
       </if>
@@ -198,6 +208,12 @@
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="compId != null">
+        #{compId,jdbcType=BIGINT},
+      </if>
+      <if test="compName != null">
+        #{compName,jdbcType=VARCHAR},
+      </if>
       <if test="name != null">
         #{name,jdbcType=VARCHAR},
       </if>
@@ -254,6 +270,12 @@
       <if test="record.id != null">
         id = #{record.id,jdbcType=BIGINT},
       </if>
+      <if test="record.compId != null">
+        comp_id = #{record.compId,jdbcType=BIGINT},
+      </if>
+      <if test="record.compName != null">
+        comp_name = #{record.compName,jdbcType=VARCHAR},
+      </if>
       <if test="record.name != null">
         name = #{record.name,jdbcType=VARCHAR},
       </if>
@@ -304,6 +326,8 @@
   <update id="updateByExampleWithBLOBs" parameterType="map">
     update pms_brand
     set id = #{record.id,jdbcType=BIGINT},
+      comp_id = #{record.compId,jdbcType=BIGINT},
+      comp_name = #{record.compName,jdbcType=VARCHAR},
       name = #{record.name,jdbcType=VARCHAR},
       first_letter = #{record.firstLetter,jdbcType=VARCHAR},
       sort = #{record.sort,jdbcType=INTEGER},
@@ -325,6 +349,8 @@
   <update id="updateByExample" parameterType="map">
     update pms_brand
     set id = #{record.id,jdbcType=BIGINT},
+      comp_id = #{record.compId,jdbcType=BIGINT},
+      comp_name = #{record.compName,jdbcType=VARCHAR},
       name = #{record.name,jdbcType=VARCHAR},
       first_letter = #{record.firstLetter,jdbcType=VARCHAR},
       sort = #{record.sort,jdbcType=INTEGER},
@@ -345,6 +371,12 @@
   <update id="updateByPrimaryKeySelective" parameterType="com.hwrj.cloud.admin.model.PmsBrand">
     update pms_brand
     <set>
+      <if test="compId != null">
+        comp_id = #{compId,jdbcType=BIGINT},
+      </if>
+      <if test="compName != null">
+        comp_name = #{compName,jdbcType=VARCHAR},
+      </if>
       <if test="name != null">
         name = #{name,jdbcType=VARCHAR},
       </if>
@@ -392,7 +424,9 @@
   </update>
   <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.hwrj.cloud.admin.model.PmsBrand">
     update pms_brand
-    set name = #{name,jdbcType=VARCHAR},
+    set comp_id = #{compId,jdbcType=BIGINT},
+      comp_name = #{compName,jdbcType=VARCHAR},
+      name = #{name,jdbcType=VARCHAR},
       first_letter = #{firstLetter,jdbcType=VARCHAR},
       sort = #{sort,jdbcType=INTEGER},
       factory_status = #{factoryStatus,jdbcType=INTEGER},
@@ -410,7 +444,9 @@
   </update>
   <update id="updateByPrimaryKey" parameterType="com.hwrj.cloud.admin.model.PmsBrand">
     update pms_brand
-    set name = #{name,jdbcType=VARCHAR},
+    set comp_id = #{compId,jdbcType=BIGINT},
+      comp_name = #{compName,jdbcType=VARCHAR},
+      name = #{name,jdbcType=VARCHAR},
       first_letter = #{firstLetter,jdbcType=VARCHAR},
       sort = #{sort,jdbcType=INTEGER},
       factory_status = #{factoryStatus,jdbcType=INTEGER},

+ 6 - 64
forest-admin/admin-server/src/main/java/com/hwrj/cloud/admin/dto/PmsBrandParam.java

@@ -2,6 +2,7 @@ package com.hwrj.cloud.admin.dto;
 
 import com.hwrj.cloud.admin.validator.FlagValidator;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotEmpty;
@@ -10,7 +11,12 @@ import javax.validation.constraints.NotEmpty;
  * 品牌传递参数
  * Created by macro on 2018/4/26.
  */
+@Data
 public class PmsBrandParam {
+    @ApiModelProperty(value = "供应商id")
+    private Long compId;
+    @ApiModelProperty(value = "供应商名称")
+    private String compName;
     @ApiModelProperty(value = "品牌名称", required = true)
     @NotEmpty(message = "名称不能为空")
     private String name;
@@ -32,68 +38,4 @@ public class PmsBrandParam {
     private String bigPic;
     @ApiModelProperty(value = "品牌故事")
     private String brandStory;
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getFirstLetter() {
-        return firstLetter;
-    }
-
-    public void setFirstLetter(String firstLetter) {
-        this.firstLetter = firstLetter;
-    }
-
-    public Integer getSort() {
-        return sort;
-    }
-
-    public void setSort(Integer sort) {
-        this.sort = sort;
-    }
-
-    public Integer getFactoryStatus() {
-        return factoryStatus;
-    }
-
-    public void setFactoryStatus(Integer factoryStatus) {
-        this.factoryStatus = factoryStatus;
-    }
-
-    public Integer getShowStatus() {
-        return showStatus;
-    }
-
-    public void setShowStatus(Integer showStatus) {
-        this.showStatus = showStatus;
-    }
-
-    public String getLogo() {
-        return logo;
-    }
-
-    public void setLogo(String logo) {
-        this.logo = logo;
-    }
-
-    public String getBigPic() {
-        return bigPic;
-    }
-
-    public void setBigPic(String bigPic) {
-        this.bigPic = bigPic;
-    }
-
-    public String getBrandStory() {
-        return brandStory;
-    }
-
-    public void setBrandStory(String brandStory) {
-        this.brandStory = brandStory;
-    }
 }

+ 6 - 0
forest-admin/admin-server/src/main/java/com/hwrj/cloud/admin/service/impl/PmsBrandServiceImpl.java

@@ -10,6 +10,7 @@ import com.hwrj.cloud.admin.model.PmsBrandExample;
 import com.hwrj.cloud.admin.model.PmsProduct;
 import com.hwrj.cloud.admin.model.PmsProductExample;
 import com.hwrj.cloud.admin.service.PmsBrandService;
+import com.hwrj.cloud.admin.util.CurrUserUtil;
 import com.hwrj.cloud.common.exception.GlobalException;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -97,6 +98,8 @@ public class PmsBrandServiceImpl implements PmsBrandService {
 
     @Override
     public List<PmsBrand> listBrand(String keyword, int pageNum, int pageSize) {
+        long compId = CurrUserUtil.getCompIdInfo();
+
         PageHelper.startPage(pageNum, pageSize);
         PmsBrandExample pmsBrandExample = new PmsBrandExample();
         pmsBrandExample.setOrderByClause("sort desc");
@@ -104,6 +107,9 @@ public class PmsBrandServiceImpl implements PmsBrandService {
         if (!StringUtils.isEmpty(keyword)) {
             criteria.andNameLike("%" + keyword + "%");
         }
+        if(!StringUtils.isEmpty(compId)){
+            criteria.andCompIdEqualTo(compId);
+        }
         return brandMapper.selectByExample(pmsBrandExample);
     }
 

+ 6 - 2
forest-admin/admin-server/src/main/java/com/hwrj/cloud/admin/service/impl/UmsCompanyShareServiceImpl.java

@@ -13,6 +13,7 @@ import com.hwrj.cloud.common.util.ShareCodeUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 import java.util.Date;
 import java.util.List;
@@ -69,8 +70,11 @@ public class UmsCompanyShareServiceImpl implements UmsCompanyShareService {
         PageHelper.startPage(pageNo,pageSize);
         List<UmsCompanyShare> shares = umsCompanyShareMapper.selectByExample(umsCompanyShareExample);
         for (UmsCompanyShare share : shares) {
-            UmsMember umsMember = umsMemberMapper.selectByPrimaryKey(share.getMemberId());
-            share.setMember(umsMember.getNickname());
+            Long memberId = share.getMemberId();
+            if(!StringUtils.isEmpty(memberId)){
+                UmsMember umsMember = umsMemberMapper.selectByPrimaryKey(memberId);
+                share.setMember(umsMember.getNickname());
+            }
         }
         return shares;
     }

+ 7 - 6
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/controller/OmePreItemController.java

@@ -6,6 +6,7 @@ import com.hwrj.cloud.common.api.CommonResult;
 import com.hwrj.cloud.portal.dao.OmsPreItemDao;
 import com.hwrj.cloud.portal.model.OmsPreItem;
 import com.hwrj.cloud.portal.model.UmsMember;
+import com.hwrj.cloud.portal.model.UmsMemberPlatform;
 import com.hwrj.cloud.portal.service.OmsPreItemService;
 import com.hwrj.cloud.portal.service.UmsMemberService;
 import com.hwrj.cloud.portal.util.MemberUtil;
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
+import java.util.Map;
 
 @Controller
 @Api(tags = "OmePreItemController", description = "预购信息处理")
@@ -57,17 +59,16 @@ public class OmePreItemController {
         OmsPreItem omsPreItemDetail = omsPreItemService.getOmsPreItemDetail(preId);
         return CommonResult.success(omsPreItemDetail);
     }
-
+    @Autowired
+    private UmsMemberService memberService;
     @GetMapping(value = "/own")
     @ApiOperation("获取有意向详情")
     @ResponseBody
     public CommonResult getOwn(@RequestParam(defaultValue = "10") int pageSize,
                                @RequestParam(defaultValue = "1") int pageNO,HttpServletRequest request){
-        UmsMember currentMember = umsMemberService.getCurrentMember();
-        List<OmsPreItemDao> omsPreItemListOwn = omsPreItemService.getOmsPreItemListOwn(currentMember.getId(), pageSize, pageNO);
-
-
-
+        Map<String,Object> map = memberService.getCurrentWxUser();
+        UmsMemberPlatform umsMemberPlatform = (UmsMemberPlatform) map.get("wxUsers");
+        List<OmsPreItemDao> omsPreItemListOwn = omsPreItemService.getOmsPreItemListOwn(umsMemberPlatform.getId(), pageSize, pageNO);
         return CommonResult.success(CommonPage.restPage(omsPreItemListOwn));
     }
 

+ 4 - 1
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/controller/UmsCompanyInfoController.java

@@ -1,6 +1,7 @@
 package com.hwrj.cloud.portal.controller;
 
 import com.hwrj.cloud.common.api.CommonResult;
+import com.hwrj.cloud.portal.domain.BrandVO;
 import com.hwrj.cloud.portal.domain.UmsCompanyInfoDto;
 import com.hwrj.cloud.portal.domain.UmsMemberOriginDto;
 import com.hwrj.cloud.portal.model.PmsProduct;
@@ -36,9 +37,11 @@ public class UmsCompanyInfoController {
     public CommonResult detail(@RequestParam(value = "compId",required = true)Long compId){
         UmsCompanyInfoDto infoDto = umsCompanyInfoService.detailInfo(compId);
         List<UmsMemberOriginDto> umsMemberOriginDtos = umsMemberOriginService.detailListOfCompany(infoDto.getId());
-        List<PmsProduct> productByCompanyId = productService.getProductByCompanyId(infoDto.getId());
         infoDto.setOrigines(umsMemberOriginDtos);
+        List<PmsProduct> productByCompanyId = productService.getProductByCompanyId(infoDto.getId());
         infoDto.setProducts(productByCompanyId);
+        List<BrandVO> brands= productService.getPmsPrands(compId);
+        infoDto.setBrands(brands);
         return CommonResult.success(infoDto);
     }
     @ApiOperation("搜索供应商列表")

+ 13 - 0
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/dao/PmsProductDao.java

@@ -0,0 +1,13 @@
+package com.hwrj.cloud.portal.dao;
+
+import com.hwrj.cloud.portal.domain.BrandVO;
+import org.apache.ibatis.annotations.Param;
+import org.mapstruct.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface PmsProductDao {
+
+    List<BrandVO> selectBandList(@Param("compId") Long compId);
+}

+ 1 - 1
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/dao/UmsMemberDao.java

@@ -5,5 +5,5 @@ import io.lettuce.core.dynamic.annotation.Param;
 import java.util.Map;
 
 public interface UmsMemberDao {
-    public Map<String,Object> getOwnData(@Param("memberId")Long memberId);
+    public Map<String,Object> getOwnData(@Param("memberId")Long memberId,@Param("wxUserId")Long wxUserId);
 }

+ 18 - 0
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/domain/BrandVO.java

@@ -0,0 +1,18 @@
+package com.hwrj.cloud.portal.domain;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@Api
+public class BrandVO implements Serializable {
+
+    @ApiModelProperty(value = "品牌id")
+    private Long brandId;
+
+    @ApiModelProperty(value = "品牌名称")
+    private String brandName;
+}

+ 2 - 0
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/domain/OmsPreItemDto.java

@@ -10,4 +10,6 @@ public @Data class OmsPreItemDto extends OmsPreItem {
 
     @ApiModelProperty("产品信息")
     private PmsProduct pmsProduct;
+
+    private String headimgurl;
 }

+ 3 - 0
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/domain/UmsCompanyInfoDto.java

@@ -22,4 +22,7 @@ public class UmsCompanyInfoDto extends UmsCompanyInfo {
     @ApiModelProperty("产品集合")
     private List<PmsProduct> products;
 
+    @ApiModelProperty("品牌集合")
+    private List<BrandVO> brands;
+
 }

+ 2 - 4
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/service/PmsPortalProductService.java

@@ -1,10 +1,7 @@
 package com.hwrj.cloud.portal.service;
 
-import com.hwrj.cloud.portal.domain.CartProduct;
-import com.hwrj.cloud.portal.domain.PromotionProduct;
+import com.hwrj.cloud.portal.domain.*;
 import com.hwrj.cloud.portal.model.PmsProduct;
-import com.hwrj.cloud.portal.domain.PmsPortalProductDetail;
-import com.hwrj.cloud.portal.domain.PmsProductCategoryNode;
 
 import java.util.List;
 
@@ -73,4 +70,5 @@ public interface PmsPortalProductService {
      */
     List<PmsProduct> getProductByCompanyId(Long companyId);
 
+    List<BrandVO> getPmsPrands(Long compId);
 }

+ 10 - 5
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/service/impl/PmsPortalProductServiceImpl.java

@@ -3,13 +3,11 @@ package com.hwrj.cloud.portal.service.impl;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.PageHelper;
-import com.hwrj.cloud.portal.domain.CartProduct;
-import com.hwrj.cloud.portal.domain.PromotionProduct;
+import com.hwrj.cloud.portal.dao.PmsProductDao;
+import com.hwrj.cloud.portal.dao.PortalProductDao;
+import com.hwrj.cloud.portal.domain.*;
 import com.hwrj.cloud.portal.mapper.*;
 import com.hwrj.cloud.portal.model.*;
-import com.hwrj.cloud.portal.dao.PortalProductDao;
-import com.hwrj.cloud.portal.domain.PmsPortalProductDetail;
-import com.hwrj.cloud.portal.domain.PmsProductCategoryNode;
 import com.hwrj.cloud.portal.service.CouponService;
 import com.hwrj.cloud.portal.service.PmsPortalProductService;
 import org.springframework.beans.BeanUtils;
@@ -262,6 +260,8 @@ public class PmsPortalProductServiceImpl implements PmsPortalProductService {
     public PmsProduct getPmsProductById(Long productId) {
         return productMapper.selectByPrimaryKey(productId);
     }
+    @Autowired
+    private PmsProductDao pmsProductDao;
 
     @Override
     public List<PmsProduct> getProductByCompanyId(Long companyId) {
@@ -276,6 +276,11 @@ public class PmsPortalProductServiceImpl implements PmsPortalProductService {
         return pmsProducts;
     }
 
+    @Override
+    public List<BrandVO> getPmsPrands(Long compId) {
+        return pmsProductDao.selectBandList(compId);
+    }
+
 
     /**
      * 初始对象转化为节点对象

+ 22 - 19
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/service/impl/PortalProductPulishServiceImpl.java

@@ -19,6 +19,7 @@ import java.lang.reflect.Method;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 @Slf4j
@@ -57,23 +58,24 @@ public class PortalProductPulishServiceImpl implements PortalProductPulishServic
     public int create(PmsProductVo productVo) {
         int count;
         //创建商品
-//        long compId = CurrUserUtil.getCompId();
-//        if(StringUtils.isEmpty(compId)){
-//            throw new RuntimeException("没有绑定供应商无法新增!");
-//        }
+        long compId = productVo.getCompId();
+        if (StringUtils.isEmpty(compId)) {
+            throw new RuntimeException("没有绑定供应商无法新增!");
+        }
 //        productParam.setCompId(compId);
 
-        UmsMember currentMember = memberService.getCurrentMember();
-//        if (currentMember == null){
-//            Asserts.fail("登录异常");
-//        }
-//        String type = currentMember.getType();
-//        if (!"供应商".equals(type)){
+        Map<String, Object> map = memberService.getCurrentWxUser();
+        UmsMemberPlatform umsMemberPlatform = (UmsMemberPlatform) map.get("wxUsers");
+        if (umsMemberPlatform == null) {
+            Asserts.fail("登录异常");
+        }
+//        UmsCompanyShare umsCompanyShare = (UmsCompanyShare) map.get("company");
+//        if (umsCompanyShare == null) {
 //            Asserts.fail("没有进行供应商认证");
 //        }
-//        productVo.setCompId(currentMember.getCompId());
-//        productVo.setCompName(currentMember.getCompanyInfo());
-        productVo.setCreateId((long) currentMember.getId());
+//        productVo.setCompId(umsCompanyShare.getCompId());
+//        productVo.setCompName(umsCompanyShare.getCompName());
+        productVo.setCreateId(umsMemberPlatform.getId());
         productVo.setCreateType(1);
         productVo.setCreateTime(new Date());
         productVo.setDeleteStatus(0);
@@ -144,16 +146,16 @@ public class PortalProductPulishServiceImpl implements PortalProductPulishServic
     }
 
     @Override
-    public List<PmsProduct> list( Integer pageSize, Integer pageNo) {
+    public List<PmsProduct> list(Integer pageSize, Integer pageNo) {
         Long memberId = memberService.getMemberId();
-        if (memberId == null){
+        if (memberId == null) {
             Asserts.fail("请先登录");
         }
         PmsProductExample example = new PmsProductExample();
         PmsProductExample.Criteria criteria = example.createCriteria();
         criteria.andCreateIdEqualTo(memberId);
         criteria.andCreateTypeEqualTo(1);
-        PageHelper.startPage(pageNo,pageSize);
+        PageHelper.startPage(pageNo, pageSize);
         List<PmsProduct> pmsProducts = productMapper.selectByExample(example);
         return pmsProducts;
 
@@ -161,11 +163,11 @@ public class PortalProductPulishServiceImpl implements PortalProductPulishServic
 
     @Override
     public PmsProduct detail(Long id) {
-        if (id  == null){
+        if (id == null) {
             Asserts.fail("获取详情失败");
         }
         Long memberId = memberService.getMemberId();
-        if (memberId== null){
+        if (memberId == null) {
             Asserts.fail("获取详情失败");
         }
         PmsProductExample example = new PmsProductExample();
@@ -174,7 +176,7 @@ public class PortalProductPulishServiceImpl implements PortalProductPulishServic
         criteria.andCreateTypeEqualTo(1);
         criteria.andIdEqualTo(id);
         List<PmsProduct> pmsProducts = productMapper.selectByExample(example);
-        if (pmsProducts != null&&pmsProducts.size()>0){
+        if (pmsProducts != null && pmsProducts.size() > 0) {
             return pmsProducts.get(0);
         }
 
@@ -208,6 +210,7 @@ public class PortalProductPulishServiceImpl implements PortalProductPulishServic
 
     /**
      * 处理sku编码
+     *
      * @param skuStockList
      * @param productId
      */

+ 4 - 2
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/service/impl/UmsMemberServiceImpl.java

@@ -208,8 +208,9 @@ public class UmsMemberServiceImpl implements UmsMemberService {
 
                 throw  new RuntimeException("登录失败");
             }
-            map.put("wxUsers",platforms.get(0));
-            Map<String, Object> ownData = umsMemberDao.getOwnData(umsMember.getId());
+            UmsMemberPlatform umsMemberPlatform = platforms.get(0);
+            map.put("wxUsers",umsMemberPlatform);
+            Map<String, Object> ownData = umsMemberDao.getOwnData(umsMember.getId(),umsMemberPlatform.getId());
             map.put("pre",ownData);
             getCompany(umsMember, map);
         }
@@ -220,6 +221,7 @@ public class UmsMemberServiceImpl implements UmsMemberService {
         UmsCompanyShareExample example=new UmsCompanyShareExample();
         UmsCompanyShareExample.Criteria criteria = example.createCriteria();
         criteria.andMemberIdEqualTo(umsMember.getId());
+        criteria.andStatusEqualTo(0);
         List<UmsCompanyShare> umsCompanyShares = umsCompanyShareMapper.selectByExample(example);
         if(umsCompanyShares.size()>0){
             map.put("company",umsCompanyShares.get(0));

+ 12 - 1
forest-portal/portal-server/src/main/resources/dao/OmsPreItemDao.xml

@@ -4,6 +4,7 @@
   <resultMap id="BaseResultMap" type="com.hwrj.cloud.portal.domain.OmsPreItemDto">
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="product_id" jdbcType="BIGINT" property="productId" />
+    <result column="icon" jdbcType="VARCHAR" property="headimgurl" />
     <result column="member_id" jdbcType="BIGINT" property="memberId" />
     <result column="company_id" jdbcType="BIGINT" property="companyId" />
     <result column="push_id" jdbcType="BIGINT" property="pushId" />
@@ -26,7 +27,17 @@
     <collection property="pmsProduct" ofType="com.hwrj.cloud.portal.model.PmsProduct" select="selectByProductId" column="product_id"/>
   </resultMap>
   <select id="selectOmsPreItemDao" resultMap="BaseResultMap" parameterType="java.lang.Long">
-    select a.* from oms_pre_item a left join pms_product b on a.product_id=b.id where a.delete_status=0 and b.id is not null and b.delete_status=0
+    SELECT DISTINCT
+    c.icon,
+    a.*
+    FROM
+    oms_pre_item a
+    LEFT JOIN pms_product b ON a.product_id = b.id
+    LEFT JOIN ums_member c ON c.id = a.member_id
+    WHERE
+    a.delete_status = 0
+    AND b.id IS NOT NULL
+    AND b.delete_status = 0
     <if test="memberId != null">
       and a.member_id = #{memberId}
     </if>

+ 12 - 0
forest-portal/portal-server/src/main/resources/dao/PmsProductDao.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hwrj.cloud.portal.dao.PmsProductDao">
+
+    <select id="selectBandList" resultType="com.hwrj.cloud.portal.domain.BrandVO">
+        SELECT
+            a.id AS brandId,
+            a.`name` AS brandName
+        FROM
+            pms_brand a WHERE a.comp_id = #{compId}
+    </select>
+</mapper>

+ 1 - 1
forest-portal/portal-server/src/main/resources/dao/UmsOwnDataDao.xml

@@ -4,7 +4,7 @@
     <select id="getOwnData" parameterType="java.lang.Long" resultType="java.util.Map">
         SELECT
             count( 0 ) AS want,
-            ( SELECT count(0) FROM oms_pre_item WHERE push_id = #{memberId} )  as own
+            ( SELECT count(0) FROM oms_pre_item WHERE push_id = #{wxUserId} )  as own
         FROM
             `oms_pre_item`
         WHERE

+ 11 - 1
sql/forest-mall-cloud/更新sql.sql

@@ -190,4 +190,14 @@ WHERE
 			a.delete_status = 0
 	);
 
-
+# 品牌表新增字段
+ALTER TABLE pms_brand ADD COLUMN `comp_id` BIGINT (20) DEFAULT NULL COMMENT '供应商id' AFTER `id`;
+
+ALTER TABLE pms_brand ADD COLUMN `comp_name` VARCHAR (100) DEFAULT NULL COMMENT '供应商名称' AFTER `comp_id`;
+# 更新语句
+UPDATE pms_brand a
+JOIN pms_product b
+SET a.comp_id = b.comp_id,
+ a.comp_name = b.comp_name
+WHERE
+	a.id = b.brand_id