fix: 优化下拉列表逻辑
This commit is contained in:
parent
7839508630
commit
256a22aa49
@ -43,6 +43,8 @@ public class FishImportResult {
|
|||||||
private FishDraftData data;
|
private FishDraftData data;
|
||||||
private List<String> unrecognizedFields;
|
private List<String> unrecognizedFields;
|
||||||
private List<String> warnings;
|
private List<String> warnings;
|
||||||
|
private List<Map<String, String>> vdpthList;
|
||||||
|
private List<Map<String, String>> picpthList;
|
||||||
private List<String> vdpthsWarnings;
|
private List<String> vdpthsWarnings;
|
||||||
private List<String> picpthsWarnings;
|
private List<String> picpthsWarnings;
|
||||||
public FishImportRow() {
|
public FishImportRow() {
|
||||||
@ -50,6 +52,8 @@ public class FishImportResult {
|
|||||||
this.warnings = new ArrayList<>();
|
this.warnings = new ArrayList<>();
|
||||||
this.vdpthsWarnings = new ArrayList<>();
|
this.vdpthsWarnings = new ArrayList<>();
|
||||||
this.picpthsWarnings = new ArrayList<>();
|
this.picpthsWarnings = new ArrayList<>();
|
||||||
|
this.vdpthList = new ArrayList<>();
|
||||||
|
this.picpthList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FishImportRow(int rowIndex) {
|
public FishImportRow(int rowIndex) {
|
||||||
@ -58,6 +62,8 @@ public class FishImportResult {
|
|||||||
this.warnings = new ArrayList<>();
|
this.warnings = new ArrayList<>();
|
||||||
this.vdpthsWarnings = new ArrayList<>();
|
this.vdpthsWarnings = new ArrayList<>();
|
||||||
this.picpthsWarnings = new ArrayList<>();
|
this.picpthsWarnings = new ArrayList<>();
|
||||||
|
this.vdpthList = new ArrayList<>();
|
||||||
|
this.picpthList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ public interface FishDraftDataMapper extends BaseMapper<FishDraftData> {
|
|||||||
@Param("status") String status,
|
@Param("status") String status,
|
||||||
@Param("ftp") String ftp,
|
@Param("ftp") String ftp,
|
||||||
@Param("startTime") String startTime,
|
@Param("startTime") String startTime,
|
||||||
@Param("endTime") String endTime);
|
@Param("endTime") String endTime,@Param("userId") String userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联查询过鱼数据(不分页)
|
* 关联查询过鱼数据(不分页)
|
||||||
|
|||||||
@ -67,13 +67,15 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
|||||||
String TM = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "TM");
|
String TM = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "TM");
|
||||||
String startTime=null;
|
String startTime=null;
|
||||||
String endTime=null;
|
String endTime=null;
|
||||||
|
|
||||||
|
SecurityUtils.getCurrentUser().getAuthorities();
|
||||||
|
String userId = SecurityUtils.getCurrentUser().getAuthorities().contains("sjtb:import-add") || "admin".equals(SecurityUtils.getCurrentUsername()) ?null:SecurityUtils.getUserId();
|
||||||
// 如果 startTime 和 endTime 为空,尝试从 TM 字段解析
|
// 如果 startTime 和 endTime 为空,尝试从 TM 字段解析
|
||||||
if (StrUtil.isNotBlank(TM)&& TM.split( ",").length==2) {
|
if (StrUtil.isNotBlank(TM)&& TM.split( ",").length==2) {
|
||||||
startTime=TM.split(",")[0];
|
startTime=TM.split(",")[0];
|
||||||
endTime=TM.split(",")[1];
|
endTime=TM.split(",")[1];
|
||||||
}
|
}
|
||||||
Page<FishDraftDataVO> resultPage = fishDraftDataMapper.selectJoinPage(
|
Page<FishDraftDataVO> resultPage = fishDraftDataMapper.selectJoinPage(page, stcd, rstcd, baseId, direction, status, ftp, startTime, endTime,userId);
|
||||||
page, stcd, rstcd, baseId, direction, status, ftp, startTime, endTime);
|
|
||||||
fillUserNames(resultPage.getRecords());
|
fillUserNames(resultPage.getRecords());
|
||||||
return resultPage;
|
return resultPage;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -821,13 +821,15 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
if (fileName.isEmpty()) {
|
if (fileName.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String actualPath = findFilePath(fileName, videoMap);
|
String actualPath = findFilePath(fileName, videoMap);
|
||||||
|
Map<String, String> fileMap = new HashMap<>();
|
||||||
|
fileMap.put("name", fileName);
|
||||||
if (actualPath != null) {
|
if (actualPath != null) {
|
||||||
try {
|
try {
|
||||||
String attachmentId = attachmentUploadService.uploadFileAndGetId(actualPath);
|
String attachmentId = attachmentUploadService.uploadFileAndGetId(actualPath);
|
||||||
if (attachmentId != null) {
|
if (attachmentId != null) {
|
||||||
attachmentIds.add(attachmentId);
|
attachmentIds.add(attachmentId);
|
||||||
|
fileMap.put("value", attachmentId);
|
||||||
} else {
|
} else {
|
||||||
importRow.getVdpthsWarnings().add(fileName);
|
importRow.getVdpthsWarnings().add(fileName);
|
||||||
// attachmentIds.add(fileName);
|
// attachmentIds.add(fileName);
|
||||||
@ -841,6 +843,7 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
importRow.getVdpthsWarnings().add(fileName);
|
importRow.getVdpthsWarnings().add(fileName);
|
||||||
// attachmentIds.add(fileName);
|
// attachmentIds.add(fileName);
|
||||||
}
|
}
|
||||||
|
importRow.getVdpthList().add(fileMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.join(",", attachmentIds);
|
return String.join(",", attachmentIds);
|
||||||
@ -853,19 +856,20 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
|
|
||||||
String[] fileNames = imageNames.split(";");
|
String[] fileNames = imageNames.split(";");
|
||||||
List<String> attachmentIds = new ArrayList<>();
|
List<String> attachmentIds = new ArrayList<>();
|
||||||
|
|
||||||
for (String fileName : fileNames) {
|
for (String fileName : fileNames) {
|
||||||
fileName = fileName.trim();
|
fileName = fileName.trim();
|
||||||
if (fileName.isEmpty()) {
|
if (fileName.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Map<String, String> fileMap = new HashMap<>();
|
||||||
|
fileMap.put("name", fileName);
|
||||||
String actualPath = findFilePath(fileName, imageMap);
|
String actualPath = findFilePath(fileName, imageMap);
|
||||||
if (actualPath != null) {
|
if (actualPath != null) {
|
||||||
try {
|
try {
|
||||||
String attachmentId = attachmentUploadService.uploadFileAndGetId(actualPath);
|
String attachmentId = attachmentUploadService.uploadFileAndGetId(actualPath);
|
||||||
if (attachmentId != null) {
|
if (attachmentId != null) {
|
||||||
attachmentIds.add(attachmentId);
|
attachmentIds.add(attachmentId);
|
||||||
|
fileMap.put("value", attachmentId);
|
||||||
} else {
|
} else {
|
||||||
importRow.getPicpthsWarnings().add(fileName);
|
importRow.getPicpthsWarnings().add(fileName);
|
||||||
// attachmentIds.add(fileName);
|
// attachmentIds.add(fileName);
|
||||||
@ -879,8 +883,8 @@ public class FishImportServiceImpl implements IFishImportService {
|
|||||||
importRow.getPicpthsWarnings().add(fileName);
|
importRow.getPicpthsWarnings().add(fileName);
|
||||||
// attachmentIds.add(fileName);
|
// attachmentIds.add(fileName);
|
||||||
}
|
}
|
||||||
|
importRow.getPicpthList().add(fileMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.join(",", attachmentIds);
|
return String.join(",", attachmentIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,10 +11,12 @@ import com.yfd.platform.data.domain.vo.SysUserDataScopeVO;
|
|||||||
import com.yfd.platform.data.mapper.SysUserDataScopeMapper;
|
import com.yfd.platform.data.mapper.SysUserDataScopeMapper;
|
||||||
import com.yfd.platform.data.service.ISysUserDataScopeService;
|
import com.yfd.platform.data.service.ISysUserDataScopeService;
|
||||||
import com.yfd.platform.env.domain.SdEngInfoBH;
|
import com.yfd.platform.env.domain.SdEngInfoBH;
|
||||||
|
import com.yfd.platform.env.domain.SdHbrvDic;
|
||||||
import com.yfd.platform.env.domain.SdHycdDic;
|
import com.yfd.platform.env.domain.SdHycdDic;
|
||||||
import com.yfd.platform.env.domain.SdHydrobase;
|
import com.yfd.platform.env.domain.SdHydrobase;
|
||||||
import com.yfd.platform.env.domain.SdRvcdDic;
|
import com.yfd.platform.env.domain.SdRvcdDic;
|
||||||
import com.yfd.platform.env.mapper.SdEngInfoBHMapper;
|
import com.yfd.platform.env.mapper.SdEngInfoBHMapper;
|
||||||
|
import com.yfd.platform.env.mapper.SdHbrvDicMapper;
|
||||||
import com.yfd.platform.env.mapper.SdHycdDicMapper;
|
import com.yfd.platform.env.mapper.SdHycdDicMapper;
|
||||||
import com.yfd.platform.env.mapper.SdHydrobaseMapper;
|
import com.yfd.platform.env.mapper.SdHydrobaseMapper;
|
||||||
import com.yfd.platform.env.mapper.SdRvcdDicMapper;
|
import com.yfd.platform.env.mapper.SdRvcdDicMapper;
|
||||||
@ -46,6 +48,9 @@ public class SysUserDataScopeServiceImpl extends ServiceImpl<SysUserDataScopeMap
|
|||||||
@Resource
|
@Resource
|
||||||
private SdEngInfoBHMapper engInfoBHMapper;
|
private SdEngInfoBHMapper engInfoBHMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SdHbrvDicMapper hbrvDicMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SysUserMapper sysUserMapper;
|
private SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
@ -181,7 +186,20 @@ public class SysUserDataScopeServiceImpl extends ServiceImpl<SysUserDataScopeMap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3.2 查询基地名称 (BASE)
|
// 3.2 查询基地流域名称 (HBRV)
|
||||||
|
if (groupedByType.containsKey("HBRVCD")) {
|
||||||
|
Set<String> hbrvcds = groupedByType.get("HBRVCD").stream()
|
||||||
|
.map(SysUserDataScope::getOrgId)
|
||||||
|
.filter(StrUtil::isNotBlank)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(hbrvcds)) {
|
||||||
|
List<SdHbrvDic> hbrvs = hbrvDicMapper.selectBatchIds(hbrvcds);
|
||||||
|
hbrvs.forEach(hbrv -> orgNameMap.put(hbrv.getHbrvcd(), hbrv.getHbrvnm()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3.3 查询基地名称 (BASE)
|
||||||
if (groupedByType.containsKey("BASE")) {
|
if (groupedByType.containsKey("BASE")) {
|
||||||
Set<String> baseIds = groupedByType.get("BASE").stream()
|
Set<String> baseIds = groupedByType.get("BASE").stream()
|
||||||
.map(SysUserDataScope::getOrgId)
|
.map(SysUserDataScope::getOrgId)
|
||||||
@ -194,7 +212,7 @@ public class SysUserDataScopeServiceImpl extends ServiceImpl<SysUserDataScopeMap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3.3 查询公司名称 (COMPANY)
|
// 3.4 查询公司名称 (COMPANY)
|
||||||
if (groupedByType.containsKey("COMPANY")) {
|
if (groupedByType.containsKey("COMPANY")) {
|
||||||
Set<String> hycds = groupedByType.get("COMPANY").stream()
|
Set<String> hycds = groupedByType.get("COMPANY").stream()
|
||||||
.map(SysUserDataScope::getOrgId)
|
.map(SysUserDataScope::getOrgId)
|
||||||
@ -207,7 +225,7 @@ public class SysUserDataScopeServiceImpl extends ServiceImpl<SysUserDataScopeMap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3.4 查询电站名称 (STATION)
|
// 3.5 查询电站名称 (STATION)
|
||||||
if (groupedByType.containsKey("STATION")) {
|
if (groupedByType.containsKey("STATION")) {
|
||||||
Set<String> stcds = groupedByType.get("STATION").stream()
|
Set<String> stcds = groupedByType.get("STATION").stream()
|
||||||
.map(SysUserDataScope::getOrgId)
|
.map(SysUserDataScope::getOrgId)
|
||||||
|
|||||||
@ -76,6 +76,13 @@ public class SdEngInfoBHController {
|
|||||||
return ResponseResult.successData(engInfoBHService.selectForDropdown(baseId, ennm));
|
return ResponseResult.successData(engInfoBHService.selectForDropdown(baseId, ennm));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/regDropdown")
|
||||||
|
@Operation(summary = "电站下拉列表(根据基地编码筛选 + 支持名称模糊搜索)注册")
|
||||||
|
public ResponseResult regDropdown(@RequestParam(required = false) String baseId,
|
||||||
|
@RequestParam(required = false) String ennm) {
|
||||||
|
return ResponseResult.successData(engInfoBHService.selectRegDropdown(baseId, ennm));
|
||||||
|
}
|
||||||
|
|
||||||
@Log(module = "电站管理", value = "新增电站")
|
@Log(module = "电站管理", value = "新增电站")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@Operation(summary = "新增电站")
|
@Operation(summary = "新增电站")
|
||||||
|
|||||||
@ -104,4 +104,12 @@ public class SdHbrvDicController {
|
|||||||
@RequestParam(required = false) String baseid) {
|
@RequestParam(required = false) String baseid) {
|
||||||
return ResponseResult.successData(hbrvDicService.selectForDropdown(hbrvnm, baseid));
|
return ResponseResult.successData(hbrvDicService.selectForDropdown(hbrvnm, baseid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/regDropdown")
|
||||||
|
@Operation(summary = "下拉框列表查询")
|
||||||
|
public ResponseResult regDropdown(
|
||||||
|
@RequestParam(required = false) String hbrvnm,
|
||||||
|
@RequestParam(required = false) String baseid) {
|
||||||
|
return ResponseResult.successData(hbrvDicService.regDropdown(hbrvnm, baseid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -62,6 +62,23 @@ public class SdHycdDicController {
|
|||||||
return ResponseResult.successData(hycdDicService.getById(hycd));
|
return ResponseResult.successData(hycdDicService.getById(hycd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/selectForDropdown")
|
||||||
|
@Operation(summary = "下拉框列表查询")
|
||||||
|
public ResponseResult selectForDropdown(
|
||||||
|
@RequestParam(required = false) String hynm,
|
||||||
|
@RequestParam(required = false) Integer grd) {
|
||||||
|
return ResponseResult.successData(hycdDicService.selectForDropdown(hynm, grd));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/regDropdown")
|
||||||
|
@Operation(summary = "下拉框列表查询(注册)")
|
||||||
|
public ResponseResult regDropdown(
|
||||||
|
@RequestParam(required = false) String hynm,
|
||||||
|
@RequestParam(required = false) Integer grd) {
|
||||||
|
return ResponseResult.successData(hycdDicService.regDropdown(hynm, grd));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Log(module = "公司管理", value = "新增公司")
|
@Log(module = "公司管理", value = "新增公司")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@Operation(summary = "新增公司")
|
@Operation(summary = "新增公司")
|
||||||
|
|||||||
@ -83,4 +83,10 @@ public class SdHycdDic implements Serializable {
|
|||||||
* 简称
|
* 简称
|
||||||
*/
|
*/
|
||||||
private String shortname;
|
private String shortname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型 1:集团 ;2:公司
|
||||||
|
*/
|
||||||
|
private String lx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,4 +55,6 @@ public interface ISdEngInfoBHService extends IService<SdEngInfoBH> {
|
|||||||
* 删除电站
|
* 删除电站
|
||||||
*/
|
*/
|
||||||
boolean deleteEngInfo(String stcd);
|
boolean deleteEngInfo(String stcd);
|
||||||
|
|
||||||
|
List<SdEngInfoBH> selectRegDropdown(String baseId, String ennm);
|
||||||
}
|
}
|
||||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import com.yfd.platform.env.domain.SdHbrvDic;
|
import com.yfd.platform.env.domain.SdHbrvDic;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -52,4 +53,9 @@ public interface ISdHbrvDicService extends IService<SdHbrvDic> {
|
|||||||
* 下拉框列表查询(支持名称模糊查询)
|
* 下拉框列表查询(支持名称模糊查询)
|
||||||
*/
|
*/
|
||||||
List<SdHbrvDic> selectForDropdown(String hbrvnm, String baseid);
|
List<SdHbrvDic> selectForDropdown(String hbrvnm, String baseid);
|
||||||
|
|
||||||
|
Set<String> getUserAuthorizedStationCodes();
|
||||||
|
|
||||||
|
List<SdHbrvDic> regDropdown(String hbrvnm, String baseid);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -42,4 +42,11 @@ public interface ISdHycdDicService extends IService<SdHycdDic> {
|
|||||||
* 删除公司
|
* 删除公司
|
||||||
*/
|
*/
|
||||||
boolean deleteHycdDic(String hycd);
|
boolean deleteHycdDic(String hycd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉框列表查询(支持名称和级别过滤)
|
||||||
|
*/
|
||||||
|
List<SdHycdDic> selectForDropdown(String hynm, Integer grd);
|
||||||
|
|
||||||
|
List<SdHycdDic> regDropdown(String hynm, Integer grd);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,9 +75,10 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
|||||||
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||||
if (authorizedStations != null && !authorizedStations.isEmpty()) {
|
if (authorizedStations != null && !authorizedStations.isEmpty()) {
|
||||||
wrapper.in(SdEngInfoBH::getStcd, authorizedStations);
|
wrapper.in(SdEngInfoBH::getStcd, authorizedStations);
|
||||||
} else {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// return new ArrayList<>();
|
||||||
|
// }
|
||||||
|
|
||||||
return this.list(wrapper);
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
@ -104,7 +105,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
|||||||
|
|
||||||
if ("STATION".equals(orgType)) {
|
if ("STATION".equals(orgType)) {
|
||||||
stationCodes.add(orgId);
|
stationCodes.add(orgId);
|
||||||
} else if ("RVCD".equals(orgType)) {
|
} else if ("HBRVCD".equals(orgType)) {
|
||||||
basinCodes.add(orgId);
|
basinCodes.add(orgId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,7 +117,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
|||||||
if (!basinCodes.isEmpty()) {
|
if (!basinCodes.isEmpty()) {
|
||||||
List<SdEngInfoBH> engInfos = this.lambdaQuery()
|
List<SdEngInfoBH> engInfos = this.lambdaQuery()
|
||||||
.select(SdEngInfoBH::getStcd)
|
.select(SdEngInfoBH::getStcd)
|
||||||
.in(SdEngInfoBH::getRvcd, basinCodes)
|
.in(SdEngInfoBH::getHbrvcd, basinCodes)
|
||||||
.list();
|
.list();
|
||||||
return engInfos.stream()
|
return engInfos.stream()
|
||||||
.map(SdEngInfoBH::getStcd)
|
.map(SdEngInfoBH::getStcd)
|
||||||
@ -140,4 +141,15 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
|||||||
public boolean deleteEngInfo(String stcd) {
|
public boolean deleteEngInfo(String stcd) {
|
||||||
return this.removeById(stcd);
|
return this.removeById(stcd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SdEngInfoBH> selectRegDropdown(String baseId, String ennm) {
|
||||||
|
LambdaQueryWrapper<SdEngInfoBH> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(StringUtils.hasText(baseId), SdEngInfoBH::getBaseId, baseId)
|
||||||
|
.like(StringUtils.hasText(ennm), SdEngInfoBH::getEnnm, ennm)
|
||||||
|
.select(SdEngInfoBH::getStcd, SdEngInfoBH::getEnnm, SdEngInfoBH::getBaseId)
|
||||||
|
.orderByAsc(SdEngInfoBH::getOrderIndex);
|
||||||
|
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -67,10 +67,6 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
|
|||||||
public List<SdFpssBH> selectForDropdown(String rstcd, String stnm, String baseId) {
|
public List<SdFpssBH> selectForDropdown(String rstcd, String stnm, String baseId) {
|
||||||
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||||
|
|
||||||
if (authorizedStations == null || authorizedStations.isEmpty()) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<SdFpssBH> result;
|
List<SdFpssBH> result;
|
||||||
|
|
||||||
if (StringUtils.hasText(baseId)) {
|
if (StringUtils.hasText(baseId)) {
|
||||||
@ -82,6 +78,9 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
|
|||||||
.orderByDesc(SdFpssBH::getOrderIndex);
|
.orderByDesc(SdFpssBH::getOrderIndex);
|
||||||
result = list(wrapper);
|
result = list(wrapper);
|
||||||
}
|
}
|
||||||
|
if (authorizedStations.isEmpty()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return result.stream()
|
return result.stream()
|
||||||
.filter(fpss -> authorizedStations.contains(fpss.getRstcd()))
|
.filter(fpss -> authorizedStations.contains(fpss.getRstcd()))
|
||||||
@ -110,7 +109,7 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
|
|||||||
|
|
||||||
if ("STATION".equals(orgType)) {
|
if ("STATION".equals(orgType)) {
|
||||||
stationCodes.add(orgId);
|
stationCodes.add(orgId);
|
||||||
} else if ("RVCD".equals(orgType)) {
|
} else if ("HBRVCD".equals(orgType)) {
|
||||||
basinCodes.add(orgId);
|
basinCodes.add(orgId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +122,7 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
|
|||||||
List<SdEngInfoBH> engInfos = sdEngInfoBHMapper.selectList(
|
List<SdEngInfoBH> engInfos = sdEngInfoBHMapper.selectList(
|
||||||
new LambdaQueryWrapper<SdEngInfoBH>()
|
new LambdaQueryWrapper<SdEngInfoBH>()
|
||||||
.select(SdEngInfoBH::getStcd)
|
.select(SdEngInfoBH::getStcd)
|
||||||
.in(SdEngInfoBH::getRvcd, basinCodes)
|
.in(SdEngInfoBH::getHbrvcd, basinCodes)
|
||||||
);
|
);
|
||||||
return engInfos.stream()
|
return engInfos.stream()
|
||||||
.map(SdEngInfoBH::getStcd)
|
.map(SdEngInfoBH::getStcd)
|
||||||
|
|||||||
@ -1,13 +1,25 @@
|
|||||||
package com.yfd.platform.env.service.impl;
|
package com.yfd.platform.env.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.yfd.platform.data.domain.SysUserDataScope;
|
||||||
|
import com.yfd.platform.data.mapper.SysUserDataScopeMapper;
|
||||||
|
import com.yfd.platform.env.domain.SdEngInfoBH;
|
||||||
import com.yfd.platform.env.domain.SdHbrvDic;
|
import com.yfd.platform.env.domain.SdHbrvDic;
|
||||||
|
import com.yfd.platform.env.domain.SdHydrobase;
|
||||||
|
import com.yfd.platform.env.mapper.SdEngInfoBHMapper;
|
||||||
import com.yfd.platform.env.mapper.SdHbrvDicMapper;
|
import com.yfd.platform.env.mapper.SdHbrvDicMapper;
|
||||||
import com.yfd.platform.env.service.ISdHbrvDicService;
|
import com.yfd.platform.env.service.ISdHbrvDicService;
|
||||||
|
import com.yfd.platform.utils.SecurityUtils;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -16,7 +28,11 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SdHbrvDicServiceImpl extends ServiceImpl<SdHbrvDicMapper, SdHbrvDic> implements ISdHbrvDicService {
|
public class SdHbrvDicServiceImpl extends ServiceImpl<SdHbrvDicMapper, SdHbrvDic> implements ISdHbrvDicService {
|
||||||
|
@Resource
|
||||||
|
private SysUserDataScopeMapper sysUserDataScopeMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SdEngInfoBHMapper engInfoBHMapper;
|
||||||
@Override
|
@Override
|
||||||
public Page<SdHbrvDic> queryPageList(Page<SdHbrvDic> page, String hbrvnm, String baseid) {
|
public Page<SdHbrvDic> queryPageList(Page<SdHbrvDic> page, String hbrvnm, String baseid) {
|
||||||
return this.page(page, this.lambdaQuery()
|
return this.page(page, this.lambdaQuery()
|
||||||
@ -74,6 +90,80 @@ public class SdHbrvDicServiceImpl extends ServiceImpl<SdHbrvDicMapper, SdHbrvDic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SdHbrvDic> selectForDropdown(String hbrvnm, String baseid) {
|
public List<SdHbrvDic> selectForDropdown(String hbrvnm, String baseid) {
|
||||||
|
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||||
|
LambdaQueryWrapper<SdHbrvDic> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (authorizedStations != null && !authorizedStations.isEmpty()) {
|
||||||
|
List<SdEngInfoBH> engInfos = engInfoBHMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<SdEngInfoBH>()
|
||||||
|
.select(SdEngInfoBH::getHbrvcd)
|
||||||
|
.in(SdEngInfoBH::getStcd, authorizedStations)
|
||||||
|
);
|
||||||
|
List<String> hbrvcds = engInfos.stream()
|
||||||
|
.map(SdEngInfoBH::getHbrvcd)
|
||||||
|
.filter(id -> id != null && !id.isEmpty())
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (!hbrvcds.isEmpty()) {
|
||||||
|
wrapper.in(SdHbrvDic::getHbrvcd, hbrvcds);
|
||||||
|
} else {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wrapper.like(hbrvnm != null && !hbrvnm.isEmpty(), SdHbrvDic::getHbrvnm, hbrvnm)
|
||||||
|
.eq(baseid != null && !baseid.isEmpty(), SdHbrvDic::getBaseid, baseid)
|
||||||
|
.eq(SdHbrvDic::getEnabled, 1)
|
||||||
|
.orderByAsc(SdHbrvDic::getOrderIndex);
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getUserAuthorizedStationCodes() {
|
||||||
|
String userId = SecurityUtils.getUserId();
|
||||||
|
List<SysUserDataScope> sysUserDataScopes = sysUserDataScopeMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<SysUserDataScope>()
|
||||||
|
.eq(SysUserDataScope::getUserId, userId)
|
||||||
|
.select(SysUserDataScope::getOrgId, SysUserDataScope::getOrgType)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (sysUserDataScopes == null || sysUserDataScopes.isEmpty()) {
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> stationCodes = new HashSet<>();
|
||||||
|
List<String> basinCodes = new ArrayList<>();
|
||||||
|
|
||||||
|
for (SysUserDataScope scope : sysUserDataScopes) {
|
||||||
|
String orgType = scope.getOrgType();
|
||||||
|
String orgId = scope.getOrgId();
|
||||||
|
|
||||||
|
if ("STATION".equals(orgType)) {
|
||||||
|
stationCodes.add(orgId);
|
||||||
|
} else if ("HBRVCD".equals(orgType)) {
|
||||||
|
basinCodes.add(orgId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stationCodes.isEmpty()) {
|
||||||
|
return stationCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!basinCodes.isEmpty()) {
|
||||||
|
List<SdEngInfoBH> engInfos = engInfoBHMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<SdEngInfoBH>()
|
||||||
|
.select(SdEngInfoBH::getStcd)
|
||||||
|
.in(SdEngInfoBH::getHbrvcd, basinCodes)
|
||||||
|
);
|
||||||
|
return engInfos.stream()
|
||||||
|
.map(SdEngInfoBH::getStcd)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
return stationCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SdHbrvDic> regDropdown(String hbrvnm, String baseid) {
|
||||||
return this.lambdaQuery()
|
return this.lambdaQuery()
|
||||||
.like(hbrvnm != null && !hbrvnm.isEmpty(), SdHbrvDic::getHbrvnm, hbrvnm)
|
.like(hbrvnm != null && !hbrvnm.isEmpty(), SdHbrvDic::getHbrvnm, hbrvnm)
|
||||||
.eq(baseid != null && !baseid.isEmpty(), SdHbrvDic::getBaseid, baseid)
|
.eq(baseid != null && !baseid.isEmpty(), SdHbrvDic::getBaseid, baseid)
|
||||||
|
|||||||
@ -56,4 +56,22 @@ public class SdHycdDicServiceImpl extends ServiceImpl<SdHycdDicMapper, SdHycdDic
|
|||||||
public boolean deleteHycdDic(String hycd) {
|
public boolean deleteHycdDic(String hycd) {
|
||||||
return this.removeById(hycd);
|
return this.removeById(hycd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SdHycdDic> selectForDropdown(String hynm, Integer grd) {
|
||||||
|
return this.lambdaQuery()
|
||||||
|
.like(hynm != null && !hynm.isEmpty(), SdHycdDic::getHynm, hynm)
|
||||||
|
.eq(grd != null, SdHycdDic::getGrd, grd)
|
||||||
|
.orderByAsc(SdHycdDic::getOrderIndex)
|
||||||
|
.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SdHycdDic> regDropdown(String hynm, Integer grd) {
|
||||||
|
return this.lambdaQuery()
|
||||||
|
.like(hynm != null && !hynm.isEmpty(), SdHycdDic::getHynm, hynm)
|
||||||
|
.eq(grd != null, SdHycdDic::getGrd, grd)
|
||||||
|
.orderByAsc(SdHycdDic::getOrderIndex)
|
||||||
|
.list();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,9 +87,10 @@ public class SdHydrobaseServiceImpl extends ServiceImpl<SdHydrobaseMapper, SdHyd
|
|||||||
} else {
|
} else {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// return new ArrayList<>();
|
||||||
|
// }
|
||||||
wrapper.orderByAsc(SdHydrobase::getOrderIndex);
|
wrapper.orderByAsc(SdHydrobase::getOrderIndex);
|
||||||
return this.list(wrapper);
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
@ -116,7 +117,7 @@ public class SdHydrobaseServiceImpl extends ServiceImpl<SdHydrobaseMapper, SdHyd
|
|||||||
|
|
||||||
if ("STATION".equals(orgType)) {
|
if ("STATION".equals(orgType)) {
|
||||||
stationCodes.add(orgId);
|
stationCodes.add(orgId);
|
||||||
} else if ("RVCD".equals(orgType)) {
|
} else if ("HBRVCD".equals(orgType)) {
|
||||||
basinCodes.add(orgId);
|
basinCodes.add(orgId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,7 +130,7 @@ public class SdHydrobaseServiceImpl extends ServiceImpl<SdHydrobaseMapper, SdHyd
|
|||||||
List<SdEngInfoBH> engInfos = sdEngInfoBHMapper.selectList(
|
List<SdEngInfoBH> engInfos = sdEngInfoBHMapper.selectList(
|
||||||
new LambdaQueryWrapper<SdEngInfoBH>()
|
new LambdaQueryWrapper<SdEngInfoBH>()
|
||||||
.select(SdEngInfoBH::getStcd)
|
.select(SdEngInfoBH::getStcd)
|
||||||
.in(SdEngInfoBH::getRvcd, basinCodes)
|
.in(SdEngInfoBH::getHbrvcd, basinCodes)
|
||||||
);
|
);
|
||||||
return engInfos.stream()
|
return engInfos.stream()
|
||||||
.map(SdEngInfoBH::getStcd)
|
.map(SdEngInfoBH::getStcd)
|
||||||
|
|||||||
@ -28,4 +28,23 @@ public class SmsVerifyCodeRequest {
|
|||||||
* 用户
|
* 用户
|
||||||
*/
|
*/
|
||||||
private SysUser user;
|
private SysUser user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流域编号
|
||||||
|
*/
|
||||||
|
private String rvcdCode;
|
||||||
|
/**
|
||||||
|
* 集团编号
|
||||||
|
*/
|
||||||
|
private String groupCode;
|
||||||
|
/**
|
||||||
|
* 公司编号
|
||||||
|
*/
|
||||||
|
private String companyCode;
|
||||||
|
/**
|
||||||
|
* 站点编号
|
||||||
|
*/
|
||||||
|
private String stationCode;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -134,6 +134,9 @@
|
|||||||
<if test="stcd != null and stcd != ''">
|
<if test="stcd != null and stcd != ''">
|
||||||
AND D.STCD = #{stcd}
|
AND D.STCD = #{stcd}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
AND D.CREATED_BY = #{userId}
|
||||||
|
</if>
|
||||||
<if test="ftp != null and ftp != ''">
|
<if test="ftp != null and ftp != ''">
|
||||||
AND D.FTP = #{ftp}
|
AND D.FTP = #{ftp}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user