Commit b7891caa by zhangxingmin

push

parent b0a64047
...@@ -117,7 +117,7 @@ public class ApiAppointmentFileController implements ApiAppointmentFileFeignClie ...@@ -117,7 +117,7 @@ public class ApiAppointmentFileController implements ApiAppointmentFileFeignClie
} }
/** /**
* Excel导入-预约信息 * Excel导入-解析Excel预约信息
* @return * @return
*/ */
@Override @Override
......
...@@ -349,7 +349,7 @@ public class ApiAppointmentFileServiceImpl implements ApiAppointmentFileService ...@@ -349,7 +349,7 @@ public class ApiAppointmentFileServiceImpl implements ApiAppointmentFileService
/** /**
* Excel导入-预约信息 * Excel导入-解析Excel预约信息
* @param file * @param file
* @param request * @param request
* @return * @return
...@@ -357,22 +357,17 @@ public class ApiAppointmentFileServiceImpl implements ApiAppointmentFileService ...@@ -357,22 +357,17 @@ public class ApiAppointmentFileServiceImpl implements ApiAppointmentFileService
@Override @Override
public Result<ApiAppointmentImportExcelResponse> appointmentImportExcel(MultipartFile file, public Result<ApiAppointmentImportExcelResponse> appointmentImportExcel(MultipartFile file,
ApiAppointmentImportExcelRequest request) { ApiAppointmentImportExcelRequest request) {
//校验预约信息是否存在
Result<Appointment> appointmentResult = apiAppointmentService.checkAppointmentIsExist(request.getAppointmentBizId());
Appointment appointment = appointmentResult.getData();
ApiAppointmentImportExcelResponse response = new ApiAppointmentImportExcelResponse();
String s = "com.yd.csf.feign.dto.excel.ApiExcelImportAppointmentDto,com.yd.csf.feign.dto.excel.ApiExcelImportHealthDto"; String s = "com.yd.csf.feign.dto.excel.ApiExcelImportAppointmentDto,com.yd.csf.feign.dto.excel.ApiExcelImportHealthDto";
//Feign调用-oss服务,通用-Excel解析(支持多sheet页解析) //Feign调用-oss服务,通用-Excel解析(支持多sheet页解析)
Result<ApiOssExcelParseResponse> result = apiExcelFeignClient.parse(file, s); Result<ApiOssExcelParseResponse> result = apiExcelFeignClient.parse(file, s);
if (Objects.isNull(result.getData()) || if (Objects.isNull(result.getData()) ||
(!Objects.isNull(result.getData()) && Objects.isNull(result.getData().getMap()))){ (!Objects.isNull(result.getData()) && Objects.isNull(result.getData().getMap()))){
throw new BusinessException("导入数据不能为空!"); throw new BusinessException("导入数据不能为空!");
} }
//Excel解析出的信息 //Excel解析出的信息
Map<Integer, Object> data = (Map<Integer, Object>) result.getData().getMap(); Map<Integer, Object> data = (Map<Integer, Object>) result.getData().getMap();
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
try { try {
...@@ -382,83 +377,44 @@ public class ApiAppointmentFileServiceImpl implements ApiAppointmentFileService ...@@ -382,83 +377,44 @@ public class ApiAppointmentFileServiceImpl implements ApiAppointmentFileService
LinkedHashMap<String, Object> appointmentData = (LinkedHashMap<String, Object>) data.get(0); LinkedHashMap<String, Object> appointmentData = (LinkedHashMap<String, Object>) data.get(0);
ApiExcelImportAppointmentDto appointmentDto = objectMapper.convertValue(appointmentData, ApiExcelImportAppointmentDto.class); ApiExcelImportAppointmentDto appointmentDto = objectMapper.convertValue(appointmentData, ApiExcelImportAppointmentDto.class);
// 获取第二个Sheet页的解析结果并转换为 DTO //设置预约主体信息
// LinkedHashMap<String, Object> healthData = (LinkedHashMap<String, Object>) data.get(1);
// ApiExcelImportHealthDto healthDto = objectMapper.convertValue(healthData, ApiExcelImportHealthDto.class);
//编辑更新预约主体信息
ApiAppointmentInfoDto apiAppointmentInfoDto = new ApiAppointmentInfoDto(); ApiAppointmentInfoDto apiAppointmentInfoDto = new ApiAppointmentInfoDto();
BeanUtils.copyProperties(appointment,apiAppointmentInfoDto);
apiAppointmentInfoDto = ApiExcelImportAppointmentDto.buildApiAppointmentInfoDto(appointmentDto,apiAppointmentInfoDto,dictTypeResponses); apiAppointmentInfoDto = ApiExcelImportAppointmentDto.buildApiAppointmentInfoDto(appointmentDto,apiAppointmentInfoDto,dictTypeResponses);
BeanUtils.copyProperties(apiAppointmentInfoDto,appointment); response.setApiAppointmentInfoDto(apiAppointmentInfoDto);
iAppointmentService.saveOrUpdate(appointment);
//编辑更新产品计划主信息 //设置产品计划主信息
//查询产品计划主信息 ApiProductPlanInfoDto apiProductPlanInfoDto = new ApiProductPlanInfoDto();
ProductPlan productPlan = iProductPlanService.queryOne(request.getAppointmentBizId(),"");
ApiProductPlanMainInfoDto apiProductPlanMainInfoDto = new ApiProductPlanMainInfoDto(); ApiProductPlanMainInfoDto apiProductPlanMainInfoDto = new ApiProductPlanMainInfoDto();
if (!Objects.isNull(productPlan)) { apiProductPlanMainInfoDto = ApiExcelImportAppointmentDto.buildApiProductPlanMainInfoDto(appointmentDto,apiProductPlanMainInfoDto,dictTypeResponses);
BeanUtils.copyProperties(productPlan,apiProductPlanMainInfoDto); apiProductPlanInfoDto.setApiProductPlanMainInfoDto(apiProductPlanMainInfoDto);
apiProductPlanMainInfoDto = ApiExcelImportAppointmentDto.buildApiProductPlanMainInfoDto(appointmentDto,apiProductPlanMainInfoDto,dictTypeResponses); //设置产品附加计划(附加险列表)
BeanUtils.copyProperties(apiProductPlanMainInfoDto,productPlan); List<ApiProductPlanAdditionalInfoDto> apiProductPlanAdditionalInfoDtoList = ApiExcelImportAppointmentDto.buildApiProductPlanAdditionalInfoDto(appointmentDto.getAdditionalDtoList(),dictTypeResponses);
iProductPlanService.saveOrUpdate(productPlan); apiProductPlanInfoDto.setApiProductPlanAdditionalInfoDtoList(apiProductPlanAdditionalInfoDtoList);
//新增附加计划(附加险列表) response.setApiProductPlanInfoDto(apiProductPlanInfoDto);
List<ApiProductPlanAdditionalInfoDto> apiBeneficiaryInfoDtoList = ApiExcelImportAppointmentDto.buildApiProductPlanAdditionalInfoDto(appointmentDto.getAdditionalDtoList(),dictTypeResponses,productPlan.getPlanBizId());
if (!CollectionUtils.isEmpty(apiBeneficiaryInfoDtoList)) { //设置投保人信息
List<Additional> saveList = apiBeneficiaryInfoDtoList.stream().map(dto -> {
Additional additional = new Additional();
BeanUtils.copyProperties(dto,additional);
return additional;
}).collect(Collectors.toList());
iAdditionalService.saveOrUpdateBatch(saveList);
}
}
//编辑更新投保人信息
//查询投保人信息
Policyholder policyholder = iPolicyholderService.queryOne(request.getAppointmentBizId(),"");
ApiPolicyholderInfoDto apiPolicyholderInfoDto = new ApiPolicyholderInfoDto(); ApiPolicyholderInfoDto apiPolicyholderInfoDto = new ApiPolicyholderInfoDto();
if (!Objects.isNull(policyholder)) { apiPolicyholderInfoDto = ApiExcelImportAppointmentDto.buildApiPolicyholderInfoDto(appointmentDto,apiPolicyholderInfoDto,dictTypeResponses);
BeanUtils.copyProperties(policyholder,apiPolicyholderInfoDto); response.setApiPolicyholderInfoDto(apiPolicyholderInfoDto);
apiPolicyholderInfoDto = ApiExcelImportAppointmentDto.buildApiPolicyholderInfoDto(appointmentDto,apiPolicyholderInfoDto,dictTypeResponses);
BeanUtils.copyProperties(apiPolicyholderInfoDto,policyholder);
iPolicyholderService.saveOrUpdate(policyholder);
}
//编辑更新受保人信息 //设置受保人信息
//查询受保人信息
Insurant insurant = iInsurantService.queryOne(request.getAppointmentBizId(),"");
ApiInsurantInfoDto apiInsurantInfoDto = new ApiInsurantInfoDto(); ApiInsurantInfoDto apiInsurantInfoDto = new ApiInsurantInfoDto();
if (!Objects.isNull(insurant)) { apiInsurantInfoDto = ApiExcelImportAppointmentDto.buildApiInsurantInfoDto(appointmentDto,apiInsurantInfoDto,dictTypeResponses);
BeanUtils.copyProperties(insurant,apiInsurantInfoDto); response.setApiInsurantInfoDto(apiInsurantInfoDto);
apiInsurantInfoDto = ApiExcelImportAppointmentDto.buildApiInsurantInfoDto(appointmentDto,apiInsurantInfoDto,dictTypeResponses);
BeanUtils.copyProperties(apiInsurantInfoDto,insurant);
iInsurantService.saveOrUpdate(insurant);
}
//编辑更新第二持有人信息 //编辑更新第二持有人信息
//查询第二持有人信息 //查询第二持有人信息
SecondHolder secondHolder = iSecondHolderService.queryOne(request.getAppointmentBizId(),"");
ApiSecondHolderInfoDto apiSecondHolderInfoDto = new ApiSecondHolderInfoDto(); ApiSecondHolderInfoDto apiSecondHolderInfoDto = new ApiSecondHolderInfoDto();
if (!Objects.isNull(secondHolder)) { apiSecondHolderInfoDto = ApiExcelImportAppointmentDto.buildApiSecondHolderInfoDto(appointmentDto,apiSecondHolderInfoDto,dictTypeResponses);
BeanUtils.copyProperties(secondHolder,apiSecondHolderInfoDto); response.setApiSecondHolderInfoDto(apiSecondHolderInfoDto);
apiSecondHolderInfoDto = ApiExcelImportAppointmentDto.buildApiSecondHolderInfoDto(appointmentDto,apiSecondHolderInfoDto,dictTypeResponses);
BeanUtils.copyProperties(apiSecondHolderInfoDto,secondHolder);
iSecondHolderService.saveOrUpdate(secondHolder);
}
//新增受益人列表 //新增受益人列表
List<ApiBeneficiaryInfoDto> apiBeneficiaryInfoDtoList = ApiExcelImportAppointmentDto.buildApiBeneficiaryInfoDtoList(appointmentDto.getBeneficiaryDtoList(),dictTypeResponses,request.getAppointmentBizId()); List<ApiBeneficiaryInfoDto> apiBeneficiaryInfoDtoList = ApiExcelImportAppointmentDto.buildApiBeneficiaryInfoDtoList(appointmentDto.getBeneficiaryDtoList(),dictTypeResponses);
if (!CollectionUtils.isEmpty(apiBeneficiaryInfoDtoList)) { ApiBeneficiaryInfoFzDto fzDto = new ApiBeneficiaryInfoFzDto();
List<Beneficiary> saveList = apiBeneficiaryInfoDtoList.stream().map(dto -> { fzDto.setApiBeneficiaryInfoDtoList(apiBeneficiaryInfoDtoList);
Beneficiary beneficiary = new Beneficiary(); response.setApiBeneficiaryInfoFzDto(fzDto);
BeanUtils.copyProperties(dto,beneficiary);
return beneficiary;
}).collect(Collectors.toList());
iBeneficiaryService.saveOrUpdateBatch(saveList);
}
return Result.success(); return Result.success(response);
} catch (Exception e) { } catch (Exception e) {
log.error("Excel数据转换异常", e); log.error("Excel数据转换异常", e);
......
...@@ -87,7 +87,7 @@ public interface ApiAppointmentFileFeignClient { ...@@ -87,7 +87,7 @@ public interface ApiAppointmentFileFeignClient {
Result<ApiAppointmentExportExcelResponse> appointmentExportExcel(@NotBlank(message = "预约信息主表唯一业务ID不能为空") @RequestParam(value = "appointmentBizId") String appointmentBizId); Result<ApiAppointmentExportExcelResponse> appointmentExportExcel(@NotBlank(message = "预约信息主表唯一业务ID不能为空") @RequestParam(value = "appointmentBizId") String appointmentBizId);
/** /**
* Excel导入-预约信息 * Excel导入-解析Excel预约信息
* @return * @return
*/ */
@PostMapping(value = "/excel/import/appointment") @PostMapping(value = "/excel/import/appointment")
......
package com.yd.csf.feign.response.appointmentfile; package com.yd.csf.feign.response.appointmentfile;
import com.yd.csf.feign.dto.appointment.*;
import lombok.Data; import lombok.Data;
@Data @Data
public class ApiAppointmentImportExcelResponse { public class ApiAppointmentImportExcelResponse {
/**
* 预约信息(包含签约信息)
*/
private ApiAppointmentInfoDto apiAppointmentInfoDto;
/**
* 产品计划信息
*/
private ApiProductPlanInfoDto apiProductPlanInfoDto;
/**
* 投保人信息
*/
private ApiPolicyholderInfoDto apiPolicyholderInfoDto;
/**
* 受保人信息
*/
private ApiInsurantInfoDto apiInsurantInfoDto;
/**
* 受益人封装对象
*/
private ApiBeneficiaryInfoFzDto apiBeneficiaryInfoFzDto;
/**
* 第二持有人信息
*/
private ApiSecondHolderInfoDto apiSecondHolderInfoDto;
} }
...@@ -83,8 +83,8 @@ public class ProductPlan implements Serializable { ...@@ -83,8 +83,8 @@ public class ProductPlan implements Serializable {
/** /**
* 产品上架信息表名称(标题) * 产品上架信息表名称(标题)
*/ */
@TableField("product_launch_name") @TableField("product_launch_main_name")
private String productLaunchName; private String productLaunchMainName;
/** /**
* 供款期数 * 供款期数
......
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