Browse Source

Merge remote-tracking branch 'origin/developerH' into developerH

zhengjinyi 2 năm trước cách đây
mục cha
commit
9c50aa6902

+ 2 - 1
src/main/java/com/caimei/modules/info/dao/InfoAdDao.java

@@ -3,6 +3,7 @@ package com.caimei.modules.info.dao;
 import com.caimei.modules.info.entity.InfoAd;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 信息广告DAO接口
@@ -11,5 +12,5 @@ import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
  */
 @MyBatisDao
 public interface InfoAdDao extends CrudDao<InfoAd> {
-
+        void updatesoft(@Param("soft")Integer soft, @Param("InfoId")Integer InfoId);
 }

+ 11 - 1
src/main/java/com/caimei/modules/info/entity/InfoAd.java

@@ -20,7 +20,17 @@ public class InfoAd extends DataEntity<InfoAd> {
 	private String guidanceImage;		// 引导图
 	private Long clickRate;		// 点击量
 	private String enabledStatus;		// 启用/禁用状态
-//	private String soft;      //排序值
+	private Integer soft;//排序值
+
+	public Integer getSoft() {
+		return soft;
+	}
+
+	public void setSoft(Integer soft) {
+		this.soft = soft;
+	}
+
+	//	private String soft;      //排序值
 //	public void setSoft(String soft) {
 //		this.soft = soft;
 //	}

+ 4 - 1
src/main/java/com/caimei/modules/info/service/InfoAdService.java

@@ -82,5 +82,8 @@ public class InfoAdService extends CrudService<InfoAdDao, InfoAd> {
 	public void updateEnabledStatusByIds(String enabledStatus, String[] ids) {
 		infoAdDao.updateEnabledStatusByIds(enabledStatus,ids);
 	}
-	
+	@Transactional(readOnly = false)
+	public void updatesoft(Integer soft,Integer InfoId) {
+		infoAdDao.updatesoft(soft,InfoId);
+	}
 }

+ 14 - 0
src/main/java/com/caimei/modules/info/web/InfoAdController.java

@@ -105,4 +105,18 @@ public class InfoAdController extends BaseController {
 		}
         return map;  
 	}
+
+	/**
+	 * 修改排序值
+	 * @param soft
+	 * @param InfoId
+	 * @param request
+	 * @param response
+	 * @return
+	 */
+	@RequestMapping(value="/update/soft")
+	public String updatesoft(Integer soft,Integer InfoId,HttpServletRequest request,HttpServletResponse response){
+		infoAdService.updatesoft(soft,InfoId);
+		return "modules/info/infoAdList";
+	}
 }

+ 9 - 1
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -168,7 +168,7 @@ public class Product extends DataEntity<Product> {
     private String source;  //信息来源 1网站 2小程序 3后台 4小程序-协销
     private String dockingPeopleName; //对接人名称
     private Integer floorId;//呵呵商城楼层id
-
+    private Integer insertStatus;
 
     /**
      * 商品别名
@@ -1741,4 +1741,12 @@ public class Product extends DataEntity<Product> {
     public void setReturnGoodsStutas(Integer returnGoodsStutas) {
         this.returnGoodsStutas = returnGoodsStutas;
     }
+
+    public Integer getInsertStatus() {
+        return insertStatus;
+    }
+
+    public void setInsertStatus(Integer insertStatus) {
+        this.insertStatus = insertStatus;
+    }
 }

+ 10 - 8
src/main/java/com/caimei/modules/product/service/ProductNewService.java

@@ -100,14 +100,16 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
         List<Product> list = dao.findList(entity);
         list.forEach(p -> {
             CmSku sku = productDao.findSku(p.getProductID());
-            p.setPrice(sku.getPrice());
-            p.setNormalPrice(sku.getNormalPrice());
-            Integer costCheckFlag = sku.getCostCheckFlag();
-            p.setCostCheckFlag(costCheckFlag.toString());
-            if(1==costCheckFlag){
-                p.setCostPrice(sku.getCostPrice().toString());
-            }else{
-                p.setSqlCostProportional(sku.getCostProportional());
+            if(null!=sku){
+                p.setPrice(sku.getPrice());
+                p.setNormalPrice(sku.getNormalPrice());
+                Integer costCheckFlag = sku.getCostCheckFlag();
+                p.setCostCheckFlag(costCheckFlag.toString());
+                if(1==costCheckFlag){
+                    p.setCostPrice(sku.getCostPrice().toString());
+                }else{
+                    p.setSqlCostProportional(sku.getCostProportional());
+                }
             }
         });
         page.setList(list);

+ 1 - 0
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -350,6 +350,7 @@ public class ProductNewController extends BaseController {
             product.setSmallTypeID(0);
             product.setTinyTypeID(0);
             product.setShopType(2);
+            product.setInsertStatus(1);
         }
         product.setCommodityType(StringUtils.isEmpty(product.getCommodityType()) ? "0" : product.getCommodityType());
         List<CmBrand> brandList = productService.findBrandList();

+ 12 - 5
src/main/resources/mappings/modules/info/InfoAdMapper.xml

@@ -16,7 +16,8 @@
 		a.createBy AS "createBy.id",
 		a.createDate AS "createDate",
 		a.updateBy AS "updateBy.id",
-		a.updateDate AS "updateDate"
+		a.updateDate AS "updateDate",
+		a.soft as "soft"
 	</sql>
 	
 	<sql id="infoAdJoins">
@@ -94,7 +95,8 @@
 			createBy,
 			createDate,
 			updateBy,
-			updateDate
+			updateDate,
+			soft
 		) VALUES (
 			#{serviceObject},
 			#{link},
@@ -107,7 +109,8 @@
 			#{createBy.id},
 			#{createDate},
 			#{updateBy.id},
-			#{updateDate}
+			#{updateDate},
+			#{soft}
 		)
 	</insert>
 	
@@ -122,7 +125,8 @@
 			clickRate = #{clickRate},
 			enabledStatus = #{enabledStatus},
 			updateBy = #{updateBy.id},
-			updateDate = #{updateDate}
+			updateDate = #{updateDate},
+			soft=#{soft}
 		WHERE id = #{id}
 	</update>
 	
@@ -138,5 +142,8 @@
 	       #{id}
 	 	</foreach>
 	</update>
-	
+	<update id="updatesoft">
+		UPDATE info_ad a SET a.soft = #{soft}
+		WHERE  a.id =#{InfoId}
+	</update>
 </mapper>

+ 6 - 0
src/main/webapp/WEB-INF/views/modules/info/infoAdForm.jsp

@@ -97,6 +97,12 @@
 				</form:select>
 			</div>
 		</div>
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>排序值:</label>
+			<div class="controls">
+				<form:input path="soft" htmlEscape="false" maxlength="11" class="input-xlarge required" type="number"/>
+			</div>
+		</div>
 		<div class="form-actions">
 			<shiro:hasPermission name="info:infoAd:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
 			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>

+ 21 - 4
src/main/webapp/WEB-INF/views/modules/info/infoAdList.jsp

@@ -7,8 +7,24 @@
 	<style type="text/css">
 	.table th{text-align: center;}
 	.table td{text-align: center;}
+	#soft{
+		width: 80px;
+	}
 	</style>
 	<script type="text/javascript">
+		//失焦修改排序值
+		function upSoft(infoAd,softs){
+			var soft=softs.value;
+			$.post("${ctx}/info/infoAd/update/soft",{'soft':soft,'InfoId':infoAd}, function(data) {
+				if(true==data.success){
+					setTimeout(function () {
+						$("#searchForm").submit();
+					},200)
+				} else {
+					$.jBox.tip(data.msg,'error');
+				}
+			},"JSON");//这里返回的类型有:json,html,xml,text
+		}
 		$(document).ready(function() {
 			
 		});
@@ -79,7 +95,7 @@
 				<th>广告位置</th>
 				<th>引导图</th>
 				<th>链接</th>
-<%--				<th>排序</th>--%>
+				<th>排序</th>
 				<th>点击量</th>
 				<th>添加时间</th>
 				<th>状态</th>
@@ -102,9 +118,10 @@
 				<td>
 					${infoAd.link}
 				</td>
-<%--				<td>--%>
-<%--						<input id="soft" value="${infoAd.soft}" onblur="savaSoftValue()">--%>
-<%--				</td>--%>
+				<td>
+					<input id="soft" type="number" value="${infoAd.soft}" maxlength="11" onblur="upSoft(${infoAd.id},this)">
+<%--					<input value="${infoAd.soft}">	--%>
+				</td>
 				<td>
 					${empty infoAd.clickRate?0:(infoAd.clickRate)}
 				</td>

+ 20 - 13
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp

@@ -1668,6 +1668,7 @@
         trainingShow();
     }
     var conn=0;
+    var insertStatus='${product.insertStatus}';
     function loadSmallType(id) {
         if (id) {
             $("#bigType").val(id);
@@ -1709,7 +1710,13 @@
             document.getElementById("s2id_smallType").style.cssText = "display: none";
         }
         loadTinyType();
-        loadGoods(conn);
+        if(insertStatus==1){
+            conn=1;
+            loadGoods(conn);
+            insertStatus++;
+        }else{
+            loadGoods(conn);
+        }
     }
 
     function loadTinyType(id) {
@@ -1749,13 +1756,13 @@
     function loadGoods(id){
             var bigType=null;
             if(id==1){
-                bigType='${product.returnGoodsStutas}'
-                $("#goods").html("");
-                $("#goods").prev().find(".select2-chosen").text("请选择");
-                $("#goods").append("<option value=''>请选择</option>");
-                var not='不能';
-                var ye='能';
                 if(typeof (bigType) != "undefined" && bigType != ""){
+                    bigType='${product.returnGoodsStutas}'
+                    $("#goods").html("");
+                    $("#goods").prev().find(".select2-chosen").text("请选择");
+                    $("#goods").append("<option value=''>请选择</option>");
+                    var not='不能';
+                    var ye='能';
                     if(bigType=='2'){
                         $("#goods").append("<option value='1'>" + '能' + "</option>");
                         $("#goods").append("<option selected value='2'>" + not + "</option>");
@@ -1767,13 +1774,13 @@
                     }
                 }
             }else{
-                bigType = $("#bigType").val();
-                $("#goods").html("");
-                $("#goods").prev().find(".select2-chosen").text("请选择");
-                $("#goods").append("<option value=''>请选择</option>");
-                var not='不能';
-                var ye='能';
                 if(typeof (bigType) != "undefined" && bigType != ""){
+                    bigType = $("#bigType").val();
+                    $("#goods").html("");
+                    $("#goods").prev().find(".select2-chosen").text("请选择");
+                    $("#goods").append("<option value=''>请选择</option>");
+                    var not='不能';
+                    var ye='能';
                     if(bigType=='1014'||bigType=='1016'||bigType=='1021'||bigType=='1023'){
                         $("#goods").append("<option value='1'>" + '能' + "</option>");
                         $("#goods").append("<option selected value='2'>" + not + "</option>");