diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java index 50c63347..458fa847 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java @@ -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 orderDetailList = orderDetailService.selectOrderDetailList(orderDetail); - return getDataTable(orderDetailList); + List orderDetails = orderDetailService.selectOrderDetailList(orderDetail); + + Set customerIds = orderDetails.stream().map(OrderDetail::getCustomerId).collect(Collectors.toSet()); + Map customerMap = customerService.selectByIds(customerIds) + .stream().collect(Collectors.toMap(Customer::getCustomerId, x -> x, (x, y) -> y)); + + Set orderMasterIds = orderDetails.stream().map(OrderDetail::getOrderMasterId).collect(Collectors.toSet()); + List orderMasters = orderMasterService.selectByIds(orderMasterIds); + Map orderMasterMap = orderMasters.stream().collect(Collectors.toMap(OrderMaster::getId, x -> x, (x, y) -> y)); + + List financialMasters = financialMasterService.selectByOrderMasterIds(orderMasterIds); + Map financialMasterMap = financialMasters + .stream().collect(Collectors.toMap(FinancialMaster::getOrderMasterId, x -> x, (x, y) -> y)); + + Set orderDetailIds = orderDetails.stream().map(OrderDetail::getId).collect(Collectors.toSet()); + Map financialDetailMap = financialDetailService.selectByOrderDetailIds(orderDetailIds) + .stream().collect(Collectors.toMap(FinancialDetail::getOrderDetailId, x -> x, (x, y) -> y)); + + Set goodsIds = orderMasters.stream().map(OrderMaster::getGoodsId).collect(Collectors.toSet()); + Map goodsMap = goodsService.selectByIds(goodsIds) + .stream().collect(Collectors.toMap(Goods::getGoodsId, x -> x, (x, y) -> y)); + + Set workerIds = orderDetails.stream().map(OrderDetail::getWorkerId).collect(Collectors.toSet()); + Map 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 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 afterServiceRecordList =afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecord); + List 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 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 afterServiceRecordList = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecord); - Map> detailRecordMap = afterServiceRecordList.stream().collect(Collectors.groupingBy(record->record.getOrderDetailId())); + Map> detailRecordMap = afterServiceRecordList.stream().collect(Collectors.groupingBy(record -> record.getOrderDetailId())); // 踢重后的子单ids - List detailIds = afterServiceRecordList.stream().map(AfterServiceRecord::getOrderDetailId).distinct().collect(Collectors.toList()); + List 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 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 finishImgObjList = new ArrayList(); - 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 orderGoodsList = orderGoodsService.selectByOrderMasterId(orderMasterId); + List orderGoodsList = orderGoodsService.selectByOrderMasterId(orderMasterId); // 找出原单关联的细单的商品数量 List 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 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()); } } diff --git a/ghy-admin/src/main/resources/templates/order/master.html b/ghy-admin/src/main/resources/templates/order/master.html index 7a2853ab..713471b0 100644 --- a/ghy-admin/src/main/resources/templates/order/master.html +++ b/ghy-admin/src/main/resources/templates/order/master.html @@ -22,7 +22,8 @@
  • 订单状态:
  • @@ -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 '
    ' + + '' + + '
    ' + + '

    ' + row.code + '

    ' + + '

    ' + value.goodsName + '

    ' + + '

    ' + + '' + value.goodsDesc + '
    ' + + '创建时间:' + row.createTime + '
    ' + + '消费者:' + row.customerName + row.customerPhone + '
    ' + + '预约时间:' + row.expectTimeStart + ' - ' + row.expectTimeEnd + '
    ' + + '总金额:' + row.financialMasterMoney + '元 应得金额:' + row.financialDetailMoney + '元
    ' + + '

    ' + + '

    ' + + '
    '; } }, { 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 '' + value.name + value.phone + '
    ' + + '接单时间:' + row.revTime + '' + } }, { - field: 'revTime', - title: '接单时间' - }, - { - field: 'createTime', - title: '创建时间', - sortable: true - }, { title: '操作', align: 'left', formatter: function (value, row, index) { var actions = []; - actions.push('详情 '); + actions.push('详情 '); return actions.join(''); } }] diff --git a/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerMapper.java b/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerMapper.java index 80d12dfe..8729fcc8 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerMapper.java +++ b/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerMapper.java @@ -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 getByCustomerIdList(@Param("customerIdList") List customerIdList); + List selectByIds(@Param("customerIds") Collection customerIds); } diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/CustomerService.java b/ghy-custom/src/main/java/com/ghy/customer/service/CustomerService.java index 314d34be..774b73b7 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/CustomerService.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/CustomerService.java @@ -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 byCustomerUseridInMap(List customerUserIdList); + /** + * @param customerIds 消费者ID + * @return Customer + */ + List selectByIds(Set customerIds); } diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerServiceImpl.java b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerServiceImpl.java index d14a9538..b166e522 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerServiceImpl.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerServiceImpl.java @@ -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 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 byCustomerUseridInMap(List customerUserIdList) { Map longCustomerMap = new HashMap<>(); - if(customerUserIdList != null && customerUserIdList.size() > 0){ - List customerList = customerMapper.getByCustomerIdList(customerUserIdList); - if(customerList != null && customerList.size() > 0){ - for(Customer customer : customerList){ + if (customerUserIdList != null && customerUserIdList.size() > 0) { + List 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 selectByIds(Set customerIds) { + if (CollectionUtils.isEmpty(customerIds)) { + return new ArrayList<>(); + } + return customerMapper.selectByIds(customerIds); + } } diff --git a/ghy-custom/src/main/resources/mapper/customer/CustomerMapper.xml b/ghy-custom/src/main/resources/mapper/customer/CustomerMapper.xml index 5477cd43..3bf0e060 100644 --- a/ghy-custom/src/main/resources/mapper/customer/CustomerMapper.xml +++ b/ghy-custom/src/main/resources/mapper/customer/CustomerMapper.xml @@ -136,11 +136,11 @@ where customer_id = #{customerId} - - and customer_id in - + AND customer_id IN + #{item} diff --git a/ghy-order/src/main/java/com/ghy/order/domain/OrderDetail.java b/ghy-order/src/main/java/com/ghy/order/domain/OrderDetail.java index ff472854..11c700c2 100644 --- a/ghy-order/src/main/java/com/ghy/order/domain/OrderDetail.java +++ b/ghy-order/src/main/java/com/ghy/order/domain/OrderDetail.java @@ -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; } diff --git a/ghy-order/src/main/java/com/ghy/order/mapper/OrderMasterMapper.java b/ghy-order/src/main/java/com/ghy/order/mapper/OrderMasterMapper.java index 30c82ad0..3d114f42 100644 --- a/ghy-order/src/main/java/com/ghy/order/mapper/OrderMasterMapper.java +++ b/ghy-order/src/main/java/com/ghy/order/mapper/OrderMasterMapper.java @@ -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 selectUnfinished(); + List selectByIds(@Param("orderMasterId") Collection orderMasterIds); } diff --git a/ghy-order/src/main/java/com/ghy/order/service/OrderMasterService.java b/ghy-order/src/main/java/com/ghy/order/service/OrderMasterService.java index f29d4de5..dc5d7773 100644 --- a/ghy-order/src/main/java/com/ghy/order/service/OrderMasterService.java +++ b/ghy-order/src/main/java/com/ghy/order/service/OrderMasterService.java @@ -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 selectUnfinished(); + + List selectByIds(Collection masterIds); } diff --git a/ghy-order/src/main/java/com/ghy/order/service/impl/OrderMasterServiceImpl.java b/ghy-order/src/main/java/com/ghy/order/service/impl/OrderMasterServiceImpl.java index d677f410..b59c0545 100644 --- a/ghy-order/src/main/java/com/ghy/order/service/impl/OrderMasterServiceImpl.java +++ b/ghy-order/src/main/java/com/ghy/order/service/impl/OrderMasterServiceImpl.java @@ -397,4 +397,12 @@ public class OrderMasterServiceImpl implements OrderMasterService { public List selectUnfinished() { return orderMasterMapper.selectUnfinished(); } + + @Override + public List selectByIds(Collection masterIds) { + if (CollectionUtils.isEmpty(masterIds)) { + return new ArrayList<>(); + } + return orderMasterMapper.selectByIds(masterIds); + } } diff --git a/ghy-order/src/main/resources/mapper/order/OrderMasterMapper.xml b/ghy-order/src/main/resources/mapper/order/OrderMasterMapper.xml index 4b8d1e3f..5b2b005c 100644 --- a/ghy-order/src/main/resources/mapper/order/OrderMasterMapper.xml +++ b/ghy-order/src/main/resources/mapper/order/OrderMasterMapper.xml @@ -46,7 +46,8 @@ create_by, create_time, remark, - all_self_assigned + all_self_assigned, + goods_id FROM order_master @@ -330,4 +331,15 @@ WHERE `order_status` < 5 + + + diff --git a/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java b/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java index 40112ef8..e3706e92 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java +++ b/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialDetailMapper.java @@ -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 getByOrderIdList(@Param("orderIdList") List orderIdList); + List selectByOrderDetailIds(@Param("orderDetailIds") Collection orderDetailIds); /** * 撤销支付成功 diff --git a/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialMasterMapper.java b/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialMasterMapper.java index d406eea0..ffa2a79e 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialMasterMapper.java +++ b/ghy-payment/src/main/java/com/ghy/payment/mapper/FinancialMasterMapper.java @@ -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 selectByOrderMasterIds(@Param(value = "orderMasterIds") Set orderMasterIds); } diff --git a/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java b/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java index 0378de87..eb4163d4 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java +++ b/ghy-payment/src/main/java/com/ghy/payment/service/FinancialDetailService.java @@ -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 selectByFinancialMasterId(Long financialMasterId); + List selectByOrderDetailIds(Set orderDetailIds); + /** * @param ids 财务细单ids * @return 删除结果 diff --git a/ghy-payment/src/main/java/com/ghy/payment/service/FinancialMasterService.java b/ghy-payment/src/main/java/com/ghy/payment/service/FinancialMasterService.java index 86119cbe..a3fc5e52 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/service/FinancialMasterService.java +++ b/ghy-payment/src/main/java/com/ghy/payment/service/FinancialMasterService.java @@ -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 selectByOrderMasterIds(Set orderMasterIds); + /** * 保存一条支付记录 * diff --git a/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java b/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java index e6d851bd..a6cc7012 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java +++ b/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialDetailServiceImpl.java @@ -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 byOrderIdInMap(List orderIdList) { Map longFinancialDetailHashMap = new HashMap<>(); if (orderIdList != null && orderIdList.size() > 0) { - List financialDetailList = financialDetailMapper.getByOrderIdList(orderIdList); + List 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 selectByOrderDetailIds(Set orderDetailIds) { + if (CollectionUtils.isEmpty(orderDetailIds)) { + return new ArrayList<>(); + } + return financialDetailMapper.selectByOrderDetailIds(orderDetailIds); + } } diff --git a/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialMasterServiceImpl.java b/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialMasterServiceImpl.java index f3b1e74d..45f3cbe2 100644 --- a/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialMasterServiceImpl.java +++ b/ghy-payment/src/main/java/com/ghy/payment/service/impl/FinancialMasterServiceImpl.java @@ -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 selectAppList(FinancialMaster request) { - List masterList =this.selectFinancialMasterList(request); - masterList.forEach(master->{ + List masterList = this.selectFinancialMasterList(request); + masterList.forEach(master -> { FinancialDetail param = new FinancialDetail(); param.setFinancialMasterId(master.getId()); param.setPayeeId(request.getUserId()); List 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 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 selectByOrderMasterIds(Set orderMasterIds) { + if (CollectionUtils.isEmpty(orderMasterIds)) { + return new ArrayList<>(); + } + return financialMasterMapper.selectByOrderMasterIds(orderMasterIds); + } } diff --git a/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml b/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml index cd3772f4..71245210 100644 --- a/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml +++ b/ghy-payment/src/main/resources/mapper/financial/FinancialDetailMapper.xml @@ -218,11 +218,11 @@ WHERE `code` = #{financialDetailCode} LIMIT 1 - and order_detail_id in - + #{item} diff --git a/ghy-payment/src/main/resources/mapper/financial/FinancialMasterMapper.xml b/ghy-payment/src/main/resources/mapper/financial/FinancialMasterMapper.xml index de26a245..939fe4ac 100644 --- a/ghy-payment/src/main/resources/mapper/financial/FinancialMasterMapper.xml +++ b/ghy-payment/src/main/resources/mapper/financial/FinancialMasterMapper.xml @@ -73,6 +73,13 @@ WHERE payment_id = #{paymentId} + + DELETE FROM financial_master WHERE id IN diff --git a/ghy-worker/src/main/java/com/ghy/worker/mapper/WorkerMapper.java b/ghy-worker/src/main/java/com/ghy/worker/mapper/WorkerMapper.java index 99c71e4f..647aaf23 100644 --- a/ghy-worker/src/main/java/com/ghy/worker/mapper/WorkerMapper.java +++ b/ghy-worker/src/main/java/com/ghy/worker/mapper/WorkerMapper.java @@ -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 getByWorkIdList(@Param("workIdList") List workIdList); + List selectByIds(@Param("workIds") Collection workIds); } diff --git a/ghy-worker/src/main/java/com/ghy/worker/service/WorkerService.java b/ghy-worker/src/main/java/com/ghy/worker/service/WorkerService.java index 6b76d862..8c8f21fa 100644 --- a/ghy-worker/src/main/java/com/ghy/worker/service/WorkerService.java +++ b/ghy-worker/src/main/java/com/ghy/worker/service/WorkerService.java @@ -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 byWorkUserIdInMap(List workUserIdList); + + List selectByIds(Set workerIds); } diff --git a/ghy-worker/src/main/java/com/ghy/worker/service/impl/WorkerServiceImpl.java b/ghy-worker/src/main/java/com/ghy/worker/service/impl/WorkerServiceImpl.java index 01a808ca..16c4ab2a 100644 --- a/ghy-worker/src/main/java/com/ghy/worker/service/impl/WorkerServiceImpl.java +++ b/ghy-worker/src/main/java/com/ghy/worker/service/impl/WorkerServiceImpl.java @@ -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 byWorkUserIdInMap(List workUserIdList) { Map longWorkerMap = new HashMap<>(); if(workUserIdList != null && workUserIdList.size() > 0){ - List workerList = workerMapper.getByWorkIdList(workUserIdList); + List 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 selectByIds(Set workerIds) { + if (CollectionUtils.isEmpty(workerIds)){ + return new ArrayList<>(); + } + return workerMapper.selectByIds(workerIds); + } } diff --git a/ghy-worker/src/main/resources/mapper/worker/WorkerMapper.xml b/ghy-worker/src/main/resources/mapper/worker/WorkerMapper.xml index 181c77b2..98666134 100644 --- a/ghy-worker/src/main/resources/mapper/worker/WorkerMapper.xml +++ b/ghy-worker/src/main/resources/mapper/worker/WorkerMapper.xml @@ -137,11 +137,11 @@ where worker_id = #{workerId} - and w.worker_id in - + #{item}