| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dtflys.forest.annotation.Var; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ruoyi.app.application.domain.ArdAppApplication; |
| | | import com.ruoyi.app.application.mapper.ArdAppApplicationMapper; |
| | | import com.ruoyi.app.position.mapper.ArdAppPositionMapper; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | |
| | | import com.ruoyi.sy.domain.ArdAccessFence; |
| | | import com.ruoyi.sy.param.ArdSyCarParam; |
| | | import com.ruoyi.sy.vo.ArdSyCarVo; |
| | | import com.ruoyi.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.utils.gis.GisUtil; |
| | | import com.ruoyi.utils.gis.Point; |
| | | import com.ruoyi.scheduling.domian.SchedulingParam; |
| | |
| | | RedisCache redisCache; |
| | | @Resource |
| | | private ArdSyCarDayMapper ardSyCarDayMapper; |
| | | |
| | | @Resource |
| | | private ArdAppApplicationMapper ardAppApplicationMapper; |
| | | |
| | | @Resource |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | | @Value("${minio.endpoint}") |
| | | private String minioEndpoint; |
| | |
| | | return sYClient.getAlarmHPfmCountDetail(syURL,carId,sessionId,startTime,endTime); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getOnlineSYCarPosition(String soilderId) { |
| | | Map<String,Object> result = new HashMap(); |
| | | ArdSyUser ardSyUserPara = new ArdSyUser(); |
| | | ardSyUserPara.setSysUserId(soilderId); |
| | | List<ArdSyUser> ardSyUserList = ardSyUserMapper.selectArdSyUserList(ardSyUserPara); |
| | | if(ardSyUserList.size() == 0){ |
| | | result.put("code","0"); |
| | | result.put("msg","登录用户未挂接三一车辆账号"); |
| | | result.put("SYCarPositionList",new ArrayList()); |
| | | return result; |
| | | } |
| | | ArdAppApplication ardAppApplicationPara = new ArdAppApplication(); |
| | | ardAppApplicationPara.setSoilderId(soilderId); |
| | | ardAppApplicationPara.setApplicationType("SYCar"); |
| | | ardAppApplicationPara.setState("1"); |
| | | List<ArdAppApplication> ardAppApplicationList = ardAppApplicationMapper.selectArdAppApplicationList(ardAppApplicationPara); |
| | | if(ardAppApplicationList.size() == 0){ |
| | | result.put("code","0"); |
| | | result.put("msg","登录用户未经指挥端同意"); |
| | | result.put("SYCarPositionList",new ArrayList()); |
| | | return result; |
| | | } |
| | | SysUser sysUser = userMapper.selectUserById(soilderId);//获取系统用户 |
| | | List<Long> deptIdList = new ArrayList(); |
| | | deptIdList.add(sysUser.getDeptId()); |
| | | deptIdList = getOwnAndChildrenDeptIdList(deptIdList,new ArrayList());//递归查询下属部门主键 |
| | | List<String> carIdList = ardSyCarMapper.selectArdSyCarByDeptIds(deptIdList); |
| | | String carIds = ""; |
| | | for(String carId : carIdList){ |
| | | carIds = carIds + carId + ","; |
| | | } |
| | | carIds = carIds.substring(0,carIds.length() - 1); |
| | | String syURL = ""; |
| | | List<SysConfig> sysConfigResult = sysConfigMapper.selectByType("syCarPT"); |
| | | if(sysConfigResult.size() > 0){ |
| | | syURL = sysConfigResult.get(0).getConfigValue(); |
| | | }else{ |
| | | result.put("code","0"); |
| | | result.put("msg","三一车辆url没有录入"); |
| | | result.put("SYCarPositionList",new ArrayList()); |
| | | return result; |
| | | } |
| | | String passwordMd5 = DigestUtils.md5Hex(ardSyUserList.get(0).getPassword()); |
| | | Map<String,Object> syLoginResult = sYClient.logIn(syURL, passwordMd5, ardSyUserList.get(0).getUserId()); |
| | | String sessionId = (String) syLoginResult.get("sessionId"); |
| | | Map<String,Object> carNearPositionResult = sYClient.getCarNearPositionByCarId(syURL, carIds, ardSyUserList.get(0).getUserId(),sessionId); |
| | | if(((String)carNearPositionResult.get("rspCode")).equals("1")){ |
| | | result.put("code","1"); |
| | | result.put("msg","三一车辆查询成功"); |
| | | List<Map<String,Object>> SYCarPositionList = (List<Map<String, Object>>) carNearPositionResult.get("list"); |
| | | //筛选在线 |
| | | SYCarPositionList = SYCarPositionList.stream().filter(map -> ((String)map.get("stateCn")).startsWith("在线")).collect(Collectors.toList()); |
| | | for(Map<String,Object> sycar : SYCarPositionList){ |
| | | Map<String,Object> map = ardSyCarMapper.getArdSyCarAndDeptByCarId((String)sycar.get("carId")); |
| | | sycar.putAll(map); |
| | | } |
| | | result.put("SYCarPositionList",SYCarPositionList); |
| | | return result; |
| | | }else{ |
| | | result.put("code","0"); |
| | | result.put("msg","三一车辆查询失败"); |
| | | result.put("SYCarPositionList",new ArrayList()); |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | public List<Long> getOwnAndChildrenDeptIdList(List<Long> deptIdList,List<Long> deptIdListr){ |
| | | deptIdListr.addAll(deptIdList); |
| | | List<Long> result = sysDeptMapper.getChildrenDeptIdList(deptIdList); |
| | | if(result.size() != 0){ |
| | | deptIdListr.addAll(result); |
| | | result = getOwnAndChildrenDeptIdList(result,deptIdListr); |
| | | } |
| | | deptIdListr = deptIdListr.stream().distinct().collect(Collectors.toList()); |
| | | return deptIdListr; |
| | | } |
| | | } |