Commit e85b9d82 by yao.xiao

处理历史数据,放开判断

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