Sfoglia il codice sorgente

Merge remote-tracking branch 'remotes/origin/developer' into developerA

Aslee 3 anni fa
parent
commit
0b52fa55a3

+ 18 - 8
src/main/java/com/caimei/modules/brand/entity/CmBrand.java

@@ -12,12 +12,13 @@ import java.beans.Transient;
  * @version 2019-04-19
  */
 public class CmBrand extends DataEntity<CmBrand> {
-	
+
 	private static final long serialVersionUID = 1L;
 	private String name;		// 品牌名字
 	private String source;		// 添加来源 0:后台添加 ,1:供应商添加
 	private String userID;		// 添加用户ID,后台则为后台用户ID,供应商则为供应商用户ID
 	private String status;		// 品牌状态 0:待审核,1:审核通过,2:审核失败
+	private String weights;     // 品牌权重(1-100):默认为50
 	private String auditNote;		// 审核备注
 	private String auditStatus;		// 审核备注
 	private String sort;		// 排序
@@ -29,7 +30,7 @@ public class CmBrand extends DataEntity<CmBrand> {
 	private String shopMobile;//供应商手机号
 
 	private String descriptionFlag;// 品牌描述有无标记  1有   0无
-	
+
 	public CmBrand() {
 		super();
 	}
@@ -38,6 +39,15 @@ public class CmBrand extends DataEntity<CmBrand> {
 		super(id);
 	}
 
+	@Length(min=0, max=100, message="品牌权重必须介于 0 和 100 之间")
+	public String getWeights() {
+		return weights;
+	}
+
+	public void setWeights(String weights) {
+		this.weights = weights;
+	}
+
 	@Length(min=0, max=50, message="品牌名字长度必须介于 0 和 50 之间")
 	public String getName() {
 		return name;
@@ -46,7 +56,7 @@ public class CmBrand extends DataEntity<CmBrand> {
 	public void setName(String name) {
 		this.name = name;
 	}
-	
+
 	@Length(min=0, max=1, message="添加来源 0:后台添加 ,1:供应商添加长度必须介于 0 和 1 之间")
 	public String getSource() {
 		return source;
@@ -55,7 +65,7 @@ public class CmBrand extends DataEntity<CmBrand> {
 	public void setSource(String source) {
 		this.source = source;
 	}
-	
+
 	@Length(min=0, max=11, message="添加用户ID,后台则为后台用户ID,供应商则为供应商用户ID长度必须介于 0 和 11 之间")
 	public String getUserID() {
 		return userID;
@@ -64,7 +74,7 @@ public class CmBrand extends DataEntity<CmBrand> {
 	public void setUserID(String userID) {
 		this.userID = userID;
 	}
-	
+
 	@Length(min=0, max=1, message="品牌状态 0:待审核,1:审核通过,2:审核失败长度必须介于 0 和 1 之间")
 	public String getStatus() {
 		return status;
@@ -73,7 +83,7 @@ public class CmBrand extends DataEntity<CmBrand> {
 	public void setStatus(String status) {
 		this.status = status;
 	}
-	
+
 	@Length(min=0, max=50, message="审核备注长度必须介于 0 和 50 之间")
 	public String getAuditNote() {
 		return auditNote;
@@ -82,7 +92,7 @@ public class CmBrand extends DataEntity<CmBrand> {
 	public void setAuditNote(String auditNote) {
 		this.auditNote = auditNote;
 	}
-	
+
 	@Length(min=0, max=11, message="排序长度必须介于 0 和 11 之间")
 	public String getSort() {
 		return sort;
@@ -148,4 +158,4 @@ public class CmBrand extends DataEntity<CmBrand> {
 	public void setAuthLogo(String authLogo) {
 		this.authLogo = authLogo;
 	}
-}
+}

+ 23 - 4
src/main/java/com/caimei/modules/brand/web/CmBrandController.java

@@ -3,6 +3,7 @@ package com.caimei.modules.brand.web;
 import com.caimei.modules.brand.entity.BrandAndProductType;
 import com.caimei.modules.brand.entity.CmBrand;
 import com.caimei.modules.brand.service.CmBrandService;
+import com.caimei.modules.opensearch.CoreServiceUitls;
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.sys.utils.SMSUtils;
@@ -59,7 +60,8 @@ public class CmBrandController extends BaseController {
     private CmBrandService cmBrandService;
     @Autowired
     private ProductDao productDao;
-
+    @Autowired
+    private CoreServiceUitls coreServiceUitls;
     @ModelAttribute
     public CmBrand get(@RequestParam(required = false) String id) {
         CmBrand entity = null;
@@ -150,17 +152,32 @@ public class CmBrandController extends BaseController {
                         }
                     }
                 }
-
             }
 
-
             cmBrand.setUpdateDate(new Date());
             cmBrandService.save(cmBrand);
+            // 更新商品索引
+            updateProductIndexByBrand(cmBrand.getId());
+
             addMessage(redirectAttributes, "保存品牌成功");
         }
         return "redirect:" + Global.getAdminPath() + "/brand/cmBrand/";
     }
 
+    /**
+     * 根据品牌Id更新商品索引
+     * @param brandId
+     */
+    private void updateProductIndexByBrand(String brandId) {
+        // 更新商品索引
+        List<Integer> productIds = productDao.getProductIdByBrandId(brandId);
+        for (Integer productId : productIds) {
+            if (null != productId) {
+                coreServiceUitls.updateProductIndex(productId);
+            }
+        }
+    }
+
     @RequiresPermissions("brand:cmBrand:delete")
     @RequestMapping(value = "delete")
     public String delete(CmBrand cmBrand, RedirectAttributes redirectAttributes) {
@@ -171,6 +188,8 @@ public class CmBrandController extends BaseController {
         cmBrandService.delete(cmBrand);
         //清理对应品牌商品信息(标记品牌为null)
         productDao.updateProductByBrandId(Integer.parseInt(cmBrand.getId()));
+        // 更新商品索引
+        updateProductIndexByBrand(cmBrand.getId());
         addMessage(redirectAttributes, "删除品牌成功");
         return "redirect:" + Global.getAdminPath() + "/brand/cmBrand/?repage";
     }
@@ -502,4 +521,4 @@ public class CmBrandController extends BaseController {
         this.errorMsg = errorMsg;
     }
 
-}
+}

+ 8 - 16
src/main/java/com/caimei/modules/cmpage/web/CmPageCentreController.java

@@ -111,13 +111,8 @@ public class CmPageCentreController extends BaseController {
         }
         cmPageCentreService.save(cmPageCentre);
         addMessage(redirectAttributes, "保存成功");
-        if ("5".equals(cmPageCentre.getType())) {
-            //清除产品仪器缓存
-            cleanRedisCache();
-        } else {
-            //清除活动专题缓存
-            redisService.removePattern("getPageFloorData*");
-        }
+        //清除产品仪器缓存
+        cleanRedisCache();
         return "redirect:" + Global.getAdminPath() + "/cmpage/cmPageCentre/?pageId=" + cmPageCentre.getPageId() + "&type=" + cmPageCentre.getType();
     }
 
@@ -125,13 +120,8 @@ public class CmPageCentreController extends BaseController {
     @RequestMapping(value = "delete")
     public String delete(CmPageCentre cmPageCentre, RedirectAttributes redirectAttributes) {
         cmPageCentreService.delete(cmPageCentre);
-        if ("5".equals(cmPageCentre.getType())) {
-            //清除产品仪器缓存
-            cleanRedisCache();
-        } else {
-            //清除活动专题缓存
-            redisService.removePattern("getPageFloorData*");
-        }
+        //清除缓存
+        cleanRedisCache();
         addMessage(redirectAttributes, "删除成功");
         return "redirect:" + Global.getAdminPath() + "/cmpage/cmPageCentre/?pageId=" + cmPageCentre.getPageId() + "&type=" + cmPageCentre.getType();
     }
@@ -216,8 +206,6 @@ public class CmPageCentreController extends BaseController {
             }
             //清除产品仪器缓存
             cleanRedisCache();
-            //清除活动专题缓存
-            redisService.removePattern("activityData*");
             map.put("success", true);
             map.put("msg", "更新排序成功");
             return map;
@@ -245,6 +233,10 @@ public class CmPageCentreController extends BaseController {
     }
 
     public void cleanRedisCache() {
+        //清除活动专题缓存
+        redisService.removePattern("getPageFloorData*");
+        //清除活动专题缓存
+        redisService.removePattern("activityData*");
         //清除产品仪器缓存
         redisService.removePattern("instrumentData*");
         redisService.removePattern("insCommodityData*");

+ 6 - 4
src/main/java/com/caimei/modules/cmpage/web/CmPageController.java

@@ -155,16 +155,14 @@ public class CmPageController extends BaseController {
                     }
                 }
             }
+        }
 
+        cleanRedisCache();
 
-        }
         addMessage(redirectAttributes, "保存成功");
         if ("2".equals(cmPage.getType())) {
             // 更新索引
             coreServiceUitls.updateEquipmentIndex(Integer.parseInt(cmPage.getId()));
-        } else {
-            //清除活动专题缓存
-            redisService.removePattern("getPageFloorData*");
         }
         if (StringUtils.equals("1", cmPage.getFlag())) { // 1讲师设置页面
             return "redirect:" + Global.getAdminPath() + "/cmpage/cmPage/form?id=1";
@@ -179,6 +177,7 @@ public class CmPageController extends BaseController {
     @RequestMapping(value = "delete")
     public String delete(CmPage cmPage, RedirectAttributes redirectAttributes) {
         cmPageService.delete(cmPage);
+        cleanRedisCache();
         addMessage(redirectAttributes, "删除成功");
         return "redirect:" + Global.getAdminPath() + "/cmpage/cmPage?flag=2";
     }
@@ -192,6 +191,7 @@ public class CmPageController extends BaseController {
             cmPageService.updateEnabledStatusByIds(enabledStatus, ids);
             map.put("success", true);
             map.put("msg", "修改成功");
+            cleanRedisCache();
         } catch (Exception e) {
             logger.debug(e.toString(), e);
             map.put("success", false);
@@ -232,6 +232,8 @@ public class CmPageController extends BaseController {
         if (redisService.exists(getSearchHotWord)) {
             redisService.remove(getSearchHotWord);
         }
+        //清除活动专题缓存
+        redisService.removePattern("getPageFloorData*");
         //清除产品仪器缓存
         redisService.removePattern("instrumentData*");
         redisService.removePattern("insCommodityData*");

+ 7 - 5
src/main/java/com/caimei/modules/newhome/web/NewPageFloorController.java

@@ -308,17 +308,12 @@ public class NewPageFloorController extends BaseController {
         if (floorContent.getFloorId() != null) {
             return "redirect:" + Global.getAdminPath() + "/newhome/newPageFloor/?repage";
         } else if (StringUtils.isNotBlank(floorContent.getFormType())) {
-            //清除活动专题缓存
-            redisService.removePattern("getPageFloorData*");
             if (floorContent.getRedirectFlag() == 1) {
                 return "redirect:" + Global.getAdminPath() + "/cmpage/cmPageCentre/?pageId=" + floorContent.getPageId() + "&type=" + floorContent.getFormType();
             } else {
                 return "redirect:" + Global.getAdminPath() + "/cmpage/cmPageCentre/goContentPage?centreId=" + floorContent.getCentreId() + "&pageId=" + floorContent.getPageId() + "&type=" + floorContent.getFormType();
             }
         } else {
-            //清除产品仪器缓存
-            redisService.removePattern("instrumentData*");
-            redisService.removePattern("insCommodityData*");
             return "redirect:" + Global.getAdminPath() + "/cmpage/cmPageCentre/?pageId=" + floorContent.getPageId() + "&type=5";
         }
     }
@@ -332,6 +327,13 @@ public class NewPageFloorController extends BaseController {
      * 有数据变动时需要清除缓存
      */
     public void cleanRedisCache() {
+        //清除活动专题缓存
+        redisService.removePattern("getPageFloorData*");
+        //清除活动专题缓存
+        redisService.removePattern("activityData*");
+        //清除产品仪器缓存
+        redisService.removePattern("instrumentData*");
+        redisService.removePattern("insCommodityData*");
         //首页缓存
         String homeData = "getHomeData*";
         redisService.removePattern(homeData);

+ 4 - 1
src/main/java/com/caimei/modules/product/dao/ProductDao.java

@@ -77,7 +77,7 @@ public interface ProductDao extends CrudDao<Product> {
 
     public int insertProductPriceRecord(ProductPriceRecord productPriceRecord);
 
-/*    public int updateCRMFlag(String enabledStatus, String[] ids);*/
+    /*    public int updateCRMFlag(String enabledStatus, String[] ids);*/
 
     public int updatePostFlag(String enabledStatus, String[] ids);
 
@@ -176,4 +176,7 @@ public interface ProductDao extends CrudDao<Product> {
     String findProductDetail(Integer productID);
 
     String findProductDescribe(Integer productID);
+
+    List<Integer> getProductIdByBrandId(String brandId);
+
 }

+ 1 - 0
src/main/resources/mappings/modules/brand/CmBrandMapper.xml

@@ -8,6 +8,7 @@
 		a.source AS "source",
 		a.userID AS "userID",
 		a.status AS "status",
+		a.weights AS "weights",
 		a.auditNote AS "auditNote",
 		a.sort AS "sort",
 		a.description AS "description",

File diff suppressed because it is too large
+ 476 - 476
src/main/resources/mappings/modules/product/ProductMapper.xml


+ 22 - 0
src/main/webapp/WEB-INF/views/modules/brand/cmBrandForm.jsp

@@ -53,6 +53,22 @@
                 $(".auditNoteClass").hide();
 			}
         }
+		/**
+		 * @param obj
+		 * jquery控制input只能输入0-100之间的整数
+
+		 * placeholder="请输入0-100之间的整数" onchange="weightVerify(this)"
+		 */
+		function weightVerify(obj) {
+			var weights = document.getElementById("weights").value;
+			if(weights<0){
+				alertx("只能输入0-100之间的整数");
+				$("#weights").val(0);
+			}else if(weights>100){
+				alertx("只能输入0-100之间的整数");
+				$("#weights").val(100);
+			}
+		}
 	</script>
 </head>
 <body>
@@ -76,6 +92,12 @@
 				<sys:ckfinder input="logoImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
 			</div>
 		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font> 品牌权重:</label>
+			<div class="controls">
+				<form:input path="weights" htmlEscape="false" class="input-xlarge required" type="number" value="50" step="1" placeholder="请输入0-100之间的整数" onchange="weightVerify(this)"/>
+			</div>
+		</div>
 		<div class="control-group">
 			<label class="control-label">品牌描述:</label>
 			<div class="controls">

+ 2 - 0
src/main/webapp/WEB-INF/views/modules/brand/cmBrandList.jsp

@@ -61,6 +61,7 @@
 				<th>ID</th>
 				<th>品牌logo</th>
 				<th>品牌名称</th>
+				<th>品牌权重</th>
 				<th>有无品牌描述</th>
 				<th>添加来源</th>
 				<th>供应商名称</th>
@@ -80,6 +81,7 @@
 				<td>
 					${cmBrand.name}
 				</td>
+				<td>${cmBrand.weights}</td>
 				<td>${empty cmBrand.description ? '无' : '有'}</td>
 				<td>
 					<c:if test="${cmBrand.source eq 0}">

+ 14 - 9
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp

@@ -549,7 +549,7 @@
         <tr>
             <th>商品说明:</th>
             <td colspan="3">
-                <form:textarea path="productDescribe" id="wipeRemarks" maxlength="200" placeholder="请输入备注文字,不能超过200字" class="input-xlarge required"  rows="4"></form:textarea>
+                <form:textarea path="productDescribe" id="wipeRemarks" maxlength="200" placeholder="请输入备注文字,不能超过200字" class="input-xlarge"  rows="4"></form:textarea>
                 <p style="width:500px;text-align:right;"><span id="remarkLen" style="color:red;">0</span>/200</p>
             </td>
         </tr>
@@ -583,15 +583,20 @@
         </tr>
         <tr>
             <th><span class="red">*</span>资质机构商品详情:</th>
-            <td colspan="1"><span style="color: red">(适用于资质机构)</span></td>
+            <td><span style="color: red">(适用于资质机构)</span></td>
             <th><span class="red">*</span>普通机构商品详情:</th>
-            <td colspan="5">
-                <span style="color: red">(适用于游客和个人机构,可选择是否和资质机构商品详情相同,不相同的话需要编辑内容)</span>
-                <label><input type="radio" name="productDetail"
-                              value="1" ${product.productDetail == "1" ? "checked" : ""} />同资质机构商品详情<b
-                        class="line">|</b></label>
-                <label><input type="radio" name="productDetail"
-                              value="2" ${product.productDetail == "2" || product.productDetail == null ? "checked" : ""} />不同于资质机构商品详情(即使用以下编辑内容)</label>
+            <td><span style="color: red">(适用于游客和个人机构,可选择是否和资质机构商品详情相同,不相同的话需要编辑内容)</span>
+                <label>
+                    <input type="radio"
+                           name="productDetail"
+                           value="1" ${product.productDetail == "1" ? "checked" : ""} />同资质机构商品详情<b
+                           class="line">|</b>
+                </label>
+                <label>
+                    <input type="radio"
+                           name="productDetail"
+                           value="2" ${product.productDetail == "2" || product.productDetail == null ? "checked" : ""} />不同于资质机构商品详情(即使用以下编辑内容)
+                </label>
             </td>
         </tr>
         <tr>

Some files were not shown because too many files changed in this diff