接口优化
This commit is contained in:
parent
78507c428e
commit
700803fd20
@ -37,6 +37,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@ -93,8 +94,8 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl<EbikeOperationR
|
||||
@Override
|
||||
public Page<EbikeOperationRegion> pageOperationRegion(PageParam pageParam, String simpleName, String regionName, Integer inOperation) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_OPERATION_REGION.SIMPLE_NAME.eq(simpleName, !simpleName.isBlank()))
|
||||
.where(EBIKE_OPERATION_REGION.OPERATION_REGION_NAME.eq(regionName, !regionName.isBlank()))
|
||||
.where(EBIKE_OPERATION_REGION.SIMPLE_NAME.eq(simpleName, !StringUtils.isEmpty(simpleName)))
|
||||
.where(EBIKE_OPERATION_REGION.OPERATION_REGION_NAME.eq(regionName, !StringUtils.isEmpty(regionName)))
|
||||
.where(EBIKE_OPERATION_REGION.IN_OPERATION.eq(inOperation, Objects::nonNull));
|
||||
return this.mapper.paginate(pageParam.getPage(), queryWrapper);
|
||||
}
|
||||
@ -122,8 +123,8 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl<EbikeOperationR
|
||||
@Override
|
||||
public void delOperation(ReqBatchRegionDto delRegionDto) {
|
||||
List<EbikeOperationRegion> ebikeOperationRegions = this.mapper.selectListByIds(delRegionDto.getIds());
|
||||
ebikeOperationRegions.forEach(region->{
|
||||
delPoints(region.getOrgId(),region.getOperationRegionId());
|
||||
ebikeOperationRegions.forEach(region -> {
|
||||
delPoints(region.getOrgId(), region.getOperationRegionId());
|
||||
});
|
||||
this.mapper.deleteBatchByIds(delRegionDto.getIds());
|
||||
}
|
||||
@ -135,7 +136,7 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl<EbikeOperationR
|
||||
.leftJoin(EBIKE_STAFF_REGION).on(EBIKE_OPERATION_REGION.OPERATION_REGION_ID.eq(EBIKE_STAFF_REGION.REGION_ID))
|
||||
.where(EBIKE_STAFF_REGION.STAFF_ID.eq(staffFeign.getStaffId()))
|
||||
.where(EBIKE_OPERATION_REGION.ZONE_ID.eq(zoneId, StringUtil.hasText(zoneId)));
|
||||
return this.mapper.selectListWithRelationsByQueryAs(queryWrapper,ResEbikeOperationRegionDto.class);
|
||||
return this.mapper.selectListWithRelationsByQueryAs(queryWrapper, ResEbikeOperationRegionDto.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -178,14 +179,14 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl<EbikeOperationR
|
||||
if (redisPoints == null || redisPoints.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
Map<String,RedisPoint> map = new HashMap<>();
|
||||
Map<String, RedisPoint> map = new HashMap<>();
|
||||
for (RedisPoint redisPoint : redisPoints) {
|
||||
map.put(redisPoint.getMember(), redisPoint);
|
||||
}
|
||||
List<String> strings = redisPoints.stream().map(RedisPoint::getMember).toList();
|
||||
ReqEcuSnDto ecuSnDto = new ReqEcuSnDto(strings);
|
||||
JsonResult<List<RspBikeInfo>> result = maintenanceFeignClient.getBikeByEcuSn(ecuSnDto);
|
||||
if (result.getCode() != 200){
|
||||
if (result.getCode() != 200) {
|
||||
throw new RuntimeException("获取车辆信息失败");
|
||||
}
|
||||
List<RspBikeInfo> bikeInfos = result.getData();
|
||||
@ -211,7 +212,7 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl<EbikeOperationR
|
||||
.select(EBIKE_OPERATION_REGION.OPERATION_REGION_ID)
|
||||
.leftJoin(EBIKE_ADMINISTRATION_ZONE).on(EBIKE_ADMINISTRATION_ZONE.ID.eq(EBIKE_OPERATION_REGION.ZONE_ID))
|
||||
.where(EBIKE_ADMINISTRATION_ZONE.NAME.like(zoneName));
|
||||
return this.mapper.selectListByQueryAs(queryWrapper,Long.class);
|
||||
return this.mapper.selectListByQueryAs(queryWrapper, Long.class);
|
||||
}
|
||||
|
||||
void savePoints(List<ReqEbikePointDto> points, Long orgId, Long operateRegionId) {
|
||||
@ -250,7 +251,7 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl<EbikeOperationR
|
||||
}
|
||||
redisUtil.addOperationArea(orgId, operateRegionId, vertices);
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_POINT.REGION_ID.eq(operateRegionId));
|
||||
.where(EBIKE_POINT.REGION_ID.eq(operateRegionId));
|
||||
pointMapper.deleteByQuery(queryWrapper);
|
||||
pointMapper.insertBatch(list);
|
||||
}
|
||||
@ -262,7 +263,7 @@ public class EbikeOperationRegionServiceImpl extends ServiceImpl<EbikeOperationR
|
||||
redisUtil.delOperationArea(orgId, operateRegionId);
|
||||
}
|
||||
|
||||
StaffFeign getStaff(){
|
||||
StaffFeign getStaff() {
|
||||
String tokenValue = StpUtil.getTokenValue();
|
||||
JsonResult<StaffFeign> jsonResult = staffFeignClient.getInfoByToken(tokenValue);
|
||||
StaffFeign staffFeign = jsonResult.getData();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user