Browse Source

#分页接口改造

zhongwei
yang_shj 5 months ago
parent
commit
14c750079d
  1. 33
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  2. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/interruption/service/impl/InterruptionServiceImpl.java
  3. 19
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java
  4. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java
  5. 35
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java
  6. 8
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java
  7. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  8. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java
  9. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java
  10. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  11. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java
  12. 2
      hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java

33
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java

@ -114,6 +114,39 @@ public class EmInfoController extends BladeController {
return R.data(pages);
}
@RequestMapping(value = "/devices", method = {RequestMethod.GET, RequestMethod.POST})
@ApiOperationSupport(order = 3)
@ApiOperation(value = "查询设备列表", notes = "传入查询参数")
@ApiImplicitParams({
})
@OperationAnnotation(moduleName = "设备管理",title = "设备信息",operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE,
action = "查询设备信息列表")
public R<List<EmInfoEntity>> devices(@ApiIgnore @RequestParam Map<String, Object> em_info, Query query) {
QueryWrapper<EmInfoEntity> queryWrapper = Condition.getQueryWrapper(em_info, EmInfoEntity.class);
queryWrapper.lambda().eq(EmInfoEntity::getGpid, 0);
queryWrapper.orderByDesc("create_time");
List<EmInfoEntity> devices = em_infoService.list( queryWrapper);
if(CollectionUtil.isEmpty(devices)){
return R.data(new ArrayList<>());
}
// 获取站点列表 - 填充站点编码、站点类型、站点名称
R<List<StationEntity>> stations = stationClient.list(new StationEntity());
if(!stations.isSuccess() || CollectionUtil.isEmpty(stations.getData())) {
return R.data(devices);
}
return R.data(devices.stream().peek(device -> {
Optional<StationEntity> stationOptional = stations.getData().stream()
.filter(station -> Func.isNotEmpty(station.getRefDept()) && station.getRefDept().equals(device.getDepartment())).findAny();
if(stationOptional.isPresent()) {
StationEntity stationEntity = stationOptional.get();
device.setStationCode(stationEntity.getCode());
device.setStationType(stationEntity.getType());
device.setStationName(stationEntity.getName());
}
}).collect(Collectors.toList()));
}
/**
* 查看子设备列表 分页(树结构)
*/

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/interruption/service/impl/InterruptionServiceImpl.java

@ -53,7 +53,7 @@ public class InterruptionServiceImpl extends ServiceImpl<InterruptionMapper, Int
queryWrapper.lambda().ge(InterruptionEntity::getCreateTime,param.getStartTime());
queryWrapper.lambda().le(InterruptionEntity::getCreateTime,param.getEndTime());
queryWrapper.lambda().orderByAsc(InterruptionEntity::getAlarmTime);
if(!StringUtil.isEmpty(param.getStationId())){
if(StringUtil.isNotBlank(param.getStationId())){
queryWrapper.lambda().in(InterruptionEntity::getStationId,Func.toLongList(",",param.getStationId()));
}
List<InterruptionEntity> interruptions = this.list(queryWrapper);

19
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java

@ -92,6 +92,25 @@ public class RobotController extends BladeController {
}
/**
* 分页 代码自定义代号
*/
@GetMapping("/robots")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "查看机器人列表", notes = "传入st_robot")
@ApiImplicitParams({
})
@Operate(label = "查看机器人列表",type = BusinessType.QUERY,ignore = false)
public R<List<RobotEntity>> robots(@ApiIgnore @RequestParam(required = false) Map<String,Object> st_robot) {
QueryWrapper<RobotEntity> queryWrapper = Condition.getQueryWrapper( st_robot, RobotEntity.class);
List<RobotEntity> robots = st_robotService.list(queryWrapper);
robots.stream().filter(robot -> Func.isNotEmpty(robot.getUserId())).forEach(robotEntity -> {
User user = UserCache.getUser(robotEntity.getUserId());
robotEntity.setUserName(Optional.ofNullable(user).map(User::getName).orElse(null));
});
return R.data(robots);
}
/**
* 新增 代码自定义代号
*/
@PostMapping("/save")

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java

@ -57,4 +57,6 @@ public interface ProjectService extends IService<ProjectEntity> {
* @return 机构-项目树
*/
List<Map<String,Object>> deptProjectTree(ProjectDTO project);
List<ProjectVO> projects(String emCode, ContentDTO content);
}

35
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java

@ -41,6 +41,7 @@ import java.util.stream.Stream;
/**
* 巡检项目service
* @author ysj
*/
@Service
@AllArgsConstructor
@ -161,6 +162,40 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
}
/**
* 查询设备巡检项目&项目内容
* @param deviceCodes
* @param content
* @return
*/
@Override
public List<ProjectVO> projects(String deviceCodes, ContentDTO content) {
return Stream.of(deviceCodes.split(",")).map(emCode -> {
LambdaQueryWrapper<ProjectEntity> queryWrapper = Wrappers.<ProjectEntity>lambdaQuery()
.eq(ProjectEntity::getEmCode, emCode)
.eq(ProjectEntity::getStatus, ObjectConstants.ProjectEnableEnum.YES.getEnableType());
// 根据设备编号获取项目
ProjectEntity project = this.getOne(queryWrapper);
ProjectVO projectVO = ProjectWrapper.build().entityVO(project);
if(Func.isNotEmpty(project)) {
// 获取巡检项目下的巡检内容
LambdaQueryWrapper<ProjectContentEntity> projectContentQuery = Wrappers.<ProjectContentEntity>lambdaQuery()
.select(ProjectContentEntity::getContentId)
.eq(ProjectContentEntity::getProjectId, project.getId());
ProjectContentService projectContentService = SpringUtil.getBean(ProjectContentServiceImpl.class);
List<ProjectContentEntity> projectContentList = projectContentService.list(projectContentQuery);
if(CollectionUtil.isNotEmpty(projectContentList)) {
List<Long> contentIdList = projectContentList.stream().map(ProjectContentEntity::getContentId).collect(Collectors.toList());
LambdaQueryWrapper<ContentEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.in(CollectionUtil.isNotEmpty(contentIdList),ContentEntity::getId, contentIdList);
List<ContentEntity> contents = contentService.list(wrapper);
projectVO.setContentList(ContentWrapper.build().listVO(contents));
}
}
return projectVO;
}).collect(Collectors.toList());
}
/**
* 获取项目树中 机构下巡检项目的子集
* @param project 筛选条件
* @param deptId 机构ID

8
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java

@ -177,6 +177,14 @@ public class ProjectController {
return R.data(projectService.getProjectAndContentByEmCode(emCode,content,query));
}
@GetMapping("/projects")
@ApiOperation(value = "根据设备编号获取项目以及内容列表(分页展示)")
@ApiOperationSupport(order = 10)
public R<List<ProjectVO>> projects(String emCode, ContentDTO content) {
return R.data(projectService.projects(emCode,content));
}
@GetMapping("/getProjectAndContentByEmCodes")
@ApiOperation(value = "根据多个设备编号(逗号分隔)获取项目以及内容列表(分页展示)")
@ApiOperationSupport(order = 8)

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java

@ -113,7 +113,7 @@ public class HomeServiceImpl implements HomeService {
count.setCount(stations.stream().filter(station->serve.equals(station.getServeType()) && type.equals(station.getType())).count());
}
count.setType(String.valueOf(type));
count.setTypeName(DictCache.getValue("stationType", type));
count.setTypeName(DictCache.getValue("stationType", String.valueOf(type)));
return count;
}).collect(Collectors.toList())));
return counts.stream().sorted(Comparator.comparing(StationCountVo::getServeType)).collect(Collectors.toList());

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java

@ -122,6 +122,21 @@ public class OperMaintenanceTaskController extends BladeController {
return taskService.list(req);
}
/**
* 分页
*/
@PostMapping("/maintenances")
@ApiOperationSupport(order = 60)
@ApiOperation(value = "查询日常维护任务")
@ApiImplicitParams({
})
@OperationAnnotation(moduleName = "日常维护", title = "日常维护记录", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,
action = "分页查询日常维护记录列表")
public R<List<OperMaintenanceTaskVO>> maintenances(@RequestBody OperMaintenanceTaskDTO param) {
return R.data(taskService.maintenances(param));
}
@PostMapping("/exportMaintenance")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "日常维护记录导出")

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java

@ -103,4 +103,6 @@ public interface IOperMaintenanceTaskService extends IService<OperMaintenanceTas
List<VoteChartVo> getMaintenanceListStatistics(String startTime, String endTime,Long deptId);
List<MaintenanceExportVO> exportMaintenance(OperMaintenanceTaskDTO req);
List<OperMaintenanceTaskVO> maintenances(OperMaintenanceTaskDTO param);
}

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -638,6 +638,21 @@ public class OperMaintenanceTaskServiceImpl extends ServiceImpl<OperMaintenanceT
return list;
}
/**
* 查询日常维护任务列表
* @param param
* @return
*/
@Override
public List<OperMaintenanceTaskVO> maintenances(OperMaintenanceTaskDTO param) {
Wrapper<OperMaintenanceTaskEntity> queryWrapper = getQueryWrapper(param);
List<OperMaintenanceTaskEntity> maintenances = this.list(queryWrapper);
if(CollectionUtil.isEmpty(maintenances)){
return new ArrayList<>();
}
return OperMaintenanceTaskWrapper.build().listVO(maintenances);
}
private VoteChartVo getVoteChartVo(List<OperMaintenanceTaskEntity> list) {
VoteChartVo voteChartVo = new VoteChartVo();
List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> StringUtil.isNotBlank(s.getFlowTaskName())&&"结束".equals(s.getFlowTaskName())).map(BaseEntity::getId).collect(Collectors.toList());

20
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java

@ -9,6 +9,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.operational.station.dto.StationVideoTypeDTO;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
@ -29,16 +30,13 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.AuthClient;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.beans.factory.annotation.Value;
@ -250,12 +248,22 @@ public class StationVideoTypeController extends BladeController {
@ApiOperationSupport(order = 120)
@ApiOperation(value = "获取Flv配置列表", notes = "获取Flv配置列表")
public R getFlvVideoConfig(VideoConfigEntity req,Query query) {
LambdaQueryWrapper<VideoConfigEntity> queryWrapper = com.hnac.hzims.common.utils.Condition.getQueryWrapper(VideoConfigEntity.class, req);
LambdaQueryWrapper<VideoConfigEntity> queryWrapper = Condition.getQueryWrapper(VideoConfigEntity.class, req);
queryWrapper.eq(VideoConfigEntity::getCreateUser,AuthUtil.getUserId());
IPage<VideoConfigEntity> page = videoConfigService.page(com.hnac.hzims.common.utils.Condition.getPage(query), queryWrapper);
IPage<VideoConfigEntity> page = videoConfigService.page(Condition.getPage(query), queryWrapper);
return R.data(page);
}
@GetMapping("/flvVideoConfigs")
@ApiOperationSupport(order = 120)
@ApiOperation(value = "获取Flv配置列表", notes = "获取Flv配置列表")
public R flvVideoConfigs(VideoConfigEntity req) {
LambdaQueryWrapper<VideoConfigEntity> queryWrapper = Condition.getQueryWrapper(VideoConfigEntity.class, req);
queryWrapper.eq(VideoConfigEntity::getCreateUser,AuthUtil.getUserId());
return R.data(videoConfigService.list(queryWrapper));
}
@PostMapping ("/updateFlvVideoConfig")
@ApiOperationSupport(order = 120)
@ApiOperation(value = "更新Flv配置列表", notes = "更新Flv配置列表")

2
hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java

@ -42,7 +42,7 @@ public class XxlJobConfig {
log.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setAppname(appName);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
System.out.println(">>>>>>>>>>> xxl-rpc, port " + port);

Loading…
Cancel
Save