feat:设备管理流程类功能开发
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.zt.plat.module.qms.resource.device.controller.admin;
|
package com.zt.plat.module.qms.resource.device.controller.admin;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
||||||
@@ -66,6 +67,19 @@ public class DeviceApplyController extends AbstractFileUploadController implemen
|
|||||||
return deviceApplyService.saveDeviceApply(createReqVO);
|
return deviceApplyService.saveDeviceApply(createReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/addDetail")
|
||||||
|
@Operation(summary = "增加明细")
|
||||||
|
public CommonResult<Boolean> addDetail(@RequestBody JSONObject param) {
|
||||||
|
return deviceApplyService.addDetail(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping("/removeDetail")
|
||||||
|
@Operation(summary = "删除明细")
|
||||||
|
public CommonResult<Boolean> removeDetail(@RequestBody JSONObject param) {
|
||||||
|
return deviceApplyService.removeDetail(param);
|
||||||
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新设备通用流程,验收、降级、停用、报废、还原、启用")
|
@Operation(summary = "更新设备通用流程,验收、降级、停用、报废、还原、启用")
|
||||||
// @PreAuthorize("@ss.hasPermission('qms:device-apply:update')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-apply:update')")
|
||||||
@@ -101,7 +115,7 @@ public class DeviceApplyController extends AbstractFileUploadController implemen
|
|||||||
return success(BeanUtils.toBean(deviceApply, DeviceApplyRespVO.class));
|
return success(BeanUtils.toBean(deviceApply, DeviceApplyRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获得设备通用流程,验收、降级、停用、报废、还原、启用分页")
|
@Operation(summary = "获得设备通用流程,验收、降级、停用、报废、还原、启用分页")
|
||||||
public CommonResult<PageResult<DeviceApplyRespVO>> getDeviceApplyPage(@Valid DeviceApplyPageReqVO pageReqVO) {
|
public CommonResult<PageResult<DeviceApplyRespVO>> getDeviceApplyPage(@Valid DeviceApplyPageReqVO pageReqVO) {
|
||||||
PageResult<DeviceApplyDO> pageResult = deviceApplyService.getDeviceApplyPage(pageReqVO);
|
PageResult<DeviceApplyDO> pageResult = deviceApplyService.getDeviceApplyPage(pageReqVO);
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package com.zt.plat.module.qms.resource.device.controller.admin;
|
package com.zt.plat.module.qms.resource.device.controller.admin;
|
||||||
|
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyDetailPageReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.*;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyDetailRespVO;
|
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyDetailSaveReqVO;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -55,6 +54,13 @@ public class DeviceApplyDetailController extends AbstractFileUploadController im
|
|||||||
@Resource
|
@Resource
|
||||||
private DeviceApplyDetailService deviceApplyDetailService;
|
private DeviceApplyDetailService deviceApplyDetailService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得设备通用流程分页")
|
||||||
|
public CommonResult<List<DeviceApplyDetailRespVO>> list(DeviceApplyDetailPageReqVO reqVO) {
|
||||||
|
List<DeviceApplyDetailDO> list = deviceApplyDetailService.selectList(reqVO);
|
||||||
|
return success(BeanUtils.toBean(list, DeviceApplyDetailRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建设备通用流程明细")
|
@Operation(summary = "创建设备通用流程明细")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-apply-detail:create')")
|
@PreAuthorize("@ss.hasPermission('qms:device-apply-detail:create')")
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ public class DeviceConfigFlowController implements BusinessControllerMarker {
|
|||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建设备通用流程配置")
|
@Operation(summary = "创建设备通用流程配置")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:create')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-flow:create')")
|
||||||
public CommonResult<DeviceConfigFlowRespVO> createDeviceConfigFlow(@Valid @RequestBody DeviceConfigFlowSaveReqVO createReqVO) {
|
public CommonResult<DeviceConfigFlowRespVO> createDeviceConfigFlow(@Valid @RequestBody DeviceConfigFlowSaveReqVO createReqVO) {
|
||||||
return success(deviceConfigFlowService.createDeviceConfigFlow(createReqVO));
|
return success(deviceConfigFlowService.createDeviceConfigFlow(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新设备通用流程配置")
|
@Operation(summary = "更新设备通用流程配置")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:update')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-flow:update')")
|
||||||
public CommonResult<Boolean> updateDeviceConfigFlow(@Valid @RequestBody DeviceConfigFlowSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateDeviceConfigFlow(@Valid @RequestBody DeviceConfigFlowSaveReqVO updateReqVO) {
|
||||||
deviceConfigFlowService.updateDeviceConfigFlow(updateReqVO);
|
deviceConfigFlowService.updateDeviceConfigFlow(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -71,7 +71,7 @@ public class DeviceConfigFlowController implements BusinessControllerMarker {
|
|||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除设备通用流程配置")
|
@Operation(summary = "删除设备通用流程配置")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:delete')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-flow:delete')")
|
||||||
public CommonResult<Boolean> deleteDeviceConfigFlow(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> deleteDeviceConfigFlow(@RequestParam("id") Long id) {
|
||||||
deviceConfigFlowService.deleteDeviceConfigFlow(id);
|
deviceConfigFlowService.deleteDeviceConfigFlow(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -80,7 +80,7 @@ public class DeviceConfigFlowController implements BusinessControllerMarker {
|
|||||||
@DeleteMapping("/delete-list")
|
@DeleteMapping("/delete-list")
|
||||||
@Parameter(name = "ids", description = "编号", required = true)
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
@Operation(summary = "批量删除设备通用流程配置")
|
@Operation(summary = "批量删除设备通用流程配置")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:delete')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-flow:delete')")
|
||||||
public CommonResult<Boolean> deleteDeviceConfigFlowList(@RequestBody BatchDeleteReqVO req) {
|
public CommonResult<Boolean> deleteDeviceConfigFlowList(@RequestBody BatchDeleteReqVO req) {
|
||||||
deviceConfigFlowService.deleteDeviceConfigFlowListByIds(req.getIds());
|
deviceConfigFlowService.deleteDeviceConfigFlowListByIds(req.getIds());
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -89,7 +89,7 @@ public class DeviceConfigFlowController implements BusinessControllerMarker {
|
|||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得设备通用流程配置")
|
@Operation(summary = "获得设备通用流程配置")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-flow:query')")
|
||||||
public CommonResult<DeviceConfigFlowRespVO> getDeviceConfigFlow(@RequestParam("id") Long id) {
|
public CommonResult<DeviceConfigFlowRespVO> getDeviceConfigFlow(@RequestParam("id") Long id) {
|
||||||
DeviceConfigFlowDO deviceConfigFlow = deviceConfigFlowService.getDeviceConfigFlow(id);
|
DeviceConfigFlowDO deviceConfigFlow = deviceConfigFlowService.getDeviceConfigFlow(id);
|
||||||
return success(BeanUtils.toBean(deviceConfigFlow, DeviceConfigFlowRespVO.class));
|
return success(BeanUtils.toBean(deviceConfigFlow, DeviceConfigFlowRespVO.class));
|
||||||
@@ -104,7 +104,7 @@ public class DeviceConfigFlowController implements BusinessControllerMarker {
|
|||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出设备通用流程配置 Excel")
|
@Operation(summary = "导出设备通用流程配置 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-flow:export')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-flow:export')")
|
||||||
@ApiAccessLog(operateType = EXPORT)
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
public void exportDeviceConfigFlowExcel(@Valid DeviceConfigFlowPageReqVO pageReqVO,
|
public void exportDeviceConfigFlowExcel(@Valid DeviceConfigFlowPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
|
|||||||
@@ -35,4 +35,7 @@ public class DeviceApplyDetailPageReqVO extends PageParam {
|
|||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
//扩展字段
|
||||||
|
@Schema(description = "设备id列表")
|
||||||
|
private List<Long> deviceInfoIdList;
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,8 @@ import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDetailDO
|
|||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyDetailPageReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyDetailPageReqVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备通用流程明细 Mapper
|
* 设备通用流程明细 Mapper
|
||||||
*
|
*
|
||||||
@@ -27,4 +29,18 @@ public interface DeviceApplyDetailMapper extends BaseMapperX<DeviceApplyDetailDO
|
|||||||
.orderByDesc(DeviceApplyDetailDO::getId));
|
.orderByDesc(DeviceApplyDetailDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<DeviceApplyDetailDO> selectList(DeviceApplyDetailPageReqVO reqVO) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<DeviceApplyDetailDO>()
|
||||||
|
.eqIfPresent(DeviceApplyDetailDO::getApplyId, reqVO.getApplyId())
|
||||||
|
.eqIfPresent(DeviceApplyDetailDO::getDeviceInfomationId, reqVO.getDeviceInfomationId())
|
||||||
|
.inIfPresent(DeviceApplyDetailDO::getDeviceInfomationId, reqVO.getDeviceInfoIdList())
|
||||||
|
.eqIfPresent(DeviceApplyDetailDO::getDeviceBorrowDetailId, reqVO.getDeviceBorrowDetailId())
|
||||||
|
.eqIfPresent(DeviceApplyDetailDO::getFormData, reqVO.getFormData())
|
||||||
|
.eqIfPresent(DeviceApplyDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||||
|
.eqIfPresent(DeviceApplyDetailDO::getRemark, reqVO.getRemark())
|
||||||
|
.betweenIfPresent(DeviceApplyDetailDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(DeviceApplyDetailDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,10 @@ import com.zt.plat.framework.common.pojo.PageResult;
|
|||||||
*/
|
*/
|
||||||
public interface DeviceApplyDetailService {
|
public interface DeviceApplyDetailService {
|
||||||
|
|
||||||
|
List<DeviceApplyDetailDO> selectList(DeviceApplyDetailPageReqVO reqVO);
|
||||||
|
|
||||||
|
void insertBatch(List<DeviceApplyDetailDO> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建设备通用流程明细
|
* 创建设备通用流程明细
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyDetailRes
|
|||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyDetailSaveReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyDetailSaveReqVO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -32,6 +33,17 @@ public class DeviceApplyDetailServiceImpl implements DeviceApplyDetailService {
|
|||||||
@Resource
|
@Resource
|
||||||
private DeviceApplyDetailMapper deviceApplyDetailMapper;
|
private DeviceApplyDetailMapper deviceApplyDetailMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceApplyDetailDO> selectList(DeviceApplyDetailPageReqVO reqVO) {
|
||||||
|
return deviceApplyDetailMapper.selectList(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void insertBatch(List<DeviceApplyDetailDO> list) {
|
||||||
|
deviceApplyDetailMapper.insertBatch(list);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceApplyDetailRespVO createDeviceApplyDetail(DeviceApplyDetailSaveReqVO createReqVO) {
|
public DeviceApplyDetailRespVO createDeviceApplyDetail(DeviceApplyDetailSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.qms.resource.device.service;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
||||||
@@ -28,6 +29,12 @@ public interface DeviceApplyService {
|
|||||||
//创建临时数据
|
//创建临时数据
|
||||||
CommonResult<DeviceApplyRespVO> createTempData(@Valid DeviceApplySaveReqVO createReqVO);
|
CommonResult<DeviceApplyRespVO> createTempData(@Valid DeviceApplySaveReqVO createReqVO);
|
||||||
|
|
||||||
|
//增加明细
|
||||||
|
CommonResult<Boolean> addDetail(JSONObject param);
|
||||||
|
|
||||||
|
//删除明细
|
||||||
|
CommonResult<Boolean> removeDetail(JSONObject param);
|
||||||
|
|
||||||
CommonResult<Boolean> saveDeviceApply(@Valid DeviceApplySaveReqVO updateReqVO);
|
CommonResult<Boolean> saveDeviceApply(@Valid DeviceApplySaveReqVO updateReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,10 +13,13 @@ import com.zt.plat.module.qms.common.data.dal.dataobject.DataTemplateDO;
|
|||||||
import com.zt.plat.module.qms.common.data.service.DataCollectionService;
|
import com.zt.plat.module.qms.common.data.service.DataCollectionService;
|
||||||
import com.zt.plat.module.qms.common.data.service.DataTemplateService;
|
import com.zt.plat.module.qms.common.data.service.DataTemplateService;
|
||||||
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||||
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyDetailPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
||||||
|
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDetailDO;
|
||||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigFlowDO;
|
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigFlowDO;
|
||||||
|
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.beanutils.PropertyUtils;
|
import org.apache.commons.beanutils.PropertyUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -27,6 +30,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDO;
|
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDO;
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
@@ -50,6 +54,8 @@ public class DeviceApplyServiceImpl implements DeviceApplyService {
|
|||||||
|
|
||||||
@Resource private DeviceApplyMapper deviceApplyMapper;
|
@Resource private DeviceApplyMapper deviceApplyMapper;
|
||||||
@Resource private DeviceConfigFlowService deviceConfigFlowService;
|
@Resource private DeviceConfigFlowService deviceConfigFlowService;
|
||||||
|
@Resource private DeviceInfomationService deviceInfomationService;
|
||||||
|
@Resource private DeviceApplyDetailService deviceApplyDetailService;
|
||||||
@Resource private DataCollectionService dataCollectionService;
|
@Resource private DataCollectionService dataCollectionService;
|
||||||
@Resource private DataTemplateService dataTemplateService;
|
@Resource private DataTemplateService dataTemplateService;
|
||||||
|
|
||||||
@@ -96,6 +102,55 @@ public class DeviceApplyServiceImpl implements DeviceApplyService {
|
|||||||
return CommonResult.success(BeanUtils.toBean(deviceApply, DeviceApplyRespVO.class));
|
return CommonResult.success(BeanUtils.toBean(deviceApply, DeviceApplyRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//增加明细
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public CommonResult<Boolean> addDetail(JSONObject param) {
|
||||||
|
String deviceIds = param.getString("deviceIds");
|
||||||
|
String applyId = param.getString("applyId");
|
||||||
|
if(ObjectUtils.isEmpty(deviceIds))
|
||||||
|
return CommonResult.error(DEVICE_APPLY_NOT_EXISTS.getCode(), "请选择设备");
|
||||||
|
if(ObjectUtils.isEmpty(applyId))
|
||||||
|
return CommonResult.error(DEVICE_APPLY_NOT_EXISTS.getCode(), "缺少申请id参数,请刷新后重试!");
|
||||||
|
List<DeviceInfomationDO> deviceList = deviceInfomationService.getListByIds(deviceIds);
|
||||||
|
if(deviceList.isEmpty())
|
||||||
|
return CommonResult.error(DEVICE_APPLY_NOT_EXISTS.getCode(), "设备不存在");
|
||||||
|
List<Long> deviceInfoIdList = new ArrayList<>();
|
||||||
|
for (DeviceInfomationDO device : deviceList) {
|
||||||
|
deviceInfoIdList.add(device.getId());
|
||||||
|
}
|
||||||
|
//查询已有明细,避免重复添加
|
||||||
|
DeviceApplyDetailPageReqVO detailPageReqVO = new DeviceApplyDetailPageReqVO();
|
||||||
|
detailPageReqVO.setApplyId(Long.valueOf(applyId));
|
||||||
|
detailPageReqVO.setDeviceInfoIdList(deviceInfoIdList);
|
||||||
|
List<DeviceApplyDetailDO> detailList = deviceApplyDetailService.selectList(detailPageReqVO);
|
||||||
|
//过滤已添加设备
|
||||||
|
List<DeviceInfomationDO> addDeviceList = deviceList.stream().filter(device ->
|
||||||
|
detailList.stream().noneMatch(detail -> detail.getDeviceInfomationId().equals(device.getId()))).toList();
|
||||||
|
List<DeviceApplyDetailDO> detailDOList = new ArrayList<>();
|
||||||
|
for (DeviceInfomationDO device : addDeviceList) {
|
||||||
|
DeviceApplyDetailDO detail = new DeviceApplyDetailDO();
|
||||||
|
detail.setApplyId(Long.valueOf(applyId));
|
||||||
|
detail.setDeviceInfomationId(device.getId());
|
||||||
|
detailDOList.add(detail);
|
||||||
|
}
|
||||||
|
deviceApplyDetailService.insertBatch(detailDOList);
|
||||||
|
|
||||||
|
return CommonResult.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<Boolean> removeDetail(JSONObject param) {
|
||||||
|
|
||||||
|
String detailIds = param.getString("detailIds");
|
||||||
|
if(ObjectUtils.isEmpty(detailIds))
|
||||||
|
return CommonResult.error(DEVICE_APPLY_NOT_EXISTS.getCode(), "请选择需要删除的明细数据");
|
||||||
|
List<Long> detailIdList = Arrays.stream(detailIds.split(",")).map(Long::valueOf).toList();
|
||||||
|
deviceApplyDetailService.deleteDeviceApplyDetailListByIds(detailIdList);
|
||||||
|
return CommonResult.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
//保存
|
//保存
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public interface DeviceInfomationService {
|
|||||||
DeviceInfomationDO getByCode(String code);
|
DeviceInfomationDO getByCode(String code);
|
||||||
|
|
||||||
List<DeviceInfomationDO> getListByProductIdList(List<Long> productIds);
|
List<DeviceInfomationDO> getListByProductIdList(List<Long> productIds);
|
||||||
|
List<DeviceInfomationDO> getListByIds(String ids);
|
||||||
|
|
||||||
List<Long> getIdListByProductIdList(List<Long> productIds);
|
List<Long> getIdListByProductIdList(List<Long> productIds);
|
||||||
|
|
||||||
@@ -47,11 +48,7 @@ public interface DeviceInfomationService {
|
|||||||
// CommonResult<Boolean> updateDeviceAcceptFlag(Long deviceId, String acceptFlag);
|
// CommonResult<Boolean> updateDeviceAcceptFlag(Long deviceId, String acceptFlag);
|
||||||
// CommonResult<Boolean> updateDeviceLendFlag(Long deviceId, Integer lendFlag);
|
// CommonResult<Boolean> updateDeviceLendFlag(Long deviceId, Integer lendFlag);
|
||||||
|
|
||||||
|
void updateBatch(List<DeviceInfomationDO> updateList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建设备-设备信息
|
* 创建设备-设备信息
|
||||||
|
|||||||
@@ -25,9 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||||
@@ -201,6 +199,11 @@ public class DeviceInfomationServiceImpl implements DeviceInfomationService {
|
|||||||
deviceInfomationMapper.update(updateWrapper);
|
deviceInfomationMapper.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateBatch(List<DeviceInfomationDO> updateList) {
|
||||||
|
deviceInfomationMapper.updateBatch(updateList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceInfomationDO getByCode(String code) {
|
public DeviceInfomationDO getByCode(String code) {
|
||||||
LambdaQueryWrapper<DeviceInfomationDO> query = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<DeviceInfomationDO> query = new LambdaQueryWrapper<>();
|
||||||
@@ -215,6 +218,14 @@ public class DeviceInfomationServiceImpl implements DeviceInfomationService {
|
|||||||
return deviceInfomationMapper.selectList(query);
|
return deviceInfomationMapper.selectList(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceInfomationDO> getListByIds(String ids) {
|
||||||
|
if(ObjectUtils.isEmpty(ids))
|
||||||
|
return Collections.emptyList();
|
||||||
|
List< Long> idsList = Arrays.asList(ids.split(",")).stream().map(Long::parseLong).toList();
|
||||||
|
return deviceInfomationMapper.selectByIds(idsList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Long> getIdListByProductIdList(List<Long> productIds) {
|
public List<Long> getIdListByProductIdList(List<Long> productIds) {
|
||||||
List<DeviceInfomationDO> list = getListByProductIdList(productIds);
|
List<DeviceInfomationDO> list = getListByProductIdList(productIds);
|
||||||
|
|||||||
Reference in New Issue
Block a user