Commit 0c290d46 by jianan

新单跟进40

parent 64b7a2bc
......@@ -489,14 +489,28 @@ public class ApiPolicyFollowController {
@PostMapping("/list/page/vo")
@Operation(summary = "分页获取新单跟进列表")
public Result<Page<PolicyFollow>> listPolicyFollowByPage(@RequestBody PolicyFollowQueryRequest policyFollowQueryRequest,
HttpServletRequest request) {
HttpServletRequest request) {
long current = policyFollowQueryRequest.getPageNo();
long size = policyFollowQueryRequest.getPageSize();
// 查询数据库
Page<PolicyFollow> policyFollowPage = policyFollowService.page(new Page<>(current, size),
policyFollowService.getQueryWrapper(policyFollowQueryRequest));
// 获取封装类
// 处理 nextStatusList 字段
policyFollowPage.getRecords().forEach(policyFollow -> {
Object nextStatusList = policyFollow.getNextStatusList();
if (nextStatusList != null && !nextStatusList.toString().isEmpty()) {
String[] statusArr = nextStatusList.toString().split(",");
List<Map<String, String>> statusMapList = new ArrayList<>();
for (String status : statusArr) {
Map<String, String> map = new HashMap<>();
map.put("itemLabel", PolicyFollowStatusEnum.getEnumByValue(status).getItemLabel());
map.put("itemValue", status);
statusMapList.add(map);
}
policyFollow.setNextStatusList(statusMapList);
}
});
return Result.success(policyFollowPage);
}
......
......@@ -101,6 +101,8 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
private PolicyAdditionalService policyAdditionalService;
@Resource
private IProductPlanService iProductPlanService;
@Resource
private CustomerService customerService;
/**
* 预约分页查询
......@@ -448,6 +450,12 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
&& !Objects.isNull(response.getApiInsurantInfoDto())) {
apiInsurantInfoDto = response.getApiInsurantInfoDto();
}
// 查询客户信息表数据
Customer customer = customerService.getByCustomerBizId(appointment.getCustomerBizId());
// 查询产品计划信息表数据
ProductPlan productPlan = iProductPlanService.queryOne(appointment.getAppointmentBizId(), apiProductPlanMainInfoDto.getPlanBizId());
// 新增新单跟进记录
PolicyFollow follow = new PolicyFollow();
String policyBizId = RandomStringGenerator.generateBizId16(CommonEnum.UID_TYPE_POLICY.getCode());
//新单跟进唯一业务ID
......@@ -456,6 +464,10 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
follow.setAppointmentNo(appointment.getAppointmentNo());
//客户信息表唯一业务ID
follow.setCustomerBizId(appointment.getCustomerBizId());
if (customer != null) {
//客户名称
follow.setCustomerName(customer.getFirstNamePinyin());
}
//待跟进
follow.setStatus(PolicyFollowStatusEnum.FOLLOW_UP.getItemValue());
follow.setNextStatusList(policyFollowService.getNextStatus(PolicyFollowStatusEnum.CHECKING));
......@@ -463,8 +475,10 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
// follow.setInsurerBizId();
//TODO 期交保费
// follow.setPaymentPremium();
//TODO 保單持有人
// follow.setPolicyHolder();
// 保單持有人
if (apiPolicyholderInfoDto != null) {
follow.setPolicyHolder(apiPolicyholderInfoDto.getName());
}
//TODO 预缴年期
// follow.setPrepaidTerm();
//TODO 产品类别
......@@ -498,6 +512,9 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
//供款年期
if (StringUtils.isNotBlank(apiProductPlanMainInfoDto.getPaymentTerm())) {
follow.setPaymentTerm(Integer.getInteger(apiProductPlanMainInfoDto.getPaymentTerm()));
if (follow.getPaymentTerm() == null) {
follow.setPaymentTerm(productPlan.getPaymentTerm());
}
}
//产品名称
follow.setProductName(apiProductPlanMainInfoDto.getProductName());
......@@ -506,7 +523,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
policyFollowService.saveOrUpdate(follow);
// 同步保存保单(产品计划)
savePolicy(apiPolicyholderInfoDto, apiInsurantInfoDto, apiProductPlanMainInfoDto, policyBizId, policyTransfer);
savePolicy(productPlan, apiPolicyholderInfoDto, apiInsurantInfoDto, apiProductPlanMainInfoDto, policyBizId, policyTransfer);
// 同步保存保单产品计划附加险
savePolicyAdditional(apiProductPlanAdditionalInfoDtoList, policyBizId);
// 同步保存保单投保人
......@@ -608,6 +625,7 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
policyInsurant.setId(null);
policyInsurant.setPolicyBizId(policyBizId);
policyInsurant.setPolicyInsurantBizId(RandomStringGenerator.generateBizId16("policy_insurant"));
policyInsurant.setName(apiInsurantInfoDto.getName());
return policyInsurantService.saveOrUpdate(policyInsurant);
}
......@@ -624,11 +642,13 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
policyPolicyholder.setId(null);
policyPolicyholder.setPolicyBizId(policyBizId);
policyPolicyholder.setPolicyPolicyholderBizId(RandomStringGenerator.generateBizId16("policy_policyholder"));
policyPolicyholder.setName(apiPolicyholderInfoDto.getName());
return policyPolicyholderService.saveOrUpdate(policyPolicyholder);
}
private boolean savePolicy(ApiPolicyholderInfoDto apiPolicyholderInfoDto,
private boolean savePolicy(ProductPlan productPlan,
ApiPolicyholderInfoDto apiPolicyholderInfoDto,
ApiInsurantInfoDto apiInsurantInfoDto,
ApiProductPlanMainInfoDto apiProductPlanMainInfoDto,
String policyBizId,
......@@ -636,7 +656,6 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
) {
String appointmentBizId = apiProductPlanMainInfoDto.getAppointmentBizId();
String planBizId = apiProductPlanMainInfoDto.getPlanBizId();
ProductPlan productPlan = iProductPlanService.queryOne(appointmentBizId, planBizId);
if (productPlan == null) {
return false;
}
......
......@@ -3,6 +3,7 @@ package com.yd.csf.service.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yd.csf.service.model.Fna;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;
/**
* @author Zhang Jianan
......@@ -13,6 +14,8 @@ import org.apache.ibatis.annotations.Param;
public interface FnaMapper extends BaseMapper<Fna> {
boolean updateFnaNoById(@Param("fnaNo") String fnaNo, @Param("id") Long id);
int updateCustomerNameByCustomerBizId(@Param("firstNamePinyin") String firstNamePinyin, @Param("customerBizId") String customerBizId);
}
......
......@@ -90,7 +90,7 @@ public class PolicyFollow implements Serializable {
/**
* 供款年期
*/
private Integer paymentTerm;
private Object paymentTerm;
/**
* 期交保费
......@@ -170,7 +170,7 @@ public class PolicyFollow implements Serializable {
/**
* 下一步跟进状态列表
*/
private String nextStatusList;
private Object nextStatusList;
/**
* 保單持有人
......
......@@ -53,4 +53,6 @@ public interface FnaService extends IService<Fna> {
Boolean updateFna(FnaUpdateRequest fnaUpdateRequest, String appointmentNo);
Map<String, Object> copyFna(FnaCopyRequest fnaCopyRequest);
int updateCustomerNameByCustomerBizId(String firstNamePinyin, String customerBizId);
}
......@@ -20,8 +20,10 @@ import com.yd.csf.service.dto.CustomerUpdateRequest;
import com.yd.csf.service.dto.FnaQueryRequest;
import com.yd.csf.service.model.Customer;
import com.yd.csf.service.model.CustomerExpand;
import com.yd.csf.service.model.Fna;
import com.yd.csf.service.service.CustomerExpandService;
import com.yd.csf.service.service.CustomerService;
import com.yd.csf.service.service.FnaService;
import com.yd.csf.service.utils.ValidateUtil;
import com.yd.csf.service.vo.AddressVO;
import com.yd.csf.service.vo.CustomerExpandVO;
......@@ -54,6 +56,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
@Resource
private CustomerService customerService;
@Resource
private FnaService fnaService;
@Override
......@@ -241,6 +246,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
customerService.validCustomer(oldCustomer);
// 更新主表
boolean result = customerService.updateById(oldCustomer);
if (StringUtils.isNotBlank(customerUpdateRequest.getFirstNamePinyin())) {
fnaService.updateCustomerNameByCustomerBizId(customerUpdateRequest.getFirstNamePinyin(), customerBizId);
}
// 获取扩展表信息
CustomerExpand customerExpand = customerExpandService.getByCustomerBizId(customerBizId);
......
......@@ -356,6 +356,11 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
return Collections.singletonMap("fnaBizId", newFna.getFnaBizId());
}
@Override
public int updateCustomerNameByCustomerBizId(String firstNamePinyin, String customerBizId) {
return baseMapper.updateCustomerNameByCustomerBizId(firstNamePinyin, customerBizId);
}
private String copyFnaForm(String oldFnaFormBizId, String userBizId) {
FnaForm fnaForm = fnaFormService.getByFnaFormBizId(oldFnaFormBizId);
if (fnaForm == null) {
......
......@@ -92,7 +92,7 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
queryWrapper.eq(ObjectUtils.isNotEmpty(policyNo), "policy_no", policyNo);
queryWrapper.eq(ObjectUtils.isNotEmpty(customerName), "customer_name", customerName);
queryWrapper.eq(ObjectUtils.isNotEmpty(customerBizId), "customer_biz_id", customerBizId);
queryWrapper.eq(ObjectUtils.isNotEmpty(status), "status", status);
queryWrapper.eq(ObjectUtils.isNotEmpty(status.trim()), "status", status);
queryWrapper.eq(ObjectUtils.isNotEmpty(insurer), "insurance", insurer);
queryWrapper.eq(ObjectUtils.isNotEmpty(productName), "product_code", productName);
queryWrapper.ge(ObjectUtils.isNotEmpty(signDateStart), "sign_date", signDateStart);
......
......@@ -32,7 +32,7 @@ public class PolicyFollowVO implements Serializable {
* 下一步跟进状态列表
*/
@Schema(description = "下一步跟进状态列表, 下拉框")
private List<String> nextStatusList;
private Object nextStatusList;
/**
* 新单跟进Dto
......@@ -83,7 +83,7 @@ public class PolicyFollowVO implements Serializable {
policyFollowVO.setPolicyFollowUpdateDto(policyFollowUpdateDto);
if (policyFollow.getNextStatusList() != null) {
policyFollowVO.setNextStatusList(Arrays.asList(policyFollow.getNextStatusList().split(",")));
policyFollowVO.setNextStatusList(policyFollow.getNextStatusList());
}
VerifyPolicyInfo verifyPolicyInfo = new VerifyPolicyInfo();
......
......@@ -41,4 +41,8 @@
<update id="updateFnaNoById">
update fna set fna_no = #{fnaNo} where id = #{id}
</update>
<update id="updateCustomerNameByCustomerBizId">
update fna set customer_name = #{firstNamePinyin} where customer_biz_id = #{customerBizId}
</update>
</mapper>
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