Browse Source

客户绑定支行

master
dimengzhe 1 year ago
parent
commit
902a689fd5
  1. 2
      src/main/java/com/yxt/yythmall/api/lpkcustomer/CustomerInfoVo.java
  2. 3
      src/main/java/com/yxt/yythmall/api/lpkcustomer/LpkCustomer.java
  3. 29
      src/main/java/com/yxt/yythmall/api/lpkcustomerbank/LpkCustomerBank.java
  4. 19
      src/main/java/com/yxt/yythmall/api/lpkcustomerbank/LpkCustomerBankQuery.java
  5. 17
      src/main/java/com/yxt/yythmall/api/lpkcustomerbank/LpkCustomerBankVo.java
  6. 9
      src/main/java/com/yxt/yythmall/biz/lpkcustomer/LpkCustomerRest.java
  7. 28
      src/main/java/com/yxt/yythmall/biz/lpkcustomer/LpkCustomerService.java
  8. 24
      src/main/java/com/yxt/yythmall/biz/lpkcustomerbank/LpkCustomerBankMapper.java
  9. 21
      src/main/java/com/yxt/yythmall/biz/lpkcustomerbank/LpkCustomerBankMapper.xml
  10. 45
      src/main/java/com/yxt/yythmall/biz/lpkcustomerbank/LpkCustomerBankRest.java
  11. 54
      src/main/java/com/yxt/yythmall/biz/lpkcustomerbank/LpkCustomerBankService.java
  12. 2
      src/main/java/com/yxt/yythmall/config/SaTokenConfigure.java

2
src/main/java/com/yxt/yythmall/api/lpkcustomer/CustomerInfoVo.java

@ -20,6 +20,8 @@ public class CustomerInfoVo {
@ApiModelProperty("是否实名:已实名或未实名")
private String realAttestationExplain;
@ApiModelProperty("客户绑定的支行名称")
private String customerBankName;
}

3
src/main/java/com/yxt/yythmall/api/lpkcustomer/LpkCustomer.java

@ -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;
}

29
src/main/java/com/yxt/yythmall/api/lpkcustomerbank/LpkCustomerBank.java

@ -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;
}

19
src/main/java/com/yxt/yythmall/api/lpkcustomerbank/LpkCustomerBankQuery.java

@ -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;
}

17
src/main/java/com/yxt/yythmall/api/lpkcustomerbank/LpkCustomerBankVo.java

@ -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;
}

9
src/main/java/com/yxt/yythmall/biz/lpkcustomer/LpkCustomerRest.java

@ -42,11 +42,13 @@ 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) {
return lpkCustomerService.getCustomerInfo(sid);
}
@Test
public void a() {
long id = IdUtil.createSnowflake(1, 1).nextId();
@ -83,10 +85,17 @@ public class LpkCustomerRest {
ResultBean<RealInfoVo> getRealInfo(@PathVariable("userSid") String userSid) {
return lpkCustomerService.getRealInfo(userSid);
}
@ApiOperation("保存实名信息")
@PostMapping("/saveRealInfo")
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);
}
}

28
src/main/java/com/yxt/yythmall/biz/lpkcustomer/LpkCustomerService.java

@ -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;
@ -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
@ -134,6 +140,7 @@ 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();
@ -144,6 +151,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
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);
@ -232,6 +240,15 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
} 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);
}
@ -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();
}
}

24
src/main/java/com/yxt/yythmall/biz/lpkcustomerbank/LpkCustomerBankMapper.java

@ -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);
}

21
src/main/java/com/yxt/yythmall/biz/lpkcustomerbank/LpkCustomerBankMapper.xml

@ -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>

45
src/main/java/com/yxt/yythmall/biz/lpkcustomerbank/LpkCustomerBankRest.java

@ -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);
}
}

54
src/main/java/com/yxt/yythmall/biz/lpkcustomerbank/LpkCustomerBankService.java

@ -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);
}
}

2
src/main/java/com/yxt/yythmall/config/SaTokenConfigure.java

@ -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")
;
}
}

Loading…
Cancel
Save