交易信息功能

This commit is contained in:
huaibo
2022-03-11 10:44:25 +08:00
parent 62fc38078c
commit e76f0ff26e
13 changed files with 1286 additions and 2 deletions

25
ruoyi-info/pom.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-info</artifactId>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,252 @@
package com.ruoyi.info.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 交易信息对象 trade_info
*
* @author ruoyi
* @date 2022-03-10
*/
public class TradeInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 交易编号 */
@Excel(name = "交易编号")
private String tradeNo;
/** 操作人名称 */
@Excel(name = "操作人名称")
private String operatorName;
/** 群编号 */
@Excel(name = "群编号")
private String groupNo;
/** 卡类型 */
@Excel(name = "卡类型")
private String cardType;
/** 币种 */
@Excel(name = "币种")
private String currencyType;
/** 卡面值 */
@Excel(name = "卡面值")
private Long cardValue;
/** 收卡汇率 */
@Excel(name = "收卡汇率")
private BigDecimal buyCardExchangeRate;
/** 收卡成本 */
@Excel(name = "收卡成本")
private BigDecimal buyCost;
/** 奈拉值 */
@Excel(name = "奈拉值")
private Long nailaValue;
/** 代码 */
@Excel(name = "代码")
private String code;
/** 对接群 */
@Excel(name = "对接群")
private String commGroup;
/** 售出价格 */
@Excel(name = "售出价格")
private BigDecimal salePrice;
/** 利润 */
@Excel(name = "利润")
private BigDecimal profit;
/** 银行账号 */
@Excel(name = "银行账号")
private String bankAccount;
/** 支付状态 */
@Excel(name = "支付状态")
private String payStatus;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTradeNo(String tradeNo)
{
this.tradeNo = tradeNo;
}
public String getTradeNo()
{
return tradeNo;
}
public void setOperatorName(String operatorName)
{
this.operatorName = operatorName;
}
public String getOperatorName()
{
return operatorName;
}
public void setGroupNo(String groupNo)
{
this.groupNo = groupNo;
}
public String getGroupNo()
{
return groupNo;
}
public void setCardType(String cardType)
{
this.cardType = cardType;
}
public String getCardType()
{
return cardType;
}
public void setCurrencyType(String currencyType)
{
this.currencyType = currencyType;
}
public String getCurrencyType()
{
return currencyType;
}
public void setCardValue(Long cardValue)
{
this.cardValue = cardValue;
}
public Long getCardValue()
{
return cardValue;
}
public void setBuyCardExchangeRate(BigDecimal buyCardExchangeRate)
{
this.buyCardExchangeRate = buyCardExchangeRate;
}
public BigDecimal getBuyCardExchangeRate()
{
return buyCardExchangeRate;
}
public void setBuyCost(BigDecimal buyCost)
{
this.buyCost = buyCost;
}
public BigDecimal getBuyCost()
{
return buyCost;
}
public void setNailaValue(Long nailaValue)
{
this.nailaValue = nailaValue;
}
public Long getNailaValue()
{
return nailaValue;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setCommGroup(String commGroup)
{
this.commGroup = commGroup;
}
public String getCommGroup()
{
return commGroup;
}
public void setSalePrice(BigDecimal salePrice)
{
this.salePrice = salePrice;
}
public BigDecimal getSalePrice()
{
return salePrice;
}
public void setProfit(BigDecimal profit)
{
this.profit = profit;
}
public BigDecimal getProfit()
{
return profit;
}
public void setBankAccount(String bankAccount)
{
this.bankAccount = bankAccount;
}
public String getBankAccount()
{
return bankAccount;
}
public void setPayStatus(String payStatus)
{
this.payStatus = payStatus;
}
public String getPayStatus()
{
return payStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("tradeNo", getTradeNo())
.append("operatorName", getOperatorName())
.append("groupNo", getGroupNo())
.append("cardType", getCardType())
.append("currencyType", getCurrencyType())
.append("cardValue", getCardValue())
.append("buyCardExchangeRate", getBuyCardExchangeRate())
.append("buyCost", getBuyCost())
.append("nailaValue", getNailaValue())
.append("code", getCode())
.append("commGroup", getCommGroup())
.append("salePrice", getSalePrice())
.append("profit", getProfit())
.append("bankAccount", getBankAccount())
.append("payStatus", getPayStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.info.mapper;
import java.util.List;
import com.ruoyi.info.domain.TradeInfo;
/**
* 交易信息Mapper接口
*
* @author ruoyi
* @date 2022-03-10
*/
public interface TradeInfoMapper
{
/**
* 查询交易信息
*
* @param id 交易信息主键
* @return 交易信息
*/
public TradeInfo selectTradeInfoById(Long id);
/**
* 查询交易信息列表
*
* @param tradeInfo 交易信息
* @return 交易信息集合
*/
public List<TradeInfo> selectTradeInfoList(TradeInfo tradeInfo);
/**
* 新增交易信息
*
* @param tradeInfo 交易信息
* @return 结果
*/
public int insertTradeInfo(TradeInfo tradeInfo);
/**
* 修改交易信息
*
* @param tradeInfo 交易信息
* @return 结果
*/
public int updateTradeInfo(TradeInfo tradeInfo);
/**
* 删除交易信息
*
* @param id 交易信息主键
* @return 结果
*/
public int deleteTradeInfoById(Long id);
/**
* 批量删除交易信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTradeInfoByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.info.service;
import java.util.List;
import com.ruoyi.info.domain.TradeInfo;
/**
* 交易信息Service接口
*
* @author ruoyi
* @date 2022-03-10
*/
public interface ITradeInfoService
{
/**
* 查询交易信息
*
* @param id 交易信息主键
* @return 交易信息
*/
public TradeInfo selectTradeInfoById(Long id);
/**
* 查询交易信息列表
*
* @param tradeInfo 交易信息
* @return 交易信息集合
*/
public List<TradeInfo> selectTradeInfoList(TradeInfo tradeInfo);
/**
* 新增交易信息
*
* @param tradeInfo 交易信息
* @return 结果
*/
public int insertTradeInfo(TradeInfo tradeInfo);
/**
* 修改交易信息
*
* @param tradeInfo 交易信息
* @return 结果
*/
public int updateTradeInfo(TradeInfo tradeInfo);
/**
* 批量删除交易信息
*
* @param ids 需要删除的交易信息主键集合
* @return 结果
*/
public int deleteTradeInfoByIds(Long[] ids);
/**
* 删除交易信息信息
*
* @param id 交易信息主键
* @return 结果
*/
public int deleteTradeInfoById(Long id);
}

View File

@ -0,0 +1,101 @@
package com.ruoyi.info.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.info.util.GenerateNoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.info.mapper.TradeInfoMapper;
import com.ruoyi.info.domain.TradeInfo;
import com.ruoyi.info.service.ITradeInfoService;
/**
* 交易信息Service业务层处理
*
* @author ruoyi
* @date 2022-03-10
*/
@Service
public class TradeInfoServiceImpl implements ITradeInfoService
{
@Autowired
private TradeInfoMapper tradeInfoMapper;
@Autowired
private GenerateNoUtils generateNoUtils;
/**
* 查询交易信息
*
* @param id 交易信息主键
* @return 交易信息
*/
@Override
public TradeInfo selectTradeInfoById(Long id)
{
return tradeInfoMapper.selectTradeInfoById(id);
}
/**
* 查询交易信息列表
*
* @param tradeInfo 交易信息
* @return 交易信息
*/
@Override
public List<TradeInfo> selectTradeInfoList(TradeInfo tradeInfo)
{
return tradeInfoMapper.selectTradeInfoList(tradeInfo);
}
/**
* 新增交易信息
*
* @param tradeInfo 交易信息
* @return 结果
*/
@Override
public int insertTradeInfo(TradeInfo tradeInfo)
{
String tradeNo = generateNoUtils.tradeNo();
tradeInfo.setCreateTime(DateUtils.getNowDate());
tradeInfo.setTradeNo(tradeNo);
return tradeInfoMapper.insertTradeInfo(tradeInfo);
}
/**
* 修改交易信息
*
* @param tradeInfo 交易信息
* @return 结果
*/
@Override
public int updateTradeInfo(TradeInfo tradeInfo)
{
tradeInfo.setUpdateTime(DateUtils.getNowDate());
return tradeInfoMapper.updateTradeInfo(tradeInfo);
}
/**
* 批量删除交易信息
*
* @param ids 需要删除的交易信息主键
* @return 结果
*/
@Override
public int deleteTradeInfoByIds(Long[] ids)
{
return tradeInfoMapper.deleteTradeInfoByIds(ids);
}
/**
* 删除交易信息信息
*
* @param id 交易信息主键
* @return 结果
*/
@Override
public int deleteTradeInfoById(Long id)
{
return tradeInfoMapper.deleteTradeInfoById(id);
}
}

View File

@ -0,0 +1,37 @@
package com.ruoyi.info.util;
import com.ruoyi.common.core.redis.RedisCache;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.concurrent.TimeUnit;
@Component
public class GenerateNoUtils {
@Autowired
private RedisCache redisCache;
public String tradeNo() {
String yyyyMMdd = DateFormatUtils.format(new Date(), "yyyyMMdd");
String incrKey = "trade:" + yyyyMMdd;
Long increment = redisCache.redisTemplate.opsForValue().increment(incrKey, 1);
redisCache.expire(incrKey, 1L, TimeUnit.DAYS);
return yyyyMMdd + paddingFour(increment);
}
private static String paddingFour(long l) {
String s = String.valueOf(l);
int length = s.length();
if (length > 3) {
return s;
}
for (; length < 4; length++) {
s = "0" + s;
}
return s;
}
}

View File

@ -0,0 +1,142 @@
<?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.ruoyi.info.mapper.TradeInfoMapper">
<resultMap type="TradeInfo" id="TradeInfoResult">
<result property="id" column="id" />
<result property="tradeNo" column="trade_no" />
<result property="operatorName" column="operator_name" />
<result property="groupNo" column="group_no" />
<result property="cardType" column="card_type" />
<result property="currencyType" column="currency_type" />
<result property="cardValue" column="card_value" />
<result property="buyCardExchangeRate" column="buy_card_exchange_rate" />
<result property="buyCost" column="buy_cost" />
<result property="nailaValue" column="naila_value" />
<result property="code" column="code" />
<result property="commGroup" column="comm_group" />
<result property="salePrice" column="sale_price" />
<result property="profit" column="profit" />
<result property="bankAccount" column="bank_account" />
<result property="payStatus" column="pay_status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTradeInfoVo">
select id, trade_no, operator_name, group_no, card_type, currency_type, card_value, buy_card_exchange_rate, buy_cost, naila_value, code, comm_group, sale_price, profit, bank_account, pay_status, create_by, create_time, update_by, update_time from trade_info
</sql>
<select id="selectTradeInfoList" parameterType="TradeInfo" resultMap="TradeInfoResult">
<include refid="selectTradeInfoVo"/>
<where>
<if test="tradeNo != null and tradeNo != ''"> and trade_no = #{tradeNo}</if>
<if test="operatorName != null and operatorName != ''"> and operator_name like concat('%', #{operatorName}, '%')</if>
<if test="groupNo != null and groupNo != ''"> and group_no = #{groupNo}</if>
<if test="cardType != null and cardType != ''"> and card_type = #{cardType}</if>
<if test="currencyType != null and currencyType != ''"> and currency_type = #{currencyType}</if>
<if test="cardValue != null "> and card_value = #{cardValue}</if>
<if test="buyCardExchangeRate != null "> and buy_card_exchange_rate = #{buyCardExchangeRate}</if>
<if test="buyCost != null "> and buy_cost = #{buyCost}</if>
<if test="nailaValue != null "> and naila_value = #{nailaValue}</if>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="commGroup != null and commGroup != ''"> and comm_group = #{commGroup}</if>
<if test="salePrice != null "> and sale_price = #{salePrice}</if>
<if test="profit != null "> and profit = #{profit}</if>
<if test="bankAccount != null and bankAccount != ''"> and bank_account = #{bankAccount}</if>
<if test="payStatus != null and payStatus != ''"> and pay_status = #{payStatus}</if>
</where>
</select>
<select id="selectTradeInfoById" parameterType="Long" resultMap="TradeInfoResult">
<include refid="selectTradeInfoVo"/>
where id = #{id}
</select>
<insert id="insertTradeInfo" parameterType="TradeInfo" useGeneratedKeys="true" keyProperty="id">
insert into trade_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tradeNo != null and tradeNo != ''">trade_no,</if>
<if test="operatorName != null">operator_name,</if>
<if test="groupNo != null">group_no,</if>
<if test="cardType != null">card_type,</if>
<if test="currencyType != null">currency_type,</if>
<if test="cardValue != null">card_value,</if>
<if test="buyCardExchangeRate != null">buy_card_exchange_rate,</if>
<if test="buyCost != null">buy_cost,</if>
<if test="nailaValue != null">naila_value,</if>
<if test="code != null">code,</if>
<if test="commGroup != null">comm_group,</if>
<if test="salePrice != null">sale_price,</if>
<if test="profit != null">profit,</if>
<if test="bankAccount != null">bank_account,</if>
<if test="payStatus != null">pay_status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tradeNo != null and tradeNo != ''">#{tradeNo},</if>
<if test="operatorName != null">#{operatorName},</if>
<if test="groupNo != null">#{groupNo},</if>
<if test="cardType != null">#{cardType},</if>
<if test="currencyType != null">#{currencyType},</if>
<if test="cardValue != null">#{cardValue},</if>
<if test="buyCardExchangeRate != null">#{buyCardExchangeRate},</if>
<if test="buyCost != null">#{buyCost},</if>
<if test="nailaValue != null">#{nailaValue},</if>
<if test="code != null">#{code},</if>
<if test="commGroup != null">#{commGroup},</if>
<if test="salePrice != null">#{salePrice},</if>
<if test="profit != null">#{profit},</if>
<if test="bankAccount != null">#{bankAccount},</if>
<if test="payStatus != null">#{payStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTradeInfo" parameterType="TradeInfo">
update trade_info
<trim prefix="SET" suffixOverrides=",">
<if test="tradeNo != null and tradeNo != ''">trade_no = #{tradeNo},</if>
<if test="operatorName != null">operator_name = #{operatorName},</if>
<if test="groupNo != null">group_no = #{groupNo},</if>
<if test="cardType != null">card_type = #{cardType},</if>
<if test="currencyType != null">currency_type = #{currencyType},</if>
<if test="cardValue != null">card_value = #{cardValue},</if>
<if test="buyCardExchangeRate != null">buy_card_exchange_rate = #{buyCardExchangeRate},</if>
<if test="buyCost != null">buy_cost = #{buyCost},</if>
<if test="nailaValue != null">naila_value = #{nailaValue},</if>
<if test="code != null">code = #{code},</if>
<if test="commGroup != null">comm_group = #{commGroup},</if>
<if test="salePrice != null">sale_price = #{salePrice},</if>
<if test="profit != null">profit = #{profit},</if>
<if test="bankAccount != null">bank_account = #{bankAccount},</if>
<if test="payStatus != null">pay_status = #{payStatus},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTradeInfoById" parameterType="Long">
delete from trade_info where id = #{id}
</delete>
<delete id="deleteTradeInfoByIds" parameterType="String">
delete from trade_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>