获取手机号

This commit is contained in:
wangw 2024-07-22 11:39:57 +08:00
parent cda3245f7b
commit 9a5c02a949
3 changed files with 22 additions and 4 deletions

View File

@ -8,9 +8,11 @@ import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.IpUtil; import com.chaozhanggui.system.cashierservice.util.IpUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@CrossOrigin(origins = "*") @CrossOrigin(origins = "*")
@RestController @RestController
@ -50,4 +52,12 @@ public class LoginContoller {
return loginService.getShopInfo(token); return loginService.getShopInfo(token);
} }
@RequestMapping(value = "getPhone")
public Result getPhone( @RequestBody Map<String, String> map){
if (CollectionUtils.isEmpty(map) || !map.containsKey("userId")) {
return Result.fail("id不允许为空");
}
return loginService.getPhone(Integer.valueOf(map.get("userId").toString()));
}
} }

View File

@ -17,6 +17,7 @@ public class WebAppConfigurer implements WebMvcConfigurer {
registry.addInterceptor(signInterceptor) registry.addInterceptor(signInterceptor)
.addPathPatterns("/**") .addPathPatterns("/**")
.excludePathPatterns("/login/login") .excludePathPatterns("/login/login")
.excludePathPatterns("/login/getPhone")
.excludePathPatterns("/cloudPrinter/print") .excludePathPatterns("/cloudPrinter/print")
.excludePathPatterns("/cloudPrinter/handoverPrint") .excludePathPatterns("/cloudPrinter/handoverPrint")
.excludePathPatterns("/data/handoverData") .excludePathPatterns("/data/handoverData")

View File

@ -4,10 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.TbPlussShopStaff; import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
import com.chaozhanggui.system.cashierservice.entity.TbToken;
import com.chaozhanggui.system.cashierservice.entity.TbmerchantAccount;
import com.chaozhanggui.system.cashierservice.model.LoginReq; import com.chaozhanggui.system.cashierservice.model.LoginReq;
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer; import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum; import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
@ -35,6 +32,8 @@ public class LoginService {
@Autowired @Autowired
TbShopInfoMapper tbShopInfoMapper; TbShopInfoMapper tbShopInfoMapper;
@Autowired
TbUserInfoMapper userInfoMapper;
@Autowired @Autowired
TbProductMapper tbProductMapper; TbProductMapper tbProductMapper;
@ -187,4 +186,12 @@ public class LoginService {
return Result.success(SUCCESS,shopInfo); return Result.success(SUCCESS,shopInfo);
} }
public Result getPhone(Integer userId) {
TbUserInfo userInfo = userInfoMapper.selectByPrimaryKey(userId);
if (userInfo != null) {
return Result.success(SUCCESS, userInfo.getTelephone());
}
return Result.success(SUCCESS, "");
}
} }