Commit d193adac by jianan

Fna接口42

parent 6c418256
package com.yd.csf.api.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yd.auth.core.dto.AuthUserDto;
import com.yd.auth.core.utils.SecurityUtil;
import com.yd.common.enums.CommonEnum;
import com.yd.common.enums.ResultCode;
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.FnaFormAddRequest;
import com.yd.csf.service.dto.FnaFormQueryRequest;
import com.yd.csf.service.dto.FnaFormUpdateRequest;
import com.yd.csf.service.dto.FnaUpdateRequest;
import com.yd.csf.service.model.FnaForm;
import com.yd.csf.service.service.FnaFormService;
import com.yd.csf.service.vo.FnaFormVO;
......@@ -19,7 +16,6 @@ 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.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -55,11 +51,11 @@ public class ApiFnaFormController {
public Result<Map<String, Object>> addFnaForm(@RequestBody FnaFormAddRequest fnaFormAddRequest, HttpServletRequest request) {
if (fnaFormAddRequest == null) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
return Result.fail(ResultCode.PARAMS_ERROR.getCode(), ResultCode.PARAMS_ERROR.getMessage());
}
String saveType = fnaFormAddRequest.getSaveType();
if (StringUtils.isBlank(saveType)) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), "保存方式必传");
return Result.fail(ResultCode.PARAMS_ERROR.getCode(), "保存方式必传");
}
// 校验
fnaFormService.validFnaFormAdd(fnaFormAddRequest.getPersonalData(), saveType);
......@@ -81,7 +77,7 @@ public class ApiFnaFormController {
// 写入数据库
boolean result = fnaFormService.save(fnaForm);
if (!result) {
return Result.fail(ErrorCode.OPERATION_ERROR.getCode(), ErrorCode.OPERATION_ERROR.getMessage());
return Result.fail(ResultCode.FAIL.getCode(), ResultCode.FAIL.getMessage());
}
// 返回新写入的数据 id
......@@ -101,20 +97,20 @@ public class ApiFnaFormController {
// @PostMapping("/delete")
// public Result<Boolean> deleteFna(@RequestBody DeleteRequest deleteRequest, HttpServletRequest request) {
// if (deleteRequest == null || deleteRequest.getId() <= 0) {
// throw new BusinessException(ErrorCode.PARAMS_ERROR);
// throw new BusinessException(ResultCode.PARAMS_ERROR);
// }
// User user = userService.getLoginUser(request);
// long id = deleteRequest.getId();
// // 判断是否存在
// FnaForm oldFna = fnaFormService.getById(id);
// ThrowUtils.throwIf(oldFna == null, ErrorCode.NOT_FOUND_ERROR);
// ThrowUtils.throwIf(oldFna == null, ResultCode.NULL_ERROR);
// // 仅本人或管理员可删除
// if (!oldFna.getUserId().equals(user.getId()) && !userService.isAdmin(request)) {
// throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
// throw new BusinessException(ResultCode.NO_AUTH_ERROR);
// }
// // 操作数据库
// boolean result = fnaFormService.removeById(id);
// ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
// ThrowUtils.throwIf(!result, ResultCode.FAIL);
// return Result.success(true);
// }
......@@ -128,11 +124,17 @@ public class ApiFnaFormController {
@Operation(summary = "更新 Fna表单")
public Result<Boolean> updateFnaForm(@RequestBody FnaFormUpdateRequest fnaUpdateRequest) {
if (fnaUpdateRequest == null || StringUtils.isBlank(fnaUpdateRequest.getFnaFormBizId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), ResultCode.PARAMS_ERROR.getMessage());
}
String saveType = fnaUpdateRequest.getSaveType();
if (StringUtils.isBlank(saveType)) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), "保存方式必传");
return Result.fail(ResultCode.PARAMS_ERROR.getCode(), "保存方式必传");
}
// 判断是否存在
String fnaFormBizId = fnaUpdateRequest.getFnaFormBizId();
FnaForm oldFna = fnaFormService.getByFnaFormBizId(fnaFormBizId);
if (oldFna == null) {
return Result.fail(ResultCode.NULL_ERROR.getCode(), ResultCode.NULL_ERROR.getMessage());
}
// 校验
fnaFormService.validFnaFormAdd(fnaUpdateRequest.getPersonalData(), saveType);
......@@ -140,16 +142,10 @@ public class ApiFnaFormController {
FnaForm fnaForm = fnaFormService.getFnaForm(fnaUpdateRequest);
// 表单状态
fnaForm.setFnaFormStatus("save".equals(saveType)? "COMPLETED" : "UNCOMPLETED");
// 判断是否存在
String fnaFormBizId = fnaUpdateRequest.getFnaFormBizId();
FnaForm oldFna = fnaFormService.getByFnaFormBizId(fnaFormBizId);
if (oldFna == null) {
return Result.fail(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
}
// 操作数据库
boolean result = fnaFormService.updateById(fnaForm);
if (!result) {
return Result.fail(ErrorCode.OPERATION_ERROR.getCode(), ErrorCode.OPERATION_ERROR.getMessage());
return Result.fail(ResultCode.FAIL.getCode(), ResultCode.FAIL.getMessage());
}
return Result.success(true);
}
......@@ -164,12 +160,12 @@ public class ApiFnaFormController {
@Operation(summary = "根据 fnaFormBizId 获取Fna表单详情")
public Result<FnaFormVO> getFnaFormVOByFnaFormBizId(String fnaFormBizId, HttpServletRequest request) {
if (fnaFormBizId == null) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
return Result.fail(ResultCode.PARAMS_ERROR.getCode(), ResultCode.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.fail(ResultCode.NULL_ERROR.getCode(), ResultCode.NULL_ERROR.getMessage());
}
// 获取封装类
......
......@@ -7,7 +7,7 @@ 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
* @Entity com.yd.csf.service.model.FnaForm
*/
public interface FnaFormMapper extends BaseMapper<FnaForm> {
......
......@@ -48,34 +48,16 @@ public class FnaFormAddRequest implements Serializable {
private List<ExistingSecurity> existingSecurityInsured;
/**
* 平均月收入
* 收支情况
*/
@Schema(description = "在过去24个月里,你从所有所得的收入来源所得的平均每月收入为?(包括薪金、花红、佣金、其他薪酬红利、银行存款利息、债券利息及股息等")
private String monthlyIncome;
@Schema(description = "收支情况")
private IncomeExpense incomeExpense;
/**
* 平均月支出
* 流动资产
*/
@Schema(description = "过去24个月每月里,你每月的平均开支为?")
private String monthlyExpense;
/**
* 累积流动资产
*/
@Schema(description = "您现时的累积流动资产约有多少?")
private String liquidAssets;
/**
* 流动资产种类
*/
@Schema(description = "流动资产种类,多选逗号隔开 字典值:csf_liquid_asset_type")
private String liquidAssetType;
/**
* 其他流动资产的说明
*/
@Schema(description = "其他流动资产的说明")
private String otherLiquidAsset;
@Schema(description = "流动资产")
private LiquidAssets liquidAssets;
/**
* 保单持有人资产
......@@ -89,8 +71,11 @@ public class FnaFormAddRequest implements Serializable {
@Schema(description = "公司业务资料")
private CompanyBusinessData companyBusinessData;
@Schema(description = "首期及续保保费的财富来源,单选 字典值:csf_premium_funding_source")
private String premiumFundingSource;
/**
* 其他问题
*/
@Schema(description = "Fna表单其他问题")
private FnaFormOther fnaFormOther;
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
public class FnaFormOther {
@Schema(description = "首期及续保保费的财富来源,单选 字典值:csf_premium_funding_source")
private String premiumFundingSource;
}
......@@ -53,34 +53,16 @@ public class FnaFormUpdateRequest implements Serializable {
private List<ExistingSecurity> existingSecurityInsured;
/**
* 平均月收入
* 收支情况
*/
@Schema(description = "在过去24个月里,你从所有所得的收入来源所得的平均每月收入为?(包括薪金、花红、佣金、其他薪酬红利、银行存款利息、债券利息及股息等。")
private String monthlyIncome;
@Schema(description = "收支情况")
private IncomeExpense incomeExpense;
/**
* 平均月支出
* 流动资产
*/
@Schema(description = "过去24个月每月里,你每月的平均开支为?")
private String monthlyExpense;
/**
* 累积流动资产
*/
@Schema(description = "您现时的累积流动资产约有多少?")
private String liquidAssets;
/**
* 流动资产种类
*/
@Schema(description = "流动资产种类,多选逗号隔开 字典值:csf_liquid_asset_type")
private String liquidAssetType;
/**
* 其他流动资产的说明
*/
@Schema(description = "其他流动资产的说明")
private String otherLiquidAsset;
@Schema(description = "流动资产")
private LiquidAssets liquidAssets;
/**
* 保单持有人资产
......@@ -94,8 +76,11 @@ public class FnaFormUpdateRequest implements Serializable {
@Schema(description = "公司业务资料")
private CompanyBusinessData companyBusinessData;
@Schema(description = "首期及续保保费的财富来源,单选 字典值:csf_premium_funding_source")
private String premiumFundingSource;
/**
* 其他问题
*/
@Schema(description = "Fna表单其他问题")
private FnaFormOther fnaFormOther;
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
public class IncomeExpense {
/**
* 平均月收入
*/
@Schema(description = "在过去24个月里,你从所有所得的收入来源所得的平均每月收入为?(包括薪金、花红、佣金、其他薪酬红利、银行存款利息、债券利息及股息等")
private String monthlyIncome;
/**
* 平均月支出
*/
@Schema(description = "过去24个月每月里,你每月的平均开支为?")
private String monthlyExpense;
}
package com.yd.csf.service.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class LiquidAssets {
/**
* 累积流动资产
*/
@Schema(description = "您现时的累积流动资产约有多少?")
private String liquidAssets;
/**
* 流动资产种类
*/
@Schema(description = "流动资产种类,多选逗号隔开 字典值:csf_liquid_asset_type")
private String liquidAssetType;
/**
* 其他流动资产的说明
*/
@Schema(description = "其他流动资产的说明")
private String otherLiquidAsset;
}
......@@ -20,7 +20,7 @@ public class PersonalData {
@Schema(description = "税务国家", requiredMode = Schema.RequiredMode.REQUIRED)
private String taxCountry;
@Schema(description = "就业情况", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "就业情况 字典值: csf_employment", requiredMode = Schema.RequiredMode.REQUIRED)
private String employment;
@Schema(description = "其他就业情况")
......
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;
/**
......@@ -18,7 +18,7 @@ public class FnaForm implements Serializable {
/**
* id
*/
@TableId
@TableId(type = IdType.AUTO)
private Long id;
/**
......@@ -62,29 +62,14 @@ public class FnaForm implements Serializable {
private Object existingSecurityInsured;
/**
* 平均月收入
*/
private String monthlyIncome;
/**
* 平均月支出
*/
private String monthlyExpense;
/**
* 累积流动资产
*/
private String liquidAssets;
/**
* 流动资产种类(A.现金 B.银行存款……)
* 收支情况
*/
private String liquidAssetType;
private Object incomeExpense;
/**
* 其他流动资产的说明
* 流动资产
*/
private String otherLiquidAsset;
private Object liquidAssets;
/**
* 保单持有人资产
......@@ -97,12 +82,12 @@ public class FnaForm implements Serializable {
private Object companyBusinessData;
/**
* 首期及续保保费的财富来源(A.储蓄 B.受雇收入 C.自雇收入 D.投资收入)
* 表单其他问题
*/
private String premiumFundingSource;
private Object fnaFormOther;
/**
* fna表单状态
* 表单状态
*/
private String fnaFormStatus;
......
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.yd.common.enums.ResultCode;
import com.yd.common.exception.BusinessException;
import com.yd.csf.service.common.ErrorCode;
import com.yd.csf.service.dao.FnaFormMapper;
......@@ -128,6 +129,14 @@ public class FnaFormServiceImpl extends ServiceImpl<FnaFormMapper, FnaForm> impl
fnaFormVO.setExistingSecurityInsured(GSON.fromJson(existingSecurityInsured.toString(), new TypeToken<List<ExistingSecurity>>() {
}.getType()));
}
Object incomeExpense = fnaForm.getIncomeExpense();
if (incomeExpense != null) {
fnaFormVO.setIncomeExpense(GSON.fromJson(incomeExpense.toString(), IncomeExpense.class));
}
Object liquidAssets = fnaForm.getLiquidAssets();
if (liquidAssets != null) {
fnaFormVO.setLiquidAssets(GSON.fromJson(liquidAssets.toString(), LiquidAssets.class));
}
Object ownerAssets = fnaForm.getOwnerAssets();
if (ownerAssets != null) {
fnaFormVO.setOwnerAssets(GSON.fromJson(ownerAssets.toString(), new TypeToken<OwnerAssets>() {
......@@ -137,6 +146,10 @@ public class FnaFormServiceImpl extends ServiceImpl<FnaFormMapper, FnaForm> impl
if (monthlyIncome != null) {
fnaFormVO.setCompanyBusinessData(GSON.fromJson(monthlyIncome.toString(), CompanyBusinessData.class));
}
Object fnaFormOther = fnaForm.getFnaFormOther();
if (fnaFormOther != null) {
fnaFormVO.setFnaFormOther(GSON.fromJson(fnaFormOther.toString(), FnaFormOther.class));
}
return fnaFormVO;
}
......@@ -168,23 +181,23 @@ public class FnaFormServiceImpl extends ServiceImpl<FnaFormMapper, FnaForm> impl
@Override
public void validFnaFormAdd(PersonalData personalData, String saveType) {
if (personalData == null || ValidateUtil.isAllFieldsNull(personalData)) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), "个人资料不能全不为空");
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "个人资料不能全不为空");
}
if ("save".equals(saveType)) {
if (StringUtils.isBlank(personalData.getAccountName())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), "陪同顾问姓名不能为空");
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "陪同顾问姓名不能为空");
}
if (StringUtils.isBlank(personalData.getRegistrationNumber())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), "理财顾问注册编号不能为空");
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "理财顾问注册编号不能为空");
}
if (StringUtils.isBlank(personalData.getCustomerName())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), "客户姓名不能为空");
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "客户姓名不能为空");
}
if (StringUtils.isBlank(personalData.getTaxCountry())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), "税务国家不能为空");
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "税务国家不能为空");
}
if (StringUtils.isBlank(personalData.getEmployment())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), "就业情况不能为空");
throw new BusinessException(ResultCode.PARAM_CHECK_ERROR.getCode(), "就业情况不能为空");
}
}
}
......@@ -198,13 +211,11 @@ public class FnaFormServiceImpl extends ServiceImpl<FnaFormMapper, FnaForm> impl
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.setIncomeExpense(GSON.toJson(fnaFormAddRequest.getIncomeExpense()));
fnaForm.setLiquidAssets(GSON.toJson(fnaFormAddRequest.getLiquidAssets()));
fnaForm.setOwnerAssets(GSON.toJson(fnaFormAddRequest.getOwnerAssets()));
fnaForm.setCompanyBusinessData(GSON.toJson(fnaFormAddRequest.getCompanyBusinessData()));
fnaForm.setPremiumFundingSource(fnaFormAddRequest.getPremiumFundingSource());
fnaForm.setFnaFormOther(GSON.toJson(fnaFormAddRequest.getFnaFormOther()));
return fnaForm;
}
......@@ -218,8 +229,11 @@ public class FnaFormServiceImpl extends ServiceImpl<FnaFormMapper, FnaForm> impl
fnaForm.setFamilyMembers(GSON.toJson(fnaFormUpdateRequest.getFamilyMembers()));
fnaForm.setExistingSecurityOwner(GSON.toJson(fnaFormUpdateRequest.getExistingSecurityOwner()));
fnaForm.setExistingSecurityInsured(GSON.toJson(fnaFormUpdateRequest.getExistingSecurityInsured()));
fnaForm.setIncomeExpense(GSON.toJson(fnaFormUpdateRequest.getIncomeExpense()));
fnaForm.setLiquidAssets(GSON.toJson(fnaFormUpdateRequest.getLiquidAssets()));
fnaForm.setOwnerAssets(GSON.toJson(fnaFormUpdateRequest.getOwnerAssets()));
fnaForm.setCompanyBusinessData(GSON.toJson(fnaFormUpdateRequest.getCompanyBusinessData()));
fnaForm.setFnaFormOther(GSON.toJson(fnaFormUpdateRequest.getFnaFormOther()));
return fnaForm;
}
......
......@@ -62,28 +62,16 @@ public class FnaFormVO implements Serializable {
private List<ExistingSecurity> existingSecurityInsured;
/**
* 平均月收入
* 收支情况
*/
@Schema(description = "在过去24个月里,你从所有所得的收入来源所得的平均每月收入为?(包括薪金、花红、佣金、其他薪酬红利、银行存款利息、债券利息及股息等")
private String monthlyIncome;
@Schema(description = "收支情况")
private IncomeExpense incomeExpense;
/**
* 平均月支出
* 流动资产
*/
@Schema(description = "过去24个月每月里,你每月的平均开支为?")
private String monthlyExpense;
/**
* 累积流动资产
*/
@Schema(description = "您现时的累积流动资产约有多少?")
private String liquidAssets;
/**
* 流动资产种类(A.现金 B.银行存款……)
*/
@Schema(description = "流动资产种类(A.现金 B.银行存款 C.货币市场账户 D.交投活络的股票 E.债券及互惠基金 F.美国国库债券 G. 其他(請說明))")
private String liquidAssetType;
@Schema(description = "流动资产")
private LiquidAssets liquidAssets;
/**
* 保单持有人资产
......@@ -98,10 +86,10 @@ public class FnaFormVO implements Serializable {
private CompanyBusinessData companyBusinessData;
/**
* 首期及续保保费的财富来源(A.储蓄 B.受雇收入 C.自雇收入 D.投资收入)
* 其他问题
*/
@Schema(description = "首期及续保保费的财富来源(A.储蓄 B.受雇收入 C.自雇收入 D.投资收入)")
private String premiumFundingSource;
@Schema(description = "Fna表单其他问题")
private FnaFormOther fnaFormOther;
/**
......
......@@ -14,13 +14,12 @@
<result property="familyMembers" column="family_members" />
<result property="existingSecurityOwner" column="existing_security_owner" />
<result property="existingSecurityInsured" column="existing_security_insured" />
<result property="monthlyIncome" column="monthly_income" />
<result property="monthlyExpense" column="monthly_expense" />
<result property="incomeExpense" column="income_expense" />
<result property="liquidAssets" column="liquid_assets" />
<result property="liquidAssetType" column="liquid_asset_type" />
<result property="ownerAssets" column="owner_assets" />
<result property="companyBusinessData" column="company_business_data" />
<result property="premiumFundingSource" column="premium_funding_source" />
<result property="fnaFormOther" column="fna_form_other" />
<result property="fnaFormStatus" column="fna_form_status" />
<result property="remark" column="remark" />
<result property="isDeleted" column="is_deleted" />
<result property="creatorId" column="creator_id" />
......@@ -31,9 +30,8 @@
<sql id="Base_Column_List">
id,fna_form_biz_id,user_biz_id,agent_biz_id,customer_biz_id,personal_data,
family_members,existing_security_owner,existing_security_insured,monthly_income,monthly_expense,
liquid_assets,liquid_asset_type,owner_assets,company_business_data,premium_funding_source,
remark,is_deleted,creator_id,updater_id,create_time,
update_time
family_members,existing_security_owner,existing_security_insured,income_expense,liquid_assets,
owner_assets,company_business_data,fna_form_other,fna_form_status,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