|
|
@@ -186,28 +186,32 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
);
|
|
|
//.批量录入微信好友
|
|
|
List<FosterwxMobileWxfriend> addFriend = new ArrayList<>();
|
|
|
- Map<Integer, Boolean> friendsIds = new HashMap<>();
|
|
|
+ Map<String, Boolean> friendsNames = new HashMap<>();
|
|
|
for (Integer s = 1; s <= 3; s++) {
|
|
|
String sStr = s.toString();
|
|
|
- String wxFriendIdStr = row.get(i).get("wxFriendId" + sStr);
|
|
|
- Integer wxFriendId = Integer.parseInt(wxFriendIdStr);
|
|
|
- if (wxFriendId == null || wxFriendId == 0) {
|
|
|
+ String wxFriendName = row.get(i).get("wxFriendName" + sStr);
|
|
|
+ String wxFriendUserName = row.get(i).get("wxFriendUserName" + sStr);
|
|
|
+ if (wxFriendName == null || wxFriendName.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
- if (friendsIds.get(wxFriendId) != null) {
|
|
|
- throw new Exception("第" + (i + 1) + "行," + wxFriendId + "微信好友ID录入重复");
|
|
|
+ if (friendsNames.get(wxFriendName) != null) {
|
|
|
+ throw new Exception("第" + (i + 1) + "行," + wxFriendName + "微信好友名称录入重复");
|
|
|
}
|
|
|
- friendsIds.put(wxFriendId, true);
|
|
|
- Boolean findRes = this.checkWxFriendCnt(friends, wxFriendId);
|
|
|
+ friendsNames.put(wxFriendName, true);
|
|
|
+ Boolean findRes = this.checkWxFriendCnt(friends, wxFriendName);
|
|
|
if (!findRes) {
|
|
|
- throw new Exception("第" + (i + 1) + "行," + wxFriendId + "微信好友ID在当前站点内已经使用超过三次,无法再次录入");
|
|
|
+ throw new Exception("第" + (i + 1) + "行," + wxFriendName + "微信好友名称在当前站点内已经使用超过三次,无法再次录入");
|
|
|
}
|
|
|
FosterwxMobileWxfriend fosterwxMobileWxfriend = new FosterwxMobileWxfriend();
|
|
|
fosterwxMobileWxfriend.setMobileId(fosterwxMobile.getId());
|
|
|
fosterwxMobileWxfriend.setCreateAt(nowDate);
|
|
|
fosterwxMobileWxfriend.setUpdateAt(nowDate);
|
|
|
fosterwxMobileWxfriend.setSeq(s);
|
|
|
- fosterwxMobileWxfriend.setFriendId(wxFriendId);
|
|
|
+ fosterwxMobileWxfriend.setWxName(wxFriendName);
|
|
|
+ if (wxFriendUserName != null && !wxFriendUserName.isEmpty()) {
|
|
|
+ fosterwxMobileWxfriend.setWxUsername(wxFriendUserName);
|
|
|
+ }
|
|
|
+
|
|
|
addFriend.add(fosterwxMobileWxfriend);
|
|
|
}
|
|
|
|
|
|
@@ -329,10 +333,10 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private Boolean checkWxFriendCnt(List<FosterwxMobileWxfriend> row, Integer friendId) {
|
|
|
+ private Boolean checkWxFriendCnt(List<FosterwxMobileWxfriend> row, String wxName) {
|
|
|
Integer findCnt = 0;
|
|
|
for (FosterwxMobileWxfriend fosterwxMobileWxfriend : row) {
|
|
|
- if (fosterwxMobileWxfriend.getFriendId().equals(friendId)) {
|
|
|
+ if (fosterwxMobileWxfriend.getWxName().equals(wxName)) {
|
|
|
findCnt++;
|
|
|
}
|
|
|
if (findCnt >= 3) {
|