|  | @@ -1,11 +1,13 @@
 | 
	
		
			
				|  |  |  package cn.iocoder.yudao.module.pms.service.iotrddailyreport;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import cn.hutool.core.util.ObjUtil;
 | 
	
		
			
				|  |  |  import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
	
		
			
				|  |  |  import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 | 
	
		
			
				|  |  |  import cn.iocoder.yudao.module.pms.controller.admin.iotrddailyreport.vo.IotRdDailyReportPageReqVO;
 | 
	
		
			
				|  |  |  import cn.iocoder.yudao.module.pms.controller.admin.iotrddailyreport.vo.IotRdDailyReportSaveReqVO;
 | 
	
		
			
				|  |  |  import cn.iocoder.yudao.module.pms.dal.dataobject.iotrddailyreport.IotRdDailyReportDO;
 | 
	
		
			
				|  |  |  import cn.iocoder.yudao.module.pms.dal.mysql.iotrddailyreport.IotRdDailyReportMapper;
 | 
	
		
			
				|  |  | +import cn.iocoder.yudao.module.supplier.enums.common.SupplierAuditStatusEnum;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.validation.annotation.Validated;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -43,9 +45,27 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
 | 
	
		
			
				|  |  |          validateIotRdDailyReportExists(updateReqVO.getId());
 | 
	
		
			
				|  |  |          // 更新
 | 
	
		
			
				|  |  |          IotRdDailyReportDO updateObj = BeanUtils.toBean(updateReqVO, IotRdDailyReportDO.class);
 | 
	
		
			
				|  |  | +        // 设置 日报填写状态 保存 已完成
 | 
	
		
			
				|  |  | +        updateObj.setStatus(1);
 | 
	
		
			
				|  |  | +        // 设置 日报审批状态为 审批中 auditStatus = 10
 | 
	
		
			
				|  |  | +        updateObj.setAuditStatus(10);
 | 
	
		
			
				|  |  |          iotRdDailyReportMapper.updateById(updateObj);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void approvalRdDailyReport(IotRdDailyReportSaveReqVO updateReqVO) {
 | 
	
		
			
				|  |  | +        // 如果审批拒绝 修改日报 填报状态 status = 0 填写中  审批状态 auditStatus = 审批不通过
 | 
	
		
			
				|  |  | +        // 审批通过 设置 日报审批状态 auditStatus = 审批通过
 | 
	
		
			
				|  |  | +        // 校验存在
 | 
	
		
			
				|  |  | +        IotRdDailyReportDO dailyReport = validateIotRdDailyReportExists(updateReqVO.getId());
 | 
	
		
			
				|  |  | +        dailyReport.setAuditStatus(updateReqVO.getAuditStatus());
 | 
	
		
			
				|  |  | +        if (SupplierAuditStatusEnum.REJECT.getStatus().equals(updateReqVO.getAuditStatus())) {
 | 
	
		
			
				|  |  | +            dailyReport.setStatus(0);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        dailyReport.setOpinion(updateReqVO.getOpinion());
 | 
	
		
			
				|  |  | +        iotRdDailyReportMapper.updateById(dailyReport);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void deleteIotRdDailyReport(Long id) {
 | 
	
		
			
				|  |  |          // 校验存在
 | 
	
	
		
			
				|  | @@ -54,10 +74,12 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
 | 
	
		
			
				|  |  |          iotRdDailyReportMapper.deleteById(id);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private void validateIotRdDailyReportExists(Long id) {
 | 
	
		
			
				|  |  | -        if (iotRdDailyReportMapper.selectById(id) == null) {
 | 
	
		
			
				|  |  | +    private IotRdDailyReportDO validateIotRdDailyReportExists(Long id) {
 | 
	
		
			
				|  |  | +        IotRdDailyReportDO dailyReport = iotRdDailyReportMapper.selectById(id);
 | 
	
		
			
				|  |  | +        if (ObjUtil.isEmpty(dailyReport)) {
 | 
	
		
			
				|  |  |              throw exception(IOT_RD_DAILY_REPORT_NOT_EXISTS);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        return dailyReport;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 |