|
@@ -54,8 +54,8 @@ public class AdvBudgetServiceImpl implements IAdvBudgetService {
|
|
|
|
|
|
|
|
if(fxsum > 0){
|
|
if(fxsum > 0){
|
|
|
//比例
|
|
//比例
|
|
|
- BigDecimal percent = BigDecimal.valueOf(fxsum).divide(BigDecimal.valueOf(sum), 4, RoundingMode.HALF_UP);
|
|
|
|
|
- Double fxPercent = percent.setScale(5, RoundingMode.HALF_UP).doubleValue();
|
|
|
|
|
|
|
+ BigDecimal percent = BigDecimal.valueOf(fxsum).divide(BigDecimal.valueOf(sum), 20, RoundingMode.HALF_UP);
|
|
|
|
|
+ Double fxPercent = percent.setScale(10, RoundingMode.HALF_UP).doubleValue();
|
|
|
|
|
|
|
|
// 通用广告金金额
|
|
// 通用广告金金额
|
|
|
Integer amountA = (int)(totalAmountA * fxPercent);
|
|
Integer amountA = (int)(totalAmountA * fxPercent);
|
|
@@ -64,36 +64,37 @@ public class AdvBudgetServiceImpl implements IAdvBudgetService {
|
|
|
// 定向激励金额
|
|
// 定向激励金额
|
|
|
Integer amountC = (int)(totalAmountC * fxPercent);
|
|
Integer amountC = (int)(totalAmountC * fxPercent);
|
|
|
|
|
|
|
|
-// System.err.println("小程序周期内总收入:"+sum);
|
|
|
|
|
-// System.err.println("分销商小程序周期内总收入:"+fxsum);
|
|
|
|
|
-// System.err.println("精确比例:"+percent);
|
|
|
|
|
-// System.err.println("四舍五入比例:"+fxPercent);
|
|
|
|
|
-// System.err.println("可用通用广告金金额:"+totalAmountA);
|
|
|
|
|
-// System.err.println("分销商通用广告金金额:"+amountA);
|
|
|
|
|
-// System.err.println("可用广告激励金金额:"+totalAmountB);
|
|
|
|
|
-// System.err.println("分销商广告激励金金额:"+amountB);
|
|
|
|
|
-// System.err.println("可用定向激励金额:"+totalAmountC);
|
|
|
|
|
-// System.err.println("分销商定向激励金额:"+amountC);
|
|
|
|
|
-
|
|
|
|
|
- Map<String, Object> data = new HashMap<>();
|
|
|
|
|
- data.put("appId", appId);
|
|
|
|
|
- data.put("personId", distributorId);
|
|
|
|
|
- data.put("settleBegin", settleBegin);
|
|
|
|
|
- data.put("settleEnd", settleEnd);
|
|
|
|
|
- data.put("fundMoneyA", amountA);
|
|
|
|
|
- data.put("fundMoneyB", amountB);
|
|
|
|
|
- data.put("fundMoneyC", amountC);
|
|
|
|
|
- data.put("expireTime", expireTime);
|
|
|
|
|
- data.put("scale", fxPercent);
|
|
|
|
|
- int rows =advBudgetMapper.replaceAdvBudget(data);
|
|
|
|
|
-// if (rows == 1) {
|
|
|
|
|
-// System.err.println("成功插入新记录");
|
|
|
|
|
-// } else if (rows == 2) {
|
|
|
|
|
-// System.err.println("成功覆盖旧记录");
|
|
|
|
|
-// } else if (rows == 0) {
|
|
|
|
|
-// System.err.println("没有任何变化");
|
|
|
|
|
-// }
|
|
|
|
|
-// System.err.println("----------分割线------------");
|
|
|
|
|
|
|
+ if (amountA > 0 || amountB > 0 || amountC > 0) {
|
|
|
|
|
+ System.err.println("小程序周期内总收入:"+sum);
|
|
|
|
|
+ System.err.println("分销商小程序周期内总收入:"+fxsum);
|
|
|
|
|
+ System.err.println("精确比例:"+percent);
|
|
|
|
|
+ System.err.println("四舍五入比例:"+fxPercent);
|
|
|
|
|
+ System.err.println("可用通用广告金金额:"+totalAmountA);
|
|
|
|
|
+ System.err.println("分销商通用广告金金额:"+amountA);
|
|
|
|
|
+ System.err.println("可用广告激励金金额:"+totalAmountB);
|
|
|
|
|
+ System.err.println("分销商广告激励金金额:"+amountB);
|
|
|
|
|
+ System.err.println("可用定向激励金额:"+totalAmountC);
|
|
|
|
|
+ System.err.println("分销商定向激励金额:"+amountC);
|
|
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
|
|
+ data.put("appId", appId);
|
|
|
|
|
+ data.put("personId", distributorId);
|
|
|
|
|
+ data.put("settleBegin", settleBegin);
|
|
|
|
|
+ data.put("settleEnd", settleEnd);
|
|
|
|
|
+ data.put("fundMoneyA", amountA);
|
|
|
|
|
+ data.put("fundMoneyB", amountB);
|
|
|
|
|
+ data.put("fundMoneyC", amountC);
|
|
|
|
|
+ data.put("expireTime", expireTime);
|
|
|
|
|
+ data.put("scale", fxPercent);
|
|
|
|
|
+ int rows = advBudgetMapper.replaceAdvBudget(data);
|
|
|
|
|
+ if (rows == 1) {
|
|
|
|
|
+ System.err.println("成功插入新记录");
|
|
|
|
|
+ } else if (rows == 2) {
|
|
|
|
|
+ System.err.println("成功覆盖旧记录");
|
|
|
|
|
+ } else if (rows == 0) {
|
|
|
|
|
+ System.err.println("没有任何变化");
|
|
|
|
|
+ }
|
|
|
|
|
+ System.err.println("----------分割线------------");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|