| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.constant.CommonConstant; |
| | | import org.springblade.common.constant.DictConstant; |
| | | import org.springblade.common.param.CommonParamSet; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | |
| | | |
| | | @Override |
| | | public IPage<TaskPlaceSelfCheckVO> selectTaskPlaceSelfCheckPage(IPage<TaskPlaceSelfCheckVO> page, TaskPlaceSelfCheckVO taskPlaceSelfCheck) { |
| | | return page.setRecords(baseMapper.selectTaskPlaceSelfCheckPage(page, taskPlaceSelfCheck)); |
| | | // 公共参数设置 |
| | | CommonParamSet commonParamSet = new CommonParamSet().invoke(TaskPlaceSelfCheckVO.class,taskPlaceSelfCheck); |
| | | List<TaskPlaceSelfCheckVO> placeCheckVOS = baseMapper.selectTaskPlaceSelfCheckPage(page, |
| | | taskPlaceSelfCheck, |
| | | commonParamSet.getIsAdministrator(), |
| | | commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getGridCodeList()); |
| | | for (TaskPlaceSelfCheckVO placeCheckVO : placeCheckVOS) { |
| | | int number = 0; |
| | | for (TaskPlaceRecordVO patrolRecord : placeCheckVO.getTaskPlaceRecordVOList()) { |
| | | if (patrolRecord.getState().equals(0)) { |
| | | number++; |
| | | } |
| | | } |
| | | placeCheckVO.setNumber(number); |
| | | } |
| | | return page.setRecords(placeCheckVOS); |
| | | } |
| | | |
| | | /** |
| | | * 查询消防自查记任务表 |
| | | * |
| | | * @param id 消防自查记任务表ID |
| | | * @param taskPlaceSelfCheck 消防自查记任务表ID |
| | | * @return 消防自查记任务表 |
| | | */ |
| | | @Override |
| | | public TaskPlaceSelfCheckDTO selectTaskPlaceSelfCheckById(Long id) { |
| | | return this.baseMapper.selectTaskPlaceSelfCheckById(id); |
| | | public TaskPlaceSelfCheckDTO selectTaskPlaceSelfCheckById(TaskPlaceSelfCheckEntity taskPlaceSelfCheck) { |
| | | return this.baseMapper.selectTaskPlaceSelfCheckById(taskPlaceSelfCheck); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 1.保存任务表 |
| | | ITaskService bean2 = SpringUtils.getBean(ITaskService.class); |
| | | Long aLong = bean2.saveTask(CommonConstant.NUMBER_ONE, DictConstant.FIRE_SELF_CHECK_NOTICE, 1, |
| | | "", AuthUtil.getUserId(), taskPlaceSelfCheck.getHouseCode(), CommonConstant.NUMBER_TWO, 4); |
| | | "", AuthUtil.getUserId(), taskPlaceSelfCheck.getHouseCode(), CommonConstant.NUMBER_TWO, 1); |
| | | if (aLong <= 0) { |
| | | return false; |
| | | } |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean updateTaskPlaceSelfCheck(TaskPlaceSelfCheckVO taskPlaceSelfCheck) throws Exception { |
| | | // 1.更新任务表 |
| | | ITaskService bean2 = SpringUtils.getBean(ITaskService.class); |
| | | Long aLong = bean2.updateTask(null, null, null, taskPlaceSelfCheck.getReasonFailure(), AuthUtil.getUserId(), taskPlaceSelfCheck.getTaskId(), taskPlaceSelfCheck.getStatus()); |
| | | ITaskService taskService = SpringUtils.getBean(ITaskService.class); |
| | | Long aLong = taskService.updateTask(null, null, null, taskPlaceSelfCheck.getReasonFailure(), AuthUtil.getUserId(), taskPlaceSelfCheck.getTaskId(), taskPlaceSelfCheck.getStatus()); |
| | | if (aLong <= 0) { |
| | | return false; |
| | | } |
| | |
| | | if (save) { |
| | | // 3.更新题目记录 |
| | | List<TaskPlaceRecordVO> taskPlaceRecordList = taskPlaceSelfCheck.getTaskPlaceRecordVOList(); |
| | | ITaskPlaceRecordService bean = SpringUtil.getBean(ITaskPlaceRecordService.class); |
| | | List<TaskPlaceRecordEntity> collect = taskPlaceRecordList.stream().filter(item -> item.getState().equals(0)).collect(Collectors.toList()); |
| | | boolean b = bean.updateBatchById(collect); |
| | | if (b) { |
| | | return b; |
| | | if (taskPlaceRecordList != null && taskPlaceRecordList.size() > 0) { |
| | | ITaskPlaceRecordService bean = SpringUtil.getBean(ITaskPlaceRecordService.class); |
| | | List<TaskPlaceRecordEntity> copy = BeanUtil.copy(taskPlaceRecordList, TaskPlaceRecordEntity.class); |
| | | boolean b = bean.saveOrUpdateBatch(copy); |
| | | if (b) { |
| | | return b; |
| | | } |
| | | throw new Exception("保存失败!"); |
| | | } |
| | | throw new Exception("保存失败!"); |
| | | return save; |
| | | } |
| | | throw new Exception("保存失败!"); |
| | | } |