package com.xiaopeng.maintenance.controller;
|
|
|
import com.xiaopeng.api.feignClient.account.XpOperationUserClient;
|
import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient;
|
import com.xiaopeng.common.core.domain.R;
|
import com.xiaopeng.common.security.service.TokenService;
|
import com.xiaopeng.maintenance.dto.XpVehicleCleanDTO;
|
import com.xiaopeng.maintenance.model.vo.XpVehicleCleanVO;
|
import com.xiaopeng.maintenance.service.IXpVehicleCleanService;
|
import com.xiaopeng.maintenance.service.XpTaskService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.apache.shardingsphere.transaction.annotation.ShardingSphereTransactionType;
|
import org.apache.shardingsphere.transaction.core.TransactionType;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* <p>
|
* 车辆清洁 前端控制器
|
* </p>
|
*
|
* @author xiaochen
|
* @since 2026-02-06
|
*/
|
@Api(tags = "车辆清洁")
|
@RestController
|
@RequestMapping("")
|
public class XpVehicleCleanController {
|
|
@Autowired
|
private IXpVehicleCleanService xpVehicleCleanService;
|
@Autowired
|
private XpVehicleClient xpVehicleClient;
|
@Autowired
|
private XpOperationUserClient xpOperationUserClient;
|
|
@Autowired
|
private XpTaskService xpTaskService;
|
@Autowired
|
private TokenService tokenService;
|
@Autowired
|
private ThreadPoolTaskScheduler taskScheduler;
|
|
/**
|
* 车辆运维-车辆运维-车身清洁
|
*/
|
@Transactional
|
@ShardingSphereTransactionType(TransactionType.BASE)
|
@ApiOperation(value = "车辆运维-车辆运维-车身清洁", tags = {"运维APP-车辆管理"})
|
@PostMapping("/api/v1/vehicleClean/add")
|
public R<String> add(@RequestBody XpVehicleCleanDTO dto) {
|
Long id = tokenService.getLoginOperationUser().getId();
|
dto.setOperationsUserId(id);
|
xpVehicleCleanService.save(dto);
|
// 处理任务状态
|
xpTaskService.updateTaskStatus(dto.getTaskId(), 2, id);
|
return R.ok();
|
}
|
|
/**
|
* 车辆运维-车辆运维-清洁记录详情
|
*/
|
@ApiOperation(value = "车辆运维-运维记录-清洁记录详情", tags = {"运维APP-车辆管理"})
|
@GetMapping("/api/v1/vehicleClean/cleanDetail")
|
public R<XpVehicleCleanVO> cleanDetail(@RequestParam Long id) {
|
XpVehicleCleanVO xpVehicleCleanVO = xpVehicleCleanService.cleanDetail(id);
|
return R.ok(xpVehicleCleanVO);
|
}
|
|
}
|