This commit is contained in:
Vinjor 2024-10-25 18:51:37 +08:00
commit f3e4ba39d1
3 changed files with 50 additions and 3 deletions

View File

@ -9,6 +9,8 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
@ -38,6 +40,8 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* 请填写功能名称Service业务层处理
*
@ -68,7 +72,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
private IDelOrderInfoService delInspectionOrderService;
@Autowired
private IDelInspectionInfoService delInspectionInfoService;
@Resource
private CustomerMainService customerMainService;
/**
* 查询请填写功能名称
*
@ -195,6 +200,12 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
customerInfo.setCustomerName(user.getNickname());
customerInfo.setSex("0");
customerInfo.setUserAge(user.getUserAge());
// 设置客户来源
CustomerMain customerMain = new CustomerMain();
customerMain.setDataFrom("01");
customerMainService.saveOrUpdate(customerMain);
customerInfoService.insertPartnerCustomerInfo(customerInfo);
}
//追加订单明细记录

View File

@ -248,7 +248,7 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
customerMain.setIsHangAccount("0");
customerMain.setTypeCode("01");
// 设置客户初始来源
customerMain.setDataFrom("01");
//customerMain.setDataFrom("01");
// 设置注册方式
customerMain.setInviterType("01");

View File

@ -3,9 +3,14 @@ package cn.iocoder.yudao.module.rescue.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.CoordinateUtil;
import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
import cn.iocoder.yudao.module.rescue.domain.*;
import cn.iocoder.yudao.module.rescue.mapper.RescueDriverInfoMapper;
import cn.iocoder.yudao.module.rescue.utils.RedissonDelayQueue;
import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
@ -72,6 +77,10 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
private WechatPayConfig wechatPayConfig;
@Resource
private RedissonDelayQueue redissonDelayQueue;
@Autowired
private IPartnerCustomerInfoService customerInfoService;
@Resource
private CustomerMainService customerMainService;
public static String Redis_Driver_Key = "Rescue:Driver:";
public static String Redis_Driver_Position_Key = "DriverPosition:";
@ -581,6 +590,33 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
//处理redis
DriverInfo driverInfo = driverInfoService.getById(rescueInfo.getDriverId());
AdminUserRespDTO user = userService.getUser(driverInfo.getUserId());
// 收集客户信息
PartnerCustomerInfo customerInfo = new PartnerCustomerInfo();
customerInfo.setCustomerName(rescueInfo.getConnectionName());
customerInfo.setCustomerPhone(rescueInfo.getConnectionPhone());
customerInfo.setUserId(rescueInfo.getUserId());
// 收集客户车辆信息
List<ShopUserCar> userCarList = new ArrayList<>();
ShopUserCar userCar = new ShopUserCar();
userCar.setCarNo(rescueInfo.getLicenseNum());
userCar.setCarModel(rescueInfo.getCarType());
userCar.setCarBrand(rescueInfo.getCarBrand());
userCar.setUserId(user.getId());
userCarList.add(userCar);
customerInfo.setUserCarList(userCarList);
// 设置客户来源
CustomerMain customerMain = new CustomerMain();
customerMain.setDataFrom("02");
customerMainService.saveOrUpdate(customerMain);
// 调用插入客户信息的方法
customerInfoService.insertPartnerCustomerInfo(customerInfo);
//所在顶级机构
String redisKey = Redis_Driver_Key + driverInfo.getTenantId() + ":" + rescueInfo.getDriverId();
Object temp = redisCache.getCacheMapValue(redisKey, "rescueIds");
@ -588,7 +624,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;