From d49c4335300c06504760c1bf02f3320da98964ae Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Thu, 01 Apr 2021 10:00:07 +0800
Subject: [PATCH] 积分
---
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java | 45 +++++++++++++++++++++++++++++++++------------
1 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
index 44c4ecd..e34da97 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
@@ -23,10 +23,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.Date;
@@ -144,6 +141,20 @@
return res;
}
+ /**
+ * 根据OpenID查询用户信息
+ */
+ @GetMapping(value = "/findUserInfo/{openId}")
+ public @ResponseBody
+ AjaxResult findUserInfo(@PathVariable String openId) {
+ BizUser bizUser = bizUserService.findByOpenId(openId);
+ BizUser bizUserQuery=new BizUser();
+ bizUserQuery.setNickName(bizUser.getNickName());
+ bizUserQuery.setAvatarUrl(bizUser.getAvatarUrl());
+ bizUserQuery.setOpenId(openId);
+ return AjaxResult.buildSuccessInstance(bizUserQuery);
+ }
+
/**
* 接收用户信息
@@ -157,28 +168,38 @@
// TODO 赋值操作
int i = bizUserService.saveUserInfo(bizUser);
+ checkNeedToBeSalesman(bizUser, loginUser);
+ if (i == 0) {
+ return new AjaxResult(AjaxResult.STATUS_FAIL, "更新失败");
+ }
+ return new AjaxResult(AjaxResult.STATUS_SUCCESS, Collections.singletonList(bizUser));
+ }
+
+
+ void checkNeedToBeSalesman(BizUser bizUser, BizUser loginUser) {
//查询是否需要自动成为分销员
if ((loginUser.getIsSales() == null || loginUser.getIsSales() == 2)
- && StringUtils.isNotBlank(loginUser.getNickName())) {//目前还不是分销员
+ && StringUtils.isNotBlank(bizUser.getNickName())) {//目前还不是分销员
BusParameterSettings fxSwith = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_SWITCH, HostInterceptor.getCompanyId());
if (fxSwith.getParamValue().equals("1")) {//开启分销
- BusParameterSettings applyCondition = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_APPLY_CONDITION, loginUser.getCompanyId());
- if (applyCondition.getParamValue().equals(FenxiaoSettingConstant.FX_APPLY_CONDITION_WTJ)) {//无条件可称为分销员
+ BusParameterSettings applyWay = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_APPLY_WAY, loginUser.getCompanyId());
+ if (applyWay.getParamValue().equals(FenxiaoSettingConstant.FX_APPLY_WAY_AUTO)) {//自动成为分销员
QueryWrapper<ShopSalesmanApply> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", loginUser.getOpenId());
queryWrapper.eq("apply_status", ShopSalesmanApply.APPLY_STATUS_DSH);
ShopSalesmanApply shopSalesmanApply = salesmanApplyDao.selectOne(queryWrapper);
if (shopSalesmanApply == null) {//没有待审核记录
- shopSalesmanApplyService.applyToBeAnSalesman(loginUser.getOpenId(), null, null, 2);
+ try {
+ shopSalesmanApplyService.applyToBeAnSalesman(loginUser.getOpenId(), null, null, 2);
+ }catch (Exception e){
+ LogUtil.debug(e.getMessage());
+ }
+
}
}
}
}
- if (i == 0) {
- return new AjaxResult(AjaxResult.STATUS_FAIL, "更新失败");
- }
- return new AjaxResult(AjaxResult.STATUS_SUCCESS, Collections.singletonList(bizUser));
}
--
Gitblit v1.9.1