This commit is contained in:
kuang.yifei@iwhalecloud.com 2022-06-01 16:21:09 +08:00
commit 9443a8ca24
29 changed files with 956 additions and 265 deletions

View File

@ -194,7 +194,7 @@ public class OrderController extends BaseController {
orderMaster.setCode(orderMasterService.createOrderCode());
orderMaster.setOrderType(1);
orderMaster.setPayType(appOrderRequest.getPayType());
orderMaster.setOrderStatus(OrderStatus.PLAIN.getCode());
orderMaster.setOrderStatus(OrderStatus.PLAIN.code());
orderMaster.setCustomerId(appOrderRequest.getCustomerId());
orderMaster.setPayStatus(PayStatus.WAIT_PAY.getCode());
orderMaster.setCreateTime(new Date());

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.page.TableDataInfo;
import com.ghy.common.enums.BusinessType;
import com.ghy.common.utils.ObjectUtils;
import com.ghy.common.utils.poi.ExcelUtil;
import com.ghy.order.domain.OrderDetail;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@ -43,8 +48,8 @@ public class OrderDetailController extends BaseController {
@ResponseBody
public TableDataInfo list(OrderDetail orderDetail) {
startPage();
List<OrderDetail> list = orderDetailService.selectOrderDetailList(orderDetail);
return getDataTable(list);
List<OrderDetail> orderDetailList = orderDetailService.selectOrderDetailList(orderDetail);
return getDataTable(orderDetailList);
}
@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.page.TableDataInfo;
import com.ghy.common.enums.BusinessType;
import com.ghy.common.utils.ObjectUtils;
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.service.OrderDetailService;
import com.ghy.order.service.OrderGoodsService;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 主订单API
@ -25,12 +41,17 @@ import java.util.List;
*/
@Controller
@RequestMapping("/order/master")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OrderMasterController extends BaseController {
private final String prefix = "order/master";
@Resource
private OrderMasterService orderMasterService;
private final 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")
@GetMapping()
@ -43,8 +64,74 @@ public class OrderMasterController extends BaseController {
@ResponseBody
public TableDataInfo list(OrderMaster orderMaster) {
startPage();
List<OrderMaster> list = orderMasterService.selectOrderMasterList(orderMaster);
return getDataTable(list);
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);
// 循环数据赋值
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)

View File

@ -0,0 +1,356 @@
package com.ghy.web.pojo.vo;
import com.ghy.common.enums.OrderStatus;
import com.ghy.common.utils.DateUtils;
import com.ghy.common.utils.ObjectUtils;
import com.ghy.customer.domain.CustomerAddress;
import com.ghy.order.domain.OrderGoods;
import com.ghy.order.domain.OrderMaster;
import com.ghy.worker.domain.Worker;
import lombok.*;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* @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 Long orderId;
/**
* 订单消费者信息
*/
private OrderCustomDetails customDetails;
/**
* 订单详细信息
*/
private List<OrderDetails> detailsList;
/**
* 订单状态
*/
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;
/**
* 订单枚举
*/
private OrderStatus orderStatusEnum;
/**
* 订单枚举翻译
*/
private String orderStatusDesc;
/**
* 时间
* 对应不同对状态展现不同对时间数据
* 发布时间/接单时间/完成时间
* 格式为转移后对yyyy-mm-dd hh:ss:mm
*/
private String receivingTime;
/**
* 修改上门时间次数
* 单一字段展现
*/
private Integer doorFrequency;
public static OrderState modelDataSupplement(OrderMaster orderMaster){
OrderState orderState = new OrderState();
orderState.setOrderStatus(orderMaster.getOrderStatus());
if(ObjectUtils.isNotNull(orderMaster.getOrderStatus())){
OrderStatus orderStatusByEnum = OrderStatus.parse(orderMaster.getOrderStatus());
if(ObjectUtils.isNotNull(orderStatusByEnum)){
orderState.setOrderStatusEnum(orderStatusByEnum);
orderState.setOrderStatus(orderStatusByEnum.code());
orderState.setOrderStatusDesc(orderStatusByEnum.desc());
}
}
if(ObjectUtils.isNull(orderState.getReceivingTime())){
orderState.setReceivingTime("--");
}else {
orderState.setReceivingTime(orderState.getReceivingTime());
}
// todo 此处缺少上门次数字段
return orderState;
}
}
/**
* 便签数据
*/
@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 Long receivingUserId;
/**
* 接单人用户姓名
*/
private String receivingUserName;
/**
* 接单人用户电话
*/
private String receivingUserPhone;
/**
* 操作人用户Id
*/
private Long operationUserId;
/**
* 操作人用户姓名
*/
private String operationUserName;
/**
* 操作人用户电话
*/
private String operationUserPhone;
public static OrderReceiving modelDataSupplement(Worker workerByReceiving, Worker workerByOperation){
OrderReceiving orderReceiving = new OrderReceiving();
// 接单人
if(ObjectUtils.isNotNull(workerByReceiving)){
orderReceiving.setReceivingUserId(workerByReceiving.getWorkerId());
orderReceiving.setReceivingUserName(workerByReceiving.getName());
orderReceiving.setReceivingUserPhone(workerByReceiving.getPhone());
}
// 操作人
if(ObjectUtils.isNotNull(workerByOperation)){
orderReceiving.setOperationUserId(workerByReceiving.getWorkerId());
orderReceiving.setOperationUserName(workerByReceiving.getName());
orderReceiving.setOperationUserPhone(workerByReceiving.getPhone());
}
return orderReceiving;
}
}
/**
* 订单详情
*/
@Data
@EqualsAndHashCode(callSuper = false)
public static class OrderDetails {
/**
* 商品规格id
*/
private Long goodsId;
/**
* 商品名称
*/
private String goodsName;
/**
* 商品数量
*/
private Integer goodsNum;
/**
* 已服务数量
*/
private Integer serverGoodsNum;
/**
* 完成时间
*/
private String finishTime;
public static OrderDetails modelDataSupplement(OrderGoods orderGoods){
OrderDetails orderDetails = new OrderDetails();
if(ObjectUtils.isNotNull(orderGoods)){
orderDetails.setGoodsId(orderGoods.getGoodsId());
orderDetails.setGoodsName(orderGoods.getGoodsName());
orderDetails.setGoodsNum(orderGoods.getGoodsNum());
orderDetails.setServerGoodsNum(orderGoods.getServerGoodsNum());
if(ObjectUtils.isNotNull(orderGoods.getFinishTime())){
orderDetails.setFinishTime(DateUtils.getDateTimeFormat(orderGoods.getFinishTime()));
}else {
orderDetails.setFinishTime("--");
}
}
return orderDetails;
}
}
/**
* 订单消费者信息
*/
@Data
@EqualsAndHashCode(callSuper = false)
public static class OrderCustomDetails {
/**
* 消费者id
*/
private Long customerId;
/**
* 收件人姓名
*/
private String name;
/**
* 收件人手机号
*/
private String phone;
/**
*
*/
private String provinceName;
/**
*
*/
private String cityName;
/**
*
*/
private String countryName;
/**
* 详细地址
*/
private String address;
public static OrderCustomDetails modelDataSupplement(CustomerAddress customerAddress){
OrderCustomDetails orderCustomDetails = new OrderCustomDetails();
if(ObjectUtils.isNotNull(customerAddress)){
orderCustomDetails.setCustomerId(customerAddress.getCustomerId());
orderCustomDetails.setAddress(customerAddress.getAddress());
orderCustomDetails.setCityName(customerAddress.getCityName());
orderCustomDetails.setPhone(customerAddress.getPhone());
orderCustomDetails.setProvinceName(customerAddress.getProvinceName());
orderCustomDetails.setName(customerAddress.getName());
orderCustomDetails.setCountryName(customerAddress.getCountryName());
}
return orderCustomDetails;
}
}
}

View File

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

View File

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

View File

@ -0,0 +1,19 @@
package com.ghy.common.enums;
/**
* 为了能统一处理数据库中定义的各种状态状态枚举都需要实现此接口
*
* @author chunhao.guo
* @date 2020-03-11
*/
public interface IEnumType {
/**
* 数据库中定义的 数字 状态码
*/
int code();
/**
* 简单描述
*/
String desc();
}

View File

@ -1,11 +1,17 @@
package com.ghy.common.enums;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 订单状态
*
* @author clunt
*/
public enum OrderStatus {
public enum OrderStatus implements IEnumType {
RECEIVE(0, "待接单"),
PLAIN(1, "待排期"),
@ -14,20 +20,62 @@ public enum OrderStatus {
FINISH(4, "已完成"),
CANCEL(5, "已取消");
private final Integer code;
private final int code;
private final String desc;
OrderStatus(Integer code, String desc) {
private final static Map<Integer, OrderStatus> BY_CODE_MAP
= Arrays.stream(OrderStatus.values()).collect(Collectors.toMap(OrderStatus::code, code -> code));
private final static Map<String, OrderStatus> BY_NAME_MAP
= Arrays.stream(OrderStatus.values()).collect(Collectors.toMap(code -> code.name().toLowerCase(), code -> code));
/**
* @param code 代码
* @param desc 描述
*/
OrderStatus(final int code, final String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
@Override
public int code() {
return this.code;
}
public String getDesc() {
return desc;
@Override
public String desc() {
return this.desc;
}
/**
* @param code 代码
* @return 转换出来的状态码
*/
public static OrderStatus parse(Integer code) {
return BY_CODE_MAP.get(code);
}
public static OrderStatus parse(Integer code, OrderStatus defaultState) {
return BY_CODE_MAP.getOrDefault(code, defaultState);
}
/**
* @param name 名字
* @return 转换出来的状态码
*/
public static OrderStatus parse(String name) {
if (StringUtils.isBlank(name)) {
return null;
}
return BY_NAME_MAP.get(name.trim().toLowerCase());
}
public static OrderStatus parse(String name, OrderStatus defaultState) {
if (StringUtils.isBlank(name)) {
return defaultState;
}
return BY_NAME_MAP.getOrDefault(name.trim().toLowerCase(), defaultState);
}
}

View File

@ -160,4 +160,13 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
// long sec = diff % nd % nh % nm / ns;
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

@ -0,0 +1,70 @@
package com.ghy.common.utils;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
/**
* 对象工具类
* @since 2022-05-31
* @author 但星霖
*/
public class ObjectUtils {
/**
* 判断object是否为空,集合会校验size
*/
public static boolean isNull(Object... objs) {
for (Object obj : objs) {
if (isEmpty(obj)) {
return true;
}
}
return false;
}
/**
* 判断object是否不为空,集合会校验size
*/
public static boolean isNotNull(Object... obj) {
return !isNull(obj);
}
/**
* 对象非空判断
*/
public static boolean isNotEmpty(Object obj) {
return !isEmpty(obj);
}
/**
* 对象空判断
*/
public static boolean isEmpty(Object obj) {
if (obj == null) {
return true;
}
if (obj.getClass().isArray()) {
return Array.getLength(obj) == 0;
}
if (obj instanceof CharSequence) {
return ((CharSequence) obj).length() == 0;
}
if (obj instanceof Collection) {
return ((Collection<?>) obj).isEmpty();
}
if (obj instanceof Map) {
return ((Map<?, ?>) obj).isEmpty();
}
if (obj instanceof Iterable) {
return !((Iterable<?>) obj).iterator().hasNext();
}
if (obj instanceof Iterator) {
return !((Iterator<?>) obj).hasNext();
}
// else
return false;
}
}

View File

@ -1,6 +1,7 @@
package com.ghy.customer.mapper;
import com.ghy.customer.domain.Customer;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -26,10 +27,10 @@ public interface CustomerMapper {
* @param customerId 消费者ids
* @return 删除成功条数
*/
int deleteByIds(Long [] customerId);
int deleteByIds(Long[] customerId);
/**
* @param customerId 消费者id
* @param customerId 消费者id
* @return 删除成功条数
*/
int deleteByCustomerId(Long customerId);
@ -46,4 +47,12 @@ public interface CustomerMapper {
*/
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;
import com.ghy.customer.domain.Customer;
import com.ghy.customer.domain.CustomerAddress;
import java.util.List;
import java.util.Map;
public interface CustomerAddressService {
@ -47,5 +49,4 @@ public interface CustomerAddressService {
* @return 修改成功条数
*/
int updateCustomerAddress(CustomerAddress customerAddress);
}

View File

@ -3,6 +3,7 @@ package com.ghy.customer.service;
import com.ghy.customer.domain.Customer;
import java.util.List;
import java.util.Map;
/**
* @author clunt
@ -35,7 +36,7 @@ public interface CustomerService {
int deleteByIds(String ids);
/**
* @param customerId 消费者id
* @param customerId 消费者id
* @return 删除成功条数
*/
int deleteByCustomerId(Long customerId);
@ -52,4 +53,12 @@ public interface CustomerService {
*/
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 javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author clunt
@ -75,6 +77,20 @@ public class CustomerServiceImpl implements CustomerService {
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) {
//TODO 需要校验用户是否在被使用
return 0;

View File

@ -96,4 +96,14 @@
where customer_id = #{customerId}
</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>

View File

@ -1,6 +1,8 @@
package com.ghy.order.mapper;
import com.ghy.order.domain.OrderDetail;
import com.ghy.order.domain.OrderGoods;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -48,4 +50,12 @@ public interface OrderDetailMapper {
* @return 细单表信息
*/
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;
import com.ghy.order.domain.OrderGoods;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -39,4 +40,11 @@ public interface OrderGoodsMapper {
*/
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;
import com.ghy.order.domain.OrderGoods;
import com.ghy.order.domain.OrderMaster;
import org.apache.ibatis.annotations.Param;
import java.util.List;

View File

@ -3,6 +3,7 @@ package com.ghy.order.service;
import com.ghy.order.domain.OrderDetail;
import java.util.List;
import java.util.Map;
/**
* 详细订单接口
@ -55,4 +56,12 @@ public interface OrderDetailService {
*/
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;
import com.ghy.order.domain.OrderDetail;
import com.ghy.order.domain.OrderGoods;
import java.util.List;
import java.util.Map;
/**
* 订单商品属性
@ -38,4 +40,12 @@ public interface OrderGoodsService {
* @param orderGoodsIds 需要删除的数据ID
*/
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.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import static java.time.temporal.ChronoField.*;
@ -72,4 +75,28 @@ public class OrderDetailServiceImpl implements OrderDetailService {
LocalDateTime now = LocalDateTime.now();
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;
import com.ghy.order.domain.OrderDetail;
import com.ghy.order.domain.OrderGoods;
import com.ghy.order.mapper.OrderGoodsMapper;
import com.ghy.order.service.OrderGoodsService;
@ -8,7 +9,10 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
@ -42,4 +46,27 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
public int deleteOrderGoodsByIds(Long[] 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
</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>

View File

@ -94,4 +94,14 @@
</foreach>
</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>

View File

@ -1,6 +1,7 @@
package com.ghy.worker.mapper;
import com.ghy.worker.domain.Worker;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -30,4 +31,12 @@ public interface WorkerMapper {
* @param workerId 师傅ID
*/
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 java.util.List;
import java.util.Map;
public interface WorkerService {
@ -44,4 +45,12 @@ public interface WorkerService {
* @param workerId 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 javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class WorkerServiceImpl implements WorkerService {
@ -58,4 +60,18 @@ public class WorkerServiceImpl implements WorkerService {
List<WorkerTeam> teams = workerTeamMapper.getWorkerTeamList(query);
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>
where worker_id = #{workerId}
</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>