Commit ac94eea4 authored by shiyu's avatar shiyu

计算平台佣金的新逻辑

parent c18c027e
package com.wwdz.ch.core.consts;
/**
* 账单类的枚举
*/
public class BillEnum {
/**
* 用户账户明细的状态
*/
public enum AccountDetailStateEnum {
ENTRY(1, "已入账"),
WAIT_ENTRY(0, "待入账"),
INVALID(-1, "无效"),
;
private int code;
private String des;
AccountDetailStateEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (BillEnum.AccountDetailStateEnum accountDetailStateEnum : BillEnum.AccountDetailStateEnum.values()) {
if (code == accountDetailStateEnum.getCode()) {
return accountDetailStateEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
/**
* 用户账户明细的类型
*/
public enum AccountDetailTypeEnum {
ORDER(1, "订单收入"),
CHANNEL(2, "平台佣金"),
INTRODUCE(3, "介绍佣金"),
;
private int code;
private String des;
AccountDetailTypeEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (BillEnum.AccountDetailTypeEnum accountDetailTypeEnum : BillEnum.AccountDetailTypeEnum.values()) {
if (code == accountDetailTypeEnum.getCode()) {
return accountDetailTypeEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
/**
* 用户账户明细收支类型
*/
public enum FundTypeEnum {
INCOME(1, "收入"),
EXPENDITURE(-1, "支出"),
;
private int code;
private String des;
FundTypeEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (BillEnum.FundTypeEnum fundTypeEnum : BillEnum.FundTypeEnum.values()) {
if (code == fundTypeEnum.getCode()) {
return fundTypeEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
}
package com.wwdz.ch.core.consts; package com.wwdz.ch.core.consts;
import tk.mybatis.spring.mapper.SpringBootBindUtil;
import java.math.BigDecimal;
/** /**
* 一些常用的参数定义 * 一些常用的参数定义
* *
...@@ -84,4 +88,9 @@ public interface CommConsts { ...@@ -84,4 +88,9 @@ public interface CommConsts {
* 消息跳转专场拍品详情 * 消息跳转专场拍品详情
*/ */
public final static String ITEM_OF_SPECIAL_PERFORMANCE_URL = "/pages/saleAuctionDetail/index"; public final static String ITEM_OF_SPECIAL_PERFORMANCE_URL = "/pages/saleAuctionDetail/index";
/**
* 微信手续费,按照最高的1%计算
*/
public final static double WX_COMMISSION_REBATE = 0.01;
} }
...@@ -4,16 +4,14 @@ import java.io.Serializable; ...@@ -4,16 +4,14 @@ import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import com.xxdxxs.entity.Entity;
import lombok.Data; import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2024/05/14 * @date 2024/07/10
*/ */
@Data @Data
public class DistributorProfit implements Entity { public class DistributorProfit implements Serializable {
private Long id; private Long id;
/** /**
...@@ -41,6 +39,11 @@ public class DistributorProfit implements Entity { ...@@ -41,6 +39,11 @@ public class DistributorProfit implements Entity {
*/ */
private Long amount; private Long amount;
/**
* 实际到账金额
*/
private Long realAmount;
/** /**
* 商品成本,供货价 * 商品成本,供货价
*/ */
...@@ -90,6 +93,7 @@ public class DistributorProfit implements Entity { ...@@ -90,6 +93,7 @@ public class DistributorProfit implements Entity {
sb.append(", itemId=").append(itemId); sb.append(", itemId=").append(itemId);
sb.append(", itemNum=").append(itemNum); sb.append(", itemNum=").append(itemNum);
sb.append(", amount=").append(amount); sb.append(", amount=").append(amount);
sb.append(", realAmount=").append(realAmount);
sb.append(", itemCost=").append(itemCost); sb.append(", itemCost=").append(itemCost);
sb.append(", channelCost=").append(channelCost); sb.append(", channelCost=").append(channelCost);
sb.append(", introduceCost=").append(introduceCost); sb.append(", introduceCost=").append(introduceCost);
...@@ -120,6 +124,7 @@ public class DistributorProfit implements Entity { ...@@ -120,6 +124,7 @@ public class DistributorProfit implements Entity {
&& (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId())) && (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId()))
&& (this.getItemNum() == null ? other.getItemNum() == null : this.getItemNum().equals(other.getItemNum())) && (this.getItemNum() == null ? other.getItemNum() == null : this.getItemNum().equals(other.getItemNum()))
&& (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount())) && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
&& (this.getRealAmount() == null ? other.getRealAmount() == null : this.getRealAmount().equals(other.getRealAmount()))
&& (this.getItemCost() == null ? other.getItemCost() == null : this.getItemCost().equals(other.getItemCost())) && (this.getItemCost() == null ? other.getItemCost() == null : this.getItemCost().equals(other.getItemCost()))
&& (this.getChannelCost() == null ? other.getChannelCost() == null : this.getChannelCost().equals(other.getChannelCost())) && (this.getChannelCost() == null ? other.getChannelCost() == null : this.getChannelCost().equals(other.getChannelCost()))
&& (this.getIntroduceCost() == null ? other.getIntroduceCost() == null : this.getIntroduceCost().equals(other.getIntroduceCost())) && (this.getIntroduceCost() == null ? other.getIntroduceCost() == null : this.getIntroduceCost().equals(other.getIntroduceCost()))
...@@ -139,6 +144,7 @@ public class DistributorProfit implements Entity { ...@@ -139,6 +144,7 @@ public class DistributorProfit implements Entity {
result = prime * result + ((getItemId() == null) ? 0 : getItemId().hashCode()); result = prime * result + ((getItemId() == null) ? 0 : getItemId().hashCode());
result = prime * result + ((getItemNum() == null) ? 0 : getItemNum().hashCode()); result = prime * result + ((getItemNum() == null) ? 0 : getItemNum().hashCode());
result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode()); result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
result = prime * result + ((getRealAmount() == null) ? 0 : getRealAmount().hashCode());
result = prime * result + ((getItemCost() == null) ? 0 : getItemCost().hashCode()); result = prime * result + ((getItemCost() == null) ? 0 : getItemCost().hashCode());
result = prime * result + ((getChannelCost() == null) ? 0 : getChannelCost().hashCode()); result = prime * result + ((getChannelCost() == null) ? 0 : getChannelCost().hashCode());
result = prime * result + ((getIntroduceCost() == null) ? 0 : getIntroduceCost().hashCode()); result = prime * result + ((getIntroduceCost() == null) ? 0 : getIntroduceCost().hashCode());
...@@ -163,6 +169,7 @@ public class DistributorProfit implements Entity { ...@@ -163,6 +169,7 @@ public class DistributorProfit implements Entity {
itemId("item_id", "itemId", "BIGINT", false), itemId("item_id", "itemId", "BIGINT", false),
itemNum("item_num", "itemNum", "INTEGER", false), itemNum("item_num", "itemNum", "INTEGER", false),
amount("amount", "amount", "BIGINT", false), amount("amount", "amount", "BIGINT", false),
realAmount("real_amount", "realAmount", "BIGINT", false),
itemCost("item_cost", "itemCost", "BIGINT", false), itemCost("item_cost", "itemCost", "BIGINT", false),
channelCost("channel_cost", "channelCost", "BIGINT", false), channelCost("channel_cost", "channelCost", "BIGINT", false),
introduceCost("introduce_cost", "introduceCost", "BIGINT", false), introduceCost("introduce_cost", "introduceCost", "BIGINT", false),
......
...@@ -950,6 +950,138 @@ public class DistributorProfitExample { ...@@ -950,6 +950,138 @@ public class DistributorProfitExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRealAmountIsNull() {
addCriterion("real_amount is null");
return (Criteria) this;
}
public Criteria andRealAmountIsNotNull() {
addCriterion("real_amount is not null");
return (Criteria) this;
}
public Criteria andRealAmountEqualTo(Long value) {
addCriterion("real_amount =", value, "realAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealAmountEqualToColumn(DistributorProfit.Column column) {
addCriterion(new StringBuilder("real_amount = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealAmountNotEqualTo(Long value) {
addCriterion("real_amount <>", value, "realAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealAmountNotEqualToColumn(DistributorProfit.Column column) {
addCriterion(new StringBuilder("real_amount <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealAmountGreaterThan(Long value) {
addCriterion("real_amount >", value, "realAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealAmountGreaterThanColumn(DistributorProfit.Column column) {
addCriterion(new StringBuilder("real_amount > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealAmountGreaterThanOrEqualTo(Long value) {
addCriterion("real_amount >=", value, "realAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealAmountGreaterThanOrEqualToColumn(DistributorProfit.Column column) {
addCriterion(new StringBuilder("real_amount >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealAmountLessThan(Long value) {
addCriterion("real_amount <", value, "realAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealAmountLessThanColumn(DistributorProfit.Column column) {
addCriterion(new StringBuilder("real_amount < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealAmountLessThanOrEqualTo(Long value) {
addCriterion("real_amount <=", value, "realAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_profit
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealAmountLessThanOrEqualToColumn(DistributorProfit.Column column) {
addCriterion(new StringBuilder("real_amount <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealAmountIn(List<Long> values) {
addCriterion("real_amount in", values, "realAmount");
return (Criteria) this;
}
public Criteria andRealAmountNotIn(List<Long> values) {
addCriterion("real_amount not in", values, "realAmount");
return (Criteria) this;
}
public Criteria andRealAmountBetween(Long value1, Long value2) {
addCriterion("real_amount between", value1, value2, "realAmount");
return (Criteria) this;
}
public Criteria andRealAmountNotBetween(Long value1, Long value2) {
addCriterion("real_amount not between", value1, value2, "realAmount");
return (Criteria) this;
}
public Criteria andItemCostIsNull() { public Criteria andItemCostIsNull() {
addCriterion("item_cost is null"); addCriterion("item_cost is null");
return (Criteria) this; return (Criteria) this;
......
...@@ -10,7 +10,7 @@ import lombok.Data; ...@@ -10,7 +10,7 @@ import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2024/07/08 * @date 2024/07/10
*/ */
@Data @Data
public class UserAccountDetail implements Entity { public class UserAccountDetail implements Entity {
...@@ -22,9 +22,14 @@ public class UserAccountDetail implements Entity { ...@@ -22,9 +22,14 @@ public class UserAccountDetail implements Entity {
private Long userId; private Long userId;
/** /**
* 订单id * 交易id
*/ */
private String orderId; private String transactionId;
/**
* 金额
*/
private Long amount;
/** /**
* 收入或支出的类型 * 收入或支出的类型
...@@ -37,12 +42,12 @@ public class UserAccountDetail implements Entity { ...@@ -37,12 +42,12 @@ public class UserAccountDetail implements Entity {
private Integer fundType; private Integer fundType;
/** /**
* 状态 * 状态:待入账;已入账;无效
*/ */
private Integer state; private Integer state;
/** /**
* 创建时间 * 创建时间(订单创建时间)
*/ */
private Date createTime; private Date createTime;
...@@ -61,7 +66,8 @@ public class UserAccountDetail implements Entity { ...@@ -61,7 +66,8 @@ public class UserAccountDetail implements Entity {
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", userId=").append(userId); sb.append(", userId=").append(userId);
sb.append(", orderId=").append(orderId); sb.append(", transactionId=").append(transactionId);
sb.append(", amount=").append(amount);
sb.append(", type=").append(type); sb.append(", type=").append(type);
sb.append(", fundType=").append(fundType); sb.append(", fundType=").append(fundType);
sb.append(", state=").append(state); sb.append(", state=").append(state);
...@@ -86,7 +92,8 @@ public class UserAccountDetail implements Entity { ...@@ -86,7 +92,8 @@ public class UserAccountDetail implements Entity {
UserAccountDetail other = (UserAccountDetail) that; UserAccountDetail other = (UserAccountDetail) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId())) && (this.getTransactionId() == null ? other.getTransactionId() == null : this.getTransactionId().equals(other.getTransactionId()))
&& (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getFundType() == null ? other.getFundType() == null : this.getFundType().equals(other.getFundType())) && (this.getFundType() == null ? other.getFundType() == null : this.getFundType().equals(other.getFundType()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState())) && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
...@@ -100,7 +107,8 @@ public class UserAccountDetail implements Entity { ...@@ -100,7 +107,8 @@ public class UserAccountDetail implements Entity {
int result = 1; int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode()); result = prime * result + ((getTransactionId() == null) ? 0 : getTransactionId().hashCode());
result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getFundType() == null) ? 0 : getFundType().hashCode()); result = prime * result + ((getFundType() == null) ? 0 : getFundType().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode()); result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
...@@ -119,7 +127,8 @@ public class UserAccountDetail implements Entity { ...@@ -119,7 +127,8 @@ public class UserAccountDetail implements Entity {
public enum Column { public enum Column {
id("id", "id", "BIGINT", false), id("id", "id", "BIGINT", false),
userId("user_id", "userId", "BIGINT", false), userId("user_id", "userId", "BIGINT", false),
orderId("order_id", "orderId", "VARCHAR", false), transactionId("transaction_id", "transactionId", "VARCHAR", false),
amount("amount", "amount", "BIGINT", false),
type("type", "type", "INTEGER", true), type("type", "type", "INTEGER", true),
fundType("fund_type", "fundType", "INTEGER", false), fundType("fund_type", "fundType", "INTEGER", false),
state("state", "state", "INTEGER", true), state("state", "state", "INTEGER", true),
......
...@@ -36,6 +36,12 @@ public class DistributorProfitRequestDto implements Entity { ...@@ -36,6 +36,12 @@ public class DistributorProfitRequestDto implements Entity {
*/ */
private Long amount; private Long amount;
/**
* 实际金额
* 要扣除微信的手续费
*/
private Long realAmount;
/** /**
* 商品成本,供货价 * 商品成本,供货价
*/ */
......
...@@ -17,19 +17,25 @@ public class UserAccountDetailRequestDto extends BaseRequestDto implements Entit ...@@ -17,19 +17,25 @@ public class UserAccountDetailRequestDto extends BaseRequestDto implements Entit
private Long userId; private Long userId;
/** /**
* 订单id * 交易id
* 可以是订单号,也可以是转账记录id
*/ */
private String orderId; private String transactionId;
/** /**
* 批量查询订单id * 金额
*/ */
private List<String> orderIdList; private Long amount;
/** /**
* 查询时需要排除的订单id * 批量查询交易id
*/ */
private List<String> filterOrderIdList; private List<String> transactionIdList;
/**
* 查询时需要排除的交易id
*/
private List<String> filterTransactionIdList;
/** /**
* 收入或支出的类型 * 收入或支出的类型
......
package com.wwdz.ch.db.dto.request.distribution;
import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class UserBillRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 账单id
*/
private String billId;
/**
* 账期
*/
private String accountPeriod;
/**
* 用户id
*/
private Long userId;
/**
* 总入账金额
*/
private Long totalEntryAmount;
/**
* 总待入账金额
*/
private Long totalWaitEntryAmount;
/**
* 订单入账金额
*/
private Long orderEntryAmount;
/**
* 订单待入账金额
*/
private Long orderWaitEntryAmount;
/**
* 介绍佣金入账金额
*/
private Long introduceEntryAmount;
/**
* 介绍佣金待入账金额
*/
private Long introduceWaitEntryAmount;
/**
* 状态
*/
private Integer state;
}
...@@ -21,7 +21,6 @@ public class UserAccountDetailDaoImpl implements UserAccountDetailDao { ...@@ -21,7 +21,6 @@ public class UserAccountDetailDaoImpl implements UserAccountDetailDao {
@Override @Override
public boolean insert(UserAccountDetail userAccountDetail) { public boolean insert(UserAccountDetail userAccountDetail) {
userAccountDetail.setCreateTime(new Date());
userAccountDetail.setUpdateTime(new Date()); userAccountDetail.setUpdateTime(new Date());
return userAccountDetailMapper.insert(userAccountDetail) > 0; return userAccountDetailMapper.insert(userAccountDetail) > 0;
} }
...@@ -31,7 +30,7 @@ public class UserAccountDetailDaoImpl implements UserAccountDetailDao { ...@@ -31,7 +30,7 @@ public class UserAccountDetailDaoImpl implements UserAccountDetailDao {
UserAccountDetailExample example = new UserAccountDetailExample(); UserAccountDetailExample example = new UserAccountDetailExample();
UserAccountDetailExample.Criteria criteria = example.createCriteria(); UserAccountDetailExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(userAccountDetail.getUserId(), criteria::andUserIdEqualTo); JdbcHelper.ifPresent(userAccountDetail.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(userAccountDetail.getOrderId(), criteria::andOrderIdEqualTo); JdbcHelper.ifPresent(userAccountDetail.getTransactionId(), criteria::andTransactionIdEqualTo);
userAccountDetail.setUpdateTime(new Date()); userAccountDetail.setUpdateTime(new Date());
return userAccountDetailMapper.updateByExampleSelective(userAccountDetail, example) > 0; return userAccountDetailMapper.updateByExampleSelective(userAccountDetail, example) > 0;
} }
...@@ -42,9 +41,9 @@ public class UserAccountDetailDaoImpl implements UserAccountDetailDao { ...@@ -42,9 +41,9 @@ public class UserAccountDetailDaoImpl implements UserAccountDetailDao {
UserAccountDetailExample example = new UserAccountDetailExample(); UserAccountDetailExample example = new UserAccountDetailExample();
UserAccountDetailExample.Criteria criteria = example.createCriteria(); UserAccountDetailExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo); JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getOrderId(), criteria::andOrderIdEqualTo); JdbcHelper.ifPresent(dto.getTransactionId(), criteria::andTransactionIdEqualTo);
JdbcHelper.ifPresent(dto.getOrderIdList(), criteria::andOrderIdIn); JdbcHelper.ifPresent(dto.getTransactionIdList(), criteria::andTransactionIdIn);
JdbcHelper.ifPresent(dto.getFilterOrderIdList(), criteria::andOrderIdNotIn); JdbcHelper.ifPresent(dto.getFilterTransactionIdList(), criteria::andTransactionIdNotIn);
JdbcHelper.ifPresent(dto.getState(), criteria::andStateEqualTo); JdbcHelper.ifPresent(dto.getState(), criteria::andStateEqualTo);
JdbcHelper.ifPresent(dto.getType(), criteria::andTypeEqualTo); JdbcHelper.ifPresent(dto.getType(), criteria::andTypeEqualTo);
JdbcHelper.ifPresent(dto.getFundType(), criteria::andFundTypeEqualTo); JdbcHelper.ifPresent(dto.getFundType(), criteria::andFundTypeEqualTo);
......
package com.wwdz.ch.db.mapper.distribution;
import com.wwdz.ch.db.domain.distribution.UserBill;
import com.wwdz.ch.db.domain.distribution.UserBillExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface UserBillMapper {
long countByExample(UserBillExample example);
int deleteByExample(UserBillExample example);
int deleteByPrimaryKey(Integer id);
int insert(UserBill record);
int insertSelective(UserBill record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_bill
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserBill selectOneByExample(UserBillExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_bill
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserBill selectOneByExampleSelective(@Param("example") UserBillExample example, @Param("selective") UserBill.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_bill
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<UserBill> selectByExampleSelective(@Param("example") UserBillExample example, @Param("selective") UserBill.Column ... selective);
List<UserBill> selectByExample(UserBillExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_bill
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserBill selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") UserBill.Column ... selective);
UserBill selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") UserBill record, @Param("example") UserBillExample example);
int updateByExample(@Param("record") UserBill record, @Param("example") UserBillExample example);
int updateByPrimaryKeySelective(UserBill record);
int updateByPrimaryKey(UserBill record);
}
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<result column="item_id" jdbcType="BIGINT" property="itemId" /> <result column="item_id" jdbcType="BIGINT" property="itemId" />
<result column="item_num" jdbcType="INTEGER" property="itemNum" /> <result column="item_num" jdbcType="INTEGER" property="itemNum" />
<result column="amount" jdbcType="BIGINT" property="amount" /> <result column="amount" jdbcType="BIGINT" property="amount" />
<result column="real_amount" jdbcType="BIGINT" property="realAmount" />
<result column="item_cost" jdbcType="BIGINT" property="itemCost" /> <result column="item_cost" jdbcType="BIGINT" property="itemCost" />
<result column="channel_cost" jdbcType="BIGINT" property="channelCost" /> <result column="channel_cost" jdbcType="BIGINT" property="channelCost" />
<result column="introduce_cost" jdbcType="BIGINT" property="introduceCost" /> <result column="introduce_cost" jdbcType="BIGINT" property="introduceCost" />
...@@ -16,7 +17,6 @@ ...@@ -16,7 +17,6 @@
<result column="type" jdbcType="INTEGER" property="type" /> <result column="type" jdbcType="INTEGER" property="type" />
<result column="is_valid" jdbcType="BIT" property="isValid" /> <result column="is_valid" jdbcType="BIT" property="isValid" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
<foreach collection="oredCriteria" item="criteria" separator="or"> <foreach collection="oredCriteria" item="criteria" separator="or">
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, distribution_order_id, distributor_id, item_id, item_num, amount, item_cost, id, distribution_order_id, distributor_id, item_id, item_num, amount, real_amount,
channel_cost, introduce_cost, profit, create_time, `type`, is_valid item_cost, channel_cost, introduce_cost, profit, create_time, `type`, is_valid
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributorProfitExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributorProfitExample" resultMap="BaseResultMap">
select select
...@@ -112,8 +112,8 @@ ...@@ -112,8 +112,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, distribution_order_id, distributor_id, item_id, item_num, amount, item_cost, id, distribution_order_id, distributor_id, item_id, item_num, amount, real_amount,
channel_cost, introduce_cost, profit, create_time, `type`, is_valid item_cost, channel_cost, introduce_cost, profit, create_time, `type`, is_valid
</otherwise> </otherwise>
</choose> </choose>
from distributor_profit from distributor_profit
...@@ -144,8 +144,8 @@ ...@@ -144,8 +144,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, distribution_order_id, distributor_id, item_id, item_num, amount, item_cost, id, distribution_order_id, distributor_id, item_id, item_num, amount, real_amount,
channel_cost, introduce_cost, profit, create_time, `type`, is_valid item_cost, channel_cost, introduce_cost, profit, create_time, `type`, is_valid
</otherwise> </otherwise>
</choose> </choose>
from distributor_profit from distributor_profit
...@@ -167,14 +167,14 @@ ...@@ -167,14 +167,14 @@
</selectKey> </selectKey>
insert into distributor_profit (distribution_order_id, distributor_id, insert into distributor_profit (distribution_order_id, distributor_id,
item_id, item_num, amount, item_id, item_num, amount,
item_cost, channel_cost, introduce_cost, real_amount, item_cost, channel_cost,
profit, create_time, `type`, introduce_cost, profit, create_time,
is_valid) `type`, is_valid)
values (#{distributionOrderId,jdbcType=VARCHAR}, #{distributorId,jdbcType=BIGINT}, values (#{distributionOrderId,jdbcType=VARCHAR}, #{distributorId,jdbcType=BIGINT},
#{itemId,jdbcType=BIGINT}, #{itemNum,jdbcType=INTEGER}, #{amount,jdbcType=BIGINT}, #{itemId,jdbcType=BIGINT}, #{itemNum,jdbcType=INTEGER}, #{amount,jdbcType=BIGINT},
#{itemCost,jdbcType=BIGINT}, #{channelCost,jdbcType=BIGINT}, #{introduceCost,jdbcType=BIGINT}, #{realAmount,jdbcType=BIGINT}, #{itemCost,jdbcType=BIGINT}, #{channelCost,jdbcType=BIGINT},
#{profit,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=INTEGER}, #{introduceCost,jdbcType=BIGINT}, #{profit,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{isValid,jdbcType=BIT}) #{type,jdbcType=INTEGER}, #{isValid,jdbcType=BIT})
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.DistributorProfit"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.DistributorProfit">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
...@@ -197,6 +197,9 @@ ...@@ -197,6 +197,9 @@
<if test="amount != null"> <if test="amount != null">
amount, amount,
</if> </if>
<if test="realAmount != null">
real_amount,
</if>
<if test="itemCost != null"> <if test="itemCost != null">
item_cost, item_cost,
</if> </if>
...@@ -235,6 +238,9 @@ ...@@ -235,6 +238,9 @@
<if test="amount != null"> <if test="amount != null">
#{amount,jdbcType=BIGINT}, #{amount,jdbcType=BIGINT},
</if> </if>
<if test="realAmount != null">
#{realAmount,jdbcType=BIGINT},
</if>
<if test="itemCost != null"> <if test="itemCost != null">
#{itemCost,jdbcType=BIGINT}, #{itemCost,jdbcType=BIGINT},
</if> </if>
...@@ -285,6 +291,9 @@ ...@@ -285,6 +291,9 @@
<if test="record.amount != null"> <if test="record.amount != null">
amount = #{record.amount,jdbcType=BIGINT}, amount = #{record.amount,jdbcType=BIGINT},
</if> </if>
<if test="record.realAmount != null">
real_amount = #{record.realAmount,jdbcType=BIGINT},
</if>
<if test="record.itemCost != null"> <if test="record.itemCost != null">
item_cost = #{record.itemCost,jdbcType=BIGINT}, item_cost = #{record.itemCost,jdbcType=BIGINT},
</if> </if>
...@@ -319,6 +328,7 @@ ...@@ -319,6 +328,7 @@
item_id = #{record.itemId,jdbcType=BIGINT}, item_id = #{record.itemId,jdbcType=BIGINT},
item_num = #{record.itemNum,jdbcType=INTEGER}, item_num = #{record.itemNum,jdbcType=INTEGER},
amount = #{record.amount,jdbcType=BIGINT}, amount = #{record.amount,jdbcType=BIGINT},
real_amount = #{record.realAmount,jdbcType=BIGINT},
item_cost = #{record.itemCost,jdbcType=BIGINT}, item_cost = #{record.itemCost,jdbcType=BIGINT},
channel_cost = #{record.channelCost,jdbcType=BIGINT}, channel_cost = #{record.channelCost,jdbcType=BIGINT},
introduce_cost = #{record.introduceCost,jdbcType=BIGINT}, introduce_cost = #{record.introduceCost,jdbcType=BIGINT},
...@@ -348,6 +358,9 @@ ...@@ -348,6 +358,9 @@
<if test="amount != null"> <if test="amount != null">
amount = #{amount,jdbcType=BIGINT}, amount = #{amount,jdbcType=BIGINT},
</if> </if>
<if test="realAmount != null">
real_amount = #{realAmount,jdbcType=BIGINT},
</if>
<if test="itemCost != null"> <if test="itemCost != null">
item_cost = #{itemCost,jdbcType=BIGINT}, item_cost = #{itemCost,jdbcType=BIGINT},
</if> </if>
...@@ -379,6 +392,7 @@ ...@@ -379,6 +392,7 @@
item_id = #{itemId,jdbcType=BIGINT}, item_id = #{itemId,jdbcType=BIGINT},
item_num = #{itemNum,jdbcType=INTEGER}, item_num = #{itemNum,jdbcType=INTEGER},
amount = #{amount,jdbcType=BIGINT}, amount = #{amount,jdbcType=BIGINT},
real_amount = #{realAmount,jdbcType=BIGINT},
item_cost = #{itemCost,jdbcType=BIGINT}, item_cost = #{itemCost,jdbcType=BIGINT},
channel_cost = #{channelCost,jdbcType=BIGINT}, channel_cost = #{channelCost,jdbcType=BIGINT},
introduce_cost = #{introduceCost,jdbcType=BIGINT}, introduce_cost = #{introduceCost,jdbcType=BIGINT},
...@@ -421,8 +435,8 @@ ...@@ -421,8 +435,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, distribution_order_id, distributor_id, item_id, item_num, amount, item_cost, id, distribution_order_id, distributor_id, item_id, item_num, amount, real_amount,
channel_cost, introduce_cost, profit, create_time, `type`, is_valid item_cost, channel_cost, introduce_cost, profit, create_time, `type`, is_valid
</otherwise> </otherwise>
</choose> </choose>
from distributor_profit from distributor_profit
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.distribution.UserAccountDetail"> <resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.distribution.UserAccountDetail">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" /> <result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="order_id" jdbcType="VARCHAR" property="orderId" /> <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" />
<result column="amount" jdbcType="BIGINT" property="amount" />
<result column="type" jdbcType="INTEGER" property="type" /> <result column="type" jdbcType="INTEGER" property="type" />
<result column="fund_type" jdbcType="INTEGER" property="fundType" /> <result column="fund_type" jdbcType="INTEGER" property="fundType" />
<result column="state" jdbcType="INTEGER" property="state" /> <result column="state" jdbcType="INTEGER" property="state" />
...@@ -70,7 +71,7 @@ ...@@ -70,7 +71,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, user_id, order_id, `type`, fund_type, `state`, create_time, update_time id, user_id, transaction_id, amount, `type`, fund_type, `state`, create_time, update_time
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.UserAccountDetailExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.UserAccountDetailExample" resultMap="BaseResultMap">
select select
...@@ -99,13 +100,14 @@ ...@@ -99,13 +100,14 @@
distinct distinct
</if> </if>
<choose> <choose>
<when test="selective != null and selective.length > 0"> <when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
${column.escapedColumnName} ${column.escapedColumnName}
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, user_id, order_id, `type`, fund_type, `state`, create_time, update_time id, user_id, transaction_id, amount, `type`, fund_type, `state`, create_time, update_time
</otherwise> </otherwise>
</choose> </choose>
from user_account_detail from user_account_detail
...@@ -130,13 +132,14 @@ ...@@ -130,13 +132,14 @@
--> -->
select select
<choose> <choose>
<when test="selective != null and selective.length > 0"> <when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
${column.escapedColumnName} ${column.escapedColumnName}
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, user_id, order_id, `type`, fund_type, `state`, create_time, update_time id, user_id, transaction_id, amount, `type`, fund_type, `state`, create_time, update_time
</otherwise> </otherwise>
</choose> </choose>
from user_account_detail from user_account_detail
...@@ -156,12 +159,12 @@ ...@@ -156,12 +159,12 @@
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
</selectKey> </selectKey>
insert into user_account_detail (user_id, order_id, `type`, insert into user_account_detail (user_id, transaction_id, amount,
fund_type, `state`, create_time, `type`, fund_type, `state`,
update_time) create_time, update_time)
values (#{userId,jdbcType=BIGINT}, #{orderId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, values (#{userId,jdbcType=BIGINT}, #{transactionId,jdbcType=VARCHAR}, #{amount,jdbcType=BIGINT},
#{fundType,jdbcType=INTEGER}, #{state,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=INTEGER}, #{fundType,jdbcType=INTEGER}, #{state,jdbcType=INTEGER},
#{updateTime,jdbcType=TIMESTAMP}) #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.UserAccountDetail"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.UserAccountDetail">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
...@@ -172,8 +175,11 @@ ...@@ -172,8 +175,11 @@
<if test="userId != null"> <if test="userId != null">
user_id, user_id,
</if> </if>
<if test="orderId != null"> <if test="transactionId != null">
order_id, transaction_id,
</if>
<if test="amount != null">
amount,
</if> </if>
<if test="type != null"> <if test="type != null">
`type`, `type`,
...@@ -195,8 +201,11 @@ ...@@ -195,8 +201,11 @@
<if test="userId != null"> <if test="userId != null">
#{userId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT},
</if> </if>
<if test="orderId != null"> <if test="transactionId != null">
#{orderId,jdbcType=VARCHAR}, #{transactionId,jdbcType=VARCHAR},
</if>
<if test="amount != null">
#{amount,jdbcType=BIGINT},
</if> </if>
<if test="type != null"> <if test="type != null">
#{type,jdbcType=INTEGER}, #{type,jdbcType=INTEGER},
...@@ -230,8 +239,11 @@ ...@@ -230,8 +239,11 @@
<if test="record.userId != null"> <if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT}, user_id = #{record.userId,jdbcType=BIGINT},
</if> </if>
<if test="record.orderId != null"> <if test="record.transactionId != null">
order_id = #{record.orderId,jdbcType=VARCHAR}, transaction_id = #{record.transactionId,jdbcType=VARCHAR},
</if>
<if test="record.amount != null">
amount = #{record.amount,jdbcType=BIGINT},
</if> </if>
<if test="record.type != null"> <if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER}, `type` = #{record.type,jdbcType=INTEGER},
...@@ -257,7 +269,8 @@ ...@@ -257,7 +269,8 @@
update user_account_detail update user_account_detail
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT}, user_id = #{record.userId,jdbcType=BIGINT},
order_id = #{record.orderId,jdbcType=VARCHAR}, transaction_id = #{record.transactionId,jdbcType=VARCHAR},
amount = #{record.amount,jdbcType=BIGINT},
`type` = #{record.type,jdbcType=INTEGER}, `type` = #{record.type,jdbcType=INTEGER},
fund_type = #{record.fundType,jdbcType=INTEGER}, fund_type = #{record.fundType,jdbcType=INTEGER},
`state` = #{record.state,jdbcType=INTEGER}, `state` = #{record.state,jdbcType=INTEGER},
...@@ -273,8 +286,11 @@ ...@@ -273,8 +286,11 @@
<if test="userId != null"> <if test="userId != null">
user_id = #{userId,jdbcType=BIGINT}, user_id = #{userId,jdbcType=BIGINT},
</if> </if>
<if test="orderId != null"> <if test="transactionId != null">
order_id = #{orderId,jdbcType=VARCHAR}, transaction_id = #{transactionId,jdbcType=VARCHAR},
</if>
<if test="amount != null">
amount = #{amount,jdbcType=BIGINT},
</if> </if>
<if test="type != null"> <if test="type != null">
`type` = #{type,jdbcType=INTEGER}, `type` = #{type,jdbcType=INTEGER},
...@@ -297,7 +313,8 @@ ...@@ -297,7 +313,8 @@
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.distribution.UserAccountDetail"> <update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.distribution.UserAccountDetail">
update user_account_detail update user_account_detail
set user_id = #{userId,jdbcType=BIGINT}, set user_id = #{userId,jdbcType=BIGINT},
order_id = #{orderId,jdbcType=VARCHAR}, transaction_id = #{transactionId,jdbcType=VARCHAR},
amount = #{amount,jdbcType=BIGINT},
`type` = #{type,jdbcType=INTEGER}, `type` = #{type,jdbcType=INTEGER},
fund_type = #{fundType,jdbcType=INTEGER}, fund_type = #{fundType,jdbcType=INTEGER},
`state` = #{state,jdbcType=INTEGER}, `state` = #{state,jdbcType=INTEGER},
...@@ -332,13 +349,14 @@ ...@@ -332,13 +349,14 @@
select select
'true' as QUERYID, 'true' as QUERYID,
<choose> <choose>
<when test="selective != null and selective.length > 0"> <when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
${column.escapedColumnName} ${column.escapedColumnName}
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, user_id, order_id, `type`, fund_type, `state`, create_time, update_time id, user_id, transaction_id, amount, `type`, fund_type, `state`, create_time, update_time
</otherwise> </otherwise>
</choose> </choose>
from user_account_detail from user_account_detail
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution" <javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/> targetProject="ch-dao/src/main/java"/>
<table tableName="user_bank_card" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"> <table tableName="distributor_profit" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" /> <generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table> </table>
......
...@@ -533,33 +533,37 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -533,33 +533,37 @@ public class SupplierItemServiceImpl implements SupplierItemService {
Long itemId; Long itemId;
String shareRecordId = dto.getShareRecordId(); String shareRecordId = dto.getShareRecordId();
CollectionShareRecord collectionShareRecord = null; CollectionShareRecord collectionShareRecord = null;
long introducerId = CommConsts.SYSTEM_ACCOUNT;
if (StringUtils.isEmpty(shareRecordId) && dto.getId() == null) { if (StringUtils.isEmpty(shareRecordId) && dto.getId() == null) {
return Result.failed("商品信息为空"); return Result.failed("商品信息为空");
} else if (StringUtils.hasLength(shareRecordId) && ! shareRecordId.equals(CommConsts.DEFAULT_SHARE_ID)) { } else if (StringUtils.hasLength(shareRecordId) && ! shareRecordId.equals(CommConsts.DEFAULT_SHARE_ID)) {
collectionShareRecord = collectionShareRecordDao.findById(dto.getShareRecordId()); collectionShareRecord = collectionShareRecordDao.findById(dto.getShareRecordId());
introducerId = collectionShareRecord.getSharerId();
itemId = collectionShareRecord.getShareTargetId(); itemId = collectionShareRecord.getShareTargetId();
} else {
itemId = dto.getId();
}
if (itemId == null) {
return Result.failed("没有对应的商品id");
}
if (collectionShareRecord.getItemUserId().longValue() != dto.getUserId().longValue()) { if (collectionShareRecord.getItemUserId().longValue() != dto.getUserId().longValue()) {
//客态进入别人的藏馆,自动关注 //客态进入别人的藏馆,自动关注
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto(); FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(collectionShareRecord.getItemUserId()); followFansRecordRequestDto.setFollowerId(collectionShareRecord.getItemUserId());
followFansRecordRequestDto.setFansId(dto.getUserId()); followFansRecordRequestDto.setFansId(dto.getUserId());
followFansRecordRequestDto.setIntroducerId(collectionShareRecord.getSharerId()); followFansRecordRequestDto.setIntroducerId(introducerId);
followFansRecordService.follow(followFansRecordRequestDto); Result followResult = followFansRecordService.follow(followFansRecordRequestDto);
if (followResult.getSuccess()) {
logger.info("通过藏品详情分享点击,用户id:{} 关注了 用户id为 {}, 介绍人为", dto.getUserId(), collectionShareRecord.getItemUserId(), collectionShareRecord.getSharerId()); logger.info("通过藏品详情分享点击,用户id:{} 关注了 用户id为 {}, 介绍人为", dto.getUserId(), collectionShareRecord.getItemUserId(), collectionShareRecord.getSharerId());
}
} else { } else {
itemId = dto.getId(); logger.info("通过藏品详情分享点击关注用户返回信息 : {}" + followResult.getErrmsg());
} }
if (itemId == null) {
return Result.failed("没有对应的商品id");
} }
//拍卖专场进入详情页,增加围观次数 //拍卖专场进入详情页,增加围观次数
specialPerformanceConfigDao.addViewNum(itemId); specialPerformanceConfigDao.addViewNum(itemId);
/* if (StringUtils.hasLength(shareRecordId) && !shareRecordId.equals(CommConsts.DEFAULT_SHARE_ID)) {
if (collectionShareRecord.getItemUserId().longValue() != dto.getUserId().longValue()) {
}
}*/
//查询商品所属专场id //查询商品所属专场id
SpecialPerformanceConfigRequestDto specialPerformanceConfigRequestDto = new SpecialPerformanceConfigRequestDto(); SpecialPerformanceConfigRequestDto specialPerformanceConfigRequestDto = new SpecialPerformanceConfigRequestDto();
specialPerformanceConfigRequestDto.setItemId(itemId); specialPerformanceConfigRequestDto.setItemId(itemId);
......
package com.wwdz.ch.wx.impl.distribution; package com.wwdz.ch.wx.impl.distribution;
import com.wwdz.ch.core.consts.BillEnum;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.distribution.UserAccountDetailDao; import com.wwdz.ch.db.dao.distribution.UserAccountDetailDao;
import com.wwdz.ch.db.domain.distribution.DistributionOrder;
import com.wwdz.ch.db.domain.distribution.DistributorProfit;
import com.wwdz.ch.db.domain.distribution.UserAccountDetail;
import com.wwdz.ch.db.dto.request.distribution.UserAccountDetailRequestDto; import com.wwdz.ch.db.dto.request.distribution.UserAccountDetailRequestDto;
import com.wwdz.ch.wx.service.distribution.UserAccountDetailService; import com.wwdz.ch.wx.service.distribution.UserAccountDetailService;
import com.xxdxxs.utils.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -11,6 +17,8 @@ import org.springframework.stereotype.Service; ...@@ -11,6 +17,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@Service @Service
public class UserAccountDetailServiceImpl implements UserAccountDetailService { public class UserAccountDetailServiceImpl implements UserAccountDetailService {
...@@ -19,10 +27,63 @@ public class UserAccountDetailServiceImpl implements UserAccountDetailService { ...@@ -19,10 +27,63 @@ public class UserAccountDetailServiceImpl implements UserAccountDetailService {
@Autowired @Autowired
UserAccountDetailDao userAccountDetailDao; UserAccountDetailDao userAccountDetailDao;
@Transactional(propagation=Propagation.REQUIRED) @Transactional(propagation=Propagation.REQUIRED)
@Override @Override
public Result create(UserAccountDetailRequestDto dto) throws Exception { public Result create(DistributionOrder distributionOrder, DistributorProfit distributorProfit) throws Exception {
try { try {
//订单金额
long orderAmount = distributionOrder.getAmount();
//平台佣金
long channelCost = distributorProfit.getChannelCost();
//介绍佣金
long introduceCost = distributorProfit.getIntroduceCost();
//卖家实际收益
long sellerProfitAmount = orderAmount - channelCost - introduceCost;
//记录卖家的收益
UserAccountDetail userAccountDetail = new UserAccountDetail();
userAccountDetail.setUserId(distributionOrder.getSellerId());
userAccountDetail.setTransactionId(distributionOrder.getDistributionOrderId());
userAccountDetail.setAmount(sellerProfitAmount);
userAccountDetail.setType(BillEnum.AccountDetailTypeEnum.ORDER.getCode());
userAccountDetail.setFundType(BillEnum.FundTypeEnum.INCOME.getCode());
//创建订单时状态是无效,等买家付款后变为待入账,订单完成变成已入账
userAccountDetail.setState(BillEnum.AccountDetailStateEnum.INVALID.getCode());
userAccountDetail.setCreateTime(distributionOrder.getCreateTime());
userAccountDetailDao.insert(userAccountDetail);
//记录平台佣金
UserAccountDetail channelAccountDetail = new UserAccountDetail();
channelAccountDetail.setUserId(CommConsts.SYSTEM_ACCOUNT);
channelAccountDetail.setTransactionId(distributionOrder.getDistributionOrderId());
channelAccountDetail.setAmount(channelCost);
channelAccountDetail.setType(BillEnum.AccountDetailTypeEnum.CHANNEL.getCode());
channelAccountDetail.setFundType(BillEnum.FundTypeEnum.INCOME.getCode());
//创建订单时状态是无效,等买家付款后变为待入账,订单完成变成已入账
channelAccountDetail.setState(BillEnum.AccountDetailStateEnum.INVALID.getCode());
channelAccountDetail.setCreateTime(distributionOrder.getCreateTime());
userAccountDetailDao.insert(channelAccountDetail);
//记录介绍佣金,判断介绍人是平台还是用户
UserAccountDetail introduceAccountDetail = new UserAccountDetail();
if (StringUtils.isEmpty(distributionOrder.getShareRecordId()) || CommConsts.DEFAULT_SHARE_ID.equals(distributionOrder.getShareRecordId())) {
introduceAccountDetail.setUserId(CommConsts.SYSTEM_ACCOUNT);
} else {
}
introduceAccountDetail.setTransactionId(distributionOrder.getDistributionOrderId());
introduceAccountDetail.setAmount(channelCost);
introduceAccountDetail.setType(BillEnum.AccountDetailTypeEnum.CHANNEL.getCode());
introduceAccountDetail.setFundType(BillEnum.FundTypeEnum.INCOME.getCode());
//创建订单时状态是无效,等买家付款后变为待入账,订单完成变成已入账
introduceAccountDetail.setState(BillEnum.AccountDetailStateEnum.INVALID.getCode());
introduceAccountDetail.setCreateTime(distributionOrder.getCreateTime());
userAccountDetailDao.insert(introduceAccountDetail);
return Result.success(); return Result.success();
...@@ -31,4 +92,7 @@ public class UserAccountDetailServiceImpl implements UserAccountDetailService { ...@@ -31,4 +92,7 @@ public class UserAccountDetailServiceImpl implements UserAccountDetailService {
throw new Exception(e); throw new Exception(e);
} }
} }
} }
package com.wwdz.ch.wx.service.distribution; package com.wwdz.ch.wx.service.distribution;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.domain.distribution.DistributionOrder;
import com.wwdz.ch.db.domain.distribution.DistributorProfit;
import com.wwdz.ch.db.dto.request.distribution.UserAccountDetailRequestDto; import com.wwdz.ch.db.dto.request.distribution.UserAccountDetailRequestDto;
public interface UserAccountDetailService { public interface UserAccountDetailService {
...@@ -10,5 +12,5 @@ public interface UserAccountDetailService { ...@@ -10,5 +12,5 @@ public interface UserAccountDetailService {
* @param dto * @param dto
* @return * @return
*/ */
Result create(UserAccountDetailRequestDto dto) throws Exception; Result create(DistributionOrder distributionOrder, DistributorProfit distributorProfit) throws Exception;
} }
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