This commit is contained in:
huangdeliang 2021-04-29 20:59:14 +08:00
parent ec71568749
commit 8e260f9d39
2 changed files with 42 additions and 35 deletions

View File

@ -1,9 +1,6 @@
package com.stdiet.web.controller.custom;
import com.aliyun.vod20170321.models.GetPlayInfoResponseBody;
import com.aliyun.vod20170321.models.GetVideoInfoResponseBody;
import com.aliyun.vod20170321.models.GetVideoListResponseBody;
import com.itextpdf.io.util.DateTimeUtil;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.page.TableDataInfo;
@ -21,7 +18,6 @@ import com.stdiet.custom.dto.response.MessageNoticeResponse;
import com.stdiet.custom.dto.response.NutritionalVideoResponse;
import com.stdiet.custom.page.WxLogInfo;
import com.stdiet.custom.service.*;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -100,6 +96,7 @@ public class WechatAppletController extends BaseController {
/**
* 同步客户信息
*
* @param sysWxUserInfo
* @return
*/
@ -431,11 +428,13 @@ public class WechatAppletController extends BaseController {
SysWxUserInfo curWxUserInfo = sysWxUserInfoService.selectSysWxUserInfoById(sysWxUserInfo.getOpenid());
// 第一次尝试匹配搜索sys_wx_user_info表尝试查找cus_id此时不需要手机号
if (StringUtils.isEmpty(sysWxUserInfo.getPhone()) && StringUtils.isNull(curWxUserInfo) || StringUtils.isNull(curWxUserInfo.getCusId())) {
if (StringUtils.isEmpty(sysWxUserInfo.getPhone()) && (StringUtils.isNull(curWxUserInfo) || StringUtils.isNull(curWxUserInfo.getCusId()))) {
// 如果没找到任何信息此时为未登录过的新用户 || 没有cusId没有创建用户信息
return AjaxResult.error(5000, "需要手机号进一步匹配");
} else {
}
// 第二次尝试匹配带上手机号先去sys_customer查找找到就更新sys_wx_user_info表并返回一系列登录后的数据
if (StringUtils.isNotEmpty(sysWxUserInfo.getPhone())) {
SysCustomer sysCustomer = iSysCustomerService.getCustomerByPhone(sysWxUserInfo.getPhone());
if (StringUtils.isNull(sysCustomer)) {
return AjaxResult.error(5003, "未查到用户信息,请联系销售顾问");
@ -444,11 +443,15 @@ public class WechatAppletController extends BaseController {
if (StringUtils.isNull(curWxUserInfo)) {
// 新增sys_wx_user_info
sysWxUserInfo.setCusId(sysCustomer.getId());
sysWxUserInfo.setCreateTime(DateUtils.getNowDate());
sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo);
}
}
// 更新sys_wx_user_info数据并返回一系列登录后的数据
curWxUserInfo.setUpdateTime(DateUtils.getNowDate());
sysWxUserInfoService.updateSysWxUserInfo(curWxUserInfo);
return AjaxResult.success(curWxUserInfo);
}
}

View File

@ -71,8 +71,12 @@ public class SysWxUserInfo {
private Date createTime;
private String createBy;
private Date updateTime;
private String updateBy;
private String remark;
}