| | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.constant.LogOpEnum; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.StateDto; |
| | | import com.whyc.mapper.CKPowerDevBattSetLogMapper; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattSetLog; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class CKPowerDevBattSetLogService { |
| | |
| | | |
| | | //获取核容装置日志 |
| | | public Response getBattSetLog(CKPowerDevBattSetLog battSetLog) { |
| | | PageHelper.startPage(battSetLog.getPageCurr(),battSetLog.getPageSize()); |
| | | PageHelper.startPage(battSetLog.getPageNum(),battSetLog.getPageSize()); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | if(battSetLog.getDevType()!=null&&!battSetLog.getDevType().equals("")){ |
| | | wrapper.eq("dev_type",battSetLog.getDevType()); |
| | | } |
| | | if(battSetLog.getCmdType()!=null&&battSetLog.getCmdType()!=-1){ |
| | | wrapper.eq("cmd_type",battSetLog.getDevType()); |
| | | wrapper.eq("cmd_type",battSetLog.getCmdType()); |
| | | } |
| | | if(battSetLog.getParamCn()!=null){ |
| | | wrapper.eq("param_cn",battSetLog.getDevType()); |
| | | /*if(battSetLog.getParamCn()!=null){ |
| | | wrapper.eq("param_cn",battSetLog.getParamCn()); |
| | | }*/ |
| | | if(battSetLog.getBattIndex()!=null){ |
| | | wrapper.eq("batt_index",battSetLog.getBattIndex()); |
| | | } |
| | | if(battSetLog.getCreateTime()!=null&&!battSetLog.getCreateTime().equals("")){ |
| | | wrapper.ge("create_time",battSetLog.getCreateTime()); |
| | |
| | | List<CKPowerDevBattSetLog> list=mapper.selectList(wrapper); |
| | | list.forEach(log->{ |
| | | log.setCmdName(LogOpEnum.getValueByKey(log.getCmdType())); |
| | | if(log.getParam().equals("testStopTypeSt")){ |
| | | log.setValueName(StateDto.getStopReason(Integer.valueOf(log.getValue()))); |
| | | } |
| | | if(log.getParam().equals("devWorkStateSt")){ |
| | | log.setValueName(StateDto.getWorkState(Integer.valueOf(log.getValue()))); |
| | | } |
| | | if(log.getParam().equals("currDirSt")){ |
| | | log.setValueName(StateDto.getBattState(Integer.valueOf(log.getValue()))); |
| | | } |
| | | }); |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,pageInfo,"获取核容装置日志"); |
| | |
| | | public void add(CKPowerDevBattSetLog log) { |
| | | mapper.insert(log); |
| | | } |
| | | |
| | | //获取核容装置控制列表 |
| | | public Response getOpInfo() { |
| | | Map<Integer,String> map=LogOpEnum.getOpInfo(); |
| | | return new Response().setII(1,true,map,"获取核容装置控制列表"); |
| | | } |
| | | } |