Commit 119272e9 authored by hezhen's avatar hezhen

添加订单分账和拥金结算,钱包入账

parent 222ee860
......@@ -41,6 +41,21 @@ public class OrderWaterDTO {
private Integer status;
@ApiModelProperty(value = "店铺id")
private Integer companyId;
@ApiModelProperty(value = "分账id(不用传)")
private Integer acceptId;
@ApiModelProperty(value = "正分账id(不用传)")
private Integer zAcceptId;
@ApiModelProperty(value = "分账金额")
private BigDecimal orderAmount;
@ApiModelProperty(value = "订单商品")
private List<OrderGoodsDTO> goodsDTOList;
......
......@@ -42,6 +42,11 @@ public class AppUserSellingWater implements Serializable {
@ApiModelProperty(value = "身份职位")
private Integer positionId;
@Column(name = "accept_id")
@ApiModelProperty(value = "分账id")
private Integer acceptId;
/**
* 来源用户id
*/
......
......@@ -35,7 +35,7 @@ public class BaseCommissionRatio implements Serializable {
@Column(name = "extract")
@ApiModelProperty(value = "拥金比例")
private BigDecimal extract;
private Integer extract;
@Column(name = "content")
......
package com.github.wxiaoqi.security.admin.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 订单分账表
*
* @author hezhen
* @email 18178966185@163.com
* @date 2020-03-03 13:13:34
*/
@Data
@Table(name = "base_order_accept_detailed")
public class BaseOrderAcceptDetailed implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id")
private Integer id;
@Column(name = "mch_id")
@ApiModelProperty(value = "分账账号")
private Integer mchId;
@Column(name = "order_no")
@ApiModelProperty(value = "分账订单")
private String orderNo;
@Column(name = "order_id")
@ApiModelProperty(value = "订单id")
private Integer orderId;
@Column(name = "user_id")
@ApiModelProperty(value = "来源用户id")
private Integer userId;
@Column(name = "division_type")
@ApiModelProperty(value = "类型 1=>平台抽成;2-上级用户拥金;3-上级商家拥金;4-推荐入驻拥金")
private Integer divisionType;
@Column(name = "division_amount")
@ApiModelProperty(value = "分账金额")
private BigDecimal divisionAmount;
@Column(name = "fee")
@ApiModelProperty(value = "手续费")
private BigDecimal fee;
@Column(name = "order_amount")
@ApiModelProperty(value = "订单金额")
private BigDecimal orderAmount;
@Column(name = "status")
@ApiModelProperty(value = "是否入账:0-未结算;1-已结算")
private Integer status;
@Column(name = "extract")
@ApiModelProperty(value = "抽成比例")
private Integer extract;
@Column(name = "type")
@ApiModelProperty(value = "类型:1-转入;2-退款")
private Integer type;
@Column(name = "add_time")
@ApiModelProperty(value = "下单时间")
private Long addTime;
@Column(name = "status_time")
@ApiModelProperty(value = "结算时间")
private Long statusTime;
}
......@@ -6,8 +6,6 @@ import com.github.wxiaoqi.security.admin.mapper.BaseCommissionRatioMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -22,14 +20,11 @@ public class BaseCommissionRatioBiz extends BaseBiz<BaseCommissionRatioMapper, B
public BigDecimal getExtract(Integer type){
public List<BaseCommissionRatio> getList(){
Example example=new Example(BaseGoodCommission.class);
example.createCriteria().andEqualTo("type", type).andEqualTo("status",1);
List<BaseCommissionRatio> list = mapper.selectByExample(example);
if (list != null && list.size() != 0) {
return list.get(0).getExtract();
}
return BigDecimal.ZERO;
example.createCriteria().andEqualTo("status",1);
return mapper.selectByExample(example);
}
}
\ No newline at end of file
......@@ -201,4 +201,5 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
}
}
}
\ No newline at end of file
......@@ -33,4 +33,5 @@ public interface AppUserSellingWaterMapper extends Mapper<AppUserSellingWater> {
List<AppUserSellingWaterDTO> statisticsStatffSellerWaterByUserIdsAndTime(@Param("userIds") List<Integer> userIds,
@Param("startTime") Long startTime,
@Param("endTime") Long endTime);
List<AppUserSellingWater> getCommisionByOrder(@Param("orderId") Integer orderId);
}
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.BaseOrderAcceptDetailed;
import tk.mybatis.mapper.common.Mapper;
/**
* 订单分账表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-11 14:14:54
*/
public interface BaseOrderAcceptDetailedMapper extends Mapper<BaseOrderAcceptDetailed> {
}
......@@ -175,4 +175,18 @@ FROM
</if> group by user_id) AS `auswd`
on auswd.user_id=auswu.user_id
</select>
<select id="getCommisionByOrder" resultType="com.github.wxiaoqi.security.admin.entity.AppUserSellingWater">
SELECT
r.user_id as userId,
SUM(r.zCommission)-SUM(r.fCommission) as commission,
SUM(r.zCommission) as price
FROM
(
SELECT user_id,commission as zCommission,0 as fCommission,price FROM app_user_selling_water WHERE order_id = #{orderId} and `status`= 0 and waiting = 1
UNION ALL
SELECT user_id,0 as zCommission,commission as fCommission,price FROM app_user_selling_water WHERE order_id = #{orderId} and `status`= 1 and waiting = 1
) r
GROUP BY r.user_id
</select>
</mapper>
\ No newline at end of file
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