|
|
|
@ -17,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.*;
|
|
|
|
@ -495,7 +494,6 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity<HttpStatus> insertCase(String caseInfo, String json, String operator, String type) {
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
@ -935,6 +933,15 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
ResultEntity<HttpStatus> result = getHttpStatusResultEntity(caseInvestmentPlanDto.getCaseId(), caseInvestmentPlanDto.getUserId());
|
|
|
|
|
if (result != null) return result;
|
|
|
|
|
|
|
|
|
|
CaseInvestmentPlan investmentPlan = caseInvestmentPlanDto.getInvestmentPlan();
|
|
|
|
|
String investmentPlanId = IdUtil.randomUUID();
|
|
|
|
|
if (StringUtils.isBlank(investmentPlan.getCaseInvestmentPlanId())) {
|
|
|
|
|
investmentPlan.setCaseInvestmentPlanId(investmentPlanId);
|
|
|
|
|
investmentPlanMapper.insert(investmentPlan);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanMapper.updateByPrimaryKey(investmentPlan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//投资规划-产品选择表和其余五张表是一对多关系
|
|
|
|
|
if (caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos() != null
|
|
|
|
|
&& !caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos().isEmpty()) {
|
|
|
|
@ -943,12 +950,11 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
for (CaseInvestmentPlanSelectDto investmentPlanSelect : investmentPlanSelects) {
|
|
|
|
|
|
|
|
|
|
CaseInvestmentPlanSelect caseInvestmentPlanSelect = investmentPlanSelect.getCaseInvestmentPlanSelect(); //产品选择表
|
|
|
|
|
|
|
|
|
|
String selectId = IdUtil.randomUUID();
|
|
|
|
|
//操作产品选择表
|
|
|
|
|
//id为空则新增 表不可能为null
|
|
|
|
|
if (caseInvestmentPlanSelect != null && StringUtils.isBlank(caseInvestmentPlanSelect.getProductSelectId())) {
|
|
|
|
|
caseInvestmentPlanSelect.setProductSelectId(IdUtil.randomUUID());
|
|
|
|
|
//todo caseid前端能否传过来
|
|
|
|
|
caseInvestmentPlanSelect.setCaseInvestmentPlanId(investmentPlanId);
|
|
|
|
|
caseInvestmentPlanSelectMapper.insert(caseInvestmentPlanSelect);
|
|
|
|
|
} else {
|
|
|
|
|
caseInvestmentPlanSelectMapper.updateByPrimaryKeySelective(caseInvestmentPlanSelect);
|
|
|
|
@ -962,6 +968,8 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanFundProductInfo.getFundProductinfoId())) {
|
|
|
|
|
investmentPlanFundProductInfo.setFundProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanFundProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanFundProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanFundProductInfoMapper.insert(investmentPlanFundProductInfo);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanFundProductInfoMapper.updateByPrimaryKeySelective(investmentPlanFundProductInfo);
|
|
|
|
@ -976,6 +984,8 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanBankProductInfo.getBankProductinfoId())) {
|
|
|
|
|
investmentPlanBankProductInfo.setBankProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanBankProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanBankProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanBankProductInfoMapper.insert(investmentPlanBankProductInfo);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanBankProductInfoMapper.updateByPrimaryKeySelective(investmentPlanBankProductInfo);
|
|
|
|
@ -991,6 +1001,8 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanInsuranceProductInfo.getInsuranceProductinfoId())) {
|
|
|
|
|
investmentPlanInsuranceProductInfo.setInsuranceProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanInsuranceProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanInsuranceProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanInsuranceProductInfoMapper.insert(investmentPlanInsuranceProductInfo);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanInsuranceProductInfoMapper.updateByPrimaryKeySelective(investmentPlanInsuranceProductInfo);
|
|
|
|
@ -1005,6 +1017,8 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanP2PProductInfo.getP2pProductinfoId())) {
|
|
|
|
|
investmentPlanP2PProductInfo.setP2pProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanP2PProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanP2PProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanP2PProductInfoMapper.insert(investmentPlanP2PProductInfo);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanP2PProductInfoMapper.updateByPrimaryKeySelective(investmentPlanP2PProductInfo);
|
|
|
|
@ -1020,6 +1034,8 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanRealGoldProductInfo.getRealGoldProductId())) {
|
|
|
|
|
investmentPlanRealGoldProductInfo.setRealGoldProductId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanRealGoldProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanRealGoldProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanRealGoldProductInfoMapper.insert(investmentPlanRealGoldProductInfo);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanRealGoldProductInfoMapper.updateByPrimaryKeySelective(investmentPlanRealGoldProductInfo);
|
|
|
|
@ -1269,21 +1285,154 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
wrongCount = getCaseInsurancePlanWrongCount(wrongCount, stuData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (type.equals("投资规划")) {
|
|
|
|
|
// CaseInvestmentPlan stuInvestmentPlan = gson.fromJson(json, CaseInvestmentPlan.class);
|
|
|
|
|
// CaseInvestmentPlanExample caseInvestmentPlanExample = new CaseInvestmentPlanExample();
|
|
|
|
|
// caseInvestmentPlanExample.createCriteria().andIsAnswerEqualTo("学生答案").andUserIdEqualTo(stuInvestmentPlan.getUserId()).andCaseIdEqualTo(stuInvestmentPlan.getCaseId());
|
|
|
|
|
// List<CaseInvestmentPlan> caseInvestmentPlans = investmentPlanMapper.selectByExampleWithBLOBs(caseInvestmentPlanExample);
|
|
|
|
|
// if (!caseInvestmentPlans.isEmpty()) {
|
|
|
|
|
// for (CaseInvestmentPlan caseInvestmentPlan : caseInvestmentPlans) {
|
|
|
|
|
// investmentPlanMapper.deleteByPrimaryKey(caseInvestmentPlan.getCaseInvestmentPlanId());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// stuInvestmentPlan.setCaseInvestmentPlanId(IdUtil.randomUUID());
|
|
|
|
|
// investmentPlanMapper.insert(stuInvestmentPlan);
|
|
|
|
|
//
|
|
|
|
|
// //比较正确答案
|
|
|
|
|
// wrongCount = getCaseInvestmentPlan(wrongCount, stuInvestmentPlan);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//先查询一次
|
|
|
|
|
if (type.equals("投资规划")) {
|
|
|
|
|
CaseInvestmentPlan stuInvestmentPlan = gson.fromJson(json, CaseInvestmentPlan.class);
|
|
|
|
|
CaseInvestmentPlanExample caseInvestmentPlanExample = new CaseInvestmentPlanExample();
|
|
|
|
|
caseInvestmentPlanExample.createCriteria().andIsAnswerEqualTo("学生答案").andUserIdEqualTo(stuInvestmentPlan.getUserId()).andCaseIdEqualTo(stuInvestmentPlan.getCaseId());
|
|
|
|
|
List<CaseInvestmentPlan> caseInvestmentPlans = investmentPlanMapper.selectByExampleWithBLOBs(caseInvestmentPlanExample);
|
|
|
|
|
if (!caseInvestmentPlans.isEmpty()) {
|
|
|
|
|
for (CaseInvestmentPlan caseInvestmentPlan : caseInvestmentPlans) {
|
|
|
|
|
investmentPlanMapper.deleteByPrimaryKey(caseInvestmentPlan.getCaseInvestmentPlanId());
|
|
|
|
|
CaseInvestmentPlanDto caseInvestmentPlanDto = gson.fromJson(json, CaseInvestmentPlanDto.class);
|
|
|
|
|
|
|
|
|
|
CaseInvestmentPlan investmentPlan = caseInvestmentPlanDto.getInvestmentPlan();
|
|
|
|
|
|
|
|
|
|
//投资规划-产品选择表和其余五张表是一对多关系
|
|
|
|
|
if (caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos() != null
|
|
|
|
|
&& !caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos().isEmpty()) {
|
|
|
|
|
List<CaseInvestmentPlanSelectDto> investmentPlanSelects = caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos();
|
|
|
|
|
|
|
|
|
|
for (CaseInvestmentPlanSelectDto investmentPlanSelect : investmentPlanSelects) {
|
|
|
|
|
|
|
|
|
|
CaseInvestmentPlanSelect caseInvestmentPlanSelect = investmentPlanSelect.getCaseInvestmentPlanSelect(); //产品选择表
|
|
|
|
|
String selectId = IdUtil.randomUUID();
|
|
|
|
|
|
|
|
|
|
//提交功能 主表必定不为空,把老数据查出来删掉
|
|
|
|
|
CaseInvestmentPlanExample example = new CaseInvestmentPlanExample();
|
|
|
|
|
example.createCriteria().andCaseIdEqualTo(investmentPlan.getCaseId()).andUserIdEqualTo(investmentPlan.getUserId()).andIsAnswerEqualTo("学生答案");
|
|
|
|
|
List<CaseInvestmentPlan> caseInvestmentPlans = investmentPlanMapper.selectByExampleWithBLOBs(example);
|
|
|
|
|
|
|
|
|
|
//删除老数据
|
|
|
|
|
if (caseInvestmentPlans != null) {
|
|
|
|
|
CaseInvestmentPlan caseInvestmentPlan = caseInvestmentPlans.get(0);
|
|
|
|
|
|
|
|
|
|
CaseInvestmentPlanSelectExample planSelectExample = new CaseInvestmentPlanSelectExample();
|
|
|
|
|
planSelectExample.createCriteria().andCaseInvestmentPlanIdEqualTo(caseInvestmentPlan.getCaseInvestmentPlanId());
|
|
|
|
|
List<CaseInvestmentPlanSelect> investmentPlanSelectsDataList = caseInvestmentPlanSelectMapper.selectByExampleWithBLOBs(planSelectExample);
|
|
|
|
|
if (investmentPlanSelectsDataList != null) {
|
|
|
|
|
CaseInvestmentPlanSelect investmentPlanSelectsData = investmentPlanSelectsDataList.get(0);
|
|
|
|
|
String productSelectId = investmentPlanSelectsData.getProductSelectId();
|
|
|
|
|
caseInvestmentPlanSelectMapper.deleteByPrimaryKey(productSelectId);
|
|
|
|
|
caseInvestmentPlanSelectMapper.deleteByPrimaryKey(productSelectId);
|
|
|
|
|
investmentPlanFundProductInfoMapper.deleteByPrimaryKey(productSelectId);
|
|
|
|
|
investmentPlanBankProductInfoMapper.deleteByPrimaryKey(productSelectId);
|
|
|
|
|
investmentPlanInsuranceProductInfoMapper.deleteByPrimaryKey(productSelectId);
|
|
|
|
|
investmentPlanP2PProductInfoMapper.deleteByPrimaryKey(productSelectId);
|
|
|
|
|
investmentPlanRealGoldProductInfoMapper.deleteByPrimaryKey(productSelectId);
|
|
|
|
|
}
|
|
|
|
|
investmentPlanMapper.deleteByPrimaryKey(caseInvestmentPlan.getCaseInvestmentPlanId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//新增主表
|
|
|
|
|
String newCaseInvestmentPlanId = IdUtil.randomUUID();
|
|
|
|
|
investmentPlan.setCaseInvestmentPlanId(newCaseInvestmentPlanId);
|
|
|
|
|
investmentPlanMapper.insert(investmentPlan);
|
|
|
|
|
|
|
|
|
|
//下面都为新增操作
|
|
|
|
|
if (caseInvestmentPlanSelect != null) {
|
|
|
|
|
caseInvestmentPlanSelect.setProductSelectId(selectId);
|
|
|
|
|
caseInvestmentPlanSelect.setCaseInvestmentPlanId(newCaseInvestmentPlanId);
|
|
|
|
|
caseInvestmentPlanSelectMapper.insert(caseInvestmentPlanSelect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//投资规划-基金产品信息表
|
|
|
|
|
if (investmentPlanSelect.getInvestmentPlanFundProductInfos() != null
|
|
|
|
|
&& !investmentPlanSelect.getInvestmentPlanFundProductInfos().isEmpty()) {
|
|
|
|
|
List<CaseInvestmentPlanFundProductInfo> investmentPlanFundProductInfos = investmentPlanSelect.getInvestmentPlanFundProductInfos();
|
|
|
|
|
|
|
|
|
|
for (CaseInvestmentPlanFundProductInfo investmentPlanFundProductInfo : investmentPlanFundProductInfos) {
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanFundProductInfo.getFundProductinfoId())) {
|
|
|
|
|
investmentPlanFundProductInfo.setFundProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanFundProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanFundProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanFundProductInfoMapper.insert(investmentPlanFundProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//投资规划-银行储蓄信息表
|
|
|
|
|
if (investmentPlanSelect.getInvestmentPlanBankProductInfos() != null
|
|
|
|
|
&& !investmentPlanSelect.getInvestmentPlanBankProductInfos().isEmpty()) {
|
|
|
|
|
List<CaseInvestmentPlanBankProductInfo> investmentPlanBankProductInfos = investmentPlanSelect.getInvestmentPlanBankProductInfos(); //投资规划-银行储蓄信息表
|
|
|
|
|
for (CaseInvestmentPlanBankProductInfo investmentPlanBankProductInfo : investmentPlanBankProductInfos) {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanBankProductInfo.getBankProductinfoId())) {
|
|
|
|
|
investmentPlanBankProductInfo.setBankProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanBankProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanBankProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanBankProductInfoMapper.insert(investmentPlanBankProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//投资规划-保险产品信息表
|
|
|
|
|
if (investmentPlanSelect.getInvestmentPlanInsuranceProductInfos() != null
|
|
|
|
|
&& !investmentPlanSelect.getInvestmentPlanInsuranceProductInfos().isEmpty()) {
|
|
|
|
|
List<CaseInvestmentPlanInsuranceProductInfo> investmentPlanInsuranceProductInfos = investmentPlanSelect.getInvestmentPlanInsuranceProductInfos();//投资规划-保险产品信息表
|
|
|
|
|
|
|
|
|
|
for (CaseInvestmentPlanInsuranceProductInfo investmentPlanInsuranceProductInfo : investmentPlanInsuranceProductInfos) {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanInsuranceProductInfo.getInsuranceProductinfoId())) {
|
|
|
|
|
investmentPlanInsuranceProductInfo.setInsuranceProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanInsuranceProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanInsuranceProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanInsuranceProductInfoMapper.insert(investmentPlanInsuranceProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//投资规划-P2P产品信息表
|
|
|
|
|
if (investmentPlanSelect.getInvestmentPlanP2PProductInfos() != null
|
|
|
|
|
&& !investmentPlanSelect.getInvestmentPlanP2PProductInfos().isEmpty()) {
|
|
|
|
|
List<CaseInvestmentPlanP2PProductInfo> investmentPlanP2PProductInfos = investmentPlanSelect.getInvestmentPlanP2PProductInfos();//投资规划-P2P产品信息表
|
|
|
|
|
for (CaseInvestmentPlanP2PProductInfo investmentPlanP2PProductInfo : investmentPlanP2PProductInfos) {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanP2PProductInfo.getP2pProductinfoId())) {
|
|
|
|
|
investmentPlanP2PProductInfo.setP2pProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanP2PProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanP2PProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanP2PProductInfoMapper.insert(investmentPlanP2PProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//投资规划-实物黄金信息表
|
|
|
|
|
if (investmentPlanSelect.getInvestmentPlanRealGoldProductInfos() != null
|
|
|
|
|
&& !investmentPlanSelect.getInvestmentPlanRealGoldProductInfos().isEmpty()) {
|
|
|
|
|
List<CaseInvestmentPlanRealGoldProductInfo> investmentPlanRealGoldProductInfos = investmentPlanSelect.getInvestmentPlanRealGoldProductInfos();//投资规划-实物黄金信息表
|
|
|
|
|
|
|
|
|
|
for (CaseInvestmentPlanRealGoldProductInfo investmentPlanRealGoldProductInfo : investmentPlanRealGoldProductInfos) {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanRealGoldProductInfo.getRealGoldProductId())) {
|
|
|
|
|
investmentPlanRealGoldProductInfo.setRealGoldProductId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanRealGoldProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanRealGoldProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanRealGoldProductInfoMapper.insert(investmentPlanRealGoldProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
stuInvestmentPlan.setCaseInvestmentPlanId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanMapper.insert(stuInvestmentPlan);
|
|
|
|
|
|
|
|
|
|
//比较正确答案
|
|
|
|
|
wrongCount = getCaseInvestmentPlan(wrongCount, stuInvestmentPlan);
|
|
|
|
|
wrongCount = getCaseInvestmentPlan(wrongCount, investmentPlan);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type.equals("税务筹划")) {
|
|
|
|
@ -1354,7 +1503,8 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
wrongCount = getCaseHeritageWrongCount(wrongCount, stuData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
} catch (
|
|
|
|
|
Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new RuntimeException("实训提交失败");
|
|
|
|
|
}
|
|
|
|
|