Commit 949389f6 by jianan

来佣比对优化-查询

parent bee321e6
...@@ -75,6 +75,8 @@ public class LifeCommissionServiceImpl implements LifeCommissionService { ...@@ -75,6 +75,8 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
String status = requestVO.getCheckStatus(); String status = requestVO.getCheckStatus();
String loginId = requestVO.getLoginId(); String loginId = requestVO.getLoginId();
String checkBatch = requestVO.getCheckBatch(); String checkBatch = requestVO.getCheckBatch();
List<String> commissionNos = requestVO.getCommissionNos();
if (StringUtils.isBlank(checkBatch)) { if (StringUtils.isBlank(checkBatch)) {
resp.setCommonResult(new CommonResult(false, "检核日期不能为空")); resp.setCommonResult(new CommonResult(false, "检核日期不能为空"));
return resp; return resp;
...@@ -102,6 +104,9 @@ public class LifeCommissionServiceImpl implements LifeCommissionService { ...@@ -102,6 +104,9 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
} }
this.updateOrderAndFortune(orderIds, fortuneList, status, fortuneCommissionPayoutStatus, loginId, checkBatch); this.updateOrderAndFortune(orderIds, fortuneList, status, fortuneCommissionPayoutStatus, loginId, checkBatch);
// 更新多年期佣金
this.updateOrderCommission(commissionNos, status, loginId, checkBatch);
// 订单已退保后发送邮件通知运营 // 订单已退保后发送邮件通知运营
if ("3".equals(status)) {//已比对 if ("3".equals(status)) {//已比对
this.orderCommissionCheckCancelSendMail(orders); this.orderCommissionCheckCancelSendMail(orders);
...@@ -116,6 +121,13 @@ public class LifeCommissionServiceImpl implements LifeCommissionService { ...@@ -116,6 +121,13 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
return resp; return resp;
} }
private void updateOrderCommission(List<String> commissionNos, String status, String loginId, String checkBatch) {
// 获取批次号(如2020-11的字符串)
Long checkBatchId = this.getOrderCommissionCheckBatch(checkBatch, loginId);
}
@Override @Override
public QuerycheckBatchListResponseVO querycheckBatchList() { public QuerycheckBatchListResponseVO querycheckBatchList() {
QuerycheckBatchListResponseVO resp = new QuerycheckBatchListResponseVO(); QuerycheckBatchListResponseVO resp = new QuerycheckBatchListResponseVO();
......
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
public class CheckComeCommissionRequestVO { public class CheckComeCommissionRequestVO {
private List<Long> orderIds; private List<Long> orderIds;
private String checkStatus; private String checkStatus;
private List<String> commissionNos;
private String loginId; private String loginId;
/** /**
* 来佣比对批次 * 来佣比对批次
...@@ -42,4 +43,12 @@ public class CheckComeCommissionRequestVO { ...@@ -42,4 +43,12 @@ public class CheckComeCommissionRequestVO {
public void setCheckBatch(String checkBatch) { public void setCheckBatch(String checkBatch) {
this.checkBatch = checkBatch; this.checkBatch = checkBatch;
} }
public List<String> getCommissionNos() {
return commissionNos;
}
public void setCommissionNos(List<String> commissionNos) {
this.commissionNos = commissionNos;
}
} }
...@@ -38,4 +38,11 @@ public class ComeCommissionVO { ...@@ -38,4 +38,11 @@ public class ComeCommissionVO {
private String planCategoryName; private String planCategoryName;
private String name; private String name;
private String practitionerTypeId; private String practitionerTypeId;
private String commissionNo;
private String amount;
private String commissionYear;
private String commissionStatus;
private String commissionTime;
private String commissionPeriod;
} }
...@@ -5,7 +5,8 @@ import lombok.Data; ...@@ -5,7 +5,8 @@ import lombok.Data;
@Data @Data
public class QueryComeCommissionListRequestVO { public class QueryComeCommissionListRequestVO {
private String compareDate; private String startDate;
private String endDate;
private String historyDate; private String historyDate;
private Long insurerId; private Long insurerId;
private Long practitionerTypeId; private Long practitionerTypeId;
......
...@@ -15,19 +15,44 @@ ...@@ -15,19 +15,44 @@
o.commission_amount commissionAmount, o.commission_amount commissionAmount,
o.commission_check_status commissionCheckStatus, o.commission_check_status commissionCheckStatus,
o.order_date orderDate, o.order_date orderDate,
o.commission_no commissionNo,
o.amount ,
o.commissionYear,
o.commission_status commissionStatus,
o.commission_time commissionTime,
o.commission_period commissionPeriod,
IFNULL(o.coverageTerm,e.coverageTerm) coverageTerm, IFNULL(o.coverageTerm,e.coverageTerm) coverageTerm,
IFNULL(o.payTerm,e.payTerm) payTerm, IFNULL(o.payTerm,e.payTerm) payTerm,
f.name, f.name,
f.practitioner_type_id practitionerTypeId, f.practitioner_type_id practitionerTypeId,
(case o.config_level when 2 then p2.pName2 else p3.pName3 END) categoryName, (case o.config_level when 2 then p2.pName2 else p3.pName3 END) categoryName,
(case o.config_level when 2 then p2.cName2 else p3.cName3 END) planCategoryName (case o.config_level when 2 then p2.cName2 else p3.cName3 END) planCategoryName
from (SELECT id, policy_no, order_price, commission_rate, commission_amount, commission_check_status, commission_check_id, product_id, from (SELECT o.*,
policyNo, commission_no, amount, commission_status, commission_time,
IFNULL(commission_year, o.order_date) commissionYear,
commission_period
from
(SELECT id, policy_no, order_price, commission_rate, commission_amount, commission_check_status, commission_check_id, product_id,
plan_id, insurer_id, order_date, commission_check_at, config_level, plan_id, insurer_id, order_date, commission_check_at, config_level,
CONCAT(payment_term, (case payment_term_unit when 'Y' then '年' when 'M' then '月' else '日' END)) payTerm, CONCAT(payment_term, (case payment_term_unit when 'Y' then '年' when 'M' then '月' else '日' END)) payTerm,
CONCAT(cover_term, cover_term_type) coverageTerm CONCAT(cover_term, cover_term_type) coverageTerm
from ag_po_order t from ag_po_order t
where t.status in (3,4) and policy_no is not null where t.status in (3,4) and policy_no is not null
and (t.plan_id not in (424,453,464) or t.plan_id is null) and (t.plan_id not in (424,453,464) or t.plan_id is null)
) o
LEFT JOIN
(SELECT policy_no policyNo, commission_no, commission_year, amount, commission_status, commission_time,
commission_period
from ag_po_order_commission t
) orderCommission
ON o.policy_no = orderCommission.policyNo
WHERE 1=1
<if test="startDate != null ">
and date_format(commission_year, '%Y-%m') &gt;= #{startDate}
</if>
<if test="endDate != null ">
and date_format(commission_year, '%Y-%m') &lt;= #{endDate}
</if>
) o ) o
left join ag_po_order_commission_check c on o.commission_check_id = c.id left join ag_po_order_commission_check c on o.commission_check_id = c.id
left join ag_product_plan a on o.plan_id = a.id left join ag_product_plan a on o.plan_id = a.id
...@@ -77,9 +102,6 @@ ...@@ -77,9 +102,6 @@
<when test="historyDate != null "> <when test="historyDate != null ">
and c.check_yearmonth = #{historyDate} and c.check_yearmonth = #{historyDate}
</when> </when>
<when test="compareDate != null ">
and date_format(o.order_date, '%Y-%m') &lt; #{compareDate}
</when>
</choose> </choose>
</select> </select>
...@@ -128,12 +150,33 @@ ...@@ -128,12 +150,33 @@
IFNULL(sum(CASE WHEN o.commission_check_status = '3' THEN 1 ELSE 0 END),0) totalYiTuiBao, IFNULL(sum(CASE WHEN o.commission_check_status = '3' THEN 1 ELSE 0 END),0) totalYiTuiBao,
IFNULL(sum(o.order_price),0) totalOrderPrice, IFNULL(sum(o.order_price),0) totalOrderPrice,
IFNULL(sum(o.commission_amount),0) totalCommission IFNULL(sum(o.commission_amount),0) totalCommission
from (SELECT order_price, commission_amount, commission_check_status, commission_check_id, order_date, from (SELECT o.*,
insurer_id,id policyNo, commission_no, amount, commission_status, commission_time,
from ag_po_order t IFNULL(commission_year, o.order_date) commissionYear,
where t.status in (3,4) and policy_no is not null commission_period
and (t.plan_id not in (424,453,464) or t.plan_id is null) from
(SELECT id, policy_no, order_price, commission_rate, commission_amount, commission_check_status, commission_check_id, product_id,
plan_id, insurer_id, order_date, commission_check_at, config_level,
CONCAT(payment_term, (case payment_term_unit when 'Y' then '年' when 'M' then '月' else '日' END)) payTerm,
CONCAT(cover_term, cover_term_type) coverageTerm
from ag_po_order t
where t.status in (3,4) and policy_no is not null
and (t.plan_id not in (424,453,464) or t.plan_id is null)
) o ) o
LEFT JOIN
(SELECT policy_no policyNo, commission_no, commission_year, amount, commission_status, commission_time,
commission_period
from ag_po_order_commission t
) orderCommission
ON o.policy_no = orderCommission.policyNo
WHERE 1=1
<if test="startDate != null ">
and date_format(commission_year, '%Y-%m') &gt;= #{startDate}
</if>
<if test="endDate != null ">
and date_format(commission_year, '%Y-%m') &lt;= #{endDate}
</if>
) o
left join ag_po_order_commission_check c on o.commission_check_id = c.id left join ag_po_order_commission_check c on o.commission_check_id = c.id
left join (SELECT order_id, name, practitioner_type_id, f.customer_id left join (SELECT order_id, name, practitioner_type_id, f.customer_id
from ( from (
...@@ -158,9 +201,6 @@ ...@@ -158,9 +201,6 @@
<when test="historyDate != null "> <when test="historyDate != null ">
and c.check_yearmonth = #{historyDate} and c.check_yearmonth = #{historyDate}
</when> </when>
<when test="compareDate != null ">
and date_format(o.order_date, '%Y-%m') &lt; #{compareDate}
</when>
</choose> </choose>
</select> </select>
......
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