• 微服务项目:尚融宝(43)(核心业务流程:借款额度审批(3))


    认清现实,放弃幻想,准备斗争

     借款额度审核

    一、后端实现

    1、创建VO

    BorrowerApprovalVO

    1. @Data
    2. @ApiModel(description = "借款人审批")
    3. public class BorrowerApprovalVO {
    4. @ApiModelProperty(value = "id")
    5. private Long borrowerId;
    6. @ApiModelProperty(value = "状态")
    7. private Integer status;
    8. @ApiModelProperty(value = "身份证信息是否正确")
    9. private Boolean isIdCardOk;
    10. @ApiModelProperty(value = "房产信息是否正确")
    11. private Boolean isHouseOk;
    12. @ApiModelProperty(value = "车辆信息是否正确")
    13. private Boolean isCarOk;
    14. @ApiModelProperty(value = "基本信息积分")
    15. private Integer infoIntegral;
    16. }

    2、controller

    AdminBorrowerController

    1. @ApiOperation("借款额度审批")
    2. @PostMapping("/approval")
    3. public R approval(@RequestBody BorrowerApprovalVO borrowerApprovalVO) {
    4. borrowerService.approval(borrowerApprovalVO);
    5. return R.ok().message("审批完成");
    6. }

    3、BorrowerService

    接口

    void approval(BorrowerApprovalVO borrowerApprovalVO);

     实现

    1. @Resource
    2. private UserIntegralMapper userIntegralMapper;
    3. @Override
    4. public void approval(BorrowerApprovalVO borrowerApprovalVO) {
    5. //借款人认证状态
    6. Long borrowerId = borrowerApprovalVO.getBorrowerId();
    7. Borrower borrower = baseMapper.selectById(borrowerId);
    8. borrower.setStatus(borrowerApprovalVO.getStatus());
    9. baseMapper.updateById(borrower);
    10. Long userId = borrower.getUserId();
    11. UserInfo userInfo = userInfoMapper.selectById(userId);
    12. //添加积分
    13. UserIntegral userIntegral = new UserIntegral();
    14. userIntegral.setUserId(userId);
    15. userIntegral.setIntegral(borrowerApprovalVO.getInfoIntegral());
    16. userIntegral.setContent("借款人基本信息");
    17. userIntegralMapper.insert(userIntegral);
    18. int curIntegral = userInfo.getIntegral() + borrowerApprovalVO.getInfoIntegral();
    19. if(borrowerApprovalVO.getIsIdCardOk()) {
    20. curIntegral += IntegralEnum.BORROWER_IDCARD.getIntegral();
    21. userIntegral = new UserIntegral();
    22. userIntegral.setUserId(userId);
    23. userIntegral.setIntegral(IntegralEnum.BORROWER_IDCARD.getIntegral());
    24. userIntegral.setContent(IntegralEnum.BORROWER_IDCARD.getMsg());
    25. userIntegralMapper.insert(userIntegral);
    26. }
    27. if(borrowerApprovalVO.getIsHouseOk()) {
    28. curIntegral += IntegralEnum.BORROWER_HOUSE.getIntegral();
    29. userIntegral = new UserIntegral();
    30. userIntegral.setUserId(userId);
    31. userIntegral.setIntegral(IntegralEnum.BORROWER_HOUSE.getIntegral());
    32. userIntegral.setContent(IntegralEnum.BORROWER_HOUSE.getMsg());
    33. userIntegralMapper.insert(userIntegral);
    34. }
    35. if(borrowerApprovalVO.getIsCarOk()) {
    36. curIntegral += IntegralEnum.BORROWER_CAR.getIntegral();
    37. userIntegral = new UserIntegral();
    38. userIntegral.setUserId(userId);
    39. userIntegral.setIntegral(IntegralEnum.BORROWER_CAR.getIntegral());
    40. userIntegral.setContent(IntegralEnum.BORROWER_CAR.getMsg());
    41. userIntegralMapper.insert(userIntegral);
    42. }
    43. userInfo.setIntegral(curIntegral);
    44. //修改审核状态
    45. userInfo.setBorrowAuthStatus(borrowerApprovalVO.getStatus());
    46. userInfoMapper.updateById(userInfo);
    47. }

    二、前端实现

    1、定义api

    api/borrower.js中添加方法

    1. approval(borrowerApproval) {
    2. return request({
    3. url: '/admin/core/borrower/approval',
    4. method: 'post',
    5. data: borrowerApproval
    6. })
    7. }

    2、页面模板

    src/views/core/borrower/detail.vue

    1. <el-form label-width="170px" v-if="borrower.status === '认证中'">
    2. <el-form-item label="是否通过">
    3. <el-radio-group v-model="approvalForm.status">
    4. <el-radio :label="2">
    5. 通过
    6. el-radio>
    7. <el-radio :label="-1">
    8. 不通过
    9. el-radio>
    10. el-radio-group>
    11. el-form-item>
    12. <el-form-item v-if="approvalForm.status == 2" label="基本信息积分">
    13. <el-input v-model="approvalForm.infoIntegral" style="width: 140px;" />
    14. <span style="color: indianred">(可获取30至100积分)span>
    15. el-form-item>
    16. <el-form-item v-if="approvalForm.status == 2" label="身份证信息是否正确">
    17. <el-radio-group v-model="approvalForm.isIdCardOk">
    18. <el-radio :label="true">
    19. el-radio>
    20. <el-radio :label="false">
    21. el-radio>
    22. el-radio-group>
    23. <span style="color: indianred">(可获得积分30积分)span>
    24. el-form-item>
    25. <el-form-item v-if="approvalForm.status == 2" label="车辆信息是否正确">
    26. <el-radio-group v-model="approvalForm.isCarOk">
    27. <el-radio :label="true">
    28. el-radio>
    29. <el-radio :label="false">
    30. el-radio>
    31. el-radio-group>
    32. <span style="color: indianred">(可获得积分60积分)span>
    33. el-form-item>
    34. <el-form-item v-if="approvalForm.status == 2" label="房产信息是否正确">
    35. <el-radio-group v-model="approvalForm.isHouseOk">
    36. <el-radio :label="true">
    37. el-radio>
    38. <el-radio :label="false">
    39. el-radio>
    40. el-radio-group>
    41. <span style="color: indianred">(可获得积分100积分)span>
    42. el-form-item>
    43. <el-row style="text-align:center">
    44. <el-button type="primary" @click="approvalSubmit()">
    45. 确定
    46. el-button>
    47. el-row>
    48. el-form>

    3、页面脚本

    src/views/core/borrower/detail.vue

    1. approvalSubmit() {
    2. this.saveBtnDisabled = true
    3. this.approvalForm.borrowerId = this.$route.params.id
    4. borrowerApi.approval(this.approvalForm).then(response => {
    5. this.$message.success(response.message)
    6. this.$router.push({ path: '/core/borrower/list' })
    7. })
    8. }

    4、查看用户积分

    审批后可以在会员列表查看用户积分 

    这部分的难点在于积分的累加判断

  • 相关阅读:
    第二节——Vue 基本介绍
    墨者-网络安全
    数据库云管平台 zCloud v3.5发布,智能化和国产数据库支持能力再增强
    论文阅读之Reasoning Implicit Sentiment with Chain-of-Thought Prompting
    基本数据类型
    【LittleXi】ccpc 2023 秦皇岛
    vue路由 & nodeJS环境搭建
    车身板(ABS)市场现状及未来发展趋势分析
    Vue中的数据代理
    数据结构--字符串的模式匹配
  • 原文地址:https://blog.csdn.net/m0_62436868/article/details/126900647