diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevMergeController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevMergeController.java index 0c6324d..d9de9b2 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevMergeController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/controller/DevMergeController.java @@ -213,6 +213,17 @@ public class DevMergeController extends BaseController { } } + @ApiOperation(value = "装备台账-删除增单个设备草稿") + @PostMapping("/delDeviceByMaIds") + public AjaxResult delDeviceByMaIds(@RequestBody Long[] maIds) { + try { + return toAjax(service.deleteDevInfoByMaIds(maIds)); + } catch (Exception e) { + logger.error("报错啦", e); + return AjaxResult.error("调用异常,请联系管理员"); + } + } + /** * 提交设备台账 diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java index 2433c5d..746b98e 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java @@ -325,5 +325,7 @@ public interface DevInfoMapper { DevInfoVo selectToolByMaId(Long maId); DevInfo getMaStatusByToolId(@Param("id") Long id, @Param("num") Integer num); + + int delMaApplyDetails(@Param("maIds") Long[] maIds); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/DevMergeService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/DevMergeService.java index 3eff0a8..87f1229 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/DevMergeService.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/DevMergeService.java @@ -88,4 +88,12 @@ public interface DevMergeService { * @return Map<装备类型名称, 特征项列表> */ Map> getAllTypePropertiesMap(); + + /** + * 批量删除设备信息 + * + * @param maIds 需要删除的设备信息主键集合 + * @return 结果 + */ + int deleteDevInfoByMaIds(Long[] maIds); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevMergeServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevMergeServiceImpl.java index 7996f5d..e917a1f 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevMergeServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevMergeServiceImpl.java @@ -492,13 +492,45 @@ public class DevMergeServiceImpl implements DevMergeService { // 4.4 校验日期格式(若框架未自动处理,可添加) // 示例:校验productionDate是否为有效日期(根据实际需求调整) - LocalDate productionDate = item.getProductionDate().toInstant() - .atZone(ZoneId.systemDefault()).toLocalDate(); - LocalDate purchaseDate = item.getPurchaseDate().toInstant() - .atZone(ZoneId.systemDefault()).toLocalDate(); - if (productionDate.isAfter(purchaseDate)) { - rowError.append("生产日期不能晚于采购日期;"); + Date prodDate = item.getProductionDate(); + Date purDate = item.getPurchaseDate(); + + if (prodDate != null && purDate != null) { + LocalDate productionDate = prodDate.toInstant() + .atZone(ZoneId.systemDefault()) + .toLocalDate(); + LocalDate purchaseDate = purDate.toInstant() + .atZone(ZoneId.systemDefault()) + .toLocalDate(); + + if (productionDate.isAfter(purchaseDate)) { + rowError.append("生产日期不能晚于采购日期;"); + } } + + //校验装备名称、规格型号、资产原值、生产厂家、下次维保日期、最大使用年限、计数单位等字段必填 + if (StringUtils.isBlank(item.getEquipmentName())){ + rowError.append("装备名称不能为空;"); + } + if (StringUtils.isBlank(item.getSpecification())){ + rowError.append("规格型号不能为空;"); + } + if (ObjectUtil.isEmpty(item.getOriginalValue())){ + rowError.append("资产原值不能为空;"); + } + if (StringUtils.isBlank(item.getManufacturer())){ + rowError.append("生产厂家不能为空;"); + } + if (item.getNextMaintenanceDate() == null) { + rowError.append("下次维保日期不能为空;"); + } + if (StringUtils.isBlank(item.getUnit())){ + rowError.append("计数单位不能为空;"); + } + if (ObjectUtil.isEmpty(item.getMaxServiceYears())){ + rowError.append("最大使用年限不能为空;"); + } + Integer typeId = devMergeMapper.getTypeId(item.getProfession()); if (ObjectUtil.isEmpty(typeId)) { rowError.append("请选择类别"); @@ -1163,6 +1195,20 @@ public class DevMergeServiceImpl implements DevMergeService { return typePropertiesMap; } + /** + * 批量删除设备信息 + * + * @param maIds 需要删除的设备信息主键 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int deleteDevInfoByMaIds(Long[] maIds) { + devInfoMapper.batchDeleteDevInfoProperties(maIds); + devInfoMapper.deleteDevInfoByMaIds(maIds); + return devInfoMapper.delMaApplyDetails(maIds); + } + private boolean isCoreFieldHasValue(EquipmentImportDTO item) { return StringUtils.hasText(item.getEquipmentName()) || StringUtils.hasText(item.getSpecification()) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/repair/controller/RepairController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/repair/controller/RepairController.java index 7b49f29..a839af8 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/repair/controller/RepairController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/repair/controller/RepairController.java @@ -2,6 +2,7 @@ package com.bonus.material.repair.controller; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.core.web.page.TableDataInfo; import com.bonus.material.devchange.domain.CsDeviceInfo; import com.bonus.material.devchange.domain.CsDeviceVo; import com.bonus.material.repair.domain.ToBeRepair; @@ -33,10 +34,11 @@ public class RepairController extends BaseController { */ @ApiOperation(value = "获取待修工具和装备列表") @GetMapping("/getToBeRepairList") - public AjaxResult list(ToBeRepair bean) + public TableDataInfo list(ToBeRepair bean) { + startPage(); List list = service.getToBeRepairList(bean); - return AjaxResult.success(list); + return getDataTable(list); } /** diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml index 461eed6..fe00b05 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml @@ -693,6 +693,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{maId} + + delete from ma_apply_details where dev_id in + + #{maId} + + insert into