| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.UserInfMapper; |
| | | import com.whyc.mapper.UserWorkMapper; |
| | | import com.whyc.mapper.WorkAlarmMapper; |
| | | import com.whyc.mapper.WorkflowAlarmMapper; |
| | | import com.whyc.pojo.BattDevAlarmData; |
| | | import com.whyc.pojo.BattalarmData; |
| | | import com.whyc.pojo.UserWork; |
| | | import com.whyc.pojo.WorkAlarm; |
| | | import com.whyc.util.RSAUtil; |
| | | import com.whyc.pojo.*; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | private WorkAlarmMapper mapper; |
| | | @Resource |
| | | private UserWorkMapper userWorkMapper; |
| | | @Resource |
| | | private UserInfMapper userInfMapper; |
| | | |
| | | public Response searchByUserIdAndStatus(int pageNum,int pageSize,Integer uId,Integer status){ |
| | | public Response searchByUserIdAndStatus(int pageNum,int pageSize,Integer uId,Integer note){ |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | //Integer status = null; |
| | | ////查询全部列表 |
| | | //if(pageInfo.getNote()==1){ |
| | | // status = null; |
| | | //} |
| | | ////查询待处理列表 |
| | | //else if(pageInfo.getNote()==2){ |
| | | // status = 1; |
| | | //} |
| | | ////查询处理中列表 |
| | | //else if(pageInfo.getNote()==3){ |
| | | // status = 2; |
| | | //} |
| | | ////查询已完成列表 |
| | | //else if(pageInfo.getNote()==4){ |
| | | // status = 3; |
| | | //} |
| | | Integer status = null; |
| | | //查询全部列表 |
| | | if(note==1){ |
| | | status = null; |
| | | } |
| | | //查询待处理列表 |
| | | else if(note==2){ |
| | | status = 1; |
| | | } |
| | | //查询处理中列表 |
| | | else if(note==3){ |
| | | status = 2; |
| | | } |
| | | //查询已完成列表 |
| | | else if(note==4){ |
| | | status = 3; |
| | | } |
| | | List<WorkAlarm> list = mapper.searchByUserIdAndStatus(uId,status); |
| | | PageInfo pageInfo = new PageInfo(list); |
| | | return new Response().set(1,pageInfo,"查询成功"); |
| | |
| | | |
| | | public Response searchById(int id){ |
| | | WorkAlarm result = mapper.selectById(id); |
| | | if (result.getUserId()!=null && result.getUserId()!=0){ |
| | | UserInf userInf = userInfMapper.selectById(result.getUserId()); |
| | | result.setUserName(userInf.getUName()); |
| | | } |
| | | //去告警表查询是否存在 |
| | | int flag = 1; |
| | | if (result.getAlarmRecordId()==null){ |
| | | if (result.getAlarmRecId()==null){ |
| | | flag = 0; |
| | | } |
| | | boolean bl = alarmIsExist(result.getAlarmRecId(),result.getAlarmRecordId()); |
| | | boolean bl = alarmIsExist(result.getAlarmRecId()); |
| | | if (!bl){ |
| | | flag = 0; |
| | | } |
| | |
| | | return new Response().set(1,result,"查询成功"); |
| | | } |
| | | |
| | | public boolean alarmIsExist(int num,long recordId){ |
| | | public boolean alarmIsExist(int num){ |
| | | boolean bl = false; |
| | | List<BattalarmData> list = mapper.getBattAlarm(num,recordId); |
| | | List<BattalarmData> list = mapper.getBattAlarm(num); |
| | | if (list != null && list.size() > 0) { |
| | | bl = true; |
| | | } |
| | | List<BattDevAlarmData> list2 = mapper.getDevAlarm(num,recordId); |
| | | List<BattDevAlarmData> list2 = mapper.getDevAlarm(num); |
| | | if (list2 != null && list2.size() > 0) { |
| | | bl = true; |
| | | } |
| | |
| | | Integer status = null; |
| | | Integer checkStatus = null; |
| | | //查询未派单列表 |
| | | if(note==1){ |
| | | if (note == 1) { |
| | | status = 0; |
| | | //此时还没生成user_work表记录 |
| | | checkStatus = null; |
| | | } |
| | | //查询已派单列表 |
| | | else if(note==2){ |
| | | else if (note == 2) { |
| | | status = 1; |
| | | checkStatus = null; |
| | | } |
| | | //查询待审核列表 |
| | | else if(note==3){ |
| | | else if (note == 3) { |
| | | status = 2; |
| | | checkStatus = 2; |
| | | } |
| | | //查询已完成列表 |
| | | else if(note==4){ |
| | | else if (note == 4) { |
| | | status = 3; |
| | | checkStatus = 3; |
| | | } |
| | | List<WorkAlarm> list = mapper.getTaskListWithFlag(uId,status,checkStatus); |
| | | List<WorkAlarm> list = mapper.getTaskListWithFlag(uId, status, checkStatus); |
| | | PageInfo pageInfo = new PageInfo(list); |
| | | return new Response().set(1,pageInfo,"查询成功"); |
| | | return new Response().set(1, pageInfo, "查询成功"); |
| | | } |
| | | |
| | | public Response getTaskListWithFlagNew(Integer uId, Integer note, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | Integer status = null; |
| | | Integer checkStatus = null; |
| | | //查询未派单列表 |
| | | if (note == 1) { |
| | | status = 0; |
| | | //此时还没生成user_work表记录 |
| | | checkStatus = null; |
| | | } |
| | | //查询已派单列表 |
| | | else if (note == 2) { |
| | | status = 1; |
| | | checkStatus = null; |
| | | } |
| | | //查询待审核列表 |
| | | else if (note == 3) { |
| | | status = 2; |
| | | checkStatus = 2; |
| | | } |
| | | //查询已完成列表 |
| | | else if (note == 4) { |
| | | status = 3; |
| | | checkStatus = 3; |
| | | } |
| | | List<WorkAlarm> list = mapper.getTaskListWithFlagNew(uId, status, checkStatus); |
| | | PageInfo pageInfo = new PageInfo(list); |
| | | return new Response().set(1, pageInfo, "查询成功"); |
| | | } |
| | | |
| | | |
| | | public Response dispatchTask(){ |
| | | |
| | | return null; |
| | | public Response dispatchTask(List<WorkAlarm> alarmList) { |
| | | for (WorkAlarm alarm : alarmList) { |
| | | mapper.dispatchTask(alarm); |
| | | } |
| | | return new Response().set(1, true, "更新完成"); |
| | | } |
| | | |
| | | |