Merge branch 'repair' of http://122.51.230.86:3000/dianliang/lanan-system into repair
This commit is contained in:
commit
fecc6bb4da
@ -81,9 +81,8 @@ public class CustomerMainController {
|
||||
|
||||
@PostMapping("/saveCustomerAndCar")
|
||||
@Operation(summary = "保存客户及车辆信息")
|
||||
public CommonResult<Boolean> saveCustomerAndCar(@RequestBody CustomerMainSaveReqVO saveReqVO) throws Exception {
|
||||
customerCarService.saveCustomerAndCar(saveReqVO);
|
||||
return success(true);
|
||||
public CommonResult<?> saveCustomerAndCar(@RequestBody CustomerMainSaveReqVO saveReqVO) throws Exception {
|
||||
return CommonResult.success(customerCarService.saveCustomerAndCar(saveReqVO));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,5 +100,14 @@ public interface CarMainService extends IService<CarMain> {
|
||||
**/
|
||||
CarMainRespVO compute(CarMainReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 根据客户信息+车牌号查这个客户是否已有这个车
|
||||
* @author vinjor-M
|
||||
* @date 14:41 2024/11/13
|
||||
* @param userId 用户id
|
||||
* @param carNumber 车牌号
|
||||
* @return cn.iocoder.yudao.module.custom.entity.CarMain
|
||||
**/
|
||||
CarMain selectByUserIdAndCarNumber(Long userId,String carNumber);
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 客户车辆管理关联Service 接口
|
||||
@ -34,5 +35,5 @@ public interface CustomerCarService extends IService<CustomerCar> {
|
||||
* @param saveReqVO CustomerMainSaveReqVO
|
||||
* @return void
|
||||
**/
|
||||
void saveCustomerAndCar(CustomerMainSaveReqVO saveReqVO) throws Exception;
|
||||
Map<String,String> saveCustomerAndCar(CustomerMainSaveReqVO saveReqVO) throws Exception;
|
||||
}
|
@ -309,6 +309,28 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
|
||||
return respVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户信息+车牌号查这个客户是否已有这个车
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param carNumber 车牌号
|
||||
* @return cn.iocoder.yudao.module.custom.entity.CarMain
|
||||
* @author vinjor-M
|
||||
* @date 14:41 2024/11/13
|
||||
**/
|
||||
@Override
|
||||
public CarMain selectByUserIdAndCarNumber(Long userId, String carNumber) {
|
||||
LambdaQueryWrapper<CarMain> queryWrapper = new LambdaQueryWrapper<CarMain>()
|
||||
.eq(CarMain::getUserId,userId)
|
||||
.eq(CarMain::getLicenseNumber,carNumber);
|
||||
List<CarMain> rtnList = this.list(queryWrapper);
|
||||
if(rtnList.isEmpty()){
|
||||
return null;
|
||||
}else{
|
||||
return rtnList.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据品牌型号获取保养规则
|
||||
*
|
||||
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.custom.service.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
@ -23,7 +25,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.*;
|
||||
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS;
|
||||
@ -93,13 +97,16 @@ public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, Custo
|
||||
* @date 15:51 2024/11/12
|
||||
**/
|
||||
@Override
|
||||
public void saveCustomerAndCar(CustomerMainSaveReqVO saveReqVO) throws Exception {
|
||||
public Map<String,String> saveCustomerAndCar(CustomerMainSaveReqVO saveReqVO) throws Exception {
|
||||
Map<String,String> rtnMap = new HashMap<>();
|
||||
chekData(saveReqVO);
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
saveReqVO.getCar().setLicenseNumber(saveReqVO.getCar().getLicenseNumber().toUpperCase());
|
||||
//用户信息
|
||||
AdminUserRespDTO userDTO = adminUserApi.getUserByUsername(saveReqVO.getPhoneNumber());
|
||||
UserDTO user = BeanUtils.toBean(userDTO, UserDTO.class);
|
||||
if (null == userDTO){
|
||||
user = new UserDTO();
|
||||
//客户信息不存在,直接新增客户、新增车辆及绑定关系
|
||||
UserDTO user = new UserDTO();
|
||||
//如果不存在创建用户;
|
||||
user.setUsername(saveReqVO.getPhoneNumber());
|
||||
user.setNickname(saveReqVO.getCusName());
|
||||
@ -107,24 +114,60 @@ public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, Custo
|
||||
user.setPassword(PASSWORD_DEFAULT);
|
||||
user.setMobile(saveReqVO.getPhoneNumber());
|
||||
user.setUserType(USER_TYPE_CUS);
|
||||
//创建客户
|
||||
user.setTenantId(loginUser.getTenantId());
|
||||
//创建用户
|
||||
Long userId = adminUserApi.createUser(user);
|
||||
saveReqVO.setUserId(userId);
|
||||
//创建客户信息
|
||||
CustomerMain customerMain = BeanUtils.toBean(saveReqVO,CustomerMain.class);
|
||||
customerMain.setId(null);
|
||||
customerMain.setDataFrom("02");
|
||||
customerMainService.save(customerMain);
|
||||
//创建车辆信息
|
||||
CarMain carMain = saveReqVO.getCar();
|
||||
carMain.setUserId(userId);
|
||||
carMainService.save(carMain);
|
||||
//客户和车的关联关系
|
||||
CustomerCar customerCar = new CustomerCar();
|
||||
customerCar.setCusId(customerMain.getId());
|
||||
customerCar.setCarId(carMain.getId());
|
||||
//默认车主
|
||||
customerCar.setIsOwner("1");
|
||||
this.save(customerCar);
|
||||
rtnMap.put("userId",userId.toString());
|
||||
rtnMap.put("carId",carMain.getId());
|
||||
} else {
|
||||
saveReqVO.setUserId(user.getId());
|
||||
//已有 用户
|
||||
Long userId = userDTO.getId();
|
||||
saveReqVO.setUserId(userId);
|
||||
//查是否存在客户信息
|
||||
CustomerMain customerMain = customerMainService.getCustomerByUserId(userId);
|
||||
if(null==customerMain){
|
||||
//不存在客户信息,新增客户
|
||||
customerMain = BeanUtils.toBean(saveReqVO,CustomerMain.class);
|
||||
customerMain.setId(null);
|
||||
customerMain.setDataFrom("02");
|
||||
customerMainService.save(customerMain);
|
||||
}
|
||||
//根据客户信息+车牌号查这个客户是否已有这个车
|
||||
CarMain carMain = carMainService.selectByUserIdAndCarNumber(userId,saveReqVO.getCar().getLicenseNumber());
|
||||
if(null==carMain){
|
||||
//这个客户不存在这个车辆信息,新增
|
||||
carMain = saveReqVO.getCar();
|
||||
carMain.setUserId(userId);
|
||||
carMainService.save(carMain);
|
||||
//客户和车的关联关系
|
||||
CustomerCar customerCar = new CustomerCar();
|
||||
customerCar.setCusId(customerMain.getId());
|
||||
customerCar.setCarId(carMain.getId());
|
||||
//默认车主
|
||||
customerCar.setIsOwner("1");
|
||||
this.save(customerCar);
|
||||
}
|
||||
rtnMap.put("userId",userId.toString());
|
||||
rtnMap.put("carId",carMain.getId());
|
||||
}
|
||||
//客户信息
|
||||
CustomerMain customerMain = BeanUtils.toBean(saveReqVO,CustomerMain.class);
|
||||
customerMain.setDataFrom("02");
|
||||
//车辆信息
|
||||
CarMain carMain = saveReqVO.getCar();
|
||||
customerMainService.save(customerMain);
|
||||
carMainService.save(carMain);
|
||||
//关联关系
|
||||
CustomerCar customerCar = new CustomerCar();
|
||||
customerCar.setCusId(customerMain.getId());
|
||||
customerCar.setCarId(carMain.getId());
|
||||
save(customerCar);
|
||||
return rtnMap;
|
||||
}
|
||||
|
||||
private void chekData(CustomerMainSaveReqVO saveReqVO) throws Exception {
|
||||
@ -140,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("车辆品牌不能为空");
|
||||
}
|
||||
}
|
||||
}
|
@ -76,6 +76,9 @@ public enum RecordTypeEnum {
|
||||
/** 删除工单 */
|
||||
SCGG("scgg", "删除工单"),
|
||||
|
||||
/** 删除工单 */
|
||||
JC("jc", "交车"),
|
||||
|
||||
/** 内返派工 */
|
||||
NFPG("nfpg", "内返派工");
|
||||
|
||||
|
@ -27,6 +27,10 @@ public enum TicketsStatusEnum {
|
||||
* 待通知客户取车
|
||||
*/
|
||||
WAITING_NOTICE("07","待通知客户取车"),
|
||||
/**
|
||||
* 已交车
|
||||
*/
|
||||
OVER("08","已交车"),
|
||||
/**
|
||||
* 挂单/记账
|
||||
*/
|
||||
|
@ -297,6 +297,19 @@ public class DlRepairTicketsController {
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务顾问交车
|
||||
* @author vinjor-M
|
||||
* @date 16:51 2024/11/13
|
||||
* @param respVO
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@PostMapping("/overOrder")
|
||||
@Operation(summary = "服务顾问交车")
|
||||
public CommonResult<?> overOrder(@RequestBody DlRepairTicketsRespVO respVO) {
|
||||
dlRepairTicketsService.overOrder(respVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
/**
|
||||
* 从总检的角度差维修中、已完成的工单数量
|
||||
* @author vinjor-M
|
||||
|
@ -235,4 +235,12 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param id 工单ID
|
||||
**/
|
||||
void removeTicketById(String id);
|
||||
|
||||
/**
|
||||
* 服务顾问交车
|
||||
* @author vinjor-M
|
||||
* @date 16:51 2024/11/13
|
||||
* @param respVO
|
||||
**/
|
||||
void overOrder(DlRepairTicketsRespVO respVO);
|
||||
}
|
||||
|
@ -1691,6 +1691,28 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 记录操作日志
|
||||
repairRecordsService.saveRepairRecord(id, null, RecordTypeEnum.SCGG.getCode(), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务顾问交车
|
||||
*
|
||||
* @param respVO
|
||||
* @author vinjor-M
|
||||
* @date 16:51 2024/11/13
|
||||
**/
|
||||
@Override
|
||||
public void overOrder(DlRepairTicketsRespVO respVO) {
|
||||
// 更新工单状态
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode())
|
||||
.set(DlRepairTickets::getTicketsStatus, TicketsStatusEnum.OVER.getCode())
|
||||
//交车时才能把工单置为完成
|
||||
.set(DlRepairTickets::getIsFinish,"1")
|
||||
.eq(DlRepairTickets::getId, respVO.getId())
|
||||
);
|
||||
|
||||
// 记录日志
|
||||
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JC.getCode(), respVO.getRemark(), respVO.getImage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -216,7 +216,7 @@
|
||||
from dl_repair_tickets drt
|
||||
left join dl_repair_titem drti
|
||||
on drt.id = drti.ticket_id AND drti.deleted = '0'
|
||||
where (drt.deleted = '0') AND drt.tickets_status IN ('04','05','01','07')
|
||||
where (drt.deleted = '0') AND drt.tickets_status IN ('04','05','01','07','06','02')
|
||||
<if test="map.ticketNo != null and map.ticketNo != ''">
|
||||
and (
|
||||
drt.ticket_no like concat('%', #{map.ticketNo}, '%')
|
||||
@ -255,10 +255,11 @@
|
||||
)
|
||||
</when>
|
||||
<otherwise>
|
||||
-- 服务顾问和仓管查待办都是查未结束的工单 --
|
||||
AND drt.is_finish = '0'
|
||||
<if test="map.adviserId != null and map.adviserId != ''">
|
||||
-- 查服务顾问 待处理的 工单未完成并且服务顾问是自己的 工单已完成且当前处理人是自己的--
|
||||
AND ( drt.is_finish = '0' AND drt.adviser_id = #{map.adviserId} )
|
||||
OR (drt.is_finish = '1' AND drt.now_repair_id = #{map.adviserId})
|
||||
-- 查服务顾问 当前处理人或服务顾问是自己的--
|
||||
AND ( drt.adviser_id = #{map.adviserId} OR drt.now_repair_id = #{map.adviserId})
|
||||
</if>
|
||||
<if test="map.userIds != null and map.userIds.size > 0">
|
||||
-- 查总检待处理的 --
|
||||
|
@ -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());
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.system.api.user.dto;
|
||||
|
||||
import cn.iocoder.yudao.module.system.enums.common.SexEnum;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ -51,5 +50,9 @@ public class UserDTO {
|
||||
* 用户openId
|
||||
**/
|
||||
private String openId;
|
||||
/**
|
||||
* 用户openId
|
||||
**/
|
||||
private Long tenantId;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user