فهرست منبع

Merge branch 'usky-zyj' of uskycloud/usky-modules into server-165

James 11 ماه پیش
والد
کامیت
e22cf7daa7

+ 5 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionEventController.java

@@ -46,6 +46,11 @@ public class PatrolInspectionEventController {
         return ApiResult.success();
     }
 
+    /**
+     * 修改
+     * @param patrolInspectionEvent
+     * @return
+     */
     @PutMapping("edit")
     public ApiResult<Void> edit(@RequestBody PatrolInspectionEvent patrolInspectionEvent){
         patrolInspectionEventService.edit(patrolInspectionEvent);

+ 34 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionEventServiceImpl.java

@@ -8,12 +8,20 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.security.utils.SecurityUtils;
 import com.usky.fire.domain.PatrolInspectionEvent;
+import com.usky.fire.domain.PatrolInspectionPersonnel;
+import com.usky.fire.domain.PatrolInspectionPlanSchedule;
 import com.usky.fire.mapper.PatrolInspectionEventMapper;
 import com.usky.fire.service.PatrolInspectionEventService;
 import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.fire.service.PatrolInspectionPersonnelService;
+import com.usky.fire.service.PatrolInspectionPlanScheduleService;
 import com.usky.fire.service.vo.PatrolInspectionPlanRequestVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDateTime;
+import java.util.List;
+
 /**
  * <p>
  * 事件管理表 服务实现类
@@ -24,6 +32,10 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class PatrolInspectionEventServiceImpl extends AbstractCrudService<PatrolInspectionEventMapper, PatrolInspectionEvent> implements PatrolInspectionEventService {
+    @Autowired
+    private PatrolInspectionPlanScheduleService patrolInspectionPlanScheduleService;
+    @Autowired
+    private PatrolInspectionPersonnelService patrolInspectionPersonnelService;
 
     @Override
     public CommonPage<PatrolInspectionEvent> patrolInspectionEventList(PatrolInspectionPlanRequestVO requestVO){
@@ -42,11 +54,33 @@ public class PatrolInspectionEventServiceImpl extends AbstractCrudService<Patrol
 
     @Override
     public void add(PatrolInspectionEvent patrolInspectionEvent){
+        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());
+        }
+        patrolInspectionEvent.setHandleStatus(0);
+        patrolInspectionEvent.setTenantId(SecurityUtils.getTenantId());
+        patrolInspectionEvent.setCreateBy(SecurityUtils.getUsername());
+        patrolInspectionEvent.setCreateTime(LocalDateTime.now());
 
+        this.save(patrolInspectionEvent);
     }
 
     @Override
     public void edit(PatrolInspectionEvent patrolInspectionEvent){
+        patrolInspectionEvent.setHandleStatus(1);
+        patrolInspectionEvent.setHandleName(SecurityUtils.getUsername());
+        patrolInspectionEvent.setHandleTime(LocalDateTime.now());
+        this.updateById(patrolInspectionEvent);
 
     }