Compare commits
3 Commits
b37aa22783
...
a740e600cc
| Author | SHA1 | Date |
|---|---|---|
|
|
a740e600cc | |
|
|
beefcc6878 | |
|
|
6df5c5d556 |
|
|
@ -409,6 +409,15 @@ public class BizOrderController extends BaseController {
|
||||||
return toAjax(bizOrderService.deleteBizOrderByIds(ids));
|
return toAjax(bizOrderService.deleteBizOrderByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改订单状态为已完成
|
||||||
|
*/
|
||||||
|
@Log(title = "订单", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/orderStatus/update/{ids}")
|
||||||
|
public AjaxResult updateOrderStatus(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(bizOrderService.updateOrderStatus(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 去配送
|
* 去配送
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,93 @@
|
||||||
package com.cpxt.web.controller.biz;
|
package com.cpxt.web.controller.biz;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.cpxt.biz.domain.BizOrder;
|
||||||
|
import com.cpxt.biz.domain.BizOrderSub;
|
||||||
|
import com.cpxt.biz.domain.OrderStatusChangePushEntity;
|
||||||
|
import com.cpxt.biz.mapper.BizOrderMapper;
|
||||||
|
import com.cpxt.biz.mapper.BizOrderSubMapper;
|
||||||
import com.cpxt.common.annotation.Anonymous;
|
import com.cpxt.common.annotation.Anonymous;
|
||||||
|
import com.cpxt.common.core.domain.AjaxResult;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
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.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping("/cpxt-api/api/order")
|
@RequestMapping("/cpxt-api/api/order")
|
||||||
public class OpenContrller {
|
public class OpenContrller {
|
||||||
|
|
||||||
@Anonymous
|
@Autowired
|
||||||
@PostMapping("/orderStatusChangePush")
|
private BizOrderMapper bizOrderMapper;
|
||||||
public void orderStatusChangePush() {
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BizOrderSubMapper bizOrderSubMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态变更推送
|
||||||
|
* @param orderStatusChangePushEntity 接口参数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@Transactional
|
||||||
|
@PostMapping("/orderStatusChangePush")
|
||||||
|
public Map<String,Object> orderStatusChangePush(@RequestBody OrderStatusChangePushEntity orderStatusChangePushEntity) {
|
||||||
|
Map<String,Object> resultMap = new HashMap<>();
|
||||||
|
String subOrderSn = orderStatusChangePushEntity.getChannelOrderNo();
|
||||||
|
BizOrderSub bizOrderSub = bizOrderSubMapper.selectBySubOrderSn(subOrderSn);
|
||||||
|
if (bizOrderSub == null) {
|
||||||
|
resultMap.put("code", 500);
|
||||||
|
resultMap.put("message", "操作失败,订单不存在!");
|
||||||
|
resultMap.put("result", "");
|
||||||
|
resultMap.put("success", "false");
|
||||||
|
}else {
|
||||||
|
// 修改子单信息(状态、预计送达时间)
|
||||||
|
bizOrderSub.setSubOrderStatus(orderStatusChangePushEntity.getStatus());
|
||||||
|
if (ObjectUtil.isNotEmpty(orderStatusChangePushEntity.getRemark().getDeliverTime())){
|
||||||
|
bizOrderSub.setExpectTime(DateUtil.parseTime(orderStatusChangePushEntity.getRemark().getDeliverTime()));
|
||||||
|
}
|
||||||
|
bizOrderSubMapper.updateById(bizOrderSub);
|
||||||
|
// 修改订单信息(状态、开始配送时间和到达时间)
|
||||||
|
BizOrder bizOrder = bizOrderMapper.selectByOrderSn(bizOrderSub.getOrderSn());
|
||||||
|
String status = orderStatusChangePushEntity.getStatus();
|
||||||
|
if ("02".equals(status) || "03".equals(status) || "04".equals(status)) {
|
||||||
|
bizOrder.setStatus(1); //待配送
|
||||||
|
}else if ("05".equals(status)){
|
||||||
|
LambdaQueryWrapper<BizOrderSub> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(BizOrderSub::getOrderSn,bizOrderSub.getOrderSn());
|
||||||
|
queryWrapper.eq(BizOrderSub::getSubOrderStatus,"05");
|
||||||
|
if (bizOrderSubMapper.selectList(queryWrapper).size() == 0) {
|
||||||
|
bizOrder.setStatus(2); //已接单
|
||||||
|
bizOrder.setStartTime(new Date()); //开始配送时间
|
||||||
|
}
|
||||||
|
}else if ("06".equals(status)){
|
||||||
|
LambdaQueryWrapper<BizOrderSub> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(BizOrderSub::getOrderSn,bizOrderSub.getOrderSn());
|
||||||
|
queryWrapper.ne(BizOrderSub::getSubOrderStatus,"06");
|
||||||
|
if (bizOrderSubMapper.selectList(queryWrapper).size() == 0) {
|
||||||
|
bizOrder.setStatus(3); //已送达
|
||||||
|
bizOrder.setArriveTime(new Date()); //到达时间
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
bizOrder.setStatus(4); //已取消
|
||||||
|
}
|
||||||
|
bizOrderMapper.updateById(bizOrder);
|
||||||
|
resultMap.put("code", 200);
|
||||||
|
resultMap.put("message", "操作成功!");
|
||||||
|
resultMap.put("result", "");
|
||||||
|
resultMap.put("success", "true");
|
||||||
|
}
|
||||||
|
resultMap.put("timestamp",System.currentTimeMillis());
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@ public class BizOrderSub
|
||||||
@Excel(name = "子单号")
|
@Excel(name = "子单号")
|
||||||
private String subOrderSn;
|
private String subOrderSn;
|
||||||
|
|
||||||
|
/** 子单状态 */
|
||||||
|
@Excel(name = "子单状态")
|
||||||
|
private String subOrderStatus;
|
||||||
|
|
||||||
/** 重量 */
|
/** 重量 */
|
||||||
@Excel(name = "重量")
|
@Excel(name = "重量")
|
||||||
private BigDecimal weight;
|
private BigDecimal weight;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.cpxt.biz.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @TableName biz_order_status_change_log
|
||||||
|
*/
|
||||||
|
@TableName(value ="biz_order_status_change_log")
|
||||||
|
@Data
|
||||||
|
public class BizOrderSubStatusChangeLog implements Serializable {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渠道订单号(接入方订单号)
|
||||||
|
*/
|
||||||
|
private String channelOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台订单号
|
||||||
|
*/
|
||||||
|
private String platformOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同城系统订单号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运单号
|
||||||
|
*/
|
||||||
|
private String expressNbr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 02 -> 未分配骑手
|
||||||
|
03 -> 已分配骑手
|
||||||
|
04 -> 已到店
|
||||||
|
05 -> 配送中
|
||||||
|
06 -> 已完单
|
||||||
|
07 -> 配送退回
|
||||||
|
08 -> 配送员取消
|
||||||
|
09 -> 用户取消
|
||||||
|
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态描述
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件号
|
||||||
|
*/
|
||||||
|
private String emailNbr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预估送达时间
|
||||||
|
*/
|
||||||
|
private Date deliverTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间
|
||||||
|
*/
|
||||||
|
private Date opTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.cpxt.biz.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class OrderStatusChangePushEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渠道订单号
|
||||||
|
*/
|
||||||
|
private String channelOrderNo;
|
||||||
|
/**
|
||||||
|
* 平台订单号(cpxt订单号)
|
||||||
|
*/
|
||||||
|
private String platformOrderNo;
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 02 -> 未分配骑手
|
||||||
|
* 03 -> 已分配骑手
|
||||||
|
* 04 -> 已到店
|
||||||
|
* 05 -> 配送中
|
||||||
|
* 06 -> 已完单
|
||||||
|
* 07 -> 配送退回
|
||||||
|
* 08 -> 配送员取消
|
||||||
|
* 09 -> 用户取消
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 状态描述
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
/**
|
||||||
|
* 操作时间
|
||||||
|
*/
|
||||||
|
private String opTime;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private RemarkBean remark;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public static class RemarkBean {
|
||||||
|
/**
|
||||||
|
* 邮件号(运单号)
|
||||||
|
*/
|
||||||
|
private String expressNbr;
|
||||||
|
/**
|
||||||
|
* 预计送达时间
|
||||||
|
*/
|
||||||
|
private String deliverTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.cpxt.biz.mapper;
|
||||||
|
|
||||||
|
import com.cpxt.biz.domain.BizOrderSubStatusChangeLog;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author LuoJian
|
||||||
|
* @description 针对表【biz_order_status_change_log】的数据库操作Mapper
|
||||||
|
* @createDate 2025-02-12 14:56:06
|
||||||
|
* @Entity com.cpxt.biz.domain.BizOrderStatusChangeLog
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BizOrderSubStatusChangeLogMapper extends BaseMapper<BizOrderSubStatusChangeLog> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.cpxt.biz.service;
|
||||||
|
|
||||||
|
import com.cpxt.biz.domain.BizOrderSubStatusChangeLog;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author LuoJian
|
||||||
|
* @description 针对表【biz_order_status_change_log】的数据库操作Service
|
||||||
|
* @createDate 2025-02-12 14:56:06
|
||||||
|
*/
|
||||||
|
public interface BizOrderSubStatusChangeLogService extends IService<BizOrderSubStatusChangeLog> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -78,4 +78,6 @@ public interface IBizOrderService
|
||||||
public int arrived(Map map);
|
public int arrived(Map map);
|
||||||
|
|
||||||
Map<String,Long> getOrderStaticsByDriver();
|
Map<String,Long> getOrderStaticsByDriver();
|
||||||
|
|
||||||
|
public int updateOrderStatus(Long[] ids);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -486,6 +486,20 @@ public class BizOrderServiceImpl implements IBizOrderService {
|
||||||
return bizOrderMapper.update(null, updateWrapper);
|
return bizOrderMapper.update(null, updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改订单状态
|
||||||
|
* @param ids 订单id
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateOrderStatus(Long[] ids) {
|
||||||
|
UpdateWrapper<BizOrder> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.in("id", (Object[]) ids);
|
||||||
|
updateWrapper.set("order_status", "3"); //状态改为已完成
|
||||||
|
return bizOrderMapper.update(null, updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除订单信息
|
* 删除订单信息
|
||||||
*
|
*
|
||||||
|
|
@ -758,7 +772,6 @@ public class BizOrderServiceImpl implements IBizOrderService {
|
||||||
bizOrder.setOrderSn(orderSn);
|
bizOrder.setOrderSn(orderSn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int goDelivery(Map map){
|
public int goDelivery(Map map){
|
||||||
BizDriver bizDriver = bizDriverMapper.selectByUserId(SecurityUtils.getUserId());
|
BizDriver bizDriver = bizDriverMapper.selectByUserId(SecurityUtils.getUserId());
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.cpxt.biz.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.cpxt.biz.domain.BizOrderSubStatusChangeLog;
|
||||||
|
import com.cpxt.biz.service.BizOrderSubStatusChangeLogService;
|
||||||
|
import com.cpxt.biz.mapper.BizOrderSubStatusChangeLogMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author LuoJian
|
||||||
|
* @description 针对表【biz_order_status_change_log】的数据库操作Service实现
|
||||||
|
* @createDate 2025-02-12 14:56:06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BizOrderSubStatusChangeLogServiceImpl extends ServiceImpl<BizOrderSubStatusChangeLogMapper, BizOrderSubStatusChangeLog>
|
||||||
|
implements BizOrderSubStatusChangeLogService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?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="BizOrderSubStatusChangeLogMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.cpxt.biz.domain.BizOrderSubStatusChangeLog">
|
||||||
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||||
|
<result property="channelOrderNo" column="channel_order_no" jdbcType="VARCHAR"/>
|
||||||
|
<result property="platformOrderNo" column="platform_order_no" jdbcType="VARCHAR"/>
|
||||||
|
<result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
|
||||||
|
<result property="expressNbr" column="express_nbr" jdbcType="VARCHAR"/>
|
||||||
|
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||||
|
<result property="message" column="message" jdbcType="VARCHAR"/>
|
||||||
|
<result property="emailNbr" column="email_nbr" jdbcType="VARCHAR"/>
|
||||||
|
<result property="deliverTime" column="deliver_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="opTime" column="op_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,channel_order_no,platform_order_no,
|
||||||
|
order_no,express_nbr,status,
|
||||||
|
message,email_nbr,deliver_time,
|
||||||
|
op_time,create_time
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue