Commit 445b5c8a by huangjy

fix:子女端登陆问题

parent f2b7157e
...@@ -18,6 +18,7 @@ import com.makeit.utils.third.wechat.WxUserInfo; ...@@ -18,6 +18,7 @@ import com.makeit.utils.third.wechat.WxUserInfo;
import com.makeit.utils.third.wechat.WechatUtil; import com.makeit.utils.third.wechat.WechatUtil;
import com.makeit.utils.user.TokenUtil; import com.makeit.utils.user.TokenUtil;
import com.makeit.utils.user.wechat.WechatUserInfo; import com.makeit.utils.user.wechat.WechatUserInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -25,6 +26,7 @@ import org.springframework.stereotype.Service; ...@@ -25,6 +26,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
@Service @Service
public class PlatElderChildrenInfoUserLoginWechatServiceImpl implements PlatElderChildrenInfoUserLoginWechatService { public class PlatElderChildrenInfoUserLoginWechatServiceImpl implements PlatElderChildrenInfoUserLoginWechatService {
...@@ -45,46 +47,41 @@ public class PlatElderChildrenInfoUserLoginWechatServiceImpl implements PlatElde ...@@ -45,46 +47,41 @@ public class PlatElderChildrenInfoUserLoginWechatServiceImpl implements PlatElde
logger.info("userinfo:{}", userInfo); logger.info("userinfo:{}", userInfo);
PlatElderChildrenInfo childrenInfo = platElderChildrenInfoService.getOne(new QueryWrapper<PlatElderChildrenInfo>().lambda() List<PlatElderChildrenInfo> childrenInfoList = platElderChildrenInfoService.list(new QueryWrapper<PlatElderChildrenInfo>().lambda()
.eq(PlatElderChildrenInfo::getOpenid, userInfo.getOpenId())); .eq(PlatElderChildrenInfo::getOpenid, userInfo.getOpenId()));
//.eq(PlatElderChildrenInfo::getPhone, userInfo.getPhoneNumber())); PlatElderChildrenInfo childrenInfo;
if (CollectionUtils.isEmpty(childrenInfoList)) {
if (childrenInfo == null) {
childrenInfo = new PlatElderChildrenInfo(); childrenInfo = new PlatElderChildrenInfo();
childrenInfo.setOpenid(userInfo.getOpenId()); childrenInfo.setOpenid(userInfo.getOpenId());
childrenInfo.setName(userInfo.getNickName()); childrenInfo.setName(userInfo.getNickName());
/* PlatOrgSplitDTO vo = platOrgService.getOrgSplitVO(dto.getOrgId());
childrenInfo.setOrgId(dto.getOrgId());
childrenInfo.setCityOrgId(vo.getCityOrgId());
childrenInfo.setDistrictOrgId(vo.getDistrictOrgId());
childrenInfo.setStreetOrgId(vo.getStreetOrgId());
childrenInfo.setOrgPath(vo.getOrgPath());*/
childrenInfo.setCreateBy(userInfo.getNickName()); childrenInfo.setCreateBy(userInfo.getNickName());
childrenInfo.setUpdateBy(userInfo.getNickName()); childrenInfo.setUpdateBy(userInfo.getNickName());
logger.info("children:{}", childrenInfo);
}
//childrenInfo.setOpenid(userInfo.getOpenId());
childrenInfo.setPhone(userInfo.getPhoneNumber()); childrenInfo.setPhone(userInfo.getPhoneNumber());
childrenInfo.setAvatar(userInfo.getAvatarUrl()); childrenInfo.setAvatar(userInfo.getAvatarUrl());
logger.info("children:{}", childrenInfo);
String token = IdGen.getUUID(); NoFillUtil.executeCreate(() -> {
platElderChildrenInfoService.save(childrenInfo);
});
} else {
for (PlatElderChildrenInfo platElderChildrenInfo : childrenInfoList) {
platElderChildrenInfo.setPhone(userInfo.getPhoneNumber());
platElderChildrenInfo.setAvatar(userInfo.getAvatarUrl());
//RequestUtil.setHeader(HeaderConst.WECHAT_TOKEN, token); //RequestUtil.setHeader(HeaderConst.WECHAT_TOKEN, token);
childrenInfo.setUpdateBy(userInfo.getNickName()); platElderChildrenInfo.setUpdateBy(userInfo.getNickName());
PlatElderChildrenInfo finalChildrenInfo = childrenInfo;
NoFillUtil.executeCreate(() -> { NoFillUtil.executeCreate(() -> {
NoFillUtil.executeUpdate(() -> { NoFillUtil.executeUpdate(() -> {
platElderChildrenInfoService.saveOrUpdate(finalChildrenInfo); platElderChildrenInfoService.saveOrUpdate(platElderChildrenInfo);
}); });
}); });
}
childrenInfo = childrenInfoList.get(0);
}
//childrenInfo.setOpenid(userInfo.getOpenId());
WechatUserInfo wechatUserVo = BeanDtoVoUtils.convert(childrenInfo, WechatUserInfo.class); WechatUserInfo wechatUserVo = BeanDtoVoUtils.convert(childrenInfo, WechatUserInfo.class);
...@@ -92,6 +89,8 @@ public class PlatElderChildrenInfoUserLoginWechatServiceImpl implements PlatElde ...@@ -92,6 +89,8 @@ public class PlatElderChildrenInfoUserLoginWechatServiceImpl implements PlatElde
u.setAvatarPath(f.getFullUrl()); u.setAvatarPath(f.getFullUrl());
}); });
String token = IdGen.getUUID();
wechatUserVo.setToken(token); wechatUserVo.setToken(token);
TokenUtil.wechatLogin(token, wechatUserVo); TokenUtil.wechatLogin(token, wechatUserVo);
......
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 sign in to comment