Browse Source

实名信息相关接口

master
dimengzhe 1 year ago
parent
commit
95f698dbd9
  1. 3
      src/main/java/com/yxt/yythmall/api/lpkcustomer/CustomerInfoVo.java
  2. 9
      src/main/java/com/yxt/yythmall/api/lpkcustomer/LpkCustomer.java
  3. 25
      src/main/java/com/yxt/yythmall/api/lpkcustomer/RealInfoDto.java
  4. 24
      src/main/java/com/yxt/yythmall/api/lpkcustomer/RealInfoVo.java
  5. 38
      src/main/java/com/yxt/yythmall/api/region/Region.java
  6. 16
      src/main/java/com/yxt/yythmall/biz/lpkcustomer/LpkCustomerRest.java
  7. 45
      src/main/java/com/yxt/yythmall/biz/lpkcustomer/LpkCustomerService.java
  8. 19
      src/main/java/com/yxt/yythmall/biz/region/RegionRest.java
  9. 2
      src/main/java/com/yxt/yythmall/config/SaTokenConfigure.java

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

@ -18,5 +18,8 @@ public class CustomerInfoVo {
private String phone;
@ApiModelProperty("是否实名:已实名或未实名")
private String realAttestationExplain;
}

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

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ -34,4 +35,12 @@ public class LpkCustomer {
private String photo;
@TableField(exist = false)
private String token;
@ApiModelProperty("性别")
private String sex;
@ApiModelProperty("生日")
private String birthDay;
@ApiModelProperty("所在区域code")
private String regionCode;
@ApiModelProperty("所在区域名称")
private String regionName;
}

25
src/main/java/com/yxt/yythmall/api/lpkcustomer/RealInfoDto.java

@ -0,0 +1,25 @@
package com.yxt.yythmall.api.lpkcustomer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description:
* @author: dimengzhe
* @date: 2024/1/19
**/
@Data
public class RealInfoDto {
private String userSid;
@ApiModelProperty("所在区县code")
private String regionCode;
@ApiModelProperty("所在区域名称:拼接省/市/县区")
private String regionName;
@ApiModelProperty("生日")
private String birthDay;
@ApiModelProperty("真实姓名")
private String realName;
@ApiModelProperty("性别:男/女")
private String sex;
}

24
src/main/java/com/yxt/yythmall/api/lpkcustomer/RealInfoVo.java

@ -0,0 +1,24 @@
package com.yxt.yythmall.api.lpkcustomer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description:
* @author: dimengzhe
* @date: 2024/1/19
**/
@Data
public class RealInfoVo {
@ApiModelProperty("所在区域code")
private String regionCode;
@ApiModelProperty("所在区域名称")
private String regionName;
@ApiModelProperty("真实姓名")
private String realName;
@ApiModelProperty("性别")
private String sex;
@ApiModelProperty("生日")
private String birthDay;
}

38
src/main/java/com/yxt/yythmall/api/region/Region.java

@ -0,0 +1,38 @@
package com.yxt.yythmall.api.region;
import com.yxt.common.core.domain.BaseEntity;
import lombok.Data;
/**
* @description:
* @author: dimengzhe
* @date: 2024/1/19
**/
@Data
public class Region extends BaseEntity {
/**
* 名称区域名称
*/
private String name;
/**
* 级别
*/
private Integer level;
/**
* 行政区划代码
*/
private String districtCode;
/**
* 上级sid
*/
private String pSid;
/**
* sid全路径Idprovincesid/citysid/countysid/townsid
*/
private String sidPath;
/**
* 排序号
*/
private String sortNo;
}

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

@ -4,10 +4,7 @@ import cn.hutool.core.util.IdUtil;
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.lpkcustomer.CustomerInfoVo;
import com.yxt.yythmall.api.lpkcustomer.LpkCustomerQuery;
import com.yxt.yythmall.api.lpkcustomer.LpkCustomerVo;
import com.yxt.yythmall.api.lpkcustomer.WxBindMobileDto;
import com.yxt.yythmall.api.lpkcustomer.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.junit.Test;
@ -81,4 +78,15 @@ public class LpkCustomerRest {
return lpkCustomerService.getPhoneNumber(code,userSid);
}
@ApiOperation("获取实名信息")
@GetMapping("/getRealInfo/{userSid}")
ResultBean<RealInfoVo> getRealInfo(@PathVariable("userSid")String userSid){
return lpkCustomerService.getRealInfo(userSid);
}
@ApiOperation("保存实名信息")
@PostMapping("/saveRealInfo")
ResultBean saveRealInfo(@RequestBody RealInfoDto dto){
return lpkCustomerService.saveRealInfo(dto);
}
}

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

@ -101,7 +101,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
newCustomer.setWxMpOpenid(openid);
// newCustomer.setUnionId(unionid);
newCustomer.setCreateTime(new Date());
newCustomer.setPhoto("headImage.jpg");
newCustomer.setPhoto("headImage.png");
LpkCustomer lpkCustomer1 = baseMapper.selectOwn();
newCustomer.setNick("小主000"+ Integer.valueOf(lpkCustomer1.getId()) +1);
baseMapper.insert(newCustomer);
@ -117,7 +117,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
// return rb.setData(lpkCustomer).setCode("110");
// }
if(StringUtils.isBlank(lpkCustomer.getPhoto())){
lpkCustomer.setPhoto("headImage.jpg");
lpkCustomer.setPhoto("headImage.png");
baseMapper.updateById(lpkCustomer);
lpkCustomer = fetchBySid(lpkCustomer.getSid());
}
@ -222,6 +222,11 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
}else{
customerInfoVo.setPhone("获取");
}
if(StringUtils.isNotBlank(lpkCustomer.getRealName()) && StringUtils.isNotBlank(lpkCustomer.getRegionCode())){
customerInfoVo.setRealAttestationExplain("已实名");
}else{
customerInfoVo.setRealAttestationExplain("未实名");
}
return rb.success().setData(customerInfoVo);
}
@ -263,4 +268,40 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
}
return null;
}
public ResultBean<RealInfoVo> getRealInfo(String userSid) {
ResultBean<RealInfoVo> rb = ResultBean.fireFail();
LpkCustomer lpkCustomer = fetchBySid(userSid);
if(lpkCustomer == null){
return rb.setMsg("该客户不存在");
}
RealInfoVo realInfoVo = new RealInfoVo();
realInfoVo.setRealName(lpkCustomer.getRealName());
realInfoVo.setRegionCode(lpkCustomer.getRegionCode());
realInfoVo.setBirthDay(lpkCustomer.getBirthDay());
realInfoVo.setRegionName(lpkCustomer.getRegionName());
realInfoVo.setSex(lpkCustomer.getSex());
return rb.success().setData(realInfoVo);
}
public ResultBean saveRealInfo(RealInfoDto dto) {
ResultBean rb = ResultBean.fireFail();
LpkCustomer lpkCustomer = fetchBySid(dto.getUserSid());
if(lpkCustomer == null){
return rb.setMsg("该客户不存在");
}
if(StringUtils.isBlank(dto.getRealName())){
return rb.setMsg("真实姓名是必填项");
}
lpkCustomer.setRealName(dto.getRealName());
lpkCustomer.setBirthDay(dto.getBirthDay());
if(StringUtils.isBlank(dto.getRegionCode())){
return rb.setMsg("所在区域是必填项");
}
lpkCustomer.setRegionCode(dto.getRegionCode());
lpkCustomer.setRegionName(dto.getRegionName());
lpkCustomer.setSex(dto.getSex());
baseMapper.updateById(lpkCustomer);
return rb.success();
}
}

19
src/main/java/com/yxt/yythmall/biz/region/RegionRest.java

@ -0,0 +1,19 @@
package com.yxt.yythmall.biz.region;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @description:
* @author: dimengzhe
* @date: 2024/1/19
**/
@Api(tags = "区域信息")
@RestController
@RequestMapping("Region")
public class RegionRest {
}

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

@ -78,6 +78,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
.excludePathPatterns("/lpkcustomer/modifyHeadImage")
.excludePathPatterns("/upload/**")
.excludePathPatterns("/lpkcustomer/getPhoneNumber")
.excludePathPatterns("/lpkcustomer/getRealInfo/**")
.excludePathPatterns("/lpkcustomer/saveRealInfo")
;
}
}

Loading…
Cancel
Save