| | |
| | | import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
| | | import org.springblade.common.constant.CommonConstant; |
| | | import org.springblade.common.constant.DictConstant; |
| | | import org.springblade.common.exception.CustomException; |
| | | import org.springblade.common.param.CommonParamSet; |
| | | import org.springblade.common.utils.AuthUtils; |
| | | import org.springblade.common.utils.SpringUtils; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean savePlace(TaskPlaceSelfCheckVO taskPlaceSelfCheck) throws Exception { |
| | | public Boolean savePlace(TaskPlaceSelfCheckVO taskPlaceSelfCheck) { |
| | | taskPlaceSelfCheck.setCreateUser(AuthUtil.getUserId()); |
| | | // 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, 1); |
| | | if (aLong <= 0) { |
| | | ITaskService iTaskService = SpringUtils.getBean(ITaskService.class); |
| | | Long restults; |
| | | if (taskPlaceSelfCheck.getType().equals("2")) { |
| | | restults = iTaskService.saveTask(CommonConstant.NUMBER_ONE, DictConstant.FIRE_SCHOOL_CHECK_NOTICE, 1, |
| | | "", AuthUtil.getUserId(), taskPlaceSelfCheck.getHouseCode(), CommonConstant.NUMBER_FOUR, 1); |
| | | } else { |
| | | restults = iTaskService.saveTask(CommonConstant.NUMBER_ONE, DictConstant.FIRE_SELF_CHECK_NOTICE, 1, |
| | | "", AuthUtil.getUserId(), taskPlaceSelfCheck.getHouseCode(), CommonConstant.NUMBER_SEVEN, 1); |
| | | } |
| | | if (restults <= 0) { |
| | | return false; |
| | | } |
| | | taskPlaceSelfCheck.setTaskId(aLong); |
| | | taskPlaceSelfCheck.setTaskId(restults); |
| | | // 2.保存任务详情 |
| | | boolean save = save(taskPlaceSelfCheck); |
| | | if (save) { |
| | |
| | | taskPlaceRecordList.stream().forEach(item -> { |
| | | item.setTaskPlaceSelfCheckId(taskPlaceSelfCheck.getId()); |
| | | item.setCreateUser(AuthUtil.getUserId()); |
| | | item.setType("1"); |
| | | }); |
| | | List<TaskPlaceRecordEntity> collect = taskPlaceRecordList.stream().filter(item -> item.getState().equals(0)).collect(Collectors.toList()); |
| | | if (collect.size() > 0) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean updateTaskPlaceSelfCheck(TaskPlaceSelfCheckVO taskPlaceSelfCheck) throws Exception { |
| | | @Transactional |
| | | public Boolean updateTaskPlaceSelfCheck(TaskPlaceSelfCheckVO taskPlaceSelfCheck) { |
| | | // 1.更新任务表 |
| | | ITaskService taskService = SpringUtils.getBean(ITaskService.class); |
| | | Long aLong = taskService.updateTask(null, null, null, taskPlaceSelfCheck.getReasonFailure(), AuthUtil.getUserId(), taskPlaceSelfCheck.getTaskId(), taskPlaceSelfCheck.getStatus()); |
| | |
| | | if (b) { |
| | | return b; |
| | | } |
| | | throw new Exception("保存失败!"); |
| | | throw new CustomException("保存失败!"); |
| | | } |
| | | return save; |
| | | } |
| | | throw new Exception("保存失败!"); |
| | | throw new CustomException("保存失败!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer getCount(String neiCode, int i) { |
| | | public Integer getCount(String neiCode, int status, int type) { |
| | | // 获取请求头中的角色别名 |
| | | String roleName = SpringUtils.getRequestParam("roleName"); |
| | | if (AuthUtils.isMj(roleName)) { |
| | | return baseMapper.getCount(neiCode, i, AuthUtil.getUserId()); |
| | | return baseMapper.getCount(neiCode, status, AuthUtil.getUserId(), type); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public TaskPlaceSelfCheckEntity getDetailByTaskId(Long taskId) { |
| | | return baseMapper.getDetailByTaskId(taskId); |
| | | } |
| | | } |