Commit e5863dea authored by shiyu's avatar shiyu

新增开户行信息,新增介绍记录

parent 1930e872
......@@ -99,6 +99,12 @@ public class UserBillVo implements Entity {
@ExcelProperty(value = "真实姓名", index = 5)
private String realName;
/**
* 银行卡号真实姓名
*/
@ExcelProperty(value = "开户行", index = 6)
private String bankName;
/**
* 结款凭证
*/
......
......@@ -170,6 +170,7 @@ public class SysFinanceServiceImpl implements SysFinanceService {
if (userBankCard != null) {
userBillVo.setBankCardId(userBankCard.getCardId());
userBillVo.setRealName(userBankCard.getName());
userBillVo.setBankName(userBankCard.getBankName());
}
if (userBill.getState() == BillEnum.BillStateEnum.PAID.getCode()) {
//查询结款凭证
......@@ -401,6 +402,7 @@ public class SysFinanceServiceImpl implements SysFinanceService {
settlementRecord.setUserId(userBill.getUserId());
settlementRecord.setBankCardId(userBankCard.getCardId());
settlementRecord.setRealUserName(userBankCard.getName());
settlementRecord.setBankName(userBankCard.getBankName());
settlementRecord.setSettleAmount(userBill.getTotalEntryAmount());
settlementRecord.setSettleTime(now);
settlementRecord.setCreateTime(now);
......
......@@ -131,4 +131,9 @@ public interface CommConsts {
* 微信手续费,按照最高的1%计算
*/
public final static double WX_COMMISSION_REBATE = 0.01;
/**
* 默认介绍佣金比例
*/
public final static double REBATE = 0.03;
}
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.IntroduceRecord;
public interface IntroduceRecordDao {
boolean insert(IntroduceRecord introduceRecord);
IntroduceRecord findByUserId(long userId);
IntroduceRecord findByDoubleId(long userId, long introducerId);
boolean isExisted(long userId);
}
package com.wwdz.ch.db.domain.distribution;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import com.xxdxxs.entity.Entity;
import lombok.Data;
/**
* @author shiyu
* @date 2024/08/06
*/
@Data
public class IntroduceRecord implements Entity {
private Long id;
/**
* 被介绍的用户id
*/
private Long userId;
/**
* 介绍人id
*/
private Long introducerId;
/**
* 分享记录id
*/
private String shareRecordId;
/**
* 创建时间
*/
private Date createTime;
private static final long serialVersionUID = 1L;
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", introducerId=").append(introducerId);
sb.append(", shareRecordId=").append(shareRecordId);
sb.append(", createTime=").append(createTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
IntroduceRecord other = (IntroduceRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getIntroducerId() == null ? other.getIntroducerId() == null : this.getIntroducerId().equals(other.getIntroducerId()))
&& (this.getShareRecordId() == null ? other.getShareRecordId() == null : this.getShareRecordId().equals(other.getShareRecordId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getIntroducerId() == null) ? 0 : getIntroducerId().hashCode());
result = prime * result + ((getShareRecordId() == null) ? 0 : getShareRecordId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "BIGINT", false),
userId("user_id", "userId", "BIGINT", false),
introducerId("introducer_id", "introducerId", "BIGINT", false),
shareRecordId("share_record_id", "shareRecordId", "VARCHAR", false),
createTime("create_time", "createTime", "TIMESTAMP", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String BEGINNING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String ENDING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final boolean isColumnNameDelimited;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
}
}
\ No newline at end of file
......@@ -34,6 +34,11 @@ public class SettlementRecord implements Entity {
*/
private String bankCardId;
/**
* 开户行名称
*/
private String bankName;
/**
* 真实姓名
*/
......
......@@ -8,7 +8,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/07/09
* @date 2024/08/06
*/
@Data
public class UserBankCard implements Entity {
......@@ -29,6 +29,11 @@ public class UserBankCard implements Entity {
*/
private String name;
/**
* 开户行名称
*/
private String bankName;
/**
* 创建时间
*/
......@@ -51,6 +56,7 @@ public class UserBankCard implements Entity {
sb.append(", userId=").append(userId);
sb.append(", cardId=").append(cardId);
sb.append(", name=").append(name);
sb.append(", bankName=").append(bankName);
sb.append(", createTime=").append(createTime);
sb.append(", state=").append(state);
sb.append(", serialVersionUID=").append(serialVersionUID);
......@@ -74,6 +80,7 @@ public class UserBankCard implements Entity {
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getCardId() == null ? other.getCardId() == null : this.getCardId().equals(other.getCardId()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getBankName() == null ? other.getBankName() == null : this.getBankName().equals(other.getBankName()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()));
}
......@@ -86,6 +93,7 @@ public class UserBankCard implements Entity {
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getCardId() == null) ? 0 : getCardId().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getBankName() == null) ? 0 : getBankName().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
return result;
......@@ -103,6 +111,7 @@ public class UserBankCard implements Entity {
userId("user_id", "userId", "BIGINT", false),
cardId("card_id", "cardId", "VARCHAR", false),
name("name", "name", "VARCHAR", true),
bankName("bank_name", "bankName", "VARCHAR", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
state("state", "state", "INTEGER", true);
......
......@@ -696,6 +696,148 @@ public class UserBankCardExample {
return (Criteria) this;
}
public Criteria andBankNameIsNull() {
addCriterion("bank_name is null");
return (Criteria) this;
}
public Criteria andBankNameIsNotNull() {
addCriterion("bank_name is not null");
return (Criteria) this;
}
public Criteria andBankNameEqualTo(String value) {
addCriterion("bank_name =", value, "bankName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_bank_card
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBankNameEqualToColumn(UserBankCard.Column column) {
addCriterion(new StringBuilder("bank_name = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBankNameNotEqualTo(String value) {
addCriterion("bank_name <>", value, "bankName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_bank_card
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBankNameNotEqualToColumn(UserBankCard.Column column) {
addCriterion(new StringBuilder("bank_name <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBankNameGreaterThan(String value) {
addCriterion("bank_name >", value, "bankName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_bank_card
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBankNameGreaterThanColumn(UserBankCard.Column column) {
addCriterion(new StringBuilder("bank_name > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBankNameGreaterThanOrEqualTo(String value) {
addCriterion("bank_name >=", value, "bankName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_bank_card
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBankNameGreaterThanOrEqualToColumn(UserBankCard.Column column) {
addCriterion(new StringBuilder("bank_name >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBankNameLessThan(String value) {
addCriterion("bank_name <", value, "bankName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_bank_card
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBankNameLessThanColumn(UserBankCard.Column column) {
addCriterion(new StringBuilder("bank_name < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBankNameLessThanOrEqualTo(String value) {
addCriterion("bank_name <=", value, "bankName");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_bank_card
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andBankNameLessThanOrEqualToColumn(UserBankCard.Column column) {
addCriterion(new StringBuilder("bank_name <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andBankNameLike(String value) {
addCriterion("bank_name like", value, "bankName");
return (Criteria) this;
}
public Criteria andBankNameNotLike(String value) {
addCriterion("bank_name not like", value, "bankName");
return (Criteria) this;
}
public Criteria andBankNameIn(List<String> values) {
addCriterion("bank_name in", values, "bankName");
return (Criteria) this;
}
public Criteria andBankNameNotIn(List<String> values) {
addCriterion("bank_name not in", values, "bankName");
return (Criteria) this;
}
public Criteria andBankNameBetween(String value1, String value2) {
addCriterion("bank_name between", value1, value2, "bankName");
return (Criteria) this;
}
public Criteria andBankNameNotBetween(String value1, String value2) {
addCriterion("bank_name not between", value1, value2, "bankName");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
......
package com.wwdz.ch.db.impl.distribution;
import com.wwdz.ch.db.dao.distribution.IntroduceRecordDao;
import com.wwdz.ch.db.domain.distribution.IntroduceRecord;
import com.wwdz.ch.db.domain.distribution.IntroduceRecordExample;
import com.wwdz.ch.db.mapper.distribution.IntroduceRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
public class IntroduceRecordDaoImpl implements IntroduceRecordDao {
@Autowired
IntroduceRecordMapper introduceRecordMapper;
@Override
public boolean insert(IntroduceRecord introduceRecord) {
return introduceRecordMapper.insert(introduceRecord) > 0;
}
@Override
public IntroduceRecord findByUserId(long userId) {
IntroduceRecordExample example = new IntroduceRecordExample();
IntroduceRecordExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
return introduceRecordMapper.selectOneByExample(example);
}
@Override
public IntroduceRecord findByDoubleId(long userId, long introducerId) {
IntroduceRecordExample example = new IntroduceRecordExample();
IntroduceRecordExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
criteria.andIntroducerIdEqualTo(introducerId);
return introduceRecordMapper.selectOneByExample(example);
}
@Override
public boolean isExisted(long userId) {
IntroduceRecordExample example = new IntroduceRecordExample();
IntroduceRecordExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
return introduceRecordMapper.countByExample(example) > 0;
}
}
package com.wwdz.ch.db.mapper.distribution;
import com.wwdz.ch.db.domain.distribution.IntroduceRecord;
import com.wwdz.ch.db.domain.distribution.IntroduceRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
@Mapper
public interface IntroduceRecordMapper {
long countByExample(IntroduceRecordExample example);
int deleteByExample(IntroduceRecordExample example);
int deleteByPrimaryKey(Long id);
int insert(IntroduceRecord record);
int insertSelective(IntroduceRecord record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
IntroduceRecord selectOneByExample(IntroduceRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
IntroduceRecord selectOneByExampleSelective(@Param("example") IntroduceRecordExample example, @Param("selective") IntroduceRecord.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<IntroduceRecord> selectByExampleSelective(@Param("example") IntroduceRecordExample example, @Param("selective") IntroduceRecord.Column ... selective);
List<IntroduceRecord> selectByExample(IntroduceRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table introduce_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
IntroduceRecord selectByPrimaryKeySelective(@Param("id") Long id, @Param("selective") IntroduceRecord.Column ... selective);
IntroduceRecord selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") IntroduceRecord record, @Param("example") IntroduceRecordExample example);
int updateByExample(@Param("record") IntroduceRecord record, @Param("example") IntroduceRecordExample example);
int updateByPrimaryKeySelective(IntroduceRecord record);
int updateByPrimaryKey(IntroduceRecord record);
}
\ No newline at end of file
......@@ -3,11 +3,8 @@ package com.wwdz.ch.db.mapper.distribution;
import com.wwdz.ch.db.domain.distribution.UserBankCard;
import com.wwdz.ch.db.domain.distribution.UserBankCardExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface UserBankCardMapper {
long countByExample(UserBankCardExample example);
......
......@@ -6,6 +6,7 @@
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="card_id" jdbcType="VARCHAR" property="cardId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="bank_name" jdbcType="VARCHAR" property="bankName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="state" jdbcType="INTEGER" property="state" />
</resultMap>
......@@ -68,7 +69,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, user_id, card_id, `name`, create_time, `state`
id, user_id, card_id, `name`, bank_name, create_time, `state`
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.UserBankCardExample" resultMap="BaseResultMap">
select
......@@ -97,13 +98,13 @@
distinct
</if>
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, user_id, card_id, `name`, create_time, `state`
id, user_id, card_id, `name`, bank_name, create_time, `state`
</otherwise>
</choose>
from user_bank_card
......@@ -128,13 +129,13 @@
-->
select
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, user_id, card_id, `name`, create_time, `state`
id, user_id, card_id, `name`, bank_name, create_time, `state`
</otherwise>
</choose>
from user_bank_card
......@@ -155,9 +156,11 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into user_bank_card (user_id, card_id, `name`,
create_time, `state`)
bank_name, create_time, `state`
)
values (#{userId,jdbcType=BIGINT}, #{cardId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER})
#{bankName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.UserBankCard">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
......@@ -174,6 +177,9 @@
<if test="name != null">
`name`,
</if>
<if test="bankName != null">
bank_name,
</if>
<if test="createTime != null">
create_time,
</if>
......@@ -191,6 +197,9 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="bankName != null">
#{bankName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
......@@ -220,6 +229,9 @@
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.bankName != null">
bank_name = #{record.bankName,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
......@@ -237,6 +249,7 @@
user_id = #{record.userId,jdbcType=BIGINT},
card_id = #{record.cardId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
bank_name = #{record.bankName,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
`state` = #{record.state,jdbcType=INTEGER}
<if test="_parameter != null">
......@@ -255,6 +268,9 @@
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="bankName != null">
bank_name = #{bankName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
......@@ -269,6 +285,7 @@
set user_id = #{userId,jdbcType=BIGINT},
card_id = #{cardId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
bank_name = #{bankName,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
`state` = #{state,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
......@@ -300,13 +317,13 @@
select
'true' as QUERYID,
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, user_id, card_id, `name`, create_time, `state`
id, user_id, card_id, `name`, bank_name, create_time, `state`
</otherwise>
</choose>
from user_bank_card
......
......@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/>
<table tableName="distribution_order" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<table tableName="user_bank_card" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table>
......
......@@ -136,6 +136,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Autowired
GroupPurchaseService groupPurchaseService;
@Autowired
IntroduceRecordDao introduceRecordDao;
@Transactional
@Override
public Result createDistributionOrder(DistributionOrderRequestDto dto) {
......@@ -258,25 +261,23 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
AuctionRecord firstAuctionRecord = auctionRecordDao.findFirstRecord(dto.getItemId(), auctionRecord.getUserId());
String shareRecordId = firstAuctionRecord.getShareRecordId();*/
//查询该用户和藏家的介绍人
FollowFansRecordRequestDto queryFollowFansRecordRequestDto = new FollowFansRecordRequestDto();
queryFollowFansRecordRequestDto.setFollowerId(auctionConfig.getCreatorId());
queryFollowFansRecordRequestDto.setFansId(dto.getBuyerId());
FollowFansRecord followFansRecord = followFansRecordDao.findOne(queryFollowFansRecordRequestDto);
//查询该用户介绍人
long introducerId;
//没有关注记录,则介绍费算作平台的
if (followFansRecord == null) {
IntroduceRecord introduceRecord = introduceRecordDao.findByUserId(dto.getBuyerId());
if (introduceRecord == null) {
introducerId = CommConsts.SYSTEM_ACCOUNT;
IntroduceRecord newRecord = new IntroduceRecord();
newRecord.setUserId(dto.getBuyerId());
newRecord.setIntroducerId(introducerId);
newRecord.setShareRecordId(CommConsts.DEFAULT_SHARE_ID);
newRecord.setCreateTime(new Date());
introduceRecordDao.insert(newRecord);
} else {
//把介绍人作为该订单的分享链接字段的值
introducerId = followFansRecord.getIntroducerId();
introducerId = introduceRecord.getIntroducerId();
}
//查询该用户和藏家的介绍人
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(auctionConfig.getCreatorId());
followFansRecordRequestDto.setFansId(auctionRecord.getUserId());
double rebate = distributorProfitService.getIntroduceRebate(followFansRecordRequestDto);
//查询佣金比例
double rebate = distributorProfitService.getIntroduceRebate(auctionRecord.getUserId(), introducerId);
DistributionOrder distributionOrder = new DistributionOrder();
distributionOrder.setIntroducerId(introducerId);
......@@ -411,21 +412,22 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
}
String prepayId = (String) prePayResult.getData();
//查询该用户和藏家的介绍人
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(supplierItem.getCreatorId());
followFansRecordRequestDto.setFansId(dto.getBuyerId());
FollowFansRecord followFansRecord = followFansRecordDao.findOne(followFansRecordRequestDto);
//查询该用户介绍人
long introducerId;
//没有关注记录,则介绍费算作平台的
if (followFansRecord == null) {
IntroduceRecord introduceRecord = introduceRecordDao.findByUserId(dto.getBuyerId());
if (introduceRecord == null) {
introducerId = CommConsts.SYSTEM_ACCOUNT;
IntroduceRecord newRecord = new IntroduceRecord();
newRecord.setUserId(dto.getBuyerId());
newRecord.setIntroducerId(introducerId);
newRecord.setShareRecordId(CommConsts.DEFAULT_SHARE_ID);
newRecord.setCreateTime(new Date());
introduceRecordDao.insert(newRecord);
} else {
//把介绍人作为该订单的分享链接字段的值
introducerId = followFansRecord.getIntroducerId();
introducerId = introduceRecord.getIntroducerId();
}
//介绍人分佣
double rebate = distributorProfitService.getIntroduceRebate(followFansRecordRequestDto);
//查询佣金比例
double rebate = distributorProfitService.getIntroduceRebate(dto.getBuyerId(), introducerId);
DistributionOrder distributionOrder = new DistributionOrder();
distributionOrder.setIntroduceRebate(BigDecimal.valueOf(rebate));
......@@ -516,21 +518,22 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
}
long amount = groupPurchaseConfig.getPrice() * dto.getItemNum();
SupplierItem supplierItem = supplierItemDao.findById(itemId);
//查询该用户和藏家的介绍人
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(supplierItem.getCreatorId());
followFansRecordRequestDto.setFansId(dto.getUserId());
FollowFansRecord followFansRecord = followFansRecordDao.findOne(followFansRecordRequestDto);
//查询该用户介绍人
long introducerId;
//没有关注记录,则介绍费算作平台的
if (followFansRecord == null) {
IntroduceRecord introduceRecord = introduceRecordDao.findByUserId(dto.getBuyerId());
if (introduceRecord == null) {
introducerId = CommConsts.SYSTEM_ACCOUNT;
IntroduceRecord newRecord = new IntroduceRecord();
newRecord.setUserId(dto.getBuyerId());
newRecord.setIntroducerId(introducerId);
newRecord.setShareRecordId(CommConsts.DEFAULT_SHARE_ID);
newRecord.setCreateTime(new Date());
introduceRecordDao.insert(newRecord);
} else {
//把介绍人作为该订单的分享链接字段的值
introducerId = followFansRecord.getIntroducerId();
introducerId = introduceRecord.getIntroducerId();
}
//查询该用户和藏家的介绍人
double rebate = distributorProfitService.getIntroduceRebate(followFansRecordRequestDto);
//查询佣金比例
double rebate = distributorProfitService.getIntroduceRebate(dto.getBuyerId(), introducerId);
String distributionOrderId = IdUtils.getOrderNumber(DISTRIBUTION_ORDER_PREFIX);
DistributionOrderRequestDto prePayDto = new DistributionOrderRequestDto();
......@@ -1258,7 +1261,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(supplierItem.getCreatorId());
followFansRecordRequestDto.setFansId(distributionOrder.getBuyerId());
double rebate = distributorProfitService.getIntroduceRebate(followFansRecordRequestDto);
IntroduceRecord introduceRecord = introduceRecordDao.findByUserId(distributionOrder.getBuyerId());
double rebate = CommConsts.REBATE;
if (introduceRecord != null) {
rebate = distributorProfitService.getIntroduceRebate(distributionOrder.getBuyerId(), introduceRecord.getIntroducerId());
}
distributionOrderDetailVo.setIntroduceRebate(PriceUtil.convertPriceFromStr(String.valueOf(rebate)).toString());
distributionOrderDetailVo.setProfit(PriceUtil.convertPriceFenToYuan(distributorProfit.getProfit()));
}
......
package com.wwdz.ch.wx.impl.distribution;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.db.dao.CollectorWhiteListDao;
import com.wwdz.ch.db.dao.FollowFansRecordDao;
import com.wwdz.ch.db.dao.distribution.DistributorProfitDao;
import com.wwdz.ch.db.dao.distribution.IntroduceRecordDao;
import com.wwdz.ch.db.domain.CollectorWhiteList;
import com.wwdz.ch.db.domain.FollowFansRecord;
import com.wwdz.ch.db.domain.distribution.IntroduceRecord;
import com.wwdz.ch.db.dto.request.FollowFansRecordRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.wwdz.ch.wx.service.distribution.DistributorProfitService;
......@@ -35,15 +38,21 @@ public class DistributorProfitServiceImpl implements DistributorProfitService {
@Autowired
CollectorWhiteListDao collectorWhiteListDao;
@Autowired
IntroduceRecordDao introduceRecordDao;
@Override
public Double getIntroduceRebate(FollowFansRecordRequestDto dto) {
double rebate = 0.03;
public Double getIntroduceRebate(long userId, long introducerId) {
double rebate = CommConsts.REBATE;
try {
FollowFansRecord followFansRecord = followFansRecordDao.findOne(dto);
if (followFansRecord == null) {
if (introducerId == CommConsts.SYSTEM_ACCOUNT) {
return rebate;
}
IntroduceRecord introduceRecord = introduceRecordDao.findByDoubleId(userId, introducerId);
if (introduceRecord == null) {
return rebate;
}
Date createTime = followFansRecord.getCreateTime();
Date createTime = introduceRecord.getCreateTime();
Date now = new Date();
int year = 0;
for (int i = 1; i <= 3; i++) {
......
......@@ -148,6 +148,9 @@ public class SupplierItemServiceImpl implements SupplierItemService {
@Autowired
GroupPurchaseService groupPurchaseService;
@Autowired
IntroduceRecordDao introduceRecordDao;
@Override
public Result findList(SupplierItemRequestDto dto) {
try {
......@@ -546,6 +549,16 @@ public class SupplierItemServiceImpl implements SupplierItemService {
itemId = collectionShareRecord.getShareTargetId();
if (collectionShareRecord != null && collectionShareRecord.getItemUserId().longValue() != dto.getUserId().longValue()) {
//保存介绍记录
if (!introduceRecordDao.isExisted(dto.getUserId())) {
IntroduceRecord introduceRecord = new IntroduceRecord();
introduceRecord.setUserId(dto.getUserId());
introduceRecord.setIntroducerId(introducerId);
introduceRecord.setShareRecordId(shareRecordId);
introduceRecord.setCreateTime(now);
introduceRecordDao.insert(introduceRecord);
}
//客态进入别人的藏馆,自动关注
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(collectionShareRecord.getItemUserId());
......@@ -843,6 +856,15 @@ public class SupplierItemServiceImpl implements SupplierItemService {
collectionShareRecord = collectionShareRecordDao.findById(dto.getShareRecordId());
itemId = collectionShareRecord.getShareTargetId();
if (collectionShareRecord != null && collectionShareRecord.getItemUserId().longValue() != dto.getUserId().longValue()) {
//保存介绍记录
if (!introduceRecordDao.isExisted(dto.getUserId())) {
IntroduceRecord introduceRecord = new IntroduceRecord();
introduceRecord.setUserId(dto.getUserId());
introduceRecord.setIntroducerId(collectionShareRecord.getSharerId());
introduceRecord.setShareRecordId(dto.getShareRecordId());
introduceRecord.setCreateTime(new Date());
introduceRecordDao.insert(introduceRecord);
}
//客态进入别人的藏馆,自动关注
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(collectionShareRecord.getItemUserId());
......@@ -984,6 +1006,16 @@ public class SupplierItemServiceImpl implements SupplierItemService {
itemId = collectionShareRecord.getShareTargetId();
if (collectionShareRecord != null && collectionShareRecord.getItemUserId().longValue() != dto.getUserId().longValue()) {
//保存介绍记录
if (!introduceRecordDao.isExisted(dto.getUserId())) {
IntroduceRecord introduceRecord = new IntroduceRecord();
introduceRecord.setUserId(dto.getUserId());
introduceRecord.setIntroducerId(introducerId);
introduceRecord.setShareRecordId(dto.getShareRecordId());
introduceRecord.setCreateTime(new Date());
introduceRecordDao.insert(introduceRecord);
}
//客态进入别人的藏馆,自动关注
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(collectionShareRecord.getItemUserId());
......
......@@ -8,10 +8,10 @@ public interface DistributorProfitService {
/**
* 获取介绍人当前的佣金比例
* @param dto
* @param userId, introducerId
* @return
*/
Double getIntroduceRebate(FollowFansRecordRequestDto dto);
Double getIntroduceRebate(long userId, long introducerId);
/**
* 获取预计分佣金额
......
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