ソースを参照

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

于继渤 2 年 前
コミット
bf976933e6

+ 13 - 4
src/main/java/com/dk/mdm/controller/mac/AccountController.java

@@ -6,11 +6,8 @@ import com.dk.common.controller.BaseController;
 import com.dk.common.service.BaseService;
 import com.dk.mdm.model.query.mac.AccountItemQuery;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
+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.AccountService;
 
@@ -29,6 +26,18 @@ public class AccountController extends BaseController<Account> {
 
 
     /**
+     * @desc : 查看来源单据,总单加明细
+     * @author : 姜永辉
+     * @date : 2024/3/6 10:36
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO selectById(@PathVariable String id) {
+        return accountService.selectById(id);
+    }
+
+
+
+    /**
      * @desc : 查询应收账款明细
      * @author : 付斌
      * @date : 2023/1/9 10:36

+ 6 - 1
src/main/java/com/dk/mdm/mapper/ivt/IntoReturnItemMapper.xml

@@ -216,9 +216,14 @@
         tmgs.sku_code AS sku_code,
         tmgs.sku_name AS sku_name,
         tmgs.sku_model AS sku_model,
-        tmgs.sku_images AS sku_images
+        tmgs.sku_images AS sku_images,
+        tpii.into_qty as "intoQty",
+        tpii.into_amt as "intoAmt",
+        tpii.return_qty as "returnQty",
+        tpii.return_amt as "returnAmt"
         FROM dkic_b.t_psi_into_return_item  tpiri
         left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = tpiri.sku_id
+        left join dkic_b.t_psi_inbound_item tpii on tpiri.into_item_id = tpii.item_id
         <include refid="Condition_Join"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}

+ 3 - 3
src/main/java/com/dk/mdm/mapper/mac/AccountItemMapper.java

@@ -15,14 +15,14 @@ import java.util.Map;
 @Repository
 public interface AccountItemMapper extends BaseMapper<AccountItem>{
     /**
-     * @desc : 根据条件进行查询
+     * @desc : 查询应收账款明细
      * @author : 付斌
      * @date : 2024-02-28 10:18
      */
-    List<AccountItemResponse> selectByCond(AccountItemQuery accountItemQuery);
+    List<AccountItemResponse> getReceivableAccountItem(AccountItemQuery accountItemQuery);
 
     /**
-     * @desc : 根据条件进行查询
+     * @desc : 查询应付账款明细
      * @author : 付斌
      * @date : 2024-02-28 10:18
      */

+ 48 - 31
src/main/java/com/dk/mdm/mapper/mac/AccountItemMapper.xml

@@ -64,13 +64,13 @@
                 AND t.acc_item_type = #{accItemType}
             </if>
             <if test="objectId != null and objectId != ''">
-                AND t.object_id = #{objectId}
+                AND t.object_id = #{objectId}::uuid
             </if>
             <if test="orgId != null and orgId != ''">
-                AND t.org_id = #{orgId}
+                AND t.org_id = #{orgId}::uuid
             </if>
             <if test="staffId != null and staffId != ''">
-                AND t.staff_id = #{staffId}
+                AND t.staff_id = #{staffId}::uuid
             </if>
             <if test="biznisType != null and biznisType != ''">
                 AND t.biznis_type = #{biznisType}
@@ -130,24 +130,44 @@
         </foreach>
     </sql>
 
-    <!-- 查询表t_mac_account_item,(条件查询+分页)列表 -->
-    <select id="getPayableAccountItem" resultMap="BaseResultMapResponse">
+    <!-- 根据主键查询表t_mac_account_item的一行数据 -->
+    <select id="selectByCond" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM dkic_b.t_mac_account_item as t
+        where 1 = 1
+        <include refid="Condition"/>
+    </select>
+
+    <!-- 查询表t_mac_account_item,(条件查询)个数 -->
+    <select id="countByCond" resultType="Long">
+        SELECT
+        count(1)
+        FROM dkic_b.t_mac_account_item as t
+        where 1 = 1
+        <include refid="Condition"/>
+    </select>
+
+
+    <!-- 查询应收账款明细 -->
+    <select id="getReceivableAccountItem" resultMap="BaseResultMapResponse">
         SELECT t.item_id,
                t.acc_item_type,
                t.object_id,
-               tms.sup_code       as "supCode",
-               tms.sup_name       as "supName",
-               tms.contact_phone  as "contactPhone",
-               tms.return_address as "returnAddress",
+               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",
+               tmo.org_name                                      as "orgName",
                t.staff_id,
-               tms.staff_name     as "staffName",
+               tms.staff_name                                    as "staffName",
                t.biznis_type,
                t.biznis_id,
                t.biznis_no,
                t.acc_date,
                t.rec_status,
+               sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "recStatusName",
                t.amt_rec,
                t.amt_pay,
                t.amt_should,
@@ -160,35 +180,38 @@
                t.flg_valid,
                t.cp_id
         FROM dkic_b.t_mac_account_item as t
-                 left join dkic_b.t_mst_supplier tms on tms.sup_id = t.object_id
+                 left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
                  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 sys.t_data_kind as tdk1 on t.rec_status = tdk1.kind_code
         where t.flg_valid
-          and t.acc_item_type = '账款类型-应付'
+          and t.acc_item_type = '账款类型-应收'
+          and t.amt_residue > 0
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>
     </select>
 
-    <!-- 查询表t_mac_account_item,(条件查询+分页)列表 -->
-    <select id="selectByCond" resultMap="BaseResultMapResponse">
+    <!-- 查询应付账款明细 -->
+    <select id="getPayableAccountItem" resultMap="BaseResultMapResponse">
         SELECT t.item_id,
                t.acc_item_type,
                t.object_id,
-               tmc.cus_code     as "cusCode",
-               tmc.cus_name     as "cusName",
-               tmc.cus_phone    as "cusPhone",
-               tmc.address_full as "addressFull",
+               tms.sup_code       as "supCode",
+               tms.sup_name       as "supName",
+               tms.contact_phone  as "contactPhone",
+               tms.return_address as "returnAddress",
                t.org_id,
-               tmo.org_name     as "orgName",
+               tmo.org_name       as "orgName",
                t.staff_id,
-               tms.staff_name   as "staffName",
+               tms.staff_name     as "staffName",
                t.biznis_type,
                t.biznis_id,
                t.biznis_no,
                t.acc_date,
                t.rec_status,
+               sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "recStatusName",
                t.amt_rec,
                t.amt_pay,
                t.amt_should,
@@ -201,25 +224,19 @@
                t.flg_valid,
                t.cp_id
         FROM dkic_b.t_mac_account_item as t
-                 left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
+                 left join dkic_b.t_mst_supplier tms on tms.sup_id = t.object_id
                  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 sys.t_data_kind as tdk1 on t.rec_status = tdk1.kind_code
         where t.flg_valid
-          and t.acc_item_type = '账款类型-应收'
+          and t.acc_item_type = '账款类型-应付'
+          and t.amt_residue > 0
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>
     </select>
 
-    <!-- 查询表t_mac_account_item,(条件查询)个数 -->
-    <select id="countByCond" resultType="Long">
-        SELECT
-        count(1)
-        FROM dkic_b.t_mac_account_item
-        where 1=1
-        <include refid="Condition"/>
-    </select>
 
     <!-- 根据主键查询表t_mac_account_item的一行数据 -->
     <select id="selectById" resultMap="BaseResultMap">

+ 9 - 1
src/main/java/com/dk/mdm/mapper/mac/AccountMapper.java

@@ -2,6 +2,9 @@ package com.dk.mdm.mapper.mac;
 
 import com.dk.mdm.model.pojo.mac.Account;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.response.ivt.InboundResponse;
+import com.dk.mdm.model.response.mac.AccountResponse;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -9,6 +12,11 @@ import org.springframework.stereotype.Repository;
 */
 @Repository
 public interface AccountMapper extends BaseMapper<Account>{
-	
+    /**
+     * @desc   : 根据id查询
+     * @date   : 2024/3/9 9:14
+     * @author :  姜永辉
+     */
+    AccountResponse selectById(@Param("intoId") String intoId);
 }
 

+ 2 - 0
src/main/java/com/dk/mdm/model/pojo/mac/Account.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.dk.mdm.model.response.mac.AccountItemResponse;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.AllArgsConstructor;
@@ -199,6 +200,7 @@ public class Account extends PageInfo<Account> implements Serializable {
     private Integer cpId;
 
 
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 30 - 0
src/main/java/com/dk/mdm/model/response/ivt/IntoReturnItemResponse.java

@@ -248,6 +248,36 @@ public class IntoReturnItemResponse  {
     @ApiModelProperty(value = "仓库名称")
     private String whName;
 
+    /**
+     * 已入库数量
+     */
+    @Excel(name = "已入库数量")
+    @ApiModelProperty(value = "已入库数量")
+    private BigDecimal intoQty;
+
+
+    /**
+     * 已入库金额
+     */
+    @Excel(name = "已入库金额")
+    @ApiModelProperty(value = "已入库金额")
+    private BigDecimal intoAmt;
+
+    /**
+     * 已入库退货数量
+     */
+    @Excel(name = "已入库退货数量")
+    @ApiModelProperty(value = "已入库退货数量")
+    private BigDecimal returnQty;
+
+
+    /**
+     * 已入库退货金额
+     */
+    @Excel(name = "已入库退货金额")
+    @ApiModelProperty(value = "已入库退货金额")
+    private BigDecimal returnAmt;
+
 
     private static final long serialVersionUID = 1L;
 

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

@@ -233,6 +233,9 @@ public class AccountItemResponse extends PageInfo<AccountItemResponse> implement
     @ApiModelProperty(value = "详细地址")
     private String addressFull;
 
+    @ApiModelProperty(value = "账务状态")
+    private String recStatusName;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 216 - 0
src/main/java/com/dk/mdm/model/response/mac/AccountResponse.java

@@ -0,0 +1,216 @@
+package com.dk.mdm.model.response.mac;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+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.util.List;
+
+/**
+ *  账款对象
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("账款对象")
+@TableName(value = "t_mac_account", autoResultMap = true)
+@ApiModel(value="实体类:账款对象", description="表名:t_mac_account")
+public class AccountResponse extends PageInfo<AccountResponse> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 账务对象ID
+     */
+//    @TableId(value = "object_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "账务对象ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String objectId;
+
+
+    /**
+     * 对象类型 (【系统字典】客户、供应商)
+     */
+    @Excel(name = "对象类型 (【系统字典】客户、供应商)")
+    @ApiModelProperty(value = "对象类型 (【系统字典】客户、供应商)")
+    private String objectType;
+
+
+    /**
+     * 总收款金额 (SUM(收款+退收款)(不包含锁定金额))
+     */
+    @Excel(name = "总收款金额 (SUM(收款+退收款)(不包含锁定金额))")
+    @ApiModelProperty(value = "总收款金额 (SUM(收款+退收款)(不包含锁定金额))")
+    private BigDecimal receipt;
+
+
+    /**
+     * 总收款锁定金额 (SUM(收款+退收款)(锁定金额))
+     */
+    @Excel(name = "总收款锁定金额 (SUM(收款+退收款)(锁定金额))")
+    @ApiModelProperty(value = "总收款锁定金额 (SUM(收款+退收款)(锁定金额))")
+    private BigDecimal receiptLock;
+
+
+    /**
+     * 销售订单未出库金额 (SUM(销售订单金额-出库金额)+SUM(销售退货-出库金额)合同资产)
+     */
+    @Excel(name = "销售订单未出库金额 (SUM(销售订单金额-出库金额)+SUM(销售退货-出库金额)合同资产)")
+    @ApiModelProperty(value = "销售订单未出库金额 (SUM(销售订单金额-出库金额)+SUM(销售退货-出库金额)合同资产)")
+    private BigDecimal contractAssets;
+
+
+    /**
+     * 总应收账款 (SUM(应收账款.应收账款))
+     */
+    @Excel(name = "总应收账款 (SUM(应收账款.应收账款))")
+    @ApiModelProperty(value = "总应收账款 (SUM(应收账款.应收账款))")
+    private BigDecimal receivable;
+
+
+    /**
+     * 总应收收款金额 (SUM(应收账款.还款金额))
+     */
+    @Excel(name = "总应收收款金额 (SUM(应收账款.还款金额))")
+    @ApiModelProperty(value = "总应收收款金额 (SUM(应收账款.还款金额))")
+    private BigDecimal receivableHandle;
+
+
+    /**
+     * 总应收优惠金额 (SUM(应收账款.优惠金额))
+     */
+    @Excel(name = "总应收优惠金额 (SUM(应收账款.优惠金额))")
+    @ApiModelProperty(value = "总应收优惠金额 (SUM(应收账款.优惠金额))")
+    private BigDecimal receivableWaive;
+
+
+    /**
+     * 总剩余应收 (总应收账款-总应收收款金额-总应收优惠金额)
+     */
+    @Excel(name = "总剩余应收 (总应收账款-总应收收款金额-总应收优惠金额)")
+    @ApiModelProperty(value = "总剩余应收 (总应收账款-总应收收款金额-总应收优惠金额)")
+    private BigDecimal receivableResidue;
+
+
+    /**
+     * 总收款可退金额 (总收款金额-总应收收款金额+总应收优惠金额(现金池))
+     */
+    @Excel(name = "总收款可退金额 (总收款金额-总应收收款金额+总应收优惠金额(现金池))")
+    @ApiModelProperty(value = "总收款可退金额 (总收款金额-总应收收款金额+总应收优惠金额(现金池))")
+    private BigDecimal receiptResidue;
+
+
+    /**
+     * 总付款金额 (SUM(付款+退付款))
+     */
+    @Excel(name = "总付款金额 (SUM(付款+退付款))")
+    @ApiModelProperty(value = "总付款金额 (SUM(付款+退付款))")
+    private BigDecimal payment;
+
+
+    /**
+     * 采购订单未入库金额 (SUM(采购订单金额-入库金额)+SUM(采购退货-入库金额)采购暂估)
+     */
+    @Excel(name = "采购订单未入库金额 (SUM(采购订单金额-入库金额)+SUM(采购退货-入库金额)采购暂估)")
+    @ApiModelProperty(value = "采购订单未入库金额 (SUM(采购订单金额-入库金额)+SUM(采购退货-入库金额)采购暂估)")
+    private BigDecimal purEstimate;
+
+
+    /**
+     * 总应付账款 (SUM(应付账款.应付金额))
+     */
+    @Excel(name = "总应付账款 (SUM(应付账款.应付金额))")
+    @ApiModelProperty(value = "总应付账款 (SUM(应付账款.应付金额))")
+    private BigDecimal payable;
+
+
+    /**
+     * 总应付付款金额 (SUM(应付账款.总应付付款金额))
+     */
+    @Excel(name = "总应付付款金额 (SUM(应付账款.总应付付款金额))")
+    @ApiModelProperty(value = "总应付付款金额 (SUM(应付账款.总应付付款金额))")
+    private BigDecimal payableHandle;
+
+
+    /**
+     * 总应付优惠金额 (SUM(应付账款.总应付优惠金额))
+     */
+    @Excel(name = "总应付优惠金额 (SUM(应付账款.总应付优惠金额))")
+    @ApiModelProperty(value = "总应付优惠金额 (SUM(应付账款.总应付优惠金额))")
+    private BigDecimal payableWaive;
+
+
+    /**
+     * 总剩余应付 (总应付账款-总应付付款金额-总应付优惠金额)
+     */
+    @Excel(name = "总剩余应付 (总应付账款-总应付付款金额-总应付优惠金额)")
+    @ApiModelProperty(value = "总剩余应付 (总应付账款-总应付付款金额-总应付优惠金额)")
+    private BigDecimal payableResidue;
+
+
+    /**
+     * 总付款可退金额 (总付款金额-总应付付款金额+总应付优惠金额)
+     */
+    @Excel(name = "总付款可退金额 (总付款金额-总应付付款金额+总应付优惠金额)")
+    @ApiModelProperty(value = "总付款可退金额 (总付款金额-总应付付款金额+总应付优惠金额)")
+    private BigDecimal paymentResidue;
+
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+    @ApiModelProperty(value = "明细")
+    private List<AccountItemResponse> list;
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 16 - 1
src/main/java/com/dk/mdm/service/mac/AccountService.java

@@ -15,6 +15,7 @@ import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.pojo.mst.MoneyAccount;
 import com.dk.mdm.model.query.mac.AccountItemQuery;
 import com.dk.mdm.model.response.mac.AccountItemResponse;
+import com.dk.mdm.model.response.mac.AccountResponse;
 import com.dk.mdm.service.mst.MoneyAccountService;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,6 +51,20 @@ public class AccountService extends BaseService<Account> {
     @Autowired
     private MoneyAccountItemMapper moneyAccountItemMapper;
 
+
+    /**
+     * @desc : 查看来源单据,总单加明细
+     * @author : 姜永辉
+     * @date : 2024/3/6 10:36
+     */
+    public ResponseResultVO selectById(String id) {
+        //根据id查询
+        AccountResponse accountResponse = accountMapper.selectById(id);
+        List<AccountItemResponse> accountItemResponses = accountItemMapper.getReceivableAccountItem(new AccountItemQuery().setObjectId(id));
+        accountResponse.setList(accountItemResponses);
+        return ResponseResultUtil.success(accountResponse);
+    }
+
     /**
      * @desc : 查询应收账款明细
      * @author : 付斌
@@ -57,7 +72,7 @@ public class AccountService extends BaseService<Account> {
      */
     @Pagination
     public ResponseResultVO<?> getReceivableAccountItem(AccountItemQuery accountItemQuery) {
-        List<AccountItemResponse> accountItemResponse = accountItemMapper.selectByCond(accountItemQuery);
+        List<AccountItemResponse> accountItemResponse = accountItemMapper.getReceivableAccountItem(accountItemQuery);
         return ResponseResultUtil.success(accountItemResponse);
     }
 

+ 1 - 1
src/main/java/com/dk/mdm/service/pur/PurchaseService.java

@@ -245,7 +245,7 @@ public class PurchaseService extends BaseService<Purchase> {
             }
         }
         return ResponseResultUtil.success(super.update(purchase, new UpdateWrapper<Purchase>().lambda().eq(Purchase::getPurId,
-                UUID.fromString(purchase.getPurId()))));
+                UUID.fromString(purchase.getPurId ()))));
     }
 
     /**