接口优化
This commit is contained in:
parent
b8c554deda
commit
272ef9933e
@ -11,10 +11,7 @@ import com.ebike.feign.model.rsp.FeignEbikeRegionDto;
|
|||||||
import com.cdzy.common.model.ReqComponentOutRecordDto;
|
import com.cdzy.common.model.ReqComponentOutRecordDto;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -171,5 +168,5 @@ public interface OperateFeignClient {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("ebikeComponent/ComponentInventoryOutbound")
|
@PostMapping("ebikeComponent/ComponentInventoryOutbound")
|
||||||
JsonResult<?> componentInventoryOutbound(@RequestBody ReqComponentOutRecordDto reqComponentOutRecordDto);
|
JsonResult<?> componentInventoryOutbound(@RequestBody ReqComponentOutRecordDto reqComponentOutRecordDto,@RequestHeader("Authorization") String token);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,6 +59,7 @@ public class EbikeBikeInfo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
|
@Column(onInsertValue = "0")
|
||||||
private String state;
|
private String state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,4 +108,11 @@ public class EbikeBikeInfo implements Serializable {
|
|||||||
* 车牌号
|
* 车牌号
|
||||||
*/
|
*/
|
||||||
private String bikeNumber;
|
private String bikeNumber;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "1")
|
||||||
|
private String isNew;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "1")
|
||||||
|
private String isInWarehouse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,6 +147,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
public Boolean saveEbikeInfo(ReqEbikeBikeInfoDto reqEbikeBikeInfoDto) {
|
public Boolean saveEbikeInfo(ReqEbikeBikeInfoDto reqEbikeBikeInfoDto) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
String tokenValue = StpUtil.getTokenValue();
|
||||||
EbikeBikeInfo ebikeBikeInfo = new EbikeBikeInfo();
|
EbikeBikeInfo ebikeBikeInfo = new EbikeBikeInfo();
|
||||||
BeanUtils.copyProperties(reqEbikeBikeInfoDto, ebikeBikeInfo);
|
BeanUtils.copyProperties(reqEbikeBikeInfoDto, ebikeBikeInfo);
|
||||||
EbikeBatteryInfo ebikeBatteryInfo = new EbikeBatteryInfo();
|
EbikeBatteryInfo ebikeBatteryInfo = new EbikeBatteryInfo();
|
||||||
@ -166,7 +167,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
reqComponentOutRecordDto.setEbikeEcuOutRecords(ebikeEcuOutRecords);
|
reqComponentOutRecordDto.setEbikeEcuOutRecords(ebikeEcuOutRecords);
|
||||||
reqComponentOutRecordDto.setComponentType("262711452730008");
|
reqComponentOutRecordDto.setComponentType("262711452730008");
|
||||||
//ecu出库
|
//ecu出库
|
||||||
operateFeignClient.componentInventoryOutbound(reqComponentOutRecordDto);
|
operateFeignClient.componentInventoryOutbound(reqComponentOutRecordDto, tokenValue);
|
||||||
ebikeEcuInfoMapper.insert(ebikeEcuInfo);
|
ebikeEcuInfoMapper.insert(ebikeEcuInfo);
|
||||||
ebikeBikeInfo.setEcuId(ebikeEcuInfo.getEcuId());
|
ebikeBikeInfo.setEcuId(ebikeEcuInfo.getEcuId());
|
||||||
|
|
||||||
@ -181,7 +182,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
reqComponentOutRecordDto.setComponentType("262711452730001");
|
reqComponentOutRecordDto.setComponentType("262711452730001");
|
||||||
reqComponentOutRecordDto.setEbikeEcuOutRecords(null);
|
reqComponentOutRecordDto.setEbikeEcuOutRecords(null);
|
||||||
//头盔出库
|
//头盔出库
|
||||||
operateFeignClient.componentInventoryOutbound(reqComponentOutRecordDto);
|
operateFeignClient.componentInventoryOutbound(reqComponentOutRecordDto, tokenValue);
|
||||||
ebikeHelmetInfoMapper.insert(ebikeHelmetInfo);
|
ebikeHelmetInfoMapper.insert(ebikeHelmetInfo);
|
||||||
ebikeBikeInfo.setHelmetId(ebikeHelmetInfo.getHelmetId());
|
ebikeBikeInfo.setHelmetId(ebikeHelmetInfo.getHelmetId());
|
||||||
}
|
}
|
||||||
@ -194,7 +195,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
reqComponentOutRecordDto.setComponentType("262711452730000");
|
reqComponentOutRecordDto.setComponentType("262711452730000");
|
||||||
reqComponentOutRecordDto.setEbikeHelmetOutRecords(null);
|
reqComponentOutRecordDto.setEbikeHelmetOutRecords(null);
|
||||||
//电池出库
|
//电池出库
|
||||||
operateFeignClient.componentInventoryOutbound(reqComponentOutRecordDto);
|
operateFeignClient.componentInventoryOutbound(reqComponentOutRecordDto, tokenValue);
|
||||||
ebikeBatteryInfoMapper.insert(ebikeBatteryInfo);
|
ebikeBatteryInfoMapper.insert(ebikeBatteryInfo);
|
||||||
ebikeBikeInfo.setBatteryId(ebikeBatteryInfo.getBatteryId());
|
ebikeBikeInfo.setBatteryId(ebikeBatteryInfo.getBatteryId());
|
||||||
ebikeBikeInfoMapper.insert(ebikeBikeInfo);
|
ebikeBikeInfoMapper.insert(ebikeBikeInfo);
|
||||||
@ -282,20 +283,23 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
|||||||
EbikeEcuInfo ebikeEcuInfo = ebikeEcuInfoMapper.selectOneByQuery(queryWrapper);
|
EbikeEcuInfo ebikeEcuInfo = ebikeEcuInfoMapper.selectOneByQuery(queryWrapper);
|
||||||
BeanUtils.copyProperties(resInventoryBikeListDto, resEbikeBikeAndEcuCodeDto);
|
BeanUtils.copyProperties(resInventoryBikeListDto, resEbikeBikeAndEcuCodeDto);
|
||||||
BeanUtils.copyProperties(ebikeEcuInfo, resEbikeBikeAndEcuCodeDto);
|
BeanUtils.copyProperties(ebikeEcuInfo, resEbikeBikeAndEcuCodeDto);
|
||||||
String jsonData = JSONObject.toJSONString(redisUtil.get(String.valueOf(ebikeEcuInfo.getEcuSn())));
|
Object o = redisUtil.get(String.valueOf(ebikeEcuInfo.getEcuSn()));
|
||||||
ResGPSDto resGPSDto = JSONObject.parseObject(jsonData, ResGPSDto.class);
|
if (o != null) {
|
||||||
// 经纬度转GCJ-02坐标系
|
String jsonData = JSONObject.toJSONString(o);
|
||||||
double[] gcj02 = CoordinateUtil.WGS84ToGCJ02(resGPSDto.getLongitude(), resGPSDto.getLatitude());
|
ResGPSDto resGPSDto = JSONObject.parseObject(jsonData, ResGPSDto.class);
|
||||||
JSONObject jsonObject = new JSONObject();
|
// 经纬度转GCJ-02坐标系
|
||||||
jsonObject.put("lat", gcj02[1]);
|
double[] gcj02 = CoordinateUtil.WGS84ToGCJ02(resGPSDto.getLongitude(), resGPSDto.getLatitude());
|
||||||
jsonObject.put("lng", gcj02[0]);
|
JSONObject jsonObject = new JSONObject();
|
||||||
resGPSDto.setLatitude(gcj02[1]);
|
jsonObject.put("lat", gcj02[1]);
|
||||||
resGPSDto.setLongitude(gcj02[0]);
|
jsonObject.put("lng", gcj02[0]);
|
||||||
String address = geoCodingUtil.getLocationToAddress(jsonObject);
|
resGPSDto.setLatitude(gcj02[1]);
|
||||||
if (address != null) {
|
resGPSDto.setLongitude(gcj02[0]);
|
||||||
resGPSDto.setChineseLocation(address);
|
String address = geoCodingUtil.getLocationToAddress(jsonObject);
|
||||||
|
if (address != null) {
|
||||||
|
resGPSDto.setChineseLocation(address);
|
||||||
|
}
|
||||||
|
resEbikeBikeAndEcuCodeDto.setResGPSDto(resGPSDto);
|
||||||
}
|
}
|
||||||
resEbikeBikeAndEcuCodeDto.setResGPSDto(resGPSDto);
|
|
||||||
return resEbikeBikeAndEcuCodeDto;
|
return resEbikeBikeAndEcuCodeDto;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("getBikeINfoData===>{}", e.getMessage() + Arrays.toString(e.getStackTrace()));
|
log.error("getBikeINfoData===>{}", e.getMessage() + Arrays.toString(e.getStackTrace()));
|
||||||
|
|||||||
@ -54,7 +54,7 @@ public class ReqComponentOutRecordDto {
|
|||||||
/**
|
/**
|
||||||
* 是否是整车绑定调用
|
* 是否是整车绑定调用
|
||||||
*/
|
*/
|
||||||
private Boolean isWholeBinding;
|
private Boolean isWholeBinding = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 中控信息列表,包含所有ECU部件的出库记录。
|
* 中控信息列表,包含所有ECU部件的出库记录。
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class EbikeComponentEnterRecordsServiceImpl extends ServiceImpl<EbikeComp
|
|||||||
EBIKE_COMPONENT_TYPE_INFO.COVER.as("type_cover"));
|
EBIKE_COMPONENT_TYPE_INFO.COVER.as("type_cover"));
|
||||||
query.leftJoin(EBIKE_OPERATION_REGION).on(EBIKE_COMPONENT_ENTER_RECORDS.OWNING_REGION.eq(EBIKE_OPERATION_REGION.OPERATION_REGION_ID));
|
query.leftJoin(EBIKE_OPERATION_REGION).on(EBIKE_COMPONENT_ENTER_RECORDS.OWNING_REGION.eq(EBIKE_OPERATION_REGION.OPERATION_REGION_ID));
|
||||||
query.leftJoin(EBIKE_COMPONENT_TYPE_INFO).on(EBIKE_COMPONENT_ENTER_RECORDS.COMPONENT_TYPE.eq(EBIKE_COMPONENT_TYPE_INFO.ID));
|
query.leftJoin(EBIKE_COMPONENT_TYPE_INFO).on(EBIKE_COMPONENT_ENTER_RECORDS.COMPONENT_TYPE.eq(EBIKE_COMPONENT_TYPE_INFO.ID));
|
||||||
|
query.where(EBIKE_COMPONENT_ENTER_RECORDS.COMPONENT_OUT_RECORD_ID.isNull());
|
||||||
String region = reqEbikeComponentEnterRecordsDto.getRegion();
|
String region = reqEbikeComponentEnterRecordsDto.getRegion();
|
||||||
if (region != null && !region.isEmpty())
|
if (region != null && !region.isEmpty())
|
||||||
query.where(EBIKE_COMPONENT_ENTER_RECORDS.OWNING_REGION.eq(region));
|
query.where(EBIKE_COMPONENT_ENTER_RECORDS.OWNING_REGION.eq(region));
|
||||||
|
|||||||
@ -43,6 +43,7 @@ public class EbikeComponentOutRecordsServiceImpl extends ServiceImpl<EbikeCompon
|
|||||||
EBIKE_COMPONENT_TYPE_INFO.COVER.as("type_cover"));
|
EBIKE_COMPONENT_TYPE_INFO.COVER.as("type_cover"));
|
||||||
query.leftJoin(EBIKE_OPERATION_REGION).on(EBIKE_COMPONENT_OUT_RECORDS.OWNING_REGION.eq(EBIKE_OPERATION_REGION.OPERATION_REGION_ID));
|
query.leftJoin(EBIKE_OPERATION_REGION).on(EBIKE_COMPONENT_OUT_RECORDS.OWNING_REGION.eq(EBIKE_OPERATION_REGION.OPERATION_REGION_ID));
|
||||||
query.leftJoin(EBIKE_COMPONENT_TYPE_INFO).on(EBIKE_COMPONENT_OUT_RECORDS.COMPONENT_TYPE.eq(EBIKE_COMPONENT_TYPE_INFO.ID));
|
query.leftJoin(EBIKE_COMPONENT_TYPE_INFO).on(EBIKE_COMPONENT_OUT_RECORDS.COMPONENT_TYPE.eq(EBIKE_COMPONENT_TYPE_INFO.ID));
|
||||||
|
|
||||||
String region = reqEbikeComponentOutRecordsDto.getRegion();
|
String region = reqEbikeComponentOutRecordsDto.getRegion();
|
||||||
if (region != null && !region.isEmpty())
|
if (region != null && !region.isEmpty())
|
||||||
query.where(EBIKE_COMPONENT_OUT_RECORDS.OWNING_REGION.eq(region));
|
query.where(EBIKE_COMPONENT_OUT_RECORDS.OWNING_REGION.eq(region));
|
||||||
@ -53,8 +54,11 @@ public class EbikeComponentOutRecordsServiceImpl extends ServiceImpl<EbikeCompon
|
|||||||
if (oldOption != null && !oldOption.isEmpty())
|
if (oldOption != null && !oldOption.isEmpty())
|
||||||
query.where(EBIKE_COMPONENT_OUT_RECORDS.OLD_COMPONENT_HANDLE_OPTION.eq(oldOption));
|
query.where(EBIKE_COMPONENT_OUT_RECORDS.OLD_COMPONENT_HANDLE_OPTION.eq(oldOption));
|
||||||
String state = reqEbikeComponentOutRecordsDto.getState();
|
String state = reqEbikeComponentOutRecordsDto.getState();
|
||||||
if (state != null && !state.isEmpty())
|
if (state != null && !state.isEmpty()) {
|
||||||
query.where(EBIKE_COMPONENT_OUT_RECORDS.STATE.eq(state));
|
query.where(EBIKE_COMPONENT_OUT_RECORDS.STATE.eq(state));
|
||||||
|
} else {
|
||||||
|
query.where(EBIKE_COMPONENT_OUT_RECORDS.STATE.ne("3"));
|
||||||
|
}
|
||||||
if (reqEbikeComponentOutRecordsDto.getSortBy() != null && !reqEbikeComponentOutRecordsDto.getSortBy().isEmpty()) {
|
if (reqEbikeComponentOutRecordsDto.getSortBy() != null && !reqEbikeComponentOutRecordsDto.getSortBy().isEmpty()) {
|
||||||
query.orderBy(reqEbikeComponentOutRecordsDto.getSortBy(), "asc".equals(reqEbikeComponentOutRecordsDto.getSortMethod()));
|
query.orderBy(reqEbikeComponentOutRecordsDto.getSortBy(), "asc".equals(reqEbikeComponentOutRecordsDto.getSortMethod()));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -61,7 +61,6 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
private EbikeBatteryOutRecordsMapper ebikeBatteryOutRecordsMapper;
|
private EbikeBatteryOutRecordsMapper ebikeBatteryOutRecordsMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 中控设备部件入库接口,暂存
|
* 中控设备部件入库接口,暂存
|
||||||
* @param params
|
* @param params
|
||||||
@ -105,7 +104,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String componentOutRecordId = params.getComponentOutRecordId();
|
String componentOutRecordId = params.getComponentOutRecordId();
|
||||||
if(componentOutRecordId != null && !componentOutRecordId.isEmpty() && stockInType == 1 ){
|
if (componentOutRecordId != null && !componentOutRecordId.isEmpty() && stockInType == 1) {
|
||||||
// 更新出库记录状态为 已归还
|
// 更新出库记录状态为 已归还
|
||||||
updateOutRecordStatus(componentOutRecordId);
|
updateOutRecordStatus(componentOutRecordId);
|
||||||
}
|
}
|
||||||
@ -119,6 +118,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
StaffFeign staffFeign = getStaffFeignInfo();
|
StaffFeign staffFeign = getStaffFeignInfo();
|
||||||
return staffFeign.getStaffId().toString();
|
return staffFeign.getStaffId().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
获取组织Id
|
获取组织Id
|
||||||
*/
|
*/
|
||||||
@ -248,9 +248,9 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
ebikeComponentInventory.setLastUpdatedUser(userId);
|
ebikeComponentInventory.setLastUpdatedUser(userId);
|
||||||
ebikeComponentInventory.setState(state); // 1 已入库 //2 已出库
|
ebikeComponentInventory.setState(state); // 1 已入库 //2 已出库
|
||||||
// 查询是否已存在该记录
|
// 查询是否已存在该记录
|
||||||
QueryWrapper query =new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("item_code",ItemCode);
|
query.eq("item_code", ItemCode);
|
||||||
query.eq("serial_number",SerialNumber);
|
query.eq("serial_number", SerialNumber);
|
||||||
EbikeComponentInventory existingInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
EbikeComponentInventory existingInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
||||||
if (existingInventory != null) {
|
if (existingInventory != null) {
|
||||||
// 如果记录存在,则进行更新
|
// 如果记录存在,则进行更新
|
||||||
@ -279,7 +279,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
ebikeComponentInventorycount.setBrand(ebikeComponentTypeInfo.getBrand());
|
ebikeComponentInventorycount.setBrand(ebikeComponentTypeInfo.getBrand());
|
||||||
ebikeComponentInventorycount.setUnit(ebikeComponentTypeInfo.getUnit());
|
ebikeComponentInventorycount.setUnit(ebikeComponentTypeInfo.getUnit());
|
||||||
ebikeComponentInventorycount.setPrice(ebikeComponentTypeInfo.getPrice());
|
ebikeComponentInventorycount.setPrice(ebikeComponentTypeInfo.getPrice());
|
||||||
ebikeComponentInventorycount.setItemCount(0L+size);
|
ebikeComponentInventorycount.setItemCount(0L + size);
|
||||||
ebikeComponentInventorycountMapper.insert(ebikeComponentInventorycount);
|
ebikeComponentInventorycountMapper.insert(ebikeComponentInventorycount);
|
||||||
} else {
|
} else {
|
||||||
if (type == 1) {//入库
|
if (type == 1) {//入库
|
||||||
@ -345,7 +345,6 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出库作废增加部件数量
|
* 出库作废增加部件数量
|
||||||
*
|
*
|
||||||
@ -377,8 +376,8 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
Long orgId = getOrgId(); // 获取当前操作用户所在组织ID
|
Long orgId = getOrgId(); // 获取当前操作用户所在组织ID
|
||||||
EbikeComponentTypeInfo ebikeComponentTypeInfo = getComponentTypeInfo(params.getComponentType()); // 获取部件信息
|
EbikeComponentTypeInfo ebikeComponentTypeInfo = getComponentTypeInfo(params.getComponentType()); // 获取部件信息
|
||||||
|
|
||||||
/**
|
/**够
|
||||||
* 验证仓库数量是否足够
|
* 验证仓库数量是否足
|
||||||
*/
|
*/
|
||||||
Integer outQuantity = params.getOutQuantity(); // 选择的出库数量
|
Integer outQuantity = params.getOutQuantity(); // 选择的出库数量
|
||||||
// 查看仓库剩余部件数量
|
// 查看仓库剩余部件数量
|
||||||
@ -401,19 +400,19 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
|
|
||||||
String componentOutRecordId = ebikeComponentOutRecords.getComponentOutRecordId();
|
String componentOutRecordId = ebikeComponentOutRecords.getComponentOutRecordId();
|
||||||
|
|
||||||
if (params.getEbikeEcuOutRecords()!=null && !params.getEbikeEcuOutRecords().isEmpty()) {
|
if (params.getEbikeEcuOutRecords() != null && !params.getEbikeEcuOutRecords().isEmpty()) {
|
||||||
// 删除原有的ECU入库记录并保存新的记录
|
// 删除原有的ECU入库记录并保存新的记录
|
||||||
deleteAndInsertEcuOutRecords(componentOutRecordId, params.getEbikeEcuOutRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
deleteAndInsertEcuOutRecords(componentOutRecordId, params.getEbikeEcuOutRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
||||||
if (stockInType == 1) {
|
if (stockInType == 1) {
|
||||||
updateInventoryCount(ebikeComponentTypeInfo, orgId, params.getEbikeEcuOutRecords().size(), 2);
|
updateInventoryCount(ebikeComponentTypeInfo, orgId, params.getEbikeEcuOutRecords().size(), 2);
|
||||||
}
|
}
|
||||||
} else if (params.getEbikeBatteryOutRecords()!=null && !params.getEbikeBatteryOutRecords().isEmpty()) {
|
} else if (params.getEbikeBatteryOutRecords() != null && !params.getEbikeBatteryOutRecords().isEmpty()) {
|
||||||
// 删除原有的电池入库记录并保存新的记录
|
// 删除原有的电池入库记录并保存新的记录
|
||||||
deleteAndInsertBatteryOutRecords(componentOutRecordId, params.getEbikeBatteryOutRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
deleteAndInsertBatteryOutRecords(componentOutRecordId, params.getEbikeBatteryOutRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
||||||
if (stockInType == 1) {
|
if (stockInType == 1) {
|
||||||
updateInventoryCount(ebikeComponentTypeInfo, orgId, params.getEbikeBatteryOutRecords().size(), 2);
|
updateInventoryCount(ebikeComponentTypeInfo, orgId, params.getEbikeBatteryOutRecords().size(), 2);
|
||||||
}
|
}
|
||||||
} else if (params.getEbikeHelmetOutRecords()!=null && !params.getEbikeHelmetOutRecords().isEmpty()) {
|
} else if (params.getEbikeHelmetOutRecords() != null && !params.getEbikeHelmetOutRecords().isEmpty()) {
|
||||||
// 删除原有的头盔入库记录并保存新的记录
|
// 删除原有的头盔入库记录并保存新的记录
|
||||||
deleteAndInsertHelmetOutRecords(componentOutRecordId, params.getEbikeHelmetOutRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
deleteAndInsertHelmetOutRecords(componentOutRecordId, params.getEbikeHelmetOutRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
||||||
if (stockInType == 1) {
|
if (stockInType == 1) {
|
||||||
@ -428,6 +427,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
}
|
}
|
||||||
return JsonResult.success(componentOutRecordId);
|
return JsonResult.success(componentOutRecordId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备部件出库取消(通用)
|
* 设备部件出库取消(通用)
|
||||||
*
|
*
|
||||||
@ -444,6 +444,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
||||||
return JsonResult.success("成功");
|
return JsonResult.success("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备部件出库作废 (通用
|
* 设备部件出库作废 (通用
|
||||||
*
|
*
|
||||||
@ -479,6 +480,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
}
|
}
|
||||||
return JsonResult.success("成功");
|
return JsonResult.success("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询Ecu入库记录。
|
* 分页查询Ecu入库记录。
|
||||||
*
|
*
|
||||||
@ -489,11 +491,12 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
public Page<EbikeEcuEnterRecords> ecuEnterList(ReqEbikeEcuEnterRecordsDto reqEbikeEcuEnterRecordsDto) {
|
public Page<EbikeEcuEnterRecords> ecuEnterList(ReqEbikeEcuEnterRecordsDto reqEbikeEcuEnterRecordsDto) {
|
||||||
QueryWrapper query = QueryWrapper.create();
|
QueryWrapper query = QueryWrapper.create();
|
||||||
String componentId = reqEbikeEcuEnterRecordsDto.getComponentEnterRecordId();
|
String componentId = reqEbikeEcuEnterRecordsDto.getComponentEnterRecordId();
|
||||||
if(componentId!=null&&!componentId.isEmpty())
|
if (componentId != null && !componentId.isEmpty())
|
||||||
query.where(EBIKE_ECU_ENTER_RECORDS.COMPONENT_ENTER_RECORD_ID.eq(componentId));
|
query.where(EBIKE_ECU_ENTER_RECORDS.COMPONENT_ENTER_RECORD_ID.eq(componentId));
|
||||||
Page<EbikeEcuEnterRecords> page = reqEbikeEcuEnterRecordsDto.getPageParam().getPage();
|
Page<EbikeEcuEnterRecords> page = reqEbikeEcuEnterRecordsDto.getPageParam().getPage();
|
||||||
return ebikeEcuEnterRecordsMapper.paginate(page, query);
|
return ebikeEcuEnterRecordsMapper.paginate(page, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询Ecu出库库记录。
|
* 分页查询Ecu出库库记录。
|
||||||
*
|
*
|
||||||
@ -504,11 +507,12 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
public Page<EbikeEcuOutRecords> ecuOutList(ReqEbikeEcuOutRecordsDto reqEbikeEcuOutRecordsDto) {
|
public Page<EbikeEcuOutRecords> ecuOutList(ReqEbikeEcuOutRecordsDto reqEbikeEcuOutRecordsDto) {
|
||||||
QueryWrapper query = QueryWrapper.create();
|
QueryWrapper query = QueryWrapper.create();
|
||||||
String componentId = reqEbikeEcuOutRecordsDto.getComponentOutRecordId();
|
String componentId = reqEbikeEcuOutRecordsDto.getComponentOutRecordId();
|
||||||
if(componentId!=null&&!componentId.isEmpty())
|
if (componentId != null && !componentId.isEmpty())
|
||||||
query.where(EBIKE_ECU_OUT_RECORDS.COMPONENT_OUT_RECORD_ID.eq(componentId));
|
query.where(EBIKE_ECU_OUT_RECORDS.COMPONENT_OUT_RECORD_ID.eq(componentId));
|
||||||
Page<EbikeEcuOutRecords> page = reqEbikeEcuOutRecordsDto.getPageParam().getPage();
|
Page<EbikeEcuOutRecords> page = reqEbikeEcuOutRecordsDto.getPageParam().getPage();
|
||||||
return ebikeEcuOutRecordsMapper.paginate(page, query);
|
return ebikeEcuOutRecordsMapper.paginate(page, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部件出库记录表主键,查询部件出库记录信息以及归还部件信息
|
* 根据部件出库记录表主键,查询部件出库记录信息以及归还部件信息
|
||||||
*
|
*
|
||||||
@ -545,10 +549,12 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
|
|
||||||
return JsonResult.success(resComponentOutRecordInfoDto);
|
return JsonResult.success(resComponentOutRecordInfoDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部件编号 和部件类型验证仓库中是否已经存在
|
* 根据部件编号 和部件类型验证仓库中是否已经存在
|
||||||
* @params
|
*
|
||||||
* @return
|
* @return
|
||||||
|
* @params
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public JsonResult<?> validateComponentExistence(ReqValidateComponentExistenceDto params) {
|
public JsonResult<?> validateComponentExistence(ReqValidateComponentExistenceDto params) {
|
||||||
@ -557,7 +563,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
String componentType = params.getComponentType();
|
String componentType = params.getComponentType();
|
||||||
Boolean isNew = params.getIsNew();
|
Boolean isNew = params.getIsNew();
|
||||||
// 检查是否存在重复记录
|
// 检查是否存在重复记录
|
||||||
boolean duplicateEntry = isDuplicateEntry(componentCode, componentType,isNew);
|
boolean duplicateEntry = isDuplicateEntry(componentCode, componentType, isNew);
|
||||||
// 返回成功响应
|
// 返回成功响应
|
||||||
return JsonResult.success(duplicateEntry);
|
return JsonResult.success(duplicateEntry);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -628,6 +634,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
ebikeComponentInventorycountMapper.update(ebikeComponentInventorycount);
|
ebikeComponentInventorycountMapper.update(ebikeComponentInventorycount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private EbikeComponentOutRecords buildOutRecord(ReqComponentOutRecordDto params, EbikeComponentTypeInfo ebikeComponentTypeInfo, Integer stockInType, Long orgId) {
|
private EbikeComponentOutRecords buildOutRecord(ReqComponentOutRecordDto params, EbikeComponentTypeInfo ebikeComponentTypeInfo, Integer stockInType, Long orgId) {
|
||||||
EbikeComponentOutRecords ebikeComponentOutRecords = new EbikeComponentOutRecords();
|
EbikeComponentOutRecords ebikeComponentOutRecords = new EbikeComponentOutRecords();
|
||||||
ebikeComponentOutRecords.setOwningRegion(params.getOwningRegion());
|
ebikeComponentOutRecords.setOwningRegion(params.getOwningRegion());
|
||||||
@ -669,6 +676,12 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("component_out_record_id", componentOutRecordId);
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
ebikeEcuOutRecordsMapper.deleteByQuery(query);
|
ebikeEcuOutRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
ebikeHelmetOutRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
ebikeBatteryOutRecordsMapper.deleteByQuery(query);
|
||||||
// 插入新的ECU入库记录
|
// 插入新的ECU入库记录
|
||||||
for (EbikeEcuOutRecords record : outRecords) {
|
for (EbikeEcuOutRecords record : outRecords) {
|
||||||
record.setComponentOutRecordId(componentOutRecordId);
|
record.setComponentOutRecordId(componentOutRecordId);
|
||||||
@ -683,7 +696,13 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
// 删除原有的头盔出库记录
|
// 删除原有的头盔出库记录
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("component_out_record_id", componentOutRecordId);
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
ebikeEcuOutRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
ebikeHelmetOutRecordsMapper.deleteByQuery(query);
|
ebikeHelmetOutRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
ebikeBatteryOutRecordsMapper.deleteByQuery(query);
|
||||||
// 插入新的头盔出库记录
|
// 插入新的头盔出库记录
|
||||||
for (EbikeHelmetOutRecords record : ebikeHelmetOutRecords) {
|
for (EbikeHelmetOutRecords record : ebikeHelmetOutRecords) {
|
||||||
record.setComponentOutRecordId(componentOutRecordId);
|
record.setComponentOutRecordId(componentOutRecordId);
|
||||||
@ -698,7 +717,13 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
// 删除原有的电池出库记录
|
// 删除原有的电池出库记录
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("component_out_record_id", componentOutRecordId);
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
ebikeBatteryEnterRecordsMapper.deleteByQuery(query);
|
ebikeEcuOutRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
ebikeHelmetOutRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
ebikeBatteryOutRecordsMapper.deleteByQuery(query);
|
||||||
// 插入新的电池出库记录
|
// 插入新的电池出库记录
|
||||||
for (EbikeBatteryOutRecords record : ebikeBatteryOutRecords) {
|
for (EbikeBatteryOutRecords record : ebikeBatteryOutRecords) {
|
||||||
record.setComponentOutRecordId(componentOutRecordId);
|
record.setComponentOutRecordId(componentOutRecordId);
|
||||||
@ -763,7 +788,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
|
|
||||||
// 根据组件类型填充出库记录
|
// 根据组件类型填充出库记录
|
||||||
private void populateOutRecords(ResComponentOutRecordInfoDto dto, String componentOutRecordId, ComponentType componentTypeEnum) {
|
private void populateOutRecords(ResComponentOutRecordInfoDto dto, String componentOutRecordId, ComponentType componentTypeEnum) {
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("component_out_record_id", componentOutRecordId);
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
switch (componentTypeEnum) {
|
switch (componentTypeEnum) {
|
||||||
case BATTERY: // 电池
|
case BATTERY: // 电池
|
||||||
@ -807,22 +832,25 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新出库记录状态为已归还
|
// 更新出库记录状态为已归还
|
||||||
private void updateOutRecordStatus(String componentOutRecordId) {
|
private void updateOutRecordStatus(String componentOutRecordId) {
|
||||||
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneById(componentOutRecordId);
|
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneById(componentOutRecordId);
|
||||||
ebikeComponentOutRecords.setState("2");
|
ebikeComponentOutRecords.setState("2");
|
||||||
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
||||||
}
|
}
|
||||||
public boolean isDuplicateEntry(String itemCode,String componentType,Boolean isNew) {
|
|
||||||
|
public boolean isDuplicateEntry(String itemCode, String componentType, Boolean isNew) {
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("item_code", itemCode);
|
query.eq("item_code", itemCode);
|
||||||
query.eq("component_type", componentType);
|
query.eq("component_type", componentType);
|
||||||
if(!isNew){
|
if (!isNew) {
|
||||||
query.eq("state", 1); // 假设 1 表示已已入库
|
query.eq("state", 1); // 假设 1 表示已已入库
|
||||||
}
|
}
|
||||||
long count = ebikeComponentInventoryMapper.selectCountByQuery(query); // 查询符合条件的记录数
|
long count = ebikeComponentInventoryMapper.selectCountByQuery(query); // 查询符合条件的记录数
|
||||||
return count > 0; // 如果记录数大于 0,说明已经存在重复入库
|
return count > 0; // 如果记录数大于 0,说明已经存在重复入库
|
||||||
}
|
}
|
||||||
|
|
||||||
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