diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/EquipmentToRepairController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/EquipmentToRepairController.java new file mode 100644 index 0000000..572835e --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/EquipmentToRepairController.java @@ -0,0 +1,125 @@ +package com.bonus.sgzb.material.controller; + +import com.alibaba.fastjson.JSONObject; +import com.bonus.sgzb.base.domain.RepairApplyRecord; +import com.bonus.sgzb.base.domain.RepairPartDetails; +import com.bonus.sgzb.base.domain.RepairTask; +import com.bonus.sgzb.base.domain.RepairTaskDetails; +import com.bonus.sgzb.base.domain.vo.DictVo; +import com.bonus.sgzb.base.service.RepairService; +import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; +import com.bonus.sgzb.common.core.web.controller.BaseController; +import com.bonus.sgzb.common.core.web.domain.AjaxResult; +import com.bonus.sgzb.common.core.web.page.TableDataInfo; +import com.bonus.sgzb.common.log.annotation.Log; +import com.bonus.sgzb.common.log.enums.BusinessType; +import com.bonus.sgzb.common.security.annotation.RequiresPermissions; + +import com.bonus.sgzb.material.domain.*; +import com.bonus.sgzb.material.service.EquipmentToRepairService; +import com.bonus.sgzb.material.vo.RepairAuditDetailsNew; +import com.bonus.sgzb.system.api.domain.SysUser; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @author c liu + * @date 2023/12/11 + */ +@RestController +@RequestMapping("/equipmentToRepair") +public class EquipmentToRepairController extends BaseController { + @Autowired + private EquipmentToRepairService service; + + /** + * 获取设备编号在库下拉 + */ + @GetMapping("/getMaCodeSelect") + public AjaxResult getMaCodeSelect(equipmentMaCodeInfo info) + { + List list = service.getMaCodeSelect(info); + return AjaxResult.success(list); + } + + + /** + * 获取维保任务列表 + */ + @ApiOperation(value = "获取维保任务列表") + @Log(title = "维修任务列表", businessType = BusinessType.QUERY) + @GetMapping("/getEquipmentList") +// @RequiresPermissions(value = "repair:manage:list") + public TableDataInfo getEquipmentList(EquipmentTask bean) + { + startPage(); + List list = service.getEquipmentList(bean); + return getDataTable(list); + } + + /** + * 新增维保记录 + */ + @ApiOperation(value = "新增维保记录") + @Log(title = "新增维保记录", businessType = BusinessType.INSERT) + @PostMapping("/submitEquipment") + public AjaxResult submitEquipment(@RequestBody EquipmentRecord bean) { + String partStrList = bean.getPartStrList(); + List equipmentPartDetails = JSONObject.parseArray(partStrList, EquipmentPartDetails.class); + bean.setPartList(equipmentPartDetails); + AjaxResult ajaxResult = service.submitEquipment(bean); + return ajaxResult; + } + + @ApiOperation("获取维保详细信息") + @GetMapping("/getEquipmentInfo") + public AjaxResult getEquipmentInfo(EquipmentRecord bean) { + + EquipmentRecord vo = service.getEquipmentInfo(bean); + return AjaxResult.success(vo); + } + + /** + * 编辑维保 + */ + @ApiOperation(value = "编辑维保") + @Log(title = "编辑维保", businessType = BusinessType.INSERT) + @PostMapping("/editEquipmentInfo") + public AjaxResult editEquipmentInfo(@RequestBody EquipmentRecord bean) { + String partStrList = bean.getPartStrList(); + List repairPartDetails = JSONObject.parseArray(partStrList, EquipmentPartDetails.class); + bean.setPartList(repairPartDetails); + AjaxResult ajaxResult = service.editEquipmentInfo(bean); + return ajaxResult; + } + + /** + * 提交维保记录 + */ + @ApiOperation(value = "提交维保记录") + @Log(title = "提交维保记录", businessType = BusinessType.INSERT) + @PostMapping("/submitStatusNew") + public AjaxResult submitStatusNew(@RequestBody EquipmentRecord bean) { + AjaxResult ajaxResult = service.submitStatusNew(bean); + return ajaxResult; + } + + /** + * 查看保养记录表 + */ + @ApiOperation("查看保养记录表") + @GetMapping("/getMaintenanceEquipment") +// @RequiresPermissions("service:auditing:list") + public AjaxResult getMaintenanceEquipment(EquipmentRecord bean) { + + EquipmentRecord vo = service.getMaintenanceEquipment(bean); + return AjaxResult.success(vo); + } +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/SelectController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/SelectController.java index 9c887ba..abd5801 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/SelectController.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/SelectController.java @@ -4,10 +4,7 @@ import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.material.domain.SelectDto; import com.bonus.sgzb.material.service.SelectService; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -122,6 +119,12 @@ public class SelectController { return service.getDeviceTypeTree(dto); } + @ApiOperation(value = "设备类型树") + @GetMapping("getDeviceTypeTreeTwo") + public AjaxResult getDeviceTypeTreeTwo(SelectDto dto){ + return service.getDeviceTypeTree(dto); + } + @ApiOperation(value = "资产属性") @PostMapping("getAssetAttributesCbx") public AjaxResult getAssetAttributesCbx(@RequestBody SelectDto dto){ diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/EquipmentPartDetails.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/EquipmentPartDetails.java new file mode 100644 index 0000000..c789d81 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/EquipmentPartDetails.java @@ -0,0 +1,113 @@ +package com.bonus.sgzb.material.domain; + +import com.bonus.sgzb.base.api.domain.FileInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author c liu + * @date 2023/12/11 + */ +@Data +@ApiModel(value="维修配件") +public class EquipmentPartDetails { + private Long id; + + private long parentId; + + + /** + * 机具ID + */ + @ApiModelProperty(value = "机具ID") + private String maId; + /** + * 规格ID + */ + @ApiModelProperty(value = "规格ID") + private String typeId; + /** + * 配件ID + */ + @ApiModelProperty(value = "配件ID") + private Long partId; + /** + * 配件名称 + */ + @ApiModelProperty(value = "配件名称") + private String partName; + + /** + * 配件数量 + */ + @ApiModelProperty(value = "配件数量") + private Integer partNum; + /** + * 配件费用 + */ + @ApiModelProperty(value = "配件费用") + private BigDecimal partCost; + /** + * 配件单价 + */ + @ApiModelProperty(value = "配件单价") + private BigDecimal partPrice; + /** + * 类型(0不收费,1收费) + */ + @ApiModelProperty(value = "类型(0不收费,1收费)") + private String partType; + /** + * 创建者 + */ + @ApiModelProperty(value = "创建者") + private Long createBy; + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private String createTime; + /** + * 更新者 + */ + @ApiModelProperty(value = "更新者") + private String updateBy; + /** + * 更新时间 + */ + @ApiModelProperty(value = "更新时间") + private String updateTime; + + @ApiModelProperty(value = "技术鉴定") + private String repairRemark; + /** + * 维修处理情况 + */ + @ApiModelProperty(value = "维修处理情况") + private String repairContent; + + /** + * 维修前情况 + */ + @ApiModelProperty(value = "维修前情况") + private String repairContentBefore; + + private Long companyId; + + private Long repairer; + + private List fileList; + + @ApiModelProperty(value = "维修数量") + private Integer repairNum; + + private String partChange; + + private Integer partChangeNum; + + +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/EquipmentRecord.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/EquipmentRecord.java new file mode 100644 index 0000000..102eb05 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/EquipmentRecord.java @@ -0,0 +1,139 @@ +package com.bonus.sgzb.material.domain; + +import com.bonus.sgzb.base.api.domain.FileInfo; +import com.bonus.sgzb.base.domain.RepairPartDetails; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @author c liu + * @date 2023/12/11 + */ +@Data +@ApiModel(value="维保任务详细") +public class EquipmentRecord implements Serializable { + private static final long serialVersionUID = 1L; + private Long id; + + /** + * 机具ID + */ + @ApiModelProperty(value = "机具ID") + private String maId; + /** + * 规格ID + */ + @ApiModelProperty(value = "规格ID") + private String typeId; + + private String typeName; + + private String typeModelName; + + private String maCode; + /** + * 维修数量 + */ + @ApiModelProperty(value = "维修数量") + private Integer repairNum; + + + /** + * 创建者 + */ + @ApiModelProperty(value = "创建者") + private Long createBy; + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private String createTime; + /** + * 更新者 + */ + @ApiModelProperty(value = "更新者") + private String updateBy; + /** + * 更新时间 + */ + @ApiModelProperty(value = "更新时间") + private String updateTime; + + + /** + * 配件数量 + */ + @ApiModelProperty(value = "配件数量") + private Integer partNum; + /** + * 配件单价 + */ + @ApiModelProperty(value = "配件单价") + private BigDecimal partPrice; + /** + * 维修处理情况 + */ + @ApiModelProperty(value = "维修处理情况") + private String repairContent; + + /** + * 维修前情况 + */ + @ApiModelProperty(value = "维修前情况") + private String repairContentBefore; + /** + * 类型(0不收费,1收费) + */ + @ApiModelProperty(value = "类型(0不收费,1收费)") + private String partType; + /** + * 配件名称 + */ + @ApiModelProperty(value = "配件名称") + private String partName; + private String repairRemark; + /** + * 维修人 + */ + @ApiModelProperty(value = "维修人") + private Long repairer; + private List partList; + private String partStrList; + private Long companyId; + private Integer partId; + /** + * 损坏照片id + */ + @ApiModelProperty(value = "损坏照片id") + private String fileIds; + + private List fileList; + + private int manageType; + + private String partChange; + + private Integer partChangeNum; + + private int parentId; + + /** + * 维保状态 + */ + @ApiModelProperty(value = "维保状态") + private Integer repairStatus; + + @ApiModelProperty(value = "维修时间") + private String repairTime; + + private long[] ids; + + private String auditBy; + + private String repairerName; +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/EquipmentTask.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/EquipmentTask.java new file mode 100644 index 0000000..c08536d --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/EquipmentTask.java @@ -0,0 +1,127 @@ +package com.bonus.sgzb.material.domain; + +import com.bonus.sgzb.common.core.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author c liu + * @date 2023/12/11 + */ +@Data +@ApiModel(value="维保任务") +public class EquipmentTask { + + + private long id; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private Long maId; + + /** + * 编码 + */ + @ApiModelProperty(value = "编码") + private String maCode; + + /** + * 任务创建人 + */ + @ApiModelProperty(value = "任务创建人") + private Long createBy; + + + /** + * 任务创建时间 + */ + @ApiModelProperty(value = "任务创建时间") + private String createTime; + + /** + * 维保时间 + */ + @ApiModelProperty(value = "维保时间") + private String repairTime; + + /** + * 维保状态 + */ + @ApiModelProperty(value = "维保状态") + private Integer repairStatus; + /** + * 关键字 + */ + private String keyword; + /** + * 开始时间 + */ + private String startTime; + /** + * 结束时间 + */ + private String endTime; + private Long companyId; + private Long agreementId; + + /** + * 维修机具类型 + */ + @ApiModelProperty(value = "维修规格型号") + @Excel(name = "维修规格型号",sort = 1) + private String typeModelName; + /** + * 规格型号 + */ + @ApiModelProperty(value = "维修机具类型") + @Excel(name = "维修机具类型",sort = 2) + private String typeName; + + /** + * 维修总量 + */ + @ApiModelProperty(value = "维修总量") + @Excel(name = "维修总量",sort = 3) + private int repairNum; + + /** + * 维修人员 + */ + @ApiModelProperty(value = "维修人员") + private String repairer; + + //类型ID + private Long typeId; + + + /** + * 技术鉴定 + */ + @ApiModelProperty(value = "技术鉴定") + private String repairRemark; + + /** + * 维修处理情况 + */ + @ApiModelProperty(value = "维修处理情况") + private String repairContent; + + /** + * 维修前情况 + */ + @ApiModelProperty(value = "维修前情况") + private String repairContentBefore; + + private int manageType; + + /** 用户ID */ + @ApiModelProperty(value = "userId") + private Long userId; + + +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/equipmentMaCodeInfo.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/equipmentMaCodeInfo.java new file mode 100644 index 0000000..feb1f71 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/equipmentMaCodeInfo.java @@ -0,0 +1,31 @@ +package com.bonus.sgzb.material.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author c liu + * @date 2023/12/11 + */ +@Data +@ApiModel(value="设备编号") +public class equipmentMaCodeInfo { + /** 规格ID */ + @ApiModelProperty(value = "规格ID") + private Long typeId; + + @ApiModelProperty(value = "机具ID") + private Long maId; + + @ApiModelProperty(value = "设备编码") + private String maCode; + + @ApiModelProperty(value = "库存数量") + private BigDecimal storageNum; + + @ApiModelProperty(value = "设备状态") + private Integer maStatus; +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/EquipmentToRepairMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/EquipmentToRepairMapper.java new file mode 100644 index 0000000..a45fe2d --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/EquipmentToRepairMapper.java @@ -0,0 +1,51 @@ +package com.bonus.sgzb.material.mapper; + +import com.bonus.sgzb.base.api.domain.FileInfo; +import com.bonus.sgzb.base.domain.RepairApplyRecord; +import com.bonus.sgzb.base.domain.RepairPartDetails; +import com.bonus.sgzb.base.domain.RepairTask; +import com.bonus.sgzb.base.domain.RepairTaskDetails; +import com.bonus.sgzb.base.domain.vo.DictVo; +import com.bonus.sgzb.material.domain.*; +import com.bonus.sgzb.system.api.domain.SysUser; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * @author c liu + * @date 2023/12/11 + */ +@Mapper +public interface EquipmentToRepairMapper { + /** + * 获取设备编号在库下拉 + * @return + */ + List getMaCodeSelect(equipmentMaCodeInfo info); + + List getEquipmentList(EquipmentTask bean); + + int addEquipmentNew(EquipmentRecord beanTemp); + + int addEquipmentDetailsNew(EquipmentPartDetails beanTempTwo); + + EquipmentRecord getEquipmentInfo(EquipmentRecord bean); + + List getPartList(EquipmentRecord record); + + List getFileEquipmentList(Long id); + + void deleteEquipmentDetails(EquipmentRecord record); + + void deleteFileEquipmentList(EquipmentRecord record); + + int editEquipmentNew(EquipmentRecord beanTemp); + + int submitStatusNew(long id); + + EquipmentRecord getMaintenanceEquipment(EquipmentRecord bean); +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/EquipmentToRepairService.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/EquipmentToRepairService.java new file mode 100644 index 0000000..3df9838 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/EquipmentToRepairService.java @@ -0,0 +1,42 @@ +package com.bonus.sgzb.material.service; + +import com.bonus.sgzb.base.domain.RepairApplyRecord; +import com.bonus.sgzb.base.domain.RepairPartDetails; +import com.bonus.sgzb.base.domain.RepairTask; +import com.bonus.sgzb.base.domain.RepairTaskDetails; +import com.bonus.sgzb.base.domain.vo.DictVo; +import com.bonus.sgzb.common.core.web.domain.AjaxResult; + +import com.bonus.sgzb.material.domain.EquipmentRecord; +import com.bonus.sgzb.material.domain.EquipmentTask; +import com.bonus.sgzb.material.domain.equipmentMaCodeInfo; +import com.bonus.sgzb.system.api.domain.SysUser; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * @author c liu + * @date 2023/12/11 + */ +public interface EquipmentToRepairService { + + /** + * 获取设备编号在库下拉 + * @return + */ + List getMaCodeSelect(equipmentMaCodeInfo info); + + List getEquipmentList(EquipmentTask bean); + + AjaxResult submitEquipment(EquipmentRecord bean); + + EquipmentRecord getEquipmentInfo(EquipmentRecord bean); + + AjaxResult editEquipmentInfo(EquipmentRecord bean); + + AjaxResult submitStatusNew(EquipmentRecord bean); + + EquipmentRecord getMaintenanceEquipment(EquipmentRecord bean); +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/EquipmentToRepairServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/EquipmentToRepairServiceImpl.java new file mode 100644 index 0000000..48fd4ab --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/EquipmentToRepairServiceImpl.java @@ -0,0 +1,478 @@ +package com.bonus.sgzb.material.service.impl; + +import com.bonus.sgzb.app.mapper.BackReceiveMapper; +import com.bonus.sgzb.base.api.domain.FileInfo; +import com.bonus.sgzb.base.domain.RepairApplyRecord; +import com.bonus.sgzb.base.domain.RepairPartDetails; +import com.bonus.sgzb.base.domain.RepairTask; +import com.bonus.sgzb.base.domain.RepairTaskDetails; +import com.bonus.sgzb.base.mapper.RepairMapper; +import com.bonus.sgzb.base.service.RepairService; +import com.bonus.sgzb.common.core.exception.ServiceException; +import com.bonus.sgzb.common.core.utils.DateUtils; +import com.bonus.sgzb.common.core.web.domain.AjaxResult; +import com.bonus.sgzb.common.security.utils.SecurityUtils; +import com.bonus.sgzb.material.domain.*; +import com.bonus.sgzb.material.mapper.EquipmentToRepairMapper; +import com.bonus.sgzb.material.mapper.TaskMapper; +import com.bonus.sgzb.material.service.EquipmentToRepairService; +import com.bonus.sgzb.system.api.model.LoginUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Set; + +/** + * @author c liu + * @date 2023/12/11 + */ +@Service("EquipmentToRepairService") +public class EquipmentToRepairServiceImpl implements EquipmentToRepairService { + @Autowired + private EquipmentToRepairMapper mapper; + + @Autowired + private BackReceiveMapper backReceiveMapper; + + private final static String STRING_ADMIN = "admin"; + @Override + public List getMaCodeSelect(equipmentMaCodeInfo info) { + return mapper.getMaCodeSelect(info); + } + + @Override + public List getEquipmentList(EquipmentTask bean) { + Set roles = SecurityUtils.getLoginUser().getRoles(); + List equipmentTaskList = new ArrayList<>(); + if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin")) { + equipmentTaskList = mapper.getEquipmentList(bean); + }else{ + Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId(); + bean.setCompanyId(companyId); + bean.setUserId(SecurityUtils.getLoginUser().getUserid()); + equipmentTaskList = mapper.getEquipmentList(bean); + } + return equipmentTaskList; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult submitEquipment(EquipmentRecord bean) { + + LoginUser loginUser = SecurityUtils.getLoginUser(); + bean.setUpdateBy(loginUser.getUserid().toString()); + bean.setCreateBy(loginUser.getUserid()); + List partList = bean.getPartList(); + if (partList != null && partList.size() > 0) { + if (partList.get(0).getRepairNum() == null){ + throw new ServiceException("请输入维修数量"); + } + bean.setRepairNum(partList.get(0).getRepairNum()); + bean.setRepairer(partList.get(0).getRepairer()); + if (partList.get(0).getUpdateTime() == null) { + // 获取当前时间并格式化为 "yyyy-MM-dd HH:mm:ss" + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + bean.setUpdateTime(sdf.format(new Date())); + } else { + // 如果已有日期但无时分秒,补上 "00:00:00" + bean.setUpdateTime(partList.get(0).getUpdateTime() + " 00:00:00"); + } + }else{ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + bean.setUpdateTime(sdf.format(new Date())); + } + //如果是编码维修 + if(bean.getManageType()==0){ //编码管理 + //插入到equipment_record表 + EquipmentRecord beanTemp = new EquipmentRecord(); + beanTemp.setTypeId(bean.getTypeId()); + beanTemp.setMaId(bean.getMaId()); + beanTemp.setRepairNum(1); + beanTemp.setRepairStatus(0); + beanTemp.setCreateBy(bean.getRepairer()); + beanTemp.setRepairer(bean.getRepairer()); + beanTemp.setRepairTime(bean.getUpdateTime()); + mapper.addEquipmentNew(beanTemp); + + //插入到details表 + if (partList != null && partList.size() > 0) { + for (EquipmentPartDetails partDetails : partList) { + if (partDetails.getPartId() != null) { + // 有维修配件时 + if (partDetails.getPartCost() == null) { + partDetails.setPartCost(new BigDecimal(0)); + } + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(loginUser.getUserid()); + + EquipmentPartDetails beanTempTwo = new EquipmentPartDetails(); + beanTempTwo.setTypeId(bean.getTypeId()); + beanTempTwo.setMaId(bean.getMaId()); + beanTempTwo.setParentId(beanTemp.getId()); + beanTempTwo.setPartId(partDetails.getPartId()); + beanTempTwo.setPartPrice(partDetails.getPartCost()); + beanTempTwo.setPartNum(partDetails.getPartNum()); + beanTempTwo.setRepairContent(partDetails.getRepairContent()); + beanTempTwo.setRepairContentBefore(partDetails.getRepairContentBefore()); + beanTempTwo.setRepairRemark(partDetails.getRepairRemark()); + beanTempTwo.setPartChange(partDetails.getPartChange()); + beanTempTwo.setPartChangeNum(partDetails.getPartChangeNum()); + beanTempTwo.setCreateBy(loginUser.getUserid()); + mapper.addEquipmentDetailsNew(beanTempTwo); + + //文件上传新增 + if (partDetails.getFileList() != null){ + for (FileInfo fileInfo : partDetails.getFileList()) { + fileInfo.setModelId(beanTempTwo.getId()); + fileInfo.setTypeId(Integer.parseInt(bean.getTypeId())); + if (bean.getMaId() != null){ + fileInfo.setMaId(Integer.parseInt(bean.getMaId())); + } + fileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString()); + fileInfo.setCreateTime(DateUtils.getNowDate()); + fileInfo.setRepairStatus(2); + backReceiveMapper.insertBmFileInfo(fileInfo); + } + } + }else{ + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(loginUser.getUserid()); + + EquipmentPartDetails beanTempTwo = new EquipmentPartDetails(); + beanTempTwo.setTypeId(bean.getTypeId()); + beanTempTwo.setParentId(beanTemp.getId()); + beanTempTwo.setPartId(null); + beanTempTwo.setPartPrice(null); + beanTempTwo.setPartNum(null); + beanTempTwo.setRepairContent(partDetails.getRepairContent()); + beanTempTwo.setRepairContentBefore(partDetails.getRepairContentBefore()); + beanTempTwo.setRepairRemark(partDetails.getRepairRemark()); + beanTempTwo.setPartChange(null); + beanTempTwo.setPartChangeNum(null); + beanTempTwo.setCreateBy(loginUser.getUserid()); + mapper.addEquipmentDetailsNew(beanTempTwo); + } + + } + } + + }else{ //数量管理 + //插入到equipment_record表 + EquipmentRecord beanTemp = new EquipmentRecord(); + beanTemp.setTypeId(bean.getTypeId()); + beanTemp.setRepairNum(bean.getRepairNum()); + beanTemp.setRepairStatus(0); + beanTemp.setCreateBy(bean.getRepairer()); + beanTemp.setRepairer(bean.getRepairer()); + beanTemp.setRepairTime(bean.getUpdateTime()); + mapper.addEquipmentNew(beanTemp); + + //插入到details表 + if (partList != null && partList.size() > 0) { + for (EquipmentPartDetails partDetails : partList) { + if (partDetails.getPartId() != null) { + // 有维修配件时 + if (partDetails.getPartCost() == null) { + partDetails.setPartCost(new BigDecimal(0)); + } + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(loginUser.getUserid()); + + EquipmentPartDetails beanTempTwo = new EquipmentPartDetails(); + beanTempTwo.setTypeId(bean.getTypeId()); + beanTempTwo.setParentId(beanTemp.getId()); + beanTempTwo.setPartId(partDetails.getPartId()); + beanTempTwo.setPartPrice(partDetails.getPartCost()); + beanTempTwo.setPartNum(partDetails.getPartNum()); + beanTempTwo.setRepairContent(partDetails.getRepairContent()); + beanTempTwo.setRepairContentBefore(partDetails.getRepairContentBefore()); + beanTempTwo.setRepairRemark(partDetails.getRepairRemark()); + beanTempTwo.setPartChange(partDetails.getPartChange()); + beanTempTwo.setPartChangeNum(partDetails.getPartChangeNum()); + beanTempTwo.setCreateBy(loginUser.getUserid()); + mapper.addEquipmentDetailsNew(beanTempTwo); + + //文件上传新增 + if (partDetails.getFileList() != null){ + for (FileInfo fileInfo : partDetails.getFileList()) { + fileInfo.setModelId(beanTempTwo.getId()); + fileInfo.setTypeId(Integer.parseInt(bean.getTypeId())); + if (bean.getMaId() != null){ + fileInfo.setMaId(Integer.parseInt(bean.getMaId())); + } + fileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString()); + fileInfo.setCreateTime(DateUtils.getNowDate()); + fileInfo.setRepairStatus(2); + backReceiveMapper.insertBmFileInfo(fileInfo); + } + } + }else{ + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(loginUser.getUserid()); + + EquipmentPartDetails beanTempTwo = new EquipmentPartDetails(); + beanTempTwo.setTypeId(bean.getTypeId()); + beanTempTwo.setParentId(beanTemp.getId()); + beanTempTwo.setPartId(null); + beanTempTwo.setPartPrice(null); + beanTempTwo.setPartNum(null); + beanTempTwo.setRepairContent(partDetails.getRepairContent()); + beanTempTwo.setRepairContentBefore(partDetails.getRepairContentBefore()); + beanTempTwo.setRepairRemark(partDetails.getRepairRemark()); + beanTempTwo.setPartChange(null); + beanTempTwo.setPartChangeNum(null); + beanTempTwo.setCreateBy(loginUser.getUserid()); + mapper.addEquipmentDetailsNew(beanTempTwo); + } + + } + } + + + + } + + return AjaxResult.success(); + } + + @Override + public EquipmentRecord getEquipmentInfo(EquipmentRecord bean) { + //获取维保信息 + EquipmentRecord record = mapper.getEquipmentInfo(bean); + //获取配件信息 + if(record != null){ + List partList = mapper.getPartList(record); + if(partList != null){ + for(int i=0; i fileList = mapper.getFileEquipmentList(partDetails.getId()); + partDetails.setFileList(fileList); + } + record.setPartList(partList); + } + } + + return record; + } + + @Override + public AjaxResult editEquipmentInfo(EquipmentRecord bean) { + //删除之前的配件和文件数据 + EquipmentRecord record = mapper.getEquipmentInfo(bean); + if (record != null) { + //删除repair_equipment_details表 + mapper.deleteEquipmentDetails(record); + //删除sys_file_info表 + mapper.deleteFileEquipmentList(record); + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + bean.setUpdateBy(loginUser.getUserid().toString()); + bean.setCreateBy(loginUser.getUserid()); + List partList = bean.getPartList(); + if (partList != null && partList.size() > 0) { + if (partList.get(0).getRepairNum() == null) { + throw new ServiceException("请输入维修数量"); + } + bean.setRepairNum(partList.get(0).getRepairNum()); + bean.setRepairer(partList.get(0).getRepairer()); + if (partList.get(0).getUpdateTime() == null) { + // 获取当前时间并格式化为 "yyyy-MM-dd HH:mm:ss" + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + bean.setUpdateTime(sdf.format(new Date())); + } else { + // 如果已有日期但无时分秒,补上 "00:00:00" + bean.setUpdateTime(partList.get(0).getUpdateTime() + " 00:00:00"); + } + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + bean.setUpdateTime(sdf.format(new Date())); + } + //如果是编码维修 + if (bean.getManageType() == 0) { //编码管理 + //插入到equipment_record表 + EquipmentRecord beanTemp = new EquipmentRecord(); + beanTemp.setId(bean.getId()); + beanTemp.setTypeId(bean.getTypeId()); + beanTemp.setMaId(bean.getMaId()); + beanTemp.setRepairNum(1); + beanTemp.setRepairStatus(0); + beanTemp.setCreateBy(bean.getRepairer()); + beanTemp.setRepairer(bean.getRepairer()); + beanTemp.setRepairTime(bean.getUpdateTime()); + mapper.editEquipmentNew(beanTemp); + + //插入到details表 + if (partList != null && partList.size() > 0) { + for (EquipmentPartDetails partDetails : partList) { + if (partDetails.getPartId() != null) { + // 有维修配件时 + if (partDetails.getPartCost() == null) { + partDetails.setPartCost(new BigDecimal(0)); + } + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(loginUser.getUserid()); + + EquipmentPartDetails beanTempTwo = new EquipmentPartDetails(); + beanTempTwo.setTypeId(bean.getTypeId()); + beanTempTwo.setParentId(beanTemp.getId()); + beanTempTwo.setPartId(partDetails.getPartId()); + beanTempTwo.setPartPrice(partDetails.getPartCost()); + beanTempTwo.setPartNum(partDetails.getPartNum()); + beanTempTwo.setRepairContent(partDetails.getRepairContent()); + beanTempTwo.setRepairContentBefore(partDetails.getRepairContentBefore()); + beanTempTwo.setRepairRemark(partDetails.getRepairRemark()); + beanTempTwo.setPartChange(partDetails.getPartChange()); + beanTempTwo.setPartChangeNum(partDetails.getPartChangeNum()); + beanTempTwo.setCreateBy(loginUser.getUserid()); + mapper.addEquipmentDetailsNew(beanTempTwo); + + //文件上传新增 + if (partDetails.getFileList() != null) { + for (FileInfo fileInfo : partDetails.getFileList()) { + fileInfo.setModelId(beanTempTwo.getId()); + fileInfo.setTypeId(Integer.parseInt(bean.getTypeId())); + if (bean.getMaId() != null) { + fileInfo.setMaId(Integer.parseInt(bean.getMaId())); + } + fileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString()); + fileInfo.setCreateTime(DateUtils.getNowDate()); + fileInfo.setRepairStatus(2); + backReceiveMapper.insertBmFileInfo(fileInfo); + } + } + } else { + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(loginUser.getUserid()); + + EquipmentPartDetails beanTempTwo = new EquipmentPartDetails(); + beanTempTwo.setTypeId(bean.getTypeId()); + beanTempTwo.setParentId(beanTemp.getId()); + beanTempTwo.setPartId(null); + beanTempTwo.setPartPrice(null); + beanTempTwo.setPartNum(null); + beanTempTwo.setRepairContent(partDetails.getRepairContent()); + beanTempTwo.setRepairContentBefore(partDetails.getRepairContentBefore()); + beanTempTwo.setRepairRemark(partDetails.getRepairRemark()); + beanTempTwo.setPartChange(null); + beanTempTwo.setPartChangeNum(null); + beanTempTwo.setCreateBy(loginUser.getUserid()); + mapper.addEquipmentDetailsNew(beanTempTwo); + } + + } + } + + } else { //数量管理 + //插入到equipment_record表 + EquipmentRecord beanTemp = new EquipmentRecord(); + beanTemp.setId(bean.getId()); + beanTemp.setTypeId(bean.getTypeId()); + beanTemp.setRepairNum(bean.getRepairNum()); + beanTemp.setRepairStatus(0); + beanTemp.setCreateBy(bean.getRepairer()); + beanTemp.setRepairer(bean.getRepairer()); + beanTemp.setRepairTime(bean.getUpdateTime()); + mapper.editEquipmentNew(beanTemp); + + //插入到details表 + if (partList != null && partList.size() > 0) { + for (EquipmentPartDetails partDetails : partList) { + if (partDetails.getPartId() != null) { + // 有维修配件时 + if (partDetails.getPartCost() == null) { + partDetails.setPartCost(new BigDecimal(0)); + } + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(loginUser.getUserid()); + + EquipmentPartDetails beanTempTwo = new EquipmentPartDetails(); + beanTempTwo.setTypeId(bean.getTypeId()); + beanTempTwo.setParentId(beanTemp.getId()); + beanTempTwo.setPartId(partDetails.getPartId()); + beanTempTwo.setPartPrice(partDetails.getPartCost()); + beanTempTwo.setPartNum(partDetails.getPartNum()); + beanTempTwo.setRepairContent(partDetails.getRepairContent()); + beanTempTwo.setRepairContentBefore(partDetails.getRepairContentBefore()); + beanTempTwo.setRepairRemark(partDetails.getRepairRemark()); + beanTempTwo.setPartChange(partDetails.getPartChange()); + beanTempTwo.setPartChangeNum(partDetails.getPartChangeNum()); + beanTempTwo.setCreateBy(loginUser.getUserid()); + mapper.addEquipmentDetailsNew(beanTempTwo); + + //文件上传新增 + if (partDetails.getFileList() != null) { + for (FileInfo fileInfo : partDetails.getFileList()) { + fileInfo.setModelId(beanTempTwo.getId()); + fileInfo.setTypeId(Integer.parseInt(bean.getTypeId())); + if (bean.getMaId() != null) { + fileInfo.setMaId(Integer.parseInt(bean.getMaId())); + } + fileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString()); + fileInfo.setCreateTime(DateUtils.getNowDate()); + fileInfo.setRepairStatus(2); + backReceiveMapper.insertBmFileInfo(fileInfo); + } + } + } else { + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(loginUser.getUserid()); + + EquipmentPartDetails beanTempTwo = new EquipmentPartDetails(); + beanTempTwo.setTypeId(bean.getTypeId()); + beanTempTwo.setParentId(beanTemp.getId()); + beanTempTwo.setPartId(null); + beanTempTwo.setPartPrice(null); + beanTempTwo.setPartNum(null); + beanTempTwo.setRepairContent(partDetails.getRepairContent()); + beanTempTwo.setRepairContentBefore(partDetails.getRepairContentBefore()); + beanTempTwo.setRepairRemark(partDetails.getRepairRemark()); + beanTempTwo.setPartChange(null); + beanTempTwo.setPartChangeNum(null); + beanTempTwo.setCreateBy(loginUser.getUserid()); + mapper.addEquipmentDetailsNew(beanTempTwo); + } + + } + } + + } + return AjaxResult.success(); + } + + @Override + public AjaxResult submitStatusNew(EquipmentRecord bean) { + if(bean.getIds()!=null){ + for (long id : bean.getIds()) { + int count = mapper.submitStatusNew(id); + if(count<=0){ + return AjaxResult.error("提交失败"); + } + } + } + return AjaxResult.success(); + } + + @Override + public EquipmentRecord getMaintenanceEquipment(EquipmentRecord bean) { + return mapper.getMaintenanceEquipment(bean); + } +} diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/base/RepairMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/base/RepairMapper.xml index a27fbf1..843ff96 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/base/RepairMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/base/RepairMapper.xml @@ -272,22 +272,28 @@ @@ -452,42 +460,62 @@ + select + ma_id as maId, + ma_code as maCode + from + ma_machine + where ma_status in (15,16) + and type_id = #{typeId} + + + + + + insert into repair_equipment_record (ma_id,type_id,repair_num,status,create_by,create_time,repairer,repair_time) + values (#{maId},#{typeId},#{repairNum},#{repairStatus},#{createBy},now(),#{repairer},#{repairTime}); + + + + insert into repair_equipment_details (parent_id,type_id,ma_id,part_id,part_num,part_price,repair_remark,repair_content,repair_content_before,part_change,part_change_num,create_by,create_time) + values (#{parentId},#{typeId},#{maId},#{partId},#{partNum},#{partPrice},#{repairRemark},#{repairContent},#{repairContentBefore},#{partChange},#{partChangeNum},#{createBy},now()); + + + + + + + + delete from repair_equipment_details where parent_id = #{id} + + + + delete from sys_file_info + where type_id = #{typeId} and repair_status = 2 + + and ma_id = #{maId} + + + + + update repair_equipment_record + + + ma_id = #{maId}, + + + type_id = #{typeId}, + + + repair_num = #{repairNum}, + + + repairer = #{repairer}, + + + repair_time = #{repairTime}, + + update_by = #{updateBy}, + update_time = now() + + where id = #{id} + + + + update repair_equipment_record + + status = 1 + + where id = #{id} + + + +