lin
2024-04-11 0ecbf017eba6b832e50e4905d62acfcf12914bf6
src/main/java/org/springblade/modules/task/service/impl/TaskServiceImpl.java
@@ -24,6 +24,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springblade.common.constant.CommonConstant;
import org.springblade.common.constant.DictConstant;
import org.springblade.common.param.CommonParamSet;
import org.springblade.common.utils.SpringUtils;
@@ -604,33 +605,47 @@
   }
   /**
    * 任务审核
    * @param task
    * @return
    * 审核任务。
    * 根据任务的报告类型,更新相应的任务状态,并触发相应的事件更新。
    *
    * @param task 任务实体,包含任务信息和报告类型。
    * @return 返回审核结果,成功为true,失败为false。
    */
   @Override
   public Boolean examine(TaskEntity task) {
      // 二手交易
      if (task.getReportType().equals(5)) {
         boolean b = updateById(task);
         if (b) {
      if (task == null || task.getReportType() == null) {
         // 检查任务和报告类型是否为空,若为空则直接返回false
         return false;
      }
      // 根据任务报告类型,更新任务状态并触发相应的事件更新
      boolean result = updateById(task);
      if (task.getReportType().equals(CommonConstant.REPORT_TYPE_SECONDHAND_TRADE)) {
         // 如果报告类型匹配,尝试更新任务标签报告事件状态
         if (result) {
            ITaskLabelReportingEventService bean = SpringUtils.getBean(ITaskLabelReportingEventService.class);
            return bean.update(Wrappers.<TaskLabelReportingEventEntity>lambdaUpdate()
               .set(TaskLabelReportingEventEntity::getConfirmFlag, task.getStatus())
               .eq(TaskLabelReportingEventEntity::getTaskId, task.getId()));
         }
      }
      // 消防只查
      if (task.getReportType().equals(2)) {
         boolean b = updateById(task);
         if (b) {
      } else if (task.getReportType().equals(CommonConstant.REPORT_TYPE_FIRE_INSPECTION)) {
         // 如果报告类型为消防自查,尝试更新消防自查状态
         if (result) {
            ITaskPlaceSelfCheckService bean = SpringUtils.getBean(ITaskPlaceSelfCheckService.class);
            return bean.update(Wrappers.<TaskPlaceSelfCheckEntity>lambdaUpdate()
               .set(TaskPlaceSelfCheckEntity::getStatus, task.getStatus())
               .eq(TaskPlaceSelfCheckEntity::getTaskId, task.getId()));
         }
      } else if (task.getReportType().equals(CommonConstant.REPORT_TYPE_NO_FRAUD)) {
         // 如果报告类型为无诈,尝试更新无诈报告状态
         if (result) {
            ITaskNoFraudReportingService bean = SpringUtils.getBean(ITaskNoFraudReportingService.class);
            return bean.update(Wrappers.<TaskNoFraudReportingEntity>lambdaUpdate()
               .set(TaskNoFraudReportingEntity::getStatus, task.getStatus())
               .eq(TaskNoFraudReportingEntity::getTaskId, task.getId()));
      }
      }
      // 如果没有匹配的报告类型,返回false
      return false;
   }
}