Browse Source

凯和财务

lazhaoqian 4 years ago
parent
commit
e91ac97ceb
32 changed files with 3160 additions and 293 deletions
  1. 16 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/controller/KHTWarehousebillsController.java
  2. 198 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/finance/InvoiceApplyFor.java
  3. 113 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/finance/TFeeInvoiceController.java
  4. 32 9
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TChargeController.java
  5. 56 9
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TContrastController.java
  6. 33 9
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TPaymentController.java
  7. 245 0
      ruoyi-shipping/src/main/java/com/ruoyi/shipping/domain/TFeeInvoice.java
  8. 77 0
      ruoyi-shipping/src/main/java/com/ruoyi/shipping/mapper/TFeeInvoiceMapper.java
  9. 63 0
      ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/ITFeeInvoiceService.java
  10. 110 0
      ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/impl/TFeeInvoiceServiceImpl.java
  11. 169 0
      ruoyi-shipping/src/main/resources/mapper/shipping/TFeeInvoiceMapper.xml
  12. 3 0
      ruoyi-shipping/src/main/resources/mapper/shipping/TVesselMapper.xml
  13. 145 9
      ruoyi-warehouse/src/main/java/com/ruoyi/approvalFlow/service/impl/AuditPathsServiceImpl.java
  14. 64 8
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TFee.java
  15. 100 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TFeeDo.java
  16. 134 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TWareHouseFees.java
  17. 7 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeDoMapper.java
  18. 13 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeMapper.java
  19. 3 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeDoService.java
  20. 29 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeService.java
  21. 18 0
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeDoServiceImpl.java
  22. 311 6
      ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java
  23. 20 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java
  24. 10 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehousebillsfees.java
  25. 7 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java
  26. 11 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java
  27. 10 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/BillnoSerialServiceImpl.java
  28. 161 7
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java
  29. 56 0
      ruoyi-warehouse/src/main/resources/mapper/finance/TFeeDoMapper.xml
  30. 786 235
      ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml
  31. 112 1
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml
  32. 48 0
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

+ 16 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/controller/KHTWarehousebillsController.java

@@ -265,4 +265,20 @@ public class KHTWarehousebillsController extends BaseController
                 tWarehousebillsfeesCr,tWarehousebillsfeesDr,loginUser,billsType);
 
     }
+    @PreAuthorize("@ss.hasPermi('warehouse:warehousebills:ruoYiSubmitMessage')")
+    @Log(title = "凯和若依订单提交", businessType = BusinessType.DELETE)
+    @PostMapping("/ruoYiSubmitMessage")
+    public AjaxResult ruoYiSubmitMessage(@RequestParam(value = "tWarehousebills") String tWarehousebills,
+                                              @RequestParam(value = "tWarehousebillsCntritems",required = false) String tWarehousebillsCntritems,
+                                              @RequestParam("tWarehousebillsfeesCr") String tWarehousebillsfeesCr,
+                                              @RequestParam("tWarehousebillsfeesDr") String tWarehousebillsfeesDr){
+        if (StringUtils.isEmpty(tWarehousebills)){
+            return AjaxResult.error("未找到订单主表信息,请确认");
+        }
+        String billsType = "KHDD";
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tWarehousebillsService.ruoYiSubmitMessage(tWarehousebills,tWarehousebillsCntritems,
+                tWarehousebillsfeesCr,tWarehousebillsfeesDr,loginUser,billsType);
+
+    }
 }

+ 198 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/finance/InvoiceApplyFor.java

@@ -0,0 +1,198 @@
+package com.ruoyi.web.controller.shipping.finance;
+
+import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.finance.domain.TFee;
+import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.service.ITFeeDoService;
+import com.ruoyi.finance.service.ITFeeService;
+import com.ruoyi.framework.web.service.TokenService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 发票申请
+ */
+@RestController
+@RequestMapping("/financial/invoiceApplyFor")
+public class InvoiceApplyFor extends BaseController {
+    @Autowired
+    private ITFeeService tFeeService;
+    @Autowired
+    private ITFeeDoService tFeeDoService;
+
+    /**
+     * 查询申请发票数据主列表
+     */
+    //@PreAuthorize("@ss.hasPermi('financial:invoiceApplyFor:list')")
+    @DataScope(deptAlias = "d", userAlias = "u")
+    @GetMapping("/list")
+    public TableDataInfo list(TFee tFee) {
+        tFee.setfBilltype("ApplyFP");
+        startPage();
+        List<Map<String, Object>> list = tFeeService.selectTFeeList1(tFee);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取发票数据主详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('finance:contrast:edit')")
+    @GetMapping(value = "/{fId}")
+    public AjaxResult getInfo(@PathVariable("fId") Long fId) {
+        return AjaxResult.success(tFeeService.selectTFeeByIdNew(fId));
+    }
+
+    /**
+     * 新增发票申请
+     *
+     * @param tFee
+     * @param tFeeDo
+     * @return
+     */
+    //@PreAuthorize("@ss.hasPermi('financial:invoiceApplyFor:add')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/add")
+    @RepeatSubmit
+    public AjaxResult add(@RequestParam("tFee") String tFee,
+                          @RequestParam("tFeeDo") String tFeeDo,
+                          @RequestParam(value = "tFeeInvoice",required = false) String tFeeInvoice,
+                          @RequestParam("billsType") String billsType) {
+        if (StringUtils.isEmpty(tFee)){
+            return AjaxResult.error("财务主表信息不能为空");
+        }
+        if (StringUtils.isEmpty(tFeeDo)) {
+            return AjaxResult.error("财务明细表信息不能为空");
+        }
+        if (StringUtils.isEmpty(billsType)){
+            return AjaxResult.error("单据类型不能为空");
+        }
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.insertKHTFeeTFeeDo(tFee, tFeeDo, tFeeInvoice, loginUser, billsType);
+    }
+
+    /**
+     * 新增开发票信息
+     *
+     * @param tFee
+     * @param tFeeDo
+     * @return
+     */
+   // @PreAuthorize("@ss.hasPermi('financial:invoiceApplyFor:invoiceAdd')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/invoice/add")
+    @RepeatSubmit
+    public AjaxResult invoiceAdd(@RequestParam("tFee") String tFee,
+                          @RequestParam("tFeeDo") String tFeeDo,
+                          @RequestParam(value = "tFeeInvoice", required = false) String tFeeInvoice) {
+        if (StringUtils.isEmpty(tFee)) {
+            return AjaxResult.error("财务主表信息不能为空");
+        }
+        if (StringUtils.isEmpty(tFeeDo)) {
+            return AjaxResult.error("财务明细表信息不能为空");
+        }
+        String billsType = "invoiceFP";
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.insertKHTFeeTFeeDo(tFee, tFeeDo, tFeeInvoice, loginUser, billsType);
+    }
+
+    /**
+     * 确认发票申请
+     */
+    //@PreAuthorize("@ss.hasPermi('financial:invoiceApplyFor:confirm')")
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/confirm")
+    @RepeatSubmit
+    public AjaxResult confirm(@RequestParam("tFee") String tFee,
+                              @RequestParam("tFeeDo") String tFeeDo,
+                              @RequestParam(value = "tFeeInvoice",required = false) String tFeeInvoice,
+                              @RequestParam("billsType") String billsType) {
+       // String billsType = "ApplyFP";
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.confirmKaiHe(tFee, tFeeDo, tFeeInvoice, loginUser, billsType);
+    }
+
+    /**
+     * 修改发票主数据
+     * @param tFee
+     * @return
+     */
+    @PreAuthorize("@ss.hasPermi('financial:invoiceApplyFor:edit')")
+    @Log(title = "财务数据主", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TFee tFee) {
+        return toAjax(tFeeService.updateTFee(tFee));
+    }
+
+    /**
+     * 删除发票数据主
+     */
+    @PreAuthorize("@ss.hasPermi('financial:invoiceApplyFor:remove')")
+    @Log(title = "财务数据主", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{fIds}")
+    public AjaxResult remove(@PathVariable Long[] fIds) {
+        return toAjax(tFeeService.deleteTFeeByIds(fIds));
+    }
+
+    @PreAuthorize("@ss.hasPermi('financial:invoiceApplyFor:remove')")
+    @Log(title = "财务数据主", businessType = BusinessType.DELETE)
+    @DeleteMapping("/queryRemove/{fId}")
+    public AjaxResult queryRemove(@PathVariable("fId") Long fId) {
+        return tFeeService.remove(fId);
+    }
+    /**
+     * 发票申请查询
+     */
+    //@PreAuthorize("@ss.hasPermi('financial:invoiceApplyFor:list')")
+    @GetMapping("/contrastList")
+    public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
+        startPage();
+        String billsType = "ApplyFP";
+        if (StringUtils.isNotEmpty(tWareHouseFees.getfSystemType())
+                && "3".equals(tWareHouseFees.getfSystemType())) {
+            tWareHouseFees.setfTypeid(1);
+        }
+        tWareHouseFees.setfBillstatus("6");
+        tWareHouseFees.setfDc("D");
+        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees, billsType);
+        return getDataTable(list);
+    }
+    /**
+     * 开发票查询
+     */
+    @PreAuthorize("@ss.hasPermi('financial:invoiceApplyFor:invoiceList')")
+    @GetMapping("/invoiceList")
+    public TableDataInfo invoiceList(TWareHouseFees tWareHouseFees) {
+        startPage();
+        String billsType = "invoiceFP";
+        if (StringUtils.isNotEmpty(tWareHouseFees.getfSystemType())
+                && "3".equals(tWareHouseFees.getfSystemType())) {
+            tWareHouseFees.setfTypeid(1);
+        }
+        tWareHouseFees.setfBillstatus("6");
+        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees, billsType);
+        return getDataTable(list);
+    }
+    @PreAuthorize("@ss.hasPermi('financial:invoiceApplyFor:removeFeeDo')")
+    @Log(title = "财务数据主", businessType = BusinessType.DELETE)
+    @DeleteMapping("/removeFeeDo/{fId}")
+    public AjaxResult removeFeeDo(@PathVariable("fId") Long fId) {
+        return tFeeDoService.removeFeeDoById(fId);
+    }
+}

+ 113 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/finance/TFeeInvoiceController.java

@@ -0,0 +1,113 @@
+package com.ruoyi.web.controller.shipping.finance;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.shipping.domain.TFeeInvoice;
+import com.ruoyi.shipping.service.ITFeeInvoiceService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 发票从Controller
+ * 
+ * @author ruoyi
+ * @date 2021-04-22
+ */
+@RestController
+@RequestMapping("/shipping/invoice")
+public class TFeeInvoiceController extends BaseController
+{
+    @Autowired
+    private ITFeeInvoiceService tFeeInvoiceService;
+
+    /**
+     * 查询发票从列表
+     */
+    @PreAuthorize("@ss.hasPermi('shipping:invoice:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TFeeInvoice tFeeInvoice)
+    {
+        startPage();
+        List<TFeeInvoice> list = tFeeInvoiceService.selectTFeeInvoiceList(tFeeInvoice);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出发票从列表
+     */
+    @PreAuthorize("@ss.hasPermi('shipping:invoice:export')")
+    @Log(title = "发票从", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TFeeInvoice tFeeInvoice)
+    {
+        List<TFeeInvoice> list = tFeeInvoiceService.selectTFeeInvoiceList(tFeeInvoice);
+        ExcelUtil<TFeeInvoice> util = new ExcelUtil<TFeeInvoice>(TFeeInvoice.class);
+        return util.exportExcel(list, "invoice");
+    }
+
+    /**
+     * 获取发票从详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('shipping:invoice:query')")
+    @GetMapping(value = "/{fId}")
+    public AjaxResult getInfo(@PathVariable("fId") Long fId)
+    {
+        return AjaxResult.success(tFeeInvoiceService.selectTFeeInvoiceById(fId));
+    }
+
+    /**
+     * 新增发票从
+     */
+    @PreAuthorize("@ss.hasPermi('shipping:invoice:add')")
+    @Log(title = "发票从", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TFeeInvoice tFeeInvoice)
+    {
+        return toAjax(tFeeInvoiceService.insertTFeeInvoice(tFeeInvoice));
+    }
+
+    /**
+     * 修改发票从
+     */
+    @PreAuthorize("@ss.hasPermi('shipping:invoice:edit')")
+    @Log(title = "发票从", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TFeeInvoice tFeeInvoice)
+    {
+        return toAjax(tFeeInvoiceService.updateTFeeInvoice(tFeeInvoice));
+    }
+
+    /**
+     * 删除发票从
+     */
+    @PreAuthorize("@ss.hasPermi('shipping:invoice:remove')")
+    @Log(title = "发票从", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{fIds}")
+    public AjaxResult remove(@PathVariable Long fIds)
+    {
+        return tFeeInvoiceService.deleteTFeeInvoiceById(fIds);
+    }
+    /**
+     * 删除发票从
+     */
+    @PreAuthorize("@ss.hasPermi('shipping:invoice:removeByid')")
+    @Log(title = "发票从", businessType = BusinessType.DELETE)
+    @DeleteMapping("/remove/{fId}")
+    public AjaxResult removeByid(@PathVariable Long fId)
+    {
+        return tFeeInvoiceService.deleteTFeeInvoiceById(fId);
+    }
+}

+ 32 - 9
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TChargeController.java

@@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.ServletUtils;
+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;
@@ -43,7 +44,9 @@ public class TChargeController extends BaseController {
     @DataScope(deptAlias = "d", userAlias = "u")
     @GetMapping("/list")
     public TableDataInfo list(TFee tFee) {
-        tFee.setfBilltype("SF");
+        if (StringUtils.isEmpty(tFee.getfBilltype())){
+            tFee.setfBilltype("SF");
+        }
         startPage();
         List<TFee> list = tFeeService.selectTFeeList(tFee);
         return getDataTable(list);
@@ -57,7 +60,9 @@ public class TChargeController extends BaseController {
     @DataScope(deptAlias = "d", userAlias = "u")
     @GetMapping("/export")
     public AjaxResult export(TFee tFee) throws Exception {
-        tFee.setfBilltype("SF");
+        if (StringUtils.isEmpty(tFee.getfBilltype())){
+            tFee.setfBilltype("SF");
+        }
         List<Charge> list = tFeeService.chargeExport(tFee);
         ExcelUtil<Charge> util = new ExcelUtil<Charge>(Charge.class);
         return util.exportExcel(list, "收费");
@@ -80,8 +85,11 @@ public class TChargeController extends BaseController {
     @PostMapping(value = "/add")
     @RepeatSubmit
     public AjaxResult add(@RequestParam("tFee") String tFee,
-                          @RequestParam("tFeeDo") String tFeeDo ) {
-        String billsType = "SF";
+                          @RequestParam("tFeeDo") String tFeeDo,
+                          @RequestParam(value = "billsType",required = false) String billsType) {
+        if (StringUtils.isEmpty(billsType)){
+            billsType = "SF";
+        }
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tFeeService.insertTFeeTFeeDo(tFee,tFeeDo,loginUser,billsType);
@@ -121,8 +129,17 @@ public class TChargeController extends BaseController {
     @GetMapping("/chargeList")
     public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
         tWareHouseFees.setfDc("D");
+        tWareHouseFees.setfBillstatus("6");
         startPage();
-        String billsType = "SF";
+        String billsType = null;
+       /* if (StringUtils.isEmpty(tWareHouseFees.getBillsType())){
+            billsType = "SF";
+        }*/
+        billsType = "SF";
+        if (StringUtils.isNotEmpty(tWareHouseFees.getfSystemType())
+        && "3".equals(tWareHouseFees.getfSystemType())){
+            tWareHouseFees.setfTypeid(1);
+        }
         List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees,billsType);
         return getDataTable(list);
     }
@@ -135,8 +152,11 @@ public class TChargeController extends BaseController {
     @PostMapping(value = "/confirm")
     @RepeatSubmit
     public AjaxResult confirm(@RequestParam("tFee") String tFee,
-                          @RequestParam("tFeeDo") String tFeeDo ) {
-        String billsType = "SF";
+                          @RequestParam("tFeeDo") String tFeeDo,
+                          @RequestParam(value = "billsType",required = false) String billsType) {
+        if (StringUtils.isEmpty(billsType)){
+            billsType = "SF";
+        }
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tFeeService.confirm(tFee,tFeeDo,loginUser,billsType);
@@ -151,8 +171,11 @@ public class TChargeController extends BaseController {
     @PostMapping(value = "/revoke")
     @RepeatSubmit
     public AjaxResult revoke(@RequestParam("tFee") String tFee,
-                              @RequestParam("tFeeDo") String tFeeDo ) {
-        String billsType = "DCRevoke";
+                              @RequestParam("tFeeDo") String tFeeDo,
+                             @RequestParam(value = "billsType",required = false) String billsType) {
+        if (StringUtils.isEmpty(billsType)){
+            billsType = "DCRevoke";
+        }
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tFeeService.revoke(tFee,tFeeDo,loginUser,billsType);

+ 56 - 9
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TContrastController.java

@@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.ServletUtils;
+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;
@@ -43,7 +44,9 @@ public class TContrastController extends BaseController {
     @DataScope(deptAlias = "d", userAlias = "u")
     @GetMapping("/list")
     public TableDataInfo list(TFee tFee) {
-        tFee.setfBilltype("DZ");
+        if (StringUtils.isEmpty(tFee.getfBilltype())){
+            tFee.setfBilltype("DZ");
+        }
         startPage();
         List<Map<String, Object>> list = tFeeService.selectTFeeList1(tFee);
         return getDataTable(list);
@@ -57,7 +60,9 @@ public class TContrastController extends BaseController {
     @DataScope(deptAlias = "d", userAlias = "u")
     @GetMapping("/export")
     public AjaxResult export(TFee tFee) throws Exception {
-        tFee.setfBilltype("DZ");
+        if (StringUtils.isEmpty(tFee.getfBilltype())){
+            tFee.setfBilltype("DZ");
+        }
         List<Contrast> list = tFeeService.contrastExport(tFee);
         ExcelUtil<Contrast> util = new ExcelUtil<Contrast>(Contrast.class);
         return util.exportExcel(list, "对账");
@@ -80,8 +85,11 @@ public class TContrastController extends BaseController {
     @PostMapping(value = "/add")
     @RepeatSubmit
     public AjaxResult add(@RequestParam("tFee") String tFee,
-                          @RequestParam("tFeeDo") String tFeeDo ) {
-        String billsType = "DZ";
+                          @RequestParam("tFeeDo") String tFeeDo,
+                          @RequestParam(value = "billsType",required = false) String billsType) {
+        if (StringUtils.isEmpty(billsType)){
+            billsType = "DZ";
+        }
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tFeeService.insertTFeeTFeeDo(tFee,tFeeDo,loginUser,billsType);
@@ -121,10 +129,43 @@ public class TContrastController extends BaseController {
     @GetMapping("/contrastList")
     public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
         startPage();
-        String billsType = "DZ";
+        String billsType = null;
+        if (StringUtils.isNotEmpty(tWareHouseFees.getBillsType())){
+            billsType = tWareHouseFees.getBillsType();
+        }else {
+            billsType = "DZ";
+        }
+        if (StringUtils.isNotEmpty(tWareHouseFees.getfSystemType())
+                && "3".equals(tWareHouseFees.getfSystemType())){
+            tWareHouseFees.setfTypeid(1);
+        }
+        tWareHouseFees.setfBillstatus("6");
+        tWareHouseFees.setfDc("D");
         List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees,billsType);
         return getDataTable(list);
     }
+    @GetMapping("/webVersionChargeList")
+    public TableDataInfo webVersionChargeList(TWareHouseFees tWareHouseFees) {
+        startPage();
+        String billsType = "KHDZ";
+        tWareHouseFees.setfTypeid(1);
+        tWareHouseFees.setfBillstatus("6");
+        tWareHouseFees.setfDc("D");
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        tWareHouseFees.setCreateBy(loginUser.getUser().getUserName());
+        List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees,billsType);
+        return getDataTable(list);
+    }
+    @Log(title = "财务数据主", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/webVersionConfirm")
+    @RepeatSubmit
+    public AjaxResult webVersionConfirm(@RequestParam("tFee") String tFee,
+                              @RequestParam("tFeeDo") String tFeeDo) {
+        String billsType = "KHDZ";
+        // 获取当前的用户
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tFeeService.confirm(tFee,tFeeDo,loginUser,billsType);
+    }
 
     /**
      *   确认对账
@@ -134,8 +175,11 @@ public class TContrastController extends BaseController {
     @PostMapping(value = "/confirm")
     @RepeatSubmit
     public AjaxResult confirm(@RequestParam("tFee") String tFee,
-                              @RequestParam("tFeeDo") String tFeeDo ) {
-        String billsType = "DZ";
+                              @RequestParam("tFeeDo") String tFeeDo,
+                              @RequestParam(value = "billsType",required = false) String billsType) {
+        if (StringUtils.isEmpty(billsType)){
+            billsType = "DZ";
+        }
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tFeeService.confirm(tFee,tFeeDo,loginUser,billsType);
@@ -149,8 +193,11 @@ public class TContrastController extends BaseController {
     @PostMapping(value = "/revoke")
     @RepeatSubmit
     public AjaxResult revoke(@RequestParam("tFee") String tFee,
-                             @RequestParam("tFeeDo") String tFeeDo ) {
-        String billsType = "DZRevoke";
+                             @RequestParam("tFeeDo") String tFeeDo,
+                             @RequestParam(value = "billsType",required = false) String billsType) {
+        if (StringUtils.isEmpty(billsType)){
+            billsType = "DZRevoke";
+        }
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tFeeService.revoke(tFee,tFeeDo,loginUser,billsType);

+ 33 - 9
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/finance/TPaymentController.java

@@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.ServletUtils;
+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;
@@ -42,7 +43,9 @@ public class TPaymentController extends BaseController {
     @DataScope(deptAlias = "d", userAlias = "u")
     @GetMapping("/list")
     public TableDataInfo list(TFee tFee) {
-        tFee.setfBilltype("FF");
+        if (StringUtils.isEmpty(tFee.getfSystemType())){
+            tFee.setfBilltype("FF");
+        }
         startPage();
         List<TFee> list = tFeeService.selectTFeeList(tFee);
         return getDataTable(list);
@@ -56,7 +59,9 @@ public class TPaymentController extends BaseController {
     @DataScope(deptAlias = "d", userAlias = "u")
     @GetMapping("/export")
     public AjaxResult export(TFee tFee) throws Exception {
-        tFee.setfBilltype("SF");
+        if (StringUtils.isEmpty(tFee.getfSystemType())){
+            tFee.setfBilltype("FF");
+        }
         List<Payment> list = tFeeService.paymentExport(tFee);
         ExcelUtil<Payment> util = new ExcelUtil<Payment>(Payment.class);
         return util.exportExcel(list, "付费");
@@ -79,8 +84,11 @@ public class TPaymentController extends BaseController {
     @PostMapping(value = "/add")
     @RepeatSubmit
     public AjaxResult add(@RequestParam("tFee") String tFee,
-                          @RequestParam("tFeeDo") String tFeeDo ) {
-        String billsType = "FF";
+                          @RequestParam("tFeeDo") String tFeeDo,
+                          @RequestParam(value = "billsType",required = false) String billsType) {
+        if (StringUtils.isEmpty(billsType)){
+            billsType = "FF";
+        }
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tFeeService.insertTFeeTFeeDo(tFee,tFeeDo,loginUser,billsType);
@@ -120,8 +128,18 @@ public class TPaymentController extends BaseController {
     @GetMapping("/paymentList")
     public TableDataInfo chargeList(TWareHouseFees tWareHouseFees) {
         tWareHouseFees.setfDc("C");
+        tWareHouseFees.setfBillstatus("6");
         startPage();
-        String billsType = "FF";
+        String billsType = null;
+        if (StringUtils.isNotEmpty(tWareHouseFees.getBillsType())){
+            billsType = tWareHouseFees.getBillsType();
+        }else {
+            billsType = "FF";
+        }
+        if (StringUtils.isNotEmpty(tWareHouseFees.getfSystemType())
+                && "3".equals(tWareHouseFees.getfSystemType())){
+            tWareHouseFees.setfTypeid(1);
+        }
         List<Map<String, Object>> list = tFeeService.warehouseBillsFeesList(tWareHouseFees,billsType);
         return getDataTable(list);
     }
@@ -134,8 +152,11 @@ public class TPaymentController extends BaseController {
     @PostMapping(value = "/confirm")
     @RepeatSubmit
     public AjaxResult confirm(@RequestParam("tFee") String tFee,
-                              @RequestParam("tFeeDo") String tFeeDo ) {
-        String billsType = "FF";
+                              @RequestParam("tFeeDo") String tFeeDo,
+                              @RequestParam(value = "billsType",required = false) String billsType) {
+        if (StringUtils.isEmpty(billsType)){
+            billsType = "FF";
+        }
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tFeeService.confirm(tFee,tFeeDo,loginUser,billsType);
@@ -149,8 +170,11 @@ public class TPaymentController extends BaseController {
     @PostMapping(value = "/revoke")
     @RepeatSubmit
     public AjaxResult revoke(@RequestParam("tFee") String tFee,
-                             @RequestParam("tFeeDo") String tFeeDo ) {
-        String billsType = "DCRevoke";
+                             @RequestParam("tFeeDo") String tFeeDo,
+                             @RequestParam(value = "billsType",required = false) String billsType) {
+        if (StringUtils.isEmpty(billsType)){
+            billsType = "DCRevoke";
+        }
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tFeeService.revoke(tFee,tFeeDo,loginUser,billsType);

+ 245 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/domain/TFeeInvoice.java

@@ -0,0 +1,245 @@
+package com.ruoyi.shipping.domain;
+
+import java.math.BigDecimal;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 发票从对象 t_fee_invoice
+ * 
+ * @author ruoyi
+ * @date 2021-04-22
+ */
+public class TFeeInvoice extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long fId;
+
+    /** t_fee表主键 */
+    @Excel(name = "t_fee表主键")
+    private Long fPid;
+
+    /** 费用名称 */
+    @Excel(name = "费用名称")
+    private Long fFeeid;
+
+    /** 规格型号 */
+    @Excel(name = "规格型号")
+    private String fModel;
+
+    /** 单位 */
+    @Excel(name = "单位")
+    private Long fSbu;
+
+    /** 数量 */
+    @Excel(name = "数量")
+    private Long fNumber;
+
+    /** 单价(含税) */
+    @Excel(name = "单价", readConverterExp = "含=税")
+    private BigDecimal fUnitprice;
+
+    /** 金额(含税) */
+    @Excel(name = "金额", readConverterExp = "含=税")
+    private BigDecimal fMoney;
+
+    /** 税率 */
+    @Excel(name = "税率")
+    private BigDecimal fTaxrate;
+
+    /** 税额 */
+    @Excel(name = "税额")
+    private BigDecimal fTax;
+
+    /** 合计金额 */
+    @Excel(name = "合计金额")
+    private BigDecimal fAmount;
+
+    /** 作废状态(是否) */
+    @Excel(name = "作废状态", readConverterExp = "是=否")
+    private String fStatus;
+
+    /**
+     * 状态
+     */
+    @Excel(name = "状态")
+    private String fBillstatus;
+
+    /** 备注 */
+    @Excel(name = "备注")
+    private String remarks;
+    //费用名称中文
+    private String fFeeName;
+    //单位名称中文
+    private String fSbuName;
+
+    public String getfBillstatus() {
+        return fBillstatus;
+    }
+
+    public void setfBillstatus(String fBillstatus) {
+        this.fBillstatus = fBillstatus;
+    }
+
+    public String getfFeeName() {
+        return fFeeName;
+    }
+
+    public void setfFeeName(String fFeeName) {
+        this.fFeeName = fFeeName;
+    }
+
+    public String getfSbuName() {
+        return fSbuName;
+    }
+
+    public void setfSbuName(String fSbuName) {
+        this.fSbuName = fSbuName;
+    }
+
+    public void setfId(Long fId)
+    {
+        this.fId = fId;
+    }
+
+    public Long getfId() 
+    {
+        return fId;
+    }
+    public void setfPid(Long fPid) 
+    {
+        this.fPid = fPid;
+    }
+
+    public Long getfPid() 
+    {
+        return fPid;
+    }
+    public void setfFeeid(Long fFeeid) 
+    {
+        this.fFeeid = fFeeid;
+    }
+
+    public Long getfFeeid() 
+    {
+        return fFeeid;
+    }
+    public void setfModel(String fModel) 
+    {
+        this.fModel = fModel;
+    }
+
+    public String getfModel() 
+    {
+        return fModel;
+    }
+    public void setfSbu(Long fSbu) 
+    {
+        this.fSbu = fSbu;
+    }
+
+    public Long getfSbu() 
+    {
+        return fSbu;
+    }
+    public void setfNumber(Long fNumber) 
+    {
+        this.fNumber = fNumber;
+    }
+
+    public Long getfNumber() 
+    {
+        return fNumber;
+    }
+    public void setfUnitprice(BigDecimal fUnitprice) 
+    {
+        this.fUnitprice = fUnitprice;
+    }
+
+    public BigDecimal getfUnitprice() 
+    {
+        return fUnitprice;
+    }
+    public void setfMoney(BigDecimal fMoney) 
+    {
+        this.fMoney = fMoney;
+    }
+
+    public BigDecimal getfMoney() 
+    {
+        return fMoney;
+    }
+    public void setfTaxrate(BigDecimal fTaxrate) 
+    {
+        this.fTaxrate = fTaxrate;
+    }
+
+    public BigDecimal getfTaxrate() 
+    {
+        return fTaxrate;
+    }
+    public void setfTax(BigDecimal fTax) 
+    {
+        this.fTax = fTax;
+    }
+
+    public BigDecimal getfTax() 
+    {
+        return fTax;
+    }
+    public void setfAmount(BigDecimal fAmount) 
+    {
+        this.fAmount = fAmount;
+    }
+
+    public BigDecimal getfAmount() 
+    {
+        return fAmount;
+    }
+    public void setfStatus(String fStatus) 
+    {
+        this.fStatus = fStatus;
+    }
+
+    public String getfStatus() 
+    {
+        return fStatus;
+    }
+    public void setRemarks(String remarks) 
+    {
+        this.remarks = remarks;
+    }
+
+    public String getRemarks() 
+    {
+        return remarks;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("fId", getfId())
+            .append("fPid", getfPid())
+            .append("fFeeid", getfFeeid())
+            .append("fModel", getfModel())
+            .append("fSbu", getfSbu())
+            .append("fNumber", getfNumber())
+            .append("fUnitprice", getfUnitprice())
+            .append("fMoney", getfMoney())
+            .append("fTaxrate", getfTaxrate())
+            .append("fTax", getfTax())
+            .append("fAmount", getfAmount())
+            .append("fStatus", getfStatus())
+            .append("fBillstatus", getfBillstatus())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remarks", getRemarks())
+            .toString();
+    }
+}

+ 77 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/mapper/TFeeInvoiceMapper.java

@@ -0,0 +1,77 @@
+package com.ruoyi.shipping.mapper;
+
+import java.util.List;
+import com.ruoyi.shipping.domain.TFeeInvoice;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 发票从Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2021-04-22
+ */
+public interface TFeeInvoiceMapper 
+{
+    /**
+     * 查询发票从
+     * 
+     * @param fId 发票从ID
+     * @return 发票从
+     */
+    public TFeeInvoice selectTFeeInvoiceById(Long fId);
+
+    /**
+     * 查询发票从列表
+     * 
+     * @param tFeeInvoice 发票从
+     * @return 发票从集合
+     */
+    public List<TFeeInvoice> selectTFeeInvoiceList(TFeeInvoice tFeeInvoice);
+
+    /**
+     * 新增发票从
+     * 
+     * @param tFeeInvoice 发票从
+     * @return 结果
+     */
+    public int insertTFeeInvoice(TFeeInvoice tFeeInvoice);
+
+    /**
+     * 修改发票从
+     * 
+     * @param tFeeInvoice 发票从
+     * @return 结果
+     */
+    public int updateTFeeInvoice(TFeeInvoice tFeeInvoice);
+
+    /**
+     * 删除发票从
+     * 
+     * @param fId 发票从ID
+     * @return 结果
+     */
+    public int deleteTFeeInvoiceById(Long fId);
+
+    /**
+     * 批量删除发票从
+     * 
+     * @param fIds 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTFeeInvoiceByIds(Long[] fIds);
+
+    /**
+     * 根据fpid删除数据
+     * @param fId
+     * @return
+     */
+    int deleteByFPid(Long fId);
+    /**
+     *  根据主表id 更新主表对应状态
+     *
+     * @param fettle 对应状态
+     * @param fPid 主表id
+     * @return  结果
+     */
+    int tFeeInvoiceUpdate(@Param("fPid") Long fPid, @Param("fettle") Long fettle);
+}

+ 63 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/ITFeeInvoiceService.java

@@ -0,0 +1,63 @@
+package com.ruoyi.shipping.service;
+
+import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.shipping.domain.TFeeInvoice;
+
+/**
+ * 发票从Service接口
+ * 
+ * @author ruoyi
+ * @date 2021-04-22
+ */
+public interface ITFeeInvoiceService 
+{
+    /**
+     * 查询发票从
+     * 
+     * @param fId 发票从ID
+     * @return 发票从
+     */
+    public TFeeInvoice selectTFeeInvoiceById(Long fId);
+
+    /**
+     * 查询发票从列表
+     * 
+     * @param tFeeInvoice 发票从
+     * @return 发票从集合
+     */
+    public List<TFeeInvoice> selectTFeeInvoiceList(TFeeInvoice tFeeInvoice);
+
+    /**
+     * 新增发票从
+     * 
+     * @param tFeeInvoice 发票从
+     * @return 结果
+     */
+    public int insertTFeeInvoice(TFeeInvoice tFeeInvoice);
+
+    /**
+     * 修改发票从
+     * 
+     * @param tFeeInvoice 发票从
+     * @return 结果
+     */
+    public int updateTFeeInvoice(TFeeInvoice tFeeInvoice);
+
+    /**
+     * 批量删除发票从
+     * 
+     * @param fIds 需要删除的发票从ID
+     * @return 结果
+     */
+    public int deleteTFeeInvoiceByIds(Long[] fIds);
+
+    /**
+     * 删除发票从信息
+     * 
+     * @param fId 发票从ID
+     * @return 结果
+     */
+    public AjaxResult deleteTFeeInvoiceById(Long fId);
+}

+ 110 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/service/impl/TFeeInvoiceServiceImpl.java

@@ -0,0 +1,110 @@
+package com.ruoyi.shipping.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.shipping.mapper.TFeeInvoiceMapper;
+import com.ruoyi.shipping.domain.TFeeInvoice;
+import com.ruoyi.shipping.service.ITFeeInvoiceService;
+
+/**
+ * 发票从Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2021-04-22
+ */
+@Service
+public class TFeeInvoiceServiceImpl implements ITFeeInvoiceService 
+{
+    @Autowired
+    private TFeeInvoiceMapper tFeeInvoiceMapper;
+
+    /**
+     * 查询发票从
+     * 
+     * @param fId 发票从ID
+     * @return 发票从
+     */
+    @Override
+    public TFeeInvoice selectTFeeInvoiceById(Long fId)
+    {
+        return tFeeInvoiceMapper.selectTFeeInvoiceById(fId);
+    }
+
+    /**
+     * 查询发票从列表
+     * 
+     * @param tFeeInvoice 发票从
+     * @return 发票从
+     */
+    @Override
+    public List<TFeeInvoice> selectTFeeInvoiceList(TFeeInvoice tFeeInvoice)
+    {
+        return tFeeInvoiceMapper.selectTFeeInvoiceList(tFeeInvoice);
+    }
+
+    /**
+     * 新增发票从
+     * 
+     * @param tFeeInvoice 发票从
+     * @return 结果
+     */
+    @Override
+    public int insertTFeeInvoice(TFeeInvoice tFeeInvoice)
+    {
+        tFeeInvoice.setCreateTime(DateUtils.getNowDate());
+        return tFeeInvoiceMapper.insertTFeeInvoice(tFeeInvoice);
+    }
+
+    /**
+     * 修改发票从
+     * 
+     * @param tFeeInvoice 发票从
+     * @return 结果
+     */
+    @Override
+    public int updateTFeeInvoice(TFeeInvoice tFeeInvoice)
+    {
+        tFeeInvoice.setUpdateTime(DateUtils.getNowDate());
+        return tFeeInvoiceMapper.updateTFeeInvoice(tFeeInvoice);
+    }
+
+    /**
+     * 批量删除发票从
+     * 
+     * @param fIds 需要删除的发票从ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTFeeInvoiceByIds(Long[] fIds)
+    {
+        return tFeeInvoiceMapper.deleteTFeeInvoiceByIds(fIds);
+    }
+
+    /**
+     * 删除发票从信息
+     * 
+     * @param fId 发票从ID
+     * @return 结果
+     */
+    @Override
+    public AjaxResult deleteTFeeInvoiceById(Long fId)
+    {
+        TFeeInvoice tFeeInvoice = tFeeInvoiceMapper.selectTFeeInvoiceById(fId);
+        if ("4".equals(tFeeInvoice.getfBillstatus())
+                || "5".equals(tFeeInvoice.getfBillstatus())
+                ||"6".equals(tFeeInvoice.getfBillstatus())){
+            return AjaxResult.error("数据已提交审批,暂不能删除");
+        }
+        Integer i = tFeeInvoiceMapper.deleteTFeeInvoiceById(fId);
+        if (i != null && i >0){
+            return AjaxResult.success();
+        }else {
+            return AjaxResult.error("删除失败,请找管理员");
+        }
+
+    }
+}

+ 169 - 0
ruoyi-shipping/src/main/resources/mapper/shipping/TFeeInvoiceMapper.xml

@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.shipping.mapper.TFeeInvoiceMapper">
+    
+    <resultMap type="TFeeInvoice" id="TFeeInvoiceResult">
+        <result property="fId"    column="f_id"    />
+        <result property="fPid"    column="f_pid"    />
+        <result property="fFeeid"    column="f_feeid"    />
+        <result property="fModel"    column="f_model"    />
+        <result property="fSbu"    column="f_sbu"    />
+        <result property="fNumber"    column="f_number"    />
+        <result property="fUnitprice"    column="f_unitprice"    />
+        <result property="fMoney"    column="f_money"    />
+        <result property="fTaxrate"    column="f_taxrate"    />
+        <result property="fTax"    column="f_tax"    />
+        <result property="fAmount"    column="f_amount"    />
+        <result property="fStatus"    column="f_status"    />
+        <result property="fBillstatus" column="f_billstatus"/>
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remarks"    column="remarks"    />
+    </resultMap>
+
+    <sql id="selectTFeeInvoiceVo">
+        select f_id, f_pid, f_feeid, f_model, f_sbu, f_number, f_unitprice, f_money, f_taxrate, f_tax, f_amount, f_status,f_billstatus, create_by, create_time, update_by, update_time, remarks from t_fee_invoice
+    </sql>
+
+    <select id="selectTFeeInvoiceList" parameterType="TFeeInvoice" resultMap="TFeeInvoiceResult">
+        SELECT
+        tf.f_id,
+        tf.f_pid,
+        tf.f_feeid,
+        te.f_name fFeeName,
+        tf.f_model,
+        tf.f_sbu,
+        pr.dict_label fSbuName,
+        tf.f_number,
+        tf.f_unitprice,
+        tf.f_money,
+        tf.f_taxrate,
+        tf.f_tax,
+        tf.f_amount,
+        tf.f_status,
+        tf.f_billstatus,
+        tf.create_by,
+        tf.create_time,
+        tf.update_by,
+        tf.update_time,
+        tf.remarks
+        FROM
+        t_fee_invoice tf
+        LEFT JOIN sys_dict_data pr ON pr.dict_value = tf.f_sbu AND pr.dict_type = 'data_unitfees'
+        LEFT JOIN t_fees te ON tf.f_feeid = te.f_id
+        <where>  
+            <if test="fPid != null "> and tf.f_pid = #{fPid}</if>
+            <if test="fFeeid != null "> and tf.f_feeid = #{fFeeid}</if>
+            <if test="fModel != null  and fModel != ''"> and tf.f_model = #{fModel}</if>
+            <if test="fSbu != null "> and tf.f_sbu = #{fSbu}</if>
+            <if test="fNumber != null "> and tf.f_number = #{fNumber}</if>
+            <if test="fUnitprice != null "> and tf.f_unitprice = #{fUnitprice}</if>
+            <if test="fMoney != null "> and tf.f_money = #{fMoney}</if>
+            <if test="fTaxrate != null "> and tf.f_taxrate = #{fTaxrate}</if>
+            <if test="fTax != null "> and tf.f_tax = #{fTax}</if>
+            <if test="fAmount != null "> and tf.f_amount = #{fAmount}</if>
+            <if test="fStatus != null  and fStatus != ''"> and tf.f_status = #{fStatus}</if>
+            <if test="fBillstatus != null  and fBillstatus != ''">and tf.f_billstatus = #{fBillstatus}</if>
+            <if test="remarks != null  and remarks != ''"> and tf.remarks = #{remarks}</if>
+        </where>
+    </select>
+    
+    <select id="selectTFeeInvoiceById" parameterType="Long" resultMap="TFeeInvoiceResult">
+        <include refid="selectTFeeInvoiceVo"/>
+        where f_id = #{fId}
+    </select>
+        
+    <insert id="insertTFeeInvoice" parameterType="TFeeInvoice">
+        insert into t_fee_invoice
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="fId != null">f_id,</if>
+            <if test="fPid != null">f_pid,</if>
+            <if test="fFeeid != null">f_feeid,</if>
+            <if test="fModel != null">f_model,</if>
+            <if test="fSbu != null">f_sbu,</if>
+            <if test="fNumber != null">f_number,</if>
+            <if test="fUnitprice != null">f_unitprice,</if>
+            <if test="fMoney != null">f_money,</if>
+            <if test="fTaxrate != null">f_taxrate,</if>
+            <if test="fTax != null">f_tax,</if>
+            <if test="fAmount != null">f_amount,</if>
+            <if test="fStatus != null">f_status,</if>
+            <if test="fBillstatus != null and fBillstatus != ''">f_billstatus,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remarks != null">remarks,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="fId != null">#{fId},</if>
+            <if test="fPid != null">#{fPid},</if>
+            <if test="fFeeid != null">#{fFeeid},</if>
+            <if test="fModel != null">#{fModel},</if>
+            <if test="fSbu != null">#{fSbu},</if>
+            <if test="fNumber != null">#{fNumber},</if>
+            <if test="fUnitprice != null">#{fUnitprice},</if>
+            <if test="fMoney != null">#{fMoney},</if>
+            <if test="fTaxrate != null">#{fTaxrate},</if>
+            <if test="fTax != null">#{fTax},</if>
+            <if test="fAmount != null">#{fAmount},</if>
+            <if test="fStatus != null">#{fStatus},</if>
+            <if test="fBillstatus != null and fBillstatus != ''">#{fBillstatus},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remarks != null">#{remarks},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTFeeInvoice" parameterType="TFeeInvoice">
+        update t_fee_invoice
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="fPid != null">f_pid = #{fPid},</if>
+            <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
+            <if test="fModel != null">f_model = #{fModel},</if>
+            <if test="fSbu != null">f_sbu = #{fSbu},</if>
+            <if test="fNumber != null">f_number = #{fNumber},</if>
+            <if test="fUnitprice != null">f_unitprice = #{fUnitprice},</if>
+            <if test="fMoney != null">f_money = #{fMoney},</if>
+            <if test="fTaxrate != null">f_taxrate = #{fTaxrate},</if>
+            <if test="fTax != null">f_tax = #{fTax},</if>
+            <if test="fAmount != null">f_amount = #{fAmount},</if>
+            <if test="fStatus != null">f_status = #{fStatus},</if>
+            <if test="fBillstatus != null and fBillstatus != ''">f_billstatus = #{fBillstatus},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remarks != null">remarks = #{remarks},</if>
+        </trim>
+        where f_id = #{fId}
+    </update>
+
+    <delete id="deleteTFeeInvoiceById" parameterType="Long">
+        delete from t_fee_invoice where f_id = #{fId}
+    </delete>
+
+    <delete id="deleteTFeeInvoiceByIds" parameterType="String">
+        delete from t_fee_invoice where f_id in 
+        <foreach item="fId" collection="array" open="(" separator="," close=")">
+            #{fId}
+        </foreach>
+    </delete>
+    <delete id="deleteByFPid" parameterType="Long">
+        delete from t_fee_invoice where f_pid = #{fId}
+    </delete>
+    <update id="tFeeInvoiceUpdate" parameterType="Long">
+        update
+            t_fee_invoice
+        set f_billstatus = #{fettle}
+        where
+            f_pid = #{fPid}
+    </update>
+    
+</mapper>

+ 3 - 0
ruoyi-shipping/src/main/resources/mapper/shipping/TVesselMapper.xml

@@ -175,6 +175,9 @@
 	        t_vessel
         WHERE
 	        f_status = 'T'
+            <if test="fName != null and fName != ''">
+                and f_name = #{fName}
+            </if>
     </select>
 
 </mapper>

+ 145 - 9
ruoyi-warehouse/src/main/java/com/ruoyi/approvalFlow/service/impl/AuditPathsServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.approvalFlow.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.ruoyi.approvalFlow.domain.*;
 import com.ruoyi.approvalFlow.mapper.*;
 import com.ruoyi.approvalFlow.service.IAuditPathsService;
@@ -269,6 +270,16 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
             // 协议审批
             List<Map<String, Object>> mapList = auditItemsMapper.selectWarehouseApprover(auditItems);
             return AjaxResult.success(mapList);
+        } else if (auditItems.getActId() == 460 ) {
+            // 协议审批
+            List<Map<String, Object>> mapList = auditItemsMapper.selectWarehouseApprover(auditItems);
+            return AjaxResult.success(mapList);
+        }else if (auditItems.getActId() == 470 ){
+            List<Map<String, Object>> mapList = auditItemsMapper.selectWarehouseApprover(auditItems);
+            return AjaxResult.success(mapList);
+        }else if (auditItems.getActId() >= 430 && auditItems.getActId() <= 450 ){
+            List<Map<String, Object>> mapList = auditItemsMapper.selectWarehouseApprover(auditItems);
+            return AjaxResult.success(mapList);
         }
         return AjaxResult.success();
     }
@@ -407,7 +418,7 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                             fettle = 5L;
                         }
                         //变更凯和订单状态
-                        AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle);
+                        AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle, at.getAuditItem());
                         String code = ajaxResult.get("code").toString();
                         if ("500".equals(code)) {
                             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -420,12 +431,67 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                             fettle = 10L;
                         }
                         //变更凯和订单状态
-                        AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle);
+                        AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle, at.getAuditItem());
+                        String code = ajaxResult.get("code").toString();
+                        if ("500".equals(code)) {
+                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                            return ajaxResult;
+                        }
+                    } else if (auditItems.getActId() >= 430 && auditItems.getActId() <= 450) {
+                        // 财务模块
+                        if ("T".equals(at.getIffinalItem())) {
+                            fettle = 6L;
+                            // 更新费用明细
+                            AjaxResult ajaxResult = tFeeServiceImpl.billsfeesFollow(auditItems.getBillId());
+                            String code = ajaxResult.get("code").toString();
+                            if ("500".equals(code)) {
+                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                                return ajaxResult;
+                            }
+                        } else if ("F".equals(at.getIffinalItem())) {
+                            fettle = 5L;
+                        }
+                        // 变更财务状态
+                        AjaxResult ajaxResult = tFeeServiceImpl.tfeeFollow(auditItems.getBillId(), fettle);
                         String code = ajaxResult.get("code").toString();
                         if ("500".equals(code)) {
                             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                             return ajaxResult;
                         }
+                    }else if (auditItems.getActId() == 470) {
+                        // 财务模块
+                        if ("T".equals(at.getIffinalItem())) {
+                            fettle = 6L;
+                            // 更新费用明细
+                            AjaxResult ajaxResult = tFeeServiceImpl.billsfeesFollow(auditItems.getBillId());
+                            String code = ajaxResult.get("code").toString();
+                            if ("500".equals(code)) {
+                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                                return ajaxResult;
+                            }
+                        } else if ("F".equals(at.getIffinalItem())) {
+                            fettle = 5L;
+                        }
+                        // 变更财务状态
+                        AjaxResult ajaxResult = tFeeServiceImpl.tfeeFollow(auditItems.getBillId(), fettle);
+                        String code = ajaxResult.get("code").toString();
+                        if ("500".equals(code)) {
+                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                            return ajaxResult;
+                        }
+                    }else if (auditItems.getActId()== 460 ){
+                        if ("T".equals(at.getIffinalItem())) {
+                            fettle = 6L;
+                        } else if ("F".equals(at.getIffinalItem())) {
+                            fettle = 5L;
+                        }
+                        //变更凯和订单状态
+                        Integer i = tWarehousebillsfeesMapper.warehouseFeesFollowUpdate(auditItems.getBillId(), fettle, at.getAuditItem());
+                        if (i != null && i>0) {
+                        }else {
+                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                            return AjaxResult.error("审核失败,更新费用状态失败");
+                        }
                     }
                     if ("F".equals(at.getIffinalItem())) {
                         at.setLevelId(at.getLevelId() + 1);
@@ -509,7 +575,7 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
             }
         }else if (auditItems.getActId()== 410){
             fettle = 3L;
-            AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle);
+            AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle,auditItems.getAuditItem());
             String code = ajaxResult.get("code").toString();
             if ("500".equals(code)) {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -517,7 +583,33 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
             }
         }else if (auditItems.getActId()== 420){
             fettle = 8L;
-            AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle);
+            AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle,auditItems.getAuditItem());
+            String code = ajaxResult.get("code").toString();
+            if ("500".equals(code)) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return ajaxResult;
+            }
+        }else if (auditItems.getActId() >= 430 && auditItems.getActId() <= 450) {
+            fettle = 3L;
+            // 财务模块
+            AjaxResult ajaxResult = tFeeServiceImpl.tfeeFollow(auditItems.getBillId(), fettle);
+            String code = ajaxResult.get("code").toString();
+            if ("500".equals(code)) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return ajaxResult;
+            }
+        } else if (auditItems.getActId()== 460){
+            fettle = 3L;
+            Integer i = tWarehousebillsfeesMapper.warehouseFeesFollowUpdate(auditItems.getBillId(), fettle, auditItems.getAuditItem());
+            if (i != null && i>0){
+            }else{
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("审批驳回失败,更新费用状态失败");
+            }
+        }else if (auditItems.getActId() == 470) {
+            fettle = 3L;
+            // 财务模块
+            AjaxResult ajaxResult = tFeeServiceImpl.tfeeFollow(auditItems.getBillId(), fettle);
             String code = ajaxResult.get("code").toString();
             if ("500".equals(code)) {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -626,13 +718,13 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                 return AjaxResult.error("审批撤销失败: 更新审批状态失败");
             }
         }else if (auditItems.getActId()== 410 ){
-            fettle = 1L;
+            fettle = 2L;
             TWarehouseBills tWarehouseBills = tWarehouseBillsService.selectKaHeById(auditItems.getBillId());
-            if (!"4".equals(tWarehouseBills.getfBillstatus())){
+            if (tWarehouseBills.getfBillstatus()!= 4L){
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return AjaxResult.error("审批撤销失败: 已经过审批");
             }
-            AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle);
+            AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle,auditItems.getAuditItem());
             String code = ajaxResult.get("code").toString();
             if ("500".equals(code)) {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -641,16 +733,60 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
         }else if (auditItems.getActId()== 420 ){
             fettle = 7L;
             TWarehouseBills tWarehouseBills = tWarehouseBillsService.selectKaHeById(auditItems.getBillId());
-            if (!"9".equals(tWarehouseBills.getfBillstatus())){
+            if (tWarehouseBills.getfBillstatus() != 9L){
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return AjaxResult.error("审批撤销失败: 已经过审批");
             }
-            AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle);
+            AjaxResult ajaxResult = tWarehouseBillsService.updateKaHeOrder(auditItems.getBillId(), fettle,auditItems.getAuditItem());
             String code = ajaxResult.get("code").toString();
             if ("500".equals(code)) {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return ajaxResult;
             }
+        }else if (auditItems.getActId() >= 430 && auditItems.getActId() <= 450) {
+            fettle = 2L;
+            // 查询财务状态
+            TFee tFee = tFeeMapper.selectTFeeById(auditItems.getBillId());
+            if (!"4".equals(tFee.getfBillstatus())) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("审批撤销失败: 已经过审批");
+            }
+            // 财务模块
+            AjaxResult ajaxResult = tFeeServiceImpl.tfeeFollow(auditItems.getBillId(), fettle);
+            String code = ajaxResult.get("code").toString();
+            if ("500".equals(code)) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("审批撤销失败: 更新审批状态失败");
+            }
+        }else if (auditItems.getActId()== 460 ){
+            fettle = 2L;
+            TWarehousebillsfees warehousebillsfees = new TWarehousebillsfees();
+            warehousebillsfees.setfPid(auditItems.getBillId());
+            List<TWarehousebillsfees> tWarehousebillsfees = tWarehousebillsfeesMapper.selectTWarehousebillsfeesList(warehousebillsfees);
+            if (CollectionUtils.isNotEmpty(tWarehousebillsfees) && tWarehousebillsfees.get(0).getfBillstatus() != 4L){
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("审批撤销失败: 已经过审批");
+            }
+            Integer i = tWarehousebillsfeesMapper.warehouseFeesFollowUpdate(auditItems.getBillId(), fettle, auditItems.getAuditItem());
+            if (i != null && i>0){}else  {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("审核失败,更新费用状态失败");
+            }
+        }else if (auditItems.getActId() == 470) {
+            fettle = 2L;
+            // 查询财务状态
+            TFee tFee = tFeeMapper.selectTFeeById(auditItems.getBillId());
+            if (!"4".equals(tFee.getfBillstatus())) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("审批撤销失败: 已经过审批");
+            }
+            // 财务模块
+            AjaxResult ajaxResult = tFeeServiceImpl.tfeeFollow(auditItems.getBillId(), fettle);
+            String code = ajaxResult.get("code").toString();
+            if ("500".equals(code)) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("审批撤销失败: 更新审批状态失败");
+            }
         }
         AuditItems item = new AuditItems();
         item.setBillId(auditItems.getId());

+ 64 - 8
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TFee.java

@@ -55,6 +55,8 @@ public class TFee extends BaseEntity {
      */
     @Excel(name = "结算单位(下拉模糊搜索)")
     private Long fCorpid;
+    //结算单位中文名称
+    private String fCorpidName;
 
     /**
      * 业务员id
@@ -160,11 +162,72 @@ public class TFee extends BaseEntity {
     /** 系统类型(1仓储、2车队、3凯和) */
     @Excel(name = "系统类型(1仓储、2车队、3凯和)")
     private String fSystemType;
+    /**申请金额区间*/
+    private List<String> money;
 
     /**
      * 查询时间区间
      */
     private List<String> timeInterval;
+    /**
+     * 查询申请时间区间
+     */
+    private List<String> applyTime;
+    /**
+     * 申请单位
+     */
+    private String createName;
+    //税率
+    private BigDecimal fTaxrate;
+
+    public String getfSystemType() {
+        return fSystemType;
+    }
+
+    public void setfSystemType(String fSystemType) {
+        this.fSystemType = fSystemType;
+    }
+
+    public BigDecimal getfTaxrate() {
+        return fTaxrate;
+    }
+
+    public void setfTaxrate(BigDecimal fTaxrate) {
+        this.fTaxrate = fTaxrate;
+    }
+
+    public String getfCorpidName() {
+        return fCorpidName;
+    }
+
+    public void setfCorpidName(String fCorpidName) {
+        this.fCorpidName = fCorpidName;
+    }
+
+    public String getCreateName() {
+        return createName;
+    }
+
+    public void setCreateName(String createName) {
+        this.createName = createName;
+    }
+
+    public List<String> getMoney() {
+        return money;
+    }
+
+    public List<String> getApplyTime() {
+        return applyTime;
+    }
+
+    public void setApplyTime(List<String> applyTime) {
+        this.applyTime = applyTime;
+    }
+
+    public void setMoney(List<String> money) {
+        this.money = money;
+    }
+
     public void settimeInterval(List<String> timeInterval) {
         this.timeInterval = timeInterval;
     }
@@ -348,14 +411,6 @@ public class TFee extends BaseEntity {
         this.waterBillNo = waterBillNo;
     }
 
-    public String getFSystemType() {
-        return fSystemType;
-    }
-
-    public void setFSystemType(String fSystemType) {
-        this.fSystemType = fSystemType;
-    }
-
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -381,6 +436,7 @@ public class TFee extends BaseEntity {
                 .append("createTime", getCreateTime())
                 .append("updateBy", getUpdateBy())
                 .append("updateTime", getUpdateTime())
+                .append("fSystemType",getfSystemType())
                 .toString();
     }
 }

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

@@ -109,6 +109,106 @@ public class TFeeDo extends BaseEntity {
      */
     @Excel(name = "备注")
     private String fRemarks;
+    //币别
+    private String fCurrency;
+    //汇率
+    private String fExrate;
+    //船名
+    private String boatName;
+    //航次
+    private String voyageName;
+    //费用名称
+    private String fFeeName;
+    //业务编号
+    private String srcBillNo;
+    //提单号
+    private String fMblno;
+    //业务类型
+    private String fBilltype;
+    //状态中文
+    private String fStatusName;
+    //收付
+    private String fSrcdcName;
+
+    public String getfFeeName() {
+        return fFeeName;
+    }
+
+    public void setfFeeName(String fFeeName) {
+        this.fFeeName = fFeeName;
+    }
+
+    public String getfSrcdcName() {
+        return fSrcdcName;
+    }
+
+    public void setfSrcdcName(String fSrcdcName) {
+        this.fSrcdcName = fSrcdcName;
+    }
+
+    public String getfStatusName() {
+        return fStatusName;
+    }
+
+    public void setfStatusName(String fStatusName) {
+        this.fStatusName = fStatusName;
+    }
+
+    public String getfMblno() {
+        return fMblno;
+    }
+
+    public void setfMblno(String fMblno) {
+        this.fMblno = fMblno;
+    }
+
+    public String getfBilltype() {
+        return fBilltype;
+    }
+
+    public void setfBilltype(String fBilltype) {
+        this.fBilltype = fBilltype;
+    }
+
+    public String getSrcBillNo() {
+        return srcBillNo;
+    }
+
+    public void setSrcBillNo(String srcBillNo) {
+        this.srcBillNo = srcBillNo;
+    }
+
+    public String getfCurrency() {
+        return fCurrency;
+    }
+
+    public void setfCurrency(String fCurrency) {
+        this.fCurrency = fCurrency;
+    }
+
+    public String getfExrate() {
+        return fExrate;
+    }
+
+    public void setfExrate(String fExrate) {
+        this.fExrate = fExrate;
+    }
+
+    public String getBoatName() {
+        return boatName;
+    }
+
+    public void setBoatName(String boatName) {
+        this.boatName = boatName;
+    }
+
+    public String getVoyageName() {
+        return voyageName;
+    }
+
+    public void setVoyageName(String voyageName) {
+        this.voyageName = voyageName;
+    }
 
     public void setfId(Long fId) {
         this.fId = fId;

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

@@ -95,6 +95,96 @@ public class TWareHouseFees extends BaseEntity {
      * 查询时间区间 审核日期
      */
     private List<String> timeExamine;
+    //业务类型 1代表凯和
+    private Integer fTypeid;
+    //系统类型 1 仓储 2 车队 3 凯和
+    private String fSystemType;
+    //船名
+    private String boatName;
+    //航次
+    private String voyageName;
+    //货权方
+    private String fName;
+    //仓库费用表主键
+    private Long[] fSrcidList;
+    //仓库主表主键
+    private Long[] fSrcpidList;
+    /** 起运港 */
+    private Long fLoadportid;
+    /** 目的港 */
+    private Long fDestportid;
+
+    public Long getfLoadportid() {
+        return fLoadportid;
+    }
+
+    public void setfLoadportid(Long fLoadportid) {
+        this.fLoadportid = fLoadportid;
+    }
+
+    public Long getfDestportid() {
+        return fDestportid;
+    }
+
+    public void setfDestportid(Long fDestportid) {
+        this.fDestportid = fDestportid;
+    }
+
+    public Long[] getfSrcidList() {
+        return fSrcidList;
+    }
+
+    public void setfSrcidList(Long[] fSrcidList) {
+        this.fSrcidList = fSrcidList;
+    }
+
+    public Long[] getfSrcpidList() {
+        return fSrcpidList;
+    }
+
+    public void setfSrcpidList(Long[] fSrcpidList) {
+        this.fSrcpidList = fSrcpidList;
+    }
+
+    public String getfName() {
+        return fName;
+    }
+
+    public void setfName(String fName) {
+        this.fName = fName;
+    }
+
+    public String getBoatName() {
+        return boatName;
+    }
+
+    public void setBoatName(String boatName) {
+        this.boatName = boatName;
+    }
+
+    public String getVoyageName() {
+        return voyageName;
+    }
+
+    public void setVoyageName(String voyageName) {
+        this.voyageName = voyageName;
+    }
+
+    public String getfSystemType() {
+        return fSystemType;
+    }
+
+    public void setfSystemType(String fSystemType) {
+        this.fSystemType = fSystemType;
+    }
+
+    public Integer getfTypeid() {
+        return fTypeid;
+    }
+
+    public void setfTypeid(Integer fTypeid) {
+        this.fTypeid = fTypeid;
+    }
 
     public List<String> getTimeExamine() {
         return timeExamine;
@@ -122,6 +212,50 @@ public class TWareHouseFees extends BaseEntity {
      * 查询时间区间 入(出)库日期
      */
     private List<String> timeInterval;
+    /**
+     * 查询时间区间 入(出)库日期
+     */
+    private List<String> createTimeList;
+    //船id
+    private Long fVslid;
+    //航次id
+    private Long fVoyid;
+    //查询类型
+    private String billsType;
+
+    public Long getfVslid() {
+        return fVslid;
+    }
+
+    public void setfVslid(Long fVslid) {
+        this.fVslid = fVslid;
+    }
+
+    public Long getfVoyid() {
+        return fVoyid;
+    }
+
+
+    public void setfVoyid(Long fVoyid) {
+        this.fVoyid = fVoyid;
+    }
+
+    public String getBillsType() {
+        return billsType;
+    }
+
+    public void setBillsType(String billsType) {
+        this.billsType = billsType;
+    }
+
+    public List<String> getCreateTimeList() {
+        return createTimeList;
+    }
+
+    public void setCreateTimeList(List<String> createTimeList) {
+        this.createTimeList = createTimeList;
+    }
+
     public void settimeInterval(List<String> timeInterval) {
         this.timeInterval = timeInterval;
     }

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

@@ -27,6 +27,13 @@ public interface TFeeDoMapper {
      * @return 财务数据明细集合
      */
     public List<TFeeDo> selectTFeeDoList(TFeeDo tFeeDo);
+    /**
+     * 查询财务数据明细列表
+     * 根据主表id
+     * @param fPid 财务数据明细
+     * @return 财务数据明细集合
+     */
+    public List<TFeeDo> selectTFeeDoByfPid(@Param("fPid") Long fPid);
 
     /**
      * 新增财务数据明细

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

@@ -24,6 +24,13 @@ public interface TFeeMapper {
      * @return 财务数据主
      */
     public TFee selectTFeeById(Long fId);
+    /**
+     * 查询财务数据主
+     *
+     * @param fId 财务数据主ID
+     * @return 财务数据主
+     */
+    public TFee selectTFeeByIdNew(Long fId);
 
     /**
      * 查询财务数据主列表
@@ -74,6 +81,12 @@ public interface TFeeMapper {
     public List<Map<String, Object>> warehouseBillsFeesList(@Param("map") Map<String, Object> map);
 
     public List<Map<String, Object>> warehouseBillsFeesListAccamount(@Param("map") Map<String, Object> map);
+    //发票申请查询
+    public List<Map<String, Object>> warehouseApplyFPFeesList(@Param("map") Map<String, Object> map);
+    //开发票查询
+    public List<Map<String, Object>> warehouseInvoiceFPFeesList(@Param("map") Map<String, Object> map);
+
+    public List<Map<String, Object>> warehouseBillsKHFeesListAccamount(@Param("map") Map<String, Object> map);
 
     public List<Map<String, Object>> warehouseBillsFeesList1(TWareHouseFees tWareHouseFees);
 

+ 3 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeDoService.java

@@ -1,5 +1,6 @@
 package com.ruoyi.finance.service;
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.finance.domain.TFeeDo;
 
 import java.util.List;
@@ -59,4 +60,6 @@ public interface ITFeeDoService {
      * @return 结果
      */
     public int deleteTFeeDoById(Long fId);
+
+    public AjaxResult removeFeeDoById(Long fId);
 }

+ 29 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeService.java

@@ -31,6 +31,13 @@ public interface ITFeeService {
      * @return 财务数据主
      */
     public Map<String, Object> selectTFeeById(Long fId);
+    /**
+     * 查询财务数据主
+     *
+     * @param fId 财务数据主ID
+     * @return 财务数据主
+     */
+    public Map<String, Object> selectTFeeByIdNew(Long fId);
 
     /**
      * 查询财务数据主列表
@@ -60,6 +67,15 @@ public interface ITFeeService {
      * @return
      */
     public AjaxResult insertTFeeTFeeDo(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
+    /**
+     *  保存对账、收款
+     * @param tfee
+     * @param tfeeDo
+     * @param loginUser
+     * @param fBilltype
+     * @return
+     */
+    public AjaxResult insertKHTFeeTFeeDo(String tfee, String tfeeDo,String tFeeInvoice,LoginUser loginUser,String fBilltype);
 
     /**
      * 修改财务数据主
@@ -106,10 +122,23 @@ public interface ITFeeService {
      */
     public AjaxResult confirm(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
 
+    /**
+     * 凯和
+     * @param tfee
+     * @param tfeeDo
+     * @param tFeeInvoice
+     * @param loginUser
+     * @param fBilltype
+     * @return
+     */
+    public AjaxResult confirmKaiHe(String tfee, String tfeeDo,String tFeeInvoice,LoginUser loginUser,String fBilltype);
+
     public AjaxResult revoke(String tfee, String tfeeDo ,LoginUser loginUser,String fBilltype);
 
     public AjaxResult queryRemove(Long fId);
 
+    public AjaxResult remove(Long fId);
+
     /**
      *  导出计算明细
      * @param fId

+ 18 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeDoServiceImpl.java

@@ -1,6 +1,8 @@
 package com.ruoyi.finance.service.impl;
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.finance.domain.TFee;
 import com.ruoyi.finance.domain.TFeeDo;
 import com.ruoyi.finance.mapper.TFeeDoMapper;
 import com.ruoyi.finance.service.ITFeeDoService;
@@ -87,4 +89,20 @@ public class TFeeDoServiceImpl implements ITFeeDoService {
     public int deleteTFeeDoById(Long fId) {
         return tFeeDoMapper.deleteTFeeDoById(fId);
     }
+
+    @Override
+    public AjaxResult removeFeeDoById(Long fId) {
+        TFeeDo tFeeDo = tFeeDoMapper.selectTFeeDoById(fId);
+        if ("4".equals(tFeeDo.getfStatus())
+                || "5".equals(tFeeDo.getfStatus())
+                ||"6".equals(tFeeDo.getfStatus())){
+            return AjaxResult.error("数据已提交审批,暂不能删除");
+        }
+        Integer i = tFeeDoMapper.deleteTFeeDoById(fId);
+        if (i != null && i >0){
+            return AjaxResult.success();
+        }else {
+            return AjaxResult.error("删除失败,请找管理员");
+        }
+    }
 }

+ 311 - 6
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.finance.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.ruoyi.approvalFlow.domain.AuditItems;
 import com.ruoyi.approvalFlow.service.impl.AuditItemsServiceImpl;
 import com.ruoyi.basicData.domain.TCorps;
@@ -27,6 +28,8 @@ import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Payable;
 import com.ruoyi.reportManagement.excel.Profit;
 import com.ruoyi.reportManagement.excel.Receivable;
+import com.ruoyi.shipping.domain.TFeeInvoice;
+import com.ruoyi.shipping.mapper.TFeeInvoiceMapper;
 import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.mapper.SysConfigMapper;
 import com.ruoyi.system.service.ISysDictDataService;
@@ -87,6 +90,8 @@ public class TFeeServiceImpl implements ITFeeService {
 
     @Autowired
     private ISysDictDataService iSysDictDataService;
+    @Autowired
+    private TFeeInvoiceMapper tFeeInvoiceMapper;
 
 
 
@@ -123,8 +128,14 @@ public class TFeeServiceImpl implements ITFeeService {
                 TWarehouseBills tWarehousebills = tWarehouseBillsMapper.selectTWarehousebillsById(fees.getfSrcpid());
                 // 费用名称
                 TFees tFees= tFeesMapper.selectTFeesById(fees.getfFeeid());
+                if (tFees == null){
+                    return AjaxResult.error("费用名称为空,请确认");
+                }
                 // 费用表数据
                 TWarehousebillsfees tWarehousebillsfees = tWarehousebillsfeesMapper.selectTWarehousebillsfeesById(fees.getfSrcid());
+                if (tWarehousebillsfees == null){
+                    return AjaxResult.error("费用数据为空,请确认");
+                }
                 // 字典宝
                 SysDictData sysDictData =new SysDictData();
                 sysDictData.setDictType("data_unitfees");
@@ -172,7 +183,11 @@ public class TFeeServiceImpl implements ITFeeService {
                 map1.put("fFeeunitid",sysDictDataList.get(0).getDictLabel());
                 map1.put("fQty",tWarehousebillsfees.getfQty());
                 map1.put("fUnitprice",tWarehousebillsfees.getfUnitprice());
-                map1.put("fBusinessType",sysDictDataListIn.get(0).getDictLabel());
+                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")){
@@ -183,6 +198,8 @@ public class TFeeServiceImpl implements ITFeeService {
                     map1.put("fBilltype","货物通关");
                 } else if(tWarehousebills.getfBilltype().equals("HQZY")){
                     map1.put("fBilltype","货权转移");
+                }else if(tWarehousebills.getfBilltype().equals("KHDD")){
+                    map1.put("fBilltype","船运订单");
                 }
                 feeDoList.add(map1);
             }
@@ -211,6 +228,20 @@ public class TFeeServiceImpl implements ITFeeService {
         return map;
     }
 
+    @Override
+    public Map<String, Object> selectTFeeByIdNew(Long fId) {
+        Map<String,Object> map = new HashMap<>();
+        TFee tFee = tFeeMapper.selectTFeeByIdNew(fId);
+        List<TFeeDo> feeDoList = tFeeDoMapper.selectTFeeDoByfPid(fId);
+        TFeeInvoice tFeeInvoice = new TFeeInvoice();
+        tFeeInvoice.setfPid(fId);
+        List<TFeeInvoice> tFeeInvoiceList = tFeeInvoiceMapper.selectTFeeInvoiceList(tFeeInvoice);
+        map.put("tFee",tFee);
+        map.put("feeDoList",feeDoList);
+        map.put("tFeeInvoiceList",tFeeInvoiceList);
+        return map;
+    }
+
     /**
      * 查询财务数据主列表
      *
@@ -263,15 +294,71 @@ public class TFeeServiceImpl implements ITFeeService {
             Date time = new Date();
             String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
             tFee.setfBillno(billNo);
+            tFee.setfBillstatus("2");
+            tFeeMapper.insertTFee(tFee);
+            fPid = tFee.getfId();
+        } else {
+            fPid = tFee.getfId();
+            tFee.setUpdateBy(loginUser.getUser().getUserName());
+            tFee.setUpdateTime(new Date());
+            tFeeMapper.updateTFee(tFee);
+            // 删除从表
+            tFeeDoMapper.deleteByFPid(fPid);
+        }
+        //  财务从表
+        if (StringUtils.isNotNull(tfeeDo)) {
+            JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
+            List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
+            for (TFeeDo tFeeDo : tFeeDoList) {
+                tFeeDo.setfPid(fPid);
+                tFeeDo.setCreateBy(loginUser.getUser().getUserName());
+                tFeeDo.setCreateTime(new Date());
+                tFeeDo.setfStatus("2");
+                tFeeDoMapper.insertTFeeDo(tFeeDo);
+            }
+        }
+        map.put("tFee", tFee);
+        return AjaxResult.success("成功", map);
+    }
+    /**
+     *    新增对账 、收费、
+     * @param tfee
+     * @param tfeeDo
+     * @param loginUser
+     * @param fBilltype
+     * @return
+     */
+    @Override
+    @Transactional
+    public AjaxResult insertKHTFeeTFeeDo(String tfee, String tfeeDo,String tFeeInvoice, LoginUser loginUser, String fBilltype) {
+        Long fPid = null;
+        Map<String, Object> map = new HashMap<>();
+        TFee tFee = JSONArray.parseObject(tfee, TFee.class);
+        if (StringUtils.isNull(tFee.getfId())) {
+            // 如果是新数据
+            tFee.setCreateBy(loginUser.getUser().getUserName());
+            tFee.setCreateTime(new Date());
+            tFee.setfDeptid(loginUser.getUser().getDeptId());
+            tFee.setfBilltype(fBilltype);
+            // 业务编码
+            Date time = new Date();
+            String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
+            tFee.setfBillno(billNo);
+            tFee.setfBillstatus("2");
             tFeeMapper.insertTFee(tFee);
             fPid = tFee.getfId();
         } else {
             fPid = tFee.getfId();
+            boolean change = this.change(fPid);
+            if (!change){
+                return AjaxResult.error("当前数据不支持修改");
+            }
             tFee.setUpdateBy(loginUser.getUser().getUserName());
             tFee.setUpdateTime(new Date());
             tFeeMapper.updateTFee(tFee);
             // 删除从表
             tFeeDoMapper.deleteByFPid(fPid);
+            tFeeInvoiceMapper.deleteByFPid(fPid);
         }
         //  财务从表
         if (StringUtils.isNotNull(tfeeDo)) {
@@ -281,9 +368,21 @@ public class TFeeServiceImpl implements ITFeeService {
                 tFeeDo.setfPid(fPid);
                 tFeeDo.setCreateBy(loginUser.getUser().getUserName());
                 tFeeDo.setCreateTime(new Date());
+                tFeeDo.setfStatus("2");
                 tFeeDoMapper.insertTFeeDo(tFeeDo);
             }
         }
+        if (!"".equals(tFeeInvoice) && tFeeInvoice != null && !"null".equals(tFeeInvoice)) {
+            JSONArray jsonDrArray = JSONArray.parseArray(tFeeInvoice);
+            List<TFeeInvoice> tFeeInvoiceList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeInvoice.class);
+            for (TFeeInvoice feeInvoice : tFeeInvoiceList) {
+                feeInvoice.setfPid(fPid);
+                feeInvoice.setCreateBy(loginUser.getUser().getUserName());
+                feeInvoice.setCreateTime(new Date());
+                feeInvoice.setfBillstatus("2");
+                tFeeInvoiceMapper.insertTFeeInvoice(feeInvoice);
+            }
+        }
         map.put("tFee", tFee);
         return AjaxResult.success("成功", map);
     }
@@ -338,9 +437,13 @@ public class TFeeServiceImpl implements ITFeeService {
         Map<String, Object> map = new HashMap<>();
         map.put("tWareHouseFees", tWareHouseFees);
         List<Map<String, Object>> mapList =new ArrayList<>();
-        if(billsType.equals("DZ")){
+        if(billsType.equals("DZ") ||billsType.equals("KHDZ")){
             mapList = tFeeMapper.warehouseBillsFeesListAccamount(map);
-        } else{
+        }else if (billsType.equals("invoiceFP")){
+            mapList = tFeeMapper.warehouseInvoiceFPFeesList(map);
+        }else if (billsType.equals("ApplyFP")){
+            mapList = tFeeMapper.warehouseApplyFPFeesList(map);
+        }else{
             mapList = tFeeMapper.warehouseBillsFeesList(map);
             /*if(tWareHouseFees.getfStatementNo()!=null && !tWareHouseFees.getfStatementNo().equals("")){
                 mapList = tFeeMapper.warehouseBillsFeesListAccamount(map);
@@ -371,14 +474,49 @@ public class TFeeServiceImpl implements ITFeeService {
     @Override
     @Transactional
     public AjaxResult confirm(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype) {
-
+        String key = "";
+        boolean isApprove = false;
+        long actId = 0L;
+        if ("DZ".equals(fBilltype)) {
+            actId = 210L;
+            key = "warehouse.contrast.ApprovalFlow";
+        } else if ("SF".equals(fBilltype)) {
+            actId = 220L;
+            key = "warehouse.charge.ApprovalFlow";
+        } else if ("FF".equals(fBilltype)) {
+            actId = 230L;
+            key = "warehouse.payment.ApprovalFlow";
+        } else if ("KHDZ".equals(fBilltype)) {
+            actId = 430L;
+            key = "warehouse.kaiHeContrast.ApprovalFlow";
+        } else if ("KHSF".equals(fBilltype)) {
+            actId = 440L;
+            key = "warehouse.kaiHeCharge.ApprovalFlow";
+        }else if ("KHFF".equals(fBilltype)) {
+            actId = 450L;
+            key = "warehouse.kaiHePayment.ApprovalFlow";
+        }
+        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
+        if (StringUtils.isNull(sysConfig)) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return AjaxResult.error("系统参数异常,未找到开启审批流参数");
+        }
+        if ("0".equals(sysConfig.getConfigValue())) {
+            isApprove = true;
+        }
         TFee tFee = JSONArray.parseObject(tfee, TFee.class);
-        tFee.setfBillstatus("4");
+        String billstatus = "";
+        if (isApprove){
+            billstatus = "4";
+        }else {
+            billstatus = "6";
+        }
         if (StringUtils.isNull(tFee.getfId())) {
             // 如果是新数据
             tFee.setCreateBy(loginUser.getUser().getUserName());
             tFee.setfDeptid(loginUser.getUser().getDeptId());
             tFee.setfBilltype(fBilltype);
+            tFee.setfBillstatus(billstatus);
             // 业务编码
             Date time = new Date();
             String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
@@ -387,6 +525,7 @@ public class TFeeServiceImpl implements ITFeeService {
         } else {
             tFee.setUpdateBy(loginUser.getUser().getUserName());
             tFee.setUpdateTime(new Date());
+            tFee.setfBillstatus(billstatus);
             tFeeMapper.updateTFee(tFee);
             // 删除从表
             tFeeDoMapper.deleteByFPid(tFee.getfId());
@@ -399,13 +538,63 @@ public class TFeeServiceImpl implements ITFeeService {
                 tFeeDo.setfPid(tFee.getfId());
                 tFeeDo.setCreateBy(loginUser.getUser().getUserName());
                 tFeeDo.setCreateTime(new Date());
+                tFeeDo.setfStatus(billstatus);
                 tFeeDoMapper.insertTFeeDo(tFeeDo);
             }
         }
         // 这里加个判断取系统参数来确定是否需要启用审批流
+
+        if (isApprove) {
+            AuditItems auditItems = new AuditItems();
+            auditItems.setLevelId(0L);
+            auditItems.setBillId(tFee.getfId());
+            auditItems.setActId(actId);
+            auditItems.setIffinalItem("F");
+            auditItems.setBillNo(tFee.getfBillno()); // 业务编号
+            auditItems.setRefno1(String.valueOf(tFee.getfCorpid())); // 货权方
+            auditItems.setRefno2(tFee.getfBilltype());// 财务类型
+            auditItems.setRefno3(tFee.gettMblno());// 提单号
+            auditItems.setSendUserId(loginUser.getUser().getUserId());
+            auditItems.setSendName(loginUser.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);
+            Long code = Long.valueOf(String.valueOf(approvalFlow.get("code"))).longValue();
+            if (code.equals(500L)) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            }
+            return approvalFlow;
+        }else {
+            if (StringUtils.isNotNull(tfeeDo) && !"[]".equals(tfeeDo)) {
+                JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
+                List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
+                for (TFeeDo tFeeDo : tFeeDoList) {
+                    // 跟新费用明细
+                    int m = updateBillsFees(tFee.getfId(),tFeeDo,fBilltype);
+                    if (m == 0) {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return AjaxResult.error("更新费用明细失败");
+                    }
+                }
+            }
+            AjaxResult ajaxResult = tfeeFollow(tFee.getfId(), 6L);
+            Long code = Long.valueOf(String.valueOf(ajaxResult.get("code"))).longValue();
+            return ajaxResult;
+        }
+    }
+
+    @Override
+    public AjaxResult confirmKaiHe(String tfee, String tfeeDo,String tFeeInvoice,LoginUser loginUser, String fBilltype) {
+        Long fPid = null;
+        TFee tFee = JSONArray.parseObject(tfee, TFee.class);
         String key = "";
         boolean isApprove = false;
         long actId = 0L;
+        String billStatus = "";
         if ("DZ".equals(fBilltype)) {
             actId = 210L;
             key = "warehouse.contrast.ApprovalFlow";
@@ -415,6 +604,18 @@ public class TFeeServiceImpl implements ITFeeService {
         } else if ("FF".equals(fBilltype)) {
             actId = 230L;
             key = "warehouse.payment.ApprovalFlow";
+        } else if ("KHDZ".equals(fBilltype)) {
+            actId = 430L;
+            key = "warehouse.kaiHeContrast.ApprovalFlow";
+        } else if ("KHSF".equals(fBilltype)) {
+            actId = 440L;
+            key = "warehouse.kaiHeCharge.ApprovalFlow";
+        }else if ("KHFF".equals(fBilltype)) {
+            actId = 450L;
+            key = "warehouse.kaiHePayment.ApprovalFlow";
+        }else if ("ApplyFP".equals(fBilltype)) {
+            actId = 470L;
+            key = "warehouse.kaiHeApplyFP.ApprovalFlow";
         }
         SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
         if (StringUtils.isNull(sysConfig)) {
@@ -424,6 +625,62 @@ public class TFeeServiceImpl implements ITFeeService {
         if ("0".equals(sysConfig.getConfigValue())) {
             isApprove = true;
         }
+        if (isApprove){
+            billStatus = "4";
+        }else {
+            billStatus ="6";
+        }
+        if (StringUtils.isNull(tFee.getfId())) {
+            // 如果是新数据
+            tFee.setCreateBy(loginUser.getUser().getUserName());
+            tFee.setfDeptid(loginUser.getUser().getDeptId());
+            tFee.setfBilltype(fBilltype);
+            // 业务编码
+            Date time = new Date();
+            String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
+            tFee.setfBillno(billNo);
+            tFee.setfBillstatus(billStatus);
+            tFeeMapper.insertTFee(tFee);
+            fPid = tFee.getfId();
+        } else {
+            fPid = tFee.getfId();
+            boolean change = this.change(fPid);
+            if (!change){
+                return AjaxResult.error("当前数据不支持修改");
+            }
+            tFee.setUpdateBy(loginUser.getUser().getUserName());
+            tFee.setUpdateTime(new Date());
+            tFee.setfBillstatus(billStatus);
+            tFeeMapper.updateTFee(tFee);
+            // 删除从表
+            tFeeDoMapper.deleteByFPid(tFee.getfId());
+            //删除开票从表
+            tFeeInvoiceMapper.deleteByFPid(tFee.getfId());
+        }
+        //  财务从表
+        if (StringUtils.isNotNull(tfeeDo) && !"[]".equals(tfeeDo)) {
+            JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
+            List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
+            for (TFeeDo tFeeDo : tFeeDoList) {
+                tFeeDo.setfPid(tFee.getfId());
+                tFeeDo.setCreateBy(loginUser.getUser().getUserName());
+                tFeeDo.setCreateTime(new Date());
+                tFeeDo.setfStatus(billStatus);
+                tFeeDoMapper.insertTFeeDo(tFeeDo);
+            }
+        }
+        if (!"".equals(tFeeInvoice) && tFeeInvoice != null && !"null".equals(tFeeInvoice)) {
+            JSONArray jsonDrArray = JSONArray.parseArray(tFeeInvoice);
+            List<TFeeInvoice> tFeeInvoiceList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeInvoice.class);
+            for (TFeeInvoice feeInvoice : tFeeInvoiceList) {
+                feeInvoice.setfPid(fPid);
+                feeInvoice.setCreateBy(loginUser.getUser().getUserName());
+                feeInvoice.setCreateTime(new Date());
+                feeInvoice.setfBillstatus(billStatus);
+                tFeeInvoiceMapper.insertTFeeInvoice(feeInvoice);
+            }
+        }
+        // 这里加个判断取系统参数来确定是否需要启用审批流
         if (isApprove) {
             AuditItems auditItems = new AuditItems();
             auditItems.setLevelId(0L);
@@ -489,8 +746,20 @@ public class TFeeServiceImpl implements ITFeeService {
         try{
             int itemUpdateResult = tFeeDoMapper.tfeeDoFollowUpdate(fPid,fettle);
         } catch (Exception exception){
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return AjaxResult.error("更新财务明细状态失败,请联系管理员");
         }
+        TFeeInvoice invoice = new TFeeInvoice();
+        invoice.setfPid(fPid);
+        List<TFeeInvoice> tFeeInvoiceList = tFeeInvoiceMapper.selectTFeeInvoiceList(invoice);
+        if (CollectionUtils.isNotEmpty(tFeeInvoiceList)){
+            try{
+                int itemUpdateResult = tFeeInvoiceMapper.tFeeInvoiceUpdate(fPid,fettle);
+            } catch (Exception exception){
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("更新开票明细状态失败,请联系管理员");
+            }
+        }
         return AjaxResult.success();
     }
 
@@ -561,6 +830,29 @@ public class TFeeServiceImpl implements ITFeeService {
     }
 
     @Override
+    @Transactional
+    public AjaxResult remove(Long fId) {
+        TFee tFee=tFeeMapper.selectTFeeById(fId);
+        if ("4".equals(tFee.getfBillstatus())){
+            return AjaxResult.error("数据已提交审批,暂不能删除");
+        }else if ("5".equals(tFee.getfBillstatus())){
+            return AjaxResult.error("数据正在审批,暂不能删除");
+        }else if ("6".equals(tFee.getfBillstatus())){
+            return AjaxResult.error("数据审批完成,不能删除");
+        }else {
+            try {
+                tFeeMapper.deleteTFeeById(fId);
+                tFeeDoMapper.deleteByFPid(fId);
+                tFeeInvoiceMapper.deleteByFPid(fId);
+            }catch (Exception e){
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("删除失败,请找管理员");
+            }
+            return AjaxResult.success();
+        }
+    }
+
+    @Override
     public List<TWareHouseExcelItem> selectTWarehousebillsItemsList(Long fId) {
         List<TWareHouseExcelItem> tWareHouseExcelItemList = tFeeMapper.selectTWarehousebillsItemsList(fId);
         List<TWareHouseExcelItem> tWareHouseExcelItemList1 = new ArrayList<>();
@@ -690,7 +982,8 @@ public class TFeeServiceImpl implements ITFeeService {
     public  int  updateBillsFees(Long fid,TFeeDo tFeeDo,String billsType){
         // 查询从表数据
         TFee tFee=tFeeMapper.selectTFeeById(fid);
-        if(billsType.equals("SF") || billsType.equals("FF")){
+        if(billsType.equals("SF") || billsType.equals("FF")
+        || billsType.equals("KHSF") || billsType.equals("KHFF")){
             billsType="DC";
         }
         Map<String, Object> map = new HashMap<>();
@@ -699,6 +992,18 @@ public class TFeeServiceImpl implements ITFeeService {
         map.put("tFeeDo", tFeeDo);
         return tWarehousebillsfeesMapper.updateTWarehousebillsfee(map);
     }
+    public boolean change(Long fId){
+        boolean flag = false;
+        TFee tFee = tFeeMapper.selectTFeeById(fId);
+        if ("4".equals(tFee.getfBillstatus())
+                || "5".equals(tFee.getfBillstatus())
+                ||"6".equals(tFee.getfBillstatus())){
+            flag = false;
+        }else {
+            flag = true;
+        }
+        return flag;
+    }
 
 
 

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

@@ -460,10 +460,30 @@ public class TWarehouseBills extends BaseEntity {
     private String boxNumber;
     //客户名称
     private String corpName;
+    //查询时间区间
+    private List<String> cLoadDate;
     //应收款信息
     private List<TWarehousebillsfees> tWarehousebillsfeesDr;
     //应付款信息
     List<TWarehousebillsfees> warehousebillsfeesCr;
+    //费用状态
+    private Long moneyStatus;
+
+    public Long getMoneyStatus() {
+        return moneyStatus;
+    }
+
+    public void setMoneyStatus(Long moneyStatus) {
+        this.moneyStatus = moneyStatus;
+    }
+
+    public List<String> getcLoadDate() {
+        return cLoadDate;
+    }
+
+    public void setcLoadDate(List<String> cLoadDate) {
+        this.cLoadDate = cLoadDate;
+    }
 
     public String getCorpName() {
         return corpName;

+ 10 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehousebillsfees.java

@@ -281,6 +281,16 @@ public class TWarehousebillsfees extends BaseEntity {
     private String corpName;
     //费用中文名
     private String feeName;
+    //状态中文
+    private String fBillstatusName;
+
+    public String getfBillstatusName() {
+        return fBillstatusName;
+    }
+
+    public void setfBillstatusName(String fBillstatusName) {
+        this.fBillstatusName = fBillstatusName;
+    }
 
     public String getCorpName() {
         return corpName;

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

@@ -62,6 +62,13 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
      * @return 结果
      */
     public int updateTWarehousebills(TWarehouseBills tWarehousebills);
+    /**
+     * 修改详情主表
+     *
+     * @param tWarehousebills 详情主表
+     * @return 结果
+     */
+    public int updateKaHeOrder(TWarehouseBills tWarehousebills);
 
     /**
      * 删除详情主表

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

@@ -317,5 +317,16 @@ public interface ITWarehouseBillsService {
     public AjaxResult ruoYiUpdateOrderMessage(String tWarehousebills,String tWarehousebillsCntritems,
                                               String tWarehousebillsfeesCr,String tWarehousebillsfeesDr,LoginUser loginUser,
                                               String billsType);
+    /**
+     * 若依维护订单信息
+     * @param tWarehousebills
+     * @param tWarehousebillsCntritems
+     * @param tWarehousebillsfeesCr
+     * @param tWarehousebillsfeesDr
+     * @return
+     */
+    public AjaxResult ruoYiSubmitMessage(String tWarehousebills,String tWarehousebillsCntritems,
+                                              String tWarehousebillsfeesCr,String tWarehousebillsfeesDr,LoginUser loginUser,
+                                              String billsType);
 
 }

+ 10 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/BillnoSerialServiceImpl.java

@@ -97,6 +97,16 @@ public class BillnoSerialServiceImpl implements IBillnoSerialService {
             billNo = "HWTG" + billNo;
         }else if ("SE".equals(billType)){
             billNo = "SE" + billNo;
+        }else if ("KHDZ".equals(billType)) {
+            billNo = "KHDZ" + billNo;
+        } else if ("KHSF".equals(billType)) {
+            billNo = "KHSF" + billNo;
+        } else if ("KHFF".equals(billType)) {
+            billNo = "KHFF" + billNo;
+        }else if ("ApplyFP".equals(billType)) {
+            billNo = "ApplyFP" + billNo;
+        }else if ("invoiceFP".equals(billType)) {
+            billNo = "invoiceFP" + billNo;
         }
         return billNo;
     }

+ 161 - 7
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -23,6 +23,7 @@ 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.TWareHouseFees;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.mapper.TWhgenlegMapper;
@@ -615,7 +616,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             warehouseBills.setfBillno(billNo);
             warehouseBills.setCreateTime(DateUtils.getNowDate());
             warehouseBills.setCreateBy(SecurityUtils.getUsername());
-            warehouseBills.setfBilltype("SE");
+            warehouseBills.setfBilltype(billsType);
             warehouseBills.setfTypeid(1);
             warehouseBills.setfBillstatus(2L);
             warehouseBills.setfDeptid(loginUser.getUser().getDeptId());
@@ -694,11 +695,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             warehouseBills.setfBillno(billNo);
             warehouseBills.setCreateTime(DateUtils.getNowDate());
             warehouseBills.setCreateBy(SecurityUtils.getUsername());
-            warehouseBills.setfBilltype("SE");
+            warehouseBills.setfBilltype(billsType);
             warehouseBills.setfTypeid(1);
             warehouseBills.setfDeptid(loginUser.getUser().getDeptId());
             warehouseBills.setfBsdeptid(loginUser.getUser().getDeptId());
             warehouseBills.setfCorpid(clientFid);
+            warehouseBills.setfContacts(loginUser.getUser().getUserName());
+            warehouseBills.setfTel(loginUser.getUser().getPhonenumber());
             if (isApprove) {
                 warehouseBills.setfBillstatus(4L);
             } else {
@@ -851,6 +854,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             warehouseBills.setfBillstatus(9L);
         } else {
             warehouseBills.setfBillstatus(11L);
+            warehouseBills.setfReviewDate(new Date());
         }
         TWarehouseBills tWarehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(warehouseBills.getfId());
         if (tWarehouseBills.getfBillstatus()== 6L
@@ -1393,6 +1397,11 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 //应付信息
                 List<TWarehousebillsfees> warehousebillsfeesCr = tWarehousebillsfeesMapper.selectFeesByPId(warehouseBill.getfId(), "C");
                 warehouseBill.setWarehousebillsfeesCr(warehousebillsfeesCr);
+                if (CollectionUtils.isNotEmpty(tWarehousebillsfeesDr)){
+                    warehouseBill.setMoneyStatus(tWarehousebillsfeesDr.get(0).getfBillstatus());
+                }else if (CollectionUtils.isNotEmpty(warehousebillsfeesCr)){
+                    warehouseBill.setMoneyStatus(warehousebillsfeesCr.get(0).getfBillstatus());
+                }
             }
         }
         return warehouseBills;
@@ -1435,6 +1444,18 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             }
             map.put("tWarehousebillsCntritemsList",tWarehousebillsCntritemsList);
         }
+        TWarehousebillsfees warehousebillsfees = new TWarehousebillsfees();
+        warehousebillsfees.setfPid(warehouseBills.getfId());
+        List<TWarehousebillsfees> tWarehousebillsfees = tWarehousebillsfeesMapper.selectTWarehousebillsfeesList(warehousebillsfees);
+        if (CollectionUtils.isNotEmpty(tWarehousebillsfees)){
+            Long aLong = tWarehousebillsfees.get(0).getfBillstatus();
+            if (aLong == 4L || aLong == 5L){
+                return AjaxResult.error("订单费用审核中,不支持修改");
+            }
+            if (aLong == 6L){
+                return AjaxResult.error("订单费用审核通过,不支持修改");
+            }
+        }
         int c = tWarehousebillsfeesMapper.deleteFessByFPid(warehouseBills.getfId(), "C");
         if (StringUtils.isNotNull(tWarehousebillsfeesCr) && !"[]".equals(tWarehousebillsfeesCr)) {
             JSONArray jsonCrArray = JSONArray.parseArray(tWarehousebillsfeesCr);
@@ -1462,7 +1483,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             for (TWarehousebillsfees wbDr : warehousebillsfeesDrList) {
                 wbDr.setfPid(warehouseBills.getfId());
                 wbDr.setfDc("D");
-                wbDr.setfBillstatus(4L);
                 wbDr.setfBilltype(billsType);
                 wbDr.setCreateTime(new Date());
                 wbDr.setSrcBillNo(tWarehouseBills.getfBillno());
@@ -1478,12 +1498,143 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         }
         return AjaxResult.success("success",map);
     }
+    @Override
+    @Transactional
+    public AjaxResult ruoYiSubmitMessage(String tWarehousebills,String tWarehousebillsCntritems,String tWarehousebillsfeesCr,
+                                              String tWarehousebillsfeesDr,LoginUser loginUser,String billsType) {
+        boolean isApprove = false;
+        String key = "";
+        long actId = 0L;
+        Long billStatus = null;
+        if ("KHDD".equals(billsType)) {
+            actId = 460L;
+            key = "warehouse.khSubmitMoney.ApprovalFlow";
+        }
+        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
+        if (StringUtils.isNull(sysConfig)) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return AjaxResult.error("系统参数异常,未找到开启审批流参数");
+        }
+        if ("0".equals(sysConfig.getConfigValue())) {
+            isApprove = true;
+        }
+        if (isApprove){
+            billStatus = 4L;
+        }else {
+            billStatus = 6L;
+        }
+        TWarehouseBills warehouseBills = JSONArray.parseObject(tWarehousebills, TWarehouseBills.class);
+        Map<String ,Object> map = new HashMap<>();
+        if (StringUtils.isEmpty(warehouseBills.getfMblno())){
+            return AjaxResult.error("提单号不能为空");
+        }
+        TWarehouseBills mblno = tWarehouseBillsMapper.selectTWarehousebillsfMblno(warehouseBills);
+        if (StringUtils.isNotNull(mblno) && !mblno.getfId().equals(mblno.getfId())) {
+            return AjaxResult.error("提单号已存在,请重新提交");
+        }
+        TWarehouseBills tWarehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(warehouseBills.getfId());
+        if (tWarehouseBills.getfBillstatus() != 11L){
+            return AjaxResult.error("订单未审核完成,暂不支持维护提单号");
+        }
+        TWarehouseBills bills = new TWarehouseBills();
+        bills.setfId(warehouseBills.getfId());
+        bills.setfMblno(warehouseBills.getfMblno());
+        Integer integer = tWarehouseBillsMapper.updateTWarehousebills(bills);
+        map.put("tWarehouseBills",tWarehouseBills);
+        if (StringUtils.isNotEmpty(tWarehousebillsCntritems)){
+            JSONArray jsonCrArray = JSONArray.parseArray(tWarehousebillsCntritems);
+            List<TWarehousebillsCntritems> tWarehousebillsCntritemsList = JSONObject.parseArray(jsonCrArray.toJSONString(), TWarehousebillsCntritems.class);
+            if (CollectionUtils.isNotEmpty(tWarehousebillsCntritemsList)){
+                int cntritemsfPid = tWarehousebillsCntritemsMapper.deleteTWarehousebillsCntritemsfPid(warehouseBills.getfId());
+                for (TWarehousebillsCntritems warehousebillsCntritems : tWarehousebillsCntritemsList) {
+                    warehousebillsCntritems.setfPid(warehouseBills.getfId());
+                    warehousebillsCntritems.setCreateTime(DateUtils.getNowDate());
+                    warehousebillsCntritems.setCreateBy(SecurityUtils.getUsername());
+                    int cntr = tWarehousebillsCntritemsMapper.insertTWarehousebillsCntritems(warehousebillsCntritems);
+
+                }
+            }
+            map.put("tWarehousebillsCntritemsList",tWarehousebillsCntritemsList);
+        }
+        int c = tWarehousebillsfeesMapper.deleteFessByFPid(warehouseBills.getfId(), "C");
+        if (StringUtils.isNotNull(tWarehousebillsfeesCr) && !"[]".equals(tWarehousebillsfeesCr)) {
+            JSONArray jsonCrArray = JSONArray.parseArray(tWarehousebillsfeesCr);
+            List<TWarehousebillsfees> warehousebillsfeesCrList = JSONObject.parseArray(jsonCrArray.toJSONString(), TWarehousebillsfees.class);
+            for (TWarehousebillsfees wbCr : warehousebillsfeesCrList) {
+                wbCr.setfPid(warehouseBills.getfId());
+                wbCr.setfDc("C");
+                wbCr.setfBilltype(billsType);
+                wbCr.setfBillstatus(billStatus);
+                wbCr.setCreateTime(new Date());
+                wbCr.setSrcBillNo(tWarehouseBills.getfBillno());
+                wbCr.setCreateBy(loginUser.getUser().getUserName());
+                //wbCr.setfChargedate(warehouseBills.getfChargedate());
+                //wbCr.setfBillingDeadline(warehouseBills.getfChargedate());
+                if (warehouseBills.getfBsdate() != null && !warehouseBills.getfBsdate().equals("")) {
+                    wbCr.setfBsdate(warehouseBills.getfBsdate());
+                }
+                tWarehousebillsfeesMapper.insertTWarehousebillsfees(wbCr);
+            }
+            map.put("warehousebillsfeesCrList",warehousebillsfeesCrList);
+        }
+        int d = tWarehousebillsfeesMapper.deleteFessByFPid(warehouseBills.getfId(), "D");
+        if (StringUtils.isNotNull(tWarehousebillsfeesDr) && !"[]".equals(tWarehousebillsfeesDr)) {
+            JSONArray jsonCrArray = JSONArray.parseArray(tWarehousebillsfeesDr);
+            List<TWarehousebillsfees> warehousebillsfeesDrList = JSONObject.parseArray(jsonCrArray.toJSONString(), TWarehousebillsfees.class);
+            for (TWarehousebillsfees wbDr : warehousebillsfeesDrList) {
+                wbDr.setfPid(warehouseBills.getfId());
+                wbDr.setfDc("D");
+                wbDr.setfBillstatus(billStatus);
+                wbDr.setfBilltype(billsType);
+                wbDr.setCreateTime(new Date());
+                wbDr.setSrcBillNo(tWarehouseBills.getfBillno());
+                wbDr.setCreateBy(loginUser.getUser().getUserName());
+                //wbDr.setfChargedate(warehouseBills.getfChargedate());
+                //wbDr.setfBillingDeadline(warehouseBills.getfChargedate());
+                if (warehouseBills.getfBsdate() != null && !warehouseBills.getfBsdate().equals("")) {
+                    wbDr.setfBsdate(warehouseBills.getfBsdate());
+                }
+                tWarehousebillsfeesMapper.insertTWarehousebillsfees(wbDr);
+            }
+            map.put("warehousebillsfeesDrList",warehousebillsfeesDrList);
+        }
+        if (isApprove) {
+            AuditItems auditItems = new AuditItems();
+            auditItems.setLevelId(0L);
+            auditItems.setBillId(warehouseBills.getfId());
+            auditItems.setActId(actId);
+            auditItems.setIffinalItem("F");
+            auditItems.setBillNo(tWarehouseBills.getfBillno());
+            // 存储委托方(货权方)
+            auditItems.setRefno1(tWarehouseBills.getfCorpid() + "");
+            // 存储业务类型(业务类型)
+            auditItems.setRefno2(tWarehouseBills.getfBilltype());
+            // 存储提单号(提单号)
+            //auditItems.setRefno3(warehouseBills.getfMblno());
+            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);
+//            Long code = Long.valueOf(String.valueOf(approvalFlow.get("code"))).longValue();
+            String code = approvalFlow.get("code").toString();
+//                Long code = Long.valueOf(String.valueOf(ajaxResult.get("code"))).longValue();
+            if ("500".equals(code)) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            }
+            return approvalFlow;
+        }
+        return AjaxResult.success("success",map);
+    }
 
     @Override
     @Transactional
     public AjaxResult addCreditItems(String tEnclosure, String tWarehousebillsitems, String billsType, LoginUser loginUser) {
-        TWarehouseBills tWarehouseBills = new TWarehouseBills();
-        TWarehousebillsitems warehousebillsitemsList = JSONArray.parseObject(tWarehousebillsitems, TWarehousebillsitems.class);
+        TWarehouseBills tWarehouseBills = new TWarehouseBills();        TWarehousebillsitems warehousebillsitemsList = JSONArray.parseObject(tWarehousebillsitems, TWarehousebillsitems.class);
         if (billsType.equals("SJRK")) {
             if (null != warehousebillsitemsList) {
                 // 先查询是否已经处理
@@ -3068,14 +3219,17 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     }
 
     @Transactional
-    public AjaxResult updateKaHeOrder(Long fPid, long fettle) {
+    public AjaxResult updateKaHeOrder(Long fPid, long fettle,Date auditItem ) {
         if (StringUtils.isNull(fPid)) {
             return AjaxResult.error("协议更新状态未找到主表信息,请与管理员联系");
         }
         TWarehouseBills tWarehouseBills = new TWarehouseBills();
         tWarehouseBills.setfId(fPid);
         tWarehouseBills.setfBillstatus(fettle);
-        int tFeeUpdateResult = tWarehouseBillsMapper.updateTWarehousebills(tWarehouseBills);
+        if (fettle==11L){
+            tWarehouseBills.setfReviewDate(auditItem);
+        }
+        int tFeeUpdateResult = tWarehouseBillsMapper.updateKaHeOrder(tWarehouseBills);
         if (tFeeUpdateResult <= 0) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return AjaxResult.error("更新订单主表状态失败,请联系管理员");

+ 56 - 0
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeDoMapper.xml

@@ -55,6 +55,62 @@
         <include refid="selectTFeeDoVo"/>
         where f_id = #{fId}
     </select>
+    <select id="selectTFeeDoByfPid" parameterType="Long" resultMap="TFeeDoResult">
+        SELECT
+            td.f_id,
+            td.f_pid,
+            td.f_act_id,
+            td.f_lineno,
+            td.f_srcid,
+            td.f_srclineno,
+            td.f_srcpid,
+            td.f_srcdc,
+            CASE
+
+                WHEN td.f_srcdc = 'D' THEN
+                    '收'
+                WHEN td.f_srcdc = 'C' THEN
+                    '付'
+                END AS fSrcdcName,
+            td.f_feeid,
+            tf.f_name fFeeName,
+            td.f_amtdr,
+            td.f_amt,
+            td.f_status,
+            CASE
+                WHEN td.f_status = '1' THEN '保存'
+                WHEN td.f_status = '2' THEN '暂存'
+                WHEN td.f_status = '3' THEN '审批驳回'
+                WHEN td.f_status = '4' THEN '提交审核'
+                WHEN td.f_status = '5' THEN '审核中'
+                WHEN td.f_status = '6' THEN '审核完成'
+                END
+                AS fStatusName,
+            td.del_flag,
+            td.create_by,
+            td.f_amt_stl,
+            td.create_time,
+            td.f_amt_blc,
+            td.update_by,
+            td.update_time,
+            td.f_remarks,
+            tw.f_currency fCurrency,
+            tw.f_exrate fExrate,
+            tw.src_bill_no srcBillNo,
+            tw.f_mblno fMblno,
+            tv.f_name boatName,
+            ty.f_no voyageName,
+            te.f_billtype fBilltype
+        FROM
+            t_fee_do td
+                LEFT JOIN t_fees tf ON td.f_feeid = tf.f_id
+                LEFT JOIN t_warehousebillsfees tw ON td.f_srcid = tw.f_id
+                LEFT JOIN t_warehousebills th ON td.f_srcpid = th.f_id
+                LEFT JOIN t_vessel tv ON tv.f_id = th.f_vslid
+                LEFT JOIN t_voyage ty ON ty.f_id = th.f_voyid
+                LEFT JOIN t_fee te ON te.f_id = td.f_pid
+        where td.f_pid = #{fPid}
+    </select>
 
     <insert id="insertTFeeDo" parameterType="TFeeDo" useGeneratedKeys="true" keyProperty="fId">
         insert into t_fee_do

File diff suppressed because it is too large
+ 786 - 235
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml


+ 112 - 1
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -1067,6 +1067,96 @@
         </trim>
         where f_id = #{fId}
     </update>
+    <update id="updateKaHeOrder" parameterType="TWarehousebills">
+        update t_warehousebills
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="fBillno != null">f_billno = #{fBillno},</if>
+            <if test="fCustomsdeclartion != null">f_customsdeclartion = #{fCustomsdeclartion},</if>
+            <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
+            <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
+            <if test="fBsdeptid != null">f_bsdeptid = #{fBsdeptid},</if>
+            <if test="fContacts != null">f_contacts = #{fContacts},</if>
+            <if test="fTel != null">f_tel = #{fTel},</if>
+            <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
+            <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
+            <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
+            <if test="fBscorpno != null and fBscorpno != ''">f_bscorpno = #{fBscorpno},</if>
+            <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
+            <if test="fStorekeeper != null">f_storekeeper = #{fStorekeeper},</if>
+            <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
+            <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
+            <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
+            <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
+            <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
+            <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
+            <if test="fQty != null">f_qty = #{fQty},</if>
+            <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
+            <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
+            <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
+            <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
+            <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
+            <if test="fSbu != null">f_sbu = #{fSbu},</if>
+            <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
+            <if test="fMblno != null">f_mblno = #{fMblno},</if>
+            <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
+            <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
+            <if test="fEta != null">f_eta = #{fEta},</if>
+            <if test="fCustomno != null">f_customno = #{fCustomno},</if>
+            <if test="fIfweigh != null">f_ifweigh = #{fIfweigh},</if>
+            <if test="fIfpledge != null">f_ifpledge = #{fIfpledge},</if>
+            <if test="fIfdamage != null">f_ifdamage = #{fIfdamage},</if>
+            <if test="fBankcorpid != null">f_bankcorpid = #{fBankcorpid},</if>
+            <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
+            <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="fItemsStatus != null">f_items_status = #{fItemsStatus},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
+            <if test="fProductName != null">f_product_name = #{fProductName},</if>
+            <if test="fReviewDate != null and fBillstatus == 11" >f_review_date = #{fReviewDate},</if>
+            <if test="fReviewDate != null and fBillstatus != 11">f_review_date = null,</if>
+            <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
+            <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
+            <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
+            <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
+            <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
+            <if test="fReviewDate == null">f_review_date = null,</if>
+            <if test="fLabour  != null">f_labour = #{fLabour },</if>
+            <if test="fFleet != null">f_fleet = #{fFleet},</if>
+            <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
+            <if test="fBstime != null">f_bstime = #{fBstime},</if>
+            <if test="fCartype != null">f_cartype = #{fCartype},</if>
+            <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
+            <if test="fNewTrademodeid != null">f_new_trademodeid = #{fNewTrademodeid},</if>
+            <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
+            <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
+            <if test="fServiceitems != null">f_serviceitems = #{fServiceitems},</if>
+            <if test="fInvoceobj != null">f_invoceobj = #{fInvoceobj},</if>
+            <if test="fSign != null">f_sign = #{fSign},</if>
+            <if test="fDetentioncargo != null">f_detentioncargo = #{fDetentioncargo},</if>
+            <if test="fBooksmarks != null">f_booksmarks = #{fBooksmarks},</if>
+            <if test="fShippername != null">f_shippername = #{fShippername},</if>
+            <if test="fShipperattn != null">f_shipperattn = #{fShipperattn},</if>
+            <if test="fShippertel != null">f_shippertel = #{fShippertel},</if>
+            <if test="fConsigneername != null">f_consigneername = #{fConsigneername},</if>
+            <if test="fConsigneeattn != null">f_consigneeattn = #{fConsigneeattn},</if>
+            <if test="fConsigneetel != null">f_consigneetel = #{fConsigneetel},</if>
+            <if test="fInsurance != null">f_insurance = #{fInsurance},</if>
+            <if test="fInsuranceamt != null">f_insuranceamt = #{fInsuranceamt},</if>
+            <if test="fClosedate != null">f_closedate = #{fClosedate},</if>
+            <if test="fDocmentdate != null">f_docmentdate = #{fDocmentdate},</if>
+            <if test="fVslid != null">f_vslid = #{fVslid},</if>
+            <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
+            <if test="fPaymode != null">f_paymode = #{fPaymode},</if>
+            <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
+            <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
+        </trim>
+        where f_id = #{fId}
+    </update>
 
     <delete id="deleteTWarehousebillsById" parameterType="Long">
         delete
@@ -1499,7 +1589,21 @@
         '配船审批通过'
         WHEN tw.f_billstatus = '12' THEN
         '运单变更'
-        END AS fBillstatus
+        END AS fBillstatus,
+        CASE
+        WHEN tf.f_billstatus = '1' THEN
+        '新建'
+        WHEN tf.f_billstatus = '2' THEN
+        '暂存'
+        WHEN tf.f_billstatus = '3' THEN
+        '驳回'
+        WHEN tf.f_billstatus = '4' THEN
+        '提交'
+        WHEN tf.f_billstatus = '5' THEN
+        '审批中'
+        WHEN tf.f_billstatus = '6' THEN
+        '审批通过'
+        END AS moneyStatus
         FROM
         t_warehousebills tw
         LEFT JOIN t_address ta ON ta.f_id = tw.f_laneid
@@ -1522,6 +1626,7 @@
         LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
         LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
         ) tc ON tc.f_pid = tw.f_id
+        LEFT JOIN (SELECT f_pid,f_billstatus FROM t_warehousebillsfees GROUP BY f_pid,f_billstatus)tf ON tf.f_pid = tw.f_id
         <where>
             tw.f_typeid = '1'
             <if test="fId != null">and tw.f_id = #{fId}</if>
@@ -1630,6 +1735,12 @@
                 #{voyidName}, '%')
             </if>
             <if test="createBy != null  and createBy != ''">and tw.create_by = #{createBy}</if>
+            <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
+                and tw.f_bsdate &gt;= #{cLoadDate[0]}
+            </if>
+            <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
+                and tw.f_bsdate &lt;= #{cLoadDate[1]}
+            </if>
         </where>
         ORDER BY tw.create_time DESC, tw.f_id DESC
     </select>

+ 48 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

@@ -413,6 +413,40 @@
                 f_stlamount = f_stlamount - #{map.tFeeDo.fAmt},
                 f_stlamount_date =#{map.tFee.fAccbilldate}
             </if>
+            /*判断开发票款*/
+            <if test="map.billType == 'invoiceFP'">
+                f_stlamount_no = #{map.tFee.fBillno},
+                f_invamount = f_invamount + #{map.tFeeDo.fAmt},
+                f_stlamount_date =#{map.tFee.fAccbilldate}
+            </if>
+            <if test="map.billType == 'DZinvoiceFP'">
+                f_stlamount_no = #{map.tFee.fBillno},
+                f_invamount = f_invamount - #{map.tFeeDo.fAmt},
+                f_stlamount_date =#{map.tFee.fAccbilldate}
+            </if>
+            /*判断申请发票款*/
+            <if test="map.billType == 'ApplyFP'">
+                f_stlamount_no = #{map.tFee.fBillno},
+                f_askamount = f_askamount + #{map.tFeeDo.fAmt},
+                f_stlamount_date =#{map.tFee.fAccbilldate}
+            </if>
+            <if test="map.billType == 'DZApplyFP'">
+                f_stlamount_no = #{map.tFee.fBillno},
+                f_askamount = f_askamount - #{map.tFeeDo.fAmt},
+                f_stlamount_date =#{map.tFee.fAccbilldate}
+            </if>
+            /*判断确认对账*/
+            <if test="map.billType == 'KHDZ'">
+                f_statement_no = #{map.tFee.fBillno},
+                f_accamount = f_accamount + #{map.tFeeDo.fAmt},
+                f_accamount_date = #{map.tFee.fAccbilldate}
+            </if>
+            /*判断撤销对账*/
+            <if test="map.billType == 'KHDZRevoke'">
+                f_statement_no = #{map.tFee.fBillno},
+                f_accamount = f_accamount - #{map.tFeeDo.fAmt},
+                f_accamount_date = #{map.tFee.fAccbilldate}
+            </if>
         </trim>
         where f_id = #{map.tFeeDo.fSrcid}
     </update>
@@ -434,6 +468,20 @@
         tw.f_taxrate,
         tw.f_dc,
         tw.f_billstatus,
+        CASE
+        WHEN tw.f_billstatus = '1' THEN
+        '新建'
+        WHEN tw.f_billstatus = '2' THEN
+        '暂存'
+        WHEN tw.f_billstatus = '3' THEN
+        '驳回'
+        WHEN tw.f_billstatus = '4' THEN
+        '提交'
+        WHEN tw.f_billstatus = '5' THEN
+        '审批中'
+        WHEN tw.f_billstatus = '6' THEN
+        '审批通过'
+        END AS fBillstatusName,
         tw.f_review_date,
         tw.f_statement_no,
         tw.f_accamount,

Some files were not shown because too many files changed in this diff