| | |
| | | import com.java110.utils.constant.MappingConstant; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 这个接口没有写好 给商城专用, |
| | | * 重新写一个,这个接口查询完后还要 刷入用户中 |
| | | * 没有考虑 不登录情况下 的openId 获取 |
| | | * 根据小程序code 获取openId |
| | | */ |
| | | |
| | |
| | | |
| | | String openId = responseObj.getString("openid"); |
| | | |
| | | if (StringUtil.isEmpty(userId) || userId.startsWith("-")) { |
| | | context.setResponseEntity(ResultVo.createResponseEntity(openId)); |
| | | return; |
| | | } |
| | | |
| | | UserAttrDto userAttrDto = new UserAttrDto(); |
| | | userAttrDto.setUserId(userId); |
| | | userAttrDto.setSpecCd(UserAttrDto.SPEC_MALL_OPEN_ID); |
| | | List<UserAttrDto> userAttrDtos = userAttrV1InnerServiceSMOImpl.queryUserAttrs(userAttrDto); |
| | | if(userAttrDtos == null || userAttrDtos.size() < 1){ |
| | | if (userAttrDtos == null || userAttrDtos.size() < 1) { |
| | | UserAttrPo userAttrPo = new UserAttrPo(); |
| | | userAttrPo.setAttrId(GenerateCodeFactory.getAttrId()); |
| | | userAttrPo.setUserId(userId); |
| | | userAttrPo.setSpecCd(UserAttrDto.SPEC_MALL_OPEN_ID); |
| | | userAttrPo.setValue(openId); |
| | | userAttrV1InnerServiceSMOImpl.saveUserAttr(userAttrPo); |
| | | }else { |
| | | } else { |
| | | UserAttrPo userAttrPo = new UserAttrPo(); |
| | | userAttrPo.setAttrId(userAttrDtos.get(0).getAttrId()); |
| | | userAttrPo.setValue(openId); |