Quellcode durchsuchen

修改了代理商实体类(有冲突)

liuzhiwei vor 7 Jahren
Ursprung
Commit
d3d2af62ea

+ 27 - 27
tooth-common-core/src/main/java/com/iamberry/wechat/core/entity/agentInfo/AgentInfo.java

@@ -4,11 +4,11 @@ import java.util.Date;
 
 /**
  * 代理商信息表
- * Created by liuzhiwei on 2017/10/11.
+ * Created by liuzhiwei on 2017/10/12.
  */
-public class AgentInfo implements java.io.Serializable{
+public class AgentTooth implements java.io.Serializable{
 
-    private static final long serialVersionUID = 2348414330680714715L;
+    private static final long serialVersionUID = 9112955646979500166L;
     private Integer agentId;        //id
     private String agentName;      //名称
     private String agentAddr;      //地址
@@ -26,6 +26,30 @@ public class AgentInfo implements java.io.Serializable{
         this.agentId = agentId;
     }
 
+    public String getAgentName() {
+        return agentName;
+    }
+
+    public void setAgentName(String agentName) {
+        this.agentName = agentName;
+    }
+
+    public String getAgentAddr() {
+        return agentAddr;
+    }
+
+    public void setAgentAddr(String agentAddr) {
+        this.agentAddr = agentAddr;
+    }
+
+    public String getAgentTel() {
+        return agentTel;
+    }
+
+    public void setAgentTel(String agentTel) {
+        this.agentTel = agentTel;
+    }
+
     public Integer getAgentRoleId() {
         return agentRoleId;
     }
@@ -57,28 +81,4 @@ public class AgentInfo implements java.io.Serializable{
     public void setAgentOpenid(String agentOpenid) {
         this.agentOpenid = agentOpenid;
     }
-
-    public String getAgentName() {
-        return agentName;
-    }
-
-    public void setAgentName(String agentName) {
-        this.agentName = agentName;
-    }
-
-    public String getAgentAddr() {
-        return agentAddr;
-    }
-
-    public void setAgentAddr(String agentAddr) {
-        this.agentAddr = agentAddr;
-    }
-
-    public String getAgentTel() {
-        return agentTel;
-    }
-
-    public void setAgentTel(String agentTel) {
-        this.agentTel = agentTel;
-    }
 }

+ 9 - 1
tooth-wechat-interface/src/main/java/com/iamberry/wechat/face/agentInfo/AgentInfoService.java

@@ -1,6 +1,7 @@
 package com.iamberry.wechat.face.agentInfo;
 
 import com.iamberry.wechat.core.entity.agentInfo.AgentConfig;
+import com.iamberry.wechat.core.entity.agentInfo.AgentTooth;
 
 import java.util.List;
 
@@ -14,5 +15,12 @@ public interface AgentInfoService {
      * @param config
      * @return
      */
-    List<AgentConfig> ListAgentConfig(AgentConfig config);
+    List<AgentConfig> listAgentConfig(AgentConfig config);
+
+    /**
+     * 查询代理商集合
+     * @param agentTooth
+     * @return
+     */
+    List<AgentTooth> listAgentTooth(AgentTooth agentTooth);
 }

+ 8 - 2
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/agentInfo/AgentInfoServiceImpl.java

@@ -1,6 +1,7 @@
 package com.iamberry.wechat.service.agentInfo;
 
 import com.iamberry.wechat.core.entity.agentInfo.AgentConfig;
+import com.iamberry.wechat.core.entity.agentInfo.AgentTooth;
 import com.iamberry.wechat.face.agentInfo.AgentInfoService;
 import com.iamberry.wechat.service.mapper.AgentInfoMapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,7 +19,12 @@ public class AgentInfoServiceImpl implements AgentInfoService {
     private AgentInfoMapper agentInfoMapper;
 
     @Override
-    public List<AgentConfig> ListAgentConfig(AgentConfig config) {
-        return agentInfoMapper.ListAgentConfig(config);
+    public List<AgentConfig> listAgentConfig(AgentConfig config) {
+        return agentInfoMapper.listAgentConfig(config);
+    }
+
+    @Override
+    public List<AgentTooth> listAgentTooth(AgentTooth agentTooth) {
+        return agentInfoMapper.listAgentTooth(agentTooth);
     }
 }

+ 9 - 1
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/AgentInfoMapper.java

@@ -1,6 +1,7 @@
 package com.iamberry.wechat.service.mapper;
 
 import com.iamberry.wechat.core.entity.agentInfo.AgentConfig;
+import com.iamberry.wechat.core.entity.agentInfo.AgentTooth;
 
 import java.util.List;
 
@@ -14,5 +15,12 @@ public interface AgentInfoMapper {
      * @param config
      * @return
      */
-    List<AgentConfig> ListAgentConfig(AgentConfig config);
+    List<AgentConfig> listAgentConfig(AgentConfig config);
+
+    /**
+     * 查询代理商集合
+     * @param agentTooth
+     * @return
+     */
+    List<AgentTooth> listAgentTooth(AgentTooth agentTooth);
 }

+ 29 - 3
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/agentInfoMapper.xml

@@ -10,13 +10,39 @@
         config_status configStatus,
         config_create_time configCreateTime
     </sql>
+    <sql id="agentInfo">
+      agent_id agentId,
+      agent_name agentName,
+      agent_addr agentAddr,
+      agent_tel agentTel,
+      agent_role_id agentRoleId,
+      agent_create_date agentCreateDate,
+      agent_status agentStatus,
+      agent_openid agentOpenid
+    </sql>
+
+    <!-- 查询代理商列表 -->
+    <select id="listAgentTooth" parameterType="AgentTooth" resultType="AgentTooth">
+      select <include refid="agentInfo"/> from tb_iamberry_agent_agentinfo where agent_status = #{agentStatus}
+    </select>
 
     <!-- 查询代理商配置金额集合 -->
-    <select id="ListAgentConfig" parameterType="AgentConfig" resultType="AgentConfig">
+    <select id="listAgentConfig" parameterType="AgentConfig" resultType="AgentConfig">
       select
-        <include refid="agentConfig"/>
+        a.config_id configId,
+        a.agent_id agentId,
+        a.color_id colorId,
+        a.config_amount configAmount,
+        a.config_status configStatus,
+        a.config_create_time configCreateTime,
+        c.color_name colorName,
+        p.product_name productName,
+        i.agent_name agentName
       from
-        tb_iamberry_agent_config
+        tb_iamberry_agent_config a
+        LEFT JOIN tb_iamberry_agent_agentinfo i ON a.agent_id = i.agent_id
+        LEFT JOIN tb_iamberry_product_color c ON a.color_id = c.color_id
+        LEFT JOIN tb_iamberry_product_info p ON c.color_product_id = p.product_id
         <if test="page!=null and page.pageSize>0 ">
             LIMIT ${page.recordBegin},${page.pageSize}
         </if>

+ 45 - 1
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/admin/AdminAgentToothHandler.java

@@ -1,16 +1,24 @@
 package com.iamberry.wechat.handles.admin;
 
 import com.iamberry.wechat.core.entity.PageBean;
+import com.iamberry.wechat.core.entity.ResultMsg;
 import com.iamberry.wechat.core.entity.agentInfo.AgentConfig;
+import com.iamberry.wechat.core.entity.agentInfo.AgentTooth;
+import com.iamberry.wechat.core.entity.product.ProductColor;
 import com.iamberry.wechat.face.agentInfo.AgentInfoService;
+import com.iamberry.wechat.face.porduct.ProductColorService;
+import com.iamberry.wechat.tools.ResultInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 代理商逻辑处理类
@@ -22,6 +30,8 @@ public class AdminAgentToothHandler {
 
     @Autowired
     private AgentInfoService agentInfoService;
+    @Autowired
+    private ProductColorService productColorService;
 
     @RequestMapping("/select_agent_config_list")
     public ModelAndView selectAgentConfigList(HttpServletRequest request,
@@ -36,9 +46,43 @@ public class AdminAgentToothHandler {
         page.initRecordBegin();
         config.setPage(page);
         //查询代理商配置金额集合
-        List<AgentConfig> configList = agentInfoService.ListAgentConfig(config);
+        List<AgentConfig> configList = agentInfoService.listAgentConfig(config);
         mv.addObject("configList", configList);
         mv.addObject("pageNO", pageNO);
         return mv;
     }
+
+    @RequestMapping("/_add_agent_config")
+    public ModelAndView addAgentConfigUI(HttpServletRequest request) throws Exception {
+        ModelAndView mv = new ModelAndView("admin/agentInfo/addAgentConfig");
+        return mv;
+    }
+
+    /**
+     * 查询商品列表
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/select_agent_and_product")
+    public ResultMsg selectAgentAndProduct(HttpServletRequest request) throws Exception {
+        ResultMsg msg = new ResultMsg();
+        Map<String,Object> map = new HashMap<String,Object>();
+        ProductColor productColor = new ProductColor();
+        productColor.setPage(null);
+        List<ProductColor> colorList = productColorService.selectProductColorList(productColor);
+        if (colorList == null || colorList.size() <= 0) {
+            msg.setStatus(false);
+        }
+        AgentTooth agent = new AgentTooth();
+        agent.setAgentStatus(1);
+        List<AgentTooth> agentList = agentInfoService.listAgentTooth(agent);
+        map.put("colorList",colorList);
+        map.put("agentList",agentList);
+        msg.setData(map);
+        msg.setStatus(true);
+        msg.setResultCode(ResultInfo.SUCCESSCODE);
+        return msg;
+    }
 }

+ 1 - 0
tooth-wechat-web/src/main/resources/iamberry-wechat-service-mybatis.xml

@@ -222,6 +222,7 @@
 		<typeAlias type="com.iamberry.wechat.core.entity.machineNumber.WarrantyCard" alias="WarrantyCard"/>
 		<!-- 代理商信息 -->
 		<typeAlias type="com.iamberry.wechat.core.entity.agentInfo.AgentConfig" alias="AgentConfig"/>
+		<typeAlias type="com.iamberry.wechat.core.entity.agentInfo.AgentTooth" alias="AgentTooth"/>
 
 		<!-- 销售统计 -->
 		<typeAlias type="com.iamberry.wechat.core.entity.statictics.StatisticsSalesOrder" alias="StatisticsSalesOrder"/>

+ 157 - 0
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/agentInfo/addAgentConfig.jsp

@@ -0,0 +1,157 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+         pageEncoding="UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="renderer" content="webkit|ie-comp|ie-stand">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <!-- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" /> -->
+    <meta http-equiv="Cache-Control" content="no-siteapp" />
+    <!--[if lt IE 9]>
+    <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/html5.js"></script>
+    <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/respond.min.js"></script>
+    <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/PIE_IE678.js"></script>
+    <![endif]-->
+    <link href="${pageContext.request.contextPath }/common/css/bootstrap.min-3.3.css" rel="stylesheet" type="text/css" />
+    <link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
+    <link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
+    <link href="${pageContext.request.contextPath }/common/admin/lib/select2/select2.min.css" rel="stylesheet" type="text/css" />
+    <link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
+    <!--[if IE 6]>
+    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
+    <script>DD_belatedPNG.fix('*');</script>
+    <![endif]-->
+
+    <style>
+        #datainit{
+            margin-left:5px;
+        }
+
+        ul {
+            width: 800px;
+        }
+        li {
+            width: 400px;
+            float: left;
+            display: block;
+        }
+
+    </style>
+    <title>代理商管理操作</title>
+</head>
+<body>
+<div class="codeView">
+    <form action="${pageContext.request.contextPath }/admin/product/add_product_price" method="post" class="form form-horizontal" id="form-Validform" novalidate="novalidate">
+        <div id="pre_product" class="row cl">
+            <label class="form-label col-xs-4 col-sm-3">代理商信息:</label>
+            <div class="col-xs-6 col-sm-6">
+                <select id="sel_agent">
+
+                </select>
+            </div>
+        </div>
+        <div class="row cl">
+            <label class="form-label col-xs-4 col-sm-3">产品价格:</label>
+            <div class="col-xs-6 col-sm-6">
+                <input type="text" class="input-text" style="width: 300px;" nullmsg="产品价格不能为空" name="pre_price" id="pre_price">
+                <input type="hidden" class="input-text" style="width: 300px;" name="qrcodePreDiscount" id="qrcodePreDiscount">
+            </div>
+        </div>
+        <div id="pre_div">
+            <div class="row cl">
+                <label class="form-label col-xs-4 col-sm-3">请选择产品:</label>
+                <div class="col-xs-6 col-sm-6">
+                    <ul id="pro_gift" class="my-table-list">
+
+                    </ul>
+                </div>
+            </div>
+        </div>
+        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
+            <input class="btn btn-primary" type="submit" onclick="return checkValue();"  value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
+        </div>
+    </form>
+</div>
+
+
+
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/laypage/1.2/laypage.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/My97DatePicker/WdatePicker.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/select2/select2.min.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/select2/zh-CN.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/Validform/5.3.2/Validform.min.js"></script>
+<script type="text/javascript">
+    var isNum=/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
+    $(function(){
+        $.ajax({
+            url: '${pageContext.request.contextPath }/admin/agentTooth/select_agent_and_product',
+            dataType:'json',//服务器返回json格式数据
+            type:'post',	//HTTP请求类型
+            error:function(data){
+
+            },
+            success:  function(dt){
+                if(dt.status){
+                    console.log(dt.data);
+                    var color_list = [];
+                    var agent_list = [];
+                    color_list = dt.data.colorList;
+                    agent_list = dt.data.agentList;
+                    var table = document.body.querySelector('.my-table-list');
+                    var sel_agent = $('#sel_agent');
+                    $.each(agent_list, function(i,item) {
+                        sel_agent.append("<option value='" + item.agentId + "'>" + item.agentName + "</option>");
+                    });
+                    $.each(color_list, function(i,item){
+                        var li = document.createElement('li');
+                        li.innerHTML = '<input type="checkbox" name="pre_gift" value="'+item.colorId+'"/>' + item.colorProductName;
+                        table.appendChild(li);
+                    });
+                }else{
+                    layer.msg(data.message,{icon:1,time:3000});
+                }
+            }
+        });
+    });
+
+    //校验输入金额格式
+    function checkValue() {
+        var check = true;
+        var message = '';
+        var pre_price = $('#pre_price').val().trim();
+        var sales_price = $('#sales_price').val().trim();
+        if (pre_price != null && pre_price != '') {
+            if (!isNum.test(pre_price)) {
+                check = false;
+                message = "扫描优惠二维码优惠价格格式不正确,请重新输入!";
+            } else {
+                $('#qrcodePreDiscount').val(pre_price * 100);
+            }
+        }
+        if (sales_price != null && sales_price != '') {
+            if (!isNum.test(sales_price)) {
+                check = false;
+                message = "扫描购买二维码优惠价格格式不正确,请重新输入!";
+            } else {
+                $('#qrcodeSalesDiscount').val(sales_price * 100);
+            }
+        }
+        if (!check) {
+            alert(message);
+        }
+        return check;
+    }
+
+</script>
+
+</body>
+</html>

+ 8 - 8
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/agentInfo/agentConfigList.jsp

@@ -33,7 +33,7 @@
 <body>
 <nav class="breadcrumb">
     <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
-    商城管理 <span class="c-gray en">&gt;</span>扫描优惠二维码赠品列表 <a
+    商城管理 <span class="c-gray en">&gt;</span>代理商优惠价管理 <a
         class="btn btn-success radius r mr-20"
         style="line-height: 1.6em; margin-top: 3px"
         href="javascript:location.replace(location.href);" title="刷新"><i
@@ -42,12 +42,12 @@
 <div class="pd-20">
     <div class="cl pd-5 bg-1 bk-gray mt-20">
 		<span class="l">
-			<a href="${pageContext.request.contextPath }/admin/product/_add_product_price" class="btn btn-primary radius">
-				<i class="Hui-iconfont">&#xe600;</i> 添加优惠价
+			<a href="${pageContext.request.contextPath }/admin/agentTooth/_add_agent_config" class="btn btn-primary radius">
+				<i class="Hui-iconfont">&#xe600;</i> 添加优惠价
 			</a>
 		</span>
     </div>
-    <form id="goodsform" >
+    <form id="configform" >
         <table class="table table-border table-bordered table-bg" id="example">
             <thead>
             <tr>
@@ -75,12 +75,12 @@
                 <td id="config_status">${config.configStatus==1?'启用':''}${config.configStatus==2?'停用':''}</td>
                 <td><fmt:formatDate value="${config.configCreateTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                 <td class="td-manage">
-                    <input id="qrcodeStatus" type="hidden" value="${config.configStatus }">
-                    <select id="Goodstatus" name="" onchange="updateGiftState(this,${config.configId })">
+                    <input id="configStatus" type="hidden" value="${config.configStatus }">
+                    <select id="goodstatus" name="" onchange="updateGiftState(this,${config.configId })">
                         <option value="1" ${config.configStatus==1?'selected':''}>正常</option>
                         <option value="2" ${config.configStatus==2?'selected':''}>停用</option>
                     </select>
-                    <a onclick="goods_edit('${pageContext.request.contextPath }/admin/product/_update_product_price?qrcodeId=${config.qrcodeId }')"
+                    <a onclick="config_edit('${pageContext.request.contextPath }/admin/product/_update_product_price?qrcodeId=${config.configId }')"
                        title="编辑" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
                 </td>
                 </c:forEach>
@@ -125,7 +125,7 @@
                                     message = '停用';
                                     break;
                             }
-                            $('#qrcode_status').html(message);
+                            $('#config_status').html(message);
                         } else {
                             layer.msg("修改失败</br>",{icon: 5,time:2000});
                         }