dongke 1 год назад
Родитель
Сommit
3b7d03757a

+ 86 - 0
src/main/java/com/dk/oauth/controller/ReceiptSetController.java

@@ -0,0 +1,86 @@
+package com.dk.oauth.controller;
+
+import com.dk.common.model.vo.mst.OrgVO;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.oauth.model.pojo.ReceiptSet;
+import com.dk.common.service.BaseService;
+import com.dk.oauth.service.IReceiptSetService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import io.swagger.annotations.Api;
+import com.dk.oauth.service.impl.ReceiptSetService;
+
+@Api(tags = "发票设置API接口")
+@RestController
+@RequestMapping("/receiptSet")
+public class ReceiptSetController{
+
+
+
+    @Autowired
+    private IReceiptSetService receiptSetService;
+
+
+    /**
+     * @desc : 条件查询
+     * @author : 王英杰
+     * @date : 2024/2/26 10:36
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO selectByCond(@RequestBody ReceiptSet receiptSet) {
+        return receiptSetService.selectByCond(receiptSet);
+    }
+
+    /**
+     * @desc : 通过ID查询
+     * @author : 付斌
+     * @date : 2023/1/9 10:41
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO selectById(@PathVariable String id) {
+        return receiptSetService.selectById(id);
+    }
+
+    /**
+     * @desc   : 新建发票设置
+     * @author : 王英杰
+     * @date   : 2024/2/27 9:13
+     */
+    @ApiOperation( value = "新建发票设置", notes = "新建发票设置" )
+    @PostMapping({"insert"})
+    public ResponseResultVO<?> insert(@RequestBody ReceiptSet receiptSet) {
+        return receiptSetService.insertSingle(receiptSet);
+    }
+    /**
+     * @desc   : 编辑发票设置
+     * @author : 王英杰
+     * @date   : 2024/2/27 9:13
+     */
+    @ApiOperation( value = "编辑发票设置", notes = "编辑发票设置" )
+    @PostMapping({"update"})
+    public ResponseResultVO<?> update(@RequestBody ReceiptSet receiptSet) {
+        return receiptSetService.updateSingle(receiptSet);
+    }
+
+
+    /**
+     * @desc : 停用
+     * @author : 王英杰
+     * @date :  2023/1/4 9:39
+     */
+    @PostMapping("disable/{id}")
+    public ResponseResultVO<Boolean> disable(@PathVariable String id) {
+        return receiptSetService.disable(id);
+    }
+    /**
+     * @desc : 启用
+     * @author : 王英杰
+     * @date :  2023/1/4 9:39
+     */
+    @PostMapping("enable/{id}")
+    public ResponseResultVO<Boolean> enable(@PathVariable String id) {
+        return receiptSetService.enable(id);
+    }
+}

+ 12 - 0
src/main/java/com/dk/oauth/controller/TradeController.java

@@ -2,6 +2,7 @@ package com.dk.oauth.controller;
 
 import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.entity.Trade;
+import com.dk.oauth.query.RoleQuery;
 import com.dk.oauth.service.ITradeService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -39,4 +40,15 @@ public class TradeController {
     public ResponseResultVO<?> insertTrade(@RequestBody Trade trade) {
         return tradeService.insertTrade(trade);
     }
+
+    /**
+     * @desc : 条件查询
+     * @author : 王英杰
+     * @date : 2024/2/26 10:36
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO selectByCond(@RequestBody Trade trade) {
+        return tradeService.selectByCond(trade);
+    }
 }

+ 17 - 1
src/main/java/com/dk/oauth/entity/Trade.java

@@ -121,6 +121,9 @@ public class Trade  extends PageInfo<Trade> implements Serializable {
     @TableField(typeHandler = UuidListTypeHandler.class)
     private List<String> buyFunId;
 
+    @Excel(name = "开票标识")
+    @ApiModelProperty(value = "开票标识")
+    private String receiptStatus;
     /**
      * 购买版本
      */
@@ -202,7 +205,20 @@ public class Trade  extends PageInfo<Trade> implements Serializable {
      * 关联属性 + 查询条件
      * @TableField(exist = false)
      */
-
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(exist = false)
+    private LocalDate tradeTimeStart;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(exist = false)
+    private LocalDate tradeTimeEnd;
 
     private static final long serialVersionUID = 1L;
 }

+ 8 - 0
src/main/java/com/dk/oauth/entity/TradeResponse.java

@@ -168,4 +168,12 @@ public class TradeResponse   {
     @TableField(typeHandler = UuidListTypeHandler.class)
     private List<String> activityIds;
 
+    @ApiModelProperty(value = "交易类型")
+    private String tradeTypeName;
+    @ApiModelProperty(value = "交易状态")
+    private String tradeStatusName;
+    @ApiModelProperty(value = "开票标识")
+    private String receiptStatusName;
+    @ApiModelProperty(value = "开票标识")
+    private String receiptStatus;
 }

+ 31 - 0
src/main/java/com/dk/oauth/mapper/ReceiptSetMapper.java

@@ -0,0 +1,31 @@
+package com.dk.oauth.mapper;
+
+import com.dk.oauth.model.pojo.ReceiptSet;
+import com.dk.common.mapper.BaseMapper;
+import com.dk.oauth.response.ReceiptSetResponse;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+*  发票设置 Mapper
+*/
+@Repository
+public interface ReceiptSetMapper extends BaseMapper<ReceiptSet>{
+    /**
+     * @desc   : 根据条件进行查询
+     * @author : 王英杰
+     * @date : 2024/2/26 10:36
+     */
+    List<ReceiptSetResponse> selectReceiptSet(ReceiptSet receiptSet);
+
+    ReceiptSetResponse selectById( @Param("setId") String setId);
+
+    int updateById(ReceiptSet receiptSet);
+
+    int insertSingle(ReceiptSet receiptSet);
+
+    int getMaxDisplayNo ();
+}
+

+ 213 - 0
src/main/java/com/dk/oauth/model/pojo/ReceiptSet.java

@@ -0,0 +1,213 @@
+package com.dk.oauth.model.pojo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.*;
+import java.io.Serializable;
+
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.*;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+import java.time.LocalDateTime;
+
+/**
+ *  发票设置
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("发票设置")
+@TableName(value = "t_mst_receipt_set", autoResultMap = true)
+@ApiModel(value="实体类:发票设置", description="表名:t_mst_receipt_set")
+public class ReceiptSet extends PageInfo<ReceiptSet> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 发票设置ID
+     */
+    @TableId(value = "set_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "发票设置ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String setId;
+
+
+    /**
+     * 公司ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "公司ID")
+    @ApiModelProperty(value = "公司ID")
+    private Integer cpId;
+
+
+    /**
+     * 公司名称
+     */
+    @Excel(name = "公司名称")
+    @ApiModelProperty(value = "公司名称")
+    private String cpName;
+
+
+    /**
+     * 公司税号
+     */
+    @Excel(name = "公司税号")
+    @ApiModelProperty(value = "公司税号")
+    private String taxNo;
+
+
+    /**
+     * 电子邮箱
+     */
+    @Excel(name = "电子邮箱")
+    @ApiModelProperty(value = "电子邮箱")
+    private String cpEmail;
+
+
+    /**
+     * 注册地址
+     */
+    @Excel(name = "注册地址")
+    @ApiModelProperty(value = "注册地址")
+    private String cpAddress;
+
+
+    /**
+     * 注册电话
+     */
+    @Excel(name = "注册电话")
+    @ApiModelProperty(value = "注册电话")
+    private String cpPhone;
+
+
+    /**
+     * 开户行
+     */
+    @Excel(name = "开户行")
+    @ApiModelProperty(value = "开户行")
+    private String openBank;
+
+
+    /**
+     * 银行账户
+     */
+    @Excel(name = "银行账户")
+    @ApiModelProperty(value = "银行账户")
+    private String bankAccount;
+
+
+    /**
+     * 默认标识
+     */
+    @Excel(name = "默认标识")
+    @ApiModelProperty(value = "默认标识")
+    private Boolean flgDefault;
+
+
+    /**
+     * 显示顺序 (【1 ~ 46655】)
+     */
+    @Excel(name = "显示顺序 (【1 ~ 46655】)")
+    @ApiModelProperty(value = "显示顺序 (【1 ~ 46655】)")
+    private Integer displayNo;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 创建时间 (触发器自动处理)
+     */
+    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opCreateTime;
+
+
+    /**
+     * 创建用户 (触发器自动处理)
+     */
+    @Excel(name = "创建用户 (触发器自动处理)")
+    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
+    private Long opCreateUserId;
+
+
+    /**
+     * 修改时间 (触发器自动处理)
+     */
+    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opUpdateTime;
+
+
+    /**
+     * 修改用户 (触发器自动处理)
+     */
+    @Excel(name = "修改用户 (触发器自动处理)")
+    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
+    private Long opUpdateUserId;
+
+
+    /**
+     * 数据操作应用 (触发器自动处理)
+     */
+    @Excel(name = "数据操作应用 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
+    private String opAppCode;
+
+
+    /**
+     * 数据时间戳 (触发器自动处理)
+     */
+    @Excel(name = "数据时间戳 (触发器自动处理)")
+    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opTimestamp;
+
+
+    /**
+     * 数据操作数据库用户 (触发器自动处理)
+     */
+    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
+    private String opDbUser;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 211 - 0
src/main/java/com/dk/oauth/response/ReceiptSetResponse.java

@@ -0,0 +1,211 @@
+package com.dk.oauth.response;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.*;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *  发票设置
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@ExportTitle("发票设置")
+@TableName(value = "t_mst_receipt_set", autoResultMap = true)
+@ApiModel(value="实体类:发票设置", description="表名:t_mst_receipt_set")
+public class ReceiptSetResponse   implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 发票设置ID
+     */
+    @TableId(value = "set_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "发票设置ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String setId;
+
+
+    /**
+     * 公司ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "公司ID")
+    @ApiModelProperty(value = "公司ID")
+    private Integer cpId;
+
+
+    /**
+     * 公司名称
+     */
+    @Excel(name = "公司名称")
+    @ApiModelProperty(value = "公司名称")
+    private String cpName;
+
+
+    /**
+     * 公司税号
+     */
+    @Excel(name = "公司税号")
+    @ApiModelProperty(value = "公司税号")
+    private String taxNo;
+
+
+    /**
+     * 电子邮箱
+     */
+    @Excel(name = "电子邮箱")
+    @ApiModelProperty(value = "电子邮箱")
+    private String cpEmail;
+
+
+    /**
+     * 注册地址
+     */
+    @Excel(name = "注册地址")
+    @ApiModelProperty(value = "注册地址")
+    private String cpAddress;
+
+
+    /**
+     * 注册电话
+     */
+    @Excel(name = "注册电话")
+    @ApiModelProperty(value = "注册电话")
+    private String cpPhone;
+
+
+    /**
+     * 开户行
+     */
+    @Excel(name = "开户行")
+    @ApiModelProperty(value = "开户行")
+    private String openBank;
+
+
+    /**
+     * 银行账户
+     */
+    @Excel(name = "银行账户")
+    @ApiModelProperty(value = "银行账户")
+    private String bankAccount;
+
+
+    /**
+     * 默认标识
+     */
+    @Excel(name = "默认标识")
+    @ApiModelProperty(value = "默认标识")
+    private Boolean flgDefault;
+
+
+    /**
+     * 显示顺序 (【1 ~ 46655】)
+     */
+    @Excel(name = "显示顺序 (【1 ~ 46655】)")
+    @ApiModelProperty(value = "显示顺序 (【1 ~ 46655】)")
+    private Integer displayNo;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 创建时间 (触发器自动处理)
+     */
+    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opCreateTime;
+
+
+    /**
+     * 创建用户 (触发器自动处理)
+     */
+    @Excel(name = "创建用户 (触发器自动处理)")
+    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
+    private Long opCreateUserId;
+
+
+    /**
+     * 修改时间 (触发器自动处理)
+     */
+    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
+    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opUpdateTime;
+
+
+    /**
+     * 修改用户 (触发器自动处理)
+     */
+    @Excel(name = "修改用户 (触发器自动处理)")
+    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
+    private Long opUpdateUserId;
+
+
+    /**
+     * 数据操作应用 (触发器自动处理)
+     */
+    @Excel(name = "数据操作应用 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
+    private String opAppCode;
+
+
+    /**
+     * 数据时间戳 (触发器自动处理)
+     */
+    @Excel(name = "数据时间戳 (触发器自动处理)")
+    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime opTimestamp;
+
+
+    /**
+     * 数据操作数据库用户 (触发器自动处理)
+     */
+    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
+    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
+    private String opDbUser;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 28 - 0
src/main/java/com/dk/oauth/service/IReceiptSetService.java

@@ -0,0 +1,28 @@
+package com.dk.oauth.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.oauth.entity.Trade;
+import com.dk.oauth.model.pojo.ReceiptSet;
+import com.dk.oauth.response.ReceiptSetResponse;
+
+/**
+ * 交易记录接口
+ *
+ * @author admin
+ * @since 2023-07-01 09:41:05
+ */
+public interface IReceiptSetService extends IService<ReceiptSet> {
+
+    ResponseResultVO selectByCond(ReceiptSet receiptSet);
+
+    ResponseResultVO selectById(String id);
+
+    ResponseResultVO<Boolean> disable(String id);
+
+    ResponseResultVO<Boolean> enable(String id);
+
+    ResponseResultVO<Boolean> insertSingle(ReceiptSet receiptSet);
+
+    ResponseResultVO<Boolean> updateSingle(ReceiptSet receiptSet);
+}

+ 3 - 0
src/main/java/com/dk/oauth/service/ITradeService.java

@@ -3,6 +3,7 @@ package com.dk.oauth.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.entity.Trade;
+import com.dk.oauth.query.RoleQuery;
 
 import java.util.Map;
 
@@ -18,4 +19,6 @@ public interface ITradeService extends IService<Trade> {
 
     ResponseResultVO selectById(Integer id);
 
+    ResponseResultVO selectByCond(Trade trade);
+
 }

+ 119 - 0
src/main/java/com/dk/oauth/service/impl/ReceiptSetService.java

@@ -0,0 +1,119 @@
+package com.dk.oauth.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dk.common.infrastructure.constant.Constant;
+import com.dk.common.response.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.oauth.entity.Trade;
+import com.dk.oauth.mapper.TradeMapper;
+import com.dk.oauth.model.pojo.ReceiptSet;
+import com.dk.oauth.mapper.ReceiptSetMapper;
+import com.dk.common.service.BaseService;
+import com.dk.common.mapper.BaseMapper;
+import com.dk.oauth.response.ReceiptSetResponse;
+import com.dk.oauth.service.IReceiptSetService;
+import com.dk.oauth.service.ITradeService;
+import org.springframework.stereotype.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@Transactional
+public class ReceiptSetService extends ServiceImpl<ReceiptSetMapper, ReceiptSet> implements IReceiptSetService {
+
+
+    @Resource
+    ReceiptSetMapper receiptSetMapper;
+
+    /**
+     * @desc : 查询
+     * @author : 王英杰
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    public ResponseResultVO selectByCond(ReceiptSet receiptSet) {
+
+        return ResponseResultUtil.success(receiptSetMapper.selectReceiptSet(receiptSet));
+    }
+
+    /**
+     * @desc : 查询 单个
+     * @author : 王英杰
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    public ResponseResultVO selectById(String id) {
+        ReceiptSetResponse receiptSetResponse =   receiptSetMapper.selectById(id);
+        return ResponseResultUtil.success(receiptSetResponse);
+    }
+
+    /**
+     * @desc : 新建插入
+     * @author : 王英杰
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    public ResponseResultVO<Boolean> insertSingle(ReceiptSet receiptSet) {
+        if (receiptSet.getFlgDefault()) { //设置成默认的
+            //先把之前的 默认 更新成 false
+            List<ReceiptSetResponse> list = receiptSetMapper.selectReceiptSet(new ReceiptSet().setCpId(receiptSet.getCpId()).setFlgDefault(true));
+            if (list.size() > 0) {
+                ReceiptSetResponse receiptSetResponse = list.get(0);
+                receiptSetMapper.updateById(new ReceiptSet().setSetId(receiptSetResponse.getSetId()).setFlgDefault(false));
+            }
+        }
+        receiptSet.setDisplayNo(receiptSetMapper.getMaxDisplayNo() + 1);
+        int status = receiptSetMapper.insertSingle(receiptSet);
+        return ResponseResultUtil.success(status > 0);
+    }
+
+    /**
+     * @desc : 编辑
+     * @author : 王英杰
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    public ResponseResultVO<Boolean> updateSingle(ReceiptSet receiptSet) {
+        if (receiptSet.getFlgDefault()) { //设置成默认的
+            //先把之前的 默认 更新成 false
+            List<ReceiptSetResponse> list = receiptSetMapper.selectReceiptSet(new ReceiptSet().setCpId(receiptSet.getCpId()).setFlgDefault(true));
+            if (list.size() > 0) {
+                ReceiptSetResponse receiptSetResponse = list.get(0);
+                receiptSetMapper.updateById(new ReceiptSet().setSetId(receiptSetResponse.getSetId()).setFlgDefault(false));
+            }
+        }
+        int status = receiptSetMapper.updateById(receiptSet);
+        return ResponseResultUtil.success(status > 0);
+    }
+
+    /**
+     * @desc : 启用
+     * @author : 王英杰
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    public ResponseResultVO<Boolean> enable(String id) {
+
+        int status = receiptSetMapper.updateById(new ReceiptSet().setSetId(id).setFlgValid(true));
+        return ResponseResultUtil.success(status > 0);
+    }
+
+    /**
+     * @desc : 停用
+     * @author : 王英杰
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    public ResponseResultVO<Boolean> disable(String id) {
+//		ReceiptSetResponse receiptSetResponse =  receiptSetMapper.selectById(id);
+        int status = receiptSetMapper.updateById(new ReceiptSet().setSetId(id).setFlgValid(false));
+        return ResponseResultUtil.success(status > 0);
+    }
+
+}

+ 10 - 2
src/main/java/com/dk/oauth/service/impl/TradeServiceImpl.java

@@ -5,6 +5,7 @@ import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.entity.Trade;
 import com.dk.oauth.mapper.TradeMapper;
+import com.dk.oauth.query.RoleQuery;
 import com.dk.oauth.service.ITradeService;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -31,8 +32,15 @@ public class TradeServiceImpl extends ServiceImpl<TradeMapper, Trade> implements
     public ResponseResultVO selectById(Integer id) {
         return ResponseResultUtil.success(TradeMapper.selectById(id));
     }
-
-
+    /**
+     * @desc : 查询交易记录
+     * @author : 王英杰
+     * @date : 2023/2/3 13:32
+     */
+    @Override
+    public ResponseResultVO selectByCond(Trade query) {
+        return ResponseResultUtil.success(TradeMapper.selectTrade(query));
+    }
 
     /**
      * @desc : 注册-商户

+ 275 - 0
src/main/resources/mapper/ReceiptSetMapper.xml

@@ -0,0 +1,275 @@
+<?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.dk.oauth.mapper.ReceiptSetMapper">
+
+    <!-- 通用设置 -->
+    <!-- 通用查询列 -->
+    <sql id="Base_Column_List">
+        set_id
+        , cp_id, cp_name, tax_no, cp_email, cp_address, cp_phone, open_bank, bank_account, flg_default, display_no, flg_valid, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user
+    </sql>
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.dk.oauth.response.ReceiptSetResponse">
+        <id column="set_id" property="setId"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="cp_name" property="cpName"/>
+        <result column="tax_no" property="taxNo"/>
+        <result column="cp_email" property="cpEmail"/>
+        <result column="cp_address" property="cpAddress"/>
+        <result column="cp_phone" property="cpPhone"/>
+        <result column="open_bank" property="openBank"/>
+        <result column="bank_account" property="bankAccount"/>
+        <result column="flg_default" property="flgDefault"/>
+        <result column="display_no" property="displayNo"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
+        <result column="op_create_user_id" property="opCreateUserId"/>
+        <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
+        <result column="op_update_user_id" property="opUpdateUserId"/>
+        <result column="op_app_code" property="opAppCode"/>
+        <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
+        <result column="op_db_user" property="opDbUser"/>
+    </resultMap>
+
+    <!-- 通用条件列 -->
+    <sql id="Condition">
+        <where>
+            <if test="cpId != null">
+                AND cp_id = #{cpId}
+            </if>
+            <if test="cpName != null and cpName != ''">
+                AND cp_name = #{cpName}
+            </if>
+            <if test="taxNo != null and taxNo != ''">
+                AND tax_no = #{taxNo}
+            </if>
+            <if test="cpEmail != null and cpEmail != ''">
+                AND cp_email = #{cpEmail}
+            </if>
+            <if test="cpAddress != null and cpAddress != ''">
+                AND cp_address = #{cpAddress}
+            </if>
+            <if test="cpPhone != null and cpPhone != ''">
+                AND cp_phone = #{cpPhone}
+            </if>
+            <if test="openBank != null and openBank != ''">
+                AND open_bank = #{openBank}
+            </if>
+            <if test="bankAccount != null and bankAccount != ''">
+                AND bank_account = #{bankAccount}
+            </if>
+            <if test="flgDefault != null">
+                AND flg_default = #{flgDefault}
+            </if>
+            <if test="displayNo != null">
+                AND display_no = #{displayNo}
+            </if>
+            <if test="flgValid != null">
+                AND flg_valid = #{flgValid}
+            </if>
+            <if test="opCreateTime != null">
+                AND op_create_time = #{opCreateTime}
+            </if>
+            <if test="opCreateUserId != null">
+                AND op_create_user_id = #{opCreateUserId}
+            </if>
+            <if test="opUpdateTime != null">
+                AND op_update_time = #{opUpdateTime}
+            </if>
+            <if test="opUpdateUserId != null">
+                AND op_update_user_id = #{opUpdateUserId}
+            </if>
+            <if test="opAppCode != null and opAppCode != ''">
+                AND op_app_code = #{opAppCode}
+            </if>
+            <if test="opTimestamp != null">
+                AND op_timestamp = #{opTimestamp}
+            </if>
+            <if test="opDbUser != null and opDbUser != ''">
+                AND op_db_user = #{opDbUser}
+            </if>
+        </where>
+    </sql>
+
+    <sql id="idsForeach">
+        <!-- 根据主键setId批量操作 -->
+        WHERE set_id in
+        <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </sql>
+
+    <!-- 查询表t_mst_receipt_set,(条件查询+分页)列表 -->
+    <select id="selectByCond" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mst_receipt_set
+        <include refid="Condition"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+    <!-- 查询表t_mst_receipt_set,(条件查询+分页)列表 -->
+    <select id="selectReceiptSet" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_a.t_mst_receipt_set
+        <include refid="Condition"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+    <!-- 查询表t_mst_receipt_set,(条件查询)个数 -->
+    <select id="countByCond" resultType="Long">
+        SELECT
+        count(1)
+        FROM t_mst_receipt_set
+        <include refid="Condition"/>
+    </select>
+
+    <!-- 根据主键查询表t_mst_receipt_set的一行数据 -->
+    <select id="selectById" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_a.t_mst_receipt_set
+        WHERE set_id = #{setId}::uuid
+    </select>
+
+    <!-- 根据主键锁定表t_mst_receipt_set的一行数据 -->
+    <select id="selectByIdForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mst_receipt_set
+        WHERE set_id = #{setId}
+        for update
+    </select>
+
+    <!-- 根据主键锁定表t_mst_receipt_set的多行数据 -->
+    <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mst_receipt_set
+        <include refid="idsForeach"/>
+        for update
+    </select>
+
+    <insert id="insertBatch">
+        insert into t_mst_receipt_set
+        (
+        <trim suffixOverrides=",">
+            cp_id,
+            cp_name,
+            tax_no,
+            cp_email,
+            cp_address,
+            cp_phone,
+            open_bank,
+            bank_account,
+            flg_default,
+            display_no,
+            op_app_code,
+        </trim>
+        )
+        values
+        <foreach collection="list" index="index" item="item" separator=",">
+            (
+            <trim suffixOverrides=",">
+                #{item.cpId},
+                #{item.cpName},
+                #{item.taxNo},
+                #{item.cpEmail},
+                #{item.cpAddress},
+                #{item.cpPhone},
+                #{item.openBank},
+                #{item.bankAccount},
+                #{item.flgDefault},
+                #{item.displayNo},
+                #{item.opAppCode},
+            </trim>
+            )
+        </foreach>
+    </insert>
+
+    <!-- 更新数据-->
+    <update id="updateById" parameterType="com.dk.oauth.model.pojo.ReceiptSet">
+        update dkic_a.t_mst_receipt_set
+        <set>
+            <if test="cpName != null">
+                cp_name = #{cpName,jdbcType=VARCHAR},
+            </if>
+            <if test="taxNo != null">
+                tax_no = #{taxNo,jdbcType=VARCHAR},
+            </if>
+            <if test="cpEmail != null">
+                cp_email = #{cpEmail,jdbcType=VARCHAR},
+            </if>
+            <if test="cpAddress != null">
+                cp_address = #{cpAddress,jdbcType=VARCHAR},
+            </if>
+            <if test="cpPhone != null">
+                cp_phone = #{cpPhone,jdbcType=VARCHAR},
+            </if>
+            <if test="openBank != null">
+                open_bank = #{openBank,jdbcType=VARCHAR},
+            </if>
+            <if test="bankAccount != null">
+                bank_account = #{bankAccount,jdbcType=VARCHAR},
+            </if>
+            <if test="flgValid != null">
+                flg_valid = #{flgValid,jdbcType=BOOLEAN},
+            </if>
+            <if test="flgDefault != null">
+                flg_default = #{flgDefault,jdbcType=BOOLEAN},
+            </if>
+            <if test="displayNo != null">
+                display_no = #{displayNo,jdbcType=NUMERIC},
+            </if>
+        </set>
+        where set_id = #{setId,typeHandler=UuidTypeHandler}
+
+    </update>
+
+    <insert id="insertSingle">
+        INSERT INTO dkic_a.t_mst_receipt_set
+        (
+            cp_id,
+            cp_name,
+            tax_no,
+            cp_email,
+            cp_address,
+            cp_phone,
+            open_bank,
+            bank_account,
+            flg_default,
+            display_no,
+            op_app_code
+        )
+        VALUES
+            (
+                #{cpId},
+                #{cpName},
+                #{taxNo},
+                #{cpEmail},
+                #{cpAddress},
+                #{cpPhone},
+                #{openBank},
+                #{bankAccount},
+                #{flgDefault},
+                #{displayNo},
+                #{opAppCode}
+            )
+    </insert>
+
+
+    <!-- 获取显示顺序的最大值 -->
+    <select id="getMaxDisplayNo" resultType="Integer">
+        select max(display_no) + 1
+        from dkic_a.t_mst_receipt_set
+        where 1=1
+        <if test="flgValid != null">
+            and flg_valid = #{flgValid}
+        </if>
+
+    </select>
+</mapper>

+ 21 - 2
src/main/resources/mapper/TradeMapper.xml

@@ -66,7 +66,7 @@
         <result column="buy_end_date" property="buyEndDate" typeHandler="TimestampTypeHandler"/>
         <result column="buy_fun_id" property="buyFunId" typeHandler="UuidListTypeHandler"/>
         <result column="buy_grade_code" property="buyGradeCode"/>
-        <result column="wx_trade_no" property="wxtradeNo"/>
+        <result column="wx_trade_no" property="wxTradeNo"/>
         <result column="extend_days" property="extendDays"/>
         <result column="dk_user_id" property="dkUserId" typeHandler="UuidTypeHandler"/>
         <result column="dk_user_id" property="dkUserId" typeHandler="UuidTypeHandler"/>
@@ -75,14 +75,27 @@
         <result column="trade_desc" property="tradeDesc"/>
         <result column="activity_ids" property="activityIds" typeHandler="UuidListTypeHandler"/>
         <result column="activity_item_ids" property="activityItemIds" typeHandler="UuidListTypeHandler"/>
+        <result column="tradeTypeName" property="tradeTypeName"/>
+        <result column="tradeStatusName" property="tradeStatusName"/>
+        <result column="receiptStatusName" property="receiptStatusName"/>
     </resultMap>
 
     <!-- 通用条件列 -->
     <sql id="Condition">
         <where>
+            <if test="tradeTimeStart != null and tradeTimeEnd != null">
+                AND t.trade_time &gt;= #{tradeTimeStart}::timestamp with time zone
+                AND t.trade_time &lt; #{tradeTimeEnd}::timestamp with time zone + interval '1 day'
+            </if>
             <if test="tradeId != null and tradeId != ''">
                 AND t.trade_id = #{tradeId}
             </if>
+            <if test="tradeStatus != null and tradeStatus != ''">
+                AND t.trade_status = #{tradeStatus}
+            </if>
+            <if test="receiptStatus != null and receiptStatus != ''">
+                AND t.receipt_status = #{receiptStatus}
+            </if>
             <if test="tradeNo != null and tradeNo != ''">
                 AND t.trade_no = #{tradeNo}
             </if>
@@ -123,13 +136,19 @@
         SELECT
         <include refid="Base_Column_List"/>
         ,g.grade_name gradeName
+        ,sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n} ) AS "tradeTypeName"
+        ,sys.f_get_name_i18n(tdk2.kind_name_i18n, #{i18n} ) AS "tradeStatusName"
+        ,sys.f_get_name_i18n(tdk3.kind_name_i18n, #{i18n} ) AS "receiptStatusName"
         FROM dkic_a.t_cp_trade t
         left join sys.t_grade g on t.buy_grade_code = g.grade_code
+        LEFT JOIN sys.t_data_kind tdk1   ON tdk1.kind_code = t.trade_type
+        LEFT JOIN sys.t_data_kind tdk2   ON tdk2.kind_code = t.trade_status
+        LEFT JOIN sys.t_data_kind tdk3   ON tdk3.kind_code = t.receipt_status
         <include refid="Condition"/>
+        order by t.trade_time desc
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>
-        order by t.trade_time desc
     </select>
 
     <!-- 查询表t_cp_trade,(条件查询)个数 -->