积分相关代码存在多个精度和计算正确性问题:积分发放使用 ROUND_CEILING(进位取整)而非用户要求的四舍五入;多店铺积分分摊使用 double 算术存在浮点精度风险;preAllocatedIntegral 使用 Double 类型不符合积分必须为整数的约束;多店铺分摊中 cap 修正后未回写累计值导致最后一个店铺减法兜底结果错误。
ROUND_CEILING 改为 ROUND_HALF_UP(四舍五入)FsStoreOrderComputedParam.preAllocatedIntegral 类型从 Double 改为 IntegercomputedOrders 中积分分摊计算全部改用 BigDecimal 算术,消除 double 精度风险subDeduction 超限 cap 后未更新 allocatedDeductionSum / allocatedIntegralSum 的 buguser.getIntegral().intValue() 改为 longValue(),totalIntegral 改为 long 类型,避免大值截断totalDeduction 计算改用 BigDecimal.divide 确保精度FsUserIntegralLogsServiceImpl.java、FsStoreOrderScrmServiceImpl.java、FsStoreOrderComputedParam.javacomputedOrder / store.integral 配置)refundIntegral)preAllocatedIntegral 类型变更需同步修改 computedOrders 和 computedOrderMultiStore 中的使用积分发放时,amount × rate 的结果 SHALL 使用 RoundingMode.HALF_UP(四舍五入)取整,不得使用 ROUND_CEILING(进位取整)。
多店铺积分分摊 SHALL 全程使用 BigDecimal 算术,禁止使用 double 中间运算。积分值 SHALL 始终为整数,不得出现小数。
allocatedDeductionSum 和 allocatedIntegralSum,确保最后一个店铺的减法兜底结果正确FsStoreOrderComputedParam.preAllocatedIntegral SHALL 为 Integer 类型,不得使用 Double。
读取用户积分余额时 SHALL 使用 longValue(),不得使用 intValue() 以防大值截断。