Commit cf6a2474 by zhangxingmin

Merge remote-tracking branch 'origin/test' into dev_zxm_test

# Conflicts:
#	yd-csf-service/pom.xml
parents ead1306e 761f4605
# 基础镜像
FROM openjdk:8
# 维护人
LABEL maintainer="zxm<2060197959@qq.com>"
# 创建目录
RUN mkdir -p /home/app
# 拷贝项目jar - 使用可执行的 fat JAR
COPY target/yd-csf-api-1.0-SNAPSHOT-exec.jar /home/app/yd-csf-api.jar
# 执行命令启动jar
ENTRYPOINT ["java", "-jar", "/home/app/yd-csf-api.jar"]
# 暴露端口
EXPOSE 9202
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
<artifactId>yd-csf-api</artifactId> <artifactId>yd-csf-api</artifactId>
<dependencies> <dependencies>
<dependency>
<groupId>com.yd</groupId>
<artifactId>yd-user-feign</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
...@@ -69,6 +74,10 @@ ...@@ -69,6 +74,10 @@
<groupId>com.yd</groupId> <groupId>com.yd</groupId>
<artifactId>yd-csf-service</artifactId> <artifactId>yd-csf-service</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
</dependencies> </dependencies>
......
...@@ -13,7 +13,7 @@ public class CsfApiApplication { ...@@ -13,7 +13,7 @@ public class CsfApiApplication {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(CsfApiApplication.class) new SpringApplicationBuilder(CsfApiApplication.class)
.properties("spring.application.name="+ ServerNameConstants.ydCsfApi) .properties("spring.application.name=" + "yd-csf-api")
.build().run(args); .build().run(args);
System.out.println("(♥◠‿◠)ノ゙ yd-csf-api启动成功 ლ(´ڡ`ლ)゙ "); System.out.println("(♥◠‿◠)ノ゙ yd-csf-api启动成功 ლ(´ڡ`ლ)゙ ");
} }
......
package com.yd.csf.api.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yd.common.exception.BusinessException;
import com.yd.common.result.Result;
import com.yd.common.utils.RandomStringGenerator;
import com.yd.csf.service.common.ErrorCode;
import com.yd.csf.service.dto.CustomerAddRequest;
import com.yd.csf.service.dto.CustomerQueryRequest;
import com.yd.csf.service.dto.FnaQueryRequest;
import com.yd.csf.service.model.Customer;
import com.yd.csf.service.model.CustomerExpand;
import com.yd.csf.service.service.CustomerService;
import com.yd.csf.service.utils.ValidateUtil;
import com.yd.csf.service.vo.CustomerVO;
import com.yd.csf.service.vo.FnaVO;
import com.yd.user.feign.client.sysuser.ApiSysUserFeignClient;
import com.yd.csf.service.service.CustomerExpandService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* customer接口
*
* @author jianan
* @since 2025-07-31
*/
@RestController
@RequestMapping("/Customer")
@Tag(name = "客户接口")
public class ApiCustomerController {
@Resource
private CustomerService customerService;
@Resource
private CustomerExpandService customerExpandService;
@Resource
private ApiSysUserFeignClient apiSysUserFeignClient;
/**
* 创建客户
*
* @param customerAddRequest
* @param request
* @return
*/
@Operation(summary = "创建客户")
@PostMapping("/add")
@Transactional(rollbackFor = Exception.class)
public Result<String> addCustomer(@RequestBody CustomerAddRequest customerAddRequest, HttpServletRequest request) {
if (customerAddRequest == null) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
// 校验 请求 对象中,参数是否全部为空
if (ValidateUtil.isAllFieldsNull(customerAddRequest)) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
// 客户主表信息
Customer customer = new Customer();
BeanUtils.copyProperties(customerAddRequest, customer);
// 客户扩展表信息
CustomerExpand customerExpand = customerService.getCustomerExpand(customerAddRequest);
// 客户主表业务唯一id
customer.setCustomerBizId(RandomStringGenerator.generateBizId16("customer"));
boolean result = customerService.save(customer);
if (!result) {
return Result.fail(ErrorCode.OPERATION_ERROR.getCode(), ErrorCode.OPERATION_ERROR.getMessage());
}
// 客户扩展表信息,非空时,写入数据库
if (!ValidateUtil.isAllFieldsNull(customerAddRequest)) {
// 主表业务唯一id
customerExpand.setCustomerBizId(customer.getCustomerBizId());
// 客户扩展表业务唯一id
customerExpand.setCustomerExpandBizId(RandomStringGenerator.generateBizId16("customer_expand"));
// 写入数据库
boolean resultExpand = customerExpandService.save(customerExpand);
if (!resultExpand) {
return Result.fail(ErrorCode.OPERATION_ERROR.getCode(), ErrorCode.OPERATION_ERROR.getMessage());
}
// 更新客户主表
Customer updateCustomer = new Customer();
updateCustomer.setId(customer.getId());
updateCustomer.setCustomerExpandBizId(customerExpand.getCustomerBizId());
customerService.updateById(updateCustomer);
}
// Result<GetLoginInfoResponse> loginUser = apiSysUserFeignClient.getLoginInfo();
// customer.setUserBizId(loginUser.getData().getApiLoginUserInfoResponse().getUserBizId());
// 返回新写入的数据 id
String newFnaId = customer.getCustomerBizId();
return Result.success(newFnaId);
}
/**
* 删除fna
*
* @param deleteRequest
* @param request
* @return
*/
// @PostMapping("/delete")
// public Result<Boolean> deleteFna(@RequestBody DeleteRequest deleteRequest, HttpServletRequest request) {
// if (deleteRequest == null || deleteRequest.getId() <= 0) {
// throw new BusinessException(ErrorCode.PARAMS_ERROR);
// }
// User user = userService.getLoginUser(request);
// long id = deleteRequest.getId();
// // 判断是否存在
// Customer oldFna = customerService.getById(id);
// ThrowUtils.throwIf(oldFna == null, ErrorCode.NOT_FOUND_ERROR);
// // 仅本人或管理员可删除
// if (!oldFna.getUserId().equals(user.getId()) && !userService.isAdmin(request)) {
// throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
// }
// // 操作数据库
// boolean result = customerService.removeById(id);
// ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
// return Result.success(true);
// }
/**
* 更新fna(仅管理员可用)
*
* @param fnaUpdateRequest
* @return
*/
// @PostMapping("/update")
// @AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
// public Result<Boolean> updateFna(@RequestBody FnaUpdateRequest fnaUpdateRequest) {
// if (fnaUpdateRequest == null || fnaUpdateRequest.getId() <= 0) {
// throw new BusinessException(ErrorCode.PARAMS_ERROR);
// }
// // todo 在此处将实体类和 DTO 进行转换
// Customer customer = new Customer();
// BeanUtils.copyProperties(fnaUpdateRequest, customer);
// // 数据校验
// customerService.validFna(customer, false);
// // 判断是否存在
// long id = fnaUpdateRequest.getId();
// Customer oldFna = customerService.getById(id);
// ThrowUtils.throwIf(oldFna == null, ErrorCode.NOT_FOUND_ERROR);
// // 操作数据库
// boolean result = customerService.updateById(customer);
// ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
// return Result.success(true);
// }
/**
* 根据 customerBizId 获取客户(封装类)
*
* @param customerBizId
* @return
*/
@GetMapping("/get/vo")
@Operation(summary = "根据 customerBizId 获取客户详情")
public Result<CustomerVO> getCustomerVOByCustomerBizId(@RequestParam("customerBizId") String customerBizId, HttpServletRequest request) {
if (customerBizId == null) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
// 查询数据库
Customer customer = customerService.getByCustomerBizId(customerBizId);
if (customer == null) {
return Result.fail(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
}
// 获取封装类
return Result.success(customerService.getCustomerVO(customer));
}
/**
* 分页获取客户列表(仅管理员可用)
*
* @param fnaQueryRequest
* @return
*/
// @PostMapping("/list/page")
// public Result<Page<Customer>> listFnaByPage(@RequestBody FnaQueryRequest fnaQueryRequest) {
// long current = fnaQueryRequest.getPageNo();
// long size = fnaQueryRequest.getPageSize();
// // 查询数据库
// Page<Customer> fnaPage = customerService.page(new Page<>(current, size),
// customerService.getQueryWrapper(fnaQueryRequest));
// return Result.success(fnaPage);
// }
/**
* 分页获取客户列表(VO)
*
* @param customerQueryRequest
* @param request
* @return
*/
@PostMapping("/list/page/vo")
@Operation(summary = "分页获取客户列表")
public Result<Page<CustomerVO>> listCustomerVOByPage(@RequestBody CustomerQueryRequest customerQueryRequest,
HttpServletRequest request) {
long current = customerQueryRequest.getPageNo();
long size = customerQueryRequest.getPageSize();
// 查询数据库
Page<Customer> customerPage = customerService.page(new Page<>(current, size),
customerService.getQueryWrapper(customerQueryRequest));
// 获取封装类
return Result.success(customerService.getCustomerVOPage(customerPage));
}
}
package com.yd.csf.api.controller;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yd.common.exception.BusinessException;
import com.yd.common.result.Result;
import com.yd.common.utils.RandomStringGenerator;
import com.yd.csf.service.common.ErrorCode;
import com.yd.csf.service.dto.DeleteFnaRequest;
import com.yd.csf.service.dto.FnaAddRequest;
import com.yd.csf.service.dto.FnaQueryRequest;
import com.yd.csf.service.dto.FnaUpdateRequest;
import com.yd.csf.service.model.Customer;
import com.yd.csf.service.model.Fna;
import com.yd.csf.service.service.FnaService;
import com.yd.csf.service.vo.FnaVO;
import com.yd.user.feign.client.sysuser.ApiSysUserFeignClient;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* Fna接口
*
* @author jianan
* @since 2025-08-31
*/
@RestController
@RequestMapping("/Fna")
@Tag(name = "Fna接口")
public class ApiFnaController {
@Resource
private FnaService fnaService;
@Resource
private ApiSysUserFeignClient apiSysUserFeignClient;
/**
* 创建fna
*
* @param fnaAddRequest
* @param request
* @return
*/
@PostMapping("/add")
@Operation(summary = "创建Fna")
@Transactional(rollbackFor = Exception.class)
public Result<String> addFna(@RequestBody FnaAddRequest fnaAddRequest, HttpServletRequest request) {
if (fnaAddRequest == null) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
Fna fna = new Fna();
BeanUtils.copyProperties(fnaAddRequest, fna);
// 获取Security上下文当前用户的登录信息
// AuthUserDto authUserDto = SecurityUtil.getCurrentLoginUser();
// String userBizId = authUserDto.getUserBizId();
String userBizId = "user_dMnkKPIwemvY0zhk";
fna.setUserBizId(userBizId);
fna.setFnaBizId(RandomStringGenerator.generateBizId16("fna"));
fna.setCreatorId(userBizId);
fna.setUpdaterId(userBizId);
// 写入数据库
boolean result = fnaService.save(fna);
if (!result) {
return Result.fail(ErrorCode.OPERATION_ERROR.getCode(), ErrorCode.OPERATION_ERROR.getMessage());
}
// 更新 fna_no
Fna updateFna = new Fna();
updateFna.setId(fna.getId());
updateFna.setFnaNo(fna.getId());
fnaService.updateById(updateFna);
// 返回新写入的数据 id
String newFnaId = fna.getFnaBizId();
return Result.success(newFnaId);
}
/**
* 删除fna
*
* @param deleteRequest
* @param request
* @return
*/
@PostMapping("/delete")
@Operation(summary = "删除Fna")
public Result<Boolean> deleteFna(@RequestBody DeleteFnaRequest deleteRequest, HttpServletRequest request) {
if (deleteRequest == null || deleteRequest.getId() == null) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
Long id = deleteRequest.getId();
// 判断是否存在
Fna oldFna = fnaService.getById(id);
if (oldFna == null) {
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
}
// 仅本人或管理员可删除
// if (!oldFna.getUserId().equals(user.getId()) && !userService.isAdmin(request)) {
// throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
// }
// 操作数据库
oldFna.setIsDeleted(1);
boolean result = fnaService.updateById(oldFna);
if (!result) {
return Result.fail(ErrorCode.OPERATION_ERROR.getCode(), ErrorCode.OPERATION_ERROR.getMessage());
}
return Result.success(true);
}
/**
* 更新 Fna
*
* @param fnaUpdateRequest
* @return
*/
@PostMapping("/update")
@Operation(summary = "更新Fna")
public Result<Boolean> updateFna(@RequestBody FnaUpdateRequest fnaUpdateRequest) {
if (fnaUpdateRequest == null || StringUtils.isBlank(fnaUpdateRequest.getFnaBizId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
// 判断是否存在
String fnaBizId = fnaUpdateRequest.getFnaBizId();
Fna fna = fnaService.getByBizId(fnaBizId);
if (fna == null) {
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
}
BeanUtils.copyProperties(fnaUpdateRequest, fna,"fnaBizId");
// 操作数据库
boolean result = fnaService.updateById(fna);
if (!result) {
return Result.fail(ErrorCode.OPERATION_ERROR.getCode(), ErrorCode.OPERATION_ERROR.getMessage());
}
return Result.success(true);
}
/**
* 根据 id 获取fna(封装类)
*
* @param id
* @return
*/
@GetMapping("/get/vo")
@Operation(summary = "根据id获取FnaVO")
public Result<FnaVO> getFnaVOById(long id, HttpServletRequest request) {
if (id == 0) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
// 查询数据库
Fna fna = fnaService.getById(id);
if (fna == null) {
return Result.fail(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
}
// 获取封装类
return Result.success(fnaService.getFnaVO(fna));
}
/**
* 分页获取fna列表(仅管理员可用)
*
* @param fnaQueryRequest
* @return
*/
@PostMapping("/list/page")
@Operation(summary = "分页获取Fna列表")
public Result<Page<FnaVO>> listFnaByPage(@RequestBody FnaQueryRequest fnaQueryRequest) {
long current = fnaQueryRequest.getPageNo();
long size = fnaQueryRequest.getPageSize();
// 查询数据库
Page<Fna> fnaPage = fnaService.page(new Page<>(current, size),
fnaService.getQueryWrapper(fnaQueryRequest));
return Result.success(fnaService.getFnaVOPage(fnaPage));
}
/**
* 分页获取fna列表(封装类)
*
* @param fnaQueryRequest
* @param request
* @return
*/
// @PostMapping("/list/page/vo")
// public Result<Page<Fna>> listFnaVOByPage(@RequestBody FnaQueryRequest fnaQueryRequest,
// HttpServletRequest request) {
// long current = fnaQueryRequest.getPageNo();
// long size = fnaQueryRequest.getPageSize();
//
// // 查询数据库
// Page<Fna> fnaPage = fnaService.page(new Page<>(current, size),
// fnaService.getQueryWrapper(fnaQueryRequest));
// // 获取封装类
//// return Result.success(fnaService.getFnaVOPage(fnaPage, request));
//
// return Result.success(fnaPage);
// }
}
package com.yd.csf.api.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yd.common.result.Result;
import com.yd.common.utils.RandomStringGenerator;
import com.yd.csf.service.common.ErrorCode;
import com.yd.csf.service.dto.FnaFormAddRequest;
import com.yd.csf.service.dto.FnaFormQueryRequest;
import com.yd.csf.service.model.FnaForm;
import com.yd.csf.service.service.FnaFormService;
import com.yd.csf.service.vo.FnaFormVO;
import com.yd.user.feign.client.sysuser.ApiSysUserFeignClient;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* Fna表单接口
*
* @author jianan
* @since 2025-08-31
*/
@RestController
@RequestMapping("/FnaForm")
@Tag(name = "Fna表单接口")
public class ApiFnaFormController {
@Resource
private FnaFormService fnaFormService;
@Resource
private ApiSysUserFeignClient apiSysUserFeignClient;
/**
* 创建 Fna表单
*
* @param fnaFormAddRequest
* @param request
* @return
*/
@PostMapping("/add")
public Result<String> addFnaForm(@RequestBody FnaFormAddRequest fnaFormAddRequest, HttpServletRequest request) {
if (fnaFormAddRequest == null) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
// 校验
fnaFormService.validFnaFormAdd(fnaFormAddRequest);
// 转换为数据库实体
FnaForm fnaForm = fnaFormService.getFnaForm(fnaFormAddRequest);
// 获取Security上下文当前用户的登录信息
// AuthUserDto authUserDto = SecurityUtil.getCurrentLoginUser();
// String userBizId = authUserDto.getUserBizId();
String userBizId = "user_dMnkKPIwemvY0zhk";
fnaForm.setUserBizId(userBizId);
fnaForm.setFnaFormBizId(RandomStringGenerator.generateBizId16("fna_form"));
fnaForm.setCreatorId(userBizId);
fnaForm.setUpdaterId(userBizId);
// 写入数据库
boolean result = fnaFormService.save(fnaForm);
if (!result) {
return Result.fail(ErrorCode.OPERATION_ERROR.getCode(), ErrorCode.OPERATION_ERROR.getMessage());
}
// 返回新写入的数据 id
String newFnaFormId = fnaForm.getFnaFormBizId();
return Result.success(newFnaFormId);
}
/**
* 删除fna
*
* @param deleteRequest
* @param request
* @return
*/
// @PostMapping("/delete")
// public Result<Boolean> deleteFna(@RequestBody DeleteRequest deleteRequest, HttpServletRequest request) {
// if (deleteRequest == null || deleteRequest.getId() <= 0) {
// throw new BusinessException(ErrorCode.PARAMS_ERROR);
// }
// User user = userService.getLoginUser(request);
// long id = deleteRequest.getId();
// // 判断是否存在
// FnaForm oldFna = fnaFormService.getById(id);
// ThrowUtils.throwIf(oldFna == null, ErrorCode.NOT_FOUND_ERROR);
// // 仅本人或管理员可删除
// if (!oldFna.getUserId().equals(user.getId()) && !userService.isAdmin(request)) {
// throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
// }
// // 操作数据库
// boolean result = fnaFormService.removeById(id);
// ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
// return Result.success(true);
// }
/**
* 更新fna(仅管理员可用)
*
* @param fnaUpdateRequest
* @return
*/
// @PostMapping("/update")
// @AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
// public Result<Boolean> updateFna(@RequestBody FnaUpdateRequest fnaUpdateRequest) {
// if (fnaUpdateRequest == null || fnaUpdateRequest.getId() <= 0) {
// throw new BusinessException(ErrorCode.PARAMS_ERROR);
// }
// // todo 在此处将实体类和 DTO 进行转换
// FnaForm fnaForm = new FnaForm();
// BeanUtils.copyProperties(fnaUpdateRequest, fnaForm);
// // 数据校验
// fnaFormService.validFna(fnaForm, false);
// // 判断是否存在
// long id = fnaUpdateRequest.getId();
// FnaForm oldFna = fnaFormService.getById(id);
// ThrowUtils.throwIf(oldFna == null, ErrorCode.NOT_FOUND_ERROR);
// // 操作数据库
// boolean result = fnaFormService.updateById(fnaForm);
// ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
// return Result.success(true);
// }
/**
* 根据 fnaFormBizId 获取fna表单(封装类)
*
* @param fnaFormBizId
* @return
*/
@GetMapping("/get/vo")
@Operation(summary = "根据 fnaFormBizId 获取Fna表单详情")
public Result<FnaForm> getFnaFormVOByFnaFormBizId(String fnaFormBizId, HttpServletRequest request) {
if (fnaFormBizId == null) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
// 查询数据库
FnaForm fnaForm = fnaFormService.getByFnaFormBizId(fnaFormBizId);
if (fnaForm == null) {
return Result.fail(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
}
// 获取封装类
return Result.success(fnaForm);
}
/**
* 分页获取fna表单列表(仅管理员可用)
*
* @param fnaFormQueryRequest
* @return
*/
// @PostMapping("/list/page")
// public Result<Page<FnaForm>> listFnaFormByPage(@RequestBody FnaFormQueryRequest fnaFormQueryRequest) {
// long current = fnaFormQueryRequest.getPageNo();
// long size = fnaFormQueryRequest.getPageSize();
// // 查询数据库
// Page<FnaForm> fnaPage = fnaFormService.page(new Page<>(current, size),
// fnaFormService.getQueryWrapper(fnaFormQueryRequest));
// return Result.success(fnaPage);
// }
/**
* 分页获取fna表单列表(封装类)
*
* @param fnaFormQueryRequest
* @param request
* @return
*/
// @PostMapping("/list/page/vo")
// public Result<Page<FnaForm>> listFnaFormVOByPage(@RequestBody FnaFormQueryRequest fnaFormQueryRequest,
// HttpServletRequest request) {
// long current = fnaFormQueryRequest.getPageNo();
// long size = fnaFormQueryRequest.getPageSize();
//
// // 查询数据库
// Page<FnaForm> fnaPage = fnaFormService.page(new Page<>(current, size),
// fnaFormService.getQueryWrapper(fnaFormQueryRequest));
// // 获取封装类
//// return Result.success(fnaFormService.getFnaVOPage(fnaPage, request));
//
// return Result.success(fnaPage);
// }
}
...@@ -4,6 +4,8 @@ spring: ...@@ -4,6 +4,8 @@ spring:
# active: '@spring.profiles.active@' # active: '@spring.profiles.active@'
--- ---
spring: spring:
application:
name: yd-csf-api
profiles: dev profiles: dev
main: main:
allow-bean-definition-overriding: true allow-bean-definition-overriding: true
...@@ -31,6 +33,8 @@ spring: ...@@ -31,6 +33,8 @@ spring:
server-addr: ${spring.cloud.nacos.config.server-addr} server-addr: ${spring.cloud.nacos.config.server-addr}
--- ---
spring: spring:
application:
name: yd-csf-api
profiles: test profiles: test
main: main:
allow-bean-definition-overriding: true allow-bean-definition-overriding: true
......
...@@ -12,6 +12,25 @@ ...@@ -12,6 +12,25 @@
<artifactId>yd-csf-service</artifactId> <artifactId>yd-csf-service</artifactId>
<dependencies> <dependencies>
<!-- gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!-- knife4j -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
<version>4.3.0</version>
</dependency>
<!-- https://hutool.cn/docs/index.html#/-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.8</version>
</dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
......
package com.yd.csf.service.common;
/**
* 自定义错误码
*
*/
public enum ErrorCode {
SUCCESS(0, "ok"),
PARAMS_ERROR(40000, "请求参数错误"),
NOT_LOGIN_ERROR(40100, "未登录"),
NO_AUTH_ERROR(40101, "无权限"),
NOT_FOUND_ERROR(40400, "请求数据不存在"),
FORBIDDEN_ERROR(40300, "禁止访问"),
SYSTEM_ERROR(50000, "系统内部异常"),
OPERATION_ERROR(50001, "操作失败");
/**
* 状态码
*/
private final int code;
/**
* 信息
*/
private final String message;
ErrorCode(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
}
package com.yd.csf.service.dao;
import com.yd.csf.service.model.CustomerExpand;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author Zhang Jianan
* @description 针对表【customer_expand(CSF客户信息扩展表)】的数据库操作Mapper
* @createDate 2025-09-03 17:48:36
* @Entity generator.domain.CustomerExpand
*/
public interface CustomerExpandMapper extends BaseMapper<CustomerExpand> {
}
package com.yd.csf.service.dao;
import com.yd.csf.service.model.Customer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author Zhang Jianan
* @description 针对表【customer(客户信息表)】的数据库操作Mapper
* @createDate 2025-08-29 17:38:23
* @Entity generator.domain.Customer
*/
public interface CustomerMapper extends BaseMapper<Customer> {
}
package com.yd.csf.service.dao;
import com.yd.csf.service.model.FnaForm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author Zhang Jianan
* @description 针对表【fna_form(fna表单表)】的数据库操作Mapper
* @createDate 2025-09-05 11:19:10
* @Entity generator.domain.FnaForm
*/
public interface FnaFormMapper extends BaseMapper<FnaForm> {
}
package com.yd.csf.service.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yd.csf.service.model.Fna;
/**
* @author Zhang Jianan
* @description 针对表【fna(fna表)】的数据库操作Mapper
* @createDate 2025-08-29 14:29:15
* @Entity generator.domain.Fna
*/
public interface FnaMapper extends BaseMapper<Fna> {
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class CompanyBusinessData {
@Schema(description = "公司過去兩年平均純利 (HKD)")
private String averageNetProfit;
@Schema(description = "公司現時大約的總資產 (HKD)")
private String estimatedTotalAssets;
@Schema(description = "資產所佔百分比 (%)")
private String assetPercentage;
}
package com.yd.csf.service.dto;
import com.yd.csf.service.vo.AddressVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 创建customer请求
*
*/
@Data
public class CustomerAddRequest implements Serializable {
/**
* 自定义代码
*/
// private String customCode;
/**
* 姓氏
*/
@Schema(description = "姓氏")
private String lastName;
/**
* 名字
*/
@Schema(description = "名字")
private String firstName;
/**
* 姓名
*/
@Schema(description = "姓名")
private String name;
/**
* 姓氏拼音
*/
@Schema(description = "姓氏拼音")
private String lastNamePinyin;
/**
* 名字拼音
*/
@Schema(description = "名字拼音")
private String firstNamePinyin;
/**
* 拼音全称
*/
@Schema(description = "姓名拼音")
private String pinyin;
/**
* 称谓
*/
@Schema(description = "称谓")
private String title;
/**
* 性别
*/
@Schema(description = "性别")
private Object gender;
/**
* 生日
*/
@Schema(description = "生日")
private Date birthday;
/**
* 出生日期
*/
@Schema(description = "客户出生日期")
private Date birthdate;
/**
* 异常信息
*/
@Schema(description = "客户异常信息")
private String abnormal;
/**
* 年龄
*/
@Schema(description = "年龄")
private String age;
/**
* 地区代码
*/
@Schema(description = "地区代码")
private String areaCode;
/**
* 电话号码
*/
@Schema(description = "电话号码")
private String phone;
/**
* 电子邮箱
*/
@Schema(description = "电子邮箱")
private String email;
/**
* 是否吸烟
*/
@Schema(description = "是否吸烟")
private String smoke;
/**
* 吸烟数量
*/
@Schema(description = "吸烟数量")
private String smokeQuantity;
/**
* 公司类型
*/
@Schema(description = "公司类型")
private String companyType;
/**
* 来源
*/
@Schema(description = "客户来源")
private String source;
/**
* 证件类型
*/
@Schema(description = "证件类型")
private String idType;
/**
* 证件号码
*/
@Schema(description = "证件号码")
private String idCard;
/**
* 护照号
*/
@Schema(description = "护照号")
private String passport;
/**
* 往来港澳通行证号码
*/
@Schema(description = "往来港澳通行证号码")
private String eepCode;
/**
* 婚姻状况
*/
@Schema(description = "婚姻状况")
private Object marriage;
/**
* 出生地
*/
@Schema(description = "出生地")
private String birthplace;
/**
* 教育程度
*/
@Schema(description = "教育程度")
private Object education;
/**
* 国家
*/
@Schema(description = "国家")
private String country;
// region 客户扩展信息
/**
* 客户类型
*/
@Schema(description = "客户类型 个人-INDIVIDUAL, 企业-COMPANY")
private String customerType;
/**
* 居住地区代码
*/
@Schema(description = "居住地区代码")
private String residenceAreaCode;
/**
* 住宅电话
*/
@Schema(description = "住宅电话")
private String residenceTelephone;
/**
* 是否长期出国
*/
@Schema(description = "是否长期出国")
private String longtimeAbroad;
/**
* 居住地址
*/
private AddressVO residenceAddress;
/**
* 住宅地址
*/
private AddressVO residentialAddress;
/**
* 邮寄地址
*/
private AddressVO mailingAddress;
/**
* 公司地址
*/
private AddressVO companyAddress;
/**
* 公司名称
*/
@Schema(description = "公司名称")
private String companyName;
/**
* 公司地区代码
*/
@Schema(description = "公司地区代码")
private String companyAreaCode;
/**
* 公司电话
*/
@Schema(description = "公司电话")
private String companyTelephone;
/**
* 职位
*/
@Schema(description = "职位")
private String position;
/**
* 工作年限
*/
@Schema(description = "工作年限")
private String workYear;
/**
* 薪资
*/
@Schema(description = "薪资")
private BigDecimal salary;
// endregion
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 编辑customer请求
*
*/
@Data
public class CustomerEditRequest implements Serializable {
/**
* id
*/
private Long id;
/**
* 标题
*/
private String title;
/**
* 内容
*/
private String content;
/**
* 标签列表
*/
private List<String> tags;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import com.yd.common.dto.PageDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* 查询customer请求
*
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class CustomerQueryRequest extends PageDto implements Serializable {
/**
* 客户名称
*/
@Schema(description = "客户名称")
private String name;
/**
* 标题
*/
@Schema(description = "手机号")
private String phone;
/**
* 内容
*/
@Schema(description = "邮箱")
private String email;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 更新customer请求
*
*/
@Data
public class CustomerUpdateRequest implements Serializable {
/**
* id
*/
private Long id;
/**
* 标题
*/
private String title;
/**
* 内容
*/
private String content;
/**
* 标签列表
*/
private List<String> tags;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import lombok.Data;
@Data
public class DeleteFnaRequest {
private Long id;
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "个人已有保障")
public class ExistingSecurity {
@Schema(description = "保险公司")
private String insurer;
@Schema(description = "保障类型")
private String insuranceType;
@Schema(description = "保额 (HKD)")
private String sumInsured;
@Schema(description = "保单签发日期")
private String policyIssueDate;
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "受保人个人已有保障", allOf = ExistingSecuritys.class)
public class ExistingSecurityInsured extends ExistingSecuritys {
// 不需要额外字段,只是为了文档化区分
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "保单持有人个人已有保障", allOf = ExistingSecuritys.class)
public class ExistingSecurityOwner extends ExistingSecuritys {
// 不需要额外字段,只是为了文档化区分
}
\ No newline at end of file
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "个人已有保障-existingSecurityOwner/受保人个人已有保障-existingSecurityInsured")
public class ExistingSecuritys {
/**
* 个人已有保障1
*/
private ExistingSecurity existingSecurity1;
/**
* 个人已有保障2
*/
private ExistingSecurity existingSecurity2;
/**
* 个人已有保障3
*/
private ExistingSecurity existingSecurity3;
/**
* 个人已有保障4
*/
private ExistingSecurity existingSecurity4;
/**
* 个人已有保障5
*/
private ExistingSecurity existingSecurity5;
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "家庭成员")
public class FamilyMember {
@Schema(description = "是否需要供养")
private String needProvide;
@Schema(description = "年龄")
private String age;
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
public class FamilyMembers {
private FamilyMember father;
private FamilyMember mother;
private FamilyMember spouse;
private List<FamilyMember> children;
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable;
/**
* 创建fna请求
*
*/
@Data
@Tag(name = "创建fna请求")
public class FnaAddRequest implements Serializable {
/**
* 系统用户唯一业务ID
*/
@Schema(description = "系统用户唯一业务ID")
private String userBizId;
/**
* 客户唯一业务ID
*/
@Schema(description = "客户唯一业务ID")
private String customerBizId;
/**
* Fna表单唯一业务ID
*/
@Schema(description = "Fna表单唯一业务ID")
private String fnaFormBizId;
/**
* 预约编号
*/
@Schema(description = "预约编号")
private String appointmentNo;
/**
* 预约信息主表唯一业务ID
*/
@Schema(description = "预约信息主表唯一业务ID")
private String appointmentBizId;
/**
* 核保编号
*/
@Schema(description = "核保编号")
private String underwritingNo;
/**
* 新单跟进ID
*/
@Schema(description = "新单跟进ID")
private String policyId;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 状态
*/
@Schema(description = "状态")
private Object status;
/**
* 产品代码
*/
@Schema(description = "产品代码")
private String productCode;
/**
* 产品名称
*/
@Schema(description = "产品名称")
private String productName;
/**
* 相关URL
*/
@Schema(description = "相关URL")
private String url;
/**
* 通用备注
*/
@Schema(description = "通用备注")
private String remark;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 编辑fna请求
*
*/
@Data
public class FnaEditRequest implements Serializable {
/**
* id
*/
private Long id;
/**
* 标题
*/
private String title;
/**
* 内容
*/
private String content;
/**
* 标签列表
*/
private List<String> tags;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 创建Fna表单请求
*
*/
@Data
public class FnaFormAddRequest implements Serializable {
/**
* 客户唯一业务ID
*/
@Schema(description = "客户唯一业务ID")
private String customerBizId;
/**
* 个人资料
*/
@Schema(description = "个人资料")
private PersonalData personalData;
/**
* 家庭状况
*/
@Schema(description = "家庭状况(父亲-father/母亲-mother/配偶-spouse/子女-children)")
private FamilyMembers familyMembers;
/**
* 保单持有人个人已有保障
*/
private ExistingSecuritys existingSecurityOwner;
/**
* 受保人个人已有保障
*/
private ExistingSecuritys existingSecurityInsured;
/**
* 平均月收入
*/
@Schema(description = "平均月收入")
private String monthlyIncome;
/**
* 平均月支出
*/
@Schema(description = "平均月支出")
private String monthlyExpense;
/**
* 累积流动资产
*/
@Schema(description = "累积流动资产")
private String liquidAssets;
/**
* 流动资产种类(A.现金 B.银行存款……)
*/
@Schema(description = "流动资产种类(A.现金 B.银行存款……)")
private String liquidAssetType;
/**
* 保单持有人资产
*/
@Schema(description = "保单持有人资产")
private OwnerAssets ownerAssets;
/**
* 公司业务资料
*/
@Schema(description = "公司业务资料")
private CompanyBusinessData companyBusinessData;
@Schema(description = "首期及续保保费的财富来源(A.储蓄 B.受雇收入 C.自雇收入 D.投资收入)")
private String premiumFundingSource;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 编辑Fna表单请求
*
*/
@Data
public class FnaFormEditRequest implements Serializable {
/**
* id
*/
private Long id;
/**
* 标题
*/
private String title;
/**
* 内容
*/
private String content;
/**
* 标签列表
*/
private List<String> tags;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import com.yd.common.dto.PageDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* 查询Fna表单请求
*
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class FnaFormQueryRequest extends PageDto implements Serializable {
/**
* id
*/
private Long id;
/**
* id
*/
private Long notId;
/**
* 搜索词
*/
private String searchText;
/**
* 标题
*/
private String title;
/**
* 内容
*/
private String content;
/**
* 标签列表
*/
private List<String> tags;
/**
* 创建用户 id
*/
private Long userId;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 更新Fna表单请求
*
*/
@Data
public class FnaFormUpdateRequest implements Serializable {
/**
* id
*/
private Long id;
/**
* 标题
*/
private String title;
/**
* 内容
*/
private String content;
/**
* 标签列表
*/
private List<String> tags;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import com.yd.common.dto.PageDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* 查询fna请求
*
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class FnaQueryRequest extends PageDto implements Serializable {
/**
* 客户姓名
*/
@Schema(description = "客户姓名")
private String customerName;
/**
* 预约编号
*/
@Schema(description = "预约编号")
private String appointmentNo;
/**
* 新单编号
*/
@Schema(description = "新单编号")
private String policyId;
/**
* 保单号
*/
@Schema(description = "保单号")
private String policyNo;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 更新fna请求
*
*/
@Data
public class FnaUpdateRequest implements Serializable {
/**
* fna唯一业务ID
*/
@Schema(description = "fna唯一业务ID")
private String fnaBizId;
/**
* 预约编号
*/
@Schema(description = "预约编号")
private String appointmentNo;
/**
* 新单编号
*/
@Schema(description = "新单编号")
private String policyId;
/**
* 保单号
*/
@Schema(description = "保单号")
private String policyNo;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "投資房地產")
public class InvestmentProperties {
@Schema(description = "地址")
private String address;
@Schema(description = "市值(HKD)")
private String marketValue;
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class OwnerAssets {
private OwnerProperties primaryResidence1;
private OwnerProperties primaryResidence2;
private InvestmentProperties investment1;
private InvestmentProperties investment2;
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "自住用途之房地產")
public class OwnerProperties {
@Schema(description = "地址")
private String address;
@Schema(description = "市值(HKD)")
private String marketValue;
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class PersonalData {
@Schema(description = "陪同顾问姓名")
private String accountName;
@Schema(description = "陪同顾问手机号")
private String accountPhone;
@Schema(description = "理财顾问注册编号")
private String registrationNumber;
@Schema(description = "理财顾问内部编码")
private String number;
@Schema(description = "客户姓名")
private String customerName;
@Schema(description = "税务国家")
private String taxCountry;
@Schema(description = "就业情况")
private String employment;
@Schema(description = "其他就业情况")
private String otherEmployment;
@Schema(description = "是否退休")
private String isRetired;
@Schema(description = "退休年龄")
private String retiredAge;
}
package com.yd.csf.service.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 客户信息表
* @TableName customer
*/
@TableName(value ="customer")
@Data
public class Customer implements Serializable {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 唯一业务ID
*/
private String customerBizId;
/**
* 自定义代码
*/
private String customCode;
/**
* 姓氏
*/
private String lastName;
/**
* 名字
*/
private String firstName;
/**
* 姓名
*/
private String name;
/**
* 姓氏拼音
*/
private String lastNamePinyin;
/**
* 名字拼音
*/
private String firstNamePinyin;
/**
* 拼音全称
*/
private String pinyin;
/**
* 称谓
*/
private String title;
/**
* 性别
*/
private Object gender;
/**
* 出生日期
*/
private Date birthdate;
/**
* 异常信息
*/
private String abnormal;
/**
* 年龄
*/
private String age;
/**
* 地区代码
*/
private String areaCode;
/**
* 电话号码
*/
private String phone;
/**
* 电子邮箱
*/
private String email;
/**
* 是否吸烟
*/
private String smoke;
/**
* 吸烟数量
*/
private String smokeQuantity;
/**
* 公司类型
*/
private String companyType;
/**
* 来源
*/
private String source;
/**
* 证件类型
*/
private String idType;
/**
* 证件号码
*/
private String idCard;
/**
* 护照号
*/
private String passport;
/**
* EEP代码
*/
private String eepCode;
/**
* 婚姻状况
*/
private Object marriage;
/**
* 出生地
*/
private String birthplace;
/**
* 教育程度
*/
private Object education;
/**
* 签单用户扩展唯一业务ID
*/
private String customerExpandBizId;
/**
* 国家
*/
private String country;
/**
* 通用备注
*/
private String remark;
/**
* 删除标识: 0-正常, 1-删除
*/
private Integer isDeleted;
/**
* 创建人ID
*/
private String creatorId;
/**
* 更新人ID
*/
private String updaterId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.yd.csf.service.vo.AddressVO;
import lombok.Data;
/**
* CSF客户信息扩展表
* @TableName customer_expand
*/
@TableName(value ="customer_expand")
@Data
public class CustomerExpand implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 客户扩展唯一业务ID
*/
private String customerExpandBizId;
/**
* 客户信息唯一标识(业务ID)
*/
private String customerBizId;
/**
* 客户类型
*/
private Object customerType;
/**
* 居住地区代码
*/
private String residenceAreaCode;
/**
* 住宅电话
*/
private String residenceTelephone;
/**
* 是否长期出国
*/
private String longtimeAbroad;
/**
* 居住地址
*/
private String residenceAddress;
/**
* 住宅地址
*/
private String residentialAddress;
/**
* 邮寄地址
*/
private String mailingAddress;
/**
* 公司地址
*/
private String companyAddress;
/**
* 公司名称
*/
private String companyName;
/**
* 公司地区代码
*/
private String companyAreaCode;
/**
* 公司电话
*/
private String companyTelephone;
/**
* 职位
*/
private String position;
/**
* 工作年限
*/
private String workYear;
/**
* 薪资
*/
private BigDecimal salary;
/**
* 通用备注
*/
private String remark;
/**
* 删除标识: 0-正常, 1-删除
*/
private Integer isDeleted;
/**
* 创建人ID
*/
private String creatorId;
/**
* 更新人ID
*/
private String updaterId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* fna表
* @TableName fna
*/
@TableName(value ="fna")
@Data
public class Fna implements Serializable {
/**
* id
*/
@TableId
private Long id;
/**
* fna唯一业务ID
*/
private String fnaBizId;
/**
* 财富需要分析编号
*/
private Long fnaNo;
/**
* 系统用户唯一业务ID
*/
private String userBizId;
/**
* 客户名称
*/
private String customerName;
/**
* 客户唯一业务ID
*/
private String customerBizId;
/**
* Fna表单唯一业务ID
*/
private String fnaFormBizId;
/**
* 预约编号
*/
private String appointmentNo;
/**
* 预约信息主表唯一业务ID
*/
private String appointmentBizId;
/**
* 预订状态提示
*/
private String bookingStatusTip;
/**
* 核保编号
*/
private String underwritingNo;
/**
* 保单ID
*/
private String policyId;
/**
* 保单编号
*/
private String policyNo;
/**
* 状态
*/
private Object status;
/**
* 产品代码
*/
private String productCode;
/**
* 产品名称
*/
private String productName;
/**
* 相关URL
*/
private String url;
/**
* 是否可编辑: 0-否, 1-是
*/
private Integer edit;
/**
* 通用备注
*/
private String remark;
/**
* 删除标识: 0-正常, 1-删除
*/
private Integer isDeleted;
/**
* 创建人ID
*/
private String creatorId;
/**
* 更新人ID
*/
private String updaterId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* fna表单表
* @TableName fna_form
*/
@TableName(value ="fna_form")
@Data
public class FnaForm implements Serializable {
/**
* id
*/
@TableId
private Long id;
/**
* fna唯一业务ID
*/
private String fnaFormBizId;
/**
* 系统用户唯一业务ID
*/
private String userBizId;
/**
* 理财顾问资料业务ID(查询个人资料)
*/
private String agentBizId;
/**
* 客户唯一业务ID
*/
private String customerBizId;
/**
* 个人资料
*/
private Object personalData;
/**
* 家庭状况
*/
private Object familyMembers;
/**
* 保单持有人个人已有保障
*/
private Object existingSecurityOwner;
/**
* 受保人个人已有保障
*/
private Object existingSecurityInsured;
/**
* 平均月收入
*/
private String monthlyIncome;
/**
* 平均月支出
*/
private String monthlyExpense;
/**
* 累积流动资产
*/
private String liquidAssets;
/**
* 流动资产种类(A.现金 B.银行存款……)
*/
private String liquidAssetType;
/**
* 保单持有人资产
*/
private Object ownerAssets;
/**
* 公司业务资料
*/
private Object companyBusinessData;
/**
* 首期及续保保费的财富来源(A.储蓄 B.受雇收入 C.自雇收入 D.投资收入)
*/
private String premiumFundingSource;
/**
* 通用备注
*/
private String remark;
/**
* 删除标识: 0-正常, 1-删除
*/
private Integer isDeleted;
/**
* 创建人ID
*/
private String creatorId;
/**
* 更新人ID
*/
private String updaterId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.csf.service.service;
import com.yd.csf.service.model.CustomerExpand;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author Zhang Jianan
* @description 针对表【customer_expand(CSF客户信息扩展表)】的数据库操作Service
* @createDate 2025-09-03 17:48:36
*/
public interface CustomerExpandService extends IService<CustomerExpand> {
}
package com.yd.csf.service.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yd.csf.service.dto.CustomerAddRequest;
import com.yd.csf.service.dto.CustomerQueryRequest;
import com.yd.csf.service.dto.FnaQueryRequest;
import com.yd.csf.service.model.Customer;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yd.csf.service.model.CustomerExpand;
import com.yd.csf.service.vo.CustomerVO;
import com.yd.csf.service.vo.FnaVO;
/**
* @author Zhang Jianan
* @description 针对表【customer(客户信息表)】的数据库操作Service
* @createDate 2025-08-29 17:38:23
*/
public interface CustomerService extends IService<Customer> {
CustomerVO getCustomerVO(Customer customer);
Wrapper<Customer> getQueryWrapper(CustomerQueryRequest customerQueryRequest);
CustomerExpand getCustomerExpand(CustomerAddRequest customerAddRequest);
Page<CustomerVO> getCustomerVOPage(Page<Customer> customerPage);
Customer getByCustomerBizId(String customerBizId);
}
package com.yd.csf.service.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yd.csf.service.dto.FnaFormAddRequest;
import com.yd.csf.service.dto.FnaFormQueryRequest;
import com.yd.csf.service.model.FnaForm;
import com.yd.csf.service.vo.FnaFormVO;
/**
* Fna表单服务
*
*/
public interface FnaFormService extends IService<FnaForm> {
/**
* 校验数据
*
* @param fnaForm
* @param add 对创建的数据进行校验
*/
void validFnaForm(FnaForm fnaForm, boolean add);
/**
* 获取查询条件
*
* @param fnaFormQueryRequest
* @return
*/
QueryWrapper<FnaForm> getQueryWrapper(FnaFormQueryRequest fnaFormQueryRequest);
/**
* 获取Fna表单封装
*
* @param fnaForm
* @return
*/
FnaFormVO getFnaFormVO(FnaForm fnaForm);
/**
* 分页获取Fna表单封装
*
* @param fnaFormPage
* @return
*/
Page<FnaFormVO> getFnaFormVOPage(Page<FnaForm> fnaFormPage);
void validFnaFormAdd(FnaFormAddRequest fnaFormAddRequest);
FnaForm getFnaForm(FnaFormAddRequest fnaFormAddRequest);
FnaForm getByFnaFormBizId(String fnaFormBizId);
}
package com.yd.csf.service.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yd.csf.service.dto.FnaQueryRequest;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yd.csf.service.model.Fna;
import com.yd.csf.service.vo.FnaVO;
/**
* @author Zhang Jianan
* @description 针对表【fna(fna表)】的数据库操作Service
* @createDate 2025-08-29 14:29:15
*/
public interface FnaService extends IService<Fna> {
boolean addFna(Fna fna);
/**
* 获取查询条件
*
* @param fnaQueryRequest
* @return
*/
QueryWrapper<Fna> getQueryWrapper(FnaQueryRequest fnaQueryRequest);
/**
* 获取fna封装
*
* @param fna
* @return
*/
FnaVO getFnaVO(Fna fna);
/**
* 分页获取fna封装
*
* @param fnaPage
* @return
*/
Page<FnaVO> getFnaVOPage(Page<Fna> fnaPage);
Fna getByBizId(String fnaBizId);
boolean updateByBizId(Fna fna);
}
package com.yd.csf.service.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yd.csf.service.model.CustomerExpand;
import com.yd.csf.service.service.CustomerExpandService;
import com.yd.csf.service.dao.CustomerExpandMapper;
import org.springframework.stereotype.Service;
/**
* @author Zhang Jianan
* @description 针对表【customer_expand(CSF客户信息扩展表)】的数据库操作Service实现
* @createDate 2025-09-03 17:48:36
*/
@Service
public class CustomerExpandServiceImpl extends ServiceImpl<CustomerExpandMapper, CustomerExpand>
implements CustomerExpandService{
}
package com.yd.csf.service.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.Gson;
import com.yd.csf.service.dao.CustomerMapper;
import com.yd.csf.service.dto.CustomerAddRequest;
import com.yd.csf.service.dto.CustomerQueryRequest;
import com.yd.csf.service.dto.FnaQueryRequest;
import com.yd.csf.service.model.Customer;
import com.yd.csf.service.model.CustomerExpand;
import com.yd.csf.service.service.CustomerExpandService;
import com.yd.csf.service.service.CustomerService;
import com.yd.csf.service.vo.AddressVO;
import com.yd.csf.service.vo.CustomerExpandVO;
import com.yd.csf.service.vo.CustomerVO;
import com.yd.csf.service.vo.FnaVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Zhang Jianan
* @description 针对表【customer(客户信息表)】的数据库操作Service实现
* @createDate 2025-08-29 17:38:23
*/
@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
implements CustomerService{
private final static Gson GSON = new Gson();
@Resource
private CustomerExpandService customerExpandService;
@Override
public CustomerVO getCustomerVO(Customer customer) {
return CustomerVO.objToVo(customer);
}
@Override
public Wrapper<Customer> getQueryWrapper(CustomerQueryRequest customerQueryRequest) {
return null;
}
@Override
public CustomerExpand getCustomerExpand(CustomerAddRequest customerAddRequest) {
CustomerExpand customerExpand = new CustomerExpand();
BeanUtils.copyProperties(customerAddRequest, customerExpand);
AddressVO residenceAddress = customerAddRequest.getResidenceAddress();
if (residenceAddress != null) {
customerExpand.setResidenceAddress(residenceAddress.toString());
}
AddressVO residentialAddress = customerAddRequest.getResidentialAddress();
if (residentialAddress != null) {
customerExpand.setResidentialAddress(residentialAddress.toString());
}
AddressVO mailingAddress = customerAddRequest.getMailingAddress();
if (mailingAddress != null) {
customerExpand.setMailingAddress(mailingAddress.toString());
}
AddressVO companyAddress = customerAddRequest.getCompanyAddress();
if (companyAddress != null) {
customerExpand.setCompanyAddress(companyAddress.toString());
}
return customerExpand;
}
@Override
public Page<CustomerVO> getCustomerVOPage(Page<Customer> customerPage) {
List<Customer> customerList = customerPage.getRecords();
Page<CustomerVO> customerVOPage = new Page<>(customerPage.getCurrent(), customerPage.getSize(), customerPage.getTotal());
if (CollUtil.isEmpty(customerList)) {
return customerVOPage;
}
// 对象列表 => 封装对象列表
List<CustomerVO> customerVOList = customerList.stream().map(CustomerVO::objToVo).collect(Collectors.toList());
// 1. 关联查询扩展信息
Set<String> customerIdSet = customerList.stream().map(Customer::getCustomerBizId).collect(Collectors.toSet());
Map<String, List<CustomerExpand>> customerBizIdCustomerExpandListMap = customerExpandService.listByIds(customerIdSet).stream()
.collect(Collectors.groupingBy(CustomerExpand::getCustomerBizId));
// 填充信息
customerVOList.forEach(customerVO -> {
String customerBizId = customerVO.getCustomerBizId();
CustomerExpand customerExpand = null;
if (customerBizIdCustomerExpandListMap.containsKey(customerBizId)) {
customerExpand = customerBizIdCustomerExpandListMap.get(customerBizId).get(0);
}
customerVO.setCustomerExpand(CustomerExpandVO.objToVo(customerExpand));
});
// endregion
customerVOPage.setRecords(customerVOList);
return customerVOPage;
}
@Override
public Customer getByCustomerBizId(String customerBizId) {
return baseMapper.selectOne(new LambdaQueryWrapper<Customer>().eq(Customer::getCustomerBizId, customerBizId));
}
}
package com.yd.csf.service.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.Gson;
import com.yd.common.exception.BusinessException;
import com.yd.csf.service.common.ErrorCode;
import com.yd.csf.service.dao.FnaFormMapper;
import com.yd.csf.service.dto.FnaFormAddRequest;
import com.yd.csf.service.dto.FnaFormQueryRequest;
import com.yd.csf.service.model.FnaForm;
import com.yd.csf.service.service.FnaFormService;
import com.yd.csf.service.vo.FnaFormVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Fna表单服务实现
*
*/
@Service
@Slf4j
public class FnaFormServiceImpl extends ServiceImpl<FnaFormMapper, FnaForm> implements FnaFormService {
// @Resource
// private UserService userService;
private final static Gson GSON = new Gson();
/**
* 校验数据
*
* @param fnaForm
* @param add 对创建的数据进行校验
*/
@Override
public void validFnaForm(FnaForm fnaForm, boolean add) {
// ThrowUtils.throwIf(fnaForm == null, ErrorCode.PARAMS_ERROR);
// // todo 从对象中取值
// String title = fnaForm.getTitle();
// // 创建数据时,参数不能为空
// if (add) {
// // todo 补充校验规则
// ThrowUtils.throwIf(StringUtils.isBlank(title), ErrorCode.PARAMS_ERROR);
// }
// // 修改数据时,有参数则校验
// // todo 补充校验规则
// if (StringUtils.isNotBlank(title)) {
// ThrowUtils.throwIf(title.length() > 80, ErrorCode.PARAMS_ERROR, "标题过长");
// }
}
/**
* 获取查询条件
*
* @param fnaFormQueryRequest
* @return
*/
@Override
public QueryWrapper<FnaForm> getQueryWrapper(FnaFormQueryRequest fnaFormQueryRequest) {
QueryWrapper<FnaForm> queryWrapper = new QueryWrapper<>();
if (fnaFormQueryRequest == null) {
return queryWrapper;
}
// todo 从对象中取值
Long id = fnaFormQueryRequest.getId();
Long notId = fnaFormQueryRequest.getNotId();
String title = fnaFormQueryRequest.getTitle();
String content = fnaFormQueryRequest.getContent();
String searchText = fnaFormQueryRequest.getSearchText();
List<String> tagList = fnaFormQueryRequest.getTags();
Long userId = fnaFormQueryRequest.getUserId();
// todo 补充需要的查询条件
// 从多字段中搜索
if (StringUtils.isNotBlank(searchText)) {
// 需要拼接查询条件
queryWrapper.and(qw -> qw.like("title", searchText).or().like("content", searchText));
}
// 模糊查询
queryWrapper.like(StringUtils.isNotBlank(title), "title", title);
queryWrapper.like(StringUtils.isNotBlank(content), "content", content);
// JSON 数组查询
if (CollUtil.isNotEmpty(tagList)) {
for (String tag : tagList) {
queryWrapper.like("tags", "\"" + tag + "\"");
}
}
// 精确查询
queryWrapper.ne(ObjectUtils.isNotEmpty(notId), "id", notId);
queryWrapper.eq(ObjectUtils.isNotEmpty(id), "id", id);
queryWrapper.eq(ObjectUtils.isNotEmpty(userId), "userId", userId);
// 排序规则
// queryWrapper.orderBy(SqlUtils.validSortField(sortField),
// sortOrder.equals(CommonConstant.SORT_ORDER_ASC),
// sortField);
return queryWrapper;
}
/**
* 获取Fna表单封装
*
* @param fnaForm
* @return
*/
@Override
public FnaFormVO getFnaFormVO(FnaForm fnaForm) {
// 对象转封装类
FnaFormVO fnaFormVO = FnaFormVO.objToVo(fnaForm);
// todo 可以根据需要为封装对象补充值,不需要的内容可以删除
// region 可选
// endregion
return fnaFormVO;
}
/**
* 分页获取Fna表单封装
*
* @param fnaFormPage
* @return
*/
@Override
public Page<FnaFormVO> getFnaFormVOPage(Page<FnaForm> fnaFormPage) {
List<FnaForm> fnaFormList = fnaFormPage.getRecords();
Page<FnaFormVO> fnaFormVOPage = new Page<>(fnaFormPage.getCurrent(), fnaFormPage.getSize(), fnaFormPage.getTotal());
if (CollUtil.isEmpty(fnaFormList)) {
return fnaFormVOPage;
}
// 对象列表 => 封装对象列表
List<FnaFormVO> fnaFormVOList = fnaFormList.stream().map(fnaForm -> {
return FnaFormVO.objToVo(fnaForm);
}).collect(Collectors.toList());
fnaFormVOPage.setRecords(fnaFormVOList);
return fnaFormVOPage;
}
@Override
public void validFnaFormAdd(FnaFormAddRequest fnaFormAddRequest) {
if (fnaFormAddRequest == null) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
}
@Override
public FnaForm getFnaForm(FnaFormAddRequest fnaFormAddRequest) {
FnaForm fnaForm = new FnaForm();
fnaForm.setCustomerBizId(fnaFormAddRequest.getCustomerBizId());
fnaForm.setPersonalData(GSON.toJson(fnaFormAddRequest.getPersonalData()));
fnaForm.setFamilyMembers(GSON.toJson(fnaFormAddRequest.getFamilyMembers()));
fnaForm.setExistingSecurityOwner(GSON.toJson(fnaFormAddRequest.getExistingSecurityOwner()));
fnaForm.setExistingSecurityInsured(GSON.toJson(fnaFormAddRequest.getExistingSecurityInsured()));
fnaForm.setMonthlyIncome(fnaFormAddRequest.getMonthlyIncome());
fnaForm.setMonthlyExpense(fnaFormAddRequest.getMonthlyExpense());
fnaForm.setLiquidAssets(fnaFormAddRequest.getLiquidAssets());
fnaForm.setLiquidAssetType(fnaFormAddRequest.getLiquidAssetType());
fnaForm.setOwnerAssets(GSON.toJson(fnaFormAddRequest.getOwnerAssets()));
fnaForm.setCompanyBusinessData(GSON.toJson(fnaFormAddRequest.getCompanyBusinessData()));
fnaForm.setPremiumFundingSource(fnaFormAddRequest.getPremiumFundingSource());
return fnaForm;
}
@Override
public FnaForm getByFnaFormBizId(String fnaFormBizId) {
QueryWrapper<FnaForm> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("fnaFormBizId", fnaFormBizId);
return baseMapper.selectOne(queryWrapper);
}
}
package com.yd.csf.service.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yd.csf.service.dao.FnaMapper;
import com.yd.csf.service.dto.FnaQueryRequest;
import com.yd.csf.service.model.Fna;
import com.yd.csf.service.service.FnaService;
import com.yd.csf.service.vo.FnaVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* fna服务实现
*
*/
@Service
@Slf4j
public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaService {
// @Resource
// private UserService userService;
@Override
public boolean addFna(Fna fna) {
Date date = new Date();
fna.setCreateTime(date);
fna.setUpdateTime(date);
return this.save(fna);
}
/**
* 获取查询条件
*
* @param fnaQueryRequest
* @return
*/
@Override
public QueryWrapper<Fna> getQueryWrapper(FnaQueryRequest fnaQueryRequest) {
QueryWrapper<Fna> queryWrapper = new QueryWrapper<>();
if (fnaQueryRequest == null) {
return queryWrapper;
}
// 客户姓名
String customerName = fnaQueryRequest.getCustomerName();
// 预约编号
String appointmentNo = fnaQueryRequest.getAppointmentNo();
// 新单编号
String policyId = fnaQueryRequest.getPolicyId();
// 保单号
String policyNo = fnaQueryRequest.getPolicyNo();
// 客户姓名
queryWrapper.like(StringUtils.isNotBlank(customerName), "customer_name", customerName);
// 预约编号
queryWrapper.like(StringUtils.isNotBlank(appointmentNo), "appointment_no", appointmentNo);
// 新单编号
queryWrapper.like(StringUtils.isNotBlank(policyId), "policy_id", policyId);
// 保单号
queryWrapper.like(StringUtils.isNotBlank(policyNo), "policy_no", policyNo);
// 排序规则
queryWrapper.orderByDesc("id");
return queryWrapper;
}
/**
* 获取fna封装
*
* @param fna
* @return
*/
@Override
public FnaVO getFnaVO(Fna fna) {
// 对象转封装类
FnaVO fnaVO = FnaVO.objToVo(fna);
// region 可选
// 1. 关联查询用户信息
// Long userId = fna.getUserId();
// User user = null;
// if (userId != null && userId > 0) {
// user = userService.getById(userId);
// }
// UserVO userVO = userService.getUserVO(user);
// fnaVO.setUser(userVO);
// 2. 已登录,获取用户点赞、收藏状态
long fnaId = fna.getId();
// User loginUser = userService.getLoginUserPermitNull(request);
// endregion
return fnaVO;
}
/**
* 分页获取fna封装
*
* @param fnaPage
* @return
*/
@Override
public Page<FnaVO> getFnaVOPage(Page<Fna> fnaPage) {
List<Fna> fnaList = fnaPage.getRecords();
Page<FnaVO> fnaVOPage = new Page<>(fnaPage.getCurrent(), fnaPage.getSize(), fnaPage.getTotal());
if (CollUtil.isEmpty(fnaList)) {
return fnaVOPage;
}
// 对象列表 => 封装对象列表
List<FnaVO> fnaVOList = fnaList.stream().map(FnaVO::objToVo).collect(Collectors.toList());
// region 可选
// 1. 关联查询用户信息
// Set<Long> userIdSet = fnaList.stream().map(Fna::getUserId).collect(Collectors.toSet());
// Map<Long, List<User>> userIdUserListMap = userService.listByIds(userIdSet).stream()
// .collect(Collectors.groupingBy(User::getId));
// 2. 已登录,获取用户点赞、收藏状态
Map<Long, Boolean> fnaIdHasThumbMap = new HashMap<>();
Map<Long, Boolean> fnaIdHasFavourMap = new HashMap<>();
// User loginUser = userService.getLoginUserPermitNull(request);
// 填充信息
// fnaVOList.forEach(fnaVO -> {
// Long userId = fnaVO.getUserId();
// User user = null;
// if (userIdUserListMap.containsKey(userId)) {
// user = userIdUserListMap.get(userId).get(0);
// }
// fnaVO.setUser(userService.getUserVO(user));
// fnaVO.setHasThumb(fnaIdHasThumbMap.getOrDefault(fnaVO.getId(), false));
// fnaVO.setHasFavour(fnaIdHasFavourMap.getOrDefault(fnaVO.getId(), false));
// });
// endregion
fnaVOPage.setRecords(fnaVOList);
return fnaVOPage;
}
@Override
public Fna getByBizId(String fnaBizId) {
QueryWrapper<Fna> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("fna_biz_id", fnaBizId);
return baseMapper.selectOne(queryWrapper);
}
@Override
public boolean updateByBizId(Fna fna) {
UpdateWrapper<Fna> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("fna_biz_id", fna.getFnaBizId());
return baseMapper.update(fna, updateWrapper) > 0;
}
}
package com.yd.csf.service.utils;
import org.apache.commons.lang3.reflect.FieldUtils;
import java.util.Arrays;
public class ValidateUtil {
public static boolean isAllFieldsNull(Object obj) {
return Arrays.stream(obj.getClass().getDeclaredFields())
.allMatch(field -> {
try {
return FieldUtils.readField(field, obj, true) == null;
} catch (IllegalAccessException e) {
return true; // 如果无法访问,视为null
}
});
}
}
package com.yd.csf.service.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
@Schema(description = "地址 residenceAddress-居住地址、residentialAddress-住宅地址、mailingAddress-邮寄地址、companyAddress-公司地址")
public class AddressVO implements Serializable {
@Schema(description = "区域")
private String region;
@Schema(description = "城市(省份+城市)")
private String city;
@Schema(description = "街道")
private String street;
@Schema(description = "详细地址")
private String location;
private static final long serialVersionUID = 1L;
}
package com.yd.csf.service.vo;
import com.yd.csf.service.model.CustomerExpand;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 客户扩展信息视图
*
*/
@Data
@Schema(description = "客户扩展信息")
public class CustomerExpandVO implements Serializable {
/**
* 客户扩展信息唯一业务ID
*/
@Schema(description = "客户扩展信息唯一业务ID")
private String customerExpandBizId;
/**
* 客户信息唯一标识(业务ID)
*/
@Schema(description = "客户信息唯一标识(业务ID)")
private String customerBizId;
/**
* 客户类型
*/
@Schema(description = "客户类型")
private Object customerType;
/**
* 居住地区代码
*/
@Schema(description = "居住地区代码")
private String residenceAreaCode;
/**
* 住宅电话
*/
@Schema(description = "住宅电话")
private String residenceTelephone;
/**
* 是否长期出国
*/
@Schema(description = "是否长期出国")
private String longtimeAbroad;
/**
* 居住地址
*/
private AddressVO residenceAddress;
/**
* 住宅地址
*/
private AddressVO residentialAddress;
/**
* 邮寄地址
*/
private AddressVO mailingAddress;
/**
* 公司地址
*/
private AddressVO companyAddress;
/**
* 公司名称
*/
@Schema(description = "公司名称")
private String companyName;
/**
* 公司地区代码
*/
@Schema(description = "公司地区代码")
private String companyAreaCode;
/**
* 公司电话
*/
@Schema(description = "公司电话")
private String companyTelephone;
/**
* 职位
*/
@Schema(description = "职位")
private String position;
/**
* 工作年限
*/
@Schema(description = "工作年限")
private String workYear;
/**
* 薪资
*/
@Schema(description = "薪资")
private BigDecimal salary;
/**
* 通用备注
*/
private String remark;
/**
* 封装类转对象
*
* @param customerExpandVO
* @return
*/
public static CustomerExpand voToObj(CustomerExpandVO customerExpandVO) {
if (customerExpandVO == null) {
return null;
}
CustomerExpand customerExpand = new CustomerExpand();
BeanUtils.copyProperties(customerExpandVO, customerExpand);
return customerExpand;
}
/**
* 对象转封装类
*
* @param customerExpand
* @return
*/
public static CustomerExpandVO objToVo(CustomerExpand customerExpand) {
if (customerExpand == null) {
return null;
}
CustomerExpandVO customerExpandVO = new CustomerExpandVO();
BeanUtils.copyProperties(customerExpand, customerExpandVO);
return customerExpandVO;
}
}
package com.yd.csf.service.vo;
import com.yd.csf.service.model.Customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.io.Serializable;
import java.util.Date;
/**
* customer视图
*
*/
@Data
public class CustomerVO implements Serializable {
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 客户唯一业务ID
*/
@Schema(description = "客户业务ID")
private String customerBizId;
/**
* 自定义代码
*/
@Schema(description = "客户自定义代码")
private String customCode;
/**
* 姓氏
*/
@Schema(description = "客户姓氏")
private String lastName;
/**
* 名字
*/
@Schema(description = "客户名字")
private String firstName;
/**
* 姓名
*/
@Schema(description = "客户姓名")
private String name;
/**
* 姓氏拼音
*/
@Schema(description = "客户姓氏拼音")
private String lastNamePinyin;
/**
* 名字拼音
*/
@Schema(description = "客户名字拼音")
private String firstNamePinyin;
/**
* 拼音全称
*/
@Schema(description = "客户拼音全称")
private String pinyin;
/**
* 称谓
*/
@Schema(description = "客户称谓")
private String title;
/**
* 性别
*/
@Schema(description = "性别")
private Object gender;
/**
* 出生日期
*/
@Schema(description = "出生日期")
private String birthdate;
/**
* 异常信息
*/
@Schema(description = "异常信息")
private String abnormal;
/**
* 年龄
*/
@Schema(description = "年龄")
private String age;
/**
* 地区代码
*/
@Schema(description = "地区代码")
private String areaCode;
/**
* 电话号码
*/
@Schema(description = "客户电话号码")
private String phone;
/**
* 电子邮箱
*/
@Schema(description = "客户电子邮箱")
private String email;
/**
* 是否吸烟
*/
@Schema(description = "是否吸烟 'NS'-不吸烟 'S'-吸烟 ")
private String smoke;
/**
* 吸烟数量
*/
@Schema(description = "吸烟数量")
private String smokeQuantity;
/**
* 公司类型
*/
@Schema(description = "公司类型")
private String companyType;
/**
* 来源
*/
@Schema(description = "客户来源")
private String source;
/**
* 证件类型
*/
@Schema(description = "证件类型")
private String idType;
/**
* 证件号码
*/
@Schema(description = "证件号码")
private String idCard;
/**
* 护照号
*/
@Schema(description = "护照号")
private String passport;
/**
* 往来港澳通行证号码
*/
@Schema(description = "往来港澳通行证号码")
private String eepCode;
/**
* 婚姻状况
*/
@Schema(description = "婚姻状况")
private Object marriage;
/**
* 出生地
*/
@Schema(description = "出生地")
private String birthplace;
/**
* 教育程度
*/
@Schema(description = "教育程度")
private Object education;
/**
* 签单用户扩展唯一业务ID
*/
@Schema(description = "客户扩展信息ID")
private String customerExpandBizId;
/**
* 国家
*/
@Schema(description = "国家")
private String country;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private Date createTime;
/**
* 客户扩展信息
*/
private CustomerExpandVO customerExpand;
/**
* 封装类转对象
*
* @param customerVO
* @return
*/
public static Customer voToObj(CustomerVO customerVO) {
if (customerVO == null) {
return null;
}
Customer customer = new Customer();
BeanUtils.copyProperties(customerVO, customer);
return customer;
}
/**
* 对象转封装类
*
* @param customer
* @return
*/
public static CustomerVO objToVo(Customer customer) {
if (customer == null) {
return null;
}
CustomerVO customerVO = new CustomerVO();
BeanUtils.copyProperties(customer, customerVO);
return customerVO;
}
}
package com.yd.csf.service.vo;
import cn.hutool.json.JSONUtil;
import com.yd.csf.service.model.FnaForm;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Fna表单视图
*
*/
@Data
public class FnaFormVO implements Serializable {
/**
* id
*/
private Long id;
/**
* 标题
*/
private String title;
/**
* 内容
*/
private String content;
/**
* 创建用户 id
*/
private Long userId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 标签列表
*/
private List<String> tagList;
/**
* 封装类转对象
*
* @param fnaFormVO
* @return
*/
public static FnaForm voToObj(FnaFormVO fnaFormVO) {
if (fnaFormVO == null) {
return null;
}
FnaForm fnaForm = new FnaForm();
BeanUtils.copyProperties(fnaFormVO, fnaForm);
List<String> tagList = fnaFormVO.getTagList();
return fnaForm;
}
/**
* 对象转封装类
*
* @param fnaForm
* @return
*/
public static FnaFormVO objToVo(FnaForm fnaForm) {
if (fnaForm == null) {
return null;
}
FnaFormVO fnaFormVO = new FnaFormVO();
BeanUtils.copyProperties(fnaForm, fnaFormVO);
return fnaFormVO;
}
}
package com.yd.csf.service.vo;
import com.yd.csf.service.model.Fna;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* fna视图
*
*/
@Data
public class FnaVO implements Serializable {
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* fna唯一业务ID
*/
@Schema(description = "fna业务ID")
private String fnaBizId;
/**
* 财富需要分析编号
*/
@Schema(description = "财富需要分析编号")
private Long fnaNo;
/**
* 系统用户唯一业务ID
*/
@Schema(description = "系统用户唯一业务ID")
private String userBizId;
/**
* 客户姓名
*/
@Schema(description = "客户姓名")
private String customerName;
/**
* 客户唯一业务ID
*/
@Schema(description = "客户唯一业务ID")
private String customerBizId;
/**
* Fna表单唯一业务ID
*/
@Schema(description = "Fna表单唯一业务ID")
private String fnaFormBizId;
/**
* 预约编号
*/
@Schema(description = "预约编号")
private String appointmentNo;
/**
* 预约信息主表唯一业务ID
*/
@Schema(description = "预约信息主表唯一业务ID")
private String appointmentBizId;
/**
* 新单跟进ID
*/
@Schema(description = "新单跟进ID")
private String policyId;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* FNA 状态
*/
@Schema(description = "FNA 状态 'UNCOMPLETED'-未完成, 'COMPLETED'-已完成")
private Object status;
/**
* 产品代码
*/
@Schema(description = "产品代码")
private String productCode;
/**
* 产品名称
*/
@Schema(description = "产品名称")
private String productName;
/**
* 相关URL
*/
@Schema(description = "相关URL")
private String url;
/**
* 是否可编辑: 0-否, 1-是
*/
@Schema(description = "是否可编辑: '0'-否, '1'-是")
private String edit;
/**
* 通用备注
*/
@Schema(description = "通用备注")
private String remark;
/**
* 删除标识: 0-正常, 1-删除
*/
@Schema(description = "删除标识: '0'-正常, '1'-删除")
private String isDeleted;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private Date createTime;
/**
* 封装类转对象
*
* @param fnaVO
* @return
*/
public static Fna voToObj(FnaVO fnaVO) {
if (fnaVO == null) {
return null;
}
Fna fna = new Fna();
BeanUtils.copyProperties(fnaVO, fna);
return fna;
}
/**
* 对象转封装类
*
* @param fna
* @return
*/
public static FnaVO objToVo(Fna fna) {
if (fna == null) {
return null;
}
FnaVO fnaVO = new FnaVO();
BeanUtils.copyProperties(fna, fnaVO);
return fnaVO;
}
}
<?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.yd.csf.service.dao.CustomerExpandMapper">
<resultMap id="BaseResultMap" type="com.yd.csf.service.model.CustomerExpand">
<id property="id" column="id" />
<result property="customerExpandBizId" column="customer_expand_biz_id" />
<result property="customerBizId" column="customer_biz_id" />
<result property="customerType" column="customer_type" />
<result property="residenceAreaCode" column="residence_area_code" />
<result property="residenceTelephone" column="residence_telephone" />
<result property="longtimeAbroad" column="longtime_abroad" />
<result property="residenceAddress" column="residence_address" />
<result property="residentialAddress" column="residential_address" />
<result property="mailingAddress" column="mailing_address" />
<result property="companyAddress" column="company_address" />
<result property="companyName" column="company_name" />
<result property="companyAreaCode" column="company_area_code" />
<result property="companyTelephone" column="company_telephone" />
<result property="position" column="position" />
<result property="workYear" column="work_year" />
<result property="salary" column="salary" />
<result property="remark" column="remark" />
<result property="isDeleted" column="is_deleted" />
<result property="creatorId" column="creator_id" />
<result property="updaterId" column="updater_id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="Base_Column_List">
id,customer_expand_biz_id,customer_biz_id,customer_type,residence_area_code,residence_telephone,
longtime_abroad,residence_address,residential_address,mailing_address,company_address,
company_name,company_area_code,company_telephone,position,work_year,
salary,remark,is_deleted,creator_id,updater_id,
create_time,update_time
</sql>
</mapper>
<?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.yd.csf.service.dao.CustomerMapper">
<resultMap id="BaseResultMap" type="com.yd.csf.service.model.Customer">
<id property="id" column="id" />
<result property="customerBizId" column="customer_biz_id" />
<result property="customCode" column="custom_code" />
<result property="lastName" column="last_name" />
<result property="firstName" column="first_name" />
<result property="name" column="name" />
<result property="lastNamePinyin" column="last_name_pinyin" />
<result property="firstNamePinyin" column="first_name_pinyin" />
<result property="pinyin" column="pinyin" />
<result property="title" column="title" />
<result property="gender" column="gender" />
<result property="birthdate" column="birthdate" />
<result property="abnormal" column="abnormal" />
<result property="age" column="age" />
<result property="areaCode" column="area_code" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="smoke" column="smoke" />
<result property="smokeQuantity" column="smoke_quantity" />
<result property="companyType" column="company_type" />
<result property="source" column="source" />
<result property="idType" column="id_type" />
<result property="idCard" column="id_card" />
<result property="passport" column="passport" />
<result property="eepCode" column="eep_code" />
<result property="marriage" column="marriage" />
<result property="birthplace" column="birthplace" />
<result property="education" column="education" />
<result property="customerExpandBizId" column="customer_expand_biz_id" />
<result property="country" column="country" />
<result property="remark" column="remark" />
<result property="isDeleted" column="is_deleted" />
<result property="creatorId" column="creator_id" />
<result property="updaterId" column="updater_id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="Base_Column_List">
id,customer_biz_id,custom_code,last_name,first_name,name,
last_name_pinyin,first_name_pinyin,pinyin,title,gender,
birthdate,abnormal,age,area_code,
phone,email,smoke,smoke_quantity,company_type,
source,id_type,id_card,passport,eep_code,
marriage,birthplace,education,customer_expand_biz_id,country,
remark,is_deleted,creator_id,updater_id,create_time,
update_time
</sql>
</mapper>
<?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.yd.csf.service.dao.FnaMapper">
<resultMap id="BaseResultMap" type="com.yd.csf.service.model.Fna">
<id property="id" column="id" />
<result property="fnaBizId" column="fna_biz_id" />
<result property="fnaNo" column="fna_no" />
<result property="userBizId" column="user_biz_id" />
<result property="customerBizId" column="customer_biz_id" />
<result property="appointmentNo" column="appointment_no" />
<result property="appointmentBizId" column="appointment_biz_id" />
<result property="bookingStatusTip" column="booking_status_tip" />
<result property="underwritingNo" column="underwriting_no" />
<result property="policyId" column="policy_id" />
<result property="policyNo" column="policy_no" />
<result property="status" column="status" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="url" column="url" />
<result property="edit" column="edit" />
<result property="remark" column="remark" />
<result property="isDeleted" column="is_deleted" />
<result property="creatorId" column="creator_id" />
<result property="updaterId" column="updater_id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="Base_Column_List">
id,fna_biz_id,fna_no,user_biz_id,customer_biz_id,appointment_no,
appointment_biz_id,booking_status_tip,underwriting_no,policy_id,policy_no,
status,product_code,product_name,url,edit,
remark,is_deleted,creator_id,updater_id,create_time,
update_time
</sql>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment