songyang 2 лет назад
Родитель
Сommit
b4f00fa345

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

@@ -37,6 +37,17 @@ public class MoneyAccountController{
     }
 
     /**
+     * @desc   : 通过ID查询
+     * @author : songy
+     * @date   : 2024/3/1 16:01
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO selectById(@PathVariable String id) {
+        return moneyAccountService.selectById(id);
+    }
+
+
+    /**
      * @desc : 新建资金账户
      * @author : songy
      * @date : 2023/2/29 10:48
@@ -58,6 +69,8 @@ public class MoneyAccountController{
         return moneyAccountService.update(moneyAccountVO);
     }
 
+
+
     /**
      * @desc : 停用
      * @author : songy

+ 10 - 2
src/main/java/com/dk/mdm/mapper/mst/MoneyAccountMapper.java

@@ -2,6 +2,7 @@ package com.dk.mdm.mapper.mst;
 
 import com.dk.mdm.model.pojo.mst.MoneyAccount;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mst.GoodsBrandQuery;
 import com.dk.mdm.model.query.mst.MoneyAccountQuery;
 import com.dk.mdm.model.response.mst.MoneyAccountResponse;
 import org.springframework.stereotype.Repository;
@@ -16,15 +17,22 @@ public interface MoneyAccountMapper extends BaseMapper<MoneyAccount>{
     /**
      * @desc   : 根据条件进行查询
      * @author : songy
-     * @date   : 2023/1/9 10:42
+     * @date   : 2024/3/1 10:42
      */
     List<MoneyAccountResponse> selectByCond(MoneyAccountQuery moneyAccountQuery);
 
     /**
      * @desc   : 根据条件进行查询(数量)
      * @author : songy
-     * @date   : 2023/1/9 10:42
+     * @date   : 2024/3/1 10:42
      */
     Long countByCond(MoneyAccountQuery moneyAccountQuery);
+
+   /**
+    * @desc   : 查询
+    * @author : songy
+    * @date   : 2024/3/2 16:19
+    */
+    Integer selectDisplayNo(MoneyAccountQuery moneyAccountQuery);
 }
 

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

@@ -9,7 +9,7 @@
     </sql>
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.MoneyAccount">
+    <resultMap id="BaseResultMap" 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"/>
@@ -34,55 +34,37 @@
     <sql id="Condition">
         <where>
             <if test="macCode != null and macCode != ''">
-                AND mac_code = #{macCode}
+                AND ma.mac_code = #{macCode}
             </if>
             <if test="macName != null and macName != ''">
-                AND mac_name = #{macName}
-            </if>
-            <if test="macType != null and macType != ''">
-                AND mac_type = #{macType}
-            </if>
-            <if test="balance != null">
-                AND balance = #{balance}
-            </if>
-            <if test="displayNo != null">
-                AND display_no = #{displayNo}
-            </if>
-            <if test="flgDefault != null">
-                AND flg_default = #{flgDefault}
-            </if>
-            <if test="macReceiptCode != null and macReceiptCode != ''">
-                AND mac_receipt_code = #{macReceiptCode}
+                AND ma.mac_name = #{macName}
             </if>
             <if test="remarks != null and remarks != ''">
-                AND remarks = #{remarks}
-            </if>
-            <if test="flgValid != null">
-                AND flg_valid = #{flgValid}
+                AND ma.remarks = #{remarks}
             </if>
             <if test="cpId != null">
-                AND cp_id = #{cpId}
+                AND ma.cp_id = #{cpId}
             </if>
             <if test="opCreateTime != null">
-                AND op_create_time = #{opCreateTime}
+                AND ma.op_create_time = #{opCreateTime}
             </if>
             <if test="opCreateUserId != null and opCreateUserId != ''">
-                AND op_create_user_id = #{opCreateUserId}
+                AND ma.op_create_user_id = #{opCreateUserId}
             </if>
             <if test="opUpdateTime != null">
-                AND op_update_time = #{opUpdateTime}
+                AND ma.op_update_time = #{opUpdateTime}
             </if>
             <if test="opUpdateUserId != null and opUpdateUserId != ''">
-                AND op_update_user_id = #{opUpdateUserId}
-            </if>
-            <if test="opAppCode != null and opAppCode != ''">
-                AND op_app_code = #{opAppCode}
+                AND ma.op_update_user_id = #{opUpdateUserId}
             </if>
             <if test="opTimestamp != null">
-                AND op_timestamp = #{opTimestamp}
+                AND ma.op_timestamp = #{opTimestamp}
             </if>
-            <if test="opDbUser != null and opDbUser != ''">
-                AND op_db_user = #{opDbUser}
+            <if test="flgValidList != null and flgValidList.size>0">
+                AND ma.flg_valid  =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
+            </if>
+            <if test="macTypeList != null and macTypeList.size() > 0">
+                AND ma.mac_Type  =any(#{macTypeList, typeHandler=UuidListTypeHandler})
             </if>
         </where>
     </sql>
@@ -97,9 +79,12 @@
 
     <!-- 查询表t_mst_money_account,(条件查询+分页)列表 -->
     <select id="selectByCond" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mst_money_account
+        SELECT ma.mac_Type,ma.mac_code,ma.mac_name,ma.remarks
+             ,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
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -110,68 +95,12 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_mst_money_account
+        FROM dkic_b.t_mst_money_account ma
         <include refid="Condition"/>
     </select>
 
-    <!-- 根据主键查询表t_mst_money_account的一行数据 -->
-    <select id="selectById" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mst_money_account
-        WHERE mac_id = #{macId}::uuid
+    <select id="selectDisplayNo" resultType="Integer">
+        SELECT MAX(display_no) + 1  FROM dkic_b.t_mst_money_account ma
+         WHERE ma.cp_id = #{cpId}
     </select>
-
-    <!-- 根据主键锁定表t_mst_money_account的一行数据 -->
-    <select id="selectByIdForUpdate" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mst_money_account
-        WHERE mac_id = #{macId}
-        for update
-    </select>
-
-    <!-- 根据主键锁定表t_mst_money_account的多行数据 -->
-    <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mst_money_account
-        <include refid="idsForeach"/>
-        for update
-    </select>
-
-    <insert id="insertBatch">
-        insert into t_mst_money_account
-        (
-        <trim suffixOverrides=",">
-            mac_code,
-            mac_name,
-            mac_type,
-            balance,
-            display_no,
-            flg_default,
-            mac_receipt_code,
-            remarks,
-            cp_id,
-            op_app_code,
-        </trim>
-        )
-        values
-        <foreach collection="list" index="index" item="item" separator=",">
-            (
-            <trim suffixOverrides=",">
-                #{item.macCode},
-                #{item.macName},
-                #{item.macType}::uuid,
-                #{item.balance},
-                #{item.displayNo},
-                #{item.flgDefault},
-                #{item.macReceiptCode},
-                #{item.remarks},
-                #{item.cpId},
-                #{item.opAppCode},
-            </trim>
-            )
-        </foreach>
-    </insert>
 </mapper>

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

@@ -41,7 +41,7 @@ public class MoneyAccount extends PageInfo<MoneyAccount> implements Serializable
     /**
      * 资金账户ID
      */
-    @TableId(value = "mac_id", type = IdType.AUTO)
+//    @TableId(value = "mac_id", type = IdType.AUTO)
     @ApiModelProperty(value = "资金账户ID")
     @TableField(typeHandler = UuidTypeHandler.class)
     private String macId;
@@ -71,7 +71,6 @@ public class MoneyAccount extends PageInfo<MoneyAccount> implements Serializable
     @TableField(typeHandler = UuidTypeHandler.class)
     private String macType;
 
-
     /**
      * 账户余额
      */
@@ -120,6 +119,7 @@ public class MoneyAccount extends PageInfo<MoneyAccount> implements Serializable
     private Boolean flgValid;
 
 
+
     /**
      * 企业ID
      */

+ 20 - 0
src/main/java/com/dk/mdm/model/query/mst/MoneyAccountQuery.java

@@ -21,6 +21,7 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  *  资金账户
@@ -193,6 +194,25 @@ public class MoneyAccountQuery extends PageInfo<MoneyAccountQuery> implements Se
     private String opDbUser;
 
 
+    /**
+     * @desc   : 有效标识List
+     * @author : songy
+     * @date   : 2024/3/2 9:31
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private List<Boolean> flgValidList;
+
+
+    /**
+     * @desc   : 账户类别list
+     * @author : songy
+     * @date   : 2024/3/2 9:27
+     */
+    @Excel(name = "账户类别 (【数据字典】)")
+    @ApiModelProperty(value = "账户类别 (【数据字典】)")
+    private List<String> macTypeList;
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 9 - 0
src/main/java/com/dk/mdm/model/response/mst/MoneyAccountResponse.java

@@ -6,6 +6,7 @@ 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.StringListTypeHandler;
 import com.dk.common.infrastructure.handler.TimestampTypeHandler;
 import com.dk.common.infrastructure.handler.UuidTypeHandler;
 import com.dk.common.model.pojo.PageInfo;
@@ -21,6 +22,7 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  *  资金账户
@@ -72,6 +74,13 @@ public class MoneyAccountResponse extends PageInfo<MoneyAccountResponse> impleme
     @TableField(typeHandler = UuidTypeHandler.class)
     private String macType;
 
+    /**
+     * 账户类别名称 (【数据字典】)
+     */
+    @Excel(name = "账户类别 (【数据字典】)")
+    @ApiModelProperty(value = "账户类别 (【数据字典】)")
+    private String macTypeName;
+
 
     /**
      * 账户余额

+ 23 - 1
src/main/java/com/dk/mdm/service/mst/MoneyAccountService.java

@@ -2,7 +2,9 @@ package com.dk.mdm.service.mst;
 
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.infrastructure.constant.Constant;
 import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.infrastructure.convert.mst.MoneyAccountConvert;
@@ -11,14 +13,19 @@ 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.Staff;
+import com.dk.mdm.model.query.mst.GoodsBrandQuery;
 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.model.vo.mst.StaffVO;
+import com.dk.mdm.service.common.CommonService;
 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 java.util.Map;
 import java.util.UUID;
 
 @Service
@@ -36,6 +43,9 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 	@Autowired
 	private MoneyAccountConvert moneyAccountConvert;
 
+	@Autowired
+	private CommonService commonService;
+
 	/**
 	 * @desc   : 重写主键
 	 * @author : songy
@@ -58,6 +68,7 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 				moneyAccountMapper.countByCond(moneyAccountQuery));
 	}
 
+
 	/**
 	 * @desc : 保存方法
 	 * @author : songy
@@ -69,7 +80,17 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 	public ResponseResultVO<?> insert(MoneyAccountVO moneyAccountVO) {
 		// 转化实体
 		MoneyAccount moneyAccount = moneyAccountConvert.convertToPo(moneyAccountVO);
-
+		Integer displayNo = moneyAccountMapper.selectDisplayNo(new MoneyAccountQuery());
+		if (displayNo != null) {
+			//插入序号
+			moneyAccount.setDisplayNo(displayNo);
+		} else {
+			moneyAccount.setDisplayNo(0);
+		}
+		// 获取编码和主键UuId
+		Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.MONEYACCOUNT.getName(),true);
+		moneyAccount.setMacId(codeMap.get("outId").toString());
+		moneyAccount.setMacCode(codeMap.get("outNote").toString());
 		return super.insert(moneyAccount);
 	}
 
@@ -87,4 +108,5 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 		return ResponseResultUtil.success(super.update(moneyAccount, new UpdateWrapper<MoneyAccount>().lambda().eq(MoneyAccount::getMacId,
 				UUID.fromString(moneyAccount.getMacId()))));
 	}
+
 }