fix: 优化批量驳回方法
This commit is contained in:
parent
a623c90f21
commit
e52dccdb3e
@ -245,6 +245,22 @@ public class FishDraftDataController {
|
|||||||
return result ? ResponseResult.success("驳回成功") : ResponseResult.error("驳回失败");
|
return result ? ResponseResult.success("驳回成功") : ResponseResult.error("驳回失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/batchReject")
|
||||||
|
@Operation(summary = "批量驳回")
|
||||||
|
public ResponseResult batchRejectFull(@RequestBody BatchRejectRequest request) {
|
||||||
|
if (request.getApprovalIds() != null && !request.getApprovalIds().isEmpty()) {
|
||||||
|
List<FishDraftData> draft = fishDraftDataService.list(new LambdaQueryWrapper<FishDraftData>().in(FishDraftData::getApprovalId, request.getApprovalIds()).eq(FishDraftData::getStatus, "PENDING").select(FishDraftData::getId));
|
||||||
|
List<String> ids = draft.stream().map(FishDraftData::getId).toList();
|
||||||
|
boolean result = fishDraftDataService.rejectBatch(ids, request.getRejectReason());
|
||||||
|
return result ? ResponseResult.success("驳回成功") : ResponseResult.error("驳回失败");
|
||||||
|
}
|
||||||
|
if (request.getIds() != null && !request.getIds().isEmpty()) {
|
||||||
|
boolean result = fishDraftDataService.rejectBatch(request.getIds(), request.getRejectReason());
|
||||||
|
return result ? ResponseResult.success("驳回成功") : ResponseResult.error("驳回失败");
|
||||||
|
}
|
||||||
|
return ResponseResult.error("请选择要驳回的数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/lockDraft")
|
@PostMapping("/lockDraft")
|
||||||
@Operation(summary = "锁定草稿")
|
@Operation(summary = "锁定草稿")
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.yfd.platform.data.domain;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批驳回请求参数
|
* 审批驳回请求参数
|
||||||
*/
|
*/
|
||||||
@ -13,6 +15,12 @@ public class BatchRejectRequest {
|
|||||||
@Schema(description = "草稿数据ID")
|
@Schema(description = "草稿数据ID")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "草稿数据ID列表")
|
||||||
|
private List<String> ids;
|
||||||
|
|
||||||
|
@Schema(description = "批次ID列表")
|
||||||
|
private List<String> approvalIds;
|
||||||
|
|
||||||
@Schema(description = "驳回原因")
|
@Schema(description = "驳回原因")
|
||||||
private String rejectReason;
|
private String rejectReason;
|
||||||
}
|
}
|
||||||
@ -75,6 +75,11 @@ public interface IFishDraftDataService extends IService<FishDraftData> {
|
|||||||
*/
|
*/
|
||||||
boolean batchReject(String id, String rejectReason);
|
boolean batchReject(String id, String rejectReason);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量驳回
|
||||||
|
*/
|
||||||
|
boolean rejectBatch(List<String> ids, String rejectReason);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 锁定草稿
|
* 锁定草稿
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -87,7 +87,9 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
|||||||
String endTime=null;
|
String endTime=null;
|
||||||
// String userId = (SecurityUtils.hasPermission("sjtb:edit-review") || "admin".equals(SecurityUtils.getCurrentUsername())) ?null:SecurityUtils.getUserId();
|
// String userId = (SecurityUtils.hasPermission("sjtb:edit-review") || "admin".equals(SecurityUtils.getCurrentUsername())) ?null:SecurityUtils.getUserId();
|
||||||
String userId = SecurityUtils.getUserId();
|
String userId = SecurityUtils.getUserId();
|
||||||
|
if(StrUtil.isNotBlank(approvalId)){
|
||||||
|
userId=null;
|
||||||
|
}
|
||||||
// 如果 startTime 和 endTime 为空,尝试从 TM 字段解析
|
// 如果 startTime 和 endTime 为空,尝试从 TM 字段解析
|
||||||
if (StrUtil.isNotBlank(STRDT)&& STRDT.split( ",").length==2) {
|
if (StrUtil.isNotBlank(STRDT)&& STRDT.split( ",").length==2) {
|
||||||
startTime=STRDT.split(",")[0];
|
startTime=STRDT.split(",")[0];
|
||||||
@ -461,6 +463,55 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean rejectBatch(List<String> ids, String rejectReason) {
|
||||||
|
if (ids == null || ids.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(rejectReason)) {
|
||||||
|
throw new IllegalArgumentException("驳回原因不能为空");
|
||||||
|
}
|
||||||
|
Date now = new Date();
|
||||||
|
String operatorId = SecurityUtils.getUserId();
|
||||||
|
|
||||||
|
List<FishDraftData> dataList = this.listByIds(ids);
|
||||||
|
Set<String> processedApprovalIds = new HashSet<>();
|
||||||
|
List<String> validIds = new ArrayList<>();
|
||||||
|
|
||||||
|
for (FishDraftData fishDraftData : dataList) {
|
||||||
|
if ("PENDING".equals(fishDraftData.getStatus())) {
|
||||||
|
validIds.add(fishDraftData.getId());
|
||||||
|
if (fishDraftData.getApprovalId() != null) {
|
||||||
|
processedApprovalIds.add(fishDraftData.getApprovalId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!validIds.isEmpty()) {
|
||||||
|
LambdaUpdateWrapper<FishDraftData> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.in(FishDraftData::getId, validIds);
|
||||||
|
updateWrapper.set(FishDraftData::getStatus, "REJECTED");
|
||||||
|
updateWrapper.set(FishDraftData::getApproveTime, now);
|
||||||
|
updateWrapper.set(FishDraftData::getUpdatedBy, operatorId);
|
||||||
|
this.update(updateWrapper);
|
||||||
|
|
||||||
|
for (String approvalId : processedApprovalIds) {
|
||||||
|
approvalLogService.logReject(approvalId, operatorId, rejectReason);
|
||||||
|
ApprovalMain approvalMain = approvalMainService.getById(approvalId);
|
||||||
|
if (approvalMain != null) {
|
||||||
|
approvalMain.setStatus("REJECTED");
|
||||||
|
approvalMain.setApproverId(operatorId);
|
||||||
|
approvalMain.setApproveTime(now);
|
||||||
|
approvalMain.setRemark(rejectReason);
|
||||||
|
approvalMainService.updateById(approvalMain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean lockDraft(String id) {
|
public boolean lockDraft(String id) {
|
||||||
|
|||||||
@ -85,14 +85,6 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
private static final Map<String, String> FPSS_TO_STATION_CACHE = new LinkedHashMap<>();
|
private static final Map<String, String> FPSS_TO_STATION_CACHE = new LinkedHashMap<>();
|
||||||
private static final Map<String, String> ISFS_DICT_CACHE = new LinkedHashMap<>();
|
private static final Map<String, String> ISFS_DICT_CACHE = new LinkedHashMap<>();
|
||||||
|
|
||||||
private static final long CACHE_EXPIRE_MILLIS = 10 * 60 * 1000;
|
|
||||||
private static long stationCacheTimestamp = 0;
|
|
||||||
private static long baseCacheTimestamp = 0;
|
|
||||||
private static long riverCacheTimestamp = 0;
|
|
||||||
private static long hbrvcdCacheTimestamp = 0;
|
|
||||||
private static long fishDictCacheTimestamp = 0;
|
|
||||||
private static long fpssCacheTimestamp = 0;
|
|
||||||
|
|
||||||
private static final String DICT_CODE_FISH = "FISH_TYPE";
|
private static final String DICT_CODE_FISH = "FISH_TYPE";
|
||||||
private static final String DICT_CODE_DIRECTION = "FISH_DIRECTION";
|
private static final String DICT_CODE_DIRECTION = "FISH_DIRECTION";
|
||||||
private static final String DICT_CODE_ISFS = "YES_NO";
|
private static final String DICT_CODE_ISFS = "YES_NO";
|
||||||
@ -202,6 +194,62 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
FishImportResult.FishImportRow importRow = new FishImportResult.FishImportRow(rowIndex);
|
FishImportResult.FishImportRow importRow = new FishImportResult.FishImportRow(rowIndex);
|
||||||
FishDraftData data = new FishDraftData();
|
FishDraftData data = new FishDraftData();
|
||||||
data.setId(UUID.randomUUID().toString());
|
data.setId(UUID.randomUUID().toString());
|
||||||
|
String userId = SecurityUtils.getUserId();
|
||||||
|
Set<String> allowedHbrvcdSet = new HashSet<>();
|
||||||
|
Set<String> directStcdSet = new HashSet<>();
|
||||||
|
Set<String> directBHSet = new HashSet<>();
|
||||||
|
if (userId != null) {
|
||||||
|
List<SysUserDataScope> permissions = userDataScopeMapper.selectValidPermissions(userId);
|
||||||
|
if (permissions != null && !permissions.isEmpty()) {
|
||||||
|
for (SysUserDataScope permission : permissions) {
|
||||||
|
String orgType = permission.getOrgType();
|
||||||
|
String orgId = permission.getOrgId();
|
||||||
|
|
||||||
|
if (orgId == null || orgId.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("HBRVCD".equals(orgType)) {
|
||||||
|
allowedHbrvcdSet.add(orgId);
|
||||||
|
} else if ("STATION".equals(orgType)) {
|
||||||
|
directStcdSet.add(orgId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> allStcdSet = new HashSet<>();
|
||||||
|
|
||||||
|
if (!allowedHbrvcdSet.isEmpty() || !directStcdSet.isEmpty()) {
|
||||||
|
if (!allowedHbrvcdSet.isEmpty()) {
|
||||||
|
List<SdEngInfoBH> stationsFromHbrv = engInfoBHMapper.selectByHbrvcdList(new ArrayList<>(allowedHbrvcdSet));
|
||||||
|
for (SdEngInfoBH station : stationsFromHbrv) {
|
||||||
|
if (station.getStcd() != null) {
|
||||||
|
allStcdSet.add(station.getStcd());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!directStcdSet.isEmpty()) {
|
||||||
|
List<SdEngInfoBH> stationsFromStcd = engInfoBHMapper.selectBatchIds(new ArrayList<>(directStcdSet));
|
||||||
|
for (SdEngInfoBH station : stationsFromStcd) {
|
||||||
|
if (station.getStcd() != null) {
|
||||||
|
allStcdSet.add(station.getStcd());
|
||||||
|
}
|
||||||
|
if (station.getHbrvcd() != null) {
|
||||||
|
allowedHbrvcdSet.add(station.getHbrvcd());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!directStcdSet.isEmpty()) {
|
||||||
|
List<SdFpssBH> sdFpssBHS = fpssBHMapper.selectList(new LambdaQueryWrapper<SdFpssBH>().in(SdFpssBH::getRstcd, allStcdSet).select(SdFpssBH::getStcd));
|
||||||
|
for (SdFpssBH sdFpssBH : sdFpssBHS) {
|
||||||
|
if (sdFpssBH.getStcd() != null) {
|
||||||
|
directBHSet.add(sdFpssBH.getStcd());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for (Map.Entry<Integer, String> entry : columnIndexMap.entrySet()) {
|
for (Map.Entry<Integer, String> entry : columnIndexMap.entrySet()) {
|
||||||
Integer columnIndex = entry.getKey();
|
Integer columnIndex = entry.getKey();
|
||||||
String fieldName = entry.getValue();
|
String fieldName = entry.getValue();
|
||||||
@ -220,8 +268,15 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
importRow.getWarnings().add("rstcd");
|
importRow.getWarnings().add("rstcd");
|
||||||
data.setEnnm(cellValue.trim());
|
data.setEnnm(cellValue.trim());
|
||||||
} else {
|
} else {
|
||||||
|
if (allStcdSet.contains(stcd)) {
|
||||||
data.setEnnm(cellValue.trim());
|
data.setEnnm(cellValue.trim());
|
||||||
data.setRstcd(stcd);
|
data.setRstcd(stcd);
|
||||||
|
} else {
|
||||||
|
importRow.getWarnings().add("rstcd");
|
||||||
|
data.setEnnm(cellValue.trim());
|
||||||
|
data.setRstcd(cellValue);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -265,8 +320,15 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
data.setHbrvcd(cellValue.trim());
|
data.setHbrvcd(cellValue.trim());
|
||||||
data.setHbrvnm(cellValue.trim());
|
data.setHbrvnm(cellValue.trim());
|
||||||
} else {
|
} else {
|
||||||
|
if (allowedHbrvcdSet.contains(hbrvcdCode)) {
|
||||||
data.setHbrvcd(hbrvcdCode);
|
data.setHbrvcd(hbrvcdCode);
|
||||||
data.setHbrvnm(cellValue.trim());
|
data.setHbrvnm(cellValue.trim());
|
||||||
|
} else {
|
||||||
|
importRow.getWarnings().add("hbrvcd");
|
||||||
|
data.setHbrvcd(cellValue.trim());
|
||||||
|
data.setHbrvnm(cellValue.trim());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (StringUtils.hasText(cellValue)) {
|
// if (StringUtils.hasText(cellValue)) {
|
||||||
@ -434,8 +496,15 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
data.setStcd(cellValue.trim());
|
data.setStcd(cellValue.trim());
|
||||||
data.setStnm(cellValue.trim());
|
data.setStnm(cellValue.trim());
|
||||||
} else {
|
} else {
|
||||||
|
if(directBHSet.contains(stcd)){
|
||||||
data.setStnm(cellValue.trim());
|
data.setStnm(cellValue.trim());
|
||||||
data.setStcd(stcd);
|
data.setStcd(stcd);
|
||||||
|
}else {
|
||||||
|
importRow.getWarnings().add("stcd");
|
||||||
|
data.setStcd(cellValue.trim());
|
||||||
|
data.setStnm(cellValue.trim());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -483,69 +552,64 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadStationAndBaseCache() {
|
private void loadStationAndBaseCache() {
|
||||||
String userId = SecurityUtils.getUserId();
|
// String userId = SecurityUtils.getUserId();
|
||||||
Set<String> allowedHbrvcdSet = new HashSet<>();
|
// Set<String> allowedHbrvcdSet = new HashSet<>();
|
||||||
Set<String> directStcdSet = new HashSet<>();
|
// Set<String> directStcdSet = new HashSet<>();
|
||||||
|
//
|
||||||
|
// if (userId != null) {
|
||||||
|
// List<SysUserDataScope> permissions = userDataScopeMapper.selectValidPermissions(userId);
|
||||||
|
// if (permissions != null && !permissions.isEmpty()) {
|
||||||
|
// for (SysUserDataScope permission : permissions) {
|
||||||
|
// String orgType = permission.getOrgType();
|
||||||
|
// String orgId = permission.getOrgId();
|
||||||
|
//
|
||||||
|
// if (orgId == null || orgId.isEmpty()) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if ("HBRVCD".equals(orgType)) {
|
||||||
|
// allowedHbrvcdSet.add(orgId);
|
||||||
|
// } else if ("STATION".equals(orgType)) {
|
||||||
|
// directStcdSet.add(orgId);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Set<String> allStcdSet = new HashSet<>();
|
||||||
|
//
|
||||||
|
// if (!allowedHbrvcdSet.isEmpty() || !directStcdSet.isEmpty()) {
|
||||||
|
// if (!allowedHbrvcdSet.isEmpty()) {
|
||||||
|
// List<SdEngInfoBH> stationsFromHbrv = engInfoBHMapper.selectByHbrvcdList(new ArrayList<>(allowedHbrvcdSet));
|
||||||
|
// for (SdEngInfoBH station : stationsFromHbrv) {
|
||||||
|
// if (station.getStcd() != null) {
|
||||||
|
// allStcdSet.add(station.getStcd());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (!directStcdSet.isEmpty()) {
|
||||||
|
// List<SdEngInfoBH> stationsFromStcd = engInfoBHMapper.selectBatchIds(new ArrayList<>(directStcdSet));
|
||||||
|
// for (SdEngInfoBH station : stationsFromStcd) {
|
||||||
|
// if (station.getStcd() != null) {
|
||||||
|
// allStcdSet.add(station.getStcd());
|
||||||
|
// }
|
||||||
|
// if (station.getHbrvcd() != null) {
|
||||||
|
// allowedHbrvcdSet.add(station.getHbrvcd());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (userId != null) {
|
if (STATION_NAME_CACHE.isEmpty()) {
|
||||||
List<SysUserDataScope> permissions = userDataScopeMapper.selectValidPermissions(userId);
|
List<SdEngInfoBH> stationList = engInfoBHMapper.selectList(null);
|
||||||
if (permissions != null && !permissions.isEmpty()) {
|
// if (!allStcdSet.isEmpty()) {
|
||||||
for (SysUserDataScope permission : permissions) {
|
// stationList = engInfoBHMapper.selectBatchIds(new ArrayList<>(allStcdSet));
|
||||||
String orgType = permission.getOrgType();
|
// } else if("admin".equals(SecurityUtils.getCurrentUsername())){
|
||||||
String orgId = permission.getOrgId();
|
//
|
||||||
|
// }else {
|
||||||
if (orgId == null || orgId.isEmpty()) {
|
// stationList = new ArrayList<>();
|
||||||
continue;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
if ("HBRVCD".equals(orgType)) {
|
|
||||||
allowedHbrvcdSet.add(orgId);
|
|
||||||
} else if ("STATION".equals(orgType)) {
|
|
||||||
directStcdSet.add(orgId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<String> allStcdSet = new HashSet<>();
|
|
||||||
|
|
||||||
if (!allowedHbrvcdSet.isEmpty() || !directStcdSet.isEmpty()) {
|
|
||||||
if (!allowedHbrvcdSet.isEmpty()) {
|
|
||||||
List<SdEngInfoBH> stationsFromHbrv = engInfoBHMapper.selectByHbrvcdList(new ArrayList<>(allowedHbrvcdSet));
|
|
||||||
for (SdEngInfoBH station : stationsFromHbrv) {
|
|
||||||
if (station.getStcd() != null) {
|
|
||||||
allStcdSet.add(station.getStcd());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!directStcdSet.isEmpty()) {
|
|
||||||
List<SdEngInfoBH> stationsFromStcd = engInfoBHMapper.selectBatchIds(new ArrayList<>(directStcdSet));
|
|
||||||
for (SdEngInfoBH station : stationsFromStcd) {
|
|
||||||
if (station.getStcd() != null) {
|
|
||||||
allStcdSet.add(station.getStcd());
|
|
||||||
}
|
|
||||||
if (station.getHbrvcd() != null) {
|
|
||||||
allowedHbrvcdSet.add(station.getHbrvcd());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean stationCacheExpired = isCacheExpired(stationCacheTimestamp);
|
|
||||||
if (STATION_NAME_CACHE.isEmpty() || stationCacheExpired) {
|
|
||||||
if (stationCacheExpired) {
|
|
||||||
STATION_NAME_CACHE.clear();
|
|
||||||
STATION_CODE_TO_NAME_CACHE.clear();
|
|
||||||
STATION_TO_BASE_CACHE.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<SdEngInfoBH> stationList;
|
|
||||||
if (!allStcdSet.isEmpty()) {
|
|
||||||
stationList = engInfoBHMapper.selectBatchIds(new ArrayList<>(allStcdSet));
|
|
||||||
} else {
|
|
||||||
stationList = engInfoBHMapper.selectList(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (SdEngInfoBH station : stationList) {
|
for (SdEngInfoBH station : stationList) {
|
||||||
if (StringUtils.hasText(station.getEnnm())) {
|
if (StringUtils.hasText(station.getEnnm())) {
|
||||||
@ -560,16 +624,9 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stationCacheTimestamp = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean baseCacheExpired = isCacheExpired(baseCacheTimestamp);
|
|
||||||
if (BASE_NAME_CACHE.isEmpty() || baseCacheExpired) {
|
|
||||||
if (baseCacheExpired) {
|
|
||||||
BASE_NAME_CACHE.clear();
|
|
||||||
BASE_CODE_TO_NAME_CACHE.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BASE_NAME_CACHE.isEmpty()) {
|
||||||
List<SdHydrobase> baseList = hydrobaseMapper.selectList(null);
|
List<SdHydrobase> baseList = hydrobaseMapper.selectList(null);
|
||||||
for (SdHydrobase base : baseList) {
|
for (SdHydrobase base : baseList) {
|
||||||
if (StringUtils.hasText(base.getBasename())) {
|
if (StringUtils.hasText(base.getBasename())) {
|
||||||
@ -581,16 +638,9 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
baseCacheTimestamp = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean riverCacheExpired = isCacheExpired(riverCacheTimestamp);
|
|
||||||
if (RIVER_NAME_CACHE.isEmpty() || riverCacheExpired) {
|
|
||||||
if (riverCacheExpired) {
|
|
||||||
RIVER_NAME_CACHE.clear();
|
|
||||||
RIVER_CODE_TO_NAME_CACHE.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RIVER_NAME_CACHE.isEmpty()) {
|
||||||
List<SdRvcdDic> riverList = rvcdDicMapper.selectList(null);
|
List<SdRvcdDic> riverList = rvcdDicMapper.selectList(null);
|
||||||
for (SdRvcdDic river : riverList) {
|
for (SdRvcdDic river : riverList) {
|
||||||
if (StringUtils.hasText(river.getRvnm())) {
|
if (StringUtils.hasText(river.getRvnm())) {
|
||||||
@ -602,24 +652,17 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
riverCacheTimestamp = System.currentTimeMillis();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hbrvcdCacheExpired = isCacheExpired(hbrvcdCacheTimestamp);
|
if (HBRVCD_NAME_CACHE.isEmpty()) {
|
||||||
if (HBRVCD_NAME_CACHE.isEmpty() || hbrvcdCacheExpired) {
|
List<SdHbrvDic> riverList = sdHbrvDicMapper.selectList(null);
|
||||||
if (hbrvcdCacheExpired) {
|
// if (!allowedHbrvcdSet.isEmpty()) {
|
||||||
HBRVCD_NAME_CACHE.clear();
|
// LambdaQueryWrapper<SdHbrvDic> wrapper = new LambdaQueryWrapper<>();
|
||||||
HBRVCD_CODE_TO_NAME_CACHE.clear();
|
// wrapper.in(SdHbrvDic::getHbrvcd, allowedHbrvcdSet);
|
||||||
}
|
// riverList = sdHbrvDicMapper.selectList(wrapper);
|
||||||
|
// } else {
|
||||||
List<SdHbrvDic> riverList;
|
// riverList = sdHbrvDicMapper.selectList(null);
|
||||||
if (!allowedHbrvcdSet.isEmpty()) {
|
// }
|
||||||
LambdaQueryWrapper<SdHbrvDic> wrapper = new LambdaQueryWrapper<>();
|
|
||||||
wrapper.in(SdHbrvDic::getHbrvcd, allowedHbrvcdSet);
|
|
||||||
riverList = sdHbrvDicMapper.selectList(wrapper);
|
|
||||||
} else {
|
|
||||||
riverList = sdHbrvDicMapper.selectList(null);
|
|
||||||
}
|
|
||||||
for (SdHbrvDic river : riverList) {
|
for (SdHbrvDic river : riverList) {
|
||||||
if (StringUtils.hasText(river.getHbrvnm())) {
|
if (StringUtils.hasText(river.getHbrvnm())) {
|
||||||
HBRVCD_NAME_CACHE.put(river.getHbrvnm().trim().toLowerCase(), river.getHbrvcd());
|
HBRVCD_NAME_CACHE.put(river.getHbrvnm().trim().toLowerCase(), river.getHbrvcd());
|
||||||
@ -630,16 +673,9 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hbrvcdCacheTimestamp = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean fishDictCacheExpired = isCacheExpired(fishDictCacheTimestamp);
|
|
||||||
if (FISH_DICT_CACHE.isEmpty() || fishDictCacheExpired) {
|
|
||||||
if (fishDictCacheExpired) {
|
|
||||||
FISH_DICT_CACHE.clear();
|
|
||||||
FISH_CODE_TO_NAME_CACHE.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FISH_DICT_CACHE.isEmpty()) {
|
||||||
List<SdFishDictoryB> sdFishDictoryBS = fishDictoryBMapper.selectList(null);
|
List<SdFishDictoryB> sdFishDictoryBS = fishDictoryBMapper.selectList(null);
|
||||||
for (SdFishDictoryB fishDictoryB : sdFishDictoryBS) {
|
for (SdFishDictoryB fishDictoryB : sdFishDictoryBS) {
|
||||||
if (StringUtils.hasText(fishDictoryB.getName())) {
|
if (StringUtils.hasText(fishDictoryB.getName())) {
|
||||||
@ -651,23 +687,15 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fishDictCacheTimestamp = System.currentTimeMillis();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean fpssCacheExpired = isCacheExpired(fpssCacheTimestamp);
|
if (FPSS_BH_CACHE.isEmpty()) {
|
||||||
if (FPSS_BH_CACHE.isEmpty() || fpssCacheExpired) {
|
List<SdFpssBH> sdFpssBHS = fpssBHMapper.selectList(null);
|
||||||
if (fpssCacheExpired) {
|
// if (!allStcdSet.isEmpty()) {
|
||||||
FPSS_BH_CACHE.clear();
|
// sdFpssBHS = fpssBHMapper.selectList(new LambdaQueryWrapper<SdFpssBH>().in(SdFpssBH::getStcd, allStcdSet));
|
||||||
FPSS_CODE_TO_NAME_CACHE.clear();
|
// } else {
|
||||||
FPSS_TO_STATION_CACHE.clear();
|
// sdFpssBHS = fpssBHMapper.selectList(null);
|
||||||
}
|
// }
|
||||||
|
|
||||||
List<SdFpssBH> sdFpssBHS;
|
|
||||||
if (!allStcdSet.isEmpty()) {
|
|
||||||
sdFpssBHS = fpssBHMapper.selectList(new LambdaQueryWrapper<SdFpssBH>().in(SdFpssBH::getStcd, allStcdSet));
|
|
||||||
} else {
|
|
||||||
sdFpssBHS = fpssBHMapper.selectList(null);
|
|
||||||
}
|
|
||||||
for (SdFpssBH sdFpssBH : sdFpssBHS) {
|
for (SdFpssBH sdFpssBH : sdFpssBHS) {
|
||||||
if (StringUtils.hasText(sdFpssBH.getStnm())) {
|
if (StringUtils.hasText(sdFpssBH.getStnm())) {
|
||||||
FPSS_BH_CACHE.put(sdFpssBH.getStnm().trim().toLowerCase(), sdFpssBH.getStcd());
|
FPSS_BH_CACHE.put(sdFpssBH.getStnm().trim().toLowerCase(), sdFpssBH.getStcd());
|
||||||
@ -681,14 +709,9 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fpssCacheTimestamp = System.currentTimeMillis();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCacheExpired(long timestamp) {
|
|
||||||
return System.currentTimeMillis() - timestamp > CACHE_EXPIRE_MILLIS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String resolveStationCode(String stationName) {
|
public String resolveStationCode(String stationName) {
|
||||||
if (stationName == null) {
|
if (stationName == null) {
|
||||||
|
|||||||
@ -70,11 +70,13 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
|||||||
@Override
|
@Override
|
||||||
public List<SdEngInfoBH> selectForDropdown(SdEngInfoBHRequest sdEngInfoBHRequest) {
|
public List<SdEngInfoBH> selectForDropdown(SdEngInfoBHRequest sdEngInfoBHRequest) {
|
||||||
String baseId = sdEngInfoBHRequest.getBaseId();
|
String baseId = sdEngInfoBHRequest.getBaseId();
|
||||||
|
String hbrvcd = sdEngInfoBHRequest.getHbrvcd();
|
||||||
String ennm = sdEngInfoBHRequest.getEnnm();
|
String ennm = sdEngInfoBHRequest.getEnnm();
|
||||||
List<String> rvcds = sdEngInfoBHRequest.getRvcds();
|
List<String> rvcds = sdEngInfoBHRequest.getRvcds();
|
||||||
List<String> hbrvcds = sdEngInfoBHRequest.getHbrvcds();
|
List<String> hbrvcds = sdEngInfoBHRequest.getHbrvcds();
|
||||||
LambdaQueryWrapper<SdEngInfoBH> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SdEngInfoBH> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(StringUtils.hasText(baseId), SdEngInfoBH::getBaseId, baseId)
|
wrapper.eq(StringUtils.hasText(baseId), SdEngInfoBH::getBaseId, baseId)
|
||||||
|
.eq(StringUtils.hasText(hbrvcd), SdEngInfoBH::getHbrvcd, hbrvcd)
|
||||||
.in(rvcds != null && !rvcds.isEmpty(), SdEngInfoBH::getRvcd, rvcds)
|
.in(rvcds != null && !rvcds.isEmpty(), SdEngInfoBH::getRvcd, rvcds)
|
||||||
.in(hbrvcds != null && !hbrvcds.isEmpty(), SdEngInfoBH::getHbrvcd, hbrvcds)
|
.in(hbrvcds != null && !hbrvcds.isEmpty(), SdEngInfoBH::getHbrvcd, hbrvcds)
|
||||||
.like(StringUtils.hasText(ennm), SdEngInfoBH::getEnnm, ennm)
|
.like(StringUtils.hasText(ennm), SdEngInfoBH::getEnnm, ennm)
|
||||||
@ -175,10 +177,12 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
|||||||
public List<SdEngInfoBH> selectRegDropdown(SdEngInfoBHRequest sdEngInfoBHRequest) {
|
public List<SdEngInfoBH> selectRegDropdown(SdEngInfoBHRequest sdEngInfoBHRequest) {
|
||||||
String baseId = sdEngInfoBHRequest.getBaseId();
|
String baseId = sdEngInfoBHRequest.getBaseId();
|
||||||
String ennm = sdEngInfoBHRequest.getEnnm();
|
String ennm = sdEngInfoBHRequest.getEnnm();
|
||||||
|
String hbrvcd = sdEngInfoBHRequest.getHbrvcd();
|
||||||
List<String> rvcds = sdEngInfoBHRequest.getRvcds();
|
List<String> rvcds = sdEngInfoBHRequest.getRvcds();
|
||||||
List<String> hbrvcds = sdEngInfoBHRequest.getHbrvcds();
|
List<String> hbrvcds = sdEngInfoBHRequest.getHbrvcds();
|
||||||
LambdaQueryWrapper<SdEngInfoBH> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SdEngInfoBH> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(StringUtils.hasText(baseId), SdEngInfoBH::getBaseId, baseId)
|
wrapper.eq(StringUtils.hasText(baseId), SdEngInfoBH::getBaseId, baseId)
|
||||||
|
.eq(StringUtils.hasText(hbrvcd), SdEngInfoBH::getHbrvcd, hbrvcd)
|
||||||
.in(rvcds != null && !rvcds.isEmpty(), SdEngInfoBH::getRvcd, rvcds)
|
.in(rvcds != null && !rvcds.isEmpty(), SdEngInfoBH::getRvcd, rvcds)
|
||||||
.in(hbrvcds != null && !hbrvcds.isEmpty(), SdEngInfoBH::getHbrvcd, hbrvcds)
|
.in(hbrvcds != null && !hbrvcds.isEmpty(), SdEngInfoBH::getHbrvcd, hbrvcds)
|
||||||
.like(StringUtils.hasText(ennm), SdEngInfoBH::getEnnm, ennm)
|
.like(StringUtils.hasText(ennm), SdEngInfoBH::getEnnm, ennm)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user