Commit 1c9afdf1 by zhangxingmin

Merge remote-tracking branch 'origin/dev_zxm' into test

parents efcbdefb 3e5915ad
......@@ -79,6 +79,11 @@
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>com.yd</groupId>
<artifactId>yd-question-feign</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
......
......@@ -6,6 +6,7 @@ import com.yd.csf.api.service.ApiBeneficiaryService;
import com.yd.csf.feign.client.beneficiary.ApiBeneficiaryFeignClient;
import com.yd.csf.feign.dto.appointment.ApiBeneficiaryInfoDto;
import com.yd.csf.feign.dto.appointment.ApiInsurantInfoDto;
import com.yd.csf.feign.request.beneficiary.ApiBatchEditBeneficiaryRequest;
import com.yd.csf.feign.request.beneficiary.ApiBeneficiaryPageRequest;
import com.yd.csf.feign.response.beneficiary.ApiBeneficiaryPageResponse;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -79,6 +80,16 @@ public class ApiBeneficiaryController implements ApiBeneficiaryFeignClient {
}
/**
* 批量编辑受益人信息
* @param request
* @return
*/
@Override
public Result batchEdit(ApiBatchEditBeneficiaryRequest request) {
return apiBeneficiaryService.batchEdit(request);
}
/**
* 删除单个受益人信息
* @param beneficiaryBizId
* @return
......
......@@ -25,6 +25,8 @@ public interface ApiAppointmentCheckService {
Result checkEditApiInsurantInfoDto(ApiInsurantInfoDto dto);
Result checkEditApiBeneficiaryInfoDtoList(List<ApiBeneficiaryInfoDto> list);
Result checkAddApiBeneficiaryInfoDtoList(List<ApiBeneficiaryInfoDto> list);
Result checkEditApiSecondHolderInfoDto(ApiSecondHolderInfoDto dto);
......
......@@ -2,6 +2,7 @@ package com.yd.csf.api.service;
import com.yd.common.result.Result;
import com.yd.csf.feign.dto.appointment.ApiBeneficiaryInfoDto;
import com.yd.csf.feign.request.beneficiary.ApiBatchEditBeneficiaryRequest;
import java.util.List;
......@@ -15,6 +16,8 @@ public interface ApiBeneficiaryService {
Result edit(ApiBeneficiaryInfoDto apiBeneficiaryInfoDto);
Result batchEdit(ApiBatchEditBeneficiaryRequest request);
Result del(String beneficiaryBizId);
Result batchAddBeneficiaryData(List<ApiBeneficiaryInfoDto> apiBeneficiaryInfoDtoList,
......
......@@ -544,7 +544,8 @@ public class ApiAppointmentCheckServiceImpl implements ApiAppointmentCheckServic
* @param list
* @return
*/
public Result checkAddApiBeneficiaryInfoDtoList(List<ApiBeneficiaryInfoDto> list){
@Override
public Result checkEditApiBeneficiaryInfoDtoList(List<ApiBeneficiaryInfoDto> list){
if (CollectionUtils.isEmpty(list)) {
//如果对象集合空就放行不校验
return Result.success();
......@@ -559,6 +560,91 @@ public class ApiAppointmentCheckServiceImpl implements ApiAppointmentCheckServic
if (StringUtils.isBlank(dto.getInsurantRel())) {
throw new BusinessException(tipStr+"与受保人关系不能为空");
}
if (Objects.isNull(dto.getId())) {
throw new BusinessException(tipStr+"第"+i+"项的受益人信息主键id不能为空");
}
// if (StringUtils.isBlank(dto.getAppointmentBizId())) {
// throw new BusinessException(tipStr+"第"+i+"项的预约信息主表唯一业务ID不能为空");
// }
if (StringUtils.isBlank(dto.getBeneficiaryBizId())) {
throw new BusinessException(tipStr+"第"+i+"项的受益人信息表唯一业务ID不能为空");
}
if (RelTypeEnum.MYSELF.getItemValue().equals(dto.getInsurantRel())) {
//如果对象与受保人关系为本人,就不校验下面的参数,继续循环下一个
continue;
}
if (CustomerTypeEnum.INDIVIDUAL.getItemValue().equals(dto.getCustomerType())) {
//客户类型为个人的字段校验
//校验客户类型为个人类型的公共参数字段
if (StringUtils.isBlank(dto.getName())) {
throw new BusinessException(tipStr+"第"+i+"项的名字不能为空");
}
if (StringUtils.isBlank(dto.getNameEn())) {
throw new BusinessException(tipStr+"第"+i+"项的名字-英文不能为空");
}
if (StringUtils.isBlank(dto.getGender())) {
throw new BusinessException(tipStr+"第"+i+"项的性别不能为空");
}
// CustomerTypeIndividualCheckCommonDto individualCheckCommonDto = new CustomerTypeIndividualCheckCommonDto();
// BeanUtils.copyProperties(dto,individualCheckCommonDto);
// checkCustomerTypeIndividualCheckCommonDto(individualCheckCommonDto,tipStr);
}else if (CustomerTypeEnum.COMPANY.getItemValue().equals(dto.getCustomerType())){
//客户类型为公司的字段校验
if (StringUtils.isBlank(dto.getCompanyName())) {
throw new BusinessException(tipStr+"第"+i+"项的公司名称不能为空");
}
if (StringUtils.isBlank(dto.getCompanyNameEn())) {
throw new BusinessException(tipStr+"第"+i+"项的公司名称(英文)不能为空");
}
if (StringUtils.isBlank(dto.getCompanyBusinessNo())) {
throw new BusinessException(tipStr+"第"+i+"项的公司商业登记号码不能为空");
}
if (Objects.isNull(dto.getCompanyRegisterTime())) {
throw new BusinessException(tipStr+"第"+i+"项的公司注册日期不能为空");
}
if (Objects.isNull(dto.getCompanyMobile())) {
throw new BusinessException(tipStr+"第"+i+"项的公司电话不能为空");
}
if (Objects.isNull(dto.getCompanyMobileCode())) {
throw new BusinessException(tipStr+"第"+i+"项的公司电话区号不能为空");
}
if (Objects.isNull(dto.getCompanyRegisterRegion())) {
throw new BusinessException(tipStr+"第"+i+"项的公司注册地区不能为空");
}
// CustomerTypeCompanyCheckCommonDto companyCheckCommonDto = new CustomerTypeCompanyCheckCommonDto();
// BeanUtils.copyProperties(dto,companyCheckCommonDto);
// //校验客户类型为公司类型的公共参数字段
// checkCustomerTypeCompanyCheckCommonDto(companyCheckCommonDto,tipStr);
}
i++;
}
return Result.success();
}
/**
* 编辑预约入参字段校验 - 受益人列表信息字段校验
* @param list
* @return
*/
public Result checkAddApiBeneficiaryInfoDtoList(List<ApiBeneficiaryInfoDto> list){
if (CollectionUtils.isEmpty(list)) {
//如果对象集合空就放行不校验
return Result.success();
}
String tipStr = "受益人-";
//列表下标标记位
int i = 1;
for (ApiBeneficiaryInfoDto dto : list) {
if (StringUtils.isBlank(dto.getCustomerType())) {
throw new BusinessException(tipStr+"第"+i+"项的客户类型不能为空");
}
if (StringUtils.isBlank(dto.getInsurantRel())) {
throw new BusinessException(tipStr+"第"+i+"项的与受保人关系不能为空");
}
if (!Objects.isNull(dto.getId())) {
throw new BusinessException(tipStr+"第"+i+"项的受益人信息主键id不传值");
}
......
......@@ -23,6 +23,8 @@ import com.yd.csf.service.model.Fna;
import com.yd.csf.service.model.ProductPlan;
import com.yd.csf.service.service.FnaService;
import com.yd.csf.service.service.IAppointmentService;
import com.yd.question.feign.client.ApiQuestionnairesFeignClient;
import com.yd.question.feign.request.ApiObjectSaveRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -70,6 +72,9 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
@Autowired
private FnaService fnaService;
@Autowired
private ApiQuestionnairesFeignClient apiQuestionnairesFeignClient;
/**
* 预约分页查询
* @param request
......@@ -165,6 +170,9 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
//添加第二持有人信息表数据
apiSecondHolderService.addSecondHolderData(request.getApiSecondHolderInfoDto(),appointment.getAppointmentBizId());
//新增健康问卷和预约对象关系绑定
objectSaveJkQuestion(appointment.getAppointmentBizId());
//预约编号和预约业务id更新到FNA表(提交待预约状态,预约信息的预约业务id和预约编号更新到Fna表的预约业务id和预约编号)
updateFnaBizIdAndNo(appointment.getFnaBizId(),appointment.getAppointmentBizId(),appointment.getAppointmentNo());
ApiAppointmentAddResponse response = new ApiAppointmentAddResponse();
......@@ -222,6 +230,9 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
//添加第二持有人信息表数据
apiSecondHolderService.addSecondHolderData(request.getApiSecondHolderInfoDto(),appointment.getAppointmentBizId());
//新增健康问卷和预约对象关系绑定
objectSaveJkQuestion(appointment.getAppointmentBizId());
return Result.success();
}
......@@ -446,13 +457,19 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
return Result.success();
}
// /**
// * 保存健康问卷和预约对象关系绑定
// * @return
// */
// public Result objectSaveQuestion() {
//
// }
/**
* 新增健康问卷和预约对象关系绑定
* @return
*/
public Result objectSaveJkQuestion(String appointmentBizId) {
ApiObjectSaveRequest apiObjectSaveRequest = new ApiObjectSaveRequest();
apiObjectSaveRequest.setObjectBizId(appointmentBizId);
apiObjectSaveRequest.setObjectName("预约");
apiObjectSaveRequest.setObjectTableName("appointment");
apiObjectSaveRequest.setQuestionnaireBizId("questionnaires_1001");
apiQuestionnairesFeignClient.objectSave(apiObjectSaveRequest);
return Result.success();
}
/**
* 校验预约信息是否存在
......
......@@ -8,6 +8,7 @@ import com.yd.common.utils.RandomStringGenerator;
import com.yd.csf.api.service.ApiAppointmentCheckService;
import com.yd.csf.api.service.ApiBeneficiaryService;
import com.yd.csf.feign.dto.appointment.ApiBeneficiaryInfoDto;
import com.yd.csf.feign.request.beneficiary.ApiBatchEditBeneficiaryRequest;
import com.yd.csf.feign.utils.CommonUtil;
import com.yd.csf.service.dto.BeneficiaryDto;
import com.yd.csf.service.model.Beneficiary;
......@@ -109,6 +110,19 @@ public class ApiBeneficiaryServiceImpl implements ApiBeneficiaryService {
}
/**
* 批量编辑受益人信息
* @param request
* @return
*/
@Override
public Result batchEdit(ApiBatchEditBeneficiaryRequest request) {
apiAppointmentCheckService.checkEditApiBeneficiaryInfoDtoList(request.getBeneficiaryInfoDtoList());
//批量编辑受益人信息表数据
batchEditBeneficiaryData(request.getBeneficiaryInfoDtoList(),request.getAppointmentBizId());
return Result.success();
}
/**
* 删除单个受益人信息
* @param beneficiaryBizId
* @return
......
......@@ -4,6 +4,7 @@ import com.yd.common.result.Result;
import com.yd.csf.feign.dto.appointment.ApiBeneficiaryInfoDto;
import com.yd.csf.feign.dto.appointment.ApiInsurantInfoDto;
import com.yd.csf.feign.fallback.beneficiary.ApiBeneficiaryFeignFallbackFactory;
import com.yd.csf.feign.request.beneficiary.ApiBatchEditBeneficiaryRequest;
import com.yd.csf.feign.request.beneficiary.ApiBeneficiaryPageRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
......@@ -58,6 +59,14 @@ public interface ApiBeneficiaryFeignClient {
Result edit(@Validated @RequestBody ApiBeneficiaryInfoDto apiBeneficiaryInfoDto);
/**
* 批量编辑受益人信息
* @param request
* @return
*/
@PutMapping("/batch/edit")
Result batchEdit(@Validated @RequestBody ApiBatchEditBeneficiaryRequest request);
/**
* 删除单个受益人信息
* @param beneficiaryBizId
* @return
......
package com.yd.csf.feign.request.beneficiary;
import com.yd.csf.feign.dto.appointment.ApiBeneficiaryInfoDto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.List;
@Data
public class ApiBatchEditBeneficiaryRequest {
/**
* 预约信息主表唯一业务ID
*/
@NotBlank(message = "预约信息主表唯一业务ID不能为空")
private String appointmentBizId;
/**
* 受益人列表
*/
private List<ApiBeneficiaryInfoDto> beneficiaryInfoDtoList;
}
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