Commit 5a7e79b6 authored by hanfeng's avatar hanfeng

Merge remote-tracking branch 'origin/master-customer-management' into master-customer-management

parents a416a068 5d8b3090
......@@ -67,57 +67,62 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
* @param parentId
*/
public void bindRelation(Integer userId,Integer parentId,Integer type){
if (userId.equals(parentId)){
log.info("----userId==="+userId+"----parentId===="+parentId+"----自己不能成为自己的上线");
return;
}
try {
if (userId.equals(parentId)){
log.info("----userId==="+userId+"----parentId===="+parentId+"----自己不能成为自己的上线");
return;
}
/* AppUserVo appUserVo=userDetailBiz.getUserInfoById(userId);
if (appUserVo==null){
log.info("----userId==="+userId+"----parentId===="+parentId+"----该用户不存在");
return;
}*/
AppUserVo appUserVo=userDetailBiz.getUserInfoById(parentId);
if (appUserVo==null){
log.info("----userId==="+userId+"----parentId===="+parentId+"----该上线用户不存在");
return;
}
AppUserRelation relation=getMyBiz().getRelationByUserId(parentId);
Long time=System.currentTimeMillis();
if(relation==null){
relation=new AppUserRelation();
relation.setUserId(parentId);
relation.setBindType(type);
insertSelective(relation);
}
Long bindTime=time-validTime;
//判断用户是否有有效的下线
if (getCountByParentId(userId,bindTime)==0L){
relation=getMyBiz().getRelationByUserId(userId);
AppUserVo appUserVo=userDetailBiz.getUserInfoById(parentId);
if (appUserVo==null){
log.info("----userId==="+userId+"----parentId===="+parentId+"----该上线用户不存在");
return;
}
AppUserRelation relation=getMyBiz().getRelationByUserId(parentId);
Long time=System.currentTimeMillis();
if(relation==null){
relation=new AppUserRelation();
relation.setUserId(userId);
relation.setParentId(parentId);
relation.setUserId(parentId);
relation.setBindType(type);
relation.setBindTime(time);
insertSelective(relation);
}else {
//判断用户是否有有效的上线
log.info("----userId==="+userId+"----bindTime===="+bindTime+"----relation.getBindTime()==="+relation.getBindTime());
if(relation.getParentId()==null||relation.getParentId()==0||(relation.getIsForever()!=1&&validTime>0&&relation.getBindTime()<bindTime)){
}
Long bindTime=time-validTime;
//判断用户是否有有效的下线
if (getCountByParentId(userId,bindTime)==0L){
relation=getMyBiz().getRelationByUserId(userId);
if(relation==null){
relation=new AppUserRelation();
relation.setUserId(userId);
relation.setParentId(parentId);
relation.setBindType(type);
relation.setBindTime(time);
getMyBiz().updRelation(relation);
insertSelective(relation);
}else {
//判断用户是否有有效的上线
log.info("----userId==="+userId+"----bindTime===="+bindTime+"----relation.getBindTime()==="+relation.getBindTime());
if(relation.getParentId()==null||relation.getParentId()==0||(relation.getIsForever()!=1&&validTime>0&&relation.getBindTime()<bindTime)){
relation.setParentId(parentId);
relation.setBindType(type);
relation.setBindTime(time);
getMyBiz().updRelation(relation);
}
}
if (relation != null){
AppStaffUserDTO staffUserDTO=new AppStaffUserDTO();
staffUserDTO.setSuId(relation.getParentId());
staffUserDTO.setUid(relation.getUserId());
staffUserBiz.addAppStaffUser(staffUserDTO);
}
}
if (relation != null){
AppStaffUserDTO staffUserDTO=new AppStaffUserDTO();
staffUserDTO.setSuId(relation.getParentId());
staffUserDTO.setUid(relation.getUserId());
staffUserBiz.addAppStaffUser(staffUserDTO);
}
}catch (Exception e){
log.info("网络异常===" + e.getMessage());
}
}
//首页关系绑定
public ObjectRestResponse appBindRelation(Integer userId,String code){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment