| | |
| | | |
| | | import java.util.*; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.ruoyi.common.core.domain.entity.SysConfig; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.sy.domain.ArdSyUser; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getLockByCarPlate(String usersId, String carPlate) { |
| | | List<ArdTankLock> ardTankLockList = ardTankLockMapper.getAll(); |
| | | public Map<String,Object> getLockByCarPlate(String usersId, String carPlate, Integer pageNum, Integer pageSize) { |
| | | ArdSyUser ardSyUser = ardSyUserMapper.userById(usersId); |
| | | if(ardSyUser == null){ |
| | | return new ArrayList(); |
| | | return new HashMap(); |
| | | } |
| | | List<SysConfig> syURLResult = sysConfigMapper.selectByType("syCarPT"); |
| | | String syURL = ""; |
| | | if(syURLResult.size() != 0){ |
| | | syURL = syURLResult.get(0).getConfigValue(); |
| | | }else{ |
| | | return new ArrayList(); |
| | | return new HashMap(); |
| | | } |
| | | String passwordMd5 = DigestUtils.md5Hex(ardSyUser.getPassword()); |
| | | Map<String, Object> LogInResult = sYClient.logIn(syURL, passwordMd5, ardSyUser.getUserId()); |
| | | String sessionId = (String) LogInResult.get("sessionId"); |
| | | //List<ArdTankLock> ardTankLockList = ardTankLockMapper.getAll(); |
| | | List<ArdTankLock> ardTankLockList = new ArrayList(); |
| | | List<Map<String,Object>> result = new ArrayList(); |
| | | List<String> carIdList = new ArrayList();//记录三一车辆主键 |
| | | if(!carPlate.equals("")){ |
| | | Map<String,Object> carMap = sYClient.getCarListByPlate(syURL,carPlate,ardSyUser.getUserId(),sessionId);//车牌号模糊搜索车辆 |
| | | List<Map<String,Object>> carList = new ArrayList(); |
| | | if(((String)carMap.get("rspCode")).equals("1")){ |
| | | carList = (List<Map<String, Object>>) carMap.get("list"); |
| | | }else{ |
| | | return new ArrayList(); |
| | | return new HashMap(); |
| | | } |
| | | List<String> carIdList = new ArrayList();//记录三一车辆主键 |
| | | //List<String> carIdList = new ArrayList();//记录三一车辆主键 |
| | | for(Map<String,Object> map : carList){ |
| | | carIdList.add((String) map.get("carId")); |
| | | } |
| | | PageHelper.startPage(pageNum, pageSize);//分页 |
| | | ardTankLockList = ardTankLockMapper.getLockByCarIdList(carIdList); |
| | | for(ArdTankLock ardTankLock : ardTankLockList){ |
| | | if(carIdList.contains(ardTankLock.getCarId())){//返回的车辆包含数据库录入的车辆 |
| | | Map<String,Object> map = new HashMap(); |
| | |
| | | } |
| | | } |
| | | }else{ |
| | | PageHelper.startPage(pageNum, pageSize);//分页 |
| | | ardTankLockList = ardTankLockMapper.getAll(); |
| | | for(ArdTankLock ardTankLock : ardTankLockList){ |
| | | Map<String,Object> map = new HashMap(); |
| | | map.put("id",ardTankLock.getId()); |
| | |
| | | result.add(map); |
| | | } |
| | | } |
| | | return result; |
| | | Long total = Long.valueOf(0); |
| | | if(!carPlate.equals("")){ |
| | | total = ardTankLockMapper.selectArdTankLockTotalByCarIdList(carIdList); |
| | | }else{ |
| | | total = ardTankLockMapper.selectArdTankLockAllTotal(); |
| | | } |
| | | Map<String,Object> mapResult = new HashMap(); |
| | | mapResult.put("list",result); |
| | | mapResult.put("total",total); |
| | | return mapResult; |
| | | } |
| | | } |