Commit 79652939 authored by hezhen's avatar hezhen

123

parent ed01f730
......@@ -28,7 +28,7 @@ public class AppUserPositionBiz extends BaseBiz<AppUserPositionMapper,AppUserPos
//获取用户职位的折扣
public Integer getExtract(Integer userId){
public AppUserPosition getExtract(Integer userId){
return mapper.getExtractByUserId(userId);
}
......
......@@ -103,6 +103,21 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
Integer parentId = relation.getParentId();
log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---parentId===" + parentId);
Integer positionId = 6;
Integer level = 0;
AppUserPosition position=positionBiz.getExtract(parentId);
if (position!=null){
positionId=position.getId();
}
AppUserPosition position1=positionBiz.getExtract(userId);
if (position!=null){
level=position1.getLevel();
}
log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---positionId===" + positionId+"---level==="+level);
if(level!=0){
log.info("购买计算用户拥金----payOrderWater--------userId===" + userId +"----无法享受拥金");
return;
}
BigDecimal amount = new BigDecimal("0.00");
//商品类型
Integer orderType=0;
......@@ -115,13 +130,9 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
orderType = goodsDto.getType();
//商品比例
Integer extract = commissionBiz.getExtract(orderType, goodId);
AppUserVo userVo = detailBiz.getUserInfoById(parentId);
Integer positionId = 6;
if (userVo != null) {
positionId = userVo.getPositionId();
}
if (extract == null || extract == 0) {
extract = positionBiz.getExtract(parentId);
extract = position.getExtract();
}
log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---extract===" + extract);
if (extract != null && extract > 0) {
......@@ -184,23 +195,25 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
log.info("订单完成计算用户拥金----finishOrderWater----id====" + id + "---commission==" + commission+"----orderType==="+orderType);
amount = amount.add(commission);
}
}
log.info("订单完成计算用户拥金----finishOrderWater----orderId====" + orderId + "---amount==" + amount);
int r = amount.compareTo(BigDecimal.ZERO);
//更新钱包
if (r == 1 && userId > 0) {
MyWalletDetail detail=new MyWalletDetail();
detail.setUserId(userId);
detail.setAmount(amount);
detail.setCono(orderId);
detail.setSource(1);
myWaterBiz.updMyWater(detail);
if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(userId,amount,2);
}
log.info("订单完成计算用户拥金----finishOrderWater----orderId====" + orderId + "---amount==" + amount);
int r = amount.compareTo(BigDecimal.ZERO);
//更新钱包
if (r == 1 && userId > 0) {
MyWalletDetail detail=new MyWalletDetail();
detail.setUserId(userId);
detail.setAmount(amount);
detail.setCono(orderId);
detail.setSource(1);
myWaterBiz.updMyWater(detail);
if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(userId,amount,2);
}
}
}
}
//订单退款计算用户拥金
......@@ -230,20 +243,20 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
log.info("订单完成计算用户拥金----refundOrderWater----id====" + id + "---commission==" + commission+"---orderType===="+orderType);
unbooked=unbooked.add(commission);
}
}
log.info("订单完成计算用户拥金----refundOrderWater----orderId====" + orderId + "---amount==" + amount+"---unbooked==="+unbooked);
int r = amount.compareTo(BigDecimal.ZERO);
//更新钱包
if (r == 1 && userId > 0) {
MyWalletDetail detail=new MyWalletDetail();
detail.setUserId(userId);
detail.setAmount(amount);
detail.setCono(orderId);
detail.setSource(1);
myWaterBiz.updMyWater(detail);
}
if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(userId,unbooked,2);
log.info("订单完成计算用户拥金----refundOrderWater----orderId====" + orderId + "---amount==" + amount+"---unbooked==="+unbooked);
int r = amount.compareTo(BigDecimal.ZERO);
//更新钱包
if (r == 1 && userId > 0) {
MyWalletDetail detail=new MyWalletDetail();
detail.setUserId(userId);
detail.setAmount(amount);
detail.setCono(orderId);
detail.setSource(1);
myWaterBiz.updMyWater(detail);
}
if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(userId,unbooked,2);
}
}
}
......
......@@ -113,7 +113,8 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
//钱包未入账的处理type1-进;2-出
public void updMyWalletUnbooked(Integer userId,BigDecimal amount,Integer type){
log.info("---钱包未入账的处理updMyWalletUnbooked----userId==="+userId+"----type==="+type);
log.info("---钱包未入账的处理updMyWalletUnbooked----userId==="+userId+"----type==="+type+"---amount==="+amount);
MyWallet wallet=new MyWallet();
wallet.setUserId(userId);
wallet=selectOne(wallet);
......
......@@ -17,6 +17,6 @@ import java.util.List;
public interface AppUserPositionMapper extends Mapper<AppUserPosition> {
Integer getExtractByUserId(@Param("userId")Integer userId);
AppUserPosition getExtractByUserId(@Param("userId")Integer userId);
}
......@@ -16,7 +16,7 @@
<result property="isDel" column="is_del"/>
</resultMap>
<select id="getExtractByUserId" resultType="Integer">
<select id="getExtractByUserId" resultMap="appUserPositionMap">
SELECT p.extract FROM app_user_detail d LEFT JOIN app_user_position p
ON d.position_id=p.id
WHERE d.userid=#{userId} LIMIT 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment