From d41881df151795517970c8e4e1f123f60f250937 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Sat, 28 Sep 2024 18:12:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=8C=E7=BC=96=E8=BE=91?= =?UTF-8?q?=20=E7=BB=BC=E5=90=88=E8=A7=84=E5=88=92=E6=A1=88=E4=BE=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E4=BF=AE=E6=94=B9=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E8=80=83=E8=AF=95=E8=AE=B0=E5=BD=95=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=B1=95=E7=A4=BA=E6=8E=A5=E5=8F=A3=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CaseController.java | 9 +- .../controller/TheoryTestController.java | 26 +- .../entity/CaseConsumptionPlanWithBLOBs.java | 2 + .../money_management/entity/StuCaseDto.java | 46 ++++ .../money_management/service/CaseService.java | 3 + .../service/impl/CaseServiceImpl.java | 224 +++++++++++++++++- .../impl/SynthesisPlanServiceImpl.java | 64 ++++- 7 files changed, 355 insertions(+), 19 deletions(-) create mode 100644 src/main/java/com/sztzjy/money_management/entity/StuCaseDto.java diff --git a/src/main/java/com/sztzjy/money_management/controller/CaseController.java b/src/main/java/com/sztzjy/money_management/controller/CaseController.java index b439d46..de7ad4c 100644 --- a/src/main/java/com/sztzjy/money_management/controller/CaseController.java +++ b/src/main/java/com/sztzjy/money_management/controller/CaseController.java @@ -47,6 +47,13 @@ public class CaseController { return caseService.insertCase(caseInfo, json, operator, type); } + + @PostMapping("/insertComprehensivePlanCase") + @ApiOperation("新增/编辑综合规划案例") + private ResultEntity insertComprehensivePlanCase(@ApiParam("主表caseInfo必传")@RequestBody StuCaseDto stuCaseDto) { + return caseService.insertComprehensivePlanCase(stuCaseDto); + } + @PostMapping("/insertOrUpdateInvestmentPlan") @ApiOperation("新增/编辑案例,投资规划") private ResultEntity insertOrUpdateInvestmentPlan(@ApiParam("老师或管理员新增修改不传userId") @RequestBody CaseInvestmentPlanDto caseInvestmentPlanDto) { @@ -57,7 +64,7 @@ public class CaseController { @PostMapping("/deleteCase") @ApiOperation("删除案例题") private ResultEntity deleteCase(@RequestParam String caseId, - @ApiParam("管理员/老师")@RequestParam String role) { + @ApiParam("管理员/老师") @RequestParam String role) { CaseInfo caseInfo = caseInfoMapper.selectByPrimaryKey(caseId); if (role.equals("老师")) { if (caseInfo.getSource().equals("999999999")) { diff --git a/src/main/java/com/sztzjy/money_management/controller/TheoryTestController.java b/src/main/java/com/sztzjy/money_management/controller/TheoryTestController.java index c0aa7c8..b46cbf0 100644 --- a/src/main/java/com/sztzjy/money_management/controller/TheoryTestController.java +++ b/src/main/java/com/sztzjy/money_management/controller/TheoryTestController.java @@ -109,16 +109,15 @@ public class TheoryTestController { } - //获取理论考试开始时间 - @PostMapping("getAuthTestRecord") - @ApiOperation("认证考试/获取考试记录") - @AnonymousAccess - public ResultEntity> getAuthTestRecord(@RequestParam Integer index, - @RequestParam Integer size, - @RequestParam String userId, - @RequestParam String source) { - return theoryTestService.getAuthTestRecord(index, size, userId, source); - } +// @PostMapping("getAuthTestRecord") +// @ApiOperation("认证考试/获取考试记录") +// @AnonymousAccess +// public ResultEntity> getAuthTestRecord(@RequestParam Integer index, +// @RequestParam Integer size, +// @RequestParam String userId, +// @RequestParam String source) { +// return theoryTestService.getAuthTestRecord(index, size, userId, source); +// } //错题集展示 @@ -169,12 +168,11 @@ public class TheoryTestController { //考试记录详情查询 @GetMapping("getTheoryTestDetail") - @ApiOperation("理论考试/获取考试数据详情") + @ApiOperation("理论考试/认证考试/获取考试数据详情") @AnonymousAccess public ResultEntity> getTheoryTestDetail(@ApiParam("理论考试id") @RequestParam String theoryExamId, @RequestParam Integer index, - @RequestParam Integer size, - @RequestParam String schoolId) { + @RequestParam Integer size) { List detailDtoList = null; try { detailDtoList = theoryTestService.getTheoryTestDetail(theoryExamId, index, size); @@ -185,7 +183,7 @@ public class TheoryTestController { } - //答题次数、平均正确率、排名(理论考试记录) ************ +// 答题次数、平均正确率、排名(理论考试记录) ************ @GetMapping("getTheoryRecord") @ApiOperation("理论考试/获取考试记录") @AnonymousAccess diff --git a/src/main/java/com/sztzjy/money_management/entity/CaseConsumptionPlanWithBLOBs.java b/src/main/java/com/sztzjy/money_management/entity/CaseConsumptionPlanWithBLOBs.java index f536f71..15d5fc9 100644 --- a/src/main/java/com/sztzjy/money_management/entity/CaseConsumptionPlanWithBLOBs.java +++ b/src/main/java/com/sztzjy/money_management/entity/CaseConsumptionPlanWithBLOBs.java @@ -7,6 +7,8 @@ import io.swagger.annotations.ApiModelProperty; * @author xcj * case_consumption_plan */ + +// 没用 public class CaseConsumptionPlanWithBLOBs extends CaseConsumptionPlan { @ApiModelProperty("消费规划分析") private String analysis; diff --git a/src/main/java/com/sztzjy/money_management/entity/StuCaseDto.java b/src/main/java/com/sztzjy/money_management/entity/StuCaseDto.java new file mode 100644 index 0000000..0730715 --- /dev/null +++ b/src/main/java/com/sztzjy/money_management/entity/StuCaseDto.java @@ -0,0 +1,46 @@ +package com.sztzjy.money_management.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author xcj + * @Date 2024/9/28 + */ +@Data +public class StuCaseDto { + @ApiModelProperty("案例表") + private CaseInfo caseInfo; + @ApiModelProperty("财务分析现金流量表") + private CaseCashFlow caseCashFlow; + @ApiModelProperty("案例现金规划表") + private CaseCashPlan caseCashPlan; + @ApiModelProperty("生涯规划-消费规划表") + private CaseConsumptionPlan caseConsumptionPlan; + @ApiModelProperty("案例财产分配表") + private CaseDistributionOfPropertyWithBLOBs caseDistributionOfProperty; + @ApiModelProperty("案例财产分配家庭结构记录表") + private CaseDistributionOfPropertyFamilyRecords caseDistributionOfPropertyFamilyRecords; + @ApiModelProperty("财务分析-资产负债表") + private CaseFinanceLiability caseFinanceLiability; + @ApiModelProperty("案例财务分析财务比率分析表") + private CaseFinancialRatiosWithBLOBs caseFinancialRatios; + @ApiModelProperty("案例遗产传承表") + private CaseHeritageWithBLOBs caseHeritage; + @ApiModelProperty("案例财务分析收支储蓄表") + private CaseIncomeAndExpenses caseIncomeAndExpenses; + @ApiModelProperty("投资规划案例表") + private CaseInvestmentPlan caseInvestmentPlan; + @ApiModelProperty("案例生涯规划保险规划表") + private CaseInsurancePlan caseInsurancePlan; + @ApiModelProperty("案例生涯规划教育规划表") + private CaseLifeEducationPlan caseLifeEducationPlan; + @ApiModelProperty("案例生涯规划退休规划表") + private CaseRetirementPlan caseRetirementPlan; + @ApiModelProperty("风险测评-风险指标表") + private CaseRiskIndex caseRiskIndex; + @ApiModelProperty("案例生涯规划创业规划表") + private CaseStartAnUndertakingPlan caseStartAnUndertakingPlan; + @ApiModelProperty("案例税务筹划表") + private CaseTaxPlan caseTaxPlan; +} diff --git a/src/main/java/com/sztzjy/money_management/service/CaseService.java b/src/main/java/com/sztzjy/money_management/service/CaseService.java index 40b26b0..679e18f 100644 --- a/src/main/java/com/sztzjy/money_management/service/CaseService.java +++ b/src/main/java/com/sztzjy/money_management/service/CaseService.java @@ -1,6 +1,7 @@ package com.sztzjy.money_management.service; import com.nimbusds.jose.shaded.gson.Gson; +import com.sztzjy.money_management.entity.StuCaseDto; import com.sztzjy.money_management.entity.dto.CaseInvestmentPlanDto; import com.sztzjy.money_management.util.ResultEntity; import org.springframework.http.HttpStatus; @@ -22,4 +23,6 @@ public interface CaseService { ResultEntity addCorrelationTable(String type, String json, Gson gson, String operator); ResultEntity insertOrUpdateInvestmentPlan(CaseInvestmentPlanDto caseInvestmentPlanDto); + + ResultEntity insertComprehensivePlanCase(StuCaseDto stuCaseDto); } diff --git a/src/main/java/com/sztzjy/money_management/service/impl/CaseServiceImpl.java b/src/main/java/com/sztzjy/money_management/service/impl/CaseServiceImpl.java index 71a5501..9db9674 100644 --- a/src/main/java/com/sztzjy/money_management/service/impl/CaseServiceImpl.java +++ b/src/main/java/com/sztzjy/money_management/service/impl/CaseServiceImpl.java @@ -81,6 +81,7 @@ public class CaseServiceImpl implements CaseService { @Autowired private CaseInvestmentPlanSelectMapper caseInvestmentPlanSelectMapper; + private void insertSynthesisPlanClient(CaseInfo newCase) { SynthesisPlanClient synthesisPlanClient = new SynthesisPlanClient(); @@ -141,6 +142,224 @@ public class CaseServiceImpl implements CaseService { synthesisPlanClientMapper.insert(synthesisPlanClient); } + + @Override + public ResultEntity insertComprehensivePlanCase(StuCaseDto stuCaseDto) { + CaseInfo caseInfo = stuCaseDto.getCaseInfo(); + //新增 综合规划表 和 客户案例信息表 包含修改 + adminOrTeaInsert("master", caseInfo); + + //财务分析现金流量表 + if (stuCaseDto.getCaseCashFlow() != null) { + CaseCashFlow caseCashFlow = stuCaseDto.getCaseCashFlow(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseCashFlow.getCaseCashFlowId())) { + caseCashFlow.setCaseCashFlowId(IdUtil.randomUUID()); + caseCashFlowMapper.insert(caseCashFlow); + } + if (StringUtils.isNotBlank(caseCashFlow.getCaseCashFlowId())) { + caseCashFlowMapper.updateByPrimaryKeySelective(caseCashFlow); + } + } + + //案例现金规划表 + if (stuCaseDto.getCaseCashPlan() != null) { + CaseCashPlan caseCashPlan = stuCaseDto.getCaseCashPlan(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseCashPlan.getCaseCashPlanId())) { + caseCashPlan.setCaseCashPlanId(IdUtil.randomUUID()); + caseCashPlanMapper.insert(caseCashPlan); + } + if (StringUtils.isNotBlank(caseCashPlan.getCaseCashPlanId())) { + caseCashPlanMapper.updateByPrimaryKeySelective(caseCashPlan); + } + } + + //生涯规划-消费规划表 + if (stuCaseDto.getCaseConsumptionPlan() != null) { + CaseConsumptionPlan caseConsumptionPlan = stuCaseDto.getCaseConsumptionPlan(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseConsumptionPlan.getCaseConsumptionPlanId())) { + caseConsumptionPlan.setCaseConsumptionPlanId(IdUtil.randomUUID()); + caseConsumptionPlanMapper.insert(caseConsumptionPlan); + } + if (StringUtils.isNotBlank(caseConsumptionPlan.getCaseConsumptionPlanId())) { + caseConsumptionPlanMapper.updateByPrimaryKeySelective(caseConsumptionPlan); + } + } + + //案例财产分配表 + if (stuCaseDto.getCaseDistributionOfProperty() != null) { + CaseDistributionOfPropertyWithBLOBs caseDistributionOfProperty = stuCaseDto.getCaseDistributionOfProperty(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseDistributionOfProperty.getCaseDistributionOfPropertyId())) { + caseDistributionOfProperty.setCaseDistributionOfPropertyId(IdUtil.randomUUID()); + caseDistributionOfPropertyMapper.insert(caseDistributionOfProperty); + } + if (StringUtils.isNotBlank(caseDistributionOfProperty.getCaseDistributionOfPropertyId())) { + caseDistributionOfPropertyMapper.updateByPrimaryKeySelective(caseDistributionOfProperty); + } + } + + //案例财产分配家庭结构记录表 + if (stuCaseDto.getCaseDistributionOfPropertyFamilyRecords() != null) { + CaseDistributionOfPropertyFamilyRecords caseDistributionOfPropertyFamilyRecords = stuCaseDto.getCaseDistributionOfPropertyFamilyRecords(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseDistributionOfPropertyFamilyRecords.getCaseDistributionOfPropertyFamilyRecordsId())) { + caseDistributionOfPropertyFamilyRecords.setCaseDistributionOfPropertyFamilyRecordsId(IdUtil.randomUUID()); + caseDistributionOfPropertyFamilyRecordsMapper.insert(caseDistributionOfPropertyFamilyRecords); + } + if (StringUtils.isNotBlank(caseDistributionOfPropertyFamilyRecords.getCaseDistributionOfPropertyFamilyRecordsId())) { + caseDistributionOfPropertyFamilyRecordsMapper.updateByPrimaryKeySelective(caseDistributionOfPropertyFamilyRecords); + } + } + + //财务分析-资产负债表 + if (stuCaseDto.getCaseFinanceLiability() != null) { + CaseFinanceLiability caseFinanceLiability = stuCaseDto.getCaseFinanceLiability(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseFinanceLiability.getCaseFinanceLiabilityId())) { + caseFinanceLiability.setCaseFinanceLiabilityId(IdUtil.randomUUID()); + caseFinanceLiabilityMapper.insert(caseFinanceLiability); + } + if (StringUtils.isNotBlank(caseFinanceLiability.getCaseFinanceLiabilityId())) { + caseFinanceLiabilityMapper.updateByPrimaryKeySelective(caseFinanceLiability); + } + } + + //案例财务分析财务比率分析表 + if (stuCaseDto.getCaseFinancialRatios() != null) { + CaseFinancialRatiosWithBLOBs caseFinancialRatios = stuCaseDto.getCaseFinancialRatios(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseFinancialRatios.getCaseFinancialRatiosId())) { + caseFinancialRatios.setCaseFinancialRatiosId(IdUtil.randomUUID()); + caseFinancialRatiosMapper.insert(caseFinancialRatios); + } + if (StringUtils.isNotBlank(caseFinancialRatios.getCaseFinancialRatiosId())) { + caseFinancialRatiosMapper.updateByPrimaryKeySelective(caseFinancialRatios); + } + } + + //案例遗产传承表 + if (stuCaseDto.getCaseHeritage() != null) { + CaseHeritageWithBLOBs caseHeritage = stuCaseDto.getCaseHeritage(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseHeritage.getCaseHeritageId())) { + caseHeritage.setCaseHeritageId(IdUtil.randomUUID()); + caseHeritageMapper.insert(caseHeritage); + } + if (StringUtils.isNotBlank(caseHeritage.getCaseHeritageId())) { + caseHeritageMapper.updateByPrimaryKeySelective(caseHeritage); + } + } + + //案例财务分析收支储蓄表 + if (stuCaseDto.getCaseIncomeAndExpenses() != null) { + CaseIncomeAndExpenses caseIncomeAndExpenses = stuCaseDto.getCaseIncomeAndExpenses(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseIncomeAndExpenses.getCaseIncomeAndExpensesId())) { + caseIncomeAndExpenses.setCaseIncomeAndExpensesId(IdUtil.randomUUID()); + caseIncomeAndExpensesMapper.insert(caseIncomeAndExpenses); + } + if (StringUtils.isNotBlank(caseIncomeAndExpenses.getCaseIncomeAndExpensesId())) { + caseIncomeAndExpensesMapper.updateByPrimaryKeySelective(caseIncomeAndExpenses); + } + } + + //投资规划案例表 + if (stuCaseDto.getCaseInvestmentPlan() != null) { + CaseInvestmentPlan caseInvestmentPlan = stuCaseDto.getCaseInvestmentPlan(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseInvestmentPlan.getCaseInvestmentPlanId())) { + caseInvestmentPlan.setCaseInvestmentPlanId(IdUtil.randomUUID()); + investmentPlanMapper.insert(caseInvestmentPlan); + } + if (StringUtils.isNotBlank(caseInvestmentPlan.getCaseInvestmentPlanId())) { + investmentPlanMapper.updateByPrimaryKeySelective(caseInvestmentPlan); + } + } + + //案例生涯规划保险规划表 + if (stuCaseDto.getCaseInsurancePlan() != null) { + CaseInsurancePlan caseInsurancePlan = stuCaseDto.getCaseInsurancePlan(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseInsurancePlan.getCaseInsurancePlanId())) { + caseInsurancePlan.setCaseInsurancePlanId(IdUtil.randomUUID()); + caseInsurancePlanMapper.insert(caseInsurancePlan); + } + if (StringUtils.isNotBlank(caseInsurancePlan.getCaseInsurancePlanId())) { + caseInsurancePlanMapper.updateByPrimaryKeySelective(caseInsurancePlan); + } + } + + //案例生涯规划教育规划表 + if (stuCaseDto.getCaseLifeEducationPlan() != null) { + CaseLifeEducationPlan caseLifeEducationPlan = stuCaseDto.getCaseLifeEducationPlan(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseLifeEducationPlan.getCaseLifeEducationPlanId())) { + caseLifeEducationPlan.setCaseLifeEducationPlanId(IdUtil.randomUUID()); + caseLifeEducationPlanMapper.insert(caseLifeEducationPlan); + } + if (StringUtils.isNotBlank(caseLifeEducationPlan.getCaseLifeEducationPlanId())) { + caseLifeEducationPlanMapper.updateByPrimaryKeySelective(caseLifeEducationPlan); + } + } + + //案例生涯规划退休规划表 + if (stuCaseDto.getCaseRetirementPlan() != null) { + CaseRetirementPlan caseRetirementPlan = stuCaseDto.getCaseRetirementPlan(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseRetirementPlan.getCaseRetirementPlanId())) { + caseRetirementPlan.setCaseRetirementPlanId(IdUtil.randomUUID()); + caseRetirementPlanMapper.insert(caseRetirementPlan); + } + if (StringUtils.isNotBlank(caseRetirementPlan.getCaseRetirementPlanId())) { + caseRetirementPlanMapper.updateByPrimaryKeySelective(caseRetirementPlan); + } + } + + //风险测评-风险指标表 + if (stuCaseDto.getCaseRiskIndex() != null) { + CaseRiskIndex caseRiskIndex = stuCaseDto.getCaseRiskIndex(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseRiskIndex.getCaseRiskIndexId())) { + caseRiskIndex.setCaseRiskIndexId(IdUtil.randomUUID()); + caseRiskIndexMapper.insert(caseRiskIndex); + } + if (StringUtils.isNotBlank(caseRiskIndex.getCaseRiskIndexId())) { + caseRiskIndexMapper.updateByPrimaryKeySelective(caseRiskIndex); + } + } + + //案例生涯规划创业规划表 + if (stuCaseDto.getCaseStartAnUndertakingPlan() != null) { + CaseStartAnUndertakingPlan caseStartAnUndertakingPlan = stuCaseDto.getCaseStartAnUndertakingPlan(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseStartAnUndertakingPlan.getCaseStartAnUndertakingPlanId())) { + caseStartAnUndertakingPlan.setCaseStartAnUndertakingPlanId(IdUtil.randomUUID()); + caseStartAnUndertakingPlanMapper.insert(caseStartAnUndertakingPlan); + } + if (StringUtils.isNotBlank(caseStartAnUndertakingPlan.getCaseStartAnUndertakingPlanId())) { + caseStartAnUndertakingPlanMapper.updateByPrimaryKeySelective(caseStartAnUndertakingPlan); + } + } + + //案例税务筹划表 + if (stuCaseDto.getCaseTaxPlan() != null) { + CaseTaxPlan caseTaxPlan = stuCaseDto.getCaseTaxPlan(); + //ID为空新增,不为空编辑 + if (StringUtils.isBlank(caseTaxPlan.getCaseTaxPlanId())) { + caseTaxPlan.setCaseTaxPlanId(IdUtil.randomUUID()); + caseTaxPlanMapper.insert(caseTaxPlan); + } + if (StringUtils.isNotBlank(caseTaxPlan.getCaseTaxPlanId())) { + caseTaxPlanMapper.updateByPrimaryKeySelective(caseTaxPlan); + } + } + return null; + } + + @Override public ResultEntity insertCase(String caseInfo, String json, String operator, String type) { Gson gson = new Gson(); @@ -632,6 +851,7 @@ public class CaseServiceImpl implements CaseService { return new ResultEntity(HttpStatus.OK, "操作成功!"); } + private ResultEntity teaOrAdminUpdateOrInsertInvestmentPlan(CaseInvestmentPlanDto caseInvestmentPlanDto) { CaseInvestmentPlan investmentPlan = caseInvestmentPlanDto.getInvestmentPlan(); @@ -1699,10 +1919,10 @@ public class CaseServiceImpl implements CaseService { example.createCriteria().andCaseidEqualTo(caseID); List comCases = comCaseMapper.selectByExample(example); - SynthesisPlanClientExample example1 =new SynthesisPlanClientExample(); + SynthesisPlanClientExample example1 = new SynthesisPlanClientExample(); example1.createCriteria().andUseridEqualTo(userId).andCaseidEqualTo(caseID); List synthesisPlanClientList = synthesisPlanClientMapper.selectByExample(example1); - if (synthesisPlanClientList!=null && !synthesisPlanClientList.isEmpty()){ + if (synthesisPlanClientList != null && !synthesisPlanClientList.isEmpty()) { SynthesisPlanClient synthesisPlanClient = synthesisPlanClientList.get(0); synthesisPlanClient.setSubmitStatus("未审核"); synthesisPlanClientMapper.updateByPrimaryKey(synthesisPlanClient); diff --git a/src/main/java/com/sztzjy/money_management/service/impl/SynthesisPlanServiceImpl.java b/src/main/java/com/sztzjy/money_management/service/impl/SynthesisPlanServiceImpl.java index d51765d..a37ba2d 100644 --- a/src/main/java/com/sztzjy/money_management/service/impl/SynthesisPlanServiceImpl.java +++ b/src/main/java/com/sztzjy/money_management/service/impl/SynthesisPlanServiceImpl.java @@ -58,7 +58,8 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { private CaseServiceImpl caseService; @Autowired private SynthesisPlanScoreMapper synthesisPlanScoreMapper; - + @Autowired + private CaseInvestmentPlanMapper caseInvestmentPlanmapper; @Override public Map adviseInvestmentProductAllot(BigDecimal RAIScore, BigDecimal RCIScore) { @@ -435,6 +436,20 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { if (type.equals("投资规划")) { // todo 表暂时没有 + //投资规划 + CaseInvestmentPlanExample caseInvestmentPlanExample = new CaseInvestmentPlanExample(); + caseInvestmentPlanExample.createCriteria().andCaseIdEqualTo(caseID).andIsAnswerEqualTo("题目答案").andUserIdIsNull(); + List rightCaseInvestmentPlans = caseInvestmentPlanmapper.selectByExample(caseInvestmentPlanExample); + + CaseInvestmentPlanExample stuCaseInvestmentPlanExample = new CaseInvestmentPlanExample(); + stuCaseInvestmentPlanExample.createCriteria().andCaseIdEqualTo(caseID).andIsAnswerEqualTo("学生答案").andUserIdEqualTo(userId); + List stuCaseInvestmentPlans = caseInvestmentPlanmapper.selectByExample(stuCaseInvestmentPlanExample); + //为空的话返回报错提示 + if (stuCaseInvestmentPlans == null || stuCaseInvestmentPlans.isEmpty()) { + return new ResultEntity(HttpStatus.BAD_REQUEST, type + "还未填写!"); + } + //计算对错 + caseInvestmentPlan(userId, caseID, rightCaseInvestmentPlans, stuCaseInvestmentPlans, list); } if (type.equals("税务筹划")) { @@ -693,7 +708,52 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { } - //todo 投资规划 表暂无 + //投资规划 + private void caseInvestmentPlan(String userId, String + caseID, List rightCaseInvestmentPlans, + List stuCaseInvestmentPlans, List list) { + if ((rightCaseInvestmentPlans != null && !rightCaseInvestmentPlans.isEmpty()) + && (stuCaseInvestmentPlans != null && !stuCaseInvestmentPlans.isEmpty())) { + CaseInvestmentPlan stuCaseInvestmentPlan = stuCaseInvestmentPlans.get(0); + CaseInvestmentPlan caseInvestmentPlan = rightCaseInvestmentPlans.get(0); + + Map> testCenters = new HashMap<>(); + testCenters.put("当前客户所处家庭生命周期", item -> convertToString(item.getLifeCycleId())); + testCenters.put("投资规划分析", item -> convertToString(item.getAnalysis())); + + for (Map.Entry> entry : testCenters.entrySet()) { + String testCenter = entry.getKey(); + java.util.function.Function scoreGetter = entry.getValue(); + + String caseScore = convertToString(scoreGetter.apply(caseInvestmentPlan)); + String stuScore = convertToString(scoreGetter.apply(stuCaseInvestmentPlan)); + + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("投资规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + + if (testCenter.equals("投资规划分析")) { + + } else { + if (stuScore == null || !stuScore.equals(caseScore)) { + synthesisPlanScore.setStatus("答错"); + synthesisPlanScore.setScore(BigDecimal.ZERO); + } else { + synthesisPlanScore.setStatus("答对"); + synthesisPlanScore.setScore(BigDecimal.valueOf(2)); + } + } + list.add(synthesisPlanScore); + } + } + } + private void caseInsurancePlans(String userId, String caseID, List rightCaseInsurancePlans,