fubin 2 лет назад
Родитель
Сommit
f33ae1d30e

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

@@ -0,0 +1,23 @@
+package com.dk.mdm.controller.mac;
+
+import com.dk.mdm.model.pojo.mac.MacTransfer;
+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.MacTransferService;
+
+@Api(tags = "资金转账API接口")
+@RestController
+@RequestMapping("/transfer")
+public class MacTransferController {
+
+    public BaseService<MacTransfer> getService() {
+        return macTransferService;
+    }
+
+    @Autowired
+    private MacTransferService macTransferService;
+
+}

+ 10 - 10
src/main/java/com/dk/mdm/controller/mst/MoneyAccountController.java

@@ -38,16 +38,6 @@ public class MoneyAccountController{
     public ResponseResultVO<PageList<MoneyAccountResponse>> selectByCond(@RequestBody MoneyAccountQuery moneyAccountQuery) {
         return moneyAccountService.selectByCond(moneyAccountQuery);
     }
-    /**
-     * @desc : 维修小程序查询
-     * @author : 王英杰
-     * @date : 2023/2/29 10:36
-     */
-    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
-    @PostMapping({"wx_list_by"})
-    public ResponseResultVO<Map<String, Object>> wxSelectByCond(@RequestBody MoneyAccountQuery moneyAccountQuery) {
-        return moneyAccountService.wxSelectByCond(moneyAccountQuery);
-    }
 
     /**
      * @desc   : 通过ID查询
@@ -59,6 +49,16 @@ public class MoneyAccountController{
         return moneyAccountService.selectById(id);
     }
 
+    /**
+     * @desc : 维修小程序查询
+     * @author : 王英杰
+     * @date : 2023/2/29 10:36
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"wx_list_by"})
+    public ResponseResultVO<Map<String, Object>> wxSelectByCond(@RequestBody MoneyAccountQuery moneyAccountQuery) {
+        return moneyAccountService.wxSelectByCond(moneyAccountQuery);
+    }
 
     /**
      * @desc : 新建资金账户

+ 15 - 0
src/main/java/com/dk/mdm/mapper/mac/MacTransferMapper.java

@@ -0,0 +1,15 @@
+package com.dk.mdm.mapper.mac;
+
+import com.dk.mdm.model.pojo.mac.MacTransfer;
+import com.dk.common.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+*  资金转账 Mapper
+*/
+@Repository
+public interface MacTransferMapper extends BaseMapper<MacTransfer>{
+
+    MacTransfer selectByInMacIdForUpdate(String id);
+}
+

+ 230 - 0
src/main/java/com/dk/mdm/mapper/mac/MacTransferMapper.xml

@@ -0,0 +1,230 @@
+<?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.MacTransferMapper">
+
+    <!-- 通用设置 -->
+    <!-- 通用查询列 -->
+    <sql id="Base_Column_List">
+        trf_id, trf_no, trf_type, org_id, staff_id, trf_in_mac, trf_out_mac, amt_trf, acc_date, remarks, annex_paths, make_staff, make_time, flg_valid, cp_id
+    </sql>
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mac.MacTransfer">
+        <id column="trf_id" property="trfId"/>
+            <result column="trf_no" property="trfNo"/>
+            <result column="trf_type" property="trfType"/>
+            <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
+            <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+            <result column="trf_in_mac" property="trfInMac" typeHandler="UuidTypeHandler"/>
+            <result column="trf_out_mac" property="trfOutMac" typeHandler="UuidTypeHandler"/>
+            <result column="amt_trf" property="amtTrf"/>
+            <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
+            <result column="remarks" property="remarks"/>
+            <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
+            <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
+            <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
+            <result column="flg_valid" property="flgValid"/>
+            <result column="cp_id" property="cpId"/>
+    </resultMap>
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.MacTransferResponse">
+        <id column="trf_id" property="trfId"/>
+            <result column="trf_no" property="trfNo"/>
+            <result column="trf_type" property="trfType"/>
+            <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
+            <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+            <result column="trf_in_mac" property="trfInMac" typeHandler="UuidTypeHandler"/>
+            <result column="trf_out_mac" property="trfOutMac" typeHandler="UuidTypeHandler"/>
+            <result column="amt_trf" property="amtTrf"/>
+            <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
+            <result column="remarks" property="remarks"/>
+            <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
+            <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
+            <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
+            <result column="flg_valid" property="flgValid"/>
+            <result column="cp_id" property="cpId"/>
+    </resultMap>
+
+    <!-- 通用条件列 -->
+    <sql id="Condition">
+        <where>
+            <if test="trfNo != null and trfNo != ''">
+                AND t.trf_no LIKE concat('%',my_ex.likequery(#{trfNo}),'%')
+            </if>
+            <if test="trfType != null">
+                AND t.trf_type = #{trfType}
+            </if>
+            <if test="orgId != null and orgId != ''">
+                AND org_id = #{orgId}
+            </if>
+            <if test="staffId != null and staffId != ''">
+                AND staff_id = #{staffId}
+            </if>
+            <if test="trfInMac != null and trfInMac != ''">
+                AND t.trf_in_mac = #{trfInMac}
+            </if>
+            <if test="trfOutMac != null and trfOutMac != ''">
+                AND t.trf_out_mac = #{trfOutMac}
+            </if>
+            <if test="amtTrf != null">
+                AND t.amt_trf = #{amtTrf}
+            </if>
+            <if test="accDate != null">
+                AND t.acc_date = #{accDate}
+            </if>
+            <if test="remarks != null and remarks != ''">
+                AND t.remarks LIKE concat('%',my_ex.likequery(#{remarks}),'%')
+            </if>
+            <if test="annexPaths != null and annexPaths != ''">
+                AND t.annex_paths = #{annexPaths}
+            </if>
+            <if test="makeStaff != null and makeStaff != ''">
+                AND t.make_staff = #{makeStaff}
+            </if>
+            <if test="cpId != null">
+                AND t.cp_id = #{cpId}
+            </if>
+            <if test="orgIdList != null and orgIdList.size() > 0">
+                AND t.org_id  =any(#{orgIdList, typeHandler=uuidListTypeHandler})
+            </if>
+            <if test="staffIdList != null and staffIdList.size() > 0">
+                AND t.staff_id  =any(#{staffIdList, typeHandler=uuidListTypeHandler})
+            </if>
+            <if test="makeTimeStart != null and makeTimeEnd != null">
+                AND t.make_time &gt;= #{makeTimeStart}::timestamp with time zone
+                AND t.make_time &lt; #{makeTimeEnd}::timestamp with time zone + interval '1 day'
+            </if>
+            <if test="flgValidList != null and flgValidList.size()>0">
+                AND t.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
+            </if>
+        </where>
+    </sql>
+
+    <sql id="idsForeach">
+        <!-- 根据主键trfId批量操作 -->
+        WHERE trf_id in
+        <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </sql>
+
+    <!-- 查询表t_mac_transfer,(条件查询+分页)列表 -->
+    <select id="selectByCond" resultMap="BaseResultMapResponse">
+        SELECT t.trf_id,
+               t.trf_no,
+               t.trf_type,
+               t.org_id,
+               t.staff_id,
+               t.trf_in_mac,
+               t.trf_out_mac,
+               t.amt_trf,
+               t.acc_date,
+               t.remarks,
+               t.annex_paths,
+               t.make_staff,
+               t.make_time,
+               t.flg_valid,
+               t.cp_id,
+               tmo.org_name         as "orgName",
+               tms.staff_name       as "staffName",
+               makestaff.staff_name as "makeStaffName"
+        FROM dkic_b.t_mac_transfer as t
+                 left join dkic_b.t_mst_org tmo on t.org_id = tmo.org_id
+                 left join dkic_b.t_mst_staff tms on t.staff_id = tms.staff_id
+                 left join dkic_b.t_mst_staff as makestaff on t.make_staff = makestaff.staff_id
+        <include refid="Condition"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+
+    <!-- 查询表t_mac_transfer,(条件查询)个数 -->
+    <select id="countByCond" resultType="Long">
+        SELECT count(1)
+        FROM dkic_b.t_mac_transfer as t
+                 left join dkic_b.t_mst_org tmo on t.org_id = tmo.org_id
+                 left join dkic_b.t_mst_staff tms on t.staff_id = tms.staff_id
+                 left join dkic_b.t_mst_staff as makestaff on t.make_staff = makestaff.staff_id
+        <include refid="Condition"/>
+    </select>
+
+    <!-- 根据主键查询表t_mac_transfer的一行数据 -->
+    <select id="selectById" resultMap="BaseResultMapResponse">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_mac_transfer
+        WHERE trf_id = #{trfId}::uuid
+    </select>
+
+    <!-- 根据主键锁定表t_mac_transfer的一行数据 -->
+    <select id="selectByIdForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_mac_transfer
+        WHERE trf_id = #{id}::uuid
+        for update
+    </select>
+
+    <!-- 根据主键锁定表t_mac_transfer的一行数据 -->
+    <select id="selectByInMacIdForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_mac_transfer
+        WHERE trf_type = 0
+          and trf_in_mac = #{id}::uuid
+        for update
+    </select>
+
+    <!-- 根据主键锁定表t_mac_transfer的多行数据 -->
+    <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_mac_transfer
+        <include refid="idsForeach"/>
+        for update
+    </select>
+
+    <insert id="insertBatch">
+        insert into dkic_b.t_mac_transfer
+        (
+        <trim suffixOverrides=",">
+            trf_no,
+            trf_type,
+            org_id,
+            staff_id,
+            trf_in_mac,
+            trf_out_mac,
+            amt_trf,
+            acc_date,
+            remarks,
+            annex_paths,
+            make_staff,
+            make_time,
+            cp_id,
+            op_app_code,
+        </trim>
+        )
+        values
+        <foreach collection="list" index="index" item="item" separator=",">
+            (
+            <trim suffixOverrides=",">
+                #{item.trfNo},
+                #{item.trfType},
+                #{item.orgId}::uuid,
+                #{item.staffId}::uuid,
+                #{item.trfInMac}::uuid,
+                #{item.trfOutMac}::uuid,
+                #{item.amtTrf},
+                #{item.accDate},
+                #{item.remarks},
+                #{item.annexPaths},
+                #{item.makeStaff}::uuid,
+                #{item.makeTime},
+                #{item.cpId},
+                #{item.opAppCode},
+            </trim>
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 7 - 0
src/main/java/com/dk/mdm/mapper/mst/MoneyAccountItemMapper.java

@@ -25,5 +25,12 @@ public interface MoneyAccountItemMapper extends BaseMapper<MoneyAccountItem>{
      * @date   : 2024-03-09 11:36
      */
     Map<String, Object> getSumAmtInflow(String id);
+
+    /**
+     * @desc   : 根据来源ID查询资金流水
+     * @author : 付斌
+     * @date   : 2024-04-04 14:48
+     */
+    MoneyAccountItem selectByInvoiceIdForUpdate(String id);
 }
 

+ 9 - 0
src/main/java/com/dk/mdm/mapper/mst/MoneyAccountItemMapper.xml

@@ -131,6 +131,15 @@
         for update
     </select>
 
+    <!-- 根据来源Id锁定表t_mst_money_account_item的一行数据 -->
+    <select id="selectByInvoiceIdForUpdate" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM t_mst_money_account_item
+        WHERE invoice_id = #{id}::uuid
+        for update
+    </select>
+
     <!-- 根据主键锁定表t_mst_money_account_item的多行数据 -->
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT

+ 96 - 77
src/main/java/com/dk/mdm/mapper/mst/MoneyAccountMapper.xml

@@ -5,92 +5,120 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        mac_id, mac_code, mac_name, mac_type, balance, display_no, flg_default, mac_receipt_code, remarks, flg_valid, cp_id
-    </sql>
-    <sql id="Base_Column_List_">
-        tmma.mac_id, tmma.mac_code, tmma.mac_name, tmma.mac_type, tmma.balance, tmma.display_no, tmma.flg_default, tmma.mac_receipt_code, tmma.remarks, tmma.flg_valid, tmma.cp_id
+        mac_id, mac_code, mac_name, mac_type, balance, display_no, flg_default, mac_receipt_code, acc_date, flg_negative, remarks, flg_valid, cp_id
     </sql>
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.MoneyAccount">
         <id column="mac_id" property="macId"/>
-                <result column="mac_code" property="macCode"/>
-                <result column="mac_name" property="macName"/>
-                <result column="mac_type" property="macType" typeHandler="UuidTypeHandler"/>
-                <result column="balance" property="balance"/>
-                <result column="display_no" property="displayNo"/>
-                <result column="flg_default" property="flgDefault"/>
-                <result column="mac_receipt_code" property="macReceiptCode"/>
-                <result column="remarks" property="remarks"/>
-                <result column="flg_valid" property="flgValid"/>
-                <result column="cp_id" property="cpId"/>
+            <result column="mac_code" property="macCode"/>
+            <result column="mac_name" property="macName"/>
+            <result column="mac_type" property="macType" typeHandler="UuidTypeHandler"/>
+            <result column="balance" property="balance"/>
+            <result column="display_no" property="displayNo"/>
+            <result column="flg_default" property="flgDefault"/>
+            <result column="mac_receipt_code" property="macReceiptCode"/>
+            <result column="acc_date" property="accDate"/>
+            <result column="flg_negative" property="flgNegative"/>
+            <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.mst.MoneyAccountResponse">
         <id column="mac_id" property="macId"/>
-                <result column="mac_code" property="macCode"/>
-                <result column="mac_name" property="macName"/>
-                <result column="mac_type" property="macType" typeHandler="UuidTypeHandler"/>
-                <result column="balance" property="balance"/>
-                <result column="display_no" property="displayNo"/>
-                <result column="flg_default" property="flgDefault"/>
-                <result column="mac_receipt_code" property="macReceiptCode"/>
-                <result column="remarks" property="remarks"/>
-                <result column="flg_valid" property="flgValid"/>
-                <result column="cp_id" property="cpId"/>
+            <result column="mac_code" property="macCode"/>
+            <result column="mac_name" property="macName"/>
+            <result column="mac_type" property="macType" typeHandler="UuidTypeHandler"/>
+            <result column="balance" property="balance"/>
+            <result column="display_no" property="displayNo"/>
+            <result column="flg_default" property="flgDefault"/>
+            <result column="mac_receipt_code" property="macReceiptCode"/>
+            <result column="acc_date" property="accDate"/>
+            <result column="flg_negative" property="flgNegative"/>
+            <result column="remarks" property="remarks"/>
+            <result column="flg_valid" property="flgValid"/>
+            <result column="cp_id" property="cpId"/>
     </resultMap>
 
     <!-- 通用条件列 -->
     <sql id="Condition">
         <where>
             <if test="macCode != null and macCode != ''">
-                AND ma.mac_code LIKE concat('%',my_ex.likequery(#{macCode}),'%')
+                AND t.mac_code LIKE concat('%',my_ex.likequery(#{macCode}),'%')
             </if>
             <if test="macName != null and macName != ''">
-                AND ma.mac_name LIKE concat('%',my_ex.likequery(#{macName}),'%')
+                AND t.mac_name LIKE concat('%',my_ex.likequery(#{macName}),'%')
             </if>
             <if test="remarks != null and remarks != ''">
-                AND ma.remarks = LIKE concat('%',my_ex.likequery(#{remarks}),'%')
+                AND t.remarks = LIKE concat('%',my_ex.likequery(#{remarks}),'%')
             </if>
             <if test="cpId != null">
-                AND ma.cp_id = #{cpId}
-            </if>
-            <if test="opTimestamp != null">
-                AND ma.op_timestamp = #{opTimestamp}
+                AND t.cp_id = #{cpId}
             </if>
             <if test="flgValidList != null and flgValidList.size>0">
-                AND ma.flg_valid  =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
+                AND t.flg_valid  =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
             </if>
             <if test="flgValid != null ">
-                AND ma.flg_valid  = #{flgValid}
+                AND t.flg_valid  = #{flgValid}
             </if>
             <if test="macTypeList != null and macTypeList.size() > 0">
-                AND ma.mac_Type  =any(#{macTypeList, typeHandler=UuidListTypeHandler})
+                AND t.mac_Type  =any(#{macTypeList, typeHandler=UuidListTypeHandler})
             </if>
         </where>
     </sql>
 
     <!-- 查询表t_mst_money_account,(条件查询+分页)列表 -->
     <select id="selectByCond" resultMap="BaseResultMapResponse">
-        SELECT ma.mac_Type,ma.mac_code,ma.mac_name,ma.remarks,ma.mac_receipt_code
-             ,ma.cp_id,ma.flg_valid
-             ,dd.data_value AS "macTypeName"
-             ,ma.mac_id,ma.balance,ma.display_no
-        FROM dkic_b.t_mst_money_account ma
-        left join dkic_b.t_mst_dictionary_data dd on ma.mac_type=dd.data_id
+        SELECT t.mac_id,
+               t.mac_code,
+               t.mac_name,
+               t.mac_Type,
+               dd.data_value            AS "macTypeName",
+               t.balance,
+               t.display_no,
+               t.mac_receipt_code,
+               t.acc_date,
+               t.flg_negative,
+               t.remarks,
+               t.flg_valid,
+               t.cp_id,
+               coalesce(tmt.amt_trf, 0) as "initBalance"
+        FROM dkic_b.t_mst_money_account as t
+                 left join dkic_b.t_mst_dictionary_data as dd on t.mac_type = dd.data_id
+                 left join dkic_b.t_mac_transfer as tmt on tmt.trf_in_mac = t.mac_id and tmt.trf_type = 0
         <include refid="Condition"/>
     </select>
 
-
-
     <!-- 查询表t_mst_money_account,(条件查询)个数 -->
     <select id="countByCond" resultType="Long">
-        SELECT
-        count(1)
-        FROM dkic_b.t_mst_money_account ma
+        SELECT count(1)
+        FROM dkic_b.t_mst_money_account as t
         <include refid="Condition"/>
     </select>
 
+    <!-- 根据主键查询表t_mst_money_account的一行数据 -->
+    <select id="selectById" resultMap="BaseResultMapResponse">
+        SELECT t.mac_id,
+               t.mac_code,
+               t.mac_name,
+               t.mac_Type,
+               dd.data_value            AS "macTypeName",
+               t.balance,
+               t.display_no,
+               t.mac_receipt_code,
+               t.acc_date,
+               t.flg_negative,
+               t.remarks,
+               t.flg_valid,
+               t.cp_id,
+               coalesce(tmt.amt_trf, 0) as "initBalance"
+        FROM dkic_b.t_mst_money_account as t
+                 left join dkic_b.t_mst_dictionary_data as dd on t.mac_type = dd.data_id
+                 left join dkic_b.t_mac_transfer as tmt on tmt.trf_in_mac = t.mac_id and tmt.trf_type = 0
+        WHERE t.mac_id = #{macId}::uuid
+    </select>
+
     <!-- 王英杰 2024年3月6日 微信小程序用 -->
     <select id="wxSelectByCond" resultType="java.util.Map">
         SELECT T
@@ -113,19 +141,19 @@
         WHERE
         tmdd.dict_code = '账户类别' UNION ALL
         SELECT
-        ma.mac_id AS "macId",
-        ma.mac_Type as "macType",
-        ma.mac_code AS "macCode",
-        ma.mac_name AS "macName",
-        ma.remarks  AS "Remarks",
-        ma.flg_valid AS "flgValid",
+        t.mac_id AS "macId",
+        t.mac_Type as "macType",
+        t.mac_code AS "macCode",
+        t.mac_name AS "macName",
+        t.remarks  AS "Remarks",
+        t.flg_valid AS "flgValid",
         dd.data_value AS "macTypeName",
-        ma.mac_id AS  "macId",
-        ma.balance AS  "balance",
-        ma.display_no AS  "displayNo"
+        t.mac_id AS  "macId",
+        t.balance AS  "balance",
+        t.display_no AS  "displayNo"
         FROM
-        dkic_b.t_mst_money_account ma
-        LEFT JOIN dkic_b.t_mst_dictionary_data dd ON ma.mac_type = dd.data_id
+        dkic_b.t_mst_money_account as t
+        LEFT JOIN dkic_b.t_mst_dictionary_data dd ON t.mac_type = dd.data_id
         <include refid="Condition"/>
 
         ) T
@@ -157,18 +185,18 @@
         WHERE
         tmdd.dict_code = '账户类别' UNION ALL
         SELECT
-        ma.mac_Type as "macType",
-        ma.mac_code AS "macCode",
-        ma.mac_name AS "macName",
-        ma.remarks  AS "Remarks",
-        ma.flg_valid AS "flgValid",
+        t.mac_Type as "macType",
+        t.mac_code AS "macCode",
+        t.mac_name AS "macName",
+        t.remarks  AS "Remarks",
+        t.flg_valid AS "flgValid",
         dd.data_value AS "macTypeName",
-        ma.mac_id AS  "macId",
-        ma.balance AS  "balance",
-        ma.display_no AS  "displayNo"
+        t.mac_id AS  "macId",
+        t.balance AS  "balance",
+        t.display_no AS  "displayNo"
         FROM
-        dkic_b.t_mst_money_account ma
-        LEFT JOIN dkic_b.t_mst_dictionary_data dd ON ma.mac_type = dd.data_id
+        dkic_b.t_mst_money_account as t
+        LEFT JOIN dkic_b.t_mst_dictionary_data dd ON t.mac_type = dd.data_id
         <include refid="Condition"/>
         ) T
         <where>
@@ -177,19 +205,10 @@
             </if>
         </where>
     </select>
-    <!-- 根据主键查询表t_mst_money_account的一行数据 -->
-    <select id="selectById" resultMap="BaseResultMapResponse">
-        SELECT
-        <include refid="Base_Column_List_"/>
-        ,tmdd.data_value AS "macTypeName"
-        FROM dkic_b.t_mst_money_account tmma
-        left join dkic_b.t_mst_dictionary_data tmdd on tmma.mac_type=tmdd.data_id
-        WHERE tmma.mac_id = #{macId}::uuid
-    </select>
 
     <select id="selectDisplayNo" resultType="Integer">
-        SELECT MAX(display_no) + 1  FROM dkic_b.t_mst_money_account ma
-         WHERE ma.cp_id = #{cpId}
+        SELECT MAX(display_no) + 1  FROM dkic_b.t_mst_money_account t
+         WHERE t.cp_id = #{cpId}
     </select>
 
     <!-- 根据主键锁定表t_mst_money_account的一行数据 -->

+ 1 - 1
src/main/java/com/dk/mdm/mapper/sale/OrderMapper.xml

@@ -372,7 +372,7 @@
                 AND t.amt_residue = #{amtResidue}
             </if>
             <if test="remarks != null and remarks != ''">
-                AND t.remarks = #{remarks}
+                AND t.remarks LIKE concat('%',my_ex.likequery(#{remarks}),'%')
             </if>
             <if test="annexPaths != null and annexPaths != ''">
                 AND t.annex_paths = #{annexPaths}

+ 174 - 0
src/main/java/com/dk/mdm/model/pojo/mac/MacTransfer.java

@@ -0,0 +1,174 @@
+package com.dk.mdm.model.pojo.mac;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONArray;
+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;
+import java.time.LocalDateTime;
+
+/**
+ *  资金转账
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("资金转账")
+@TableName(value = "t_mac_transfer", autoResultMap = true)
+@ApiModel(value="实体类:资金转账", description="表名:t_mac_transfer")
+public class MacTransfer extends PageInfo<MacTransfer> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 转账单ID
+     */
+//    @TableId(value = "trf_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "转账单ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfId;
+
+
+    /**
+     * 转账单号
+     */
+    @Excel(name = "转账单号")
+    @ApiModelProperty(value = "转账单号")
+    private String trfNo;
+
+
+    /**
+     * 转账类型 (0:期初 1:业务)
+     */
+    @Excel(name = "转账类型 (0:期初 1:业务)")
+    @ApiModelProperty(value = "转账类型 (0:期初 1:业务)")
+    private Integer trfType;
+
+
+    /**
+     * 部门
+     */
+    @Excel(name = "部门")
+    @ApiModelProperty(value = "部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String orgId;
+
+
+    /**
+     * 员工
+     */
+    @Excel(name = "员工")
+    @ApiModelProperty(value = "员工")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String staffId;
+
+
+    /**
+     * 转入账户
+     */
+    @Excel(name = "转入账户")
+    @ApiModelProperty(value = "转入账户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfInMac;
+
+
+    /**
+     * 转出账户
+     */
+    @Excel(name = "转出账户")
+    @ApiModelProperty(value = "转出账户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfOutMac;
+
+
+    /**
+     * 转账金额
+     */
+    @Excel(name = "转账金额")
+    @ApiModelProperty(value = "转账金额")
+    private BigDecimal amtTrf;
+
+
+    /**
+     * 转账日期 (账务日期)
+     */
+    @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;
+
+
+    /**
+     * 附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
+     */
+    @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONArray annexPaths;
+
+
+    /**
+     * 制单员
+     */
+    @Excel(name = "制单员")
+    @ApiModelProperty(value = "制单员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String makeStaff;
+
+
+    /**
+     * 制单时间
+     */
+    @Excel(name = "制单时间")
+    @ApiModelProperty(value = "制单时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime makeTime;
+
+
+    /**
+     * 有效标识 (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;
+
+}

+ 19 - 0
src/main/java/com/dk/mdm/model/pojo/mst/MoneyAccount.java

@@ -7,6 +7,7 @@ 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;
@@ -16,6 +17,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 
 /**
  *  资金账户
@@ -100,6 +102,23 @@ public class MoneyAccount extends PageInfo<MoneyAccount> implements Serializable
 
 
     /**
+     * 开户日期 (开户日期)
+     */
+    @Excel(name = "开户日期 (开户日期)")
+    @ApiModelProperty(value = "开户日期 (开户日期)")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDate accDate;
+
+    
+    /**
+     * 允许账户余额为负数
+     */
+    @Excel(name = "允许账户余额为负数")
+    @ApiModelProperty(value = "允许账户余额为负数")
+    private Boolean flgNegative;
+
+    /**
      * 备注
      */
     @Excel(name = "备注")

+ 197 - 0
src/main/java/com/dk/mdm/model/query/mac/MacTransferQuery.java

@@ -0,0 +1,197 @@
+package com.dk.mdm.model.query.mac;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONArray;
+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.JsonTypeHandler;
+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;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ *  资金转账
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("资金转账")
+@TableName(value = "t_mac_transfer", autoResultMap = true)
+@ApiModel(value="实体类:资金转账", description="表名:t_mac_transfer")
+public class MacTransferQuery extends PageInfo<MacTransferQuery> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 转账单ID
+     */
+//    @TableId(value = "trf_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "转账单ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfId;
+
+
+    /**
+     * 转账单号
+     */
+    @Excel(name = "转账单号")
+    @ApiModelProperty(value = "转账单号")
+    private String trfNo;
+
+
+    /**
+     * 转账类型 (0:期初 1:业务)
+     */
+    @Excel(name = "转账类型 (0:期初 1:业务)")
+    @ApiModelProperty(value = "转账类型 (0:期初 1:业务)")
+    private Integer trfType;
+
+
+    /**
+     * 部门
+     */
+    @Excel(name = "部门")
+    @ApiModelProperty(value = "部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String orgId;
+
+
+    /**
+     * 员工
+     */
+    @Excel(name = "员工")
+    @ApiModelProperty(value = "员工")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String staffId;
+
+
+    /**
+     * 转入账户
+     */
+    @Excel(name = "转入账户")
+    @ApiModelProperty(value = "转入账户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfInMac;
+
+
+    /**
+     * 转出账户
+     */
+    @Excel(name = "转出账户")
+    @ApiModelProperty(value = "转出账户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfOutMac;
+
+
+    /**
+     * 转账金额
+     */
+    @Excel(name = "转账金额")
+    @ApiModelProperty(value = "转账金额")
+    private BigDecimal amtTrf;
+
+
+    /**
+     * 转账日期 (账务日期)
+     */
+    @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;
+
+
+    /**
+     * 附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
+     */
+    @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONArray annexPaths;
+
+
+    /**
+     * 制单员
+     */
+    @Excel(name = "制单员")
+    @ApiModelProperty(value = "制单员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String makeStaff;
+
+
+    /**
+     * 制单时间
+     */
+    @Excel(name = "制单时间")
+    @ApiModelProperty(value = "制单时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime makeTime;
+
+
+    /**
+     * 有效标识 (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;
+
+
+    @ApiModelProperty(value = "部门List")
+    private List<String> orgIdList;
+
+    @ApiModelProperty(value = "业务员List")
+    private List<String> staffIdList;
+
+    @ApiModelProperty(value = "制单时间开始")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate makeTimeStart;
+
+    @ApiModelProperty(value = "制单时间结束")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate makeTimeEnd;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private List<Boolean> flgValidList;
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 19 - 3
src/main/java/com/dk/mdm/model/query/mst/MoneyAccountQuery.java

@@ -1,9 +1,7 @@
 package com.dk.mdm.model.query.mst;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.dk.common.infrastructure.annotaiton.ExportTitle;
 import com.dk.common.infrastructure.handler.TimestampTypeHandler;
@@ -20,7 +18,7 @@ import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
-import java.time.LocalDateTime;
+import java.time.LocalDate;
 import java.util.List;
 
 /**
@@ -107,6 +105,24 @@ public class MoneyAccountQuery extends PageInfo<MoneyAccountQuery> implements Se
 
 
     /**
+     * 开户日期 (开户日期)
+     */
+    @Excel(name = "开户日期 (开户日期)")
+    @ApiModelProperty(value = "开户日期 (开户日期)")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDate accDate;
+
+
+    /**
+     * 允许账户余额为负数
+     */
+    @Excel(name = "允许账户余额为负数")
+    @ApiModelProperty(value = "允许账户余额为负数")
+    private Boolean flgNegative;
+
+
+    /**
      * 备注
      */
     @Excel(name = "备注")

+ 187 - 0
src/main/java/com/dk/mdm/model/response/mac/MacTransferResponse.java

@@ -0,0 +1,187 @@
+package com.dk.mdm.model.response.mac;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONArray;
+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.JsonTypeHandler;
+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;
+import java.time.LocalDateTime;
+
+/**
+ *  资金转账
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("资金转账")
+@TableName(value = "t_mac_transfer", autoResultMap = true)
+@ApiModel(value="实体类:资金转账", description="表名:t_mac_transfer")
+public class MacTransferResponse extends PageInfo<MacTransferResponse> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 转账单ID
+     */
+//    @TableId(value = "trf_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "转账单ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfId;
+
+
+    /**
+     * 转账单号
+     */
+    @Excel(name = "转账单号")
+    @ApiModelProperty(value = "转账单号")
+    private String trfNo;
+
+
+    /**
+     * 转账类型 (0:期初 1:业务)
+     */
+    @Excel(name = "转账类型 (0:期初 1:业务)")
+    @ApiModelProperty(value = "转账类型 (0:期初 1:业务)")
+    private Integer trfType;
+
+
+    /**
+     * 部门
+     */
+    @Excel(name = "部门")
+    @ApiModelProperty(value = "部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String orgId;
+
+
+    /**
+     * 员工
+     */
+    @Excel(name = "员工")
+    @ApiModelProperty(value = "员工")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String staffId;
+
+
+    /**
+     * 转入账户
+     */
+    @Excel(name = "转入账户")
+    @ApiModelProperty(value = "转入账户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfInMac;
+
+
+    /**
+     * 转出账户
+     */
+    @Excel(name = "转出账户")
+    @ApiModelProperty(value = "转出账户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfOutMac;
+
+
+    /**
+     * 转账金额
+     */
+    @Excel(name = "转账金额")
+    @ApiModelProperty(value = "转账金额")
+    private BigDecimal amtTrf;
+
+
+    /**
+     * 转账日期 (账务日期)
+     */
+    @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;
+
+
+    /**
+     * 附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
+     */
+    @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONArray annexPaths;
+
+
+    /**
+     * 制单员
+     */
+    @Excel(name = "制单员")
+    @ApiModelProperty(value = "制单员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String makeStaff;
+
+
+    /**
+     * 制单时间
+     */
+    @Excel(name = "制单时间")
+    @ApiModelProperty(value = "制单时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime makeTime;
+
+
+    /**
+     * 有效标识 (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;
+
+
+    @ApiModelProperty(value = "组织名称")
+    private String orgName;
+
+    @ApiModelProperty(value = "员工姓名")
+    private String staffName;
+
+    @ApiModelProperty(value = "制单员")
+    private String makeStaffName;
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 26 - 11
src/main/java/com/dk/mdm/model/response/mst/MoneyAccountResponse.java

@@ -4,8 +4,10 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 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;
@@ -16,6 +18,7 @@ import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.time.LocalDate;
 
 /**
  *  资金账户
@@ -67,13 +70,6 @@ public class MoneyAccountResponse extends PageInfo<MoneyAccountResponse> impleme
     @TableField(typeHandler = UuidTypeHandler.class)
     private String macType;
 
-    /**
-     * 账户类别名称 (【数据字典】)
-     */
-    @Excel(name = "账户类别 (【数据字典】)")
-    @ApiModelProperty(value = "账户类别 (【数据字典】)")
-    private String macTypeName;
-
 
     /**
      * 账户余额
@@ -108,6 +104,24 @@ public class MoneyAccountResponse extends PageInfo<MoneyAccountResponse> impleme
 
 
     /**
+     * 开户日期 (开户日期)
+     */
+    @Excel(name = "开户日期 (开户日期)")
+    @ApiModelProperty(value = "开户日期 (开户日期)")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDate accDate;
+
+
+    /**
+     * 允许账户余额为负数
+     */
+    @Excel(name = "允许账户余额为负数")
+    @ApiModelProperty(value = "允许账户余额为负数")
+    private Boolean flgNegative;
+
+
+    /**
      * 备注
      */
     @Excel(name = "备注")
@@ -130,14 +144,15 @@ public class MoneyAccountResponse extends PageInfo<MoneyAccountResponse> impleme
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
 
-    /**
-     * 账户余额
-     */
-    @TableField(exist = false)
+
     @ApiModelProperty(value = "合计账户余额")
     private BigDecimal totalBalance;
 
+    @ApiModelProperty(value = "账户类别 (【数据字典】)")
+    private String macTypeName;
 
+    @ApiModelProperty(value = "期初余额")
+    private BigDecimal initBalance;
 
     private static final long serialVersionUID = 1L;
 

+ 177 - 0
src/main/java/com/dk/mdm/model/vo/mac/MacTransferVO.java

@@ -0,0 +1,177 @@
+package com.dk.mdm.model.vo.mac;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONArray;
+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.JsonTypeHandler;
+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;
+import java.time.LocalDateTime;
+
+/**
+ *  资金转账
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("资金转账")
+@TableName(value = "t_mac_transfer", autoResultMap = true)
+@ApiModel(value="实体类:资金转账", description="表名:t_mac_transfer")
+public class MacTransferVO extends PageInfo<MacTransferVO> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 转账单ID
+     */
+//    @TableId(value = "trf_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "转账单ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfId;
+
+
+    /**
+     * 转账单号
+     */
+    @Excel(name = "转账单号")
+    @ApiModelProperty(value = "转账单号")
+    private String trfNo;
+
+
+    /**
+     * 转账类型 (0:期初 1:业务)
+     */
+    @Excel(name = "转账类型 (0:期初 1:业务)")
+    @ApiModelProperty(value = "转账类型 (0:期初 1:业务)")
+    private Integer trfType;
+
+
+    /**
+     * 部门
+     */
+    @Excel(name = "部门")
+    @ApiModelProperty(value = "部门")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String orgId;
+
+
+    /**
+     * 员工
+     */
+    @Excel(name = "员工")
+    @ApiModelProperty(value = "员工")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String staffId;
+
+
+    /**
+     * 转入账户
+     */
+    @Excel(name = "转入账户")
+    @ApiModelProperty(value = "转入账户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfInMac;
+
+
+    /**
+     * 转出账户
+     */
+    @Excel(name = "转出账户")
+    @ApiModelProperty(value = "转出账户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String trfOutMac;
+
+
+    /**
+     * 转账金额
+     */
+    @Excel(name = "转账金额")
+    @ApiModelProperty(value = "转账金额")
+    private BigDecimal amtTrf;
+
+
+    /**
+     * 转账日期 (账务日期)
+     */
+    @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;
+
+
+    /**
+     * 附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
+     */
+    @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONArray annexPaths;
+
+
+    /**
+     * 制单员
+     */
+    @Excel(name = "制单员")
+    @ApiModelProperty(value = "制单员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String makeStaff;
+
+
+    /**
+     * 制单时间
+     */
+    @Excel(name = "制单时间")
+    @ApiModelProperty(value = "制单时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime makeTime;
+
+
+    /**
+     * 有效标识 (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;
+
+}

+ 32 - 0
src/main/java/com/dk/mdm/model/vo/mst/MoneyAccountVO.java

@@ -4,8 +4,10 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 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;
@@ -16,6 +18,7 @@ import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 /**
@@ -102,6 +105,24 @@ public class MoneyAccountVO extends PageInfo<MoneyAccountVO> implements Serializ
 
 
     /**
+     * 开户日期 (开户日期)
+     */
+    @Excel(name = "开户日期 (开户日期)")
+    @ApiModelProperty(value = "开户日期 (开户日期)")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDate accDate;
+
+
+    /**
+     * 允许账户余额为负数
+     */
+    @Excel(name = "允许账户余额为负数")
+    @ApiModelProperty(value = "允许账户余额为负数")
+    private Boolean flgNegative;
+
+
+    /**
      * 备注
      */
     @Excel(name = "备注")
@@ -124,6 +145,17 @@ public class MoneyAccountVO extends PageInfo<MoneyAccountVO> implements Serializ
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
 
+    @ApiModelProperty(value = "期初余额")
+    private BigDecimal initBalance;
+
+    @ApiModelProperty(value = "制单员")
+    private String makeStaff;
+
+    @ApiModelProperty(value = "部门")
+    private String orgId;
+
+    @ApiModelProperty(value = "员工")
+    private String staffId;
 
     private static final long serialVersionUID = 1L;
 

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

@@ -0,0 +1,28 @@
+package com.dk.mdm.service.mac;
+
+import com.dk.mdm.model.pojo.mac.MacTransfer;
+import com.dk.mdm.mapper.mac.MacTransferMapper;
+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 MacTransferService extends BaseService<MacTransfer> {
+
+	@Override
+	public String getPrimaryKey() {
+		return "trf_id";
+	}
+
+	@Override
+	public BaseMapper<MacTransfer> getRepository() {
+		return macTransferMapper;
+	}
+
+	@Autowired
+	private MacTransferMapper macTransferMapper;
+
+}

+ 88 - 20
src/main/java/com/dk/mdm/service/mst/MoneyAccountService.java

@@ -7,14 +7,20 @@ import com.dk.common.model.pojo.PageList;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.infrastructure.convert.mst.MoneyAccountConvert;
+import com.dk.mdm.mapper.mac.MacTransferMapper;
+import com.dk.mdm.mapper.mst.MoneyAccountItemMapper;
+import com.dk.mdm.model.pojo.mac.MacTransfer;
 import com.dk.mdm.model.pojo.mst.MoneyAccount;
 import com.dk.mdm.mapper.mst.MoneyAccountMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.pojo.mst.MoneyAccountItem;
 import com.dk.mdm.model.query.mst.MoneyAccountQuery;
 import com.dk.mdm.model.response.mst.MoneyAccountResponse;
 import com.dk.mdm.model.vo.mst.MoneyAccountVO;
 import com.dk.mdm.service.common.CommonService;
+import com.dk.mdm.service.mac.AccountService;
+import com.dk.mdm.service.mac.MacTransferService;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -28,29 +34,44 @@ import java.util.UUID;
 @Transactional
 public class MoneyAccountService extends BaseService<MoneyAccount> {
 
+	/**
+	 * @desc   : 重写主键
+	 * @author : 宋扬
+	 * @date   : 2023/1/9 10:39
+	 */
+	@Override
+	public String getPrimaryKey() {
+		return "mac_id";
+	}
+
 	@Override
 	public BaseMapper<MoneyAccount> getRepository() {
 		return moneyAccountMapper;
 	}
 
 	@Autowired
+	private MacTransferService macTransferService;
+
+	@Autowired
 	private MoneyAccountMapper moneyAccountMapper;
 
 	@Autowired
-	private MoneyAccountConvert moneyAccountConvert;
+	private MoneyAccountItemService moneyAccountItemService;
+
+	@Autowired
+	private MoneyAccountItemMapper moneyAccountItemMapper;
+
+	@Autowired
+	private AccountService accountService;
 
 	@Autowired
 	private CommonService commonService;
 
-	/**
-	 * @desc   : 重写主键
-	 * @author : 宋扬
-	 * @date   : 2023/1/9 10:39
-	 */
-	@Override
-	public String getPrimaryKey() {
-		return "mac_id";
-	}
+	@Autowired
+	private MacTransferMapper macTransferMapper;
+
+	@Autowired
+	private MoneyAccountConvert moneyAccountConvert;
 
 
 	/**
@@ -65,6 +86,17 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 	}
 
 	/**
+	 * @desc   : 条件查询
+	 * @author : 宋扬
+	 * @date   : 2023/2/29 10:40
+	 */
+	@Pagination
+	public ResponseResultVO selectById(String id) {
+		MoneyAccountResponse moneyAccountResponse = moneyAccountMapper.selectById(id);
+		return ResponseResultUtil.success(moneyAccountResponse);
+	}
+
+	/**
 	 * @desc   : 维修小程序列表
 	 * @author : 王英杰
 	 * @date   : 2023/2/29 10:40
@@ -81,7 +113,6 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 
 	}
 
-
 	/**
 	 * @desc : 保存方法
 	 * @author : 宋扬
@@ -93,14 +124,33 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 	public ResponseResultVO<?> insert(MoneyAccountVO moneyAccountVO) {
 		// 转化实体
 		MoneyAccount moneyAccount = moneyAccountConvert.convertToPo(moneyAccountVO);
-		// 获取显示顺序
-		Integer displayNo = commonService.getMaxDisplayNo(Constant.DisplayNoTable.MONEYACCOUNT);
+		// 赋值期初
+		moneyAccount.setBalance(moneyAccountVO.getInitBalance());
+
 		// 获取编码和主键UuId
 		Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.MONEYACCOUNT.getName(),true);
-		moneyAccount.setDisplayNo(displayNo);
-		moneyAccount.setMacId(codeMap.get("outId").toString());
-		moneyAccount.setMacCode(codeMap.get("outNote").toString());
-		return super.insert(moneyAccount);
+		// 获取显示顺序
+		Integer displayNo = commonService.getMaxDisplayNo(Constant.DisplayNoTable.MONEYACCOUNT);
+		moneyAccount.setMacId(codeMap.get("outId").toString()).setMacCode(codeMap.get("outNote").toString()).setDisplayNo(displayNo);
+		super.insert(moneyAccount);
+
+		// 插入资金转账表
+		MacTransfer macTransfer = new MacTransfer();
+		codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.MACTRANSFER.getName(),true);
+		macTransfer.setTrfId(codeMap.get("outId").toString()).setTrfNo(codeMap.get("outNote").toString())
+			.setTrfType(0).setOrgId(moneyAccountVO.getOrgId()).setStaffId(moneyAccountVO.getStaffId())
+			.setTrfInMac(moneyAccount.getMacId()).setAmtTrf(moneyAccount.getBalance()).setAccDate(moneyAccount.getAccDate())
+			.setMakeStaff(moneyAccountVO.getMakeStaff()).setCpId(moneyAccount.getCpId());
+		macTransferMapper.insert(macTransfer);
+
+		// 插入资金流水
+		MoneyAccountItem moneyAccountItem = new MoneyAccountItem();
+		moneyAccountItem.setMacId(moneyAccount.getMacId()).setFlowType(Constant.FlowType.ZHUAN_ZHANG.getName())
+				.setInvoiceId(macTransfer.getTrfId()).setAmtInflow(moneyAccount.getBalance()).setAccDate(moneyAccount.getAccDate())
+				.setMakeStaff(moneyAccountVO.getMakeStaff()).setCpId(moneyAccount.getCpId());
+		moneyAccountItemMapper.insert(moneyAccountItem);
+
+		return ResponseResultUtil.success();
 	}
 
 	/**
@@ -114,8 +164,26 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 	public ResponseResultVO<Boolean> update(MoneyAccountVO moneyAccountVO) {
 		// 转化实体
 		MoneyAccount moneyAccount = moneyAccountConvert.convertToPo(moneyAccountVO);
-		return ResponseResultUtil.success(super.update(moneyAccount, new UpdateWrapper<MoneyAccount>().lambda().eq(MoneyAccount::getMacId,
-				UUID.fromString(moneyAccount.getMacId()))));
+		super.update(moneyAccount, new UpdateWrapper<MoneyAccount>().lambda().eq(MoneyAccount::getMacId,
+				UUID.fromString(moneyAccount.getMacId())));
+
+		// 赋值期初
+		moneyAccount.setBalance(moneyAccountVO.getInitBalance());
+
+		// 更新资金转账
+		MacTransfer macTransfer = macTransferMapper.selectByInMacIdForUpdate(moneyAccount.getMacId());
+		MacTransfer MacTransferUpdate = new MacTransfer();
+		MacTransferUpdate.setAmtTrf(moneyAccount.getBalance()).setAccDate(moneyAccount.getAccDate()).setTrfId(macTransfer.getTrfId());
+		macTransferService.updateByUuid(MacTransferUpdate);
+
+		// 更新资金流水
+		MoneyAccountItem moneyAccountItem = moneyAccountItemMapper.selectByInvoiceIdForUpdate(macTransfer.getTrfId());
+		MoneyAccountItem moneyAccountItemUpdate = new MoneyAccountItem();
+		moneyAccountItemUpdate.setAmtInflow(moneyAccount.getBalance()).setAccDate(moneyAccount.getAccDate()).setItemId(moneyAccountItem.getItemId());
+		moneyAccountItemService.updateByUuid(moneyAccountItemUpdate);
+
+		// 更新账户余额
+		accountService.updateMac(moneyAccount.getMacId());
+		return ResponseResultUtil.success();
 	}
-
 }