From 0c568e9f295471f6b80e0b6d156ae890163b19bf Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Mon, 13 Feb 2023 15:06:56 +0800 Subject: [PATCH] 订单发货设置 --- src/main/resources/templates/febs/views/modules/order/orderDetail.html | 36 ++++---- src/main/resources/templates/febs/views/modules/order/deliverGoods.html | 4 src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallOrderService.java | 8 + src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java | 10 +- src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java | 47 +++++++---- src/main/resources/mapper/modules/MallOrderInfoMapper.xml | 2 src/main/resources/templates/febs/views/modules/order/orderList.html | 117 ++++++++++++++++++----------- 7 files changed, 132 insertions(+), 92 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java index ac9a274..03897f1 100644 --- a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java +++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java @@ -278,13 +278,24 @@ String title = "订单列表"; orderSheet.setSheetName(title); orderSheet.setTitle(title); +// String[] header = {"订单编号", "订单金额", "下单时间", "配送方式", "收货姓名", "收货电话", "收货地址", "商品名称", "订单状态", "物流单号", "物流公司", "物流公司码"}; String[] header = {"订单编号", "订单金额", "下单时间", "配送方式", "收货姓名", "收货电话", "收货地址", "商品名称", "订单状态", "物流单号", "物流公司", "物流公司码"}; orderSheet.setHeaders(header); QueryRequest request = new QueryRequest(); request.setPageNum(1); request.setPageSize(9999); - List<MallOrderInfo> dataList = adminMallOrderService.findOrderListInPage(mallOrderInfo, request).getRecords(); + List<MallOrderInfo> dataList = new ArrayList<>(); + String orderIds = mallOrderInfo.getOrderIds(); + List<String> ids = StrUtil.splitTrim(orderIds, ","); + for(String id : ids){ + long orderId = Long.parseLong(id); + MallOrderInfo mallOrderInfo1 = mallOrderInfoMapper.selectAllOrderInfoByIdAndTakeUniqueCode(orderId,mallOrderInfo.getTakeUniqueCode()); + if(ObjectUtil.isNotEmpty(mallOrderInfo1)){ + dataList.add(mallOrderInfo1); + } + } +// List<MallOrderInfo> dataList = adminMallOrderService.findOrderListInPage(mallOrderInfo, request).getRecords(); List<List<Object>> list = new ArrayList<>(); if (dataList.size() > 0) { for (MallOrderInfo item : dataList) { @@ -346,19 +357,19 @@ mallOrderInfo.setDeliveryState(OrderDeliveryStateEnum.DELIVERY_FINISH.getValue()); mallOrderInfoMapper.updateById(mallOrderInfo); - OrderStateDto orderStateDto = new OrderStateDto(); - String productNames = getProductNames(mallOrderInfo.getMemberId(), mallOrderInfo.getId()); - orderStateDto.setGoodsName(StrUtil.sub(productNames,0,15)+"..."); - String takeUniqueCode = mallOrderInfo.getTakeUniqueCode(); - MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(takeUniqueCode); - orderStateDto.setAddressArea(mallTeamLeader.getAddressArea()); - orderStateDto.setDetailAddress(StrUtil.sub(mallTeamLeader.getDetailAddress(),0,20)+"..."); - orderStateDto.setRemark("果蔬等生鲜,请尽快取货"); - orderStateDto.setLeaderPhone(mallTeamLeader.getPhone()); - orderStateDto.setOpenId(mallMemberMapper.selectById(mallOrderInfo.getMemberId()).getOpenId()); - DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WX_TEMPLATE_ID_THREE.getType(), DataDictionaryEnum.WX_TEMPLATE_ID_THREE.getCode()); - orderStateDto.setTemplateId(dataDictionaryCustom.getValue()); - iXcxPayService.pushOrderToAddress(orderStateDto); +// OrderStateDto orderStateDto = new OrderStateDto(); +// String productNames = getProductNames(mallOrderInfo.getMemberId(), mallOrderInfo.getId()); +// orderStateDto.setGoodsName(StrUtil.sub(productNames,0,15)+"..."); +// String takeUniqueCode = mallOrderInfo.getTakeUniqueCode(); +// MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(takeUniqueCode); +// orderStateDto.setAddressArea(mallTeamLeader.getAddressArea()); +// orderStateDto.setDetailAddress(StrUtil.sub(mallTeamLeader.getDetailAddress(),0,20)+"..."); +// orderStateDto.setRemark("果蔬等生鲜,请尽快取货"); +// orderStateDto.setLeaderPhone(mallTeamLeader.getPhone()); +// orderStateDto.setOpenId(mallMemberMapper.selectById(mallOrderInfo.getMemberId()).getOpenId()); +// DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.WX_TEMPLATE_ID_THREE.getType(), DataDictionaryEnum.WX_TEMPLATE_ID_THREE.getCode()); +// orderStateDto.setTemplateId(dataDictionaryCustom.getValue()); +// iXcxPayService.pushOrderToAddress(orderStateDto); // iXcxPayService.uniformMessageSend(orderStateDto); } return new FebsResponse().success(); @@ -372,9 +383,9 @@ for(String id : ids){ long orderId = Long.parseLong(id); MallOrderInfo mallOrderInfo = mallOrderInfoMapper.selectByIdAndTakeUniqueCode(orderId,mallOrderInfoDto.getTakeUniqueCode()); - if(ObjectUtil.isEmpty(mallOrderInfo)){ - return new FebsResponse().fail().message("请确认订单是否属于该团长"); - } +// if(ObjectUtil.isEmpty(mallOrderInfo)){ +// return new FebsResponse().fail().message("请确认订单是否属于该团长"); +// } Integer status = mallOrderInfo.getStatus() == null ? 0 : mallOrderInfo.getStatus(); Integer deliveryState = mallOrderInfo.getDeliveryState() == null ? 0 : mallOrderInfo.getDeliveryState(); if(OrderStatusEnum.WAIT_SHIPPING.getValue() != status){ @@ -510,7 +521,7 @@ } String fileName = file.getOriginalFilename(); - String dirPath = "/Users/helius/Documents/"; + String dirPath = "/home/javaweb/webresource/qianAYi/"; File saveFile = new File(new File(dirPath).getAbsolutePath() + File.separator + fileName); if (!saveFile.exists()) { diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallOrderService.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallOrderService.java index a9450bd..0958a2f 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallOrderService.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallOrderService.java @@ -5,6 +5,7 @@ import cc.mrbird.febs.common.enumerates.FlowTypeEnum; import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; import cc.mrbird.febs.common.enumerates.OrderDeliveryStateEnum; +import cc.mrbird.febs.common.enumerates.OrderStatusEnum; import cc.mrbird.febs.mall.dto.*; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.mapper.*; @@ -117,9 +118,10 @@ mallExpressInfo.setExpressCom(expressCom); mallExpressInfoMapper.insert(mallExpressInfo); - mallOrderInfo.setStatus(3); - mallOrderInfo.setDeliveryState(OrderDeliveryStateEnum.DELIVERY_ING.getValue()); - mallOrderInfoMapper.updateById(mallOrderInfo); + mallOrderInfoMapper.updateOrderStateAndDeliveryState(mallOrderInfo.getId(), + OrderStatusEnum.WAIT_FINISH.getValue(), + OrderDeliveryStateEnum.DELIVERY_ING.getValue()); + return new FebsResponse().success(); } diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java index 3101140..d3dd280 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java @@ -462,11 +462,11 @@ OrderDetailVo orderDetailVo = MallOrderInfoConversion.INSTANCE.entityToDetailVo(orderInfo); -// if (orderInfo.getStatus() == OrderStatusEnum.WAIT_FINISH.getValue()) { -// MallExpressInfo expressInfo = expressInfoMapper.selectByOrderId(orderInfo.getId()); -// orderDetailVo.setExpressNo(expressInfo.getExpressNo()); -// orderDetailVo.setExpressCom(expressInfo.getExpressCom()); -// } + if (orderInfo.getStatus() == OrderStatusEnum.WAIT_FINISH.getValue()) { + MallExpressInfo expressInfo = expressInfoMapper.selectByOrderId(orderInfo.getId()); + orderDetailVo.setExpressNo(expressInfo.getExpressNo()); + orderDetailVo.setExpressCom(expressInfo.getExpressCom()); + } if (orderInfo.getStatus() == OrderStatusEnum.REFUNDING.getValue() || orderInfo.getStatus() == OrderStatusEnum.REFUNDED.getValue()) { MallOrderRefund orderRefund = mallOrderRefundMapper.selectOrderRefundByOrderId(orderInfo.getId()); diff --git a/src/main/resources/mapper/modules/MallOrderInfoMapper.xml b/src/main/resources/mapper/modules/MallOrderInfoMapper.xml index db7bf05..190092e 100644 --- a/src/main/resources/mapper/modules/MallOrderInfoMapper.xml +++ b/src/main/resources/mapper/modules/MallOrderInfoMapper.xml @@ -419,7 +419,7 @@ b.amount from mall_order_info a inner join mall_order_item b on a.id=b.order_id - where a.del_flag=2 and a.id = #{orderId} and a.take_unique_code = #{takeUniqueCode} + where a.del_flag=2 and a.id = #{orderId} order by a.created_time desc </select> diff --git a/src/main/resources/templates/febs/views/modules/order/deliverGoods.html b/src/main/resources/templates/febs/views/modules/order/deliverGoods.html index 8f716ec..3f43912 100644 --- a/src/main/resources/templates/febs/views/modules/order/deliverGoods.html +++ b/src/main/resources/templates/febs/views/modules/order/deliverGoods.html @@ -49,14 +49,14 @@ <div class="layui-form-item"> <label class="layui-form-label febs-form-item-require">物流单号:</label> <div class="layui-input-block"> - <input type="text" name="expressNo" + <input type="text" name="expressNo" lay-verify="required" autocomplete="off" class="layui-input" > </div> </div> <div class="layui-form-item"> <label class="layui-form-label febs-form-item-require">物流公司:</label> <div class="layui-input-block"> - <input type="text" name="expressCom" + <input type="text" name="expressCom" lay-verify="required" autocomplete="off" class="layui-input" > </div> </div> diff --git a/src/main/resources/templates/febs/views/modules/order/orderDetail.html b/src/main/resources/templates/febs/views/modules/order/orderDetail.html index 06cab11..a65cd5b 100644 --- a/src/main/resources/templates/febs/views/modules/order/orderDetail.html +++ b/src/main/resources/templates/febs/views/modules/order/orderDetail.html @@ -42,7 +42,7 @@ <div class="layui-form-item"> <label class="layui-form-label">地区:</label> <div class="layui-input-block"> - <input type="text" name="addressArea" + <input type="text" name="address" autocomplete="off" class="layui-input" readonly> </div> </div> @@ -81,20 +81,20 @@ <textarea id="lay_edit" lay-verify="orderItems" name = "orderItems" class="layui-textarea" readonly></textarea> </div> </div> -<!-- <div class="layui-form-item">--> -<!-- <label class="layui-form-label">物流单号:</label>--> -<!-- <div class="layui-input-block">--> -<!-- <input type="text" name="expressNo"--> -<!-- autocomplete="off" class="layui-input" readonly>--> -<!-- </div>--> -<!-- </div>--> -<!-- <div class="layui-form-item">--> -<!-- <label class="layui-form-label">物流公司:</label>--> -<!-- <div class="layui-input-block">--> -<!-- <input type="text" name="expressCom"--> -<!-- autocomplete="off" class="layui-input" readonly >--> -<!-- </div>--> -<!-- </div>--> + <div class="layui-form-item"> + <label class="layui-form-label">物流单号:</label> + <div class="layui-input-block"> + <input type="text" name="expressNo" + autocomplete="off" class="layui-input" readonly> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label">物流公司:</label> + <div class="layui-input-block"> + <input type="text" name="expressCom" + autocomplete="off" class="layui-input" readonly > + </div> + </div> </form> </div> @@ -125,11 +125,11 @@ "orderItems": orderDetail.orderItems, "addressArea": orderDetail.addressArea, "addressInfo": orderDetail.addressInfo, - // "expressNo": orderDetail.expressNo, - // "expressCom": orderDetail.expressCom, + "expressNo": orderDetail.expressNo, + "expressCom": orderDetail.expressCom, // "payImage": orderDetail.payImage, // "payOrderNo": orderDetail.payOrderNo, - // "address": orderDetail.address + "address": orderDetail.address }); } diff --git a/src/main/resources/templates/febs/views/modules/order/orderList.html b/src/main/resources/templates/febs/views/modules/order/orderList.html index 1c8c545..8053601 100644 --- a/src/main/resources/templates/febs/views/modules/order/orderList.html +++ b/src/main/resources/templates/febs/views/modules/order/orderList.html @@ -7,11 +7,13 @@ <div class="layui-form-item"> <div class="layui-col-md10"> <div class="layui-inline"> + <label class="layui-form-label">用户名:</label> <div class="layui-input-inline"> <input type="text" placeholder="用户名" name="name" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-inline"> + <label class="layui-form-label">订单编号:</label> <div class="layui-input-inline"> <input type="text" placeholder="订单编号" name="orderNo" autocomplete="off" class="layui-input"> </div> @@ -25,30 +27,30 @@ <option value="2">待发货</option> <option value="3">待收货</option> <option value="4">已完成</option> - <option value="5">退款中</option> - <option value="6">已退款</option> +<!-- <option value="5">退款中</option>--> +<!-- <option value="6">已退款</option>--> <option value="7">已取消</option> </select> </div> </div> - <div class="layui-inline"> - <label class="layui-form-label">团长:</label> - <div class="layui-input-inline"> - <select name="uniqueCode" class="order-takeUniqueCode"> - <option value="">请选择</option> - </select> - </div> - </div> - <div class="layui-inline"> - <label class="layui-form-label layui-form-label-sm">配送方式</label> - <div class="layui-input-inline"> - <select name="isHome"> - <option value="">请选择</option> - <option value="1">送货上门</option> - <option value="2">自提</option> - </select> - </div> - </div> +<!-- <div class="layui-inline">--> +<!-- <label class="layui-form-label">团长:</label>--> +<!-- <div class="layui-input-inline">--> +<!-- <select name="uniqueCode" class="order-takeUniqueCode">--> +<!-- <option value="">请选择</option>--> +<!-- </select>--> +<!-- </div>--> +<!-- </div>--> +<!-- <div class="layui-inline">--> +<!-- <label class="layui-form-label layui-form-label-sm">配送方式</label>--> +<!-- <div class="layui-input-inline">--> +<!-- <select name="isHome">--> +<!-- <option value="">请选择</option>--> +<!-- <option value="1">送货上门</option>--> +<!-- <option value="2">自提</option>--> +<!-- </select>--> +<!-- </div>--> +<!-- </div>--> <div class="layui-inline"> <label class="layui-form-label layui-form-label-sm">支付状态</label> <div class="layui-input-inline"> @@ -113,13 +115,13 @@ </script> <script type="text/html" id="tableToolBar"> <div class="layui-btn-container"> - <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="exportDeliverOne">导出待发货订单,系统自动发货</button> +<!-- <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="exportDeliverOne">导出待发货订单,系统自动发货</button>--> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="confirmOrder">确认到货</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="printSelect">自定义打印</button> <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="goodsStatistics">统计商品份数</button> <!-- <button id="printSelect" type="button" class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain">自定义打印</button>--> -<!-- <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="exportDeliverTwo">导出未发货订单(快递)</button>--> -<!-- <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" id="importDeliver" lay-event="importDeliver">导入发货</button>--> + <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" lay-event="exportDeliverTwo">导出未发货订单(快递)</button> + <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain" id="importDeliver" lay-event="importDeliver">导入发货</button> </div> </script> <!-- 表格操作栏 end --> @@ -236,11 +238,11 @@ // window.location.href = ctx + "admin/order/confirmOrder?takeUniqueCode="+uniqueCodeValue+"&orderIds="+ids; } if (event == 'exportDeliverOne') { - let uniqueCodeValue = $searchForm.find("select[name='uniqueCode']").val(); - if(uniqueCodeValue == '' || uniqueCodeValue == null){ - febs.alert.warn('请选择团长'); - return; - } + // let uniqueCodeValue = $searchForm.find("select[name='uniqueCode']").val(); + // if(uniqueCodeValue == '' || uniqueCodeValue == null){ + // febs.alert.warn('请选择团长'); + // return; + // } var data = checkStatus.data; let ids = ""; for(let i = 0;i < data.length;i++){ @@ -260,8 +262,8 @@ febs.alert.warn('请选择待发货的订单'); return; } - window.location.href = ctx + "admin/order/exportOrderListOne?orderType=1&status=2&deliveryType=1&takeUniqueCode="+uniqueCodeValue+'&orderIds='+ids; - febs.get(ctx + 'admin/order/deliverOrder?takeUniqueCode='+uniqueCodeValue+'&orderIds='+ids, null, function () { + window.location.href = ctx + "admin/order/exportOrderListOne?orderType=1&status=2&deliveryType=1&orderIds="+ids; + febs.get(ctx + 'admin/order/deliverOrder?&orderIds='+ids, null, function () { febs.alert.success('操作成功'); $query.click(); @@ -269,7 +271,26 @@ } if (event == 'exportDeliverTwo') { - window.location.href = ctx + "admin/order/exportOrderList?orderType=1&status=2&deliveryType=2"; + var data = checkStatus.data; + let ids = ""; + for(let i = 0;i < data.length;i++){ + if(data[i].status != 2){ + febs.alert.warn('请选择待发货的订单'); + return; + }else if(data[i].deliveryState != 1){ + febs.alert.warn('请选择待配送的订单'); + return; + }else{ + ids = ids + data[i].id+","; + } + } + // layer.alert(layui.util.escape(JSON.stringify(data))); + console.log(ids); + if(ids == null || ids == ""){ + febs.alert.warn('请选择待发货的订单'); + return; + } + window.location.href = ctx + "admin/order/exportOrderList?orderType=1&status=2&deliveryType=2&orderIds="+ids; } }); @@ -362,19 +383,19 @@ {field: 'memberPhone', title: '联系方式', minWidth: 120,align:'left'}, // {field: 'memberBindPhone', title: '联系方式', minWidth: 120,align:'left'}, {field: 'goodsName', title: '商品', minWidth: 160,align:'left'}, - {field: 'amount', title: '订单金额', minWidth: 80,align:'left'}, - {field: 'leaderName', title: '团长', minWidth: 120,align:'left'}, + {field: 'amount', title: '订单金额', minWidth: 160,align:'left'}, + // {field: 'leaderName', title: '团长', minWidth: 120,align:'left'}, {field: 'orderTime', title: '下单时间', minWidth: 200,align:'left'}, - {field: 'isHome', title: '配送方式', - templet: function (d) { - if (d.isHome === 2) { - return '<span style="color:dodgerblue;">自提</span>' - } else if (d.isHome === 1) { - return '<span style="color:forestgreen;">送货上门</span>' - }else{ - return '' - } - }, minWidth: 100,align:'center'}, + // {field: 'isHome', title: '配送方式', + // templet: function (d) { + // if (d.isHome === 2) { + // return '<span style="color:dodgerblue;">自提</span>' + // } else if (d.isHome === 1) { + // return '<span style="color:forestgreen;">送货上门</span>' + // }else{ + // return '' + // } + // }, minWidth: 100,align:'center'}, {field: 'status', title: '状态', templet: function (d) { if (d.status === 1) { @@ -409,10 +430,16 @@ }, minWidth: 80,align:'center'}, {field: 'payMethod', title: '支付方式', minWidth: 100,align:'left'}, {field: 'payTime', title: '支付时间', minWidth: 120,align:'left'}, - {field: 'wxOrderNo', title: '支付订单号', minWidth: 120,align:'left'}, + // {field: 'wxOrderNo', title: '支付订单号', minWidth: 120,align:'left'}, {title: '操作', templet: function (d) { - return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' + if(d.status === 2){ + return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' + +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="deliverGoods" shiro:hasPermission="user:update">发货</button>' + }else{ + return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="seeOrder" shiro:hasPermission="user:update">详情</button>' + } + },minWidth: 200,align:'center', fixed:'right'} ]] }); -- Gitblit v1.9.1