增加主单退单原因
This commit is contained in:
parent
9c519ce980
commit
d2260ade7b
|
|
@ -1498,6 +1498,10 @@ public class OrderMasterController extends BaseController {
|
|||
|
||||
orderStandardDetail.setAfterTimeout(orderDetail.getAfterTimeout());
|
||||
|
||||
orderStandardDetail.setReturnReason(orderDetail.getReturnReason());
|
||||
orderStandardDetail.setReturnReasonDetail(orderDetail.getReturnReasonDetail());
|
||||
orderStandardDetail.setReturnImages(orderDetail.getReturnImages());
|
||||
|
||||
orderStandardDetails.add(orderStandardDetail);
|
||||
}
|
||||
|
||||
|
|
@ -2002,43 +2006,51 @@ public class OrderMasterController extends BaseController {
|
|||
@PostMapping("/console/cancel")
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult consoleCancel(Long id) {
|
||||
if(id == null){
|
||||
public AjaxResult consoleCancel(@RequestBody OrderMaster orderMaster) {
|
||||
if(orderMaster.getId() == null){
|
||||
return AjaxResult.error("订单编码id不能为空!");
|
||||
}
|
||||
|
||||
// 判断该主单状态
|
||||
OrderMaster orderMaster = orderMasterService.selectById(id);
|
||||
if(!orderMaster.getOrderStatus().equals(OrderStatus.PLAIN.code()) && !orderMaster.getOrderStatus().equals(OrderStatus.RECEIVE.code())){
|
||||
OrderMaster orderMasterInfo = orderMasterService.selectById(orderMaster.getId());
|
||||
if(!orderMasterInfo.getOrderStatus().equals(OrderStatus.PLAIN.code()) && !orderMasterInfo.getOrderStatus().equals(OrderStatus.RECEIVE.code())){
|
||||
return AjaxResult.error("该订单处于无法退单状态!");
|
||||
}
|
||||
|
||||
// 含有子单
|
||||
List<OrderDetail> orderDetails = orderDetailService.selectByOrderMasterId(id);
|
||||
List<OrderDetail> orderDetails = orderDetailService.selectByOrderMasterId(orderMaster.getId());
|
||||
if(CollectionUtils.isNotEmpty(orderDetails)){
|
||||
return AjaxResult.error("该订单已经派发过子单,无法退单状态!");
|
||||
}
|
||||
|
||||
try {
|
||||
// 判断是否为服务订单且需要退还服务金额
|
||||
if (isServiceOrder(orderMaster) &&
|
||||
orderMaster.getGoodsOrderMasterId() != null &&
|
||||
orderMaster.getServerGoodsMoney() != null &&
|
||||
orderMaster.getServerGoodsMoney().compareTo(BigDecimal.ZERO) > 0) {
|
||||
if (isServiceOrder(orderMasterInfo) &&
|
||||
orderMasterInfo.getGoodsOrderMasterId() != null &&
|
||||
orderMasterInfo.getServerGoodsMoney() != null &&
|
||||
orderMasterInfo.getServerGoodsMoney().compareTo(BigDecimal.ZERO) > 0) {
|
||||
|
||||
logger.info("检测到服务订单退单,开始退还服务金额:订单[{}],金额[{}],目标商品订单[{}]",
|
||||
orderMaster.getId(), orderMaster.getServerGoodsMoney(), orderMaster.getGoodsOrderMasterId());
|
||||
orderMasterInfo.getId(), orderMasterInfo.getServerGoodsMoney(), orderMasterInfo.getGoodsOrderMasterId());
|
||||
|
||||
// 退还服务金额到商品订单
|
||||
refundServerMoneyToGoodsOrder(orderMaster.getGoodsOrderMasterId(), orderMaster.getServerGoodsMoney());
|
||||
refundServerMoneyToGoodsOrder(orderMasterInfo.getGoodsOrderMasterId(), orderMasterInfo.getServerGoodsMoney());
|
||||
|
||||
// 重置配件主单的服务订单派发状态
|
||||
OrderMaster goodsOrderUpdate = new OrderMaster();
|
||||
goodsOrderUpdate.setId(orderMaster.getGoodsOrderMasterId());
|
||||
goodsOrderUpdate.setId(orderMasterInfo.getGoodsOrderMasterId());
|
||||
goodsOrderUpdate.setHasServiceOrder(0); // 重置为未派发状态
|
||||
orderMasterService.updateOrderMaster(goodsOrderUpdate);
|
||||
}
|
||||
|
||||
// 保存退单信息
|
||||
OrderMaster returnOrderUpdate = new OrderMaster();
|
||||
returnOrderUpdate.setId(orderMaster.getId());
|
||||
returnOrderUpdate.setReturnReason(orderMaster.getReturnReason());
|
||||
returnOrderUpdate.setReturnReasonDetail(orderMaster.getReturnReasonDetail());
|
||||
returnOrderUpdate.setReturnImages(orderMaster.getReturnImages());
|
||||
orderMasterService.updateOrderMaster(returnOrderUpdate);
|
||||
|
||||
// 清空id
|
||||
orderMasterService.removeWorker(orderMaster.getId());
|
||||
// 更新状态待接单
|
||||
|
|
@ -2047,7 +2059,7 @@ public class OrderMasterController extends BaseController {
|
|||
return AjaxResult.success("退单成功");
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("退单失败:订单ID={}, 错误信息={}", id, e.getMessage(), e);
|
||||
logger.error("退单失败:订单ID={}, 错误信息={}", orderMaster.getId(), e.getMessage(), e);
|
||||
return AjaxResult.error("退单失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -2145,6 +2157,9 @@ public class OrderMasterController extends BaseController {
|
|||
detailRes.setOrderDetailCode(detail.getCode());
|
||||
detailRes.setWorkerName(workerName);
|
||||
detailRes.setRemark(workerName + "(" + detail.getCode() + ")");
|
||||
detailRes.setReturnReason(detail.getReturnReason());
|
||||
detailRes.setReturnReasonDetail(detail.getReturnReasonDetail());
|
||||
detailRes.setReturnImages(detail.getReturnImages());
|
||||
orderStandardDetails.add(detailRes);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,4 +84,19 @@ public class OrderStandardDetail {
|
|||
|
||||
private BigDecimal addMoney;
|
||||
|
||||
/**
|
||||
* 退单原因
|
||||
*/
|
||||
private String returnReason;
|
||||
|
||||
/**
|
||||
* 退单原因详情
|
||||
*/
|
||||
private String returnReasonDetail;
|
||||
|
||||
/**
|
||||
* 退单图片
|
||||
*/
|
||||
private String returnImages;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ public class CustomerServiceImpl implements CustomerService {
|
|||
|
||||
@Override
|
||||
public Customer selectByCustomerId(Long customerId) {
|
||||
if (customerId == null) {
|
||||
return null;
|
||||
}
|
||||
return customerMapper.selectByCustomerId(customerId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,23 +95,28 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
|||
@Override
|
||||
public List<DeptGoodsCategory> appList(DeptGoodsCategory deptGoodsCategory) {
|
||||
Customer customer= customerService.selectByCustomerId(deptGoodsCategory.getCustomerId());
|
||||
Long customerId=customer.getCustomerPlace();
|
||||
if (customer.getPlaceStatus()==2){
|
||||
customerId=customer.getCustomerId();
|
||||
}
|
||||
CustomerSelection customerSelection=new CustomerSelection();
|
||||
customerSelection.setCustomerId(customerId);
|
||||
List<CustomerSelection> customerSelections=customerSelectionService.selectCustomerSelectionList(customerSelection);
|
||||
List<DeptGoodsCategory> goodsCategoryList =new ArrayList<>();
|
||||
log.info("用户id{}获取到的类目列表{}",customerId,customerSelections);
|
||||
// 第一层
|
||||
if (deptGoodsCategory.getIsSetting()==1){
|
||||
List<DeptGoodsCategory> goodsCategoryList = new ArrayList<>();
|
||||
if (customer == null) {
|
||||
log.warn("未找到客户,customerId: {}", deptGoodsCategory.getCustomerId());
|
||||
// 返回全部类目或默认类目
|
||||
goodsCategoryList = deptGoodsCategoryMapper.appList(deptGoodsCategory);
|
||||
}else{
|
||||
for (CustomerSelection customerSelection1 : customerSelections) {
|
||||
DeptGoodsCategory deptGoodsCategory1=deptGoodsCategoryMapper.selectOneByGoodsCategoryId(customerSelection1.getDeptCategoryId());
|
||||
if (customerSelection1.getSelectionType()==1){
|
||||
goodsCategoryList.add(deptGoodsCategory1);
|
||||
} else {
|
||||
Long customerId = customer.getCustomerPlace();
|
||||
if (customer.getPlaceStatus() == 2) {
|
||||
customerId = customer.getCustomerId();
|
||||
}
|
||||
CustomerSelection customerSelection = new CustomerSelection();
|
||||
customerSelection.setCustomerId(customerId);
|
||||
List<CustomerSelection> customerSelections = customerSelectionService.selectCustomerSelectionList(customerSelection);
|
||||
log.info("用户id{}获取到的类目列表{}", customerId, customerSelections);
|
||||
if (deptGoodsCategory.getIsSetting() == 1) {
|
||||
goodsCategoryList = deptGoodsCategoryMapper.appList(deptGoodsCategory);
|
||||
} else {
|
||||
for (CustomerSelection customerSelection1 : customerSelections) {
|
||||
DeptGoodsCategory deptGoodsCategory1 = deptGoodsCategoryMapper.selectOneByGoodsCategoryId(customerSelection1.getDeptCategoryId());
|
||||
if (customerSelection1.getSelectionType() == 1) {
|
||||
goodsCategoryList.add(deptGoodsCategory1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,4 +230,19 @@ public class OrderDetail extends BaseEntity {
|
|||
*/
|
||||
private Integer delayCount;
|
||||
|
||||
/**
|
||||
* 退单原因
|
||||
*/
|
||||
private String returnReason;
|
||||
|
||||
/**
|
||||
* 退单原因详情
|
||||
*/
|
||||
private String returnReasonDetail;
|
||||
|
||||
/**
|
||||
* 退单图片
|
||||
*/
|
||||
private String returnImages;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,4 +303,19 @@ public class OrderMaster extends BaseEntity {
|
|||
*/
|
||||
@Excel(name = "原师傅id", cellType = Excel.ColumnType.NUMERIC)
|
||||
private Long originalWorkerId;
|
||||
|
||||
/**
|
||||
* 退单原因
|
||||
*/
|
||||
private String returnReason;
|
||||
|
||||
/**
|
||||
* 退单原因详情
|
||||
*/
|
||||
private String returnReasonDetail;
|
||||
|
||||
/**
|
||||
* 退单图片
|
||||
*/
|
||||
private String returnImages;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@
|
|||
<result property="afterTimeout" column="after_timeout"/>
|
||||
<result property="timeoutFineTimes" column="timeout_fine_times"/>
|
||||
<result property="delayCount" column="delay_count"/>
|
||||
<result property="returnReason" column="return_reason"/>
|
||||
<result property="returnReasonDetail" column="return_reason_detail"/>
|
||||
<result property="returnImages" column="return_images"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOrderDetail">
|
||||
|
|
@ -70,7 +73,10 @@
|
|||
timeout_,
|
||||
timeout_fine_times,
|
||||
after_timeout,
|
||||
delay_count
|
||||
delay_count,
|
||||
return_reason,
|
||||
return_reason_detail,
|
||||
return_images
|
||||
FROM order_detail
|
||||
</sql>
|
||||
|
||||
|
|
@ -106,7 +112,10 @@
|
|||
od.timeout_,
|
||||
od.timeout_fine_times,
|
||||
od.after_timeout,
|
||||
od.delay_count
|
||||
od.delay_count,
|
||||
od.return_reason,
|
||||
od.return_reason_detail,
|
||||
od.return_images
|
||||
FROM order_detail od
|
||||
LEFT JOIN order_master om ON om.id = od.order_master_id
|
||||
LEFT JOIN customer_address ca ON ca.customer_address_id = om.address_id
|
||||
|
|
@ -373,6 +382,9 @@
|
|||
<if test="ledgerAccountStatus != null">ledger_account_status = #{ledgerAccountStatus},</if>
|
||||
<if test="timeout != null">timeout_ = #{timeout},</if>
|
||||
<if test="delayCount != null">delay_count = #{delayCount},</if>
|
||||
<if test="returnReason != null">return_reason = #{returnReason},</if>
|
||||
<if test="returnReasonDetail != null">return_reason_detail = #{returnReasonDetail},</if>
|
||||
<if test="returnImages != null">return_images = #{returnImages},</if>
|
||||
update_time = SYSDATE()
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
|
|
@ -432,6 +444,9 @@
|
|||
<if test="handoverRemark != null">handover_remark,</if>
|
||||
<if test="confirmStartTime != null">confirm_start_time,</if>
|
||||
<if test="delayCount != null">delay_count,</if>
|
||||
<if test="returnReason != null">return_reason,</if>
|
||||
<if test="returnReasonDetail != null">return_reason_detail,</if>
|
||||
<if test="returnImages != null">return_images,</if>
|
||||
<if test="expectTimeStart != null">expect_time_start,</if>
|
||||
<if test="expectTimeEnd != null">expect_time_end,</if>
|
||||
<if test="workBeginTime != null">work_begin_time,</if>
|
||||
|
|
@ -452,6 +467,9 @@
|
|||
<if test="handoverRemark != null">#{handoverRemark},</if>
|
||||
<if test="confirmStartTime != null">#{confirmStartTime},</if>
|
||||
<if test="delayCount != null">#{delayCount},</if>
|
||||
<if test="returnReason != null">#{returnReason},</if>
|
||||
<if test="returnReasonDetail != null">#{returnReasonDetail},</if>
|
||||
<if test="returnImages != null">#{returnImages},</if>
|
||||
<if test="expectTimeStart != null">#{expectTimeStart},</if>
|
||||
<if test="expectTimeEnd != null">#{expectTimeEnd},</if>
|
||||
<if test="workBeginTime != null">#{workBeginTime},</if>
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@
|
|||
<result property="isInvoiced" column="is_invoiced"/>
|
||||
<result property="isNeedBill" column="is_need_bill"/>
|
||||
<result property="originalWorkerId" column="original_worker_id"/>
|
||||
<result property="returnReason" column="return_reason"/>
|
||||
<result property="returnReasonDetail" column="return_reason_detail"/>
|
||||
<result property="returnImages" column="return_images"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
|
@ -127,7 +130,10 @@
|
|||
delivery_images,
|
||||
is_invoiced,
|
||||
is_need_bill,
|
||||
original_worker_id
|
||||
original_worker_id,
|
||||
return_reason,
|
||||
return_reason_detail,
|
||||
return_images
|
||||
|
||||
FROM order_master
|
||||
</sql>
|
||||
|
|
@ -190,7 +196,10 @@
|
|||
om.delivery_images,
|
||||
om.is_invoiced,
|
||||
om.is_need_bill,
|
||||
om.original_worker_id
|
||||
om.original_worker_id,
|
||||
om.return_reason,
|
||||
om.return_reason_detail,
|
||||
om.return_images
|
||||
FROM order_master om
|
||||
LEFT JOIN customer_address ca ON ca.customer_address_id = om.address_id
|
||||
LEFT JOIN goods g ON g.goods_id = om.goods_id
|
||||
|
|
@ -496,6 +505,9 @@
|
|||
<if test="isInvoiced != null">is_invoiced = #{isInvoiced},</if>
|
||||
<if test="isNeedBill != null">is_need_bill = #{isNeedBill},</if>
|
||||
<if test="originalWorkerId != null">original_worker_id = #{originalWorkerId},</if>
|
||||
<if test="returnReason != null">return_reason = #{returnReason},</if>
|
||||
<if test="returnReasonDetail != null">return_reason_detail = #{returnReasonDetail},</if>
|
||||
<if test="returnImages != null">return_images = #{returnImages},</if>
|
||||
update_time = SYSDATE()
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
|
|
@ -564,6 +576,9 @@
|
|||
<if test="isInvoiced != null">is_invoiced,</if>
|
||||
<if test="isNeedBill != null">is_need_bill,</if>
|
||||
<if test="originalWorkerId != null">original_worker_id,</if>
|
||||
<if test="returnReason != null">return_reason,</if>
|
||||
<if test="returnReasonDetail != null">return_reason_detail,</if>
|
||||
<if test="returnImages != null">return_images,</if>
|
||||
create_time
|
||||
)VALUES(
|
||||
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
||||
|
|
@ -613,6 +628,9 @@
|
|||
<if test="isInvoiced != null">#{isInvoiced},</if>
|
||||
<if test="isNeedBill != null">#{isNeedBill},</if>
|
||||
<if test="originalWorkerId != null">#{originalWorkerId},</if>
|
||||
<if test="returnReason != null">#{returnReason},</if>
|
||||
<if test="returnReasonDetail != null">#{returnReasonDetail},</if>
|
||||
<if test="returnImages != null">#{returnImages},</if>
|
||||
SYSDATE()
|
||||
)
|
||||
</insert>
|
||||
|
|
|
|||
|
|
@ -83,4 +83,19 @@ public class OrderStandardDetail {
|
|||
|
||||
private Integer afterTimeout;
|
||||
|
||||
/**
|
||||
* 退单原因
|
||||
*/
|
||||
private String returnReason;
|
||||
|
||||
/**
|
||||
* 退单原因详情
|
||||
*/
|
||||
private String returnReasonDetail;
|
||||
|
||||
/**
|
||||
* 退单图片
|
||||
*/
|
||||
private String returnImages;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue