Bläddra i källkod

易宝回调成功后修改应付记录状态为成功

LIDEXI 4 år sedan
förälder
incheckning
1617548c22

+ 10 - 4
src/main/java/org/springblade/modules/payment/listener/UserPayListener.java

@@ -105,7 +105,7 @@ public class UserPayListener {
 						shop.setSales(shop.getSales() != null?shop.getSales()+1:1);
 						shop.setTradeTimes(shop.getTradeTimes() != null ? shop.getTradeTimes() +1 : 1);
 						shopService.updateById(shop);
-						//支付成功增加商场和商家的积分成本,增加用户的可用积分余额
+
 
 						//查询是否有商场送积分的待确认记录
 						List<PointDetail> mallPointDetails = pointDetailService.getBaseMapper().selectList(new QueryWrapper<>(new PointDetail()).lambda()
@@ -157,7 +157,7 @@ public class UserPayListener {
 						}
 
 						/**
-						 * 商送积分的待确认记录
+						 * 商送积分的待确认记录
 						 */
 						List<PointDetail> shopPointDetails = pointDetailService.getBaseMapper().selectList(new QueryWrapper<>(new PointDetail()).lambda()
 							.eq(PointDetail::getBillRecordId,billRecord.getId())
@@ -170,13 +170,14 @@ public class UserPayListener {
 							shopService.updateById(shop);
 							shopPointDetail.setBillRecordStatus(SystemConstant.BillRecordPayStatus.PAYED.getValue());
 							pointDetailService.updateById(shopPointDetail);
-							//修改该用户的
+
 							//增加该商店会员的可用积分
 
 							shopMember.setPointValue(shopMember.getPointValue() != null ? shopMember.getPointValue().add(shopPointDetail.getPointValue()): shopPointDetail.getPointValue());
 							shopMember.setPointTotal(shopMember.getPointTotal() != null ? shopMember.getPointTotal().add(shopPointDetail.getPoint()): shopPointDetail.getPoint());
 							shopMember.setPayTotal(shopMember.getPayTotal() != null ? shopMember.getPayTotal().add(billRecord.getPrice()):billRecord.getPrice());
 							memberService.updateById(shopMember);
+							//修改该用户的可用积分余额
 							loginUser.setPointValue(loginUser.getPointValue() != null ? loginUser.getPointValue().add(shopPointDetail.getPointValue()):shopPointDetail.getPointValue());
 							loginUser.setPoint(loginUser.getPoint() != null ? loginUser.getPoint().add(shopPointDetail.getPoint()):shopPointDetail.getPoint());
 							loginUserService.updateById(loginUser);
@@ -194,9 +195,10 @@ public class UserPayListener {
 							channelPointDetail.setBillRecordStatus(SystemConstant.BillRecordPayStatus.PAYED.getValue());
 							pointDetailService.updateById(channelPointDetail);
 							if(channelUserPoint != null){
+								//减少该用户在该渠道的积分
 								channelUserPoint.setUsablePointValue(channelUserPoint.getUsablePoint().subtract(channelPointDetail.getPoint()));
 								channelUserPointService.updateById(channelUserPoint);
-								//减少用户信息的渠道积分
+								//减少用户信息的渠道积分
 								loginUser.setChannelPointValue(loginUser.getChannelPointValue().subtract(channelPointDetail.getPointValue()));
 								loginUserService.updateById(loginUser);
 								/**   判断是否有商家待应收记录   **/
@@ -204,10 +206,14 @@ public class UserPayListener {
 									.eq(ShopYingshou::getBillRecordStatus, SystemConstant.BillRecordPayStatus.PAYING.getValue())
 									.eq(ShopYingshou::getBillRecordId, billRecord.getId()));
 								if(shopYingshou != null){
+
 									//增加商户的总应收
 									shopYingshou.setBillRecordStatus(SystemConstant.BillRecordPayStatus.PAYED.getValue());
 									shop.setTotalFunkPrice(shop.getTotalFunkPrice() != null? shop.getTotalFunkPrice().add(shopYingshou.getPointValue()):shopYingshou.getPointValue());
 									shopService.updateById(shop);
+									//修改应付记录为完成
+									shopYingshou.setBillRecordStatus(SystemConstant.BillRecordPayStatus.PAYED.getValue());
+									shopYingshouService.updateById(shopYingshou);
 								}
 							}
 						}