|
@@ -91,6 +91,8 @@ public class UserLogic {
|
|
|
PromotionGroupSpecUserService promotionGroupSpecUserService;
|
|
|
@Autowired
|
|
|
UserServiceWaitService userServiceWaitService;
|
|
|
+ @Autowired
|
|
|
+ AdminWebsitService adminWebsitService;
|
|
|
|
|
|
/**
|
|
|
* 微信授权
|
|
@@ -266,7 +268,7 @@ public class UserLogic {
|
|
|
if (wxCpUser == null) {
|
|
|
List<EnterpriseWechatWorker> list = enterpriseWechatWorkerService.lambdaQuery()
|
|
|
.eq(EnterpriseWechatWorker::getWechatUserId, workUserId)
|
|
|
- .eq(EnterpriseWechatWorker::getCorpId,currentCompanyWechat.getCorpId()).list();
|
|
|
+ .eq(EnterpriseWechatWorker::getCorpId,"").list();
|
|
|
if (list.size() > 0) {
|
|
|
EnterpriseWechatWorker enterpriseWechatWorker = list.get(0);
|
|
|
wxCpUser = new WxCpUser();
|
|
@@ -368,6 +370,8 @@ public class UserLogic {
|
|
|
if (user.getType().equals(UserTypeEnum.GENERAL.toString()) && service.getType().equals(UserTypeEnum.SERVICE.toString())) {
|
|
|
user.setServiceId(serviceId);
|
|
|
user.setServiceTime(new Date());
|
|
|
+ user.setWebsitId(service.getWebsitId());
|
|
|
+ user.setWebsitName(service.getWebsitName());
|
|
|
}
|
|
|
|
|
|
//判断是否为团长
|
|
@@ -595,17 +599,16 @@ public class UserLogic {
|
|
|
if (user == null) {
|
|
|
throw new RemoteServiceException(ResponseHelper.ResponseCode_AUTH_ERROR, "请求不合法");
|
|
|
}
|
|
|
- CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat(request);
|
|
|
- EnterpriseWechatWorker enterpriseWechatWorker = enterpriseWechatWorkerService.lambdaQuery()
|
|
|
- .eq(EnterpriseWechatWorker::getWechatUserId, user.getWorkUserId())
|
|
|
- .eq(EnterpriseWechatWorker::getCorpId,currentCompanyWechat.getCorpId())
|
|
|
- .one();
|
|
|
+
|
|
|
UserWxBean userWxBean = new UserWxBean();
|
|
|
BeanUtils.copyProperties(user, userWxBean);
|
|
|
- userWxBean.setWorkQrcode(enterpriseWechatWorker == null ? null : enterpriseWechatWorker.getQrCode());
|
|
|
- userWxBean.setWorkQrcode2(enterpriseWechatWorker == null ? null : enterpriseWechatWorker.getQrCode2());
|
|
|
+
|
|
|
userWxBean.setShoppingCartNums(shoppingCartLogic.total(userWxBean.getUserId()));
|
|
|
userWxBean.setServiceWorkerBean(userInfoMapper.queryWebsit(user.getUserId()));
|
|
|
+ if (!StringUtil.isEmpty(user.getWebsitId())) {
|
|
|
+ AdminWebsit adminWebsit = adminWebsitService.getById(user.getWebsitId());
|
|
|
+ userWxBean.setAdminWebsit(adminWebsit);
|
|
|
+ }
|
|
|
return userWxBean;
|
|
|
}
|
|
|
|
|
@@ -704,4 +707,63 @@ public class UserLogic {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public AdminWebsit userWebsit(String userId, String lng, String lat) {
|
|
|
+ User user = userService.getById(userId);
|
|
|
+ if (!StringUtil.isEmpty(user.getServiceId())) {
|
|
|
+ AdminWebsit adminWebsit = adminWebsitService.getById(user.getWebsitId());
|
|
|
+ return adminWebsit;
|
|
|
+ }
|
|
|
+
|
|
|
+ AdminWebsit adminWebsit = userInfoMapper.userWebsit(userId, lng, lat);
|
|
|
+
|
|
|
+ if (adminWebsit == null)
|
|
|
+ return null;
|
|
|
+
|
|
|
+ user.setWebsitId(adminWebsit.getWebsitId());
|
|
|
+ user.setWebsitName(adminWebsit.getName());
|
|
|
+ return adminWebsit;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<AdminWebsit> websitList() {
|
|
|
+ List<AdminWebsit> adminWebsits = adminWebsitService.lambdaQuery()
|
|
|
+ .eq(AdminWebsit::getStatus, "ON").list();
|
|
|
+ return adminWebsits;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String websitUrl(String websitId,String key, String vrifyCode, HttpServletRequest request) {
|
|
|
+
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotEmpty(key) && org.apache.commons.lang.StringUtils.isNotEmpty(vrifyCode)) {
|
|
|
+ boolean b = this.checkVrifyCode(key, vrifyCode);
|
|
|
+ if (!b) {
|
|
|
+ throw new RemoteServiceException("验证码不通过");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ AdminWebsit adminWebsit = adminWebsitService.getById(websitId);
|
|
|
+
|
|
|
+ return adminWebsit.getUrl();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验验证码
|
|
|
+ *
|
|
|
+ * @param key
|
|
|
+ * @param vrifyCode
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean checkVrifyCode(String key, String vrifyCode) throws RemoteServiceException {
|
|
|
+ Object serverCode = redisUtil.get(Constant.RedisPrefix.VERIFICATION +":"+key);
|
|
|
+ if (serverCode == null) {
|
|
|
+ throw new RemoteServiceException("验证码超时");
|
|
|
+ }
|
|
|
+ //允许拖拽式验证码误差+-10
|
|
|
+ int code = (int) serverCode;
|
|
|
+ int code2 = Integer.parseInt(vrifyCode);
|
|
|
+ if (code >= (code2 - 15) && code <= (code2 + 15)) {
|
|
|
+ redisUtil.del(Constant.RedisPrefix.VERIFICATION +":"+key);
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ throw new RemoteServiceException("验证码校验不通过");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|