Merge branch 'master' of http://139.186.142.91:10010/r/productDev/zbomyoujia
| | |
| | | # 项目信息配置 |
| | | project: |
| | | name: 访客系统 |
| | | name: 志邦业绩数字化赋能后台系统 |
| | | version: 1.0.0 |
| | | env: development |
| | | # env: production |
| | |
| | | */ |
| | | @Override |
| | | public ZTSysuserGetTokenResponse getSysuserToken(String mobile){ |
| | | ZTBaseResponse<ZTSysuserGetTokenResponse> result = sendHttpRequest( |
| | | ZTBaseResponse<ZTSysuserGetTokenResponse> result = sendSysHttpRequest( |
| | | ZTConstants.IntegerUrl.USER_MOBILE_FASTLOGIN_URL+"?mobile="+mobile, |
| | | ZTConstants.IntegerName.USER_MOBILE_FASTLOGIN_NAME, |
| | | null, |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public <T> ZTBaseResponse<T> sendSysHttpRequest(String url,String name,String token,String userType,String param,TypeReference<ZTBaseResponse<T>> typeReference){ |
| | | log.info("【"+name+"】================开始===="+ JSONObject.toJSONString(param)); |
| | | String res = null; |
| | | int success = 0; |
| | | try { |
| | | Map<String,String> headers = new HashMap<>(); |
| | | if(StringUtils.equals(userType,ZTConstants.CUSTOMER)){ |
| | | //如果是C端客户 |
| | | headers.put(ZTConstants.HEADER_TOKEN,token); |
| | | }else{ |
| | | //如果是B端用户 |
| | | headers.put(ZTConstants.HEADER_SYSUSER_TOKEN,token); |
| | | } |
| | | headers.put(ZTConstants.HEADER_USERTYPE,userType); |
| | | String index = (String) redisTemplate.opsForValue().get(Constants.RedisKeys.ZBOM_ZHONGTAI_SYS_API_URL); |
| | | res = HttpsUtil.postJsonWithHeaders(index+url,param,headers); |
| | | ZTBaseResponse<T> result = JSONObject.parseObject(res, typeReference.getType()); |
| | | logResult(result,name); |
| | | if(Constants.equalsInteger(result.getCode(),ZTConstants.CODE_SUCCESS)){ |
| | | return result; |
| | | }else{ |
| | | success =1; |
| | | } |
| | | }catch (Exception e){ |
| | | success = 1; |
| | | log.error("【"+name+"】================失败===="+ JSONObject.toJSONString(param)); |
| | | }finally { |
| | | saveInterfaceLog(url,name,param,success,res); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public void saveInterfaceLog(String url,String name,String param,Integer success,String respone){ |
| | | if(interfaceLogMapper ==null){ |
| | | return; |
| | |
| | | /** |
| | | * 收藏量 |
| | | */ |
| | | private String collectCount; |
| | | private Integer collectCount; |
| | | /** |
| | | * 主图 |
| | | */ |
| | |
| | | /** |
| | | * 是否收藏 true:收藏 false:未收藏 |
| | | */ |
| | | private boolean isCollection; |
| | | private Boolean isCollection; |
| | | private String layoutUlr; |
| | | private String panorama; |
| | | /** |
| | |
| | | /** |
| | | * 浏览量 |
| | | */ |
| | | private String viewCount; |
| | | private Integer viewCount; |
| | | |
| | | } |
| | |
| | | /** |
| | | * 收藏数 |
| | | */ |
| | | private String collectCount; |
| | | private Integer collectCount; |
| | | /** |
| | | * 内容ID |
| | | */ |
| | |
| | | /** |
| | | * 查看数 |
| | | */ |
| | | private String viewCount; |
| | | private Integer viewCount; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "收藏量") |
| | | private Integer collectCount; |
| | | |
| | | @ApiModelProperty(value = "喜欢量") |
| | | private Integer likeCount; |
| | | |
| | | @ApiModelProperty(value = "是否喜欢") |
| | | private Boolean isLike; |
| | | |
| | | @ApiModelProperty(value = "是否收藏") |
| | | private Boolean isCollection; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | * 详情页轮播图列表(多视角图) |
| | | */ |
| | | private String[] bannerImgList; |
| | | private String collectCount; |
| | | private Integer collectCount; |
| | | /** |
| | | * 详情页富文本(全屋定制遍历spaceList的富文本) |
| | | */ |
| | |
| | | private List<ZTSpaceInfoResponse> spaceList; |
| | | private String subtitle; |
| | | private String title; |
| | | private String viewCount; |
| | | private Integer viewCount; |
| | | private String downloadCount; |
| | | private String isTop; |
| | | private String orgId; |
| | |
| | | * 详情页轮播图列表(多视角图) |
| | | */ |
| | | private String[] bannerImgList; |
| | | private String collectCount; |
| | | private Integer collectCount; |
| | | /** |
| | | * 详情页富文本(全屋定制遍历spaceList的富文本) |
| | | */ |
| | |
| | | private List<ZTSpaceInfoResponse> spaceList; |
| | | private String subtitle; |
| | | private String title; |
| | | private String viewCount; |
| | | private Integer viewCount; |
| | | private String downloadCount; |
| | | private String isTop; |
| | | private String orgId; |
| | |
| | | public class ZTRealcaseInfoResponse implements Serializable { |
| | | |
| | | private String caseInfo; |
| | | private String collectCount; |
| | | private Integer collectCount; |
| | | /** |
| | | * 主图 |
| | | */ |
| | |
| | | /** |
| | | * 是否收藏 true:收藏 false:未收藏 |
| | | */ |
| | | @ApiModelProperty(value = "是否收藏 true:收藏 false:未收藏") |
| | | private boolean isCollection; |
| | | private Boolean isCollection; |
| | | /** |
| | | * 发布日期 |
| | | */ |
| | |
| | | * 标题 |
| | | */ |
| | | private String title; |
| | | private String viewCount; |
| | | private Integer viewCount; |
| | | |
| | | private String contentCategory; |
| | | private String intro; |
| | |
| | | /** |
| | | * 收藏数量 |
| | | */ |
| | | private long collectCount; |
| | | private Integer collectCount; |
| | | /** |
| | | * 封面图 |
| | | */ |
| | |
| | | /** |
| | | * 是否收藏 |
| | | */ |
| | | private boolean isCollection; |
| | | private Boolean isCollection; |
| | | private String langCode; |
| | | /** |
| | | * 喜欢数量 |
| | |
| | | /** |
| | | * 浏览数量 |
| | | */ |
| | | private String viewCount; |
| | | private Integer viewCount; |
| | | } |
| | |
| | | @Data |
| | | public class ZTZbDecoInfoResponse implements Serializable { |
| | | private String author; |
| | | private long collectCount; |
| | | private Integer collectCount; |
| | | /** |
| | | * 内容 |
| | | */ |
| | |
| | | /** |
| | | * 是否收藏 |
| | | */ |
| | | private boolean isCollection; |
| | | private Boolean isCollection; |
| | | private String langCode; |
| | | private long likeCount; |
| | | private String publishDepartment; |
| | |
| | | * 标题 |
| | | */ |
| | | private String title; |
| | | private String viewCount; |
| | | private Integer viewCount; |
| | | } |
| | |
| | | import com.doumee.dao.business.model.Member; |
| | | import io.jsonwebtoken.*; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | |
| | | public static final String UserId_Name = "AppUserId"; |
| | | //取值名称 |
| | | public static final String UserType = "UserType"; |
| | | //取值名称 |
| | | public static final String UserInfo = "UserInfo"; |
| | | //加密密钥 |
| | | private final static String jwtSecret = "MhAjU9poLf8ko54K25XBDtonaL33vtt1"; |
| | | //过期时间(s) 86400L=1天 604800L=7天 |
| | |
| | | return generateToken(jwtPayLoad.getUserId(), expirationDate, jwtPayLoad.toMap()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 生成token,根据userId和默认过期时间 |
| | | */ |
| | | public static String generateTokenForZb(Long userId,String userType,String userInfo,RedisTemplate<String,Object> redisTemplate) { |
| | | Long expiredSeconds = getExpireSeconds(); |
| | | final Date expirationDate = new Date(System.currentTimeMillis() + expiredSeconds * 1000); |
| | | return generateTokenZb(userId,userType,userInfo, expirationDate,redisTemplate); |
| | | } |
| | | |
| | | |
| | | public static String generateTokenZb(Long userId, String userType,String userInfo, Date expiredDate,RedisTemplate<String,Object> redisTemplate) { |
| | | String tokenKey = UUID.randomUUID() + "_" + userId; |
| | | redisTemplate.opsForValue().set(userType + "_" +tokenKey,userInfo); |
| | | return tokenKey; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 验证token是否失效 |
| | | */ |
| | |
| | | HandlerMethod handlerMethod = (HandlerMethod) handler; |
| | | |
| | | Class<?> beanType = handlerMethod.getBeanType(); |
| | | |
| | | // Method method = handlerMethod.getMethod(); |
| | | |
| | | // 有 @LoginRequired 注解,需要登录认证 客户端使用 |
| | | if (beanType.isAnnotationPresent(LoginRequired.class) || handlerMethod.hasMethodAnnotation(LoginRequired.class)) { |
| | | //获取token |
| | | String token = request.getHeader(JwtTokenUtil.HEADER_KEY); // 从 http 请求头中取出 token |
| | | if (StringUtils.isNotBlank(token)) { |
| | | checkLogin(request,response); |
| | | } else { |
| | | throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"未登录"); |
| | | } |
| | | // 有 @UserLoginRequired 注解,需要登录认证 内部人员使用 |
| | | } else if(beanType.isAnnotationPresent(UserLoginRequired.class) || handlerMethod.hasMethodAnnotation(UserLoginRequired.class)){ |
| | | //ERP 业务注解 |
| | | String token = request.getHeader(JwtTokenUtil.HEADER_KEY); |
| | | if (StringUtils.isNotBlank(token)) { |
| | | checkPersonnelLogin(request,response); |
| | | } else { |
| | | throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"未登录"); |
| | | } |
| | | Boolean checkFlag = false; |
| | | if(!( handlerMethod.hasMethodAnnotation(LoginRequired.class) || handlerMethod.hasMethodAnnotation(UserLoginRequired.class)) |
| | | ){ |
| | | return true; |
| | | } |
| | | String token = request.getHeader(JwtTokenUtil.HEADER_KEY); |
| | | if(StringUtils.isBlank(token)){ |
| | | throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"未登录"); |
| | | } |
| | | if (handlerMethod.hasMethodAnnotation(LoginRequired.class)) { |
| | | checkFlag = checkLogin(request,response,token); |
| | | } |
| | | if(!checkFlag && handlerMethod.hasMethodAnnotation(UserLoginRequired.class)){ |
| | | checkFlag = checkPersonnelLogin(request,response,token); |
| | | } |
| | | if(!checkFlag){ |
| | | throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"未登录"); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public Boolean checkLogin(HttpServletRequest request, HttpServletResponse response){ |
| | | String token = request.getHeader(JwtTokenUtil.HEADER_KEY); |
| | | public Boolean checkLogin(HttpServletRequest request, HttpServletResponse response,String token){ |
| | | try { |
| | | //获取账号ID |
| | | Long memberId = JwtTokenUtil.getJwtPayLoad(token).getUserId(); |
| | | String tokenRedis = (String) redisTemplate.opsForValue().get(ZTConstants.CUSTOMER+"_"+memberId); |
| | | if(StringUtils.isNotBlank(tokenRedis)){ |
| | | if(!tokenRedis.equals(token)){ |
| | | throw new BusinessException(ResponseStatus.TOKEN_EXCEED_TIME.getCode(),"长时间未操作,请重新登录"); |
| | | } |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.TOKEN_EXCEED_TIME.getCode(),"长时间未操作,请重新登录"); |
| | | String tokenRedis = (String) redisTemplate.opsForValue().get(ZTConstants.CUSTOMER+"_"+token); |
| | | if(StringUtils.isBlank(tokenRedis)){ |
| | | return false; |
| | | } |
| | | Member member = dao.queryForObject(" select * from `member` where id = ? limit 1 ", new BeanPropertyRowMapper<>(Member.class),memberId ); |
| | | Long memberId = getTokenId(token); |
| | | Member member = dao.queryForObject(" select * from `member` where id = ? limit 1 ", new BeanPropertyRowMapper<>(Member.class),memberId); |
| | | if(Objects.isNull(member)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | |
| | | } |
| | | request.setAttribute(JwtTokenUtil.UserId_Name, memberId); |
| | | request.setAttribute(JwtTokenUtil.UserType, ZTConstants.CUSTOMER); |
| | | request.setAttribute(JwtTokenUtil.HEADER_KEY, ZTConstants.CUSTOMER+"_"+token); |
| | | request.setAttribute(JwtTokenUtil.UserInfo, tokenRedis); |
| | | return true; |
| | | } catch (IllegalArgumentException | JwtException e) { |
| | | throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"未登录"); |
| | | } |
| | | } |
| | | |
| | | public Boolean checkPersonnelLogin(HttpServletRequest request, HttpServletResponse response){ |
| | | String token = request.getHeader(JwtTokenUtil.HEADER_KEY); |
| | | public Boolean checkPersonnelLogin(HttpServletRequest request, HttpServletResponse response,String token){ |
| | | try { |
| | | //获取账号ID |
| | | Long userId = JwtTokenUtil.getJwtPayLoad(token).getUserId(); |
| | | String tokenRedis = (String) redisTemplate.opsForValue().get(ZTConstants.BUSINESS+"_"+userId); |
| | | if(StringUtils.isNotBlank(tokenRedis)){ |
| | | if(!tokenRedis.equals(token)){ |
| | | throw new BusinessException(ResponseStatus.TOKEN_EXCEED_TIME.getCode(),"长时间未操作,请重新登录"); |
| | | } |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.TOKEN_EXCEED_TIME.getCode(),"长时间未操作,请重新登录"); |
| | | String tokenRedis = (String) redisTemplate.opsForValue().get(ZTConstants.BUSINESS+"_"+token); |
| | | if(StringUtils.isBlank(tokenRedis)){ |
| | | return false; |
| | | } |
| | | Long userId = getTokenId(token); |
| | | Users users = dao.queryForObject(" select * from `users` where id = ? limit 1 ", new BeanPropertyRowMapper<>(Users.class),userId); |
| | | if(Objects.isNull(users)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | |
| | | } |
| | | request.setAttribute(JwtTokenUtil.UserId_Name, userId); |
| | | request.setAttribute(JwtTokenUtil.UserType, ZTConstants.BUSINESS); |
| | | request.setAttribute(JwtTokenUtil.HEADER_KEY, ZTConstants.CUSTOMER+"_"+token); |
| | | request.setAttribute(JwtTokenUtil.UserInfo, tokenRedis); |
| | | return true; |
| | | } catch (IllegalArgumentException | JwtException e) { |
| | | throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"未登录"); |
| | |
| | | return new RestTemplate(); |
| | | } |
| | | |
| | | public Long getTokenId(String token){ |
| | | try { |
| | | Integer lastIndex = token.lastIndexOf("_")+1; |
| | | Long tokenId = Long.valueOf(token.substring(lastIndex)); |
| | | return tokenId; |
| | | }catch (Exception e){ |
| | | throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"未登录"); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @Target({ElementType.METHOD,ElementType.TYPE}) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface UserLoginRequired {} |
| | | public @interface UserLoginRequired { |
| | | |
| | | } |
| | |
| | | |
| | | public static final String WX_PLATFORM = "WX_PLATFORM"; |
| | | public static final String ZBOM_ZHONGTAI_API_URL = "ZBOM_ZHONGTAI_API_URL"; |
| | | public static final String ZBOM_ZHONGTAI_SYS_API_URL = "ZBOM_ZHONGTAI_SYS_API_URL"; |
| | | public static final String WX_PLATFORM_ACCESS_TOKEN = "WX_PLATFORM_ACCESS_TOKEN"; |
| | | public static final String ZBOM_ENCODE_URL = "ZBOM_ENCODE_URL"; |
| | | public static final String WX_PLATFORM_APPID = "WX_PLATFORM_APPID"; |
| | |
| | | String ZBOM_ENCODE_URL ="ZBOM_ENCODE_URL"; |
| | | String ZBOM_SMS_API_KEY ="ZBOM_SMS_API_KEY"; |
| | | String ZBOM_ZHONGTAI_API_URL ="ZBOM_ZHONGTAI_API_URL"; |
| | | String ZBOM_ZHONGTAI_SYS_API_URL ="ZBOM_ZHONGTAI_SYS_API_URL"; |
| | | String ZBOM_CRM_POSTCUS_API_KEY ="ZBOM_CRM_POSTCUS_API_KEY"; |
| | | String ZBOM_AREA_REDIS_KEY ="ZBOM_AREA_REDIS_KEY"; |
| | | String ZBOM_SMS_API_URL ="ZBOM_SMS_API_URL"; |
| | |
| | | @ApiModelProperty(value = "微信sessionKey") |
| | | private String sessionKey; |
| | | |
| | | @ApiModelProperty(value = "手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "用户信息 - 客户端") |
| | | private Member member; |
| | | |
| | |
| | | public interface GetZhongTaiDataService { |
| | | |
| | | |
| | | ZSZXCatalogResponse getZSZXCatalogs(Long userId); |
| | | ZSZXCatalogResponse getZSZXCatalogs(Long userId,String userType); |
| | | |
| | | /** |
| | | * 分类数据 |
| | |
| | | redisTemplate.opsForValue().set(Constants.RedisKeys.ZBOM_SMS_API_URL,systemDictDataBiz.queryByCode(Constants.ZBOM,Constants.ZBOM_SMS_API_URL).getCode()); |
| | | redisTemplate.opsForValue().set(Constants.RedisKeys.ZBOM_SMS_API_KEY,systemDictDataBiz.queryByCode(Constants.ZBOM,Constants.ZBOM_SMS_API_KEY).getCode()); |
| | | redisTemplate.opsForValue().set(Constants.RedisKeys.ZBOM_ZHONGTAI_API_URL,systemDictDataBiz.queryByCode(Constants.ZBOM,Constants.ZBOM_ZHONGTAI_API_URL).getCode()); |
| | | redisTemplate.opsForValue().set(Constants.RedisKeys.ZBOM_ZHONGTAI_SYS_API_URL,systemDictDataBiz.queryByCode(Constants.ZBOM,Constants.ZBOM_ZHONGTAI_SYS_API_URL).getCode()); |
| | | redisTemplate.opsForValue().set(Constants.RedisKeys.ZBOM_ENCODE_URL,systemDictDataBiz.queryByCode(Constants.ZBOM,Constants.ZBOM_ENCODE_URL).getCode()); |
| | | } |
| | | @PostConstruct |
| | |
| | | * 用户注销 |
| | | * @param memberId |
| | | */ |
| | | ZTBaseRequst logOff(Long memberId); |
| | | ZTBaseRequst logOff(Long memberId,String token); |
| | | |
| | | } |
| | |
| | | import com.doumee.dao.business.model.Users; |
| | | import com.doumee.dao.web.reqeust.ContentShareImgDto; |
| | | import com.doumee.dao.web.reqeust.EditUsersRequest; |
| | | import com.doumee.dao.web.reqeust.WxPhoneRequest; |
| | | import com.doumee.dao.web.response.AccountResponse; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | |
| | | String getContentShareImg(Users loginUserInfo, ContentShareImgDto param); |
| | | |
| | | ZTBaseRequst logOff(Long userId); |
| | | ZTBaseRequst logOff(Long userId,String token); |
| | | |
| | | AccountResponse getWxMiniPhoneLogin(WxPhoneRequest wxPhoneRequest); |
| | | } |
| | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.IamInterfaceLogMapper; |
| | | import com.doumee.dao.business.MemberMapper; |
| | | import com.doumee.dao.business.UsersMapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Override |
| | | public ZSZXCatalogResponse getZSZXCatalogs(Long userId){ |
| | | public ZSZXCatalogResponse getZSZXCatalogs(Long userId,String userType){ |
| | | ZSZXCatalogResponse response = new ZSZXCatalogResponse(); |
| | | ZTCatalogListRequest param = new ZTCatalogListRequest(); |
| | | param.setUserId(userId.toString()); |
| | | param.setUserType(ZTConstants.CUSTOMER); |
| | | param.setUserType(userType); |
| | | param.setCatalogCode(ZTConstants.CatalogCode.ZHISHUO_ZHUANGXIU); |
| | | List<ZTCatalogInfoResponse> cataList = getCatalogList(param); |
| | | if(cataList!=null ){ |
| | |
| | | ZTBaseInfoResponse ztBaseInfoResponse = MemberServiceImpl.getZTToken(zbomZhongTaiService,memberMapper,usersMapper,systemDictDataBiz, |
| | | Long.valueOf(ztContentListRequest.getUserId()),ztContentListRequest.getUserType()); |
| | | ztContentListRequest.setToken(ztBaseInfoResponse.getToken()); |
| | | System.out.println("开始时间========================》"+DateUtil.getLongDate(new Date())); |
| | | ZTBasePageResponse<ZTProductInfoResponse> response = zbomZhongTaiService.pageProductList(ztContentListRequest); |
| | | System.out.println("结束时间========================》"+DateUtil.getLongDate(new Date())); |
| | | return response; |
| | | } |
| | | |
| | |
| | | |
| | | import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"获取openid失败!请联系管理员"); |
| | | } |
| | | // String openId = code; |
| | | Member member = memberMapper.selectOne(new QueryWrapper<Member>().eq("OPENID", openId)); |
| | | Member member = memberMapper.selectOne(new QueryWrapper<Member>().eq("OPENID", openId).isNotNull("phone")); |
| | | Users users = new Users(); |
| | | if(StringUtils.isBlank(iamId)){ |
| | | users = usersMapper.selectOne(new QueryWrapper<Users>().lambda() |
| | |
| | | this.saveCustomerUser(users,member.getId()); |
| | | member = this.getMemberInfo(member.getId()); |
| | | } |
| | | //创建token |
| | | JwtPayLoad payLoad = new JwtPayLoad(member.getId(),Constants.ZERO); |
| | | String token = JwtTokenUtil.generateToken(payLoad); |
| | | redisTemplate.opsForValue().set(ZTConstants.CUSTOMER+"_"+member.getId(),token); |
| | | String token = JwtTokenUtil.generateTokenForZb(users.getId(),ZTConstants.CUSTOMER, JSONObject.toJSON(member).toString(),redisTemplate); |
| | | AccountResponse accountResponse = new AccountResponse(); |
| | | accountResponse.setToken(token); |
| | | accountResponse.setSessionKey(session.getSessionKey()); |
| | |
| | | // .set(Member::getTokenDate,date)//默认有效期为两小时 |
| | | .eq(Member::getId,member.getId())); |
| | | ztBaseInfoResponse.setToken(ztUserGetTokenResponse.getToken()); |
| | | }else{ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"中台TOKEN获取失败,请联系管理员"); |
| | | } |
| | | } |
| | | ztBaseInfoResponse.setToken(member.getToken()); |
| | |
| | | ztBaseInfoResponse.setUserType(ZTConstants.BUSINESS); |
| | | ztBaseInfoResponse.setOpenId(users.getOpenid()); |
| | | if(Objects.isNull(users.getTokenDate()) || users.getTokenDate().getTime()<=System.currentTimeMillis() ){ |
| | | ZTUserGetTokenRequest param = new ZTUserGetTokenRequest(); |
| | | //查询APPID |
| | | String appId = systemDictDataBiz.queryByCode(Constants.WX_MINI_CONFIG,Constants.WX_APPID_CUSTOMER).getCode(); |
| | | param.setAppId(appId); |
| | | param.setOpenId(users.getOpenid()); |
| | | ZTSysuserGetTokenResponse ztUserGetTokenResponse = zbomZhongTaiService.getSysuserToken(users.getPhone()); |
| | | if(Objects.nonNull(ztUserGetTokenResponse)){ |
| | | users.setToken(ztUserGetTokenResponse.getToken()); |
| | |
| | | .eq(Users::getId,users.getId())); |
| | | ztBaseInfoResponse.setToken(ztUserGetTokenResponse.getToken()); |
| | | return ztBaseInfoResponse; |
| | | }else{ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"中台TOKEN获取失败,请联系管理员"); |
| | | } |
| | | } |
| | | ztBaseInfoResponse.setToken(users.getToken()); |
| | | // return ztBaseInfoResponse; |
| | | }else{ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"参数错误"); |
| | | } |
| | | return ztBaseInfoResponse; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ZTBaseRequst logOff(Long memberId){ |
| | | public ZTBaseRequst logOff(Long memberId,String token){ |
| | | Member member = memberMapper.selectById(memberId); |
| | | if(Objects.isNull(member)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(StringUtils.isBlank(member.getPhone())){ |
| | | redisTemplate.delete(ZTConstants.CUSTOMER+"_"+ member.getId()); |
| | | redisTemplate.delete(token); |
| | | return null; |
| | | } |
| | | //校验用户token信息 |
| | |
| | | ztBaseRequst.setOpenId(member.getOpenid()); |
| | | ztBaseRequst.setToken(member.getToken()); |
| | | memberMapper.update(new UpdateWrapper<Member>().lambda() |
| | | .set(Member::getOpenid,null) |
| | | .set(Member::getPhone,null) |
| | | .set(Member::getEditDate,new Date()) |
| | | .eq(Member::getId,member.getId()) |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.dao.web.reqeust.EditUsersRequest; |
| | | import com.doumee.dao.web.reqeust.ContentShareImgDto; |
| | | import com.doumee.dao.web.reqeust.WxPhoneRequest; |
| | | import com.doumee.dao.web.response.AccountResponse; |
| | | import com.doumee.service.business.UsersService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | // } |
| | | // smsEmailMapper.updateById(model); |
| | | //创建token |
| | | JwtPayLoad payLoad = new JwtPayLoad(users.getId(),Constants.ONE); |
| | | String token = JwtTokenUtil.generateToken(payLoad); |
| | | redisTemplate.opsForValue().set(ZTConstants.BUSINESS+"_"+users.getId(),token); |
| | | // JwtPayLoad payLoad = new JwtPayLoad(users.getId(),Constants.ONE); |
| | | // String token = JwtTokenUtil.generateToken(payLoad); |
| | | // redisTemplate.opsForValue().set(ZTConstants.BUSINESS+"_"+users.getId(),token); |
| | | String token = JwtTokenUtil.generateTokenForZb(users.getId(),ZTConstants.BUSINESS,JSONObject.toJSON(users).toString(),redisTemplate); |
| | | AccountResponse accountResponse = new AccountResponse(); |
| | | accountResponse.setToken(token); |
| | | accountResponse.setUsers(users); |
| | |
| | | accountResponse.setSessionKey(session.getSessionKey()); |
| | | Users users = usersMapper.selectOne(new QueryWrapper<Users>().lambda().eq(Users::getOpenid,openId).last("limit 1")); |
| | | if(Objects.isNull(users)){ |
| | | accountResponse.setSessionKey(session.getSessionKey()); |
| | | return accountResponse; |
| | | } |
| | | if(!Constants.equalsInteger(users.getIsdeleted(),Constants.ZERO)){ |
| | |
| | | users.setOpenid(openId); |
| | | usersMapper.updateById(users); |
| | | //创建token |
| | | JwtPayLoad payLoad = new JwtPayLoad(users.getId(),Constants.ONE); |
| | | String token = JwtTokenUtil.generateToken(payLoad); |
| | | redisTemplate.opsForValue().set(ZTConstants.BUSINESS+"_"+users.getId(),token); |
| | | String token = JwtTokenUtil.generateTokenForZb(users.getId(),ZTConstants.BUSINESS,users.getId()+"",redisTemplate); |
| | | accountResponse.setToken(token); |
| | | getUsersDetail(users); |
| | | accountResponse.setSessionKey(session.getSessionKey()); |
| | | accountResponse.setUsers(users); |
| | | return accountResponse; |
| | | } catch (WxErrorException e) { |
| | |
| | | } |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"微信登录异常!请联系管理员"); |
| | | } |
| | | |
| | | @Override |
| | | public AccountResponse getWxMiniPhoneLogin(WxPhoneRequest wxPhoneRequest){ |
| | | try { |
| | | WxMaPhoneNumberInfo userPhoneInfo = WxMiniConfig.wxPersonnelService.getUserService().getPhoneNoInfo( |
| | | wxPhoneRequest.getSessionKey(), wxPhoneRequest.getEncryptedData(), wxPhoneRequest.getIv()); |
| | | //获取手机号 |
| | | String phone= userPhoneInfo.getPurePhoneNumber(); |
| | | if(Objects.isNull(phone)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未获取到手机号"); |
| | | } |
| | | Users users = usersMapper.selectOne(new QueryWrapper<Users>().lambda() |
| | | .eq(Users::getPhone,phone).last("limit 1")); |
| | | AccountResponse accountResponse = new AccountResponse(); |
| | | accountResponse.setPhone(phone); |
| | | if(Objects.isNull(users)){ |
| | | return accountResponse; |
| | | } |
| | | accountResponse.setUsers(users); |
| | | String token = JwtTokenUtil.generateTokenForZb(users.getId(),ZTConstants.BUSINESS,users.getId()+"",redisTemplate); |
| | | accountResponse.setToken(token); |
| | | return accountResponse; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"更新手机号失败"); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | |
| | | @Override |
| | | public ZTBaseRequst logOff(Long userId){ |
| | | public ZTBaseRequst logOff(Long userId,String token){ |
| | | Users users = usersMapper.selectById(userId); |
| | | if(Objects.isNull(users)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(StringUtils.isBlank(users.getOpenid())){ |
| | | redisTemplate.delete(ZTConstants.BUSINESS+"_"+ users.getId()); |
| | | redisTemplate.delete(token); |
| | | return null; |
| | | } |
| | | //校验用户token信息 |
| | |
| | | package com.doumee.api.web; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.config.Jwt.JwtTokenUtil; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.business.model.Users; |
| | | import com.doumee.service.business.MemberService; |
| | | import com.doumee.service.business.UsersService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.ss.formula.ptg.MemAreaPtg; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | Object obj = this.getRequest().getAttribute(JwtTokenUtil.UserId_Name); |
| | | return obj != null ? (Long) obj : null; |
| | | } |
| | | |
| | | protected String getToken() { |
| | | Object obj = this.getRequest().getAttribute(JwtTokenUtil.HEADER_KEY); |
| | | return obj != null ? (String) obj : null; |
| | | } |
| | | |
| | | |
| | | protected Long getUserId() { |
| | | // if(isDebug){ |
| | | // return 2L; |
| | |
| | | return obj != null ? (Long) obj : null; |
| | | } |
| | | protected Users getLoginUserInfo() { |
| | | Long userId = getUserId(); |
| | | if(userId== null){ |
| | | return null; |
| | | } |
| | | Users user = usersService.findById(userId); |
| | | return user; |
| | | Long userId = getUserId(); |
| | | if(userId== null){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"未登录"); |
| | | } |
| | | Object obj = this.getRequest().getAttribute(JwtTokenUtil.UserInfo); |
| | | String userInfo = obj != null ? (String) obj : null; |
| | | Users user = new Users(); |
| | | if(StringUtils.isNotBlank(userInfo)){ |
| | | user = JSONObject.toJavaObject(JSONObject.parseObject(userInfo),Users.class); |
| | | } |
| | | return user; |
| | | } |
| | | protected Member getLoginMemberInfo() { |
| | | Long userId = getMemberId(); |
| | | if(userId== null){ |
| | | return null; |
| | | } |
| | | Member user = memberService.findById(userId); |
| | | return user; |
| | | Object obj = this.getRequest().getAttribute(JwtTokenUtil.UserInfo); |
| | | String userInfo = obj != null ? (String) obj : null; |
| | | Member member = new Member(); |
| | | if(StringUtils.isNotBlank(userInfo)){ |
| | | member = JSONObject.toJavaObject(JSONObject.parseObject(userInfo),Member.class); |
| | | } |
| | | return member; |
| | | } |
| | | |
| | | protected Long getUserType() { |
| | | protected String getUserType() { |
| | | Object obj = this.getRequest().getAttribute(JwtTokenUtil.UserType); |
| | | return obj != null ? (Long) obj : null; |
| | | return obj != null ? (String) obj : null; |
| | | } |
| | | |
| | | } |
| | |
| | | return ApiResponse.success(memberService.wxLogin(code,iamId)); |
| | | } |
| | | |
| | | |
| | | @LoginRequired |
| | | @ApiOperation(value = "获取手机号", notes = "客户端小程序") |
| | | @PostMapping("/getWxMiniPhone") |
| | |
| | | @ApiOperation(value = "用户注销", notes = "客户端小程序") |
| | | @GetMapping("/logOff") |
| | | public ApiResponse logOff() { |
| | | ZTBaseRequst ztBaseRequst = memberService.logOff(getUserId()); |
| | | ZTBaseRequst ztBaseRequst = memberService.logOff(getUserId(),getToken()); |
| | | if(Objects.nonNull(ztBaseRequst)){ |
| | | getZhongTaiDataService.userLogout(ztBaseRequst); |
| | | } |
| | |
| | | |
| | | |
| | | @LoginRequired |
| | | @ApiOperation(value = "产品资讯详情 - 中台", notes = "客户端小程序") |
| | | @GetMapping("/getProductNewsInfo") |
| | | @ApiOperation(value = "产品资讯详情 - 中台", notes = "客户端小程序") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), |
| | | @ApiImplicitParam(paramType = "query", dataType = "String", name = "id", value = "内容主键", required = true), |
| | |
| | | import com.doumee.biz.zbom.ZbomCRMService; |
| | | import com.doumee.biz.zbom.ZbomZhongTaiService; |
| | | import com.doumee.config.annotation.LoginRequired; |
| | | import com.doumee.config.annotation.UserLoginRequired; |
| | | import com.doumee.core.annotation.trace.Trace; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageData; |
| | |
| | | public GetZhongTaiDataService getZhongTaiDataService; |
| | | |
| | | |
| | | @UserLoginRequired |
| | | @LoginRequired |
| | | @ApiOperation(value = "【C端小程序】获取首页志说装修四个模块类目数据", notes = "获取首页志说装修四个模块类目数据,背景图暂时写死,参考UI") |
| | | @PostMapping("/getZSZXCatalogs") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) |
| | | }) |
| | | public ApiResponse<ZSZXCatalogResponse> getZSZXCatalogs() { |
| | | return ApiResponse.success(getZhongTaiDataService.getZSZXCatalogs(getMemberId())); |
| | | return ApiResponse.success(getZhongTaiDataService.getZSZXCatalogs(getMemberId(),getUserType())); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | @UserLoginRequired |
| | | @ApiOperation(value = "获取客户管理授权-列表跳转地址", notes = "获取客户管理授权跳转地址") |
| | | @GetMapping("/getCrmAuthUrl") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), |
| | | @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "类型 0客户列表 1跳转新增意向客户", required = true) |
| | | }) |
| | | public ApiResponse<String> getCrmAuthUrl(@RequestParam Integer type) { |
| | |
| | | import com.doumee.dao.business.model.Shop; |
| | | import com.doumee.dao.business.model.SmsEmail; |
| | | import com.doumee.dao.business.model.Users; |
| | | import com.doumee.dao.web.reqeust.EditMemberRequest; |
| | | import com.doumee.dao.web.reqeust.EditShopDTO; |
| | | import com.doumee.dao.web.reqeust.EditUsersRequest; |
| | | import com.doumee.dao.web.reqeust.ContentShareImgDto; |
| | | import com.doumee.dao.web.reqeust.*; |
| | | import com.doumee.dao.web.response.AccountResponse; |
| | | import com.doumee.service.business.*; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "手机号验证码登陆", notes = "员工端小程序") |
| | | @GetMapping("/loginByPhone") |
| | | @ApiImplicitParams({ |
| | |
| | | usersService.bindingOpenid(code,getUserId()); |
| | | return ApiResponse.success("操作成功"); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "手机号快捷登录", notes = "客户端小程序") |
| | | @PostMapping("/getWxMiniPhoneLogin") |
| | | public ApiResponse<AccountResponse> getWxMiniPhone(@Valid @RequestBody WxPhoneRequest wxPhoneRequest) { |
| | | return ApiResponse.success("获取成功",usersService.getWxMiniPhoneLogin(wxPhoneRequest)); |
| | | } |
| | | |
| | | |
| | | @UserLoginRequired |
| | | @ApiOperation(value = "获取个人信息详情", notes = "员工端小程序") |
| | |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) |
| | | }) |
| | | public ApiResponse logOff() { |
| | | ZTBaseRequst ztBaseRequst = usersService.logOff(getUserId()); |
| | | ZTBaseRequst ztBaseRequst = usersService.logOff(getUserId(),getToken()); |
| | | if(Objects.nonNull(ztBaseRequst)){ |
| | | getZhongTaiDataService.userLogout(ztBaseRequst); |
| | | } |
| | |
| | | # 项目信息配置 |
| | | project: |
| | | name: 智能会议室小程序端 |
| | | name: 志邦业绩数字化赋能小程序 |
| | | version: 1.0.0 |
| | | env: development |
| | | # env: production |
| | |
| | | data |
| | | }) |
| | | } |
| | | // 小程序注销 |
| | | export const getCrmAuthUrl = (data) => { |
| | | return request({ |
| | | url: '/web/customer/getCrmAuthUrl', |
| | | data |
| | | }) |
| | | } |
| | |
| | | // pages/client/index.js |
| | | Page({ |
| | | |
| | | import { getCrmAuthUrl, getDictData } from '../../api/index' |
| | | Page({ |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | |
| | | }, |
| | | |
| | | url:'' |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | |
| | | onLoad(options) { |
| | | this.loadData() |
| | | }, |
| | | |
| | | loadData(){ |
| | | wx.showToast() |
| | | getCrmAuthUrl({type:0}).then(res => { |
| | | console.log(res.data) |
| | | this.setData({ url: res.data }) |
| | | }) |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | |
| | | onShow() { |
| | | // if(this.data.url ==null || this.data.url ==''){ |
| | | // this.loadData() |
| | | // } |
| | | }, |
| | | |
| | | /** |
| | |
| | | <!--pages/client/index.wxml--> |
| | | <text>pages/client/index.wxml</text> |
| | | <web-view wx:if="{{url !=null && url !=''}}" src="{{url}}"> </web-view> |
| | | <button wx:else style="margin-top: 50%;width: 200rpx;font-size: 14px;" bind:tap="loadData">重新加载</button> |
| | |
| | | onLoad(options) { |
| | | console.log(options.type) |
| | | if(options.type == 1){ |
| | | wx.setNavigationBarTitle({title:'隐私协议'}) |
| | | wx.setNavigationBarTitle({title:'用户隐私协议'}) |
| | | }else{ |
| | | wx.setNavigationBarTitle({title:'用户协议'}) |
| | | wx.setNavigationBarTitle({title:'用户服务协议'}) |
| | | } |
| | | this.loadDict(options.type); |
| | | }, |
| | |
| | | <button class="btn2" bind:tap="saveCard">保持到相册</button> |
| | | </view> |
| | | </van-popup> |
| | | </view> |
| | | </view>prod |
| | |
| | | |
| | | // export const imageUrl = 'https://osswebcdn.zbom.com/jiaxuan/images/' |
| | | |
| | | // export const baseUrl = 'https://dmtest.ahapp.net/web_interface/' // 测试服 |
| | | export const baseUrl = 'http://192.168.0.135:10027' // 本地 |
| | | |
| | | // 腾讯地图开发者 key |
| | | export const qqMapKey = 'HIDBZ-2QXL4-TAWUD-XET6Q-EKTJE-CCBSQ' |
| | | |