zhangyuewww 2 年之前
父节点
当前提交
d6574795b9

+ 9 - 5
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ExpenseAllocationInfoController.java

@@ -1,14 +1,11 @@
 package com.yh.saas.plugin.yiliangyiyun.controller;
 
 
+import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseAllocationInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseInfo;
 import com.yh.saas.plugin.yiliangyiyun.service.IExpenseAllocationInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
-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.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * <p>
@@ -33,6 +30,13 @@ public class ExpenseAllocationInfoController {
     public void deleteInfo(@RequestBody ExpenseInfo example) {
         expenseAllocationInfoService.deleteInfo(example.getId());
     }
+    /**
+     * 查看可分配金额
+     */
+    @GetMapping("/getExpenseAllocationInfo")
+    public ExpenseAllocationInfo getExpenseAllocationInfo(String contractNo, String costType){
+        return expenseAllocationInfoService.getExpenseAllocationInfo(contractNo,costType);
+    }
 
 }
 

+ 20 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ExpenseAllocationInfo.java

@@ -45,6 +45,26 @@ public class ExpenseAllocationInfo extends BaseModel<ExpenseAllocationInfo> {
      * 入库单id
      */
     private String orderId;
+    /**
+     * 合同号
+     */
+    private String contractNo;
+    /**
+     * 合同号id
+     */
+    private String contractId;
+    /**
+     * 费用类型(1粮款5保证金)
+     */
+    private String costType;
+    /**
+     * 累计金额
+     */
+    private Double accumulatedPrepayment;
+    /**
+     * 收回金额
+     */
+    private Double recoveryPrepayments;
     /**
      * 费用编号
      */

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/WarehousingOrder.java

@@ -295,6 +295,11 @@ public class WarehousingOrder extends BaseModel<WarehousingOrder> {
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     @TableField(exist = false)
     private Date issuingTimeElse;
+    /**
+     * 本次分配金额
+     */
+    @TableField(exist = false)
+    private Double money;
 
     @Override
     protected Serializable pkVal() {

+ 10 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/view/PaymentView.java

@@ -1,7 +1,11 @@
 package com.yh.saas.plugin.yiliangyiyun.entity.view;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 @Data
 @Accessors(chain = true)
@@ -51,5 +55,11 @@ public class PaymentView {
      * 申请人
      */
     private String applicant;
+    /**
+     * 时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateDate;
 
 }

+ 4 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IExpenseAllocationInfoService.java

@@ -2,7 +2,6 @@ package com.yh.saas.plugin.yiliangyiyun.service;
 
 import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseAllocationInfo;
 import com.baomidou.mybatisplus.service.IService;
-import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseInfo;
 
 /**
  * <p>
@@ -19,6 +18,9 @@ public interface IExpenseAllocationInfoService extends IService<ExpenseAllocatio
      * @param id
      */
     void deleteInfo(String id);
-
+    /**
+     * 查看可分配金额
+     */
+    ExpenseAllocationInfo getExpenseAllocationInfo(String contractNo,String costType);
 
 }

+ 9 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ExpenseAllocationInfoServiceImpl.java

@@ -1,7 +1,7 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseAllocationInfo;
-import com.yh.saas.plugin.yiliangyiyun.entity.ExpenseInfo;
 import com.yh.saas.plugin.yiliangyiyun.mapper.ExpenseAllocationInfoMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.IExpenseAllocationInfoService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
@@ -29,4 +29,12 @@ public class ExpenseAllocationInfoServiceImpl extends ServiceImpl<ExpenseAllocat
             this.deleteById(expenseAllocationInfo.getId());
         }
     }
+
+    @Override
+    public ExpenseAllocationInfo getExpenseAllocationInfo(String contractNo, String costType) {
+        ExpenseAllocationInfo expenseAllocationInfo=this.selectOne(new EntityWrapper<ExpenseAllocationInfo>()
+        .eq("contract_no",contractNo)
+        .eq("cost_type",costType));
+        return expenseAllocationInfo;
+    }
 }

+ 39 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ExpenseInfoServiceImpl.java

@@ -193,6 +193,27 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
             expenseInfo.setStatusFlag(StatusEnum.TO_BE_CONFIRMED.getFlag());
             expenseInfo.setStatus(StatusEnum.TO_BE_CONFIRMED.getName());
             this.insert(expenseInfo);
+            //合同费用
+            if ("1".equals(expenseInfo.getExpensesPurpose())){
+                //查是否有分配数据
+                ExpenseAllocationInfo expenseAllocationInfo=expenseAllocationInfoService.selectOne(new EntityWrapper<ExpenseAllocationInfo>()
+                .eq("contract_id",expenseInfo.getContractId())
+                .eq("cost_type",expenseInfo.getCostType()));
+                if (expenseAllocationInfo!=null){
+                    //累加收回金额
+                    expenseAllocationInfo.setRecoveryPrepayments(expenseAllocationInfo.getRecoveryPrepayments()+expenseInfo.getAmountMoney());
+                    expenseAllocationInfoService.updateById(expenseAllocationInfo);
+                }
+                else {
+                    ExpenseAllocationInfo expenseAllocationInfo1=new ExpenseAllocationInfo();
+                    expenseAllocationInfo1.setId(IdGenerator.generateUUID());
+                    expenseAllocationInfo1.setCostType(expenseInfo.getCostType());
+                    expenseAllocationInfo1.setContractId(expenseInfo.getContractId());
+                    expenseAllocationInfo1.setContractNo(expenseInfo.getContractNo());
+                    expenseAllocationInfo1.setRecoveryPrepayments(expenseInfo.getAmountMoney());
+                    expenseAllocationInfoService.insert(expenseAllocationInfo1);
+                }
+            }
             // 插入操作历史
             String staffName = this.billOperateHisService.getStaffAndName();
             // 插入操作历史
@@ -458,6 +479,24 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
             contractExpensesInfo.setContractNo(expenseInfo1.getContractNo());
             contractExpensesInfo.setCostType("1");
             contractExpensesInfoService.insert(contractExpensesInfo);
+            //查是否有分配数据
+            ExpenseAllocationInfo expenseAllocationInfo=expenseAllocationInfoService.selectOne(new EntityWrapper<ExpenseAllocationInfo>()
+                    .eq("contract_id",expenseInfo1.getContractId())
+                    .eq("cost_type",expenseInfo1.getCostType()));
+            if (expenseAllocationInfo!=null){
+                //累加付款金额
+                expenseAllocationInfo.setAccumulatedPrepayment(expenseAllocationInfo.getAccumulatedPrepayment()+expenseInfo1.getAmountMoney());
+                expenseAllocationInfoService.updateById(expenseAllocationInfo);
+            }
+            else {
+                ExpenseAllocationInfo expenseAllocationInfo1=new ExpenseAllocationInfo();
+                expenseAllocationInfo1.setId(IdGenerator.generateUUID());
+                expenseAllocationInfo1.setCostType(expenseInfo1.getCostType());
+                expenseAllocationInfo1.setContractId(expenseInfo1.getContractId());
+                expenseAllocationInfo1.setContractNo(expenseInfo1.getContractNo());
+                expenseAllocationInfo1.setAccumulatedPrepayment(expenseInfo1.getAmountMoney());
+                expenseAllocationInfoService.insert(expenseAllocationInfo1);
+            }
         }
         // 插入操作历史
         String staffName = this.billOperateHisService.getStaffAndName();

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PaymentManagementServiceImpl.java

@@ -2526,6 +2526,7 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
         paymentView.setImperfectGrainTotal(Double.valueOf(df.format(imperfectGrainTotal/netWeightTotal)));
         paymentView.setBulkDensityTotal(Double.valueOf(df.format(bulkDensityTotal/netWeightTotal)));
         paymentView.setJiaorenliTotal(Double.valueOf(df.format(jiaorenliTotal/netWeightTotal)));
+        paymentView.setUpdateDate(dataList.get(0).getUpdateDate());
         return paymentView;
 
     }

+ 25 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehousingOrderServiceImpl.java

@@ -588,7 +588,31 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                     this.updateById(warehousingOrder1);
                 }
             }
-            //请款
+            //预付款分配
+            else if ("2".equals(warehousingOrder.getFlag())) {
+                WarehousingOrder warehousingOrder1=warehousingOrder.getWarehousingOrderList().get(0);
+                warehousingOrder1.setAmountNotPayable(warehousingOrder1.getAmountNotPayable()-warehousingOrder.getMoney());
+                warehousingOrder1.setAmountEdPayable(warehousingOrder1.getAmountEdPayable()+warehousingOrder.getMoney());
+                this.updateById(warehousingOrder1);
+                ExpenseAllocationInfo expenseAllocationInfo=expenseAllocationInfoService.selectOne(new EntityWrapper<ExpenseAllocationInfo>()
+                        .eq("contract_no",warehousingOrder1.getContractNo())
+                        .eq("cost_type","1"));
+                expenseAllocationInfo.setDistributionMoney(expenseAllocationInfo.getDistributionMoney()+warehousingOrder.getMoney());
+                expenseAllocationInfoService.updateById(expenseAllocationInfo);
+            }
+            //保证金分配
+            else if ("3".equals(warehousingOrder.getFlag())) {
+                WarehousingOrder warehousingOrder1=warehousingOrder.getWarehousingOrderList().get(0);
+                warehousingOrder1.setAmountNotPayable(warehousingOrder1.getAmountNotPayable()-warehousingOrder.getMoney());
+                warehousingOrder1.setAmountEdPayable(warehousingOrder1.getAmountEdPayable()+warehousingOrder.getMoney());
+                this.updateById(warehousingOrder1);
+                ExpenseAllocationInfo expenseAllocationInfo=expenseAllocationInfoService.selectOne(new EntityWrapper<ExpenseAllocationInfo>()
+                        .eq("contract_no",warehousingOrder1.getContractNo())
+                        .eq("cost_type","5"));
+                expenseAllocationInfo.setDistributionMoney(expenseAllocationInfo.getDistributionMoney()+warehousingOrder.getMoney());
+                expenseAllocationInfoService.updateById(expenseAllocationInfo);
+            }
+            //请款1
             else {
                 String batchId = IdGenerator.generateUUID();
                 String workflowId = "";

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/PaymentManagementMapper.xml

@@ -307,6 +307,7 @@
         a.pure_weight as pureWeight,
         a.amount_ing_payable as amountIngPayable,
         a.amount_ed_payable as amountEdPayable,
+        a.update_date as updateDate,
         i.bank_card as bankCard,
         i.bank_deposit as bankDeposit,
         i.bank_deposit_branch as bankDepositBranch

+ 3 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehousingOrderMapper.xml

@@ -59,6 +59,9 @@
         wbi.warehouse_type as warehouseType,
         w.avg_cost as avgCost,
         w.workflow_id as workflowId,
+        w.amount_not_payable as amountNotPayable,
+        w.contract_no as contractNo,
+        w.goods_name as goodsName,
         w.request_funds as requestFunds,
         w.request_person as requestPerson,
         w.request_date as requestDate,