订单Vo数据/代码页面补充。

This commit is contained in:
但星霖 2022-06-01 14:50:58 +08:00
parent c28e975288
commit 07fde0c962
24 changed files with 455 additions and 257 deletions

View File

@ -6,16 +6,21 @@ import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.core.page.TableDataInfo; import com.ghy.common.core.page.TableDataInfo;
import com.ghy.common.enums.BusinessType; import com.ghy.common.enums.BusinessType;
import com.ghy.common.utils.ObjectUtils;
import com.ghy.common.utils.poi.ExcelUtil; import com.ghy.common.utils.poi.ExcelUtil;
import com.ghy.order.domain.OrderDetail; import com.ghy.order.domain.OrderDetail;
import com.ghy.order.service.OrderDetailService; import com.ghy.order.service.OrderDetailService;
import com.ghy.web.pojo.vo.OrderDetailsResponseVo;
import lombok.RequiredArgsConstructor;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -43,8 +48,8 @@ public class OrderDetailController extends BaseController {
@ResponseBody @ResponseBody
public TableDataInfo list(OrderDetail orderDetail) { public TableDataInfo list(OrderDetail orderDetail) {
startPage(); startPage();
List<OrderDetail> list = orderDetailService.selectOrderDetailList(orderDetail); List<OrderDetail> orderDetailList = orderDetailService.selectOrderDetailList(orderDetail);
return getDataTable(list); return getDataTable(orderDetailList);
} }
@Log(title = "详细订单管理", businessType = BusinessType.EXPORT) @Log(title = "详细订单管理", businessType = BusinessType.EXPORT)

View File

@ -6,17 +6,33 @@ import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.core.page.TableDataInfo; import com.ghy.common.core.page.TableDataInfo;
import com.ghy.common.enums.BusinessType; import com.ghy.common.enums.BusinessType;
import com.ghy.common.utils.ObjectUtils;
import com.ghy.common.utils.poi.ExcelUtil; import com.ghy.common.utils.poi.ExcelUtil;
import com.ghy.customer.domain.Customer;
import com.ghy.customer.domain.CustomerAddress;
import com.ghy.customer.service.CustomerAddressService;
import com.ghy.customer.service.CustomerService;
import com.ghy.order.domain.OrderDetail;
import com.ghy.order.domain.OrderGoods;
import com.ghy.order.domain.OrderMaster; import com.ghy.order.domain.OrderMaster;
import com.ghy.order.service.OrderDetailService;
import com.ghy.order.service.OrderGoodsService;
import com.ghy.order.service.OrderMasterService; import com.ghy.order.service.OrderMasterService;
import com.ghy.web.pojo.vo.OrderDetailsResponseVo;
import com.ghy.worker.domain.Worker;
import com.ghy.worker.service.WorkerService;
import lombok.RequiredArgsConstructor;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 主订单API * 主订单API
@ -25,12 +41,17 @@ import java.util.List;
*/ */
@Controller @Controller
@RequestMapping("/order/master") @RequestMapping("/order/master")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OrderMasterController extends BaseController { public class OrderMasterController extends BaseController {
private final String prefix = "order/master"; private final String prefix = "order/master";
@Resource private final OrderMasterService orderMasterService;
private OrderMasterService orderMasterService; private final CustomerService customerService;
private final WorkerService workerService;
private final OrderDetailService orderDetailService;
private final OrderGoodsService orderGoodsService;
private final CustomerAddressService customerAddressService;
@RequiresPermissions("order:master:view") @RequiresPermissions("order:master:view")
@GetMapping() @GetMapping()
@ -43,8 +64,74 @@ public class OrderMasterController extends BaseController {
@ResponseBody @ResponseBody
public TableDataInfo list(OrderMaster orderMaster) { public TableDataInfo list(OrderMaster orderMaster) {
startPage(); startPage();
List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster); List<OrderMaster> orderMasterList = orderMasterService.selectOrderMasterList(orderMaster);
return getDataTable(list); // 数据处理待返回的数据信息
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);
// 循环数据赋值
for(OrderMaster orderMasterByListData : orderMasterList){
OrderDetailsResponseVo orderDetailsResponseVo = new OrderDetailsResponseVo();
// 订单基本信息
orderDetailsResponseVo.setOrderId(orderMasterByListData.getId());
// 基本信息
List<OrderGoods> orderGoodsList = longOrderGoodsMap.get(orderMasterByListData.getId());
if(orderGoodsList != null && orderGoodsList.size() > 0){
List<OrderDetailsResponseVo.OrderDetails> orderDetailsList = new ArrayList<>();
for(OrderGoods orderGoods : orderGoodsList){
OrderDetailsResponseVo.OrderDetails orderDetails = OrderDetailsResponseVo.OrderDetails.modelDataSupplement(orderGoods);
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)));
}
}
// 数据添加处理
orderDetailsResponseVoList.add(orderDetailsResponseVo);
}
}
return getDataTable(orderDetailsResponseVoList);
} }
@Log(title = "主订单管理", businessType = BusinessType.EXPORT) @Log(title = "主订单管理", businessType = BusinessType.EXPORT)

View File

@ -90,62 +90,143 @@
visible: false visible: false
}, },
{ {
field: 'code', field: 'id',
title: '订单号' title: '号'
}, },
{ {
field: 'customerId', field: 'detailsList',
title: '消费者ID' title: '订单信息',
},
{
field: 'orderType',
title: '订单类型',
align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
return $.table.selectDictLabel(orderTypes, value); console.log(value);
console.log(row);
console.log(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(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: 'orderStatus', field: 'state',
title: '订单状态' title: '订单状态',
},
{
field: 'payType',
title: '付款类型',
align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
return $.table.selectDictLabel(payTypes, value); var actions = [];
if(value){
actions.push("订单状态:" + value.orderStatus + "</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;
}
} }
}, },
{ {
field: 'payStatus', field: 'detailsList',
title: '付款状态' title: '订单流转信息',
align: 'center'
}, },
{ {
field: 'payTime', field: 'receiving',
title: '付款时间' 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: '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: 'workerId', field: 'workerId',
title: '接单师傅ID' title: '客诉中'
}, },
{ {
field: 'revTime', field: 'revTime',
title: '接单时间' title: '商家信息',
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>");
}
return actions.join('');
}
},
{
field: 'business',
title: '商家发布家'
}, },
{ {
field: 'createTime', field: 'createTime',
title: '创建时间', title: '商家加追金额'
sortable: true },
}, { {
title: '操作', field: 'createTime',
align: 'left', 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> '); field: 'createTime',
return actions.join(''); title: '奖励金'
} },
}] {
field: 'createTime',
title: '邀请人'
}
// {
// title: '操作',
// align: 'left',
// }
]
}; };
$.table.init(options); $.table.init(options);
} }

View File

@ -5,81 +5,78 @@ import java.util.List;
/** /**
* 表格分页数据对象 * 表格分页数据对象
* *
* @author clunt * @author clunt
*/ */
public class TableDataInfo implements Serializable public class TableDataInfo implements Serializable {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 总记录数 */ /**
* 总记录数
*/
private long total; private long total;
/** 列表数据 */ /**
* 列表数据
*/
private List<?> rows; private List<?> rows;
/** 消息状态码 */ /**
* 消息状态码
*/
private int code; private int code;
/** 消息内容 */ /**
* 消息内容
*/
private String msg; private String msg;
/** /**
* 表格数据对象 * 表格数据对象
*/ */
public TableDataInfo() public TableDataInfo() {
{
} }
/** /**
* 分页 * 分页
* *
* @param list 列表数据 * @param list 列表数据
* @param total 总记录数 * @param total 总记录数
*/ */
public TableDataInfo(List<?> list, int total) public TableDataInfo(List<?> list, int total) {
{
this.rows = list; this.rows = list;
this.total = total; this.total = total;
} }
public long getTotal() public long getTotal() {
{
return total; return total;
} }
public void setTotal(long total) public void setTotal(long total) {
{
this.total = total; this.total = total;
} }
public List<?> getRows() public List<?> getRows() {
{
return rows; return rows;
} }
public void setRows(List<?> rows) public void setRows(List<?> rows) {
{
this.rows = rows; this.rows = rows;
} }
public int getCode() public int getCode() {
{
return code; return code;
} }
public void setCode(int code) public void setCode(int code) {
{
this.code = code; this.code = code;
} }
public String getMsg() public String getMsg() {
{
return msg; return msg;
} }
public void setMsg(String msg) public void setMsg(String msg) {
{
this.msg = msg; this.msg = msg;
} }
} }

View File

@ -160,4 +160,13 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
// long sec = diff % nd % nh % nm / ns; // long sec = diff % nd % nh % nm / ns;
return day + "" + hour + "小时" + min + "分钟"; return day + "" + hour + "小时" + min + "分钟";
} }
/**
* 根据当前时间进行转换数据
* 格式信息yy-mm-dd HH:mm:ss
*/
public static String getDateTimeFormat(Date date) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateUtils.YYYY_MM_DD_HH_MM_SS);
return simpleDateFormat.format(date);
}
} }

View File

@ -1,6 +1,7 @@
package com.ghy.customer.mapper; package com.ghy.customer.mapper;
import com.ghy.customer.domain.Customer; import com.ghy.customer.domain.Customer;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -26,10 +27,10 @@ public interface CustomerMapper {
* @param customerId 消费者ids * @param customerId 消费者ids
* @return 删除成功条数 * @return 删除成功条数
*/ */
int deleteByIds(Long [] customerId); int deleteByIds(Long[] customerId);
/** /**
* @param customerId 消费者id * @param customerId 消费者id
* @return 删除成功条数 * @return 删除成功条数
*/ */
int deleteByCustomerId(Long customerId); int deleteByCustomerId(Long customerId);
@ -46,4 +47,12 @@ public interface CustomerMapper {
*/ */
int updateCustomer(Customer customer); int updateCustomer(Customer customer);
/**
* 根据消费者id集合信息进行批量查询数据
*
* @param customerIdList 消费者id集合信息
* @return Customer实体集合信息
*/
List<Customer> getByCustomerIdList(@Param("customerIdList") List<Long> customerIdList);
} }

View File

@ -1,8 +1,10 @@
package com.ghy.customer.service; package com.ghy.customer.service;
import com.ghy.customer.domain.Customer;
import com.ghy.customer.domain.CustomerAddress; import com.ghy.customer.domain.CustomerAddress;
import java.util.List; import java.util.List;
import java.util.Map;
public interface CustomerAddressService { public interface CustomerAddressService {
@ -47,5 +49,4 @@ public interface CustomerAddressService {
* @return 修改成功条数 * @return 修改成功条数
*/ */
int updateCustomerAddress(CustomerAddress customerAddress); int updateCustomerAddress(CustomerAddress customerAddress);
} }

View File

@ -3,6 +3,7 @@ package com.ghy.customer.service;
import com.ghy.customer.domain.Customer; import com.ghy.customer.domain.Customer;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author clunt * @author clunt
@ -35,7 +36,7 @@ public interface CustomerService {
int deleteByIds(String ids); int deleteByIds(String ids);
/** /**
* @param customerId 消费者id * @param customerId 消费者id
* @return 删除成功条数 * @return 删除成功条数
*/ */
int deleteByCustomerId(Long customerId); int deleteByCustomerId(Long customerId);
@ -52,4 +53,12 @@ public interface CustomerService {
*/ */
int updateCustomer(Customer customer); int updateCustomer(Customer customer);
/**
* 根据消费者id集合信息进行查询封装成为map数据
*
* @param customerUserIdList 消费者Id集合信息数据
* @return 键值队列数据 key-> 消费者Id value-> 消费者实体信息
*/
Map<Long, Customer> byCustomerUseridInMap(List<Long> customerUserIdList);
} }

View File

@ -9,7 +9,9 @@ import com.ghy.customer.service.CustomerService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author clunt * @author clunt
@ -75,6 +77,20 @@ public class CustomerServiceImpl implements CustomerService {
return customerMapper.updateCustomer(customer); return customerMapper.updateCustomer(customer);
} }
@Override
public Map<Long, Customer> byCustomerUseridInMap(List<Long> customerUserIdList) {
Map<Long, Customer> longCustomerMap = new HashMap<>();
if(customerUserIdList != null && customerUserIdList.size() > 0){
List<Customer> customerList = customerMapper.getByCustomerIdList(customerUserIdList);
if(customerList != null && customerList.size() > 0){
for(Customer customer : customerList){
longCustomerMap.put(customer.getCustomerId(), customer);
}
}
}
return longCustomerMap;
}
public int countUserCustomer(Customer customer) { public int countUserCustomer(Customer customer) {
//TODO 需要校验用户是否在被使用 //TODO 需要校验用户是否在被使用
return 0; return 0;

View File

@ -96,4 +96,14 @@
where customer_id = #{customerId} where customer_id = #{customerId}
</update> </update>
<select id="getByCustomerIdList" resultMap="CustomerResult">
<include refid="selectCustomer" />
<where>
and customer_id in
<foreach item="item" index="customerIdList" collection="customerIdList" open="(" separator="," close=")">
#{item}
</foreach>
</where>
</select>
</mapper> </mapper>

View File

@ -1,6 +1,8 @@
package com.ghy.order.mapper; package com.ghy.order.mapper;
import com.ghy.order.domain.OrderDetail; import com.ghy.order.domain.OrderDetail;
import com.ghy.order.domain.OrderGoods;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -48,4 +50,12 @@ public interface OrderDetailMapper {
* @return 细单表信息 * @return 细单表信息
*/ */
OrderDetail checkOrderDetailCodeUnique(String orderDetailCode); OrderDetail checkOrderDetailCodeUnique(String orderDetailCode);
/**
* 根据订单id集合信息进行批量数据查询
*
* @param orderIdList 订单Id集合信息
* @return OrderDetail实体集合信息
*/
List<OrderDetail> getByOrderIdList(@Param("orderIdList") List<Long> orderIdList);
} }

View File

@ -1,6 +1,7 @@
package com.ghy.order.mapper; package com.ghy.order.mapper;
import com.ghy.order.domain.OrderGoods; import com.ghy.order.domain.OrderGoods;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -39,4 +40,11 @@ public interface OrderGoodsMapper {
*/ */
int deleteOrderGoodsByIds(Long[] orderGoodsIds); int deleteOrderGoodsByIds(Long[] orderGoodsIds);
/**
* 根据订单id集合信息进行批量数据查询
*
* @param orderIdList 订单Id集合信息
* @return OrderGoods实体集合信息
*/
List<OrderGoods> getByOrderIdList(@Param("orderIdList") List<Long> orderIdList);
} }

View File

@ -1,6 +1,8 @@
package com.ghy.order.mapper; package com.ghy.order.mapper;
import com.ghy.order.domain.OrderGoods;
import com.ghy.order.domain.OrderMaster; import com.ghy.order.domain.OrderMaster;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;

View File

@ -3,6 +3,7 @@ package com.ghy.order.service;
import com.ghy.order.domain.OrderDetail; import com.ghy.order.domain.OrderDetail;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 详细订单接口 * 详细订单接口
@ -55,4 +56,12 @@ public interface OrderDetailService {
*/ */
String createCode(); String createCode();
/**
* 根据订单id集合信息进行查询封装成为map数据
*
* @param orderIdList 订单Id集合信息数据
* @return 键值队列数据 key-> 订单Id value-> 订单实体集合信息
*/
Map<Long, List<OrderDetail>> byOrderIdInMap(List<Long> orderIdList);
} }

View File

@ -1,8 +1,10 @@
package com.ghy.order.service; package com.ghy.order.service;
import com.ghy.order.domain.OrderDetail;
import com.ghy.order.domain.OrderGoods; import com.ghy.order.domain.OrderGoods;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 订单商品属性 * 订单商品属性
@ -38,4 +40,12 @@ public interface OrderGoodsService {
* @param orderGoodsIds 需要删除的数据ID * @param orderGoodsIds 需要删除的数据ID
*/ */
int deleteOrderGoodsByIds(Long[] orderGoodsIds); int deleteOrderGoodsByIds(Long[] orderGoodsIds);
/**
* 根据订单id集合信息进行查询封装成为map数据
*
* @param orderIdList 订单Id集合信息数据
* @return 键值队列数据 key-> 订单Id value-> 订单实体集合信息
*/
Map<Long, List<OrderGoods>> byOrderIdInMap(List<Long> orderIdList);
} }

View File

@ -11,7 +11,10 @@ import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeFormatterBuilder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import static java.time.temporal.ChronoField.*; import static java.time.temporal.ChronoField.*;
@ -72,4 +75,28 @@ public class OrderDetailServiceImpl implements OrderDetailService {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
return "od" + now.format(MINI_FORMATTER) + INDEX.getAndIncrement(); return "od" + now.format(MINI_FORMATTER) + INDEX.getAndIncrement();
} }
@Override
public Map<Long, List<OrderDetail>> byOrderIdInMap(List<Long> orderIdList) {
Map<Long, List<OrderDetail>> longByOrderDetailListMap = new HashMap<>();
if(orderIdList != null && orderIdList.size() > 0){
List<OrderDetail> orderDetailList = orderDetailMapper.getByOrderIdList(orderIdList);
if(orderDetailList != null && orderDetailList.size() > 0){
for(OrderDetail orderDetail : orderDetailList){
List<OrderDetail> orderDetailListByMapCrw = longByOrderDetailListMap.get(orderDetail.getOrderMasterId());
if(orderDetailListByMapCrw != null && orderDetailListByMapCrw.size() > 0){
List<OrderDetail> orderDetailListByMapNew = new ArrayList<>();
orderDetailListByMapNew.add(orderDetail);
longByOrderDetailListMap.put(orderDetail.getOrderMasterId(), orderDetailListByMapNew);
}else {
List<OrderDetail> orderDetailListByMapNew = new ArrayList<>();
orderDetailListByMapNew.add(orderDetail);
longByOrderDetailListMap.put(orderDetail.getOrderMasterId(), orderDetailListByMapNew);
}
}
}
}
return longByOrderDetailListMap;
}
} }

View File

@ -1,5 +1,6 @@
package com.ghy.order.service.impl; package com.ghy.order.service.impl;
import com.ghy.order.domain.OrderDetail;
import com.ghy.order.domain.OrderGoods; import com.ghy.order.domain.OrderGoods;
import com.ghy.order.mapper.OrderGoodsMapper; import com.ghy.order.mapper.OrderGoodsMapper;
import com.ghy.order.service.OrderGoodsService; import com.ghy.order.service.OrderGoodsService;
@ -8,7 +9,10 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Slf4j @Slf4j
@Service @Service
@ -42,4 +46,27 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
public int deleteOrderGoodsByIds(Long[] orderGoodsIds) { public int deleteOrderGoodsByIds(Long[] orderGoodsIds) {
return orderGoodsMapper.deleteOrderGoodsByIds(orderGoodsIds); return orderGoodsMapper.deleteOrderGoodsByIds(orderGoodsIds);
} }
@Override
public Map<Long, List<OrderGoods>> byOrderIdInMap(List<Long> orderIdList) {
Map<Long, List<OrderGoods>> longByOrderGoodsListMap = new HashMap<>();
if(orderIdList != null && orderIdList.size() > 0){
List<OrderGoods> orderGoodsList = orderGoodsMapper.getByOrderIdList(orderIdList);
if(orderGoodsList != null && orderGoodsList.size() > 0){
for(OrderGoods orderGoods : orderGoodsList){
List<OrderGoods> orderDetailListByMapCrw = longByOrderGoodsListMap.get(orderGoods.getOrderId());
if(orderDetailListByMapCrw != null && orderDetailListByMapCrw.size() > 0){
List<OrderGoods> orderDetailListByMapNew = new ArrayList<>();
orderDetailListByMapNew.add(orderGoods);
longByOrderGoodsListMap.put(orderGoods.getOrderId(), orderDetailListByMapNew);
}else {
List<OrderGoods> orderDetailListByMapNew = new ArrayList<>();
orderDetailListByMapNew.add(orderGoods);
longByOrderGoodsListMap.put(orderGoods.getOrderId(), orderDetailListByMapNew);
}
}
}
}
return longByOrderGoodsListMap;
}
} }

View File

@ -1,183 +0,0 @@
package com.ghy.order.vo;
import lombok.*;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @author : 但星霖
* @date : 2022-05-30 20:04
* 订单列表返回数据vo
*/
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class OrderDetailsResponseVo implements Serializable {
/**
* 序号
*/
private Long id;
/**
* 商户ID
*/
private Long deptId;
/**
* 订单编码
*/
private String code;
/**
* 订单状态
*/
private OrderState state;
/**
* 便签数据
*/
private OrderMemo memo;
/**
* 订单流转信息
*/
private OrderCirculation circulation;
/**
* 商家信息
*/
private OrderBusiness business;
/**
* 接单数据信息
*/
private OrderReceiving receiving;
/**
* 订单状态
*/
@Data
@EqualsAndHashCode(callSuper = false)
public static class OrderState {
/**
* 订单状态
*/
private Integer orderStatus;
/**
* 时间
* 对应不同对状态展现不同对时间数据
* 发布时间/接单时间/完成时间
* 格式为转移后对yyyy-mm-dd hh:ss:mm
*/
private String receivingTime;
/**
* 修改上门时间次数
* 单一字段展现
*/
private Integer doorFrequency;
}
/**
* 便签数据
*/
@Data
@EqualsAndHashCode(callSuper = false)
public static class OrderMemo {
/**
* 便签数据
*/
private String memoStr;
}
/**
* 流转信息
*/
@Data
@EqualsAndHashCode(callSuper = false)
public static class OrderCirculation {
/**
* 流转信息文本数据
*/
private String circulationStr;
/**
* 流转信息管理员Id
*/
private String circulationUserId;
}
/**
* 商家信息
*/
@Data
@EqualsAndHashCode(callSuper = false)
public static class OrderBusiness {
/**
* 商家id
*/
private String businessId;
/**
* 商家姓名
*/
private String businessUserName;
/**
* 商家电话
*/
private String businessUserPhone;
}
/**
* 接单信息
*/
@Data
@EqualsAndHashCode(callSuper = false)
public static class OrderReceiving {
/**
* 接单人用户Id
*/
private String receivingUserId;
/**
* 接单人用户姓名
*/
private String receivingUserName;
/**
* 接单人用户电话
*/
private String receivingUserPhone;
/**
* 操作人用户Id
*/
private String operationUserId;
/**·
* 操作人用户姓名
*/
private String operationUserName;
/**
* 操作人用户电话
*/
private String operationUserPhone;
}
}

View File

@ -130,4 +130,14 @@
WHERE `code` =#{orderDetailCode} LIMIT 1 WHERE `code` =#{orderDetailCode} LIMIT 1
</select> </select>
<select id="getByOrderIdList" resultMap="OrderDetailResult">
<include refid="selectOrderDetail" />
<where>
and order_master_id in
<foreach item="item" index="orderIdList" collection="orderIdList" open="(" separator="," close=")">
#{item}
</foreach>
</where>
</select>
</mapper> </mapper>

View File

@ -94,4 +94,14 @@
</foreach> </foreach>
</delete> </delete>
<select id="getByOrderIdList" resultMap="OrderGoodsResult">
<include refid="selectOrderGoods" />
<where>
and order_id in
<foreach item="item" index="orderIdList" collection="orderIdList" open="(" separator="," close=")">
#{item}
</foreach>
</where>
</select>
</mapper> </mapper>

View File

@ -1,6 +1,7 @@
package com.ghy.worker.mapper; package com.ghy.worker.mapper;
import com.ghy.worker.domain.Worker; import com.ghy.worker.domain.Worker;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -30,4 +31,12 @@ public interface WorkerMapper {
* @param workerId 师傅ID * @param workerId 师傅ID
*/ */
Worker selectById(Long workerId); Worker selectById(Long workerId);
/**
* 根据师傅id集合信息进行批量数据查询
*
* @param workIdList 师傅Id集合信息
* @return Worker实体集合信息
*/
List<Worker> getByWorkIdList(@Param("workIdList") List<Long> workIdList);
} }

View File

@ -3,6 +3,7 @@ package com.ghy.worker.service;
import com.ghy.worker.domain.Worker; import com.ghy.worker.domain.Worker;
import java.util.List; import java.util.List;
import java.util.Map;
public interface WorkerService { public interface WorkerService {
@ -44,4 +45,12 @@ public interface WorkerService {
* @param workerId workerId * @param workerId workerId
*/ */
boolean checkInTeam(Long leaderId, Long workerId); boolean checkInTeam(Long leaderId, Long workerId);
/**
* 根据师傅id集合信息进行查询封装成为map数据
*
* @param workUserIdList 师傅Id集合信息数据
* @return 键值队列数据 key-> 师傅Id value-> 师傅实体信息
*/
Map<Long, Worker> byWorkUserIdInMap(List<Long> workUserIdList);
} }

View File

@ -10,7 +10,9 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class WorkerServiceImpl implements WorkerService { public class WorkerServiceImpl implements WorkerService {
@ -58,4 +60,18 @@ public class WorkerServiceImpl implements WorkerService {
List<WorkerTeam> teams = workerTeamMapper.getWorkerTeamList(query); List<WorkerTeam> teams = workerTeamMapper.getWorkerTeamList(query);
return !CollectionUtils.isEmpty(teams); return !CollectionUtils.isEmpty(teams);
} }
@Override
public Map<Long, Worker> byWorkUserIdInMap(List<Long> workUserIdList) {
Map<Long, Worker> longWorkerMap = new HashMap<>();
if(workUserIdList != null && workUserIdList.size() > 0){
List<Worker> workerList = workerMapper.getByWorkIdList(workUserIdList);
if(workerList != null && workerList.size() > 0){
for(Worker worker : workerList){
longWorkerMap.put(worker.getWorkerId(), worker);
}
}
}
return longWorkerMap;
}
} }

View File

@ -79,4 +79,14 @@
</set> </set>
where worker_id = #{workerId} where worker_id = #{workerId}
</update> </update>
<select id="getByWorkIdList" resultMap="WorkerResult">
<include refid="selectWorker" />
<where>
and w.worker_id in
<foreach item="item" index="workIdList" collection="workIdList" open="(" separator="," close=")">
#{item}
</foreach>
</where>
</select>
</mapper> </mapper>