Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
c05b90d4d9
@ -0,0 +1,13 @@
|
|||||||
|
package com.cdzy.ebikemaintenance.enums;
|
||||||
|
|
||||||
|
public interface EbikeStatus {
|
||||||
|
String WAITING_FOR_SHIPMENT = "0"; // 待出库
|
||||||
|
String SHIPPED_WAITING_TO_BE_DELIVERED = "1"; // 已出库,待投放
|
||||||
|
String WAITING_TO_USE = "2"; // 待使用
|
||||||
|
String RIDING = "3"; // 骑行中
|
||||||
|
String WAITING_FOR_REPAIR = "4"; // 待维修
|
||||||
|
String REPAIRING = "5"; // 维修中
|
||||||
|
String SCRAPPED = "6"; // 报废
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -11,6 +11,7 @@ import com.cdzy.common.model.PageParam;
|
|||||||
import com.cdzy.common.model.ResGPSDto;
|
import com.cdzy.common.model.ResGPSDto;
|
||||||
import com.cdzy.common.utils.CoordinateUtil;
|
import com.cdzy.common.utils.CoordinateUtil;
|
||||||
import com.cdzy.ebikemaintenance.controller.EbikeInfoCoreController;
|
import com.cdzy.ebikemaintenance.controller.EbikeInfoCoreController;
|
||||||
|
import com.cdzy.ebikemaintenance.enums.EbikeStatus;
|
||||||
import com.cdzy.ebikemaintenance.mapper.*;
|
import com.cdzy.ebikemaintenance.mapper.*;
|
||||||
import com.cdzy.ebikemaintenance.model.dto.request.*;
|
import com.cdzy.ebikemaintenance.model.dto.request.*;
|
||||||
import com.cdzy.ebikemaintenance.model.dto.response.*;
|
import com.cdzy.ebikemaintenance.model.dto.response.*;
|
||||||
@ -411,6 +412,14 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
if (!ebikeBikeFaultReportFiles.isEmpty()) {
|
if (!ebikeBikeFaultReportFiles.isEmpty()) {
|
||||||
ebikeBikeFaultReportFileMapper.insertBatch(ebikeBikeFaultReportFiles);
|
ebikeBikeFaultReportFileMapper.insertBatch(ebikeBikeFaultReportFiles);
|
||||||
}
|
}
|
||||||
|
//上报故障成功后 更新车辆信息表状态
|
||||||
|
//根据车辆编号查出车辆信息
|
||||||
|
String currentStatus = EbikeStatus.WAITING_FOR_REPAIR; // 获取当前状态为“待维修”
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
|
queryWrapper.eq("bike_code", ebikeBikeFaultReport.getBikeCode());
|
||||||
|
EbikeBikeInfo ebikeBikeInfo = ebikeBikeInfoMapper.selectOneByQuery(queryWrapper);
|
||||||
|
ebikeBikeInfo.setState(currentStatus);
|
||||||
|
ebikeBikeInfoMapper.update(ebikeBikeInfo);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("faultReporting===>{}", e.getMessage() + Arrays.toString(e.getStackTrace()));
|
log.error("faultReporting===>{}", e.getMessage() + Arrays.toString(e.getStackTrace()));
|
||||||
|
|||||||
@ -58,4 +58,22 @@ public class EbikeComponentController {
|
|||||||
|
|
||||||
return ebikeComponentService.ComponentInventoryOutbound(params);
|
return ebikeComponentService.ComponentInventoryOutbound(params);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 设备部件出库取消(通用)
|
||||||
|
* @param componentOutRecordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/cancelOutDevicePart")
|
||||||
|
public JsonResult<?> cancelOutDevicePart(@RequestParam(name = "componentOutRecordId") String componentOutRecordId) {
|
||||||
|
return ebikeComponentService.cancelOutDevicePart(componentOutRecordId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设备部件出库作废 (通用
|
||||||
|
* @param componentOutRecordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/invalidateOutDevicePart")
|
||||||
|
public JsonResult<?> invalidateOutDevicePart(@RequestParam(name="componentOutRecordId")String componentOutRecordId) {
|
||||||
|
return ebikeComponentService.invalidateOutDevicePart(componentOutRecordId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,13 +21,13 @@ public interface EbikeComponentService {
|
|||||||
*/
|
*/
|
||||||
JsonResult<?> ecuStorageSave(ReqComponentEnterRecordDto params);
|
JsonResult<?> ecuStorageSave(ReqComponentEnterRecordDto params);
|
||||||
|
|
||||||
/***
|
/**
|
||||||
* 设备部件作废接口 (通用
|
* 设备部件作废接口 (通用
|
||||||
* @param componentEnterRecordId
|
* @param componentEnterRecordId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
JsonResult<?> invalidateDevicePart(String componentEnterRecordId);
|
JsonResult<?> invalidateDevicePart(String componentEnterRecordId);
|
||||||
/***
|
/**
|
||||||
* 设备部件取消接口(通用)
|
* 设备部件取消接口(通用)
|
||||||
* @param componentEnterRecordId
|
* @param componentEnterRecordId
|
||||||
* @return
|
* @return
|
||||||
@ -41,4 +41,18 @@ public interface EbikeComponentService {
|
|||||||
*/
|
*/
|
||||||
JsonResult<?> ComponentInventoryOutbound(ReqComponentOutRecordDto params);
|
JsonResult<?> ComponentInventoryOutbound(ReqComponentOutRecordDto params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备部件出库取消(通用)
|
||||||
|
* @param componentOutRecordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JsonResult<?> cancelOutDevicePart(String componentOutRecordId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备部件出库作废 (通用
|
||||||
|
* @param componentOutRecordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JsonResult<?> invalidateOutDevicePart(String componentOutRecordId);
|
||||||
}
|
}
|
||||||
@ -362,6 +362,22 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
ebikeComponentInventorycountMapper.update(ebikeComponentInventorycount);
|
ebikeComponentInventorycountMapper.update(ebikeComponentInventorycount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库作废增加部件数量
|
||||||
|
* @param componentType
|
||||||
|
* @param size
|
||||||
|
*/
|
||||||
|
private void updateOtherOutComponentStock(String componentType,Integer size) {
|
||||||
|
// 具体更新其他组件仓库总数量的逻辑
|
||||||
|
QueryWrapper query1 = new QueryWrapper();
|
||||||
|
query1.eq("code", componentType);
|
||||||
|
EbikeComponentInventorycount ebikeComponentInventorycount = ebikeComponentInventorycountMapper.selectOneByQuery(query1);
|
||||||
|
if(ebikeComponentInventorycount !=null){
|
||||||
|
ebikeComponentInventorycount.setCount(ebikeComponentInventorycount.getCount()+size);
|
||||||
|
ebikeComponentInventorycountMapper.update(ebikeComponentInventorycount);
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 部件出库(出库,暂存) (stockInType 0或空 表示暂存,1 表示入库。
|
* 部件出库(出库,暂存) (stockInType 0或空 表示暂存,1 表示入库。
|
||||||
* @param params
|
* @param params
|
||||||
@ -498,6 +514,103 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 设备部件出库取消(通用)
|
||||||
|
* @param componentOutRecordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JsonResult<?> cancelOutDevicePart(String componentOutRecordId){
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneByQuery(query);
|
||||||
|
//先更新记录表状态 为已取消(-1)
|
||||||
|
ebikeComponentOutRecords.setState("-1");
|
||||||
|
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
||||||
|
return JsonResult.success("成功");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设备部件出库作废 (通用
|
||||||
|
* @param componentOutRecordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public JsonResult<?> invalidateOutDevicePart(String componentOutRecordId){
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneByQuery(query);
|
||||||
|
String componentType = ebikeComponentOutRecords.getComponentType();
|
||||||
|
Integer enterQuantity = ebikeComponentOutRecords.getEnterQuantity();
|
||||||
|
// 电池262711452730000 头盔262711452730001 中控262711452730008 需要单独操作明细表
|
||||||
|
//先更新记录表状态 为已作废(-2)
|
||||||
|
ebikeComponentOutRecords.setState("-2");
|
||||||
|
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
||||||
|
ComponentType componentTypeEnum = ComponentType.fromCode(componentType);
|
||||||
|
switch (componentTypeEnum) {
|
||||||
|
case BATTERY: // 电池
|
||||||
|
updateBatteryOutDetails(componentOutRecordId, componentType, -2);
|
||||||
|
break;
|
||||||
|
case HELMET: // 头盔
|
||||||
|
updateHelmetOutDetails(componentOutRecordId, componentType, -2);
|
||||||
|
break;
|
||||||
|
case ECU: // 中控
|
||||||
|
updateCentralControlOutDetails(componentOutRecordId, componentType, -2);
|
||||||
|
break;
|
||||||
|
default: // 其他
|
||||||
|
updateOtherComponentStock(componentType, enterQuantity);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return JsonResult.success("成功");
|
||||||
|
}
|
||||||
|
private void updateBatteryOutDetails(String componentOutRecordId,String componentType,Integer state) {
|
||||||
|
// 具体更新电池仓库明细状态和仓库总数量的逻辑
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
List<EbikeBatteryOutRecords> ebikeBatteryOutRecords = ebikeBatteryOutRecordsMapper.selectListWithRelationsByQuery(query);
|
||||||
|
for(EbikeBatteryOutRecords record:ebikeBatteryOutRecords){
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("item_code", record.getBatteryCode());
|
||||||
|
EbikeComponentInventory ebikeComponentInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
||||||
|
ebikeComponentInventory.setState(state);
|
||||||
|
ebikeComponentInventoryMapper.update(ebikeComponentInventory);
|
||||||
|
}
|
||||||
|
int size = ebikeBatteryOutRecords.size();
|
||||||
|
updateOtherOutComponentStock(componentType,size);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateHelmetOutDetails(String componentOutRecordId,String componentType,Integer state) {
|
||||||
|
// 具体更新头盔仓库明细状态和仓库总数量的逻辑
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
|
||||||
|
List<EbikeHelmetOutRecords> ebikeHelmetOutRecords = ebikeHelmetOutRecordsMapper.selectListWithRelationsByQuery(query);
|
||||||
|
for(EbikeHelmetOutRecords record:ebikeHelmetOutRecords){
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("item_code", record.getHelmetCode());
|
||||||
|
EbikeComponentInventory ebikeComponentInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
||||||
|
ebikeComponentInventory.setState(state);
|
||||||
|
ebikeComponentInventoryMapper.update(ebikeComponentInventory);
|
||||||
|
}
|
||||||
|
int size = ebikeHelmetOutRecords.size();
|
||||||
|
updateOtherOutComponentStock(componentType,size);
|
||||||
|
}
|
||||||
|
private void updateCentralControlOutDetails(String componentOutRecordId,String componentType,Integer state) {
|
||||||
|
// 具体更新中控仓库明细状态和仓库总数量的逻辑
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
List<EbikeEcuOutRecords> ebikeEcuOutRecords = ebikeEcuOutRecordsMapper.selectListWithRelationsByQuery(query);
|
||||||
|
for(EbikeEcuOutRecords record:ebikeEcuOutRecords){
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("item_code", record.getEcuSn());
|
||||||
|
query.eq("serial_number", record.getEcuCode());
|
||||||
|
EbikeComponentInventory ebikeComponentInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
||||||
|
ebikeComponentInventory.setState(state);
|
||||||
|
ebikeComponentInventoryMapper.update(ebikeComponentInventory);
|
||||||
|
}
|
||||||
|
int size = ebikeEcuOutRecords.size();
|
||||||
|
updateOtherOutComponentStock(componentType,size);
|
||||||
|
}
|
||||||
public StaffFeign getStaffFeignInfo() {
|
public StaffFeign getStaffFeignInfo() {
|
||||||
String tokenValue = StpUtil.getTokenValue();
|
String tokenValue = StpUtil.getTokenValue();
|
||||||
// 调用 Feign 客户端获取用户信息
|
// 调用 Feign 客户端获取用户信息
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user