| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.beanutils.BeanMap; |
| | | import org.apache.commons.beanutils.BeanUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | |
| | | @ApiOperation(value = "点检工单-批量审批流程", notes = "点检工单-批量审批流程") |
| | | @PostMapping("/batchApproval") |
| | | public Result<?> batchApproval(@RequestBody EamInspectionBatchApprovalRequest request) { |
| | | if(request == null || CollectionUtil.isEmpty(request.getTastList())) { |
| | | if(request == null || CollectionUtil.isEmpty(request.getTaskList())) { |
| | | return Result.error("没有需要审批的数据!"); |
| | | } |
| | | int n = 0; |
| | | StringBuilder errorMsg = new StringBuilder(); |
| | | List<WorkTaskDataVo> tastList = request.getTastList(); |
| | | List<WorkTaskDataVo> tastList = request.getTaskList(); |
| | | for(WorkTaskDataVo workTaskDataVo : tastList) { |
| | | EamInspectionOrderRequest orderRequest = new EamInspectionOrderRequest(); |
| | | EamInspectionOrder order = eamInspectionOrderService.getById(workTaskDataVo.getDataId()); |
| | | if(order == null) { |
| | | errorMsg.append("工单ID:"); |
| | | errorMsg.append(workTaskDataVo.getDataId()); |
| | | errorMsg.append(",不存在或已被删除!\r\n"); |
| | | errorMsg.append(",不存在或已被删除!\n"); |
| | | continue; |
| | | } |
| | | if(!InspectionStatus.WAIT_CONFIRM.name().equals(order.getInspectionStatus())) { |
| | | errorMsg.append("工单号:"); |
| | | errorMsg.append(order.getOrderNum()); |
| | | errorMsg.append(",状态无法批量审批!\r\n"); |
| | | errorMsg.append(",状态无法批量审批!\n"); |
| | | continue; |
| | | } |
| | | List<EamInspectionOrderDetail> tableDetailList = eamInspectionOrderDetailService.queryListByOrderId(order.getId()); |
| | | try { |
| | | BeanUtils.copyProperties(orderRequest, order); |
| | | orderRequest.setId(order.getId()); |
| | | orderRequest.setEquipmentId(order.getEquipmentId()); |
| | | //审批信息 |
| | | orderRequest.setConfirmComment(request.getConfirmComment()); |
| | | orderRequest.setConfirmDealType(request.getConfirmDealType()); |
| | |
| | | if(result == null) { |
| | | errorMsg.append("工单号:"); |
| | | errorMsg.append(order.getOrderNum()); |
| | | errorMsg.append(",审批失败!\r\n"); |
| | | errorMsg.append(",审批失败!\n"); |
| | | continue; |
| | | } |
| | | n++; |
| | |
| | | errorMsg.append("工单号:"); |
| | | errorMsg.append(order.getOrderNum()); |
| | | errorMsg.append(",审批失败,错误原因:"); |
| | | errorMsg.append(e.getMessage() + "\r\n"); |
| | | errorMsg.append(e.getMessage() + "\n"); |
| | | } |
| | | |
| | | } |
| | | if(n > 0) { |
| | | String message = "成功审批通过" + n + "条记录!\r\n" + errorMsg; |
| | | String message = "成功审批通过" + n + "条记录!\n" + errorMsg; |
| | | return Result.OK(message); |
| | | } |
| | | return Result.error(errorMsg.toString()); |