|
|
|
@ -921,150 +921,273 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity<HttpStatus> insertOrUpdateInvestmentPlan(CaseInvestmentPlanDto caseInvestmentPlanDto) {
|
|
|
|
|
CaseInfo newCase = new CaseInfo();
|
|
|
|
|
if (caseInvestmentPlanDto.getCaseInfo() != null) {
|
|
|
|
|
newCase = caseInvestmentPlanDto.getCaseInfo();
|
|
|
|
|
}
|
|
|
|
|
//新增或修改案例信息表
|
|
|
|
|
if (newCase != null) {
|
|
|
|
|
adminOrTeaInsert("master", newCase);
|
|
|
|
|
}
|
|
|
|
|
//老师和管理员新增/修改 只操作主表后返回
|
|
|
|
|
ResultEntity<HttpStatus> flag = teaOrAdminUpdateOrInsertInvestmentPlan(caseInvestmentPlanDto);
|
|
|
|
|
if (StringUtils.isBlank(caseInvestmentPlanDto.getUserId())) {
|
|
|
|
|
return flag;
|
|
|
|
|
CaseInvestmentPlan investmentPlan = caseInvestmentPlanDto.getInvestmentPlan();
|
|
|
|
|
|
|
|
|
|
//提交功能 主表必定不为空,把老数据查出来删掉
|
|
|
|
|
CaseInvestmentPlanExample example = new CaseInvestmentPlanExample();
|
|
|
|
|
example.createCriteria().andCaseIdEqualTo(investmentPlan.getCaseId()).andUserIdEqualTo(investmentPlan.getUserId()).andIsAnswerEqualTo("学生答案");
|
|
|
|
|
List<CaseInvestmentPlan> caseInvestmentPlans = investmentPlanMapper.selectByExampleWithBLOBs(example);
|
|
|
|
|
|
|
|
|
|
//删除老数据
|
|
|
|
|
if (caseInvestmentPlans != null && !caseInvestmentPlans.isEmpty()) {
|
|
|
|
|
CaseInvestmentPlan caseInvestmentPlan = caseInvestmentPlans.get(0);
|
|
|
|
|
|
|
|
|
|
CaseInvestmentPlanSelectExample planSelectExample = new CaseInvestmentPlanSelectExample();
|
|
|
|
|
planSelectExample.createCriteria().andCaseInvestmentPlanIdEqualTo(caseInvestmentPlan.getCaseInvestmentPlanId());
|
|
|
|
|
List<CaseInvestmentPlanSelect> investmentPlanSelectsDataList = caseInvestmentPlanSelectMapper.selectByExampleWithBLOBs(planSelectExample);
|
|
|
|
|
if (investmentPlanSelectsDataList != null && !investmentPlanSelectsDataList.isEmpty()) {
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
//学生操作多张表之后 最后返回
|
|
|
|
|
if (StringUtils.isNotBlank(caseInvestmentPlanDto.getUserId())) {
|
|
|
|
|
//判断是否提交过
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
//新增主表
|
|
|
|
|
String newCaseInvestmentPlanId = IdUtil.randomUUID();
|
|
|
|
|
investmentPlan.setCaseInvestmentPlanId(newCaseInvestmentPlanId);
|
|
|
|
|
investmentPlanMapper.insert(investmentPlan);
|
|
|
|
|
|
|
|
|
|
//投资规划-产品选择表和其余五张表是一对多关系
|
|
|
|
|
if (caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos() != null
|
|
|
|
|
&& !caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos().isEmpty()) {
|
|
|
|
|
List<CaseInvestmentPlanSelectDto> investmentPlanSelects = caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos();
|
|
|
|
|
|
|
|
|
|
for (CaseInvestmentPlanSelectDto investmentPlanSelect : investmentPlanSelects) {
|
|
|
|
|
|
|
|
|
|
CaseInvestmentPlanSelect caseInvestmentPlanSelect = investmentPlanSelect.getCaseInvestmentPlanSelect(); //产品选择表
|
|
|
|
|
String selectId = IdUtil.randomUUID();
|
|
|
|
|
//操作产品选择表
|
|
|
|
|
if (caseInvestmentPlanSelect != null && StringUtils.isBlank(caseInvestmentPlanSelect.getProductSelectId())) {
|
|
|
|
|
caseInvestmentPlanSelect.setProductSelectId(IdUtil.randomUUID());
|
|
|
|
|
caseInvestmentPlanSelect.setCaseInvestmentPlanId(investmentPlanId);
|
|
|
|
|
caseInvestmentPlanSelectMapper.insert(caseInvestmentPlanSelect);
|
|
|
|
|
} else {
|
|
|
|
|
caseInvestmentPlanSelectMapper.updateByPrimaryKeySelective(caseInvestmentPlanSelect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//投资规划-基金产品信息表
|
|
|
|
|
if (investmentPlanSelect.getInvestmentPlanFundProductInfos() != null
|
|
|
|
|
&& !investmentPlanSelect.getInvestmentPlanFundProductInfos().isEmpty()) {
|
|
|
|
|
List<CaseInvestmentPlanFundProductInfo> investmentPlanFundProductInfos = investmentPlanSelect.getInvestmentPlanFundProductInfos();
|
|
|
|
|
for (CaseInvestmentPlanFundProductInfo investmentPlanFundProductInfo : investmentPlanFundProductInfos) {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanFundProductInfo.getFundProductinfoId())) {
|
|
|
|
|
investmentPlanFundProductInfo.setFundProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanFundProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanFundProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanFundProductInfoMapper.insert(investmentPlanFundProductInfo);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanFundProductInfoMapper.updateByPrimaryKeySelective(investmentPlanFundProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//投资规划-产品选择表和其余五张表是一对多关系 //下面都为新增操作
|
|
|
|
|
if (caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos() != null
|
|
|
|
|
&& !caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos().isEmpty()) {
|
|
|
|
|
List<CaseInvestmentPlanSelectDto> investmentPlanSelects = caseInvestmentPlanDto.getCaseInvestmentPlanSelectDtos();
|
|
|
|
|
|
|
|
|
|
for (CaseInvestmentPlanSelectDto investmentPlanSelect : investmentPlanSelects) {
|
|
|
|
|
|
|
|
|
|
CaseInvestmentPlanSelect caseInvestmentPlanSelect = investmentPlanSelect.getCaseInvestmentPlanSelect(); //产品选择表
|
|
|
|
|
String selectId = IdUtil.randomUUID();
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanBankProductInfoMapper.updateByPrimaryKeySelective(investmentPlanBankProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//投资规划-银行储蓄信息表
|
|
|
|
|
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);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanInsuranceProductInfoMapper.updateByPrimaryKeySelective(investmentPlanInsuranceProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//投资规划-保险产品信息表
|
|
|
|
|
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);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanP2PProductInfoMapper.updateByPrimaryKeySelective(investmentPlanP2PProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//投资规划-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);
|
|
|
|
|
} else {
|
|
|
|
|
investmentPlanRealGoldProductInfoMapper.updateByPrimaryKeySelective(investmentPlanRealGoldProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//投资规划-实物黄金信息表
|
|
|
|
|
if (investmentPlanSelect.getInvestmentPlanRealGoldProductInfos() != null
|
|
|
|
|
&& !investmentPlanSelect.getInvestmentPlanRealGoldProductInfos().isEmpty()) {
|
|
|
|
|
List<CaseInvestmentPlanRealGoldProductInfo> investmentPlanRealGoldProductInfos = investmentPlanSelect.getInvestmentPlanRealGoldProductInfos();//投资规划-实物黄金信息表
|
|
|
|
|
|
|
|
|
|
for (CaseInvestmentPlanRealGoldProductInfo investmentPlanRealGoldProductInfo : investmentPlanRealGoldProductInfos) {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanRealGoldProductInfo.getRealGoldProductId())) {
|
|
|
|
|
investmentPlanRealGoldProductInfo.setRealGoldProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanRealGoldProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanRealGoldProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanRealGoldProductInfoMapper.insert(investmentPlanRealGoldProductInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (
|
|
|
|
|
Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return new ResultEntity<HttpStatus>(HttpStatus.INTERNAL_SERVER_ERROR, "系统错误,请联系管理员!");
|
|
|
|
|
}
|
|
|
|
|
return new ResultEntity<HttpStatus>(HttpStatus.OK, "操作成功!");
|
|
|
|
|
return new ResultEntity<HttpStatus>(HttpStatus.OK,"操作成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CaseInfo newCase = new CaseInfo();
|
|
|
|
|
// if (caseInvestmentPlanDto.getCaseInfo() != null) {
|
|
|
|
|
// newCase = caseInvestmentPlanDto.getCaseInfo();
|
|
|
|
|
// }
|
|
|
|
|
// //新增或修改案例信息表
|
|
|
|
|
// if (newCase != null) {
|
|
|
|
|
// adminOrTeaInsert("master", newCase);
|
|
|
|
|
// }
|
|
|
|
|
// //老师和管理员新增/修改 只操作主表后返回
|
|
|
|
|
// ResultEntity<HttpStatus> flag = teaOrAdminUpdateOrInsertInvestmentPlan(caseInvestmentPlanDto);
|
|
|
|
|
// if (StringUtils.isBlank(caseInvestmentPlanDto.getUserId())) {
|
|
|
|
|
// return flag;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// try {
|
|
|
|
|
// //学生操作多张表之后 最后返回
|
|
|
|
|
// if (StringUtils.isNotBlank(caseInvestmentPlanDto.getUserId())) {
|
|
|
|
|
// //判断是否提交过
|
|
|
|
|
// ResultEntity<HttpStatus> result = getHttpStatusResultEntity(caseInvestmentPlanDto.getCaseId(), caseInvestmentPlanDto.getUserId());
|
|
|
|
|
// if (result != null) return result;
|
|
|
|
|
//
|
|
|
|
|
// 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();
|
|
|
|
|
// //操作产品选择表
|
|
|
|
|
// if (caseInvestmentPlanSelect != null && StringUtils.isBlank(caseInvestmentPlanSelect.getProductSelectId())) {
|
|
|
|
|
// caseInvestmentPlanSelect.setProductSelectId(selectId);
|
|
|
|
|
// caseInvestmentPlanSelect.setCaseInvestmentPlanId(investmentPlan.getCaseInvestmentPlanId());
|
|
|
|
|
// caseInvestmentPlanSelectMapper.insert(caseInvestmentPlanSelect);
|
|
|
|
|
// } else {
|
|
|
|
|
// caseInvestmentPlanSelectMapper.updateByPrimaryKeySelective(caseInvestmentPlanSelect);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //投资规划-基金产品信息表
|
|
|
|
|
// if (investmentPlanSelect.getInvestmentPlanFundProductInfos() != null
|
|
|
|
|
// && !investmentPlanSelect.getInvestmentPlanFundProductInfos().isEmpty()) {
|
|
|
|
|
// List<CaseInvestmentPlanFundProductInfo> investmentPlanFundProductInfos = investmentPlanSelect.getInvestmentPlanFundProductInfos();
|
|
|
|
|
// for (CaseInvestmentPlanFundProductInfo investmentPlanFundProductInfo : investmentPlanFundProductInfos) {
|
|
|
|
|
// //id为空则新增
|
|
|
|
|
// if (StringUtils.isBlank(investmentPlanFundProductInfo.getFundProductinfoId())) {
|
|
|
|
|
// investmentPlanFundProductInfo.setFundProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
// investmentPlanFundProductInfo.setProductSelectId(selectId);
|
|
|
|
|
// investmentPlanFundProductInfo.setAddTime(new Date());
|
|
|
|
|
// investmentPlanFundProductInfoMapper.insert(investmentPlanFundProductInfo);
|
|
|
|
|
// } else {
|
|
|
|
|
// investmentPlanFundProductInfoMapper.updateByPrimaryKeySelective(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);
|
|
|
|
|
// } else {
|
|
|
|
|
// investmentPlanBankProductInfoMapper.updateByPrimaryKeySelective(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);
|
|
|
|
|
// } else {
|
|
|
|
|
// investmentPlanInsuranceProductInfoMapper.updateByPrimaryKeySelective(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);
|
|
|
|
|
// } else {
|
|
|
|
|
// investmentPlanP2PProductInfoMapper.updateByPrimaryKeySelective(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);
|
|
|
|
|
// } else {
|
|
|
|
|
// investmentPlanRealGoldProductInfoMapper.updateByPrimaryKeySelective(investmentPlanRealGoldProductInfo);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (
|
|
|
|
|
// Exception e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// return new ResultEntity<HttpStatus>(HttpStatus.INTERNAL_SERVER_ERROR, "系统错误,请联系管理员!");
|
|
|
|
|
// }
|
|
|
|
|
// return new ResultEntity<HttpStatus>(HttpStatus.OK, "操作成功!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ResultEntity<HttpStatus> teaOrAdminUpdateOrInsertInvestmentPlan(CaseInvestmentPlanDto
|
|
|
|
|
caseInvestmentPlanDto) {
|
|
|
|
|
if (caseInvestmentPlanDto.getInvestmentPlan() == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
CaseInvestmentPlan investmentPlan = caseInvestmentPlanDto.getInvestmentPlan();
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(investmentPlan.getCaseInvestmentPlanId())) { //主键为空为新增
|
|
|
|
@ -1431,7 +1554,7 @@ public class CaseServiceImpl implements CaseService {
|
|
|
|
|
for (CaseInvestmentPlanRealGoldProductInfo investmentPlanRealGoldProductInfo : investmentPlanRealGoldProductInfos) {
|
|
|
|
|
//id为空则新增
|
|
|
|
|
if (StringUtils.isBlank(investmentPlanRealGoldProductInfo.getRealGoldProductId())) {
|
|
|
|
|
investmentPlanRealGoldProductInfo.setRealGoldProductId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanRealGoldProductInfo.setRealGoldProductinfoId(IdUtil.randomUUID());
|
|
|
|
|
investmentPlanRealGoldProductInfo.setProductSelectId(selectId);
|
|
|
|
|
investmentPlanRealGoldProductInfo.setAddTime(new Date());
|
|
|
|
|
investmentPlanRealGoldProductInfoMapper.insert(investmentPlanRealGoldProductInfo);
|
|
|
|
|