订单信息页

This commit is contained in:
HH 2023-02-17 21:11:23 +08:00
parent f8b88dddf1
commit ab034f6ab9
23 changed files with 286 additions and 108 deletions

View File

@ -12,6 +12,7 @@ import com.ghy.common.enums.PayStatus;
import com.ghy.common.utils.ExceptionUtil; import com.ghy.common.utils.ExceptionUtil;
import com.ghy.common.utils.StringUtils; import com.ghy.common.utils.StringUtils;
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.domain.CustomerAddress;
import com.ghy.customer.service.CustomerAddressService; import com.ghy.customer.service.CustomerAddressService;
import com.ghy.customer.service.CustomerService; import com.ghy.customer.service.CustomerService;
@ -119,8 +120,57 @@ public class OrderDetailController extends BaseController {
@ResponseBody @ResponseBody
public TableDataInfo list(OrderDetail orderDetail) { public TableDataInfo list(OrderDetail orderDetail) {
startPage(); startPage();
List<OrderDetail> orderDetailList = orderDetailService.selectOrderDetailList(orderDetail); List<OrderDetail> orderDetails = orderDetailService.selectOrderDetailList(orderDetail);
return getDataTable(orderDetailList);
Set<Long> customerIds = orderDetails.stream().map(OrderDetail::getCustomerId).collect(Collectors.toSet());
Map<Long, Customer> customerMap = customerService.selectByIds(customerIds)
.stream().collect(Collectors.toMap(Customer::getCustomerId, x -> x, (x, y) -> y));
Set<Long> orderMasterIds = orderDetails.stream().map(OrderDetail::getOrderMasterId).collect(Collectors.toSet());
List<OrderMaster> orderMasters = orderMasterService.selectByIds(orderMasterIds);
Map<Long, OrderMaster> orderMasterMap = orderMasters.stream().collect(Collectors.toMap(OrderMaster::getId, x -> x, (x, y) -> y));
List<FinancialMaster> financialMasters = financialMasterService.selectByOrderMasterIds(orderMasterIds);
Map<Long, FinancialMaster> financialMasterMap = financialMasters
.stream().collect(Collectors.toMap(FinancialMaster::getOrderMasterId, x -> x, (x, y) -> y));
Set<Long> orderDetailIds = orderDetails.stream().map(OrderDetail::getId).collect(Collectors.toSet());
Map<Long, FinancialDetail> financialDetailMap = financialDetailService.selectByOrderDetailIds(orderDetailIds)
.stream().collect(Collectors.toMap(FinancialDetail::getOrderDetailId, x -> x, (x, y) -> y));
Set<Long> goodsIds = orderMasters.stream().map(OrderMaster::getGoodsId).collect(Collectors.toSet());
Map<Long, Goods> goodsMap = goodsService.selectByIds(goodsIds)
.stream().collect(Collectors.toMap(Goods::getGoodsId, x -> x, (x, y) -> y));
Set<Long> workerIds = orderDetails.stream().map(OrderDetail::getWorkerId).collect(Collectors.toSet());
Map<Long, Worker> workerMap = workerService.selectByIds(workerIds)
.stream().collect(Collectors.toMap(Worker::getWorkerId, x -> x, (x, y) -> y));
for (OrderDetail detail : orderDetails) {
Customer customer = customerMap.get(detail.getCustomerId());
if (customer != null) {
detail.setCustomerName(customer.getName());
detail.setCustomerPhone(customer.getPhone());
}
OrderMaster orderMaster = orderMasterMap.get(detail.getOrderMasterId());
if (orderMaster != null) {
detail.setPayStatus(orderMaster.getPayStatus());
detail.setPayType(orderMaster.getPayType());
detail.setPayTime(orderMaster.getPayTime());
detail.setGoods(goodsMap.get(orderMaster.getGoodsId()));
FinancialMaster fm = financialMasterMap.get(detail.getOrderMasterId());
if (fm != null) {
detail.setFinancialMasterMoney(fm.getPayMoney());
}
}
FinancialDetail fd = financialDetailMap.get(detail.getId());
if (fd != null) {
detail.setFinancialDetailMoney(fd.getPayMoney());
}
detail.setWorker(workerMap.get(detail.getWorkerId()));
}
return getDataTable(orderDetails);
} }
@PostMapping("/app/detail") @PostMapping("/app/detail")
@ -230,11 +280,18 @@ public class OrderDetailController extends BaseController {
SysDeptConfig sysDeptConfig = sysDeptConfigService.selectByDeptId(request.getDeptId()); SysDeptConfig sysDeptConfig = sysDeptConfigService.selectByDeptId(request.getDeptId());
orderTimeoutRecords.stream().forEach(timeoutRecord -> { orderTimeoutRecords.stream().forEach(timeoutRecord -> {
switch (timeoutRecord.getOrderStatus()) { switch (timeoutRecord.getOrderStatus()) {
case 0: timeoutRecord.setPayMoney(sysDeptConfig.getPlainOutTime()); break; case 0:
case 1: timeoutRecord.setPayMoney(sysDeptConfig.getGoOutTime()); break; timeoutRecord.setPayMoney(sysDeptConfig.getPlainOutTime());
break;
case 1:
timeoutRecord.setPayMoney(sysDeptConfig.getGoOutTime());
break;
case 2: case 2:
case 3: timeoutRecord.setPayMoney(sysDeptConfig.getGoingOutTime()); break; case 3:
default: break; timeoutRecord.setPayMoney(sysDeptConfig.getGoingOutTime());
break;
default:
break;
} }
}); });

View File

@ -22,7 +22,8 @@
<li> <li>
订单状态:<select name="status" th:with="type=${@dict.getType('order_status')}"> 订单状态:<select name="status" th:with="type=${@dict.getType('order_status')}">
<option value="">所有</option> <option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select> </select>
</li> </li>
<li> <li>
@ -60,7 +61,7 @@
var orderStatus = [[${@dict.getType('order_status')}]]; var orderStatus = [[${@dict.getType('order_status')}]];
var editFlag = [[${@permission.hasPermi('order:order:edit')}]]; var editFlag = [[${@permission.hasPermi('order:order:edit')}]];
var prefix = ctx + "order/master"; var prefix = ctx + "order/detail";
$(function () { $(function () {
var panehHidden = false; var panehHidden = false;
@ -95,20 +96,28 @@
title: '订单ID', title: '订单ID',
visible: false visible: false
}, },
// {
// field: 'code',
// title: '订单编号'
// },
{ {
field: 'code', field: 'goods',
title: '订单号' title: '订单信息',
}, formatter: function (value, row) {
{ return '<div style="display:flex">'
field: 'customerName', + '<img decoding="async" src="' + value.goodsImgUrl + '" width="120" height="120" />'
title: '消费者' + '<div>'
}, + '<h3>' + row.code + '<h3/>'
{ + '<h3>' + value.goodsName + '<h3/>'
field: 'orderType', + '<p>'
title: '订单类型', + '<small>' + value.goodsDesc + '</small><br>'
align: 'center', + '<small>创建时间:' + row.createTime + '</small><br>'
formatter: function(value, row, index) { + '<small>消费者:' + row.customerName + row.customerPhone + '</small><br>'
return $.table.selectDictLabel(orderTypes, value); + '<small>预约时间:' + row.expectTimeStart + ' - ' + row.expectTimeEnd + '</small><br>'
+ '<small>总金额:' + row.financialMasterMoney + '元 应得金额:' + row.financialDetailMoney + '元</small><br>'
+ '<p/>'
+ '</div>'
+ '</div>';
} }
}, },
{ {
@ -119,6 +128,14 @@
return $.table.selectDictLabel(orderStatus, value); return $.table.selectDictLabel(orderStatus, value);
} }
}, },
{
field: 'orderType',
title: '订单类型',
align: 'center',
formatter: function (value, row, index) {
return $.table.selectDictLabel(orderTypes, value);
}
},
{ {
field: 'payType', field: 'payType',
title: '付款类型', title: '付款类型',
@ -140,23 +157,21 @@
title: '付款时间' title: '付款时间'
}, },
{ {
field: 'workerName', field: 'worker',
title: '接单师傅' title: '接单信息',
align: 'center',
formatter: function (value, row, index) {
return '<small>' + value.name + value.phone + '</small><br>'
+ '<small>接单时间:' + row.revTime + '</small>'
}
}, },
{ {
field: 'revTime',
title: '接单时间'
},
{
field: 'createTime',
title: '创建时间',
sortable: true
}, {
title: '操作', title: '操作',
align: 'left', align: 'left',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>详情</a> '); 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(''); return actions.join('');
} }
}] }]

View File

@ -3,7 +3,9 @@ package com.ghy.customer.mapper;
import com.ghy.customer.domain.Customer; import com.ghy.customer.domain.Customer;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @author clunt * @author clunt
@ -56,9 +58,9 @@ public interface CustomerMapper {
/** /**
* 根据消费者id集合信息进行批量查询数据 * 根据消费者id集合信息进行批量查询数据
* *
* @param customerIdList 消费者id集合信息 * @param customerIds 消费者id集合信息
* @return Customer实体集合信息 * @return Customer实体集合信息
*/ */
List<Customer> getByCustomerIdList(@Param("customerIdList") List<Long> customerIdList); List<Customer> selectByIds(@Param("customerIds") Collection<Long> customerIds);
} }

View File

@ -4,6 +4,7 @@ import com.ghy.customer.domain.Customer;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* @author clunt * @author clunt
@ -67,4 +68,9 @@ public interface CustomerService {
*/ */
Map<Long, Customer> byCustomerUseridInMap(List<Long> customerUserIdList); Map<Long, Customer> byCustomerUseridInMap(List<Long> customerUserIdList);
/**
* @param customerIds 消费者ID
* @return Customer
*/
List<Customer> selectByIds(Set<Long> customerIds);
} }

View File

@ -7,11 +7,10 @@ import com.ghy.customer.domain.Customer;
import com.ghy.customer.mapper.CustomerMapper; import com.ghy.customer.mapper.CustomerMapper;
import com.ghy.customer.service.CustomerService; import com.ghy.customer.service.CustomerService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* @author clunt * @author clunt
@ -51,11 +50,9 @@ public class CustomerServiceImpl implements CustomerService {
@Override @Override
public int deleteByIds(String ids) { public int deleteByIds(String ids) {
Long[] customerIds = Convert.toLongArray(ids); Long[] customerIds = Convert.toLongArray(ids);
for (Long customerId : customerIds) for (Long customerId : customerIds) {
{
Customer customer = selectByCustomerId(customerId); Customer customer = selectByCustomerId(customerId);
if (countUserCustomer(customer) > 0) if (countUserCustomer(customer) > 0) {
{
throw new ServiceException(String.format("%1$s正在使用,不能删除", customer.getName())); throw new ServiceException(String.format("%1$s正在使用,不能删除", customer.getName()));
} }
} }
@ -65,8 +62,7 @@ public class CustomerServiceImpl implements CustomerService {
@Override @Override
public int deleteByCustomerId(Long customerId) { public int deleteByCustomerId(Long customerId) {
Customer customer = selectByCustomerId(customerId); Customer customer = selectByCustomerId(customerId);
if (countUserCustomer(customer) > 0) if (countUserCustomer(customer) > 0) {
{
throw new ServiceException(String.format("%1$s正在使用,不能删除", customer.getName())); throw new ServiceException(String.format("%1$s正在使用,不能删除", customer.getName()));
} }
return customerMapper.deleteByCustomerId(customerId); return customerMapper.deleteByCustomerId(customerId);
@ -86,7 +82,7 @@ public class CustomerServiceImpl implements CustomerService {
public Map<Long, Customer> byCustomerUseridInMap(List<Long> customerUserIdList) { public Map<Long, Customer> byCustomerUseridInMap(List<Long> customerUserIdList) {
Map<Long, Customer> longCustomerMap = new HashMap<>(); Map<Long, Customer> longCustomerMap = new HashMap<>();
if (customerUserIdList != null && customerUserIdList.size() > 0) { if (customerUserIdList != null && customerUserIdList.size() > 0) {
List<Customer> customerList = customerMapper.getByCustomerIdList(customerUserIdList); List<Customer> customerList = customerMapper.selectByIds(customerUserIdList);
if (customerList != null && customerList.size() > 0) { if (customerList != null && customerList.size() > 0) {
for (Customer customer : customerList) { for (Customer customer : customerList) {
longCustomerMap.put(customer.getCustomerId(), customer); longCustomerMap.put(customer.getCustomerId(), customer);
@ -100,4 +96,12 @@ public class CustomerServiceImpl implements CustomerService {
//TODO 需要校验用户是否在被使用 //TODO 需要校验用户是否在被使用
return 0; return 0;
} }
@Override
public List<Customer> selectByIds(Set<Long> customerIds) {
if (CollectionUtils.isEmpty(customerIds)) {
return new ArrayList<>();
}
return customerMapper.selectByIds(customerIds);
}
} }

View File

@ -136,11 +136,11 @@
where customer_id = #{customerId} where customer_id = #{customerId}
</update> </update>
<select id="getByCustomerIdList" resultMap="CustomerResult"> <select id="selectByIds" resultMap="CustomerResult">
<include refid="selectCustomer" /> <include refid="selectCustomer" />
<where> <where>
and customer_id in AND customer_id IN
<foreach item="item" index="customerIdList" collection="customerIdList" open="(" separator="," close=")"> <foreach item="item" index="customerIds" collection="customerIds" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</where> </where>

View File

@ -2,8 +2,11 @@ package com.ghy.order.domain;
import com.ghy.common.annotation.Excel; import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity; import com.ghy.common.core.domain.BaseEntity;
import com.ghy.goods.domain.Goods;
import com.ghy.worker.domain.Worker;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -34,6 +37,12 @@ public class OrderDetail extends BaseEntity {
@Excel(name = "消费者用户id", cellType = Excel.ColumnType.NUMERIC) @Excel(name = "消费者用户id", cellType = Excel.ColumnType.NUMERIC)
private Long customerId; private Long customerId;
@Excel(name = "消费者", cellType = Excel.ColumnType.STRING)
private String customerName;
@Excel(name = "消费者电话", cellType = Excel.ColumnType.STRING)
private String customerPhone;
@Excel(name = "订单类型", cellType = Excel.ColumnType.NUMERIC) @Excel(name = "订单类型", cellType = Excel.ColumnType.NUMERIC)
private Integer orderType; private Integer orderType;
@ -43,6 +52,8 @@ public class OrderDetail extends BaseEntity {
@Excel(name = "接单师傅id", cellType = Excel.ColumnType.NUMERIC) @Excel(name = "接单师傅id", cellType = Excel.ColumnType.NUMERIC)
private Long workerId; private Long workerId;
private Worker worker;
@Excel(name = "接单时间", cellType = Excel.ColumnType.STRING) @Excel(name = "接单时间", cellType = Excel.ColumnType.STRING)
private Date revTime; private Date revTime;
@ -62,6 +73,7 @@ public class OrderDetail extends BaseEntity {
private Long goodsCategoryId; private Long goodsCategoryId;
private Goods goods;
private String goodsName; private String goodsName;
private Long countryId; private Long countryId;
@ -90,4 +102,16 @@ public class OrderDetail extends BaseEntity {
* 发起提现时间 draw_cash_date * 发起提现时间 draw_cash_date
*/ */
private Date drawCashDate; private Date drawCashDate;
@Excel(name = "付款类型", cellType = Excel.ColumnType.NUMERIC)
private Integer payType;
@Excel(name = "付款状态", cellType = Excel.ColumnType.NUMERIC)
private Integer payStatus;
@Excel(name = "付款时间", cellType = Excel.ColumnType.STRING)
private Date payTime;
private BigDecimal financialMasterMoney;
private BigDecimal financialDetailMoney;
} }

View File

@ -3,6 +3,7 @@ package com.ghy.order.mapper;
import com.ghy.order.domain.OrderMaster; import com.ghy.order.domain.OrderMaster;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
@ -85,4 +86,5 @@ public interface OrderMasterMapper {
*/ */
List<OrderMaster> selectUnfinished(); List<OrderMaster> selectUnfinished();
List<OrderMaster> selectByIds(@Param("orderMasterId") Collection<Long> orderMasterIds);
} }

View File

@ -4,7 +4,9 @@ import com.ghy.order.domain.OrderMaster;
import com.ghy.order.request.AppOrderRequest; import com.ghy.order.request.AppOrderRequest;
import com.huifu.adapay.core.exception.BaseAdaPayException; import com.huifu.adapay.core.exception.BaseAdaPayException;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 主订单接口 * 主订单接口
@ -115,4 +117,6 @@ public interface OrderMasterService {
* @return 主订单 * @return 主订单
*/ */
List<OrderMaster> selectUnfinished(); List<OrderMaster> selectUnfinished();
List<OrderMaster> selectByIds(Collection<Long> masterIds);
} }

View File

@ -397,4 +397,12 @@ public class OrderMasterServiceImpl implements OrderMasterService {
public List<OrderMaster> selectUnfinished() { public List<OrderMaster> selectUnfinished() {
return orderMasterMapper.selectUnfinished(); return orderMasterMapper.selectUnfinished();
} }
@Override
public List<OrderMaster> selectByIds(Collection<Long> masterIds) {
if (CollectionUtils.isEmpty(masterIds)) {
return new ArrayList<>();
}
return orderMasterMapper.selectByIds(masterIds);
}
} }

View File

@ -46,7 +46,8 @@
create_by, create_by,
create_time, create_time,
remark, remark,
all_self_assigned all_self_assigned,
goods_id
FROM order_master FROM order_master
</sql> </sql>
<sql id="selectOrderMasterMoreInfo"> <sql id="selectOrderMasterMoreInfo">
@ -330,4 +331,15 @@
WHERE `order_status` &lt; 5 WHERE `order_status` &lt; 5
</select> </select>
<select id="selectByIds" resultMap="OrderMasterResult">
<include refid="selectOrderMaster"/>
<where>
AND id IN
<foreach item="item" index="orderMasterId" collection="orderMasterId" open="(" separator="," close=")">
#{item}
</foreach>
</where>
</select>
</mapper> </mapper>

View File

@ -4,7 +4,9 @@ import com.ghy.payment.domain.FinancialDetail;
import com.ghy.payment.response.FinancialCountResponse; import com.ghy.payment.response.FinancialCountResponse;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 财务细单(转派后产生的订单)的mapper层 * 财务细单(转派后产生的订单)的mapper层
@ -73,10 +75,10 @@ public interface FinancialDetailMapper {
/** /**
* 根据订单id集合信息进行批量数据查询 * 根据订单id集合信息进行批量数据查询
* *
* @param orderIdList 订单Id集合信息 * @param orderDetailIds 订单Id集合信息
* @return FinancialDetail实体集合信息 * @return FinancialDetail实体集合信息
*/ */
List<FinancialDetail> getByOrderIdList(@Param("orderIdList") List<Long> orderIdList); List<FinancialDetail> selectByOrderDetailIds(@Param("orderDetailIds") Collection<Long> orderDetailIds);
/** /**
* 撤销支付成功 * 撤销支付成功

View File

@ -4,6 +4,7 @@ import com.ghy.payment.domain.FinancialMaster;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 主财务单的mapper层 * 主财务单的mapper层
@ -74,4 +75,6 @@ public interface FinancialMasterMapper {
* @param paymentId 支付ID * @param paymentId 支付ID
*/ */
FinancialMaster selectByPaymentId(String paymentId); FinancialMaster selectByPaymentId(String paymentId);
List<FinancialMaster> selectByOrderMasterIds(@Param(value = "orderMasterIds") Set<Long> orderMasterIds);
} }

View File

@ -5,6 +5,7 @@ import com.ghy.payment.response.FinancialCountResponse;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* 财务细单接口 * 财务细单接口
@ -60,6 +61,8 @@ public interface FinancialDetailService {
*/ */
List<FinancialDetail> selectByFinancialMasterId(Long financialMasterId); List<FinancialDetail> selectByFinancialMasterId(Long financialMasterId);
List<FinancialDetail> selectByOrderDetailIds(Set<Long> orderDetailIds);
/** /**
* @param ids 财务细单ids * @param ids 财务细单ids
* @return 删除结果 * @return 删除结果

View File

@ -4,6 +4,7 @@ import com.ghy.common.adapay.model.PaymentDTO;
import com.ghy.payment.domain.FinancialMaster; import com.ghy.payment.domain.FinancialMaster;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 主财务单接口 * 主财务单接口
@ -68,6 +69,8 @@ public interface FinancialMasterService {
*/ */
FinancialMaster selectByOrderMasterId(Long orderMasterId); FinancialMaster selectByOrderMasterId(Long orderMasterId);
List<FinancialMaster> selectByOrderMasterIds(Set<Long> orderMasterIds);
/** /**
* 保存一条支付记录 * 保存一条支付记录
* *

View File

@ -14,9 +14,7 @@ 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.HashMap; import java.util.*;
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.*;
@ -154,7 +152,7 @@ public class FinancialDetailServiceImpl implements FinancialDetailService {
public Map<Long, FinancialDetail> byOrderIdInMap(List<Long> orderIdList) { public Map<Long, FinancialDetail> byOrderIdInMap(List<Long> orderIdList) {
Map<Long, FinancialDetail> longFinancialDetailHashMap = new HashMap<>(); Map<Long, FinancialDetail> longFinancialDetailHashMap = new HashMap<>();
if (orderIdList != null && orderIdList.size() > 0) { if (orderIdList != null && orderIdList.size() > 0) {
List<FinancialDetail> financialDetailList = financialDetailMapper.getByOrderIdList(orderIdList); List<FinancialDetail> financialDetailList = financialDetailMapper.selectByOrderDetailIds(orderIdList);
if (financialDetailList != null && financialDetailList.size() > 0) { if (financialDetailList != null && financialDetailList.size() > 0) {
for (FinancialDetail financialDetail : financialDetailList) { for (FinancialDetail financialDetail : financialDetailList) {
longFinancialDetailHashMap.put(financialDetail.getOrderDetailId(), financialDetail); longFinancialDetailHashMap.put(financialDetail.getOrderDetailId(), financialDetail);
@ -163,4 +161,12 @@ public class FinancialDetailServiceImpl implements FinancialDetailService {
} }
return longFinancialDetailHashMap; return longFinancialDetailHashMap;
} }
@Override
public List<FinancialDetail> selectByOrderDetailIds(Set<Long> orderDetailIds) {
if (CollectionUtils.isEmpty(orderDetailIds)) {
return new ArrayList<>();
}
return financialDetailMapper.selectByOrderDetailIds(orderDetailIds);
}
} }

View File

@ -20,8 +20,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.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import static java.time.temporal.ChronoField.*; import static java.time.temporal.ChronoField.*;
@ -153,4 +155,11 @@ public class FinancialMasterServiceImpl implements FinancialMasterService {
return financialMasterMapper.selectByPaymentId(paymentId); return financialMasterMapper.selectByPaymentId(paymentId);
} }
@Override
public List<FinancialMaster> selectByOrderMasterIds(Set<Long> orderMasterIds) {
if (CollectionUtils.isEmpty(orderMasterIds)) {
return new ArrayList<>();
}
return financialMasterMapper.selectByOrderMasterIds(orderMasterIds);
}
} }

View File

@ -218,11 +218,11 @@
WHERE `code` = #{financialDetailCode} LIMIT 1 WHERE `code` = #{financialDetailCode} LIMIT 1
</select> </select>
<select id="getByOrderIdList" resultMap="FinancialDetailResult"> <select id="selectByOrderDetailIds" resultMap="FinancialDetailResult">
<include refid="selectFinancialDetail" /> <include refid="selectFinancialDetail" />
<where> <where>
and order_detail_id in and order_detail_id in
<foreach item="item" index="orderIdList" collection="orderIdList" open="(" separator="," close=")"> <foreach item="item" index="orderDetailIds" collection="orderDetailIds" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</where> </where>

View File

@ -73,6 +73,13 @@
<include refid="selectFinancialMaster"/> WHERE payment_id = #{paymentId} <include refid="selectFinancialMaster"/> WHERE payment_id = #{paymentId}
</select> </select>
<select id="selectByOrderMasterIds" resultMap="FinancialMasterResult">
<include refid="selectFinancialMaster"/> WHERE order_master_id IN
<foreach collection="orderMasterIds" item="orderMasterId" open="(" separator="," close=")">
#{orderMasterId}
</foreach>
</select>
<delete id="deleteFinancialMasterByIds" parameterType="Long"> <delete id="deleteFinancialMasterByIds" parameterType="Long">
DELETE FROM financial_master WHERE id IN DELETE FROM financial_master WHERE id IN
<foreach collection="array" item="financialMasterId" open="(" separator="," close=")"> <foreach collection="array" item="financialMasterId" open="(" separator="," close=")">

View File

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

View File

@ -2,8 +2,10 @@ package com.ghy.worker.service;
import com.ghy.worker.domain.Worker; import com.ghy.worker.domain.Worker;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
public interface WorkerService { public interface WorkerService {
@ -53,4 +55,6 @@ public interface WorkerService {
* @return 键值队列数据 key-> 师傅Id value-> 师傅实体信息 * @return 键值队列数据 key-> 师傅Id value-> 师傅实体信息
*/ */
Map<Long, Worker> byWorkUserIdInMap(List<Long> workUserIdList); Map<Long, Worker> byWorkUserIdInMap(List<Long> workUserIdList);
List<Worker> selectByIds(Set<Long> workerIds);
} }

View File

@ -10,9 +10,7 @@ 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.*;
import java.util.List;
import java.util.Map;
@Service @Service
public class WorkerServiceImpl implements WorkerService { public class WorkerServiceImpl implements WorkerService {
@ -65,7 +63,7 @@ public class WorkerServiceImpl implements WorkerService {
public Map<Long, Worker> byWorkUserIdInMap(List<Long> workUserIdList) { public Map<Long, Worker> byWorkUserIdInMap(List<Long> workUserIdList) {
Map<Long, Worker> longWorkerMap = new HashMap<>(); Map<Long, Worker> longWorkerMap = new HashMap<>();
if(workUserIdList != null && workUserIdList.size() > 0){ if(workUserIdList != null && workUserIdList.size() > 0){
List<Worker> workerList = workerMapper.getByWorkIdList(workUserIdList); List<Worker> workerList = workerMapper.selectByIds(workUserIdList);
if(workerList != null && workerList.size() > 0){ if(workerList != null && workerList.size() > 0){
for(Worker worker : workerList){ for(Worker worker : workerList){
longWorkerMap.put(worker.getWorkerId(), worker); longWorkerMap.put(worker.getWorkerId(), worker);
@ -74,4 +72,12 @@ public class WorkerServiceImpl implements WorkerService {
} }
return longWorkerMap; return longWorkerMap;
} }
@Override
public List<Worker> selectByIds(Set<Long> workerIds) {
if (CollectionUtils.isEmpty(workerIds)){
return new ArrayList<>();
}
return workerMapper.selectByIds(workerIds);
}
} }

View File

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