|
|
@@ -177,7 +177,6 @@ public class FosterwxMobileWxfriendServiceImpl extends ServiceImpl<FosterwxMobil
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public VoltaHandle<Boolean> importData(List<Map<String,String>> row, User authUser) throws Exception{
|
|
|
VoltaHandle<Boolean> res = new VoltaHandle<>();
|
|
|
if (row.size() <= 0) {
|
|
|
@@ -198,12 +197,19 @@ public class FosterwxMobileWxfriendServiceImpl extends ServiceImpl<FosterwxMobil
|
|
|
if (mobileInfo == null) {
|
|
|
throw new Exception("第" + (i + 1) + "行,手机编号:" + mobileCode + ",不存在");
|
|
|
}
|
|
|
+ //.判断是否同账号下重复绑定好友
|
|
|
Integer hasRecord = this.count(new QueryWrapper<FosterwxMobileWxfriend>()
|
|
|
.eq("mobile_id",mobileInfo.getId())
|
|
|
.eq("friend_id",row.get(i).get("friendId")));
|
|
|
if(hasRecord > 0){
|
|
|
throw new Exception("第" + (i + 1) + "行,好友编号:"+row.get(i).get("friendId") + "已经和账号绑定不可重复绑定");
|
|
|
}
|
|
|
+ //.判断账号下是否已经绑满3个好友
|
|
|
+ VoltaHandle<String> checkBindRes = this.checkOneFriendInMobile(mobileInfo.getId());
|
|
|
+ if (checkBindRes.getErr() != null){
|
|
|
+ throw new Exception("第" + (i + 1) + "行,站点编号:"+row.get(i).get("mobileCode") + "已经绑定3个好友,无法再次绑定了");
|
|
|
+ }
|
|
|
+ //.判断好友ID是否在站点下已经被绑定了3次
|
|
|
VoltaHandle<String> checkRes = this.checkOneFriend(stationInfo.getId(),Integer.parseInt(row.get(i).get("friendId")));
|
|
|
if (checkRes.getErr() != null){
|
|
|
throw new Exception("第" + (i + 1) + "行,好友编号:"+row.get(i).get("friendId") + "已经绑定3次,无法再次绑定了");
|
|
|
@@ -218,6 +224,16 @@ public class FosterwxMobileWxfriendServiceImpl extends ServiceImpl<FosterwxMobil
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ public VoltaHandle<String> checkOneFriendInMobile(Integer mobileId){
|
|
|
+ VoltaHandle<String> res = new VoltaHandle<>();
|
|
|
+ Integer mobileBindCnt = this.count(new QueryWrapper<FosterwxMobileWxfriend>().eq("mobile_id",mobileId));
|
|
|
+ if (mobileBindCnt >= 3){
|
|
|
+ res.setErr("账号id:"+mobileId + "已经绑定了3个好友");
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ //.判断某个好友是否已经在站点下呗绑定了3次
|
|
|
public VoltaHandle<String> checkOneFriend(Integer stationId,Integer friendId){
|
|
|
VoltaHandle<String> res = new VoltaHandle<>();
|
|
|
List<FosterwxMobile> mobileList = fosterwxMobileService.list(new QueryWrapper<FosterwxMobile>()
|
|
|
@@ -228,8 +244,8 @@ public class FosterwxMobileWxfriendServiceImpl extends ServiceImpl<FosterwxMobil
|
|
|
.in("mobile_id",mobileIds)
|
|
|
.eq("friend_id",friendId)
|
|
|
);
|
|
|
- if (friends.size() >=3){
|
|
|
- res.setErr("好友Id:"+friendId + "已经被绑定3个无法再绑定");
|
|
|
+ if (friends.size() >= 3){
|
|
|
+ res.setErr("好友id:"+friendId + "已经被绑定3个无法再绑定");
|
|
|
}
|
|
|
return res;
|
|
|
}
|