订单行为记录

This commit is contained in:
HH 2023-03-03 18:36:32 +08:00
parent 7b0c54024e
commit ccda079938
9 changed files with 391 additions and 127 deletions

View File

@ -3,6 +3,7 @@ package com.ghy.web.controller.order;
import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.enums.FinancialDetailType; import com.ghy.common.enums.FinancialDetailType;
import com.ghy.common.enums.OrderBehaviorEnum;
import com.ghy.common.enums.OrderStatus; import com.ghy.common.enums.OrderStatus;
import com.ghy.common.enums.PayStatus; import com.ghy.common.enums.PayStatus;
import com.ghy.common.utils.StringUtils; import com.ghy.common.utils.StringUtils;
@ -17,17 +18,11 @@ import com.ghy.goods.request.AppGoodsRequest;
import com.ghy.goods.service.DeptGoodsCategoryService; import com.ghy.goods.service.DeptGoodsCategoryService;
import com.ghy.goods.service.GoodsService; import com.ghy.goods.service.GoodsService;
import com.ghy.goods.service.GoodsStandardService; import com.ghy.goods.service.GoodsStandardService;
import com.ghy.order.domain.AfterServiceRecord; import com.ghy.order.domain.*;
import com.ghy.order.domain.OrderDetail;
import com.ghy.order.domain.OrderGoods;
import com.ghy.order.domain.OrderMaster;
import com.ghy.order.request.AppOrderAssignRequest; import com.ghy.order.request.AppOrderAssignRequest;
import com.ghy.order.request.AppOrderRequest; import com.ghy.order.request.AppOrderRequest;
import com.ghy.order.request.SysOrderAssignRequest; import com.ghy.order.request.SysOrderAssignRequest;
import com.ghy.order.service.IAfterServiceRecordService; import com.ghy.order.service.*;
import com.ghy.order.service.OrderDetailService;
import com.ghy.order.service.OrderGoodsService;
import com.ghy.order.service.OrderMasterService;
import com.ghy.payment.domain.FinancialChangeRecord; import com.ghy.payment.domain.FinancialChangeRecord;
import com.ghy.payment.domain.FinancialDetail; import com.ghy.payment.domain.FinancialDetail;
import com.ghy.payment.domain.FinancialMaster; import com.ghy.payment.domain.FinancialMaster;
@ -44,11 +39,9 @@ import com.ghy.worker.domain.WorkerCertification;
import com.ghy.worker.service.IWorkerCertificationService; import com.ghy.worker.service.IWorkerCertificationService;
import com.ghy.worker.service.WorkerService; import com.ghy.worker.service.WorkerService;
import com.huifu.adapay.core.exception.BaseAdaPayException; import com.huifu.adapay.core.exception.BaseAdaPayException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -57,13 +50,13 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.temporal.TemporalAdjusters;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -75,73 +68,60 @@ import java.util.stream.Collectors;
@RequestMapping("/order") @RequestMapping("/order")
public class OrderController extends BaseController { public class OrderController extends BaseController {
@Autowired @Resource
private CustomerService customerService; private CustomerService customerService;
@Resource
@Autowired
private GoodsService goodsService; private GoodsService goodsService;
@Resource
@Autowired
private DeptGoodsCategoryService deptGoodsCategoryService; private DeptGoodsCategoryService deptGoodsCategoryService;
@Resource
@Autowired
private WorkerService workerService; private WorkerService workerService;
@Resource
@Autowired
private OrderMasterService orderMasterService; private OrderMasterService orderMasterService;
@Resource
@Autowired
private OrderDetailService orderDetailService; private OrderDetailService orderDetailService;
@Resource
@Autowired
private OrderGoodsService orderGoodsService; private OrderGoodsService orderGoodsService;
@Resource
@Autowired
private FinancialMasterService financialMasterService; private FinancialMasterService financialMasterService;
@Resource
@Autowired
private FinancialDetailService financialDetailService; private FinancialDetailService financialDetailService;
@Resource
@Autowired
private GoodsStandardService goodsStandardService; private GoodsStandardService goodsStandardService;
@Resource
@Autowired
private CustomerAddressService addressService; private CustomerAddressService addressService;
@Resource
@Autowired
private ISysAreaService sysAreaService; private ISysAreaService sysAreaService;
@Resource
@Autowired
private OrderFineRecordService orderFineRecordService; private OrderFineRecordService orderFineRecordService;
@Resource
@Autowired
private FinancialChangeRecordService financialChangeRecordService; private FinancialChangeRecordService financialChangeRecordService;
@Resource
@Autowired
private IWorkerCertificationService workerCertificationService; private IWorkerCertificationService workerCertificationService;
@Resource
@Autowired
private IAfterServiceRecordService afterServiceRecordService; private IAfterServiceRecordService afterServiceRecordService;
@Resource
private OrderBehaviorService orderBehaviorService;
/** /**
* 可派单商品数量 * 可派单商品数量
* */ */
@PostMapping("/can/assign") @PostMapping("/can/assign")
@ResponseBody @ResponseBody
public AjaxResult canAssign(@RequestBody AppOrderAssignRequest request){ public AjaxResult canAssign(@RequestBody AppOrderAssignRequest request) {
try { try {
// 找出原单的数量 // 找出原单的数量
List<OrderGoods> orderGoodsList = orderGoodsService.selectByOrderMasterId(request.getOrderMasterId()); List<OrderGoods> orderGoodsList = orderGoodsService.selectByOrderMasterId(request.getOrderMasterId());
// 找出原单关联的细单的商品数量 // 找出原单关联的细单的商品数量
List<OrderDetail> orderDetailList = orderDetailService.selectByOrderMasterId(request.getOrderMasterId()); List<OrderDetail> orderDetailList = orderDetailService.selectByOrderMasterId(request.getOrderMasterId());
for (OrderDetail orderDetail : orderDetailList){ for (OrderDetail orderDetail : orderDetailList) {
// 子单数量 // 子单数量
List<OrderGoods> orderDetailGoodsList = orderGoodsService.selectByOrderDetailId(orderDetail.getId()); List<OrderGoods> orderDetailGoodsList = orderGoodsService.selectByOrderDetailId(orderDetail.getId());
// 计算剩余未分配的商品数量 // 计算剩余未分配的商品数量
for (OrderGoods detailGoods : orderDetailGoodsList) { for (OrderGoods detailGoods : orderDetailGoodsList) {
for(OrderGoods masterGoods : orderGoodsList){ for (OrderGoods masterGoods : orderGoodsList) {
if(Objects.equals(masterGoods.getGoodsStandardId(), detailGoods.getGoodsStandardId())){ if (Objects.equals(masterGoods.getGoodsStandardId(), detailGoods.getGoodsStandardId())) {
masterGoods.setGoodsNum(masterGoods.getGoodsNum() - detailGoods.getGoodsNum()); masterGoods.setGoodsNum(masterGoods.getGoodsNum() - detailGoods.getGoodsNum());
} }
} }
@ -149,7 +129,7 @@ public class OrderController extends BaseController {
} }
//计算新单的数量 //计算新单的数量
return AjaxResult.success(orderGoodsList); return AjaxResult.success(orderGoodsList);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
@ -157,10 +137,10 @@ public class OrderController extends BaseController {
/** /**
* 后台批量下单 * 后台批量下单
* */ */
@PostMapping("/sys/order") @PostMapping("/sys/order")
@ResponseBody @ResponseBody
public AjaxResult sysOrder(@RequestBody SysOrderAssignRequest request){ public AjaxResult sysOrder(@RequestBody SysOrderAssignRequest request) {
try { try {
// 新增商品 -- 商品不关联师傅,状态为不展示在商城页面 // 新增商品 -- 商品不关联师傅,状态为不展示在商城页面
@ -174,13 +154,15 @@ public class OrderController extends BaseController {
// 生成财务细单 -- 平台扣点提成 // 生成财务细单 -- 平台扣点提成
return AjaxResult.success("下单成功"); return AjaxResult.success("下单成功");
}catch (Exception e){ } catch (Exception e) {
return AjaxResult.error("系统异常"); return AjaxResult.error("系统异常");
} }
} }
/**
* 分配订单
*/
@PostMapping("/assign") @PostMapping("/assign")
@ResponseBody @ResponseBody
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -197,11 +179,11 @@ public class OrderController extends BaseController {
Assert.notNull(acceptWorker, "查询接单师傅信息失败"); Assert.notNull(acceptWorker, "查询接单师傅信息失败");
om.setAllSelfAssigned(0); om.setAllSelfAssigned(0);
// 校验接单师傅和派单师傅是不是同一个Team // 校验接单师傅和派单师傅是不是同一个Team
if(!om.getWorkerId().equals(request.getWorkerId())){ if (!om.getWorkerId().equals(request.getWorkerId())) {
fm.setServerMoney(fm.getServerMoney().subtract(request.getTotalPay())); fm.setServerMoney(fm.getServerMoney().subtract(request.getTotalPay()));
boolean checkInTeam = workerService.checkInTeam(assignWorker.getWorkerId(), acceptWorker.getWorkerId()); boolean checkInTeam = workerService.checkInTeam(assignWorker.getWorkerId(), acceptWorker.getWorkerId());
Assert.isTrue(checkInTeam, "接单师傅不在本团队"); Assert.isTrue(checkInTeam, "接单师傅不在本团队");
}else { } else {
// 自己接单 -- 计算剩余金额 // 自己接单 -- 计算剩余金额
om.setAllSelfAssigned(1); om.setAllSelfAssigned(1);
BigDecimal realPay = fm.getPayMoney(); BigDecimal realPay = fm.getPayMoney();
@ -217,7 +199,7 @@ public class OrderController extends BaseController {
} }
// 判断是否全部派完 // 判断是否全部派完
if(request.getIsAll() == 1){ if (request.getIsAll() == 1) {
om.setHasDispatchedAll(1); om.setHasDispatchedAll(1);
} }
orderMasterService.updateOrderMaster(om); orderMasterService.updateOrderMaster(om);
@ -260,6 +242,11 @@ public class OrderController extends BaseController {
// 更新财务主单金额 // 更新财务主单金额
financialMasterService.updateFinancialMaster(fm); financialMasterService.updateFinancialMaster(fm);
OrderBehavior orderBehavior = new OrderBehavior().setOrderMasterId(om.getId()).setOrderMasterCode(om.getCode())
.setWorkerId(assignWorker.getWorkerId()).setWorkerName(assignWorker.getName()).setBehavior(OrderBehaviorEnum.ASSIGN_ORDER);
orderBehaviorService.insert(orderBehavior);
return AjaxResult.success(); return AjaxResult.success();
} }
@ -328,7 +315,7 @@ public class OrderController extends BaseController {
// createFinancialDetail(goodsList.get(0).getDeptGoodsCategoryId(), deptId, customer, payMoney, financialMaster); // createFinancialDetail(goodsList.get(0).getDeptGoodsCategoryId(), deptId, customer, payMoney, financialMaster);
//生成财务子单 //生成财务子单
createFinancialDetail(appGoodsList,deptId, customer, payMoney, financialMaster); createFinancialDetail(appGoodsList, deptId, customer, payMoney, financialMaster);
// 生成商品订单 // 生成商品订单
Map<Long, GoodsStandard> goodsMap = goodsList.stream().filter(Objects::nonNull) Map<Long, GoodsStandard> goodsMap = goodsList.stream().filter(Objects::nonNull)
@ -343,7 +330,7 @@ public class OrderController extends BaseController {
return AjaxResult.success(orderMaster); return AjaxResult.success(orderMaster);
} }
private void createFinancialDetail(List<AppGoodsRequest> appGoodsList, Long deptId, Customer customer, BigDecimal serverMoney, FinancialMaster financialMaster){ private void createFinancialDetail(List<AppGoodsRequest> appGoodsList, Long deptId, Customer customer, BigDecimal serverMoney, FinancialMaster financialMaster) {
// 平台 // 平台
BigDecimal deptMoney = BigDecimal.ZERO; BigDecimal deptMoney = BigDecimal.ZERO;
// 一级分销 // 一级分销
@ -354,12 +341,12 @@ public class OrderController extends BaseController {
BigDecimal threeMoney = BigDecimal.ZERO; BigDecimal threeMoney = BigDecimal.ZERO;
// 截流扣点 // 截流扣点
BigDecimal specialMoney = BigDecimal.ZERO; BigDecimal specialMoney = BigDecimal.ZERO;
for(AppGoodsRequest goodsRequest : appGoodsList){ for (AppGoodsRequest goodsRequest : appGoodsList) {
// 商品规格-提成额 // 商品规格-提成额
GoodsStandard goodsStandard = goodsStandardService.selectById(goodsRequest.getGoodsStandardId()); GoodsStandard goodsStandard = goodsStandardService.selectById(goodsRequest.getGoodsStandardId());
// 扣点设置类目 // 扣点设置类目
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(goodsStandard.getDeptGoodsCategoryId()); DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(goodsStandard.getDeptGoodsCategoryId());
for (int index = 0; index < goodsRequest.getNum(); index++){ for (int index = 0; index < goodsRequest.getNum(); index++) {
// 一级分销 = 商品单价 * 扣点比例 // 一级分销 = 商品单价 * 扣点比例
oneMoney = oneMoney oneMoney = oneMoney
.add(goodsStandard.getGoodsPrice().multiply(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getOneRate())))); .add(goodsStandard.getGoodsPrice().multiply(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getOneRate()))));
@ -508,7 +495,7 @@ public class OrderController extends BaseController {
/** /**
* 订单统计 * 订单统计
* */ */
@PostMapping("/app/statistics") @PostMapping("/app/statistics")
@ResponseBody @ResponseBody
public AjaxResult orderStatistics(@RequestBody OrderStatisticsRequest request) { public AjaxResult orderStatistics(@RequestBody OrderStatisticsRequest request) {
@ -566,7 +553,7 @@ public class OrderController extends BaseController {
orderListRequest.setIsMonitoredOrder(true); orderListRequest.setIsMonitoredOrder(true);
orderListRequest.setAllSelfAssigned(0); orderListRequest.setAllSelfAssigned(0);
AjaxResult afterListRes = this.appMixAfterList(orderListRequest); AjaxResult afterListRes = this.appMixAfterList(orderListRequest);
List<AfterServiceRecord> afterList = (List<AfterServiceRecord>)afterListRes.get("data"); List<AfterServiceRecord> afterList = (List<AfterServiceRecord>) afterListRes.get("data");
response.setAfterListNum(afterList.size()); response.setAfterListNum(afterList.size());
// 统计超时单量 // 统计超时单量
orderListRequest = new OrderListRequest(); orderListRequest = new OrderListRequest();
@ -575,7 +562,7 @@ public class OrderController extends BaseController {
orderListRequest.setIsMonitoredOrder(true); orderListRequest.setIsMonitoredOrder(true);
orderListRequest.setAllSelfAssigned(0); orderListRequest.setAllSelfAssigned(0);
AjaxResult overTimeRes = this.appMixOrderList(orderListRequest); AjaxResult overTimeRes = this.appMixOrderList(orderListRequest);
List<OrderListResponse> overTimeList = (List)overTimeRes.get("data"); List<OrderListResponse> overTimeList = (List) overTimeRes.get("data");
response.setOverTimeOrderNum(overTimeList.size()); response.setOverTimeOrderNum(overTimeList.size());
// 统计今日单量 // 统计今日单量
LocalDateTime today = LocalDateTime.of(LocalDate.now(), LocalTime.MIN); LocalDateTime today = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
@ -602,7 +589,7 @@ public class OrderController extends BaseController {
/** /**
* 查询主单子单的混合列表根据预约时间倒序排列请求参数中的师傅id不能为空 * 查询主单子单的混合列表根据预约时间倒序排列请求参数中的师傅id不能为空
* */ */
@PostMapping("/app/mix/order/list") @PostMapping("/app/mix/order/list")
@ResponseBody @ResponseBody
public AjaxResult appMixOrderList(@RequestBody OrderListRequest orderListRequest) { public AjaxResult appMixOrderList(@RequestBody OrderListRequest orderListRequest) {
@ -625,13 +612,13 @@ public class OrderController extends BaseController {
if (orderListRequest.getIsOverTime() != null && orderListRequest.getIsOverTime()) { if (orderListRequest.getIsOverTime() != null && orderListRequest.getIsOverTime()) {
// 需要排除同个师傅的主单子单同时出现 // 需要排除同个师傅的主单子单同时出现
List<OrderListResponse> filteredMasterList = new ArrayList<OrderListResponse>(); List<OrderListResponse> filteredMasterList = new ArrayList<OrderListResponse>();
for (OrderListResponse master: masterList) { for (OrderListResponse master : masterList) {
boolean isKeep = false; boolean isKeep = false;
// 查询该主单下所有售后中的子单 // 查询该主单下所有售后中的子单
OrderDetail detailAfterListOfMasterQry = new OrderDetail(); OrderDetail detailAfterListOfMasterQry = new OrderDetail();
detailAfterListOfMasterQry.setOrderMasterCode(master.getOrderMasterCode()); detailAfterListOfMasterQry.setOrderMasterCode(master.getOrderMasterCode());
List<OrderListResponse> detailListOfMasters = this.getDetailList(detailAfterListOfMasterQry); List<OrderListResponse> detailListOfMasters = this.getDetailList(detailAfterListOfMasterQry);
for (OrderListResponse detailListOfMaster: detailListOfMasters) { for (OrderListResponse detailListOfMaster : detailListOfMasters) {
if (!detailListOfMaster.getWorkerId().equals(orderListRequest.getWorkerId())) { if (!detailListOfMaster.getWorkerId().equals(orderListRequest.getWorkerId())) {
isKeep = true; isKeep = true;
break; break;
@ -677,13 +664,13 @@ public class OrderController extends BaseController {
List<OrderListResponse> masterList = this.getMasterAfterList(orderMasterReq); List<OrderListResponse> masterList = this.getMasterAfterList(orderMasterReq);
// 需要排除同个师傅的主单子单同时出现 // 需要排除同个师傅的主单子单同时出现
List<OrderListResponse> filteredMasterList = new ArrayList<OrderListResponse>(); List<OrderListResponse> filteredMasterList = new ArrayList<OrderListResponse>();
for (OrderListResponse master: masterList) { for (OrderListResponse master : masterList) {
boolean isKeep = false; boolean isKeep = false;
// 查询该主单下所有售后中的子单 // 查询该主单下所有售后中的子单
OrderDetail detailAfterListOfMasterQry = new OrderDetail(); OrderDetail detailAfterListOfMasterQry = new OrderDetail();
detailAfterListOfMasterQry.setOrderMasterCode(master.getOrderMasterCode()); detailAfterListOfMasterQry.setOrderMasterCode(master.getOrderMasterCode());
List<OrderListResponse> detailAfterListOfMasters = this.getDetailAfterList(detailAfterListOfMasterQry); List<OrderListResponse> detailAfterListOfMasters = this.getDetailAfterList(detailAfterListOfMasterQry);
for (OrderListResponse detailAfterListOfMaster: detailAfterListOfMasters) { for (OrderListResponse detailAfterListOfMaster : detailAfterListOfMasters) {
if (!detailAfterListOfMaster.getWorkerId().equals(orderListRequest.getWorkerId())) { if (!detailAfterListOfMaster.getWorkerId().equals(orderListRequest.getWorkerId())) {
isKeep = true; isKeep = true;
break; break;
@ -713,31 +700,31 @@ public class OrderController extends BaseController {
afterServiceRecord.setExcludeAfterServiceFinished(Boolean.TRUE); afterServiceRecord.setExcludeAfterServiceFinished(Boolean.TRUE);
List<AfterServiceRecord> afterServiceRecordList = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecord); List<AfterServiceRecord> afterServiceRecordList = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecord);
// 踢重后的子单ids // 踢重后的子单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(); StringBuilder orderDetailIds = new StringBuilder();
OrderDetail orderDetail = new OrderDetail(); OrderDetail orderDetail = new OrderDetail();
orderDetail.setCustomerId(orderMaster.getCustomerId()); orderDetail.setCustomerId(orderMaster.getCustomerId());
orderDetail.setDeptId(orderMaster.getDeptId()); orderDetail.setDeptId(orderMaster.getDeptId());
detailIds.forEach(id->{ detailIds.forEach(id -> {
orderDetailIds.append(id).append(","); orderDetailIds.append(id).append(",");
}); });
String ids = orderDetailIds.toString(); String ids = orderDetailIds.toString();
if(StringUtils.isNotEmpty(ids)){ if (StringUtils.isNotEmpty(ids)) {
orderDetail.setOrderDetailIds(ids.substring(0, ids.length()-1)); orderDetail.setOrderDetailIds(ids.substring(0, ids.length() - 1));
}else { } else {
orderDetail.setOrderDetailIds("0"); orderDetail.setOrderDetailIds("0");
} }
// 所有售后的子单 // 所有售后的子单
List<OrderDetail> orderDetailList = orderDetailService.selectOrderDetailList(orderDetail); List<OrderDetail> orderDetailList = orderDetailService.selectOrderDetailList(orderDetail);
StringBuilder orderMasterIds = new StringBuilder(); StringBuilder orderMasterIds = new StringBuilder();
orderDetailList.stream().map(OrderDetail::getOrderMasterId).distinct() orderDetailList.stream().map(OrderDetail::getOrderMasterId).distinct()
.collect(Collectors.toList()).forEach(id->{ .collect(Collectors.toList()).forEach(id -> {
orderMasterIds.append(id).append(","); orderMasterIds.append(id).append(",");
}); });
String orderIds = orderMasterIds.toString(); String orderIds = orderMasterIds.toString();
if(StringUtils.isNotEmpty(orderIds)){ if (StringUtils.isNotEmpty(orderIds)) {
orderMaster.setOrderMasterIds(orderIds.substring(0, orderIds.length()-1)); orderMaster.setOrderMasterIds(orderIds.substring(0, orderIds.length() - 1));
}else { } else {
orderMaster.setOrderMasterIds("0"); orderMaster.setOrderMasterIds("0");
} }
@ -798,7 +785,7 @@ public class OrderController extends BaseController {
AfterServiceRecord afterServiceRecordQry = new AfterServiceRecord(); AfterServiceRecord afterServiceRecordQry = new AfterServiceRecord();
afterServiceRecordQry.setOrderDetailId(detail.getId()); afterServiceRecordQry.setOrderDetailId(detail.getId());
List<AfterServiceRecord> records = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecordQry); List<AfterServiceRecord> records = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecordQry);
afterServiceRecords.addAll(records); afterServiceRecords.addAll(records);
}); });
@ -846,17 +833,17 @@ public class OrderController extends BaseController {
AfterServiceRecord afterServiceRecord = new AfterServiceRecord(); AfterServiceRecord afterServiceRecord = new AfterServiceRecord();
afterServiceRecord.setExcludeAfterServiceFinished(Boolean.TRUE); afterServiceRecord.setExcludeAfterServiceFinished(Boolean.TRUE);
List<AfterServiceRecord> afterServiceRecordList = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecord); 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 // 踢重后的子单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(); StringBuilder orderDetailIds = new StringBuilder();
detailIds.forEach(id->{ detailIds.forEach(id -> {
orderDetailIds.append(id).append(","); orderDetailIds.append(id).append(",");
}); });
String ids = orderDetailIds.toString(); String ids = orderDetailIds.toString();
if(StringUtils.isNotEmpty(ids)){ if (StringUtils.isNotEmpty(ids)) {
orderDetail.setOrderDetailIds(ids.substring(0, ids.length()-1)); orderDetail.setOrderDetailIds(ids.substring(0, ids.length() - 1));
}else { } else {
orderDetail.setOrderDetailIds("0"); orderDetail.setOrderDetailIds("0");
} }
List<OrderListResponse> orderListResponses = new ArrayList<>(); List<OrderListResponse> orderListResponses = new ArrayList<>();
@ -924,7 +911,7 @@ public class OrderController extends BaseController {
OrderTimeoutRecord orderTimeoutRecord = orderFineRecordService.selectByDetailIdAndStatus(detail.getId(), detail.getOrderStatus()); OrderTimeoutRecord orderTimeoutRecord = orderFineRecordService.selectByDetailIdAndStatus(detail.getId(), detail.getOrderStatus());
Boolean isOverTime = orderTimeoutRecord == null ? false : true; 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()); FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(detail.getOrderMasterId());
BigDecimal workerFee = financialMaster.getPayMoney(); BigDecimal workerFee = financialMaster.getPayMoney();
List<FinancialDetail> financialDetailList = financialDetailService.selectByFinancialMasterId(financialMaster.getId()); List<FinancialDetail> financialDetailList = financialDetailService.selectByFinancialMasterId(financialMaster.getId());
@ -935,7 +922,7 @@ public class OrderController extends BaseController {
} }
orderListResponse.setPayMoney(workerFee); orderListResponse.setPayMoney(workerFee);
orderListResponse.setIsOnlyServ(Boolean.TRUE); orderListResponse.setIsOnlyServ(Boolean.TRUE);
}else { } else {
orderListResponse.setPayMoney(detailPayMoney); orderListResponse.setPayMoney(detailPayMoney);
orderListResponse.setIsOnlyServ(Boolean.FALSE); orderListResponse.setIsOnlyServ(Boolean.FALSE);
} }
@ -1012,7 +999,7 @@ public class OrderController extends BaseController {
// 查询加价价格 // 查询加价价格
BigDecimal changeMoney = BigDecimal.ZERO; BigDecimal changeMoney = BigDecimal.ZERO;
List<FinancialChangeRecord> changeRecords = financialChangeRecordService.selectByDetailIds(StringUtils.join(orderDetailIds, ",")); List<FinancialChangeRecord> changeRecords = financialChangeRecordService.selectByDetailIds(StringUtils.join(orderDetailIds, ","));
for (FinancialChangeRecord changeRecord: changeRecords) { for (FinancialChangeRecord changeRecord : changeRecords) {
if (PayStatus.WAIT_PAY.getCode().equals(changeRecord.getPayStatus())) { if (PayStatus.WAIT_PAY.getCode().equals(changeRecord.getPayStatus())) {
changeMoney = changeMoney.add(changeRecord.getChangeMoney()); changeMoney = changeMoney.add(changeRecord.getChangeMoney());
} }
@ -1036,7 +1023,7 @@ public class OrderController extends BaseController {
AfterServiceRecord afterServiceRecordQry = new AfterServiceRecord(); AfterServiceRecord afterServiceRecordQry = new AfterServiceRecord();
afterServiceRecordQry.setOrderDetailId(detail.getId()); afterServiceRecordQry.setOrderDetailId(detail.getId());
List<AfterServiceRecord> records = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecordQry); List<AfterServiceRecord> records = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecordQry);
afterServiceRecords.addAll(records); afterServiceRecords.addAll(records);
}); });
if (Boolean.TRUE.equals(orderMaster.getIsOverTime()) && timeoutRecords.size() == 0) { if (Boolean.TRUE.equals(orderMaster.getIsOverTime()) && timeoutRecords.size() == 0) {
@ -1180,22 +1167,22 @@ public class OrderController extends BaseController {
return orderListResponses; return orderListResponses;
} }
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); 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; return false;
} }
// 子单数量 // 子单数量
List<OrderGoods> orderDetailGoodsList = orderGoodsService.selectByOrderDetailId(detail.getId()); List<OrderGoods> orderDetailGoodsList = orderGoodsService.selectByOrderDetailId(detail.getId());
// 计算剩余未分配的商品数量 // 计算剩余未分配的商品数量
for (OrderGoods detailGoods : orderDetailGoodsList) { for (OrderGoods detailGoods : orderDetailGoodsList) {
for(OrderGoods masterGoods : orderGoodsList){ for (OrderGoods masterGoods : orderGoodsList) {
if(Objects.equals(masterGoods.getGoodsStandardId(), detailGoods.getGoodsStandardId())){ if (Objects.equals(masterGoods.getGoodsStandardId(), detailGoods.getGoodsStandardId())) {
masterGoods.setGoodsNum(masterGoods.getGoodsNum() - detailGoods.getGoodsNum()); masterGoods.setGoodsNum(masterGoods.getGoodsNum() - detailGoods.getGoodsNum());
} }
} }

View File

@ -5,10 +5,7 @@ import com.ghy.common.constant.UserConstants;
import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.core.page.TableDataInfo; import com.ghy.common.core.page.TableDataInfo;
import com.ghy.common.enums.BusinessType; import com.ghy.common.enums.*;
import com.ghy.common.enums.ImgType;
import com.ghy.common.enums.OrderStatus;
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;
@ -48,7 +45,6 @@ import com.huifu.adapay.core.exception.BaseAdaPayException;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.util.Assert; import org.apache.shiro.util.Assert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
@ -74,40 +70,42 @@ public class OrderDetailController extends BaseController {
@Resource @Resource
private OrderDetailService orderDetailService; private OrderDetailService orderDetailService;
@Autowired @Resource
private OrderMasterService orderMasterService; private OrderMasterService orderMasterService;
@Autowired @Resource
private CustomerService customerService; private CustomerService customerService;
@Autowired @Resource
private WorkerService workerService; private WorkerService workerService;
@Autowired @Resource
private OrderGoodsService orderGoodsService; private OrderGoodsService orderGoodsService;
@Autowired @Resource
private CustomerAddressService addressService; private CustomerAddressService addressService;
@Autowired @Resource
private ISysAreaService sysAreaService; private ISysAreaService sysAreaService;
@Autowired @Resource
private GoodsService goodsService; private GoodsService goodsService;
@Autowired @Resource
private GoodsImgsService goodsImgsService; private GoodsImgsService goodsImgsService;
@Autowired @Resource
private GoodsStandardService goodsStandardService; private GoodsStandardService goodsStandardService;
@Autowired @Resource
private FinancialDetailService financialDetailService; private FinancialDetailService financialDetailService;
@Autowired @Resource
private OrderFineRecordService orderFineRecordService; private OrderFineRecordService orderFineRecordService;
@Autowired @Resource
private IAfterServiceRecordService afterServiceRecordService; private IAfterServiceRecordService afterServiceRecordService;
@Autowired @Resource
private FinancialChangeRecordService financialChangeRecordService; private FinancialChangeRecordService financialChangeRecordService;
@Autowired @Resource
private IWorkerCertificationService workerCertificationService; private IWorkerCertificationService workerCertificationService;
@Autowired @Resource
private IOrderAssessLabelService orderAssessLabelService; private IOrderAssessLabelService orderAssessLabelService;
@Autowired @Resource
private FinancialMasterService financialMasterService; private FinancialMasterService financialMasterService;
@Autowired @Resource
private ISysDeptConfigService sysDeptConfigService; private ISysDeptConfigService sysDeptConfigService;
@Resource
private OrderBehaviorService orderBehaviorService;
@RequiresPermissions("order:detail:view") @RequiresPermissions("order:detail:view")
@GetMapping() @GetMapping()
@ -796,17 +794,22 @@ public class OrderDetailController extends BaseController {
return AjaxResult.success("发起成功"); return AjaxResult.success("发起成功");
} }
/**
* 拒绝订单
*/
@PostMapping("/app/order/reject") @PostMapping("/app/order/reject")
@ResponseBody @ResponseBody
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult rejectDetailOrder(@RequestBody OrderDetail orderDetail) { public AjaxResult rejectDetailOrder(@RequestBody OrderDetail orderDetail) {
// 查询子单信息 // 查询订单信息
OrderDetail detailInfo = this.orderDetailService.selectById(orderDetail.getId()); OrderDetail od = this.orderDetailService.selectById(orderDetail.getId());
OrderMaster om = orderMasterService.selectById(od.getOrderMasterId());
Worker worker = workerService.selectById(od.getWorkerId());
// 删除子单 // 删除子单
orderDetailService.deleteOrderDetailByIds(orderDetail.getId().toString()); orderDetailService.deleteOrderDetailByIds(orderDetail.getId().toString());
FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detailInfo.getId()); FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(od.getId());
// 财务子单金额返还给主单 // 财务子单金额返还给主单
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(detailInfo.getOrderMasterId()); FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(od.getOrderMasterId());
financialMaster.setServerMoney(financialMaster.getServerMoney().add(financialDetail.getPayMoney())); financialMaster.setServerMoney(financialMaster.getServerMoney().add(financialDetail.getPayMoney()));
financialMasterService.updateFinancialMaster(financialMaster); financialMasterService.updateFinancialMaster(financialMaster);
// 删除子财务单 // 删除子财务单
@ -814,7 +817,7 @@ public class OrderDetailController extends BaseController {
// 退回旧商品 // 退回旧商品
// List<OrderGoods> goodsList = orderGoodsService.selectByOrderDetailId(orderDetail.getId()); // List<OrderGoods> goodsList = orderGoodsService.selectByOrderDetailId(orderDetail.getId());
// goodsList.forEach(orderGoods -> { // goodsList.forEach(orderGoods -> {
// List<OrderGoods> masterGoods = orderGoodsService.selectByOrderMasterId(detailInfo.getOrderMasterId()); // List<OrderGoods> masterGoods = orderGoodsService.selectByOrderMasterId(od.getOrderMasterId());
// masterGoods.forEach(master->{ // masterGoods.forEach(master->{
// if(master.getGoodsStandardId().equals(orderGoods.getGoodsStandardId())){ // if(master.getGoodsStandardId().equals(orderGoods.getGoodsStandardId())){
// master.setServerGoodsNum(master.getServerGoodsNum()-orderGoods.getGoodsNum()); // master.setServerGoodsNum(master.getServerGoodsNum()-orderGoods.getGoodsNum());
@ -825,10 +828,10 @@ public class OrderDetailController extends BaseController {
// 删除派单记录 // 删除派单记录
orderGoodsService.deleteByOrderDetailId(orderDetail.getId()); orderGoodsService.deleteByOrderDetailId(orderDetail.getId());
OrderMaster orderMaster2Update = new OrderMaster(); OrderMaster orderMaster2Update = new OrderMaster();
orderMaster2Update.setId(detailInfo.getOrderMasterId()); orderMaster2Update.setId(od.getOrderMasterId());
orderMaster2Update.setOrderStatus(OrderStatus.PLAIN.code()); orderMaster2Update.setOrderStatus(OrderStatus.PLAIN.code());
// 查询是否还有派单记录没有的话需要重置主单是否自己承接的字段为NULL // 查询是否还有派单记录没有的话需要重置主单是否自己承接的字段为NULL
List<OrderGoods> existOrderGoods = orderGoodsService.selectByOrderMasterId(detailInfo.getOrderMasterId()); List<OrderGoods> existOrderGoods = orderGoodsService.selectByOrderMasterId(od.getOrderMasterId());
if (CollectionUtils.isNotEmpty(existOrderGoods)) { if (CollectionUtils.isNotEmpty(existOrderGoods)) {
orderMaster2Update.setResetAllSelfAssigned(true); orderMaster2Update.setResetAllSelfAssigned(true);
} }
@ -836,6 +839,10 @@ public class OrderDetailController extends BaseController {
orderMaster2Update.setHasDispatchedAll(0); orderMaster2Update.setHasDispatchedAll(0);
orderMasterService.updateOrderMaster(orderMaster2Update); orderMasterService.updateOrderMaster(orderMaster2Update);
OrderBehavior orderBehavior = new OrderBehavior().setOrderMasterId(om.getId()).setOrderMasterCode(om.getCode())
.setWorkerId(worker.getWorkerId()).setWorkerName(worker.getName()).setBehavior(OrderBehaviorEnum.REFUSE_ORDER);
orderBehaviorService.insert(orderBehavior);
return AjaxResult.success(); return AjaxResult.success();
} }

View File

@ -0,0 +1,35 @@
package com.ghy.common.enums;
/**
* 用户行为枚举
*
* @author HH
*/
public enum OrderBehaviorEnum {
/**
* 接受订单
*/
ACCEPT_ORDER("ACCEPT_ORDER", "接受订单"),
/**
* 拒绝订单
*/
REFUSE_ORDER("REFUSE_ORDER", "拒绝订单"),
/**
* 完成订单
*/
FINISH_ORDER("FINISH_ORDER", "完成订单"),
/**
* 派单
*/
ASSIGN_ORDER("ASSIGN_ORDER", "派单");
public final String code;
public final String desc;
OrderBehaviorEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
}

View File

@ -0,0 +1,40 @@
package com.ghy.order.domain;
import com.ghy.common.enums.OrderBehaviorEnum;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* 订单行为 order_behavior
*
* @author HH
*/
@Data
@Accessors(chain = true)
public class OrderBehavior {
private Long id;
@NotNull
private Long workerId;
@NotBlank
private String workerName;
@NotNull
private Long orderMasterId;
@NotBlank
private String orderMasterCode;
private Long orderDetailId;
private String orderDetailCode;
@NotNull
private OrderBehaviorEnum behavior;
private LocalDateTime behaviorTime;
}

View File

@ -0,0 +1,25 @@
package com.ghy.order.mapper;
import com.ghy.order.domain.OrderBehavior;
import java.util.List;
import java.util.Set;
/**
* @author HH
*/
public interface OrderBehaviorMapper {
int insert(OrderBehavior orderBehavior);
int delete(Long id);
int batchDelete(Set<Long> ids);
OrderBehavior selectById(Long id);
List<OrderBehavior> selectByIds(Set<Long> ids);
List<OrderBehavior> select(OrderBehavior orderBehavior);
}

View File

@ -0,0 +1,24 @@
package com.ghy.order.service;
import com.ghy.order.domain.OrderBehavior;
import java.util.List;
import java.util.Set;
/**
* @author HH
*/
public interface OrderBehaviorService {
int insert(OrderBehavior orderBehavior);
int delete(Long id);
int batchDelete(Set<Long> ids);
OrderBehavior selectById(Long id);
List<OrderBehavior> selectByIds(Set<Long> ids);
List<OrderBehavior> select(OrderBehavior orderBehavior);
}

View File

@ -0,0 +1,62 @@
package com.ghy.order.service.impl;
import com.ghy.order.domain.OrderBehavior;
import com.ghy.order.mapper.OrderBehaviorMapper;
import com.ghy.order.service.OrderBehaviorService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* @author HH
*/
@Service
public class OrderBehaviorServiceImpl implements OrderBehaviorService {
@Resource
private OrderBehaviorMapper orderBehaviorMapper;
@Override
public int insert(@Valid OrderBehavior orderBehavior) {
return orderBehaviorMapper.insert(orderBehavior);
}
@Override
public int delete(Long id) {
return orderBehaviorMapper.delete(id);
}
@Override
public int batchDelete(Set<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return 0;
}
return orderBehaviorMapper.batchDelete(ids);
}
@Override
public OrderBehavior selectById(Long id) {
if (id == null || id < 1) {
return null;
}
return orderBehaviorMapper.selectById(id);
}
@Override
public List<OrderBehavior> selectByIds(Set<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return new ArrayList<>();
}
return orderBehaviorMapper.selectByIds(ids);
}
@Override
public List<OrderBehavior> select(OrderBehavior orderBehavior) {
return orderBehaviorMapper.select(orderBehavior);
}
}

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ghy.order.mapper.OrderBehaviorMapper">
<resultMap id="ColumnMap" type="com.ghy.order.domain.OrderBehavior">
<id property="id" column="id"/>
<result property="workerId" column="worker_id"/>
<result property="workerName" column="worker_name"/>
<result property="orderMasterId" column="order_master_id"/>
<result property="orderMasterCode" column="order_master_code"/>
<result property="orderDetailId" column="order_detail_id"/>
<result property="orderDetailCode" column="order_detail_code"/>
<result property="behavior" column="behavior"/>
<result property="behaviorTime" column="behavior_time"/>
</resultMap>
<sql id="selectColumns">
SELECT id,
worker_id,
worker_name,
order_master_id,
order_master_code,
order_detail_id,
order_detail_code,
behavior,
behavior_time
FROM order_behavior
</sql>
<insert id="insert" parameterType="com.ghy.order.domain.OrderBehavior" useGeneratedKeys="true" keyProperty="id">
INSERT INTO order_behavior(
worker_id, worker_name, order_master_id, order_master_code,
order_detail_id, order_detail_code, behavior, behavior_time
)VALUES(
#{workerId}, #{workerName}, #{orderMasterId}, #{orderMasterCode},
#{orderDetailId}, #{orderDetailCode}, #{behavior}, NOW())
</insert>
<select id="select" parameterType="com.ghy.order.domain.OrderBehavior" resultMap="ColumnMap">
<include refid="selectColumns"/>
<where>
<if test="workerId != null and workerId != 0">
AND worker_id = #{workerId}
</if>
<if test="orderMasterId != null and orderMasterId != 0">
AND order_master_id = #{orderMasterId}
</if>
<if test="orderMasterCode != null and orderMasterCode != ''">
AND order_master_code = #{orderMasterCode}
</if>
<if test="orderDetailId != null and orderDetailId != 0">
AND order_detail_id = #{orderDetailId}
</if>
<if test="orderDetailCode != null and orderDetailCode != ''">
AND order_detail_code = #{orderDetailCode}
</if>
</where>
</select>
<select id="selectById" parameterType="long" resultMap="ColumnMap">
<include refid="selectColumns"/> WHERE id = #{id}
</select>
<select id="selectByIds" resultMap="ColumnMap">
<include refid="selectColumns"/> WHERE id IN
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<delete id="delete" parameterType="Long">
DELETE FROM order_behavior WHERE id = #{id}
</delete>
<delete id="batchDelete">
DELETE FROM order_behavior WHERE id IN
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -88,7 +88,7 @@
#{userId}, #{userId},
<if test="templateName != null and templateName != 0">#{templateName},</if> <if test="templateName != null and templateName != 0">#{templateName},</if>
<if test="goodsBrand != null and goodsBrand != 0">#{goodsBrand},</if> <if test="goodsBrand != null and goodsBrand != 0">#{goodsBrand},</if>
<if test="goodsSpecification != null and goodsSpecification != 0">goods_specification = #{goodsSpecification},</if> <if test="goodsSpecification != null and goodsSpecification != 0">#{goodsSpecification},</if>
<if test="videoUrl != null and videoUrl != 0">#{videoUrl},</if> <if test="videoUrl != null and videoUrl != 0">#{videoUrl},</if>
<if test="imageUrl != null and imageUrl != 0">#{imageUrl},</if> <if test="imageUrl != null and imageUrl != 0">#{imageUrl},</if>
<if test="addressId != null and addressId != 0">#{addressId},</if> <if test="addressId != null and addressId != 0">#{addressId},</if>
@ -122,7 +122,7 @@
<include refid="selectColumns"/> WHERE id = #{id} <include refid="selectColumns"/> WHERE id = #{id}
</select> </select>
<select id="selectByIds" resultType="com.ghy.order.domain.OrderTemplate"> <select id="selectByIds" resultMap="ColumnMap">
<include refid="selectColumns"/> WHERE id IN <include refid="selectColumns"/> WHERE id IN
<foreach collection="array" item="id" open="(" separator="," close=")"> <foreach collection="array" item="id" open="(" separator="," close=")">
#{id} #{id}