| | |
| | | package org.springblade.modules.task.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springblade.common.constant.DictConstant; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.category.entity.CategoryEntity; |
| | | import org.springblade.modules.category.service.ICategoryService; |
| | | import org.springblade.modules.house.service.IHouseRentalService; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.house.vo.HouseRentalTenantVO; |
| | | import org.springblade.modules.place.service.IPlaceExtService; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.task.entity.*; |
| | |
| | | import org.springblade.modules.task.vo.TaskVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 任务表 服务实现类 |
| | |
| | | @Service |
| | | public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> implements ITaskService { |
| | | |
| | | // @Autowired |
| | | // private ITaskReportForRepairsService iTaskReportForRepairsService; |
| | | @Autowired |
| | | private IPlaceService placeService; |
| | | |
| | | @Autowired |
| | | private IHouseholdService iHouseholdService; |
| | |
| | | @Autowired |
| | | private IHouseRentalService iHouseRentalService; |
| | | |
| | | |
| | | @Autowired |
| | | private IDeptService deptService; |
| | | |
| | | @Autowired |
| | | private ICategoryService categoryService; |
| | | |
| | | @Autowired |
| | | private ITaskCampusReportingEventService taskCampusReportingEventService; |
| | | |
| | | @Override |
| | | public IPage<TaskVO> selectTaskPage(IPage<TaskVO> page, TaskVO task) { |
| | |
| | | |
| | | return update1; |
| | | } |
| | | |
| | | /** |
| | | * 根据类型创建任务 |
| | | * @param reportType 任务/事件类型 |
| | | * @param color 参数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean createTaskJob(Integer reportType, String color) { |
| | | boolean flag = false; |
| | | if (reportType==6){ |
| | | // 校园安全自查,查询标签为教育的场所 parentNo = 1601 |
| | | String parentNo = "1601"; |
| | | QueryWrapper<CategoryEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted",0).eq("parent_no",parentNo); |
| | | List<CategoryEntity> categoryEntityList = categoryService.list(wrapper); |
| | | // 取出编号集合 |
| | | List<String> stringList = categoryEntityList.stream().map(categoryEntity -> categoryEntity.getCategoryNo()).collect(Collectors.toList()); |
| | | // 根据编号集合查询对应的场所 |
| | | List<PlaceVO> placeVOList = placeService.getPlaceListByParam(stringList,color); |
| | | // 生成任务 |
| | | for (PlaceVO placeVO : placeVOList) { |
| | | TaskEntity taskEntity = new TaskEntity(); |
| | | taskEntity.setType(1); |
| | | taskEntity.setName(DictConstant.CAMPUS_SECURITY_INSPECTION); |
| | | taskEntity.setFrequency(2); |
| | | taskEntity.setCreateTime(new Date()); |
| | | taskEntity.setHouseCode(placeVO.getHouseCode()); |
| | | taskEntity.setReportType(reportType); |
| | | // 新增 |
| | | flag = save(taskEntity); |
| | | // 同时新增校园安全检查任务 |
| | | TaskCampusReportingEventEntity campusReportingEventEntity = new TaskCampusReportingEventEntity(); |
| | | campusReportingEventEntity.setTaskId(taskEntity.getId()); |
| | | campusReportingEventEntity.setPlaceId(placeVO.getId()); |
| | | campusReportingEventEntity.setCheckUserId(placeVO.getPrincipalUserId()); |
| | | campusReportingEventEntity.setCheckUserName(placeVO.getPrincipal()); |
| | | campusReportingEventEntity.setCheckTelephone(placeVO.getPrincipalPhone()); |
| | | // 系统下发 |
| | | campusReportingEventEntity.setSource(2); |
| | | // 新增 |
| | | taskCampusReportingEventService.save(campusReportingEventEntity); |
| | | } |
| | | } |
| | | return flag; |
| | | } |
| | | } |