Sfoglia il codice sorgente

修改客户信息

liujiankang 7 anni fa
parent
commit
ed0297eccb

+ 56 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/customer/LowestPriceInfo.java

@@ -0,0 +1,56 @@
+package com.iamberry.rst.core.customer;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by Administrator on 2018/5/15.
+ */
+public class LowestPriceInfo implements Serializable {
+    private static final long serialVersionUID = -8005905099621784835L;
+    private Integer lowestPriceId;//
+    private Integer productId;
+    private Integer channelDivisionId;
+    private Integer lowestPrice;
+    private Date createDate;
+
+    public Integer getLowestPriceId() {
+        return lowestPriceId;
+    }
+
+    public void setLowestPriceId(Integer lowestPriceId) {
+        this.lowestPriceId = lowestPriceId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getChannelDivisionId() {
+        return channelDivisionId;
+    }
+
+    public void setChannelDivisionId(Integer channelDivisionId) {
+        this.channelDivisionId = channelDivisionId;
+    }
+
+    public Integer getLowestPrice() {
+        return lowestPrice;
+    }
+
+    public void setLowestPrice(Integer lowestPrice) {
+        this.lowestPrice = lowestPrice;
+    }
+
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+}

+ 6 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/customer/CustomerBasicService.java

@@ -217,4 +217,10 @@ public interface CustomerBasicService {
      */
     Integer deleteDivisionInfo(Integer channelDivisionId);
 
+    /**
+     * 获取产品最低价格信息
+     * @param lowestPriceInfo
+     * @return
+     */
+    LowestPriceInfo getLowestPrice(LowestPriceInfo lowestPriceInfo);
 }

+ 5 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/CustomerBasicServiceImpl.java

@@ -301,6 +301,11 @@ public class CustomerBasicServiceImpl implements CustomerBasicService{
     public Integer deleteDivisionInfo(Integer channelDivisionId) {
         return customerBasicMapper.deleteDivisionInfo(channelDivisionId);
     }
+
+    @Override
+    public LowestPriceInfo getLowestPrice(LowestPriceInfo lowestPriceInfo) {
+        return customerBasicMapper.getLowestPrice(lowestPriceInfo);
+    }
     /*@Override
     public void saveDockedContactInfo(DockedContactInfo dockedContactInfo) {
         customerBasicInfoSaveMapper.saveDockedContactInfo(dockedContactInfo);

+ 7 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicMapper.java

@@ -199,4 +199,11 @@ public interface CustomerBasicMapper {
      * @return
      */
     String queryIsExsitChannelNameChannelName(ChannelSaleInfo channelSaleInfo);
+
+    /**
+     * 获取产品最低价格信息
+     * @param lowestPriceInfo
+     * @return
+     */
+    LowestPriceInfo getLowestPrice(LowestPriceInfo lowestPriceInfo);
 }

+ 8 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicMapper.xml

@@ -671,4 +671,12 @@
     <delete id="deleteDivisionInfo" parameterType="Integer">
         DELETE FROM tb_rst_channel_division_info WHERE channel_division_id = #{channelDivisionId}
     </delete>
+
+    <select id="getLowestPrice" parameterType="LowestPriceInfo" resultType="LowestPriceInfo">
+      select * from tb_rst_lowest_price_info
+      where
+      product_id = #{productId}
+      AND
+      channel_division_id = #{channelDivisionId}
+    </select>
 </mapper>

+ 20 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/customer/CustomerBasicController.java

@@ -532,4 +532,24 @@ public class CustomerBasicController {
         }
         return rj;
     }
+
+    /**
+     * 根据销售产品id和渠道id查询最低价
+     *
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "/getLowestPrice")
+    public ResponseJson getLowestPrice(HttpServletRequest request,LowestPriceInfo lowestPriceInfo) {
+        if(lowestPriceInfo != null){
+            lowestPriceInfo = customerBasicService.getLowestPrice(lowestPriceInfo);
+        }
+        if (lowestPriceInfo != null) {
+            ResponseJson rj =new ResponseJson(200, "查询成功", 200);
+            rj.addResponseKeyValue("lowestPriceInfo", lowestPriceInfo);
+            return rj;
+        } else {
+            return new ResponseJson(500, "查询失败", 500);
+        }
+    }
 }

+ 1 - 0
watero-rst-web/src/main/resources/watero-rst-orm.xml

@@ -99,6 +99,7 @@
 		<typeAlias type="com.iamberry.rst.core.customer.CustomerBasicInfo" alias="CustomerBasicInfo"/>
 		<typeAlias type="com.iamberry.rst.core.customer.DockedContactInfo" alias="DockedContactInfo"/>
 		<typeAlias type="com.iamberry.rst.core.customer.TicketOpeningInfo" alias="TicketOpeningInfo"/>
+		<typeAlias type="com.iamberry.rst.core.customer.LowestPriceInfo" alias="LowestPriceInfo"/>
 	</typeAliases>
 	<!-- PageHelper -->
 	<plugins>

+ 38 - 3
watero-rst-web/src/main/webapp/WEB-INF/views/customer/save_customer_info.ftl

@@ -234,7 +234,7 @@
                 <#--<input type="text" class="input-text"  style="width:120px;margin-right: 0px;margin-bottom: 10px;"  placeholder="手动填写供货价格" id="writeSupplyPrice" name="writeSupplyPrice">-->
             </div>
             <div class="formControls col-2 col-sm-2" style="width:80px;padding:0 0;margin-right: 15px;">
-                <input type="text" class="input-text"  style="width:80px;margin-right: 0px;"  placeholder="手动填写供货价格" id="writeSupplyPrice" name="writeSupplyPrice">
+                <input type="text" class="input-text"  style="width:80px;margin-right: 0px;"  placeholder="手动填写供货价格" id="writeSupplyPrice" name="writeSupplyPrice" onkeyup='this.value=this.value.replace(/\D/gi,"")'>
             </div>
             <label class="form-label col-2 col-sm-2" style="width:135px;padding:0 0;">
                 <button type="button" style="cursor:pointer; float: right;height: 31px;" class="my-btn-search" id="channelSaleId" onclick="toAddChannelSaleInfo();">添加</button>
@@ -471,6 +471,34 @@
         })
     })
 
+    /*获取产品最低价*/
+
+    function getLowestPrice(){
+        var channelDivisionId = document.getElementById("channelCategory").value;
+        var productId = document.getElementById("promotingProducts").value;
+        var writeSupplyPrice = document.getElementById("writeSupplyPrice").value;
+        var msg = null;
+            $.ajax({
+                type: "POST",
+                data: {
+                    productId : productId,
+                    channelDivisionId : channelDivisionId
+                },
+                url: "${path}/admin/customerBasic/getLowestPrice",
+                async: false,
+                success: function(data){
+                    if (data.returnCode == 200) {
+                       if(writeSupplyPrice < data.returnMsg.lowestPriceInfo.lowestPrice){
+                           msg = data.returnMsg.lowestPriceInfo.lowestPrice;
+                       }
+                    }
+                },
+                error: function(XmlHttpRequest, textStatus, errorThrown){
+                }
+            });
+            return msg;
+    }
+
     /*付款/退款信息填充到开票信息*/
     $("input[name='accountNum']").blur(function (){
         var accountType = $("input[name='accountType']:checked").val();
@@ -660,7 +688,7 @@
                     if (data.returnCode == 200) {
                         for(var i=0;i<data.returnMsg.channelTypeList.length;i++){
                             channelTypeListInfo = data.returnMsg.channelTypeList[i];
-                            html += '<option value="'+ channelTypeListInfo.channelName +'">'+ channelTypeListInfo.channelType +'</option>';
+                            html += '<option value="'+ channelTypeListInfo.channelDivisionId +'">'+ channelTypeListInfo.channelType +'</option>';
                         }
                     }else{
                         html = '';
@@ -874,7 +902,9 @@
         }else if(channelCategory == "4"){
             channelCategory = "海外";
         }
-        var channelType = document.getElementById("channelType").value;
+        /*var channelType = document.getElementById("channelType").value;*/
+        var mychannelType=document.getElementById("channelType");
+        var channelType = mychannelType.options[mychannelType.selectedIndex].text;
         var channelName = document.getElementById("channelName").value;
         var promotingProducts = document.getElementById("promotingProducts").value;
         var myselect=document.getElementById("promotingProducts");
@@ -922,6 +952,11 @@
             layer.msg("供货价格长度超限", {icon:2, time: 3000});
             return;
         }
+        var s = getLowestPrice();
+        if(s != null){
+            layer.msg("最低价格不能少于"+s, {icon:2, time: 3000});
+            return;
+        }
         var promotingProductsHtml = '<input type="hidden" value="'+promotingProducts+'">';
         //var operation = "删除";
         var operation = "<a href='javascript:;' onclick='deleteChannelSale(this)' name='deleteChannelSale'>删除</a>";

+ 35 - 1
watero-rst-web/src/main/webapp/WEB-INF/views/customer/update_customer_info.ftl

@@ -270,7 +270,7 @@
                 </span>
             </div>
             <div class="formControls col-2 col-sm-2" style="width:80px;padding:0 0;">
-                <input type="text" class="input-text"  style="width:80px;margin-right: 0;margin-bottom: 10px;"  placeholder="填写供货价格" id="writeSupplyPrice" name="writeSupplyPrice">
+                <input type="text" class="input-text"  style="width:80px;margin-right: 0;margin-bottom: 10px;"  placeholder="填写供货价格" id="writeSupplyPrice" name="writeSupplyPrice" onkeyup='this.value=this.value.replace(/\D/gi,"")'>
             </div>
 
             <label class="form-label col-2 col-sm-2" style="width:150px;padding:0 0;">
@@ -630,6 +630,35 @@
         }
     });
 
+    /*获取产品最低价*/
+
+    function getLowestPrice(){
+        var channelDivisionId = document.getElementById("channelCategory").value;
+        var productId = document.getElementById("promotingProducts").value;
+        var writeSupplyPrice = document.getElementById("writeSupplyPrice").value;
+        var msg = null;
+        $.ajax({
+            type: "POST",
+            data: {
+                productId : productId,
+                channelDivisionId : channelDivisionId
+            },
+            url: "${path}/admin/customerBasic/getLowestPrice",
+            async: false,
+            success: function(data){
+                if (data.returnCode == 200) {
+                    if(writeSupplyPrice < data.returnMsg.lowestPriceInfo.lowestPrice){
+                        msg = data.returnMsg.lowestPriceInfo.lowestPrice;
+                    }
+                }
+            },
+            error: function(XmlHttpRequest, textStatus, errorThrown){
+            }
+        });
+        return msg;
+    }
+
+
     /*业务逻辑js控制 start*/
     $(document).on('click', '.dalog-ask .answer', function() {
         var customerProvinceCode = $(this).find(".customerProvinceCode").val();
@@ -1037,6 +1066,11 @@
             layer.msg("供货价格长度超限");
             return;
         }
+        var s = getLowestPrice();
+        if(s != null){
+            layer.msg("最低价格不能少于"+s, {icon:2, time: 3000});
+            return;
+        }
         layer.tips('记得点击底部确认修改按钮哦', '#channelSaleId', {
             tips: [2, '#3595CC'],
             time: 3000