订单信息页

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.StringUtils;
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;
@ -119,8 +120,57 @@ public class OrderDetailController extends BaseController {
@ResponseBody
public TableDataInfo list(OrderDetail orderDetail) {
startPage();
List<OrderDetail> orderDetailList = orderDetailService.selectOrderDetailList(orderDetail);
return getDataTable(orderDetailList);
List<OrderDetail> orderDetails = orderDetailService.selectOrderDetailList(orderDetail);
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")
@ -203,7 +253,7 @@ public class OrderDetailController extends BaseController {
orderStandard.setWaitServerNum(orderStandard.getStandardNum() - orderStandard.getServerNum());
standardList.add(orderStandard);
}
if(this.checkIsOnlyServer(orderMaster.getId(), detail.getWorkerId())){
if (this.checkIsOnlyServer(orderMaster.getId(), detail.getWorkerId())) {
BigDecimal workerFee = financialMaster.getPayMoney();
List<FinancialDetail> financialDetailList = financialDetailService.selectByFinancialMasterId(financialMaster.getId());
for (FinancialDetail param : financialDetailList) {
@ -213,7 +263,7 @@ public class OrderDetailController extends BaseController {
}
orderListResponse.setPayMoney(workerFee);
orderListResponse.setIsOnlyServ(Boolean.TRUE);
}else {
} else {
orderListResponse.setPayMoney(detailPayMoney);
orderListResponse.setIsOnlyServ(Boolean.FALSE);
}
@ -221,7 +271,7 @@ public class OrderDetailController extends BaseController {
// 售后记录
AfterServiceRecord afterServiceRecord = new AfterServiceRecord();
afterServiceRecord.setOrderDetailId(detail.getId());
List<AfterServiceRecord> afterServiceRecordList =afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecord);
List<AfterServiceRecord> afterServiceRecordList = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecord);
// 超时记录
OrderTimeoutRecord timeoutRecordQry = new OrderTimeoutRecord();
@ -230,11 +280,18 @@ public class OrderDetailController extends BaseController {
SysDeptConfig sysDeptConfig = sysDeptConfigService.selectByDeptId(request.getDeptId());
orderTimeoutRecords.stream().forEach(timeoutRecord -> {
switch (timeoutRecord.getOrderStatus()) {
case 0: timeoutRecord.setPayMoney(sysDeptConfig.getPlainOutTime()); break;
case 1: timeoutRecord.setPayMoney(sysDeptConfig.getGoOutTime()); break;
case 0:
timeoutRecord.setPayMoney(sysDeptConfig.getPlainOutTime());
break;
case 1:
timeoutRecord.setPayMoney(sysDeptConfig.getGoOutTime());
break;
case 2:
case 3: timeoutRecord.setPayMoney(sysDeptConfig.getGoingOutTime()); break;
default: break;
case 3:
timeoutRecord.setPayMoney(sysDeptConfig.getGoingOutTime());
break;
default:
break;
}
});
@ -352,7 +409,7 @@ public class OrderDetailController extends BaseController {
OrderTimeoutRecord orderTimeoutRecord = orderFineRecordService.selectByDetailIdAndStatus(detail.getId(), detail.getOrderStatus());
Boolean isOverTime = orderTimeoutRecord == null ? false : true;
if(this.checkIsOnlyServer(orderMaster.getId(), detail.getWorkerId())){
if (this.checkIsOnlyServer(orderMaster.getId(), detail.getWorkerId())) {
BigDecimal workerFee = financialMaster.getPayMoney();
List<FinancialDetail> financialDetailList = financialDetailService.selectByFinancialMasterId(financialMaster.getId());
for (FinancialDetail param : financialDetailList) {
@ -362,7 +419,7 @@ public class OrderDetailController extends BaseController {
}
orderListResponse.setPayMoney(workerFee);
orderListResponse.setIsOnlyServ(Boolean.TRUE);
}else {
} else {
orderListResponse.setPayMoney(detailPayMoney);
orderListResponse.setIsOnlyServ(Boolean.FALSE);
}
@ -418,17 +475,17 @@ public class OrderDetailController extends BaseController {
AfterServiceRecord afterServiceRecord = new AfterServiceRecord();
afterServiceRecord.setExcludeAfterServiceFinished(Boolean.TRUE);
List<AfterServiceRecord> afterServiceRecordList = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecord);
Map<Long, List<AfterServiceRecord>> detailRecordMap = afterServiceRecordList.stream().collect(Collectors.groupingBy(record->record.getOrderDetailId()));
Map<Long, List<AfterServiceRecord>> detailRecordMap = afterServiceRecordList.stream().collect(Collectors.groupingBy(record -> record.getOrderDetailId()));
// 踢重后的子单ids
List<Long> detailIds = afterServiceRecordList.stream().map(AfterServiceRecord::getOrderDetailId).distinct().collect(Collectors.toList());
List<Long> detailIds = afterServiceRecordList.stream().map(AfterServiceRecord::getOrderDetailId).distinct().collect(Collectors.toList());
StringBuilder orderDetailIds = new StringBuilder();
detailIds.forEach(id->{
detailIds.forEach(id -> {
orderDetailIds.append(id).append(",");
});
String ids = orderDetailIds.toString();
if(StringUtils.isNotEmpty(ids)){
orderDetail.setOrderDetailIds(ids.substring(0, ids.length()-1));
}else {
if (StringUtils.isNotEmpty(ids)) {
orderDetail.setOrderDetailIds(ids.substring(0, ids.length() - 1));
} else {
orderDetail.setOrderDetailIds("0");
}
startPage();
@ -497,7 +554,7 @@ public class OrderDetailController extends BaseController {
OrderTimeoutRecord orderTimeoutRecord = orderFineRecordService.selectByDetailIdAndStatus(detail.getId(), detail.getOrderStatus());
Boolean isOverTime = orderTimeoutRecord == null ? false : true;
if(this.checkIsOnlyServer(orderMaster.getId(), detail.getWorkerId())){
if (this.checkIsOnlyServer(orderMaster.getId(), detail.getWorkerId())) {
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(detail.getOrderMasterId());
BigDecimal workerFee = financialMaster.getPayMoney();
List<FinancialDetail> financialDetailList = financialDetailService.selectByFinancialMasterId(financialMaster.getId());
@ -508,7 +565,7 @@ public class OrderDetailController extends BaseController {
}
orderListResponse.setPayMoney(workerFee);
orderListResponse.setIsOnlyServ(Boolean.TRUE);
}else {
} else {
orderListResponse.setPayMoney(detailPayMoney);
orderListResponse.setIsOnlyServ(Boolean.FALSE);
}
@ -672,17 +729,17 @@ public class OrderDetailController extends BaseController {
// 判断工单状态是否为服务中以及是否已支付
OrderDetail orderDetail = orderDetailService.selectById(request.getOrderDetailId());
OrderMaster orderMaster = orderMasterService.selectById(orderDetail.getOrderMasterId());
if(orderDetail.getOrderStatus().equals(OrderStatus.FINISH_CHECK.code())){
if (orderDetail.getOrderStatus().equals(OrderStatus.FINISH_CHECK.code())) {
return AjaxResult.success("发起成功");
}
if (orderDetail.getOrderStatus() != OrderStatus.SERVER.code()
|| !orderMaster.getPayStatus().equals(PayStatus.PAID.getCode())) {
|| !orderMaster.getPayStatus().equals(PayStatus.PAID.getCode())) {
return AjaxResult.error("未支付订单或非服务中订单,发起完单失败");
}
// 存储完单图
List<GoodsImgs> finishImgObjList = new ArrayList<GoodsImgs>();
for (String imgUrl: request.getFinishImgList()) {
for (String imgUrl : request.getFinishImgList()) {
GoodsImgs finishImgObj = new GoodsImgs();
finishImgObj.setGoodsId(0L);
finishImgObj.setImgType(ImgType.FINISH_IMG.getId());
@ -745,11 +802,11 @@ public class OrderDetailController extends BaseController {
@PostMapping("/app/change/price")
@ResponseBody
public AjaxResult changePrice(@Valid @RequestBody OrderChangePriceRequest request){
public AjaxResult changePrice(@Valid @RequestBody OrderChangePriceRequest request) {
try {
Assert.notNull(request.getChangeMoney(), "报价不能为空");
return toAjax(orderDetailService.changePrice(request.getOrderDetailId(), request.getChangeMoney(), request.getType(), request.getRemark()));
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
logger.error(ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error("改价失败!");
@ -758,32 +815,32 @@ public class OrderDetailController extends BaseController {
@PostMapping("/app/getChangePrice")
@ResponseBody
public AjaxResult getChangePrice(@Valid @RequestBody OrderChangePriceRequest request){
public AjaxResult getChangePrice(@Valid @RequestBody OrderChangePriceRequest request) {
try {
return AjaxResult.success(orderDetailService.getChangedPriceRecord(request.getOrderDetailId()));
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
logger.error(ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error("查询改价失败!");
}
}
private boolean checkIsOnlyServer(Long orderMasterId, Long workId){
private boolean checkIsOnlyServer(Long orderMasterId, Long workId) {
// 找出原单的数量
List<OrderGoods> orderGoodsList = orderGoodsService.selectByOrderMasterId(orderMasterId);
List<OrderGoods> orderGoodsList = orderGoodsService.selectByOrderMasterId(orderMasterId);
// 找出原单关联的细单的商品数量
List<OrderDetail> orderDetailList = orderDetailService.selectByOrderMasterId(orderMasterId);
for (OrderDetail detail : orderDetailList){
for (OrderDetail detail : orderDetailList) {
// 非一个师傅接单
if(!workId.equals(detail.getWorkerId())){
if (!workId.equals(detail.getWorkerId())) {
return false;
}
// 子单数量
List<OrderGoods> orderDetailGoodsList = orderGoodsService.selectByOrderDetailId(detail.getId());
// 计算剩余未分配的商品数量
for (OrderGoods detailGoods : orderDetailGoodsList) {
for(OrderGoods masterGoods : orderGoodsList){
if(Objects.equals(masterGoods.getGoodsStandardId(), detailGoods.getGoodsStandardId())){
for (OrderGoods masterGoods : orderGoodsList) {
if (Objects.equals(masterGoods.getGoodsStandardId(), detailGoods.getGoodsStandardId())) {
masterGoods.setGoodsNum(masterGoods.getGoodsNum() - detailGoods.getGoodsNum());
}
}

View File

@ -22,7 +22,8 @@
<li>
订单状态:<select name="status" th:with="type=${@dict.getType('order_status')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
@ -60,7 +61,7 @@
var orderStatus = [[${@dict.getType('order_status')}]];
var editFlag = [[${@permission.hasPermi('order:order:edit')}]];
var prefix = ctx + "order/master";
var prefix = ctx + "order/detail";
$(function () {
var panehHidden = false;
@ -95,35 +96,51 @@
title: '订单ID',
visible: false
},
// {
// field: 'code',
// title: '订单编号'
// },
{
field: 'code',
title: '订单号'
},
{
field: 'customerName',
title: '消费者'
},
{
field: 'orderType',
title: '订单类型',
align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(orderTypes, value);
field: 'goods',
title: '订单信息',
formatter: function (value, row) {
return '<div style="display:flex">'
+ '<img decoding="async" src="' + value.goodsImgUrl + '" width="120" height="120" />'
+ '<div>'
+ '<h3>' + row.code + '<h3/>'
+ '<h3>' + value.goodsName + '<h3/>'
+ '<p>'
+ '<small>' + value.goodsDesc + '</small><br>'
+ '<small>创建时间:' + row.createTime + '</small><br>'
+ '<small>消费者:' + row.customerName + row.customerPhone + '</small><br>'
+ '<small>预约时间:' + row.expectTimeStart + ' - ' + row.expectTimeEnd + '</small><br>'
+ '<small>总金额:' + row.financialMasterMoney + '元 应得金额:' + row.financialDetailMoney + '元</small><br>'
+ '<p/>'
+ '</div>'
+ '</div>';
}
},
{
field: 'orderStatus',
title: '订单状态',
align: 'center',
formatter: function(value, row, index) {
formatter: function (value, row, index) {
return $.table.selectDictLabel(orderStatus, value);
}
},
{
field: 'orderType',
title: '订单类型',
align: 'center',
formatter: function (value, row, index) {
return $.table.selectDictLabel(orderTypes, value);
}
},
{
field: 'payType',
title: '付款类型',
align: 'center',
formatter: function(value, row, index) {
formatter: function (value, row, index) {
return $.table.selectDictLabel(payTypes, value);
}
},
@ -131,7 +148,7 @@
field: 'payStatus',
title: '付款状态',
align: 'center',
formatter: function(value, row, index) {
formatter: function (value, row, index) {
return $.table.selectDictLabel(payStatus, value);
}
},
@ -140,23 +157,21 @@
title: '付款时间'
},
{
field: 'workerName',
title: '接单师傅'
field: 'worker',
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: '操作',
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-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('');
}
}]

View File

@ -3,7 +3,9 @@ package com.ghy.customer.mapper;
import com.ghy.customer.domain.Customer;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* @author clunt
@ -56,9 +58,9 @@ public interface CustomerMapper {
/**
* 根据消费者id集合信息进行批量查询数据
*
* @param customerIdList 消费者id集合信息
* @param customerIds 消费者id集合信息
* @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.Map;
import java.util.Set;
/**
* @author clunt
@ -67,4 +68,9 @@ public interface CustomerService {
*/
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.service.CustomerService;
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;
import java.util.*;
/**
* @author clunt
@ -41,21 +40,19 @@ public class CustomerServiceImpl implements CustomerService {
@Override
public Customer selectByOpenId(Customer customer) {
List<Customer> list = customerMapper.getCustomerList(customer);
if(StringUtils.isNotEmpty(list)){
if (StringUtils.isNotEmpty(list)) {
return list.get(0);
}else {
} else {
return null;
}
}
@Override
public int deleteByIds(String ids) {
Long [] customerIds = Convert.toLongArray(ids);
for (Long customerId : customerIds)
{
Long[] customerIds = Convert.toLongArray(ids);
for (Long customerId : customerIds) {
Customer customer = selectByCustomerId(customerId);
if (countUserCustomer(customer) > 0)
{
if (countUserCustomer(customer) > 0) {
throw new ServiceException(String.format("%1$s正在使用,不能删除", customer.getName()));
}
}
@ -65,8 +62,7 @@ public class CustomerServiceImpl implements CustomerService {
@Override
public int deleteByCustomerId(Long customerId) {
Customer customer = selectByCustomerId(customerId);
if (countUserCustomer(customer) > 0)
{
if (countUserCustomer(customer) > 0) {
throw new ServiceException(String.format("%1$s正在使用,不能删除", customer.getName()));
}
return customerMapper.deleteByCustomerId(customerId);
@ -85,10 +81,10 @@ public class CustomerServiceImpl implements CustomerService {
@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){
if (customerUserIdList != null && customerUserIdList.size() > 0) {
List<Customer> customerList = customerMapper.selectByIds(customerUserIdList);
if (customerList != null && customerList.size() > 0) {
for (Customer customer : customerList) {
longCustomerMap.put(customer.getCustomerId(), customer);
}
}
@ -100,4 +96,12 @@ public class CustomerServiceImpl implements CustomerService {
//TODO 需要校验用户是否在被使用
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}
</update>
<select id="getByCustomerIdList" resultMap="CustomerResult">
<select id="selectByIds" resultMap="CustomerResult">
<include refid="selectCustomer" />
<where>
and customer_id in
<foreach item="item" index="customerIdList" collection="customerIdList" open="(" separator="," close=")">
AND customer_id IN
<foreach item="item" index="customerIds" collection="customerIds" open="(" separator="," close=")">
#{item}
</foreach>
</where>

View File

@ -2,8 +2,11 @@ package com.ghy.order.domain;
import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
import com.ghy.goods.domain.Goods;
import com.ghy.worker.domain.Worker;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -34,6 +37,12 @@ public class OrderDetail extends BaseEntity {
@Excel(name = "消费者用户id", cellType = Excel.ColumnType.NUMERIC)
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)
private Integer orderType;
@ -43,6 +52,8 @@ public class OrderDetail extends BaseEntity {
@Excel(name = "接单师傅id", cellType = Excel.ColumnType.NUMERIC)
private Long workerId;
private Worker worker;
@Excel(name = "接单时间", cellType = Excel.ColumnType.STRING)
private Date revTime;
@ -62,6 +73,7 @@ public class OrderDetail extends BaseEntity {
private Long goodsCategoryId;
private Goods goods;
private String goodsName;
private Long countryId;
@ -90,4 +102,16 @@ public class OrderDetail extends BaseEntity {
* 发起提现时间 draw_cash_date
*/
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 org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
@ -85,4 +86,5 @@ public interface OrderMasterMapper {
*/
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.huifu.adapay.core.exception.BaseAdaPayException;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* 主订单接口
@ -115,4 +117,6 @@ public interface OrderMasterService {
* @return 主订单
*/
List<OrderMaster> selectUnfinished();
List<OrderMaster> selectByIds(Collection<Long> masterIds);
}

View File

@ -397,4 +397,12 @@ public class OrderMasterServiceImpl implements OrderMasterService {
public List<OrderMaster> 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_time,
remark,
all_self_assigned
all_self_assigned,
goods_id
FROM order_master
</sql>
<sql id="selectOrderMasterMoreInfo">
@ -330,4 +331,15 @@
WHERE `order_status` &lt; 5
</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>

View File

@ -4,7 +4,9 @@ import com.ghy.payment.domain.FinancialDetail;
import com.ghy.payment.response.FinancialCountResponse;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* 财务细单(转派后产生的订单)的mapper层
@ -73,10 +75,10 @@ public interface FinancialDetailMapper {
/**
* 根据订单id集合信息进行批量数据查询
*
* @param orderIdList 订单Id集合信息
* @param orderDetailIds 订单Id集合信息
* @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 java.util.List;
import java.util.Set;
/**
* 主财务单的mapper层
@ -47,10 +48,10 @@ public interface FinancialMasterMapper {
/**
* 支付成功
*
* @param id ID
* @param payType 支付渠道
* @param id ID
* @param payType 支付渠道
*/
void paySucceeded(@Param(value = "paymentId")String paymentId, @Param(value = "id") Long id, @Param(value = "payType") int payType);
void paySucceeded(@Param(value = "paymentId") String paymentId, @Param(value = "id") Long id, @Param(value = "payType") int payType);
/**
* 支付成功
@ -74,4 +75,6 @@ public interface FinancialMasterMapper {
* @param paymentId 支付ID
*/
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.Map;
import java.util.Set;
/**
* 财务细单接口
@ -60,6 +61,8 @@ public interface FinancialDetailService {
*/
List<FinancialDetail> selectByFinancialMasterId(Long financialMasterId);
List<FinancialDetail> selectByOrderDetailIds(Set<Long> orderDetailIds);
/**
* @param ids 财务细单ids
* @return 删除结果

View File

@ -4,6 +4,7 @@ import com.ghy.common.adapay.model.PaymentDTO;
import com.ghy.payment.domain.FinancialMaster;
import java.util.List;
import java.util.Set;
/**
* 主财务单接口
@ -68,6 +69,8 @@ public interface FinancialMasterService {
*/
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.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
import static java.time.temporal.ChronoField.*;
@ -154,7 +152,7 @@ public class FinancialDetailServiceImpl implements FinancialDetailService {
public Map<Long, FinancialDetail> byOrderIdInMap(List<Long> orderIdList) {
Map<Long, FinancialDetail> longFinancialDetailHashMap = new HashMap<>();
if (orderIdList != null && orderIdList.size() > 0) {
List<FinancialDetail> financialDetailList = financialDetailMapper.getByOrderIdList(orderIdList);
List<FinancialDetail> financialDetailList = financialDetailMapper.selectByOrderDetailIds(orderIdList);
if (financialDetailList != null && financialDetailList.size() > 0) {
for (FinancialDetail financialDetail : financialDetailList) {
longFinancialDetailHashMap.put(financialDetail.getOrderDetailId(), financialDetail);
@ -163,4 +161,12 @@ public class FinancialDetailServiceImpl implements FinancialDetailService {
}
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.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import static java.time.temporal.ChronoField.*;
@ -67,13 +69,13 @@ public class FinancialMasterServiceImpl implements FinancialMasterService {
@Override
public List<FinancialMaster> selectAppList(FinancialMaster request) {
List<FinancialMaster> masterList =this.selectFinancialMasterList(request);
masterList.forEach(master->{
List<FinancialMaster> masterList = this.selectFinancialMasterList(request);
masterList.forEach(master -> {
FinancialDetail param = new FinancialDetail();
param.setFinancialMasterId(master.getId());
param.setPayeeId(request.getUserId());
List<FinancialDetail> details = financialDetailService.selectFinancialDetailList(param);
details.forEach(detail->{
details.forEach(detail -> {
});
});
@ -105,9 +107,9 @@ public class FinancialMasterServiceImpl implements FinancialMasterService {
FinancialMaster param = new FinancialMaster();
param.setOrderMasterCode(orderMasterCode);
List<FinancialMaster> result = financialMasterMapper.selectFinancialMasterList(param);
if(!CollectionUtils.isEmpty(result)){
if (!CollectionUtils.isEmpty(result)) {
financialMasterMapper.updateOrderStatus(result.get(0).getOrderMasterCode(), PayStatus.PAID.getCode());
if(StringUtils.isEmpty(result.get(0).getPaymentId())){
if (StringUtils.isEmpty(result.get(0).getPaymentId())) {
financialMasterMapper.paySucceeded(paymentId, result.get(0).getId(), payType);
}
FinancialDetail request = new FinancialDetail();
@ -116,7 +118,7 @@ public class FinancialMasterServiceImpl implements FinancialMasterService {
request.setPayType(payType);
request.setPayTime(new Date());
financialDetailService.updateByFinancialMasterId(request);
}else {
} else {
logger.error("原单不存在!");
}
}
@ -153,4 +155,11 @@ public class FinancialMasterServiceImpl implements FinancialMasterService {
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
</select>
<select id="getByOrderIdList" resultMap="FinancialDetailResult">
<select id="selectByOrderDetailIds" resultMap="FinancialDetailResult">
<include refid="selectFinancialDetail" />
<where>
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}
</foreach>
</where>

View File

@ -73,6 +73,13 @@
<include refid="selectFinancialMaster"/> WHERE payment_id = #{paymentId}
</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 FROM financial_master WHERE id IN
<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 org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface WorkerMapper {
@ -35,8 +36,8 @@ public interface WorkerMapper {
/**
* 根据师傅id集合信息进行批量数据查询
*
* @param workIdList 师傅Id集合信息
* @param workIds 师傅Id集合信息
* @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 java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface WorkerService {
@ -53,4 +55,6 @@ public interface WorkerService {
* @return 键值队列数据 key-> 师傅Id value-> 师傅实体信息
*/
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 javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service
public class WorkerServiceImpl implements WorkerService {
@ -65,7 +63,7 @@ public class WorkerServiceImpl implements WorkerService {
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);
List<Worker> workerList = workerMapper.selectByIds(workUserIdList);
if(workerList != null && workerList.size() > 0){
for(Worker worker : workerList){
longWorkerMap.put(worker.getWorkerId(), worker);
@ -74,4 +72,12 @@ public class WorkerServiceImpl implements WorkerService {
}
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}
</update>
<select id="getByWorkIdList" resultMap="WorkerResult">
<select id="selectByIds" resultMap="WorkerResult">
<include refid="selectWorker" />
<where>
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}
</foreach>
</where>