fubin před 2 roky
rodič
revize
92e083602e

+ 18 - 6
src/main/java/com/dk/mdm/controller/mac/RecPayController.java

@@ -58,33 +58,33 @@ public class RecPayController{
     }
 
     /**
-     * @desc : 新建
+     * @desc : 新建客户收款
      * @author : 付斌
      * @date : 2023/1/9 10:48
      */
-    @ApiOperation(value = "新建收款", notes = "新建收款")
+    @ApiOperation(value = "新建客户收款", notes = "新建客户收款")
     @PostMapping({"insert_receipt"})
     public ResponseResultVO<?> insertReceipt(@RequestBody RecPayVO recPayVO) {
         return recPayService.insertReceipt(recPayVO);
     }
 
     /**
-     * @desc : 新建
+     * @desc : 新建客户退款
      * @author : 付斌
      * @date : 2023/1/9 10:48
      */
-    @ApiOperation(value = "新建退款", notes = "新建退款")
+    @ApiOperation(value = "新建客户退款", notes = "新建客户退款")
     @PostMapping({"insert_refund"})
     public ResponseResultVO<?> insertRefund(@RequestBody RecPayVO recPayVO) {
         return recPayService.insertRefund(recPayVO);
     }
 
     /**
-     * @desc : 编辑
+     * @desc : 编辑客户收款/退款
      * @author : 付斌
      * @date : 2023/1/9 10:49
      */
-    @ApiOperation(value = "编辑", notes = "编辑")
+    @ApiOperation(value = "编辑客户收款/退款", notes = "编辑客户收款/退款")
     @PostMapping({"update"})
     public ResponseResultVO<?> update(@RequestBody RecPayVO recPayVO) {
         return recPayService.update(recPayVO);
@@ -95,8 +95,20 @@ public class RecPayController{
      * @author : 付斌
      * @date : 2024-02-28 13:24
      */
+    @ApiOperation(value = "查询收款明细(编辑用)", notes = "查询收款明细(编辑用)")
     @PostMapping({"get_rp_for_update/{id}"})
     public ResponseResultVO<?> getRpForUpdate(@PathVariable String id) {
         return recPayService.getRpForUpdate(id);
     }
+
+    /**
+     * @desc : 新建应收收款(收款+冲应收)
+     * @author : 付斌
+     * @date : 2023/1/9 10:48
+     */
+    @ApiOperation(value = "新建应收收款", notes = "新建应收收款")
+    @PostMapping({"insert_receivable_receipt"})
+    public ResponseResultVO<?> insertReceivableReceipt(@RequestBody RecPayVO recPayVO) {
+        return recPayService.insertReceivableReceipt(recPayVO);
+    }
 }

+ 23 - 0
src/main/java/com/dk/mdm/controller/mac/RecPayHandleItemController.java

@@ -0,0 +1,23 @@
+package com.dk.mdm.controller.mac;
+
+import com.dk.mdm.model.pojo.mac.RecPayHandleItem;
+import com.dk.common.service.BaseService;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+import io.swagger.annotations.Api;
+import com.dk.mdm.service.mac.RecPayHandleItemService;
+
+@Api(tags = "账务冲抵明细API接口")
+@RestController
+@RequestMapping("/recPayHandleItem")
+public class RecPayHandleItemController{
+
+    public BaseService<RecPayHandleItem> getService() {
+        return recPayHandleItemService;
+    }
+
+    @Autowired
+    private RecPayHandleItemService recPayHandleItemService;
+
+}

+ 14 - 0
src/main/java/com/dk/mdm/mapper/mac/RecPayHandleItemMapper.java

@@ -0,0 +1,14 @@
+package com.dk.mdm.mapper.mac;
+
+import com.dk.mdm.model.pojo.mac.RecPayHandleItem;
+import com.dk.common.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+*  账务冲抵明细 Mapper
+*/
+@Repository
+public interface RecPayHandleItemMapper extends BaseMapper<RecPayHandleItem>{
+	
+}
+

+ 157 - 0
src/main/java/com/dk/mdm/mapper/mac/RecPayHandleItemMapper.xml

@@ -0,0 +1,157 @@
+<?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.mdm.mapper.mac.RecPayHandleItemMapper">
+
+    <!-- 通用设置 -->
+    <!-- 通用查询列 -->
+    <sql id="Base_Column_List">
+        item_id, rp_id, acc_item_id, amt_receivable_handle, amt_payable_handle, amt_waive, acc_date, remarks, flg_valid, cp_id
+    </sql>
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mac.RecPayHandleItem">
+        <id column="item_id" property="itemId"/>
+                <result column="rp_id" property="rpId" typeHandler="UuidTypeHandler"/>
+                <result column="acc_item_id" property="accItemId" typeHandler="UuidTypeHandler"/>
+                <result column="amt_receivable_handle" property="amtReceivableHandle"/>
+                <result column="amt_payable_handle" property="amtPayableHandle"/>
+                <result column="amt_waive" property="amtWaive"/>
+            <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
+                <result column="remarks" property="remarks"/>
+                <result column="flg_valid" property="flgValid"/>
+                <result column="cp_id" property="cpId"/>
+    </resultMap>
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.RecPayHandleItemResponse">
+        <id column="item_id" property="itemId"/>
+                <result column="rp_id" property="rpId" typeHandler="UuidTypeHandler"/>
+                <result column="acc_item_id" property="accItemId" typeHandler="UuidTypeHandler"/>
+                <result column="amt_receivable_handle" property="amtReceivableHandle"/>
+                <result column="amt_payable_handle" property="amtPayableHandle"/>
+                <result column="amt_waive" property="amtWaive"/>
+            <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
+                <result column="remarks" property="remarks"/>
+                <result column="flg_valid" property="flgValid"/>
+                <result column="cp_id" property="cpId"/>
+    </resultMap>
+
+    <!-- 通用条件列 -->
+    <sql id="Condition">
+        <where>
+            <if test="rpId != null and rpId != ''">
+                AND rp_id = #{rpId}
+            </if>
+            <if test="accItemId != null and accItemId != ''">
+                AND acc_item_id = #{accItemId}
+            </if>
+            <if test="amtReceivableHandle != null">
+                AND amt_receivable_handle = #{amtReceivableHandle}
+            </if>
+            <if test="amtPayableHandle != null">
+                AND amt_payable_handle = #{amtPayableHandle}
+            </if>
+            <if test="amtWaive != null">
+                AND amt_waive = #{amtWaive}
+            </if>
+            <if test="accDate != null">
+                AND acc_date = #{accDate}
+            </if>
+            <if test="remarks != null and remarks != ''">
+                AND remarks = #{remarks}
+            </if>
+            <if test="flgValid != null">
+                AND flg_valid = #{flgValid}
+            </if>
+            <if test="cpId != null">
+                AND cp_id = #{cpId}
+            </if>
+        </where>
+    </sql>
+
+    <sql id="idsForeach">
+        <!-- 根据主键itemId批量操作 -->
+        WHERE item_id in
+        <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </sql>
+
+    <!-- 查询表t_mac_rec_pay_handle_item,(条件查询+分页)列表 -->
+    <select id="selectByCond" resultMap="BaseResultMapResponse">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mac_rec_pay_handle_item
+        <include refid="Condition"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+
+    <!-- 查询表t_mac_rec_pay_handle_item,(条件查询)个数 -->
+    <select id="countByCond" resultType="Long">
+        SELECT
+        count(1)
+        FROM t_mac_rec_pay_handle_item
+        <include refid="Condition"/>
+    </select>
+
+    <!-- 根据主键查询表t_mac_rec_pay_handle_item的一行数据 -->
+    <select id="selectById" resultMap="BaseResultMapResponse">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mac_rec_pay_handle_item
+        WHERE item_id = #{itemId}::uuid
+    </select>
+
+    <!-- 根据主键锁定表t_mac_rec_pay_handle_item的一行数据 -->
+    <select id="selectByIdForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mac_rec_pay_handle_item
+        WHERE item_id = #{id}::uuid
+        for update
+    </select>
+
+    <!-- 根据主键锁定表t_mac_rec_pay_handle_item的多行数据 -->
+    <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mac_rec_pay_handle_item
+        <include refid="idsForeach"/>
+        for update
+    </select>
+
+    <insert id="insertBatch">
+        insert into t_mac_rec_pay_handle_item
+        (
+        <trim suffixOverrides=",">
+            rp_id,
+            acc_item_id,
+            amt_receivable_handle,
+            amt_payable_handle,
+            amt_waive,
+            acc_date,
+            remarks,
+            cp_id,
+            op_app_code,
+        </trim>
+        )
+        values
+        <foreach collection="list" index="index" item="item" separator=",">
+            (
+            <trim suffixOverrides=",">
+                #{item.rpId}::uuid,
+                #{item.accItemId}::uuid,
+                #{item.amtReceivableHandle},
+                #{item.amtPayableHandle},
+                #{item.amtWaive},
+                #{item.accDate},
+                #{item.remarks},
+                #{item.cpId},
+                #{item.opAppCode},
+            </trim>
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 126 - 0
src/main/java/com/dk/mdm/model/pojo/mac/RecPayHandleItem.java

@@ -0,0 +1,126 @@
+package com.dk.mdm.model.pojo.mac;
+
+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 java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ *  账务冲抵明细
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("账务冲抵明细")
+@TableName(value = "t_mac_rec_pay_handle_item", autoResultMap = true)
+@ApiModel(value="实体类:账务冲抵明细", description="表名:t_mac_rec_pay_handle_item")
+public class RecPayHandleItem extends PageInfo<RecPayHandleItem> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 明细ID
+     */
+//    @TableId(value = "item_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "明细ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String itemId;
+
+
+    /**
+     * 收付款单ID
+     */
+    @Excel(name = "收付款单ID")
+    @ApiModelProperty(value = "收付款单ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String rpId;
+
+
+    /**
+     * 账款明细ID
+     */
+    @Excel(name = "账款明细ID")
+    @ApiModelProperty(value = "账款明细ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String accItemId;
+
+
+    /**
+     * 应收冲抵金额
+     */
+    @Excel(name = "应收冲抵金额")
+    @ApiModelProperty(value = "应收冲抵金额")
+    private BigDecimal amtReceivableHandle;
+
+
+    /**
+     * 应付冲抵金额
+     */
+    @Excel(name = "应付冲抵金额")
+    @ApiModelProperty(value = "应付冲抵金额")
+    private BigDecimal amtPayableHandle;
+
+
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal amtWaive;
+
+
+    /**
+     * 还款日期
+     */
+    @Excel(name = "还款日期")
+    @ApiModelProperty(value = "还款日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDate accDate;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 128 - 0
src/main/java/com/dk/mdm/model/query/mac/RecPayHandleItemQuery.java

@@ -0,0 +1,128 @@
+package com.dk.mdm.model.query.mac;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+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.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ *  账务冲抵明细
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("账务冲抵明细")
+@TableName(value = "t_mac_rec_pay_handle_item", autoResultMap = true)
+@ApiModel(value="实体类:账务冲抵明细", description="表名:t_mac_rec_pay_handle_item")
+public class RecPayHandleItemQuery extends PageInfo<RecPayHandleItemQuery> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 明细ID
+     */
+//    @TableId(value = "item_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "明细ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String itemId;
+
+
+    /**
+     * 收付款单ID
+     */
+    @Excel(name = "收付款单ID")
+    @ApiModelProperty(value = "收付款单ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String rpId;
+
+
+    /**
+     * 账款明细ID
+     */
+    @Excel(name = "账款明细ID")
+    @ApiModelProperty(value = "账款明细ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String accItemId;
+
+
+    /**
+     * 应收冲抵金额
+     */
+    @Excel(name = "应收冲抵金额")
+    @ApiModelProperty(value = "应收冲抵金额")
+    private BigDecimal amtReceivableHandle;
+
+
+    /**
+     * 应付冲抵金额
+     */
+    @Excel(name = "应付冲抵金额")
+    @ApiModelProperty(value = "应付冲抵金额")
+    private BigDecimal amtPayableHandle;
+
+
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal amtWaive;
+
+
+    /**
+     * 还款日期
+     */
+    @Excel(name = "还款日期")
+    @ApiModelProperty(value = "还款日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDate accDate;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 128 - 0
src/main/java/com/dk/mdm/model/response/mac/RecPayHandleItemResponse.java

@@ -0,0 +1,128 @@
+package com.dk.mdm.model.response.mac;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+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.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ *  账务冲抵明细
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("账务冲抵明细")
+@TableName(value = "t_mac_rec_pay_handle_item", autoResultMap = true)
+@ApiModel(value="实体类:账务冲抵明细", description="表名:t_mac_rec_pay_handle_item")
+public class RecPayHandleItemResponse extends PageInfo<RecPayHandleItemResponse> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 明细ID
+     */
+//    @TableId(value = "item_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "明细ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String itemId;
+
+
+    /**
+     * 收付款单ID
+     */
+    @Excel(name = "收付款单ID")
+    @ApiModelProperty(value = "收付款单ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String rpId;
+
+
+    /**
+     * 账款明细ID
+     */
+    @Excel(name = "账款明细ID")
+    @ApiModelProperty(value = "账款明细ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String accItemId;
+
+
+    /**
+     * 应收冲抵金额
+     */
+    @Excel(name = "应收冲抵金额")
+    @ApiModelProperty(value = "应收冲抵金额")
+    private BigDecimal amtReceivableHandle;
+
+
+    /**
+     * 应付冲抵金额
+     */
+    @Excel(name = "应付冲抵金额")
+    @ApiModelProperty(value = "应付冲抵金额")
+    private BigDecimal amtPayableHandle;
+
+
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal amtWaive;
+
+
+    /**
+     * 还款日期
+     */
+    @Excel(name = "还款日期")
+    @ApiModelProperty(value = "还款日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDate accDate;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 128 - 0
src/main/java/com/dk/mdm/model/vo/mac/RecPayHandleItemVO.java

@@ -0,0 +1,128 @@
+package com.dk.mdm.model.vo.mac;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+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.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ *  账务冲抵明细
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("账务冲抵明细")
+@TableName(value = "t_mac_rec_pay_handle_item", autoResultMap = true)
+@ApiModel(value="实体类:账务冲抵明细", description="表名:t_mac_rec_pay_handle_item")
+public class RecPayHandleItemVO extends PageInfo<RecPayHandleItemVO> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 明细ID
+     */
+//    @TableId(value = "item_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "明细ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String itemId;
+
+
+    /**
+     * 收付款单ID
+     */
+    @Excel(name = "收付款单ID")
+    @ApiModelProperty(value = "收付款单ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String rpId;
+
+
+    /**
+     * 账款明细ID
+     */
+    @Excel(name = "账款明细ID")
+    @ApiModelProperty(value = "账款明细ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String accItemId;
+
+
+    /**
+     * 应收冲抵金额
+     */
+    @Excel(name = "应收冲抵金额")
+    @ApiModelProperty(value = "应收冲抵金额")
+    private BigDecimal amtReceivableHandle;
+
+
+    /**
+     * 应付冲抵金额
+     */
+    @Excel(name = "应付冲抵金额")
+    @ApiModelProperty(value = "应付冲抵金额")
+    private BigDecimal amtPayableHandle;
+
+
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal amtWaive;
+
+
+    /**
+     * 还款日期
+     */
+    @Excel(name = "还款日期")
+    @ApiModelProperty(value = "还款日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDate accDate;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 28 - 0
src/main/java/com/dk/mdm/service/mac/RecPayHandleItemService.java

@@ -0,0 +1,28 @@
+package com.dk.mdm.service.mac;
+
+import com.dk.mdm.model.pojo.mac.RecPayHandleItem;
+import com.dk.mdm.mapper.mac.RecPayHandleItemMapper;
+import com.dk.common.service.BaseService;
+import com.dk.common.mapper.BaseMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class RecPayHandleItemService extends BaseService<RecPayHandleItem> {
+
+	@Override
+	public String getPrimaryKey() {
+		return "item_id";
+	}
+
+	@Override
+	public BaseMapper<RecPayHandleItem> getRepository() {
+		return recPayHandleItemMapper;
+	}
+
+	@Autowired
+	private RecPayHandleItemMapper recPayHandleItemMapper;
+
+}

+ 78 - 3
src/main/java/com/dk/mdm/service/mac/RecPayService.java

@@ -120,7 +120,7 @@ public class RecPayService extends BaseService<RecPay> {
     }
 
     /**
-     * @desc : 新建收款
+     * @desc : 新建客户收款
      * @author : 付斌
      * @date : 2023/1/9 10:49
      */
@@ -195,7 +195,7 @@ public class RecPayService extends BaseService<RecPay> {
     }
 
     /**
-     * @desc : 新建退款
+     * @desc :  新建客户退款
      * @author : 付斌
      * @date : 2023/1/9 10:49
      */
@@ -271,7 +271,7 @@ public class RecPayService extends BaseService<RecPay> {
     }
 
     /**
-     * @desc : 编辑方法
+     * @desc : 编辑客户收款/退款
      * @author : 付斌
      * @date : 2023/1/9 10:49
      */
@@ -356,4 +356,79 @@ public class RecPayService extends BaseService<RecPay> {
 
         return ResponseResultUtil.success(dataInfo);
     }
+
+    /**
+     * @desc : 新建应收收款(收款+冲应收)
+     * @author : 付斌
+     * @date : 2023/1/9 10:49
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> insertReceivableReceipt(RecPayVO recPayVO) {
+
+        // 获取单号
+        Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECPAY.getName(), false);
+        recPayVO.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString());
+        // 转化实体
+        RecPay recPay = recPayConvert.convertToPo(recPayVO);
+        // 总单保存
+        super.insert(recPay);
+
+        // 明细保存
+        if (recPayVO.getItemList() != null && recPayVO.getItemList().size() > 0) {
+            for (RecPayItemVO recPayItemVO : recPayVO.getItemList()) {
+                RecPayItem recPayItem = recPayItemConvert.convertToPo(recPayItemVO);
+                recPayItem.setRpId(recPay.getRpId()).setCpId(recPay.getCpId()).setMakeStaff(recPay.getMakeStaff()).setAccDate(recPay.getAccDate());
+                recPayItemMapper.insert(recPayItem);
+
+                // 插入账款明细
+                AccountItem accountItem = new AccountItem();
+                accountItem.setAccItemType(Constant.accItemType.SHOU_KUAN.getName())
+                        .setObjectId(recPayVO.getObjectId()).setOrgId(recPayVO.getOrgId()).setStaffId(recPayVO.getStaffId())
+                        .setAccDate(recPayVO.getAccDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName()).setAmtRec(recPayItem.getAmtRec())
+                        .setBiznisType("t_mac_rec_pay_item").setBiznisId(recPayItem.getItemId()).setBiznisNo(recPayVO.getRpNo())
+                        .setMakeStaff(recPayVO.getMakeStaff()).setCpId(recPayVO.getCpId());
+                accountItemMapper.insert(accountItem);
+
+                // 更新收款单上的账款明细Id
+                RecPayItem recPayItemUpdate = new RecPayItem();
+                recPayItemUpdate.setAccItemId(accountItem.getItemId()).setRpId(recPayVO.getRpId());
+                recPayItemService.updateByUuid(recPayItemUpdate);
+
+                // 插入资金流水
+                MoneyAccountItem moneyAccountItem = new MoneyAccountItem();
+                moneyAccountItem.setMacId(recPayItem.getMacId()).setFlowType(Constant.FlowType.SHOU_FU_KUAN.getName())
+                        .setInvoiceId(recPayItem.getItemId()).setAmtInflow(recPayItem.getAmtRec()).setAccDate(recPayVO.getAccDate())
+                        .setMakeStaff(recPayItem.getMakeStaff()).setCpId(recPayItem.getCpId());
+                moneyAccountItemMapper.insert(moneyAccountItem);
+
+                // 更新资金账户
+                MoneyAccount moneyAccountForUpdate = moneyAccountMapper.selectByIdForUpdate(recPayItem.getMacId());
+                MoneyAccount moneyAccountUpdate = new MoneyAccount();
+                moneyAccountUpdate.setBalance(moneyAccountForUpdate.getBalance().add(recPayItem.getAmtRec()))
+                        .setMacId(moneyAccountForUpdate.getMacId());
+                moneyAccountService.updateByUuid(moneyAccountUpdate);
+            }
+        }
+
+        // 插入账款总表
+        Account accountForUpdate = accountMapper.selectByIdForUpdate(recPayVO.getObjectId());
+
+        // 没有账款对象,需要新建
+        if (accountForUpdate == null) {
+            accountForUpdate = new Account();
+            accountForUpdate.setObjectId(recPayVO.getObjectId()).setObjectType(Constant.ObjectType.CUS.getName());
+            accountMapper.insert(accountForUpdate);
+            accountForUpdate = accountMapper.selectByIdForUpdate(recPayVO.getObjectId());
+        }
+
+        // 更新账款总表上收款的相关字段
+        Account accountUpdate = new Account();
+        accountUpdate.setReceipt(accountForUpdate.getReceipt().add(recPayVO.getSumAmtRec()))// 总收款金额
+                .setReceiptResidue(accountForUpdate.getReceiptResidue().add(recPayVO.getSumAmtRec()))//  可退金额
+                .setObjectId(accountForUpdate.getObjectId());
+        accountService.updateByUuid(accountUpdate);
+        return ResponseResultUtil.success();
+    }
 }