From e81e6456678945fc0867b571cf9fa607acdd6f9f Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Tue, 10 Oct 2023 14:23:40 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=A1=B9=E7=BB=B4=E6=8A=A4(=E6=96=B0?= =?UTF-8?q?=E5=A2=9E)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EquCheckItemController.java | 120 ++++----- .../com/op/device/domain/EquCheckItem.java | 6 +- .../op/device/domain/EquCheckItemDetail.java | 231 +++++++++++++++++ .../op/device/domain/dto/EquCheckItemDTO.java | 245 ++++++++++++++++++ .../op/device/domain/vo/EquCheckItemVO.java | 180 +++++++++++++ .../mapper/EquCheckItemDetailMapper.java | 75 ++++++ .../op/device/mapper/EquCheckItemMapper.java | 13 + .../device/service/IEquCheckItemService.java | 7 +- .../service/impl/EquCheckItemServiceImpl.java | 83 +++++- .../device/EquCheckItemDetailMapper.xml | 143 ++++++++++ .../mapper/device/EquCheckItemMapper.xml | 13 +- 11 files changed, 1048 insertions(+), 68 deletions(-) create mode 100644 op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItemDetail.java create mode 100644 op-modules/op-device/src/main/java/com/op/device/domain/dto/EquCheckItemDTO.java create mode 100644 op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemVO.java create mode 100644 op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java create mode 100644 op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java index 1f711c81..45548939 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java @@ -2,6 +2,8 @@ package com.op.device.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.op.device.domain.dto.EquCheckItemDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -23,75 +25,75 @@ import com.op.common.core.web.page.TableDataInfo; /** * 检查项维护Controller - * + * * @author wws * @date 2023-10-09 */ @RestController @RequestMapping("/item") public class EquCheckItemController extends BaseController { - @Autowired - private IEquCheckItemService equCheckItemService; + @Autowired + private IEquCheckItemService equCheckItemService; - /** - * 查询检查项维护列表 - */ - @RequiresPermissions("device:item:list") - @GetMapping("/list") - public TableDataInfo list(EquCheckItem equCheckItem) { - startPage(); - List list = equCheckItemService.selectEquCheckItemList(equCheckItem); - return getDataTable(list); - } + /** + * 查询检查项维护列表 + */ + @RequiresPermissions("device:item:list") + @GetMapping("/list") + public TableDataInfo list(EquCheckItem equCheckItem) { + startPage(); + List list = equCheckItemService.selectEquCheckItemList(equCheckItem); + return getDataTable(list); + } - /** - * 导出检查项维护列表 - */ - @RequiresPermissions("device:item:export") - @Log(title = "检查项维护", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, EquCheckItem equCheckItem) { - List list = equCheckItemService.selectEquCheckItemList(equCheckItem); - ExcelUtil util = new ExcelUtil(EquCheckItem.class); - util.exportExcel(response, list, "检查项维护数据"); - } + /** + * 导出检查项维护列表 + */ + @RequiresPermissions("device:item:export") + @Log(title = "检查项维护", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, EquCheckItem equCheckItem) { + List list = equCheckItemService.selectEquCheckItemList(equCheckItem); + ExcelUtil util = new ExcelUtil(EquCheckItem.class); + util.exportExcel(response, list, "检查项维护数据"); + } - /** - * 获取检查项维护详细信息 - */ - @RequiresPermissions("device:item:query") - @GetMapping(value = "/{itemId}") - public AjaxResult getInfo(@PathVariable("itemId") String itemId) { - return success(equCheckItemService.selectEquCheckItemByItemId(itemId)); - } + /** + * 获取检查项维护详细信息 + */ + @RequiresPermissions("device:item:query") + @GetMapping(value = "/{itemId}") + public AjaxResult getInfo(@PathVariable("itemId") String itemId) { + return success(equCheckItemService.selectEquCheckItemByItemId(itemId)); + } - /** - * 新增检查项维护 - */ - @RequiresPermissions("device:item:add") - @Log(title = "检查项维护", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody EquCheckItem equCheckItem) { - return toAjax(equCheckItemService.insertEquCheckItem(equCheckItem)); - } + /** + * 新增检查项维护 + */ + @RequiresPermissions("device:item:add") + @Log(title = "检查项维护", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody EquCheckItemDTO equCheckItemDTO) { + return equCheckItemService.insertEquCheckItem(equCheckItemDTO); + } - /** - * 修改检查项维护 - */ - @RequiresPermissions("device:item:edit") - @Log(title = "检查项维护", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody EquCheckItem equCheckItem) { - return toAjax(equCheckItemService.updateEquCheckItem(equCheckItem)); - } + /** + * 修改检查项维护 + */ + @RequiresPermissions("device:item:edit") + @Log(title = "检查项维护", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody EquCheckItem equCheckItem) { + return toAjax(equCheckItemService.updateEquCheckItem(equCheckItem)); + } - /** - * 删除检查项维护 - */ - @RequiresPermissions("device:item:remove") - @Log(title = "检查项维护", businessType = BusinessType.DELETE) - @DeleteMapping("/{itemIds}") - public AjaxResult remove(@PathVariable String[] itemIds) { - return toAjax(equCheckItemService.deleteEquCheckItemByItemIds(itemIds)); - } + /** + * 删除检查项维护 + */ + @RequiresPermissions("device:item:remove") + @Log(title = "检查项维护", businessType = BusinessType.DELETE) + @DeleteMapping("/{itemIds}") + public AjaxResult remove(@PathVariable String[] itemIds) { + return toAjax(equCheckItemService.deleteEquCheckItemByItemIds(itemIds)); + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItem.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItem.java index 90db3f22..897791b3 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItem.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItem.java @@ -198,11 +198,11 @@ public class EquCheckItem extends BaseEntity { public String getItemRemark() { return itemRemark; } - public void setFactory(String factoryCode) { + public void setFactoryCode(String factoryCode) { this.factoryCode = factoryCode; } - public String getFactory() { + public String getFactoryCode() { return factoryCode; } public void setAttr1(String attr1) { @@ -272,7 +272,7 @@ public class EquCheckItem extends BaseEntity { .append("itemType", getItemType()) .append("itemTypeName", getItemTypeName()) .append("itemRemark", getItemRemark()) - .append("factoryCode", getFactory()) + .append("factoryCode", getFactoryCode()) .append("attr1", getAttr1()) .append("attr2", getAttr2()) .append("attr3", getAttr3()) diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItemDetail.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItemDetail.java new file mode 100644 index 00000000..9a527c27 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItemDetail.java @@ -0,0 +1,231 @@ +package com.op.device.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; + +/** + * 检查项详情对象 equ_check_item_detail + * + * @author wws + * @date 2023-10-10 + */ +public class EquCheckItemDetail extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 主键 */ + private String detailId; + + /** 主检查项编码 */ + @Excel(name = "主检查项编码") + private String parentCode; + + /** 标准类型 */ + @Excel(name = "标准类型") + private String standardType; + + /** 标准名称;qualitative(定性)、quantify(定量) */ + @Excel(name = "标准名称;qualitative(定性)、quantify", readConverterExp = "定=量") + private String standardName; + + /** 工厂 */ + @Excel(name = "工厂") + private String factoryCode; + + /** 上限 */ + @Excel(name = "上限") + private BigDecimal detailUpLimit; + + /** 下限 */ + @Excel(name = "下限") + private BigDecimal detailDownLimit; + + /** 单位 */ + @Excel(name = "单位") + private String detailUnit; + + /** 备用字段1 */ + @Excel(name = "备用字段1") + private String attr1; + + /** 备用字段2 */ + @Excel(name = "备用字段2") + private String attr2; + + /** 备用字段3 */ + @Excel(name = "备用字段3") + private String attr3; + + /** 删除标识 */ + private String delFlag; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdTime; + + /** 创建人 */ + @Excel(name = "创建人") + private String createdBy; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date updatedTime; + + /** 更新人 */ + @Excel(name = "更新人") + private String updatedBy; + + /** 详情编码 */ + @Excel(name = "详情编码") + private String detailCode; + + public String getDetailCode() { + return detailCode; + } + + public void setDetailCode(String detailCode) { + this.detailCode = detailCode; + } + + public void setDetailId(String detailId) { + this.detailId = detailId; + } + + public String getDetailId() { + return detailId; + } + public void setParentCode(String parentCode) { + this.parentCode = parentCode; + } + + public String getParentCode() { + return parentCode; + } + public void setStandardType(String standardType) { + this.standardType = standardType; + } + + public String getStandardType() { + return standardType; + } + public void setStandardName(String standardName) { + this.standardName = standardName; + } + + public String getStandardName() { + return standardName; + } + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getFactoryCode() { + return factoryCode; + } + public void setDetailUpLimit(BigDecimal detailUpLimit) { + this.detailUpLimit = detailUpLimit; + } + + public BigDecimal getDetailUpLimit() { + return detailUpLimit; + } + public void setDetailDownLimit(BigDecimal detailDownLimit) { + this.detailDownLimit = detailDownLimit; + } + + public BigDecimal getDetailDownLimit() { + return detailDownLimit; + } + public void setDetailUnit(String detailUnit) { + this.detailUnit = detailUnit; + } + + public String getDetailUnit() { + return detailUnit; + } + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr1() { + return attr1; + } + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr2() { + return attr2; + } + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getAttr3() { + return attr3; + } + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlag() { + return delFlag; + } + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + public Date getCreatedTime() { + return createdTime; + } + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getCreatedBy() { + return createdBy; + } + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public Date getUpdatedTime() { + return updatedTime; + } + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public String getUpdatedBy() { + return updatedBy; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("detailId", getDetailId()) + .append("parentCode", getParentCode()) + .append("standardType", getStandardType()) + .append("standardName", getStandardName()) + .append("factoryCode", getFactoryCode()) + .append("detailUpLimit", getDetailUpLimit()) + .append("detailDownLimit", getDetailDownLimit()) + .append("detailUnit", getDetailUnit()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("delFlag", getDelFlag()) + .append("createdTime", getCreatedTime()) + .append("createdBy", getCreatedBy()) + .append("updatedTime", getUpdatedTime()) + .append("updatedBy", getUpdatedBy()) + .append("detailCode", getDetailCode()) + .toString(); + } +} diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/dto/EquCheckItemDTO.java b/op-modules/op-device/src/main/java/com/op/device/domain/dto/EquCheckItemDTO.java new file mode 100644 index 00000000..acae10b4 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/domain/dto/EquCheckItemDTO.java @@ -0,0 +1,245 @@ +package com.op.device.domain.dto; + +import com.op.device.domain.EquCheckItemDetail; + +import java.util.Date; +import java.util.List; + +// 检查项维护页面DTO +public class EquCheckItemDTO { + /** 主键 */ + private String itemId ; + /** 检查项编码 */ + private String itemCode ; + /** 检查项名称 */ + private String itemName ; + /** 检查项方法/工具 */ + private String itemMethod ; + /** 维护类型编码 */ + private String itemType ; + /** 维护类型名称 */ + private String itemTypeName ; + /** 检查项备注 */ + private String itemRemark ; + /** 工厂 */ + private String factoryCode ; + /** 备用字段1 */ + private String attr1 ; + /** 备用字段2 */ + private String attr2 ; + /** 备用字段3 */ + private String attr3 ; + /** 删除标识 */ + private String delFlag ; + /** 创建时间 */ + private Date createdTime ; + /** 创建人 */ + private String createdBy ; + /** 更新时间 */ + private Date updatedTime ; + /** 更新人 */ + private String updatedBy ; + // 标准列表 + private List formStandard; + // 创建日期范围list + private List createdTimeArray; + + // 更新日期范围list + private List updateTimeArray; + + // 更新日期开始 + private String updateTimeStart; + + // 更新日期结束 + private String updateTimeEnd; + + // 创建日期开始 + private String createTimeStart; + + // 创建日期结束 + private String createTimeEnd; + + public List getCreatedTimeArray() { + return createdTimeArray; + } + + public void setCreatedTimeArray(List createdTimeArray) { + this.createdTimeArray = createdTimeArray; + } + + public List getUpdateTimeArray() { + return updateTimeArray; + } + + public void setUpdateTimeArray(List updateTimeArray) { + this.updateTimeArray = updateTimeArray; + } + + public String getUpdateTimeStart() { + return updateTimeStart; + } + + public void setUpdateTimeStart(String updateTimeStart) { + this.updateTimeStart = updateTimeStart; + } + + public String getUpdateTimeEnd() { + return updateTimeEnd; + } + + public void setUpdateTimeEnd(String updateTimeEnd) { + this.updateTimeEnd = updateTimeEnd; + } + + public String getCreateTimeStart() { + return createTimeStart; + } + + public void setCreateTimeStart(String createTimeStart) { + this.createTimeStart = createTimeStart; + } + + public String getCreateTimeEnd() { + return createTimeEnd; + } + + public void setCreateTimeEnd(String createTimeEnd) { + this.createTimeEnd = createTimeEnd; + } + + public String getItemId() { + return itemId; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getItemMethod() { + return itemMethod; + } + + public void setItemMethod(String itemMethod) { + this.itemMethod = itemMethod; + } + + public String getItemType() { + return itemType; + } + + public void setItemType(String itemType) { + this.itemType = itemType; + } + + public String getItemTypeName() { + return itemTypeName; + } + + public void setItemTypeName(String itemTypeName) { + this.itemTypeName = itemTypeName; + } + + public String getItemRemark() { + return itemRemark; + } + + public void setItemRemark(String itemRemark) { + this.itemRemark = itemRemark; + } + + public String getFactoryCode() { + return factoryCode; + } + + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getAttr1() { + return attr1; + } + + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr2() { + return attr2; + } + + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr3() { + return attr3; + } + + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public Date getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Date getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public List getFormStandard() { + return formStandard; + } + + public void setFormStandard(List formStandard) { + this.formStandard = formStandard; + } +} diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemVO.java b/op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemVO.java new file mode 100644 index 00000000..5f4eb3e3 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemVO.java @@ -0,0 +1,180 @@ +package com.op.device.domain.vo; + +import com.op.device.domain.EquCheckItemDetail; + +import java.util.Date; +import java.util.List; + +// 检查项维护页面VO +public class EquCheckItemVO { + /** 主键 */ + private String itemId ; + /** 检查项编码 */ + private String itemCode ; + /** 检查项名称 */ + private String itemName ; + /** 检查项方法/工具 */ + private String itemMethod ; + /** 维护类型编码 */ + private String itemType ; + /** 维护类型名称 */ + private String itemTypeName ; + /** 检查项备注 */ + private String itemRemark ; + /** 工厂 */ + private String factoryCode ; + /** 备用字段1 */ + private String attr1 ; + /** 备用字段2 */ + private String attr2 ; + /** 备用字段3 */ + private String attr3 ; + /** 删除标识 */ + private String delFlag ; + /** 创建时间 */ + private Date createdTime ; + /** 创建人 */ + private String createdBy ; + /** 更新时间 */ + private Date updatedTime ; + /** 更新人 */ + private String updatedBy ; + // 标准列表 + private List formStandard; + + public String getItemId() { + return itemId; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + + public String getItemCode() { + return itemCode; + } + + public void setItemCode(String itemCode) { + this.itemCode = itemCode; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(String itemName) { + this.itemName = itemName; + } + + public String getItemMethod() { + return itemMethod; + } + + public void setItemMethod(String itemMethod) { + this.itemMethod = itemMethod; + } + + public String getItemType() { + return itemType; + } + + public void setItemType(String itemType) { + this.itemType = itemType; + } + + public String getItemTypeName() { + return itemTypeName; + } + + public void setItemTypeName(String itemTypeName) { + this.itemTypeName = itemTypeName; + } + + public String getItemRemark() { + return itemRemark; + } + + public void setItemRemark(String itemRemark) { + this.itemRemark = itemRemark; + } + + public String getFactoryCode() { + return factoryCode; + } + + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getAttr1() { + return attr1; + } + + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr2() { + return attr2; + } + + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr3() { + return attr3; + } + + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public Date getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Date getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public List getFormStandard() { + return formStandard; + } + + public void setFormStandard(List formStandard) { + this.formStandard = formStandard; + } +} diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java new file mode 100644 index 00000000..d9715e33 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java @@ -0,0 +1,75 @@ +package com.op.device.mapper; + +import java.util.List; + +import com.op.device.domain.EquCheckItemDetail; + +/** + * 检查项详情Mapper接口 + * + * @author wws + * @date 2023-10-10 + */ +public interface EquCheckItemDetailMapper { + /** + * 查询检查项详情 + * + * @param detailId 检查项详情主键 + * @return 检查项详情 + */ + public EquCheckItemDetail selectEquCheckItemDetailByDetailId(String detailId); + + /** + * 查询检查项详情列表 + * + * @param equCheckItemDetail 检查项详情 + * @return 检查项详情集合 + */ + public List selectEquCheckItemDetailList(EquCheckItemDetail equCheckItemDetail); + + /** + * 新增检查项详情 + * + * @param equCheckItemDetail 检查项详情 + * @return 结果 + */ + public int insertEquCheckItemDetail(EquCheckItemDetail equCheckItemDetail); + + /** + * 修改检查项详情 + * + * @param equCheckItemDetail 检查项详情 + * @return 结果 + */ + public int updateEquCheckItemDetail(EquCheckItemDetail equCheckItemDetail); + + /** + * 删除检查项详情 + * + * @param detailId 检查项详情主键 + * @return 结果 + */ + public int deleteEquCheckItemDetailByDetailId(String detailId); + + /** + * 批量删除检查项详情 + * + * @param detailIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEquCheckItemDetailByDetailIds(String[] detailIds); + + /** + * 通过检查项code获取流水号 + * @param itemCode + * @return + */ + int selectSerialNumber(String itemCode); + + /** + * 通过检查项code查询标准 + * @param itemCode + * @return + */ + List selectEquCheckItemDetailByParentCode(String itemCode); +} diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java index cba00a32..27e64548 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java @@ -58,4 +58,17 @@ public interface EquCheckItemMapper { * @return 结果 */ public int deleteEquCheckItemByItemIds(String[] itemIds); + + /** + * 通过检查项名称查询检查项 + * @param itemName + * @return + */ + EquCheckItem selectEquCheckItemByItemName(String itemName); + + /** + * 获取流水号 + * @return + */ + int selectSerialNumber(); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java index b7d94510..8c04b4bd 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java @@ -1,7 +1,10 @@ package com.op.device.service; import java.util.List; + +import com.op.common.core.web.domain.AjaxResult; import com.op.device.domain.EquCheckItem; +import com.op.device.domain.dto.EquCheckItemDTO; /** * 检查项维护Service接口 @@ -29,10 +32,10 @@ public interface IEquCheckItemService { /** * 新增检查项维护 * - * @param equCheckItem 检查项维护 + * @param equCheckItemDTO 检查项维护 * @return 结果 */ - public int insertEquCheckItem(EquCheckItem equCheckItem); + public AjaxResult insertEquCheckItem(EquCheckItemDTO equCheckItemDTO); /** * 修改检查项维护 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index 995a784a..c38b226a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -3,13 +3,29 @@ package com.op.device.service.impl; import java.text.SimpleDateFormat; import java.util.List; +import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A; import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.context.SecurityContextHolder; +import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.uuid.IdUtils; +import com.op.common.core.web.domain.AjaxResult; import com.op.common.log.annotation.Log; +import com.op.device.domain.EquCheckItemDetail; +import com.op.device.domain.dto.EquCheckItemDTO; +import com.op.device.mapper.EquCheckItemDetailMapper; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.device.mapper.EquCheckItemMapper; import com.op.device.domain.EquCheckItem; import com.op.device.service.IEquCheckItemService; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +import static com.op.common.core.web.domain.AjaxResult.error; +import static com.op.common.core.web.domain.AjaxResult.success; /** * 检查项维护Service业务层处理 @@ -21,6 +37,8 @@ import com.op.device.service.IEquCheckItemService; public class EquCheckItemServiceImpl implements IEquCheckItemService { @Autowired private EquCheckItemMapper equCheckItemMapper; + @Autowired + private EquCheckItemDetailMapper equCheckItemDetailMapper; /** * 查询检查项维护 @@ -65,13 +83,72 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { /** * 新增检查项维护 * - * @param equCheckItem 检查项维护 + * @param equCheckItemDTO 检查项维护 * @return 结果 + * TODO 加事务锁 */ @Override @DS("#header.poolName") - public int insertEquCheckItem(EquCheckItem equCheckItem) { - return equCheckItemMapper.insertEquCheckItem(equCheckItem); + public AjaxResult insertEquCheckItem(EquCheckItemDTO equCheckItemDTO) { + // 检验重复 + EquCheckItem checkItem = equCheckItemMapper.selectEquCheckItemByItemName(equCheckItemDTO.getItemName()); + if (checkItem != null) { + return error("检查项已存在!新增失败!"); + } + // 创建检查项对象 + EquCheckItem equCheckItem = new EquCheckItem(); + BeanUtils.copyProperties(equCheckItemDTO,equCheckItem); + + //获取当前所选工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + String str = request.getHeader(key.substring(8)); + int index = str.indexOf("_"); + String factory = str.substring(index + 1); + + // 获取检查项流水号 + String serialNum = String.format("%02d", equCheckItemMapper.selectSerialNumber()); + + // 处理检查项信息 + equCheckItem.setItemId(IdUtils.fastSimpleUUID()); + equCheckItem.setFactoryCode(factory); + equCheckItem.setItemCode("CI"+serialNum); + equCheckItem.setCreatedBy(SecurityContextHolder.getUserName()); + equCheckItem.setCreatedTime(DateUtils.getNowDate()); + equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName()); + equCheckItem.setUpdatedTime(DateUtils.getNowDate()); + if (equCheckItem.getItemType().equals("spotInspection")) { + equCheckItem.setItemTypeName("点检"); + } + if (equCheckItem.getItemType().equals("inspection")) { + equCheckItem.setItemTypeName("巡检"); + } + if (equCheckItem.getItemType().equals("maintenance")) { + equCheckItem.setItemTypeName("保养"); + } + + // 插入数据库 + equCheckItemMapper.insertEquCheckItem(equCheckItem); + + // 处理标准信息 + for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) { + // 获取标准流水号 + String detailSerialNum = String.format("%03d", equCheckItemDetailMapper.selectSerialNumber(equCheckItem.getItemCode())); + + detail.setDetailId(IdUtils.fastSimpleUUID()); + detail.setParentCode(equCheckItem.getItemCode()); + detail.setFactoryCode(factory); + detail.setDetailCode(equCheckItem.getItemCode()+detailSerialNum); + detail.setCreatedBy(SecurityContextHolder.getUserName()); + detail.setCreatedTime(DateUtils.getNowDate()); + detail.setUpdatedBy(SecurityContextHolder.getUserName()); + detail.setUpdatedTime(DateUtils.getNowDate()); + + // 插入到数据库 + equCheckItemDetailMapper.insertEquCheckItemDetail(detail); + } + + return success("新增成功"); } /** diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml new file mode 100644 index 00000000..9d7aba5b --- /dev/null +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select detail_id, parent_code, standard_type, standard_name, factory_code, detail_up_limit, detail_down_limit, detail_unit, attr1, attr2, attr3, del_flag, created_time, created_by, updated_time, updated_by, detail_code from equ_check_item_detail + + + + + + + + + + + + insert into equ_check_item_detail + + detail_id, + parent_code, + standard_type, + standard_name, + factory_code, + detail_up_limit, + detail_down_limit, + detail_unit, + attr1, + attr2, + attr3, + del_flag, + created_time, + created_by, + updated_time, + updated_by, + detail_code, + + + #{detailId}, + #{parentCode}, + #{standardType}, + #{standardName}, + #{factoryCode}, + #{detailUpLimit}, + #{detailDownLimit}, + #{detailUnit}, + #{attr1}, + #{attr2}, + #{attr3}, + #{delFlag}, + #{createdTime}, + #{createdBy}, + #{updatedTime}, + #{updatedBy}, + #{detailCode}, + + + + + update equ_check_item_detail + + parent_code = #{parentCode}, + standard_type = #{standardType}, + standard_name = #{standardName}, + factory_code = #{factoryCode}, + detail_up_limit = #{detailUpLimit}, + detail_down_limit = #{detailDownLimit}, + detail_unit = #{detailUnit}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + del_flag = #{delFlag}, + created_time = #{createdTime}, + created_by = #{createdBy}, + updated_time = #{updatedTime}, + updated_by = #{updatedBy}, + detail_code = #{detailCode}, + + where detail_id = #{detailId} + + + + delete from equ_check_item_detail where detail_id = #{detailId} + + + + delete from equ_check_item_detail where detail_id in + + #{detailId} + + + \ No newline at end of file diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml index 9f85e7ec..bc5fa342 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml @@ -54,7 +54,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where item_id = #{itemId} - + + + + + insert into equ_check_item From 899f67ebd2979c45f987b8cede7aa843c79ca592 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Tue, 10 Oct 2023 14:29:21 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=A1=B9=E7=BB=B4=E6=8A=A4(=E6=96=B0?= =?UTF-8?q?=E5=A2=9E-code=E6=A0=BC=E5=BC=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/device/service/impl/EquCheckItemServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index c38b226a..bb483d10 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -107,12 +107,12 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { String factory = str.substring(index + 1); // 获取检查项流水号 - String serialNum = String.format("%02d", equCheckItemMapper.selectSerialNumber()); + String serialNum = String.format("%03d", equCheckItemMapper.selectSerialNumber()); // 处理检查项信息 equCheckItem.setItemId(IdUtils.fastSimpleUUID()); equCheckItem.setFactoryCode(factory); - equCheckItem.setItemCode("CI"+serialNum); + equCheckItem.setItemCode("CI"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+serialNum); equCheckItem.setCreatedBy(SecurityContextHolder.getUserName()); equCheckItem.setCreatedTime(DateUtils.getNowDate()); equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName()); From 5205fab4f9bd8b8481c6f1c9c78f488df2adafbe Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Tue, 10 Oct 2023 14:51:23 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=A1=B9=E7=BB=B4=E6=8A=A4(=E4=BF=AE?= =?UTF-8?q?=E6=94=B9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EquCheckItemController.java | 4 +- .../device/service/IEquCheckItemService.java | 5 ++- .../service/impl/EquCheckItemServiceImpl.java | 43 ++++++++++++++++--- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java index 45548939..31d8a3c3 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java @@ -83,8 +83,8 @@ public class EquCheckItemController extends BaseController { @RequiresPermissions("device:item:edit") @Log(title = "检查项维护", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody EquCheckItem equCheckItem) { - return toAjax(equCheckItemService.updateEquCheckItem(equCheckItem)); + public AjaxResult edit(@RequestBody EquCheckItemDTO equCheckItemDTO) { + return equCheckItemService.updateEquCheckItem(equCheckItemDTO); } /** diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java index 8c04b4bd..b093e800 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java @@ -5,6 +5,7 @@ import java.util.List; import com.op.common.core.web.domain.AjaxResult; import com.op.device.domain.EquCheckItem; import com.op.device.domain.dto.EquCheckItemDTO; +import com.op.device.domain.vo.EquCheckItemVO; /** * 检查项维护Service接口 @@ -19,7 +20,7 @@ public interface IEquCheckItemService { * @param itemId 检查项维护主键 * @return 检查项维护 */ - public EquCheckItem selectEquCheckItemByItemId(String itemId); + public EquCheckItemVO selectEquCheckItemByItemId(String itemId); /** * 查询检查项维护列表 @@ -43,7 +44,7 @@ public interface IEquCheckItemService { * @param equCheckItem 检查项维护 * @return 结果 */ - public int updateEquCheckItem(EquCheckItem equCheckItem); + public AjaxResult updateEquCheckItem(EquCheckItemDTO equCheckItemDTO); /** * 批量删除检查项维护 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index bb483d10..0f8114bd 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -1,5 +1,6 @@ package com.op.device.service.impl; +import java.text.Format; import java.text.SimpleDateFormat; import java.util.List; @@ -12,6 +13,7 @@ import com.op.common.core.web.domain.AjaxResult; import com.op.common.log.annotation.Log; import com.op.device.domain.EquCheckItemDetail; import com.op.device.domain.dto.EquCheckItemDTO; +import com.op.device.domain.vo.EquCheckItemVO; import com.op.device.mapper.EquCheckItemDetailMapper; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -48,8 +50,16 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { */ @Override @DS("#header.poolName") - public EquCheckItem selectEquCheckItemByItemId(String itemId) { - return equCheckItemMapper.selectEquCheckItemByItemId(itemId); + public EquCheckItemVO selectEquCheckItemByItemId(String itemId) { + EquCheckItem equCheckItem = equCheckItemMapper.selectEquCheckItemByItemId(itemId); + + // 创建返回对象 + EquCheckItemVO equCheckItemVO = new EquCheckItemVO(); + BeanUtils.copyProperties(equCheckItem,equCheckItemVO); + + equCheckItemVO.setFormStandard(equCheckItemDetailMapper.selectEquCheckItemDetailByParentCode(equCheckItem.getItemCode())); + + return equCheckItemVO; } /** @@ -154,13 +164,36 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { /** * 修改检查项维护 * - * @param equCheckItem 检查项维护 + * @param equCheckItemDTO 检查项维护 * @return 结果 */ @Override @DS("#header.poolName") - public int updateEquCheckItem(EquCheckItem equCheckItem) { - return equCheckItemMapper.updateEquCheckItem(equCheckItem); + public AjaxResult updateEquCheckItem(EquCheckItemDTO equCheckItemDTO) { + EquCheckItem equCheckItem = new EquCheckItem(); + BeanUtils.copyProperties(equCheckItemDTO,equCheckItem); + + // 处理检查项信息 + equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName()); + equCheckItem.setUpdatedTime(DateUtils.getNowDate()); + if (equCheckItem.getItemType().equals("spotInspection")) { + equCheckItem.setItemTypeName("点检"); + } + if (equCheckItem.getItemType().equals("inspection")) { + equCheckItem.setItemTypeName("巡检"); + } + if (equCheckItem.getItemType().equals("maintenance")) { + equCheckItem.setItemTypeName("保养"); + } + + equCheckItemMapper.updateEquCheckItem(equCheckItem); + + for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) { + detail.setUpdatedBy(SecurityContextHolder.getUserName()); + detail.setUpdatedTime(DateUtils.getNowDate()); + equCheckItemDetailMapper.updateEquCheckItemDetail(detail); + } + return success("修改成功"); } /** From 57ffbd7968bac6fce7067419a49089b8fffeb59d Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Tue, 10 Oct 2023 16:04:55 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=A1=B9=E7=BB=B4=E6=8A=A4V1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/EquCheckItemDetailMapper.java | 6 ++++++ .../service/impl/EquCheckItemServiceImpl.java | 5 +++++ .../device/EquCheckItemDetailMapper.xml | 21 +++++++++++++------ .../mapper/device/EquCheckItemMapper.xml | 14 +++++++------ 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java index d9715e33..f741f429 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemDetailMapper.java @@ -72,4 +72,10 @@ public interface EquCheckItemDetailMapper { * @return */ List selectEquCheckItemDetailByParentCode(String itemCode); + + /** + * 通过检查项id删除标准信息 + * @param itemId + */ + void deleteEquCheckItemDetailByItemId(String itemId); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index 0f8114bd..c32af306 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -205,6 +205,9 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { @Override @DS("#header.poolName") public int deleteEquCheckItemByItemIds(String[] itemIds) { + for (String data : itemIds) { + equCheckItemDetailMapper.deleteEquCheckItemDetailByItemId(data); + } return equCheckItemMapper.deleteEquCheckItemByItemIds(itemIds); } @@ -217,6 +220,8 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { @Override @DS("#header.poolName") public int deleteEquCheckItemByItemId(String itemId) { + // 通过id删除标准信息 + equCheckItemDetailMapper.deleteEquCheckItemDetailByItemId(itemId); return equCheckItemMapper.deleteEquCheckItemByItemId(itemId); } } diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml index 9d7aba5b..41fc3985 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml @@ -47,22 +47,24 @@ and updated_by = #{updatedBy} and detail_code = #{detailCode} + and del_flag = '0' @@ -127,17 +129,24 @@ updated_by = #{updatedBy}, detail_code = #{detailCode}, - where detail_id = #{detailId} + where detail_id = #{detailId} and del_flag = '0' - delete from equ_check_item_detail where detail_id = #{detailId} + update equ_check_item_detail set del_flag = '1' where detail_id = #{detailId} - delete from equ_check_item_detail where detail_id in + update equ_check_item_detail set del_flag = '1' where detail_id in #{detailId} + + + update equ_check_item_detail + set del_flag = '1' + where parent_code = ( + select item_code from equ_check_item where item_id = #{itemId} ) + \ No newline at end of file diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml index bc5fa342..06687e34 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml @@ -47,23 +47,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and CONVERT(date,updated_time) >= #{updateTimeStart} and #{updateTimeEnd} >= CONVERT(date,updated_time) and updated_by like concat('%', #{updatedBy}, '%') + and del_flag = '0' + ORDER BY created_time DESC @@ -125,15 +127,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" updated_time = #{updatedTime}, updated_by = #{updatedBy}, - where item_id = #{itemId} + where item_id = #{itemId} and del_flag = '0' - delete from equ_check_item where item_id = #{itemId} + update equ_check_item set del_flag = '1' where item_id = #{itemId} - delete from equ_check_item where item_id in + update equ_check_item set del_flag = '1' where item_id in #{itemId} From 48debb98d36f9ed3d9094622a9981f3e8b52579c Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Tue, 10 Oct 2023 16:16:13 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=A1=B9=E7=BB=B4=E6=8A=A4V1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/device/service/impl/EquCheckItemServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index c32af306..ca59075c 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -122,7 +122,7 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { // 处理检查项信息 equCheckItem.setItemId(IdUtils.fastSimpleUUID()); equCheckItem.setFactoryCode(factory); - equCheckItem.setItemCode("CI"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+serialNum); + equCheckItem.setItemCode(DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+serialNum); equCheckItem.setCreatedBy(SecurityContextHolder.getUserName()); equCheckItem.setCreatedTime(DateUtils.getNowDate()); equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName()); From 8b3acc99b7eb126963daf548a5ac9ef82cff83ba Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Tue, 10 Oct 2023 16:32:51 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=A1=B9=E7=BB=B4=E6=8A=A4(=E4=BF=AE?= =?UTF-8?q?=E6=94=B9BUG=E4=BF=AE=E5=A4=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/EquCheckItemServiceImpl.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index ca59075c..1c240e80 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -189,9 +189,27 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { equCheckItemMapper.updateEquCheckItem(equCheckItem); for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) { - detail.setUpdatedBy(SecurityContextHolder.getUserName()); - detail.setUpdatedTime(DateUtils.getNowDate()); - equCheckItemDetailMapper.updateEquCheckItemDetail(detail); + // 标准不存在则新增 + if (detail.getDetailCode() == null) { + // 获取标准流水号 + String detailSerialNum = String.format("%03d", equCheckItemDetailMapper.selectSerialNumber(equCheckItem.getItemCode())); + + detail.setDetailId(IdUtils.fastSimpleUUID()); + detail.setParentCode(equCheckItem.getItemCode()); + detail.setFactoryCode(equCheckItem.getFactoryCode()); + detail.setDetailCode(equCheckItem.getItemCode()+detailSerialNum); + detail.setCreatedBy(SecurityContextHolder.getUserName()); + detail.setCreatedTime(DateUtils.getNowDate()); + detail.setUpdatedBy(SecurityContextHolder.getUserName()); + detail.setUpdatedTime(DateUtils.getNowDate()); + + // 插入到数据库 + equCheckItemDetailMapper.insertEquCheckItemDetail(detail); + }else { + detail.setUpdatedBy(SecurityContextHolder.getUserName()); + detail.setUpdatedTime(DateUtils.getNowDate()); + equCheckItemDetailMapper.updateEquCheckItemDetail(detail); + } } return success("修改成功"); } From 40f02380712deb0cd6a18b2bd75c98a07a9a2604 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Tue, 10 Oct 2023 16:45:21 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=A1=B9=E7=BB=B4=E6=8A=A4(=E4=BF=AE?= =?UTF-8?q?=E6=94=B9BUG=E4=BF=AE=E5=A4=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/EquCheckItemServiceImpl.java | 408 +++++++++--------- 1 file changed, 202 insertions(+), 206 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index 1c240e80..2fc24803 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -31,215 +31,211 @@ import static com.op.common.core.web.domain.AjaxResult.success; /** * 检查项维护Service业务层处理 - * + * * @author wws * @date 2023-10-09 */ @Service public class EquCheckItemServiceImpl implements IEquCheckItemService { - @Autowired - private EquCheckItemMapper equCheckItemMapper; - @Autowired - private EquCheckItemDetailMapper equCheckItemDetailMapper; - - /** - * 查询检查项维护 - * - * @param itemId 检查项维护主键 - * @return 检查项维护 - */ - @Override - @DS("#header.poolName") - public EquCheckItemVO selectEquCheckItemByItemId(String itemId) { - EquCheckItem equCheckItem = equCheckItemMapper.selectEquCheckItemByItemId(itemId); - - // 创建返回对象 - EquCheckItemVO equCheckItemVO = new EquCheckItemVO(); - BeanUtils.copyProperties(equCheckItem,equCheckItemVO); - - equCheckItemVO.setFormStandard(equCheckItemDetailMapper.selectEquCheckItemDetailByParentCode(equCheckItem.getItemCode())); - - return equCheckItemVO; - } - - /** - * 查询检查项维护列表 - * - * @param equCheckItem 检查项维护 - * @return 检查项维护 - */ - @Override - @DS("#header.poolName") - public List selectEquCheckItemList(EquCheckItem equCheckItem) { - if (equCheckItem.getCreatedTimeArray() != null) { - // 设置创建日期开始和结束值 - if (equCheckItem.getCreatedTimeArray().size() == 2) { - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - equCheckItem.setCreateTimeStart(formatter.format(equCheckItem.getCreatedTimeArray().get(0))); - equCheckItem.setCreateTimeEnd(formatter.format(equCheckItem.getCreatedTimeArray().get(1))); - } - } - if (equCheckItem.getUpdateTimeArray() != null) { - // 设置更新日期开始和结束 - if (equCheckItem.getUpdateTimeArray().size() == 2) { - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - equCheckItem.setUpdateTimeStart(formatter.format(equCheckItem.getUpdateTimeArray().get(0))); - equCheckItem.setUpdateTimeEnd(formatter.format(equCheckItem.getUpdateTimeArray().get(1))); - } - } - return equCheckItemMapper.selectEquCheckItemList(equCheckItem); - } - - /** - * 新增检查项维护 - * - * @param equCheckItemDTO 检查项维护 - * @return 结果 - * TODO 加事务锁 - */ - @Override - @DS("#header.poolName") - public AjaxResult insertEquCheckItem(EquCheckItemDTO equCheckItemDTO) { - // 检验重复 - EquCheckItem checkItem = equCheckItemMapper.selectEquCheckItemByItemName(equCheckItemDTO.getItemName()); - if (checkItem != null) { - return error("检查项已存在!新增失败!"); - } - // 创建检查项对象 - EquCheckItem equCheckItem = new EquCheckItem(); - BeanUtils.copyProperties(equCheckItemDTO,equCheckItem); - - //获取当前所选工厂 - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String key = "#header.poolName"; - String str = request.getHeader(key.substring(8)); - int index = str.indexOf("_"); - String factory = str.substring(index + 1); - - // 获取检查项流水号 - String serialNum = String.format("%03d", equCheckItemMapper.selectSerialNumber()); - - // 处理检查项信息 - equCheckItem.setItemId(IdUtils.fastSimpleUUID()); - equCheckItem.setFactoryCode(factory); - equCheckItem.setItemCode(DateUtils.dateTimeNow(DateUtils.YYYYMMDD)+serialNum); - equCheckItem.setCreatedBy(SecurityContextHolder.getUserName()); - equCheckItem.setCreatedTime(DateUtils.getNowDate()); - equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName()); - equCheckItem.setUpdatedTime(DateUtils.getNowDate()); - if (equCheckItem.getItemType().equals("spotInspection")) { - equCheckItem.setItemTypeName("点检"); - } - if (equCheckItem.getItemType().equals("inspection")) { - equCheckItem.setItemTypeName("巡检"); - } - if (equCheckItem.getItemType().equals("maintenance")) { - equCheckItem.setItemTypeName("保养"); - } - - // 插入数据库 - equCheckItemMapper.insertEquCheckItem(equCheckItem); - - // 处理标准信息 - for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) { - // 获取标准流水号 - String detailSerialNum = String.format("%03d", equCheckItemDetailMapper.selectSerialNumber(equCheckItem.getItemCode())); - - detail.setDetailId(IdUtils.fastSimpleUUID()); - detail.setParentCode(equCheckItem.getItemCode()); - detail.setFactoryCode(factory); - detail.setDetailCode(equCheckItem.getItemCode()+detailSerialNum); - detail.setCreatedBy(SecurityContextHolder.getUserName()); - detail.setCreatedTime(DateUtils.getNowDate()); - detail.setUpdatedBy(SecurityContextHolder.getUserName()); - detail.setUpdatedTime(DateUtils.getNowDate()); - - // 插入到数据库 - equCheckItemDetailMapper.insertEquCheckItemDetail(detail); - } - - return success("新增成功"); - } - - /** - * 修改检查项维护 - * - * @param equCheckItemDTO 检查项维护 - * @return 结果 - */ - @Override - @DS("#header.poolName") - public AjaxResult updateEquCheckItem(EquCheckItemDTO equCheckItemDTO) { - EquCheckItem equCheckItem = new EquCheckItem(); - BeanUtils.copyProperties(equCheckItemDTO,equCheckItem); - - // 处理检查项信息 - equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName()); - equCheckItem.setUpdatedTime(DateUtils.getNowDate()); - if (equCheckItem.getItemType().equals("spotInspection")) { - equCheckItem.setItemTypeName("点检"); - } - if (equCheckItem.getItemType().equals("inspection")) { - equCheckItem.setItemTypeName("巡检"); - } - if (equCheckItem.getItemType().equals("maintenance")) { - equCheckItem.setItemTypeName("保养"); - } - - equCheckItemMapper.updateEquCheckItem(equCheckItem); - - for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) { - // 标准不存在则新增 - if (detail.getDetailCode() == null) { - // 获取标准流水号 - String detailSerialNum = String.format("%03d", equCheckItemDetailMapper.selectSerialNumber(equCheckItem.getItemCode())); - - detail.setDetailId(IdUtils.fastSimpleUUID()); - detail.setParentCode(equCheckItem.getItemCode()); - detail.setFactoryCode(equCheckItem.getFactoryCode()); - detail.setDetailCode(equCheckItem.getItemCode()+detailSerialNum); - detail.setCreatedBy(SecurityContextHolder.getUserName()); - detail.setCreatedTime(DateUtils.getNowDate()); - detail.setUpdatedBy(SecurityContextHolder.getUserName()); - detail.setUpdatedTime(DateUtils.getNowDate()); - - // 插入到数据库 - equCheckItemDetailMapper.insertEquCheckItemDetail(detail); - }else { - detail.setUpdatedBy(SecurityContextHolder.getUserName()); - detail.setUpdatedTime(DateUtils.getNowDate()); - equCheckItemDetailMapper.updateEquCheckItemDetail(detail); - } - } - return success("修改成功"); - } - - /** - * 批量删除检查项维护 - * - * @param itemIds 需要删除的检查项维护主键 - * @return 结果 - */ - @Override - @DS("#header.poolName") - public int deleteEquCheckItemByItemIds(String[] itemIds) { - for (String data : itemIds) { - equCheckItemDetailMapper.deleteEquCheckItemDetailByItemId(data); - } - return equCheckItemMapper.deleteEquCheckItemByItemIds(itemIds); - } - - /** - * 删除检查项维护信息 - * - * @param itemId 检查项维护主键 - * @return 结果 - */ - @Override - @DS("#header.poolName") - public int deleteEquCheckItemByItemId(String itemId) { - // 通过id删除标准信息 - equCheckItemDetailMapper.deleteEquCheckItemDetailByItemId(itemId); - return equCheckItemMapper.deleteEquCheckItemByItemId(itemId); - } + @Autowired + private EquCheckItemMapper equCheckItemMapper; + @Autowired + private EquCheckItemDetailMapper equCheckItemDetailMapper; + + /** + * 查询检查项维护 + * + * @param itemId 检查项维护主键 + * @return 检查项维护 + */ + @Override + @DS("#header.poolName") + public EquCheckItemVO selectEquCheckItemByItemId(String itemId) { + EquCheckItem equCheckItem = equCheckItemMapper.selectEquCheckItemByItemId(itemId); + + // 创建返回对象 + EquCheckItemVO equCheckItemVO = new EquCheckItemVO(); + BeanUtils.copyProperties(equCheckItem, equCheckItemVO); + + equCheckItemVO.setFormStandard(equCheckItemDetailMapper.selectEquCheckItemDetailByParentCode(equCheckItem.getItemCode())); + + return equCheckItemVO; + } + + /** + * 查询检查项维护列表 + * + * @param equCheckItem 检查项维护 + * @return 检查项维护 + */ + @Override + @DS("#header.poolName") + public List selectEquCheckItemList(EquCheckItem equCheckItem) { + if (equCheckItem.getCreatedTimeArray() != null) { + // 设置创建日期开始和结束值 + if (equCheckItem.getCreatedTimeArray().size() == 2) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + equCheckItem.setCreateTimeStart(formatter.format(equCheckItem.getCreatedTimeArray().get(0))); + equCheckItem.setCreateTimeEnd(formatter.format(equCheckItem.getCreatedTimeArray().get(1))); + } + } + if (equCheckItem.getUpdateTimeArray() != null) { + // 设置更新日期开始和结束 + if (equCheckItem.getUpdateTimeArray().size() == 2) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + equCheckItem.setUpdateTimeStart(formatter.format(equCheckItem.getUpdateTimeArray().get(0))); + equCheckItem.setUpdateTimeEnd(formatter.format(equCheckItem.getUpdateTimeArray().get(1))); + } + } + return equCheckItemMapper.selectEquCheckItemList(equCheckItem); + } + + /** + * 新增检查项维护 + * + * @param equCheckItemDTO 检查项维护 + * @return 结果 + * TODO 加事务锁 + */ + @Override + @DS("#header.poolName") + public AjaxResult insertEquCheckItem(EquCheckItemDTO equCheckItemDTO) { + // 检验重复 + EquCheckItem checkItem = equCheckItemMapper.selectEquCheckItemByItemName(equCheckItemDTO.getItemName()); + if (checkItem != null) { + return error("检查项已存在!新增失败!"); + } + // 创建检查项对象 + EquCheckItem equCheckItem = new EquCheckItem(); + BeanUtils.copyProperties(equCheckItemDTO, equCheckItem); + + //获取当前所选工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + String str = request.getHeader(key.substring(8)); + int index = str.indexOf("_"); + String factory = str.substring(index + 1); + + // 获取检查项流水号 + String serialNum = String.format("%03d", equCheckItemMapper.selectSerialNumber()); + + // 处理检查项信息 + equCheckItem.setItemId(IdUtils.fastSimpleUUID()); + equCheckItem.setFactoryCode(factory); + equCheckItem.setItemCode(DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + serialNum); + equCheckItem.setCreatedBy(SecurityContextHolder.getUserName()); + equCheckItem.setCreatedTime(DateUtils.getNowDate()); + equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName()); + equCheckItem.setUpdatedTime(DateUtils.getNowDate()); + if (equCheckItem.getItemType().equals("spotInspection")) { + equCheckItem.setItemTypeName("点检"); + } + if (equCheckItem.getItemType().equals("inspection")) { + equCheckItem.setItemTypeName("巡检"); + } + if (equCheckItem.getItemType().equals("maintenance")) { + equCheckItem.setItemTypeName("保养"); + } + + // 插入数据库 + equCheckItemMapper.insertEquCheckItem(equCheckItem); + + // 处理标准信息 + for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) { + // 获取标准流水号 + String detailSerialNum = String.format("%03d", equCheckItemDetailMapper.selectSerialNumber(equCheckItem.getItemCode())); + + detail.setDetailId(IdUtils.fastSimpleUUID()); + detail.setParentCode(equCheckItem.getItemCode()); + detail.setFactoryCode(factory); + detail.setDetailCode(equCheckItem.getItemCode() + detailSerialNum); + detail.setCreatedBy(SecurityContextHolder.getUserName()); + detail.setCreatedTime(DateUtils.getNowDate()); + detail.setUpdatedBy(SecurityContextHolder.getUserName()); + detail.setUpdatedTime(DateUtils.getNowDate()); + + // 插入到数据库 + equCheckItemDetailMapper.insertEquCheckItemDetail(detail); + } + + return success("新增成功"); + } + + /** + * 修改检查项维护 + * + * @param equCheckItemDTO 检查项维护 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public AjaxResult updateEquCheckItem(EquCheckItemDTO equCheckItemDTO) { + EquCheckItem equCheckItem = new EquCheckItem(); + BeanUtils.copyProperties(equCheckItemDTO, equCheckItem); + + // 处理检查项信息 + equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName()); + equCheckItem.setUpdatedTime(DateUtils.getNowDate()); + if (equCheckItem.getItemType().equals("spotInspection")) { + equCheckItem.setItemTypeName("点检"); + } + if (equCheckItem.getItemType().equals("inspection")) { + equCheckItem.setItemTypeName("巡检"); + } + if (equCheckItem.getItemType().equals("maintenance")) { + equCheckItem.setItemTypeName("保养"); + } + + equCheckItemMapper.updateEquCheckItem(equCheckItem); + + // 删除所有标准 + equCheckItemDetailMapper.deleteEquCheckItemDetailByItemId(equCheckItem.getItemId()); + + for (EquCheckItemDetail detail : equCheckItemDTO.getFormStandard()) { + // 获取标准流水号 + String detailSerialNum = String.format("%03d", equCheckItemDetailMapper.selectSerialNumber(equCheckItem.getItemCode())); + + detail.setDetailId(IdUtils.fastSimpleUUID()); + detail.setParentCode(equCheckItem.getItemCode()); + detail.setFactoryCode(equCheckItem.getFactoryCode()); + detail.setDetailCode(equCheckItem.getItemCode() + detailSerialNum); + detail.setCreatedBy(SecurityContextHolder.getUserName()); + detail.setCreatedTime(DateUtils.getNowDate()); + detail.setUpdatedBy(SecurityContextHolder.getUserName()); + detail.setUpdatedTime(DateUtils.getNowDate()); + + // 插入到数据库 + equCheckItemDetailMapper.insertEquCheckItemDetail(detail); + } + return success("修改成功"); + } + + /** + * 批量删除检查项维护 + * + * @param itemIds 需要删除的检查项维护主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteEquCheckItemByItemIds(String[] itemIds) { + for (String data : itemIds) { + equCheckItemDetailMapper.deleteEquCheckItemDetailByItemId(data); + } + return equCheckItemMapper.deleteEquCheckItemByItemIds(itemIds); + } + + /** + * 删除检查项维护信息 + * + * @param itemId 检查项维护主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteEquCheckItemByItemId(String itemId) { + // 通过id删除标准信息 + equCheckItemDetailMapper.deleteEquCheckItemDetailByItemId(itemId); + return equCheckItemMapper.deleteEquCheckItemByItemId(itemId); + } }