|
|
|
|
@ -7,18 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.ObjectDangerEntity; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.ObjectEntity; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.ObjectTemplateEntity; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.OtherObjectEntity; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.services.*; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.utils.CodeUtils; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.vo.*; |
|
|
|
|
import org.springblade.hzinfo_inspect.plan.PlanContants; |
|
|
|
|
import org.springblade.hzinfo_inspect.plan.entity.PlanObjectTemplateEntity; |
|
|
|
|
import org.springblade.hzinfo_inspect.plan.service.IPlanObjectTemplateService; |
|
|
|
|
import org.springblade.hzinfo_inspect.task.TaskContants; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
|
@ -26,12 +14,24 @@ import lombok.AllArgsConstructor;
|
|
|
|
|
import org.apache.commons.io.FileUtils; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.constant.BladeConstant; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.ObjectDangerEntity; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.ObjectEntity; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.ObjectTemplateEntity; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.OtherObjectEntity; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.services.*; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.utils.CodeUtils; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.vo.ObjectBatchVo; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.vo.ObjectExcelInputData; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.vo.ObjectListQueryVO; |
|
|
|
|
import org.springblade.hzinfo_inspect.obj.vo.OtherObjectListQueryVO; |
|
|
|
|
import org.springblade.hzinfo_inspect.plan.PlanContants; |
|
|
|
|
import org.springblade.hzinfo_inspect.plan.service.IPlanObjectTemplateService; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
@ -40,10 +40,9 @@ import javax.validation.Valid;
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.OutputStream; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -164,11 +163,8 @@ public class ObjectController extends BladeController {
|
|
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入ids") |
|
|
|
|
public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
List<Long> delIdList = Func.toLongList(ids); |
|
|
|
|
QueryWrapper<PlanObjectTemplateEntity> qw = new QueryWrapper<>(); |
|
|
|
|
qw.lambda().in(PlanObjectTemplateEntity::getObjectId, delIdList).eq(PlanObjectTemplateEntity::getIsDeleted, 0); |
|
|
|
|
int count = planObjectTemplateService.count(qw); |
|
|
|
|
if (count > 0) { |
|
|
|
|
return R.fail("该巡检对象已关联模板,请先取消关联"); |
|
|
|
|
if (planObjectTemplateService.hasRelatedPlan(delIdList)) { |
|
|
|
|
return R.fail("该巡检对象存在使用中任务,请删除任务,或等待任务完成"); |
|
|
|
|
} |
|
|
|
|
for (Long aLong : delIdList) { |
|
|
|
|
objectTemplateService.remove(new QueryWrapper<ObjectTemplateEntity>() {{ |
|
|
|
|
@ -183,11 +179,8 @@ public class ObjectController extends BladeController {
|
|
|
|
|
@ApiOperation(value = "启用/停用", notes = "传入id,以及目标状态0-启用,1-停用") |
|
|
|
|
public R<Boolean> disableOrEnable(@RequestParam Long id, @RequestParam Integer status) { |
|
|
|
|
if (status == 1) { |
|
|
|
|
QueryWrapper<PlanObjectTemplateEntity> qw = new QueryWrapper<>(); |
|
|
|
|
qw.lambda().eq(PlanObjectTemplateEntity::getObjectId, id).eq(PlanObjectTemplateEntity::getIsDeleted, 0); |
|
|
|
|
int count = planObjectTemplateService.count(qw); |
|
|
|
|
if (count > 0) { |
|
|
|
|
return R.fail("该巡检对象已关联模板,请先取消关联"); |
|
|
|
|
if (planObjectTemplateService.hasRelatedPlan(Collections.singletonList(id))) { |
|
|
|
|
return R.fail("该巡检对象存在使用中任务,请删除任务,或等待任务完成"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
UpdateWrapper<ObjectEntity> ew = new UpdateWrapper<>(); |
|
|
|
|
|