Commit b7891caa by zhangxingmin

push

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