Преглед изворни кода

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

songyang пре 2 година
родитељ
комит
280f76dee2

+ 53 - 4
src/main/java/com/dk/mdm/controller/mac/OtherReceivableController.java

@@ -1,17 +1,23 @@
 package com.dk.mdm.controller.mac;
 package com.dk.mdm.controller.mac;
 
 
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.model.pojo.mac.OtherReceivable;
 import com.dk.mdm.model.pojo.mac.OtherReceivable;
-import com.dk.common.controller.BaseController;
 import com.dk.common.service.BaseService;
 import com.dk.common.service.BaseService;
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.dk.mdm.model.query.mac.OtherReceivableQuery;
+import com.dk.mdm.model.response.mac.OtherReceivableResponse;
+import com.dk.mdm.model.vo.mac.OtherReceivableVO;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RestController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import com.dk.mdm.service.mac.OtherReceivableService;
 import com.dk.mdm.service.mac.OtherReceivableService;
 
 
+import java.util.Map;
+
 @Api(tags = "其他收入单API接口")
 @Api(tags = "其他收入单API接口")
 @RestController
 @RestController
-@RequestMapping("/otherReceivable")
+@RequestMapping("/mac/otherReceivable")
 public class OtherReceivableController{
 public class OtherReceivableController{
 
 
     public BaseService<OtherReceivable> getService() {
     public BaseService<OtherReceivable> getService() {
@@ -21,4 +27,47 @@ public class OtherReceivableController{
     @Autowired
     @Autowired
     private OtherReceivableService otherReceivableService;
     private OtherReceivableService otherReceivableService;
 
 
+    /**
+     * @desc : 条件查询
+     * @author : 付斌
+     * @date : 2023/1/9 10:36
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<OtherReceivableResponse>> selectByCond(@RequestBody OtherReceivableQuery otherReceivableQuery) {
+        return otherReceivableService.selectByCond(otherReceivableQuery);
+    }
+
+    /**
+     * @desc :查询其它收入明细(明细附件)
+     * @author : 付斌
+     * @date : 2024-02-28 13:24
+     */
+    @PostMapping({"select_other_receivable_info_by_id/{id}"})
+    public ResponseResultVO<Map<String, Object>> selectOtherReceivableInfoById(@PathVariable String id) {
+        return otherReceivableService.selectOtherReceivableInfoById(id);
+    }
+
+    /**
+     * @desc : 新建方法
+     * @author : 付斌
+     * @date : 2023/1/9 10:48
+     */
+    @ApiOperation(value = "新建", notes = "新建")
+    @PostMapping({"insert"})
+    public ResponseResultVO<?> insert(@RequestBody OtherReceivableVO otherReceivableVO) {
+        return otherReceivableService.insert(otherReceivableVO);
+    }
+
+    /**
+     * @desc : 编辑方法
+     * @author : 付斌
+     * @date : 2023/1/9 10:49
+     */
+    @ApiOperation(value = "编辑", notes = "编辑")
+    @PostMapping({"update"})
+    public ResponseResultVO<?> update(@RequestBody OtherReceivableVO otherReceivableVO) {
+        return otherReceivableService.update(otherReceivableVO);
+    }
+
 }
 }

+ 22 - 0
src/main/java/com/dk/mdm/infrastructure/convert/mac/OtherReceivableConvert.java

@@ -0,0 +1,22 @@
+package com.dk.mdm.infrastructure.convert.mac;
+
+import com.dk.mdm.model.pojo.mac.OtherReceivable;
+import com.dk.mdm.model.vo.mac.OtherReceivableVO;
+import org.mapstruct.Mapper;
+
+/**
+ * @desc   : OtherReceivable转换类
+ * @author : 付斌
+ * @date   : 2024-02-28 10:18
+ */
+@Mapper(componentModel = "spring")
+public interface OtherReceivableConvert {
+
+    /**
+     * @desc   : 转换vo为pojo
+     * @author : 付斌
+     * @date   : 2024-02-28 15:26
+     */
+    OtherReceivable convertToPo(OtherReceivableVO recPayVO);
+
+}

+ 22 - 0
src/main/java/com/dk/mdm/infrastructure/convert/mac/OtherReceivableItemConvert.java

@@ -0,0 +1,22 @@
+package com.dk.mdm.infrastructure.convert.mac;
+
+import com.dk.mdm.model.pojo.mac.OtherReceivableItem;
+import com.dk.mdm.model.vo.mac.OtherReceivableItemVO;
+import org.mapstruct.Mapper;
+
+/**
+ * @desc   : OtherReceivableItem转换类
+ * @author : 付斌
+ * @date   : 2024-02-28 10:18
+ */
+@Mapper(componentModel = "spring")
+public interface OtherReceivableItemConvert {
+
+    /**
+     * @desc   : 转换vo为pojo
+     * @author : 付斌
+     * @date   : 2024-02-28 15:26
+     */
+    OtherReceivableItem convertToPo(OtherReceivableItemVO otherReceivableItemVO);
+
+}

+ 10 - 1
src/main/java/com/dk/mdm/mapper/mac/OtherReceivableItemMapper.java

@@ -2,13 +2,22 @@ package com.dk.mdm.mapper.mac;
 
 
 import com.dk.mdm.model.pojo.mac.OtherReceivableItem;
 import com.dk.mdm.model.pojo.mac.OtherReceivableItem;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mac.OtherReceivableItemQuery;
+import com.dk.mdm.model.response.mac.OtherReceivableItemResponse;
 import org.springframework.stereotype.Repository;
 import org.springframework.stereotype.Repository;
 
 
+import java.util.List;
+
 /**
 /**
 *  其他收入明细 Mapper
 *  其他收入明细 Mapper
 */
 */
 @Repository
 @Repository
 public interface OtherReceivableItemMapper extends BaseMapper<OtherReceivableItem>{
 public interface OtherReceivableItemMapper extends BaseMapper<OtherReceivableItem>{
-	
+    /**
+     * @desc : 根据条件进行查询
+     * @author : 付斌
+     * @date : 2024-02-28 10:18
+     */
+    List<OtherReceivableItemResponse> selectByCond(OtherReceivableItemQuery otherReceivableQuery);
 }
 }
 
 

+ 36 - 16
src/main/java/com/dk/mdm/mapper/mac/OtherReceivableItemMapper.xml

@@ -20,29 +20,41 @@
             <result column="cp_id" property="cpId"/>
             <result column="cp_id" property="cpId"/>
     </resultMap>
     </resultMap>
 
 
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.OtherReceivableItemResponse">
+        <id column="item_id" property="itemId"/>
+            <result column="receivable_id" property="receivableId" typeHandler="UuidTypeHandler"/>
+            <result column="receivable_type" property="receivableType" typeHandler="UuidTypeHandler"/>
+            <result column="qty_receivable" property="qtyReceivable"/>
+            <result column="amt_receivable" property="amtReceivable"/>
+            <result column="remarks" property="remarks"/>
+            <result column="flg_valid" property="flgValid"/>
+            <result column="cp_id" property="cpId"/>
+    </resultMap>
+
     <!-- 通用条件列 -->
     <!-- 通用条件列 -->
     <sql id="Condition">
     <sql id="Condition">
         <where>
         <where>
             <if test="receivableId != null and receivableId != ''">
             <if test="receivableId != null and receivableId != ''">
-                AND receivable_id = #{receivableId}::uuid
+                AND t.receivable_id = #{receivableId}::uuid
             </if>
             </if>
             <if test="receivableType != null and receivableType != ''">
             <if test="receivableType != null and receivableType != ''">
-                AND receivable_type = #{receivableType}
+                AND t.receivable_type = #{receivableType}
             </if>
             </if>
             <if test="qtyReceivable != null">
             <if test="qtyReceivable != null">
-                AND qty_receivable = #{qtyReceivable}
+                AND t.qty_receivable = #{qtyReceivable}
             </if>
             </if>
             <if test="amtReceivable != null">
             <if test="amtReceivable != null">
-                AND amt_receivable = #{amtReceivable}
+                AND t.amt_receivable = #{amtReceivable}
             </if>
             </if>
             <if test="remarks != null and remarks != ''">
             <if test="remarks != null and remarks != ''">
-                AND remarks = #{remarks}
+                AND t.remarks = #{remarks}
             </if>
             </if>
             <if test="flgValid != null">
             <if test="flgValid != null">
-                AND flg_valid = #{flgValid}
+                AND t.flg_valid = #{flgValid}
             </if>
             </if>
             <if test="cpId != null">
             <if test="cpId != null">
-                AND cp_id = #{cpId}
+                AND t.cp_id = #{cpId}
             </if>
             </if>
         </where>
         </where>
     </sql>
     </sql>
@@ -56,10 +68,18 @@
     </sql>
     </sql>
 
 
     <!-- 查询表t_mac_other_receivable_item,(条件查询+分页)列表 -->
     <!-- 查询表t_mac_other_receivable_item,(条件查询+分页)列表 -->
-    <select id="selectByCond" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mac_other_receivable_item
+    <select id="selectByCond" resultMap="BaseResultMapResponse">
+        SELECT t.item_id,
+               t.receivable_id,
+               t.receivable_type,
+               sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "receivableTypeName",
+               t.qty_receivable,
+               t.amt_receivable,
+               t.remarks,
+               t.flg_valid,
+               t.cp_id
+        FROM dkic_b.t_mac_other_receivable_item as t
+                 left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.receivable_type
         <include refid="Condition"/>
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
             limit #{end} offset #{start}
@@ -70,7 +90,7 @@
     <select id="countByCond" resultType="Long">
     <select id="countByCond" resultType="Long">
         SELECT
         SELECT
         count(1)
         count(1)
-        FROM t_mac_other_receivable_item
+        FROM dkic_b.t_mac_other_receivable_item
         <include refid="Condition"/>
         <include refid="Condition"/>
     </select>
     </select>
 
 
@@ -78,7 +98,7 @@
     <select id="selectById" resultMap="BaseResultMap">
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
-        FROM t_mac_other_receivable_item
+        FROM dkic_b.t_mac_other_receivable_item
         WHERE item_id = #{itemId}::uuid
         WHERE item_id = #{itemId}::uuid
     </select>
     </select>
 
 
@@ -86,7 +106,7 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
-        FROM t_mac_other_receivable_item
+        FROM dkic_b.t_mac_other_receivable_item
         WHERE item_id = #{id}::uuid
         WHERE item_id = #{id}::uuid
         for update
         for update
     </select>
     </select>
@@ -95,13 +115,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
-        FROM t_mac_other_receivable_item
+        FROM dkic_b.t_mac_other_receivable_item
         <include refid="idsForeach"/>
         <include refid="idsForeach"/>
         for update
         for update
     </select>
     </select>
 
 
     <insert id="insertBatch">
     <insert id="insertBatch">
-        insert into t_mac_other_receivable_item
+        insert into dkic_b.t_mac_other_receivable_item
         (
         (
         <trim suffixOverrides=",">
         <trim suffixOverrides=",">
             receivable_id,
             receivable_id,

+ 17 - 1
src/main/java/com/dk/mdm/mapper/mac/OtherReceivableMapper.java

@@ -2,13 +2,29 @@ package com.dk.mdm.mapper.mac;
 
 
 import com.dk.mdm.model.pojo.mac.OtherReceivable;
 import com.dk.mdm.model.pojo.mac.OtherReceivable;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mac.OtherReceivableQuery;
+import com.dk.mdm.model.response.mac.OtherReceivableResponse;
 import org.springframework.stereotype.Repository;
 import org.springframework.stereotype.Repository;
 
 
+import java.util.List;
+
 /**
 /**
 *  其他收入单 Mapper
 *  其他收入单 Mapper
 */
 */
 @Repository
 @Repository
 public interface OtherReceivableMapper extends BaseMapper<OtherReceivable>{
 public interface OtherReceivableMapper extends BaseMapper<OtherReceivable>{
-	
+    /**
+     * @desc   : 根据条件进行查询
+     * @author : 付斌
+     * @date   : 2024-02-28 10:18
+     */
+    List<OtherReceivableResponse> selectByCond(OtherReceivableQuery otherReceivableQuery);
+
+    /**
+     * @desc   : 根据条件进行查询(数量)
+     * @author : 付斌
+     * @date   : 2024-02-28 10:19
+     */
+    Long countByCond(OtherReceivableQuery otherReceivableQuery);
 }
 }
 
 

+ 95 - 23
src/main/java/com/dk/mdm/mapper/mac/OtherReceivableMapper.xml

@@ -27,50 +27,89 @@
             <result column="cp_id" property="cpId"/>
             <result column="cp_id" property="cpId"/>
     </resultMap>
     </resultMap>
 
 
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.OtherReceivableResponse">
+        <id column="receivable_id" property="receivableId"/>
+            <result column="receivable_no" property="receivableNo"/>
+            <result column="object_type" property="objectType"/>
+            <result column="object_id" property="objectId" typeHandler="UuidTypeHandler"/>
+            <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
+            <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+            <result column="sum_amt_receivable" property="sumAmtReceivable"/>
+            <result column="acc_item_id" property="accItemId" typeHandler="UuidTypeHandler"/>
+            <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">
     <sql id="Condition">
         <where>
         <where>
             <if test="receivableNo != null and receivableNo != ''">
             <if test="receivableNo != null and receivableNo != ''">
-                AND receivable_no = #{receivableNo}
+                AND t.receivable_no LIKE concat('%',my_ex.likequery(#{receivableNo}),'%')
             </if>
             </if>
             <if test="objectType != null and objectType != ''">
             <if test="objectType != null and objectType != ''">
-                AND object_type = #{objectType}
+                AND t.object_type = #{objectType}
             </if>
             </if>
             <if test="objectId != null and objectId != ''">
             <if test="objectId != null and objectId != ''">
-                AND object_id = #{objectId}
+                AND t.object_id = #{objectId}
             </if>
             </if>
             <if test="orgId != null and orgId != ''">
             <if test="orgId != null and orgId != ''">
-                AND org_id = #{orgId}
+                AND t.org_id = #{orgId}
             </if>
             </if>
             <if test="staffId != null and staffId != ''">
             <if test="staffId != null and staffId != ''">
-                AND staff_id = #{staffId}
+                AND t.staff_id = #{staffId}
             </if>
             </if>
             <if test="sumAmtReceivable != null">
             <if test="sumAmtReceivable != null">
-                AND sum_amt_receivable = #{sumAmtReceivable}
+                AND t.sum_amt_receivable = #{sumAmtReceivable}
             </if>
             </if>
             <if test="accItemId != null and accItemId != ''">
             <if test="accItemId != null and accItemId != ''">
-                AND acc_item_id = #{accItemId}
+                AND t.acc_item_id = #{accItemId}
             </if>
             </if>
             <if test="accDate != null">
             <if test="accDate != null">
-                AND acc_date = #{accDate}
+                AND t.acc_date = #{accDate}
             </if>
             </if>
             <if test="remarks != null and remarks != ''">
             <if test="remarks != null and remarks != ''">
-                AND remarks = #{remarks}
+                AND t.remarks = #{remarks}
             </if>
             </if>
             <if test="annexPaths != null and annexPaths != ''">
             <if test="annexPaths != null and annexPaths != ''">
-                AND annex_paths = #{annexPaths}
+                AND t.annex_paths = #{annexPaths}
             </if>
             </if>
             <if test="makeStaff != null and makeStaff != ''">
             <if test="makeStaff != null and makeStaff != ''">
-                AND make_staff = #{makeStaff}
+                AND t.make_staff = #{makeStaff}
             </if>
             </if>
             <if test="makeTime != null">
             <if test="makeTime != null">
-                AND make_time = #{makeTime}
+                AND t.make_time = #{makeTime}
             </if>
             </if>
             <if test="flgValid != null">
             <if test="flgValid != null">
-                AND flg_valid = #{flgValid}
+                AND t.flg_valid = #{flgValid}
             </if>
             </if>
             <if test="cpId != null">
             <if test="cpId != null">
-                AND cp_id = #{cpId}
+                AND t.cp_id = #{cpId}
+            </if>
+            <if test="cusPhone != null and cusPhone != ''">
+                AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
+            </if>
+            <if test="cusName != null and cusName != ''">
+                AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
+            </if>
+            <if test="orgIds != null and orgIds.size() > 0">
+                AND t.org_id  =any(#{orgIds, typeHandler=UuidListTypeHandler})
+            </if>
+            <if test="staffIds != null and staffIds.size() > 0">
+                AND t.staff_id  =any(#{staffIds, 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>
             </if>
         </where>
         </where>
     </sql>
     </sql>
@@ -84,11 +123,38 @@
     </sql>
     </sql>
 
 
     <!-- 查询表t_mac_other_receivable,(条件查询+分页)列表 -->
     <!-- 查询表t_mac_other_receivable,(条件查询+分页)列表 -->
-    <select id="selectByCond" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mac_other_receivable
+    <select id="selectByCond" resultMap="BaseResultMapResponse">
+        SELECT t.receivable_id,
+               t.receivable_no,
+               t.object_type,
+               sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "objectTypeName",
+               t.object_id,
+               tmc.cus_code         as "cusCode",
+               tmc.cus_name         as "cusName",
+               tmc.cus_phone        as "cusPhone",
+               t.org_id,
+               tmo.org_name         as "orgName",
+               t.staff_id,
+               tms.staff_name       as "staffName",
+               t.sum_amt_receivable,
+               t.acc_item_id,
+               t.acc_date,
+               t.remarks,
+               t.annex_paths,
+               t.make_staff,
+               makestaff.staff_name as "makeStaffName",
+               t.make_time,
+               t.flg_valid,
+               t.cp_id
+        FROM dkic_b.t_mac_other_receivable as t
+                 left join dkic_b.t_mst_customer tmc
+                           on tmc.cus_id = t.object_id and t.object_type in ('对象类型-客户')
+                 left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
+                 left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
+                 left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
+                 left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.object_type
         <include refid="Condition"/>
         <include refid="Condition"/>
+        order by t.op_create_time desc
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
             limit #{end} offset #{start}
         </if>
         </if>
@@ -98,7 +164,13 @@
     <select id="countByCond" resultType="Long">
     <select id="countByCond" resultType="Long">
         SELECT
         SELECT
         count(1)
         count(1)
-        FROM t_mac_other_receivable
+        FROM dkic_b.t_mac_other_receivable as t
+                 left join dkic_b.t_mst_customer tmc
+                           on tmc.cus_id = t.object_id and t.object_type in ('对象类型-客户')
+                 left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
+                 left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
+                 left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
+                 left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.object_type
         <include refid="Condition"/>
         <include refid="Condition"/>
     </select>
     </select>
 
 
@@ -106,7 +178,7 @@
     <select id="selectById" resultMap="BaseResultMap">
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
-        FROM t_mac_other_receivable
+        FROM dkic_b.t_mac_other_receivable
         WHERE receivable_id = #{receivableId}::uuid
         WHERE receivable_id = #{receivableId}::uuid
     </select>
     </select>
 
 
@@ -114,7 +186,7 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
-        FROM t_mac_other_receivable
+        FROM dkic_b.t_mac_other_receivable
         WHERE receivable_id = #{id}::uuid
         WHERE receivable_id = #{id}::uuid
         for update
         for update
     </select>
     </select>
@@ -123,13 +195,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
-        FROM t_mac_other_receivable
+        FROM dkic_b.t_mac_other_receivable
         <include refid="idsForeach"/>
         <include refid="idsForeach"/>
         for update
         for update
     </select>
     </select>
 
 
     <insert id="insertBatch">
     <insert id="insertBatch">
-        insert into t_mac_other_receivable
+        insert into dkic_b.t_mac_other_receivable
         (
         (
         <trim suffixOverrides=",">
         <trim suffixOverrides=",">
             receivable_no,
             receivable_no,

+ 25 - 0
src/main/java/com/dk/mdm/model/query/mac/OtherReceivableQuery.java

@@ -21,7 +21,9 @@ import lombok.experimental.Accessors;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.util.List;
 
 
 /**
 /**
  *  其他收入单
  *  其他收入单
@@ -171,6 +173,29 @@ public class OtherReceivableQuery extends PageInfo<OtherReceivableQuery> impleme
     @ApiModelProperty(value = "企业ID")
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
     private Integer cpId;
 
 
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
+
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
+
+    @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;
+
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private List<Boolean> flgValidList;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 3 - 0
src/main/java/com/dk/mdm/model/response/mac/OtherReceivableItemResponse.java

@@ -101,6 +101,9 @@ public class OtherReceivableItemResponse extends PageInfo<OtherReceivableItemRes
     private Integer cpId;
     private Integer cpId;
 
 
 
 
+    @ApiModelProperty(value = "收入类别名称")
+    private String receivableTypeName;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 21 - 0
src/main/java/com/dk/mdm/model/response/mac/OtherReceivableResponse.java

@@ -171,6 +171,27 @@ public class OtherReceivableResponse extends PageInfo<OtherReceivableResponse> i
     @ApiModelProperty(value = "企业ID")
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
     private Integer cpId;
 
 
+    @ApiModelProperty(value = "对象类型")
+    private String objectTypeName;
+
+    @ApiModelProperty(value = "组织名称")
+    private String orgName;
+
+    @ApiModelProperty(value = "员工姓名")
+    private String staffName;
+
+    @ApiModelProperty(value = "客户编码")
+    private String cusCode;
+
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
+
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
+
+    @ApiModelProperty(value = "制单员")
+    private String makeStaffName;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 7 - 0
src/main/java/com/dk/mdm/model/vo/mac/OtherReceivableVO.java

@@ -22,6 +22,7 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.util.List;
 
 
 /**
 /**
  *  其他收入单
  *  其他收入单
@@ -171,6 +172,12 @@ public class OtherReceivableVO extends PageInfo<OtherReceivableVO> implements Se
     @ApiModelProperty(value = "企业ID")
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
     private Integer cpId;
 
 
+    @ApiModelProperty(value = "明细")
+    private List<OtherReceivableItemVO> itemList;
+
+    @ApiModelProperty(value = "删除明细")
+    private List<OtherReceivableItemVO> deleteItemList;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 0 - 75
src/main/java/com/dk/mdm/model/vo/sale/OrderItemVO.java

@@ -210,81 +210,6 @@ public class OrderItemVO extends PageInfo<OrderItemVO> implements Serializable {
     private Integer cpId;
     private Integer cpId;
 
 
 
 
-    /**
-     * 创建时间 (触发器自动处理)
-     */
-    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
-    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @TableField(typeHandler = TimestampTypeHandler.class)
-    private LocalDateTime opCreateTime;
-
-
-    /**
-     * 创建用户 (触发器自动处理)
-     */
-    @Excel(name = "创建用户 (触发器自动处理)")
-    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
-    @TableField(typeHandler = UuidTypeHandler.class)
-    private String opCreateUserId;
-
-
-    /**
-     * 修改时间 (触发器自动处理)
-     */
-    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
-    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @TableField(typeHandler = TimestampTypeHandler.class)
-    private LocalDateTime opUpdateTime;
-
-
-    /**
-     * 修改用户 (触发器自动处理)
-     */
-    @Excel(name = "修改用户 (触发器自动处理)")
-    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
-    @TableField(typeHandler = UuidTypeHandler.class)
-    private String opUpdateUserId;
-
-
-    /**
-     * 数据操作应用 (触发器自动处理)
-     */
-    @Excel(name = "数据操作应用 (触发器自动处理)")
-    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
-    private String opAppCode;
-
-
-    /**
-     * 数据时间戳 (触发器自动处理)
-     */
-    @Excel(name = "数据时间戳 (触发器自动处理)")
-    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @TableField(typeHandler = TimestampTypeHandler.class)
-    private LocalDateTime opTimestamp;
-
-
-    /**
-     * 数据操作数据库用户 (触发器自动处理)
-     */
-    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
-    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
-    private String opDbUser;
-
-
-    /*
-     * 相关属性
-     * @TableField(exist = false)
-     */
-
-    /*
-     * 关联属性 + 查询条件
-     * @TableField(exist = false)
-     */
-
-
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 0 - 74
src/main/java/com/dk/mdm/model/vo/sale/OrderVO.java

@@ -345,70 +345,6 @@ public class OrderVO extends PageInfo<OrderVO> implements Serializable {
     @ApiModelProperty(value = "企业ID")
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
     private Integer cpId;
 
 
-
-    /**
-     * 创建时间 (触发器自动处理)
-     */
-    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
-    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @TableField(typeHandler = TimestampTypeHandler.class)
-    private LocalDateTime opCreateTime;
-
-
-    /**
-     * 创建用户 (触发器自动处理)
-     */
-    @Excel(name = "创建用户 (触发器自动处理)")
-    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
-    @TableField(typeHandler = UuidTypeHandler.class)
-    private String opCreateUserId;
-
-
-    /**
-     * 修改时间 (触发器自动处理)
-     */
-    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
-    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @TableField(typeHandler = TimestampTypeHandler.class)
-    private LocalDateTime opUpdateTime;
-
-
-    /**
-     * 修改用户 (触发器自动处理)
-     */
-    @Excel(name = "修改用户 (触发器自动处理)")
-    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
-    @TableField(typeHandler = UuidTypeHandler.class)
-    private String opUpdateUserId;
-
-
-    /**
-     * 数据操作应用 (触发器自动处理)
-     */
-    @Excel(name = "数据操作应用 (触发器自动处理)")
-    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
-    private String opAppCode;
-
-
-    /**
-     * 数据时间戳 (触发器自动处理)
-     */
-    @Excel(name = "数据时间戳 (触发器自动处理)")
-    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @TableField(typeHandler = TimestampTypeHandler.class)
-    private LocalDateTime opTimestamp;
-
-
-    /**
-     * 数据操作数据库用户 (触发器自动处理)
-     */
-    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
-    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
-    private String opDbUser;
-
     @ApiModelProperty(value = "明细")
     @ApiModelProperty(value = "明细")
     private List<OrderItemVO> itemList;
     private List<OrderItemVO> itemList;
 
 
@@ -433,16 +369,6 @@ public class OrderVO extends PageInfo<OrderVO> implements Serializable {
     @ApiModelProperty(value = "客户来源 (【数据字典】)")
     @ApiModelProperty(value = "客户来源 (【数据字典】)")
     private String cusFrom;
     private String cusFrom;
 
 
-    /*
-     * 相关属性
-     * @TableField(exist = false)
-     */
-
-    /*
-     * 关联属性 + 查询条件
-     * @TableField(exist = false)
-     */
-
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 

+ 133 - 1
src/main/java/com/dk/mdm/service/mac/OtherReceivableService.java

@@ -1,13 +1,32 @@
 package com.dk.mdm.service.mac;
 package com.dk.mdm.service.mac;
 
 
-import com.dk.mdm.model.pojo.mac.OtherReceivable;
+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.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.mdm.infrastructure.convert.mac.OtherReceivableConvert;
+import com.dk.mdm.infrastructure.convert.mac.OtherReceivableItemConvert;
+import com.dk.mdm.mapper.mac.OtherReceivableItemMapper;
+import com.dk.mdm.model.pojo.mac.*;
 import com.dk.mdm.mapper.mac.OtherReceivableMapper;
 import com.dk.mdm.mapper.mac.OtherReceivableMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mac.OtherReceivableItemQuery;
+import com.dk.mdm.model.query.mac.OtherReceivableQuery;
+import com.dk.mdm.model.response.mac.OtherReceivableItemResponse;
+import com.dk.mdm.model.response.mac.OtherReceivableResponse;
+import com.dk.mdm.model.vo.mac.OtherReceivableItemVO;
+import com.dk.mdm.model.vo.mac.OtherReceivableVO;
+import com.dk.mdm.service.common.CommonService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import java.util.*;
+import java.util.stream.Collectors;
+
 @Service
 @Service
 @Transactional
 @Transactional
 public class OtherReceivableService extends BaseService<OtherReceivable> {
 public class OtherReceivableService extends BaseService<OtherReceivable> {
@@ -25,4 +44,117 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
 	@Autowired
 	@Autowired
 	private OtherReceivableMapper otherReceivableMapper;
 	private OtherReceivableMapper otherReceivableMapper;
 
 
+	@Autowired
+	private OtherReceivableItemMapper otherReceivableItemMapper;
+
+	@Autowired
+	private OtherReceivableItemService otherReceivableItemService;
+
+	@Autowired
+	private CommonService commonService;
+
+	@Autowired
+	private OtherReceivableConvert otherReceivableConvert;
+
+	@Autowired
+	private OtherReceivableItemConvert otherReceivableItemConvert;
+
+	/**
+	 * @desc : 条件查询
+	 * @author : 付斌
+	 * @date : 2023/1/9 10:40
+	 */
+	@Pagination
+	public ResponseResultVO<PageList<OtherReceivableResponse>> selectByCond(OtherReceivableQuery otherReceivableQuery) {
+		return super.mergeListWithCount(otherReceivableQuery, otherReceivableMapper.selectByCond(otherReceivableQuery),
+				otherReceivableMapper.countByCond(otherReceivableQuery));
+	}
+
+	/**
+	 * @desc : 查询订单明细(货物、收款、附件)
+	 * @author : 付斌
+	 * @date : 2024-02-28 13:25
+	 */
+	@Pagination
+	public ResponseResultVO<Map<String, Object>> selectOtherReceivableInfoById(String id) {
+		Map<String, Object> result = new HashMap<>();
+		// 商品明细
+		List<OtherReceivableItemResponse> otherReceivableItem = otherReceivableItemMapper.selectByCond(new OtherReceivableItemQuery().setReceivableId(id));
+		result.put("otherReceivableItem", otherReceivableItem);
+
+		// 附件
+		return ResponseResultUtil.success(result);
+	}
+
+	/**
+	 * @desc : 新建方法
+	 * @author : 付斌
+	 * @date : 2023/1/9 10:49
+	 */
+	@Transactional(
+			rollbackFor = {Exception.class}
+	)
+	public ResponseResultVO<?> insert(OtherReceivableVO otherReceivableVO) {
+
+		// 获取单号
+		Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.ORDER.getName(), false);
+		otherReceivableVO.setReceivableId(codeMap.get("outId").toString()).setReceivableNo(codeMap.get("outNote").toString())
+				.setObjectType(Constant.ObjectType.CUS.getName());
+		// 转化实体
+		OtherReceivable otherReceivable = otherReceivableConvert.convertToPo(otherReceivableVO);
+		// 订单总单保存
+		super.insert(otherReceivable);
+
+		// 订单明细保存
+		if (otherReceivableVO.getItemList() != null && otherReceivableVO.getItemList().size() > 0) {
+			for (OtherReceivableItemVO otherReceivableItemVO : otherReceivableVO.getItemList()) {
+				OtherReceivableItem otherReceivableItem = otherReceivableItemConvert.convertToPo(otherReceivableItemVO);
+				otherReceivableItem.setReceivableId(otherReceivable.getReceivableId()).setCpId(otherReceivable.getCpId());
+				otherReceivableItemMapper.insert(otherReceivableItem);
+			}
+		}
+		
+		return ResponseResultUtil.success();
+	}
+
+	/**
+	 * @desc : 编辑方法
+	 * @author : 付斌
+	 * @date : 2023/1/9 10:49
+	 */
+	@Transactional(
+			rollbackFor = {Exception.class}
+	)
+	public ResponseResultVO<?> update(OtherReceivableVO otherReceivableVO) {
+		// 明细实体(避免并发,需要再查一遍)
+		OtherReceivableItem otherReceivableItemForUpdate;
+		// 转化实体
+		OtherReceivable otherReceivable = otherReceivableConvert.convertToPo(otherReceivableVO);
+		//删除的
+		List<OtherReceivableItemVO> deleteOtherReceivableItemVOList = otherReceivableVO.getDeleteItemList().stream().filter(it -> it.getItemId() != null).collect(Collectors.toList());
+		if (deleteOtherReceivableItemVOList.size() > 0) {
+			for (OtherReceivableItemVO otherReceivableItemVO : deleteOtherReceivableItemVOList) {
+				otherReceivableItemMapper.deleteById(otherReceivableItemVO.getItemId());
+			}
+		}
+		// 新增的
+		List<OtherReceivableItemVO> insertOtherReceivableItemVOList = otherReceivableVO.getItemList().stream().filter(it -> it.getItemId() == null).collect(Collectors.toList());
+		for (OtherReceivableItemVO otherReceivableItemVO : insertOtherReceivableItemVOList) {
+			OtherReceivableItem otherReceivableItem = otherReceivableItemConvert.convertToPo(otherReceivableItemVO);
+			otherReceivableItem.setReceivableId(otherReceivable.getReceivableId()).setCpId(otherReceivable.getCpId());
+			otherReceivableItemMapper.insert(otherReceivableItem);
+		}
+		// 编辑的
+		List<OtherReceivableItemVO> editOtherReceivableItemVOList = otherReceivableVO.getItemList().stream().filter(it -> it.getItemId() != null).collect(Collectors.toList());
+		for (OtherReceivableItemVO otherReceivableItemVO : editOtherReceivableItemVOList) {
+			otherReceivableItemForUpdate = otherReceivableItemMapper.selectByIdForUpdate(otherReceivableItemVO.getItemId());
+			OtherReceivableItem otherReceivableItem = otherReceivableItemConvert.convertToPo(otherReceivableItemVO);
+			otherReceivableItemService.updateByUuid(otherReceivableItem);
+		}
+
+
+		return ResponseResultUtil.success(super.update(otherReceivable, new UpdateWrapper<OtherReceivable>().lambda().eq(OtherReceivable::getReceivableId,
+				UUID.fromString(otherReceivable.getReceivableId()))));
+	}
+
 }
 }