浏览代码

收益提现

liaoyongfei 3 年之前
父节点
当前提交
45e705f648

+ 4 - 57
ymall/src/main/java/com/liangjian11/ymall/handle/SynProfitHandle.java

@@ -329,62 +329,6 @@ public class SynProfitHandle {
       QueryWrapper<ProfitRuleDetail> profitRuleDetailQuery = new QueryWrapper<>();
       profitRuleDetailQuery.eq("type", 3); //下级分润
       List<ProfitRuleDetail> profitRuleDetailList = profitRuleDetailService.list(profitRuleDetailQuery);
-
-//      QueryWrapper<PartnerRecommend> partnerRecommendQuery = new QueryWrapper<>();
-//      partnerRecommendQuery.eq("status", 1);
-//			partnerRecommendQuery.eq("subordinate_id", item.getUserRoleId());
-//			PartnerRecommend partnerRecommend = partnerRecommendService.getOne(partnerRecommendQuery);
-//			if (partnerRecommend == null) {
-//				item.setIsHandle(true);
-//				calculationProfitService.updateById(item);
-//				continue;
-//			}
-//      QueryWrapper<UserRole> userRoleQuery = new QueryWrapper<>();
-//			userRoleQuery.eq("user_role_id", partnerRecommend.getSubordinateId());
-//      UserRole subUserRole = userRoleService.getOne(userRoleQuery);
-//      QueryWrapper<UserRole> userRoleQuery1 = new QueryWrapper<>();
-//      userRoleQuery1.eq("user_role_id", partnerRecommend.getSuperiorId());
-//      UserRole userRole = userRoleService.getOne(userRoleQuery1);
-//			if (userRole == null) {
-//				item.setIsHandle(true);
-//				calculationProfitService.updateById(item);
-//				continue;
-//			}
-//      ProfitRuleDetail ruleDetail = null;
-//			for (ProfitRuleDetail ruleDetailItem : profitRuleDetailList) {
-//				if (ruleDetailItem.getUserRoleType().equals(subUserRole.getUserRoleType())) {
-//					ruleDetail = ruleDetailItem;
-//					break;
-//				}
-//			}
-//			if (ruleDetail == null) {
-//				item.setIsHandle(true);
-//				calculationProfitService.updateById(item);
-//				continue;
-//			}
-//      CalculationProfit profit = new CalculationProfit();
-//			double price = item.getPrice() / 100D;
-//			profit.setCalculationFormula("(" + price + "*" + ruleDetail.getIncomeRatio() + "%)=" + item.getPrice() * ruleDetail.getIncomeRatio() / 10000D);
-//			profit.setPrice((int) (item.getPrice() * ruleDetail.getIncomeRatio() / 100D));
-//			profit.setProfitRuleDetailId(ruleDetail.getId());
-//			profit.setProfitRuleId(ruleDetail.getProfitRuleId());
-//			profit.setAccountId(userRole.getAccountId());
-//			profit.setCreateTime(new Date());
-//			profit.setIsHandle(false);
-//			profit.setOrderCode(item.getOrderCode());
-//			profit.setOrderId(item.getOrderId());
-//			profit.setPaidPrice(item.getPaidPrice());
-//			profit.setStatus(1);
-//			profit.setEntryTime(new Date());
-//			profit.setSynOrderTime(item.getSynOrderTime());
-//			profit.setType(3);
-//			profit.setUpdateTime(new Date());
-//			profit.setUserRoleId(partnerRecommend.getSuperiorId());
-//			profit.setSubordinateCalculationId(item.getId());
-//			calculationProfitService.save(profit);
-//      item.setIsHandle(true);
-//      calculationProfitService.updateById(item);
-
       //医生上级分润
       CalculationProfit calculationProfit= this.createSuperProfit(null, item,  profitRuleDetailList);
       //医生上级的上级分润
@@ -454,9 +398,10 @@ public class SynProfitHandle {
     profit.setUserRoleId(partnerRecommend.getSuperiorId());
     profit.setSubordinateCalculationId(item.getId());
     calculationProfitService.save(profit);
-
     item.setIsHandle(true);
     calculationProfitService.updateById(item);
+    //添加账户收益
+    calculationProfitService.accountProfitOfEntry(profit);
     return profit;
   }
 
@@ -517,6 +462,8 @@ public class SynProfitHandle {
           calculationProfit.setUpdateTime(new Date());
           calculationProfit.setUserRoleId(userRuleId);
           calculationProfitService.save(calculationProfit);
+          //添加账户收益
+          calculationProfitService.accountProfitOfEntry(calculationProfit);
         }
       }
     }

+ 1 - 1
ymall/src/main/java/com/liangjian11/ymall/service/impl/CalculationProfitServiceImpl.java

@@ -249,7 +249,7 @@ public class CalculationProfitServiceImpl extends ServiceImpl<CalculationProfitM
       List<UserAccountProfit> accountProfitList = userAccountProfitMapper.selectList(userAccountProfitQuery);
       UserAccountProfit accountProfit;
       if (accountProfitList == null || accountProfitList.size() == 0) {
-        accountProfit = new UserAccountProfit(userAccount.getId(), (short) 1, DataChangeUtil.ljDecode(userAccount.getMobile()), userAccount.getUnionid());
+        accountProfit = new UserAccountProfit(userAccount.getId(), (short) 1, userAccount.getMobile(), userAccount.getUnionid());
         userAccountProfitMapper.insert(accountProfit);
       }
       accountProfit = accountProfitList.get(0);