Commit ad067d0a authored by hezhen's avatar hezhen

123

parent fec5ddec
...@@ -32,6 +32,9 @@ public class UserCommentVo extends UserComment { ...@@ -32,6 +32,9 @@ public class UserCommentVo extends UserComment {
@ApiModelProperty("用户名称") @ApiModelProperty("用户名称")
private String toUserName; private String toUserName;
@ApiModelProperty("to用户头像")
private String toHeadimgurl;
private PageDataVO<UserCommentVo> childer; private PageDataVO<UserCommentVo> childer;
......
...@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.pojo.dto.order.VMCalendarPriceCostDTO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -84,7 +85,7 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM ...@@ -84,7 +85,7 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM
} }
} }
//购买计算用户拥金 //下单分账
public void payOrderAccept(OrderWaterDTO orderWaterDTO) { public void payOrderAccept(OrderWaterDTO orderWaterDTO) {
//订单id //订单id
Integer orderId = orderWaterDTO.getOrderId() == null ? 0 : orderWaterDTO.getOrderId(); Integer orderId = orderWaterDTO.getOrderId() == null ? 0 : orderWaterDTO.getOrderId();
...@@ -104,8 +105,19 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM ...@@ -104,8 +105,19 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM
List<BaseCommissionRatio> baseCommissionRatios = commissionRatioBiz.getList(); List<BaseCommissionRatio> baseCommissionRatios = commissionRatioBiz.getList();
BigDecimal amount=BigDecimal.ZERO; BigDecimal amount=BigDecimal.ZERO;
BigDecimal companyDivisionAmount=orderAmount;
if (baseCommissionRatios.size() > 0){ if (baseCommissionRatios.size() > 0){
//先计算分给店铺
BigDecimal companyExtrac = baseCommissionRatios.stream().map(BaseCommissionRatio::getExtract).reduce(BigDecimal.ZERO,BigDecimal::add);
companyExtrac = new BigDecimal(100).subtract(companyExtrac);
//店铺金额
companyDivisionAmount=orderAmount.multiply(companyExtrac).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
//其他金额
BigDecimal otherDivisionAmount=orderAmount.subtract(companyDivisionAmount);
Integer num = 0;
for (BaseCommissionRatio commissionRatio:baseCommissionRatios){ for (BaseCommissionRatio commissionRatio:baseCommissionRatios){
num++;
Integer type = commissionRatio.getType() == null ? 0 : commissionRatio.getType(); Integer type = commissionRatio.getType() == null ? 0 : commissionRatio.getType();
Integer mchId=0; Integer mchId=0;
Integer divisionType=0; Integer divisionType=0;
...@@ -131,7 +143,12 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM ...@@ -131,7 +143,12 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM
if (type != 3 && mchId == 0){ if (type != 3 && mchId == 0){
continue; continue;
} }
BigDecimal divisionAmount=orderAmount.multiply(commissionRatio.getExtract()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP); BigDecimal divisionAmount ;
if (num.equals(baseCommissionRatios.size())){
divisionAmount=otherDivisionAmount.subtract(amount);
}else {
divisionAmount=otherDivisionAmount.multiply(commissionRatio.getExtract()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
}
BaseOrderAcceptDetailed acceptDetailed=new BaseOrderAcceptDetailed(); BaseOrderAcceptDetailed acceptDetailed=new BaseOrderAcceptDetailed();
BeanUtils.copyProperties(orderWaterDTO,acceptDetailed); BeanUtils.copyProperties(orderWaterDTO,acceptDetailed);
acceptDetailed.setMchId(mchId); acceptDetailed.setMchId(mchId);
...@@ -147,18 +164,18 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM ...@@ -147,18 +164,18 @@ public class BaseOrderAcceptDetailedBiz extends BaseBiz<BaseOrderAcceptDetailedM
sellingWaterBiz.payOrderWater(orderWaterDTO); sellingWaterBiz.payOrderWater(orderWaterDTO);
} }
} }
if (orderAmount.compareTo(amount) > 0){
BigDecimal divisionAmount=orderAmount.subtract(amount).setScale(2, BigDecimal.ROUND_HALF_UP); //店铺分账
BaseOrderAcceptDetailed acceptDetailed=new BaseOrderAcceptDetailed(); BaseOrderAcceptDetailed acceptDetailed=new BaseOrderAcceptDetailed();
BeanUtils.copyProperties(orderWaterDTO,acceptDetailed); BeanUtils.copyProperties(orderWaterDTO,acceptDetailed);
acceptDetailed.setMchId(companyId); acceptDetailed.setMchId(companyId);
acceptDetailed.setOrderAmount(orderAmount); acceptDetailed.setOrderAmount(orderAmount);
acceptDetailed.setDivisionAmount(divisionAmount); acceptDetailed.setDivisionAmount(companyDivisionAmount);
acceptDetailed.setDivisionType(5); acceptDetailed.setDivisionType(5);
acceptDetailed.setAddTime(System.currentTimeMillis()); acceptDetailed.setAddTime(System.currentTimeMillis());
acceptDetailed.setStatus(0); acceptDetailed.setStatus(0);
insertSelective(acceptDetailed); insertSelective(acceptDetailed);
}
} }
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
SELECT SELECT
c.*, c.*,
IFNULL(d1.realname,d1.nickname) as userName, IFNULL(d1.realname,d1.nickname) as userName,
d1.headimgurl as headimgurl,
IFNULL(d2.realname,d2.nickname) as toUserName, IFNULL(d2.realname,d2.nickname) as toUserName,
d2.headimgurl as toHeadimgurl,
b.`name`as companyName b.`name`as companyName
FROM user_comment c FROM user_comment c
LEFT JOIN app_user_detail d1 ON c.user_id=d1.userid LEFT JOIN app_user_detail d1 ON c.user_id=d1.userid
......
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