| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.dto.message.MessageDTO; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IEquipmentReportRepairService; |
| | | import org.jeecg.modules.eam.service.IFaultDescriptionService; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private ISysBaseAPI sysBaseApi; |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IFaultDescriptionService faultDescriptionService; |
| | | // @Autowired |
| | | // private IUploadRelaService uploadRelaService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | |
| | | @AutoLog(value = "mom_eam_equipment_report_repair-添加") |
| | | @ApiOperation(value = "mom_eam_equipment_report_repair-添加", notes = "mom_eam_equipment_report_repair-添加") |
| | | @PostMapping(value = "/add") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<String> add(@RequestBody EquipmentReportRepair equipmentReportRepair) { |
| | | equipmentReportRepair.setStatus("1"); |
| | | equipmentReportRepair.setSource("1"); |
| | |
| | | equipment.setEquipmentStatus("2"); |
| | | String teamId = equipment.getTeamId(); |
| | | if(StringUtils.isNotBlank(teamId)){ |
| | | |
| | | List<SysUser> sysUsers = userService.list(new QueryWrapper<SysUser>() |
| | | .eq("team_id",teamId) |
| | | .eq("del_flag",0)); |
| | | for(SysUser user:sysUsers){ |
| | | String msg = "统一编号为【"+equipment.getNum()+"】的设备需要维修,请移步至故障报修查看"; |
| | | MessageDTO messageDTO = new MessageDTO(); |
| | | messageDTO.setTitle("故障报修提醒"); |
| | | messageDTO.setContent(msg); |
| | | messageDTO.setCategory("故障报修提醒"); |
| | | messageDTO.setFromUser("故障报修提醒小助手"); |
| | | messageDTO.setToUser(user.getUsername()); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } |
| | | }else { |
| | | return Result.error("该设备尚未维护维修班组,请维护后再报修"); |
| | | } |
| | | //添加故障描述信息 |
| | | FaultDescription faultDescription = new FaultDescription(); |
| | |
| | | faultDescription.setFaultId(equipmentReportRepair.getId()); |
| | | faultDescription.setPhoto(equipmentReportRepair.getPhoto()); |
| | | faultDescriptionService.save(faultDescription); |
| | | equipmentService.updateById(equipment); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |