|
|
@ -11,6 +11,7 @@ import com.epmet.dto.UserDTO; |
|
|
|
import com.epmet.dto.UserWechatDTO; |
|
|
|
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO; |
|
|
|
import com.epmet.dto.form.WxLoginUserInfoFormDTO; |
|
|
|
import com.epmet.dto.form.WxUserInfoFormDTO; |
|
|
|
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; |
|
|
|
import com.epmet.entity.UserEntity; |
|
|
|
import com.epmet.entity.UserWechatEntity; |
|
|
@ -19,6 +20,8 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @Description |
|
|
@ -33,7 +36,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据openId、app查询对应终端用户信息 |
|
|
|
* |
|
|
|
* <p> |
|
|
|
* 居民端用户与政府端用户都在一张表内且都有微信登录的入口 |
|
|
|
* user_wechat表保存每一个用户和微信(openId)的绑定关系 |
|
|
|
* |
|
|
@ -43,7 +46,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Result<UserDTO> selecWxLoginUserInfo(WxLoginUserInfoFormDTO formDTO) { |
|
|
|
UserDTO userDTO=userWechatDao.selectUserDTOByOpenId(formDTO); |
|
|
|
UserDTO userDTO = userWechatDao.selectUserDTOByOpenId(formDTO); |
|
|
|
return new Result<UserDTO>().ok(userDTO); |
|
|
|
} |
|
|
|
|
|
|
@ -90,4 +93,26 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem |
|
|
|
} |
|
|
|
return new Result<PasswordLoginUserInfoResultDTO>().ok(passwordLoginUserInfoResultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param wxUserInfoFormDTO |
|
|
|
* @Author sun |
|
|
|
* @Description 居民端个人信息-同步用户微信信息 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result updateWxUserInfo(WxUserInfoFormDTO wxUserInfoFormDTO) { |
|
|
|
UserWechatDTO userWechatDTO = new UserWechatDTO(); |
|
|
|
//前台和后台已有实体字段不对于 需要挨个赋值
|
|
|
|
userWechatDTO.setUserId(wxUserInfoFormDTO.getUserId()); |
|
|
|
userWechatDTO.setNickname(wxUserInfoFormDTO.getNickName() == null ? null : wxUserInfoFormDTO.getNickName()); |
|
|
|
userWechatDTO.setSex(Integer.parseInt(wxUserInfoFormDTO.getGender())); |
|
|
|
userWechatDTO.setHeadImgUrl(wxUserInfoFormDTO.getAvatarUrl()); |
|
|
|
userWechatDTO.setCountry(wxUserInfoFormDTO.getCountry() == null ? null : wxUserInfoFormDTO.getCountry()); |
|
|
|
userWechatDTO.setProvince(wxUserInfoFormDTO.getProvince() == null ? null : wxUserInfoFormDTO.getProvince()); |
|
|
|
userWechatDTO.setCity(wxUserInfoFormDTO.getCity() == null ? null : wxUserInfoFormDTO.getCity()); |
|
|
|
userWechatDTO.setUpdatedTime(new Date()); |
|
|
|
userWechatDTO.setUpdatedBy(wxUserInfoFormDTO.getUserId()); |
|
|
|
userWechatDao.updateByUserId(userWechatDTO); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
} |
|
|
|