fix: 野生动物监测-一级页面动物列表
This commit is contained in:
parent
d04eed8188
commit
5d76129fbb
@ -156,6 +156,12 @@ public class WeFishController {
|
||||
return ResponseResult.successData(weFishService.getQgcWeAnimalPoint(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/animalList/qgc/GetKendoListCust")
|
||||
@Operation(summary = "野生动物监测-一级页面动物列表")
|
||||
public ResponseResult getQgcWeAnimalList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getQgcWeAnimalList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/point/qgc/GetKendoListCust")
|
||||
@Operation(summary = "环保部-水生生态调查-地图锚点")
|
||||
public ResponseResult getQgcWePoint(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "野生动物监测-一级页面动物列表")
|
||||
public class WeAnimalListQgcVo {
|
||||
|
||||
@Schema(description = "动物编码")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "动物名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "动物字典编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "基地编码")
|
||||
private String baseId;
|
||||
|
||||
@Schema(description = "基地名称")
|
||||
private String baseName;
|
||||
|
||||
@Schema(description = "河流编码")
|
||||
private String rvcd;
|
||||
|
||||
@Schema(description = "河流名称")
|
||||
private String rvcdName;
|
||||
|
||||
@Schema(description = "流域编码")
|
||||
private String hbrvcd;
|
||||
|
||||
@Schema(description = "流域名称")
|
||||
private String hbrvcdName;
|
||||
|
||||
@Schema(description = "电站编码")
|
||||
private String rstcd;
|
||||
|
||||
@Schema(description = "电站名称")
|
||||
private String ennm;
|
||||
|
||||
@Schema(description = "监测站点编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "监测站点名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "时间")
|
||||
private String tm;
|
||||
|
||||
@Schema(description = "年份")
|
||||
private Integer yr;
|
||||
|
||||
@Schema(description = "检测次数")
|
||||
private Long acnt;
|
||||
}
|
||||
@ -57,6 +57,8 @@ public interface WeFishService {
|
||||
|
||||
DataSourceResult<WeAnimalPointQgcVo> getQgcWeAnimalPoint(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeAnimalListQgcVo> getQgcWeAnimalList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeTeSpecialAnimalVo> getTeSpecialAnimalList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
List<WeDefaultDataVo> getWeDefaultData(String stcd);
|
||||
|
||||
@ -1266,6 +1266,338 @@ public class WeFishServiceImpl implements WeFishService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<WeAnimalListQgcVo> getQgcWeAnimalList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
GroupingInfo[] groupInfos = loadOptions == null ? null : loadOptions.getGroup();
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
|
||||
String filterSql = buildWeAnimalListFilterCondition(
|
||||
dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
|
||||
paramMap,
|
||||
new int[]{0}
|
||||
);
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT r.id AS id, r.name AS name, r.code AS code, ")
|
||||
.append("r.baseId AS baseId, r.baseName AS baseName, ")
|
||||
.append("r.rvcd AS rvcd, r.rvcdName AS rvcdName, ")
|
||||
.append("r.hbrvcd AS hbrvcd, r.hbrvcdName AS hbrvcdName, ")
|
||||
.append("r.rstcd AS rstcd, r.ennm AS ennm, ")
|
||||
.append("r.stcd AS stcd, r.stnm AS stnm, ")
|
||||
.append("r.tm AS tm, r.yr AS yr, r.acnt AS acnt ")
|
||||
.append("FROM (")
|
||||
.append(buildWeAnimalListDetailSql())
|
||||
.append(") r WHERE 1 = 1 ");
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append("AND ").append(filterSql).append(" ");
|
||||
}
|
||||
|
||||
DataSourceResult<WeAnimalListQgcVo> result = new DataSourceResult<>();
|
||||
if (CollUtil.isNotEmpty(dataSourceRequest == null ? null : dataSourceRequest.getGroup())) {
|
||||
String groupedSql = buildWeAnimalListGroupSql(sql.toString(), groupInfos);
|
||||
List<Map<String, Object>> rows = microservicDynamicSQLMapper.getAllList(groupedSql, paramMap);
|
||||
if (Boolean.TRUE.equals(dataSourceRequest.getGroupResultFlat())) {
|
||||
result.setData((List<WeAnimalListQgcVo>) (List<?>) new GroupHelper().faltGroup(rows, Arrays.asList(groupInfos)));
|
||||
} else {
|
||||
result.setData((List<WeAnimalListQgcVo>) (List<?>) new GroupHelper().group(rows, Arrays.asList(groupInfos)));
|
||||
}
|
||||
result.setTotal(0L);
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
sql.append(buildWeAnimalListOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
|
||||
Page<?> page = loadOptions == null ? null
|
||||
: QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<Map<String, Object>> rows = microservicDynamicSQLMapper.pageAllList(page, sql.toString(), paramMap);
|
||||
List<WeAnimalListQgcVo> list = new ArrayList<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
WeAnimalListQgcVo vo = buildWeAnimalListQgcVo(row);
|
||||
if (vo != null) {
|
||||
list.add(vo);
|
||||
}
|
||||
}
|
||||
|
||||
result.setData(list);
|
||||
result.setTotal(page != null ? page.getTotal() : list.size());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
private String buildWeAnimalListDetailSql() {
|
||||
return "SELECT " +
|
||||
"a.ID AS id, a.NAME AS name, a.CODE AS code, " +
|
||||
"aim.RVCD AS rvcd, rv.RVNM AS rvcdName, " +
|
||||
"aim.HBRVCD AS hbrvcd, hbrv.HBRVNM AS hbrvcdName, " +
|
||||
"aim.RSTCD AS rstcd, eng.ENNM AS ennm, " +
|
||||
"aim.BASE_ID AS baseId, hb.BASENAME AS baseName, " +
|
||||
"aim.STCD AS stcd, aim.STNM AS stnm, " +
|
||||
"MAX(w.TM) AS tm, TO_CHAR(MAX(w.TM), 'yyyy') AS yr, " +
|
||||
"COUNT(*) AS acnt " +
|
||||
"FROM SD_WVA_R w " +
|
||||
"INNER JOIN SD_ANIMALDICTORY_B a ON a.ID = w.ANIMAL_ID " +
|
||||
" AND NVL(a.IS_DELETED, 0) = 0 " +
|
||||
" AND NVL(a.ENABLE, 1) = 1 " +
|
||||
"INNER JOIN SD_AIMONITOR_B_H aim ON aim.STCD = w.STCD " +
|
||||
" AND NVL(aim.IS_DELETED, 0) = 0 " +
|
||||
" AND aim.STTP = 'WVA' " +
|
||||
"LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = aim.RSTCD " +
|
||||
" AND NVL(eng.IS_DELETED, 0) = 0 " +
|
||||
"LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = aim.BASE_ID " +
|
||||
" AND NVL(hb.IS_DELETED, 0) = 0 " +
|
||||
"LEFT JOIN SD_RVCD_DIC rv ON rv.RVCD = aim.RVCD " +
|
||||
" AND NVL(rv.IS_DELETED, 0) = 0 " +
|
||||
"LEFT JOIN SD_HBRV_DIC hbrv ON hbrv.HBRVCD = aim.HBRVCD " +
|
||||
" AND hbrv.BASEID = aim.BASE_ID " +
|
||||
" AND NVL(hbrv.IS_DELETED, 0) = 0 " +
|
||||
"WHERE NVL(w.IS_DELETED, 0) = 0 " +
|
||||
"GROUP BY a.ID, a.NAME, a.CODE, " +
|
||||
"aim.RVCD, rv.RVNM, aim.HBRVCD, hbrv.HBRVNM, aim.RSTCD, eng.ENNM, " +
|
||||
"aim.BASE_ID, hb.BASENAME, aim.STCD, aim.STNM";
|
||||
}
|
||||
|
||||
private String buildWeAnimalListFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
if (filter == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(filter.getField())) {
|
||||
return buildWeAnimalListLeafCondition(filter, paramMap, indexHolder);
|
||||
}
|
||||
if (CollUtil.isEmpty(filter.getFilters())) {
|
||||
return "";
|
||||
}
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||
String childSql = buildWeAnimalListFilterCondition(child, paramMap, indexHolder);
|
||||
if (StrUtil.isNotBlank(childSql)) {
|
||||
conditions.add("(" + childSql + ")");
|
||||
}
|
||||
}
|
||||
if (conditions.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String logic = "or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ";
|
||||
return String.join(logic, conditions);
|
||||
}
|
||||
|
||||
private String buildWeAnimalListLeafCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
String column = mapWeAnimalListColumn(filter.getField());
|
||||
if (StrUtil.isBlank(column)) {
|
||||
return "";
|
||||
}
|
||||
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
|
||||
if ("isnull".equals(operator)) {
|
||||
return column + " IS NULL";
|
||||
}
|
||||
if ("isnotnull".equals(operator)) {
|
||||
return column + " IS NOT NULL";
|
||||
}
|
||||
if ("isempty".equals(operator)) {
|
||||
return "(" + column + " IS NULL OR " + column + " = '')";
|
||||
}
|
||||
if ("isnotempty".equals(operator)) {
|
||||
return "(" + column + " IS NOT NULL AND " + column + " <> '')";
|
||||
}
|
||||
if ("in".equals(operator) || "ni".equals(operator)) {
|
||||
List<Object> values = normalizeWeFishQgcValues(filter.getValue());
|
||||
if (values.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
for (Object value : values) {
|
||||
Object normalizedValue = normalizeWeAnimalListValue(filter.getField(), value);
|
||||
if (normalizedValue == null) {
|
||||
continue;
|
||||
}
|
||||
String key = "weAnimalListP" + indexHolder[0]++;
|
||||
paramMap.put(key, normalizedValue);
|
||||
placeholders.add("#{map." + key + "}");
|
||||
}
|
||||
if (placeholders.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return column + ("ni".equals(operator) ? " NOT IN (" : " IN (") + String.join(", ", placeholders) + ")";
|
||||
}
|
||||
|
||||
Object normalizedValue = normalizeWeAnimalListValue(filter.getField(), filter.getValue());
|
||||
if (normalizedValue == null) {
|
||||
return "";
|
||||
}
|
||||
String key = "weAnimalListP" + indexHolder[0]++;
|
||||
return switch (operator) {
|
||||
case "eq" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " = #{map." + key + "}";
|
||||
}
|
||||
case "neq" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " <> #{map." + key + "}";
|
||||
}
|
||||
case "gt" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " > #{map." + key + "}";
|
||||
}
|
||||
case "gte" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " >= #{map." + key + "}";
|
||||
}
|
||||
case "lt" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " < #{map." + key + "}";
|
||||
}
|
||||
case "lte" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " <= #{map." + key + "}";
|
||||
}
|
||||
case "contains" -> {
|
||||
paramMap.put(key, "%" + String.valueOf(normalizedValue).trim() + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "doesnotcontain" -> {
|
||||
paramMap.put(key, "%" + String.valueOf(normalizedValue).trim() + "%");
|
||||
yield column + " NOT LIKE #{map." + key + "}";
|
||||
}
|
||||
case "startswith" -> {
|
||||
paramMap.put(key, String.valueOf(normalizedValue).trim() + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "endswith" -> {
|
||||
paramMap.put(key, "%" + String.valueOf(normalizedValue).trim());
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private String mapWeAnimalListColumn(String field) {
|
||||
if (StrUtil.isBlank(field)) {
|
||||
return null;
|
||||
}
|
||||
return switch (field) {
|
||||
case "id" -> "r.id";
|
||||
case "name" -> "r.name";
|
||||
case "code" -> "r.code";
|
||||
case "baseId" -> "r.baseId";
|
||||
case "baseName" -> "r.baseName";
|
||||
case "rvcd" -> "r.rvcd";
|
||||
case "rvcdName" -> "r.rvcdName";
|
||||
case "hbrvcd" -> "r.hbrvcd";
|
||||
case "hbrvcdName" -> "r.hbrvcdName";
|
||||
case "rstcd" -> "r.rstcd";
|
||||
case "ennm" -> "r.ennm";
|
||||
case "stcd" -> "r.stcd";
|
||||
case "stnm" -> "r.stnm";
|
||||
case "tm" -> "r.tm";
|
||||
case "yr" -> "r.yr";
|
||||
case "acnt" -> "r.acnt";
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private String buildWeAnimalListGroupSql(String baseSql, GroupingInfo[] groupInfos) {
|
||||
if (groupInfos == null || groupInfos.length == 0) {
|
||||
return baseSql;
|
||||
}
|
||||
List<String> groupFields = new ArrayList<>();
|
||||
List<String> selectItems = new ArrayList<>();
|
||||
for (GroupingInfo item : groupInfos) {
|
||||
if (item == null || StrUtil.isBlank(item.getSelector())) {
|
||||
continue;
|
||||
}
|
||||
String groupColumn = mapWeAnimalListColumn(item.getSelector());
|
||||
if (StrUtil.isBlank(groupColumn)) {
|
||||
continue;
|
||||
}
|
||||
groupFields.add(groupColumn.startsWith("r.") ? groupColumn.substring(2) : groupColumn);
|
||||
selectItems.add(groupColumn.startsWith("r.") ? groupColumn.substring(2) + " AS " + item.getSelector().toUpperCase() : groupColumn);
|
||||
selectItems.add("COUNT(*) AS COUNT_" + item.getSelector().toUpperCase());
|
||||
}
|
||||
if (groupFields.isEmpty()) {
|
||||
return baseSql;
|
||||
}
|
||||
StringBuilder sql = new StringBuilder("SELECT ");
|
||||
sql.append(String.join(", ", selectItems))
|
||||
.append(" FROM (")
|
||||
.append(baseSql)
|
||||
.append(") T GROUP BY ")
|
||||
.append(String.join(", ", groupFields));
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
private String buildWeAnimalListOrderBySql(List<DataSourceRequest.SortDescriptor> sorts) {
|
||||
if (CollUtil.isEmpty(sorts)) {
|
||||
return "";
|
||||
}
|
||||
List<String> orderByParts = new ArrayList<>();
|
||||
for (DataSourceRequest.SortDescriptor sort : sorts) {
|
||||
if (sort == null || StrUtil.isBlank(sort.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = mapWeAnimalListColumn(sort.getField());
|
||||
if (StrUtil.isBlank(column)) {
|
||||
continue;
|
||||
}
|
||||
String direction = "desc".equalsIgnoreCase(sort.getDir()) ? "DESC" : "ASC";
|
||||
orderByParts.add(column + " " + direction + " NULLS LAST");
|
||||
}
|
||||
if (orderByParts.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return " ORDER BY " + String.join(", ", orderByParts);
|
||||
}
|
||||
|
||||
private Object normalizeWeAnimalListValue(String field, Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if ("yr".equals(field)) {
|
||||
try {
|
||||
return Integer.parseInt(String.valueOf(value).trim());
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if ("acnt".equals(field)) {
|
||||
try {
|
||||
return new BigDecimal(String.valueOf(value).trim());
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if ("tm".equals(field)) {
|
||||
return parseDateTimeSafely(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private WeAnimalListQgcVo buildWeAnimalListQgcVo(Map<String, Object> row) {
|
||||
if (row == null || row.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return new WeAnimalListQgcVo()
|
||||
.setId(safeWeFishString(firstPresentWeFishValue(row, "ID", "id")))
|
||||
.setName(safeWeFishString(firstPresentWeFishValue(row, "NAME", "name")))
|
||||
.setCode(safeWeFishString(firstPresentWeFishValue(row, "CODE", "code")))
|
||||
.setBaseId(safeWeFishString(firstPresentWeFishValue(row, "BASEID", "baseId")))
|
||||
.setBaseName(safeWeFishString(firstPresentWeFishValue(row, "BASENAME", "baseName")))
|
||||
.setRvcd(safeWeFishString(firstPresentWeFishValue(row, "RVCD", "rvcd")))
|
||||
.setRvcdName(safeWeFishString(firstPresentWeFishValue(row, "RVCDNAME", "rvcdName")))
|
||||
.setHbrvcd(safeWeFishString(firstPresentWeFishValue(row, "HBRVCD", "hbrvcd")))
|
||||
.setHbrvcdName(safeWeFishString(firstPresentWeFishValue(row, "HBRVCDNAME", "hbrvcdName")))
|
||||
.setRstcd(safeWeFishString(firstPresentWeFishValue(row, "RSTCD", "rstcd")))
|
||||
.setEnnm(safeWeFishString(firstPresentWeFishValue(row, "ENNM", "ennm")))
|
||||
.setStcd(safeWeFishString(firstPresentWeFishValue(row, "STCD", "stcd")))
|
||||
.setStnm(safeWeFishString(firstPresentWeFishValue(row, "STNM", "stnm")))
|
||||
.setTm(toWeFishDateTimeTextValue(firstPresentWeFishValue(row, "TM", "tm")))
|
||||
.setYr(toWeFishIntegerValue(firstPresentWeFishValue(row, "YR", "yr")))
|
||||
.setAcnt(toWeFishLongValue(firstPresentWeFishValue(row, "ACNT", "acnt")));
|
||||
}
|
||||
|
||||
private Map<String, List<WePointFishStatVo>> queryWePointFishMap(List<String> stcdList,
|
||||
String stcd,
|
||||
String startTime,
|
||||
|
||||
@ -82,7 +82,7 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addPushConfig(PushConfig pushConfig) {
|
||||
validatePushConfig(pushConfig, false);
|
||||
validatePushConfig(pushConfig, false,false);
|
||||
Date now = new Date();
|
||||
pushConfig.setCreatedAt(now);
|
||||
pushConfig.setModifyTime(now);
|
||||
@ -99,7 +99,7 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updatePushConfig(PushConfig pushConfig) {
|
||||
validatePushConfig(pushConfig, true);
|
||||
validatePushConfig(pushConfig, true,false);
|
||||
PushConfig dbConfig = getAvailableConfig(pushConfig.getId());
|
||||
dbConfig.setCategoryCode(pushConfig.getCategoryCode());
|
||||
dbConfig.setCategoryName(pushConfig.getCategoryName());
|
||||
@ -113,6 +113,10 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
// dbConfig.setUpdatedAt(new Date());
|
||||
dbConfig.setModifyTime(new Date());
|
||||
dbConfig.setModifyUser(currentUserIdOrSystem());
|
||||
Integer isSms = dbConfig.getIsSms();
|
||||
if (isSms == 1 && (StrUtil.isBlank(dbConfig.getCronExpression()) || !CronExpression.isValidExpression(dbConfig.getCronExpression()))) {
|
||||
throw new BizException("cron表达式格式错误.");
|
||||
}
|
||||
boolean updated = this.updateById(dbConfig);
|
||||
if (updated) {
|
||||
if (Objects.equals(dbConfig.getTargetType(), 1)) {
|
||||
@ -175,6 +179,8 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
}
|
||||
PushConfig config = getAvailableConfig(id);
|
||||
config.setIsSms(isSms);
|
||||
|
||||
validatePushConfig(config, false,true);
|
||||
// config.setUpdatedAt(new Date());
|
||||
// config.setModifyTime(new Date());
|
||||
// config.setModifyUser(currentUserIdOrSystem());
|
||||
@ -196,15 +202,15 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
softDeleteTargets(config.getId(), userId, now);
|
||||
//更新主表的TARGET_TYPE 1-所有人,2-按人,3-按角色
|
||||
LambdaUpdateWrapper<PushConfig> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(PushConfig::getTargetType,request.getTargetType());
|
||||
updateWrapper.eq(PushConfig::getId,request.getConfigId());
|
||||
updateWrapper.set(PushConfig::getTargetType, request.getTargetType());
|
||||
updateWrapper.eq(PushConfig::getId, request.getConfigId());
|
||||
Boolean update = this.update(updateWrapper);
|
||||
if (request.getUserRoleIds() == null || request.getUserRoleIds().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
int type = 0;
|
||||
//如果是所有人或者按人
|
||||
if(request.getTargetType() ==3 ){
|
||||
if (request.getTargetType() == 3) {
|
||||
type = 1;
|
||||
}
|
||||
List<PushConfigUser> list = new ArrayList<>();
|
||||
@ -238,7 +244,7 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
List<PushConfigTargetVo> pushConfigTargetVoList = pushConfigUserMapper.selectConfigTargets(configId);
|
||||
List<String> userRoleIds = new ArrayList<>();
|
||||
|
||||
if(pushConfigTargetVoList.size()>0){
|
||||
if (pushConfigTargetVoList.size() > 0) {
|
||||
|
||||
for (PushConfigTargetVo pushConfigTargetVo : pushConfigTargetVoList) {
|
||||
userRoleIds.add(pushConfigTargetVo.getUserRoleId());
|
||||
@ -541,6 +547,7 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
|
||||
/**
|
||||
* 统计并生成单个基地的文本(监测站+视频监控)
|
||||
*
|
||||
* @param baseName 基地名称
|
||||
* @param monitorList 该基地所在的所有监测站数据(可能包含多个基地)
|
||||
* @param videoList 该基地所在的所有视频监控数据(可能包含多个基地)
|
||||
@ -607,6 +614,7 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
private static class BaseInfo {
|
||||
String baseId;
|
||||
String baseName;
|
||||
|
||||
BaseInfo(String baseId, String baseName) {
|
||||
this.baseId = baseId;
|
||||
this.baseName = baseName;
|
||||
@ -615,6 +623,7 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
|
||||
/**
|
||||
* 拼接 LIKE 模糊查询条件(自动加 %)
|
||||
*
|
||||
* @param sql SQL 构建器
|
||||
* @param paramMap 参数容器
|
||||
* @param column 列名(如 "sd.RSTCD")
|
||||
@ -632,6 +641,7 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
|
||||
/**
|
||||
* 拼接 IN 条件,支持动态参数列表
|
||||
*
|
||||
* @param sql SQL 构建器
|
||||
* @param paramMap 参数容器(用于 MyBatis 预编译)
|
||||
* @param column 列名(如 "sd.BASE_ID")
|
||||
@ -657,6 +667,7 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
|
||||
/**
|
||||
* 构建 WT 类型(水文站)查询 SQL
|
||||
*
|
||||
* @param baseIdList 基地ID,可为空
|
||||
* @param paramMap 参数容器
|
||||
* @return SQL 字符串
|
||||
@ -812,10 +823,9 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 构建 WT 类型(水文站)查询 SQL,按 RSTCD 模糊查询
|
||||
*
|
||||
* @param rstcd RSTCD 值(如 "008610902100000001")
|
||||
* @param paramMap 参数容器
|
||||
* @return SQL 字符串
|
||||
@ -939,20 +949,6 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发送短信(占位,后续接入真实短信服务)
|
||||
*
|
||||
@ -1144,7 +1140,7 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
}
|
||||
}
|
||||
|
||||
private void validatePushConfig(PushConfig pushConfig, boolean requireId) {
|
||||
private void validatePushConfig(PushConfig pushConfig, boolean requireId,boolean requireAll) {
|
||||
if (pushConfig == null) {
|
||||
throw new BizException("参数不能为空.");
|
||||
}
|
||||
@ -1158,9 +1154,18 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
throw new BizException("消息类别名称不能为空.");
|
||||
}
|
||||
if (StrUtil.isBlank(pushConfig.getMessageType())) {
|
||||
throw new BizException("消息类型不能为空.");
|
||||
throw new BizException("消息类型不能为空");
|
||||
}
|
||||
if (StrUtil.isNotBlank(pushConfig.getCronExpression())){
|
||||
if (requireAll&&(pushConfig.getBaseIdList()==null||pushConfig.getBaseIdList().isEmpty())) {
|
||||
throw new BizException("推送目标不能为空");
|
||||
}
|
||||
if (requireAll) {
|
||||
long count = pushConfigUserMapper.selectCount(new LambdaQueryWrapper<PushConfigUser>().eq(PushConfigUser::getConfigId, pushConfig.getId()));
|
||||
if (count <= 0) {
|
||||
throw new BizException("推送目标不能为空");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(pushConfig.getCronExpression())) {
|
||||
if (StrUtil.isBlank(pushConfig.getCronExpression()) || !CronExpression.isValidExpression(pushConfig.getCronExpression())) {
|
||||
throw new BizException("cron表达式格式错误.");
|
||||
}
|
||||
@ -1178,7 +1183,7 @@ public class PushConfigServiceImpl extends ServiceImpl<PushConfigMapper, PushCon
|
||||
if (StrUtil.isBlank(request.getConfigId())) {
|
||||
throw new BizException("推送配置ID不能为空.");
|
||||
}
|
||||
if (request.getTargetType() == null || (request.getTargetType() != 1 && request.getTargetType() != 2&& request.getTargetType() != 3 )) {
|
||||
if (request.getTargetType() == null || (request.getTargetType() != 1 && request.getTargetType() != 2 && request.getTargetType() != 3)) {
|
||||
throw new BizException("绑定类型不正确.");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user