wangzhuo 2 years ago
parent
commit
433f0e299f
32 changed files with 1604 additions and 213 deletions
  1. 8 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  2. 8 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TCorpsController.java
  3. 9 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TFeesController.java
  4. 42 4
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TChargeController.java
  5. 47 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TPaymentController.java
  6. 5 1
      ruoyi-admin/src/main/resources/application-druid.yml
  7. 7 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
  8. 8 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
  9. 7 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  10. 3 0
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
  11. 78 0
      ruoyi-warehouse/src/main/java/com/ruoyi/approvalFlow/service/impl/AuditPathsServiceImpl.java
  12. 8 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java
  13. 6 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java
  14. 9 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java
  15. 111 1
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TFee.java
  16. 52 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TFeeDo.java
  17. 40 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TWareHouseFees.java
  18. 86 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/excel/CargoDetailsExcel.java
  19. 63 127
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/excel/Payment.java
  20. 64 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/excel/TotalPaymentsExport.java
  21. 39 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeDoMapper.java
  22. 31 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeMapper.java
  23. 30 5
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeService.java
  24. 254 69
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java
  25. 35 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java
  26. 32 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java
  27. 16 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java
  28. 76 2
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java
  29. 3 0
      ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml
  30. 32 1
      ruoyi-warehouse/src/main/resources/mapper/finance/TFeeDoMapper.xml
  31. 339 3
      ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml
  32. 56 0
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

+ 8 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -216,4 +216,12 @@ public class SysUserController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询所有用户下拉选
+     */
+    @GetMapping("/userPullDown")
+    public AjaxResult userPullDown() {
+        return userService.getUserList();
+    }
+
 }

+ 8 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TCorpsController.java

@@ -143,5 +143,13 @@ public class TCorpsController extends BaseController {
         return AjaxResult.success("success",tCorpsService.getCorpName(tCorps));
     }
 
+    /**
+     * 查询所有供应商
+     * @return 返回所有供应商
+     */
+    @GetMapping("/client/{fTypeid}")
+    public AjaxResult getClient(@PathVariable(name = "fTypeid") String fTypeid) {
+        return AjaxResult.success(tCorpsService.getClient(fTypeid));
+    }
 
 }

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TFeesController.java

@@ -16,6 +16,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 费用信息Controller
@@ -112,4 +113,12 @@ public class TFeesController extends BaseController {
     public AjaxResult feesList(@RequestParam("feesType") String feesType) {
         return tFeesService.selectFeesTypeList(feesType);
     }
+
+//    @PostMapping("/warehousebills")
+//    public AjaxResult getWarehousebills(@RequestBody Map<String, String> data) {
+//        data.get("");
+//        startPage();
+//        List<TFees> list = tFeesService.selectWarehousebills(tFees);
+//        return getDataTable(list);
+//    }
 }

+ 42 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TChargeController.java

@@ -14,10 +14,14 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.finance.domain.TFee;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.excel.CargoDetailsExcel;
 import com.ruoyi.finance.excel.Charge;
 import com.ruoyi.finance.excel.Detailed;
+import com.ruoyi.finance.excel.TotalPaymentsExport;
 import com.ruoyi.finance.service.ITFeeService;
 import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -37,6 +41,9 @@ public class TChargeController extends BaseController {
     @Autowired
     private ITFeeService tFeeService;
 
+    @Autowired
+    private ITWarehouseBillsService itWarehouseBillsService;
+
     /**
      * 查询财务数据主列表
      */
@@ -53,6 +60,30 @@ public class TChargeController extends BaseController {
     }
 
     /**
+     * 应付总账查询
+     */
+    @PreAuthorize("@ss.hasPermi('finance:totalPayments:list')")
+    @PostMapping("/totalPayments")
+    public TableDataInfo totalPayments(@RequestBody Map<String, String> condition) {
+        startPage();
+        TWarehouseBills tWarehouseBills = new TWarehouseBills();
+        List<TWarehouseBills> list = itWarehouseBillsService.getTotalPayments(condition);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出应付总账
+     */
+    @PreAuthorize("@ss.hasPermi('finance:totalPayments:export')")
+    @Log(title = "应付总账", businessType = BusinessType.EXPORT)
+    @PostMapping("/totalPaymentsExport")
+    public AjaxResult TotalPaymentsExport(@RequestBody Map<String, String> condition) throws Exception {
+        List<TotalPaymentsExport> list = itWarehouseBillsService.getTotalPaymentsExcel(condition);
+        ExcelUtil<TotalPaymentsExport> util = new ExcelUtil<>(TotalPaymentsExport.class);
+        return util.exportExcel(list, "应付总账");
+    }
+
+    /**
      * 导出财务数据主列表
      */
     @PreAuthorize("@ss.hasPermi('finance:charge:export')")
@@ -185,10 +216,17 @@ public class TChargeController extends BaseController {
      */
     @GetMapping("/exportItems/{fId}")
     public AjaxResult exportItems(@PathVariable("fId") Long fId) {
-        List<Detailed> list = tFeeService.selectDetailedList(fId);
-        String exportName = tFeeService.findCtrlcorpid(fId);
-        ExcelUtil<Detailed> util = new ExcelUtil<Detailed>(Detailed.class);
-        return util.exportExcel(list, exportName);
+
+//        List<Detailed> list = tFeeService.selectDetailedList(fId);
+//        String exportName = tFeeService.findCtrlcorpid(fId);
+//        ExcelUtil<Detailed> util = new ExcelUtil<Detailed>(Detailed.class);
+//        return util.exportExcel(list, exportName);
+
+        List<CargoDetailsExcel> list = tFeeService.exportItems(fId);
+//        String exportName = tFeeService.findCtrlcorpid(fId);
+        String name = tFeeService.getNameByFId(fId);
+        ExcelUtil<CargoDetailsExcel> util = new ExcelUtil<>(CargoDetailsExcel.class);
+        return util.exportExcel(list, "付费" + name);
     }
 
 }

+ 47 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TPaymentController.java

@@ -1,5 +1,8 @@
 package com.ruoyi.web.controller.warehouse.finance;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.common.annotation.DataScope;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.annotation.RepeatSubmit;
@@ -13,10 +16,14 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.finance.domain.TFee;
+import com.ruoyi.finance.domain.TFeeDo;
 import com.ruoyi.finance.domain.TWareHouseFees;
 import com.ruoyi.finance.excel.Payment;
 import com.ruoyi.finance.service.ITFeeService;
 import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
+import com.ruoyi.warehouseBusiness.service.impl.TWarehouseBillsServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -63,6 +70,7 @@ public class TPaymentController extends BaseController {
             tFee.setfBilltype("FF");
         }
         List<Payment> list = tFeeService.paymentExport(tFee);
+//        List<TFee> list = tFeeService.selectTFeeList(tFee);
         ExcelUtil<Payment> util = new ExcelUtil<Payment>(Payment.class);
         return util.exportExcel(list, "付费");
     }
@@ -139,6 +147,14 @@ public class TPaymentController extends BaseController {
         return getDataTable(list);
     }
 
+
+    @PreAuthorize("@ss.hasPermi('finance:payment:list')")
+    @GetMapping("/payDataList")
+    public TableDataInfo payDataList(TWareHouseFees tWareHouseFees) {
+        List<Map<String, Object>> list = tFeeService.payDataList(tWareHouseFees);
+        return getDataTable(list);
+    }
+
     /**
      *   确认付费
      */
@@ -157,6 +173,25 @@ public class TPaymentController extends BaseController {
         return tFeeService.confirm(tFee,tFeeDo,loginUser,billsType);
     }
 
+
+    /**
+     *   确认付费
+     */
+    @PreAuthorize("@ss.hasPermi('finance:payment:add')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/confirmPayment")
+    @RepeatSubmit
+    public AjaxResult confirmPayment(@RequestParam("tFee") String tFee, @RequestParam("tFeeDo") String tFeeDo) {
+
+        TFee tfee = JSONArray.parseObject(tFee, TFee.class);
+
+        JSONArray jsonDrArray = JSONArray.parseArray(tFeeDo);
+        List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.confirmPayment(tfee, tFeeDoList,loginUser);
+    }
+
     /**
      *   撤销付费
      */
@@ -175,4 +210,16 @@ public class TPaymentController extends BaseController {
         return tFeeService.revoke(tFee,tFeeDo,loginUser,billsType);
     }
 
+    /**
+     * 查询财务数据主列表
+     */
+    @PreAuthorize("@ss.hasPermi('finance:payment:list')")
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/PayCharge/list")
+    public TableDataInfo PayChargeList(TFee tFee) {
+        startPage();
+        List<TFee> list = tFeeService.selectChargeList(tFee);
+        return getDataTable(list);
+    }
+
 }

+ 5 - 1
ruoyi-admin/src/main/resources/application-druid.yml

@@ -9,9 +9,13 @@ spring:
 #        url: jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
  #       url: jdbc:mysql://115.29.151.39:3306/sys?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
         #url: jdbc:mysql://124.70.179.5:3306/AnPingTest?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
-        url: jdbc:mysql://124.70.179.5:3306/AnPinJingYuan?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+#        正式环境
+        url: jdbc:mysql://123.60.138.20:3306/AnPinJingYuan?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+#        本地测试
+#        url: jdbc:mysql://localhost:3306/an_pin_test?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
         username: root
         password: daasan7ujm^YHN
+#        password: root
 
       # 从库数据源
       slave:

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java

@@ -188,4 +188,11 @@ public interface SysUserMapper {
      * @return  结果
      */
     public SysUser selectUserByPhonenumber(String phonenumber);
+
+    /**
+     * 查询所有用户下拉选
+     * @return
+     */
+    List<SysUser> getUserList();
+
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service;
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysUser;
 
 import java.util.List;
@@ -182,4 +183,11 @@ public interface ISysUserService {
      * 安品获取责任人
      */
     public List<Map<String, Object>>selectUserName(String type);
+
+    /**
+     * 查询所有用户下拉选
+     * @return
+     */
+    AjaxResult getUserList();
+
 }

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.common.annotation.DataScope;
 import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysRole;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.model.LoginBody;
@@ -458,6 +459,12 @@ public class SysUserServiceImpl implements ISysUserService {
         return userMapper.selectUserName(type);
     }
 
+    @Override
+    public AjaxResult getUserList() {
+        List<SysUser> userList = userMapper.getUserList();
+        return AjaxResult.success(userList);
+    }
+
     /**
      * 小程序授权小程序
      *

+ 3 - 0
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -307,5 +307,8 @@
 		<if test="roleName != null and roleName != '' and roleName == '库管' ">AND r.role_name in('入库','出库') </if>
 		<if test="roleName != null and roleName != '' and roleName != '库管' ">AND r.role_name = #{roleName}</if>
 	</select>
+	<select id="getUserList" resultMap="SysUserResult">
+		select * from sys_user
+	</select>
 
 </mapper> 

+ 78 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/approvalFlow/service/impl/AuditPathsServiceImpl.java

@@ -11,6 +11,8 @@ import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.finance.domain.TFee;
+import com.ruoyi.finance.domain.TFeeDo;
+import com.ruoyi.finance.mapper.TFeeDoMapper;
 import com.ruoyi.finance.mapper.TFeeMapper;
 import com.ruoyi.finance.service.impl.TFeeServiceImpl;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
@@ -31,6 +33,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
+import java.math.BigDecimal;
 import java.util.*;
 
 /**
@@ -84,6 +87,9 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
     private TFeeMapper tFeeMapper;
 
     @Autowired
+    private TFeeDoMapper tFeeDoMapper;
+
+    @Autowired
     private TWarehouseAgreementMapper tWarehouseAgreementMapper;
 
     /**
@@ -286,6 +292,9 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
         }else if (auditItems.getActId() == 560){
             List<Map<String, Object>> mapList = auditItemsMapper.selectWarehouseApprover(auditItems);
             return AjaxResult.success(mapList);
+        }else if (auditItems.getActId() == 570){
+            List<Map<String, Object>> mapList = auditItemsMapper.selectWarehouseApprover(auditItems);
+            return AjaxResult.success(mapList);
         }
 
         return AjaxResult.success();
@@ -556,6 +565,34 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                             return ajaxResult;
                         }
+                    } else if (auditItems.getActId()== 570 ) {// 财务管理-付费 审核通过
+                        // T 最后一级审批,执行操作
+                        if ("T".equals(at.getIffinalItem())) {
+
+                            Long fId = auditItems.getBillId();
+
+                            List<TFeeDo> tFeeDoList = tFeeDoMapper.getByFPid(fId);
+
+                            // 主表改为审核通过
+                            int i1 = tFeeMapper.setFAuditType(fId, 2);
+
+                            for (TFeeDo tFeeDo : tFeeDoList) {
+                                tFeeDo.setIsAudit(2);
+                                // 子表赋值
+                                int i = tFeeDoMapper.setFAmtById(tFeeDo);
+
+                                // 累加
+                                TWarehouseBills tWarehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(tFeeDo.getfSrcpid());
+                                BigDecimal bigDecimal = tWarehouseBills.getfStlamount();
+                                BigDecimal auditMoney = tFeeDo.getAuditMoney();
+                                BigDecimal add = bigDecimal.add(auditMoney);
+                                tFeeDo.setAuditMoney(add);
+                                // 仓库入库表赋值
+                                int y = tWarehouseBillsMapper.confirmPayment(tFeeDo);
+                            }
+                        }
+
+
                     }else if (auditItems.getActId() >= 520 && auditItems.getActId() <= 550) {
                         if ("T".equals(at.getIffinalItem())) {
                             fettle = 6L;
@@ -712,6 +749,21 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return ajaxResult;
             }
+        }else if (auditItems.getActId()== 570L ){//费用管理驳回
+            // 修改数据的审核状态
+
+            Long fId = auditItems.getBillId();
+
+            List<TFeeDo> tFeeDoList = tFeeDoMapper.getByFPid(fId);
+
+            // 主表改为
+            int i1 = tFeeMapper.setFAuditType(fId, 3);
+
+            for (TFeeDo tFeeDo : tFeeDoList) {
+                tFeeDo.setIsAudit(3);
+                // 子表赋值
+                int i = tFeeDoMapper.setFAmtById(tFeeDo);
+            }
         }else if (auditItems.getActId() >= 520 && auditItems.getActId() <= 550) {
             fettle = 3L;
             //变更入库审核状态
@@ -923,6 +975,32 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return ajaxResult;
             }
+        }else if (auditItems.getActId()== 570L ){//费用管理驳回
+            // 修改数据的审核状态
+
+            Long fId = auditItems.getBillId();
+            TFee tFee = tFeeMapper.selectTFeeById(fId);
+
+            List<TFeeDo> tFeeDoList = tFeeDoMapper.getByFPid(fId);
+
+            // 审核通过的话入库表费用相减
+            if (tFee.getfAuditType() == 2) {
+                for (TFeeDo tFeeDo : tFeeDoList) {
+                    BigDecimal fAmt = tFeeDo.getfAmt();
+                    Long fSrcpid = tFeeDo.getfSrcpid();
+                    int i = tWarehouseBillsMapper.revokeTheMoney(fAmt, fSrcpid);
+                }
+            }
+
+            // 主表改为
+            int i1 = tFeeMapper.setFAuditType(fId, 0);
+
+            for (TFeeDo tFeeDo : tFeeDoList) {
+                tFeeDo.setIsAudit(0);
+                // 撤销
+                int i = tFeeDoMapper.payQuash(tFeeDo.getfId());
+            }
+
         }
         AuditItems item = new AuditItems();
         item.setBillId(auditItems.getId());

+ 8 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java

@@ -154,4 +154,12 @@ public interface TCorpsMapper extends BaseMapper<TCorps> {
      * @return
      */
     public List<Map<String,Object>> getCorpName (TCorps tCorps);
+
+    /**
+     * 查询所有供应商
+     * @return 返回所有供应商
+     */
+    List<TCorps> getClient(@Param("fTypeid") String fTypeid);
+
+
 }

+ 6 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java

@@ -120,4 +120,10 @@ public interface ITCorpsService {
      * @return
      */
     public List<Map<String,Object>> getCorpName (TCorps tCorps);
+
+    /**
+     * 查询所有供应商
+     * @return 返回所有供应商
+     */
+    List<TCorps> getClient(String fTypeid);
 }

+ 9 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java

@@ -372,4 +372,13 @@ public class TCorpsServiceImpl implements ITCorpsService {
         return tCorpsMapper.getCorpName(tCorps);
     }
 
+    /**
+     * 查询所有供应商
+     * @return 返回所有供应商
+     */
+    @Override
+    public List<TCorps> getClient(String fTypeid) {
+        return tCorpsMapper.getClient(fTypeid);
+    }
+
 }

+ 111 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TFee.java

@@ -46,12 +46,99 @@ public class TFee extends BaseEntity {
     private Long fActId;
 
     /**
-     * 货权方/开票公司
+     * 货权方/开票公司/付款方id
      */
     @Excel(name = "货权方")
     private String fCtrlcorpid;
 
     /**
+     * 金额
+     */
+    private BigDecimal fMoney;
+
+    public BigDecimal getfMoney() {
+        return fMoney;
+    }
+
+    public void setfMoney(BigDecimal fMoney) {
+        this.fMoney = fMoney;
+    }
+
+    /**
+     * 打印次数
+     */
+    private Integer fNumberPrint;
+
+    /**
+     * 打印时间
+     */
+    private Date fPrintTime;
+
+    public Integer getfNumberPrint() {
+        return fNumberPrint;
+    }
+
+    public void setfNumberPrint(Integer fNumberPrint) {
+        this.fNumberPrint = fNumberPrint;
+    }
+
+    public Date getfPrintTime() {
+        return fPrintTime;
+    }
+
+    public void setfPrintTime(Date fPrintTime) {
+        this.fPrintTime = fPrintTime;
+    }
+
+    /**
+     * 货权方/开票公司/付款方id Long
+     */
+    private Long fCtrlcorpidLong;
+
+    /**
+     * 付费时间
+     */
+    private String fAccbilldateBegin;
+    private String fAccbilldateEnd;
+
+    public String getfAccbilldateBegin() {
+        return fAccbilldateBegin;
+    }
+
+    public void setfAccbilldateBegin(String fAccbilldateBegin) {
+        this.fAccbilldateBegin = fAccbilldateBegin;
+    }
+
+    public String getfAccbilldateEnd() {
+        return fAccbilldateEnd;
+    }
+
+    public void setfAccbilldateEnd(String fAccbilldateEnd) {
+        this.fAccbilldateEnd = fAccbilldateEnd;
+    }
+
+    public Long getfCtrlcorpidLong() {
+        return fCtrlcorpidLong;
+    }
+
+    public void setfCtrlcorpidLong(Long fCtrlcorpidLong) {
+        this.fCtrlcorpidLong = fCtrlcorpidLong;
+    }
+
+    /**
+     * 付款方idName
+     */
+    private String fCtrlcorpName;
+
+    public String getfCtrlcorpName() {
+        return fCtrlcorpName;
+    }
+
+    public void setfCtrlcorpName(String fCtrlcorpName) {
+        this.fCtrlcorpName = fCtrlcorpName;
+    }
+
+    /**
      * 客户单位(下拉模糊搜索)
      */
     @Excel(name = "结算单位(下拉模糊搜索)")
@@ -268,6 +355,29 @@ public class TFee extends BaseEntity {
      */
     private String ctrlCorPidFTax;
 
+    /**
+     * 审核状态
+     */
+    private Integer fAuditType;
+
+    private String fAuditTypeString;
+
+    public String getfAuditTypeString() {
+        return fAuditTypeString;
+    }
+
+    public void setfAuditTypeString(String fAuditTypeString) {
+        this.fAuditTypeString = fAuditTypeString;
+    }
+
+    public Integer getfAuditType() {
+        return fAuditType;
+    }
+
+    public void setfAuditType(Integer fAuditType) {
+        this.fAuditType = fAuditType;
+    }
+
     public String getCorPidFTax() {
         return corPidFTax;
     }

+ 52 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TFeeDo.java

@@ -169,6 +169,58 @@ public class TFeeDo extends BaseEntity {
      */
     private String feeUnitName;
 
+    /**
+     * 已付金额
+     */
+    private BigDecimal fStlamount;
+
+    /**
+     * 余额
+     */
+    private BigDecimal fMoney;
+
+    /**
+     * 确认付费审批金额
+     */
+    private BigDecimal auditMoney;
+
+    /**
+     * 是否审核
+     */
+    private Integer isAudit;
+
+    public Integer getIsAudit() {
+        return isAudit;
+    }
+
+    public void setIsAudit(Integer isAudit) {
+        this.isAudit = isAudit;
+    }
+
+    public BigDecimal getAuditMoney() {
+        return auditMoney;
+    }
+
+    public void setAuditMoney(BigDecimal auditMoney) {
+        this.auditMoney = auditMoney;
+    }
+
+    public BigDecimal getfMoney() {
+        return fMoney;
+    }
+
+    public void setfMoney(BigDecimal fMoney) {
+        this.fMoney = fMoney;
+    }
+
+    public BigDecimal getfStlamount() {
+        return fStlamount;
+    }
+
+    public void setfStlamount(BigDecimal fStlamount) {
+        this.fStlamount = fStlamount;
+    }
+
     public String getFeeUnitName() {
         return feeUnitName;
     }

+ 40 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TWareHouseFees.java

@@ -10,8 +10,22 @@ import java.util.List;
 public class TWareHouseFees extends BaseEntity {
 
     /**
+     * 接受值用
+     */
+    private String page;
+
+    public String getPage() {
+        return page;
+    }
+
+    public void setPage(String page) {
+        this.page = page;
+    }
+
+    /**
      * 客户名称,t_corps 中的no或 name,模糊查找选择后,存储id,显示name
      */
+    // 供应商
     @Excel(name = "客户名称,t_corps 中的no或 name,模糊查找选择后,存储id,显示name")
     private Long fCorpid;
 
@@ -122,6 +136,32 @@ public class TWareHouseFees extends BaseEntity {
      */
     private String fCtrlcorpid;
 
+    /**
+     * 账务日期起
+     */
+    private String fBsdateStart;
+
+    /**
+     * 账务日期止
+     */
+    private String fBsdateEnd;
+
+    public String getfBsdateStart() {
+        return fBsdateStart;
+    }
+
+    public void setfBsdateStart(String fBsdateStart) {
+        this.fBsdateStart = fBsdateStart;
+    }
+
+    public String getfBsdateEnd() {
+        return fBsdateEnd;
+    }
+
+    public void setfBsdateEnd(String fBsdateEnd) {
+        this.fBsdateEnd = fBsdateEnd;
+    }
+
     public String getfCtrlcorpid() {
         return fCtrlcorpid;
     }

+ 86 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/excel/CargoDetailsExcel.java

@@ -0,0 +1,86 @@
+package com.ruoyi.finance.excel;
+
+import com.ruoyi.common.annotation.Excel;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class CargoDetailsExcel {
+
+    @Excel(name = "来源编号")
+    private String fBillno;
+
+    @Excel(name = "业务日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date fBsdate;
+
+    @Excel(name = "供应商")
+    private String fName;
+
+    @Excel(name = "开票单位")
+    private String fSbuName;
+
+    @Excel(name = "余额")
+    private BigDecimal fMoney;
+
+    @Excel(name = "本次付费")
+    private BigDecimal fAmt;
+
+    @Excel(name = "备注")
+    private String remark;
+
+    public String getfBillno() {
+        return fBillno;
+    }
+
+    public void setfBillno(String fBillno) {
+        this.fBillno = fBillno;
+    }
+
+    public Date getfBsdate() {
+        return fBsdate;
+    }
+
+    public void setfBsdate(Date fBsdate) {
+        this.fBsdate = fBsdate;
+    }
+
+    public String getfName() {
+        return fName;
+    }
+
+    public void setfName(String fName) {
+        this.fName = fName;
+    }
+
+    public String getfSbuName() {
+        return fSbuName;
+    }
+
+    public void setfSbuName(String fSbuName) {
+        this.fSbuName = fSbuName;
+    }
+
+    public BigDecimal getfMoney() {
+        return fMoney;
+    }
+
+    public void setfMoney(BigDecimal fMoney) {
+        this.fMoney = fMoney;
+    }
+
+    public BigDecimal getfAmt() {
+        return fAmt;
+    }
+
+    public void setfAmt(BigDecimal fAmt) {
+        this.fAmt = fAmt;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+}

+ 63 - 127
ruoyi-warehouse/src/main/java/com/ruoyi/finance/excel/Payment.java

@@ -3,6 +3,7 @@ package com.ruoyi.finance.excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.annotation.Excel;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -14,169 +15,104 @@ import java.util.Date;
 public class Payment {
     private static final long serialVersionUID = 1L;
 
-    /**
-     * 结算单位
-     */
-    @Excel(name = "制单人")
-    private String createBy;
-
-
-    /**
-     * 系统编号
-     */
     @Excel(name = "系统编号")
     private String fBillno;
 
+    @Excel(name = "供应商")
+    private String fCorpidName;
 
-    /**
-     * 货权方
-     */
-    @Excel(name = "货权方")
-    private String fCtrlcorpid;
+    @Excel(name = "金额")
+    private BigDecimal fMoney;
 
-
-    /**
-     * 入(出)库日期
-     */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "账单日期", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date createTime;
+    @Excel(name = "出库起始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date fBsdateStart;
 
-    /**
-     * 入(出)库日期
-     */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "收费日期", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date fAccbilldate;
-
-
-    /**
-     * 提单号
-     */
-    @Excel(name = "提单号")
-    private String tMblno;
+    @Excel(name = "出库截止时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date fBsdateEnd;
 
-    /**
-     * 提单号
-     */
-    @Excel(name = "收费方式")
-    private String chargingMethod;
+    @Excel(name = "付费金额")
+    private BigDecimal fAmtcr;
 
+    @Excel(name = "付费公司")
+    private String fCtrlcorpName;
 
-    /**
-     * 提单号
-     */
-    @Excel(name = "发票号")
-    private String invoiceNo;
-
-    /**
-     * 提单号
-     */
-    @Excel(name = "收款银行")
+    @Excel(name = "付款银行")
     private String bank;
 
-    /**
-     * 提单号
-     */
-    @Excel(name = "水单号")
-    private String waterBillNo;
-
-
+    @Excel(name = "付款账号")
+    private String invoiceNo;
 
-    /**
-     * 金额
-     */
-    @Excel(name = "应付合计")
-    private Float fAmtdr;
+    @Excel(name = "制单人")
+    private String createBy;
 
-    /**
-     * 对账金额
-     */
-    @Excel(name = "实付合计")
-    private Float fAmtcr;
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date createTime;
 
-    /**
-     * 备注
-     */
     @Excel(name = "备注")
     private String fRemarks;
 
-    /**
-     * 状态
-     */
-    @Excel(name = "状态")
-    private String fBillstatus;
-
-    public String getChargingMethod() {
-        return chargingMethod;
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
     }
 
-    public void setChargingMethod(String chargingMethod) {
-        this.chargingMethod = chargingMethod;
+    public String getfBillno() {
+        return fBillno;
     }
 
-    public String getfBillstatus() {
-        return fBillstatus;
+    public void setfBillno(String fBillno) {
+        this.fBillno = fBillno;
     }
 
-    public void setfBillstatus(String fBillstatus) {
-        this.fBillstatus = fBillstatus;
+    public String getfCorpidName() {
+        return fCorpidName;
     }
 
-    public String getCreateBy() {
-        return createBy;
+    public void setfCorpidName(String fCorpidName) {
+        this.fCorpidName = fCorpidName;
     }
 
-    public void setCreateBy(String createBy) {
-        this.createBy = createBy;
+    public BigDecimal getfMoney() {
+        return fMoney;
     }
 
-    public String getfBillno() {
-        return fBillno;
+    public void setfMoney(BigDecimal fMoney) {
+        this.fMoney = fMoney;
     }
 
-    public void setfBillno(String fBillno) {
-        this.fBillno = fBillno;
+    public Date getfBsdateStart() {
+        return fBsdateStart;
     }
 
-    public String getfCtrlcorpid() {
-        return fCtrlcorpid;
+    public void setfBsdateStart(Date fBsdateStart) {
+        this.fBsdateStart = fBsdateStart;
     }
 
-    public void setfCtrlcorpid(String fCtrlcorpid) {
-        this.fCtrlcorpid = fCtrlcorpid;
+    public Date getfBsdateEnd() {
+        return fBsdateEnd;
     }
 
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public Date getfAccbilldate() {
-        return fAccbilldate;
+    public void setfBsdateEnd(Date fBsdateEnd) {
+        this.fBsdateEnd = fBsdateEnd;
     }
 
-    public void setfAccbilldate(Date fAccbilldate) {
-        this.fAccbilldate = fAccbilldate;
+    public BigDecimal getfAmtcr() {
+        return fAmtcr;
     }
 
-    public String gettMblno() {
-        return tMblno;
+    public void setfAmtcr(BigDecimal fAmtcr) {
+        this.fAmtcr = fAmtcr;
     }
 
-    public void settMblno(String tMblno) {
-        this.tMblno = tMblno;
-    }
 
-    public String getInvoiceNo() {
-        return invoiceNo;
+    public String getfCtrlcorpName() {
+        return fCtrlcorpName;
     }
 
-    public void setInvoiceNo(String invoiceNo) {
-        this.invoiceNo = invoiceNo;
+    public void setfCtrlcorpName(String fCtrlcorpName) {
+        this.fCtrlcorpName = fCtrlcorpName;
     }
 
     public String getBank() {
@@ -187,28 +123,28 @@ public class Payment {
         this.bank = bank;
     }
 
-    public String getWaterBillNo() {
-        return waterBillNo;
+    public String getInvoiceNo() {
+        return invoiceNo;
     }
 
-    public void setWaterBillNo(String waterBillNo) {
-        this.waterBillNo = waterBillNo;
+    public void setInvoiceNo(String invoiceNo) {
+        this.invoiceNo = invoiceNo;
     }
 
-    public Float getfAmtdr() {
-        return fAmtdr;
+    public String getCreateBy() {
+        return createBy;
     }
 
-    public void setfAmtdr(Float fAmtdr) {
-        this.fAmtdr = fAmtdr;
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
     }
 
-    public Float getfAmtcr() {
-        return fAmtcr;
+    public Date getCreateTime() {
+        return createTime;
     }
 
-    public void setfAmtcr(Float fAmtcr) {
-        this.fAmtcr = fAmtcr;
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
     }
 
     public String getfRemarks() {

+ 64 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/excel/TotalPaymentsExport.java

@@ -0,0 +1,64 @@
+package com.ruoyi.finance.excel;
+
+import com.ruoyi.common.annotation.Excel;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class TotalPaymentsExport {
+
+    @Excel(name = "日期", dateFormat = "yyyy-MM")
+    private Date fBsdate;
+
+    @Excel(name = "客户名称")
+    private String fCorpName;
+
+    @Excel(name = "应付")
+    private BigDecimal fMoney;
+
+    @Excel(name = "已付")
+    private BigDecimal fStlamount;
+
+    @Excel(name = "余额")
+    private BigDecimal balance;
+
+    public Date getfBsdate() {
+        return fBsdate;
+    }
+
+    public void setfBsdate(Date fBsdate) {
+        this.fBsdate = fBsdate;
+    }
+
+    public String getfCorpName() {
+        return fCorpName;
+    }
+
+    public void setfCorpName(String fCorpName) {
+        this.fCorpName = fCorpName;
+    }
+
+    public BigDecimal getfMoney() {
+        return fMoney;
+    }
+
+    public void setfMoney(BigDecimal fMoney) {
+        this.fMoney = fMoney;
+    }
+
+    public BigDecimal getfStlamount() {
+        return fStlamount;
+    }
+
+    public void setfStlamount(BigDecimal fStlamount) {
+        this.fStlamount = fStlamount;
+    }
+
+    public BigDecimal getBalance() {
+        return balance;
+    }
+
+    public void setBalance(BigDecimal balance) {
+        this.balance = balance;
+    }
+}

+ 39 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeDoMapper.java

@@ -1,8 +1,10 @@
 package com.ruoyi.finance.mapper;
 
 import com.ruoyi.finance.domain.TFeeDo;
+import com.ruoyi.finance.excel.CargoDetailsExcel;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -91,4 +93,41 @@ public interface TFeeDoMapper {
      * @return
      */
     int tFeeDoFollowUpdateDelFlag(@Param("fPid") Long fPid);
+
+    /**
+     * 确认付费 t_warehousebills表 f_stlamount 已付金额赋值
+     * @param getfStlamount
+     * @param getfBillno
+     */
+    void setFStlamount(@Param("getfStlamount") BigDecimal getfStlamount, @Param("getfBillno") String getfBillno);
+
+    void tombstones(Long fPid);
+
+    /**
+     * 根据父id查询list
+     * @param fId
+     * @return
+     */
+    List<TFeeDo> getByFPid(Long fId);
+
+    /**
+     * 本次金额付费
+     * @param tFeeDo
+     * @return
+     */
+    int setFAmtById(TFeeDo tFeeDo);
+
+    /**
+     * 审核状态改为0未审核
+     * @param getfId
+     * @return
+     */
+    int payQuash(Long getfId);
+
+    /**
+     * 根据id逻辑删除
+     * @param fId
+     * @return
+     */
+    int deleteByTFeeId(Long fId);
 }

+ 31 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeMapper.java

@@ -1,8 +1,10 @@
 package com.ruoyi.finance.mapper;
 
 import com.ruoyi.finance.domain.TFee;
+import com.ruoyi.finance.domain.TFeeDo;
 import com.ruoyi.finance.domain.TWareHouseFees;
 import com.ruoyi.finance.excel.Detailed;
+import com.ruoyi.finance.excel.Payment;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.warehouseBusiness.excel.TWareHouseExcelItem;
 import org.apache.ibatis.annotations.Param;
@@ -162,4 +164,33 @@ public interface TFeeMapper {
 
     List<Long> getProjectId(@Param("fId") Long fId);
 
+    /**
+     * 付费导出
+     * @param tFee
+     * @return
+     */
+    List<Payment> paymentExport(TFee tFee);
+
+    List<Map<String, Object>> payDataList(@Param("map") Map<String, Object> map);
+
+    /**
+     * 确认算费提交
+     * @param tFeeDo
+     * @return
+     */
+    int reviewTheAmountAssignment(TFeeDo tFeeDo);
+
+    /**
+     * 修改审核状态
+     * @param fId
+     * @return
+     */
+    int setFAuditType(@Param("fId") Long fId, @Param("fAuditType") Integer fAuditType);
+
+    /**
+     * 根据id查询供应商名
+     * @param fId
+     * @return
+     */
+    String getNameByFId(Long fId);
 }

+ 30 - 5
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeService.java

@@ -1,14 +1,11 @@
 package com.ruoyi.finance.service;
 
-import com.ruoyi.anpin.order.dto.Result;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.finance.domain.TFee;
+import com.ruoyi.finance.domain.TFeeDo;
 import com.ruoyi.finance.domain.TWareHouseFees;
-import com.ruoyi.finance.excel.Charge;
-import com.ruoyi.finance.excel.Contrast;
-import com.ruoyi.finance.excel.Detailed;
-import com.ruoyi.finance.excel.Payment;
+import com.ruoyi.finance.excel.*;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Payable;
 import com.ruoyi.reportManagement.excel.Profit;
@@ -16,6 +13,7 @@ import com.ruoyi.reportManagement.excel.Receivable;
 import com.ruoyi.shipping.domain.TAccount;
 import com.ruoyi.shipping.domain.TFeeInvoice;
 import com.ruoyi.shipping.excel.Account;
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.excel.TWareHouseExcelItem;
 
 import java.util.List;
@@ -280,4 +278,31 @@ public interface ITFeeService {
     public int updateTFeeFBillNo(TFee tFee);
 
 
+    List<TFee> selectChargeList(TFee tFee);
+
+    List<Map<String, Object>> payDataList(TWareHouseFees tWareHouseFees);
+
+    /**
+     * 付费详情导出
+     * @param fId
+     * @return
+     */
+    List<CargoDetailsExcel> exportItems(Long fId);
+
+    /**
+     * 确认付费
+     *
+     * @param tFee
+     * @param tFeeDoList
+     * @param loginUser
+     * @return
+     */
+    AjaxResult confirmPayment(TFee tFee, List<TFeeDo> tFeeDoList, LoginUser loginUser);
+
+    /**
+     * 根据fee id查询供应商名字
+     * @param fId
+     * @return
+     */
+    String getNameByFId(Long fId);
 }

+ 254 - 69
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -16,14 +16,12 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.finance.domain.TFee;
 import com.ruoyi.finance.domain.TFeeDo;
 import com.ruoyi.finance.domain.TWareHouseFees;
-import com.ruoyi.finance.excel.Charge;
-import com.ruoyi.finance.excel.Contrast;
-import com.ruoyi.finance.excel.Detailed;
-import com.ruoyi.finance.excel.Payment;
+import com.ruoyi.finance.excel.*;
 import com.ruoyi.finance.mapper.TFeeDoMapper;
 import com.ruoyi.finance.mapper.TFeeMapper;
 import com.ruoyi.finance.service.ITFeeService;
@@ -48,7 +46,6 @@ import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
 import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsfeesMapper;
 import com.ruoyi.warehouseBusiness.service.impl.BillnoSerialServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
@@ -56,10 +53,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.time.temporal.TemporalAccessor;
 import java.util.*;
 
 /**
@@ -70,6 +65,7 @@ import java.util.*;
  */
 @Service
 public class TFeeServiceImpl implements ITFeeService {
+
     @Autowired
     private TFeeMapper tFeeMapper;
 
@@ -121,10 +117,19 @@ public class TFeeServiceImpl implements ITFeeService {
         String feeName = null;
 
         TFee tFee = tFeeMapper.selectTFeeById(fId);
-        if (StringUtils.isNotNull(tFee.getfCorpid())) {
+
+        if (tFee != null) {
+            String fCtrlcorpid = tFee.getfCtrlcorpid();
+            if (fCtrlcorpid != null && !"".equals(fCtrlcorpid)) {
+                Long aLong = Long.valueOf(fCtrlcorpid);
+                tFee.setfCtrlcorpidLong(aLong);
+            }
+
+            if (StringUtils.isNotNull(tFee.getfCorpid())) {
+                corpsId.add(tFee.getfCorpid());
+            }
             corpsId.add(tFee.getfCorpid());
         }
-        corpsId.add(tFee.getfCorpid());
 
         // 查询从表数据
         TFeeDo tFeeDo = new TFeeDo();
@@ -142,76 +147,40 @@ public class TFeeServiceImpl implements ITFeeService {
                 if (tFees != null){
                     feeName = tFees.getfName();
                 }
-                // 费用表数据
-                TWarehousebillsfees tWarehousebillsfees = tWarehousebillsfeesMapper.selectTWarehousebillsfeesById(fees.getfSrcid());
-                if (tWarehousebillsfees == null) {
-                    return AjaxResult.error("费用数据为空,请确认");
-                }
                 // 字典宝
                 SysDictData sysDictData = new SysDictData();
                 sysDictData.setDictType("data_unitfees");
-                sysDictData.setDictValue(String.valueOf(tWarehousebillsfees.getfFeeunitid()));
                 sysDictData.setStatus("0");
                 List<SysDictData> sysDictDataList = iSysDictDataService.selectDictDataList(sysDictData);
 
-                List<SysDictData> sysDictDataListIn = new ArrayList<>();
-                SysDictData sysDictDataIn = new SysDictData();
-                if (tWarehousebillsfees.getfBilltype().equals("SJRK")) {
-                    sysDictData.setDictType("st_in_type");
-                    sysDictData.setDictValue(String.valueOf(tWarehousebillsfees.getfBusinessType()));
-                    sysDictData.setStatus("0");
-                    sysDictDataListIn = iSysDictDataService.selectDictDataList(sysDictData);
-                } else if (tWarehousebillsfees.getfBilltype().equals("SJCK")) {
-                    sysDictData.setDictType("st_out_type");
-                    sysDictData.setDictValue(String.valueOf(tWarehousebillsfees.getfBusinessType()));
-                    sysDictData.setStatus("0");
-                    sysDictDataListIn = iSysDictDataService.selectDictDataList(sysDictData);
-                } else if (tWarehousebillsfees.getfBilltype().equals("CKDB") | tWarehousebillsfees.getfBilltype().equals("HWTG")) {
-                    sysDictData.setDictType("st_trans_type");
-                    sysDictData.setDictValue(String.valueOf(tWarehousebillsfees.getfBusinessType()));
-                    sysDictData.setStatus("0");
-                    sysDictDataListIn = iSysDictDataService.selectDictDataList(sysDictData);
-                }
                 map1.put("fId", fees.getfId());
+                map1.put("fPId", fees.getfPid());
                 map1.put("fSrcid", fees.getfSrcid());
                 map1.put("fSrcpid", fees.getfSrcpid());
-                map1.put("fMblno", tWarehousebillsfees.getfMblno());
                 map1.put("fBscorpno", tWarehousebills.getfBscorpno());
-                map1.put("fProductName", tWarehousebillsfees.getfProductName());
-                map1.put("fBsdate", tWarehousebillsfees.getfBsdate());
+                Date fBsdate = tWarehousebills.getfBsdate();
+                SimpleDateFormat dataf = new SimpleDateFormat("yyyy-MM-dd");
+
+                map1.put("fBsdate",dataf.format(fBsdate));
+//                map1.put("fBsdate",tWarehousebillsfees.getfBsdate());
                 map1.put("fFeeid", fees.getfFeeid());
                 map1.put("fFeeName", feeName);
                 map1.put("fSrcdc", fees.getfSrcdc());
                 map1.put("fAmt", fees.getfAmt());
                 map1.put("fAmtdr", fees.getfAmtdr());
-                map1.put("fRemarks", fees.getfRemarks());
-                map1.put("srcBillNo", tWarehousebillsfees.getSrcId());
-                map1.put("fMarks", tWarehousebillsfees.getfMarks());
-                map1.put("fChargedate", tWarehousebillsfees.getfChargedate());
-                map1.put("fBillingDeadline", tWarehousebillsfees.getfBillingDeadline());
-                map1.put("fBillingDays", tWarehousebillsfees.getfBillingDays());
-                map1.put("fInventoryDays", tWarehousebillsfees.getfInventoryDays());
+//                map1.put("fRemarks", fees.getfRemarks());
+                map1.put("remark", fees.getfRemarks());
                 map1.put("fFeeunitid", sysDictDataList.get(0).getDictLabel());
-                map1.put("fQty", tWarehousebillsfees.getfQty());
-                map1.put("fUnitprice", tWarehousebillsfees.getfUnitprice());
-                if (tWarehousebillsfees.getfBilltype().equals("KHDD")) {
-                    map1.put("fBusinessType", "船运订单");
-                } else {
-                    map1.put("fBusinessType", sysDictDataListIn.get(0).getDictLabel());
-                }
-                if (tWarehousebills.getfBilltype().equals("SJRK")) {
-                    map1.put("fBilltype", "入库");
-                } else if (tWarehousebills.getfBilltype().equals("SJCK")) {
-                    map1.put("fBilltype", "出库");
-                } else if (tWarehousebills.getfBilltype().equals("CKDB")) {
-                    map1.put("fBilltype", "调拨");
-                } else if (tWarehousebills.getfBilltype().equals("HWTG")) {
-                    map1.put("fBilltype", "货物通关");
-                } else if (tWarehousebills.getfBilltype().equals("HQZY")) {
-                    map1.put("fBilltype", "货权转移");
-                } else if (tWarehousebills.getfBilltype().equals("KHDD")) {
-                    map1.put("fBilltype", "船运订单");
-                }
+
+
+                map1.put("fBillno", tWarehousebills.getfBillno());
+                map1.put("fName", tWarehousebills.getCorpName());
+                map1.put("fSbuName", tWarehousebills.getFsbuName());
+                map1.put("fMoney", fees.getfMoney());
+                map1.put("fStlamount", fees.getfStlamount());
+                map1.put("fAmtBlc", fees.getfAmtBlc());
+                map1.put("isAudit", fees.getIsAudit());
+
                 feeDoList.add(map1);
             }
         }
@@ -337,8 +306,12 @@ public class TFeeServiceImpl implements ITFeeService {
     @Transactional
     public AjaxResult insertTFeeTFeeDo(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype) {
         Long fPid = null;
+        // 导入数据记录来源单号
         Map<String, Object> map = new HashMap<>();
         TFee tFee = JSONArray.parseObject(tfee, TFee.class);
+
+        tFee.setfCtrlcorpid(tFee.getfCtrlcorpidLong().toString());
+
         if (StringUtils.isNull(tFee.getfId())) {
             // 如果是新数据
             tFee.setCreateBy(loginUser.getUser().getUserName());
@@ -358,13 +331,15 @@ public class TFeeServiceImpl implements ITFeeService {
             tFee.setUpdateTime(new Date());
             tFeeMapper.updateTFee(tFee);
             // 删除从表
-            tFeeDoMapper.deleteByFPid(fPid);
+//            tFeeDoMapper.deleteByFPid(fPid);
+            tFeeDoMapper.tombstones(fPid);
         }
         //  财务从表
         if (StringUtils.isNotNull(tfeeDo)) {
             JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
             List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
             for (TFeeDo tFeeDo : tFeeDoList) {
+                tFeeDo.setfRemarks(tFeeDo.getRemark());
                 tFeeDo.setfPid(fPid);
                 tFeeDo.setCreateBy(loginUser.getUser().getUserName());
                 tFeeDo.setCreateTime(new Date());
@@ -571,6 +546,7 @@ public class TFeeServiceImpl implements ITFeeService {
     }
 
     @Override
+    @Transactional
     public int deleteTFeeByIds(Long[] fIds) {
         // 取出业务编号、 放入 billno_del
         for (Long id : fIds) {
@@ -586,8 +562,24 @@ public class TFeeServiceImpl implements ITFeeService {
                 fee.setfMake(0);
                 int updateTFee = tFeeMapper.updateTFee(fee);
             }
+
+            int i = tFeeMapper.tFeeUpdateDelFlag(id);
+            if (i != 1) {
+                return i;
+            }
+            List<TFeeDo> tFeeDoList = tFeeDoMapper.selectTFeeDoByfPid(id);
+
+            for (TFeeDo tFeeDo : tFeeDoList) {
+                int y = tFeeDoMapper.deleteByTFeeId(tFeeDo.getfId());
+
+                if (y != 1) {
+                    return i;
+                }
+            }
+
         }
-        return tFeeMapper.deleteTFeeByIds(fIds);
+//        return tFeeMapper.deleteTFeeByIds(fIds);
+        return 1;
     }
 
     /**
@@ -610,9 +602,25 @@ public class TFeeServiceImpl implements ITFeeService {
 
     @Override
     public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees, String billsType) {
+
+        // 服务日期起
+        String dateStart = tWareHouseFees.getfBsdateStart();
+        // 服务日期止
+        String dateEnd = tWareHouseFees.getfBsdateEnd();
+
+        if (dateStart != null && !"".equals(dateStart)) {
+            dateStart += "  00:00:00";
+        }
+
+        if (dateEnd != null && !"".equals(dateEnd)) {
+            dateEnd += "  23:59:59";
+        }
+
         List<Map<String, Object>> maps = new ArrayList<Map<String, Object>>();
         Map<String, Object> map = new HashMap<>();
         map.put("tWareHouseFees", tWareHouseFees);
+        map.put("fBsdateStart", dateStart);
+        map.put("fBsdateEnd", dateEnd);
         List<Map<String, Object>> mapList = new ArrayList<>();
         if (billsType.equals("DZ")
                 || billsType.equals("SF")
@@ -633,6 +641,12 @@ public class TFeeServiceImpl implements ITFeeService {
 
             }*/
         }
+        if (mapList != null) {
+            for (Map<String, Object> objectMap : mapList) {
+                objectMap.put("fStlamount", objectMap.get("fMoney"));
+            }
+        }
+
         return mapList;
     }
 
@@ -748,7 +762,6 @@ public class TFeeServiceImpl implements ITFeeService {
                 tFeeDo.setCreateBy(loginUser.getUser().getUserName());
                 tFeeDo.setCreateTime(new Date());
                 tFeeDo.setfStatus(billstatus);
-                tFeeDoMapper.insertTFeeDo(tFeeDo);
             }
         }
         // 这里加个判断取系统参数来确定是否需要启用审批流
@@ -1285,9 +1298,11 @@ public class TFeeServiceImpl implements ITFeeService {
 
     @Override
     public List<Payment> paymentExport(TFee tFee) throws Exception {
-        List<Map<String, Object>> list = tFeeMapper.selectFeeList(tFee);
-        List<Payment> list1 = ListMapToBeanUtils.castMapToBean(list, Payment.class);
-        return list1;
+//        List<Map<String, Object>> list = tFeeMapper.selectFeeList(tFee);
+//        List<Payment> list1 = ListMapToBeanUtils.castMapToBean(list, Payment.class);
+//        List<TFee> tFees = tFeeMapper.selectTFeeList(tFee);
+
+        return tFeeMapper.paymentExport(tFee);
     }
 
     @Override
@@ -1661,6 +1676,176 @@ public class TFeeServiceImpl implements ITFeeService {
     }
 
     @Override
+    public List<TFee> selectChargeList(TFee tFee) {
+
+//        return tFeeMapper.selectChargeList(tFee);
+        return null;
+    }
+
+    @Override
+    public List<Map<String, Object>> payDataList(TWareHouseFees tWareHouseFees) {
+        // 服务日期起
+        String dateStart = tWareHouseFees.getfBsdateStart();
+        // 服务日期止
+        String dateEnd = tWareHouseFees.getfBsdateEnd();
+
+        if (dateStart != null && !"".equals(dateStart)) {
+            dateStart += "  00:00:00";
+        }
+
+        if (dateEnd != null && !"".equals(dateEnd)) {
+            dateEnd += "  23:59:59";
+        }
+
+        List<Map<String, Object>> maps = new ArrayList<Map<String, Object>>();
+        Map<String, Object> map = new HashMap<>();
+        map.put("tWareHouseFees", tWareHouseFees);
+        map.put("fBsdateStart", dateStart);
+        map.put("fBsdateEnd", dateEnd);
+        List<Map<String, Object>> mapList = new ArrayList<>();
+
+            mapList = tFeeMapper.payDataList(map);
+
+        if (mapList != null) {
+            for (Map<String, Object> objectMap : mapList) {
+//                objectMap.put("fStlamount", objectMap.get("fMoney"));
+//
+                String fMoney = objectMap.get("fMoney").toString();
+                String fStlamount = objectMap.get("fStlamount").toString();
+                BigDecimal fMoneyB = new BigDecimal(fMoney);
+                BigDecimal fStlamountB = new BigDecimal(fStlamount);
+                BigDecimal subtract = fMoneyB.subtract(fStlamountB);
+                objectMap.put("fMoney", subtract);
+            }
+        }
+
+        return mapList;
+
+    }
+
+    /**
+     * 付费详情导出
+     * @param fId
+     * @return
+     */
+    @Override
+    public List<CargoDetailsExcel> exportItems(Long fId) {
+
+        List<CargoDetailsExcel> cargoDetailsExcels = new ArrayList<>();
+
+        // 费用
+        List<Long> feesId = new ArrayList<>();
+        //费用名称
+        String feeName = null;
+
+        // 查询从表数据
+        TFeeDo tFeeDo = new TFeeDo();
+        tFeeDo.setfPid(fId);
+        List<TFeeDo> tFeeDoList = tFeeDoMapper.selectTFeeDoList(tFeeDo);
+        if (StringUtils.isNotEmpty(tFeeDoList)) {
+            for (TFeeDo fees : tFeeDoList) {
+                CargoDetailsExcel excel = new CargoDetailsExcel();
+                feesId.add(fees.getfFeeid());
+                // 查询主表
+                TWarehouseBills tWarehousebills = tWarehouseBillsMapper.selectTWarehousebillsById(fees.getfSrcpid());
+                // 费用名称
+                TFees tFees = tFeesMapper.selectTFeesById(fees.getfFeeid());
+                if (tFees != null){
+                    feeName = tFees.getfName();
+                }
+                // 字典宝
+                SysDictData sysDictData = new SysDictData();
+                sysDictData.setDictType("data_unitfees");
+                sysDictData.setStatus("0");
+
+                excel.setfBillno(tWarehousebills.getfBillno());
+                excel.setfBsdate(tWarehousebills.getfBsdate());
+                excel.setfName(tWarehousebills.getCorpName());
+                excel.setfSbuName(tWarehousebills.getFsbuName());
+                excel.setfMoney(fees.getfAmtBlc());
+                excel.setfAmt(fees.getfAmt());
+                excel.setRemark(fees.getfRemarks());
+
+                cargoDetailsExcels.add(excel);
+            }
+        }
+        return cargoDetailsExcels;
+    }
+
+    /**
+     * 确认付费
+     *
+     * @param tFee
+     * @param tFeeDoList
+     * @param loginUser
+     * @return
+     */
+    @Override
+    @Transactional
+    public AjaxResult confirmPayment(TFee tFee, List<TFeeDo> tFeeDoList, LoginUser loginUser) {
+
+        for (TFeeDo tFeeDo : tFeeDoList) {
+
+            if (tFeeDo.getfPid() == null) {
+                return AjaxResult.error("请先保存数据");
+            }
+        }
+
+
+        // 提交审批流
+        AuditItems auditItems = new AuditItems();
+        auditItems.setLevelId(0L);
+        // 业务id
+        auditItems.setBillId(tFee.getfId());
+        // 活动号
+        auditItems.setActId(570L);
+        auditItems.setIffinalItem("F");
+        // 业务编号
+        auditItems.setBillNo(tFee.getfBillno());
+        // 存储委托方(货权方)
+        auditItems.setRefno1(tFee.getfCorpid() + "");
+        // 存储业务类型(业务类型)
+        auditItems.setRefno2(tFee.getfBilltype());
+        // 存储提单号(提单号)
+        auditItems.setRefno3(tFee.getfBillno());
+        auditItems.setSendUserId(loginUser.getUser().getUserId());
+        auditItems.setSendName(SecurityUtils.getUsername());
+        auditItems.setSendTime(new Date());
+        auditItems.setAuditUserId(loginUser.getUser().getUserId());
+        auditItems.setAuditItem(new Date());
+        auditItems.setAuditOpTime(new Date());
+        auditItems.setAuditMsg("提交");
+        auditItems.setAuditStatus("O");
+        AjaxResult approvalFlow = auditItemsService.createApprovalFlow(auditItems);
+        String code = approvalFlow.get("code").toString();
+        if ("500".equals(code)) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+        }
+
+        // fee表中审核状态改为审核中
+        int i = tFeeMapper.setFAuditType(tFee.getfId(), 1);
+        if (i != 1) {
+            return AjaxResult.error();
+        }
+
+        for (TFeeDo tFeeDo : tFeeDoList) {
+//            int i = tWarehouseBillsMapper.confirmPayment(tFeeDo);
+            // 算费金额存储到临时字段并且修改为审核中1
+            int y = tFeeMapper.reviewTheAmountAssignment(tFeeDo);
+            if (y != 1) {
+                return AjaxResult.error();
+            }
+        }
+
+        return AjaxResult.success();
+    }
+
+    @Override
+    public String getNameByFId(Long fId) {
+        return tFeeMapper.getNameByFId(fId);
+    }
+
+    @Override
     @Transactional
     public AjaxResult webVersionApplyFP(TFee tFee, LoginUser loginUser, String fBilltype, TFeeInvoice tFeeInvoice) {
         Long fPid = null;

+ 35 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java

@@ -84,6 +84,19 @@ public class TWarehouseBills extends BaseEntity {
     private Long fCorpid;
 
     /**
+     * 客户名称name
+     */
+    private String fCorpName;
+
+    public String getfCorpName() {
+        return fCorpName;
+    }
+
+    public void setfCorpName(String fCorpName) {
+        this.fCorpName = fCorpName;
+    }
+
+    /**
      * 货转客户名称,t_corps 中的no或 name,模糊查找选择后,存储id,显示name,自有在货权转移是该字段有效
      */
     @Excel(name = "货转客户名称,t_corps 中的no或 name,模糊查找选择后,存储id,显示name,自有在货权转移是该字段有效")
@@ -648,6 +661,28 @@ public class TWarehouseBills extends BaseEntity {
 
     private String fWarehouseidName;
 
+    // 已付金额
+    private BigDecimal fStlamount;
+
+    // 余额
+    private BigDecimal balance;
+
+    public BigDecimal getBalance() {
+        return balance;
+    }
+
+    public void setBalance(BigDecimal balance) {
+        this.balance = balance;
+    }
+
+    public BigDecimal getfStlamount() {
+        return fStlamount;
+    }
+
+    public void setfStlamount(BigDecimal fStlamount) {
+        this.fStlamount = fStlamount;
+    }
+
     public String getfWarehouseidName() {
         return fWarehouseidName;
     }

+ 32 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java

@@ -6,6 +6,8 @@ import com.ruoyi.anpin.MarketOut;
 import com.ruoyi.anpin.WarehouseIn;
 import com.ruoyi.anpin.WarhousrExcel;
 import com.ruoyi.common.core.domain.entity.TWarehouse;
+import com.ruoyi.finance.domain.TFeeDo;
+import com.ruoyi.finance.excel.TotalPaymentsExport;
 import com.ruoyi.reportManagement.domain.SingleAnalysisExcel;
 import com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
@@ -16,6 +18,7 @@ import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import org.apache.ibatis.annotations.Param;
 
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -271,4 +274,33 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
     List<Map<String,Object>> statisticsNew (TWarehouseBills tWarehousebills);
 
     List<TWarehouseBillOutboundExcel> getTWarehouseBillOutboundExcel(TWarehouseBills tWarehousebills);
+
+    /**
+     * 确认付费
+     * @param tFeeDo
+     * @return
+     */
+    int confirmPayment(TFeeDo tFeeDo);
+
+    /**
+     * 应收总账查询
+     * @param condition
+     * @return
+     */
+    List<TWarehouseBills> getTotalPayments(Map<String, String> condition);
+
+    /**
+     * 应收总账查询导出
+     * @param condition
+     * @return
+     */
+    List<TotalPaymentsExport> getTotalPaymentsExcel(Map<String, String> condition);
+
+    /**
+     * 撤销审批通过的付费
+     * @param fAmt
+     * @param fBillno
+     * @return
+     */
+    int revokeTheMoney(@Param("fAmt") BigDecimal fAmt, @Param("fSrcpid") Long fSrcpid);
 }

+ 16 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -3,6 +3,8 @@ package com.ruoyi.warehouseBusiness.service;
 import com.ruoyi.anpin.*;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.excel.TotalPaymentsExport;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
 import com.ruoyi.warehouseBusiness.domain.*;
 import com.ruoyi.warehouseBusiness.excel.*;
@@ -563,4 +565,18 @@ public interface ITWarehouseBillsService {
     List<Map<String,Object>> statisticsNew (TWarehouseBills tWarehousebills);
 
     List<TWarehouseBillOutboundExcel> getTWarehouseBillOutboundExcel(TWarehouseBills tWarehousebills);
+
+    /**
+     * 应收总账查询
+     * @param condition
+     * @return
+     */
+    List<TWarehouseBills> getTotalPayments(Map<String, String> condition);
+
+    /**
+     * 应收总账查询导出
+     * @param condition
+     * @return
+     */
+    List<TotalPaymentsExport> getTotalPaymentsExcel(Map<String, String> condition);
 }

+ 76 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -26,6 +26,7 @@ import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.excel.TotalPaymentsExport;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
@@ -1920,7 +1921,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 return AjaxResult.error("更新库存总账失败");
             }
         }
-        if (isApprove) {
+        if (isApprove) { // 创建审批流
             AuditItems auditItems = new AuditItems();
             auditItems.setLevelId(0L);
             auditItems.setBillId(fPid);
@@ -2175,7 +2176,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 
     @Override
     public List<InventoryLedgerExcel> selectInventoryLedger(TWarehouseBills tWarehouseBills) {
-        return tWarehousebillsfeesMapper.selectInventoryLedger(tWarehouseBills);
+        List<InventoryLedgerExcel> inventoryLedgerExcels = tWarehousebillsfeesMapper.selectInventoryLedger(tWarehouseBills);
+        return inventoryLedgerExcels;
     }
 
     @Override
@@ -2320,6 +2322,78 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     }
 
     /**
+     * 应收总账查询
+     * @param condition
+     * @return
+     */
+    @Override
+    public List<TWarehouseBills> getTotalPayments(Map<String, String> condition) {
+
+        String shippingDateBegin = condition.get("shippingDateBegin");
+        String shippingDateEnd = condition.get("shippingDateEnd");
+
+        if (shippingDateBegin != null && !"".equals(shippingDateBegin)) {
+            shippingDateBegin += " 00:00:00";
+            shippingDateEnd += " 23:59:59";
+            condition.put("shippingDateBegin", shippingDateBegin);
+            condition.put("shippingDateEnd", shippingDateEnd);
+        }
+
+        List<TWarehouseBills> totalPaymentList = tWarehouseBillsMapper.getTotalPayments(condition);
+
+        for (int i = 0; i < totalPaymentList.size(); i++) {
+            BigDecimal fMoney = totalPaymentList.get(i).getfMoney();
+            BigDecimal fStlamount = totalPaymentList.get(i).getfStlamount();
+            BigDecimal balance = fMoney.subtract(fStlamount);
+            if (balance.compareTo(new BigDecimal("0")) < 1) {
+                totalPaymentList.remove(i);
+                continue;
+            }
+            totalPaymentList.get(i).setBalance(balance);
+
+        }
+
+
+        return totalPaymentList;
+    }
+
+    /**
+     * 应收总账查询导出
+     * @param condition
+     * @return
+     */
+    @Override
+    public List<TotalPaymentsExport> getTotalPaymentsExcel(Map<String, String> condition) {
+
+        String shippingDateBegin = condition.get("shippingDateBegin");
+        String shippingDateEnd = condition.get("shippingDateEnd");
+
+        if (shippingDateBegin != null && !"".equals(shippingDateBegin)) {
+            shippingDateBegin += " 00:00:00";
+            shippingDateEnd += " 23:59:59";
+            condition.put("shippingDateBegin", shippingDateBegin);
+            condition.put("shippingDateEnd", shippingDateEnd);
+        }
+
+        List<TotalPaymentsExport> totalPaymentList = tWarehouseBillsMapper.getTotalPaymentsExcel(condition);
+
+        for (int i = 0; i < totalPaymentList.size(); i++) {
+            BigDecimal fMoney = totalPaymentList.get(i).getfMoney();
+            BigDecimal fStlamount = totalPaymentList.get(i).getfStlamount();
+            BigDecimal balance = fMoney.subtract(fStlamount);
+            if (balance.compareTo(new BigDecimal("0")) < 1) {
+                totalPaymentList.remove(i);
+                continue;
+            }
+            totalPaymentList.get(i).setBalance(balance);
+
+        }
+
+
+        return totalPaymentList;
+    }
+
+    /**
      * app仓储新行提交业务
      *
      * @param item    仓库明细数据

+ 3 - 0
ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml

@@ -451,5 +451,8 @@
         <if test="fTypeid != null and fTypeid != '' and fTypeid == 3">and tc.f_typeid like concat('%', '203', '%')</if>
         <if test="fTypeid != null and fTypeid != '' and fTypeid == 4">and tc.f_typeid like concat('%', '204', '%')</if>
     </select>
+    <select id="getClient" resultType="com.ruoyi.basicData.domain.TCorps">
+        select f_id as fId, f_name as fName from t_corps WHERE f_typeid LIKE CONCAT('%',#{fTypeid},'%')
+    </select>
 
 </mapper>

+ 32 - 1
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeDoMapper.xml

@@ -25,15 +25,18 @@
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
         <result property="fRemarks" column="f_remarks"/>
+        <result property="auditMoney" column="audit_money"/>
+        <result property="isAudit" column="is_audit"/>
     </resultMap>
 
     <sql id="selectTFeeDoVo">
-        select f_id, f_pid, f_act_id, f_lineno, f_srcid, f_srclineno, f_srcpid, f_srcdc, f_feeid, f_amtdr, f_amt, f_status, del_flag, create_by, f_amt_stl, create_time, f_amt_blc, update_by, update_time, f_remarks from t_fee_do
+        select f_id, f_pid, f_act_id, f_lineno, f_srcid, f_srclineno, f_srcpid, f_srcdc, f_feeid, f_amtdr, f_amt, f_status, del_flag, create_by, f_amt_stl, create_time, f_amt_blc, update_by, update_time, f_remarks, audit_money, is_audit from t_fee_do
     </sql>
 
     <select id="selectTFeeDoList" parameterType="TFeeDo" resultMap="TFeeDoResult">
         <include refid="selectTFeeDoVo"/>
         <where>
+            and del_flag = 0
             <if test="fPid != null ">and f_pid = #{fPid}</if>
             <if test="fActId != null ">and f_act_id = #{fActId}</if>
             <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
@@ -200,6 +203,9 @@
     <delete id="deleteByFPid" parameterType="Long">
         delete from t_fee_do where f_pid = #{fId}
     </delete>
+    <update id="deleteByTFeeId">
+        update t_fee_do set del_flag = 1 where f_id = #{fId}
+    </update>
 
     <update id="tfeeDoFollowUpdate" parameterType="Long">
         update
@@ -215,6 +221,28 @@
         where
             f_pid = #{fPid}
     </update>
+    <update id="setFStlamount">
+        update
+            t_warehousebills
+                set
+            f_stlamount = #{getfStlamount}
+        where
+            f_billno = #{getfBillno}
+    </update>
+    <update id="tombstones">
+        update
+            t_fee_do
+        set
+            del_flag = 1
+        where
+            f_pid = #{fId}
+    </update>
+    <update id="setFAmtById">
+        update t_fee_do set f_amt = #{auditMoney}, is_audit = #{isAudit} where f_id = #{fId}
+    </update>
+    <update id="payQuash">
+        update t_fee_do set is_audit = 0 where f_id = #{fId}
+    </update>
     <select id="anPinSelectTFeeDoByfPid" parameterType="Long" resultMap="TFeeDoResult">
         SELECT
             td.f_id,
@@ -288,5 +316,8 @@
         where td.f_pid = #{fPid}
                 and td.del_flag = '0'
     </select>
+    <select id="getByFPid" resultMap="TFeeDoResult">
+        select * from t_fee_do where f_pid = #{fId} and del_flag = '0'
+    </select>
 
 </mapper>

+ 339 - 3
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -44,6 +44,10 @@
         <result property="fPdfunsignedurl"    column="f_pdfUnsignedUrl"    />
         <result property="fBsdateStart"    column="f_bsdate_start"    />
         <result property="fBsdateEnd"    column="f_bsdate_end"    />
+        <result property="fAuditType"    column="f_audit_type"    />
+        <result property="fAuditTypeString"    column="f_audit_type_string"    />
+        <result property="fNumberPrint"    column="f_number_print"    />
+        <result property="fPrintTime"    column="f_print_time"    />
     </resultMap>
 
     <sql id="selectTFeeVo">
@@ -85,10 +89,13 @@
                f_viewUrl,
                f_pdfUnsignedUrl,
                f_bsdate_start,
-               f_bsdate_end
+               f_bsdate_end,
+               f_audit_type
         from t_fee
     </sql>
 
+
+
     <select id="selectTFeeList" parameterType="TFee" resultMap="TFeeResult">
         select
         ware.f_id,
@@ -100,6 +107,10 @@
         ware.f_trans_act_id,
         ware.f_amtdr,
         ware.f_amtcr,
+        ware.f_bsdate_start,
+        ware.f_bsdate_end,
+        c.f_name AS fCorpidName,
+        cb.f_name as fCtrlcorpName,
         ware.f_billtype,
         CASE
         WHEN ware.f_billstatus = '1' THEN '保存'
@@ -110,6 +121,14 @@
         WHEN ware.f_billstatus = '6' THEN '审核完成'
         END
         AS f_billstatus,
+
+        case
+        when ware.f_audit_type = '0' then '未确认付费'
+        when ware.f_audit_type = '1' then '审批中'
+        when ware.f_audit_type = '2' then '审批完成'
+        when ware.f_audit_type = '3' then '审批驳回'
+            end
+        as f_audit_type_string,
         ware.f_remarks,
         ware.f_from_date,
         ware.f_to_date,
@@ -129,15 +148,24 @@
         from
         t_fee ware
         left join sys_user u on ware.create_by = u.user_name
+        LEFT JOIN t_corps AS c ON ware.f_corpid = c.f_id
+        LEFT JOIN t_corps AS cb ON ware.f_ctrlcorpid = cb.f_id
         left join sys_dept d on ware.f_deptid = d.dept_id
         LEFT JOIN sys_dict_data pro ON pro.dict_value = ware.charging_method and pro.dict_type = 'data_settlement_type'
         <where>
+            ware.del_flag = 0
             <if test="fBillno != null  and fBillno != ''">and ware.f_billno = #{fBillno}</if>
+            <if test="createBy != null  and createBy != ''">and ware.create_by = #{createBy}</if>
+            <if test="fAuditType != null">and ware.f_audit_type = #{fAuditType}</if>
             <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
             <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
             <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
             <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
             <if test="tMblno != null  and tMblno != ''">and t_mblno = #{tMblno}</if>
+
+            <if test="fAccbilldateBegin != null and fAccbilldateBegin != ''">
+                and ware.f_accbilldate between #{fAccbilldateBegin} and #{fAccbilldateEnd}
+            </if>
             <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
             <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
             <if test="fBilltype != null  and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
@@ -259,8 +287,52 @@
     </select>
 
     <select id="selectTFeeById" parameterType="Long" resultMap="TFeeResult">
-        <include refid="selectTFeeVo"/>
-        where f_id = #{fId}
+        select ware.f_id,
+               ware.f_billno,
+               ware.f_ctrlcorpid,
+               ware.f_number_print,
+               ware.f_print_time,
+               ware.f_act_id,
+               ware.f_corpid,
+               c.f_id AS fCorpid,
+               ware.t_mblno,
+               ware.f_trans_act_id,
+               ware.f_amtdr,
+               ware.f_amtcr,
+               ware.f_billtype,
+               ware.f_billstatus,
+               ware.f_remarks,
+               ware.f_from_date,
+               ware.f_to_date,
+               ware.f_accbilldate,
+               ware.f_ref_no,
+               ware.del_flag,
+               ware.create_by,
+               ware.f_deptid,
+               ware.create_time,
+               ware.update_by,
+               ware.update_time,
+               ware.charging_method,
+               ware.invoice_no,
+               ware.bank,
+               ware.water_bill_no,
+               ware.f_system_type,
+               ware.f_tracking_number,
+               ware.f_invoice_rise,
+               ware.f_sign,
+               ware.f_send_Time,
+               ware.f_apply_money,
+               ware.f_account_id,
+               ware.f_make,
+               ware.f_invoice_date,
+               ware.f_viewUrl,
+               ware.f_pdfUnsignedUrl,
+               ware.f_bsdate_start,
+               ware.f_bsdate_end,
+               ware.f_audit_type
+        from t_fee as ware
+        LEFT JOIN t_corps AS c ON ware.f_corpid = c.f_id
+        where ware.del_flag = 0 and ware.f_id = #{fId}
     </select>
     <select id="selectTFeeByIdNew" parameterType="Long" resultMap="TFeeResult">
         SELECT f.f_id,
@@ -514,6 +586,7 @@
         w.f_id AS fSrcid,
         t.f_id AS fSrcpid,
         t.f_corpid AS fCorpid,
+        t.f_money as fMoney,
         c.f_name AS fName,
         w.fId AS fId,
         w.fName AS fFeesName,
@@ -591,6 +664,9 @@
         LEFT JOIN t_fees f ON w.f_feeid = f.f_id
         LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = w.f_business_type
         <where>
+            <if test="map.fBsdateStart != null and map.fBsdateStart != '' and map.fBsdateEnd != null and map.fBsdateEnd != ''">
+                and t.f_bsdate  between #{map.fBsdateStart} and #{map.fBsdateEnd}
+            </if>
             <if test="map.tWareHouseFees.fCorpid != null  and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
                 #{map.tWareHouseFees.fCorpid}
             </if>
@@ -698,6 +774,7 @@
         w.f_id AS fSrcid,
         t.f_id AS fSrcpid,
         t.f_corpid AS fCorpid,
+        t.f_money as fMoney,
         c.f_name AS fName,
         w.fId AS fId,
         w.fName AS fFeesName,
@@ -792,6 +869,9 @@
         <where>
             dict.status = '0'
             AND dict.dict_type = 'data_unitfees'
+            <if test="map.fBsdateStart != null and map.fBsdateStart != '' and map.fBsdateEnd != null and map.fBsdateEnd != ''">
+                and t.f_bsdate  between #{map.fBsdateStart} and #{map.fBsdateEnd}
+            </if>
             <if test="map.tWareHouseFees.fCorpid != null  and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
                 #{map.tWareHouseFees.fCorpid}
             </if>
@@ -897,6 +977,7 @@
         SELECT
         w.f_id AS fSrcid,
         t.f_id AS fSrcpid,
+        t.f_money as fMoney,
         t.f_corpid AS fCorpid,
         c.f_name AS fName,
         w.fId AS fId,
@@ -990,6 +1071,9 @@
         <where>
             dict.status = '0'
             AND dict.dict_type = 'data_unitfees'
+            <if test="map.fBsdateStart != null and map.fBsdateStart != '' and map.fBsdateEnd != null and map.fBsdateEnd != ''">
+                and t.f_bsdate  between #{map.fBsdateStart} and #{map.fBsdateEnd}
+            </if>
             <if test="map.tWareHouseFees.fCorpid != null  and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
                 #{map.tWareHouseFees.fCorpid}
             </if>
@@ -1837,6 +1921,7 @@
     <select id="anPinFinanceCenter" resultType="java.util.Map">
         SELECT
         t.f_billno AS fBillno,
+        t.f_money as fMoney,
         t.f_goodsid AS fGoodsid ,
         tp.f_name AS projectName,
         tc.f_name AS fSbuName,
@@ -1969,6 +2054,9 @@
         LEFT JOIN t_corps AS tc ON tc.f_id = t.f_sbu
         <where>
             <if test="map.tWareHouseFees.fCtrlcorpid != null ">and tc.f_name = #{map.tWareHouseFees.fCtrlcorpid}</if>
+            <if test="map.fBsdateStart != null and map.fBsdateStart != '' and map.fBsdateEnd != null and map.fBsdateEnd != ''">
+                and t.f_bsdate  between #{map.fBsdateStart} and #{map.fBsdateEnd}
+            </if>
             <if test="map.tWareHouseFees.fCorpid != null  and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
                 #{map.tWareHouseFees.fCorpid}
             </if>
@@ -2511,6 +2599,12 @@
         </trim>
         where f_billno = #{fBillno}
     </update>
+    <update id="setFAuditType">
+        update t_fee set f_audit_type = #{fAuditType} where f_id = #{fId}
+    </update>
+    <update id="reviewTheAmountAssignment">
+        update t_fee_do set audit_money = #{fAmt}, is_audit = 1 where f_id = #{fId}
+    </update>
     <select id="getProjectId" parameterType="Long" resultType="Long">
         SELECT
             DISTINCT
@@ -2522,4 +2616,246 @@
         WHERE
             te.f_id = #{fId}
     </select>
+    <select id="selectChargeList" resultType="com.ruoyi.finance.domain.TFee">
+        select * from t_warehousebills
+            <where>
+                <if test="tFee.fCorpid != null and tFee.fCorpid != ''">f_corpid = #{fCorpid}</if>
+                <if test="tFee.fCorpid != null and tFee.fCorpid != ''">f_corpid = #{fCorpid}</if>
+                <if test="tFee.fCorpid != null and tFee.fCorpid != ''">f_corpid = #{fCorpid}</if>
+                <if test="tFee.fCorpid != null and tFee.fCorpid != ''">f_corpid = #{fCorpid}</if>
+            </where>
+    </select>
+
+    <select id="paymentExport" resultType="com.ruoyi.finance.excel.Payment">
+        select
+        ware.f_id,
+        ware.f_billno as fBillno,
+        ware.f_ctrlcorpid,
+        ware.f_act_id,
+        ware.f_corpid,
+        ware.t_mblno,
+        ware.f_trans_act_id,
+        ware.f_amtdr as fMoney,
+        ware.f_amtcr as fAmtcr,
+        ware.f_bsdate_start as fBsdateStart,
+        ware.f_bsdate_end as fBsdateEnd,
+        c.f_name AS fCorpidName,
+        cb.f_name as fCtrlcorpName,
+        ware.f_billtype,
+        CASE
+        WHEN ware.f_billstatus = '1' THEN '保存'
+        WHEN ware.f_billstatus = '2' THEN '暂存'
+        WHEN ware.f_billstatus = '3' THEN '审批驳回'
+        WHEN ware.f_billstatus = '4' THEN '提交审核'
+        WHEN ware.f_billstatus = '5' THEN '审核中'
+        WHEN ware.f_billstatus = '6' THEN '审核完成'
+        END
+        AS f_billstatus,
+
+        case
+        when ware.f_audit_type = '0' then '未确认付费'
+        when ware.f_audit_type = '1' then '审批中'
+        when ware.f_audit_type = '2' then '审批完成'
+        when ware.f_audit_type = '3' then '审批驳回'
+        end
+        as f_audit_type_string,
+        ware.f_remarks as fRemarks,
+        ware.f_from_date,
+        ware.f_to_date,
+        ware.f_accbilldate,
+        ware.f_ref_no,
+        ware.del_flag,
+        ware.create_by as createBy,
+        ware.f_deptid,
+        ware.create_time as createTime,
+        ware.update_by,
+        ware.update_time,
+        pro.dict_label AS charging_method,
+        ware.invoice_no as invoiceNo,
+        ware.bank,
+        ware.water_bill_no,
+        ware.f_system_type
+        from
+        t_fee ware
+        left join sys_user u on ware.create_by = u.user_name
+        LEFT JOIN t_corps AS c ON ware.f_corpid = c.f_id
+        LEFT JOIN t_corps AS cb ON ware.f_ctrlcorpid = cb.f_id
+        left join sys_dept d on ware.f_deptid = d.dept_id
+        LEFT JOIN sys_dict_data pro ON pro.dict_value = ware.charging_method and pro.dict_type = 'data_settlement_type'
+        <where>
+            ware.del_flag = 0
+            <if test="fBillno != null  and fBillno != ''">and ware.f_billno = #{fBillno}</if>
+            <if test="createBy != null  and createBy != ''">and ware.create_by = #{createBy}</if>
+            <if test="fAuditType != null">and ware.f_audit_type = #{fAuditType}</if>
+            <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
+            <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
+            <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
+            <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
+            <if test="tMblno != null  and tMblno != ''">and t_mblno = #{tMblno}</if>
+
+            <if test="fAccbilldateBegin != null and fAccbilldateBegin != ''">
+                and ware.f_accbilldate between #{fAccbilldateBegin} and #{fAccbilldateEnd}
+            </if>
+            <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
+            <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
+            <if test="fBilltype != null  and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
+            <if test="fBillstatus != null  and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
+            <if test="fRemarks != null  and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%') </if>
+            <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
+            <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
+            <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
+            <if test="fRefNo != null  and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
+            <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
+            <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
+                and ware.f_accbilldate &gt;= #{timeInterval[0]}
+            </if>
+            <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
+                and ware.f_accbilldate &lt;= #{timeInterval[1]}
+            </if>
+            <if test='amount != null and amount[0] != null and amount[0]!= ""'>
+                and ware.f_amtdr &gt;= #{amount[0]}
+            </if>
+            <if test='amount != null and amount[1] != null and amount[1]!= ""'>
+                and ware.f_amtdr &lt;= #{amount[1]}
+            </if>
+            <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
+            <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
+            <if test="bank != null ">and ware.bank = #{bank}</if>
+            <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
+            <if test="fSystemType != null and fSystemType != ''">and ware.f_system_type = #{fSystemType}</if>
+        </where>
+        ORDER BY ware.create_time desc
+        ${params.dataScope}
+    </select>
+    <select id="payDataList" resultType="java.util.Map">
+        SELECT DISTINCT
+        tw.f_id,
+        tw.f_stlamount fStlamount,
+        tw.f_id AS fSrcpid,
+        tw.f_billno fBillno,
+        tw.f_customsdeclartion,
+        tw.f_originalbillno,
+        tw.f_deptid,
+        tw.f_bsdeptid,
+        tw.f_contacts,
+        tw.f_tel,
+        tw.f_corpid,
+        tc.f_name AS fName,
+        tw.f_tocorpid,
+        tw.f_stltypeid,
+        tw.f_bscorpno,
+        tw.f_warehouseid,
+        tw.f_storekeeper,
+        tw.f_chargedate,
+        tw.f_bsdate fBsdate,
+        tw.f_planqty,
+        tw.f_plangrossweight,
+        tw.f_plannetweight,
+        tw.f_planvolumn,
+        tw.f_qty,
+        tw.f_grossweight,
+        tw.f_netweight,
+        tw.f_volumn,
+        tw.f_billingway,
+        tw.f_trademodeid,
+        tw.f_sbu,
+        tw.f_feetunit,
+        tw.f_mblno,
+        tw.f_marks,
+        tw.f_vslvoy,
+        tw.f_eta,
+        tw.f_customno,
+        tw.f_ifweigh,
+        tw.f_ifpledge,
+        tw.f_ifdamage,
+        tw.f_bankcorpid,
+        tw.f_billtype,
+        tw.f_billstatus,
+        tw.f_items_status,
+        tw.del_flag,
+        tw.create_by,
+        tw.create_time,
+        tw.update_by,
+        tw.update_time,
+        tw.remark,
+        tw.f_billing_deadline,
+        tw.f_product_name,
+        tw.f_review_date,
+        tw.f_truckno,
+        tw.f_driver_name,
+        tw.f_driver_tel,
+        tw.f_driver_id_car,
+        tw.f_business_type,
+        tw.f_labour,
+        tw.f_fleet,
+        tw.f_inwarehouseid,
+        tw.f_bstime,
+        tw.f_cartype,
+        tw.f_goodsid,
+        tp.f_name AS projectName,
+        tw.f_new_trademodeid,
+        tw.f_loadportid,
+        tw.f_destportid,
+        tw.f_serviceitems,
+        tw.f_invoceobj,
+        tw.f_sign,
+        tw.f_detentioncargo,
+        tw.f_booksmarks,
+        tw.f_shippername,
+        tw.f_shipperattn,
+        tw.f_shippertel,
+        tw.f_consigneername,
+        tw.f_consigneeattn,
+        tw.f_consigneetel,
+        tw.f_insurance,
+        tw.f_insuranceamt,
+        tw.f_closedate,
+        tw.f_docmentdate,
+        tw.f_vslid,
+        tw.f_voyid,
+        tw.f_typeid,
+        tw.f_paymode,
+        tw.f_laneid,
+        tw.f_cntval,
+        tw.f_date_changed,
+        tw.f_market_number,
+        tw.f_money fMoney,
+        tw.f_teachers_weight,
+        tw.f_students_weight,
+        th.f_name AS fWarehouseName,
+        tw.f_market_typid,
+        tw.f_purchase,
+        tr.f_name AS fSbuName,
+        tw.f_create_log,
+        tw.f_print_log,
+        tw.f_print,
+        tw.f_take_orders,
+        tw.f_reason
+        FROM
+        t_warehousebills tw
+        LEFT JOIN t_project tp ON tw.f_goodsid = tp.f_id
+        LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
+        LEFT JOIN t_corps tr ON tr.f_id = tw.f_sbu
+        LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
+        <where>
+            <if test="map.fBsdateStart != null and map.fBsdateStart != '' and map.fBsdateEnd != null and map.fBsdateEnd != ''">
+                and tw.f_bsdate  between #{map.fBsdateStart} and #{map.fBsdateEnd}
+            </if>
+            and tw.del_flag = '0'
+            AND tw.f_corpid = #{map.tWareHouseFees.fCorpid}
+            AND tw.f_sbu = #{map.tWareHouseFees.fCtrlcorpid}
+              AND tw.f_billtype = 'RK'
+            and tw.f_billstatus = 6
+        and tw.f_money > tw.f_stlamount
+            ORDER BY
+                tw.f_bsdate DESC,
+                tw.f_id DESC
+        </where>
+    </select>
+    <select id="getNameByFId" resultType="java.lang.String">
+        select c.f_name
+        from t_fee tf
+                 inner JOIN t_corps AS c ON tf.f_corpid = c.f_id
+        where tf.f_id = #{fId}
+    </select>
 </mapper>

+ 56 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -103,6 +103,7 @@
         <result property="fReason"    column="f_reason"    />
         <result property="fAllotWarehouseid"    column="f_allot_warehouseid"    />
         <result property="fProject"    column="f_project"    />
+        <result property="fStlamount"    column="f_stlamount"    />
     </resultMap>
     <sql id="selectTWarehousebillsVo">
         select f_id,
@@ -599,6 +600,7 @@
     <select id="selectTWarehousebillsById" parameterType="Long" resultMap="TWarehousebillsResult">
         SELECT tw.f_id,
                tw.f_billno,
+               tw.f_stlamount,
                tw.f_customsdeclartion,
                tw.f_originalbillno,
                tw.f_deptid,
@@ -615,6 +617,7 @@
                tw.f_storekeeper,
                sy.user_name AS fStorekeeperName,
                tw.f_chargedate,
+               tw.f_bsdate as fBsdate,
                tw.f_bsdate,
                tw.f_planqty,
                tw.f_plangrossweight,
@@ -2367,6 +2370,7 @@
         SELECT
         DISTINCT
         tw.f_id,
+        tw.f_stlamount,
         tw.f_billno,
         tw.f_customsdeclartion,
         tw.f_originalbillno,
@@ -2654,6 +2658,12 @@
         <if test="fBillstatus != null and fBillstatus != 6">,f_audit_time = null</if>
         where f_pid = #{fPid}
     </update>
+    <update id="confirmPayment">
+        update t_warehousebills set f_stlamount = #{auditMoney} where f_id = #{fSrcpid}
+    </update>
+    <update id="revokeTheMoney">
+        update t_warehousebills set f_stlamount = f_stlamount - #{fAmt} where f_id = #{fSrcpid}
+    </update>
     <select id="cannibalizeList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
         SELECT
         DISTINCT
@@ -3749,4 +3759,50 @@
         </where>
         ORDER BY tw.f_bsdate DESC,tw.f_id DESC
     </select>
+    <select id="getTotalPayments" resultType="com.ruoyi.warehouseBusiness.domain.TWarehouseBills">
+        select tw.f_bsdate                                       as fBsdate,
+               tc.f_name                                         AS fCorpName,
+                tw.f_corpid as fCorpid,
+                SUM(tw.f_money) as fMoney,
+                SUM(tw.f_stlamount) as fStlamount
+        from t_warehousebills tw
+                 LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
+        <where>
+            <if test="fCorpid != null and fCorpid != ''">
+                tw.f_corpid = #{fCorpid}
+            </if>
+            <if test="shippingDateBegin != null and shippingDateBegin != ''">
+                and tw.f_bsdate between #{shippingDateBegin} and #{shippingDateEnd}
+            </if>
+            and tw.del_flag = '0'
+            AND tw.f_billtype = 'RK'
+            and tw.f_billstatus = 6
+            and ifnull(tw.f_money, 0) - ifnull(tw.f_stlamount, 0) &lt;&gt; 0
+            group by DATE_FORMAT(f_bsdate, '%Y-%m'), f_corpid
+            ORDER BY f_corpid, f_bsdate DESC
+        </where>
+    </select>
+    <select id="getTotalPaymentsExcel" resultType="com.ruoyi.finance.excel.TotalPaymentsExport">
+        select tw.f_bsdate                                       as fBsdate,
+        tc.f_name                                         AS fCorpName,
+        SUM(tw.f_money) as fMoney,
+        SUM(tw.f_stlamount) as fStlamount
+        from t_warehousebills tw
+        LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
+        <where>
+            <if test="fCorpid != null and fCorpid != ''">
+                tw.f_corpid = #{fCorpid}
+            </if>
+            <if test="shippingDateBegin != null and shippingDateBegin != ''">
+                and tw.f_bsdate between #{shippingDateBegin} and #{shippingDateEnd}
+            </if>
+            and tw.del_flag = '0'
+            AND tw.f_billtype = 'RK'
+            and tw.f_billstatus = 6
+            and ifnull(tw.f_money, 0) - ifnull(tw.f_stlamount, 0) &lt;&gt; 0
+            group by DATE_FORMAT(f_bsdate, '%Y-%m'), f_corpid
+            ORDER BY f_corpid, f_bsdate DESC
+        </where>
+    </select>
+
 </mapper>