| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | |
| | | |
| | | if(StringUtils.isNotBlank(ywPatrolScheme.getUserIds())){ |
| | | String [] userIds = ywPatrolScheme.getUserIds().split(","); |
| | | for (String userId:userIds) { |
| | | //添加待办信息 |
| | | Notices notices = new Notices(); |
| | | notices.setCreateDate(new Date()); |
| | | notices.setCreator(ywPatrolScheme.getCreator()); |
| | | notices.setIsdeleted(Constants.ZERO); |
| | | notices.setParam1(DateUtil.formatDate(ywPatrolTask.getStartDate(),"yyyy-MM-dd")); |
| | | notices.setTitle("巡检任务待办"); |
| | | notices.setContent("["+ywPatrolTask.getCode()+"]将在["+notices.getParam1()+"]进行巡检,请按时执行"); |
| | | notices.setObjId(ywPatrolTask.getId()); |
| | | notices.setObjType(Constants.ONE); |
| | | notices.setType(notices.getObjType()); |
| | | notices.setUserId(Integer.valueOf(userId)); |
| | | notices.setStatus(Constants.ZERO); |
| | | noticesJoinMapper.insert(notices); |
| | | List<SystemUser> systemUserList = systemUserMapper.selectList(new QueryWrapper<SystemUser>().lambda().in(SystemUser::getId,userIds)); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(systemUserList)){ |
| | | List<String> names = systemUserList.stream().filter(i->StringUtils.isNotBlank(i.getRealname())).map(i->i.getRealname()).collect(Collectors.toList()); |
| | | for (SystemUser systemUser:systemUserList) { |
| | | //添加待办信息 |
| | | Notices notices = new Notices(); |
| | | notices.setCreateDate(new Date()); |
| | | notices.setCreator(ywPatrolScheme.getCreator()); |
| | | notices.setIsdeleted(Constants.ZERO); |
| | | notices.setParam1(DateUtil.formatDate(ywPatrolTask.getStartDate(),"yyyy-MM-dd")); |
| | | notices.setTitle("巡检任务待办"); |
| | | notices.setContent("["+ywPatrolTask.getCode()+"]将在["+notices.getParam1()+"]进行巡检,请按时执行"); |
| | | notices.setObjId(ywPatrolTask.getId()); |
| | | notices.setObjType(Constants.ONE); |
| | | notices.setType(notices.getObjType()); |
| | | notices.setUserId(Integer.valueOf(systemUser.getId())); |
| | | notices.setStatus(Constants.ZERO); |
| | | //整理json数据 |
| | | Map<String,Object> jsonMap = new HashMap<>(); |
| | | jsonMap.put("key1", ywPatrolScheme.getTitle()); |
| | | jsonMap.put("key2", DateUtil.getFomartDate(ywPatrolTask.getStartDate(),"yyyy-MM-dd")); |
| | | jsonMap.put("key3", DateUtil.getFomartDate(ywPatrolTask.getStartDate(),"HH:mm") + "-" + DateUtil.getFomartDate(ywPatrolTask.getEndDate(),"HH:mm")); |
| | | jsonMap.put("key4", StringUtils.join(names , "、")); |
| | | notices.setParam2(JSONObject.toJSONString(jsonMap)); |
| | | notices.setParam3(Constants.ZERO+""); |
| | | noticesJoinMapper.insert(notices); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |