diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/DevicePDAController.java b/op-modules/op-device/src/main/java/com/op/device/controller/DevicePDAController.java index a1c14d22..76a8b016 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/DevicePDAController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/DevicePDAController.java @@ -1,8 +1,10 @@ package com.op.device.controller; import com.op.common.core.web.domain.AjaxResult; -import com.op.device.domain.EquOrder; +import com.op.common.security.annotation.RequiresPermissions; +import com.op.device.domain.*; import com.op.device.service.IDevicePDAService; +import com.op.device.service.IEquRepairOrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -19,6 +21,9 @@ public class DevicePDAController { @Autowired private IDevicePDAService devicePDAService; + @Autowired + private IEquRepairOrderService equRepairOrderService; + /** * 获取今日巡检任务工单list * @param userId @@ -58,4 +63,47 @@ public class DevicePDAController { public AjaxResult updateInspectionRecord(@RequestBody EquOrder equOrder) { return devicePDAService.updateInspectionRecord(equOrder); } + + //报修 + /** + * 新增手持报修记录 + * @param equRepairOrder + * @return + */ + @PostMapping("/addRepairRecord") + public AjaxResult addRepairRecord(@RequestBody EquRepairOrder equRepairOrder) { + return devicePDAService.addRepairRecord(equRepairOrder); + } + + //维修 + /** + * 获取维修记录(待处理和已经维修完成) + * + * @param equRepairWorkOrder + * @return + */ + @GetMapping("/getMaintenanceRecords") + public AjaxResult getMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder) { + return devicePDAService.getMaintenanceRecords(equRepairWorkOrder); + } + + /** + * 是否停机维修 + * + * @param equRepairWorkOrder + * @return + */ + @PutMapping("/updateDowntime") + public AjaxResult updateDowntime(@RequestBody EquRepairWorkOrder equRepairWorkOrder) { + return devicePDAService.updateDowntime(equRepairWorkOrder); + } + + + /** + * 获取设备管理详细信息 + */ +// @GetMapping(value = "/{equipmentId}") +// public AjaxResult queryEquipment(@PathVariable("equipmentId") Long equipmentId) { +// return devicePDAService.selectBaseEquipmentByEquipmentId(equipmentId); +// } } diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java index c5fffdc7..f047e7ff 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java @@ -3,8 +3,7 @@ package com.op.device.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; -import com.op.device.domain.EquEquipment; -import com.op.device.domain.EquOutsourceWork; +import com.op.device.domain.EquTeamUser; import com.op.device.service.IEquOutsourceWorkService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -123,9 +122,9 @@ public class EquRepairWorkOrderController extends BaseController { //获取维修人员列表 @GetMapping("/getMaintenancePersonList") - public TableDataInfo getMaintenancePersonList(EquEquipment equEquipment) { + public TableDataInfo getMaintenancePersonList(EquTeamUser equTeamUser) { startPage(); - List list = equRepairWorkOrderService.getMaintenancePersonList(equEquipment); + List list = equRepairWorkOrderService.getMaintenancePersonList(equTeamUser); return getDataTable(list); } } diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquSpareApplyController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquSpareApplyController.java index 6db2647a..b67b4da2 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquSpareApplyController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquSpareApplyController.java @@ -2,6 +2,8 @@ package com.op.device.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.op.device.domain.EquRepairWorkOrder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -94,4 +96,14 @@ public class EquSpareApplyController extends BaseController { public AjaxResult remove(@PathVariable String[] applyIds) { return toAjax(equSpareApplyService.deleteEquSpareApplyByApplyIds(applyIds)); } + + /** + * 查询申领记录列表 + */ + @GetMapping("/listRepairSparePartsRecord") + public TableDataInfo listRepairSparePartsRecord(EquRepairWorkOrder equRepairWorkOrder) { + startPage(); + List list = equSpareApplyService.selectRepairSparePartsRecord(equRepairWorkOrder); + return getDataTable(list); + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquTeamController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquTeamController.java index a5934298..52d46da2 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquTeamController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquTeamController.java @@ -2,6 +2,8 @@ package com.op.device.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.op.device.domain.EquTeamUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -72,7 +74,7 @@ public class EquTeamController extends BaseController { @Log(title = "设备班组维护", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody EquTeam equTeam) { - return toAjax(equTeamService.insertEquTeam(equTeam)); + return equTeamService.insertEquTeam(equTeam); } /** @@ -82,7 +84,7 @@ public class EquTeamController extends BaseController { @Log(title = "设备班组维护", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody EquTeam equTeam) { - return toAjax(equTeamService.updateEquTeam(equTeam)); + return equTeamService.updateEquTeam(equTeam); } /** @@ -102,4 +104,14 @@ public class EquTeamController extends BaseController { List list = equTeamService.getMaintenanceTeamList(equTeam); return getDataTable(list); } + + /** + * 查询班组人员列表 + */ + @GetMapping("/listTeamMembers") + public TableDataInfo listTeamMembers(EquTeamUser equTeamUser) { + startPage(); + List list = equTeamService.selectTeamMembers(equTeamUser); + return getDataTable(list); + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquFile.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquFile.java new file mode 100644 index 00000000..c53d5dd3 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquFile.java @@ -0,0 +1,123 @@ +package com.op.device.domain; + +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 附件对象 base_file + * + * @author Open Platform + * @date 2023-07-10 + */ +public class EquFile extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 附件ID */ + private String fileId; + + /** 附件名称 */ + @Excel(name = "附件名称") + private String fileName; + + /** 附件地址 */ + @Excel(name = "附件地址") + private String fileAddress; + + /** 数据来源 */ + @Excel(name = "数据来源") + private String sourceId; + + /** 预留字段1 */ + @Excel(name = "预留字段1") + private String attr1; + + /** 预留字段2 */ + @Excel(name = "预留字段2") + private String attr2; + + /** 预留字段3 */ + @Excel(name = "预留字段3") + private Long attr3; + + /** 预留字段4 */ + @Excel(name = "预留字段4") + private Long attr4; + + public void setFileId(String fileId) { + this.fileId = fileId; + } + + public String getFileId() { + return fileId; + } + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFileName() { + return fileName; + } + public void setFileAddress(String fileAddress) { + this.fileAddress = fileAddress; + } + + public String getFileAddress() { + return fileAddress; + } + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public String getSourceId() { + return sourceId; + } + 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(Long attr3) { + this.attr3 = attr3; + } + + public Long getAttr3() { + return attr3; + } + public void setAttr4(Long attr4) { + this.attr4 = attr4; + } + + public Long getAttr4() { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("fileId", getFileId()) + .append("fileName", getFileName()) + .append("fileAddress", getFileAddress()) + .append("sourceId", getSourceId()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairOrder.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairOrder.java index c0a3b409..18d96105 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairOrder.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairOrder.java @@ -1,6 +1,8 @@ package com.op.device.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -164,6 +166,23 @@ public class EquRepairOrder extends BaseEntity { @Excel(name = "原因") private String outSourceReason; + //图片文件 + private String fileList; + private List files; + + //图片文件 + public String getFileList() { + return fileList; + } + public void setFileList(String fileList) { + this.fileList = fileList; + } + public List getFiles() { + return files; + } + public void setFiles(List files) { + this.files = files; + } //委外 public void setWorkId(String workId) { diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairWorkOrder.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairWorkOrder.java index 28068b08..5f72c08a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairWorkOrder.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquRepairWorkOrder.java @@ -206,6 +206,10 @@ public class EquRepairWorkOrder extends BaseEntity { /** 联系方式 */ private String workConnection; + //手持 + //用户id + private String userId; + //报修 public void setOrderDesc(String orderDesc) { @@ -563,6 +567,14 @@ public class EquRepairWorkOrder extends BaseEntity { return workConnection; } + //手持 用户userId + public void setUserId(String userId) { + this.userId = userId; + } + public String getUserId() { + return userId; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquSpareApply.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquSpareApply.java index fc645678..682394d6 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquSpareApply.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquSpareApply.java @@ -50,8 +50,8 @@ public class EquSpareApply extends BaseEntity { private String spareUseEquipment; /** 领用时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "领用时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "领用时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date applyTime; /** 申领人 */ @@ -90,6 +90,14 @@ public class EquSpareApply extends BaseEntity { // 创建日期结束 private String applyTimeEnd; + //新增字段 + /** 工单编码 */ + private String workCode ; + /** 关联上级code(保养) */ + private String parentCode ; + /** 领用类型 */ + private String applyType ; + public List getApplyTimeArray() { return applyTimeArray; } @@ -227,6 +235,32 @@ public class EquSpareApply extends BaseEntity { return factoryCode; } + //新增 + /** 主工单编码(保养) */ + public String getWorkCode(){ + return this.workCode; + } + /** 主工单编码(保养) */ + public void setWorkCode(String workCode){ + this.workCode=workCode; + } + /** 关联上级code(保养) */ + public String getParentCode(){ + return this.parentCode; + } + /** 关联上级code(保养) */ + public void setParentCode(String parentCode){ + this.parentCode=parentCode; + } + /** 领用类型 */ + public String getApplyType(){ + return this.applyType; + } + /** 领用类型 */ + public void setApplyType(String applyType){ + this.applyType=applyType; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquTeam.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquTeam.java index d73977a4..57295974 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquTeam.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquTeam.java @@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle; import com.op.common.core.annotation.Excel; import com.op.common.core.web.domain.BaseEntity; +import java.util.List; + /** * 设备班组维护对象 equ_team * @@ -40,6 +42,23 @@ public class EquTeam extends BaseEntity { @Excel(name = "工厂号") private String factoryCode; + //班组右边数据列表 + private List rightData; + public void setRightData(List rightData) { + this.rightData = rightData; + } + public List getRightData() { + return rightData; + } + + private List selectedData; + public void setSelectedData(List selectedData) { + this.selectedData = selectedData; + } + public List getSelectedData() { + return selectedData; + } + public void setId(String id) { this.id = id; } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquTeamUser.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquTeamUser.java new file mode 100644 index 00000000..dd1c8e92 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquTeamUser.java @@ -0,0 +1,107 @@ +package com.op.device.domain; + +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 班组人员对象 equ_team_user + * + * @author Open Platform + * @date 2023-08-29 + */ +public class EquTeamUser extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 主键 */ + private String id; + + /** 班组id */ + @Excel(name = "班组id") + private String teamId; + + /** 班组编码 */ + @Excel(name = "班组编码") + private String teamCode; + + /** 人员id */ + @Excel(name = "人员id") + private String userId; + + /** 人员名字编号 */ + @Excel(name = "人员名字") + private String userName; + + /** 人员名字 */ + @Excel(name = "人员名字") + private String nickName; + + /** 人员拼接名字 */ + @Excel(name = "人员拼接名字") + private String teamUserName; + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + public void setTeamId(String teamId) { + this.teamId = teamId; + } + + public String getTeamId() { + return teamId; + } + public void setTeamCode(String teamCode) { + this.teamCode = teamCode; + } + + public String getTeamCode() { + return teamCode; + } + public void setUserId(String userId) { + this.userId = userId; + } + + public String getUserId() { + return userId; + } + public void setUserName(String userName) { + this.userName = userName; + } + public String getUserName() { + return userName; + } + + public String getNickName() { + return nickName; + } + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getTeamUserName() { + return teamUserName; + } + public void setTeamUserName(String teamUserName) { + this.teamUserName = teamUserName; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("teamId", getTeamId()) + .append("teamCode", getTeamCode()) + .append("userId", getUserId()) + .append("userName", getUserName()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/SparePartsLedger.java b/op-modules/op-device/src/main/java/com/op/device/domain/SparePartsLedger.java index 3db76127..1f4ea83a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/SparePartsLedger.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/SparePartsLedger.java @@ -57,6 +57,11 @@ public class SparePartsLedger extends BaseEntity { @Excel(name = "冻结数量", readConverterExp = "预=留") private BigDecimal storageAmount; + //虚拟字段 + /** 库存可用数量 */ +// @Excel(name = "库存可用数量") +// private BigDecimal availableQuantity; + /** 占用数量 */ @Excel(name = "占用数量") private BigDecimal occupyAmount; @@ -200,11 +205,9 @@ public class SparePartsLedger extends BaseEntity { // 领用数量-保养备件领用使用 private BigDecimal applyNum; - public BigDecimal getApplyNum() { return applyNum; } - public void setApplyNum(BigDecimal applyNum) { this.applyNum = applyNum; } @@ -287,6 +290,15 @@ public class SparePartsLedger extends BaseEntity { public BigDecimal getStorageAmount() { return storageAmount; } + + //库存可用数量 虚拟字段 +// public void setAvailableQuantity(BigDecimal availableQuantity) { +// this.availableQuantity = availableQuantity; +// } +// public BigDecimal getAvailableQuantity() { +// return availableQuantity; +// } + public void setOccupyAmount(BigDecimal occupyAmount) { this.occupyAmount = occupyAmount; } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquFileMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquFileMapper.java new file mode 100644 index 00000000..7b6d3fde --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquFileMapper.java @@ -0,0 +1,77 @@ +package com.op.device.mapper; + +import com.op.common.core.domain.BaseFileData; +import com.op.device.domain.EquFile; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 附件Mapper接口 + * + * @author Open Platform + * @date 2023-07-10 + */ +@Mapper +public interface EquFileMapper { + /** + * 查询附件 + * + * @param fileId 附件主键 + * @return 附件 + */ + public EquFile selectEquFileByFileId(String fileId); + + /** + * 查询附件列表 + * + * @param equFile 附件 + * @return 附件集合 + */ + public List selectEquFileList(EquFile equFile); + + /** + * 新增附件 + * + * @param equFile 附件 + * @return 结果 + */ + public int insertEquFile(EquFile equFile); + + /** + * 修改附件 + * + * @param equFile 附件 + * @return 结果 + */ + public int updateEquFile(EquFile equFile); + + /** + * 删除附件 + * + * @param fileId 附件主键 + * @return 结果 + */ + public int deleteEquFileByFileId(String fileId); + + /** + * 批量删除附件 + * + * @param fileIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEquFileByFileIds(String[] fileIds); + + /** + * 上传图片 + * @param equFiles + */ + public Boolean insertEquFileBatch(@Param("baseFiles") List equFiles); + + //查询图片 + public List getEquFileBatch(String orderId); + + //删除照图片 + public void deleteEquFileBySourceId(String orderId); +} diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairOrderMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairOrderMapper.java index 3a3c3b99..83166c0d 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairOrderMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairOrderMapper.java @@ -3,8 +3,10 @@ package com.op.device.mapper; import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.domain.BaseFileData; import com.op.device.domain.EquEquipment; import com.op.device.domain.EquRepairOrder; +import org.apache.ibatis.annotations.Param; /** * 故障报修Mapper接口 diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairWorkOrderMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairWorkOrderMapper.java index 1ec279f6..30d70d59 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairWorkOrderMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairWorkOrderMapper.java @@ -2,8 +2,9 @@ package com.op.device.mapper; import java.util.List; -import com.op.device.domain.EquEquipment; +import com.baomidou.dynamic.datasource.annotation.DS; import com.op.device.domain.EquRepairWorkOrder; +import com.op.device.domain.EquTeamUser; /** * 维修工单Mapper接口 @@ -67,5 +68,6 @@ public interface EquRepairWorkOrderMapper { void updateWorkOutsource(EquRepairWorkOrder equRepairWorkOrder); //获取维修人员列表 - public List getMaintenancePersonList(EquEquipment equEquipment); + @DS("master") + public List getMaintenancePersonList(EquTeamUser equTeamUser); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquSpareApplyMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquSpareApplyMapper.java index e9b74390..090a21ed 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquSpareApplyMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquSpareApplyMapper.java @@ -2,6 +2,7 @@ package com.op.device.mapper; import java.util.List; +import com.op.device.domain.EquRepairWorkOrder; import com.op.device.domain.EquSpareApply; /** @@ -58,4 +59,7 @@ public interface EquSpareApplyMapper { * @return 结果 */ public int deleteEquSpareApplyByApplyIds(String[] applyIds); + + //查询维修工单对应的备件申领记录 + public List selectRepairSparePartsRecord(EquRepairWorkOrder equRepairWorkOrder); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamMapper.java index 828fb06b..a70eb5ee 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamMapper.java @@ -2,7 +2,9 @@ package com.op.device.mapper; import java.util.List; +import com.baomidou.dynamic.datasource.annotation.DS; import com.op.device.domain.EquTeam; +import com.op.device.domain.EquTeamUser; /** * 设备班组维护Mapper接口 @@ -61,4 +63,16 @@ public interface EquTeamMapper { //查询设备维修组列表 public List getMaintenanceTeamList(EquTeam equTeam); + + //查询设备维修组人员 + @DS("master") + public List getMaintenancePerson(EquTeamUser equTeamUser); + + //查询所有人员 + @DS("master") + public List selectTeamMembers(EquTeamUser equTeamUser); + + //查询特定人员 + @DS("master") + public EquTeamUser selectTeamMember(EquTeamUser equTeamUser); } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamUserMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamUserMapper.java new file mode 100644 index 00000000..f982f897 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquTeamUserMapper.java @@ -0,0 +1,79 @@ +package com.op.device.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.device.domain.EquTeamUser; + +import java.util.List; + +/** + * 班组人员Mapper接口 + * + * @author Open Platform + * @date 2023-08-29 + */ +public interface EquTeamUserMapper { + /** + * 查询班组人员 + * + * @param id 班组人员主键 + * @return 班组人员 + */ + public EquTeamUser selectEquTeamUserById(String id); + + /** + * 查询班组人员列表 + * + * @param equTeamUser 班组人员 + * @return 班组人员集合 + */ + public List selectEquTeamUserList(EquTeamUser equTeamUser); + + /** + * 新增班组人员 + * + * @param equTeamUser 班组人员 + * @return 结果 + */ + public int insertEquTeamUser(EquTeamUser equTeamUser); + + /** + * 修改班组人员 + * + * @param equTeamUser 班组人员 + * @return 结果 + */ + public int updateEquTeamUser(EquTeamUser equTeamUser); + + /** + * 删除班组人员 + * + * @param id 班组人员主键 + * @return 结果 + */ + public int deleteEquTeamUserById(String id); + + /** + * 批量删除班组人员 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEquTeamUserByIds(String[] ids); + + //查询人员 + @DS("master") + public List selectTeamMembers(EquTeamUser equTeamUser); + + //查询人员对应名字 + public List selectTeamMembersIds(EquTeamUser equTeamUser); + + //查询人员ID + public String selectId(EquTeamUser equTeamUser); + + @DS("master") + public String selectUserName(EquTeamUser equTeamUser); + + //批量删除 + public void deleteEquTeamUserByTeamId(String teamId); + void deleteEquTeamUserByTeamIds(String[] teamIds); +} diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IDevicePDAService.java b/op-modules/op-device/src/main/java/com/op/device/service/IDevicePDAService.java index f4782cc4..40c9efcf 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IDevicePDAService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IDevicePDAService.java @@ -1,7 +1,7 @@ package com.op.device.service; import com.op.common.core.web.domain.AjaxResult; -import com.op.device.domain.EquOrder; +import com.op.device.domain.*; /** * PDAService @@ -37,4 +37,42 @@ public interface IDevicePDAService { * @return */ AjaxResult updateInspectionRecord(EquOrder equOrder); + + //报修 + /** + * 手持新增报修记录 + * @param equRepairOrder + * @return + */ + public AjaxResult addRepairRecord(EquRepairOrder equRepairOrder); + + //维修 + /** + * 手持查询维修记录 (待处理和已经维修完成) + * @param equRepairWorkOrder + * @return + */ + public AjaxResult getMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder); + + //班组 + /** + * 维修班组 + * @param equTeamUser + * @return + */ + public AjaxResult getMaintenancePerson(EquTeamUser equTeamUser); + + /** + * 手持是否停机 + * @param equRepairWorkOrder + * @return + */ + public AjaxResult updateDowntime(EquRepairWorkOrder equRepairWorkOrder); + + /** + * 手持是否停机 + * @param equRepairWorkOrder + * @return + */ +// AjaxResult selectBaseEquipmentByEquipmentId(Long equipmentId); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquRepairWorkOrderService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquRepairWorkOrderService.java index fe2c5077..71ff46df 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquRepairWorkOrderService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquRepairWorkOrderService.java @@ -2,8 +2,8 @@ package com.op.device.service; import java.util.List; -import com.op.device.domain.EquEquipment; import com.op.device.domain.EquRepairWorkOrder; +import com.op.device.domain.EquTeamUser; /** * 维修工单Service接口 @@ -61,7 +61,7 @@ public interface IEquRepairWorkOrderService { public int deleteEquRepairWorkOrderByWorkId(String workId); //获取维修人员列表 - public List getMaintenancePersonList(EquEquipment equEquipment); + public List getMaintenancePersonList(EquTeamUser equTeamUser); //委外申请 public int applyEquOutsourceWork(EquRepairWorkOrder equRepairWorkOrder); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquSpareApplyService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquSpareApplyService.java index 27569b55..6d4d6782 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquSpareApplyService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquSpareApplyService.java @@ -1,6 +1,8 @@ package com.op.device.service; import java.util.List; + +import com.op.device.domain.EquRepairWorkOrder; import com.op.device.domain.EquSpareApply; /** @@ -57,4 +59,7 @@ public interface IEquSpareApplyService { * @return 结果 */ public int deleteEquSpareApplyByApplyId(String applyId); + + //查询维修工单对应备件申领记录 + public List selectRepairSparePartsRecord(EquRepairWorkOrder equRepairWorkOrder); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquTeamService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquTeamService.java index 2c80041c..7fcae2d0 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquTeamService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquTeamService.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.EquTeam; +import com.op.device.domain.EquTeamUser; /** * 设备班组维护Service接口 @@ -32,7 +35,7 @@ public interface IEquTeamService { * @param equTeam 设备班组维护 * @return 结果 */ - public int insertEquTeam(EquTeam equTeam); + public AjaxResult insertEquTeam(EquTeam equTeam); /** * 修改设备班组维护 @@ -40,7 +43,7 @@ public interface IEquTeamService { * @param equTeam 设备班组维护 * @return 结果 */ - public int updateEquTeam(EquTeam equTeam); + public AjaxResult updateEquTeam(EquTeam equTeam); /** * 批量删除设备班组维护 @@ -60,4 +63,7 @@ public interface IEquTeamService { //维修组列表 List getMaintenanceTeamList(EquTeam equTeam); + + //查询所有人员信息 + List selectTeamMembers(EquTeamUser equTeamUser); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java index 692677ba..c151df26 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java @@ -8,17 +8,20 @@ import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; import com.op.common.security.utils.SecurityUtils; -import com.op.device.domain.EquOrder; -import com.op.device.domain.EquOrderDetail; -import com.op.device.domain.EquOrderEqu; -import com.op.device.domain.EquOrderStandard; +import com.op.device.domain.*; import com.op.device.mapper.*; import com.op.device.service.IDevicePDAService; import com.op.system.api.domain.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Calendar; import java.util.Date; import java.util.List; @@ -46,6 +49,12 @@ public class DevicePDAServiceImpl implements IDevicePDAService { private EquOrderPersonMapper equOrderPersonMapper; @Autowired private PersonMapper personMapper; + @Autowired + private EquRepairOrderMapper equRepairOrderMapper; + @Autowired + private EquRepairWorkOrderMapper equRepairWorkOrderMapper; + @Autowired + private EquTeamMapper equTeamMapper; /** @@ -158,11 +167,9 @@ public class DevicePDAServiceImpl implements IDevicePDAService { } equOrderStandardMapper.insertBaseFileBatch(files); } - // 更新标准 standard.setUpdateTime(DateUtils.getNowDate()); equOrderStandardMapper.updateEquOrderStandard(standard); - } } @@ -171,8 +178,128 @@ public class DevicePDAServiceImpl implements IDevicePDAService { equOrder.setUpdateTime(DateUtils.getNowDate()); equOrder.setUpdateBy(SecurityContextHolder.getUserName()); equOrder.setPlanPerson(SecurityContextHolder.getUserName()); + + // 获取故障报修流水号 + EquRepairOrder equRepairOrder = new EquRepairOrder(); + String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber()); + String equipmentCode = equOrder.getEquipmentCode(); + //报修单号 + equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); + //在主表中存入报修单号信息 + equOrder.setRepairCode(equRepairOrder.getOrderCode()); equOrderMapper.updateEquOrder(equOrder); + //新增报修记录 + equRepairOrder.setOrderId(IdUtils.fastSimpleUUID()); + equRepairOrder.setCreateTime(DateUtils.getNowDate()); + equRepairOrder.setCreateBy(SecurityUtils.getUsername()); + equRepairOrder.setOrderStatus("待审核"); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); + equRepairOrderMapper.insertEquRepairOrder(equRepairOrder); return success(equOrder); } + + //////////////////////报修 + /** + * 新增报修记录 + * + * @param equRepairOrder + * @return + */ + @Override + @DS("#header.poolName") + public AjaxResult addRepairRecord(EquRepairOrder equRepairOrder) { + try { + equRepairOrder.setOrderId(IdUtils.fastSimpleUUID()); + // 获取故障报修流水号 + String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber()); + String equipmentCode = equRepairOrder.getEquipmentCode(); + //报修单号 + equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); + equRepairOrder.setCreateTime(DateUtils.getNowDate()); + equRepairOrder.setCreateBy(SecurityUtils.getUsername()); + equRepairOrder.setOrderStatus("待审核"); +// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); +// String key = "#header.poolName"; +// equRepairOrder.setFactory(request.getHeader(key.substring(8)).replace("ds_","")); + return success("新增报修记录成功!"); + } catch (Exception e) { + return error(); + } + } + + /** + * 获取维修记录 + * + * @param equRepairWorkOrder + * @return + */ + @Override + @DS("#header.poolName") + public AjaxResult getMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder) { + try { + if (equRepairWorkOrder.getWorkPlanTimeArray() != null) { + // 设置创建日期开始和结束值 + if (equRepairWorkOrder.getWorkPlanTimeArray().size() == 2) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + equRepairWorkOrder.setWorkPlanTimeStart(formatter.format(equRepairWorkOrder.getWorkPlanTimeArray().get(0))); + equRepairWorkOrder.setWorkPlanTimeEnd(formatter.format(equRepairWorkOrder.getWorkPlanTimeArray().get(1))); + } + } + if (equRepairWorkOrder.getWorkPlanDownTimeArray() != null) { + // 设置更新日期开始和结束 + if (equRepairWorkOrder.getWorkPlanDownTimeArray().size() == 2) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + equRepairWorkOrder.setWorkPlanDownTimeStart(formatter.format(equRepairWorkOrder.getWorkPlanDownTimeArray().get(0))); + equRepairWorkOrder.setWorkPlanDownTimeEnd(formatter.format(equRepairWorkOrder.getWorkPlanDownTimeArray().get(1))); + } + } + + List list = equRepairWorkOrderMapper.selectEquRepairWorkOrderList(equRepairWorkOrder); + return success(list); + } catch (Exception e) { + return error(); + } + } + + /** + * 获取维修记录 + * + * @param equTeamUser + * @return + */ + @Override + @DS("#header.poolName") + public AjaxResult getMaintenancePerson(EquTeamUser equTeamUser) { + try { + List list = equRepairWorkOrderMapper.getMaintenancePersonList(equTeamUser); + return success(list); + } catch (Exception e) { + return error(); + } + } + + /** + * 手持提交是否停机维修 停机维修的开始时间 + * + * @param equRepairWorkOrder + * @return + */ + @Override + @DS("#header.poolName") + public AjaxResult updateDowntime(EquRepairWorkOrder equRepairWorkOrder) { + try { + if(equRepairWorkOrder.getWorkDownMachine().equals("0")){ + equRepairWorkOrder.setWorkPlanDownTime(null); + } + equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername()); + equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate()); + equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder); + return success("提交成功,开始维修!"); + } catch (Exception e) { + return error(); + } + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java index 0fbbf8a4..f741d8a7 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java @@ -1,22 +1,21 @@ package com.op.device.service.impl; +import java.util.ArrayList; +import java.util.Date; import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.domain.BaseFileData; import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.security.utils.SecurityUtils; -import com.op.device.domain.EquEquipment; -import com.op.device.domain.EquOutsourceWork; -import com.op.device.domain.EquRepairWorkOrder; -import com.op.device.mapper.EquEquipmentMapper; -import com.op.device.mapper.EquOutsourceWorkMapper; -import com.op.device.mapper.EquRepairWorkOrderMapper; +import com.op.device.domain.*; +import com.op.device.mapper.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.op.device.mapper.EquRepairOrderMapper; -import com.op.device.domain.EquRepairOrder; import com.op.device.service.IEquRepairOrderService; +import org.springframework.util.CollectionUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -41,6 +40,9 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { @Autowired private EquOutsourceWorkMapper equOutsourceWorkMapper; + + @Autowired + private EquFileMapper equFileMapper; /** * 查询故障报修 * @@ -50,7 +52,12 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { @Override @DS("#header.poolName") public EquRepairOrder selectEquRepairOrderByOrderId(String orderId) { - return equRepairOrderMapper.selectEquRepairOrderByOrderId(orderId); + EquRepairOrder list = equRepairOrderMapper.selectEquRepairOrderByOrderId(orderId); + List files = equFileMapper.getEquFileBatch(orderId); + if (!CollectionUtils.isEmpty(files)) { + list.setFiles(files); + } + return list; } /** @@ -83,9 +90,28 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { equRepairOrder.setCreateTime(DateUtils.getNowDate()); equRepairOrder.setCreateBy(SecurityUtils.getUsername()); equRepairOrder.setOrderStatus("待审核"); -// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); -// String key = "#header.poolName"; -// equRepairOrder.setFactory(request.getHeader(key.substring(8)).replace("ds_","")); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); + + //设备报修上传图片 + if (StringUtils.isNotEmpty(equRepairOrder.getFileList())) { + String[] ids = equRepairOrder.getFileList().split(","); + List files = new ArrayList<>(); + BaseFileData file = null; + for (String id : ids) { + file = new BaseFileData(); + file.setFileId(IdUtils.fastSimpleUUID()); + file.setFileName(id.split("&fileName=")[1]); + file.setFileAddress(id); + file.setSourceId(equRepairOrder.getOrderId()); + file.setCreateBy(SecurityUtils.getUsername()); + file.setCreateTime(new Date()); + files.add(file); + } + equFileMapper.insertEquFileBatch(files); + } + return equRepairOrderMapper.insertEquRepairOrder(equRepairOrder); } @@ -173,6 +199,24 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { @Override @DS("#header.poolName") public int updateEquRepairOrder(EquRepairOrder equRepairOrder) { + equFileMapper.deleteEquFileBySourceId(equRepairOrder.getOrderId()); + //上传附件 + if (StringUtils.isNotEmpty(equRepairOrder.getFileList())) { + String[] ids = equRepairOrder.getFileList().split(","); + List files = new ArrayList<>(); + BaseFileData file = null; + for (String id : ids) { + file = new BaseFileData(); + file.setFileId(IdUtils.fastSimpleUUID()); + file.setFileAddress(id); + file.setFileName(id.split("&fileName=")[1]); + file.setSourceId(equRepairOrder.getOrderId()); + file.setCreateBy(SecurityUtils.getUsername()); + file.setCreateTime(new Date()); + files.add(file); + } + equFileMapper.insertEquFileBatch(files); + } equRepairOrder.setUpdateTime(DateUtils.getNowDate()); equRepairOrder.setUpdateBy(SecurityUtils.getUsername()); return equRepairOrderMapper.updateEquRepairOrder(equRepairOrder); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java index be3f3be3..2a172e84 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java @@ -7,8 +7,8 @@ import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.security.utils.SecurityUtils; -import com.op.device.domain.EquEquipment; import com.op.device.domain.EquOutsourceWork; +import com.op.device.domain.EquTeamUser; import com.op.device.mapper.EquOutsourceWorkMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -90,7 +90,6 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService //维修单号 equRepairWorkOrder.setOrderCode("无"); equRepairWorkOrder.setOutWorkCode("无"); - equRepairWorkOrder.setWorkStatus("待维修"); equRepairWorkOrder.setWorkCode("WX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); equRepairWorkOrder.setCreateBy(SecurityUtils.getUsername()); equRepairWorkOrder.setCreateTime(DateUtils.getNowDate()); @@ -144,8 +143,8 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService //获取维人员列表 @Override - public List getMaintenancePersonList(EquEquipment equEquipment) { - return equRepairWorkOrderMapper.getMaintenancePersonList(equEquipment); + public List getMaintenancePersonList(EquTeamUser equTeamUser) { + return equRepairWorkOrderMapper.getMaintenancePersonList(equTeamUser); } //委外申请 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquSpareApplyServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquSpareApplyServiceImpl.java index 11a3b01d..e9473776 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquSpareApplyServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquSpareApplyServiceImpl.java @@ -7,11 +7,16 @@ import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.security.utils.SecurityUtils; +import com.op.device.domain.EquRepairWorkOrder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.device.mapper.EquSpareApplyMapper; import com.op.device.domain.EquSpareApply; import com.op.device.service.IEquSpareApplyService; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; /** * 申领记录Service业务层处理 @@ -66,6 +71,10 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService { @DS("#header.poolName") public int insertEquSpareApply(EquSpareApply equSpareApply) { equSpareApply.setApplyId(IdUtils.fastSimpleUUID()); + //工厂号 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); equSpareApply.setCreateTime(DateUtils.getNowDate()); equSpareApply.setCreateBy(SecurityUtils.getUsername()); return equSpareApplyMapper.insertEquSpareApply(equSpareApply); @@ -108,4 +117,13 @@ public class EquSpareApplyServiceImpl implements IEquSpareApplyService { public int deleteEquSpareApplyByApplyId(String applyId) { return equSpareApplyMapper.deleteEquSpareApplyByApplyId(applyId); } + + /** + * 查询维修单对应的申领记录列表 + */ + @Override + @DS("#header.poolName") + public List selectRepairSparePartsRecord(EquRepairWorkOrder equRepairWorkOrder) { + return equSpareApplyMapper.selectRepairSparePartsRecord(equRepairWorkOrder); + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java index d4d76a1f..df877915 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquTeamServiceImpl.java @@ -1,16 +1,29 @@ package com.op.device.service.impl; +import java.util.ArrayList; import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; 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.security.utils.SecurityUtils; +import com.op.device.domain.EquTeamUser; +import com.op.device.mapper.EquTeamUserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.device.mapper.EquTeamMapper; import com.op.device.domain.EquTeam; import com.op.device.service.IEquTeamService; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import com.op.common.core.web.domain.AjaxResult; + +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业务层处理 @@ -22,6 +35,8 @@ import com.op.device.service.IEquTeamService; public class EquTeamServiceImpl implements IEquTeamService { @Autowired private EquTeamMapper equTeamMapper; + @Autowired + private EquTeamUserMapper equTeamUserMapper; /** * 查询设备班组维护 @@ -32,6 +47,11 @@ public class EquTeamServiceImpl implements IEquTeamService { @Override @DS("#header.poolName") public EquTeam selectEquTeamById(String id) { + EquTeamUser equTeamUser = new EquTeamUser(); + equTeamUser.setTeamId(id); + List equTeamUser1 = equTeamUserMapper.selectEquTeamUserList(equTeamUser); + EquTeam equTeam = equTeamMapper.selectEquTeamById(id); + equTeam.setSelectedData(equTeamUser1); return equTeamMapper.selectEquTeamById(id); } @@ -54,12 +74,40 @@ public class EquTeamServiceImpl implements IEquTeamService { * @return 结果 */ @Override + @Transactional @DS("#header.poolName") - public int insertEquTeam(EquTeam equTeam) { - equTeam.setId(IdUtils.fastSimpleUUID()); - equTeam.setCreateTime(DateUtils.getNowDate()); - equTeam.setCreateBy(SecurityUtils.getUsername()); - return equTeamMapper.insertEquTeam(equTeam); + public AjaxResult insertEquTeam(EquTeam equTeam) { + try{ + equTeam.setId(IdUtils.fastSimpleUUID()); + equTeam.setCreateTime(DateUtils.getNowDate()); + equTeam.setCreateBy(SecurityUtils.getUsername()); + //工厂号 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + equTeam.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); + equTeamMapper.insertEquTeam(equTeam); + //新增设备班组人员信息 + String teamId = equTeam.getId(); + for(int i = 0 ; i < equTeam.getRightData().size() ; i++){ + EquTeamUser equTeamUser = new EquTeamUser(); + equTeamUser.setCreateBy(SecurityUtils.getUsername()); + equTeamUser.setCreateTime(DateUtils.getNowDate()); + equTeamUser.setTeamId(teamId); + equTeamUser.setTeamCode(equTeam.getTeamCode()); + equTeamUser.setId(IdUtils.fastSimpleUUID()); + List list = new ArrayList<>(); + list = equTeam.getRightData(); + String userId = list.get(i); + equTeamUser.setUserId(userId); + EquTeamUser memberList = equTeamMapper.selectTeamMember(equTeamUser); + equTeamUser.setUserName(memberList.getUserName()); + equTeamUser.setNickName(memberList.getNickName()); + equTeamUserMapper.insertEquTeamUser(equTeamUser); + } + return success("新增设备班组成功!"); + }catch (Exception e) { + return error(); + } } /** @@ -70,10 +118,32 @@ public class EquTeamServiceImpl implements IEquTeamService { */ @Override @DS("#header.poolName") - public int updateEquTeam(EquTeam equTeam) { - equTeam.setUpdateTime(DateUtils.getNowDate()); - equTeam.setUpdateBy(SecurityUtils.getUsername()); - return equTeamMapper.updateEquTeam(equTeam); + @Transactional + public AjaxResult updateEquTeam(EquTeam equTeam) { + try{ + equTeam.setUpdateTime(DateUtils.getNowDate()); + equTeam.setUpdateBy(SecurityUtils.getUsername()); + equTeamMapper.updateEquTeam(equTeam); + for(int i = 0;i list = new ArrayList<>(); + list = equTeam.getRightData(); + String userId = list.get(i); + equTeamUser.setUserId(userId); + String userName = equTeamUserMapper.selectUserName(equTeamUser); + //判断班组人员有没有变动 挨个遍历 + equTeamUser.setUserName(userName); + equTeamUserMapper.insertEquTeamUser(equTeamUser); + } + return success("修改设备班组成功!"); + }catch (Exception e) { + return error(); + } } /** @@ -108,4 +178,16 @@ public class EquTeamServiceImpl implements IEquTeamService { public List getMaintenanceTeamList(EquTeam equTeam) { return equTeamMapper.getMaintenanceTeamList(equTeam); } + + /** + * 查询所有人员列表 + * + * @param equTeamUser 班组人员 + * @return 班组人员 + */ + @Override + @DS("#master") + public List selectTeamMembers(EquTeamUser equTeamUser){ + return equTeamMapper.selectTeamMembers(equTeamUser); + } } diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquFileMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquFileMapper.xml new file mode 100644 index 00000000..ef5150b6 --- /dev/null +++ b/op-modules/op-device/src/main/resources/mapper/device/EquFileMapper.xml @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + select file_id, file_name, file_address, source_id, remark, attr1, + attr2, attr3, attr4, create_by, create_time, update_by, + update_time,image_type from base_file + + + + + + + + + + + + + + + insert into base_file + + file_id, + file_name, + file_address, + source_id, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + image_type, + + + #{fileId}, + #{fileName}, + #{fileAddress}, + #{sourceId}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + {imageType}, + + + + + INSERT INTO base_file(file_id, file_name, file_address, source_id, remark, create_by, create_time) + VALUES + + ( + #{baseFile.fileId}, + #{baseFile.fileName}, + #{baseFile.fileAddress}, + #{baseFile.sourceId}, + #{baseFile.remark}, + #{baseFile.createBy}, + #{baseFile.createTime} + ) + + + + + update base_file + + file_name = #{fileName}, + file_address = #{fileAddress}, + source_id = #{sourceId}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where file_id = #{fileId} + + + + delete from base_file where file_id = #{fileId} + + + + delete from base_file where file_id in + + #{fileId} + + + + + delete from base_file where source_id = #{sourceId} + + + diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOutsourceWorkMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOutsourceWorkMapper.xml index b835a9c9..c127939a 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOutsourceWorkMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOutsourceWorkMapper.xml @@ -175,11 +175,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from equ_outsource_work where work_id = #{workId} + update equ_outsource_work + set del_flag = '1' + where work_id = #{workId} - delete from equ_outsource_work where work_id in + update equ_outsource_work + set del_flag = '1' + where work_id in #{workId} diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml index 090182f4..501acfb8 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml @@ -203,12 +203,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where order_id = #{orderId} + - delete from equ_repair_order where order_id = #{orderId} + update equ_repair_order + set del_flag = '1' + where order_id = #{orderId} + - delete from equ_repair_order where order_id in + update equ_repair_order + set del_flag = '1' + where order_id in #{orderId} @@ -221,7 +227,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and del_flag = '0' - select user_id AS userId, user_name AS userName, diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquRepairWorkOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquRepairWorkOrderMapper.xml index e2899f24..6647de50 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquRepairWorkOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquRepairWorkOrderMapper.xml @@ -306,12 +306,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and del_flag = '0' + - delete from equ_repair_work_order where work_id = #{workId} + update equ_repair_work_order + set del_flag = '1' + where work_id = #{workId} + - delete from equ_repair_work_order where work_id in + update equ_repair_work_order + set del_flag = '1' + where work_id in #{workId} @@ -323,7 +329,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where del_flag = '0' - select su.user_id AS userId, su.user_name AS userName, diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquSpareApplyMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquSpareApplyMapper.xml index c2f28cb4..6a4a162b 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquSpareApplyMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquSpareApplyMapper.xml @@ -7,7 +7,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -25,16 +28,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select apply_id, apply_code, spare_code, spare_name, spare_model, spare_quantity, spare_group_line, spare_use_equipment, apply_time, apply_people, apply_approve_people, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time, factory_code from equ_spare_apply + select apply_id, apply_code, work_code,parent_code,apply_type,spare_code, spare_name, spare_model, spare_quantity, spare_group_line, spare_use_equipment, apply_time, apply_people, apply_approve_people, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time, factory_code from equ_spare_apply + + where del_flag = '0' + and work_code = #{workCode} + ORDER BY apply_time DESC + + \ No newline at end of file diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquTeamMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquTeamMapper.xml index 7611f406..b21528ab 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquTeamMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquTeamMapper.xml @@ -89,11 +89,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from equ_team where id = #{id} + update equ_team + set del_flag = '1' + where id = #{id} - delete from equ_team where id in + update equ_team + set del_flag = '1' + where id in #{id} @@ -105,4 +109,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and team_type = '维修班组' + + + + \ No newline at end of file diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquTeamUserMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquTeamUserMapper.xml new file mode 100644 index 00000000..dae6a04c --- /dev/null +++ b/op-modules/op-device/src/main/resources/mapper/device/EquTeamUserMapper.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + select id, team_id, team_code, user_id, user_name, create_by, create_time, update_by, update_time from equ_team_user + + + + + + + + insert into equ_team_user + + id, + team_id, + team_code, + user_id, + user_name, + create_by, + create_time, + update_by, + update_time, + + + #{id}, + #{teamId}, + #{teamCode}, + #{userId}, + #{userName}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update equ_team_user + + team_id = #{teamId}, + team_code = #{teamCode}, + user_id = #{userId}, + user_name = #{userName}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from equ_team_user where id = #{id} + + + + delete from equ_team_user where team_id = #{teamId} + + + + delete from equ_team_user where id in + + #{id} + + + + + + + + + + + + + + + + + delete from equ_team_user where team_id in + + #{teamId} + + + + \ No newline at end of file diff --git a/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml index dd5b1632..08d5b972 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml @@ -5,9 +5,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -32,7 +35,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select storage_type, material_code, material_desc, amount,sap_factory_code, wl_name, del_flag, spare_use_life, spare_name, spare_mode, spare_manufacturer, spare_supplier, spare_replacement_cycle, spare_measurement_unit, spare_conversion_unit, spare_conversion_ratio, spare_inventory_floor, spare_inventory_upper,spare_type,create_by, gmt_create, last_modified_by, gmt_modified, active_flag, factory_code from wms_ods_mate_storage_news + select + storage_id, + storage_type, + material_code, + material_desc, + amount, + storage_amount, + sap_factory_code, + wl_name, + del_flag, + spare_use_life, + spare_name, + spare_mode, + spare_manufacturer, + spare_supplier, + spare_replacement_cycle, + spare_measurement_unit, + spare_conversion_unit, + spare_conversion_ratio, + spare_inventory_floor, + spare_inventory_upper, + spare_type, + create_by, + gmt_create, + last_modified_by, + gmt_modified, + active_flag, + factory_code + from wms_ods_mate_storage_news