wuxw hace 6 años
padre
commit
5cca14560f
Se han modificado 32 ficheros con 1118 adiciones y 36 borrados
  1. 1 1
      java110-bean/src/main/java/com/java110/dto/productCategory/ProductCategoryDto.java
  2. 125 0
      java110-bean/src/main/java/com/java110/dto/product/ProductDto.java
  3. 1 1
      java110-bean/src/main/java/com/java110/po/productCategory/ProductCategoryPo.java
  4. 102 0
      java110-bean/src/main/java/com/java110/po/product/ProductPo.java
  5. 1 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  6. 169 0
      java110-db/src/main/resources/mapper/goods/ProductServiceDaoImplMapper.xml
  7. 37 20
      java110-generator/src/main/resources/newBack/template_1.json
  8. 39 0
      java110-generator/src/main/resources/newBack/template_productCategory.json
  9. 2 2
      java110-interface/src/main/java/com/java110/intf/goods/IProductCategoryInnerServiceSMO.java
  10. 53 0
      java110-interface/src/main/java/com/java110/intf/goods/IProductInnerServiceSMO.java
  11. 117 0
      service-goods/src/main/java/com/java110/goods/api/ProductApi.java
  12. 2 2
      service-goods/src/main/java/com/java110/goods/api/ProductCategoryApi.java
  13. 17 0
      service-goods/src/main/java/com/java110/goods/bmo/product/IDeleteProductBMO.java
  14. 16 0
      service-goods/src/main/java/com/java110/goods/bmo/product/IGetProductBMO.java
  15. 17 0
      service-goods/src/main/java/com/java110/goods/bmo/product/ISaveProductBMO.java
  16. 17 0
      service-goods/src/main/java/com/java110/goods/bmo/product/IUpdateProductBMO.java
  17. 34 0
      service-goods/src/main/java/com/java110/goods/bmo/product/impl/DeleteProductBMOImpl.java
  18. 44 0
      service-goods/src/main/java/com/java110/goods/bmo/product/impl/GetProductBMOImpl.java
  19. 38 0
      service-goods/src/main/java/com/java110/goods/bmo/product/impl/SaveProductBMOImpl.java
  20. 34 0
      service-goods/src/main/java/com/java110/goods/bmo/product/impl/UpdateProductBMOImpl.java
  21. 1 1
      service-goods/src/main/java/com/java110/goods/bmo/productCategory/IDeleteProductCategoryBMO.java
  22. 1 1
      service-goods/src/main/java/com/java110/goods/bmo/productCategory/IGetProductCategoryBMO.java
  23. 1 1
      service-goods/src/main/java/com/java110/goods/bmo/productCategory/ISaveProductCategoryBMO.java
  24. 1 1
      service-goods/src/main/java/com/java110/goods/bmo/productCategory/IUpdateProductCategoryBMO.java
  25. 1 1
      service-goods/src/main/java/com/java110/goods/bmo/productCategory/impl/DeleteProductCategoryBMOImpl.java
  26. 1 1
      service-goods/src/main/java/com/java110/goods/bmo/productCategory/impl/GetProductCategoryBMOImpl.java
  27. 1 1
      service-goods/src/main/java/com/java110/goods/bmo/productCategory/impl/SaveProductCategoryBMOImpl.java
  28. 1 1
      service-goods/src/main/java/com/java110/goods/bmo/productCategory/impl/UpdateProductCategoryBMOImpl.java
  29. 61 0
      service-goods/src/main/java/com/java110/goods/dao/IProductServiceDao.java
  30. 98 0
      service-goods/src/main/java/com/java110/goods/dao/impl/ProductServiceDaoImpl.java
  31. 2 2
      service-goods/src/main/java/com/java110/goods/smo/impl/ProductCategoryInnerServiceSMOImpl.java
  32. 83 0
      service-goods/src/main/java/com/java110/goods/smo/impl/ProductInnerServiceSMOImpl.java

+ 1 - 1
java110-bean/src/main/java/com/java110/dto/productCategory/ProductCategoryDto.java

@@ -1,4 +1,4 @@
-package com.java110.dto.productCategory;
+package com.java110.dto.product;
 
 import com.java110.dto.PageDto;
 import java.io.Serializable;

+ 125 - 0
java110-bean/src/main/java/com/java110/dto/product/ProductDto.java

@@ -0,0 +1,125 @@
+package com.java110.dto.product;
+
+import com.java110.dto.PageDto;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @ClassName FloorDto
+ * @Description 产品数据层封装
+ * @Author wuxw
+ * @Date 2019/4/24 8:52
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+public class ProductDto extends PageDto implements Serializable {
+
+    private String productId;
+private String unitName;
+private String isPostage;
+private String sort;
+private String storeId;
+private String barCode;
+private String postage;
+private String prodName;
+private String state;
+private String keyword;
+private String prodDesc;
+private String categoryId;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getProductId() {
+        return productId;
+    }
+public void setProductId(String productId) {
+        this.productId = productId;
+    }
+public String getUnitName() {
+        return unitName;
+    }
+public void setUnitName(String unitName) {
+        this.unitName = unitName;
+    }
+public String getIsPostage() {
+        return isPostage;
+    }
+public void setIsPostage(String isPostage) {
+        this.isPostage = isPostage;
+    }
+public String getSort() {
+        return sort;
+    }
+public void setSort(String sort) {
+        this.sort = sort;
+    }
+public String getStoreId() {
+        return storeId;
+    }
+public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+public String getBarCode() {
+        return barCode;
+    }
+public void setBarCode(String barCode) {
+        this.barCode = barCode;
+    }
+public String getPostage() {
+        return postage;
+    }
+public void setPostage(String postage) {
+        this.postage = postage;
+    }
+public String getProdName() {
+        return prodName;
+    }
+public void setProdName(String prodName) {
+        this.prodName = prodName;
+    }
+public String getState() {
+        return state;
+    }
+public void setState(String state) {
+        this.state = state;
+    }
+public String getKeyword() {
+        return keyword;
+    }
+public void setKeyword(String keyword) {
+        this.keyword = keyword;
+    }
+public String getProdDesc() {
+        return prodDesc;
+    }
+public void setProdDesc(String prodDesc) {
+        this.prodDesc = prodDesc;
+    }
+public String getCategoryId() {
+        return categoryId;
+    }
+public void setCategoryId(String categoryId) {
+        this.categoryId = categoryId;
+    }
+
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+}

+ 1 - 1
java110-bean/src/main/java/com/java110/po/productCategory/ProductCategoryPo.java

@@ -1,4 +1,4 @@
-package com.java110.po.productCategory;
+package com.java110.po.product;
 
 import java.io.Serializable;
 import java.util.Date;

+ 102 - 0
java110-bean/src/main/java/com/java110/po/product/ProductPo.java

@@ -0,0 +1,102 @@
+package com.java110.po.product;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class ProductPo implements Serializable {
+
+    private String productId;
+private String unitName;
+private String isPostage;
+private String statusCd = "0";
+private String sort;
+private String storeId;
+private String barCode;
+private String postage;
+private String prodName;
+private String state;
+private String keyword;
+private String prodDesc;
+private String categoryId;
+public String getProductId() {
+        return productId;
+    }
+public void setProductId(String productId) {
+        this.productId = productId;
+    }
+public String getUnitName() {
+        return unitName;
+    }
+public void setUnitName(String unitName) {
+        this.unitName = unitName;
+    }
+public String getIsPostage() {
+        return isPostage;
+    }
+public void setIsPostage(String isPostage) {
+        this.isPostage = isPostage;
+    }
+public String getStatusCd() {
+        return statusCd;
+    }
+public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+public String getSort() {
+        return sort;
+    }
+public void setSort(String sort) {
+        this.sort = sort;
+    }
+public String getStoreId() {
+        return storeId;
+    }
+public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+public String getBarCode() {
+        return barCode;
+    }
+public void setBarCode(String barCode) {
+        this.barCode = barCode;
+    }
+public String getPostage() {
+        return postage;
+    }
+public void setPostage(String postage) {
+        this.postage = postage;
+    }
+public String getProdName() {
+        return prodName;
+    }
+public void setProdName(String prodName) {
+        this.prodName = prodName;
+    }
+public String getState() {
+        return state;
+    }
+public void setState(String state) {
+        this.state = state;
+    }
+public String getKeyword() {
+        return keyword;
+    }
+public void setKeyword(String keyword) {
+        this.keyword = keyword;
+    }
+public String getProdDesc() {
+        return prodDesc;
+    }
+public void setProdDesc(String prodDesc) {
+        this.prodDesc = prodDesc;
+    }
+public String getCategoryId() {
+        return categoryId;
+    }
+public void setCategoryId(String categoryId) {
+        this.categoryId = categoryId;
+    }
+
+
+
+}

+ 1 - 0
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java

@@ -156,6 +156,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_typeCd = "85";
     public static final String CODE_PREFIX_docId = "86";
     public static final String CODE_PREFIX_categoryId = "87";
+    public static final String CODE_PREFIX_productId = "90";
 
 
 

+ 169 - 0
java110-db/src/main/resources/mapper/goods/ProductServiceDaoImplMapper.xml

@@ -0,0 +1,169 @@
+<?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="productServiceDaoImpl">
+
+
+
+
+
+    <!-- 保存产品信息 add by wuxw 2018-07-03 -->
+    <insert id="saveProductInfo" parameterType="Map">
+        insert into product(
+product_id,unit_name,is_postage,sort,store_id,bar_code,postage,prod_name,state,keyword,prod_desc,category_id
+) values (
+#{productId},#{unitName},#{isPostage},#{sort},#{storeId},#{barCode},#{postage},#{prodName},#{state},#{keyword},#{prodDesc},#{categoryId}
+)
+    </insert>
+
+
+
+    <!-- 查询产品信息 add by wuxw 2018-07-03 -->
+    <select id="getProductInfo" parameterType="Map" resultType="Map">
+        select  t.product_id,t.product_id productId,t.unit_name,t.unit_name unitName,t.is_postage,t.is_postage isPostage,t.status_cd,t.status_cd statusCd,t.sort,t.store_id,t.store_id storeId,t.bar_code,t.bar_code barCode,t.postage,t.prod_name,t.prod_name prodName,t.state,t.keyword,t.prod_desc,t.prod_desc prodDesc,t.category_id,t.category_id categoryId 
+from product t 
+where 1 =1 
+<if test="productId !=null and productId != ''">
+   and t.product_id= #{productId}
+</if> 
+<if test="unitName !=null and unitName != ''">
+   and t.unit_name= #{unitName}
+</if> 
+<if test="isPostage !=null and isPostage != ''">
+   and t.is_postage= #{isPostage}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="sort !=null and sort != ''">
+   and t.sort= #{sort}
+</if> 
+<if test="storeId !=null and storeId != ''">
+   and t.store_id= #{storeId}
+</if> 
+<if test="barCode !=null and barCode != ''">
+   and t.bar_code= #{barCode}
+</if> 
+<if test="postage !=null and postage != ''">
+   and t.postage= #{postage}
+</if> 
+<if test="prodName !=null and prodName != ''">
+   and t.prod_name= #{prodName}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="keyword !=null and keyword != ''">
+   and t.keyword= #{keyword}
+</if> 
+<if test="prodDesc !=null and prodDesc != ''">
+   and t.prod_desc= #{prodDesc}
+</if> 
+<if test="categoryId !=null and categoryId != ''">
+   and t.category_id= #{categoryId}
+</if> 
+order by t.create_time desc
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改产品信息 add by wuxw 2018-07-03 -->
+    <update id="updateProductInfo" parameterType="Map">
+        update  product t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="unitName !=null and unitName != ''">
+, t.unit_name= #{unitName}
+</if> 
+<if test="isPostage !=null and isPostage != ''">
+, t.is_postage= #{isPostage}
+</if> 
+<if test="sort !=null and sort != ''">
+, t.sort= #{sort}
+</if> 
+<if test="storeId !=null and storeId != ''">
+, t.store_id= #{storeId}
+</if> 
+<if test="barCode !=null and barCode != ''">
+, t.bar_code= #{barCode}
+</if> 
+<if test="postage !=null and postage != ''">
+, t.postage= #{postage}
+</if> 
+<if test="prodName !=null and prodName != ''">
+, t.prod_name= #{prodName}
+</if> 
+<if test="state !=null and state != ''">
+, t.state= #{state}
+</if> 
+<if test="keyword !=null and keyword != ''">
+, t.keyword= #{keyword}
+</if> 
+<if test="prodDesc !=null and prodDesc != ''">
+, t.prod_desc= #{prodDesc}
+</if> 
+<if test="categoryId !=null and categoryId != ''">
+, t.category_id= #{categoryId}
+</if> 
+ where 1=1 <if test="productId !=null and productId != ''">
+and t.product_id= #{productId}
+</if> 
+
+    </update>
+
+    <!-- 查询产品数量 add by wuxw 2018-07-03 -->
+     <select id="queryProductsCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from product t 
+where 1 =1 
+<if test="productId !=null and productId != ''">
+   and t.product_id= #{productId}
+</if> 
+<if test="unitName !=null and unitName != ''">
+   and t.unit_name= #{unitName}
+</if> 
+<if test="isPostage !=null and isPostage != ''">
+   and t.is_postage= #{isPostage}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="sort !=null and sort != ''">
+   and t.sort= #{sort}
+</if> 
+<if test="storeId !=null and storeId != ''">
+   and t.store_id= #{storeId}
+</if> 
+<if test="barCode !=null and barCode != ''">
+   and t.bar_code= #{barCode}
+</if> 
+<if test="postage !=null and postage != ''">
+   and t.postage= #{postage}
+</if> 
+<if test="prodName !=null and prodName != ''">
+   and t.prod_name= #{prodName}
+</if> 
+<if test="state !=null and state != ''">
+   and t.state= #{state}
+</if> 
+<if test="keyword !=null and keyword != ''">
+   and t.keyword= #{keyword}
+</if> 
+<if test="prodDesc !=null and prodDesc != ''">
+   and t.prod_desc= #{prodDesc}
+</if> 
+<if test="categoryId !=null and categoryId != ''">
+   and t.category_id= #{categoryId}
+</if> 
+
+
+     </select>
+
+</mapper>

+ 37 - 20
java110-generator/src/main/resources/newBack/template_1.json

@@ -1,38 +1,55 @@
 {
   "autoMove": false,
-  "id": "categoryId",
-  "name": "productCategory",
-  "desc": "产品目录",
-  "shareParam": "categoryId",
-  "shareColumn": "category_id",
+  "id": "productId",
+  "name": "product",
+  "desc": "产品",
+  "shareParam": "storeId",
+  "shareColumn": "store_id",
   "shareName": "goods",
-  "tableName": "product_category",
+  "tableName": "product",
   "param": {
-    "categoryId": "category_id",
-    "categoryName": "category_name",
-    "parentCategoryId": "parent_category_id",
-    "categoryLevel": "category_level",
-    "seq": "seq",
-    "isShow": "is_show",
+    "productId": "product_id",
     "storeId": "store_id",
+    "prodName": "prod_name",
+    "prodDesc": "prod_desc",
+    "keyword": "keyword",
+    "barCode": "bar_code",
+    "categoryId": "category_id",
+    "unitName": "unit_name",
+    "state": "state",
+    "sort": "sort",
+    "postage": "postage",
+    "isPostage": "is_postage",
     "statusCd": "status_cd"
   },
   "required": [
     {
-      "code": "categoryName",
-      "msg": "目录名称不能为空"
+      "code": "prodName",
+      "msg": "产品名称不能为空"
+    },
+    {
+      "code": "storeId",
+      "msg": "商户不能为空"
+    },
+    {
+      "code": "keyword",
+      "msg": "关键字不能为空"
+    },
+    {
+      "code": "categoryId",
+      "msg": "产品目录不能为空"
     },
     {
-      "code": "categoryLevel",
-      "msg": "目录级别不能为空"
+      "code": "unitName",
+      "msg": "单位不能为空"
     },
     {
-      "code": "seq",
-      "msg": "顺序不能为空"
+      "code": "sort",
+      "msg": "排序不能为空"
     },
     {
-      "code": "isShow",
-      "msg": "是否显示不能为空"
+      "code": "isPostage",
+      "msg": "是否包邮不能为空"
     }
   ]
 }

+ 39 - 0
java110-generator/src/main/resources/newBack/template_productCategory.json

@@ -0,0 +1,39 @@
+{
+  "autoMove": false,
+  "id": "categoryId",
+  "name": "productCategory",
+  "desc": "产品目录",
+  "shareParam": "categoryId",
+  "shareColumn": "category_id",
+  "shareName": "goods",
+  "tableName": "product_category",
+  "param": {
+    "categoryId": "category_id",
+    "categoryName": "category_name",
+    "parentCategoryId": "parent_category_id",
+    "categoryLevel": "category_level",
+    "seq": "seq",
+    "isShow": "is_show",
+    "storeId": "store_id",
+    "statusCd": "status_cd"
+  },
+  "required": [
+    {
+      "code": "categoryName",
+      "msg": "目录名称不能为空"
+    },
+    {
+      "code": "categoryLevel",
+      "msg": "目录级别不能为空"
+    },
+    {
+      "code": "seq",
+      "msg": "顺序不能为空"
+    },
+    {
+      "code": "isShow",
+      "msg": "是否显示不能为空"
+    }
+  ]
+}
+

+ 2 - 2
java110-interface/src/main/java/com/java110/intf/goods/IProductCategoryInnerServiceSMO.java

@@ -1,8 +1,8 @@
 package com.java110.intf.goods;
 
 import com.java110.config.feign.FeignConfiguration;
-import com.java110.dto.productCategory.ProductCategoryDto;
-import com.java110.po.productCategory.ProductCategoryPo;
+import com.java110.dto.product.ProductCategoryDto;
+import com.java110.po.product.ProductCategoryPo;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;

+ 53 - 0
java110-interface/src/main/java/com/java110/intf/goods/IProductInnerServiceSMO.java

@@ -0,0 +1,53 @@
+package com.java110.intf.goods;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.product.ProductDto;
+import com.java110.po.product.ProductPo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * @ClassName IProductInnerServiceSMO
+ * @Description 产品接口类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "goods-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/productApi")
+public interface IProductInnerServiceSMO {
+
+
+    @RequestMapping(value = "/saveProduct", method = RequestMethod.POST)
+    public int saveProduct(@RequestBody ProductPo productPo);
+
+    @RequestMapping(value = "/updateProduct", method = RequestMethod.POST)
+    public int updateProduct(@RequestBody ProductPo productPo);
+
+    @RequestMapping(value = "/deleteProduct", method = RequestMethod.POST)
+    public int deleteProduct(@RequestBody ProductPo productPo);
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param productDto 数据对象分享
+     * @return ProductDto 对象数据
+     */
+    @RequestMapping(value = "/queryProducts", method = RequestMethod.POST)
+    List<ProductDto> queryProducts(@RequestBody ProductDto productDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param productDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryProductsCount", method = RequestMethod.POST)
+    int queryProductsCount(@RequestBody ProductDto productDto);
+}

+ 117 - 0
service-goods/src/main/java/com/java110/goods/api/ProductApi.java

@@ -0,0 +1,117 @@
+package com.java110.goods.api;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.dto.product.ProductDto;
+import com.java110.goods.bmo.product.IDeleteProductBMO;
+import com.java110.goods.bmo.product.IGetProductBMO;
+import com.java110.goods.bmo.product.ISaveProductBMO;
+import com.java110.goods.bmo.product.IUpdateProductBMO;
+import com.java110.po.product.ProductPo;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+
+@RestController
+@RequestMapping(value = "/product")
+public class ProductApi {
+
+    @Autowired
+    private ISaveProductBMO saveProductBMOImpl;
+    @Autowired
+    private IUpdateProductBMO updateProductBMOImpl;
+    @Autowired
+    private IDeleteProductBMO deleteProductBMOImpl;
+
+    @Autowired
+    private IGetProductBMO getProductBMOImpl;
+
+    /**
+     * 微信保存消息模板
+     *
+     * @param reqJson
+     * @return
+     * @serviceCode /product/saveProduct
+     * @path /app/product/saveProduct
+     */
+    @RequestMapping(value = "/saveProduct", method = RequestMethod.POST)
+    public ResponseEntity<String> saveProduct(@RequestBody JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "prodName", "请求报文中未包含prodName");
+        Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId");
+        Assert.hasKeyAndValue(reqJson, "keyword", "请求报文中未包含keyword");
+        Assert.hasKeyAndValue(reqJson, "categoryId", "请求报文中未包含categoryId");
+        Assert.hasKeyAndValue(reqJson, "unitName", "请求报文中未包含unitName");
+        Assert.hasKeyAndValue(reqJson, "sort", "请求报文中未包含sort");
+        Assert.hasKeyAndValue(reqJson, "isPostage", "请求报文中未包含isPostage");
+
+
+        ProductPo productPo = BeanConvertUtil.covertBean(reqJson, ProductPo.class);
+        return saveProductBMOImpl.save(productPo);
+    }
+
+    /**
+     * 微信修改消息模板
+     *
+     * @param reqJson
+     * @return
+     * @serviceCode /product/updateProduct
+     * @path /app/product/updateProduct
+     */
+    @RequestMapping(value = "/updateProduct", method = RequestMethod.POST)
+    public ResponseEntity<String> updateProduct(@RequestBody JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "prodName", "请求报文中未包含prodName");
+        Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId");
+        Assert.hasKeyAndValue(reqJson, "keyword", "请求报文中未包含keyword");
+        Assert.hasKeyAndValue(reqJson, "categoryId", "请求报文中未包含categoryId");
+        Assert.hasKeyAndValue(reqJson, "unitName", "请求报文中未包含unitName");
+        Assert.hasKeyAndValue(reqJson, "sort", "请求报文中未包含sort");
+        Assert.hasKeyAndValue(reqJson, "isPostage", "请求报文中未包含isPostage");
+        Assert.hasKeyAndValue(reqJson, "productId", "productId不能为空");
+
+
+        ProductPo productPo = BeanConvertUtil.covertBean(reqJson, ProductPo.class);
+        return updateProductBMOImpl.update(productPo);
+    }
+
+    /**
+     * 微信删除消息模板
+     *
+     * @param reqJson
+     * @return
+     * @serviceCode /product/deleteProduct
+     * @path /app/product/deleteProduct
+     */
+    @RequestMapping(value = "/deleteProduct", method = RequestMethod.POST)
+    public ResponseEntity<String> deleteProduct(@RequestBody JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空");
+
+        Assert.hasKeyAndValue(reqJson, "productId", "productId不能为空");
+
+
+        ProductPo productPo = BeanConvertUtil.covertBean(reqJson, ProductPo.class);
+        return deleteProductBMOImpl.delete(productPo);
+    }
+
+    /**
+     * 微信删除消息模板
+     *
+     * @param storeId 商户ID
+     * @return
+     * @serviceCode /product/queryProduct
+     * @path /app/product/queryProduct
+     */
+    @RequestMapping(value = "/queryProduct", method = RequestMethod.GET)
+    public ResponseEntity<String> queryProduct(@RequestParam(value = "store-id") String storeId,
+                                               @RequestParam(value = "page") int page,
+                                               @RequestParam(value = "row") int row) {
+        ProductDto productDto = new ProductDto();
+        productDto.setPage(page);
+        productDto.setRow(row);
+        productDto.setStoreId(storeId);
+        return getProductBMOImpl.get(productDto);
+    }
+}

+ 2 - 2
service-goods/src/main/java/com/java110/goods/api/ProductCategoryApi.java

@@ -1,12 +1,12 @@
 package com.java110.goods.api;
 
 import com.alibaba.fastjson.JSONObject;
-import com.java110.dto.productCategory.ProductCategoryDto;
+import com.java110.dto.product.ProductCategoryDto;
 import com.java110.goods.bmo.productCategory.IDeleteProductCategoryBMO;
 import com.java110.goods.bmo.productCategory.IGetProductCategoryBMO;
 import com.java110.goods.bmo.productCategory.ISaveProductCategoryBMO;
 import com.java110.goods.bmo.productCategory.IUpdateProductCategoryBMO;
-import com.java110.po.productCategory.ProductCategoryPo;
+import com.java110.po.product.ProductCategoryPo;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;

+ 17 - 0
service-goods/src/main/java/com/java110/goods/bmo/product/IDeleteProductBMO.java

@@ -0,0 +1,17 @@
+package com.java110.goods.bmo.product;
+import com.java110.po.product.ProductPo;
+import org.springframework.http.ResponseEntity;
+
+public interface IDeleteProductBMO {
+
+
+    /**
+     * 修改产品
+     * add by wuxw
+     * @param productPo
+     * @return
+     */
+    ResponseEntity<String> delete(ProductPo productPo);
+
+
+}

+ 16 - 0
service-goods/src/main/java/com/java110/goods/bmo/product/IGetProductBMO.java

@@ -0,0 +1,16 @@
+package com.java110.goods.bmo.product;
+import com.java110.dto.product.ProductDto;
+import org.springframework.http.ResponseEntity;
+public interface IGetProductBMO {
+
+
+    /**
+     * 查询产品
+     * add by wuxw
+     * @param  productDto
+     * @return
+     */
+    ResponseEntity<String> get(ProductDto productDto);
+
+
+}

+ 17 - 0
service-goods/src/main/java/com/java110/goods/bmo/product/ISaveProductBMO.java

@@ -0,0 +1,17 @@
+package com.java110.goods.bmo.product;
+
+import com.java110.po.product.ProductPo;
+import org.springframework.http.ResponseEntity;
+public interface ISaveProductBMO {
+
+
+    /**
+     * 添加产品
+     * add by wuxw
+     * @param productPo
+     * @return
+     */
+    ResponseEntity<String> save(ProductPo productPo);
+
+
+}

+ 17 - 0
service-goods/src/main/java/com/java110/goods/bmo/product/IUpdateProductBMO.java

@@ -0,0 +1,17 @@
+package com.java110.goods.bmo.product;
+import com.java110.po.product.ProductPo;
+import org.springframework.http.ResponseEntity;
+
+public interface IUpdateProductBMO {
+
+
+    /**
+     * 修改产品
+     * add by wuxw
+     * @param productPo
+     * @return
+     */
+    ResponseEntity<String> update(ProductPo productPo);
+
+
+}

+ 34 - 0
service-goods/src/main/java/com/java110/goods/bmo/product/impl/DeleteProductBMOImpl.java

@@ -0,0 +1,34 @@
+package com.java110.goods.bmo.product.impl;
+
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.goods.bmo.product.IDeleteProductBMO;
+import com.java110.intf.goods.IProductInnerServiceSMO;
+import com.java110.po.product.ProductPo;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+@Service("deleteProductBMOImpl")
+public class DeleteProductBMOImpl implements IDeleteProductBMO {
+
+    @Autowired
+    private IProductInnerServiceSMO productInnerServiceSMOImpl;
+
+    /**
+     * @param productPo 数据
+     * @return 订单服务能够接受的报文
+     */
+    @Java110Transactional
+    public ResponseEntity<String> delete(ProductPo productPo) {
+
+        int flag = productInnerServiceSMOImpl.deleteProduct(productPo);
+
+        if (flag > 0) {
+            return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
+        }
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
+    }
+
+}

+ 44 - 0
service-goods/src/main/java/com/java110/goods/bmo/product/impl/GetProductBMOImpl.java

@@ -0,0 +1,44 @@
+package com.java110.goods.bmo.product.impl;
+
+import com.java110.dto.product.ProductDto;
+import com.java110.goods.bmo.product.IGetProductBMO;
+import com.java110.intf.goods.IProductInnerServiceSMO;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service("getProductBMOImpl")
+public class GetProductBMOImpl implements IGetProductBMO {
+
+    @Autowired
+    private IProductInnerServiceSMO productInnerServiceSMOImpl;
+
+    /**
+     * @param productDto
+     * @return 订单服务能够接受的报文
+     */
+    public ResponseEntity<String> get(ProductDto productDto) {
+
+
+        int count = productInnerServiceSMOImpl.queryProductsCount(productDto);
+
+        List<ProductDto> productDtos = null;
+        if (count > 0) {
+            productDtos = productInnerServiceSMOImpl.queryProducts(productDto);
+        } else {
+            productDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) productDto.getRow()), count, productDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        return responseEntity;
+    }
+
+}

+ 38 - 0
service-goods/src/main/java/com/java110/goods/bmo/product/impl/SaveProductBMOImpl.java

@@ -0,0 +1,38 @@
+package com.java110.goods.bmo.product.impl;
+
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.goods.bmo.product.ISaveProductBMO;
+import com.java110.intf.goods.IProductInnerServiceSMO;
+import com.java110.po.product.ProductPo;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+@Service("saveProductBMOImpl")
+public class SaveProductBMOImpl implements ISaveProductBMO {
+
+    @Autowired
+    private IProductInnerServiceSMO productInnerServiceSMOImpl;
+
+    /**
+     * 添加小区信息
+     *
+     * @param productPo
+     * @return 订单服务能够接受的报文
+     */
+    @Java110Transactional
+    public ResponseEntity<String> save(ProductPo productPo) {
+
+        productPo.setProductId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_productId));
+        int flag = productInnerServiceSMOImpl.saveProduct(productPo);
+
+        if (flag > 0) {
+            return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
+        }
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
+    }
+
+}

+ 34 - 0
service-goods/src/main/java/com/java110/goods/bmo/product/impl/UpdateProductBMOImpl.java

@@ -0,0 +1,34 @@
+package com.java110.goods.bmo.product.impl;
+
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.goods.bmo.product.IUpdateProductBMO;
+import com.java110.intf.goods.IProductInnerServiceSMO;
+import com.java110.po.product.ProductPo;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+@Service("updateProductBMOImpl")
+public class UpdateProductBMOImpl implements IUpdateProductBMO {
+
+    @Autowired
+    private IProductInnerServiceSMO productInnerServiceSMOImpl;
+
+    /**
+     * @param productPo
+     * @return 订单服务能够接受的报文
+     */
+    @Java110Transactional
+    public ResponseEntity<String> update(ProductPo productPo) {
+
+        int flag = productInnerServiceSMOImpl.updateProduct(productPo);
+
+        if (flag > 0) {
+            return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
+        }
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
+    }
+
+}

+ 1 - 1
service-goods/src/main/java/com/java110/goods/bmo/productCategory/IDeleteProductCategoryBMO.java

@@ -1,5 +1,5 @@
 package com.java110.goods.bmo.productCategory;
-import com.java110.po.productCategory.ProductCategoryPo;
+import com.java110.po.product.ProductCategoryPo;
 import org.springframework.http.ResponseEntity;
 
 public interface IDeleteProductCategoryBMO {

+ 1 - 1
service-goods/src/main/java/com/java110/goods/bmo/productCategory/IGetProductCategoryBMO.java

@@ -1,5 +1,5 @@
 package com.java110.goods.bmo.productCategory;
-import com.java110.dto.productCategory.ProductCategoryDto;
+import com.java110.dto.product.ProductCategoryDto;
 import org.springframework.http.ResponseEntity;
 public interface IGetProductCategoryBMO {
 

+ 1 - 1
service-goods/src/main/java/com/java110/goods/bmo/productCategory/ISaveProductCategoryBMO.java

@@ -1,6 +1,6 @@
 package com.java110.goods.bmo.productCategory;
 
-import com.java110.po.productCategory.ProductCategoryPo;
+import com.java110.po.product.ProductCategoryPo;
 import org.springframework.http.ResponseEntity;
 public interface ISaveProductCategoryBMO {
 

+ 1 - 1
service-goods/src/main/java/com/java110/goods/bmo/productCategory/IUpdateProductCategoryBMO.java

@@ -1,5 +1,5 @@
 package com.java110.goods.bmo.productCategory;
-import com.java110.po.productCategory.ProductCategoryPo;
+import com.java110.po.product.ProductCategoryPo;
 import org.springframework.http.ResponseEntity;
 
 public interface IUpdateProductCategoryBMO {

+ 1 - 1
service-goods/src/main/java/com/java110/goods/bmo/productCategory/impl/DeleteProductCategoryBMOImpl.java

@@ -3,7 +3,7 @@ package com.java110.goods.bmo.productCategory.impl;
 import com.java110.core.annotation.Java110Transactional;
 import com.java110.goods.bmo.productCategory.IDeleteProductCategoryBMO;
 import com.java110.intf.goods.IProductCategoryInnerServiceSMO;
-import com.java110.po.productCategory.ProductCategoryPo;
+import com.java110.po.product.ProductCategoryPo;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;

+ 1 - 1
service-goods/src/main/java/com/java110/goods/bmo/productCategory/impl/GetProductCategoryBMOImpl.java

@@ -1,6 +1,6 @@
 package com.java110.goods.bmo.productCategory.impl;
 
-import com.java110.dto.productCategory.ProductCategoryDto;
+import com.java110.dto.product.ProductCategoryDto;
 import com.java110.goods.bmo.productCategory.IGetProductCategoryBMO;
 import com.java110.intf.goods.IProductCategoryInnerServiceSMO;
 import com.java110.vo.ResultVo;

+ 1 - 1
service-goods/src/main/java/com/java110/goods/bmo/productCategory/impl/SaveProductCategoryBMOImpl.java

@@ -4,7 +4,7 @@ import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.goods.bmo.productCategory.ISaveProductCategoryBMO;
 import com.java110.intf.goods.IProductCategoryInnerServiceSMO;
-import com.java110.po.productCategory.ProductCategoryPo;
+import com.java110.po.product.ProductCategoryPo;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;

+ 1 - 1
service-goods/src/main/java/com/java110/goods/bmo/productCategory/impl/UpdateProductCategoryBMOImpl.java

@@ -3,7 +3,7 @@ package com.java110.goods.bmo.productCategory.impl;
 import com.java110.core.annotation.Java110Transactional;
 import com.java110.goods.bmo.productCategory.IUpdateProductCategoryBMO;
 import com.java110.intf.goods.IProductCategoryInnerServiceSMO;
-import com.java110.po.productCategory.ProductCategoryPo;
+import com.java110.po.product.ProductCategoryPo;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;

+ 61 - 0
service-goods/src/main/java/com/java110/goods/dao/IProductServiceDao.java

@@ -0,0 +1,61 @@
+package com.java110.goods.dao;
+
+
+import com.java110.utils.exception.DAOException;
+import com.java110.entity.merchant.BoMerchant;
+import com.java110.entity.merchant.BoMerchantAttr;
+import com.java110.entity.merchant.Merchant;
+import com.java110.entity.merchant.MerchantAttr;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 产品组件内部之间使用,没有给外围系统提供服务能力
+ * 产品服务接口类,要求全部以字符串传输,方便微服务化
+ * 新建客户,修改客户,删除客户,查询客户等功能
+ *
+ * Created by wuxw on 2016/12/27.
+ */
+public interface IProductServiceDao {
+
+
+    /**
+     * 保存 产品信息
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveProductInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询产品信息(instance过程)
+     * 根据bId 查询产品信息
+     * @param info bId 信息
+     * @return 产品信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getProductInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改产品信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateProductInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询产品总数
+     *
+     * @param info 产品信息
+     * @return 产品数量
+     */
+    int queryProductsCount(Map info);
+
+}

+ 98 - 0
service-goods/src/main/java/com/java110/goods/dao/impl/ProductServiceDaoImpl.java

@@ -0,0 +1,98 @@
+package com.java110.goods.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.goods.dao.IProductServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 产品服务 与数据库交互
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("productServiceDaoImpl")
+//@Transactional
+public class ProductServiceDaoImpl extends BaseServiceDao implements IProductServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(ProductServiceDaoImpl.class);
+
+
+
+
+
+    /**
+     * 保存产品信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveProductInfo(Map info) throws DAOException {
+        logger.debug("保存产品信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("productServiceDaoImpl.saveProductInfo",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存产品信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+
+    /**
+     * 查询产品信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getProductInfo(Map info) throws DAOException {
+        logger.debug("查询产品信息 入参 info : {}",info);
+
+        List<Map> businessProductInfos = sqlSessionTemplate.selectList("productServiceDaoImpl.getProductInfo",info);
+
+        return businessProductInfos;
+    }
+
+
+    /**
+     * 修改产品信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateProductInfo(Map info) throws DAOException {
+        logger.debug("修改产品信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("productServiceDaoImpl.updateProductInfo",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改产品信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+     /**
+     * 查询产品数量
+     * @param info 产品信息
+     * @return 产品数量
+     */
+    @Override
+    public int queryProductsCount(Map info) {
+        logger.debug("查询产品数据 入参 info : {}",info);
+
+        List<Map> businessProductInfos = sqlSessionTemplate.selectList("productServiceDaoImpl.queryProductsCount", info);
+        if (businessProductInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessProductInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 2 - 2
service-goods/src/main/java/com/java110/goods/smo/impl/ProductCategoryInnerServiceSMOImpl.java

@@ -3,10 +3,10 @@ package com.java110.goods.smo.impl;
 
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
-import com.java110.dto.productCategory.ProductCategoryDto;
+import com.java110.dto.product.ProductCategoryDto;
 import com.java110.goods.dao.IProductCategoryServiceDao;
 import com.java110.intf.goods.IProductCategoryInnerServiceSMO;
-import com.java110.po.productCategory.ProductCategoryPo;
+import com.java110.po.product.ProductCategoryPo;
 import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;

+ 83 - 0
service-goods/src/main/java/com/java110/goods/smo/impl/ProductInnerServiceSMOImpl.java

@@ -0,0 +1,83 @@
+package com.java110.goods.smo.impl;
+
+
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.product.ProductDto;
+import com.java110.goods.dao.IProductServiceDao;
+import com.java110.intf.goods.IProductInnerServiceSMO;
+import com.java110.po.product.ProductPo;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @ClassName FloorInnerServiceSMOImpl
+ * @Description 产品内部服务实现类
+ * @Author wuxw
+ * @Date 2019/4/24 9:20
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@RestController
+public class ProductInnerServiceSMOImpl extends BaseServiceSMO implements IProductInnerServiceSMO {
+
+    @Autowired
+    private IProductServiceDao productServiceDaoImpl;
+
+
+    @Override
+    public int saveProduct(@RequestBody ProductPo productPo) {
+        int saveFlag = 1;
+        productServiceDaoImpl.saveProductInfo(BeanConvertUtil.beanCovertMap(productPo));
+        return saveFlag;
+    }
+
+    @Override
+    public int updateProduct(@RequestBody ProductPo productPo) {
+        int saveFlag = 1;
+        productServiceDaoImpl.updateProductInfo(BeanConvertUtil.beanCovertMap(productPo));
+        return saveFlag;
+    }
+
+    @Override
+    public int deleteProduct(@RequestBody ProductPo productPo) {
+        int saveFlag = 1;
+        productPo.setStatusCd("1");
+        productServiceDaoImpl.updateProductInfo(BeanConvertUtil.beanCovertMap(productPo));
+        return saveFlag;
+    }
+
+    @Override
+    public List<ProductDto> queryProducts(@RequestBody ProductDto productDto) {
+
+        //校验是否传了 分页信息
+
+        int page = productDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            productDto.setPage((page - 1) * productDto.getRow());
+        }
+
+        List<ProductDto> products = BeanConvertUtil.covertBeanList(productServiceDaoImpl.getProductInfo(BeanConvertUtil.beanCovertMap(productDto)), ProductDto.class);
+
+        return products;
+    }
+
+
+    @Override
+    public int queryProductsCount(@RequestBody ProductDto productDto) {
+        return productServiceDaoImpl.queryProductsCount(BeanConvertUtil.beanCovertMap(productDto));
+    }
+
+    public IProductServiceDao getProductServiceDaoImpl() {
+        return productServiceDaoImpl;
+    }
+
+    public void setProductServiceDaoImpl(IProductServiceDao productServiceDaoImpl) {
+        this.productServiceDaoImpl = productServiceDaoImpl;
+    }
+}