lyh
7 天以前 4129e9310993e1bfd62cf827556b868c8829dfb2
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamReportAccidentsRegisterController.java
@@ -10,6 +10,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.StrUtil;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
@@ -17,7 +18,11 @@
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.eam.constant.BusinessCodeConst;
import org.jeecg.modules.eam.dto.EamReportAccidentsRegisterDto;
import org.jeecg.modules.eam.entity.EamRepairOrder;
import org.jeecg.modules.eam.entity.EamRepairPerson;
import org.jeecg.modules.eam.entity.EamReportAccidentsRegister;
import org.jeecg.modules.eam.entity.EamReportRepair;
import org.jeecg.modules.eam.request.EamRepairOrderRequest;
import org.jeecg.modules.eam.request.EamReportAccidentsRegisterQuery;
import org.jeecg.modules.eam.service.IEamReportAccidentsRegisterService;
@@ -26,6 +31,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.eam.service.IEamReportRepairService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -55,7 +61,8 @@
public class EamReportAccidentsRegisterController extends JeecgController<EamReportAccidentsRegister, IEamReportAccidentsRegisterService> {
   @Autowired
   private IEamReportAccidentsRegisterService eamReportAccidentsRegisterService;
   @Autowired
   private IEamReportRepairService eamReportRepairService;
   /**
    * 分页列表查询
    *
@@ -117,7 +124,7 @@
       // 校验领取权限
       LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
       if (!BusinessCodeConst.PCR0001.equals(user.getPost())) {
          return Result.error("填报失败,没有填报权限!,请登录操作工岗位用户");
          return Result.error("填报失败,没有填报权限!,需操作工提交");
       }
       if (eamReportAccidentsRegisterDto == null) {
          return Result.error("填报的对象不能为空!");
@@ -130,6 +137,44 @@
          }
       }
    }
    /**
     * 操作工提交-发起流程
     * @param id
     * @return
     */
    @ApiOperation(value = "设备事故登记表-提交", notes = "设备事故登记表-提交")
    @GetMapping(value = "/submit")
    public Result<?> submit(String id){
       // 校验领取权限
       LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
       if (!BusinessCodeConst.PCR0001.equals(user.getPost())) {
          return Result.error("提交失败,没有提交权限!,需操作工提交");
       }
       eamReportAccidentsRegisterService.submit(id);
       return Result.OK("提交成功!");
    }
    /**
     * 我的待办 执行/审批
     *
     * @param eamReportAccidentsRegisterDto
     * @return
     */
    @AutoLog(value = "设备事故登记表-执行/审批")
    @ApiOperation(value = "设备事故登记表-执行/审批", notes = "设备事故登记表-执行/审批")
    @PostMapping(value = "/perform")
    public Result<?> perform(@RequestBody EamReportAccidentsRegisterDto eamReportAccidentsRegisterDto) {
       if (eamReportAccidentsRegisterDto == null) {
          return Result.error("审批的对象不能为空!");
       }
       // 检查请求参数
       if (StrUtil.isBlank(eamReportAccidentsRegisterDto.getTaskId()) || StrUtil.isBlank(eamReportAccidentsRegisterDto.getDataId()) || StrUtil.isBlank(eamReportAccidentsRegisterDto.getInstanceId())) {
          return Result.error("审批任务错误或不存在!");
       }
       return  eamReportAccidentsRegisterService.audit(eamReportAccidentsRegisterDto);
    }
   /**
    *   通过id删除
@@ -177,6 +222,10 @@
      if(eamReportAccidentsRegister==null) {
         return Result.error("未找到对应数据");
      }
      EamReportRepair eamReportRepair=eamReportRepairService.getById(eamReportAccidentsRegister.getReportId());
      eamReportAccidentsRegister.setScrapPartNumber(eamReportRepair.getScrapPartNumber());
      eamReportAccidentsRegister.setScrapPartValue(eamReportRepair.getScrapPartValue());
      eamReportAccidentsRegister.setScrapPartQuantity(eamReportRepair.getScrapPartQuantity());
      return Result.OK(eamReportAccidentsRegister);
   }