Commit c8ed327c by hongzhong

Merge remote-tracking branch 'origin/dev_20210330' into dev_20210330

parents 65a4e6a8 50e1c6ce
...@@ -217,7 +217,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -217,7 +217,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
//判断这些财富记录中佣金发放状态和要修改的状态是否一致,如一致,则不需要修改 //判断这些财富记录中佣金发放状态和要修改的状态是否一致,如一致,则不需要修改
for(AclCustomerFortune fortune : fortunes) { for(AclCustomerFortune fortune : fortunes) {
//不一致,进行修改,并保存需修改的fortune和记录需要新生成的fortune //不一致,进行修改,并保存需修改的fortune和记录需要新生成的fortune
if (!paymentStatus.equals(fortune.getCommissionPayoutStatus())) { if (!paymentStatus.equals(fortune.getStatus())) {
fortune.setCommissionPayoutStatus(paymentStatus); fortune.setCommissionPayoutStatus(paymentStatus);
fortune.setStatus("2"); fortune.setStatus("2");
fortune.setCommissionPayoutBy(loginId); fortune.setCommissionPayoutBy(loginId);
...@@ -308,7 +308,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -308,7 +308,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
List<Long> withdrawUpdateIds = new ArrayList<>(); List<Long> withdrawUpdateIds = new ArrayList<>();
for(AclCustomerFortune fortune : customerFortunes){ for(AclCustomerFortune fortune : customerFortunes){
//不一致,进行修改,并保存需修改的fortune和需重新计算的withdrawIds //不一致,进行修改,并保存需修改的fortune和需重新计算的withdrawIds
if (!paymentStatus.equals(fortune.getCommissionPayoutStatus())){ if (!paymentStatus.equals(fortune.getStatus())){
fortune.setCommissionPayoutStatus(paymentStatus); fortune.setCommissionPayoutStatus(paymentStatus);
fortune.setStatus(paymentStatus); fortune.setStatus(paymentStatus);
fortune.setCommissionPayoutBy(loginId); fortune.setCommissionPayoutBy(loginId);
......
...@@ -43,9 +43,13 @@ public class CommissionPayoutStatusQueryRequestVO { ...@@ -43,9 +43,13 @@ public class CommissionPayoutStatusQueryRequestVO {
private String commissionPayoutYearmonth; private String commissionPayoutYearmonth;
/** /**
* 预计发佣年月 * 实际发佣年月
*/ */
private String payoutYearmonth; private String payoutYearmonth;
/**
* 预计发佣年月
*/
private String predictMonthPeriod;
/** /**
* 系统标志,区分公司营业部和体系,1,分公司,2营业部,3,S1分部,4,S2体系,5,S3纵队 * 系统标志,区分公司营业部和体系,1,分公司,2营业部,3,S1分部,4,S2体系,5,S3纵队
...@@ -175,5 +179,13 @@ public class CommissionPayoutStatusQueryRequestVO { ...@@ -175,5 +179,13 @@ public class CommissionPayoutStatusQueryRequestVO {
public void setPage(PageInfo<CommissionPayoutStatus> page) { public void setPage(PageInfo<CommissionPayoutStatus> page) {
this.page = page; this.page = page;
} }
public String getPredictMonthPeriod() {
return predictMonthPeriod;
}
public void setPredictMonthPeriod(String predictMonthPeriod) {
this.predictMonthPeriod = predictMonthPeriod;
}
} }
...@@ -159,7 +159,7 @@ public class LifeCommissionServiceImpl implements LifeCommissionService { ...@@ -159,7 +159,7 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
try { try {
// 1.检核续年佣金时先判断,前面期数的佣金是否检核过 // 1.检核续年佣金时先判断,前面期数的佣金是否检核过
this.validateContinuePremium(paramsList); // this.validateContinuePremium(paramsList);
// 2.更新财富等信息 // 2.更新财富等信息
this.processOrderAndFortune(paramsList, status, loginId, checkBatch); this.processOrderAndFortune(paramsList, status, loginId, checkBatch);
...@@ -218,15 +218,17 @@ public class LifeCommissionServiceImpl implements LifeCommissionService { ...@@ -218,15 +218,17 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
// 获取首年度佣金的orderId, 只有首年佣金才更新order记录和fortune记录 // 获取首年度佣金的orderId, 只有首年佣金才更新order记录和fortune记录
List<Long> orderIds = new ArrayList<>(); List<Long> orderIds = new ArrayList<>();
Long orderId; Long orderId;
for (ComeCommissionParams params: paramsList) { for (ComeCommissionParams params : paramsList) {
// 查询对应订单记录 // 查询对应订单记录
orderId = params.getOrderId(); orderId = params.getOrderId();
if (orderId != null) {
PoOrder order = poOrderDALService.findByOrderId(orderId); PoOrder order = poOrderDALService.findByOrderId(orderId);
if ("1".equals(params.getCommissionPeriod())) { if ("1".equals(params.getCommissionPeriod())) {
orderIds.add(orderId); orderIds.add(orderId);
// 只有首年记录更新order表 // 只有首年记录更新order表
this.updateOrder(order, status, loginId, checkBatch); this.updateOrder(order, status, loginId, checkBatch);
} }
}
this.updateFortune(params.getCommissionId(), status, loginId, checkBatch); this.updateFortune(params.getCommissionId(), status, loginId, checkBatch);
} }
...@@ -235,43 +237,37 @@ public class LifeCommissionServiceImpl implements LifeCommissionService { ...@@ -235,43 +237,37 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
List<PoOrder> orders = poOrderDALService.findByIds(orderIds); List<PoOrder> orders = poOrderDALService.findByIds(orderIds);
this.orderCommissionCheckCancelSendMail(orders); this.orderCommissionCheckCancelSendMail(orders);
} }
} }
private void updateOrderCommission(List<ComeCommissionParams> paramsList, String status, String loginId, String checkBatch) { private void updateOrderCommission(List<ComeCommissionParams> paramsList, String status, String loginId, String checkBatch) {
// 获取续年度来佣编号
List<String> commissionNos = new ArrayList<>();
for (ComeCommissionParams params: paramsList) {
if (StringUtils.isNotBlank(params.getCommissionNo())) {
commissionNos.add(params.getCommissionNo());
}
}
// 获取批次号(如2020-11的字符串) // 获取批次号(如2020-11的字符串)
Long checkBatchId = this.getOrderCommissionCheckBatch(checkBatch, loginId); Long checkBatchId = this.getOrderCommissionCheckBatch(checkBatch, loginId);
Set<Long> commissionCancelorderIdSet = new HashSet<>(); Set<Long> commissionCancelorderIdSet = new HashSet<>();
// 更新检核状态 // 更新检核状态
for (String commissionNo: commissionNos) { Long commissionId= null;
for (ComeCommissionParams params: paramsList) {
commissionId = params.getCommissionId();
if ("3".equals(status)) { if ("3".equals(status)) {
// 来佣比对进行“已退保”操作时,当前状态为待来佣时才修改 // 来佣比对进行“已退保”操作时,当前状态为待来佣时才修改
AgPoOrderCommission agPoOrderCommission = orderCommissionMapper.selectByCommissionNo(commissionNo); AgPoOrderCommission agPoOrderCommission = orderCommissionMapper.selectByPrimaryKey(commissionId);
if ("1".equals(agPoOrderCommission.getCommissionStatus())) { if ("1".equals(agPoOrderCommission.getCommissionStatus())) {
AgPoOrderCommission orderCommission = new AgPoOrderCommission(); AgPoOrderCommission orderCommission = new AgPoOrderCommission();
orderCommission.setCommissionNo(commissionNo); orderCommission.setId(commissionId);
orderCommission.setCommissionCheckId(checkBatchId); orderCommission.setCommissionCheckId(checkBatchId);
orderCommission.setCommissionStatus(status); orderCommission.setCommissionStatus(status);
orderCommission.setCommissionTime(""); orderCommission.setCommissionTime("");
orderCommission.setUpdatedBy(Long.valueOf(loginId)); orderCommission.setUpdatedBy(Long.valueOf(loginId));
orderCommission.setUpdatedAt(new Date()); orderCommission.setUpdatedAt(new Date());
orderCommissionMapper.updateBycommissionNo(orderCommission); orderCommissionMapper.updateByPrimaryKeySelective(orderCommission);
// 退保的orderId // 退保的orderId
if (null != agPoOrderCommission.getOrderId()) {
commissionCancelorderIdSet.add(agPoOrderCommission.getOrderId()); commissionCancelorderIdSet.add(agPoOrderCommission.getOrderId());
} }
}
} else { } else {
AgPoOrderCommission orderCommission = new AgPoOrderCommission(); AgPoOrderCommission orderCommission = new AgPoOrderCommission();
orderCommission.setCommissionNo(commissionNo); orderCommission.setId(commissionId);
orderCommission.setCommissionCheckId(checkBatchId); orderCommission.setCommissionCheckId(checkBatchId);
orderCommission.setCommissionStatus(status); orderCommission.setCommissionStatus(status);
if ("2".equals(status)) { if ("2".equals(status)) {
...@@ -280,7 +276,7 @@ public class LifeCommissionServiceImpl implements LifeCommissionService { ...@@ -280,7 +276,7 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
orderCommission.setUpdatedBy(Long.valueOf(loginId)); orderCommission.setUpdatedBy(Long.valueOf(loginId));
orderCommission.setUpdatedAt(new Date()); orderCommission.setUpdatedAt(new Date());
orderCommissionMapper.updateBycommissionNo(orderCommission); orderCommissionMapper.updateByPrimaryKeySelective(orderCommission);
} }
} }
// 如果是已退保,将后续期数的待来佣记录都改为已退保 // 如果是已退保,将后续期数的待来佣记录都改为已退保
...@@ -297,7 +293,7 @@ public class LifeCommissionServiceImpl implements LifeCommissionService { ...@@ -297,7 +293,7 @@ public class LifeCommissionServiceImpl implements LifeCommissionService {
orderCommission.setUpdatedBy(Long.valueOf(loginId)); orderCommission.setUpdatedBy(Long.valueOf(loginId));
orderCommission.setUpdatedAt(new Date()); orderCommission.setUpdatedAt(new Date());
orderCommissionMapper.updateBycommissionNo(orderCommission); orderCommissionMapper.updateByPrimaryKeySelective(orderCommission);
} }
} }
} }
......
...@@ -47,6 +47,10 @@ public class CommissionPayoutStatusQueryInfo { ...@@ -47,6 +47,10 @@ public class CommissionPayoutStatusQueryInfo {
* 预计发佣年月 * 预计发佣年月
*/ */
private String payoutYearmonth; private String payoutYearmonth;
/**
* 预计发佣年月
*/
private String predictMonthPeriod;
/** /**
* 体系子集id * 体系子集id
...@@ -148,4 +152,12 @@ public class CommissionPayoutStatusQueryInfo { ...@@ -148,4 +152,12 @@ public class CommissionPayoutStatusQueryInfo {
public void setPage(PageInfo<CommissionPayoutStatus> page) { public void setPage(PageInfo<CommissionPayoutStatus> page) {
this.page = page; this.page = page;
} }
public String getPredictMonthPeriod() {
return predictMonthPeriod;
}
public void setPredictMonthPeriod(String predictMonthPeriod) {
this.predictMonthPeriod = predictMonthPeriod;
}
} }
...@@ -133,8 +133,11 @@ ...@@ -133,8 +133,11 @@
<if test="item.commissionPayoutYearmonth != null"> <if test="item.commissionPayoutYearmonth != null">
and c.check_yearmonth = #{item.commissionPayoutYearmonth,jdbcType=VARCHAR} and c.check_yearmonth = #{item.commissionPayoutYearmonth,jdbcType=VARCHAR}
</if> </if>
<if test="item.predictMonthPeriod != null">
and DATE_FORMAT(t.predict_month_period, '%Y-%m') = #{item.predictMonthPeriod,jdbcType=VARCHAR}
</if>
<if test="item.payoutYearmonth != null"> <if test="item.payoutYearmonth != null">
and DATE_FORMAT(t.predict_month_period, '%Y-%m') = #{item.payoutYearmonth,jdbcType=VARCHAR} and pb.payout_yearmonth = #{item.payoutYearmonth,jdbcType=VARCHAR}
</if> </if>
UNION ALL UNION ALL
SELECT '' orderId,t.id fortuneId,'' commissionPayoutYearmonth,'' insurerName,'' productName, SELECT '' orderId,t.id fortuneId,'' commissionPayoutYearmonth,'' insurerName,'' productName,
...@@ -192,8 +195,11 @@ ...@@ -192,8 +195,11 @@
<!-- <if test="item.commissionPayoutYearmonth != null"> --> <!-- <if test="item.commissionPayoutYearmonth != null"> -->
<!-- and c.check_yearmonth = #{item.commissionPayoutYearmonth,jdbcType=VARCHAR} --> <!-- and c.check_yearmonth = #{item.commissionPayoutYearmonth,jdbcType=VARCHAR} -->
<!-- </if> --> <!-- </if> -->
<if test="item.predictMonthPeriod != null">
and DATE_FORMAT(t.predict_month_period, '%Y-%m') = #{item.predictMonthPeriod,jdbcType=VARCHAR}
</if>
<if test="item.payoutYearmonth != null"> <if test="item.payoutYearmonth != null">
and DATE_FORMAT(t.predict_month_period, '%Y-%m') = #{item.payoutYearmonth,jdbcType=VARCHAR} and pb.payout_yearmonth = #{item.payoutYearmonth,jdbcType=VARCHAR}
</if> </if>
</select> </select>
......
...@@ -83,7 +83,6 @@ ...@@ -83,7 +83,6 @@
) p3 ) p3
on o.config_level = p3.config_level and o.plan_id = p3.plan_id on o.config_level = p3.config_level and o.plan_id = p3.plan_id
left join ag_acl_insurer i on o.insurer_id = i.id left join ag_acl_insurer i on o.insurer_id = i.id
left join ag_acl_insurer_branch b on p.insurer_branch_id = b.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 (
select * select *
...@@ -105,7 +104,7 @@ ...@@ -105,7 +104,7 @@
and o.insurer_id = #{insurerId} and o.insurer_id = #{insurerId}
</if> </if>
<if test="insurerBranchId != null"> <if test="insurerBranchId != null">
and b.id = #{insurerBranchId,jdbcType=BIGINT} and p.insurer_branch_id = #{insurerBranchId,jdbcType=BIGINT}
</if> </if>
<if test="practitionerTypeId != null"> <if test="practitionerTypeId != null">
and f.practitioner_type_id = #{practitionerTypeId} and f.practitioner_type_id = #{practitionerTypeId}
...@@ -212,7 +211,8 @@ ...@@ -212,7 +211,8 @@
) 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_acl_insurer i on o.insurer_id = i.id left join ag_acl_insurer i on o.insurer_id = i.id
left join ag_acl_insurer_branch b on o.insurer_id = b.insurer_id left join ag_product_plan a on o.plan_id = a.id
left join ag_product p on o.product_id = p.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 (
select * select *
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
and o.insurer_id = #{insurerId} and o.insurer_id = #{insurerId}
</if> </if>
<if test="insurerBranchId != null"> <if test="insurerBranchId != null">
and b.id = #{insurerBranchId,jdbcType=BIGINT} and p.insurer_branch_id = #{insurerBranchId,jdbcType=BIGINT}
</if> </if>
<if test="practitionerTypeId != null"> <if test="practitionerTypeId != null">
and f.practitioner_type_id = #{practitionerTypeId} and f.practitioner_type_id = #{practitionerTypeId}
...@@ -286,9 +286,6 @@ ...@@ -286,9 +286,6 @@
o.commission_type commissionType, o.commission_type commissionType,
o.commission_item commissionItem, o.commission_item commissionItem,
b.id insurerBranchId,
b.branch_name insurerBranchName,
null as coverageTerm, null as coverageTerm,
null as payTerm, null as payTerm,
(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,
...@@ -324,13 +321,12 @@ ...@@ -324,13 +321,12 @@
) p3 ) p3
on o.config_level = p3.config_level and o.plan_id = p3.plan_id on o.config_level = p3.config_level and o.plan_id = p3.plan_id
left join ag_acl_insurer i on o.insurer_id = i.id left join ag_acl_insurer i on o.insurer_id = i.id
LEFT JOIN ag_acl_insurer_branch b ON o.insurer_id = b.insurer_id
where 1=1 where 1=1
<if test="insurerId != null"> <if test="insurerId != null">
and o.insurer_id = #{insurerId} and o.insurer_id = #{insurerId}
</if> </if>
<if test="insurerBranchId != null"> <if test="insurerBranchId != null">
and b.id = #{insurerBranchId,jdbcType=BIGINT} and p.insurer_branch_id = #{insurerBranchId,jdbcType=BIGINT}
</if> </if>
<if test="commissionType != null"> <if test="commissionType != null">
and o.commission_type = #{commissionType} and o.commission_type = #{commissionType}
......
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