fubin před 2 roky
rodič
revize
1a63ad8c00

+ 61 - 4
src/main/java/com/dk/mdm/controller/mac/RecPayController.java

@@ -1,17 +1,23 @@
 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.RecPay;
-import com.dk.common.controller.BaseController;
 import com.dk.common.service.BaseService;
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.dk.mdm.model.query.mac.RecPayQuery;
+import com.dk.mdm.model.response.mac.RecPayResponse;
+import com.dk.mdm.model.vo.mac.RecPayVO;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
 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.RecPayService;
 
+import java.util.Map;
+
 @Api(tags = "收付款单API接口")
 @RestController
-@RequestMapping("/recPay")
+@RequestMapping("/mac/recPay")
 public class RecPayController{
 
     public BaseService<RecPay> getService() {
@@ -20,5 +26,56 @@ public class RecPayController{
 
     @Autowired
     private RecPayService recPayService;
+    /**
+     * @desc : 条件查询
+     * @author : 付斌
+     * @date : 2023/1/9 10:36
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<RecPayResponse>> selectByCond(@RequestBody RecPayQuery recPayQuery) {
+        return recPayService.selectByCond(recPayQuery);
+    }
 
+    /**
+     * @desc :查询收款明细(货物、收款、附件)
+     * @author : 付斌
+     * @date : 2024-02-28 13:24
+     */
+    @PostMapping({"select_rp_info_by_id/{id}"})
+    public ResponseResultVO<Map<String, Object>> selectRpInfoById(@PathVariable String id) {
+        return recPayService.selectRpInfoById(id);
+    }
+
+    /**
+     * @desc : 通过ID查询
+     * @author : 付斌
+     * @date : 2023/1/9 10:41
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO selectById(@PathVariable String id) {
+        return recPayService.selectById(id);
+    }
+
+    /**
+     * @desc : 新建
+     * @author : 付斌
+     * @date : 2023/1/9 10:48
+     */
+    @ApiOperation(value = "新建", notes = "新建")
+    @PostMapping({"insert"})
+    public ResponseResultVO<?> insert(@RequestBody RecPayVO recPayVO) {
+        return recPayService.insert(recPayVO);
+    }
+
+    /**
+     * @desc : 编辑
+     * @author : 付斌
+     * @date : 2023/1/9 10:49
+     */
+    @ApiOperation(value = "编辑", notes = "编辑")
+    @PostMapping({"update"})
+    public ResponseResultVO<?> update(@RequestBody RecPayVO recPayVO) {
+        return recPayService.update(recPayVO);
+    }
 }

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

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

+ 21 - 0
src/main/java/com/dk/mdm/infrastructure/convert/mac/RecPayItemConvert.java

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

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

@@ -2,13 +2,22 @@ package com.dk.mdm.mapper.mac;
 
 import com.dk.mdm.model.pojo.mac.RecPayItem;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mac.RecPayItemQuery;
+import com.dk.mdm.model.response.mac.RecPayItemResponse;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
 *  收付款单明细 Mapper
 */
 @Repository
 public interface RecPayItemMapper extends BaseMapper<RecPayItem>{
-	
+    /**
+     * @desc   : 根据条件进行查询
+     * @author : 付斌
+     * @date   : 2024-03-19 16:13
+     */
+    List<RecPayItemResponse> selectByCond(RecPayItemQuery recPayItemQuery);
 }
 

+ 26 - 35
src/main/java/com/dk/mdm/mapper/mac/RecPayItemMapper.xml

@@ -56,55 +56,34 @@
     <sql id="Condition">
         <where>
             <if test="rpId != null and rpId != ''">
-                AND rp_id = #{rpId}
+                AND t.rp_id = #{rpId}
             </if>
             <if test="macId != null and macId != ''">
-                AND mac_id = #{macId}
+                AND t.mac_id = #{macId}
             </if>
             <if test="amtRec != null">
-                AND amt_rec = #{amtRec}
+                AND t.amt_rec = #{amtRec}
             </if>
             <if test="amtPay != null">
-                AND amt_pay = #{amtPay}
+                AND t.amt_pay = #{amtPay}
             </if>
             <if test="accDate != null">
-                AND acc_date = #{accDate}
+                AND t.acc_date = #{accDate}
             </if>
             <if test="remarks != null and remarks != ''">
-                AND remarks = #{remarks}
+                AND t.remarks = #{remarks}
             </if>
             <if test="makeStaff != null and makeStaff != ''">
-                AND make_staff = #{makeStaff}
+                AND t.make_staff = #{makeStaff}
             </if>
             <if test="makeTime != null">
-                AND make_time = #{makeTime}
+                AND t.make_time = #{makeTime}
             </if>
             <if test="flgValid != null">
-                AND flg_valid = #{flgValid}
+                AND t.flg_valid = #{flgValid}
             </if>
             <if test="cpId != null">
-                AND cp_id = #{cpId}
-            </if>
-            <if test="opCreateTime != null">
-                AND op_create_time = #{opCreateTime}
-            </if>
-            <if test="opCreateUserId != null and opCreateUserId != ''">
-                AND op_create_user_id = #{opCreateUserId}
-            </if>
-            <if test="opUpdateTime != null">
-                AND 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}
-            </if>
-            <if test="opTimestamp != null">
-                AND op_timestamp = #{opTimestamp}
-            </if>
-            <if test="opDbUser != null and opDbUser != ''">
-                AND op_db_user = #{opDbUser}
+                AND t.cp_id = #{cpId}
             </if>
         </where>
     </sql>
@@ -119,9 +98,20 @@
 
     <!-- 查询表t_mac_rec_pay_item,(条件查询+分页)列表 -->
     <select id="selectByCond" resultMap="BaseResultMapResponse">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mac_rec_pay_item
+        SELECT t.item_id,
+               t.rp_id,
+               t.mac_id,
+               tmma.mac_name as "macName",
+               t.amt_rec,
+               t.amt_pay,
+               t.acc_date,
+               t.remarks,
+               t.make_staff,
+               t.make_time,
+               t.flg_valid,
+               t.cp_id
+        FROM t_mac_rec_pay_item as t
+                 inner join dkic_b.t_mst_money_account tmma on tmma.mac_id = t.mac_id
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -132,7 +122,8 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_mac_rec_pay_item
+        FROM t_mac_rec_pay_item as t
+                 inner join dkic_b.t_mst_money_account tmma on tmma.mac_id = t.mac_id
         <include refid="Condition"/>
     </select>
 

+ 24 - 1
src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.java

@@ -2,13 +2,36 @@ package com.dk.mdm.mapper.mac;
 
 import com.dk.mdm.model.pojo.mac.RecPay;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mac.RecPayQuery;
+import com.dk.mdm.model.response.mac.RecPayResponse;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
 *  收付款单 Mapper
 */
 @Repository
 public interface RecPayMapper extends BaseMapper<RecPay>{
-	
+    /**
+     * @desc   : 根据条件进行查询
+     * @author : 付斌
+     * @date   : 2024-02-28 10:18
+     */
+    List<RecPayResponse> selectByCond(RecPayQuery recPayQuery);
+
+    /**
+     * @desc   : 根据条件进行查询(数量)
+     * @author : 付斌
+     * @date   : 2024-02-28 10:19
+     */
+    Long countByCond(RecPayQuery recPayQuery);
+
+    /**
+     * @desc   : 根据Id进行查询
+     * @author : 付斌
+     * @date   : 2024-03-03 9:25
+     */
+    RecPayResponse selectById(String id);
 }
 

+ 67 - 39
src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.xml

@@ -72,79 +72,74 @@
     <sql id="Condition">
         <where>
             <if test="rpNo != null and rpNo != ''">
-                AND rp_no = #{rpNo}
+                AND t.rp_no LIKE concat('%',my_ex.likequery(#{rpNo}),'%')
             </if>
             <if test="rpType != null and rpType != ''">
-                AND rp_type = #{rpType}
+                AND t.rp_type = #{rpType}
             </if>
             <if test="objectId != null and objectId != ''">
-                AND object_id = #{objectId}
+                AND t.object_id = #{objectId}
             </if>
             <if test="orgId != null and orgId != ''">
-                AND org_id = #{orgId}
+                AND t.org_id = #{orgId}
             </if>
             <if test="staffId != null and staffId != ''">
-                AND staff_id = #{staffId}
+                AND t.staff_id = #{staffId}
             </if>
             <if test="sumAmtRec != null">
-                AND sum_amt_rec = #{sumAmtRec}
+                AND t.sum_amt_rec = #{sumAmtRec}
             </if>
             <if test="sumAmtPay != null">
-                AND sum_amt_pay = #{sumAmtPay}
+                AND t.sum_amt_pay = #{sumAmtPay}
             </if>
             <if test="accDate != null">
-                AND acc_date = #{accDate}
+                AND t.acc_date = #{accDate}
             </if>
             <if test="remarks != null and remarks != ''">
-                AND remarks = #{remarks}
+                AND t.remarks = #{remarks}
             </if>
             <if test="annexPaths != null and annexPaths != ''">
-                AND annex_paths = #{annexPaths}
+                AND t.annex_paths = #{annexPaths}
             </if>
             <if test="biznisType != null and biznisType != ''">
-                AND biznis_type = #{biznisType}
+                AND t.biznis_type = #{biznisType}
             </if>
             <if test="biznisId != null and biznisId != ''">
-                AND biznis_id = #{biznisId}
+                AND t.biznis_id = #{biznisId}
             </if>
             <if test="biznisNo != null and biznisNo != ''">
-                AND biznis_no = #{biznisNo}
+                AND t.biznis_no = #{biznisNo}
             </if>
             <if test="flgLock != null">
-                AND flg_lock = #{flgLock}
+                AND t.flg_lock = #{flgLock}
             </if>
             <if test="makeStaff != null and makeStaff != ''">
-                AND make_staff = #{makeStaff}
+                AND t.make_staff = #{makeStaff}
             </if>
             <if test="makeTime != null">
-                AND make_time = #{makeTime}
-            </if>
-            <if test="flgValid != null">
-                AND flg_valid = #{flgValid}
+                AND t.make_time = #{makeTime}
             </if>
             <if test="cpId != null">
-                AND cp_id = #{cpId}
-            </if>
-            <if test="opCreateTime != null">
-                AND op_create_time = #{opCreateTime}
+                AND t.cp_id = #{cpId}
             </if>
-            <if test="opCreateUserId != null and opCreateUserId != ''">
-                AND op_create_user_id = #{opCreateUserId}
+            <if test="cusPhone != null and cusPhone != ''">
+                AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
             </if>
-            <if test="opUpdateTime != null">
-                AND op_update_time = #{opUpdateTime}
+            <if test="cusName != null and cusName != ''">
+                AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
             </if>
-            <if test="opUpdateUserId != null and opUpdateUserId != ''">
-                AND op_update_user_id = #{opUpdateUserId}
+            <if test="orgIdList != null and orgIdList.size() > 0">
+                AND t.org_id  =any(#{orgIdList, typeHandler=uuidListTypeHandler})
             </if>
-            <if test="opAppCode != null and opAppCode != ''">
-                AND op_app_code = #{opAppCode}
+            <if test="staffIdList != null and staffIdList.size() > 0">
+                AND t.staff_id  =any(#{staffIdList, typeHandler=uuidListTypeHandler})
             </if>
-            <if test="opTimestamp != null">
-                AND op_timestamp = #{opTimestamp}
+            <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="opDbUser != null and opDbUser != ''">
-                AND op_db_user = #{opDbUser}
+            <if test="flgValidList != null and flgValidList.size()>0">
+                AND t.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
             </if>
         </where>
     </sql>
@@ -159,9 +154,40 @@
 
     <!-- 查询表t_mac_rec_pay,(条件查询+分页)列表 -->
     <select id="selectByCond" resultMap="BaseResultMapResponse">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM t_mac_rec_pay
+        select t.rp_id,
+               t.rp_no,
+               t.rp_type,
+               sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
+               t.object_id,
+               tmc.cus_code                                      as "cusCode",
+               tmc.cus_name                                      as "cusName",
+               tmc.cus_phone                                     as "cusPhone",
+               tmc.address_full                                  as "addressFull",
+               t.org_id,
+               tmo.org_name                                      as "orgName",
+               t.staff_id,
+               tms.staff_name                                    as "staffName",
+               t.sum_amt_rec,
+               t.sum_amt_pay,
+               t.acc_date,
+               t.remarks,
+               t.annex_paths,
+               t.biznis_type,
+               t.biznis_id,
+               t.biznis_no,
+               t.flg_lock,
+               t.make_staff,
+               makestaff.staff_name                              as "makeStaffName",
+               t.make_time,
+               t.flg_valid,
+               t.cp_id
+        from dkic_b.t_mac_rec_pay as t
+                 left join dkic_b.t_mst_customer tmc
+                           on tmc.cus_id = t.object_id and t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
+                 left join sys.t_data_kind as tdk1 on t.rp_type = tdk1.kind_code
+                 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
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -172,7 +198,9 @@
     <select id="countByCond" resultType="Long">
         SELECT
         count(1)
-        FROM t_mac_rec_pay
+        FROM dkic_b.t_mac_rec_pay as t
+         LEFT JOIN dkic_b.t_mst_customer tmc
+                   ON tmc.cus_id = t.object_id and t.rp_type = '收付款类型-收款'
         <include refid="Condition"/>
     </select>
 

+ 20 - 8
src/main/java/com/dk/mdm/model/response/mac/RecPayResponse.java

@@ -268,17 +268,29 @@ public class RecPayResponse extends PageInfo<RecPayResponse> implements Serializ
     @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
     private String opDbUser;
 
+    @ApiModelProperty(value = "收付款类型")
+    private String rpTypeName;
 
-    /*
-     * 相关属性
-     * @TableField(exist = false)
-     */
+    @ApiModelProperty(value = "组织名称")
+    private String orgName;
 
-    /*
-     * 关联属性 + 查询条件
-     * @TableField(exist = false)
-     */
+    @ApiModelProperty(value = "员工姓名")
+    private String staffName;
+
+    @ApiModelProperty(value = "客户编码")
+    private String cusCode;
 
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
+
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
+
+    @ApiModelProperty(value = "详细地址")
+    private String addressFull;
+
+    @ApiModelProperty(value = "制单员")
+    private String makeStaffName;
 
     private static final long serialVersionUID = 1L;
 

+ 93 - 0
src/main/java/com/dk/mdm/service/mac/RecPayService.java

@@ -1,13 +1,37 @@
 package com.dk.mdm.service.mac;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+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.RecPayConvert;
+import com.dk.mdm.mapper.mac.RecPayItemMapper;
 import com.dk.mdm.model.pojo.mac.RecPay;
 import com.dk.mdm.mapper.mac.RecPayMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.pojo.mac.RecPayItem;
+import com.dk.mdm.model.query.mac.RecPayItemQuery;
+import com.dk.mdm.model.query.mac.RecPayQuery;
+import com.dk.mdm.model.query.sale.OrderItemQuery;
+import com.dk.mdm.model.response.mac.RecPayItemResponse;
+import com.dk.mdm.model.response.mac.RecPayResponse;
+import com.dk.mdm.model.response.sale.OrderItemResponse;
+import com.dk.mdm.model.vo.mac.RecPayVO;
+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 java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
 @Service
 @Transactional
 public class RecPayService extends BaseService<RecPay> {
@@ -25,4 +49,73 @@ public class RecPayService extends BaseService<RecPay> {
 	@Autowired
 	private RecPayMapper recPayMapper;
 
+	@Autowired
+	private RecPayItemMapper recPayItemMapper;
+
+//	@Autowired
+//	private AccountService accountService;
+//
+//	@Autowired
+//	private AccountMapper accountMapper;
+
+	@Autowired
+	private CommonService commonService;
+
+	@Autowired
+	private RecPayConvert recPayConvert;
+	
+	/**
+	 * @desc : 条件查询
+	 * @author : 付斌
+	 * @date : 2023/1/9 10:40
+	 */
+	@Pagination
+	public ResponseResultVO<PageList<RecPayResponse>> selectByCond(RecPayQuery recPayQuery) {
+		return super.mergeListWithCount(recPayQuery, recPayMapper.selectByCond(recPayQuery),
+				recPayMapper.countByCond(recPayQuery));
+	}
+
+	/**
+	 * @desc : 查询收款明细
+	 * @author : 付斌
+	 * @date : 2024-02-28 13:25
+	 */
+	@Pagination
+	public ResponseResultVO<Map<String, Object>> selectRpInfoById(String id) {
+		Map<String, Object> result = new HashMap<>();
+		// 收款明细
+		List<RecPayItemResponse> recPayItem = recPayItemMapper.selectByCond(new RecPayItemQuery().setRpId(id));
+		result.put("recPayItem", recPayItem);
+
+		// 附件
+		return ResponseResultUtil.success(result);
+	}
+
+	/**
+	 * @desc : 新建方法
+	 * @author : 付斌
+	 * @date : 2023/1/9 10:49
+	 */
+	@Transactional(
+			rollbackFor = {Exception.class}
+	)
+	public ResponseResultVO<?> insert(RecPayVO recPayVO) {
+
+
+		return ResponseResultUtil.success();
+	}
+
+	/**
+	 * @desc : 编辑方法
+	 * @author : 付斌
+	 * @date : 2023/1/9 10:49
+	 */
+	@Transactional(
+			rollbackFor = {Exception.class}
+	)
+	public ResponseResultVO<?> update(RecPayVO recPayVO) {
+		RecPay recPay = recPayConvert.convertToPo(recPayVO);
+		return ResponseResultUtil.success(super.update(recPay, new UpdateWrapper<RecPay>().lambda().eq(RecPay::getRpId,
+				UUID.fromString(recPay.getRpId()))));
+	}
 }