提交 2311e086 authored 作者: huyufan's avatar huyufan

开发:货单下订单列表修改状态文案以及增加处理货单定向司机表

上级 d0086ed9
...@@ -22,7 +22,7 @@ public class PageCarrierOrderListParam extends PageParam { ...@@ -22,7 +22,7 @@ public class PageCarrierOrderListParam extends PageParam {
@ApiModelProperty(value = "联系人(货主)id") @ApiModelProperty(value = "联系人(货主)id")
private Integer contactId; private Integer contactId;
@ApiModelProperty(value = "订单状态:2报价已确认 3平台已承接 7 挂单中 8运输中 11 挂单中") @ApiModelProperty(value = "订单状态:2:报价已确认 3:平台已承接 7:挂单中 8:运输中 11:已挂单")
private Integer orderStatus; private Integer orderStatus;
@ApiModelProperty(value = "开始时间", example = "2023-09-09 12:00:01", required = true) @ApiModelProperty(value = "开始时间", example = "2023-09-09 12:00:01", required = true)
......
...@@ -83,27 +83,27 @@ public class RabbitConfig implements RabbitListenerConfigurer { ...@@ -83,27 +83,27 @@ public class RabbitConfig implements RabbitListenerConfigurer {
// 存在此名字的bean 自带的容器工厂会不加载(yml下rabbitmq下的listener下的simple配置),如果想自定义来区分开 需要改变bean 的名称 // 存在此名字的bean 自带的容器工厂会不加载(yml下rabbitmq下的listener下的simple配置),如果想自定义来区分开 需要改变bean 的名称
@Bean // @Bean
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory() { // public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory() {
SimpleRabbitListenerContainerFactory containerFactory = new SimpleRabbitListenerContainerFactory(); // SimpleRabbitListenerContainerFactory containerFactory = new SimpleRabbitListenerContainerFactory();
containerFactory.setConnectionFactory(rabbitConnectionFactory); // containerFactory.setConnectionFactory(rabbitConnectionFactory);
//
// 预加载消息数量 -- QOS // // 预加载消息数量 -- QOS
containerFactory.setPrefetchCount(1); // containerFactory.setPrefetchCount(1);
// 应答模式(此处设置为手动) // // 应答模式(此处设置为手动)
containerFactory.setAcknowledgeMode(AcknowledgeMode.MANUAL); // containerFactory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
//消息序列化方式 // //消息序列化方式
containerFactory.setMessageConverter(new Jackson2JsonMessageConverter()); // containerFactory.setMessageConverter(new Jackson2JsonMessageConverter());
// 设置通知调用链 (这里设置的是重试机制的调用链) // // 设置通知调用链 (这里设置的是重试机制的调用链)
containerFactory.setAdviceChain( // containerFactory.setAdviceChain(
RetryInterceptorBuilder // RetryInterceptorBuilder
.stateless() // .stateless()
.recoverer(new RejectAndDontRequeueRecoverer()) // .recoverer(new RejectAndDontRequeueRecoverer())
//.retryOperations(rabbitRetryTemplate()) // //.retryOperations(rabbitRetryTemplate())
.build() // .build()
); // );
return containerFactory; // return containerFactory;
} // }
@Bean @Bean
public SimpleMessageListenerContainer simpleMessageListenerContainer(SimpleRabbitListenerContainerFactory connectionFactory) { public SimpleMessageListenerContainer simpleMessageListenerContainer(SimpleRabbitListenerContainerFactory connectionFactory) {
...@@ -133,29 +133,29 @@ public class RabbitConfig implements RabbitListenerConfigurer { ...@@ -133,29 +133,29 @@ public class RabbitConfig implements RabbitListenerConfigurer {
//重试的Template //重试的Template
//
@Bean // @Bean
public ExponentialBackOffPolicy backOffPolicyByProperties() { // public ExponentialBackOffPolicy backOffPolicyByProperties() {
ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy(); // ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
long maxInterval = properties.getListener().getSimple().getRetry().getMaxInterval().getSeconds(); // long maxInterval = properties.getListener().getSimple().getRetry().getMaxInterval().getSeconds();
long initialInterval = properties.getListener().getSimple().getRetry().getInitialInterval().getSeconds(); // long initialInterval = properties.getListener().getSimple().getRetry().getInitialInterval().getSeconds();
double multiplier = properties.getListener().getSimple().getRetry().getMultiplier(); // double multiplier = properties.getListener().getSimple().getRetry().getMultiplier();
// 重试间隔 // // 重试间隔
backOffPolicy.setInitialInterval(initialInterval * 1000); // backOffPolicy.setInitialInterval(initialInterval * 1000);
// 重试最大间隔 // // 重试最大间隔
backOffPolicy.setMaxInterval(maxInterval * 1000); // backOffPolicy.setMaxInterval(maxInterval * 1000);
// 重试间隔乘法策略 // // 重试间隔乘法策略
backOffPolicy.setMultiplier(multiplier); // backOffPolicy.setMultiplier(multiplier);
return backOffPolicy; // return backOffPolicy;
} // }
//
@Bean // @Bean
public SimpleRetryPolicy retryPolicyByProperties() { // public SimpleRetryPolicy retryPolicyByProperties() {
SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy(); // SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
int maxAttempts = properties.getListener().getSimple().getRetry().getMaxAttempts(); // int maxAttempts = properties.getListener().getSimple().getRetry().getMaxAttempts();
retryPolicy.setMaxAttempts(maxAttempts); // retryPolicy.setMaxAttempts(maxAttempts);
return retryPolicy; // return retryPolicy;
} // }
@Override @Override
public void configureRabbitListeners(RabbitListenerEndpointRegistrar registrar) { public void configureRabbitListeners(RabbitListenerEndpointRegistrar registrar) {
......
...@@ -19,4 +19,6 @@ public class RabbitKeyConstants { ...@@ -19,4 +19,6 @@ public class RabbitKeyConstants {
public static final String ORDER_ON_DEAD_QUEUE ="order.on.dead.queue"; public static final String ORDER_ON_DEAD_QUEUE ="order.on.dead.queue";
public static final String ORDER_GOODS_SYNC_TRUCK_DRIVER_INFO_QUEUE = "order.goods.sync.truck.driver.info.queue";
} }
...@@ -13,4 +13,6 @@ import java.util.List; ...@@ -13,4 +13,6 @@ import java.util.List;
*/ */
public interface OrderGoodsDriverTruckDao extends BaseDao<OrderGoodsDriverTruckMapper, OrderGoodsDriverTruck, Integer> { public interface OrderGoodsDriverTruckDao extends BaseDao<OrderGoodsDriverTruckMapper, OrderGoodsDriverTruck, Integer> {
List<Integer> getTrucksByOrderGoodsNo(String orderGoodsNo); List<Integer> getTrucksByOrderGoodsNo(String orderGoodsNo);
void deleteByTruckNoAndDriverUserNo(String truckNo, String driverUserNo);
} }
package com.clx.performance.dao.impl; package com.clx.performance.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import com.clx.performance.dao.OrderGoodsDriverTruckDao; import com.clx.performance.dao.OrderGoodsDriverTruckDao;
import com.msl.common.dao.BaseDao; import com.msl.common.dao.BaseDao;
import com.msl.common.dao.impl.BaseDaoImpl; import com.msl.common.dao.impl.BaseDaoImpl;
...@@ -20,4 +22,12 @@ public class OrderGoodsDriverTruckDaoImpl extends BaseDaoImpl<OrderGoodsDriverTr ...@@ -20,4 +22,12 @@ public class OrderGoodsDriverTruckDaoImpl extends BaseDaoImpl<OrderGoodsDriverTr
public List<Integer> getTrucksByOrderGoodsNo(String orderGoodsNo) { public List<Integer> getTrucksByOrderGoodsNo(String orderGoodsNo) {
return baseMapper.getTrucksByOrderGoodsNo(orderGoodsNo); return baseMapper.getTrucksByOrderGoodsNo(orderGoodsNo);
} }
@Override
public void deleteByTruckNoAndDriverUserNo(String truckNo, String driverUserNo) {
baseMapper.delete(new QueryWrapper<OrderGoodsDriverTruck>().lambda()
.eq(OrderGoodsDriverTruck::getTruckNo,truckNo)
.eq(OrderGoodsDriverTruck::getDriverUserNo, Long.valueOf(driverUserNo))
);
}
} }
//package com.clx.performance.listener; package com.clx.performance.listener;
//
//import com.clx.performance.constant.RabbitKeyConstants; import cn.hutool.json.JSON;
//import lombok.extern.slf4j.Slf4j; import cn.hutool.json.JSONArray;
//import org.springframework.amqp.rabbit.annotation.RabbitListener; import cn.hutool.json.JSONObject;
//import org.springframework.stereotype.Component; import cn.hutool.json.JSONUtil;
// import com.clx.performance.constant.RabbitKeyConstants;
//@Component import com.clx.performance.dao.OrderGoodsDriverTruckDao;
//@Slf4j import com.clx.performance.model.OrderGoodsDriverTruck;
//public class OrderGoodsDriverTruckListener { import lombok.extern.slf4j.Slf4j;
// import org.apache.commons.lang3.StringUtils;
// import org.springframework.amqp.core.Message;
// @RabbitListener(queues = RabbitKeyConstants.ORDER_ON_DEAD_QUEUE) import org.springframework.amqp.rabbit.annotation.RabbitListener;
// public void onMessage(String message) throws Exception { import org.springframework.beans.factory.annotation.Autowired;
// log.info("处理订单状态由已挂单变为挂弹中监听器执行,订单ID为{}", message); import org.springframework.stereotype.Component;
// if (StringUtils.isBlank(message)) { import org.springframework.transaction.annotation.Transactional;
// return;
// } @Component
// OrderInfo orderInfo = orderInfoDao.getByOrderNo(message); @Slf4j
// if (orderInfo == null) { public class OrderGoodsDriverTruckListener {
// log.info("处理订单状态由已挂单变为挂弹中监听器未查询到订单数据,消息为{}", message);
// return;
// } @Autowired
// if (OrderEnum.Status.POST_ORDER.getCode().equals(orderInfo.getOrderStatus())) { private OrderGoodsDriverTruckDao orderGoodsDriverTruckDao;
// log.info("处理订单状态由已挂单变为挂单中监听器执行,从状态{}-----变更为{}", OrderEnum.Status.POST_ORDER.getName(), OrderEnum.Status.ON_ORDER.getName());
// orderInfoDao.updateOrderStatusById(orderInfo.getId(), OrderEnum.Status.ON_ORDER.getCode()); @RabbitListener(queues = RabbitKeyConstants.ORDER_GOODS_SYNC_TRUCK_DRIVER_INFO_QUEUE)
// } @Transactional(rollbackFor = Exception.class)
// } public void onMessage(Message message) throws Exception {
//} log.info("处理货单定向司机表,数据为{}", message);
JSONArray jsonArray = JSONUtil.parseArray(new String(message.getBody()));
if (jsonArray.isEmpty()) {
log.info("处理货单定向司机表,数据为空,不处理");
return;
}
for (Object o : jsonArray) {
JSONObject jsonObject = (JSONObject) o;
Object driverUserNo = jsonObject.getByPath("driverUserNo");
Object operateType = jsonObject.getByPath("operateType");
Object driverName = jsonObject.getByPath("driverName");
Object truckNo = jsonObject.getByPath("truckNo");
Object driverMobile = jsonObject.getByPath("driverMobile");
switch (operateType.toString()) {
case "1":
OrderGoodsDriverTruck driverTruck = new OrderGoodsDriverTruck();
driverTruck.setTruckNo(truckNo == null ? "" : truckNo.toString());
driverTruck.setDriverMobile(driverMobile == null ? "" : driverMobile.toString());
driverTruck.setDriverName(driverName == null ? "" : driverName.toString());
driverTruck.setDriverUserNo(driverUserNo == null ? null : Long.valueOf(driverUserNo.toString()));
orderGoodsDriverTruckDao.saveEntity(driverTruck);
log.info("处理货单定向司机表:执行插入");
break;
case "2":
if (truckNo == null || driverUserNo == null) {
break;
}
orderGoodsDriverTruckDao.deleteByTruckNoAndDriverUserNo(truckNo.toString(), driverUserNo.toString());
log.info("处理货单定向司机表:执行删除");
break;
default:
break;
}
}
}
}
...@@ -26,14 +26,6 @@ public class OrderGoodsDriverTruck implements HasKey<Integer> { ...@@ -26,14 +26,6 @@ public class OrderGoodsDriverTruck implements HasKey<Integer> {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
@TableField("order_no")
@ApiModelProperty("订单编号")
private String orderNo;
@TableField("order_goods_no")
@ApiModelProperty("货单编号")
private String orderGoodsNo;
@TableField("truck_id") @TableField("truck_id")
@ApiModelProperty("车辆ID") @ApiModelProperty("车辆ID")
private Integer truckId; private Integer truckId;
...@@ -42,9 +34,17 @@ public class OrderGoodsDriverTruck implements HasKey<Integer> { ...@@ -42,9 +34,17 @@ public class OrderGoodsDriverTruck implements HasKey<Integer> {
@ApiModelProperty("车牌号") @ApiModelProperty("车牌号")
private String truckNo; private String truckNo;
@TableField("order_user_no") @TableField("driver_user_no")
@ApiModelProperty("接单人用户编号") @ApiModelProperty("司机用户编号")
private Long orderUserNo; private Long driverUserNo;
@TableField("driver_name")
@ApiModelProperty(value = "司机名称")
private String driverName;
@TableField("driver_mobile")
@ApiModelProperty("司机手机号")
private String driverMobile;
@TableField("create_time") @TableField("create_time")
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
...@@ -54,6 +54,7 @@ public class OrderGoodsDriverTruck implements HasKey<Integer> { ...@@ -54,6 +54,7 @@ public class OrderGoodsDriverTruck implements HasKey<Integer> {
@ApiModelProperty("修改时间") @ApiModelProperty("修改时间")
private LocalDateTime modifiedTime; private LocalDateTime modifiedTime;
@Override @Override
@KeyColumn("id") @KeyColumn("id")
public Integer gainKey() { public Integer gainKey() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论