Jelajahi Sumber

Merge branch 'master' of http://git.iamberry.com/liuzhiwei/iamberry-common-tooth

wangxiaoming 6 tahun lalu
induk
melakukan
74c40bd626

+ 6 - 0
tooth-wechat-interface/src/main/java/com/iamberry/wechat/face/channel/ChannelRebateService.java

@@ -36,4 +36,10 @@ public interface ChannelRebateService {
      * @return Integer
      */
     Integer  update(ChannelRebate  channelRebate);
+    /**
+     * 批量修改状态为已返利待打款
+     * @param
+     * @return Integer
+     */
+    Integer updateRebackStatus(ChannelRebate channelRebate);
 }

+ 5 - 0
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/channel/ChannelRebateServiceImpl.java

@@ -59,4 +59,9 @@ public class ChannelRebateServiceImpl  implements ChannelRebateService {
     public  Integer  update(ChannelRebate  channelRebate){
         return  channelRebateMapper.update(channelRebate);
     }
+
+    @Override
+    public Integer updateRebackStatus(ChannelRebate channelRebate) {
+        return channelRebateMapper.updateRebackStatus(channelRebate);
+    }
 }

+ 6 - 0
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/ChannelRebateMapper.java

@@ -34,4 +34,10 @@ public interface ChannelRebateMapper {
      * @return Integer
      */
     Integer  update(ChannelRebate  channelRebate);
+    /**
+     * 批量修改状态为已返利待打款
+     * @param
+     * @return Integer
+     */
+    Integer updateRebackStatus(ChannelRebate channelRebate);
 }

+ 13 - 0
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/channelRebateMapper.xml

@@ -125,4 +125,17 @@
         </set >
         where rebate_id= #{rebateId}
     </update>
+
+    <update id="updateRebackStatus" parameterType="ChannelRebate" >
+        update
+        tb_iamberry_channel_rebate
+        <set >
+            <if test="rebackStatus != null ">
+                reback_status = 3
+            </if >
+        </set >
+        where reback_channel_id= #{rebackChannelId}
+        AND reback_channel_type = #{rebackChannelType}
+        AND reback_status = 2
+    </update>
 </mapper>

+ 10 - 3
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/childChannelMapper.xml

@@ -59,7 +59,8 @@
         ON t.main_channel_id = mt.main_channel_id
         left JOIN tb_iamberry_channel_rebate cr
         on t.child_channel_id = cr.reback_channel_id
-        where cr.reback_channel_type = 2
+        where cr.reback_channel_type = 2 AND
+        cr.reback_status = 3
         GROUP BY child_channel_id
         <where>
             <if test="childChannelId != null ">
@@ -93,9 +94,15 @@
     </select>
     <select id="getChildChannelById" resultMap="BaseResultMap" parameterType="Integer" >
         select
-        <include refid="Base_List" />
+        <include refid="Base_List" />,
+        SUM(cr.reback_amount) rebackAmount
         from tb_iamberry_child_channel t
-        where t.child_channel_id= #{childChannelId}
+        left JOIN tb_iamberry_channel_rebate cr
+        on t.child_channel_id = cr.reback_channel_id
+        where cr.reback_channel_type = 2 AND
+        cr.reback_status = 3 AND
+        t.child_channel_id= #{childChannelId}
+        GROUP BY t.child_channel_id
     </select>
     <insert id="save" parameterType="ChildChannel" >
         insert into

+ 5 - 3
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/mainChannelMapper.xml

@@ -41,7 +41,8 @@
         from tb_iamberry_main_channel t
         left JOIN tb_iamberry_channel_rebate cr
         on t.main_channel_id = cr.reback_channel_id
-        where cr.reback_channel_type = 1
+        where cr.reback_channel_type = 1 AND
+        cr.reback_status = 3
         GROUP BY t.main_channel_id
         <where>
             <if test="mainChannelId != null ">
@@ -71,9 +72,10 @@
         from tb_iamberry_main_channel t
         left JOIN tb_iamberry_channel_rebate cr
         on t.main_channel_id = cr.reback_channel_id
-        where cr.reback_channel_type = 1
+        where cr.reback_channel_type = 1 AND
+        cr.reback_status = 3 AND
+        t.main_channel_id= #{mainChannelId}
         GROUP BY t.main_channel_id
-        where t.main_channel_id= #{mainChannelId}
     </select>
     <insert id="save" parameterType="MainChannel" >
         insert into

+ 40 - 6
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/channel/AdminChannelHandler.java

@@ -177,23 +177,57 @@ public class AdminChannelHandler {
 	 * @return
 	 * @author LJK
 	 */
+	@ResponseBody
 	@RequestMapping("/settlement")
-	public ModelAndView settlement(HttpServletRequest request) {
-		ModelAndView mv = new ModelAndView("/admin/adminChannel/settlement");
+	public ResultMsg settlement(HttpServletRequest request) {
+		ResultMsg rm = ResultMsg.getSuccess();
 		String rebackChannelId = request.getParameter("rebackChannelId");
 		String rebackChannelType = request.getParameter("rebackChannelType");
 		if(rebackChannelId == null || rebackChannelId.equals("")|| rebackChannelType == null || rebackChannelType.equals("")){
-			return mv;
+			rm.setStatus(false);
+			return rm;
 		}
 		if(rebackChannelType.equals("1")){
 			MainChannel mainChannel = mainChannelService.getMainChannelById(Integer.valueOf(rebackChannelId));
-			mv.addObject("info",mainChannel);
+			rm.setStatus(true);
+			rm.setData(mainChannel);
 		}
 		if(rebackChannelType.equals("2")){
 			ChildChannel childChannel = childChannelService.getChildChannelById(Integer.valueOf(rebackChannelId));
-			mv.addObject("info",childChannel);
+			rm.setStatus(true);
+			rm.setData(childChannel);
 		}
+		return rm;
+	}
 
-		return mv;
+	/**
+	 * 修改状态
+	 * 2018年2月24日
+	 * @author
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping("/updateRebackStatus")
+	public ResultMsg updateRebackStatus(ChannelRebate channelRebate, HttpServletRequest request) throws Exception {
+		ResultMsg msg = new ResultMsg();
+		if(channelRebate.getRebackChannelId() == null  || channelRebate.getRebackChannelType() == null || "".equals(channelRebate.getRebackChannelId())
+				|| channelRebate.getRebackChannelType() == null){
+			msg.setMessage(NameUtils.getConfig("ERRORCODE"));
+			msg.setResultCode(ResultInfo.ERRORCODE);
+			msg.setStatus(false);
+			return msg;
+		}
+		Integer flag = channelRebateService.updateRebackStatus(channelRebate);
+		if(flag > 0){
+			msg.setMessage(NameUtils.getConfig("SUCCESSINFO"));
+			msg.setResultCode(ResultInfo.SUCCESSCODE);
+			msg.setStatus(true);
+			return msg;
+		}else{
+			msg.setMessage(NameUtils.getConfig("ERRORCODE"));
+			msg.setResultCode(ResultInfo.ERRORCODE);
+			msg.setStatus(false);
+			return msg;
+		}
 	}
 }

+ 1 - 1
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/adminChannel/channelRebate_list.jsp

@@ -122,7 +122,7 @@
                     },
                     success:  function(data){
                         if(data.status){
-                            layer.msg("已修改为已打款",{icon: 1,time:2000});
+                            layer.msg("已修改为已返利,待打款",{icon: 1,time:2000});
                         }else{
                             layer.msg("修改状态失败",{icon: 5,time:2000});
                         }

+ 80 - 1
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/adminChannel/child_channel_list.jsp

@@ -48,7 +48,7 @@
         <table class="table table-border table-bordered table-bg">
             <thead>
             <tr>
-                <th scope="col" colspan="11">子渠道列表</th>
+                <th scope="col" colspan="12">子渠道列表</th>
             </tr>
             <tr class="text-c">
                 <th width="150">渠道名称</th>
@@ -82,6 +82,7 @@
                 <td><fmt:formatDate value="${infolist.childChannelCreateTime}" pattern="yyyy-MM-dd"/></td>
                 <td>
                     <a onclick="toRebateList(${infolist.mainChannelId})">查看明细</a>
+                    <a href="#" onclick="getChannel(${infolist.childChannelId});">结算</a>
                 </td>
                 </c:forEach>
                 </c:if>
@@ -94,6 +95,56 @@
             <%@include file="/common/other/paper/pager.jsp"%>
         </div>
     </form>
+    <div class="layui-layer layui-anim layui-layer-iframe" id="layui-layer4" times="4" showtime="0" contype="string" style="display:none;z-index: 19891018; width: 550px; height: 360px; position: absolute; top: 100px; left: 379px;">
+        <div class="layui-layer-title" id="sendOrderNote" style="cursor: move;" move="ok">结算</div>
+        <br>
+        <div class="row cl">
+            <label class="form-label col-2">&nbsp;&nbsp;渠道名称:</label>
+            <div class="formControls col-3">
+                <b><span id="channelName">
+
+					</span></b>
+            </div>
+        </div>
+        <div class="row cl" style="margin-top: 10px;">
+            <label class="form-label col-2">&nbsp;&nbsp;本次金额:</label>
+            <div class="formControls col-3">
+                        <span id="rebackAmount">
+
+                        </span>
+            </div>
+        </div>
+        <br>
+        <div class="row cl">
+            <div class="formControls col-5">
+                <table class="table table-border table-bordered table-bg" style="width: 450px;margin-left: 10px;">
+                    <thead>
+                    <tr class="text-c">
+                        <th width="150" >账户银行</th>
+                        <th width="150" >收款账号</th>
+                        <th width="150" >开户名称</th>
+                        <th width="90">开户支行</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr class="text-c">
+                        <td id="channelBank"></td>
+                        <td id="channelBankAccount"></td>
+                        <td id="channelBankName"></td>
+                        <td id="channelBankBranch"></td>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+        <br>
+        <span style="margin-left: 10px;">请在打款后,点击”确认已结算“按钮,系统将对应的返利记录标记为已打款。</span>
+        <div class="col-9 col-offset-3" style="margin-top: 10px;">
+            <input class="btn btn-danger" type="button" onclick="getChannel()" value="&nbsp;&nbsp;确认已结算&nbsp;&nbsp;">
+        </div>
+        <span class="layui-layer-setwin">
+			<a class="layui-layer-ico layui-layer-close layui-layer-close1" onclick="exitWindowsDiv(this)" href="javascript:;"></a>
+		</span>
+    </div>
 </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>
@@ -102,7 +153,31 @@
 <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/tips.js"></script>
 <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/My97DatePicker/WdatePicker.js"></script>
 <script type="text/javascript">
+    function getChannel(id){
+        $.ajax({
+            url: '${pageContext.request.contextPath }/admin/channel/settlement',
+            type: "POST",
+            dataType: "json",
+            data: {rebackChannelId : id,rebackChannelType : 2},
+            error:function(data){
+                layer.msg(data.status,{icon: 5,time:2000});
+            },
+            success:  function(data){
+                if(data.status){
+                    $("#layui-layer4").show();
+                    $("#channelName").html(data.data.childChannelName);
+                    $("#rebackAmount").html(data.data.rebackAmount+"元");
+                    $("#channelBank").html(data.data.childChannelBank);
+                    $("#channelBankAccount").html(data.data.childChannelBankAccount);
+                    $("#channelBankName").html(data.data.childChannelBankName);
+                    $("#channelBankBranch").html(data.data.childChannelBankBranch);
+                }else{
+                    layer.msg("操作失败",{icon: 5,time:2000});
+                }
 
+            }
+        });
+    }
     /*function update_status(id){
         layer.confirm('确认要修改返利状态吗?',function(index){
                 $.ajax({
@@ -129,6 +204,10 @@
     function toRebateList(id) {
         window.location.href = '${pageContext.request.contextPath }/admin/channel/listChannelRebate?rebackChannelType=2&rebackChannelId='+id;
     }
+    // 关闭窗口
+    function exitWindowsDiv(_this) {
+        $(_this).parent().parent().hide();
+    }
 </script>
 </body>
 </html>

+ 54 - 30
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/adminChannel/main_channel_list.jsp

@@ -80,7 +80,7 @@
                 <td><fmt:formatDate value="${infolist.mainChannelCreateTime}" pattern="yyyy-MM-dd"/></td>
                 <td>
                     <a onclick="toRebateList(${infolist.mainChannelId})">查看明细</a><br>
-                    <a href="#" onclick="settlement(${infolist.mainChannelId});">结算</a>
+                    <a href="#" onclick="getChannel(${infolist.mainChannelId});">结算</a>
                 </td>
                 </c:forEach>
                 </c:if>
@@ -99,49 +99,50 @@
         <div class="row cl">
             <label class="form-label col-2">&nbsp;&nbsp;渠道名称:</label>
             <div class="formControls col-3">
-                    <span class="">
-                        鄂锐鄂锐
-					</span>
+                <b><span id="channelName">
+
+					</span></b>
             </div>
         </div>
-        <div class="row cl">
+        <div class="row cl" style="margin-top: 10px;">
             <label class="form-label col-2">&nbsp;&nbsp;本次金额:</label>
             <div class="formControls col-3">
-                        <span class="">
-                            10000元
+                        <span id="rebackAmount">
+
                         </span>
             </div>
         </div>
         <br>
         <div class="row cl">
             <div class="formControls col-5">
-            <table class="table table-border table-bordered table-bg" style="width: 450px;">
+            <table class="table table-border table-bordered table-bg" style="width: 450px;margin-left: 10px;">
                 <thead>
                 <tr class="text-c">
-                    <th width="150">账户银行</th>
-                    <th width="150">收款账号</th>
-                    <th width="150">开户名称</th>
+                    <th width="150" >账户银行</th>
+                    <th width="150" >收款账号</th>
+                    <th width="150" >开户名称</th>
                     <th width="90">开户支行</th>
                 </tr>
                 </thead>
                 <tbody>
                 <tr class="text-c">
-                    <td>1</td>
-                    <td>1</td>
-                    <td>1</td>
-                    <td>1</td>
+                    <td id="channelBank"></td>
+                    <td id="channelBankAccount"></td>
+                    <td id="channelBankName"></td>
+                    <td id="channelBankBranch"></td>
                 </tbody>
             </table>
             </div>
         </div>
         <br>
-
-        <div class="col-9 col-offset-3">
-            <input class="btn btn-danger" type="button" onclick="remrakSumbit()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
+        <span style="margin-left: 10px;">请在打款后,点击”确认已结算“按钮,系统将对应的返利记录标记为已打款。</span>
+        <div class="col-9 col-offset-3" style="margin-top: 10px;">
+            <input class="btn btn-danger" type="button" onclick="update_status()" value="&nbsp;&nbsp;确认已结算&nbsp;&nbsp;">
         </div>
         <span class="layui-layer-setwin">
 			<a class="layui-layer-ico layui-layer-close layui-layer-close1" onclick="exitWindowsDiv(this)" href="javascript:;"></a>
 		</span>
+        <input type="hidden" value="" id="rebackChannelId">
     </div>
 </div>
 <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script>
@@ -152,13 +153,40 @@
 <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/My97DatePicker/WdatePicker.js"></script>
 <script type="text/javascript">
 
-    /*function update_status(id){
-        layer.confirm('确认要修改返利状态吗?',function(index){
+    function getChannel(id){
                 $.ajax({
-                    url: '${pageContext.request.contextPath }/admin/channel/updateState',
+                    url: '${pageContext.request.contextPath }/admin/channel/settlement',
                     type: "POST",
                     dataType: "json",
-                    data: {rebateId : id,rebackStatus : 3},
+                    data: {rebackChannelId : id,rebackChannelType : 1},
+                    error:function(data){
+                        layer.msg(data.status,{icon: 5,time:2000});
+                    },
+                    success:  function(data){
+                        if(data.status){
+                            $("#layui-layer4").show();
+                            $("#channelName").html(data.data.mainChannelName);
+                            $("#rebackAmount").html(data.data.rebackAmount+"元");
+                            $("#channelBank").html(data.data.mainChannelBank);
+                            $("#channelBankAccount").html(data.data.mainChannelBankAccount);
+                            $("#channelBankName").html(data.data.mainChannelBankName);
+                            $("#channelBankBranch").html(data.data.mainChannelBankBranch);
+                            $("#rebackChannelId").html(data.data.mainChannelId);
+                        }else{
+                            layer.msg("操作失败",{icon: 5,time:2000});
+                        }
+
+                    }
+                });
+    }
+
+   function update_status(){
+        var rebackChannelId = $("#rebackChannelId").val();
+                $.ajax({
+                    url: '${pageContext.request.contextPath }/admin/channel/updateRebackStatus',
+                    type: "POST",
+                    dataType: "json",
+                    data: {rebackChannelId : rebackChannelId,rebackChannelType : 1},
                     error:function(data){
                         layer.msg(data.status,{icon: 5,time:2000});
                     },
@@ -171,18 +199,14 @@
 
                     }
                 });
-            }
-        );
-
-    }*/
+    }
     function toRebateList(id) {
         window.location.href = '${pageContext.request.contextPath }/admin/channel/listChannelRebate?rebackChannelType=1&rebackChannelId='+id;
     }
-
-    function settlement(type,id) {
-        $("#layui-layer4").show();
+    // 关闭窗口
+    function exitWindowsDiv(_this) {
+        $(_this).parent().parent().hide();
     }
-
 </script>
 </body>
 </html>