完成投放接口
This commit is contained in:
parent
1b5086afc4
commit
0ac0976ecf
@ -24,10 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import static com.cdzy.ebikemaintenance.model.pojo.table.EbikeBatteryInfoTableDef.EBIKE_BATTERY_INFO;
|
||||
import static com.cdzy.ebikemaintenance.model.pojo.table.EbikeHelmetInfoTableDef.EBIKE_HELMET_INFO;
|
||||
@ -823,8 +820,17 @@ public class EbikeBikeInfoController {
|
||||
public JsonResult<?> updateVehicleStatus(@RequestBody ReqVehicleStatusUpdateDto request) {
|
||||
// 调用服务层方法,执行车辆状态修改操作
|
||||
return ebikeBikeInfoService.updateVehicleStatus(request);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* 完成投放
|
||||
*
|
||||
* @param request 完成投放请求参数 orderId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("completeDeployment")
|
||||
public JsonResult<?> completeDeployment(@RequestBody Map<String,Object> request) {
|
||||
// 调用服务层方法,执行完成投放操作
|
||||
return ebikeBikeInfoService.completeDeployment(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 车辆基本信息 服务层。
|
||||
@ -278,4 +279,13 @@ public interface EbikeBikeInfoService extends IService<EbikeBikeInfo> {
|
||||
* @return
|
||||
*/
|
||||
JsonResult<?> updateVehicleStatus(ReqVehicleStatusUpdateDto queryParam);
|
||||
|
||||
|
||||
/**
|
||||
* 完成投放
|
||||
*
|
||||
* @param param 完成投放请求参数 orderId
|
||||
* @return
|
||||
*/
|
||||
JsonResult<?> completeDeployment(Map<String,Object> param);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.cdzy.ebikemaintenance.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cdzy.common.enums.Code;
|
||||
import com.cdzy.common.model.CoreResult;
|
||||
@ -1334,6 +1335,37 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
} else {
|
||||
return JsonResult.failed("车辆状态修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成投放
|
||||
*
|
||||
* @param param 完成投放请求参数 orderId
|
||||
* @return
|
||||
*/
|
||||
public JsonResult<?> completeDeployment(Map<String,Object> param) {
|
||||
|
||||
String orderId = MapUtil.getStr(param, "orderId");
|
||||
//根据orderId 完成订单
|
||||
EbikeBikeOrder ebikeBikeOrder = new EbikeBikeOrder();
|
||||
ebikeBikeOrder.setOrderId(orderId);
|
||||
ebikeBikeOrder.setHandleState("1");
|
||||
ebikeBikeOrder.setUpdatedAt(LocalDateTime.now());
|
||||
ebikeBikeOrderMapper.update(ebikeBikeOrder);
|
||||
|
||||
//根据订单ID 查出需要投放的车辆 进行修改状态
|
||||
QueryWrapper query = QueryWrapper.create();
|
||||
query.eq("order_id",orderId);
|
||||
List<EbikeDispatchRecords> ebikeDispatchRecords = ebikeDispatchRecordsMapper.selectListByQuery(query);
|
||||
for (EbikeDispatchRecords ebikeDispatchRecord : ebikeDispatchRecords) {
|
||||
ebikeDispatchRecord.setDispatchState("1");
|
||||
ebikeDispatchRecordsMapper.update(ebikeDispatchRecord);
|
||||
ReqVehicleStatusUpdateDto reqVehicleStatusUpdateDto = new ReqVehicleStatusUpdateDto();
|
||||
reqVehicleStatusUpdateDto.setBikeCode(ebikeDispatchRecord.getBikeCode());
|
||||
reqVehicleStatusUpdateDto.setState("2");
|
||||
updateVehicleStatus(reqVehicleStatusUpdateDto);
|
||||
}
|
||||
|
||||
return JsonResult.success("投放成功");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user