| | |
| | | package com.ruoyi.sy.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.client.ARDCarGPSLogInClient; |
| | | import com.ruoyi.client.ARDCarSYGPSClient; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.sy.service.IArdSyUserService; |
| | | import com.ruoyi.sy.service.SysParaService; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.utils.httpclient.SYCarClient; |
| | |
| | | |
| | | @Autowired |
| | | private ISysConfigService sysConfigService; |
| | | |
| | | private Map<Integer,Map<String,String>> logInMap = new HashMap(); |
| | | |
| | | @Autowired |
| | | private SysParaService sysParaService; |
| | | |
| | | @Autowired |
| | | private IArdSyUserService iArdSyUserService; |
| | | |
| | | /** |
| | | * 查询三一车辆列表 |
| | |
| | | } |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('sy:syCar:allListByUser')") |
| | | @PostMapping("allListByUser") |
| | | @ApiOperation("根据用户获取三一列表") |
| | | public Map<String,Object> allListByUser(){ |
| | | String usersId = SecurityUtils.getUserId(); |
| | | Map<String, String> result = logInMap.get(Integer.parseInt(usersId)); |
| | | String syURL = sysParaService.getSYURL(); |
| | | if(result == null){ |
| | | Map<String,Object> m = iArdSyUserService.selectArdSyUserByUsersId(Integer.parseInt(usersId)); |
| | | if(m == null){ |
| | | Map<String,Object> map0 = new HashMap(); |
| | | map0.put("rspDesc", "当前登录用户未挂接车辆权限"); |
| | | map0.put("rspCode", "0"); |
| | | return map0; |
| | | } |
| | | Map<String, Object> result0 = ARDCarGPSLogInClient.loginIn(syURL,(String) m.get("userId"), (String) m.get("password")); |
| | | result = new HashMap(); |
| | | result.put("userId", (String) m.get("userId")); |
| | | result.put("sessionId", (String) result0.get("sessionId")); |
| | | } |
| | | Map<String,Object> result0 = new HashMap(); |
| | | try { |
| | | result0 = ARDCarSYGPSClient.getCarGPSTeamList(syURL,result.get("userId"),result.get("sessionId"));// |
| | | } catch (Exception e) { |
| | | Map<String,Object> map = new HashMap(); |
| | | map.put("rspCode", 0); |
| | | map.put("list", new ArrayList()); |
| | | return map; |
| | | } |
| | | int online = 0; |
| | | for(Map<String,Object> map : (List<Map<String,Object>>) result0.get("list")){ |
| | | Map<String,Object> resultMap = (Map<String, Object>) ARDCarSYGPSClient.getCarListByTeamId(syURL,(String)map.get("teamId"),result.get("sessionId")); |
| | | List<Map<String,Object>> carList = (List<Map<String, Object>>) resultMap.get("carList"); |
| | | for(Map<String,Object> m : carList){ |
| | | if(((String) m.get("stateCn")).contains("在线")){ |
| | | online = online + 1; |
| | | }else{ |
| | | continue; |
| | | } |
| | | } |
| | | for(Map<String,Object> m : (List<Map<String,Object>>) result0.get("list")){ |
| | | if(((String) m.get("teamId")).equals(((String) map.get("teamId")))){ |
| | | map.put("count", Integer.parseInt((String) m.get("carNum"))); |
| | | } |
| | | } |
| | | map.put("online", online); |
| | | online = 0; |
| | | } |
| | | return result0; |
| | | } |
| | | } |