实名认证、运营区

This commit is contained in:
磷叶 2025-04-27 09:12:14 +08:00
parent 4e85e7c1ab
commit a4937551ee
4 changed files with 28 additions and 11 deletions

View File

@ -20,7 +20,7 @@ public interface AreaDashboard {
* @param query
* @return
*/
LongIntegerVO selectMaxOfDeviceCountAreaId(AreaQuery query);
List<LongIntegerVO> selectMaxOfDeviceCountAreaId(AreaQuery query);
}

View File

@ -12,7 +12,6 @@ import com.ruoyi.bst.area.mapper.AreaMapper;
import com.ruoyi.bst.area.service.AreaDashboard;
import com.ruoyi.common.domain.vo.LongIntegerVO;
import com.ruoyi.common.utils.MathUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.dashboard.constants.StatKeys;
@Service
@ -31,11 +30,9 @@ public class AreaDashboardImpl implements AreaDashboard {
}
@Override
public LongIntegerVO selectMaxOfDeviceCountAreaId(AreaQuery query) {
PageHelper.startPage(1, 1);
public List<LongIntegerVO> selectMaxOfDeviceCountAreaId(AreaQuery query) {
PageHelper.orderBy("value desc");
List<LongIntegerVO> list = areaMapper.selectDeviceCountGroupByAreaId(query);
return CollectionUtils.firstElement(list);
return areaMapper.selectDeviceCountGroupByAreaId(query);
}
}

View File

@ -229,7 +229,12 @@ public class RealNameServiceImpl implements RealNameService
realName.setType(RealNameType.TWO_ELEMENT.getCode());
realName.setResult(isSuccess ? "认证成功" : idRes.getReason());
return this.handleNormalRealName(realName, null);
int result = this.handleNormalRealName(realName, null);
ServiceUtil.assertion(result != 1, "实名认证失败");
ServiceUtil.assertion(!isSuccess, "二要素实名认证未通过");
return result;
}
private int handleNormalRealName(RealName realName, String cacheKey) {

View File

@ -1,6 +1,8 @@
package com.ruoyi.web.app;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -15,6 +17,7 @@ import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.domain.vo.LongIntegerVO;
import com.ruoyi.common.utils.collection.CollectionUtils;
import io.swagger.annotations.ApiOperation;
@ -59,11 +62,23 @@ public class AppAreaController extends BaseController {
}
setQuery(query);
// 查询设备数量最多的运营区ID
LongIntegerVO max = areaDashboard.selectMaxOfDeviceCountAreaId(query);
if (max == null) {
// 按设备数量排序查询附近的运营区
Long areaId = query.getId();
query.setId(null);
List<LongIntegerVO> list = areaDashboard.selectMaxOfDeviceCountAreaId(query);
if (CollectionUtils.isEmptyElement(list)) {
return success();
}
}
// 如果有传运营区ID则优先找运营区
LongIntegerVO max = null;
if (areaId != null) {
max = list.stream().filter(item -> Objects.equals(item.getKey(), areaId)).findFirst().orElse(null);
}
// 若没有找到对应运营区则取设备数量最多的运营区
if (max == null) {
max = list.get(0);
}
// 查询运营区详情
return success(areaService.selectAreaById(max.getKey()));