dongke 2 лет назад
Родитель
Сommit
a89272c5b1

+ 1 - 1
src/main/java/com/dk/mdm/mapper/mac/OtherPayableMapper.xml

@@ -62,7 +62,7 @@
                 AND t.business_type = #{businessType}
             </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}

+ 2 - 0
src/main/java/com/dk/mdm/mapper/mst/SupplierMapper.java

@@ -35,6 +35,8 @@ public interface SupplierMapper extends BaseMapper<Supplier>{
         * @date   : 2024/2/29 17:49
         */
     int insertSupplierBrand(Supplier supplierVo);
+
+
     /**
      * @desc   : 保存供应商品牌
      * @author : 王英杰

+ 1 - 6
src/main/java/com/dk/mdm/model/pojo/mst/Supplier.java

@@ -57,12 +57,7 @@ public class Supplier extends PageInfo<Supplier> implements Serializable {
     @ApiModelProperty(value = "供应商编号")
     private String supCode;
 
-    /**
-     * 初始金额
-     */
-    @Excel(name = "初始金额")
-    @ApiModelProperty(value = "初始金额")
-    private int startAmount;
+
     /**
      * 供应商名称
      */

+ 6 - 1
src/main/java/com/dk/mdm/model/response/mst/SpplierResponse.java

@@ -50,7 +50,12 @@ public class SpplierResponse extends PageInfo<SpplierResponse> implements Serial
     @TableField(typeHandler = UuidTypeHandler.class)
     private String supId;
 
-
+    /**
+     * 合计应付
+     */
+    @Excel(name = "合计应付")
+    @ApiModelProperty(value = "合计应付")
+    private BigDecimal sumAmtPayable;
     /**
      * 供应商编号
      */

+ 8 - 1
src/main/java/com/dk/mdm/model/vo/mst/SupplierVo.java

@@ -47,6 +47,13 @@ public class SupplierVo extends PageInfo<SupplierVo> implements Serializable {
     @ApiModelProperty(value = "供应商ID")
     @TableField(typeHandler = UuidTypeHandler.class)
     private String supId;
+    /**
+     * 制单员
+     */
+    @Excel(name = "制单员")
+    @ApiModelProperty(value = "制单员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String makeStaff;
 
 
     /**
@@ -151,7 +158,7 @@ public class SupplierVo extends PageInfo<SupplierVo> implements Serializable {
      */
     @Excel(name = "初始金额")
     @ApiModelProperty(value = "初始金额")
-    private int startAmount;
+    private BigDecimal startAmount;
 
     @TableField(exist = false)
     @ApiModelProperty(value = "剩余应收付")

+ 11 - 11
src/main/java/com/dk/mdm/service/mac/OtherPayableService.java

@@ -111,17 +111,6 @@ public class OtherPayableService extends BaseService<OtherPayable> {
     private OtherPayableItemConvert otherPayableItemConvert;
 
     /**
-     * @desc : 条件查询
-     * @author : 付斌
-     * @date : 2023/1/9 10:40
-     */
-    @Pagination
-    public ResponseResultVO<PageList<OtherPayableResponse>> selectByCond(OtherPayableQuery otherPayableQuery) {
-        return super.mergeListWithCount(otherPayableQuery, otherPayableMapper.selectByCond(otherPayableQuery),
-                otherPayableMapper.countByCond(otherPayableQuery));
-    }
-
-    /**
      * @desc : 查询明细(货物、付款、附件)
      * @author : 付斌
      * @date : 2024-02-28 13:25
@@ -138,6 +127,17 @@ public class OtherPayableService extends BaseService<OtherPayable> {
     }
 
     /**
+     * @desc : 条件查询
+     * @author : 付斌
+     * @date : 2023/1/9 10:40
+     */
+    @Pagination
+    public ResponseResultVO<PageList<OtherPayableResponse>> selectByCond(OtherPayableQuery otherPayableQuery) {
+        return super.mergeListWithCount(otherPayableQuery, otherPayableMapper.selectByCond(otherPayableQuery),
+                otherPayableMapper.countByCond(otherPayableQuery));
+    }
+
+    /**
      * @desc : 新建方法
      * @author : 付斌
      * @date : 2023/1/9 10:49

+ 47 - 8
src/main/java/com/dk/mdm/service/mst/SupplierService.java

@@ -6,18 +6,30 @@ 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.mst.SupplierConvert;
+import com.dk.mdm.mapper.mac.OtherPayableMapper;
 import com.dk.mdm.model.pojo.mst.Supplier;
 import com.dk.mdm.mapper.mst.SupplierMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mac.MacTransferItemQuery;
+import com.dk.mdm.model.query.mac.OtherPayableQuery;
 import com.dk.mdm.model.query.mst.SupplierQuery;
+import com.dk.mdm.model.response.mac.MacTransferItemResponse;
+import com.dk.mdm.model.response.mac.MacTransferResponse;
+import com.dk.mdm.model.response.mac.OtherPayableResponse;
+import com.dk.mdm.model.response.mst.SpplierResponse;
+import com.dk.mdm.model.vo.mac.OtherPayableItemVO;
+import com.dk.mdm.model.vo.mac.OtherPayableVO;
 import com.dk.mdm.model.vo.mst.SupplierVo;
 import com.dk.mdm.service.common.CommonService;
+import com.dk.mdm.service.mac.OtherPayableService;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
+import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -46,6 +58,11 @@ public class SupplierService extends BaseService<Supplier> {
     private SupplierConvert supplierConvert;
     @Autowired
     private CommonService commonService;
+
+    @Autowired
+    private OtherPayableService otherPayableService;
+    @Autowired
+    private OtherPayableMapper otherPayableMapper;
     /**
      * @desc : 条件查询
      * @author : 王英杰
@@ -53,7 +70,22 @@ public class SupplierService extends BaseService<Supplier> {
      */
     @Pagination
     public ResponseResultVO<PageList<Supplier>> selectByCond(SupplierQuery supplierQuery) {
-        return super.mergeListWithCount(supplierQuery, supplierMapper.selectByCond(supplierQuery),
+        List<SpplierResponse> list = new ArrayList<>();
+        list = supplierMapper.selectByCond(supplierQuery);
+
+
+
+        for(int i =0;i<list.size();i++){ //显示明细第一条的 内容
+            list.get(i).getSupId();
+            // 转账明细
+            List<OtherPayableResponse> itemList = otherPayableMapper.selectByCond(new OtherPayableQuery().setObjectId(list.get(i).getSupId()).setBusinessType(0));
+            if(itemList.size()>0){
+                list.get(i).setSumAmtPayable(itemList.get(0).getSumAmtPayable());
+            }
+        }
+
+
+        return super.mergeListWithCount(supplierQuery,list ,
                 supplierMapper.countByCond(supplierQuery));
     }
     /**
@@ -74,7 +106,7 @@ public class SupplierService extends BaseService<Supplier> {
         // 转化实体
         Supplier supplier = supplierConvert.convertToPo(supplierVo);
 
-        try {
+
             Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.SUPPLIER.getName(), true);
 
             supplier.setSupId(codeMap.get("outId").toString());
@@ -95,15 +127,22 @@ public class SupplierService extends BaseService<Supplier> {
                 supplierMapper.insertSupplierBrandtBatch(Supplierlst); // 向供应商品牌表插入数据
             }
 
-             if(supplier.getStartAmount()>0) {
-
+             if(supplierVo.getStartAmount()!=null && supplierVo.getStartAmount().compareTo(BigDecimal.ZERO) > 0) { //说明有起始欠款  需要插入其他支出
+                 //先组装明细
+                 List<OtherPayableItemVO> itemList = new ArrayList<>();
+                 OtherPayableItemVO otherPayableItemVO = new OtherPayableItemVO();
+                 otherPayableItemVO.setPayableType("10112024-0415-0000-0000-0000300dd508");
+                 otherPayableItemVO.setAmtPayable(supplierVo.getStartAmount());
+                 itemList.add(otherPayableItemVO);
+                 //调用 新建其他支出
+                 OtherPayableVO otherPayableVO = new OtherPayableVO().setBusinessType(0).setObjectId(supplier.getSupId())
+                         .setSumAmtPayable(supplierVo .getStartAmount()).setStaffId(supplier.getStaffId())
+                         .setOrgId(supplier.getOrgId()).setAccDate(LocalDate.now()).setMakeStaff(supplierVo
+                                 .getMakeStaff()).setItemList(itemList).setSumAmtPay(BigDecimal.ZERO);
+                 otherPayableService.insert(otherPayableVO);
              }
             return ResponseResultUtil.success();
-        } catch (Exception e) {
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); // 手动回滚事务
 
-            return ResponseResultUtil.error("保存失败");
-        }
 
     }
     /**