zhongrj
2024-01-12 ed28663eebdcc20325474e70be42e10e91fad930
src/main/java/org/springblade/modules/task/service/impl/TaskCampusReportingEventServiceImpl.java
@@ -16,17 +16,22 @@
 */
package org.springblade.modules.task.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springblade.common.constant.DictConstant;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.place.entity.PlaceEntity;
import org.springblade.modules.place.service.IPlaceService;
import org.springblade.modules.task.dto.TaskCampusReportingEventDTO;
import org.springblade.modules.task.entity.TaskCampusReportingEventEntity;
import org.springblade.modules.task.mapper.TaskCampusReportingEventMapper;
import org.springblade.modules.task.service.ITaskCampusReportingEventService;
import org.springblade.modules.task.service.ITaskService;
import org.springblade.modules.task.vo.TaskCampusReportingEventVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -41,18 +46,33 @@
@Service
public class TaskCampusReportingEventServiceImpl extends ServiceImpl<TaskCampusReportingEventMapper, TaskCampusReportingEventEntity> implements ITaskCampusReportingEventService {
   @Resource
   @Autowired
   @Lazy
   private ITaskService taskService;
   @Autowired
   private IPlaceService placeService;
   @Override
   public IPage<TaskCampusReportingEventVO> selectTaskCampusReportingEventPage(IPage<TaskCampusReportingEventVO> page, TaskCampusReportingEventVO taskCampusReportingEvent) {
      return page.setRecords(baseMapper.selectTaskCampusReportingEventPage(page, taskCampusReportingEvent));
   }
   /**
    * 自定义新增
    * @param reporting
    * @return
    */
   @Override
   public Boolean saveCampusReporting(TaskCampusReportingEventDTO reporting) {
      Long aLong = taskService.saveTask(1, DictConstant.CAMPUS_SECURITY_INSPECTION, 1 , "", AuthUtil.getUserId(),reporting.getHouseCode(),reporting.getReportType());
      if (aLong > 0) {
         // 通过houseCode 获取场所id
         QueryWrapper<PlaceEntity> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted",0).eq("house_code",reporting.getHouseCode());
         PlaceEntity placeEntity = placeService.getOne(queryWrapper);
         reporting.setPlaceId(placeEntity.getId());
         reporting.setTaskId(aLong);
         reporting.setCheckUserId(AuthUtil.getUserId());
         return baseMapper.insert(reporting) > 0;