実現したいこと
エラーの原因を見つけを解消したい
前提 STSを使いアプリ作成の練習をしています。再起動するとDescription Resource Path Location Type
メソッド remove(String, char) は型 StringUtils で未定義です PlaceMasterEntityWrapper.java /kdc/src/main/java/com/kdc/common/entity/db というエラーが出ます。
StringUtilsは特にいじったり編集する必要がないと規則があるため、これらの原因と対応策を教えていただきたいです。
よろしくお願いします。(2つあります)
①public void setLongitudeandlatitude(String longitudeandlatitude) {
super.setLongitudeandlatitude(longitudeandlatitude);
longitudeandlatitude = StringUtils.remove(longitudeandlatitude, '(');
longitudeandlatitude = StringUtils.remove(longitudeandlatitude, ')');
String temp[] = longitudeandlatitude.split(",");
this.latitude = new BigDecimal(temp[0]);
this.longitude = new BigDecimal(temp[1]);
}
②
// 末尾の区切り文字を切り捨てて格納
// 場所リスト
form.setPointList(StringUtils.removeEnd(pointListStr.toString(), ";"));
// 半径リスト
form.setRadiusList(StringUtils.removeEnd(radiusListStr.toString(), ";"));
// 場所名リスト
form.setPlaceNameList(StringUtils.removeEnd(placeNameListStr.toString(), ";"));
// アイコンリスト
form.setPlaceIconIdList(StringUtils.removeEnd(placeIconIdListStr.toString(), ";"));
// 場所タイプリスト
form.setPlaceTypeList(StringUtils.removeEnd(placeTypeListStr.toString(), ";"));
// ユーザデフォルトアイコン List<IconDataSet> userIconList = KdcCommonUtils.getUserDefaultIconList(); Map<Integer, byte[]> userIconMap = new LinkedHashMap<>(); for (IconDataSet userIcon : userIconList) { Integer authlevel = KdcCommonUtils.nullSafeParseInt(StringUtils.right(userIcon.getIconName(), 2)); userIconMap.put(authlevel, userIcon.getIconData()); } // マーカーアイコン List<IconDataSet> markerIconList = KdcCommonUtils.getMarkerIconList(); Map<Integer, byte[]> markerIconMap = new LinkedHashMap<>(); for (IconDataSet markerIcon : markerIconList) { Integer markerId = KdcCommonUtils.nullSafeParseInt(StringUtils.right(markerIcon.getIconName(), 2)); markerIconMap.put(markerId, markerIcon.getIconData()); } // 最新位置をマップ化 Map<String, UserLocationEntityWrapper> userLocationMap = new LinkedHashMap<>(); List<UserLocationEntityWrapper> userLocationList = userLocationMapper.selectAll(CommonConst.FLG_OFF,form.getCurrentGroupId(), true); for (UserLocationEntityWrapper userLocation : userLocationList) { userLocationMap.put(userLocation.getUserid(), userLocation); } // DBよりユーザ位置履歴を取得して隠し項目に設定 StringBuilder markerListAllStr = new StringBuilder(); StringBuilder markerListLatestStr = new StringBuilder(); StringBuilder infoWindowListStr = new StringBuilder(); StringBuilder userIconListStr = new StringBuilder(); StringBuilder lineColorListStr = new StringBuilder(); StringBuilder lineOpacityListStr = new StringBuilder(); StringBuilder markerColorListStr = new StringBuilder(); StringBuilder userIdListStr = new StringBuilder(); List<WebUserViewEntity> userList = new ArrayList<>(); // 有効ユーザのみを表示 List<UserMasterEntity> userMasterList = this.webMainMapper.getValidUser(); if (userMasterList != null) { for (UserMasterEntity userMaster : userMasterList) { if (userLocationMap.containsKey(userMaster.getUserid())) { // ユーザの変わり目に"/"を追加 if (markerListAllStr.length() > 0) { markerListAllStr.deleteCharAt(markerListAllStr.length() - 1); markerListAllStr.append("/"); infoWindowListStr.deleteCharAt(infoWindowListStr.length() - 1); infoWindowListStr.append("/"); } // 当日の位置情報が存在するユーザは最新位置と履歴を表示する if (StringUtils.equals(KdcCommonUtils.getNowDateString(), KdcCommonUtils.timestampToDateString( userLocationMap.get(userMaster.getUserid()).getLastlocationdate()))) { // 最新位置リスト UserLocationEntityWrapper userLocation = userLocationMap.get(userMaster.getUserid()); markerListLatestStr.append(userLocation.getLatitude()).append(",") .append((userLocation.getLongitude())).append(";"); // 位置履歴 List<UserLocationRecordEntityWrapper> userLocationRecordList = userLocationRecordMapper .selectByUserIdDate(userMaster.getUserid(), KdcCommonUtils.getNowDateString()); for (UserLocationRecordEntityWrapper userLocationRecord : userLocationRecordList) { // 位置履歴リスト markerListAllStr.append(userLocationRecord.getLatitude()).append(",") .append(userLocationRecord.getLongitude()).append(";"); // 吹き出し情報リスト infoWindowListStr.append(KdcCommonUtils.nullToEmpty(userMaster.getUsername())); infoWindowListStr.append(","); infoWindowListStr.append(KdcCommonUtils.nullToEmpty( KdcCommonUtils.timeToTimeStringForDisp(userLocationRecord.getReceivedate()))); infoWindowListStr.append(","); infoWindowListStr.append(userLocationRecord.getBatterylevel()); infoWindowListStr.append(","); infoWindowListStr.append( ReceptionStatusEnum.valueOf(userLocationRecord.getReceptionstatus()).getLabel()); infoWindowListStr.append(";"); } } else { // 当日の位置情報が存在しないユーザは過去の位置情報のみを表示 UserLocationEntityWrapper userLocation = userLocationMap.get(userMaster.getUserid()); markerListLatestStr.append(userLocation.getLatitude()).append(",") .append((userLocation.getLongitude())).append(";"); // 位置履歴リスト markerListAllStr.append(userLocation.getLatitude()).append(",") .append(userLocation.getLongitude()).append(";"); // 吹き出し情報リスト infoWindowListStr.append(KdcCommonUtils.nullToEmpty(userMaster.getUsername())); infoWindowListStr.append(","); infoWindowListStr.append(KdcCommonUtils.nullToEmpty( KdcCommonUtils.timeToTimeStringForDisp(userLocation.getLastlocationdate()))); infoWindowListStr.append(","); infoWindowListStr.append(userLocation.getBatterylevel()); infoWindowListStr.append(","); infoWindowListStr .append(ReceptionStatusEnum.valueOf(userLocation.getReceptionstatus()).getLabel()); infoWindowListStr.append(";"); } } else { // 位置情報自体が登録されていないユーザは無視する continue; } // ユーザ表示色オブジェクト UserColorSet colorSet = new UserColorSet(null, userMaster.getLinecolor(), userMaster.getMarkercolor()); // アイコンリスト try { byte[] userIconFile; if (StringUtils.isNotEmpty(userMaster.getIconid())) { userIconFile = userMaster.getIconfile(); } else { userIconFile = userIconMap.get(userMaster.getAuthlevel()); } userIconListStr .append(KdcCommonUtils.createUserMarkerIconString(userIconFile, markerIconMap.containsKey(colorSet.getMarkerColorId()) ? markerIconMap.get(colorSet.getMarkerColorId()) : markerIconMap.get(1))) .append(";"); } catch (IOException e) { e.printStackTrace(); } // 移動履歴表示色リスト lineColorListStr.append(colorSet.getLineColorRGBHex()).append(";"); // 移動履歴表示不透明度リスト lineOpacityListStr.append(colorSet.getLineColorAlpha()).append(";"); // 移動地点マーカー表示色リスト // markerColorListStr.append(colorSet.getMarkerColorRGBHex()).append(";"); markerColorListStr.append(colorSet.getLineColorRGBHex()).append(";"); // userIdリスト作成 userIdListStr.append(userMaster.getUserid()).append(";"); // ユーザリスト作成 userList.add(this.makeWebUserViewEntity(userMaster, userIconMap)); } } //グループ番号取得 Map<String, String> groupMap = new LinkedHashMap<>(); Map<String, String> groupNameMap = new LinkedHashMap<>(); // ユーザマスタからグループID一覧を取得し、コンボボックスに設定 List<GroupInfoEntity> groupList = groupMasterMapper.selectAll(CommonConst.FLG_OFF); for (int cntCombo = 0; cntCombo < groupList.size(); cntCombo++) { groupMap.put(groupList.get(cntCombo).getGroupid(), groupList.get(cntCombo).getGroupname()); groupNameMap.put(groupList.get(cntCombo).getGroupname(), groupList.get(cntCombo).getGroupname()); } form.setCmbGroup(groupMap); // 末尾の区切り文字を切り捨てて格納 form.setMarkerListAll(StringUtils.removeEnd(markerListAllStr.toString(), ";")); form.setMarkerListLatest(StringUtils.removeEnd(markerListLatestStr.toString(), ";")); form.setInfoWindowList(StringUtils.removeEnd(infoWindowListStr.toString(), ";")); form.setUserIconList(StringUtils.removeEnd(userIconListStr.toString(), ";")); form.setLineColorList(StringUtils.removeEnd(lineColorListStr.toString(), ";")); form.setLineOpacityList(StringUtils.removeEnd(lineOpacityListStr.toString(), ";")); form.setMarkerColorList(StringUtils.removeEnd(markerColorListStr.toString(), ";")); form.setUserIdList(StringUtils.removeEnd(userIdListStr.toString(), ";")); form.setUserList(userList); }
発生している問題・エラーメッセージ
・メソッド removeEnd(String, String) は型 StringUtils で未定義です
・メソッド remove(String, char) は型 StringUtils で未定義です
試したこと
再起動、デバッグ
biuld.gradleの編集、リフレッシュ