|
@@ -4,11 +4,22 @@ import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.pj.api.client.level_one_server.LevelOneServerInterface;
|
|
|
+import com.pj.api.dto.OrderDto;
|
|
|
+import com.pj.common.core.exception.ServiceException;
|
|
|
+import com.pj.current.dto.APPLoginUserInfo;
|
|
|
+import com.pj.current.satoken.StpAPPUserUtil;
|
|
|
+import com.pj.enummj.DeleteStatus;
|
|
|
import com.pj.project.tb_driver.TbDriver;
|
|
|
+import com.pj.project.tb_driver.TbDriverMapper;
|
|
|
+import com.pj.project.tb_vehicle.param.DriverResultParam;
|
|
|
+import com.pj.project.tb_vehicle.vo.TbVehicleVo;
|
|
|
+import com.pj.retry.SmsRetryService;
|
|
|
import com.pj.utils.so.SoMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
@@ -19,7 +30,6 @@ import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import com.pj.utils.sg.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.swing.filechooser.FileSystemView;
|
|
@@ -39,8 +49,18 @@ public class TbVehicleService extends ServiceImpl<TbVehicleMapper, TbVehicle> im
|
|
|
@Autowired
|
|
|
private MethodVehicleService methodVehicleService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TbDriverMapper tbDriverMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SmsRetryService smsRetryService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private LevelOneServerInterface levelOneServerInterface;
|
|
|
+
|
|
|
/** 增 */
|
|
|
void add(TbVehicle t){
|
|
|
+ t.setCreateTime(new Date());
|
|
|
save(t);
|
|
|
}
|
|
|
|
|
@@ -51,6 +71,7 @@ public class TbVehicleService extends ServiceImpl<TbVehicleMapper, TbVehicle> im
|
|
|
|
|
|
/** 改 */
|
|
|
void update(TbVehicle t){
|
|
|
+ t.setUpdateTime(new Date());
|
|
|
updateById(t);
|
|
|
|
|
|
}
|
|
@@ -69,9 +90,9 @@ public class TbVehicleService extends ServiceImpl<TbVehicleMapper, TbVehicle> im
|
|
|
TbVehicle getByVehiclePlate(String vehiclePlate) {
|
|
|
|
|
|
TbVehicle tbVehicle = tbVehicleMapper.selectOne(new LambdaQueryWrapper<TbVehicle>()
|
|
|
- .eq(TbVehicle::getVehiclePlate, vehiclePlate) //车牌号
|
|
|
+ .like(TbVehicle::getVehiclePlate, vehiclePlate) //车牌号
|
|
|
.eq(TbVehicle::getVehicleStatus, 1)//车辆状态:1=空闲
|
|
|
- .eq(TbVehicle::getDeleteStatus, 1));
|
|
|
+ .eq(TbVehicle::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode()));
|
|
|
return tbVehicle;
|
|
|
}
|
|
|
|
|
@@ -90,6 +111,75 @@ public class TbVehicleService extends ServiceImpl<TbVehicleMapper, TbVehicle> im
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 商户确定车辆后执行通知司机
|
|
|
+ * @param driverId tb_driver 表ID
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public OrderDto informDriver(Long driverId,Long levelOneOrderId) throws Exception {
|
|
|
+ //通过driverId查询司机表
|
|
|
+ TbDriver tbDriver = tbDriverMapper.selectById(driverId);
|
|
|
+ if(tbDriver == null)throw new ServiceException("司机信息有误!");
|
|
|
+ //获取司机号码
|
|
|
+ String phone = tbDriver.getPhone();
|
|
|
+ //todo: 执行通知
|
|
|
+// boolean smsMsg = smsRetryService.sendSmsMsg(phone);
|
|
|
+ //发送订单内容
|
|
|
+ OrderDto orderDto = levelOneServerInterface.rpcGetById(levelOneOrderId);
|
|
|
+ if(orderDto == null)throw new ServiceException("未知异常!");
|
|
|
+ return orderDto;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 司机处理订单,同意
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean driverAgree(DriverResultParam driverResultParam){
|
|
|
+ //获取当前登录人
|
|
|
+ APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
|
|
|
+
|
|
|
+ boolean agree = methodVehicleService.agree(appLoginInfo, driverResultParam);
|
|
|
+
|
|
|
+ return agree;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 司机处理订单,拒绝
|
|
|
+ * @param purchaserPhone 收购商电话
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean driverRefuse(String purchaserPhone) throws Exception {
|
|
|
+
|
|
|
+ //todo:司机拒绝,发送通知短信给收购商
|
|
|
+// smsRetryService.sendSmsMsg(purchaserPhone);
|
|
|
+
|
|
|
+ return false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 导入
|