订单行为记录
This commit is contained in:
parent
7b0c54024e
commit
ccda079938
|
|
@ -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,57 +68,44 @@ 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) {
|
||||||
|
|
@ -157,7 +137,7 @@ 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) {
|
||||||
|
|
@ -180,7 +160,9 @@ public class OrderController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配订单
|
||||||
|
*/
|
||||||
@PostMapping("/assign")
|
@PostMapping("/assign")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -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}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue