| | |
| | | AccountService accountService; |
| | | @Resource |
| | | DictionaryDataService dictionaryDataService; |
| | | @Resource |
| | | OrganizationService organizationService; |
| | | @Resource |
| | | WebTokenService webTokenService; |
| | |
| | | public ResultBean<List<WebProvince>> add(HttpServletRequest request) { |
| | | String token = request.getHeader("token"); |
| | | List<WebProvince> mapPath = mapPathService.getMapPath(token); |
| | | if (ObjectUtils.isEmpty(mapPath)) |
| | | return new ResultBean<>("获取地图信息失败", ResultBean.FAIL); |
| | | return new ResultBean<>(mapPath); |
| | | } |
| | | |
| | | @GetMapping("redisTest") |
| | | public ResultBean<List<WebProvince>> redisTest(HttpServletRequest request) { |
| | | String token = request.getHeader("token"); |
| | | List<WebProvince> mapPath = mapPathService.getMapPath(token); |
| | | if (ObjectUtils.isEmpty(mapPath)) |
| | | return new ResultBean<>("获取地图信息失败", ResultBean.FAIL); |
| | | return new ResultBean<>(mapPath); |
| | | } |
| | | |
| | | @GetMapping("sqlTest") |
| | | public ResultBean<List<WebProvince>> sqlTest(HttpServletRequest request) { |
| | | String token = request.getHeader("token"); |
| | | List<WebProvince> mapPath = mapPathService.getMapPathTest(token); |
| | | if(ObjectUtils.isEmpty(mapPath)) |
| | | return new ResultBean<>("获取地图信息失败",ResultBean.FAIL); |
| | | return new ResultBean<>(mapPath); |
| | |
| | | return resultMap; |
| | | } |
| | | |
| | | /** |
| | | * @Description: |
| | | * @Param: [request] |
| | | * @return: java.util.Map<java.lang.String , java.lang.Object> |
| | | * @Author: 下雨听风 |
| | | * @Date: 2020/10/19 |
| | | */ |
| | | |
| | | @UserLoginToken |
| | | @GetMapping("getAccountInfo") |
| | | public Map<String, Object> getAccountInfo(HttpServletRequest request) { |
| | |
| | | throw new WebAuthException("401,token无效"); |
| | | } |
| | | Map<String, Object> resultMap = accountService.getAccountInfoById(id); |
| | | Object orgId = resultMap.get("orgId"); |
| | | if (resultMap.get("orgId") != null && resultMap.get("orgId") instanceof Integer) { |
| | | StringBuilder areaNamesBuilder = new StringBuilder("中国"); |
| | | //判断是否为本公司开发者 |
| | | if (!((Integer) orgId).equals(dictionaryDataService.querySupperOrgId())) { |
| | | //不是本公司开发者则获取用户所属地区 |
| | | Organization organization = organizationService.getOrganizationById((Integer) orgId); |
| | | if (organization.getAreaNames() != null) { |
| | | Map<String, String> areaNameMap = BeanUtils.beanToMap(organization.getAreaNames()); |
| | | List<String> names = areaNameMap.entrySet().stream().filter(item -> { |
| | | return item.getValue() != null; |
| | | }).map(item -> { |
| | | return item.getValue(); |
| | | }).collect(Collectors.toList()); |
| | | AreaNames areaNames = organization.getAreaNames(); |
| | | areaNamesBuilder.append("/"); |
| | | areaNamesBuilder.append(String.join("/", names)); |
| | | } |
| | | // 企业用户 |
| | | if (organization.getRank() != null && organization.getRank() == 0) { |
| | | resultMap.put("type", "enterprise"); |
| | | } else { |
| | | resultMap.put("type", "government"); |
| | | } |
| | | Number mapAreaCode = null; |
| | | if (organization.getVillageCode() != null) { |
| | | mapAreaCode = organization.getVillageCode(); |
| | | } else if (organization.getTownCode() != null) { |
| | | mapAreaCode = organization.getTownCode(); |
| | | } else if (organization.getAreaCode() != null) { |
| | | mapAreaCode = organization.getAreaCode(); |
| | | } else if (organization.getCityCode() != null) { |
| | | mapAreaCode = organization.getCityCode(); |
| | | } else if (organization.getProvinceCode() != null) { |
| | | mapAreaCode = organization.getProvinceCode(); |
| | | } |
| | | resultMap.put("mapAreaCode", mapAreaCode.toString()); |
| | | } |
| | | resultMap.put("mapPath", areaNamesBuilder.toString()); |
| | | String accountId = String.valueOf(resultMap.get("accountId")); |
| | | resultMap.put("token", webTokenService.getToken(accountId)); |
| | | } |
| | | |
| | | return resultMap; |
| | | } |
| | | |
| | |
| | | return new ResultBean<Map<String, Object>>(sortDatas); |
| | | } |
| | | |
| | | /** |
| | | * @Description: 根据token获取用户地图 |
| | | * @Param: [request] |
| | | * @return: com.moral.common.bean.ResultBean<java.util.List < com.moral.entity.WebProvince>> |
| | | * @Author: 下雨听风 |
| | | * @Date: 2020/11/27 |
| | | */ |
| | | |
| | | @UserLoginToken |
| | | @GetMapping("mapPath") |
| | | public ResultBean<List<WebProvince>> mapPath(HttpServletRequest request) { |
| | | String token = request.getHeader("token"); |
| | |
| | | return new ResultBean<>("获取地图信息失败",ResultBean.FAIL); |
| | | return new ResultBean<>(mapPath); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |