提交 ee56330f authored 作者: huyufan's avatar huyufan

保证金解冻逻辑修改

上级 e3024dec
......@@ -78,11 +78,11 @@ public enum OrderChildEnum {
;
private final int code;
private final Integer code;
private final String name;
public static Optional<Status> getByCode(int code) {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst();
public static Optional<Status> getByCode(Integer code) {
return Arrays.stream(values()).filter(e -> e.code.equals(code)).findFirst();
}
}
......@@ -126,7 +126,8 @@ public enum OrderChildEnum {
public static final List<Integer> CANCEL_lIST = Arrays.asList(
Status.DRIVER_CANCEL.getCode(),
Status.PLATFORM_CANCEL.getCode(),
Status.OWNER_CANCEL.getCode()
Status.OWNER_CANCEL.getCode(),
Status.ARTIFICIAL_CANCEL.getCode()
);
......
......@@ -164,4 +164,10 @@ public class OrderChildVO {
return freightPrice.multiply(weight).setScale(2, RoundingMode.HALF_UP);
}
@ApiModelProperty("状态MSG")
public String statusMsg;
public String getStatusMsg() {
return OrderChildEnum.Status.getByCode(status).get().getName();
}
}
\ No newline at end of file
......@@ -127,7 +127,7 @@ public class OrderGoodsStatusLazyComponent implements InitializingBean {
orderGoodsDao.updateOrderGoodsStatusByOrderGoodsNo(orderGoodsNo, OrderGoodsStatusEnum.Status.COMPLETED.getCode());
} else {
//更新货单已完成
log.info("当前货单虽然可拉运吨数为0,未存在未拉运完成的运单,所以更新为已完成,货单编号{}", orderGoodsNo);
log.info("当前货单可拉运吨数为0,未存在未拉运完成的运单,所以更新为已完成,货单编号{}", orderGoodsNo);
orderGoodsDao.updateOrderGoodsStatusByOrderGoodsNo(orderGoodsNo, OrderGoodsStatusEnum.Status.SUCCESS.getCode());
}
......@@ -211,15 +211,15 @@ public class OrderGoodsStatusLazyComponent implements InitializingBean {
childSum = childSum.add(orderChild.getWeight());
childNoList.add(orderChild.getChildNo());
//释放车辆
driverService.updateOrderStatus(orderChild.getDriverUserNo(), DriverInfoEnum.DriverStatus.NO.getCode(), orderChild.getTruckId(), 1);
//driverService.updateOrderStatus(orderChild.getDriverUserNo(), DriverInfoEnum.DriverStatus.NO.getCode(), orderChild.getTruckId(), 1);
orderChild.setCancelTime(DateUtils.parseDateTime(now).get());
orderChild.setFinishTime(DateUtils.parseDateTime(now).get());
breakContractDriverRecordService.saveDriverRecordOfOrderChildCancel(orderChild, 0L, "系统");
//breakContractDriverRecordService.saveDriverRecordOfOrderChildCancel(orderChild, 0L, "系统");
//保存运单日志数据
// 日志
orderChildLogService.saveDriverOrderChildLog(orderChild.getChildNo(), OrderChildLogEnum.Type.PLATFORM_CANCEL.getCode(),
OrderChildLogEnum.Type.PLATFORM_CANCEL.getMsg(), 0L, "系统");
/* orderChildLogService.saveDriverOrderChildLog(orderChild.getChildNo(), OrderChildLogEnum.Type.PLATFORM_CANCEL.getCode(),
OrderChildLogEnum.Type.PLATFORM_CANCEL.getMsg(), 0L, "系统");*/
}
log.info("取消运单ID集合:{}", childNoList);
......@@ -249,7 +249,7 @@ public class OrderGoodsStatusLazyComponent implements InitializingBean {
}
}
//只更新货单已拉运吨数
orderGoodsDao.updateOrderGoodsSetAlreadyWeight(childSum, orderGoods.getId());
orderGoodsDao.updateOrderGoodsSetResidueWeightAndAlreadyWeight(childSum, childSum, orderGoods.getId());
orderFeign.rollbackOrderWeight(param);
} else {
//只更新货单未拉运吨数,已拉运吨数
......
package com.clx.performance.controller.pc;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.pc.OrderCancelParam;
import com.clx.performance.param.pc.PageOrderGoodsListParam;
import com.clx.performance.service.OrderCancelService;
import com.clx.performance.vo.app.OrderChildVO;
import com.clx.performance.vo.pc.OrderGoodsVO;
import com.msl.common.base.PageData;
import com.msl.common.base.PageParam;
import com.msl.common.convertor.aspect.UnitCovert;
import com.msl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -11,6 +18,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RestController
@RequestMapping(value="/pc/order/")
......@@ -34,4 +43,27 @@ public class OrderCancelController {
orderCancelService.ownerCancelOrderPre(param);
return Result.ok();
}
@ApiOperation(value = "客服取消运单查询", notes = "<br>By:胡宇帆")
@GetMapping("/findArtificialCancelOrder")
public Result<OrderChildVO> findArtificialCancelOrder(@RequestParam String orderChildNo) {
OrderChildVO vo = orderCancelService.findArtificialCancelOrder(orderChildNo);
return Result.ok(vo);
}
@ApiOperation(value = "客服取消运单", notes = "<br>By:胡宇帆")
@GetMapping("/artificialCancelOrder")
public Result<Object> artificialCancelOrder(@RequestParam(value = "orderChildNo") String orderChildNo, @RequestParam(value = "remark") String remark) {
orderCancelService.artificialCancelOrder(orderChildNo, remark);
return Result.ok();
}
@ApiOperation(value = "取消运单记录", notes = "<br>By:胡宇帆")
@PostMapping("/orderChildCancelRecord")
public Result<PageData<OrderChildVO>> orderChildCancelRecord() {
PageParam pageParam = new PageParam();
IPage<OrderChildVO> page = orderCancelService.orderChildCancelRecord(pageParam);
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
}
......@@ -13,6 +13,7 @@ import com.clx.performance.vo.app.OrderChildVO;
import com.clx.performance.vo.pc.PageCarrierOrderChildVO;
import com.clx.performance.vo.pc.PageOrderChildPoundAuditVO;
import com.msl.common.base.Optional;
import com.msl.common.base.PageParam;
import com.msl.common.dao.BaseDao;
import org.apache.ibatis.annotations.Param;
......@@ -125,4 +126,12 @@ public interface OrderChildDao extends BaseDao<OrderChildMapper, OrderChild, Int
*/
List<OrderChild> selectInTransitOrderChildByOrderGoodsNo(String orderGoodsNo);
/**
* 客服查询可以取消的运单
* @param orderChildNo
* @return
*/
OrderChildVO findArtificialCancelOrder(String orderChildNo);
IPage<OrderChildVO> orderChildCancelRecord(PageParam pageParam);
}
......@@ -15,9 +15,11 @@ import com.clx.performance.param.pc.PageCarrierOrderChildParam;
import com.clx.performance.param.pc.PageMonitorOrderChildQCParam;
import com.clx.performance.param.pc.PagePoundAuditParam;
import com.clx.performance.vo.app.OrderChildVO;
import com.clx.performance.vo.pc.OrderGoodsVO;
import com.clx.performance.vo.pc.PageCarrierOrderChildVO;
import com.clx.performance.vo.pc.PageOrderChildPoundAuditVO;
import com.msl.common.base.Optional;
import com.msl.common.base.PageParam;
import com.msl.common.dao.impl.BaseDaoImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
......@@ -381,4 +383,15 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild,
return baseMapper.selectList(lQrWrapper().eq(OrderChild::getOrderGoodsNo, orderGoodsNo)
.lt(OrderChild::getStatus, OrderChildEnum.Status.UNLOAD.getCode())
); }
@Override
public OrderChildVO findArtificialCancelOrder(String orderChildNo) {
return baseMapper.findArtificialCancelOrder(orderChildNo);
}
@Override
public IPage<OrderChildVO> orderChildCancelRecord(PageParam param) {
Page<OrderGoodsVO> page = Page.of(param.getPage(), param.getPageSize());
return baseMapper.orderChildCancelRecord(page);
}
}
......@@ -12,6 +12,7 @@ import com.clx.performance.param.pc.PagePoundAuditParam;
import com.clx.performance.sqlProvider.OrderChildSqlProvider;
import com.clx.performance.sqlProvider.OrderGoodsSqlProvider;
import com.clx.performance.vo.app.OrderChildVO;
import com.clx.performance.vo.pc.OrderGoodsVO;
import com.clx.performance.vo.pc.PageCarrierOrderChildVO;
import com.clx.performance.vo.pc.PageOrderChildPoundAuditVO;
import org.apache.ibatis.annotations.*;
......@@ -51,4 +52,11 @@ public interface OrderChildMapper extends BaseMapper<OrderChild> {
Integer updateOrderGoodsSetResidueWeight(@Param(value = "status") Integer status, @Param(value = "remark") String remark,
@Param(value = "cancelTime") String cancelTime, @Param(value = "finishTime") String finishTime,
@Param(value = "childNoList") List<String> childNoList);
@SelectProvider(type = OrderChildSqlProvider.class, method = "findArtificialCancelOrder")
OrderChildVO findArtificialCancelOrder(@Param("orderChildNo") String orderChildNo);
@SelectProvider(type = OrderChildSqlProvider.class, method = "orderChildCancelRecord")
IPage<OrderChildVO> orderChildCancelRecord(@Param("page")Page<OrderGoodsVO> page);
}
\ No newline at end of file
package com.clx.performance.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.pc.OrderCancelParam;
import com.clx.performance.vo.app.OrderChildVO;
import com.msl.common.base.PageParam;
import java.util.List;
public interface OrderCancelService {
......@@ -34,6 +39,14 @@ public interface OrderCancelService {
* 客服取消
* @param orderChildNo
*/
void artificialCancelOrder(String orderChildNo);
void artificialCancelOrder(String orderChildNo, String remark);
/**
* 客服取消运单查询
* @param orderChildNo
* @return
*/
OrderChildVO findArtificialCancelOrder(String orderChildNo);
IPage<OrderChildVO> orderChildCancelRecord(PageParam pageParam);
}
......@@ -2,6 +2,7 @@ package com.clx.performance.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.order.enums.OrderEnum;
import com.clx.order.feign.OrderFeign;
import com.clx.order.param.feign.OrderCancelReasonParam;
......@@ -23,7 +24,9 @@ import com.clx.performance.service.OrderCancelService;
import com.clx.performance.service.OrderGoodsTruckBindService;
import com.clx.performance.service.OwnerAccountService;
import com.clx.performance.service.breakcontract.BreakContractSettlementOwnerService;
import com.clx.performance.vo.app.OrderChildVO;
import com.clx.user.enums.driver.DriverInfoEnum;
import com.msl.common.base.PageParam;
import com.msl.common.enums.ResultEnum;
import com.msl.common.exception.ServiceSystemException;
import com.msl.common.result.Result;
......@@ -678,16 +681,29 @@ public class OrderCancelServiceImpl implements OrderCancelService {
}
@Override
public void artificialCancelOrder(String orderChildNo) {
public void artificialCancelOrder(String orderChildNo, String remark) {
LocalDateTime now = LocalDateTime.now();
OrderChild orderChild = orderChildDao.getByChildNo(orderChildNo).orElseThrow(PerformanceResultEnum.ORDER_CHILD_NO_FOUND);
OrderChild update = new OrderChild();
update.setId(orderChild.getId());
update.setStatus(OrderChildEnum.Status.ARTIFICIAL_CANCEL.getCode());
update.setCancelRemark(OrderChildEnum.Status.ARTIFICIAL_CANCEL.getName());
update.setCancelRemark(remark);
update.setCancelTime(now);
update.setFinishTime(now);
orderChildDao.updateEntityByKey(update);
orderCancelComponent.backFillTonnageForArtificial(orderChild.getOrderGoodsNo(), orderChild.getWeight());
}
@Override
public OrderChildVO findArtificialCancelOrder(String orderChildNo) {
return orderChildDao.findArtificialCancelOrder(orderChildNo);
}
@Override
public IPage<OrderChildVO> orderChildCancelRecord(PageParam pageParam) {
return orderChildDao.orderChildCancelRecord(pageParam);
}
}
\ No newline at end of file
......@@ -146,4 +146,49 @@ public class OrderChildSqlProvider {
sqlList.append(")");
return sqlList.toString();
}
public String findArtificialCancelOrder(@Param("orderChildNo") String orderChildNo) {
return new SQL(){{
SELECT("child_no,goods_name,freight_price," +
"send_address,receive_address,good_type_code,good_type_name" +
"driver_user_no, driver_name,driver_mobile," +
"truck_no," +
"unload_pound_no,weight," +
"cancel_remark," +
"pound_status,status," +
"date_format(load_deadline, '%Y-%m-%d %H:%i:%s') as loadDeadline," +
"date_format(create_time, '%Y-%m-%d %H:%i:%s') as createTime," +
"date_format(unload_time, '%Y-%m-%d %H:%i:%s') as unloadTime "
);
FROM("order_child");
WHERE("(child_no = #{orderChildNo}");
WHERE("(status >=" + OrderChildEnum.Status.LOAD.getCode());
WHERE("(status <=" + OrderChildEnum.Status.COMPLETE.getCode());
LIMIT("1");
}}.toString();
}
public String orderChildCancelRecord(@Param("page") Page<OrderChildVO> page) {
return new SQL(){{
SELECT("child_no,goods_name,freight_price," +
"send_address,receive_address," +
"driver_user_no, driver_name,driver_mobile," +
"truck_no," +
"unload_pound_no,weight," +
"cancel_remark," +
"pound_status,status," +
"date_format(load_deadline, '%Y-%m-%d %H:%i:%s') as loadDeadline," +
"date_format(load_deadline, '%Y-%m-%d %H:%i:%s') as loadDeadline," +
"date_format(cancel_time, '%Y-%m-%d %H:%i:%s') as cancelTime "
);
FROM("order_child ");
WHERE("status in (" + StringUtils.join(OrderChildEnum.CANCEL_lIST, ",")+")");
ORDER_BY("create_time desc");
}}.toString();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论