Browse Source

1、储值记录需求开发

yys 1 month ago
parent
commit
4dadc41d99

+ 125 - 0
fs-company/src/main/java/com/fs/company/controller/company/RechargeRecordController.java

@@ -0,0 +1,125 @@
+package com.fs.company.controller.company;
+
+import java.io.IOException;
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.RechargeRecord;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.service.IRechargeRecordService;
+import com.fs.framework.security.LoginUser;
+import com.fs.framework.service.TokenService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 储值支付记录Controller
+ *
+ * @author ruoyi
+ * @date 2026-03-17
+ */
+@RestController
+@RequestMapping("/company/rechargeRecord")
+public class RechargeRecordController extends BaseController
+{
+    @Autowired
+    private IRechargeRecordService rechargeRecordService;
+
+    @Autowired
+    private ICompanyService companyService;
+
+    @Autowired
+    private TokenService tokenService;
+    /**
+     * 查询储值支付记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:rechargeRecord:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(RechargeRecord rechargeRecord)
+    {
+        startPage();
+        List<RechargeRecord> list = rechargeRecordService.selectRechargeRecordList(rechargeRecord);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出储值支付记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('company:rechargeRecord:export')")
+    @Log(title = "储值支付记录", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, RechargeRecord rechargeRecord) throws IOException {
+        List<RechargeRecord> list = rechargeRecordService.selectRechargeRecordList(rechargeRecord);
+        ExcelUtil<RechargeRecord> util = new ExcelUtil<RechargeRecord>(RechargeRecord.class);
+        util.exportExcel(response, list, "储值支付记录数据");
+    }
+
+    /**
+     * 获取储值支付记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('company:rechargeRecord:query')")
+    @GetMapping(value = "/{id}")
+    public R getInfo(@PathVariable("id") Long id)
+    {
+        return R.ok().put("data", rechargeRecordService.selectRechargeRecordById(id));
+    }
+
+    /**
+     * 新增储值支付记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:rechargeRecord:add')")
+    @Log(title = "储值支付记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody RechargeRecord rechargeRecord)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        Long companyId = loginUser.getUser().getCompanyId();
+        Company company = companyService.selectCompanyById(companyId);
+        if (ObjectUtil.isNotEmpty(company)&&company.getIsOpenStoredPay().equals(0)){
+            throw new RuntimeException("储值支付暂时没有开放!请联系管理员!");
+        }
+        rechargeRecord.setCompanyId(company.getCompanyId());
+        rechargeRecord.setCompanyName(company.getCompanyName());
+        return toAjax(rechargeRecordService.insertRechargeRecord(rechargeRecord));
+    }
+
+    /**
+     * 修改储值支付记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:rechargeRecord:edit')")
+    @Log(title = "储值支付记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody RechargeRecord rechargeRecord)
+    {
+        return toAjax(rechargeRecordService.updateRechargeRecord(rechargeRecord));
+    }
+
+    /**
+     * 删除储值支付记录
+     */
+    @PreAuthorize("@ss.hasPermi('company:rechargeRecord:remove')")
+    @Log(title = "储值支付记录", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(rechargeRecordService.deleteRechargeRecordByIds(ids));
+    }
+}

+ 155 - 0
fs-service/src/main/java/com/fs/company/domain/RechargeRecord.java

@@ -0,0 +1,155 @@
+package com.fs.company.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 储值支付记录对象 recharge_record
+ *
+ * @author ruoyi
+ * @date 2026-03-17
+ */
+public class RechargeRecord extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键ID */
+    private Long id;
+
+    /** 用户ID */
+    @Excel(name = "用户ID")
+    private Long userId;
+
+    /** 用户姓名 */
+    @Excel(name = "用户姓名")
+    private String userName;
+
+    /** 储值金额 */
+    @Excel(name = "储值金额")
+    private BigDecimal totalAmount;
+
+    /** 交易流水号 */
+    @Excel(name = "交易流水号")
+    private String transactionId;
+
+    /** 业务类型:0-充值,1-消费 */
+    @Excel(name = "业务类型", readConverterExp = "0=充值,1=消费")
+    private Integer businessType;
+
+    /** 公司ID */
+    @Excel(name = "公司ID")
+    private Long companyId;
+
+    /** 公司名称 */
+    @Excel(name = "公司名称")
+    private String companyName;
+
+    /** 删除标志:0-未删除,1-已删除 */
+    private String delFlag;
+
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+    public void setUserId(Long userId)
+    {
+        this.userId = userId;
+    }
+
+    public Long getUserId()
+    {
+        return userId;
+    }
+    public void setUserName(String userName)
+    {
+        this.userName = userName;
+    }
+
+    public String getUserName()
+    {
+        return userName;
+    }
+    public void setTotalAmount(BigDecimal totalAmount)
+    {
+        this.totalAmount = totalAmount;
+    }
+
+    public BigDecimal getTotalAmount()
+    {
+        return totalAmount;
+    }
+    public void setTransactionId(String transactionId)
+    {
+        this.transactionId = transactionId;
+    }
+
+    public String getTransactionId()
+    {
+        return transactionId;
+    }
+    public Integer getBusinessType()
+    {
+        return businessType;
+    }
+
+    public void setBusinessType(Integer businessType)
+    {
+        this.businessType = businessType;
+    }
+    public Long getCompanyId()
+    {
+        return companyId;
+    }
+
+    public void setCompanyId(Long companyId)
+    {
+        this.companyId = companyId;
+    }
+    public String getCompanyName()
+    {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName)
+    {
+        this.companyName = companyName;
+    }
+    public String getDelFlag()
+    {
+        return delFlag;
+    }
+    public void setDelFlag(String delFlag)
+    {
+        this.delFlag = delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("userId", getUserId())
+                .append("userName", getUserName())
+                .append("totalAmount", getTotalAmount())
+                .append("transactionId", getTransactionId())
+                .append("businessType", getBusinessType())
+                .append("companyId", getCompanyId())
+                .append("companyName", getCompanyName())
+                .append("remark", getRemark())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("delFlag", getDelFlag())
+                .toString();
+    }
+}

+ 62 - 0
fs-service/src/main/java/com/fs/company/mapper/RechargeRecordMapper.java

@@ -0,0 +1,62 @@
+package com.fs.company.mapper;
+
+import com.fs.company.domain.RechargeRecord;
+
+import java.util.List;
+
+/**
+ * 储值支付记录Mapper接口
+ *
+ * @author ruoyi
+ * @date 2026-03-17
+ */
+public interface RechargeRecordMapper
+{
+    /**
+     * 查询储值支付记录
+     *
+     * @param id 储值支付记录主键
+     * @return 储值支付记录
+     */
+    public RechargeRecord selectRechargeRecordById(Long id);
+
+    /**
+     * 查询储值支付记录列表
+     *
+     * @param rechargeRecord 储值支付记录
+     * @return 储值支付记录集合
+     */
+    public List<RechargeRecord> selectRechargeRecordList(RechargeRecord rechargeRecord);
+
+    /**
+     * 新增储值支付记录
+     *
+     * @param rechargeRecord 储值支付记录
+     * @return 结果
+     */
+    public int insertRechargeRecord(RechargeRecord rechargeRecord);
+
+    /**
+     * 修改储值支付记录
+     *
+     * @param rechargeRecord 储值支付记录
+     * @return 结果
+     */
+    public int updateRechargeRecord(RechargeRecord rechargeRecord);
+
+    /**
+     * 删除储值支付记录
+     *
+     * @param id 储值支付记录主键
+     * @return 结果
+     */
+    public int deleteRechargeRecordById(Long id);
+
+    /**
+     * 批量删除储值支付记录
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteRechargeRecordByIds(Long[] ids);
+}

+ 62 - 0
fs-service/src/main/java/com/fs/company/service/IRechargeRecordService.java

@@ -0,0 +1,62 @@
+package com.fs.company.service;
+
+import com.fs.company.domain.RechargeRecord;
+
+import java.util.List;
+
+/**
+ * 储值支付记录Service接口
+ *
+ * @author ruoyi
+ * @date 2026-03-17
+ */
+public interface IRechargeRecordService
+{
+    /**
+     * 查询储值支付记录
+     *
+     * @param id 储值支付记录主键
+     * @return 储值支付记录
+     */
+    public RechargeRecord selectRechargeRecordById(Long id);
+
+    /**
+     * 查询储值支付记录列表
+     *
+     * @param rechargeRecord 储值支付记录
+     * @return 储值支付记录集合
+     */
+    public List<RechargeRecord> selectRechargeRecordList(RechargeRecord rechargeRecord);
+
+    /**
+     * 新增储值支付记录
+     *
+     * @param rechargeRecord 储值支付记录
+     * @return 结果
+     */
+    public int insertRechargeRecord(RechargeRecord rechargeRecord);
+
+    /**
+     * 修改储值支付记录
+     *
+     * @param rechargeRecord 储值支付记录
+     * @return 结果
+     */
+    public int updateRechargeRecord(RechargeRecord rechargeRecord);
+
+    /**
+     * 批量删除储值支付记录
+     *
+     * @param ids 需要删除的储值支付记录主键集合
+     * @return 结果
+     */
+    public int deleteRechargeRecordByIds(Long[] ids);
+
+    /**
+     * 删除储值支付记录信息
+     *
+     * @param id 储值支付记录主键
+     * @return 结果
+     */
+    public int deleteRechargeRecordById(Long id);
+}

+ 95 - 0
fs-service/src/main/java/com/fs/company/service/impl/RechargeRecordServiceImpl.java

@@ -0,0 +1,95 @@
+package com.fs.company.service.impl;
+
+import java.util.List;
+
+import com.fs.company.domain.RechargeRecord;
+import com.fs.company.mapper.RechargeRecordMapper;
+import com.fs.company.service.IRechargeRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 储值支付记录Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2026-03-17
+ */
+@Service
+public class RechargeRecordServiceImpl implements IRechargeRecordService
+{
+    @Autowired
+    private RechargeRecordMapper rechargeRecordMapper;
+
+    /**
+     * 查询储值支付记录
+     *
+     * @param id 储值支付记录主键
+     * @return 储值支付记录
+     */
+    @Override
+    public RechargeRecord selectRechargeRecordById(Long id)
+    {
+        return rechargeRecordMapper.selectRechargeRecordById(id);
+    }
+
+    /**
+     * 查询储值支付记录列表
+     *
+     * @param rechargeRecord 储值支付记录
+     * @return 储值支付记录
+     */
+    @Override
+    public List<RechargeRecord> selectRechargeRecordList(RechargeRecord rechargeRecord)
+    {
+        return rechargeRecordMapper.selectRechargeRecordList(rechargeRecord);
+    }
+
+    /**
+     * 新增储值支付记录
+     *
+     * @param rechargeRecord 储值支付记录
+     * @return 结果
+     */
+    @Override
+    public int insertRechargeRecord(RechargeRecord rechargeRecord)
+    {
+
+        return rechargeRecordMapper.insertRechargeRecord(rechargeRecord);
+    }
+
+    /**
+     * 修改储值支付记录
+     *
+     * @param rechargeRecord 储值支付记录
+     * @return 结果
+     */
+    @Override
+    public int updateRechargeRecord(RechargeRecord rechargeRecord)
+    {
+        return rechargeRecordMapper.updateRechargeRecord(rechargeRecord);
+    }
+
+    /**
+     * 批量删除储值支付记录
+     *
+     * @param ids 需要删除的储值支付记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRechargeRecordByIds(Long[] ids)
+    {
+        return rechargeRecordMapper.deleteRechargeRecordByIds(ids);
+    }
+
+    /**
+     * 删除储值支付记录信息
+     *
+     * @param id 储值支付记录主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRechargeRecordById(Long id)
+    {
+        return rechargeRecordMapper.deleteRechargeRecordById(id);
+    }
+}

+ 102 - 0
fs-service/src/main/resources/mapper/company/RechargeRecordMapper.xml

@@ -0,0 +1,102 @@
+<?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.fs.company.mapper.RechargeRecordMapper">
+
+    <resultMap type="RechargeRecord" id="RechargeRecordResult">
+        <result property="id"    column="id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="userName"    column="user_name"    />
+        <result property="totalAmount"    column="total_amount"    />
+        <result property="transactionId"    column="transaction_id"    />
+        <result property="businessType"    column="business_type"    />
+        <result property="companyId"    column="company_id"    />
+        <result property="companyName"    column="company_name"    />
+        <result property="remark"    column="remark"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="delFlag"    column="del_flag"    />
+    </resultMap>
+
+    <sql id="selectRechargeRecordVo">
+        select id, user_id, user_name, total_amount, transaction_id, business_type, company_id, company_name, remark, create_by, create_time, update_by, update_time, del_flag from recharge_record
+    </sql>
+
+    <select id="selectRechargeRecordList" parameterType="RechargeRecord" resultMap="RechargeRecordResult">
+        <include refid="selectRechargeRecordVo"/>
+        <where>
+            and del_flag = '0'
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
+            <if test="transactionId != null  and transactionId != ''"> and transaction_id like concat('%', #{transactionId}, '%')</if>
+            <if test="businessType != null"> and business_type = #{businessType}</if>
+            <if test="companyId != null"> and company_id = #{companyId}</if>
+            <if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
+        </where>
+        order by create_time desc
+    </select>
+
+    <select id="selectRechargeRecordById" parameterType="Long" resultMap="RechargeRecordResult">
+        <include refid="selectRechargeRecordVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertRechargeRecord" parameterType="RechargeRecord" useGeneratedKeys="true" keyProperty="id">
+        insert into recharge_record
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="userId != null">user_id,</if>
+            <if test="userName != null and userName != ''">user_name,</if>
+            <if test="totalAmount != null">total_amount,</if>
+            <if test="transactionId != null and transactionId != ''">transaction_id,</if>
+            <if test="businessType != null">business_type,</if>
+            <if test="companyId != null">company_id,</if>
+            <if test="companyName != null and companyName != ''">company_name,</if>
+            <if test="remark != null">remark,</if>
+            <if test="createBy != null">create_by,</if>
+            create_time
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="userId != null">#{userId},</if>
+            <if test="userName != null and userName != ''">#{userName},</if>
+            <if test="totalAmount != null">#{totalAmount},</if>
+            <if test="transactionId != null and transactionId != ''">#{transactionId},</if>
+            <if test="businessType != null">#{businessType},</if>
+            <if test="companyId != null">#{companyId},</if>
+            <if test="companyName != null and companyName != ''">#{companyName},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="createBy != null">#{createBy},</if>
+            sysdate()
+        </trim>
+    </insert>
+
+    <update id="updateRechargeRecord" parameterType="RechargeRecord">
+        update recharge_record
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="userName != null and userName != ''">user_name = #{userName},</if>
+            <if test="totalAmount != null">total_amount = #{totalAmount},</if>
+            <if test="transactionId != null and transactionId != ''">transaction_id = #{transactionId},</if>
+            <if test="businessType != null">business_type = #{businessType},</if>
+            <if test="companyId != null">company_id = #{companyId},</if>
+            <if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            update_time = sysdate()
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteRechargeRecordById" parameterType="Long">
+        update recharge_record set del_flag = '1' where id = #{id}
+    </delete>
+
+    <delete id="deleteRechargeRecordByIds" parameterType="String">
+        update recharge_record set del_flag = '1' where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>