|
|
|
@ -48,6 +48,7 @@ import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 巡检对象控制器 |
|
|
|
* 巡检对象控制器 |
|
|
|
|
|
|
|
* |
|
|
|
* @author ninglong |
|
|
|
* @author ninglong |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@RestController |
|
|
|
@RestController |
|
|
|
@ -87,7 +88,7 @@ public class ObjectController extends BladeController { |
|
|
|
entity.setName(object.getName()); |
|
|
|
entity.setName(object.getName()); |
|
|
|
entity.setStatus(object.getStatus()); |
|
|
|
entity.setStatus(object.getStatus()); |
|
|
|
entity.setSupportAutoVideo(object.getSupportAutoVideo()); |
|
|
|
entity.setSupportAutoVideo(object.getSupportAutoVideo()); |
|
|
|
pages.setRecords(objectService.getListPage(pages,entity)); |
|
|
|
pages.setRecords(objectService.getListPage(pages, entity)); |
|
|
|
return R.data(pages); |
|
|
|
return R.data(pages); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -95,8 +96,8 @@ public class ObjectController extends BladeController { |
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
@ApiOperation(value = "其他巡检对象列表-分页", notes = "其他巡检对象列表,分页") |
|
|
|
@ApiOperation(value = "其他巡检对象列表-分页", notes = "其他巡检对象列表,分页") |
|
|
|
public R<IPage<OtherObjectEntity>> otherListPage(OtherObjectListQueryVO object, Query query, BladeUser bladeUser) { |
|
|
|
public R<IPage<OtherObjectEntity>> otherListPage(OtherObjectListQueryVO object, Query query, BladeUser bladeUser) { |
|
|
|
LambdaQueryWrapper<OtherObjectEntity> queryWrapper = Condition.getQueryWrapper(new OtherObjectEntity(),object); |
|
|
|
LambdaQueryWrapper<OtherObjectEntity> queryWrapper = Condition.getQueryWrapper(new OtherObjectEntity(), object); |
|
|
|
queryWrapper.eq(OtherObjectEntity::getCreateDept,bladeUser.getDeptId()); |
|
|
|
queryWrapper.eq(OtherObjectEntity::getCreateDept, bladeUser.getDeptId()); |
|
|
|
queryWrapper.orderByDesc(OtherObjectEntity::getRealId); |
|
|
|
queryWrapper.orderByDesc(OtherObjectEntity::getRealId); |
|
|
|
IPage<OtherObjectEntity> pages = otherObjectService.page(Condition.getPage(query), queryWrapper); |
|
|
|
IPage<OtherObjectEntity> pages = otherObjectService.page(Condition.getPage(query), queryWrapper); |
|
|
|
return R.data(pages); |
|
|
|
return R.data(pages); |
|
|
|
@ -106,8 +107,8 @@ public class ObjectController extends BladeController { |
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
@ApiOperation(value = "其他巡检对象列表", notes = "其他巡检对象列表,不分页") |
|
|
|
@ApiOperation(value = "其他巡检对象列表", notes = "其他巡检对象列表,不分页") |
|
|
|
public R<List<OtherObjectEntity>> otherList(OtherObjectListQueryVO object, BladeUser bladeUser) { |
|
|
|
public R<List<OtherObjectEntity>> otherList(OtherObjectListQueryVO object, BladeUser bladeUser) { |
|
|
|
LambdaQueryWrapper<OtherObjectEntity> queryWrapper = Condition.getQueryWrapper(new OtherObjectEntity(),object); |
|
|
|
LambdaQueryWrapper<OtherObjectEntity> queryWrapper = Condition.getQueryWrapper(new OtherObjectEntity(), object); |
|
|
|
queryWrapper.eq(OtherObjectEntity::getCreateDept,bladeUser.getDeptId()); |
|
|
|
queryWrapper.eq(OtherObjectEntity::getCreateDept, bladeUser.getDeptId()); |
|
|
|
queryWrapper.orderByDesc(OtherObjectEntity::getRealId); |
|
|
|
queryWrapper.orderByDesc(OtherObjectEntity::getRealId); |
|
|
|
//List<OtherObjectEntity> list = otherObjectService.list((!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.eq(OtherObjectEntity::getTenantId, bladeUser.getTenantId()) : queryWrapper);
|
|
|
|
//List<OtherObjectEntity> list = otherObjectService.list((!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.eq(OtherObjectEntity::getTenantId, bladeUser.getTenantId()) : queryWrapper);
|
|
|
|
List<OtherObjectEntity> list = otherObjectService.list(queryWrapper); |
|
|
|
List<OtherObjectEntity> list = otherObjectService.list(queryWrapper); |
|
|
|
@ -125,7 +126,7 @@ public class ObjectController extends BladeController { |
|
|
|
object.setType(obj.getType()); |
|
|
|
object.setType(obj.getType()); |
|
|
|
object.setRealId(obj.getRealId()); |
|
|
|
object.setRealId(obj.getRealId()); |
|
|
|
object.setCreateDept(Long.valueOf(bladeUser.getDeptId())); |
|
|
|
object.setCreateDept(Long.valueOf(bladeUser.getDeptId())); |
|
|
|
pages.setRecords(otherObjectService.getUnbindListPage(pages,object)); |
|
|
|
pages.setRecords(otherObjectService.getUnbindListPage(pages, object)); |
|
|
|
return R.data(pages); |
|
|
|
return R.data(pages); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -133,16 +134,16 @@ public class ObjectController extends BladeController { |
|
|
|
@ApiOperationSupport(order = 3) |
|
|
|
@ApiOperationSupport(order = 3) |
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入object") |
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入object") |
|
|
|
public R submit(@Valid @RequestBody ObjectEntity object) { |
|
|
|
public R submit(@Valid @RequestBody ObjectEntity object) { |
|
|
|
if(object.getId()==null && Func.isBlank(object.getCode())){ |
|
|
|
if (object.getId() == null && Func.isBlank(object.getCode())) { |
|
|
|
object.setCode(CodeUtils.randomCode()); |
|
|
|
object.setCode(CodeUtils.randomCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(object.getSupportAutoVideo().equals(PlanContants.InspectTypeEnum.COMMON.getVal()) && (Func.isEmpty(object.getObjectDangers()) || object.getObjectDangers().size() == 0)){ |
|
|
|
if (object.getSupportAutoVideo().equals(PlanContants.InspectTypeEnum.COMMON.getVal()) && (Func.isEmpty(object.getObjectDangers()) || object.getObjectDangers().size() == 0)) { |
|
|
|
throw new ServiceException("对象告警list为空"); |
|
|
|
throw new ServiceException("对象告警list为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
objectService.saveOrUpdate(object); |
|
|
|
objectService.saveOrUpdate(object); |
|
|
|
objectDangerService.remove(Wrappers.<ObjectDangerEntity>lambdaQuery().eq(ObjectDangerEntity::getObjectId, object.getId())); |
|
|
|
objectDangerService.remove(Wrappers.<ObjectDangerEntity>lambdaQuery().eq(ObjectDangerEntity::getObjectId, object.getId())); |
|
|
|
List<ObjectDangerEntity> objectDangers = object.getObjectDangers(); |
|
|
|
List<ObjectDangerEntity> objectDangers = object.getObjectDangers(); |
|
|
|
if(CollectionUtil.isNotEmpty(objectDangers)){ |
|
|
|
if (CollectionUtil.isNotEmpty(objectDangers)) { |
|
|
|
objectDangers.stream().forEach(e -> { |
|
|
|
objectDangers.stream().forEach(e -> { |
|
|
|
e.setObjectId(object.getId()); |
|
|
|
e.setObjectId(object.getId()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -164,14 +165,14 @@ public class ObjectController extends BladeController { |
|
|
|
public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
List<Long> delIdList = Func.toLongList(ids); |
|
|
|
List<Long> delIdList = Func.toLongList(ids); |
|
|
|
QueryWrapper<PlanObjectTemplateEntity> qw = new QueryWrapper<>(); |
|
|
|
QueryWrapper<PlanObjectTemplateEntity> qw = new QueryWrapper<>(); |
|
|
|
qw.lambda().in(PlanObjectTemplateEntity::getObjectId,delIdList); |
|
|
|
qw.lambda().in(PlanObjectTemplateEntity::getObjectId, delIdList); |
|
|
|
int count = planObjectTemplateService.count(qw); |
|
|
|
int count = planObjectTemplateService.count(qw); |
|
|
|
if(count>0) { |
|
|
|
if (count > 0) { |
|
|
|
return R.fail("该巡检对象已被巡检计划引用,无法删除"); |
|
|
|
return R.fail("该巡检对象已关联模板,请先取消关联"); |
|
|
|
} |
|
|
|
} |
|
|
|
for (Long aLong : delIdList) { |
|
|
|
for (Long aLong : delIdList) { |
|
|
|
objectTemplateService.remove(new QueryWrapper<ObjectTemplateEntity>(){{ |
|
|
|
objectTemplateService.remove(new QueryWrapper<ObjectTemplateEntity>() {{ |
|
|
|
eq("OBJECT_ID",aLong); |
|
|
|
eq("OBJECT_ID", aLong); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
} |
|
|
|
} |
|
|
|
return R.status(objectService.deleteLogic(delIdList)); |
|
|
|
return R.status(objectService.deleteLogic(delIdList)); |
|
|
|
@ -180,38 +181,40 @@ public class ObjectController extends BladeController { |
|
|
|
@GetMapping("/disableOrEnable") |
|
|
|
@GetMapping("/disableOrEnable") |
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
@ApiOperation(value = "启用/停用", notes = "传入id,以及目标状态0-启用,1-停用") |
|
|
|
@ApiOperation(value = "启用/停用", notes = "传入id,以及目标状态0-启用,1-停用") |
|
|
|
public R<Boolean> disableOrEnable(@RequestParam Long id,@RequestParam Integer status) { |
|
|
|
public R<Boolean> disableOrEnable(@RequestParam Long id, @RequestParam Integer status) { |
|
|
|
QueryWrapper<PlanObjectTemplateEntity> qw = new QueryWrapper<>(); |
|
|
|
QueryWrapper<PlanObjectTemplateEntity> qw = new QueryWrapper<>(); |
|
|
|
qw.lambda().eq(PlanObjectTemplateEntity::getObjectId,id); |
|
|
|
qw.lambda().eq(PlanObjectTemplateEntity::getObjectId, id); |
|
|
|
|
|
|
|
if (status == 1) { |
|
|
|
int count = planObjectTemplateService.count(qw); |
|
|
|
int count = planObjectTemplateService.count(qw); |
|
|
|
if(count>0) { |
|
|
|
if (count > 0) { |
|
|
|
return R.fail("该巡检对象已被巡检计划引用,无法停用"); |
|
|
|
return R.fail("该巡检对象已关联模板,请先取消关联"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
UpdateWrapper<ObjectEntity> ew = new UpdateWrapper<>(); |
|
|
|
UpdateWrapper<ObjectEntity> ew = new UpdateWrapper<>(); |
|
|
|
ew.lambda().set(ObjectEntity::getStatus,status).eq(ObjectEntity::getId, id); |
|
|
|
ew.lambda().set(ObjectEntity::getStatus, status).eq(ObjectEntity::getId, id); |
|
|
|
return R.status(objectService.update(ew)); |
|
|
|
return R.status(objectService.update(ew)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getAllEnableOfObject") |
|
|
|
@GetMapping("/getAllEnableOfObject") |
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
@ApiOperation(value = "获取所有启用状态的对象(不分页)", notes = "获取所有启用状态的对象(不分页") |
|
|
|
@ApiOperation(value = "获取所有启用状态的对象(不分页)", notes = "获取所有启用状态的对象(不分页") |
|
|
|
public R<List<ObjectEntity>> getAllEnableOfObject(){ |
|
|
|
public R<List<ObjectEntity>> getAllEnableOfObject() { |
|
|
|
List<ObjectEntity> list = objectService.list(Wrappers.<ObjectEntity>lambdaQuery().eq(ObjectEntity::getStatus,0)); |
|
|
|
List<ObjectEntity> list = objectService.list(Wrappers.<ObjectEntity>lambdaQuery().eq(ObjectEntity::getStatus, 0)); |
|
|
|
return R.data(list); |
|
|
|
return R.data(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getObjectList") |
|
|
|
@GetMapping("/getObjectList") |
|
|
|
@ApiOperationSupport(order = 11) |
|
|
|
@ApiOperationSupport(order = 11) |
|
|
|
@ApiOperation(value = "获获取未绑定的其他来源对象", notes = "获获取未绑定的其他来源对象,分页") |
|
|
|
@ApiOperation(value = "获获取未绑定的其他来源对象", notes = "获获取未绑定的其他来源对象,分页") |
|
|
|
public R<List<ObjectEntity>> getObjectList(ObjectEntity object){ |
|
|
|
public R<List<ObjectEntity>> getObjectList(ObjectEntity object) { |
|
|
|
List<ObjectEntity> list = objectService.list(org.springblade.core.mp.support.Condition.getQueryWrapper(new ObjectEntity(),object)); |
|
|
|
List<ObjectEntity> list = objectService.list(org.springblade.core.mp.support.Condition.getQueryWrapper(new ObjectEntity(), object)); |
|
|
|
return R.data(list); |
|
|
|
return R.data(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getOtherType") |
|
|
|
@GetMapping("/getOtherType") |
|
|
|
@ApiOperationSupport(order = 7) |
|
|
|
@ApiOperationSupport(order = 7) |
|
|
|
@ApiOperation(value = "获取其他对象来源类型", notes = "获取其他对象来源类型") |
|
|
|
@ApiOperation(value = "获取其他对象来源类型", notes = "获取其他对象来源类型") |
|
|
|
public R<List<String>> getOtherType(){ |
|
|
|
public R<List<String>> getOtherType() { |
|
|
|
List<String> list = otherObjectService.getOtherType(); |
|
|
|
List<String> list = otherObjectService.getOtherType(); |
|
|
|
return R.data(list); |
|
|
|
return R.data(list); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -222,9 +225,9 @@ public class ObjectController extends BladeController { |
|
|
|
@PostMapping("/importObjectByExcel") |
|
|
|
@PostMapping("/importObjectByExcel") |
|
|
|
@ApiOperationSupport(order = 8) |
|
|
|
@ApiOperationSupport(order = 8) |
|
|
|
@ApiOperation(value = "Excel导入巡检对象(含项目和内容)", notes = "Excel导入巡检对象(含项目和内容)") |
|
|
|
@ApiOperation(value = "Excel导入巡检对象(含项目和内容)", notes = "Excel导入巡检对象(含项目和内容)") |
|
|
|
public R<Boolean> importObjectByExcel(@ApiParam(value = "excel文件,巡检对象导入模板", required = true) @RequestParam(value="file") MultipartFile file) throws IOException { |
|
|
|
public R<Boolean> importObjectByExcel(@ApiParam(value = "excel文件,巡检对象导入模板", required = true) @RequestParam(value = "file") MultipartFile file) throws IOException { |
|
|
|
if (file.getSize() > MAX_SIZE) { |
|
|
|
if (file.getSize() > MAX_SIZE) { |
|
|
|
throw new ServiceException( "上传文件大小不能超过200M"); |
|
|
|
throw new ServiceException("上传文件大小不能超过200M"); |
|
|
|
} |
|
|
|
} |
|
|
|
EasyExcel.read(file.getInputStream(), ObjectExcelInputData.class, new ObjectExcelInputListener(objectService)).sheet().doRead(); |
|
|
|
EasyExcel.read(file.getInputStream(), ObjectExcelInputData.class, new ObjectExcelInputListener(objectService)).sheet().doRead(); |
|
|
|
return R.status(true); |
|
|
|
return R.status(true); |
|
|
|
@ -233,9 +236,9 @@ public class ObjectController extends BladeController { |
|
|
|
@ApiOperationSupport(order = 9) |
|
|
|
@ApiOperationSupport(order = 9) |
|
|
|
@ApiOperation(value = "巡检对象标签导出,下载pdf", notes = "巡检对象标签导出,下载pdf") |
|
|
|
@ApiOperation(value = "巡检对象标签导出,下载pdf", notes = "巡检对象标签导出,下载pdf") |
|
|
|
@RequestMapping(value = "/objectPdfDownload", method = {RequestMethod.GET, RequestMethod.POST}) |
|
|
|
@RequestMapping(value = "/objectPdfDownload", method = {RequestMethod.GET, RequestMethod.POST}) |
|
|
|
public void objectPdfDownload(HttpServletResponse response,@ApiParam(value = "导出对象的ids, 通过,隔开。 不传则返回全部对象", required = false) @RequestParam String ids) { |
|
|
|
public void objectPdfDownload(HttpServletResponse response, @ApiParam(value = "导出对象的ids, 通过,隔开。 不传则返回全部对象", required = false) @RequestParam String ids) { |
|
|
|
List idList = null; |
|
|
|
List idList = null; |
|
|
|
if(Func.isNotEmpty(ids)){ |
|
|
|
if (Func.isNotEmpty(ids)) { |
|
|
|
idList = Arrays.asList(ids.split(",")); |
|
|
|
idList = Arrays.asList(ids.split(",")); |
|
|
|
} |
|
|
|
} |
|
|
|
String pdfPath = objectService.exportObjectPdf(idList); |
|
|
|
String pdfPath = objectService.exportObjectPdf(idList); |
|
|
|
|