Kaynağa Gözat

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

changhaoning 1 yıl önce
ebeveyn
işleme
f9d8e2a705

+ 9 - 8
src/main/java/com/dk/mdm/mapper/ivt/OutboundItemMapper.xml

@@ -12,7 +12,7 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
         inv_id, cost_price, cost_amt, flg_valid, cp_id, op_create_time, op_create_user_id,
         op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user,
         s_out_id,s_out_item_id,s_order_id,s_order_item_id,outing_box,outing_piece,out_box,out_piece,
-        unit_id,sub_unit_id, pack_box,sku_name,sku_model,sup_id
+        unit_id,sub_unit_id, pack_box,sku_name,sku_model,sup_id,wh_id
     </sql>
 
     <sql id="Base_Column_List_Response">
@@ -22,7 +22,7 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
         tpoi.cost_price, tpoi.cost_amt, tpoi.flg_valid, tpoi.cp_id,
         tpoi.s_out_id,tpoi.s_out_item_id,tpoi.s_order_id,tpoi.s_order_item_id,
         tpoi.outing_box,tpoi.outing_piece,tpoi.out_box,tpoi.out_piece,
-        tpoi.unit_id,tpoi.sub_unit_id,tpoi.pack_box,sku_name,sku_model,sup_id
+        tpoi.unit_id,tpoi.sub_unit_id,tpoi.pack_box,sku_name,sku_model,sup_id,wh_id
     </sql>
 
     <!-- 通用查询映射结果 -->
@@ -71,6 +71,7 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
         <result column="sku_model" property="skuModel"/>
         <result column="decimalPlaces" property="decimalPlaces"/>
         <result column="sup_id" property="supId"/>
+        <result column="wh_id" property="whId" typeHandler="UuidTypeHandler"/>
     </resultMap>
 
     <!-- 通用查询映射结果 -->
@@ -262,12 +263,12 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
         ul.unit_name as "unitName",
         u2.unit_name as "subUnitName"
         FROM dkic_b.t_psi_outbound_item as tpoi
+        left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpoi.wh_id
         LEFT JOIN dkic_b.t_mst_supplier as tms ON tpoi.sup_id = tms.sup_id
         LEFT JOIN dkic_b.t_mst_unit AS ul ON tpoi.unit_id = ul.unit_id
         LEFT JOIN dkic_b.t_mst_unit AS u2 ON tpoi.sub_unit_id = u2.unit_id
         left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = tpoi.sku_id
         left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = tpoi.inv_id
-        left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
         left join sys.t_data_kind as tdk on tdk.kind_code = tpoi.out_status
         left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
         <include refid="Condition"/>
@@ -281,9 +282,9 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
         SELECT
         count(1)
         FROM dkic_b.t_psi_outbound_item as tpoi
+        left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpoi.wh_id
         left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = tpoi.sku_id
         left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = tpoi.inv_id
-        left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
         left join sys.t_data_kind as tdk on tdk.kind_code = tpoi.out_status
         left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
         <include refid="Condition"/>
@@ -431,6 +432,7 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
                tms.sup_name
                ,t.out_status
         FROM dkic_b.t_psi_outbound_item as t
+                 left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = t.wh_id
                  left join dkic_b.t_mst_supplier as tms on t.sup_id = tms.sup_id
                  left join dkic_b.t_psi_order_item as tpoi on tpoi.item_id = t.from_item_id
                  left join dkic_b.t_psi_order as tpo on tpo.order_id = t.from_id
@@ -438,7 +440,6 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
                  left join dkic_b.t_mst_unit as tmgu on t.unit_id = tmgu.unit_id
                  left join dkic_b.t_mst_unit as tmgus on t.sub_unit_id = tmgus.unit_id
                  left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = t.inv_id
-                 left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
                  left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
         where t.flg_valid
           and t.out_id = #{id}::uuid
@@ -481,10 +482,10 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
                 ,sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n}) as "outStatusName"
                 ,t.out_status
         FROM dkic_b.t_psi_outbound_item as t
+                 left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = t.wh_id
                  left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = t.sku_id
                  left join dkic_b.t_mst_unit as tmgu on t.unit_id = tmgu.unit_id
                  left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = t.inv_id
-                 left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
                  LEFT JOIN dkic_b.t_mst_unit AS ul ON t.unit_id = ul.unit_id
                  LEFT JOIN dkic_b.t_mst_unit AS u2 ON t.sub_unit_id = u2.unit_id
                  left join sys.t_data_kind as tdk on tdk.kind_code = t.out_status
@@ -561,12 +562,12 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
                 ,t.out_piece
                 ,t.out_status
         FROM dkic_b.t_psi_outbound_item as t
+                 left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = t.wh_id
                  left join dkic_b.t_mst_unit as tmgu on t.unit_id = tmgu.unit_id
                  left join dkic_b.t_mst_unit as tmgus on t.sub_unit_id = tmgus.unit_id
                  left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = t.sku_id
                  left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
                  left join dkic_b.t_psi_inventory tpi on tpi.inv_id = t.inv_id
-                 left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpi.wh_id
                  left join dkic_b.t_psi_outbound_item as tpobi on tpobi.item_id = t.s_out_item_id
         where t.flg_valid
           and t.out_id = #{id}::uuid
@@ -615,12 +616,12 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
                 ,t.out_piece
         ,t.out_status
         FROM dkic_b.t_psi_outbound_item as t
+                 left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = t.wh_id
                  left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = t.sku_id
                  left join dkic_b.t_mst_unit as tmgu on t.unit_id = tmgu.unit_id
                  left join dkic_b.t_mst_unit as tmgus on t.sub_unit_id = tmgus.unit_id
                  left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
                  left join dkic_b.t_psi_inventory tpi on tpi.inv_id = t.inv_id
-                 left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpi.wh_id
                  left join dkic_b.t_psi_outbound_item as tpobi on tpobi.item_id = t.s_out_item_id
         where t.flg_valid
           and t.out_id = #{id}::uuid

+ 5 - 0
src/main/java/com/dk/mdm/model/pojo/ivt/OutboundItem.java

@@ -365,6 +365,11 @@ public class OutboundItem extends PageInfo<OutboundItem> implements Serializable
     @TableField(typeHandler = UuidTypeHandler.class)
     private String supId;
 
+    @Excel(name = "仓库ID")
+    @ApiModelProperty(value = "仓库ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String whId;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 5 - 0
src/main/java/com/dk/mdm/model/query/ivt/OutboundItemQuery.java

@@ -237,6 +237,11 @@ public class OutboundItemQuery extends PageInfo<OutboundItemQuery>{
     @TableField(typeHandler = UuidTypeHandler.class)
     private String supId;
 
+    @Excel(name = "仓库ID")
+    @ApiModelProperty(value = "仓库ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String whId;
+
 
     private static final long serialVersionUID = 1L;
 

+ 2 - 0
src/main/java/com/dk/mdm/model/response/ivt/OutboundItemResponse.java

@@ -298,7 +298,9 @@ public class OutboundItemResponse {
     @ApiModelProperty(value = "可出库数量")
     private BigDecimal canOutingQty;
 
+    @Excel(name = "仓库ID")
     @ApiModelProperty(value = "仓库ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
     private String whId;
 
     @Excel(name = "库存数量")

+ 5 - 3
src/main/java/com/dk/mdm/model/vo/ivt/OutboundItemVO.java

@@ -256,9 +256,6 @@ public class OutboundItemVO {
     @ApiModelProperty(value = "已出库金额编辑之前")
     private BigDecimal amtBeforeUpdate;
 
-    @ApiModelProperty(value = "仓库")
-    private String whId;
-
     @ApiModelProperty(value = "新建编辑标识true:新建,false:编辑")
     private Boolean addOrEditFlag;
 
@@ -280,6 +277,11 @@ public class OutboundItemVO {
     @ApiModelProperty(value = "包装")
     private BigDecimal packBox;
 
+    @Excel(name = "仓库ID")
+    @ApiModelProperty(value = "仓库ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String whId;
+
 
 
 

+ 12 - 0
src/main/java/com/dk/mdm/model/vo/mst/CustomerVO.java

@@ -344,6 +344,18 @@ public class CustomerVO extends PageInfo<CustomerVO> implements Serializable {
     @ApiModelProperty(value = "初始金额")
     private BigDecimal startAmount;
 
+    /**
+     * 初始款项
+     */
+    @ApiModelProperty(value = "初始款项")
+    private String initialPaymentId;
+
+    /**
+     * 收付款账户
+     */
+    @ApiModelProperty(value = "收付款账户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String macId;
 
     /*
      * 相关属性

+ 5 - 10
src/main/java/com/dk/mdm/service/ivt/inbound/InboundOtherService.java

@@ -251,9 +251,8 @@ public class InboundOtherService extends BaseService<Inbound> {
             BigDecimal sumAmt = inboundVO.getItemList().stream().map(InboundItemVO::getIntoingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
             //endregion
 
-            //region  自动办理参数为true  已入库编辑
-            //自动办理参数为true
-            if (Constant.FlgHandleSetting.TRUE.getValue().equals(inboundVO.getFlgHandleSetting())) {
+            //region   已入库编辑
+            if (Constant.IntoStatus.YIRUKU.getName().equals(inboundVO.getIntoStatus())) {
 
                 //region 修改明细
                 List<InboundItemVO> itemList = inboundVO.getItemList();
@@ -356,14 +355,12 @@ public class InboundOtherService extends BaseService<Inbound> {
                 map.put("delIntoDetail", inboundVO.getDeleteItemList());
                 inventoryService.operatingInventoryInformation(map);
                 //endregion
-            } else {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.FLG_HANDLE_SETTING_NOT_ENABLED_INTO.getMessage());
             }
             //endregion
 
-            //region 自动办理参数false  入库中编辑
-            //自动办理标识为false 并且 自动办理参数为false  入库中
-            if (!inboundVO.getFlgAutoHandle() && Constant.FlgHandleSetting.FALSE.getValue().equals(inboundVO.getFlgHandleSetting())) {
+            //region   入库中编辑
+            if (Constant.IntoStatus.RUKUZHONG.getName().equals(inboundVO.getIntoStatus()) ||
+                    Constant.IntoStatus.DAIRUKU.getName().equals(inboundVO.getIntoStatus())) {
                 //region 修改明细
                 List<InboundItemVO> itemList = inboundVO.getItemList();
                 for (InboundItemVO inboundItemVO : itemList) {
@@ -428,8 +425,6 @@ public class InboundOtherService extends BaseService<Inbound> {
                         new UpdateWrapper<Inbound>().lambda().eq(Inbound::getIntoId, UUID.fromString(inbound.getIntoId()))
                 );
                 //endregion
-            } else {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.FLG_HANDLE_SETTING_NOT_ENABLED_INTO.getMessage());
             }
             //endregion
 

+ 5 - 1
src/main/java/com/dk/mdm/service/ivt/inventory/InventoryService.java

@@ -217,6 +217,10 @@ public class InventoryService extends BaseService<Inventory> {
             if (inventoryBatchVO.getSkuId() == null || "".equals(inventoryBatchVO.getSkuId())) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.SKU_IS_NULL.getMessage());
             }
+            //存货ID
+            if (inventoryBatchVO.getInvId() == null || "".equals(inventoryBatchVO.getInvId())) {
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.SKU_IS_NOT_IN_INVENTORY.getMessage());
+            }
             //仓库ID
             if (!inventoryBatchVO.getCanNegativeFlag() && (inventoryBatchVO.getWhId() == null || "".equals(inventoryBatchVO.getWhId()))) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.WAREHOUSE_IS_NULL.getMessage());
@@ -800,7 +804,7 @@ public class InventoryService extends BaseService<Inventory> {
         //存货资产
         inventory.setCostAmt(costAmt);
         //存货单价
-        inventory.setCostPrice(costAmt.compareTo(BigDecimal.ZERO) > 0 ?
+        inventory.setCostPrice(costAmt.compareTo(BigDecimal.ZERO) > 0 &&  inventory.getInvQty().compareTo(BigDecimal.ZERO) > 0 ?
                costAmt.divide(inventory.getInvQty(),BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO);
         inventoryMapper.updateAmtAndQty(inventory);
         //endregion

+ 4 - 11
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundOtherService.java

@@ -251,9 +251,8 @@ public class OutboundOtherService extends BaseService<Outbound> {
             BigDecimal sumAmt = outboundVO.getItemList().stream().map(OutboundItemVO::getOutingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
             //endregion
 
-            //region  自动办理参数为true  已出库编辑
-            //自动办理参数为true
-            if (Constant.FlgHandleSetting.TRUE.getValue().equals(outboundVO.getFlgHandleSetting())) {
+            //region   已出库编辑
+            if (Constant.OutStatus.YICHUKU.getName().equals(outboundVO.getOutStatus())) {
 
                 //region 修改明细
                 List<OutboundItemVO> itemList = outboundVO.getItemList();
@@ -363,14 +362,11 @@ public class OutboundOtherService extends BaseService<Outbound> {
                 }
                 //endregion
             }
-            else{
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.FLG_HANDLE_SETTING_NOT_ENABLED_OUT.getMessage());
-            }
             //endregion
 
             //region 自动办理参数false  出库中编辑
-            //自动办理标识为false 并且 自动办理参数为false  出库中
-            if (!outboundVO.getFlgAutoHandle() && Constant.FlgHandleSetting.FALSE.getValue().equals(outboundVO.getFlgHandleSetting())) {
+            if (Constant.OutStatus.CHUKUZHONG.getName().equals(outboundVO.getOutStatus()) ||
+                    Constant.OutStatus.DAICHUKU.getName().equals(outboundVO.getOutStatus())) {
                 //region 修改明细
                 List<OutboundItemVO> itemList = outboundVO.getItemList();
                 for (OutboundItemVO outboundItemVO : itemList) {
@@ -438,9 +434,6 @@ public class OutboundOtherService extends BaseService<Outbound> {
                 );
                 //endregion
             }
-            else{
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.FLG_HANDLE_SETTING_NOT_ENABLED_OUT.getMessage());
-            }
             //endregion
         }
         //endregion

+ 6 - 11
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java

@@ -475,7 +475,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
     public ResponseResultVO<?> saleOrderOutboundInsertCollection(OutboundVO outboundVO) {
         //新建销售出库
         saleOrderOutboundInsert(outboundVO);
-        //新建退款
+        //新建收款退款
         RecPayVO recPayVO = new RecPayVO();
         recPayVO.setObjectId(outboundVO.getObjectId());
         recPayVO.setOrgId(outboundVO.getOrgId());
@@ -531,9 +531,8 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
             BigDecimal sumAmt = outboundVO.getItemList().stream().map(OutboundItemVO::getOutingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
             //endregion
 
-            //region  自动办理参数为true  已入库编辑
-            //自动办理参数为true
-            if (Constant.FlgHandleSetting.TRUE.getValue().equals(outboundVO.getFlgHandleSetting())) {
+            //region  已入库编辑
+            if (Constant.OutStatus.YICHUKU.getName().equals(outboundVO.getOutStatus())) {
                 //region 应收反记账
                 if (outboundVO.getReceivableId() != null) {
                     accountService.reverseReceivable(outboundVO.getOutId(), Constant.InventoryDocCode.OUTBOUND.getTableName());
@@ -735,14 +734,12 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                     inventoryService.operatingInventoryInformation(invMap);
                 }
                 //endregion
-            } else {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.FLG_HANDLE_SETTING_NOT_ENABLED_OUT.getMessage());
             }
             //endregion
 
-            //region 自动办理参数false  入库中编辑
-            //自动办理标识为false 并且 自动办理参数为false  入库中
-            if (!outboundVO.getFlgAutoHandle() && Constant.FlgHandleSetting.FALSE.getValue().equals(outboundVO.getFlgHandleSetting())) {
+            //region 入库中编辑
+            if (Constant.OutStatus.CHUKUZHONG.getName().equals(outboundVO.getOutStatus()) ||
+                    Constant.OutStatus.DAICHUKU.getName().equals(outboundVO.getOutStatus())) {
                 //region 修改明细
                 List<OutboundItemVO> itemList = outboundVO.getItemList();
                 for (OutboundItemVO outboundItemVO : itemList) {
@@ -877,8 +874,6 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                     }
                 }
                 //endregion
-            } else {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.FLG_HANDLE_SETTING_NOT_ENABLED_OUT.getMessage());
             }
             //endregion
         }

+ 33 - 9
src/main/java/com/dk/mdm/service/mst/CustomerService.java

@@ -16,14 +16,12 @@ import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.query.mst.CustomerQuery;
 import com.dk.mdm.model.response.mst.CustomerResponse;
-import com.dk.mdm.model.vo.mac.OtherPayableItemVO;
-import com.dk.mdm.model.vo.mac.OtherPayableVO;
-import com.dk.mdm.model.vo.mac.OtherReceivableItemVO;
-import com.dk.mdm.model.vo.mac.OtherReceivableVO;
+import com.dk.mdm.model.vo.mac.*;
 import com.dk.mdm.model.vo.mst.CustomerVO;
 import com.dk.mdm.service.common.CommonService;
 import com.dk.mdm.service.mac.OtherPayableService;
 import com.dk.mdm.service.mac.OtherReceivableService;
+import com.dk.mdm.service.mac.ReceiptService;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -66,6 +64,10 @@ public class CustomerService extends BaseService<Customer> {
     private OtherReceivableService otherReceivableService;
 
     @Autowired
+    private ReceiptService receiptService;
+
+
+    @Autowired
     private AuthUtils authUtils;
 
     /**
@@ -127,8 +129,9 @@ public class CustomerService extends BaseService<Customer> {
         //报备日期
         customer.setReportTime(LocalDateTime.now());
         ResponseResultVO<?> insert = super.insert(customer);
-
-        if (customerVO!= null && customerVO.getStartAmount().compareTo(BigDecimal.ZERO) > 0) { //说明有起始欠款  需要插入其他支出
+        //说明有起始欠款  需要插入其他支出
+        if (customerVO != null && customerVO.getInitialPaymentId() != null
+                && customerVO.getInitialPaymentId().equals(Constant.initialPaymentType.DEBT.getName())) {
             //先组装明细
             List<OtherReceivableItemVO> itemList = new ArrayList<>();
             OtherReceivableItemVO otherReceivableItemVO = new OtherReceivableItemVO();
@@ -137,7 +140,7 @@ public class CustomerService extends BaseService<Customer> {
             param.put("dictCode", "基础资料-收入");
             param.put("dataValue", "期初");
             Map<String, Object> data = commonMapper.selectDictionaryData(param);
-            if(data != null && data.size() > 0){
+            if (data != null && data.size() > 0) {
                 String dataId = String.valueOf(data.get("dataId"));
                 otherReceivableItemVO.setReceivableType(dataId);
                 otherReceivableItemVO.setAmtReceivable(customerVO.getStartAmount());
@@ -150,6 +153,26 @@ public class CustomerService extends BaseService<Customer> {
                 otherReceivableService.insert(otherReceivableVO);
             }
         }
+        //初始款项-预收 240530
+        else if (customerVO != null && customerVO.getInitialPaymentId() != null
+                && customerVO.getInitialPaymentId().equals(Constant.initialPaymentType.PAYMENT.getName())) {
+            //先组装明细
+            List<RecPayItemVO> itemList = new ArrayList<>();
+            RecPayItemVO recPayItemVO = new RecPayItemVO();
+            recPayItemVO.setAccDate(LocalDate.now());
+            recPayItemVO.setCpId(customer.getCpId());
+            recPayItemVO.setMacId(customerVO.getMacId());
+            recPayItemVO.setAmtRec(customerVO.getStartAmount());
+            recPayItemVO.setMakeStaff(customer.getReportStaff());
+            itemList.add(recPayItemVO);
+            RecPayVO recPayVO = new RecPayVO().setObjectId(customer.getCusId()).setAccDate(LocalDate.now())
+                            .setSumAmtRec(customerVO.getStartAmount()).setStaffId(customer.getStaffId())
+                            .setOrgId(customer.getOrgId()).setMakeStaff(customer.getReportStaff())
+                    .setCpId(customer.getCpId()).setRpType(Constant.RpType.SHOU_KUAN.getName())
+                    .setItemList(itemList);
+
+            receiptService.insertReceipt(recPayVO);
+        }
 
         if (insert.getCode() == ResponseCodeEnum.SUCCESS.getCode()) {
             return ResponseResultUtil.success(customer);
@@ -178,7 +201,7 @@ public class CustomerService extends BaseService<Customer> {
      * @author : 于继渤
      * @date : 2023/1/5 9:39
      */
-    public ResponseResultVO selectCustomerById( String id) {
+    public ResponseResultVO selectCustomerById(String id) {
         CustomerResponse customerResponse = customerMapper.selectCustomerById(id);
         if (customerResponse == null) {
             return ResponseResultUtil.error(ResponseCodeEnum.SELECT_NULL);
@@ -191,13 +214,14 @@ public class CustomerService extends BaseService<Customer> {
      * @author : 于继渤
      * @date : 2023/1/5 9:39
      */
-    public ResponseResultVO<CustomerResponse> selectByIdRespone( String id) {
+    public ResponseResultVO<CustomerResponse> selectByIdRespone(String id) {
         CustomerResponse customerResponse = customerMapper.selectByIdRespone(id);
         if (customerResponse == null) {
             return ResponseResultUtil.error(ResponseCodeEnum.SELECT_NULL);
         }
         return ResponseResultUtil.success(customerResponse);
     }
+
     /**
      * @desc : 不分页查询
      * @author : 于继渤