Authored by TANLING

fix bug

... ... @@ -40,8 +40,8 @@
<select id="selectEarnestMoneyByUid" resultType="com.yohoufo.dal.order.model.SellerEarnestStatistics">
select
sum(case when sog.attributes in (1,5,6) then sog.goods_price*0.04
when sog.attributes=4 then sog.goods_price*0.08
sum(case when sog.attributes in (1,5,6) then (<![CDATA[ case when sog.goods_price*0.04>200 then 200 when sog.goods_price*0.04<28 then 28 else sog.goods_price*0.04 end ]]>)
when sog.attributes=4 then (<![CDATA[ case when sog.goods_price*0.08>400 then 400 when sog.goods_price*0.08<40 then 40 else sog.goods_price*0.08 end ]]> )
end) earnestTotal, sog.uid, sw.amount leftMoney
from seller_order_goods sog, seller_wallet sw
where sog.uid=sw.uid and sog.status=1
... ...
... ... @@ -518,11 +518,17 @@ public class StoreSellerServiceImpl implements IStoredSellerService {
|| good.getAttributes() == OrderAttributes.FLAW.getCode()
|| good.getAttributes() == OrderAttributes.SECOND_HAND.getCode()){
rate = 0.04;
earnest = YHMath.add(earnest, YHMath.mul(good.getGoodsPrice().doubleValue(), rate));
earnest = redefinedEarnest(earnest, 200, 28);
}else if(good.getAttributes() == OrderAttributes.ADVANCE_SALE.getCode()){
rate = 0.08;
}
earnest = YHMath.add(earnest, YHMath.mul(good.getGoodsPrice().doubleValue(), rate));
earnest = YHMath.add(earnest, YHMath.mul(good.getGoodsPrice().doubleValue(), rate));
earnest = redefinedEarnest(earnest, 400, 40);
}
skup.add(good.getId());
// 一旦金额达到 指定的金额, 则不需要继续查找skup
... ... @@ -536,4 +542,15 @@ public class StoreSellerServiceImpl implements IStoredSellerService {
return Pair.of(skup, earnest);
}
public double redefinedEarnest(double earnest, double max, double min){
if (earnest>max){
return max;
}else if(earnest<min){
return min;
}else{
return earnest;
}
}
}
... ...