Commit 5292fa19 authored by shiyu's avatar shiyu

保证金缴纳2

parent a48a9b6b
package com.wwdz.ch.core.api.lianpay.security;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.spec.PKCS8EncodedKeySpec;
public class LianLianPaySecurity {
/**
* 签名处理
* @param signStr:签名源内容
* @param prikeyValue:私钥
* @return
*/
public static String encrypt(String signStr, String prikeyValue) {
try {
PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(
Base64Utils.getBytesBASE64(prikeyValue));
KeyFactory keyf = KeyFactory.getInstance("RSA");
PrivateKey myprikey = keyf.generatePrivate(priPKCS8);
// 用私钥对信息生成数字签名
java.security.Signature signet = java.security.Signature
.getInstance("MD5withRSA");
signet.initSign(myprikey);
signet.update(signStr.getBytes("UTF-8"));
byte[] signed = signet.sign(); // 对信息的数字签名
return new String(org.apache.commons.codec.binary.Base64.encodeBase64(signed));
} catch (java.lang.Exception e) {
e.printStackTrace();
}
return null;
}
}
...@@ -83,7 +83,7 @@ public class EarnestEnum { ...@@ -83,7 +83,7 @@ public class EarnestEnum {
public enum StateEnum { public enum StateEnum {
VALID(1, "初始有效状态"), VALID(1, "初始有效状态"),
RELEASE(5, "已释放"), RELEASE(5, "已释放"),
DEDUCT(-1, "已扣除"), DEDUCT(-1, "中拍超时未支付,已扣除"),
; ;
private int code; private int code;
...@@ -95,9 +95,9 @@ public class EarnestEnum { ...@@ -95,9 +95,9 @@ public class EarnestEnum {
} }
public static String getNameByCode(int code) { public static String getNameByCode(int code) {
for (EarnestEnum.TypeEnum typeEnum : EarnestEnum.TypeEnum.values()) { for (EarnestEnum.StateEnum stateEnum : EarnestEnum.StateEnum.values()) {
if (code == typeEnum.getCode()) { if (code == stateEnum.getCode()) {
return typeEnum.getDes(); return stateEnum.getDes();
} }
} }
return null; return null;
......
package com.wwdz.ch.core.entity.openShop;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.Map;
@Data
public class EarnestRecordVo implements Entity {
/**
* 用户ID
*/
private Long userId;
/**
* 商品id
*/
private Long itemId;
/**
* 商品名称
*/
private String itemName;
/**
* 用于列表展示的图片对象
*/
private Map<String, Object> homePageImage;
/**
* 保证金金额
*/
private String amount;
/**
* -1扣除1新增
*/
private Integer entryType;
private String entryTypeName;
/**
* 记录类型
*/
private Integer type;
private String typeName;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 状态
*/
private Integer state;
/**
* 状态
*/
private String stateName;
}
package com.wwdz.ch.db.dao.dts;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.mapper.AccountTraceObsoleteMapper;
import com.wwdz.ch.db.mapper.UserAccountObsoleteMapper;
import com.wwdz.ch.db.mapper.UserMapper;
import com.wwdz.ch.db.domain.AccountTraceObsolete;
import com.wwdz.ch.db.domain.AccountTraceObsoleteExample;
import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.db.domain.UserAccountObsolete;
import com.wwdz.ch.db.domain.UserAccountObsoleteExample;
public interface DtsAccountDao {
UserAccountObsolete findShareUserAccountByUserId(Integer shareUserId);
void settleApplyTrace(Integer sharedUserId, String startTime,String endTime,Integer type, BigDecimal toSettleMoney,String mobile);
List<AccountTraceObsolete> queryAccountTraceList(Integer userId, Integer page, Integer size);
/**
* 新增申请提现记录
*
* @param userId
* @param applyAmt
*/
void addExtractRecord(Integer userId, BigDecimal applyAmt, String mobile, String smsCode, BigDecimal hasAmount);
void add(UserAccountObsolete userAccount);
/**
* 根据账号和状态,查询提现记录
* @param userId
* @param types
* @return
*/
List<AccountTraceObsolete> getAccountTraceList(Integer userId, Byte... types);
List<AccountTraceObsolete> querySelectiveTrace(List<User> userList, List<Byte> status, Integer page, Integer size, String sort, String order);
/**
* 为资金账户的安全,建议做线下销账处理,处理后执行该逻辑
* 这里只根据记录做状态调整和审批意见记录
* @param traceId
* @param status
* @param traceMsg
* @return
*/
boolean approveAccountTrace(Integer traceId, Byte status, String traceMsg);
}
...@@ -29,4 +29,11 @@ public interface EarnestRecordDao { ...@@ -29,4 +29,11 @@ public interface EarnestRecordDao {
* @return * @return
*/ */
List<EarnestRecord> findList(EarnestRecordRequestDto dto); List<EarnestRecord> findList(EarnestRecordRequestDto dto);
/**
* 查询用户当前被占用的保证金
* @param userId
* @return
*/
long sumForOccupy(EarnestRecordRequestDto dto);
} }
package com.wwdz.ch.db.domain;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
public class UserAccountObsolete {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dts_user_account.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dts_user_account.user_id
*
* @mbg.generated
*/
private Integer userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dts_user_account.remain_amount
*
* @mbg.generated
*/
private BigDecimal remainAmount;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dts_user_account.total_amount
*
* @mbg.generated
*/
private BigDecimal totalAmount;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dts_user_account.create_time
*
* @mbg.generated
*/
private LocalDateTime createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dts_user_account.modify_time
*
* @mbg.generated
*/
private LocalDateTime modifyTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dts_user_account.settlement_rate
*
* @mbg.generated
*/
private Integer settlementRate;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dts_user_account.status
*
* @mbg.generated
*/
private Byte status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dts_user_account.share_url
*
* @mbg.generated
*/
private String shareUrl;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dts_user_account.id
*
* @return the value of dts_user_account.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dts_user_account.id
*
* @param id the value for dts_user_account.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dts_user_account.user_id
*
* @return the value of dts_user_account.user_id
*
* @mbg.generated
*/
public Integer getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dts_user_account.user_id
*
* @param userId the value for dts_user_account.user_id
*
* @mbg.generated
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dts_user_account.remain_amount
*
* @return the value of dts_user_account.remain_amount
*
* @mbg.generated
*/
public BigDecimal getRemainAmount() {
return remainAmount;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dts_user_account.remain_amount
*
* @param remainAmount the value for dts_user_account.remain_amount
*
* @mbg.generated
*/
public void setRemainAmount(BigDecimal remainAmount) {
this.remainAmount = remainAmount;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dts_user_account.total_amount
*
* @return the value of dts_user_account.total_amount
*
* @mbg.generated
*/
public BigDecimal getTotalAmount() {
return totalAmount;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dts_user_account.total_amount
*
* @param totalAmount the value for dts_user_account.total_amount
*
* @mbg.generated
*/
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dts_user_account.create_time
*
* @return the value of dts_user_account.create_time
*
* @mbg.generated
*/
public LocalDateTime getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dts_user_account.create_time
*
* @param createTime the value for dts_user_account.create_time
*
* @mbg.generated
*/
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dts_user_account.modify_time
*
* @return the value of dts_user_account.modify_time
*
* @mbg.generated
*/
public LocalDateTime getModifyTime() {
return modifyTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dts_user_account.modify_time
*
* @param modifyTime the value for dts_user_account.modify_time
*
* @mbg.generated
*/
public void setModifyTime(LocalDateTime modifyTime) {
this.modifyTime = modifyTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dts_user_account.settlement_rate
*
* @return the value of dts_user_account.settlement_rate
*
* @mbg.generated
*/
public Integer getSettlementRate() {
return settlementRate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dts_user_account.settlement_rate
*
* @param settlementRate the value for dts_user_account.settlement_rate
*
* @mbg.generated
*/
public void setSettlementRate(Integer settlementRate) {
this.settlementRate = settlementRate;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dts_user_account.status
*
* @return the value of dts_user_account.status
*
* @mbg.generated
*/
public Byte getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dts_user_account.status
*
* @param status the value for dts_user_account.status
*
* @mbg.generated
*/
public void setStatus(Byte status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dts_user_account.share_url
*
* @return the value of dts_user_account.share_url
*
* @mbg.generated
*/
public String getShareUrl() {
return shareUrl;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dts_user_account.share_url
*
* @param shareUrl the value for dts_user_account.share_url
*
* @mbg.generated
*/
public void setShareUrl(String shareUrl) {
this.shareUrl = shareUrl;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
@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(", remainAmount=").append(remainAmount);
sb.append(", totalAmount=").append(totalAmount);
sb.append(", createTime=").append(createTime);
sb.append(", modifyTime=").append(modifyTime);
sb.append(", settlementRate=").append(settlementRate);
sb.append(", status=").append(status);
sb.append(", shareUrl=").append(shareUrl);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
UserAccountObsolete other = (UserAccountObsolete) 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.getRemainAmount() == null ? other.getRemainAmount() == null : this.getRemainAmount().equals(other.getRemainAmount()))
&& (this.getTotalAmount() == null ? other.getTotalAmount() == null : this.getTotalAmount().equals(other.getTotalAmount()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getModifyTime() == null ? other.getModifyTime() == null : this.getModifyTime().equals(other.getModifyTime()))
&& (this.getSettlementRate() == null ? other.getSettlementRate() == null : this.getSettlementRate().equals(other.getSettlementRate()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getShareUrl() == null ? other.getShareUrl() == null : this.getShareUrl().equals(other.getShareUrl()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
@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 + ((getRemainAmount() == null) ? 0 : getRemainAmount().hashCode());
result = prime * result + ((getTotalAmount() == null) ? 0 : getTotalAmount().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getModifyTime() == null) ? 0 : getModifyTime().hashCode());
result = prime * result + ((getSettlementRate() == null) ? 0 : getSettlementRate().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getShareUrl() == null) ? 0 : getShareUrl().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
userId("user_id", "userId", "INTEGER", false),
remainAmount("remain_amount", "remainAmount", "DECIMAL", false),
totalAmount("total_amount", "totalAmount", "DECIMAL", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
modifyTime("modify_time", "modifyTime", "TIMESTAMP", false),
settlementRate("settlement_rate", "settlementRate", "INTEGER", false),
status("status", "status", "TINYINT", true),
shareUrl("share_url", "shareUrl", "VARCHAR", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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 dts_user_account
*
* @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
package com.wwdz.ch.db.domain;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class UserAccountObsoleteExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dts_user_account
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dts_user_account
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dts_user_account
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public UserAccountObsoleteExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public UserAccountObsoleteExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public UserAccountObsoleteExample orderBy(String ... orderByClauses) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < orderByClauses.length; i++) {
sb.append(orderByClauses[i]);
if (i < orderByClauses.length - 1) {
sb.append(" , ");
}
}
this.setOrderByClause(sb.toString());
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria(this);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
UserAccountObsoleteExample example = new UserAccountObsoleteExample();
return example.createCriteria();
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table dts_user_account
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdNotEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Integer value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("user_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Integer value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdNotEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("user_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Integer value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdGreaterThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("user_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Integer value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdGreaterThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("user_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdLessThan(Integer value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdLessThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("user_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Integer value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdLessThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("user_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdIn(List<Integer> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Integer> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Integer value1, Integer value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Integer value1, Integer value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andRemainAmountIsNull() {
addCriterion("remain_amount is null");
return (Criteria) this;
}
public Criteria andRemainAmountIsNotNull() {
addCriterion("remain_amount is not null");
return (Criteria) this;
}
public Criteria andRemainAmountEqualTo(BigDecimal value) {
addCriterion("remain_amount =", value, "remainAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemainAmountEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("remain_amount = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemainAmountNotEqualTo(BigDecimal value) {
addCriterion("remain_amount <>", value, "remainAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemainAmountNotEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("remain_amount <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemainAmountGreaterThan(BigDecimal value) {
addCriterion("remain_amount >", value, "remainAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemainAmountGreaterThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("remain_amount > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemainAmountGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("remain_amount >=", value, "remainAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemainAmountGreaterThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("remain_amount >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemainAmountLessThan(BigDecimal value) {
addCriterion("remain_amount <", value, "remainAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemainAmountLessThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("remain_amount < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemainAmountLessThanOrEqualTo(BigDecimal value) {
addCriterion("remain_amount <=", value, "remainAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRemainAmountLessThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("remain_amount <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRemainAmountIn(List<BigDecimal> values) {
addCriterion("remain_amount in", values, "remainAmount");
return (Criteria) this;
}
public Criteria andRemainAmountNotIn(List<BigDecimal> values) {
addCriterion("remain_amount not in", values, "remainAmount");
return (Criteria) this;
}
public Criteria andRemainAmountBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("remain_amount between", value1, value2, "remainAmount");
return (Criteria) this;
}
public Criteria andRemainAmountNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("remain_amount not between", value1, value2, "remainAmount");
return (Criteria) this;
}
public Criteria andTotalAmountIsNull() {
addCriterion("total_amount is null");
return (Criteria) this;
}
public Criteria andTotalAmountIsNotNull() {
addCriterion("total_amount is not null");
return (Criteria) this;
}
public Criteria andTotalAmountEqualTo(BigDecimal value) {
addCriterion("total_amount =", value, "totalAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalAmountEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("total_amount = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalAmountNotEqualTo(BigDecimal value) {
addCriterion("total_amount <>", value, "totalAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalAmountNotEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("total_amount <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalAmountGreaterThan(BigDecimal value) {
addCriterion("total_amount >", value, "totalAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalAmountGreaterThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("total_amount > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalAmountGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("total_amount >=", value, "totalAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalAmountGreaterThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("total_amount >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalAmountLessThan(BigDecimal value) {
addCriterion("total_amount <", value, "totalAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalAmountLessThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("total_amount < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalAmountLessThanOrEqualTo(BigDecimal value) {
addCriterion("total_amount <=", value, "totalAmount");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTotalAmountLessThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("total_amount <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTotalAmountIn(List<BigDecimal> values) {
addCriterion("total_amount in", values, "totalAmount");
return (Criteria) this;
}
public Criteria andTotalAmountNotIn(List<BigDecimal> values) {
addCriterion("total_amount not in", values, "totalAmount");
return (Criteria) this;
}
public Criteria andTotalAmountBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("total_amount between", value1, value2, "totalAmount");
return (Criteria) this;
}
public Criteria andTotalAmountNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("total_amount not between", value1, value2, "totalAmount");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(LocalDateTime value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("create_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(LocalDateTime value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeNotEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("create_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(LocalDateTime value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("create_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("create_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(LocalDateTime value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("create_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("create_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<LocalDateTime> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<LocalDateTime> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andModifyTimeIsNull() {
addCriterion("modify_time is null");
return (Criteria) this;
}
public Criteria andModifyTimeIsNotNull() {
addCriterion("modify_time is not null");
return (Criteria) this;
}
public Criteria andModifyTimeEqualTo(LocalDateTime value) {
addCriterion("modify_time =", value, "modifyTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andModifyTimeEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("modify_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andModifyTimeNotEqualTo(LocalDateTime value) {
addCriterion("modify_time <>", value, "modifyTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andModifyTimeNotEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("modify_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andModifyTimeGreaterThan(LocalDateTime value) {
addCriterion("modify_time >", value, "modifyTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andModifyTimeGreaterThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("modify_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andModifyTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("modify_time >=", value, "modifyTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andModifyTimeGreaterThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("modify_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andModifyTimeLessThan(LocalDateTime value) {
addCriterion("modify_time <", value, "modifyTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andModifyTimeLessThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("modify_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andModifyTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("modify_time <=", value, "modifyTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andModifyTimeLessThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("modify_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andModifyTimeIn(List<LocalDateTime> values) {
addCriterion("modify_time in", values, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeNotIn(List<LocalDateTime> values) {
addCriterion("modify_time not in", values, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("modify_time between", value1, value2, "modifyTime");
return (Criteria) this;
}
public Criteria andModifyTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("modify_time not between", value1, value2, "modifyTime");
return (Criteria) this;
}
public Criteria andSettlementRateIsNull() {
addCriterion("settlement_rate is null");
return (Criteria) this;
}
public Criteria andSettlementRateIsNotNull() {
addCriterion("settlement_rate is not null");
return (Criteria) this;
}
public Criteria andSettlementRateEqualTo(Integer value) {
addCriterion("settlement_rate =", value, "settlementRate");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSettlementRateEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("settlement_rate = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSettlementRateNotEqualTo(Integer value) {
addCriterion("settlement_rate <>", value, "settlementRate");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSettlementRateNotEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("settlement_rate <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSettlementRateGreaterThan(Integer value) {
addCriterion("settlement_rate >", value, "settlementRate");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSettlementRateGreaterThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("settlement_rate > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSettlementRateGreaterThanOrEqualTo(Integer value) {
addCriterion("settlement_rate >=", value, "settlementRate");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSettlementRateGreaterThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("settlement_rate >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSettlementRateLessThan(Integer value) {
addCriterion("settlement_rate <", value, "settlementRate");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSettlementRateLessThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("settlement_rate < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSettlementRateLessThanOrEqualTo(Integer value) {
addCriterion("settlement_rate <=", value, "settlementRate");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andSettlementRateLessThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("settlement_rate <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andSettlementRateIn(List<Integer> values) {
addCriterion("settlement_rate in", values, "settlementRate");
return (Criteria) this;
}
public Criteria andSettlementRateNotIn(List<Integer> values) {
addCriterion("settlement_rate not in", values, "settlementRate");
return (Criteria) this;
}
public Criteria andSettlementRateBetween(Integer value1, Integer value2) {
addCriterion("settlement_rate between", value1, value2, "settlementRate");
return (Criteria) this;
}
public Criteria andSettlementRateNotBetween(Integer value1, Integer value2) {
addCriterion("settlement_rate not between", value1, value2, "settlementRate");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Byte value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStatusEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("`status` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Byte value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStatusNotEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("`status` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Byte value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStatusGreaterThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("`status` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Byte value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStatusGreaterThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("`status` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusLessThan(Byte value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStatusLessThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("`status` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Byte value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStatusLessThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("`status` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusIn(List<Byte> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Byte> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Byte value1, Byte value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Byte value1, Byte value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andShareUrlIsNull() {
addCriterion("share_url is null");
return (Criteria) this;
}
public Criteria andShareUrlIsNotNull() {
addCriterion("share_url is not null");
return (Criteria) this;
}
public Criteria andShareUrlEqualTo(String value) {
addCriterion("share_url =", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareUrlEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("share_url = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlNotEqualTo(String value) {
addCriterion("share_url <>", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareUrlNotEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("share_url <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlGreaterThan(String value) {
addCriterion("share_url >", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareUrlGreaterThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("share_url > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlGreaterThanOrEqualTo(String value) {
addCriterion("share_url >=", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareUrlGreaterThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("share_url >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlLessThan(String value) {
addCriterion("share_url <", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareUrlLessThanColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("share_url < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlLessThanOrEqualTo(String value) {
addCriterion("share_url <=", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareUrlLessThanOrEqualToColumn(UserAccountObsolete.Column column) {
addCriterion(new StringBuilder("share_url <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlLike(String value) {
addCriterion("share_url like", value, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlNotLike(String value) {
addCriterion("share_url not like", value, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlIn(List<String> values) {
addCriterion("share_url in", values, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlNotIn(List<String> values) {
addCriterion("share_url not in", values, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlBetween(String value1, String value2) {
addCriterion("share_url between", value1, value2, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlNotBetween(String value1, String value2) {
addCriterion("share_url not between", value1, value2, "shareUrl");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table dts_user_account
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private UserAccountObsoleteExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(UserAccountObsoleteExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public UserAccountObsoleteExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
if (ifAdd) {
add.add(this);
}
return this;
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public interface ICriteriaAdd {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Criteria add(Criteria add);
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table dts_user_account
*
* @mbg.generated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package com.wwdz.ch.db.impl.dts;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.dts.DtsAccountDao;
import com.wwdz.ch.db.domain.*;
import com.wwdz.ch.db.mapper.AccountTraceObsoleteMapper;
import com.wwdz.ch.db.mapper.UserAccountObsoleteMapper;
import com.wwdz.ch.db.mapper.UserMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@Repository
public class DtsAccountDaoImpl implements DtsAccountDao {
private static final Logger logger = LoggerFactory.getLogger(DtsAccountDaoImpl.class);
public static final long TWO_MONTH_DAYS = 60;//近两个月,60天
public static final long ONE_WEEK_DAYS = 7;//近一周
@Resource
private UserAccountObsoleteMapper userAccountMapper;
@Resource
private AccountTraceObsoleteMapper accountTraceMapper;
@Resource
private UserMapper userMapper;
@Override
public UserAccountObsolete findShareUserAccountByUserId(Integer shareUserId) {
UserAccountObsoleteExample example = new UserAccountObsoleteExample();
example.or().andUserIdEqualTo(shareUserId);
List<UserAccountObsolete> accounts = userAccountMapper.selectByExample(example);
// Assert.state(accounts.size() < 2, "同一个用户存在两个账户");
if (accounts.size() == 1) {
return accounts.get(0);
} else {
logger.error("根据代理用户id:{},获取账号信息出错!!!",shareUserId);
return null;
}
}
private String getRandomNum(Integer num) {
String base = "0123456789";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < num; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
return sb.toString();
}
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class })
public void settleApplyTrace(Integer sharedUserId, String startTime,String endTime,Integer type, BigDecimal toSettleMoney,String mobile) {
Integer settlementRate = 5;
// 获取用户账户信息并更新记录
UserAccountObsolete account = this.findShareUserAccountByUserId(sharedUserId);
if (account != null && toSettleMoney.compareTo(new BigDecimal("0")) == 0) {// 如果该用户未产生推荐单,则降低结算比例
settlementRate = account.getSettlementRate() > 8 ? 8 : account.getSettlementRate();
}
//更新代理用户账号信息
account.setRemainAmount(account.getRemainAmount().add(toSettleMoney));//剩余结算,尚未结算给用户
account.setTotalAmount(account.getTotalAmount().add(toSettleMoney));
account.setModifyTime(LocalDateTime.now());
account.setSettlementRate(settlementRate);
userAccountMapper.updateByPrimaryKeySelective(account);
// 新增账户跟踪表,添加结算跟踪记录
AccountTraceObsolete trace = new AccountTraceObsolete();
trace.setAmount(account.getRemainAmount());//当前申请金额,直接将未结算的进行申请
trace.setTotalAmount(account.getTotalAmount());//已提现总金额
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMdd");
String now = df.format(LocalDate.now());
String traceSn = now + getRandomNum(6);
trace.setTraceSn(traceSn);
trace.setAddTime(LocalDateTime.now());
trace.setType(type);
trace.setUserId(sharedUserId);
trace.setStatus((byte) 0);//申请状态
trace.setMobile(mobile);
accountTraceMapper.insert(trace);
}
@Override
public List<AccountTraceObsolete> queryAccountTraceList(Integer userId, Integer page, Integer size) {
AccountTraceObsoleteExample example = new AccountTraceObsoleteExample();
example.setOrderByClause(AccountTraceObsolete.Column.addTime.desc());
AccountTraceObsoleteExample.Criteria criteria = example.or();
criteria.andUserIdEqualTo(userId);
PageHelper.startPage(page, size);
return accountTraceMapper.selectByExample(example);
}
/**
* 新增申请提现记录
*
* @param userId
* @param applyAmt
*/
@Override
public void addExtractRecord(Integer userId, BigDecimal applyAmt, String mobile, String smsCode,
BigDecimal hasAmount) {
AccountTraceObsolete record = new AccountTraceObsolete();
record.setAmount(applyAmt);
record.setMobile(mobile);
record.setTotalAmount(applyAmt.add(hasAmount));
record.setSmsCode(smsCode);
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMdd");
String now = df.format(LocalDate.now());
String traceSn = now + getRandomNum(6);
record.setTraceSn(traceSn);
record.setAddTime(LocalDateTime.now());
record.setType(1);// 申请中..
record.setUserId(userId);
accountTraceMapper.insert(record);
}
@Override
public void add(UserAccountObsolete userAccount) {
userAccount.setCreateTime(LocalDateTime.now());
userAccount.setModifyTime(LocalDateTime.now());
userAccountMapper.insert(userAccount);
}
/**
* 根据账号和状态,查询提现记录
* @param userId
* @param types
* @return
*/
@Override
public List<AccountTraceObsolete> getAccountTraceList(Integer userId, Byte... types) {
if(userId == null || types == null || types.length < 1) {
return null;
}
AccountTraceObsoleteExample example = new AccountTraceObsoleteExample();
List<Byte> statusList = new ArrayList<Byte>();
for (Byte type : types) {
statusList.add(type);
}
example.or().andUserIdEqualTo(userId).andStatusIn(statusList);
return accountTraceMapper.selectByExample(example);
}
@Override
public List<AccountTraceObsolete> querySelectiveTrace(List<User> userList, List<Byte> status, Integer page,
Integer size, String sort, String order) {
//是否有匹配到的用户,转用户id集合
List<Integer> userIdArray = null;
if (userList != null && userList.size() > 0) {
userIdArray = new ArrayList<Integer>();
for (User dtsUser : userList) {
userIdArray.add(dtsUser.getId().intValue()) ;
}
}
AccountTraceObsoleteExample example = new AccountTraceObsoleteExample();
AccountTraceObsoleteExample.Criteria criteria = example.or();
if (userIdArray != null && userIdArray.size() != 0) {
criteria.andUserIdIn(userIdArray);
}
if (status != null && status.size() != 0) {
criteria.andStatusIn(status);
}
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
example.setOrderByClause(sort + " " + order);
}
PageHelper.startPage(page, size);
return accountTraceMapper.selectByExample(example);
}
/**
* 为资金账户的安全,建议做线下销账处理,处理后执行该逻辑
* 这里只根据记录做状态调整和审批意见记录
* @param traceId
* @param status
* @param traceMsg
* @return
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class })
public boolean approveAccountTrace(Integer traceId, Byte status, String traceMsg) {
AccountTraceObsolete trace = accountTraceMapper.selectByPrimaryKey(traceId);
trace.setStatus(status);
trace.setTraceMsg(traceMsg);
if (status.intValue() == 1) {//如果是审批通过,需要消除账户中的可提现余额
UserAccountObsolete userAccount = findShareUserAccountByUserId(trace.getUserId());
if (userAccount != null) {
userAccount.setRemainAmount(userAccount.getRemainAmount().subtract(trace.getAmount()));
logger.info("提现审批通过,调整账户可提现余额为{} - {} = {}",userAccount.getRemainAmount(),trace.getAmount(),userAccount.getRemainAmount().subtract(trace.getAmount()));
if(userAccountMapper.updateByPrimaryKeySelective(userAccount) == 0) {
return false;
}
} else {
logger.error("审批提现,获取账号出错!请检查对应用户 userId:{} 的账户",trace.getUserId());
return false;
}
}
if (accountTraceMapper.updateByPrimaryKeySelective(trace) == 0) {
return false;
}
return true;
}
}
...@@ -7,19 +7,16 @@ import com.wwdz.ch.db.dao.dts.DtsUserDao; ...@@ -7,19 +7,16 @@ import com.wwdz.ch.db.dao.dts.DtsUserDao;
import com.wwdz.ch.db.domain.User; import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.db.domain.UserExample; import com.wwdz.ch.db.domain.UserExample;
import com.wwdz.ch.db.domain.UserVo; import com.wwdz.ch.db.domain.UserVo;
import com.wwdz.ch.db.mapper.UserAccountObsoleteMapper;
import com.wwdz.ch.db.mapper.UserMapper; import com.wwdz.ch.db.mapper.UserMapper;
import com.wwdz.ch.db.mapper.ex.StatMapper; import com.wwdz.ch.db.mapper.ex.StatMapper;
import com.wwdz.mall.common.vo.response.CloudServerResponse; import com.wwdz.mall.common.vo.response.CloudServerResponse;
import com.wwdz.user.api.service.user.UserReadService; import com.wwdz.user.api.service.user.UserReadService;
import com.wwdz.user.api.service.user.UserWriteService; import com.wwdz.user.api.service.user.UserWriteService;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
@Repository @Repository
...@@ -28,8 +25,8 @@ public class DtsUserDaoImpl implements DtsUserDao { ...@@ -28,8 +25,8 @@ public class DtsUserDaoImpl implements DtsUserDao {
@Resource @Resource
private UserMapper userMapper; private UserMapper userMapper;
@Resource /*@Resource
private UserAccountObsoleteMapper userAccountMapper; private UserAccountObsoleteMapper userAccountObsoleteMapper;*/
@Resource @Resource
private StatMapper statMapper; private StatMapper statMapper;
......
...@@ -43,4 +43,15 @@ public class EarnestRecordDaoImpl implements EarnestRecordDao { ...@@ -43,4 +43,15 @@ public class EarnestRecordDaoImpl implements EarnestRecordDao {
example.setOrderByClause("create_time desc"); example.setOrderByClause("create_time desc");
return earnestRecordMapper.selectByExample(example); return earnestRecordMapper.selectByExample(example);
} }
@Override
public long sumForOccupy(EarnestRecordRequestDto dto) {
EarnestRecordExample example = new EarnestRecordExample();
EarnestRecordExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(dto.getUserId());
JdbcHelper.ifPresent(dto.getType(), criteria :: andTypeEqualTo);
JdbcHelper.ifPresent(dto.getTypeList(), criteria :: andTypeIn);
JdbcHelper.ifPresent(dto.getState(), criteria :: andStateEqualTo);
return earnestRecordMapper.sumForOccupy(example);
}
} }
...@@ -3,11 +3,9 @@ package com.wwdz.ch.db.impl.openShop; ...@@ -3,11 +3,9 @@ package com.wwdz.ch.db.impl.openShop;
import com.wwdz.ch.db.dao.openShop.UserAccountDao; import com.wwdz.ch.db.dao.openShop.UserAccountDao;
import com.wwdz.ch.db.domain.openShop.UserAccount; import com.wwdz.ch.db.domain.openShop.UserAccount;
import com.wwdz.ch.db.domain.openShop.UserAccountExample; import com.wwdz.ch.db.domain.openShop.UserAccountExample;
import com.wwdz.ch.db.mapper.UserMapper;
import com.wwdz.ch.db.mapper.openShop.UserAccountMapper; import com.wwdz.ch.db.mapper.openShop.UserAccountMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.Date; import java.util.Date;
@Repository @Repository
......
package com.wwdz.ch.db.mapper;
import com.wwdz.ch.db.domain.UserAccountObsolete;
import com.wwdz.ch.db.domain.UserAccountObsoleteExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface UserAccountObsoleteMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
long countByExample(UserAccountObsoleteExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int deleteByExample(UserAccountObsoleteExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int insert(UserAccountObsolete record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int insertSelective(UserAccountObsolete record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserAccountObsolete selectOneByExample(UserAccountObsoleteExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserAccountObsolete selectOneByExampleSelective(@Param("example") UserAccountObsoleteExample example, @Param("selective") UserAccountObsolete.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<UserAccountObsolete> selectByExampleSelective(@Param("example") UserAccountObsoleteExample example, @Param("selective") UserAccountObsolete.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
List<UserAccountObsolete> selectByExample(UserAccountObsoleteExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserAccountObsolete selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") UserAccountObsolete.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
UserAccountObsolete selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") UserAccountObsolete record, @Param("example") UserAccountObsoleteExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int updateByExample(@Param("record") UserAccountObsolete record, @Param("example") UserAccountObsoleteExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(UserAccountObsolete record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int updateByPrimaryKey(UserAccountObsolete record);
}
\ No newline at end of file
package com.wwdz.ch.db.mapper.openShop; package com.wwdz.ch.db.mapper.openShop;
import com.wwdz.ch.db.bean.OrderDataStat;
import com.wwdz.ch.db.domain.distribution.DistributorProfitExample;
import com.wwdz.ch.db.domain.openShop.EarnestRecord; import com.wwdz.ch.db.domain.openShop.EarnestRecord;
import com.wwdz.ch.db.domain.openShop.EarnestRecordExample; import com.wwdz.ch.db.domain.openShop.EarnestRecordExample;
import java.util.List; import java.util.List;
...@@ -66,4 +68,13 @@ public interface EarnestRecordMapper { ...@@ -66,4 +68,13 @@ public interface EarnestRecordMapper {
int updateByPrimaryKeySelective(EarnestRecord record); int updateByPrimaryKeySelective(EarnestRecord record);
int updateByPrimaryKey(EarnestRecord record); int updateByPrimaryKey(EarnestRecord record);
/**
* 统计用户被占用的保证金
* @param example
* @return
*/
long sumForOccupy(EarnestRecordExample example);
} }
\ No newline at end of file
...@@ -3,7 +3,6 @@ package com.wwdz.ch.db.mapper.openShop; ...@@ -3,7 +3,6 @@ package com.wwdz.ch.db.mapper.openShop;
import com.wwdz.ch.db.domain.openShop.UserAccount; import com.wwdz.ch.db.domain.openShop.UserAccount;
import com.wwdz.ch.db.domain.openShop.UserAccountExample; import com.wwdz.ch.db.domain.openShop.UserAccountExample;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wwdz.ch.db.mapper.UserAccountObsoleteMapper">
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.UserAccountObsolete">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="remain_amount" jdbcType="DECIMAL" property="remainAmount" />
<result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
<result column="settlement_rate" jdbcType="INTEGER" property="settlementRate" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="share_url" jdbcType="VARCHAR" property="shareUrl" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, user_id, remain_amount, total_amount, create_time, modify_time, settlement_rate,
`status`, share_url
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.UserAccountObsoleteExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from user_account_obsolete
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<if test="example.distinct">
distinct
</if>
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, user_id, remain_amount, total_amount, create_time, modify_time, settlement_rate,
`status`, share_url
</otherwise>
</choose>
from user_account_obsolete
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from user_account_obsolete
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, user_id, remain_amount, total_amount, create_time, modify_time, settlement_rate,
`status`, share_url
</otherwise>
</choose>
from user_account_obsolete
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from user_account_obsolete
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.UserAccountObsoleteExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from user_account_obsolete
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.wwdz.ch.db.domain.UserAccountObsolete">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into user_account_obsolete (user_id, remain_amount, total_amount,
create_time, modify_time, settlement_rate,
`status`, share_url)
values (#{userId,jdbcType=INTEGER}, #{remainAmount,jdbcType=DECIMAL}, #{totalAmount,jdbcType=DECIMAL},
#{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP}, #{settlementRate,jdbcType=INTEGER},
#{status,jdbcType=TINYINT}, #{shareUrl,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.UserAccountObsolete">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into user_account_obsolete
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="remainAmount != null">
remain_amount,
</if>
<if test="totalAmount != null">
total_amount,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="modifyTime != null">
modify_time,
</if>
<if test="settlementRate != null">
settlement_rate,
</if>
<if test="status != null">
`status`,
</if>
<if test="shareUrl != null">
share_url,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="remainAmount != null">
#{remainAmount,jdbcType=DECIMAL},
</if>
<if test="totalAmount != null">
#{totalAmount,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyTime != null">
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="settlementRate != null">
#{settlementRate,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="shareUrl != null">
#{shareUrl,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.UserAccountObsoleteExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from user_account_obsolete
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update user_account_obsolete
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=INTEGER},
</if>
<if test="record.remainAmount != null">
remain_amount = #{record.remainAmount,jdbcType=DECIMAL},
</if>
<if test="record.totalAmount != null">
total_amount = #{record.totalAmount,jdbcType=DECIMAL},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.modifyTime != null">
modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="record.settlementRate != null">
settlement_rate = #{record.settlementRate,jdbcType=INTEGER},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=TINYINT},
</if>
<if test="record.shareUrl != null">
share_url = #{record.shareUrl,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update user_account_obsolete
set id = #{record.id,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=INTEGER},
remain_amount = #{record.remainAmount,jdbcType=DECIMAL},
total_amount = #{record.totalAmount,jdbcType=DECIMAL},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
settlement_rate = #{record.settlementRate,jdbcType=INTEGER},
`status` = #{record.status,jdbcType=TINYINT},
share_url = #{record.shareUrl,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.wwdz.ch.db.domain.UserAccountObsolete">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update user_account_obsolete
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="remainAmount != null">
remain_amount = #{remainAmount,jdbcType=DECIMAL},
</if>
<if test="totalAmount != null">
total_amount = #{totalAmount,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="settlementRate != null">
settlement_rate = #{settlementRate,jdbcType=INTEGER},
</if>
<if test="status != null">
`status` = #{status,jdbcType=TINYINT},
</if>
<if test="shareUrl != null">
share_url = #{shareUrl,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.UserAccountObsolete">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update user_account_obsolete
set user_id = #{userId,jdbcType=INTEGER},
remain_amount = #{remainAmount,jdbcType=DECIMAL},
total_amount = #{totalAmount,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
settlement_rate = #{settlementRate,jdbcType=INTEGER},
`status` = #{status,jdbcType=TINYINT},
share_url = #{shareUrl,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.UserAccountObsoleteExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<include refid="Base_Column_List" />
from user_account_obsolete
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, user_id, remain_amount, total_amount, create_time, modify_time, settlement_rate,
`status`, share_url
</otherwise>
</choose>
from user_account_obsolete
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
...@@ -386,4 +386,11 @@ ...@@ -386,4 +386,11 @@
</if> </if>
limit 1 limit 1
</select> </select>
<select id="sumForOccupy" parameterType="com.wwdz.ch.db.domain.openShop.EarnestRecordExample" resultType="java.lang.Long">
select IFNULL(sum(amount), 0) as amount from earnest_order
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -118,7 +118,7 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService { ...@@ -118,7 +118,7 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
//换算成对应占用的保证金 //换算成对应占用的保证金
long occupyAmount = earnestAmount.longValue(); long occupyAmount = earnestAmount.longValue();
earnestRecord.setUserId(dto.getUserId()); earnestRecord.setUserId(dto.getUserId());
earnestRecord.setAmount(earnestAmount.longValue()); earnestRecord.setAmount(-earnestAmount.longValue());
earnestRecord.setItemId(dto.getItemId()); earnestRecord.setItemId(dto.getItemId());
earnestRecord.setSpecialPerformanceId(dto.getSpecialPerformanceId()); earnestRecord.setSpecialPerformanceId(dto.getSpecialPerformanceId());
earnestRecord.setEntryType(EarnestEnum.EntryEnum.DEDUCT.getCode()); earnestRecord.setEntryType(EarnestEnum.EntryEnum.DEDUCT.getCode());
......
package com.wwdz.ch.wx.impl.openShop;
import com.github.pagehelper.PageInfo;
import com.wwdz.ch.core.consts.EarnestEnum;
import com.wwdz.ch.core.entity.openShop.EarnestRecordVo;
import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.MediaUtil;
import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.db.dao.distribution.SupplierItemDao;
import com.wwdz.ch.db.dao.openShop.EarnestRecordDao;
import com.wwdz.ch.db.dao.openShop.UserAccountDao;
import com.wwdz.ch.db.domain.distribution.SupplierItem;
import com.wwdz.ch.db.domain.openShop.EarnestRecord;
import com.wwdz.ch.db.domain.openShop.UserAccount;
import com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto;
import com.wwdz.ch.wx.service.openShop.EarnestRecordService;
import com.xxdxxs.utils.EntityMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.*;
@Service
public class EarnestRecordServiceImpl implements EarnestRecordService {
private static final Logger logger = LoggerFactory.getLogger(EarnestRecordServiceImpl.class);
@Autowired
EarnestRecordDao earnestRecordDao;
@Autowired
SupplierItemDao supplierItemDao;
@Autowired
UserAccountDao userAccountDao;
@Override
public Result findList(EarnestRecordRequestDto dto) {
try {
List<EarnestRecordVo> earnestRecordVos = new ArrayList<>();
dto.setTypeList(Arrays.asList(EarnestEnum.TypeEnum.PAY.getCode(), EarnestEnum.TypeEnum.DEDUCT.getCode(), EarnestEnum.TypeEnum.WITHDRAW.getCode()));
List<EarnestRecord> earnestRecordList = earnestRecordDao.findList(dto);
PageInfo pageInfo = new PageInfo<>(earnestRecordList);
for (EarnestRecord earnestRecord : earnestRecordList) {
EarnestRecordVo earnestRecordVo = new EarnestRecordVo();
EntityMapper.copyAttribute(earnestRecord, earnestRecordVo);
earnestRecordVo.setTypeName(EarnestEnum.TypeEnum.getNameByCode(earnestRecord.getType()));
earnestRecordVo.setAmount(PriceUtil.convertPriceFenToYuan(earnestRecord.getAmount()));
earnestRecordVos.add(earnestRecordVo);
}
return Result.success(PageSearchResult.of(pageInfo, earnestRecordVos));
} catch (Exception e) {
logger.error("查询保证金明细失败 error : {}", e);
}
return Result.failed();
}
@Override
public Result findUseDetails(EarnestRecordRequestDto dto) {
try {
Map<String, Object> map = new HashMap<>();
List<EarnestRecordVo> earnestRecordVos = new ArrayList<>();
dto.setTypeList(Arrays.asList(EarnestEnum.TypeEnum.OCCUPY.getCode()));
List<EarnestRecord> earnestRecordList = earnestRecordDao.findList(dto);
PageInfo pageInfo = new PageInfo<>(earnestRecordList);
for (EarnestRecord earnestRecord : earnestRecordList) {
EarnestRecordVo earnestRecordVo = new EarnestRecordVo();
EntityMapper.copyAttribute(earnestRecord, earnestRecordVo);
earnestRecordVo.setTypeName(EarnestEnum.TypeEnum.getNameByCode(earnestRecord.getType()));
earnestRecordVo.setAmount(PriceUtil.convertPriceFenToYuan(earnestRecord.getAmount()));
if (earnestRecord.getState() != EarnestEnum.StateEnum.VALID.getCode()) {
earnestRecordVo.setStateName(EarnestEnum.StateEnum.getNameByCode(earnestRecord.getState()));
}
SupplierItem supplierItem = supplierItemDao.findById(earnestRecord.getItemId());
earnestRecordVo.setItemName(supplierItem.getName());
earnestRecordVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
earnestRecordVos.add(earnestRecordVo);
}
map.put("details", PageSearchResult.of(pageInfo, earnestRecordVos));
//查询用户被占用的保证金
EarnestRecordRequestDto earnestRecordRequestDto = new EarnestRecordRequestDto();
earnestRecordRequestDto.setUserId(dto.getUserId());
earnestRecordRequestDto.setType(EarnestEnum.TypeEnum.OCCUPY.getCode());
earnestRecordRequestDto.setState(EarnestEnum.StateEnum.VALID.getCode());
long occupyAmount = earnestRecordDao.sumForOccupy(earnestRecordRequestDto);
map.put("usedAmount", PriceUtil.convertPriceFenToYuan(occupyAmount));
//查询用户的保证金账户
UserAccount userAccount = userAccountDao.findByUserId(dto.getUserId());
return Result.success(map);
} catch (Exception e) {
logger.error("查询保证金使用明细失败 error : {}", e);
}
return Result.failed();
}
}
...@@ -5,5 +5,17 @@ import com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto; ...@@ -5,5 +5,17 @@ import com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto;
public interface EarnestRecordService { public interface EarnestRecordService {
/**
* 查询保证金明细
* @param dto
* @return
*/
Result findList(EarnestRecordRequestDto dto); Result findList(EarnestRecordRequestDto dto);
/**
* 查询保证金使用明细
* @param dto
* @return
*/
Result findUseDetails(EarnestRecordRequestDto dto);
} }
package com.wwdz.ch.wx.web.openShop;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto;
import com.wwdz.ch.wx.service.openShop.EarnestRecordService;
import com.xxdxxs.service.FormHandler;
import com.xxdxxs.validation.Validator;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/wx/earnestRecord")
public class EarnestRecordController {
private static final Logger logger = LoggerFactory.getLogger(OpenShopController.class);
@Autowired
EarnestRecordService earnestRecordService;
@ApiOperation(value = "查询保证金明细")
@PostMapping("/findList")
public Result findList(@RequestBody EarnestRecordRequestDto dto) {
logger.info("【请求开始】查询保证金明细,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("userId", "用户id").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return earnestRecordService.findList(dto);
}
@ApiOperation(value = "查询保证金使用明细")
@PostMapping("/findUseDetails")
public Result findUseDetails(@RequestBody EarnestRecordRequestDto dto) {
logger.info("【请求开始】查询保证金使用明细,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("userId", "用户id").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return earnestRecordService.findUseDetails(dto);
}
}
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