فهرست منبع

'优化事件管理表-新增接口,增加异常上报计划id不传值的判断处理逻辑'

james 10 ماه پیش
والد
کامیت
7cd61c5e75

+ 21 - 13
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionEventServiceImpl.java

@@ -20,6 +20,7 @@ import com.usky.fire.service.PatrolInspectionPersonnelService;
 import com.usky.fire.service.PatrolInspectionPlanScheduleService;
 import com.usky.fire.service.config.rabbitmq.RabbitMQConfig;
 import com.usky.fire.service.vo.PatrolInspectionPlanRequestVO;
+import org.apache.catalina.security.SecurityUtil;
 import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -72,20 +73,27 @@ public class PatrolInspectionEventServiceImpl extends AbstractCrudService<Patrol
 
         Map<Object,Object> map = new HashMap<>();
 
-        Integer planId = patrolInspectionEvent.getPlanId();
-        LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.eq(PatrolInspectionPlanSchedule::getPlanId,planId);
-        List<PatrolInspectionPlanSchedule> list = patrolInspectionPlanScheduleService.list(queryWrapper);
-        if(list.size() > 0){
-            Integer personnelId = list.get(0).getPersonnelId();
-            LambdaQueryWrapper<PatrolInspectionPersonnel> queryWrapper1 = Wrappers.lambdaQuery();
-            queryWrapper1.eq(PatrolInspectionPersonnel::getId,personnelId);
-            PatrolInspectionPersonnel one = patrolInspectionPersonnelService.getOne(queryWrapper1);
-
-            patrolInspectionEvent.setPersonnelId(personnelId);
-            patrolInspectionEvent.setPersonnelName(one.getFullName());
-            map.put("idCard",one.getIdCard());
+        if(null != patrolInspectionEvent.getPlanId()){
+            Integer planId = patrolInspectionEvent.getPlanId();
+            LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
+            queryWrapper.eq(PatrolInspectionPlanSchedule::getPlanId,planId);
+            List<PatrolInspectionPlanSchedule> list = patrolInspectionPlanScheduleService.list(queryWrapper);
+            if(list.size() > 0){
+                Integer personnelId = list.get(0).getPersonnelId();
+                LambdaQueryWrapper<PatrolInspectionPersonnel> queryWrapper1 = Wrappers.lambdaQuery();
+                queryWrapper1.eq(PatrolInspectionPersonnel::getId,personnelId);
+                PatrolInspectionPersonnel one = patrolInspectionPersonnelService.getOne(queryWrapper1);
+
+                patrolInspectionEvent.setPersonnelId(personnelId);
+                patrolInspectionEvent.setPersonnelName(one.getFullName());
+                map.put("idCard",one.getIdCard());
+            }
+        }else{
+            Long userId = SecurityUtils.getUserId();
+            patrolInspectionEvent.setPersonnelId(userId.intValue());
+            patrolInspectionEvent.setPersonnelName(SecurityUtils.getUsername());
         }
+
         patrolInspectionEvent.setHandleStatus(0);
         patrolInspectionEvent.setTenantId(SecurityUtils.getTenantId());
         patrolInspectionEvent.setCreateBy(SecurityUtils.getUsername());