| | |
| | | package com.ltkj.web.controller.app; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.ltkj.framework.config.JwtUtils; |
| | | import com.ltkj.framework.config.UserHoder; |
| | | import com.ltkj.hosp.domain.GetPhone; |
| | | import com.ltkj.hosp.domain.TjCustomer; |
| | | import com.ltkj.hosp.domain.Wxuser; |
| | | import com.ltkj.hosp.service.IAbucoderWxuserService; |
| | | import com.ltkj.hosp.service.ITjCustomerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | import java.security.Security; |
| | | import java.security.cert.CertificateException; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Author: 西安路泰科技有限公司/赵佳豪 |
| | |
| | | @Api(tags = "A小程序端登录接口大全") |
| | | @Slf4j |
| | | public class WxloginController extends BaseController { |
| | | |
| | | @Resource |
| | | private ITjCustomerService customerService; |
| | | |
| | | @Resource |
| | | private IAbucoderWxuserService wxuserService; |
| | |
| | | Wxuser wxuser = UserHoder.getWxuser(); |
| | | LambdaQueryWrapper<Wxuser> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(Wxuser::getOpenid, wxuser.getOpenid()); |
| | | // System.out.println("获取 ->"+wxuser.getOpenid()); |
| | | Wxuser one = wxuserService.getOne(wq); |
| | | return AjaxResult.success(one); |
| | | } |
| | |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("/wx/bindPhoneV2") |
| | | public AjaxResult bindPhoneV2(@RequestBody String json) { |
| | | cn.hutool.json.JSONObject entries = JSONUtil.parseObj(json); |
| | | String phone = entries.getStr("phone"); |
| | | Wxuser wxuser = UserHoder.getWxuser(); |
| | | LambdaQueryWrapper<Wxuser> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(Wxuser::getOpenid, wxuser.getOpenid()); |
| | | Wxuser one = wxuserService.getOne(wq); |
| | | // System.out.println("绑定 ->"+wxuser.getOpenid()+",json = "+json); |
| | | if (one != null){ |
| | | one.setPhone(phone); |
| | | wxuserService.updateById(one); |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | /** |
| | |
| | | one.setUpdateTime(new DateTime()); |
| | | final boolean b = wxuserService.updateById(one); |
| | | if (b){ |
| | | LambdaQueryWrapper<TjCustomer> qw = new LambdaQueryWrapper<>(); |
| | | qw.eq(TjCustomer::getCusPhone, phone); |
| | | List<TjCustomer> tjCustomer1 = customerService.list(qw); |
| | | if (tjCustomer1 != null && tjCustomer1.size()>0) { |
| | | for (TjCustomer tjCustomer : tjCustomer1) { |
| | | tjCustomer.setConnect(openId); |
| | | customerService.updateById(tjCustomer); |
| | | } |
| | | } |
| | | return AjaxResult.success("绑定成功!"); |
| | | } |
| | | } |