Commit f7b31227 by jianan

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

parents 264a0aab a8469d5c
...@@ -110,17 +110,17 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -110,17 +110,17 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
Long loginId = requestVO.getLoginId(); Long loginId = requestVO.getLoginId();
//查询出需修改的佣金发放状态的财富 //查询出需修改的佣金发放状态的财富
List<AclCustomerFortune> customerFortunes = customerFortuneDalService.findByIds(fortuneIds); List<AclCustomerFortune> customerFortunes = customerFortuneDalService.findByIds(fortuneIds);
List<String> commissionPayoutStatusList = new ArrayList<>(); // List<String> commissionPayoutStatusList = new ArrayList<>();
for (AclCustomerFortune customerFortune: customerFortunes) { // for (AclCustomerFortune customerFortune: customerFortunes) {
commissionPayoutStatusList.add(customerFortune.getCommissionPayoutStatus()); // commissionPayoutStatusList.add(customerFortune.getCommissionPayoutStatus());
} // }
if (commissionPayoutStatusList.contains("4")){ // if (commissionPayoutStatusList.contains("4")){
String message = ZHBErrorConfig.getErrorInfo("830023"); // String message = ZHBErrorConfig.getErrorInfo("830023");
commonResult.setSuccess(false); // commonResult.setSuccess(false);
commonResult.setMessage(message); // commonResult.setMessage(message);
responseVO.setCommonResult(commonResult); // responseVO.setCommonResult(commonResult);
return responseVO; // return responseVO;
} // }
//佣金预计发放批次 //佣金预计发放批次
String payoutBatch = requestVO.getPayoutBatch(); String payoutBatch = requestVO.getPayoutBatch();
//通过payoutBatch查询此批次是否再库中,在库中直接获取id,不在进行保存,获取id //通过payoutBatch查询此批次是否再库中,在库中直接获取id,不在进行保存,获取id
...@@ -144,8 +144,21 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -144,8 +144,21 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
String message = ZHBErrorConfig.getErrorInfo("800000"); String message = ZHBErrorConfig.getErrorInfo("800000");
if (("2").equals(requestVO.getPaymentStatus())){ if (("2").equals(requestVO.getPaymentStatus())){
if (CommonUtil.isNullOrBlank(requestVO.getPayoutBatch())){ if (CommonUtil.isNullOrBlank(requestVO.getPayoutBatch())){
success = false;
message = ZHBErrorConfig.getErrorInfo("830021"); message = ZHBErrorConfig.getErrorInfo("830021");
success = false;
}
commonResult.setSuccess(success);
commonResult.setMessage(message);
return commonResult;
}
Long[] fortuneIds = requestVO.getFortuneIds();
List<AclCustomerFortuneWithdraw> withdraws = customerFortuneWithdrawDalService.findByFortuneIds(fortuneIds);
for (AclCustomerFortuneWithdraw withdraw : withdraws) {
if (withdraw.getIsPaid()==1){
message = ZHBErrorConfig.getErrorInfo("830024");
commonResult.setSuccess(false);
commonResult.setMessage(message);
return commonResult;
} }
} }
commonResult.setSuccess(success); commonResult.setSuccess(success);
...@@ -261,19 +274,19 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -261,19 +274,19 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
//查询这些customerId是这个批次的最后一笔未完成的提现记录(ag_acl_customer_fortune_withdraw) //查询这些customerId是这个批次的最后一笔未完成的提现记录(ag_acl_customer_fortune_withdraw)
Map<Long,Long> customerWithdrawNoPayMap = customerFortuneWithdrawDalService.findFinalWithdrawNoPayByCustomerIds(customerIds, payoutBatchId); Map<Long,Long> customerWithdrawNoPayMap = customerFortuneWithdrawDalService.findFinalWithdrawNoPayByCustomerIds(customerIds, payoutBatchId);
//查询这些customerId最后一笔已完成的提现记录(ag_acl_customer_fortune_withdraw) //查询这些customerId最后一笔已完成的提现记录(ag_acl_customer_fortune_withdraw)
Map<Long,Long> customerWithdrawPayMap = customerFortuneWithdrawDalService.findFinalWithdrawPayByCustomerIds(customerIds); // Map<Long,Long> customerWithdrawPayMap = customerFortuneWithdrawDalService.findFinalWithdrawPayByCustomerIds(customerIds);
Map<Long,Long> customerWithdrawMap = new HashMap<>(16); Map<Long,Long> customerWithdrawMap = new HashMap<>(16);
//循环未完成记录,并于已完成的记录经行比较,如果未完成的id大于已完成的,则可以直接修改withdraw;如果未完成的id小于已完成的id,则需要生成新的withdraw //循环未完成记录,并于已完成的记录经行比较,如果未完成的id大于已完成的,则可以直接修改withdraw;如果未完成的id小于已完成的id,则需要生成新的withdraw
for (Map.Entry<Long,Long> customerWithdrawNoPay: customerWithdrawNoPayMap.entrySet()){ for (Map.Entry<Long,Long> customerWithdrawNoPay: customerWithdrawNoPayMap.entrySet()){
Long payWithdrewId = customerWithdrawPayMap.get(customerWithdrawNoPay.getKey()); // Long payWithdrewId = customerWithdrawPayMap.get(customerWithdrawNoPay.getKey());
if (CommonUtil.isNullOrZero(payWithdrewId)){ // if (CommonUtil.isNullOrZero(payWithdrewId)){
customerWithdrawMap.put(customerWithdrawNoPay.getKey(),customerWithdrawNoPay.getValue()); customerWithdrawMap.put(customerWithdrawNoPay.getKey(),customerWithdrawNoPay.getValue());
continue; continue;
} // }
if (BigDecimal.valueOf(payWithdrewId).compareTo(BigDecimal.valueOf(customerWithdrawNoPay.getValue())) > 0){ // if (BigDecimal.valueOf(payWithdrewId).compareTo(BigDecimal.valueOf(customerWithdrawNoPay.getValue())) > 0){
continue; // continue;
} // }
customerWithdrawMap.put(customerWithdrawNoPay.getKey(),customerWithdrawNoPay.getValue()); // customerWithdrawMap.put(customerWithdrawNoPay.getKey(),customerWithdrawNoPay.getValue());
} }
return customerWithdrawMap; return customerWithdrawMap;
} }
...@@ -349,7 +362,15 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -349,7 +362,15 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
//需要重新计算withdraw根据的fortune记录 //需要重新计算withdraw根据的fortune记录
List<AclCustomerFortune> fortuneWithdraw = withdrawsFortunes.get(withdrawId); List<AclCustomerFortune> fortuneWithdraw = withdrawsFortunes.get(withdrawId);
if (fortuneWithdraw == null) { if (fortuneWithdraw == null) {
updateWithdrawAmountToZero(withdraws, pays, loginId); List<AclCustomerFortuneWithdraw> withdrawList = new ArrayList<>();
withdrawList.add(withdraw);
List<AclCustomerFortunePay> payList = new ArrayList<>();
for (AclCustomerFortunePay pay : pays) {
if (pay.getWithdrawId().equals(withdrawId)) {
payList.add(pay);
}
}
updateWithdrawAmountToZero(withdrawList, payList, loginId);
continue; continue;
} }
//统计此次提现总金额 //统计此次提现总金额
......
...@@ -31,4 +31,6 @@ public interface AclCustomerFortuneWithdrawMapper { ...@@ -31,4 +31,6 @@ public interface AclCustomerFortuneWithdrawMapper {
List<AclCustomerFortuneWithdraw> findByIds(List<Long> withdrawUpdateIds); List<AclCustomerFortuneWithdraw> findByIds(List<Long> withdrawUpdateIds);
List<Map<String, Object>> findFinalWithdrawPayByCustomerIds(List<Long> customerIdList); List<Map<String, Object>> findFinalWithdrawPayByCustomerIds(List<Long> customerIdList);
List<AclCustomerFortuneWithdraw> findByFortuneIds(Long[] fortuneIds);
} }
\ No newline at end of file
...@@ -40,4 +40,11 @@ public interface AclCustomerFortuneWithdrawDALService { ...@@ -40,4 +40,11 @@ public interface AclCustomerFortuneWithdrawDALService {
Map<Long, Long> findFinalWithdrawPayByCustomerIds(Set<Long> customerIds); Map<Long, Long> findFinalWithdrawPayByCustomerIds(Set<Long> customerIds);
Long save(AclCustomerFortuneWithdraw withdraw); Long save(AclCustomerFortuneWithdraw withdraw);
/**
* 通过fortuneIds 查询withdraw记录
* @param fortuneIds
* @return
*/
List<AclCustomerFortuneWithdraw> findByFortuneIds(Long[] fortuneIds);
} }
...@@ -46,6 +46,11 @@ public class AclCustomerFortuneWithdrawDALServiceImpl implements AclCustomerFort ...@@ -46,6 +46,11 @@ public class AclCustomerFortuneWithdrawDALServiceImpl implements AclCustomerFort
return (long) customerFortuneWithdrawMapper.insert(withdraw); return (long) customerFortuneWithdrawMapper.insert(withdraw);
} }
@Override
public List<AclCustomerFortuneWithdraw> findByFortuneIds(Long[] fortuneIds) {
return customerFortuneWithdrawMapper.findByFortuneIds(fortuneIds);
}
private Map<Long, Long> changeCustomerWithdrawMap(List<Map<String, Object>> customerWithdrawList) { private Map<Long, Long> changeCustomerWithdrawMap(List<Map<String, Object>> customerWithdrawList) {
Map<Long, Long> customerWithdrawMap = new HashMap<>(16); Map<Long, Long> customerWithdrawMap = new HashMap<>(16);
for (Map<String, Object> customerWithdraw : customerWithdrawList) { for (Map<String, Object> customerWithdraw : customerWithdrawList) {
......
...@@ -37,4 +37,5 @@ ...@@ -37,4 +37,5 @@
830021=请选择发佣日期 830021=请选择发佣日期
830022=请选择关账记录 830022=请选择关账记录
830023=已关账并发放的记录,不能修改 830023=已关账并发放的记录,不能修改
830024=存在已关账保单,禁止修改为非可发放状态
900003=保险公司响应报文为空! 900003=保险公司响应报文为空!
\ No newline at end of file
...@@ -548,7 +548,7 @@ ...@@ -548,7 +548,7 @@
<foreach collection="list" item="item" separator="," open="(" close=")"> <foreach collection="list" item="item" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
and w.is_paid != 1 <!-- and w.is_paid != 1-->
and (f.payout_batch_id = #{payoutBatchId,jdbcType=BIGINT} or w.withdraw_amount = 0) and (f.payout_batch_id = #{payoutBatchId,jdbcType=BIGINT} or w.withdraw_amount = 0)
group by w.customer_id group by w.customer_id
</select> </select>
...@@ -574,4 +574,15 @@ ...@@ -574,4 +574,15 @@
and is_paid = 1 and is_paid = 1
group by customer_id group by customer_id
</select> </select>
<select id="findByFortuneIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune_withdraw
where id in (select withdrawed_id from ag_acl_customer_fortune where id in
<foreach collection="array" item="item" separator="," open="(" close=")">
#{item}
</foreach>
)
</select>
</mapper> </mapper>
\ No newline at end of file
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