This commit is contained in:
许允枞 2024-11-13 16:14:32 +08:00
parent 407c7c20c1
commit 95157aa43f
2 changed files with 29 additions and 12 deletions

View File

@ -183,8 +183,5 @@ public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, Custo
if (StringUtils.isEmpty(saveReqVO.getCar().getLicenseNumber())){
throw new Exception("车牌号不能为空");
}
if (StringUtils.isEmpty(saveReqVO.getCar().getCarBrand())){
throw new Exception("车辆品牌不能为空");
}
}
}

View File

@ -1,10 +1,14 @@
package cn.iocoder.yudao.module.rescue.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.CoordinateUtil;
import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
import cn.iocoder.yudao.module.rescue.domain.*;
@ -48,7 +52,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
* @date 2023-07-18
*/
@Service
public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMapper, RescueDriverInfo> implements IRescueDriverInfoService {
public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMapper, RescueDriverInfo> implements IRescueDriverInfoService {
@Autowired
private AdminUserApi userService;
@Autowired
@ -81,6 +85,8 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
private IPartnerCustomerInfoService customerInfoService;
@Resource
private CustomerMainService customerMainService;
@Autowired
private CustomerCarService customerCarService;
public static String Redis_Driver_Key = "Rescue:Driver:";
public static String Redis_Driver_Position_Key = "DriverPosition:";
@ -326,7 +332,7 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
rescueInfo.setDriverPhoneNum(driverInfo.getPhonenumber());
rescueInfo.setDriverCarNum(carInfo.getRescueCarNum());
} else {
throw exception0(500,"请联系管理员维护车辆信息开始接单");
throw exception0(500, "请联系管理员维护车辆信息开始接单");
}
//状态修改为救援中
rescueInfo.setRescueStatus("3");
@ -419,7 +425,7 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
queryWrapper2.eq(RescueOrderInfo::getRescueInfoId, rescueId);
RescueOrderInfo orderInfo = rescueOrderInfoService.getOne(queryWrapper2);
//为了避免微信通知不到的情况在此进行主动查询的功能
if (null!=orderInfo && StringUtils.isNotEmpty(orderInfo.getOrderStatus()) && orderInfo.getOrderStatus().equals("1")) {
if (null != orderInfo && StringUtils.isNotEmpty(orderInfo.getOrderStatus()) && orderInfo.getOrderStatus().equals("1")) {
try {
//待支付的情况下进行主动查询
String resStr = wechatPayRequest.wechatHttpGet("https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/" + orderInfo.getOrderNo() + "?mchid=" + wechatPayConfig.getMchId());
@ -585,12 +591,27 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
detailService.save(rescueInfoDetail);
rescueInfo.setRescueStatus("5");
rescueInfoService.updateById(rescueInfo);
/** 将车辆推送到维修中*/
CustomerMainSaveReqVO saveReqVO = new CustomerMainSaveReqVO();
// 绑定用户id
saveReqVO.setUserId(rescueInfo.getUserId());
// 绑定用户手机号
saveReqVO.setPhoneNumber(rescueInfo.getConnectionPhone());
// 客户名称
saveReqVO.setCusName(rescueInfo.getConnectionName());
// 车辆信息
CarMain carMain = new CarMain();
carMain.setCarLicenseImg(rescueInfo.getLicenseNum());
saveReqVO.setCar(carMain);
//推送到维修中
customerCarService.saveCustomerAndCar(saveReqVO);
//处理司机状态
//查询司机是否还存在未结束的救援订单
//处理redis
DriverInfo driverInfo = driverInfoService.getById(rescueInfo.getDriverId());
AdminUserRespDTO user = userService.getUser(driverInfo.getUserId());
try{
try {
// 收集客户信息
PartnerCustomerInfo customerInfo = new PartnerCustomerInfo();
customerInfo.setCustomerName(rescueInfo.getConnectionName());
@ -615,12 +636,11 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
// 调用插入客户信息的方法
customerInfoService.insertPartnerCustomerInfo(customerInfo);
}catch (Exception ignored){
} catch (Exception ignored) {
}
//所在顶级机构
String redisKey = Redis_Driver_Key + driverInfo.getTenantId() + ":" + rescueInfo.getDriverId();
Object temp = redisCache.getCacheMapValue(redisKey, "rescueIds");
@ -628,7 +648,7 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
String s = temp.toString();
if (StringUtils.isNotEmpty(s)) {
String resStr = "";
String[] rescueIds = temp.toString().split(",");
String[] rescueIds = temp.toString().split(",");
for (String tmp : rescueIds) {
if (!tmp.equals(rescueId.toString())) {
resStr = resStr + "," + tmp;
@ -686,7 +706,7 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
}
@Override
public IPage<RescueInfo> driverRescueList2(Long id, Page<RescueInfo> page){
public IPage<RescueInfo> driverRescueList2(Long id, Page<RescueInfo> page) {
IPage<RescueInfo> rescueInfos = baseMapper.driverRescueList2(id, page);
for (RescueInfo rescueInfo : rescueInfos.getRecords()) {
String dljy_type = dictDataService.getDictDataLabel("dljy_type", rescueInfo.getRescueType());
@ -698,7 +718,7 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
}
@Override
public IPage<RescueInfo> driverRescuePage2(RescueInfo rescueInfo, Page<RescueInfo> page){
public IPage<RescueInfo> driverRescuePage2(RescueInfo rescueInfo, Page<RescueInfo> page) {
IPage<RescueInfo> rescueInfos = baseMapper.driverRescuePage2(rescueInfo, page);
for (RescueInfo it : rescueInfos.getRecords()) {
String dljy_type = dictDataService.getDictDataLabel("dljy_type", it.getRescueType());