修改分页视图对象转换方式,后台订单主单页面
This commit is contained in:
parent
53e1bb6454
commit
5fe5cd0914
|
|
@ -4,10 +4,13 @@ import com.ghy.common.annotation.Log;
|
|||
import com.ghy.common.constant.UserConstants;
|
||||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.page.PageDomain;
|
||||
import com.ghy.common.core.page.TableDataInfo;
|
||||
import com.ghy.common.core.page.TableSupport;
|
||||
import com.ghy.common.enums.BusinessType;
|
||||
import com.ghy.common.utils.ExceptionUtil;
|
||||
import com.ghy.common.utils.ObjectUtils;
|
||||
import com.ghy.common.utils.StringUtils;
|
||||
import com.ghy.common.utils.poi.ExcelUtil;
|
||||
import com.ghy.customer.domain.Customer;
|
||||
import com.ghy.customer.domain.CustomerAddress;
|
||||
|
|
@ -27,16 +30,14 @@ import com.ghy.payment.domain.FinancialDetail;
|
|||
import com.ghy.payment.domain.FinancialMaster;
|
||||
import com.ghy.payment.service.FinancialDetailService;
|
||||
import com.ghy.payment.service.FinancialMasterService;
|
||||
import com.ghy.web.pojo.vo.OrderDetailsResponseVo;
|
||||
import com.ghy.web.pojo.vo.OrderListResponse;
|
||||
import com.ghy.web.pojo.vo.OrderStandard;
|
||||
import com.ghy.web.pojo.vo.OrderStandardDetail;
|
||||
import com.ghy.web.pojo.vo.*;
|
||||
import com.ghy.worker.domain.Worker;
|
||||
import com.ghy.worker.service.WorkerService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.util.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
|
@ -93,6 +94,7 @@ public class OrderMasterController extends BaseController {
|
|||
@PostMapping("/app/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo appList(@RequestBody OrderMaster orderMaster) {
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
startPage();
|
||||
List<OrderListResponse> orderListResponses = new ArrayList<>();
|
||||
List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster);
|
||||
|
|
@ -153,7 +155,23 @@ public class OrderMasterController extends BaseController {
|
|||
orderListResponses.add(orderListResponse);
|
||||
|
||||
});
|
||||
return voDataTable(orderListResponses, list);
|
||||
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
||||
{
|
||||
rspData.setRows(orderListResponses);
|
||||
rspData.setTotal(orderListResponses.size());
|
||||
return rspData;
|
||||
}
|
||||
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||
if (pageSize > orderListResponses.size())
|
||||
{
|
||||
pageSize = orderListResponses.size();
|
||||
}
|
||||
rspData.setRows(orderListResponses.subList(pageNum, pageSize));
|
||||
rspData.setTotal(orderListResponses.size());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
@PostMapping("/app/detail")
|
||||
|
|
@ -265,102 +283,42 @@ public class OrderMasterController extends BaseController {
|
|||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(OrderMaster orderMaster) {
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
startPage();
|
||||
List<OrderMasterResponseVo> orderMasterResponseVos = new ArrayList<>();
|
||||
List<OrderMaster> orderMasterList = orderMasterService.selectOrderMasterList(orderMaster);
|
||||
// 数据处理。待返回的数据信息。
|
||||
List<OrderDetailsResponseVo> orderDetailsResponseVoList = new ArrayList<>();
|
||||
// 存在数据在进行数据查询处理。
|
||||
if (orderMasterList != null && orderMasterList.size() > 0) {
|
||||
// 第一次循环 进行拿到对应用户数据集合信息与实体集合数据信息,
|
||||
// 消费者相关集合
|
||||
List<Long> customIdList = new ArrayList<>();
|
||||
// 师傅相关集合
|
||||
List<Long> workerIdList = new ArrayList<>();
|
||||
// 订单编号数据信息。
|
||||
List<Long> orderIdList = new ArrayList<>();
|
||||
for (OrderMaster orderMasterByListData : orderMasterList) {
|
||||
// 订单Id
|
||||
if (ObjectUtils.isNotNull(orderMasterByListData.getId())) {
|
||||
orderIdList.add(orderMasterByListData.getId());
|
||||
}
|
||||
// 消费者id
|
||||
if (ObjectUtils.isNotNull(orderMasterByListData.getCustomerId())) {
|
||||
customIdList.add(orderMasterByListData.getCustomerId());
|
||||
}
|
||||
// 师傅id
|
||||
if (ObjectUtils.isNotNull(orderMasterByListData.getWorkerId())) {
|
||||
workerIdList.add(orderMasterByListData.getWorkerId());
|
||||
}
|
||||
}
|
||||
// 消费者
|
||||
Map<Long, Customer> longCustomerMap = customerService.byCustomerUseridInMap(customIdList);
|
||||
// 师傅
|
||||
Map<Long, Worker> longWorkerMap = workerService.byWorkUserIdInMap(workerIdList);
|
||||
// 订单数据
|
||||
Map<Long, List<OrderDetail>> longOrderDetailMap = orderDetailService.byOrderIdInMap(orderIdList);
|
||||
Map<Long, List<OrderGoods>> longOrderGoodsMap = orderGoodsService.byOrderIdInMap(orderIdList);
|
||||
// 消费者的上级邀请人信息。
|
||||
List<Long> customByPlaceIdList = new ArrayList<>();
|
||||
// 循环数据赋值。
|
||||
for (OrderMaster orderMasterByListData : orderMasterList) {
|
||||
OrderDetailsResponseVo orderDetailsResponseVo = new OrderDetailsResponseVo();
|
||||
// 订单基本信息。
|
||||
orderDetailsResponseVo.setOrderId(orderMasterByListData.getId());
|
||||
orderDetailsResponseVo.setCode(orderMasterByListData.getCode());
|
||||
// 基本信息。
|
||||
List<OrderGoods> orderGoodsList = longOrderGoodsMap.get(orderMasterByListData.getId());
|
||||
if (orderGoodsList != null && orderGoodsList.size() > 0) {
|
||||
List<OrderDetailsResponseVo.OrderDetails> orderDetailsList = new ArrayList<>();
|
||||
// 用于订单附表数据查询。
|
||||
List<Long> orderDetailsIdList = new ArrayList<>();
|
||||
for (OrderGoods orderGoods : orderGoodsList) {
|
||||
orderDetailsIdList.add(orderGoods.getOrderId());
|
||||
}
|
||||
// 财务数据信息。
|
||||
Map<Long, FinancialDetail> longFinancialDetailMap = financialDetailService.byOrderIdInMap(orderDetailsIdList);
|
||||
for (OrderGoods orderGoods : orderGoodsList) {
|
||||
OrderDetailsResponseVo.OrderDetails orderDetails = OrderDetailsResponseVo.OrderDetails.modelDataSupplement(orderGoods);
|
||||
FinancialDetail financialDetail = longFinancialDetailMap.get(orderGoods.getOrderGoodsId());
|
||||
if (ObjectUtils.isNotNull(financialDetail)) {
|
||||
orderDetails.setDiscountMoney(financialDetail.getDiscountMoney());
|
||||
orderDetails.setPayMoney(financialDetail.getPayMoney());
|
||||
orderDetails.setTotalMoney(financialDetail.getTotalMoney());
|
||||
}
|
||||
orderDetailsList.add(orderDetails);
|
||||
}
|
||||
orderDetailsResponseVo.setDetailsList(orderDetailsList);
|
||||
}
|
||||
// 订单接单信息。 现在都取接单人。
|
||||
Worker workerByReceivingUser = longWorkerMap.get(orderMasterByListData.getWorkerId());
|
||||
Worker workerByOperationUser = longWorkerMap.get(orderMasterByListData.getWorkerId());
|
||||
orderDetailsResponseVo.setReceiving(OrderDetailsResponseVo.OrderReceiving.modelDataSupplement(workerByReceivingUser, workerByOperationUser));
|
||||
// 订单状态。
|
||||
orderDetailsResponseVo.setState(OrderDetailsResponseVo.OrderState.modelDataSupplement(orderMasterByListData));
|
||||
// 消费者相关。
|
||||
Customer customer = longCustomerMap.get(orderMasterByListData.getCustomerId());
|
||||
if (ObjectUtils.isNotNull(customer)) {
|
||||
// 地址信息 这里默认取第一条数据既可以了
|
||||
List<CustomerAddress> customerAddressList = customerAddressService.selectByCustomerId(customer.getCustomerId());
|
||||
if (customerAddressList != null && customerAddressList.size() > 0) {
|
||||
orderDetailsResponseVo.setCustomDetails(OrderDetailsResponseVo.OrderCustomDetails.modelDataSupplement(customerAddressList.get(0)));
|
||||
}
|
||||
customByPlaceIdList.add(customer.getCustomerPlace());
|
||||
}
|
||||
// 数据添加处理。
|
||||
orderDetailsResponseVoList.add(orderDetailsResponseVo);
|
||||
}
|
||||
// 第三次数据循环处理 用于邀请人相关补充,
|
||||
Map<Long, Customer> longCustomerByPlaceMap = customerService.byCustomerUseridInMap(customByPlaceIdList);
|
||||
for (OrderDetailsResponseVo vo : orderDetailsResponseVoList) {
|
||||
if (ObjectUtils.isNotNull(vo.getCustomDetails())) {
|
||||
Customer customer = longCustomerByPlaceMap.get(vo.getCustomDetails().getCustomerId());
|
||||
if (ObjectUtils.isNotNull(customer)) {
|
||||
vo.setInvitee(OrderDetailsResponseVo.OrderInvitee.modelDataSupplement(customer));
|
||||
}
|
||||
}
|
||||
for (OrderMaster master : orderMasterList) {
|
||||
OrderMasterResponseVo orderMasterResponseVo = new OrderMasterResponseVo();
|
||||
// 将公共属性复制过去
|
||||
BeanUtils.copyProperties(master, orderMasterResponseVo);
|
||||
// 师傅信息
|
||||
if(StringUtils.isNotNull(master.getWorkerId())){
|
||||
Worker worker = workerService.selectById(master.getWorkerId());
|
||||
orderMasterResponseVo.setWorkerName(worker.getName());
|
||||
}
|
||||
// 消费者信息
|
||||
Customer customer = customerService.selectByCustomerId(master.getCustomerId());
|
||||
orderMasterResponseVo.setCustomerName(customer.getName());
|
||||
|
||||
orderMasterResponseVos.add(orderMasterResponseVo);
|
||||
}
|
||||
return voDataTable(orderDetailsResponseVoList, orderMasterList);
|
||||
// 存在数据在进行数据查询处理。
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
||||
{
|
||||
rspData.setRows(orderMasterResponseVos);
|
||||
rspData.setTotal(orderMasterResponseVos.size());
|
||||
return rspData;
|
||||
}
|
||||
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||
if (pageSize > orderMasterResponseVos.size())
|
||||
{
|
||||
pageSize = orderMasterResponseVos.size();
|
||||
}
|
||||
rspData.setRows(orderMasterResponseVos.subList(pageNum, pageSize));
|
||||
rspData.setTotal(orderMasterResponseVos.size());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
@Log(title = "主订单管理", businessType = BusinessType.EXPORT)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.ghy.web.pojo.vo;
|
||||
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
* 后台主单视图对象
|
||||
*/
|
||||
@Data
|
||||
public class OrderMasterResponseVo extends OrderMaster {
|
||||
|
||||
private String workerName;
|
||||
|
||||
private String customerName;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
|
||||
<head>
|
||||
<th:block th:include="include :: header('订单列表')"/>
|
||||
<th:block th:include="include :: layout-latest-css"/>
|
||||
<th:block th:include="include :: ztree-css"/>
|
||||
</head>
|
||||
|
||||
<body class="gray-bg">
|
||||
|
||||
<div class="ui-layout-center">
|
||||
|
|
@ -21,6 +19,12 @@
|
|||
<li>
|
||||
订单号:<input type="text" name="code"/>
|
||||
</li>
|
||||
<li>
|
||||
订单状态:<select name="status" th:with="type=${@dict.getType('order_status')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
|
||||
class="fa fa-search"></i> 搜索</a>
|
||||
|
|
@ -52,6 +56,8 @@
|
|||
<script th:inline="javascript">
|
||||
var payTypes = [[${@dict.getType('pay_type')}]];
|
||||
var orderTypes = [[${@dict.getType('goods_category_type')}]];
|
||||
var payStatus = [[${@dict.getType('pay_status')}]];
|
||||
var orderStatus = [[${@dict.getType('order_status')}]];
|
||||
|
||||
var editFlag = [[${@permission.hasPermi('order:order:edit')}]];
|
||||
var prefix = ctx + "order/master";
|
||||
|
|
@ -91,166 +97,69 @@
|
|||
},
|
||||
{
|
||||
field: 'code',
|
||||
title: '序号'
|
||||
title: '订单号'
|
||||
},
|
||||
{
|
||||
field: 'detailsList',
|
||||
title: '订单信息',
|
||||
formatter: function (value, row, index) {
|
||||
var actions = [];
|
||||
value.forEach(item => {
|
||||
actions.push("商品id:" + item.goodsId + "</br>");
|
||||
actions.push("商品名称:" + item.goodsName+ "</br>");
|
||||
actions.push("商品数量:" + item.goodsNum+ "</br>");
|
||||
actions.push("已服务数量:" + item.serverGoodsNum + "</br>");
|
||||
actions.push("完成时间:" + item.finishTime + "</br>");
|
||||
if(item.totalMoney){
|
||||
actions.push("子单总金额:" + item.totalMoney + "</br>");
|
||||
}else {
|
||||
actions.push("子单总金额:--" + "</br>");
|
||||
}
|
||||
if(item.discountMoney){
|
||||
actions.push("优惠金额:" + item.discountMoney + "</br>");
|
||||
}else {
|
||||
actions.push("优惠金额:--" + "</br>");
|
||||
}
|
||||
if(item.payMoney){
|
||||
actions.push("实付金额:" + item.payMoney + "</br>");
|
||||
}else {
|
||||
actions.push("实付金额:--" + "</br>");
|
||||
}
|
||||
})
|
||||
/** 消费者相关信息 **/
|
||||
if(row.customDetails){
|
||||
actions.push("消费者Id:" + row.customDetails.customerId + "</br>");
|
||||
actions.push("收件人姓名:" + row.customDetails.name+ "</br>");
|
||||
actions.push("收件人手机:" + row.customDetails.phone + "</br>");
|
||||
actions.push("地址信息:" + row.customDetails.provinceName + "-" + row.customDetails.cityName + "-" + row.customDetails.countryName + "</br>");
|
||||
actions.push("详细地址:" + row.customDetails.address + "</br>");
|
||||
}
|
||||
if(actions.length){
|
||||
return actions.join('');
|
||||
}
|
||||
field: 'customerName',
|
||||
title: '消费者'
|
||||
},
|
||||
{
|
||||
field: 'orderType',
|
||||
title: '订单类型',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(orderTypes, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'state',
|
||||
field: 'orderStatus',
|
||||
title: '订单状态',
|
||||
formatter: function (value, row, index) {
|
||||
var actions = [];
|
||||
if(value){
|
||||
actions.push("订单状态:" + value.orderStatusDesc + "</br>" );
|
||||
actions.push("订单时间:" + value.receivingTime + "</br>" );
|
||||
}
|
||||
return actions.join('');
|
||||
}
|
||||
},
|
||||
// {
|
||||
// field: 'orderType',
|
||||
// title: '订单类型',
|
||||
// align: 'center',
|
||||
// formatter: function (value, row, index) {
|
||||
// return $.table.selectDictLabel(orderTypes, value);
|
||||
// }
|
||||
// },
|
||||
{
|
||||
field: 'memo',
|
||||
title: '便签',
|
||||
formatter: function (value, row, index) {
|
||||
if(value){
|
||||
return value.memoStr;
|
||||
}
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(orderStatus, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'detailsList',
|
||||
title: '订单流转信息',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
field: 'receiving',
|
||||
title: '接单信息',
|
||||
formatter: function (value, row, index) {
|
||||
var actions = [];
|
||||
if(value){
|
||||
actions.push("接单人id:" + value.receivingUserId + "</br>");
|
||||
actions.push("接单人姓名:" + value.receivingUserName + "</br>");
|
||||
actions.push("接单人电话:" + value.receivingUserPhone + "</br>");
|
||||
actions.push("操作人id:" + value.operationUserId + "</br>");
|
||||
actions.push("操作人姓名:" + value.operationUserName + "</br>");
|
||||
actions.push("操作人电话:" + value.operationUserPhone + "</br>");
|
||||
}
|
||||
return actions.join('');
|
||||
field: 'payType',
|
||||
title: '付款类型',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(payTypes, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'operationType',
|
||||
title: '操作',
|
||||
formatter: function (value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-info-circle"></i>查看</a> </br>');
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(1)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-info-circle"></i>查看急报</a> </br>');
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(2)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-info-circle"></i>发送急报</a> </br>');
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(3)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-info-circle"></i>追加扣减</a> </br>');
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(4)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-info-circle"></i>师傅退单</a> </br>');
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(5)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-info-circle"></i>商家退款</a> </br>');
|
||||
return actions.join('');
|
||||
field: 'payStatus',
|
||||
title: '付款状态',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(payStatus, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'workerId',
|
||||
title: '客诉中'
|
||||
field: 'payTime',
|
||||
title: '付款时间'
|
||||
},
|
||||
{
|
||||
field: 'workerName',
|
||||
title: '接单师傅'
|
||||
},
|
||||
{
|
||||
field: 'revTime',
|
||||
title: '商家信息',
|
||||
title: '接单时间'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
sortable: true
|
||||
}, {
|
||||
title: '操作',
|
||||
align: 'left',
|
||||
formatter: function (value, row, index) {
|
||||
var actions = [];
|
||||
if(value){
|
||||
actions.push("商家id:" + value.businessId+ "</br>");
|
||||
actions.push("商家姓名:" + value.businessUserName+ "</br>");
|
||||
actions.push("商家电话:" + value.businessUserPhone+ "</br>");
|
||||
}
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>详情</a> ');
|
||||
return actions.join('');
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'business',
|
||||
title: '商家发布家'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '商家加追金额'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '代收款'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '奖励金'
|
||||
},
|
||||
{
|
||||
field: 'invitee',
|
||||
title: '邀请人',
|
||||
formatter: function (value, row, index) {
|
||||
console.log(value);
|
||||
var actions = [];
|
||||
if(value){
|
||||
actions.push("邀请人姓名:" + value.name + "</br>");
|
||||
actions.push("邀请人电话:" + value.phone + "</br>");
|
||||
}else {
|
||||
actions.push("邀请人姓名:--" + "</br>");
|
||||
actions.push("邀请人电话:--" + "</br>");
|
||||
}
|
||||
return actions.join('');
|
||||
}
|
||||
}
|
||||
// {
|
||||
// title: '操作',
|
||||
// align: 'left',
|
||||
// }
|
||||
]
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue