浏览代码

Merge branch 'master' of http://git.ds-bay.com/project/kmall-pt-general

lsp 4 年之前
父节点
当前提交
4c9e0f636d

+ 12 - 7
kmall-admin/src/main/java/com/kmall/admin/Test.java

@@ -12,6 +12,8 @@
  */
 package com.kmall.admin;
 
+import org.springframework.web.util.HtmlUtils;
+
 /**
  * 名称:Test <br>
  * 描述:<br>
@@ -23,14 +25,17 @@ package com.kmall.admin;
 public class Test {
     public static void main(String[] args) {
         //Integer使用equals判断
-        Integer a = 127;
-        Integer b = 127;
-        System.out.println(a == b);
-        Integer c = 129;
-        Integer d = 129;
-        System.out.println(c == d);
+//        Integer a = 127;
+//        Integer b = 127;
+//        System.out.println(a == b);
+//        Integer c = 129;
+//        Integer d = 129;
+//        System.out.println(c == d);
+//
+//        System.out.println(c.equals(d));
+
 
-        System.out.println(c.equals(d));
+        System.out.println(HtmlUtils.htmlUnescape("Baby&amp;Children"));
 
     }
 }

+ 5 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/BrandController.java

@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * Controller
@@ -75,6 +76,10 @@ public class BrandController {
             throw new RRException(r.get("msg").toString());
         }
 
+        BrandEntity brandEntity = brandService.queryByCategoryIdAndBrandNameAndMerchSn(brand.getCategoryId(),brand.getName(),brand.getMerchSn());
+        if (Objects.nonNull(brandEntity)){
+            throw new RRException("该分类下已经有该品牌名称");
+        }
         brandService.save(brand);
 
         return R.ok();

+ 6 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/CategoryController.java

@@ -9,10 +9,12 @@ import com.kmall.admin.utils.ParamUtils;
 import com.kmall.common.constant.JxlsXmlTemplateName;
 import com.kmall.common.utils.*;
 import com.kmall.common.utils.excel.ExcelUtil;
+import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.util.HtmlUtils;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -70,6 +72,8 @@ public class CategoryController {
     @RequestMapping("/save")
     @RequiresPermissions("category:save")
     public R save(@RequestBody CategoryEntity category) {
+        category.setName(HtmlUtils.htmlUnescape(category.getName()));
+        category.setFrontDesc(HtmlUtils.htmlUnescape(category.getFrontDesc()));
         categoryService.save(category);
 
         return R.ok();
@@ -81,6 +85,8 @@ public class CategoryController {
     @RequestMapping("/update")
     @RequiresPermissions("category:update")
     public R update(@RequestBody CategoryEntity category) {
+        category.setName(HtmlUtils.htmlUnescape(category.getName()));
+        category.setFrontDesc(HtmlUtils.htmlUnescape(category.getFrontDesc()));
         categoryService.update(category);
 
         return R.ok();

+ 3 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/BrandDao.java

@@ -14,7 +14,7 @@ import java.util.List;
  * @date 2017-08-19 17:59:15
  */
 public interface BrandDao extends BaseDao<BrandEntity> {
-    BrandEntity queryObjectByName(@Param("brandName")String brandName,@Param("merchSn")String merchSn);
+    BrandEntity queryObjectByName(@Param("brandName")String brandName,@Param("merchSn")String merchSn,@Param("categoryId")Integer categoryId);
     List<BrandEntity> queryObjectByStoreId(@Param("storeId") Long storeId);
     BrandEntity queryBrandByBrandNameAndStoreId(@Param("brandName")String brandName,@Param("storeId") Long storeId);
 
@@ -25,4 +25,6 @@ public interface BrandDao extends BaseDao<BrandEntity> {
      * @return
      */
     String queryBrandName(@Param("prodBarcode") String prodBarcode, @Param("storeId") String storeId);
+
+    BrandEntity queryByCategoryIdAndBrandNameAndMerchSn(@Param("categoryId") Integer categoryId,@Param("name") String name,@Param("merchSn") String merchSn);
 }

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/CategoryDao.java

@@ -14,7 +14,7 @@ import java.util.List;
  * @date 2017-08-21 15:32:31
  */
 public interface CategoryDao extends BaseDao<CategoryEntity> {
-    CategoryEntity queryObjectByName(@Param("cateGoryName") String cateGoryName,@Param("merchSn")String merchSn);
+    CategoryEntity queryObjectByName(@Param("categoryName") String categoryName,@Param("merchSn")String merchSn,@Param("parentId") Integer parentId);
     List<CategoryEntity> queryObjectByStoreId(@Param("storeId") Long storeId);
 
 }

+ 3 - 0
kmall-admin/src/main/java/com/kmall/admin/service/BrandService.java

@@ -83,4 +83,7 @@ public interface BrandService {
      * @return
      */
     String queryBrandName(String prodBarcode, String storeId);
+
+
+    BrandEntity queryByCategoryIdAndBrandNameAndMerchSn(Integer categoryId, String name, String merchSn);
 }

+ 5 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/BrandServiceImpl.java

@@ -189,4 +189,9 @@ public class BrandServiceImpl implements BrandService {
     public String queryBrandName(String prodBarcode, String storeId) {
         return brandDao.queryBrandName(prodBarcode,storeId);
     }
+
+    @Override
+    public BrandEntity queryByCategoryIdAndBrandNameAndMerchSn(Integer categoryId, String name, String merchSn) {
+        return brandDao.queryByCategoryIdAndBrandNameAndMerchSn(categoryId,name,merchSn);
+    }
 }

+ 19 - 18
kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java

@@ -850,19 +850,20 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
                 }else{
                     throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]未录入系统");
                 }
-                CategoryEntity categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn());
-                if (categoryEntity != null) {
-                    storeRelaEntity.setAttributeCategory(categoryEntity.getId());
-                }else{
-                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的二级类别输入有误");
-                }
-                CategoryEntity parentCategoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getCategoryName(), store.getMerchSn());
-                if (parentCategoryEntity != null && categoryEntity.getParentId().intValue()==parentCategoryEntity.getId().intValue()) {
+                CategoryEntity parentCategoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getCategoryName(), store.getMerchSn(),0);
+                if (parentCategoryEntity != null) {
                     storeRelaEntity.setCategoryId(parentCategoryEntity.getId());
+                    CategoryEntity categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn(),parentCategoryEntity.getId());
+                    if (categoryEntity != null) {
+                        storeRelaEntity.setAttributeCategory(categoryEntity.getId());
+                    }else{
+                        throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的二级类别输入有误");
+                    }
                 }else{
                     throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的一级类别输入有误");
                 }
-                BrandEntity brandEntity = brandDao.queryObjectByName(storeGoodsDto.getBrandName(), store.getMerchSn());
+
+                BrandEntity brandEntity = brandDao.queryObjectByName(storeGoodsDto.getBrandName(), store.getMerchSn(),storeRelaEntity.getAttributeCategory());
                 if (brandEntity != null) {
                     storeRelaEntity.setBrandId(brandEntity.getId());
                 }else{
@@ -879,15 +880,15 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
                     throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的底线价不可以大于零售价");
                 }
                 // 查询批次号是否存在
-                GoodsBatchEntity goodsBatchEntity = goodsBatchDao.queryByBatchSnAndSku(storeGoodsDto.getBatchSn(), goodsEntity.getSku());
-                if (goodsBatchEntity!=null){
-                    storeRelaEntity.setBatchSn(goodsBatchEntity.getBatchSn());
-                    Date batchExpireDate = goodsBatchEntity.getBatchExpireDate();
-                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                    storeRelaEntity.setBatchExpireDate(sdf.format(batchExpireDate));
-                }else{
-//                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的批次号不存在");
-                }
+//                GoodsBatchEntity goodsBatchEntity = goodsBatchDao.queryByBatchSnAndSku(storeGoodsDto.getBatchSn(), goodsEntity.getSku());
+//                if (goodsBatchEntity!=null){
+//                    storeRelaEntity.setBatchSn(goodsBatchEntity.getBatchSn());
+//                    Date batchExpireDate = goodsBatchEntity.getBatchExpireDate();
+//                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//                    storeRelaEntity.setBatchExpireDate(sdf.format(batchExpireDate));
+//                }else{
+////                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的批次号不存在");
+//                }
                 storeRelaEntity.setMarketPrice(new BigDecimal(storeGoodsDto.getMarketPrice()));
                 storeRelaEntity.setRetailPrice(new BigDecimal(storeGoodsDto.getRetailPrice()));
                 storeRelaEntity.setBottomLinePrice(storeGoodsDto.getBottomLinePrice());

+ 1 - 1
kmall-admin/src/main/resources/XmlTemplate/StoreGoodsDtoList.xml

@@ -15,7 +15,7 @@
                 <mapping row="1" col="6">StoreGoodsDto.retailPrice</mapping>
                 <mapping row="1" col="7">StoreGoodsDto.marketPrice</mapping>
                 <mapping row="1" col="8">StoreGoodsDto.bottomLinePrice</mapping>
-                <mapping row="1" col="9">StoreGoodsDto.batchSn</mapping>
+<!--                <mapping row="1" col="9">StoreGoodsDto.batchSn</mapping>-->
             </section>
             <loopbreakcondition>
                 <rowcheck offset="0">

+ 15 - 0
kmall-admin/src/main/resources/mybatis/mapper/BrandDao.xml

@@ -68,6 +68,7 @@
         left join mall_store s on b.store_id = s.id
         left join mall_merch m on b.merch_sn = m.merch_sn
         where `name` = #{brandName}
+        and category_id=#{categoryId}
         <if test="merchSn != null and merchSn.trim() != ''">
             AND b.merch_sn = #{merchSn}
         </if>
@@ -252,5 +253,19 @@
 	        goods.prod_barcode = #{prodBarcode}
 	        and brand.store_id = #{storeId}
     </select>
+    <select id="queryByCategoryIdAndBrandNameAndMerchSn" resultType="com.kmall.admin.entity.BrandEntity">
+        select *
+        from mall_brand
+        where 1=1
+        <if test="categoryId != null and categoryId != ''">
+            AND category_id = #{categoryId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            AND merch_sn = #{merchSn}
+        </if>
+        <if test="name != null and name.trim() != ''">
+            AND `name` = #{name}
+        </if>
+    </select>
 
 </mapper>

+ 2 - 1
kmall-admin/src/main/resources/mybatis/mapper/CategoryDao.xml

@@ -69,7 +69,8 @@
 		`front_name`,
 		`is_show` as `show`
 		from mall_category
-		where name = #{cateGoryName}
+		where name = #{categoryName}
+		and parent_id=#{parentId}
 		<if test="merchSn != null and merchSn.trim() != ''">
 			AND merch_sn = #{merchSn}
 		</if> and is_show = 1

+ 11 - 11
kmall-admin/src/main/webapp/WEB-INF/page/shop/storeProductStock.html

@@ -209,17 +209,17 @@
                     </i-option>
                 </i-select>
             </Form-item>-->
-            <Form-item v-if="showInput" label="批次编号" prop="batchSn">
-                <!--<i-input v-model="productStoreRela.batchSn" placeholder="批次编号" style="width: 268px;"/>-->
-                <i-select v-model="productStoreRela.batchSn" placeholder="批次编号" @on-change="changeBatch"
-                          label-in-value style="width: 268px;">
-                    <i-option v-for="batch in batchList" :value="batch.id" :key="batch.id">{{batch.batchSn}}
-                    </i-option>
-                </i-select>
-            </Form-item>
-            <Form-item v-if="showInput" label="批次到期日期" prop="batchExpireDate">
-                <i-input type='date' v-model="productStoreRela.batchExpireDate" placeholder="批次到期日期" style="width: 268px;"/>
-            </Form-item>
+<!--            <Form-item v-if="showInput" label="批次编号" prop="batchSn">-->
+<!--                &lt;!&ndash;<i-input v-model="productStoreRela.batchSn" placeholder="批次编号" style="width: 268px;"/>&ndash;&gt;-->
+<!--                <i-select v-model="productStoreRela.batchSn" placeholder="批次编号" @on-change="changeBatch"-->
+<!--                          label-in-value style="width: 268px;">-->
+<!--                    <i-option v-for="batch in batchList" :value="batch.id" :key="batch.id">{{batch.batchSn}}-->
+<!--                    </i-option>-->
+<!--                </i-select>-->
+<!--            </Form-item>-->
+<!--            <Form-item v-if="showInput" label="批次到期日期" prop="batchExpireDate">-->
+<!--                <i-input type='date' v-model="productStoreRela.batchExpireDate" placeholder="批次到期日期" style="width: 268px;"/>-->
+<!--            </Form-item>-->
             <Form-item v-if="showInputSpecification" label="规格" prop="specification">
                 <i-input v-model="productStoreRela.specification" placeholder="规格" style="width: 268px;"/>
             </Form-item>

+ 4 - 4
kmall-admin/src/main/webapp/js/shop/storeProductStock.js

@@ -25,10 +25,10 @@ $(function () {
             {label: '商品编码', name: 'goodsSn', index: 'goodsSn', width: 180, align: 'center'},
             {label: '名称', name: 'goodsName', index: 'goodsName', width: 500, align: 'left'},
             {label: '产品编码', name: 'productSn', index: 'productSn', width: 140, align: 'center'},
-            {label: '批次编号', name: 'batchSn', index: 'batchSn', width: 220, align: 'center'},
-            {label: '批次到期日期', name: 'batchExpireDate', index: 'batchExpireDate', width: 160, align: 'center',formatter: function (value) {
-                    return transDate(value,'yyyy-MM-dd hh:mm:ss');
-            }},
+            // {label: '批次编号', name: 'batchSn', index: 'batchSn', width: 220, align: 'center'},
+            // {label: '批次到期日期', name: 'batchExpireDate', index: 'batchExpireDate', width: 160, align: 'center',formatter: function (value) {
+            //         return transDate(value,'yyyy-MM-dd hh:mm:ss');
+            // }},
             {
                 label: '上架', name: 'isOnSale', index: 'is_on_sale', width: 80, align: 'center',
                 formatter: function (value) {

二进制
kmall-admin/src/main/webapp/statics/file/store_goods_export_yyyy_mm_dd_v1.0.0.xls