提交 1ef7d80f authored 作者: hzh's avatar hzh

代码优化

上级 b1156ff4
......@@ -149,5 +149,24 @@ public class InsureBo extends BaseEntity {
*/
private String status;
/**
* 被保人数
*/
private Integer insuredCount;
/**
* 投保人
*/
private String insuredName;
/**
* 保险公司
*/
private String insurerAbbr;
/**
* 计划名称
*/
private String planName;
}
......@@ -152,5 +152,25 @@ public class InsureVo implements Serializable {
*/
private String status;
/**
* 被保人数
*/
private Integer insuredCount;
/**
* 投保人
*/
private String insuredName;
/**
* 保险公司
*/
private String insurerAbbr;
/**
* 计划名称
*/
private String planName;
}
......@@ -158,6 +158,26 @@ public class Insure extends TenantEntity {
*/
private String status;
/**
* 被保人数
*/
private Integer insuredCount;
/**
* 投保人
*/
private String insuredName;
/**
* 保险公司
*/
private String insurerAbbr;
/**
* 计划名称
*/
private String planName;
/**
* 删除标志(0代表存在 2代表删除)
*/
......
......@@ -15,6 +15,7 @@ import org.dromara.common.weishi.constant.OrderStatus;
import org.dromara.common.weishi.model.req.ApplyRequest;
import org.dromara.common.weishi.model.res.ApplyResponse;
import org.dromara.common.weishi.model.res.AuthResponse;
import org.dromara.common.weishi.model.res.ProductResponse;
import org.dromara.common.weishi.model.res.ProductsResponse;
import org.dromara.common.weishi.service.WeishiService;
import org.dromara.mall.controller.weishi.admin.bo.InsureBo;
......@@ -26,10 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.Duration;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import static org.dromara.mall.enums.weishi.WeishiConstants.WEISHI_TOKEN;
......@@ -77,6 +75,8 @@ public class InsureServiceImpl extends AbstractBaseService<InsureVo, InsureBo, I
lqw.eq(StringUtils.isNotBlank(bo.getPaymentNum()), Insure::getPaymentNum, bo.getPaymentNum());
lqw.eq(bo.getPaymentAmt() != null, Insure::getPaymentAmt, bo.getPaymentAmt());
lqw.eq(StringUtils.isNotBlank(bo.getDataTp()), Insure::getDataTp, bo.getDataTp());
lqw.like(StringUtils.isNotBlank(bo.getInsurerAbbr()), Insure::getInsurerAbbr, bo.getInsurerAbbr());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), Insure::getStatus, bo.getStatus());
lqw.eq(bo.getOrderTime() != null, Insure::getOrderTime, bo.getOrderTime());
return lqw;
}
......@@ -103,16 +103,22 @@ public class InsureServiceImpl extends AbstractBaseService<InsureVo, InsureBo, I
//设置参数
Insure insure = new Insure();
BeanUtil.copyProperties(req, insure, true);
ProductResponse productRes = weishiService.productDetail(token, req.getProductId());
ProductsResponse productsRes = StreamUtils.findFirst(productList, p -> Objects.equals(p.getProductID(), req.getProductId()));
insure.setUserId(LoginHelper.getUserId())
.setMemberId(LoginHelper.getMemberId())
.setReqJson(JSONUtil.toJsonStr(req))
.setResJson(JSONUtil.toJsonStr(res))
.setProductJson(JSONUtil.toJsonStr(weishiService.productDetail(token, req.getProductId())))
.setProductListJson(JSONUtil.toJsonStr(StreamUtils.findFirst(productList, p -> Objects.equals(p.getProductID(), req.getProductId()))))
.setProductJson(JSONUtil.toJsonStr(productRes))
.setProductListJson(JSONUtil.toJsonStr(productsRes))
.setOrderNum(res.getOrderNum())
.setOrderUrl(res.getOrderUrl())
.setOrderId(res.getOrderID())
.setStatus(OrderStatus.P.getKey())
.setInsuredCount(req.getUnits().get(0).getInsureds().size())
.setInsuredName(req.getUnits().get(0).getPolicyHolder().getName())
.setInsurerAbbr(productRes.getInsureAbbr())
.setPlanName(productRes.getInsureAbbr() + " - " + Optional.ofNullable(StreamUtils.findFirst(productRes.getPlans(), p -> StringUtils.equals(req.getProductNum(), p.getPlanNum()))).map(ProductResponse.Plan::getPlanName).orElse(null))
.setOrderTime(new Date());
insure.setCreateDept(LoginHelper.getDeptId());
baseMapper.insert(insure);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论