|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
package com.hnac.hzims.operational.station.controller; |
|
|
|
|
package com.hnac.hzims.operational.station.controller; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
@ -13,6 +13,7 @@ import com.hnac.hzims.operational.station.entity.StationEntity;
|
|
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
|
import com.hnac.hzims.operational.station.vo.StationVO; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiModelProperty; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
@ -44,47 +45,47 @@ import java.util.stream.Collectors;
|
|
|
|
|
@RestController |
|
|
|
|
@RequestMapping("/station") |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
@Api(value = "站点",tags = "站点管理") |
|
|
|
|
@Api(value = "站点", tags = "站点管理") |
|
|
|
|
@Slf4j |
|
|
|
|
public class StationController extends BladeController { |
|
|
|
|
private final IStationService stationService; |
|
|
|
|
|
|
|
|
|
private final HzimsDataService dataServicel; |
|
|
|
|
|
|
|
|
|
private final IMainSystemMonitoringService mainSystemMonitoringService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页 代码自定义代号 |
|
|
|
|
*/ |
|
|
|
|
@ApiLog |
|
|
|
|
@RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST}) |
|
|
|
|
@ApiOperationSupport(order = 10) |
|
|
|
|
@ApiOperation(value = "分页", notes = "传入StationEntity") |
|
|
|
|
@OperationAnnotation( |
|
|
|
|
moduleName = "站点管理", |
|
|
|
|
title = "水电站点管理",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, |
|
|
|
|
action = "分页查询") |
|
|
|
|
public R<IPage<StationVO>> list(StationEntity entity, Query query) { |
|
|
|
|
IPage<StationVO> vos = stationService.list(entity,query); |
|
|
|
|
return R.data(vos); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/detail/{id}") |
|
|
|
|
// @ApiOperationSupport(order = 60)
|
|
|
|
|
@ApiOperation(value = "查看详情", notes = "查看详情") |
|
|
|
|
public R<StationEntity> detail(@PathVariable @ApiParam("主键ID") Long id) { |
|
|
|
|
return R.data(stationService.getById(id)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 新增 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 20) |
|
|
|
|
@ApiOperation(value = "新增") |
|
|
|
|
public R save(@Valid @RequestBody StationEntity req) { |
|
|
|
|
stationService.buildStation(req); |
|
|
|
|
return R.success("保存成功!"); |
|
|
|
|
private final IStationService stationService; |
|
|
|
|
|
|
|
|
|
private final HzimsDataService dataServicel; |
|
|
|
|
|
|
|
|
|
private final IMainSystemMonitoringService mainSystemMonitoringService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页 代码自定义代号 |
|
|
|
|
*/ |
|
|
|
|
@ApiLog |
|
|
|
|
@RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST}) |
|
|
|
|
@ApiOperationSupport(order = 10) |
|
|
|
|
@ApiOperation(value = "分页", notes = "传入StationEntity") |
|
|
|
|
@OperationAnnotation( |
|
|
|
|
moduleName = "站点管理", |
|
|
|
|
title = "水电站点管理", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, |
|
|
|
|
action = "分页查询") |
|
|
|
|
public R<IPage<StationVO>> list(StationEntity entity, Query query) { |
|
|
|
|
IPage<StationVO> vos = stationService.list(entity, query); |
|
|
|
|
return R.data(vos); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/detail/{id}") |
|
|
|
|
// @ApiOperationSupport(order = 60)
|
|
|
|
|
@ApiOperation(value = "查看详情", notes = "查看详情") |
|
|
|
|
public R<StationEntity> detail(@PathVariable @ApiParam("主键ID") Long id) { |
|
|
|
|
return R.data(stationService.getById(id)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 新增 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 20) |
|
|
|
|
@ApiOperation(value = "新增") |
|
|
|
|
public R save(@Valid @RequestBody StationEntity req) { |
|
|
|
|
stationService.buildStation(req); |
|
|
|
|
return R.success("保存成功!"); |
|
|
|
|
// List<StationEntity> list = stationService.list(new LambdaQueryWrapper<StationEntity>(){{
|
|
|
|
|
// eq(StationEntity::getCode,req.getCode()).or().eq(StationEntity::getName,req.getName());
|
|
|
|
|
// }});
|
|
|
|
@ -96,124 +97,136 @@ public class StationController extends BladeController {
|
|
|
|
|
// return "success";
|
|
|
|
|
// });
|
|
|
|
|
// return list.size()>0 ? R.fail(400,"该站点名/编码已有对应记录,请找到相应记录做修改处理") : R.status(stationService.save(req));
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 修改 代码自定义代号 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 30) |
|
|
|
|
@ApiOperation(value = "修改", notes = "传入StationEntity") |
|
|
|
|
public R update(@Valid @RequestBody StationEntity req) { |
|
|
|
|
stationService.buildStation(req); |
|
|
|
|
return R.success("修改成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 修改 代码自定义代号 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 30) |
|
|
|
|
@ApiOperation(value = "修改", notes = "传入StationEntity") |
|
|
|
|
public R update(@Valid @RequestBody StationEntity req) { |
|
|
|
|
stationService.buildStation(req); |
|
|
|
|
return R.success("修改成功!"); |
|
|
|
|
// LambdaQueryWrapper<StationEntity> queryWrapper = new LambdaQueryWrapper<StationEntity>();
|
|
|
|
|
// queryWrapper.ne(StationEntity::getId,req.getId());
|
|
|
|
|
// queryWrapper.and(wrapper -> wrapper.eq(StationEntity::getCode,req.getCode()).or().eq(StationEntity::getName,req.getName()));
|
|
|
|
|
// List<StationEntity> list = stationService.list(queryWrapper);
|
|
|
|
|
// return list.size()>0 ? R.fail(400,"该站点名/编码已有对应记录,请找到相应记录做修改处理") : R.status(stationService.updateById(req));
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/instanceProject") |
|
|
|
|
@ApiOperationSupport(order = 60) |
|
|
|
|
@ApiOperation(value = "实例化实时画面项目", notes = "站点信息") |
|
|
|
|
public R<Boolean> instanceProject(@RequestBody StationEntity req) { |
|
|
|
|
return R.status(stationService.instanceProject(req)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/updateBatch") |
|
|
|
|
@ApiOperationSupport(order = 30) |
|
|
|
|
@ApiOperation(value = "批量修改", notes = "传入站点列表") |
|
|
|
|
public R updateBatch(@RequestBody List<StationEntity> req) { |
|
|
|
|
for (StationEntity stationEntity : req) { |
|
|
|
|
if(StringUtil.isNotBlank(stationEntity.getCode()) || StringUtil.isNotBlank(stationEntity.getName())) { |
|
|
|
|
List<StationEntity> list = stationService.list(new LambdaQueryWrapper<StationEntity>(){{ |
|
|
|
|
eq(StationEntity::getCode,stationEntity.getCode()).or().eq(StationEntity::getName,stationEntity.getName()); |
|
|
|
|
}}); |
|
|
|
|
Assert.isTrue(CollectionUtil.isEmpty(list),()->{ |
|
|
|
|
throw new ServiceException(stationEntity.getId() + "下站点名/编码已有对应记录,请找到相应记录做修改处理"); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return R.status(stationService.updateBatchById(req)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 删除 代码自定义代号 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
@ApiOperationSupport(order = 40) |
|
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入id") |
|
|
|
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(stationService.removeStation(ids)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/getStationByCode") |
|
|
|
|
@ApiOperationSupport(order = 50) |
|
|
|
|
@ApiOperation(value = "通过站点编码获取站点", notes = "传入站点code") |
|
|
|
|
public R<StationVO> getStationByCode(@RequestParam("code") String code){ |
|
|
|
|
return R.data(stationService.getStationByCode(code)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping(value = "/getList") |
|
|
|
|
@ApiOperationSupport(order = 70) |
|
|
|
|
@ApiOperation(value = "获取站点列表(不分页查询)", notes = "传入StationEntity") |
|
|
|
|
public R<List<StationEntity>> getList(StationEntity entity) { |
|
|
|
|
LambdaQueryWrapper<StationEntity> lwq = Condition.getQueryWrapper(new StationEntity(),entity); |
|
|
|
|
if(Func.isNotEmpty(entity.getStatus())) { |
|
|
|
|
lwq.eq(StationEntity::getStatus,entity.getStatus()); |
|
|
|
|
} |
|
|
|
|
return R.data(stationService.list(lwq)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/list/all") |
|
|
|
|
@ApiOperationSupport(order = 80) |
|
|
|
|
@ApiOperation(value = "查询所有", notes = "") |
|
|
|
|
public R<List<StationEntity>> listAll(){ |
|
|
|
|
return R.data(stationService.getAll()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/listByServeType") |
|
|
|
|
@ApiOperationSupport(order = 90) |
|
|
|
|
@ApiOperation(value = "根据服务类型查询站点", notes = "") |
|
|
|
|
public R<List<StationEntity>> listByServeType(@RequestParam("serveType") Integer serveType){ |
|
|
|
|
return R.data(stationService.doListByServeType(serveType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/listByType") |
|
|
|
|
@ApiOperationSupport(order = 90) |
|
|
|
|
@ApiOperation(value = "根据服务类型查询站点", notes = "") |
|
|
|
|
public R<List<StationEntity>> listByType(){ |
|
|
|
|
//获取水电站及泵站
|
|
|
|
|
String type = "0,2"; |
|
|
|
|
List<StationEntity> list = stationService.list(new LambdaQueryWrapper<StationEntity>() {{ |
|
|
|
|
in(StationEntity::getType, Func.toStrList(type)); |
|
|
|
|
}}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/instanceProject") |
|
|
|
|
@ApiOperationSupport(order = 60) |
|
|
|
|
@ApiOperation(value = "实例化实时画面项目", notes = "站点信息") |
|
|
|
|
public R<Boolean> instanceProject(@RequestBody StationEntity req) { |
|
|
|
|
return R.status(stationService.instanceProject(req)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/updateBatch") |
|
|
|
|
@ApiOperationSupport(order = 30) |
|
|
|
|
@ApiOperation(value = "批量修改", notes = "传入站点列表") |
|
|
|
|
public R updateBatch(@RequestBody List<StationEntity> req) { |
|
|
|
|
for (StationEntity stationEntity : req) { |
|
|
|
|
if (StringUtil.isNotBlank(stationEntity.getCode()) || StringUtil.isNotBlank(stationEntity.getName())) { |
|
|
|
|
List<StationEntity> list = stationService.list(new LambdaQueryWrapper<StationEntity>() {{ |
|
|
|
|
eq(StationEntity::getCode, stationEntity.getCode()).or().eq(StationEntity::getName, stationEntity.getName()); |
|
|
|
|
}}); |
|
|
|
|
Assert.isTrue(CollectionUtil.isEmpty(list), () -> { |
|
|
|
|
throw new ServiceException(stationEntity.getId() + "下站点名/编码已有对应记录,请找到相应记录做修改处理"); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return R.status(stationService.updateBatchById(req)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 删除 代码自定义代号 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
@ApiOperationSupport(order = 40) |
|
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入id") |
|
|
|
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(stationService.removeStation(ids)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/getStationByCode") |
|
|
|
|
@ApiOperationSupport(order = 50) |
|
|
|
|
@ApiOperation(value = "通过站点编码获取站点", notes = "传入站点code") |
|
|
|
|
public R<StationVO> getStationByCode(@RequestParam("code") String code) { |
|
|
|
|
return R.data(stationService.getStationByCode(code)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping(value = "/getList") |
|
|
|
|
@ApiOperationSupport(order = 70) |
|
|
|
|
@ApiOperation(value = "获取站点列表(不分页查询)", notes = "传入StationEntity") |
|
|
|
|
public R<List<StationEntity>> getList(StationEntity entity) { |
|
|
|
|
LambdaQueryWrapper<StationEntity> lwq = Condition.getQueryWrapper(new StationEntity(), entity); |
|
|
|
|
if (Func.isNotEmpty(entity.getStatus())) { |
|
|
|
|
lwq.eq(StationEntity::getStatus, entity.getStatus()); |
|
|
|
|
} |
|
|
|
|
return R.data(stationService.list(lwq)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/list/all") |
|
|
|
|
@ApiOperationSupport(order = 80) |
|
|
|
|
@ApiOperation(value = "查询所有", notes = "") |
|
|
|
|
public R<List<StationEntity>> listAll() { |
|
|
|
|
return R.data(stationService.getAll()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/listByServeType") |
|
|
|
|
@ApiOperationSupport(order = 90) |
|
|
|
|
@ApiOperation(value = "根据服务类型查询站点", notes = "") |
|
|
|
|
public R<List<StationEntity>> listByServeType(@RequestParam("serveType") Integer serveType) { |
|
|
|
|
return R.data(stationService.doListByServeType(serveType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/listByType") |
|
|
|
|
@ApiOperationSupport(order = 90) |
|
|
|
|
@ApiOperation(value = "根据服务类型查询站点", notes = "") |
|
|
|
|
public R<List<StationEntity>> listByType() { |
|
|
|
|
//获取水电站及泵站
|
|
|
|
|
String type = "0,2"; |
|
|
|
|
List<StationEntity> list = stationService.list(new LambdaQueryWrapper<StationEntity>() {{ |
|
|
|
|
in(StationEntity::getType, Func.toStrList(type)); |
|
|
|
|
}}); |
|
|
|
|
/*BladeUser user = AuthUtil.getUser(); |
|
|
|
|
if(user.getAccount().equals("admin")){ |
|
|
|
|
return R.data(stationService.doListByTypes()); |
|
|
|
|
} |
|
|
|
|
List<StationEntity> list = mainSystemMonitoringService.classifyUserDataScopeType(null, null, Func.toStrList(type));*/ |
|
|
|
|
return R.data(list); |
|
|
|
|
} |
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/getHomeStationList") |
|
|
|
|
@ApiOperationSupport(order = 91) |
|
|
|
|
@ApiOperation(value = "获取首页站点列表", notes = "") |
|
|
|
|
public R<List<StationEntity>> getHomeStationList(@RequestParam(value = "deptId",required = false) Long deptId,@RequestParam(value = "types",required = false) List<Integer> types,@RequestParam(value = "serveType",required = false) Integer serveType){ |
|
|
|
|
return R.data(stationService.getHomeStationList(deptId,types,serveType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/select") |
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@ApiOperation(value = "下拉站点列表", notes = "") |
|
|
|
|
public R<List<StationEntity>> select(@RequestParam(value = "type",required = false) Integer type,@RequestParam(value = "serveType",required = false) Integer serveType){ |
|
|
|
|
return R.data(stationService.select(type,serveType)); |
|
|
|
|
} |
|
|
|
|
return R.data(list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/getHomeStationList") |
|
|
|
|
@ApiOperationSupport(order = 91) |
|
|
|
|
@ApiOperation(value = "获取首页站点列表", notes = "") |
|
|
|
|
public R<List<StationEntity>> getHomeStationList(@RequestParam(value = "deptId", required = false) Long deptId, @RequestParam(value = "types", required = false) List<Integer> types, @RequestParam(value = "serveType", required = false) Integer serveType) { |
|
|
|
|
return R.data(stationService.getHomeStationList(deptId, types, serveType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/select") |
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@ApiOperation(value = "下拉站点列表", notes = "") |
|
|
|
|
public R<List<StationEntity>> select(@RequestParam(value = "type", required = false) Integer type, @RequestParam(value = "serveType", required = false) Integer serveType) { |
|
|
|
|
return R.data(stationService.select(type, serveType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 两票编号抬头唯一效验 |
|
|
|
|
*/ |
|
|
|
|
@ApiModelProperty("两票编号抬头唯一效验") |
|
|
|
|
@GetMapping("/uniqueStationByStation") |
|
|
|
|
public R uniqueStationByStation(@RequestParam(value = "signage") String signage) { |
|
|
|
|
stationService.uniqueStationByStation(signage); |
|
|
|
|
return R.success("两票编号抬头不存在,可以创建"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|