| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.HiddenDangerLogMapper; |
| | | import com.doumee.dao.business.HiddenDangerMapper; |
| | |
| | | import com.doumee.dao.business.MemberMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.system.MultifileMapper; |
| | | import com.doumee.dao.system.join.NoticesJoinMapper; |
| | | import com.doumee.dao.system.model.Multifile; |
| | | import com.doumee.dao.system.model.Notices; |
| | | import com.doumee.service.business.HiddenDangerLogService; |
| | | import com.doumee.service.business.HiddenDangerService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | private HiddenDangerLogMapper hiddenDangerLogMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private NoticesJoinMapper noticesJoinMapper; |
| | | |
| | | @Override |
| | | public Integer create(HiddenDanger hiddenDanger) { |
| | | if(Objects.isNull(hiddenDanger) |
| | |
| | | HiddenDangerParam hiddenDangerParam = hiddenDangerParamMapper.selectById(hiddenDanger.getAreaId()); |
| | | if(Objects.isNull(hiddenDangerParam)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到隐患区域"); |
| | | } |
| | | HiddenDangerParam hiddenDangerCate = hiddenDangerParamMapper.selectById(hiddenDanger.getCateId()); |
| | | if(Objects.isNull(hiddenDangerCate)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到隐患类型"); |
| | | } |
| | | hiddenDanger.setCreator(hiddenDanger.getLoginUserInfo().getId()); |
| | | hiddenDanger.setAreaName(hiddenDangerParam.getName()); |
| | |
| | | multifileMapper.insert(multifile); |
| | | } |
| | | } |
| | | String title = "[隐患随手拍]提报人-"+hiddenDanger.getLoginUserInfo().getRealname(); |
| | | //json数据 |
| | | Map<String,Object> jsonMap = new HashMap<>(); |
| | | jsonMap.put("name", "发现区域:" + hiddenDangerParam.getName()); |
| | | jsonMap.put("name", "隐患类型:" + hiddenDangerCate.getName()); |
| | | jsonMap.put("sTime", "发现时间:" + DateUtil.DateToStr(hiddenDanger.getSubmitTime() , "yyyy-MM-dd HH:mm")); |
| | | //默认生成一条 申请人的数据 标记删除状态用于处理到 任务中心(我发起)使用 |
| | | Notices createNotices = new Notices(); |
| | | createNotices.setCreateDate(new Date()); |
| | | createNotices.setIsdeleted(Constants.ONE); |
| | | createNotices.setObjId(hiddenDanger.getId()); |
| | | createNotices.setObjType(Constants.THREE); |
| | | createNotices.setType(Constants.THREE); |
| | | createNotices.setTitle(title); |
| | | createNotices.setParam1(JSONObject.toJSONString(jsonMap)); |
| | | createNotices.setStatus(Constants.ZERO); |
| | | createNotices.setReaded(Constants.ZERO); |
| | | createNotices.setSendacopy(Constants.ZERO); |
| | | createNotices.setParam2("0"); |
| | | createNotices.setParam3(hiddenDanger.getLoginUserInfo().getMemberId().toString()); |
| | | createNotices.setInfo("处理中"); |
| | | noticesJoinMapper.insert(createNotices); |
| | | |
| | | //存储处理人的通知消息 |
| | | Notices notices = new Notices(); |
| | | notices.setId(null); |
| | | notices.setCreateDate(new Date()); |
| | | notices.setIsdeleted(Constants.ZERO); |
| | | notices.setTitle(title); |
| | | notices.setParam1(JSONObject.toJSONString(jsonMap)); |
| | | notices.setParam2("0"); |
| | | notices.setObjId(hiddenDanger.getId()); |
| | | notices.setObjType(Constants.THREE); |
| | | notices.setType(Constants.THREE); |
| | | notices.setEditDate(new Date()); |
| | | notices.setUserId(hiddenDanger.getCheckUserId()); |
| | | notices.setStatus(Constants.ZERO); |
| | | notices.setSendacopy(Constants.ZERO); |
| | | notices.setReaded(Constants.ZERO); |
| | | noticesJoinMapper.insert(notices); |
| | | |
| | | |
| | | return hiddenDanger.getId(); |
| | |
| | | hiddenDangerLog.setTitle(hiddenDanger.getStatus().equals(Constants.ONE)?"隐患处理":"隐患退回"); |
| | | hiddenDangerLog.setObjType(hiddenDanger.getStatus().equals(Constants.ONE)?Constants.FOUR:Constants.TWO); |
| | | hiddenDangerLogMapper.insert(hiddenDangerLog); |
| | | //处理待办信息 |
| | | noticesJoinMapper.update(null,new UpdateWrapper<Notices>() |
| | | .lambda() |
| | | .set(Notices::getReaded,Constants.ONE) |
| | | .set(Notices::getStatus,Constants.ONE) |
| | | .set(Notices::getParam2,hiddenDanger.getStatus()) |
| | | .eq(Notices::getObjId,hiddenDanger.getId()) |
| | | .eq(Notices::getObjType,Constants.THREE) |
| | | .eq(Notices::getUserId,hiddenDanger.getLoginUserInfo().getMemberId()) |
| | | ); |
| | | |
| | | } |
| | | |
| | | private void isParamValid(HiddenDanger hiddenDanger) { |
| | |
| | | hiddenDangerLog.setHiddenDangerId(hiddenDanger.getId()); |
| | | hiddenDangerLog.setObjType(Constants.ONE); |
| | | hiddenDangerLogMapper.insert(hiddenDangerLog); |
| | | Notices notices = noticesJoinMapper.selectOne(new QueryWrapper<Notices>() |
| | | .lambda() |
| | | .eq(Notices::getObjId,hiddenDanger.getId()) |
| | | .eq(Notices::getObjType,Constants.THREE) |
| | | .eq(Notices::getUserId,hiddenDanger.getLoginUserInfo().getMemberId()) |
| | | .last(" limit 1 ") |
| | | ); |
| | | if(Objects.nonNull(notices)){ |
| | | Notices newNotices = new Notices(); |
| | | BeanUtils.copyProperties(notices,newNotices); |
| | | newNotices.setId(null); |
| | | newNotices.setCreateDate(new Date()); |
| | | newNotices.setParam2("3"); |
| | | newNotices.setUserId(hiddenDanger.getCheckUserId()); |
| | | noticesJoinMapper.insert(newNotices); |
| | | notices.setStatus(Constants.ONE); |
| | | notices.setEditDate(new Date()); |
| | | notices.setReaded(Constants.ONE); |
| | | noticesJoinMapper.updateById(notices); |
| | | } |
| | | } |
| | | |
| | | |