客户绑定支行
This commit is contained in:
@@ -20,6 +20,8 @@ public class CustomerInfoVo {
|
||||
|
||||
@ApiModelProperty("是否实名:已实名或未实名")
|
||||
private String realAttestationExplain;
|
||||
@ApiModelProperty("客户绑定的支行名称")
|
||||
private String customerBankName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -45,4 +45,7 @@ public class LpkCustomer {
|
||||
private String regionName;
|
||||
private String isNewUser;//是否新人 0 否 1 是
|
||||
private String isPurchase;//是否购买过 0 否 1 是
|
||||
|
||||
@ApiModelProperty("客户绑定的支行sid")
|
||||
private String customerBankSid;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yxt.yythmall.api.lpkcustomerbank;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: dimengzhe
|
||||
* @date: 2024/1/28
|
||||
**/
|
||||
@Data
|
||||
public class LpkCustomerBank {
|
||||
private String id;
|
||||
private String sid = UUID.randomUUID().toString();
|
||||
private String createTime;
|
||||
private String remarks;
|
||||
private String isEnable;
|
||||
private String name;
|
||||
private String shortName;
|
||||
private String linker;
|
||||
private String linkPhone;
|
||||
private String address;
|
||||
@ApiModelProperty("经度")
|
||||
private String lon;
|
||||
@ApiModelProperty("纬度")
|
||||
private String lat;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yxt.yythmall.api.lpkcustomerbank;
|
||||
|
||||
import com.yxt.common.core.query.Query;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: dimengzhe
|
||||
* @date: 2024/1/28
|
||||
**/
|
||||
@Data
|
||||
public class LpkCustomerBankQuery implements Query {
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yxt.yythmall.api.lpkcustomerbank;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: dimengzhe
|
||||
* @date: 2024/1/28
|
||||
**/
|
||||
@Data
|
||||
public class LpkCustomerBankVo {
|
||||
@ApiModelProperty("支行sid")
|
||||
private String bankSid;
|
||||
@ApiModelProperty("支行名称")
|
||||
private String bankName;
|
||||
}
|
||||
@@ -42,51 +42,60 @@ public class LpkCustomerRest {
|
||||
public ResultBean<PagerVo<LpkCustomerVo>> customerListPage(@RequestBody PagerQuery<LpkCustomerQuery> pq) {
|
||||
return lpkCustomerService.customerListPage(pq);
|
||||
}
|
||||
|
||||
@ApiOperation("客户个人信息")
|
||||
@GetMapping("/customerInfo/{sid}")
|
||||
public ResultBean customerInfo(@PathVariable("sid") String sid){
|
||||
public ResultBean customerInfo(@PathVariable("sid") String sid) {
|
||||
return lpkCustomerService.getCustomerInfo(sid);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void a (){
|
||||
long id= IdUtil.createSnowflake(1,1).nextId();
|
||||
public void a() {
|
||||
long id = IdUtil.createSnowflake(1, 1).nextId();
|
||||
System.out.println(String.valueOf(id).length());
|
||||
System.out.println(id);
|
||||
}
|
||||
|
||||
@ApiOperation("更改头像")
|
||||
@PostMapping("/modifyHeadImage")
|
||||
ResultBean<String> modifyHeadImage(@RequestParam("userSid")String userSid,@RequestPart(value = "file") MultipartFile file){
|
||||
return lpkCustomerService.modifyHeadImage(userSid,file);
|
||||
ResultBean<String> modifyHeadImage(@RequestParam("userSid") String userSid, @RequestPart(value = "file") MultipartFile file) {
|
||||
return lpkCustomerService.modifyHeadImage(userSid, file);
|
||||
}
|
||||
|
||||
@ApiOperation("更改昵称")
|
||||
@PostMapping("/modifyUserNickName")
|
||||
ResultBean modifyUserNickName(@RequestParam("userSid")String userSid,@RequestParam("userNickName")String userNickName){
|
||||
return lpkCustomerService.modifyUserNickName(userSid,userNickName);
|
||||
ResultBean modifyUserNickName(@RequestParam("userSid") String userSid, @RequestParam("userNickName") String userNickName) {
|
||||
return lpkCustomerService.modifyUserNickName(userSid, userNickName);
|
||||
}
|
||||
|
||||
@ApiOperation("获取客户个人信息")
|
||||
@GetMapping("/getCustomerInfo/{userSid}")
|
||||
ResultBean<CustomerInfoVo> getCustomerInfo(@PathVariable("userSid")String userSid){
|
||||
ResultBean<CustomerInfoVo> getCustomerInfo(@PathVariable("userSid") String userSid) {
|
||||
return lpkCustomerService.getCustomerInfos(userSid);
|
||||
}
|
||||
|
||||
@ApiOperation("获取客户个人信息")
|
||||
@PostMapping("/getPhoneNumber")
|
||||
ResultBean<String> getPhoneNumber(@RequestParam("code")String code,@RequestParam("userSid")String userSid){
|
||||
return lpkCustomerService.getPhoneNumber(code,userSid);
|
||||
ResultBean<String> getPhoneNumber(@RequestParam("code") String code, @RequestParam("userSid") String userSid) {
|
||||
return lpkCustomerService.getPhoneNumber(code, userSid);
|
||||
}
|
||||
|
||||
@ApiOperation("获取实名信息")
|
||||
@GetMapping("/getRealInfo/{userSid}")
|
||||
ResultBean<RealInfoVo> getRealInfo(@PathVariable("userSid")String userSid){
|
||||
ResultBean<RealInfoVo> getRealInfo(@PathVariable("userSid") String userSid) {
|
||||
return lpkCustomerService.getRealInfo(userSid);
|
||||
}
|
||||
|
||||
@ApiOperation("保存实名信息")
|
||||
@PostMapping("/saveRealInfo")
|
||||
ResultBean saveRealInfo(@RequestBody RealInfoDto dto){
|
||||
ResultBean saveRealInfo(@RequestBody RealInfoDto dto) {
|
||||
return lpkCustomerService.saveRealInfo(dto);
|
||||
}
|
||||
|
||||
@ApiOperation("客户绑定支行")
|
||||
@PostMapping("/updateCustomerBank")
|
||||
ResultBean updateCustomerBank(@RequestParam("userSid") String userSid, @RequestParam("customerBankSid") String customerBankSid) {
|
||||
return lpkCustomerService.updateCustomerBank(userSid,customerBankSid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ import com.yxt.common.core.result.FileUploadResult;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.yythmall.api.lpkcustomer.*;
|
||||
import com.yxt.yythmall.api.lpkcustomerbank.LpkCustomerBank;
|
||||
import com.yxt.yythmall.biz.lpkcustomerbank.LpkCustomerBankService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -43,7 +45,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
@Value("${weixin.miniprogram.secret:971fd3b8aa7b08ce3e8a5f3e502b1a8d}")
|
||||
String SECRET;
|
||||
|
||||
// 汇融惠享
|
||||
// 汇融惠享
|
||||
// String APP_ID = "wx4724e3a3c27f36b5";
|
||||
// String SECRET = "971fd3b8aa7b08ce3e8a5f3e502b1a8d";
|
||||
// 汇融云眼
|
||||
@@ -54,6 +56,9 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
// String SECRET = "e4572da4407573213377cd00e422397d";
|
||||
private static final String WX_URL_LOGIN = "https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code ";
|
||||
|
||||
@Autowired
|
||||
private LpkCustomerBankService lpkCustomerBankService;
|
||||
|
||||
public ResultBean<JSONObject> wxLogin(String jsCode, String appid, String secret) {
|
||||
ResultBean rb = new ResultBean();
|
||||
String url = WX_URL_LOGIN.replace("APPID", appid).replace("SECRET", secret).replace("JSCODE", jsCode).replace("authorization_code", "authorization_code");
|
||||
@@ -66,6 +71,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
|
||||
/**
|
||||
* 微信静默登录
|
||||
*
|
||||
* @param wxCode 临时凭证code值
|
||||
* @return ResultBean data:Token
|
||||
* 登陆成功后data返回用户Sid
|
||||
@@ -75,8 +81,8 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
// 通过wxCode获取unionid,失败返回微信的错误提示。
|
||||
|
||||
ResultBean<JSONObject> rbJsonObject = wxLogin(wxCode,APP_ID,SECRET);
|
||||
if (!rbJsonObject.getSuccess()){
|
||||
ResultBean<JSONObject> rbJsonObject = wxLogin(wxCode, APP_ID, SECRET);
|
||||
if (!rbJsonObject.getSuccess()) {
|
||||
JSONObject jsonObject = rbJsonObject.getData();
|
||||
String errcode = jsonObject.get("errcode").toString();
|
||||
String errmsg = jsonObject.get("errmsg").toString();
|
||||
@@ -84,20 +90,20 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
}
|
||||
// 判断存在不存在unionid,用户在开放平台的唯一标识符,若当前小程序已绑定到微信开放平台帐号下会返回,详见 UnionID 机制说明。、
|
||||
JSONObject jsonObject = rbJsonObject.getData();
|
||||
if (!jsonObject.containsKey("openid")){
|
||||
if (!jsonObject.containsKey("openid")) {
|
||||
return rb.setMsg("未获得openid,请联系管理员");
|
||||
}
|
||||
// String unionid = jsonObject.get("unionid").toString();
|
||||
String openid = jsonObject.get("openid").toString();
|
||||
Map<String,String> map=new HashMap<>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
// map.put("unionid",unionid);
|
||||
map.put("openid",openid);
|
||||
LpkCustomer lpkCustomer= baseMapper.selectOne(new QueryWrapper<LpkCustomer>().eq("wxMpOpenid",openid));
|
||||
map.put("openid", openid);
|
||||
LpkCustomer lpkCustomer = baseMapper.selectOne(new QueryWrapper<LpkCustomer>().eq("wxMpOpenid", openid));
|
||||
// List<LpkCustomer> lpkCustomer= baseMapper.getCustomer(openid);
|
||||
//查询用户是否存在
|
||||
if(null==lpkCustomer){
|
||||
if (null == lpkCustomer) {
|
||||
//新增用户
|
||||
LpkCustomer newCustomer=new LpkCustomer();
|
||||
LpkCustomer newCustomer = new LpkCustomer();
|
||||
newCustomer.setWxMpOpenid(openid);
|
||||
// newCustomer.setUnionId(unionid);
|
||||
newCustomer.setCreateTime(new Date());
|
||||
@@ -105,7 +111,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
newCustomer.setIsNewUser("1");
|
||||
newCustomer.setPhoto("headImage.png");
|
||||
LpkCustomer lpkCustomer1 = baseMapper.selectOwn();
|
||||
newCustomer.setNick("惠享客户000"+ (Integer.valueOf(lpkCustomer1.getId()).intValue() +1));
|
||||
newCustomer.setNick("惠享客户000" + (Integer.valueOf(lpkCustomer1.getId()).intValue() + 1));
|
||||
baseMapper.insert(newCustomer);
|
||||
// return rb.setData(newCustomer).setCode("110");
|
||||
StpUtil.login(newCustomer.getId());
|
||||
@@ -118,13 +124,13 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
// if(StringUtils.isBlank(lpkCustomer.getMobile())){
|
||||
// return rb.setData(lpkCustomer).setCode("110");
|
||||
// }
|
||||
if(StringUtils.isBlank(lpkCustomer.getPhoto())){
|
||||
if (StringUtils.isBlank(lpkCustomer.getPhoto())) {
|
||||
lpkCustomer.setPhoto("headImage.png");
|
||||
baseMapper.updateById(lpkCustomer);
|
||||
lpkCustomer = fetchBySid(lpkCustomer.getSid());
|
||||
}
|
||||
if(StringUtils.isBlank(lpkCustomer.getNick())){
|
||||
lpkCustomer.setNick("惠享客户000"+lpkCustomer.getId());
|
||||
if (StringUtils.isBlank(lpkCustomer.getNick())) {
|
||||
lpkCustomer.setNick("惠享客户000" + lpkCustomer.getId());
|
||||
baseMapper.updateById(lpkCustomer);
|
||||
lpkCustomer = fetchBySid(lpkCustomer.getSid());
|
||||
}
|
||||
@@ -134,21 +140,23 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
|
||||
return rb.success().setData(lpkCustomer);
|
||||
}
|
||||
|
||||
public ResultBean wxBindMobile(WxBindMobileDto wxBindMobileDto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
String mobile = wxBindMobileDto.getMobile();
|
||||
LpkCustomer lpkCustomer= baseMapper.selectOne(new QueryWrapper<LpkCustomer>().eq("wxMpOpenid",wxBindMobileDto.getOpenid()));
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
LpkCustomer lpkCustomer = baseMapper.selectOne(new QueryWrapper<LpkCustomer>().eq("wxMpOpenid", wxBindMobileDto.getOpenid()));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
lpkCustomer.setBindDate(sdf.format(new Date()));
|
||||
lpkCustomer.setMobile(mobile);
|
||||
baseMapper.updateById(lpkCustomer);
|
||||
return rb.success().setMsg("绑定成功").setData(lpkCustomer.getSid());
|
||||
}
|
||||
|
||||
public ResultBean<LpkCustomerVo> getCustomerInfo(String sid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
LpkCustomerVo lpkCustomer= baseMapper.getCustomerInfo(sid);
|
||||
LpkCustomerVo lpkCustomer = baseMapper.getCustomerInfo(sid);
|
||||
lpkCustomer.setPhoto(fileUploadComponent.getUrlPrefix() + lpkCustomer.getPhoto());
|
||||
if(StringUtils.isNotBlank(lpkCustomer.getMobile())){
|
||||
if (StringUtils.isNotBlank(lpkCustomer.getMobile())) {
|
||||
lpkCustomer.setMobile(lpkCustomer.getMobile().replaceAll("(?<=\\d{3})\\d{4}(?=\\d{4})", "****"));
|
||||
}
|
||||
return rb.success().setData(lpkCustomer);
|
||||
@@ -158,7 +166,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
LpkCustomerQuery query = pq.getParams();
|
||||
QueryWrapper<LpkCustomer> qw = new QueryWrapper<>();
|
||||
qw.eq("1","1");
|
||||
qw.eq("1", "1");
|
||||
if (StringUtils.isNotBlank(query.getMobile())) {
|
||||
qw.like("mobile", query.getMobile());
|
||||
}
|
||||
@@ -181,31 +189,31 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
|
||||
public ResultBean<String> modifyHeadImage(String userSid,MultipartFile file) {
|
||||
public ResultBean<String> modifyHeadImage(String userSid, MultipartFile file) {
|
||||
ResultBean<String> rb = ResultBean.fireFail();
|
||||
LpkCustomer lpkCustomer= fetchBySid(userSid);
|
||||
if(lpkCustomer == null){
|
||||
LpkCustomer lpkCustomer = fetchBySid(userSid);
|
||||
if (lpkCustomer == null) {
|
||||
return rb.setMsg("该客户信息不存在");
|
||||
}
|
||||
if (file == null || file.isEmpty()) {
|
||||
return rb.setMsg("文件为空");
|
||||
}
|
||||
ResultBean<FileUploadResult> resultBean =fileUploadComponent.uploadFile(file,null);
|
||||
ResultBean<FileUploadResult> resultBean = fileUploadComponent.uploadFile(file, null);
|
||||
FileUploadResult fileUploadResult = resultBean.getData();
|
||||
if(fileUploadResult != null && StringUtils.isNotBlank(fileUploadResult.getFullUrl())){
|
||||
if(fileUploadResult.getFullUrl().contains(fileUploadComponent.getUrlPrefix())){
|
||||
String headImageUrl = fileUploadResult.getFullUrl().replace(fileUploadComponent.getUrlPrefix(),"");
|
||||
if (fileUploadResult != null && StringUtils.isNotBlank(fileUploadResult.getFullUrl())) {
|
||||
if (fileUploadResult.getFullUrl().contains(fileUploadComponent.getUrlPrefix())) {
|
||||
String headImageUrl = fileUploadResult.getFullUrl().replace(fileUploadComponent.getUrlPrefix(), "");
|
||||
lpkCustomer.setPhoto(headImageUrl);
|
||||
}
|
||||
}
|
||||
baseMapper.updateById(lpkCustomer);
|
||||
return rb.success().setData(fileUploadComponent.getUrlPrefix()+lpkCustomer.getPhoto());
|
||||
return rb.success().setData(fileUploadComponent.getUrlPrefix() + lpkCustomer.getPhoto());
|
||||
}
|
||||
|
||||
public ResultBean modifyUserNickName(String userSid, String userNickName) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
LpkCustomer lpkCustomer= fetchBySid(userSid);
|
||||
if(lpkCustomer == null){
|
||||
LpkCustomer lpkCustomer = fetchBySid(userSid);
|
||||
if (lpkCustomer == null) {
|
||||
return rb.setMsg("该客户信息不存在");
|
||||
}
|
||||
lpkCustomer.setNick(userNickName);
|
||||
@@ -215,46 +223,55 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
|
||||
public ResultBean<CustomerInfoVo> getCustomerInfos(String userSid) {
|
||||
ResultBean<CustomerInfoVo> rb = ResultBean.fireFail();
|
||||
LpkCustomer lpkCustomer= fetchBySid(userSid);
|
||||
if(lpkCustomer == null){
|
||||
LpkCustomer lpkCustomer = fetchBySid(userSid);
|
||||
if (lpkCustomer == null) {
|
||||
return rb.setMsg("该客户信息不存在");
|
||||
}
|
||||
CustomerInfoVo customerInfoVo = baseMapper.getCustomerInfos(userSid);
|
||||
String photo = fileUploadComponent.getUrlPrefix()+customerInfoVo.getPhoto();
|
||||
String photo = fileUploadComponent.getUrlPrefix() + customerInfoVo.getPhoto();
|
||||
customerInfoVo.setPhoto(photo);
|
||||
if(StringUtils.isNotBlank(customerInfoVo.getPhone())){
|
||||
if (StringUtils.isNotBlank(customerInfoVo.getPhone())) {
|
||||
customerInfoVo.setPhone(customerInfoVo.getPhone().replaceAll("(?<=\\d{3})\\d{4}(?=\\d{4})", "****"));
|
||||
}else{
|
||||
} else {
|
||||
customerInfoVo.setPhone("获取");
|
||||
}
|
||||
if(StringUtils.isNotBlank(lpkCustomer.getRealName()) && StringUtils.isNotBlank(lpkCustomer.getRegionCode())){
|
||||
if (StringUtils.isNotBlank(lpkCustomer.getRealName()) && StringUtils.isNotBlank(lpkCustomer.getRegionCode())) {
|
||||
customerInfoVo.setRealAttestationExplain("已实名");
|
||||
}else{
|
||||
} else {
|
||||
customerInfoVo.setRealAttestationExplain("未实名");
|
||||
}
|
||||
if (StringUtils.isNotBlank(lpkCustomer.getCustomerBankSid())) {
|
||||
LpkCustomerBank lpkCustomerBank = lpkCustomerBankService.fetchBySid(lpkCustomer.getCustomerBankSid());
|
||||
if (lpkCustomerBank != null) {
|
||||
customerInfoVo.setCustomerBankName(lpkCustomerBank.getName());
|
||||
}
|
||||
}
|
||||
if(StringUtils.isBlank(customerInfoVo.getCustomerBankName())){
|
||||
customerInfoVo.setCustomerBankName("请选择支行");
|
||||
}
|
||||
return rb.success().setData(customerInfoVo);
|
||||
}
|
||||
|
||||
public ResultBean<String> getPhoneNumber(String code,String userSid) {
|
||||
public ResultBean<String> getPhoneNumber(String code, String userSid) {
|
||||
ResultBean<String> rb = ResultBean.fireFail();
|
||||
try {
|
||||
String objectStr = HttpUtil.post(String.format("https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=%s",getAccessToken()), "{\"code\":\""+code+"\"}");
|
||||
String objectStr = HttpUtil.post(String.format("https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=%s", getAccessToken()), "{\"code\":\"" + code + "\"}");
|
||||
log.info(objectStr);
|
||||
JSONObject jsonObject = JSON.parseObject(objectStr);
|
||||
String errCode = jsonObject.getString("errcode");
|
||||
if(!"0".equals(errCode)){
|
||||
if (!"0".equals(errCode)) {
|
||||
return rb.setMsg("微信code值失效");
|
||||
}
|
||||
jsonObject= jsonObject.getJSONObject("phone_info");
|
||||
jsonObject = jsonObject.getJSONObject("phone_info");
|
||||
String phone = jsonObject.getString("phoneNumber");
|
||||
LpkCustomer lpkCustomer = fetchBySid(userSid);
|
||||
if(lpkCustomer == null){
|
||||
if (lpkCustomer == null) {
|
||||
return rb.setMsg("该客户不存在");
|
||||
}
|
||||
lpkCustomer.setMobile(phone);
|
||||
baseMapper.updateById(lpkCustomer);
|
||||
return rb.success().setData(phone.replaceAll("(?<=\\d{3})\\d{4}(?=\\d{4})", "****"));
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("微信code解析异常", e.getMessage());
|
||||
}
|
||||
@@ -263,7 +280,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
|
||||
public String getAccessToken() {
|
||||
try {
|
||||
String objectStr = HttpUtil.get(String.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", APP_ID,SECRET));
|
||||
String objectStr = HttpUtil.get(String.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", APP_ID, SECRET));
|
||||
log.info(objectStr);
|
||||
JSONObject jsonObject = JSON.parseObject(objectStr);
|
||||
return jsonObject.getString("access_token");
|
||||
@@ -277,8 +294,8 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
public ResultBean<RealInfoVo> getRealInfo(String userSid) {
|
||||
ResultBean<RealInfoVo> rb = ResultBean.fireFail();
|
||||
LpkCustomer lpkCustomer = fetchBySid(userSid);
|
||||
if(lpkCustomer == null){
|
||||
return rb.setMsg("该客户不存在");
|
||||
if (lpkCustomer == null) {
|
||||
return rb.setMsg("该客户不存在");
|
||||
}
|
||||
RealInfoVo realInfoVo = new RealInfoVo();
|
||||
realInfoVo.setRealName(lpkCustomer.getRealName());
|
||||
@@ -292,15 +309,15 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
public ResultBean saveRealInfo(RealInfoDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
LpkCustomer lpkCustomer = fetchBySid(dto.getUserSid());
|
||||
if(lpkCustomer == null){
|
||||
if (lpkCustomer == null) {
|
||||
return rb.setMsg("该客户不存在");
|
||||
}
|
||||
if(StringUtils.isBlank(dto.getRealName())){
|
||||
if (StringUtils.isBlank(dto.getRealName())) {
|
||||
return rb.setMsg("真实姓名是必填项");
|
||||
}
|
||||
lpkCustomer.setRealName(dto.getRealName());
|
||||
lpkCustomer.setBirthDay(dto.getBirthDay());
|
||||
if(StringUtils.isBlank(dto.getRegionCode())){
|
||||
if (StringUtils.isBlank(dto.getRegionCode())) {
|
||||
return rb.setMsg("所在区域是必填项");
|
||||
}
|
||||
lpkCustomer.setRegionCode(dto.getRegionCode());
|
||||
@@ -309,4 +326,15 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
baseMapper.updateById(lpkCustomer);
|
||||
return rb.success();
|
||||
}
|
||||
|
||||
public ResultBean updateCustomerBank(String userSid, String customerBankSid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
LpkCustomer lpkCustomer = fetchBySid(userSid);
|
||||
if (lpkCustomer == null) {
|
||||
return rb.setMsg("该客户不存在");
|
||||
}
|
||||
lpkCustomer.setCustomerBankSid(customerBankSid);
|
||||
baseMapper.updateById(lpkCustomer);
|
||||
return rb.success();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yxt.yythmall.biz.lpkcustomerbank;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.yxt.yythmall.api.lpkcustomerbank.LpkCustomerBank;
|
||||
import com.yxt.yythmall.api.lpkcustomerbank.LpkCustomerBankVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: dimengzhe
|
||||
* @date: 2024/1/28
|
||||
**/
|
||||
@Mapper
|
||||
public interface LpkCustomerBankMapper extends BaseMapper<LpkCustomerBank> {
|
||||
IPage<LpkCustomerBankVo> selectPageVo(IPage<LpkCustomerBank> page, @Param(Constants.WRAPPER)QueryWrapper<LpkCustomerBank> qw);
|
||||
|
||||
List<LpkCustomerBankVo> getBankList(@Param(Constants.WRAPPER)QueryWrapper<LpkCustomerBank> qw);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yxt.yythmall.biz.lpkcustomerbank.LpkCustomerBankMapper">
|
||||
<select id="selectPageVo" resultType="com.yxt.yythmall.api.lpkcustomerbank.LpkCustomerBankVo">
|
||||
select lb.sid bankSid,
|
||||
lb.name bankName
|
||||
from lpk_customer_bank lb
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getBankList" resultType="com.yxt.yythmall.api.lpkcustomerbank.LpkCustomerBankVo">
|
||||
select lb.sid bankSid,
|
||||
lb.name bankName
|
||||
from lpk_customer_bank lb
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.yxt.yythmall.biz.lpkcustomerbank;
|
||||
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.yythmall.api.lpkbank.LpkBankQuery;
|
||||
import com.yxt.yythmall.api.lpkbank.LpkBankVo;
|
||||
import com.yxt.yythmall.api.lpkcustomerbank.LpkCustomerBankQuery;
|
||||
import com.yxt.yythmall.api.lpkcustomerbank.LpkCustomerBankVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: dimengzhe
|
||||
* @date: 2024/1/28
|
||||
**/
|
||||
@Api(tags = "支行信息(十八家支行)")
|
||||
@RestController
|
||||
@RequestMapping("LpkCustomerBank")
|
||||
public class LpkCustomerBankRest {
|
||||
|
||||
@Autowired
|
||||
private LpkCustomerBankService lpkCustomerBankService;
|
||||
|
||||
@ApiOperation("分页列表")
|
||||
@PostMapping("/listPage")
|
||||
public ResultBean<PagerVo<LpkCustomerBankVo>> ListPageVo(@RequestBody PagerQuery<LpkCustomerBankQuery> pq) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
PagerVo<LpkCustomerBankVo> pv = lpkCustomerBankService.listPageVo(pq);
|
||||
return rb.success().setData(pv);
|
||||
}
|
||||
|
||||
@ApiOperation("支行信息列表")
|
||||
@GetMapping("/getBankList")
|
||||
ResultBean<List<LpkCustomerBankVo>> getBankList(@RequestParam(value = "name", required = false) String name) {
|
||||
return lpkCustomerBankService.getBankList(name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.yxt.yythmall.biz.lpkcustomerbank;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.yxt.common.base.service.MybatisBaseService;
|
||||
import com.yxt.common.base.utils.PagerUtil;
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.yythmall.api.lpkbank.LpkBankQuery;
|
||||
import com.yxt.yythmall.api.lpkbank.LpkBankVo;
|
||||
import com.yxt.yythmall.api.lpkcustomerbank.LpkCustomerBank;
|
||||
import com.yxt.yythmall.api.lpkcustomerbank.LpkCustomerBankQuery;
|
||||
import com.yxt.yythmall.api.lpkcustomerbank.LpkCustomerBankVo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: dimengzhe
|
||||
* @date: 2024/1/28
|
||||
**/
|
||||
@Service
|
||||
public class LpkCustomerBankService extends MybatisBaseService<LpkCustomerBankMapper, LpkCustomerBank> {
|
||||
|
||||
|
||||
public PagerVo<LpkCustomerBankVo> listPageVo(PagerQuery<LpkCustomerBankQuery> pq) {
|
||||
LpkCustomerBankQuery query = pq.getParams();
|
||||
QueryWrapper<LpkCustomerBank> qw = new QueryWrapper<>();
|
||||
if (query != null) {
|
||||
if (StringUtils.isNotBlank(query.getName())) {
|
||||
qw.like("lb.name", query.getName());
|
||||
}
|
||||
}
|
||||
IPage<LpkCustomerBank> page = PagerUtil.queryToPage(pq);
|
||||
IPage<LpkCustomerBankVo> pagging = baseMapper.selectPageVo(page, qw);
|
||||
PagerVo<LpkCustomerBankVo> p = PagerUtil.pageToVo(pagging, null);
|
||||
return p;
|
||||
}
|
||||
|
||||
public ResultBean<List<LpkCustomerBankVo>> getBankList(String name) {
|
||||
ResultBean<List<LpkCustomerBankVo>> rb = ResultBean.fireFail();
|
||||
QueryWrapper<LpkCustomerBank> qw = new QueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
qw.like("lb.name", name);
|
||||
}
|
||||
List<LpkCustomerBankVo> list = baseMapper.getBankList(qw);
|
||||
list.removeAll(Collections.singleton(null));
|
||||
return rb.success().setData(list);
|
||||
}
|
||||
}
|
||||
@@ -104,6 +104,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
.excludePathPatterns("/lpkcustomer/getRealInfo/**")
|
||||
.excludePathPatterns("/lpkcustomer/saveRealInfo")
|
||||
.excludePathPatterns("/pms/PmsBrand/getList")
|
||||
.excludePathPatterns("/LpkCustomerBank/getBankList")
|
||||
.excludePathPatterns("/lpkcustomer/updateCustomerBank")
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user