Commit 713c9cde by yao.xiao

修改发佣检核状态,增加批次

parent 5e9a47af
package com.yd.api.agms.service.impl; package com.yd.api.agms.service.impl;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import com.yd.api.agms.service.AgmsFortuneService; import com.yd.api.agms.service.AgmsFortuneService;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateRequestVO; import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateRequestVO;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateResponseVO; import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateResponseVO;
...@@ -7,11 +8,13 @@ import com.yd.api.result.CommonResult; ...@@ -7,11 +8,13 @@ import com.yd.api.result.CommonResult;
import com.yd.dal.entity.agms.fortune.CustomerFortuneStatisticalInfo; import com.yd.dal.entity.agms.fortune.CustomerFortuneStatisticalInfo;
import com.yd.dal.entity.customer.AclCustomerFortune; import com.yd.dal.entity.customer.AclCustomerFortune;
import com.yd.dal.entity.customer.AclCustomerFortunePay; import com.yd.dal.entity.customer.AclCustomerFortunePay;
import com.yd.dal.entity.customer.AclCustomerFortunePayoutBatch;
import com.yd.dal.entity.customer.AclCustomerFortuneWithdraw; import com.yd.dal.entity.customer.AclCustomerFortuneWithdraw;
import com.yd.dal.entity.meta.MdIncometaxRate; import com.yd.dal.entity.meta.MdIncometaxRate;
import com.yd.dal.service.agms.AgmsFortuneDALService; import com.yd.dal.service.agms.AgmsFortuneDALService;
import com.yd.dal.service.customer.AclCustomerFortuneDALService; import com.yd.dal.service.customer.AclCustomerFortuneDALService;
import com.yd.dal.service.customer.AclCustomerFortunePayDALService; import com.yd.dal.service.customer.AclCustomerFortunePayDALService;
import com.yd.dal.service.customer.AclCustomerFortunePayoutBatchDALService;
import com.yd.dal.service.customer.AclCustomerFortuneWithdrawDALService; import com.yd.dal.service.customer.AclCustomerFortuneWithdrawDALService;
import com.yd.rmi.cache.SystemConfigService; import com.yd.rmi.cache.SystemConfigService;
import com.yd.util.CommonUtil; import com.yd.util.CommonUtil;
...@@ -34,7 +37,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -34,7 +37,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
private AclCustomerFortunePayDALService customerFortunePayDalService; private AclCustomerFortunePayDALService customerFortunePayDalService;
private AgmsFortuneDALService agmsFortuneDalService; private AgmsFortuneDALService agmsFortuneDalService;
private SystemConfigService systemConfigService; private SystemConfigService systemConfigService;
private AclCustomerFortunePayoutBatchDALService customerFortunePayoutBatchDalService;
@Autowired @Autowired
public void setAclCustomerFortuneDalService(AclCustomerFortuneDALService customerFortuneDalService) { public void setAclCustomerFortuneDalService(AclCustomerFortuneDALService customerFortuneDalService) {
this.customerFortuneDalService = customerFortuneDalService; this.customerFortuneDalService = customerFortuneDalService;
...@@ -59,6 +62,11 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -59,6 +62,11 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
this.systemConfigService = systemConfigService; this.systemConfigService = systemConfigService;
} }
@Autowired
public void setAclCustomerFortunePayoutBatchDALService(AclCustomerFortunePayoutBatchDALService customerFortunePayoutBatchDalService){
this.customerFortunePayoutBatchDalService = customerFortunePayoutBatchDalService;
}
@Override @Override
public CommissionPayoutStatusUpdateResponseVO commissionPayoutStatusUpdate(CommissionPayoutStatusUpdateRequestVO requestVO) { public CommissionPayoutStatusUpdateResponseVO commissionPayoutStatusUpdate(CommissionPayoutStatusUpdateRequestVO requestVO) {
CommissionPayoutStatusUpdateResponseVO responseVO = new CommissionPayoutStatusUpdateResponseVO(); CommissionPayoutStatusUpdateResponseVO responseVO = new CommissionPayoutStatusUpdateResponseVO();
...@@ -68,27 +76,45 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -68,27 +76,45 @@ 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);
//佣金预计发放批次
String payoutBatch = requestVO.getPayoutBatch();
//通过payoutBatch查询此批次是否再库中,在库中直接获取id,不在进行保存,获取id
Long payoutBatchId = findPayoutBatchIdByPayoutBatch(payoutBatch, loginId);
if (("2").equals(paymentStatus)){ if (("2").equals(paymentStatus)){
//如paymentStatus = 2(可发放),只需统计Fortune对应Customer最后一笔未支付的Withdraw,重新计算,如没有Withdraw生成一条新的Withdraw记录 //如paymentStatus = 2(可发放),只需统计Fortune对应Customer最后一笔未支付的Withdraw,重新计算,如没有Withdraw生成一条新的Withdraw记录
canPaymentUpDate(paymentStatus,loginId,customerFortunes); canPaymentUpDate(paymentStatus,payoutBatchId,loginId,customerFortunes);
}else { }else {
//如paymentStatus != 2(暂不可发,保留),只需统计原Fortune对应的Withdraw,重新计算 //如paymentStatus != 2(暂不可发,保留),只需统计原Fortune对应的Withdraw,重新计算
noPaymentUpDate(paymentStatus,loginId,customerFortunes); noPaymentUpDate(paymentStatus,payoutBatchId,loginId,customerFortunes);
} }
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"))); responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO; return responseVO;
} }
private void canPaymentUpDate(String paymentStatus, Long loginId, List<AclCustomerFortune> customerFortunes) { private Long findPayoutBatchIdByPayoutBatch(String payoutBatch, Long loginId) {
AclCustomerFortunePayoutBatch customerFortunePayoutBatch = customerFortunePayoutBatchDalService.findByPayoutYearmonth(payoutBatch);
if (customerFortunePayoutBatch == null){
customerFortunePayoutBatch = new AclCustomerFortunePayoutBatch();
customerFortunePayoutBatch.setPayoutYearmonth(payoutBatch);
customerFortunePayoutBatch.setCreatedBy(loginId);
customerFortunePayoutBatch.setUpdatedBy(loginId);
customerFortunePayoutBatch.setCreatedAt(new Date());
customerFortunePayoutBatch.setUpdatedAt(new Date());
customerFortunePayoutBatchDalService.save(customerFortunePayoutBatch);
}
return customerFortunePayoutBatch.getId();
}
private void canPaymentUpDate(String paymentStatus, Long payoutBatchId , Long loginId, List<AclCustomerFortune> customerFortunes) {
System.out.println("canPaymentUpDate"); System.out.println("canPaymentUpDate");
//将查询出来的财富列表根据customerId经行分类 //将查询出来的财富列表根据customerId经行分类
Map<Long,List<AclCustomerFortune>> customerFortuneMap = changeCustomerFortunesByFieldName(customerFortunes,"customerId"); Map<Long,List<AclCustomerFortune>> customerFortuneMap = changeCustomerFortunesByFieldName(customerFortunes,"customerId");
//获得所有需要修改佣金发放状的customerIds //获得所有需要修改佣金发放状的customerIds
Set<Long> customerIds = customerFortuneMap.keySet(); Set<Long> customerIds = customerFortuneMap.keySet();
//可直接修改的withdraw记录 //可直接修改的withdraw记录
Map<Long,Long> customerWithdrawMap = directModificationCustomerWithdrawMap(customerIds); Map<Long,Long> customerWithdrawMap = directModificationCustomerWithdrawMap(customerIds, payoutBatchId);
//没有最后一笔提现 记录客户信息和此次提现的财富记录 customerId fortunes //没有最后一笔提现 记录客户信息和此次提现的财富记录 customerId fortunes
Map<Long,List<AclCustomerFortune>> newCustomerWithdrawMap = new HashMap<>(16); Map<Long,List<AclCustomerFortune>> newCustomerWithdrawMap = new HashMap<>(16);
...@@ -112,6 +138,24 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -112,6 +138,24 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
fortune.setCommissionPayoutStatus(paymentStatus); fortune.setCommissionPayoutStatus(paymentStatus);
fortune.setCommissionPayoutBy(loginId); fortune.setCommissionPayoutBy(loginId);
fortune.setCommissionPayoutAt(new Date()); fortune.setCommissionPayoutAt(new Date());
fortune.setPayoutBatchId(payoutBatchId);
if (CommonUtil.isNullOrZero(withdrawId)){
//需生成新的withdraw
newFortunes.add(fortune);
}else {
//可直接修改fortune
fortune.setWithdrawedId(withdrawId);
fortuneUpdates.add(fortune);
withdrawUpdateIds.add(withdrawId);
}
}else {
//paymentStatus一致,都是可发放,判断其支付批次,是否一致,一致不需要修改,不一致需要修改两笔withdraw
if (!payoutBatchId.equals(fortune.getPayoutBatchId())){
//订单原来所属withdraw
withdrawUpdateIds.add(fortune.getWithdrawedId());
fortune.setCommissionPayoutAt(new Date());
fortune.setCommissionPayoutBy(loginId);
fortune.setPayoutBatchId(payoutBatchId);
if (CommonUtil.isNullOrZero(withdrawId)){ if (CommonUtil.isNullOrZero(withdrawId)){
//需生成新的withdraw //需生成新的withdraw
newFortunes.add(fortune); newFortunes.add(fortune);
...@@ -123,6 +167,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -123,6 +167,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
} }
} }
} }
}
//记录客户信息和此次提现的财富记录 //记录客户信息和此次提现的财富记录
if (!newFortunes.isEmpty()){ if (!newFortunes.isEmpty()){
newCustomerWithdrawMap.put(customerId,newFortunes); newCustomerWithdrawMap.put(customerId,newFortunes);
...@@ -132,14 +177,15 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -132,14 +177,15 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
//批量更新需要修改的fortune记录 //批量更新需要修改的fortune记录
customerFortuneDalService.updateBatch(fortuneUpdates); customerFortuneDalService.updateBatch(fortuneUpdates);
//重新计算受到影响的withdraw //重新计算受到影响的withdraw
Collections.sort(withdrawUpdateIds);
recalculateWithdraw(withdrawUpdateIds,customerIds,loginId); recalculateWithdraw(withdrawUpdateIds,customerIds,loginId);
//更新生成新的提现记录,及支付记录,fortune中记录对应的withdraw.id //更新生成新的提现记录,及支付记录,fortune中记录对应的withdraw.id
insertWithdraw(newCustomerWithdrawMap,loginId); insertWithdraw(newCustomerWithdrawMap,loginId);
} }
private Map<Long, Long> directModificationCustomerWithdrawMap(Set<Long> customerIds) { private Map<Long, Long> directModificationCustomerWithdrawMap(Set<Long> customerIds, Long payoutBatchId) {
//查询这些customerId最后一笔未完成的提现记录(ag_acl_customer_fortune_withdraw) //查询这些customerId是这个批次的最后一笔未完成的提现记录(ag_acl_customer_fortune_withdraw)
Map<Long,Long> customerWithdrawNoPayMap = customerFortuneWithdrawDalService.findFinalWithdrawNoPayByCustomerIds(customerIds); 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);
...@@ -158,7 +204,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -158,7 +204,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
return customerWithdrawMap; return customerWithdrawMap;
} }
private void noPaymentUpDate(String paymentStatus, Long loginId, List<AclCustomerFortune> customerFortunes) { private void noPaymentUpDate(String paymentStatus, Long payoutBatchId , Long loginId, List<AclCustomerFortune> customerFortunes) {
System.out.println("noPaymentUpDate"); System.out.println("noPaymentUpDate");
//需要修改的fortune记录(需修改佣金发放状态) //需要修改的fortune记录(需修改佣金发放状态)
List<AclCustomerFortune> fortuneUpdates = new ArrayList<>(); List<AclCustomerFortune> fortuneUpdates = new ArrayList<>();
...@@ -173,6 +219,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -173,6 +219,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
Long withdrawId = fortune.getWithdrawedId(); Long withdrawId = fortune.getWithdrawedId();
fortune.setWithdrawedId(null); fortune.setWithdrawedId(null);
fortune.setFortunePayedId(null); fortune.setFortunePayedId(null);
fortune.setFortunePayedId(null);
fortuneUpdates.add(fortune); fortuneUpdates.add(fortune);
if (!CommonUtil.isNullOrZero(withdrawId)){ if (!CommonUtil.isNullOrZero(withdrawId)){
withdrawUpdateIds.add(withdrawId); withdrawUpdateIds.add(withdrawId);
......
...@@ -23,4 +23,9 @@ public class CommissionPayoutStatusUpdateRequestVO { ...@@ -23,4 +23,9 @@ public class CommissionPayoutStatusUpdateRequestVO {
* 登入者id,loginId * 登入者id,loginId
*/ */
private Long loginId; private Long loginId;
/**
* 佣金预计发放批次
*/
private String payoutBatch;
} }
...@@ -7,6 +7,7 @@ import lombok.Data; ...@@ -7,6 +7,7 @@ import lombok.Data;
/** /**
* fortune record of customer * fortune record of customer
*/ */
@Data
public class AclCustomerFortune { public class AclCustomerFortune {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
...@@ -115,6 +116,11 @@ public class AclCustomerFortune { ...@@ -115,6 +116,11 @@ public class AclCustomerFortune {
private Date withdrawableDate; private Date withdrawableDate;
/** /**
* FK ag_acl_customer_fortune_payout_batch.id where payout_yearmonth = '2020-11-10',佣金预计发放批次
*/
private Long payoutBatchId;
/**
* FK ag_md_drop_options.drop_option_code where master = Commission_Payout_Status,佣金发放状态 * FK ag_md_drop_options.drop_option_code where master = Commission_Payout_Status,佣金发放状态
*/ */
private String commissionPayoutStatus; private String commissionPayoutStatus;
...@@ -148,562 +154,4 @@ public class AclCustomerFortune { ...@@ -148,562 +154,4 @@ public class AclCustomerFortune {
* FK ag_acl_customer.id * FK ag_acl_customer.id
*/ */
private Long createdBy; private Long createdBy;
/**
* Gets the value of id. *
*
* @return the value of id
*/
public Long getId() {
return id;
}
/**
* Sets the id. *
* <p>You can use getId() to get the value of id</p>
* * @param id id
*/
public void setId(Long id) {
this.id = id;
}
/**
* Gets the value of shareId. *
*
* @return the value of shareId
*/
public Long getShareId() {
return shareId;
}
/**
* Sets the shareId. *
* <p>You can use getShareId() to get the value of shareId</p>
* * @param shareId shareId
*/
public void setShareId(Long shareId) {
this.shareId = shareId;
}
/**
* Gets the value of customerId. *
*
* @return the value of customerId
*/
public Long getCustomerId() {
return customerId;
}
/**
* Sets the customerId. *
* <p>You can use getCustomerId() to get the value of customerId</p>
* * @param customerId customerId
*/
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
/**
* Gets the value of orderId. *
*
* @return the value of orderId
*/
public Long getOrderId() {
return orderId;
}
/**
* Sets the orderId. *
* <p>You can use getOrderId() to get the value of orderId</p>
* * @param orderId orderId
*/
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
/**
* Gets the value of orderDate. *
*
* @return the value of orderDate
*/
public Date getOrderDate() {
return orderDate;
}
/**
* Sets the orderDate. *
* <p>You can use getOrderDate() to get the value of orderDate</p>
* * @param orderDate orderDate
*/
public void setOrderDate(Date orderDate) {
this.orderDate = orderDate;
}
/**
* Gets the value of orderPrice. *
*
* @return the value of orderPrice
*/
public BigDecimal getOrderPrice() {
return orderPrice;
}
/**
* Sets the orderPrice. *
* <p>You can use getOrderPrice() to get the value of orderPrice</p>
* * @param orderPrice orderPrice
*/
public void setOrderPrice(BigDecimal orderPrice) {
this.orderPrice = orderPrice;
}
/**
* Gets the value of commissionRate. *
*
* @return the value of commissionRate
*/
public BigDecimal getCommissionRate() {
return commissionRate;
}
/**
* Sets the commissionRate. *
* <p>You can use getCommissionRate() to get the value of commissionRate</p>
* * @param commissionRate commissionRate
*/
public void setCommissionRate(BigDecimal commissionRate) {
this.commissionRate = commissionRate;
}
/**
* Gets the value of commissionAmount. *
*
* @return the value of commissionAmount
*/
public BigDecimal getCommissionAmount() {
return commissionAmount;
}
/**
* Sets the commissionAmount. *
* <p>You can use getCommissionAmount() to get the value of commissionAmount</p>
* * @param commissionAmount commissionAmount
*/
public void setCommissionAmount(BigDecimal commissionAmount) {
this.commissionAmount = commissionAmount;
}
/**
* Gets the value of fycRate. *
*
* @return the value of fycRate
*/
public BigDecimal getFycRate() {
return fycRate;
}
/**
* Sets the fycRate. *
* <p>You can use getFycRate() to get the value of fycRate</p>
* * @param fycRate fycRate
*/
public void setFycRate(BigDecimal fycRate) {
this.fycRate = fycRate;
}
/**
* Gets the value of fycAmount. *
*
* @return the value of fycAmount
*/
public BigDecimal getFycAmount() {
return fycAmount;
}
/**
* Sets the fycAmount. *
* <p>You can use getFycAmount() to get the value of fycAmount</p>
* * @param fycAmount fycAmount
*/
public void setFycAmount(BigDecimal fycAmount) {
this.fycAmount = fycAmount;
}
/**
* Gets the value of gradeCommissionRate. *
*
* @return the value of gradeCommissionRate
*/
public BigDecimal getGradeCommissionRate() {
return gradeCommissionRate;
}
/**
* Sets the gradeCommissionRate. *
* <p>You can use getGradeCommissionRate() to get the value of gradeCommissionRate</p>
* * @param gradeCommissionRate gradeCommissionRate
*/
public void setGradeCommissionRate(BigDecimal gradeCommissionRate) {
this.gradeCommissionRate = gradeCommissionRate;
}
/**
* Gets the value of shareRate. *
*
* @return the value of shareRate
*/
public BigDecimal getShareRate() {
return shareRate;
}
/**
* Sets the shareRate. *
* <p>You can use getShareRate() to get the value of shareRate</p>
* * @param shareRate shareRate
*/
public void setShareRate(BigDecimal shareRate) {
this.shareRate = shareRate;
}
/**
* Gets the value of referralRate. *
*
* @return the value of referralRate
*/
public BigDecimal getReferralRate() {
return referralRate;
}
/**
* Sets the referralRate. *
* <p>You can use getReferralRate() to get the value of referralRate</p>
* * @param referralRate referralRate
*/
public void setReferralRate(BigDecimal referralRate) {
this.referralRate = referralRate;
}
/**
* Gets the value of referralAmount. *
*
* @return the value of referralAmount
*/
public BigDecimal getReferralAmount() {
return referralAmount;
}
/**
* Sets the referralAmount. *
* <p>You can use getReferralAmount() to get the value of referralAmount</p>
* * @param referralAmount referralAmount
*/
public void setReferralAmount(BigDecimal referralAmount) {
this.referralAmount = referralAmount;
}
/**
* Gets the value of monthPeriod. *
*
* @return the value of monthPeriod
*/
public String getMonthPeriod() {
return monthPeriod;
}
/**
* Sets the monthPeriod. *
* <p>You can use getMonthPeriod() to get the value of monthPeriod</p>
* * @param monthPeriod monthPeriod
*/
public void setMonthPeriod(String monthPeriod) {
this.monthPeriod = monthPeriod;
}
/**
* Gets the value of commissionType. *
*
* @return the value of commissionType
*/
public String getCommissionType() {
return commissionType;
}
/**
* Sets the commissionType. *
* <p>You can use getCommissionType() to get the value of commissionType</p>
* * @param commissionType commissionType
*/
public void setCommissionType(String commissionType) {
this.commissionType = commissionType;
}
/**
* Gets the value of dropOptionCode. *
*
* @return the value of dropOptionCode
*/
public String getDropOptionCode() {
return dropOptionCode;
}
/**
* Sets the dropOptionCode. *
* <p>You can use getDropOptionCode() to get the value of dropOptionCode</p>
* * @param dropOptionCode dropOptionCode
*/
public void setDropOptionCode(String dropOptionCode) {
this.dropOptionCode = dropOptionCode;
}
/**
* Gets the value of practitionerLevel. *
*
* @return the value of practitionerLevel
*/
public String getPractitionerLevel() {
return practitionerLevel;
}
/**
* Sets the practitionerLevel. *
* <p>You can use getPractitionerLevel() to get the value of practitionerLevel</p>
* * @param practitionerLevel practitionerLevel
*/
public void setPractitionerLevel(String practitionerLevel) {
this.practitionerLevel = practitionerLevel;
}
/**
* Gets the value of isTax. *
*
* @return the value of isTax
*/
public Integer getIsTax() {
return isTax;
}
/**
* Sets the isTax. *
* <p>You can use getIsTax() to get the value of isTax</p>
* * @param isTax isTax
*/
public void setIsTax(Integer isTax) {
this.isTax = isTax;
}
/**
* Gets the value of taxAmount. *
*
* @return the value of taxAmount
*/
public BigDecimal getTaxAmount() {
return taxAmount;
}
/**
* Sets the taxAmount. *
* <p>You can use getTaxAmount() to get the value of taxAmount</p>
* * @param taxAmount taxAmount
*/
public void setTaxAmount(BigDecimal taxAmount) {
this.taxAmount = taxAmount;
}
/**
* Gets the value of netAmount. *
*
* @return the value of netAmount
*/
public BigDecimal getNetAmount() {
return netAmount;
}
/**
* Sets the netAmount. *
* <p>You can use getNetAmount() to get the value of netAmount</p>
* * @param netAmount netAmount
*/
public void setNetAmount(BigDecimal netAmount) {
this.netAmount = netAmount;
}
/**
* Gets the value of campaignId. *
*
* @return the value of campaignId
*/
public Long getCampaignId() {
return campaignId;
}
/**
* Sets the campaignId. *
* <p>You can use getCampaignId() to get the value of campaignId</p>
* * @param campaignId campaignId
*/
public void setCampaignId(Long campaignId) {
this.campaignId = campaignId;
}
/**
* Gets the value of campaignName. *
*
* @return the value of campaignName
*/
public String getCampaignName() {
return campaignName;
}
/**
* Sets the campaignName. *
* <p>You can use getCampaignName() to get the value of campaignName</p>
* * @param campaignName campaignName
*/
public void setCampaignName(String campaignName) {
this.campaignName = campaignName;
}
/**
* Gets the value of withdrawableDate. *
*
* @return the value of withdrawableDate
*/
public Date getWithdrawableDate() {
return withdrawableDate;
}
/**
* Sets the withdrawableDate. *
* <p>You can use getWithdrawableDate() to get the value of withdrawableDate</p>
* * @param withdrawableDate withdrawableDate
*/
public void setWithdrawableDate(Date withdrawableDate) {
this.withdrawableDate = withdrawableDate;
}
/**
* Gets the value of commissionPayoutStatus. *
*
* @return the value of commissionPayoutStatus
*/
public String getCommissionPayoutStatus() {
return commissionPayoutStatus;
}
/**
* Sets the commissionPayoutStatus. *
* <p>You can use getCommissionPayoutStatus() to get the value of commissionPayoutStatus</p>
* * @param commissionPayoutStatus commissionPayoutStatus
*/
public void setCommissionPayoutStatus(String commissionPayoutStatus) {
this.commissionPayoutStatus = commissionPayoutStatus;
}
/**
* Gets the value of commissionPayoutAt. *
*
* @return the value of commissionPayoutAt
*/
public Date getCommissionPayoutAt() {
return commissionPayoutAt;
}
/**
* Sets the commissionPayoutAt. *
* <p>You can use getCommissionPayoutAt() to get the value of commissionPayoutAt</p>
* * @param commissionPayoutAt commissionPayoutAt
*/
public void setCommissionPayoutAt(Date commissionPayoutAt) {
this.commissionPayoutAt = commissionPayoutAt;
}
/**
* Gets the value of commissionPayoutBy. *
*
* @return the value of commissionPayoutBy
*/
public Long getCommissionPayoutBy() {
return commissionPayoutBy;
}
/**
* Sets the commissionPayoutBy. *
* <p>You can use getCommissionPayoutBy() to get the value of commissionPayoutBy</p>
* * @param commissionPayoutBy commissionPayoutBy
*/
public void setCommissionPayoutBy(Long commissionPayoutBy) {
this.commissionPayoutBy = commissionPayoutBy;
}
/**
* Gets the value of withdrawedId. *
*
* @return the value of withdrawedId
*/
public Long getWithdrawedId() {
return withdrawedId;
}
/**
* Sets the withdrawedId. *
* <p>You can use getWithdrawedId() to get the value of withdrawedId</p>
* * @param withdrawedId withdrawedId
*/
public void setWithdrawedId(Long withdrawedId) {
this.withdrawedId = withdrawedId;
}
/**
* Gets the value of fortunePayedId. *
*
* @return the value of fortunePayedId
*/
public Long getFortunePayedId() {
return fortunePayedId;
}
/**
* Sets the fortunePayedId. *
* <p>You can use getFortunePayedId() to get the value of fortunePayedId</p>
* * @param fortunePayedId fortunePayedId
*/
public void setFortunePayedId(Long fortunePayedId) {
this.fortunePayedId = fortunePayedId;
}
/**
* Gets the value of createdAt. *
*
* @return the value of createdAt
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* Sets the createdAt. *
* <p>You can use getCreatedAt() to get the value of createdAt</p>
* * @param createdAt createdAt
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* Gets the value of createdBy. *
*
* @return the value of createdBy
*/
public Long getCreatedBy() {
return createdBy;
}
/**
* Sets the createdBy. *
* <p>You can use getCreatedBy() to get the value of createdBy</p>
* * @param createdBy createdBy
*/
public void setCreatedBy(Long createdBy) {
this.createdBy = createdBy;
}
} }
\ No newline at end of file
package com.yd.dal.entity.customer;
import java.util.Date;
import lombok.Data;
/**
* 经纪人佣金预计发放批次
*/
@Data
public class AclCustomerFortunePayoutBatch {
/**
* serial id
*/
private Long id;
/**
* 预计发放批次的年月
*/
private String payoutYearmonth;
/**
* 创建时间
*/
private Date createdAt;
/**
* FK ag_acl_user.id
*/
private Long createdBy;
/**
* 修改时间
*/
private Date updatedAt;
/**
* 修改人FK ag_acl_user.id
*/
private Long updatedBy;
}
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclCustomerFortunePayoutBatch;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface AclCustomerFortunePayoutBatchMapper {
int deleteByPrimaryKey(Long id);
int insert(AclCustomerFortunePayoutBatch record);
int insertSelective(AclCustomerFortunePayoutBatch record);
AclCustomerFortunePayoutBatch selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclCustomerFortunePayoutBatch record);
int updateByPrimaryKey(AclCustomerFortunePayoutBatch record);
int updateBatch(List<AclCustomerFortunePayoutBatch> list);
int updateBatchSelective(List<AclCustomerFortunePayoutBatch> list);
int batchInsert(@Param("list") List<AclCustomerFortunePayoutBatch> list);
AclCustomerFortunePayoutBatch selectByPayoutYearmonth(String payoutYearmonth);
}
\ No newline at end of file
...@@ -26,7 +26,7 @@ public interface AclCustomerFortuneWithdrawMapper { ...@@ -26,7 +26,7 @@ public interface AclCustomerFortuneWithdrawMapper {
int batchInsert(@Param("list") List<AclCustomerFortuneWithdraw> list); int batchInsert(@Param("list") List<AclCustomerFortuneWithdraw> list);
List<Map<String, Object>> findFinalWithdrawNoPayByCustomerIds(List<Long> customerIdList); List<Map<String, Object>> findFinalWithdrawNoPayByCustomerIds(@Param("list")List<Long> customerIdList, @Param("payoutBatchId")Long payoutBatchId);
List<AclCustomerFortuneWithdraw> findByIds(List<Long> withdrawUpdateIds); List<AclCustomerFortuneWithdraw> findByIds(List<Long> withdrawUpdateIds);
......
package com.yd.dal.service.customer;
import com.yd.dal.entity.customer.AclCustomerFortunePayoutBatch;
/**
* @author xxy
*/
public interface AclCustomerFortunePayoutBatchDALService {
AclCustomerFortunePayoutBatch findByPayoutYearmonth(String payoutYearmonth);
void save(AclCustomerFortunePayoutBatch customerFortunePayoutBatch);
}
...@@ -17,7 +17,7 @@ public interface AclCustomerFortuneWithdrawDALService { ...@@ -17,7 +17,7 @@ public interface AclCustomerFortuneWithdrawDALService {
* @param customerIds 客户id * @param customerIds 客户id
* @return map customerId withdrawId * @return map customerId withdrawId
*/ */
Map<Long, Long> findFinalWithdrawNoPayByCustomerIds(Set<Long> customerIds); Map<Long, Long> findFinalWithdrawNoPayByCustomerIds(Set<Long> customerIds, Long payoutBatchId);
/** /**
* 通过id批量查询 * 通过id批量查询
......
package com.yd.dal.service.customer.impl;
import com.yd.dal.entity.customer.AclCustomerFortunePayoutBatch;
import com.yd.dal.mapper.customer.AclCustomerFortunePayoutBatchMapper;
import com.yd.dal.service.customer.AclCustomerFortunePayoutBatchDALService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author xxy
*/
@Service("aclCustomerFortunePayoutBatchDALService")
public class AclCustomerFortunePayoutBatchDALServiceImpl implements AclCustomerFortunePayoutBatchDALService {
@Autowired
private AclCustomerFortunePayoutBatchMapper customerFortunePayoutBatchMapper;
@Override
public AclCustomerFortunePayoutBatch findByPayoutYearmonth(String payoutYearmonth) {
return customerFortunePayoutBatchMapper.selectByPayoutYearmonth(payoutYearmonth);
}
@Override
public void save(AclCustomerFortunePayoutBatch customerFortunePayoutBatch) {
customerFortunePayoutBatchMapper.insert(customerFortunePayoutBatch);
}
}
...@@ -18,9 +18,9 @@ public class AclCustomerFortuneWithdrawDALServiceImpl implements AclCustomerFort ...@@ -18,9 +18,9 @@ public class AclCustomerFortuneWithdrawDALServiceImpl implements AclCustomerFort
private AclCustomerFortuneWithdrawMapper customerFortuneWithdrawMapper; private AclCustomerFortuneWithdrawMapper customerFortuneWithdrawMapper;
@Override @Override
public Map<Long, Long> findFinalWithdrawNoPayByCustomerIds(Set<Long> customerIds) { public Map<Long, Long> findFinalWithdrawNoPayByCustomerIds(Set<Long> customerIds, Long payoutBatchId) {
List<Long> customerIdList = new ArrayList<>(customerIds); List<Long> customerIdList = new ArrayList<>(customerIds);
List<Map<String,Object>> customerWithdrawList = customerFortuneWithdrawMapper.findFinalWithdrawNoPayByCustomerIds(customerIdList); List<Map<String,Object>> customerWithdrawList = customerFortuneWithdrawMapper.findFinalWithdrawNoPayByCustomerIds(customerIdList, payoutBatchId);
return changeCustomerWithdrawMap(customerWithdrawList); return changeCustomerWithdrawMap(customerWithdrawList);
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<result column="campaign_id" jdbcType="BIGINT" property="campaignId" /> <result column="campaign_id" jdbcType="BIGINT" property="campaignId" />
<result column="campaign_name" jdbcType="VARCHAR" property="campaignName" /> <result column="campaign_name" jdbcType="VARCHAR" property="campaignName" />
<result column="withdrawable_date" jdbcType="TIMESTAMP" property="withdrawableDate" /> <result column="withdrawable_date" jdbcType="TIMESTAMP" property="withdrawableDate" />
<result column="payout_batch_id" jdbcType="BIGINT" property="payoutBatchId" />
<result column="commission_payout_status" jdbcType="VARCHAR" property="commissionPayoutStatus" /> <result column="commission_payout_status" jdbcType="VARCHAR" property="commissionPayoutStatus" />
<result column="commission_payout_at" jdbcType="TIMESTAMP" property="commissionPayoutAt" /> <result column="commission_payout_at" jdbcType="TIMESTAMP" property="commissionPayoutAt" />
<result column="commission_payout_by" jdbcType="BIGINT" property="commissionPayoutBy" /> <result column="commission_payout_by" jdbcType="BIGINT" property="commissionPayoutBy" />
...@@ -41,7 +42,7 @@ ...@@ -41,7 +42,7 @@
id, share_id, customer_id, order_id, order_date, order_price, commission_rate, commission_amount, id, share_id, customer_id, order_id, order_date, order_price, commission_rate, commission_amount,
fyc_rate, fyc_amount, grade_commission_rate, share_rate, referral_rate, referral_amount, fyc_rate, fyc_amount, grade_commission_rate, share_rate, referral_rate, referral_amount,
month_period, commission_type, drop_option_code, practitioner_level, is_tax, tax_amount, month_period, commission_type, drop_option_code, practitioner_level, is_tax, tax_amount,
net_amount, campaign_id, campaign_name, withdrawable_date, commission_payout_status, net_amount, campaign_id, campaign_name, withdrawable_date, payout_batch_id, commission_payout_status,
commission_payout_at, commission_payout_by, withdrawed_id, fortune_payed_id, created_at, commission_payout_at, commission_payout_by, withdrawed_id, fortune_payed_id, created_at,
created_by created_by
</sql> </sql>
...@@ -66,10 +67,10 @@ ...@@ -66,10 +67,10 @@
referral_amount, month_period, commission_type, referral_amount, month_period, commission_type,
drop_option_code, practitioner_level, is_tax, drop_option_code, practitioner_level, is_tax,
tax_amount, net_amount, campaign_id, tax_amount, net_amount, campaign_id,
campaign_name, withdrawable_date, commission_payout_status, campaign_name, withdrawable_date, payout_batch_id,
commission_payout_at, commission_payout_by, commission_payout_status, commission_payout_at,
withdrawed_id, fortune_payed_id, created_at, commission_payout_by, withdrawed_id, fortune_payed_id,
created_by) created_at, created_by)
values (#{shareId,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, values (#{shareId,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT},
#{orderDate,jdbcType=TIMESTAMP}, #{orderPrice,jdbcType=DECIMAL}, #{commissionRate,jdbcType=DECIMAL}, #{orderDate,jdbcType=TIMESTAMP}, #{orderPrice,jdbcType=DECIMAL}, #{commissionRate,jdbcType=DECIMAL},
#{commissionAmount,jdbcType=DECIMAL}, #{fycRate,jdbcType=DECIMAL}, #{fycAmount,jdbcType=DECIMAL}, #{commissionAmount,jdbcType=DECIMAL}, #{fycRate,jdbcType=DECIMAL}, #{fycAmount,jdbcType=DECIMAL},
...@@ -77,10 +78,10 @@ ...@@ -77,10 +78,10 @@
#{referralAmount,jdbcType=DECIMAL}, #{monthPeriod,jdbcType=VARCHAR}, #{commissionType,jdbcType=VARCHAR}, #{referralAmount,jdbcType=DECIMAL}, #{monthPeriod,jdbcType=VARCHAR}, #{commissionType,jdbcType=VARCHAR},
#{dropOptionCode,jdbcType=VARCHAR}, #{practitionerLevel,jdbcType=VARCHAR}, #{isTax,jdbcType=INTEGER}, #{dropOptionCode,jdbcType=VARCHAR}, #{practitionerLevel,jdbcType=VARCHAR}, #{isTax,jdbcType=INTEGER},
#{taxAmount,jdbcType=DECIMAL}, #{netAmount,jdbcType=DECIMAL}, #{campaignId,jdbcType=BIGINT}, #{taxAmount,jdbcType=DECIMAL}, #{netAmount,jdbcType=DECIMAL}, #{campaignId,jdbcType=BIGINT},
#{campaignName,jdbcType=VARCHAR}, #{withdrawableDate,jdbcType=TIMESTAMP}, #{commissionPayoutStatus,jdbcType=VARCHAR}, #{campaignName,jdbcType=VARCHAR}, #{withdrawableDate,jdbcType=TIMESTAMP}, #{payoutBatchId,jdbcType=BIGINT},
#{commissionPayoutAt,jdbcType=TIMESTAMP}, #{commissionPayoutBy,jdbcType=BIGINT}, #{commissionPayoutStatus,jdbcType=VARCHAR}, #{commissionPayoutAt,jdbcType=TIMESTAMP},
#{withdrawedId,jdbcType=BIGINT}, #{fortunePayedId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{commissionPayoutBy,jdbcType=BIGINT}, #{withdrawedId,jdbcType=BIGINT}, #{fortunePayedId,jdbcType=BIGINT},
#{createdBy,jdbcType=BIGINT}) #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT})
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortune" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortune" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
...@@ -155,6 +156,9 @@ ...@@ -155,6 +156,9 @@
<if test="withdrawableDate != null"> <if test="withdrawableDate != null">
withdrawable_date, withdrawable_date,
</if> </if>
<if test="payoutBatchId != null">
payout_batch_id,
</if>
<if test="commissionPayoutStatus != null"> <if test="commissionPayoutStatus != null">
commission_payout_status, commission_payout_status,
</if> </if>
...@@ -247,6 +251,9 @@ ...@@ -247,6 +251,9 @@
<if test="withdrawableDate != null"> <if test="withdrawableDate != null">
#{withdrawableDate,jdbcType=TIMESTAMP}, #{withdrawableDate,jdbcType=TIMESTAMP},
</if> </if>
<if test="payoutBatchId != null">
#{payoutBatchId,jdbcType=BIGINT},
</if>
<if test="commissionPayoutStatus != null"> <if test="commissionPayoutStatus != null">
#{commissionPayoutStatus,jdbcType=VARCHAR}, #{commissionPayoutStatus,jdbcType=VARCHAR},
</if> </if>
...@@ -343,6 +350,9 @@ ...@@ -343,6 +350,9 @@
<if test="withdrawableDate != null"> <if test="withdrawableDate != null">
withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP}, withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP},
</if> </if>
<if test="payoutBatchId != null">
payout_batch_id = #{payoutBatchId,jdbcType=BIGINT},
</if>
<if test="commissionPayoutStatus != null"> <if test="commissionPayoutStatus != null">
commission_payout_status = #{commissionPayoutStatus,jdbcType=VARCHAR}, commission_payout_status = #{commissionPayoutStatus,jdbcType=VARCHAR},
</if> </if>
...@@ -393,6 +403,7 @@ ...@@ -393,6 +403,7 @@
campaign_id = #{campaignId,jdbcType=BIGINT}, campaign_id = #{campaignId,jdbcType=BIGINT},
campaign_name = #{campaignName,jdbcType=VARCHAR}, campaign_name = #{campaignName,jdbcType=VARCHAR},
withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP}, withdrawable_date = #{withdrawableDate,jdbcType=TIMESTAMP},
payout_batch_id = #{payoutBatchId,jdbcType=BIGINT},
commission_payout_status = #{commissionPayoutStatus,jdbcType=VARCHAR}, commission_payout_status = #{commissionPayoutStatus,jdbcType=VARCHAR},
commission_payout_at = #{commissionPayoutAt,jdbcType=TIMESTAMP}, commission_payout_at = #{commissionPayoutAt,jdbcType=TIMESTAMP},
commission_payout_by = #{commissionPayoutBy,jdbcType=BIGINT}, commission_payout_by = #{commissionPayoutBy,jdbcType=BIGINT},
...@@ -521,6 +532,11 @@ ...@@ -521,6 +532,11 @@
when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawableDate,jdbcType=TIMESTAMP} when id = #{item.id,jdbcType=BIGINT} then #{item.withdrawableDate,jdbcType=TIMESTAMP}
</foreach> </foreach>
</trim> </trim>
<trim prefix="payout_batch_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payoutBatchId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="commission_payout_status = case" suffix="end,"> <trim prefix="commission_payout_status = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.commissionPayoutStatus,jdbcType=VARCHAR} when id = #{item.id,jdbcType=BIGINT} then #{item.commissionPayoutStatus,jdbcType=VARCHAR}
...@@ -727,6 +743,13 @@ ...@@ -727,6 +743,13 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="payout_batch_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payoutBatchId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payoutBatchId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="commission_payout_status = case" suffix="end,"> <trim prefix="commission_payout_status = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
<if test="item.commissionPayoutStatus != null"> <if test="item.commissionPayoutStatus != null">
...@@ -788,7 +811,7 @@ ...@@ -788,7 +811,7 @@
(share_id, customer_id, order_id, order_date, order_price, commission_rate, commission_amount, (share_id, customer_id, order_id, order_date, order_price, commission_rate, commission_amount,
fyc_rate, fyc_amount, grade_commission_rate, share_rate, referral_rate, referral_amount, fyc_rate, fyc_amount, grade_commission_rate, share_rate, referral_rate, referral_amount,
month_period, commission_type, drop_option_code, practitioner_level, is_tax, tax_amount, month_period, commission_type, drop_option_code, practitioner_level, is_tax, tax_amount,
net_amount, campaign_id, campaign_name, withdrawable_date, commission_payout_status, net_amount, campaign_id, campaign_name, withdrawable_date, payout_batch_id, commission_payout_status,
commission_payout_at, commission_payout_by, withdrawed_id, fortune_payed_id, created_at, commission_payout_at, commission_payout_by, withdrawed_id, fortune_payed_id, created_at,
created_by) created_by)
values values
...@@ -802,10 +825,10 @@ ...@@ -802,10 +825,10 @@
#{item.dropOptionCode,jdbcType=VARCHAR}, #{item.practitionerLevel,jdbcType=VARCHAR}, #{item.dropOptionCode,jdbcType=VARCHAR}, #{item.practitionerLevel,jdbcType=VARCHAR},
#{item.isTax,jdbcType=INTEGER}, #{item.taxAmount,jdbcType=DECIMAL}, #{item.netAmount,jdbcType=DECIMAL}, #{item.isTax,jdbcType=INTEGER}, #{item.taxAmount,jdbcType=DECIMAL}, #{item.netAmount,jdbcType=DECIMAL},
#{item.campaignId,jdbcType=BIGINT}, #{item.campaignName,jdbcType=VARCHAR}, #{item.withdrawableDate,jdbcType=TIMESTAMP}, #{item.campaignId,jdbcType=BIGINT}, #{item.campaignName,jdbcType=VARCHAR}, #{item.withdrawableDate,jdbcType=TIMESTAMP},
#{item.commissionPayoutStatus,jdbcType=VARCHAR}, #{item.commissionPayoutAt,jdbcType=TIMESTAMP}, #{item.payoutBatchId,jdbcType=BIGINT}, #{item.commissionPayoutStatus,jdbcType=VARCHAR},
#{item.commissionPayoutBy,jdbcType=BIGINT}, #{item.withdrawedId,jdbcType=BIGINT}, #{item.commissionPayoutAt,jdbcType=TIMESTAMP}, #{item.commissionPayoutBy,jdbcType=BIGINT},
#{item.fortunePayedId,jdbcType=BIGINT}, #{item.createdAt,jdbcType=TIMESTAMP}, #{item.createdBy,jdbcType=BIGINT} #{item.withdrawedId,jdbcType=BIGINT}, #{item.fortunePayedId,jdbcType=BIGINT}, #{item.createdAt,jdbcType=TIMESTAMP},
) #{item.createdBy,jdbcType=BIGINT})
</foreach> </foreach>
</insert> </insert>
...@@ -821,7 +844,7 @@ ...@@ -821,7 +844,7 @@
s.practitioner_level practitionerLevelId s.practitioner_level practitionerLevelId
FROM FROM
((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id) ((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id)
INNER JOIN (select t.* from ag_acl_customer_fortune t where t.drop_option_code = "S01" group by t.order_id ) f ON f.customer_id = p.customer_id) INNER JOIN (select t.* from ag_acl_customer_fortune t where t.drop_option_code = 'S01' group by t.order_id ) f ON f.customer_id = p.customer_id)
INNER JOIN ag_po_order o ON f.order_id = o.id INNER JOIN ag_po_order o ON f.order_id = o.id
WHERE WHERE
o.status = 3 and o.order_price &gt; 0 o.status = 3 and o.order_price &gt; 0
...@@ -845,7 +868,7 @@ ...@@ -845,7 +868,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from ag_acl_customer_fortune from ag_acl_customer_fortune
where id in where id in
<foreach collection="array" index="index" item="item" open="(" separator="," close=")"> <foreach close=")" collection="array" index="index" item="item" open="(" separator=",">
#{item} #{item}
</foreach> </foreach>
</select> </select>
...@@ -855,7 +878,7 @@ ...@@ -855,7 +878,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from ag_acl_customer_fortune from ag_acl_customer_fortune
where withdrawed_id in where withdrawed_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
#{item} #{item}
</foreach> </foreach>
</select> </select>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yd.dal.mapper.customer.AclCustomerFortunePayoutBatchMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomerFortunePayoutBatch">
<!--@mbg.generated-->
<!--@Table ag_acl_customer_fortune_payout_batch-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="payout_yearmonth" jdbcType="VARCHAR" property="payoutYearmonth" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, payout_yearmonth, created_at, created_by, updated_at, updated_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune_payout_batch
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from ag_acl_customer_fortune_payout_batch
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortunePayoutBatch" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_payout_batch (payout_yearmonth, created_at, created_by,
updated_at, updated_by)
values (#{payoutYearmonth,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT},
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortunePayoutBatch" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_payout_batch
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="payoutYearmonth != null">
payout_yearmonth,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="payoutYearmonth != null">
#{payoutYearmonth,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclCustomerFortunePayoutBatch">
<!--@mbg.generated-->
update ag_acl_customer_fortune_payout_batch
<set>
<if test="payoutYearmonth != null">
payout_yearmonth = #{payoutYearmonth,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclCustomerFortunePayoutBatch">
<!--@mbg.generated-->
update ag_acl_customer_fortune_payout_batch
set payout_yearmonth = #{payoutYearmonth,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update ag_acl_customer_fortune_payout_batch
<trim prefix="set" suffixOverrides=",">
<trim prefix="payout_yearmonth = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.payoutYearmonth,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="created_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="updated_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="updated_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update ag_acl_customer_fortune_payout_batch
<trim prefix="set" suffixOverrides=",">
<trim prefix="payout_yearmonth = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.payoutYearmonth != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.payoutYearmonth,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createdAt != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="created_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createdBy != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="updated_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updatedAt != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="updated_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updatedBy != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_payout_batch
(payout_yearmonth, created_at, created_by, updated_at, updated_by)
values
<foreach collection="list" item="item" separator=",">
(#{item.payoutYearmonth,jdbcType=VARCHAR}, #{item.createdAt,jdbcType=TIMESTAMP},
#{item.createdBy,jdbcType=BIGINT}, #{item.updatedAt,jdbcType=TIMESTAMP}, #{item.updatedBy,jdbcType=BIGINT}
)
</foreach>
</insert>
<select id="selectByPayoutYearmonth" parameterType="string" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune_payout_batch
where payout_yearmonth = #{payoutBatch,jdbcType=VARCHAR}
</select>
</mapper>
\ No newline at end of file
...@@ -540,15 +540,17 @@ ...@@ -540,15 +540,17 @@
</insert> </insert>
<select id="findFinalWithdrawNoPayByCustomerIds" parameterType="arraylist" resultType="java.util.Map"> <select id="findFinalWithdrawNoPayByCustomerIds" parameterType="arraylist" resultType="java.util.Map">
select customer_id customerId, select w.customer_id customerId,
group_concat(id order by id) withdrawIds group_concat(distinct w.id order by w.id) withdrawIds
from ag_acl_customer_fortune_withdraw from ag_acl_customer_fortune_withdraw w
where customer_id in left join ag_acl_customer_fortune f on f.withdrawed_id = w.id
where w.customer_id in
<foreach collection="list" item="item" separator="," open="(" close=")"> <foreach collection="list" item="item" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
and is_paid != 1 and w.is_paid != 1
group by customer_id and f.payout_batch_id = #{payoutBatchId,jdbcType=BIGINT}
group by w.customer_id
</select> </select>
<select id="findByIds" parameterType="list" resultMap="BaseResultMap"> <select id="findByIds" parameterType="list" resultMap="BaseResultMap">
...@@ -563,7 +565,7 @@ ...@@ -563,7 +565,7 @@
<select id="findFinalWithdrawPayByCustomerIds" resultType="java.util.Map"> <select id="findFinalWithdrawPayByCustomerIds" resultType="java.util.Map">
select customer_id customerId, select customer_id customerId,
group_concat(id order by id) withdrawIds group_concat(distinct id order by id) withdrawIds
from ag_acl_customer_fortune_withdraw from ag_acl_customer_fortune_withdraw
where customer_id in where customer_id in
<foreach collection="list" item="item" separator="," open="(" close=")"> <foreach collection="list" item="item" separator="," open="(" close=")">
......
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