Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

chenw 7 years ago
parent
commit
4169a24ee2
100 changed files with 3075 additions and 489 deletions
  1. 3 2
      README.md
  2. 209 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Customer.java
  3. 2 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/CustomerList.java
  4. 16 6
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendor.java
  5. 2 2
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/VendorList.java
  6. 2 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/FundinouttypeController.java
  7. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/FundinouttypeMapper.java
  8. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/FundinouttypeService.java
  9. 2 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java
  10. 2 1
      applications/document/document-server/src/main/resources/mapper/CustomerListMapper.xml
  11. 13 3
      applications/document/document-server/src/main/resources/mapper/CustomerMapper.xml
  12. 8 0
      applications/document/document-server/src/main/resources/mapper/FundinouttypeMapper.xml
  13. 27 15
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  14. 10 0
      applications/money/money-server/pom.xml
  15. 58 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/MoneyReportColltroller.java
  16. 10 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/AcountbalanceViewMapper.java
  17. 11 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/CustomerCheckViewMapper.java
  18. 10 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/PaydetailViewMapper.java
  19. 10 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/RecdetailViewMapper.java
  20. 10 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/VendorAcountViewMapper.java
  21. 134 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/AcountbalanceView.java
  22. 165 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/CustomerCheckView.java
  23. 10 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransferdetail.java
  24. 9 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Othreceiptsdetail.java
  25. 10 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Othspendingsdetail.java
  26. 155 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/PaydetailView.java
  27. 154 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/RecdetailView.java
  28. 174 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/VendorAcountView.java
  29. 17 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/MoneyReportService.java
  30. 7 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/FundtransferServiceImpl.java
  31. 94 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/MoneyReportServiceImpl.java
  32. 11 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthreceiptsServiceImpl.java
  33. 14 2
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthspendingsServiceImpl.java
  34. 33 0
      applications/money/money-server/src/main/resources/mapper/AcountbalanceViewMapper.xml
  35. 36 0
      applications/money/money-server/src/main/resources/mapper/CustomerCheckViewMapper.xml
  36. 1 10
      applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml
  37. 4 5
      applications/money/money-server/src/main/resources/mapper/FundtransferdetailMapper.xml
  38. 1 14
      applications/money/money-server/src/main/resources/mapper/OthreceiptsMapper.xml
  39. 3 2
      applications/money/money-server/src/main/resources/mapper/OthreceiptsdetailMapper.xml
  40. 2 14
      applications/money/money-server/src/main/resources/mapper/OthspendingsMapper.xml
  41. 3 2
      applications/money/money-server/src/main/resources/mapper/OthspendingsdetailMapper.xml
  42. 1 14
      applications/money/money-server/src/main/resources/mapper/PaybalanceMapper.xml
  43. 35 0
      applications/money/money-server/src/main/resources/mapper/PaydetailViewMapper.xml
  44. 2 15
      applications/money/money-server/src/main/resources/mapper/RecbalanceMapper.xml
  45. 34 0
      applications/money/money-server/src/main/resources/mapper/RecdetailViewMapper.xml
  46. 36 0
      applications/money/money-server/src/main/resources/mapper/VendorAcountViewMapper.xml
  47. 30 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseReportController.java
  48. 10 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchasePayMapper.java
  49. 3 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseList.java
  50. 40 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/report/PurchasePay.java
  51. 10 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/PurchaseReportService.java
  52. 2 2
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  53. 56 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseReportServiceImpl.java
  54. 9 3
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  55. 9 9
      applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutListMapper.xml
  56. 33 3
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseListMapper.xml
  57. 32 0
      applications/purchase/purchase-server/src/main/resources/mapper/PurchasePayMapper.xml
  58. 6 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/SaleDTO.java
  59. 36 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleReportController.java
  60. 3 2
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleListMapper.java
  61. 11 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleProfitViewMapper.java
  62. 11 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SalerecViewMapper.java
  63. 6 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/Sale.java
  64. 5 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/SaleList.java
  65. 53 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/report/SaleProfitView.java
  66. 38 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/report/SalerecView.java
  67. 12 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/SaleReportService.java
  68. 67 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleReportServiceImpl.java
  69. 5 4
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  70. 33 2
      applications/sale/sale-server/src/main/resources/mapper/SaleListMapper.xml
  71. 32 1
      applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml
  72. 38 0
      applications/sale/sale-server/src/main/resources/mapper/SaleProfitViewMapper.xml
  73. 31 0
      applications/sale/sale-server/src/main/resources/mapper/SalerecViewMapper.xml
  74. 13 0
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/report/ProdinoutCountView.java
  75. 33 0
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/report/ProdiodetailView.java
  76. 44 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/ProdInOutReportController.java
  77. 18 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/ProdInOutReportMapper.java
  78. 15 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/ProdInOutReportService.java
  79. 64 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInOutReportServiceImpl.java
  80. 2 2
      applications/storage/storage-server/src/main/resources/mapper/ProdInOutListMapper.xml
  81. 56 0
      applications/storage/storage-server/src/main/resources/mapper/ProdInOutReportMapper.xml
  82. 4 2
      base-servers/account/account-server/src/main/resources/mapper/AccountMapper.xml
  83. 4 2
      base-servers/account/account-server/src/main/resources/mapper/CompanyMapper.xml
  84. 4 0
      base-servers/file/README.md
  85. 9 10
      base-servers/file/file-api/src/main/java/com/usoftchina/saas/file/api/FileApi.java
  86. 37 0
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/BaseFileInfo.java
  87. 0 60
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/BaseFolder.java
  88. 0 179
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FileDTO.java
  89. 109 0
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FileInfoDTO.java
  90. 0 31
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FileListDTO.java
  91. 4 9
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FolderDTO.java
  92. 17 0
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FolderSaveDTO.java
  93. 0 18
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FolderToSaveDTO.java
  94. 31 11
      base-servers/file/file-server/pom.xml
  95. 10 2
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/FileApplication.java
  96. 12 0
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/constant/FileConstant.java
  97. 50 0
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/constant/FileType.java
  98. 320 11
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/controller/FileController.java
  99. 46 0
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/mapper/FileInfoMapper.java
  100. 0 11
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/mapper/FileMapper.java

+ 3 - 2
README.md

@@ -65,8 +65,9 @@
 │  |  ├─test-starter--------------------------测试启动辅助工具
 │  │
 │  ├─frontend---------------------------------前端
-│  |  ├─web-----------------------------------web前端(vue + element-ui)
-│  |  ├─saas-web------------------------------web前端(extjs)
+│  |  ├─saas-portal-web-----------------------门户前端
+│  |  ├─saas-web------------------------------系统前端(extjs)
+│  |  ├─web-----------------------------------系统前端(vue + element-ui)
 │  │ 
 │  ├─script-----------------------------------脚本
 │  |  ├─mysql---------------------------------mysql脚本

+ 209 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Customer.java

@@ -58,4 +58,213 @@ public class Customer extends CommonBaseEntity implements Serializable {
 
     private Double cu_recamount;
 
+    private Double cu_preamount;
+
+    public String getCu_code() {
+        return cu_code;
+    }
+
+    public void setCu_code(String cu_code) {
+        this.cu_code = cu_code;
+    }
+
+    public String getCu_name() {
+        return cu_name;
+    }
+
+    public void setCu_name(String cu_name) {
+        this.cu_name = cu_name;
+    }
+
+    public String getCu_uu() {
+        return cu_uu;
+    }
+
+    public void setCu_uu(String cu_uu) {
+        this.cu_uu = cu_uu;
+    }
+
+    public String getCu_type() {
+        return cu_type;
+    }
+
+    public void setCu_type(String cu_type) {
+        this.cu_type = cu_type;
+    }
+
+    public Date getCu_begindate() {
+        return cu_begindate;
+    }
+
+    public void setCu_begindate(Date cu_begindate) {
+        this.cu_begindate = cu_begindate;
+    }
+
+    public Double getCu_beginaramount() {
+        return cu_beginaramount;
+    }
+
+    public void setCu_beginaramount(Double cu_beginaramount) {
+        this.cu_beginaramount = cu_beginaramount;
+    }
+
+    public Double getCu_beginprerecamount() {
+        return cu_beginprerecamount;
+    }
+
+    public void setCu_beginprerecamount(Double cu_beginprerecamount) {
+        this.cu_beginprerecamount = cu_beginprerecamount;
+    }
+
+    public Double getCu_promisedays() {
+        return cu_promisedays;
+    }
+
+    public void setCu_promisedays(Double cu_promisedays) {
+        this.cu_promisedays = cu_promisedays;
+    }
+
+    public Double getCu_taxrate() {
+        return cu_taxrate;
+    }
+
+    public void setCu_taxrate(Double cu_taxrate) {
+        this.cu_taxrate = cu_taxrate;
+    }
+
+    public Integer getCu_sellerid() {
+        return cu_sellerid;
+    }
+
+    public void setCu_sellerid(Integer cu_sellerid) {
+        this.cu_sellerid = cu_sellerid;
+    }
+
+    public String getCu_sellercode() {
+        return cu_sellercode;
+    }
+
+    public void setCu_sellercode(String cu_sellercode) {
+        this.cu_sellercode = cu_sellercode;
+    }
+
+    public String getCu_sellername() {
+        return cu_sellername;
+    }
+
+    public void setCu_sellername(String cu_sellername) {
+        this.cu_sellername = cu_sellername;
+    }
+
+    public Double getCu_credit() {
+        return cu_credit;
+    }
+
+    public void setCu_credit(Double cu_credit) {
+        this.cu_credit = cu_credit;
+    }
+
+    public String getCu_status() {
+        return cu_status;
+    }
+
+    public void setCu_status(String cu_status) {
+        this.cu_status = cu_status;
+    }
+
+    public String getCu_statuscode() {
+        return cu_statuscode;
+    }
+
+    public void setCu_statuscode(String cu_statuscode) {
+        this.cu_statuscode = cu_statuscode;
+    }
+
+    public Integer getCu_recordmanid() {
+        return cu_recordmanid;
+    }
+
+    public void setCu_recordmanid(Integer cu_recordmanid) {
+        this.cu_recordmanid = cu_recordmanid;
+    }
+
+    public String getCu_recordman() {
+        return cu_recordman;
+    }
+
+    public void setCu_recordman(String cu_recordman) {
+        this.cu_recordman = cu_recordman;
+    }
+
+    public Date getCu_recorddate() {
+        return cu_recorddate;
+    }
+
+    public void setCu_recorddate(Date cu_recorddate) {
+        this.cu_recorddate = cu_recorddate;
+    }
+
+    public String getCu_text1() {
+        return cu_text1;
+    }
+
+    public void setCu_text1(String cu_text1) {
+        this.cu_text1 = cu_text1;
+    }
+
+    public String getCu_text2() {
+        return cu_text2;
+    }
+
+    public void setCu_text2(String cu_text2) {
+        this.cu_text2 = cu_text2;
+    }
+
+    public String getCu_text3() {
+        return cu_text3;
+    }
+
+    public void setCu_text3(String cu_text3) {
+        this.cu_text3 = cu_text3;
+    }
+
+    public String getCu_text4() {
+        return cu_text4;
+    }
+
+    public void setCu_text4(String cu_text4) {
+        this.cu_text4 = cu_text4;
+    }
+
+    public String getCu_text5() {
+        return cu_text5;
+    }
+
+    public void setCu_text5(String cu_text5) {
+        this.cu_text5 = cu_text5;
+    }
+
+    public Double getCu_leftamount() {
+        return cu_leftamount;
+    }
+
+    public void setCu_leftamount(Double cu_leftamount) {
+        this.cu_leftamount = cu_leftamount;
+    }
+
+    public Double getCu_recamount() {
+        return cu_recamount;
+    }
+
+    public void setCu_recamount(Double cu_recamount) {
+        this.cu_recamount = cu_recamount;
+    }
+
+    public Double getCu_preamount() {
+        return cu_preamount;
+    }
+
+    public void setCu_preamount(Double cu_preamount) {
+        this.cu_preamount = cu_preamount;
+    }
 }

+ 2 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/CustomerList.java

@@ -62,6 +62,8 @@ public class CustomerList extends CommonBaseEntity{
     private Double cu_leftamount;
 
     private Double cu_recamount;
+
+    private Double cu_preamount;
 //customeraddress
 
     private Long ca_cuid;

+ 16 - 6
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendor.java

@@ -35,11 +35,11 @@ public class Vendor extends CommonBaseEntity implements Serializable{
     /**
      * 期初应付
      */
-    private Long ve_beginapamount;
+    private double ve_beginapamount;
     /**
      * 期初预付
      */
-    private Long ve_beginprepayamount;
+    private double ve_beginprepayamount;
     /**
      * 承付天数
      */
@@ -107,6 +107,8 @@ public class Vendor extends CommonBaseEntity implements Serializable{
 
     private Integer ve_beginym;
 
+    private Double ve_preamount;
+
     public Double getVe_payamount() {
         return ve_payamount;
     }
@@ -171,19 +173,19 @@ public class Vendor extends CommonBaseEntity implements Serializable{
         this.ve_begindate = ve_begindate;
     }
 
-    public Long getVe_beginapamount() {
+    public double getVe_beginapamount() {
         return ve_beginapamount;
     }
 
-    public void setVe_beginapamount(Long ve_beginapamount) {
+    public void setVe_beginapamount(double ve_beginapamount) {
         this.ve_beginapamount = ve_beginapamount;
     }
 
-    public Long getVe_beginprepayamount() {
+    public double getVe_beginprepayamount() {
         return ve_beginprepayamount;
     }
 
-    public void setVe_beginprepayamount(Long ve_beginprepayamount) {
+    public void setVe_beginprepayamount(double ve_beginprepayamount) {
         this.ve_beginprepayamount = ve_beginprepayamount;
     }
 
@@ -306,4 +308,12 @@ public class Vendor extends CommonBaseEntity implements Serializable{
     public void setVe_text5(String ve_text5) {
         this.ve_text5 = ve_text5;
     }
+
+    public Double getVe_preamount() {
+        return ve_preamount;
+    }
+
+    public void setVe_preamount(Double ve_preamount) {
+        this.ve_preamount = ve_preamount;
+    }
 }

+ 2 - 2
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/VendorList.java

@@ -33,11 +33,11 @@ public class VendorList implements Serializable {
     /**
      * 期初应付
      */
-    private long ve_beginapamount;
+    private double ve_beginapamount;
     /**
      * 期初预付
      */
-    private long ve_beginprepayamount;
+    private double ve_beginprepayamount;
     /**
      * 承付天数
      */

+ 2 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/FundinouttypeController.java

@@ -34,8 +34,8 @@ public class FundinouttypeController {
     }
 
     @GetMapping("/getCombo")
-    public Result getCombo(){
-        List<ComboDTO> comboDTOList = fundinouttypeService.getCombo();
+    public Result getCombo(String condition){
+        List<ComboDTO> comboDTOList = fundinouttypeService.getCombo(condition);
         return Result.success(comboDTOList);
     }
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/FundinouttypeMapper.java

@@ -23,7 +23,7 @@ public interface FundinouttypeMapper extends CommonBaseMapper<Fundinouttype> {
 
     int selectCountByName(@Param("name") String name, @Param("companyId") Long companyId, @Param("id") Long id);
 
-    List<ComboDTO> getCombo(@Param("companyId") Long companyId);
+    List<ComboDTO> getCombo(@Param("companyId") Long companyId,@Param("condition") String condition);
 
     List<Fundinouttype> selectAll(@Param("companyId") Long companyId);
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/FundinouttypeService.java

@@ -11,7 +11,7 @@ import java.util.List;
 
 public interface FundinouttypeService extends CommonBaseService<FundinouttypeMapper, Fundinouttype> {
 
-    List<ComboDTO> getCombo();
+    List<ComboDTO> getCombo(String condition);
 
     List<Fundinouttype> selectAll();
 

+ 2 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java

@@ -89,8 +89,8 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
     }
 
     @Override
-    public List<ComboDTO> getCombo() {
-        return getMapper().getCombo(BaseContextHolder.getCompanyId());
+    public List<ComboDTO> getCombo(String condition) {
+        return getMapper().getCombo(BaseContextHolder.getCompanyId(),condition);
     }
 
     @Override

+ 2 - 1
applications/document/document-server/src/main/resources/mapper/CustomerListMapper.xml

@@ -23,6 +23,7 @@
     <result column="cu_recorddate" jdbcType="TIMESTAMP" property="cu_recorddate" />
     <result column="cu_leftamount" jdbcType="DOUBLE" property="cu_leftamount" />
     <result column="cu_recamount" jdbcType="DOUBLE" property="cu_recamount" />
+    <result column="cu_preamount" jdbcType="DOUBLE" property="cu_preamount" />
     <result column="ca_cuid" jdbcType="INTEGER" property="ca_cuid" />
     <result column="ca_detno" jdbcType="INTEGER" property="ca_detno" />
     <result column="ca_person" jdbcType="VARCHAR" property="ca_person" />
@@ -62,7 +63,7 @@
         and customer.companyid = #{companyId}
       </if>
     </where>
-    order by cu_id
+    order by cu_id desc
   </select>
 
   <select id="selectCustomerBycondition"  resultMap="BaseResultMap">

+ 13 - 3
applications/document/document-server/src/main/resources/mapper/CustomerMapper.xml

@@ -37,7 +37,7 @@
     cu_promisedays, cu_taxrate, cu_sellerid, cu_sellercode, cu_sellername, cu_credit, 
     cu_status, cu_statuscode, cu_recordmanid, cu_recordman, cu_recorddate, companyid, 
     updaterid, updatetime, cu_text1, cu_text2, cu_text3, cu_text4, cu_text5, cu_leftamount, 
-    cu_recamount
+    cu_recamount,cu_preamount
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select 
@@ -140,6 +140,9 @@
       <if test="cu_recamount != null">
         cu_recamount,
       </if>
+      <if test="cu_preamount != null">
+        cu_preamount,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
 
@@ -227,6 +230,9 @@
       <if test="cu_recamount != null">
         #{cu_recamount,jdbcType=DOUBLE},
       </if>
+      <if test="cu_preamount != null">
+        #{cu_preamount,jdbcType=DOUBLE},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Customer">
@@ -316,6 +322,9 @@
       <if test="cu_recamount != null">
         cu_recamount = #{cu_recamount,jdbcType=DOUBLE},
       </if>
+      <if test="cu_preamount != null">
+        cu_preamount = #{cu_preamount,jdbcType=DOUBLE},
+      </if>
     </set>
     where cu_id = #{id,jdbcType=INTEGER}
   </update>
@@ -348,7 +357,8 @@
       cu_text4 = #{cu_text4,jdbcType=VARCHAR},
       cu_text5 = #{cu_text5,jdbcType=VARCHAR},
       cu_leftamount = #{cu_leftamount,jdbcType=DOUBLE},
-      cu_recamount = #{cu_recamount,jdbcType=DOUBLE}
+      cu_recamount = #{cu_recamount,jdbcType=DOUBLE},
+      cu_preamount = #{cu_preamount,jdbcType=DOUBLE}
     where cu_id = #{id,jdbcType=INTEGER}
   </update>
 
@@ -364,7 +374,7 @@
   </select>
 
   <select id="validNameAndCodeWhenUpdate" parameterType="com.usoftchina.saas.document.entities.Customer" resultType="int">
-    select count(1) from customer where cu_code = #{cu_code,jdbcType=VARCHAR} or cu_name = #{cu_name,jdbcType=VARCHAR}
+    select count(1) from customer where (cu_code = #{cu_code,jdbcType=VARCHAR} or cu_name = #{cu_name,jdbcType=VARCHAR})
     and cu_id != #{id}
   </select>
 

+ 8 - 0
applications/document/document-server/src/main/resources/mapper/FundinouttypeMapper.xml

@@ -158,5 +158,13 @@
   </select>
     <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
         SELECT FT_NAME display,FT_NAME value FROM FUNDINOUTTYPE
+        <where>
+          <if test="companyId!=null and companyId!=0">
+            and  COMPANYID=#{companyId}
+          </if>
+          <if test="condition!=null">
+            and ft_kind=#{condition,jdbcType=VARCHAR}
+          </if>
+        </where>
     </select>
 </mapper>

+ 27 - 15
applications/document/document-server/src/main/resources/mapper/VendorMapper.xml

@@ -8,8 +8,8 @@
         <result column="ve_name" property="ve_name" jdbcType="VARCHAR" />
         <result column="ve_type" property="ve_type" jdbcType="VARCHAR" />
         <result column="ve_begindate" property="ve_begindate" jdbcType="TIMESTAMP" />
-        <result column="ve_beginapamount" property="ve_beginapamount" jdbcType="INTEGER" />
-        <result column="ve_beginprepayamount" property="ve_beginprepayamount" jdbcType="INTEGER" />
+        <result column="ve_beginapamount" property="ve_beginapamount" jdbcType="DOUBLE" />
+        <result column="ve_beginprepayamount" property="ve_beginprepayamount" jdbcType="DOUBLE" />
         <result column="ve_promisedays" property="ve_promisedays" jdbcType="INTEGER" />
         <result column="ve_taxrate" property="ve_taxrate" jdbcType="DOUBLE" />
         <result column="ve_nsrzh" property="ve_nsrzh" jdbcType="VARCHAR" />
@@ -31,6 +31,7 @@
         <result column="ve_payamount" property="ve_payamount" jdbcType="DOUBLE" />
         <result column="ve_leftamount" property="ve_leftamount" jdbcType="DOUBLE" />
         <result column="ve_beginym" property="ve_beginym" jdbcType="INTEGER" />
+        <result column="ve_preamount" property="ve_preamount" jdbcType="DOUBLE" />
     </resultMap>
     <resultMap id="VendorDTOResultMapper" type="com.usoftchina.saas.document.dto.VendorDTO">
         <id column="ve_id" property="id" jdbcType="INTEGER" />
@@ -60,8 +61,8 @@
         <result column="ve_name" property="ve_name" jdbcType="VARCHAR" />
         <result column="ve_type" property="ve_type" jdbcType="VARCHAR" />
         <result column="ve_begindate" property="ve_begindate" jdbcType="TIMESTAMP" />
-        <result column="ve_beginapamount" property="ve_beginapamount" jdbcType="INTEGER" />
-        <result column="ve_beginprepayamount" property="ve_beginprepayamount" jdbcType="INTEGER" />
+        <result column="ve_beginapamount" property="ve_beginapamount" jdbcType="DOUBLE" />
+        <result column="ve_beginprepayamount" property="ve_beginprepayamount" jdbcType="DOUBLE" />
         <result column="ve_promisedays" property="ve_promisedays" jdbcType="INTEGER" />
         <result column="ve_taxrate" property="ve_taxrate" jdbcType="DOUBLE" />
         <result column="ve_nsrzh" property="ve_nsrzh" jdbcType="VARCHAR" />
@@ -107,7 +108,7 @@
         ve_id, ve_code, ve_name, ve_uu, ve_type, ve_begindate, ve_beginapamount, ve_beginprepayamount,
         ve_promisedays, ve_taxrate, ve_nsrzh, ve_bankaccount, ve_bankcode, ve_status, ve_statuscode,
         ve_recordid, ve_recordname, ve_initdate, companyId, updaterId, updateTime, ve_text1,
-        ve_text2, ve_text3, ve_text4, ve_text5, ve_payamount, ve_leftamount, ve_beginym
+        ve_text2, ve_text3, ve_text4, ve_text5, ve_payamount, ve_leftamount, ve_beginym, ve_preamount
     </sql>
     <select id="selectByPrimaryKey" resultMap="VendorResultMapper" parameterType="java.lang.Long" >
         select
@@ -129,18 +130,19 @@
         ve_initdate, companyId, updaterId,
         updateTime, ve_text1, ve_text2,
         ve_text3, ve_text4, ve_text5,
-        ve_payamount, ve_leftamount, ve_beginym
+        ve_payamount, ve_leftamount, ve_beginym ,ve_preamount
         )
         values (#{ve_code,jdbcType=VARCHAR}, #{ve_name,jdbcType=VARCHAR},
         #{ve_uu,jdbcType=VARCHAR}, #{ve_type,jdbcType=VARCHAR}, #{ve_begindate,jdbcType=TIMESTAMP},
-        #{ve_beginapamount,jdbcType=DECIMAL}, #{ve_beginprepayamount,jdbcType=DECIMAL},
+        #{ve_beginapamount,jdbcType=DOUBLE}, #{ve_beginprepayamount,jdbcType=DOUBLE},
         #{ve_promisedays,jdbcType=DECIMAL}, #{ve_taxrate,jdbcType=DOUBLE}, #{ve_nsrzh,jdbcType=VARCHAR},
         #{ve_bankaccount,jdbcType=VARCHAR}, #{ve_bankcode,jdbcType=VARCHAR}, #{ve_status,jdbcType=VARCHAR},
         #{ve_statuscode,jdbcType=VARCHAR}, #{ve_recordid,jdbcType=DECIMAL}, #{ve_recordname,jdbcType=VARCHAR},
         #{ve_initdate,jdbcType=TIMESTAMP}, #{companyId,jdbcType=DECIMAL}, #{updaterId,jdbcType=DECIMAL},
         #{updateTime,jdbcType=TIMESTAMP}, #{ve_text1,jdbcType=VARCHAR}, #{ve_text2,jdbcType=VARCHAR},
         #{ve_text3,jdbcType=VARCHAR}, #{ve_text4,jdbcType=VARCHAR}, #{ve_text5,jdbcType=VARCHAR},
-        #{ve_payamount,jdbcType=DOUBLE}, #{ve_leftamount,jdbcType=DOUBLE}, #{ve_beginym,jdbcType=INTEGER}
+        #{ve_payamount,jdbcType=DOUBLE}, #{ve_leftamount,jdbcType=DOUBLE}, #{ve_beginym,jdbcType=INTEGER},
+        #{ve_preamount,jdbcType=DOUBLE}
         )
     </insert>
     <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Vendor" >
@@ -233,6 +235,9 @@
             <if test="ve_beginym != null" >
                 ve_beginym,
             </if>
+            <if test="ve_preamount !=null" >
+                ve_preamount,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
             <if test="ve_code != null" >
@@ -251,10 +256,10 @@
                 #{ve_begindate,jdbcType=TIMESTAMP},
             </if>
             <if test="ve_beginapamount != null" >
-                #{ve_beginapamount,jdbcType=DECIMAL},
+                #{ve_beginapamount,jdbcType=DOUBLE},
             </if>
             <if test="ve_beginprepayamount != null" >
-                #{ve_beginprepayamount,jdbcType=DECIMAL},
+                #{ve_beginprepayamount,jdbcType=DOUBLE},
             </if>
             <if test="ve_promisedays != null" >
                 #{ve_promisedays,jdbcType=DECIMAL},
@@ -319,6 +324,9 @@
             <if test="ve_beginym != null" >
                 #{ve_beginym,jdbcType=INTEGER},
             </if>
+            <if test="ve_preamount !=null" >
+                #{ve_preamount,jdbcType=DOUBLE},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Vendor" >
@@ -340,10 +348,10 @@
                 ve_begindate = #{ve_begindate,jdbcType=TIMESTAMP},
             </if>
             <if test="ve_beginapamount != null" >
-                ve_beginapamount = #{ve_beginapamount,jdbcType=DECIMAL},
+                ve_beginapamount = #{ve_beginapamount,jdbcType=DOUBLE},
             </if>
             <if test="ve_beginprepayamount != null" >
-                ve_beginprepayamount = #{ve_beginprepayamount,jdbcType=DECIMAL},
+                ve_beginprepayamount = #{ve_beginprepayamount,jdbcType=DOUBLE},
             </if>
             <if test="ve_promisedays != null" >
                 ve_promisedays = #{ve_promisedays,jdbcType=DECIMAL},
@@ -408,6 +416,9 @@
             <if test="ve_beginym != null" >
                 ve_beginym = #{ve_beginym,jdbcType=INTEGER},
             </if>
+            <if test="ve_preamount !=null" >
+                #{ve_preamount,jdbcType=DOUBLE},
+            </if>
         </set>
         where ve_id = #{id}
     </update>
@@ -418,8 +429,8 @@
         ve_uu = #{ve_uu,jdbcType=VARCHAR},
         ve_type = #{ve_type,jdbcType=VARCHAR},
         ve_begindate = #{ve_begindate,jdbcType=TIMESTAMP},
-        ve_beginapamount = #{ve_beginapamount,jdbcType=DECIMAL},
-        ve_beginprepayamount = #{ve_beginprepayamount,jdbcType=DECIMAL},
+        ve_beginapamount = #{ve_beginapamount,jdbcType=DOUBLE},
+        ve_beginprepayamount = #{ve_beginprepayamount,jdbcType=DOUBLE},
         ve_promisedays = #{ve_promisedays,jdbcType=DECIMAL},
         ve_taxrate = #{ve_taxrate,jdbcType=DOUBLE},
         ve_nsrzh = #{ve_nsrzh,jdbcType=VARCHAR},
@@ -440,7 +451,8 @@
         ve_text5 = #{ve_text5,jdbcType=VARCHAR},
         ve_payamount = #{ve_payamount,jdbcType=DOUBLE},
         ve_leftamount = #{ve_leftamount,jdbcType=DOUBLE},
-        ve_beginym = #{ve_beginym,jdbcType=INTEGER}
+        ve_beginym = #{ve_beginym,jdbcType=INTEGER},
+        ve_preamount =#{ve_preamount,jdbcType=DOUBLE}
         where ve_id = #{id}
     </update>
 

+ 10 - 0
applications/money/money-server/pom.xml

@@ -97,6 +97,16 @@
             <version>1.0.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>document-dto</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>document-server</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <build>

+ 58 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/MoneyReportColltroller.java

@@ -0,0 +1,58 @@
+package com.usoftchina.saas.money.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.money.service.MoneyReportService;
+import com.usoftchina.saas.page.PageRequest;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author heqw
+ * @date 2018/11/9 14:21
+ **/
+@RestController
+@RequestMapping("/report")
+public class MoneyReportColltroller {
+    @Autowired
+    private MoneyReportService moneyReportService;
+
+    //供应商对账
+    @GetMapping("/vendorCheck")
+    public Result vendorCheck(PageRequest page, ListReqDTO req) {
+        PageInfo listData = moneyReportService.vendorCheck(page, req);
+        return Result.success(listData);
+    }
+
+    //应付账款明细
+    @GetMapping("/payDetail")
+    public Result payDetail(PageRequest page, ListReqDTO req) {
+        PageInfo listData = moneyReportService.payDetail(page, req);
+        return Result.success(listData);
+    }
+
+    //应收款明细表
+    @GetMapping("/recDetail")
+    public Result recDetail(PageRequest page, ListReqDTO req) {
+        PageInfo listData = moneyReportService.recDetail(page, req);
+        return Result.success(listData);
+    }
+
+    //资金账号余额表
+    @GetMapping("/accountBalance")
+    public Result acountBalance(PageRequest page, ListReqDTO req) {
+        PageInfo listData = moneyReportService.acountBalance(page, req);
+        return Result.success(listData);
+    }
+
+    //客户对账单
+    @GetMapping("/customercheck")
+    public Result customercheck(PageRequest page, ListReqDTO req) {
+        PageInfo listData = moneyReportService.customercheck(page, req);
+        return Result.success(listData);
+    }
+}

+ 10 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/AcountbalanceViewMapper.java

@@ -0,0 +1,10 @@
+package com.usoftchina.saas.money.mapper;
+
+import com.usoftchina.saas.money.po.AcountbalanceView;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface AcountbalanceViewMapper {
+    List<AcountbalanceView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+}

+ 11 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/CustomerCheckViewMapper.java

@@ -0,0 +1,11 @@
+package com.usoftchina.saas.money.mapper;
+
+import com.usoftchina.saas.money.po.AcountbalanceView;
+import com.usoftchina.saas.money.po.CustomerCheckView;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface CustomerCheckViewMapper {
+    List<CustomerCheckView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+}

+ 10 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/PaydetailViewMapper.java

@@ -0,0 +1,10 @@
+package com.usoftchina.saas.money.mapper;
+
+import com.usoftchina.saas.money.po.PaydetailView;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface PaydetailViewMapper {
+    List<PaydetailView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+}

+ 10 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/RecdetailViewMapper.java

@@ -0,0 +1,10 @@
+package com.usoftchina.saas.money.mapper;
+
+import com.usoftchina.saas.money.po.RecdetailView;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface RecdetailViewMapper {
+    List<RecdetailView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+}

+ 10 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/VendorAcountViewMapper.java

@@ -0,0 +1,10 @@
+package com.usoftchina.saas.money.mapper;
+
+import com.usoftchina.saas.money.po.VendorAcountView;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface VendorAcountViewMapper {
+    List<VendorAcountView> selectByCondition(@Param("con")String con, @Param("companyId")Long companyId);
+}

+ 134 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/AcountbalanceView.java

@@ -0,0 +1,134 @@
+package com.usoftchina.saas.money.po;
+
+import java.util.Date;
+
+public class AcountbalanceView {
+    private String bankcode;
+
+    private String bankname;
+
+    private Integer bankid;
+
+    private Date date;
+
+    private String kind;
+
+    private Double outamount;
+
+    private Double inamount;
+
+    private Double thisamount;
+
+    private String bcode;
+
+    private String bname;
+
+    private String bmanname;
+
+    private String remark;
+    private Integer companyId;
+
+    public Integer getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Integer companyId) {
+        this.companyId = companyId;
+    }
+
+    public String getBankcode() {
+        return bankcode;
+    }
+
+    public void setBankcode(String bankcode) {
+        this.bankcode = bankcode == null ? null : bankcode.trim();
+    }
+
+    public String getBankname() {
+        return bankname;
+    }
+
+    public void setBankname(String bankname) {
+        this.bankname = bankname == null ? null : bankname.trim();
+    }
+
+    public Integer getBankid() {
+        return bankid;
+    }
+
+    public void setBankid(Integer bankid) {
+        this.bankid = bankid;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public String getKind() {
+        return kind;
+    }
+
+    public void setKind(String kind) {
+        this.kind = kind == null ? null : kind.trim();
+    }
+
+    public Double getOutamount() {
+        return outamount;
+    }
+
+    public void setOutamount(Double outamount) {
+        this.outamount = outamount;
+    }
+
+    public Double getInamount() {
+        return inamount;
+    }
+
+    public void setInamount(Double inamount) {
+        this.inamount = inamount;
+    }
+
+    public Double getThisamount() {
+        return thisamount;
+    }
+
+    public void setThisamount(Double thisamount) {
+        this.thisamount = thisamount;
+    }
+
+    public String getBcode() {
+        return bcode;
+    }
+
+    public void setBcode(String bcode) {
+        this.bcode = bcode == null ? null : bcode.trim();
+    }
+
+    public String getBname() {
+        return bname;
+    }
+
+    public void setBname(String bname) {
+        this.bname = bname == null ? null : bname.trim();
+    }
+
+    public String getBmanname() {
+        return bmanname;
+    }
+
+    public void setBmanname(String bmanname) {
+        this.bmanname = bmanname == null ? null : bmanname.trim();
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark == null ? null : remark.trim();
+    }
+}

+ 165 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/CustomerCheckView.java

@@ -0,0 +1,165 @@
+package com.usoftchina.saas.money.po;
+
+import java.util.Date;
+
+public class CustomerCheckView {
+    private String pi_inoutno;
+
+    private String pi_class;
+
+    private String pi_custcode;
+
+    private String pi_custname;
+
+    private Date pi_date;
+
+    private Integer pd_pdno;
+
+    private String pr_code;
+
+    private String pr_detail;
+
+    private String pr_spec;
+
+    private String pd_unit;
+
+    private Double qty;
+
+    private Double pd_orderprice;
+
+    private Double pd_taxrate;
+
+    private Double pd_total;
+
+    private Double pd_netprice;
+
+    private Double pd_nettotal;
+
+    public String getPi_inoutno() {
+        return pi_inoutno;
+    }
+
+    public void setPi_inoutno(String pi_inoutno) {
+        this.pi_inoutno = pi_inoutno;
+    }
+
+    public String getPi_class() {
+        return pi_class;
+    }
+
+    public void setPi_class(String pi_class) {
+        this.pi_class = pi_class;
+    }
+
+    public String getPi_custcode() {
+        return pi_custcode;
+    }
+
+    public void setPi_custcode(String pi_custcode) {
+        this.pi_custcode = pi_custcode;
+    }
+
+    public String getPi_custname() {
+        return pi_custname;
+    }
+
+    public void setPi_custname(String pi_custname) {
+        this.pi_custname = pi_custname;
+    }
+
+    public Date getPi_date() {
+        return pi_date;
+    }
+
+    public void setPi_date(Date pi_date) {
+        this.pi_date = pi_date;
+    }
+
+    public Integer getPd_pdno() {
+        return pd_pdno;
+    }
+
+    public void setPd_pdno(Integer pd_pdno) {
+        this.pd_pdno = pd_pdno;
+    }
+
+    public String getPr_code() {
+        return pr_code;
+    }
+
+    public void setPr_code(String pr_code) {
+        this.pr_code = pr_code;
+    }
+
+    public String getPr_detail() {
+        return pr_detail;
+    }
+
+    public void setPr_detail(String pr_detail) {
+        this.pr_detail = pr_detail;
+    }
+
+    public String getPr_spec() {
+        return pr_spec;
+    }
+
+    public void setPr_spec(String pr_spec) {
+        this.pr_spec = pr_spec;
+    }
+
+    public String getPd_unit() {
+        return pd_unit;
+    }
+
+    public void setPd_unit(String pd_unit) {
+        this.pd_unit = pd_unit;
+    }
+
+    public Double getQty() {
+        return qty;
+    }
+
+    public void setQty(Double qty) {
+        this.qty = qty;
+    }
+
+    public Double getPd_orderprice() {
+        return pd_orderprice;
+    }
+
+    public void setPd_orderprice(Double pd_orderprice) {
+        this.pd_orderprice = pd_orderprice;
+    }
+
+    public Double getPd_taxrate() {
+        return pd_taxrate;
+    }
+
+    public void setPd_taxrate(Double pd_taxrate) {
+        this.pd_taxrate = pd_taxrate;
+    }
+
+    public Double getPd_total() {
+        return pd_total;
+    }
+
+    public void setPd_total(Double pd_total) {
+        this.pd_total = pd_total;
+    }
+
+    public Double getPd_netprice() {
+        return pd_netprice;
+    }
+
+    public void setPd_netprice(Double pd_netprice) {
+        this.pd_netprice = pd_netprice;
+    }
+
+    public Double getPd_nettotal() {
+        return pd_nettotal;
+    }
+
+    public void setPd_nettotal(Double pd_nettotal) {
+        this.pd_nettotal = pd_nettotal;
+    }
+}

+ 10 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransferdetail.java

@@ -13,6 +13,8 @@ public class Fundtransferdetail extends CommonBaseEntity implements Serializable
 
     private Integer ftd_ym;
 
+    private Date ft_date;
+
     private Integer ftd_bankid;
 
     private String ftd_bankcode;
@@ -45,6 +47,14 @@ public class Fundtransferdetail extends CommonBaseEntity implements Serializable
 
     private String ftd_text5;
 
+    public Date getFt_date() {
+        return ft_date;
+    }
+
+    public void setFt_date(Date ft_date) {
+        this.ft_date = ft_date;
+    }
+
     public Integer getFtd_ftid() {
         return ftd_ftid;
     }

+ 9 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Othreceiptsdetail.java

@@ -12,6 +12,7 @@ public class Othreceiptsdetail extends CommonBaseEntity implements Serializable
     private Integer ord_detno;
 
     private Integer ord_ym;
+    private Date or_date;
 
     private String ord_type;
 
@@ -31,6 +32,14 @@ public class Othreceiptsdetail extends CommonBaseEntity implements Serializable
 
     private String ord_text5;
 
+    public Date getOr_date() {
+        return or_date;
+    }
+
+    public void setOr_date(Date or_date) {
+        this.or_date = or_date;
+    }
+
     public Integer getOrd_orid() {
         return ord_orid;
     }

+ 10 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Othspendingsdetail.java

@@ -13,6 +13,8 @@ public class Othspendingsdetail extends CommonBaseEntity implements Serializable
 
     private Integer osd_ym;
 
+    private Date os_date;
+
     private String osd_type;
 
     private Double osd_nowbalance;
@@ -31,6 +33,14 @@ public class Othspendingsdetail extends CommonBaseEntity implements Serializable
 
     private String osd_text5;
 
+    public Date getOs_date() {
+        return os_date;
+    }
+
+    public void setOs_date(Date os_date) {
+        this.os_date = os_date;
+    }
+
     public Integer getOsd_orid() {
         return osd_orid;
     }

+ 155 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/PaydetailView.java

@@ -0,0 +1,155 @@
+package com.usoftchina.saas.money.po;
+
+import java.util.Date;
+
+public class PaydetailView {
+    private String pi_inoutno;
+
+    private String pi_vendcode;
+
+    private String pi_vendname;
+
+    private String pi_class;
+
+    private String PU_BUYERCODE;
+
+    private String PU_BUYERNAME;
+
+    private Date pb_date;
+
+    private Double ve_beginapamount;
+
+    private Double pb_pdamount;
+
+    private Double pb_pbdamount;
+
+    private Double mustpay;
+
+    private Long mustdate;
+
+    private Double pi_total;
+
+    private String pi_remark;
+
+    private Integer companyId;
+
+    public Integer getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Integer companyId) {
+        this.companyId = companyId;
+    }
+
+    public String getPi_inoutno() {
+        return pi_inoutno;
+    }
+
+    public void setPi_inoutno(String pi_inoutno) {
+        this.pi_inoutno = pi_inoutno == null ? null : pi_inoutno.trim();
+    }
+
+    public String getPi_vendcode() {
+        return pi_vendcode;
+    }
+
+    public void setPi_vendcode(String pi_vendcode) {
+        this.pi_vendcode = pi_vendcode == null ? null : pi_vendcode.trim();
+    }
+
+    public String getPi_vendname() {
+        return pi_vendname;
+    }
+
+    public void setPi_vendname(String pi_vendname) {
+        this.pi_vendname = pi_vendname == null ? null : pi_vendname.trim();
+    }
+
+    public String getPi_class() {
+        return pi_class;
+    }
+
+    public void setPi_class(String pi_class) {
+        this.pi_class = pi_class == null ? null : pi_class.trim();
+    }
+
+    public String getPU_BUYERCODE() {
+        return PU_BUYERCODE;
+    }
+
+    public void setPU_BUYERCODE(String PU_BUYERCODE) {
+        this.PU_BUYERCODE = PU_BUYERCODE == null ? null : PU_BUYERCODE.trim();
+    }
+
+    public String getPU_BUYERNAME() {
+        return PU_BUYERNAME;
+    }
+
+    public void setPU_BUYERNAME(String PU_BUYERNAME) {
+        this.PU_BUYERNAME = PU_BUYERNAME == null ? null : PU_BUYERNAME.trim();
+    }
+
+    public Date getPb_date() {
+        return pb_date;
+    }
+
+    public void setPb_date(Date pb_date) {
+        this.pb_date = pb_date;
+    }
+
+    public Double getVe_beginapamount() {
+        return ve_beginapamount;
+    }
+
+    public void setVe_beginapamount(Double ve_beginapamount) {
+        this.ve_beginapamount = ve_beginapamount;
+    }
+
+    public Double getPb_pdamount() {
+        return pb_pdamount;
+    }
+
+    public void setPb_pdamount(Double pb_pdamount) {
+        this.pb_pdamount = pb_pdamount;
+    }
+
+    public Double getPb_pbdamount() {
+        return pb_pbdamount;
+    }
+
+    public void setPb_pbdamount(Double pb_pbdamount) {
+        this.pb_pbdamount = pb_pbdamount;
+    }
+
+    public Double getMustpay() {
+        return mustpay;
+    }
+
+    public void setMustpay(Double mustpay) {
+        this.mustpay = mustpay;
+    }
+
+    public Long getMustdate() {
+        return mustdate;
+    }
+
+    public void setMustdate(Long mustdate) {
+        this.mustdate = mustdate;
+    }
+
+    public Double getPi_total() {
+        return pi_total;
+    }
+
+    public void setPi_total(Double pi_total) {
+        this.pi_total = pi_total;
+    }
+
+    public String getPi_remark() {
+        return pi_remark;
+    }
+
+    public void setPi_remark(String pi_remark) {
+        this.pi_remark = pi_remark == null ? null : pi_remark.trim();
+    }
+}

+ 154 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/RecdetailView.java

@@ -0,0 +1,154 @@
+package com.usoftchina.saas.money.po;
+
+import java.util.Date;
+
+public class RecdetailView {
+    private String pi_inoutno;
+
+    private String pi_custcode;
+
+    private String pi_custname;
+
+    private String pi_class;
+
+    private String PU_BUYERCODE;
+
+    private String PU_BUYERNAME;
+
+    private Date pb_date;
+
+    private Double cu_beginaramount;
+
+    private Double pb_pdamount;
+
+    private Double pb_pbdamount;
+
+    private Double mustpay;
+
+    private Double mustdate;
+
+    private Double pi_total;
+
+    private String pi_remark;
+    private Integer companyId;
+
+    public Integer getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Integer companyId) {
+        this.companyId = companyId;
+    }
+
+    public String getPi_inoutno() {
+        return pi_inoutno;
+    }
+
+    public void setPi_inoutno(String pi_inoutno) {
+        this.pi_inoutno = pi_inoutno == null ? null : pi_inoutno.trim();
+    }
+
+    public String getPi_custcode() {
+        return pi_custcode;
+    }
+
+    public void setPi_custcode(String pi_custcode) {
+        this.pi_custcode = pi_custcode == null ? null : pi_custcode.trim();
+    }
+
+    public String getPi_custname() {
+        return pi_custname;
+    }
+
+    public void setPi_custname(String pi_custname) {
+        this.pi_custname = pi_custname == null ? null : pi_custname.trim();
+    }
+
+    public String getPi_class() {
+        return pi_class;
+    }
+
+    public void setPi_class(String pi_class) {
+        this.pi_class = pi_class == null ? null : pi_class.trim();
+    }
+
+    public String getPU_BUYERCODE() {
+        return PU_BUYERCODE;
+    }
+
+    public void setPU_BUYERCODE(String PU_BUYERCODE) {
+        this.PU_BUYERCODE = PU_BUYERCODE == null ? null : PU_BUYERCODE.trim();
+    }
+
+    public String getPU_BUYERNAME() {
+        return PU_BUYERNAME;
+    }
+
+    public void setPU_BUYERNAME(String PU_BUYERNAME) {
+        this.PU_BUYERNAME = PU_BUYERNAME == null ? null : PU_BUYERNAME.trim();
+    }
+
+    public Date getPb_date() {
+        return pb_date;
+    }
+
+    public void setPb_date(Date pb_date) {
+        this.pb_date = pb_date;
+    }
+
+    public Double getCu_beginaramount() {
+        return cu_beginaramount;
+    }
+
+    public void setCu_beginaramount(Double cu_beginaramount) {
+        this.cu_beginaramount = cu_beginaramount;
+    }
+
+    public Double getPb_pdamount() {
+        return pb_pdamount;
+    }
+
+    public void setPb_pdamount(Double pb_pdamount) {
+        this.pb_pdamount = pb_pdamount;
+    }
+
+    public Double getPb_pbdamount() {
+        return pb_pbdamount;
+    }
+
+    public void setPb_pbdamount(Double pb_pbdamount) {
+        this.pb_pbdamount = pb_pbdamount;
+    }
+
+    public Double getMustpay() {
+        return mustpay;
+    }
+
+    public void setMustpay(Double mustpay) {
+        this.mustpay = mustpay;
+    }
+
+    public Double getMustdate() {
+        return mustdate;
+    }
+
+    public void setMustdate(Double mustdate) {
+        this.mustdate = mustdate;
+    }
+
+    public Double getPi_total() {
+        return pi_total;
+    }
+
+    public void setPi_total(Double pi_total) {
+        this.pi_total = pi_total;
+    }
+
+    public String getPi_remark() {
+        return pi_remark;
+    }
+
+    public void setPi_remark(String pi_remark) {
+        this.pi_remark = pi_remark == null ? null : pi_remark.trim();
+    }
+}

+ 174 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/VendorAcountView.java

@@ -0,0 +1,174 @@
+package com.usoftchina.saas.money.po;
+
+import java.util.Date;
+
+public class VendorAcountView {
+    private String pi_inoutno;
+
+    private String pi_class;
+
+    private String pi_vendcode;
+
+    private String pi_vendname;
+
+    private Date pi_date;
+
+    private Integer pd_pdno;
+
+    private String pr_code;
+
+    private String pr_detail;
+
+    private String pr_spec;
+
+    private String pd_unit;
+
+    private Double qty;
+
+    private Double pd_orderprice;
+
+    private Double pd_taxrate;
+
+    private Double pd_total;
+
+    private Double pd_netprice;
+
+    private Double pd_nettotal;
+    private Integer companyId;
+
+    public Integer getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Integer companyId) {
+        this.companyId = companyId;
+    }
+
+    public String getPi_inoutno() {
+        return pi_inoutno;
+    }
+
+    public void setPi_inoutno(String pi_inoutno) {
+        this.pi_inoutno = pi_inoutno == null ? null : pi_inoutno.trim();
+    }
+
+    public String getPi_class() {
+        return pi_class;
+    }
+
+    public void setPi_class(String pi_class) {
+        this.pi_class = pi_class == null ? null : pi_class.trim();
+    }
+
+    public String getPi_vendcode() {
+        return pi_vendcode;
+    }
+
+    public void setPi_vendcode(String pi_vendcode) {
+        this.pi_vendcode = pi_vendcode == null ? null : pi_vendcode.trim();
+    }
+
+    public String getPi_vendname() {
+        return pi_vendname;
+    }
+
+    public void setPi_vendname(String pi_vendname) {
+        this.pi_vendname = pi_vendname == null ? null : pi_vendname.trim();
+    }
+
+    public Date getPi_date() {
+        return pi_date;
+    }
+
+    public void setPi_date(Date pi_date) {
+        this.pi_date = pi_date;
+    }
+
+    public Integer getPd_pdno() {
+        return pd_pdno;
+    }
+
+    public void setPd_pdno(Integer pd_pdno) {
+        this.pd_pdno = pd_pdno;
+    }
+
+    public String getPr_code() {
+        return pr_code;
+    }
+
+    public void setPr_code(String pr_code) {
+        this.pr_code = pr_code == null ? null : pr_code.trim();
+    }
+
+    public String getPr_detail() {
+        return pr_detail;
+    }
+
+    public void setPr_detail(String pr_detail) {
+        this.pr_detail = pr_detail == null ? null : pr_detail.trim();
+    }
+
+    public String getPr_spec() {
+        return pr_spec;
+    }
+
+    public void setPr_spec(String pr_spec) {
+        this.pr_spec = pr_spec == null ? null : pr_spec.trim();
+    }
+
+    public String getPd_unit() {
+        return pd_unit;
+    }
+
+    public void setPd_unit(String pd_unit) {
+        this.pd_unit = pd_unit == null ? null : pd_unit.trim();
+    }
+
+    public Double getQty() {
+        return qty;
+    }
+
+    public void setQty(Double qty) {
+        this.qty = qty;
+    }
+
+    public Double getPd_orderprice() {
+        return pd_orderprice;
+    }
+
+    public void setPd_orderprice(Double pd_orderprice) {
+        this.pd_orderprice = pd_orderprice;
+    }
+
+    public Double getPd_taxrate() {
+        return pd_taxrate;
+    }
+
+    public void setPd_taxrate(Double pd_taxrate) {
+        this.pd_taxrate = pd_taxrate;
+    }
+
+    public Double getPd_total() {
+        return pd_total;
+    }
+
+    public void setPd_total(Double pd_total) {
+        this.pd_total = pd_total;
+    }
+
+    public Double getPd_netprice() {
+        return pd_netprice;
+    }
+
+    public void setPd_netprice(Double pd_netprice) {
+        this.pd_netprice = pd_netprice;
+    }
+
+    public Double getPd_nettotal() {
+        return pd_nettotal;
+    }
+
+    public void setPd_nettotal(Double pd_nettotal) {
+        this.pd_nettotal = pd_nettotal;
+    }
+}

+ 17 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/MoneyReportService.java

@@ -0,0 +1,17 @@
+package com.usoftchina.saas.money.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+
+/**
+ * @author heqw
+ * @date 2018/11/9 14:50
+ **/
+public interface MoneyReportService {
+    PageInfo vendorCheck(PageRequest page, ListReqDTO req);
+    PageInfo payDetail(PageRequest page, ListReqDTO req);
+    PageInfo recDetail(PageRequest page, ListReqDTO req);
+    PageInfo acountBalance(PageRequest page, ListReqDTO req);
+    PageInfo customercheck(PageRequest page, ListReqDTO req);
+}

+ 7 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/FundtransferServiceImpl.java

@@ -92,9 +92,15 @@ public class FundtransferServiceImpl implements FundtransferService {
             this.insert(fundtran);
         }else {
             fundtransferMapper.updateByPrimaryKeySelective(fundtransfer);
+            List<Fundtransferdetail> fundtransferdetailList = fundtran.getItems();
+            Iterator isList = fundtransferdetailList.iterator();
+            while (isList.hasNext()){
+                Fundtransferdetail fundtransferdetail = (Fundtransferdetail) isList.next();
+                fundtransferdetail.setFt_date(fundtransfer.getFt_date());
+                fundtransferdetailMapper.updateByPrimaryKeySelective(fundtransferdetail);
+            }
         }
 
-
         //取从表金额
         List<Fundtransferdetail> fundtransferdetailList = fundtran.getItems();
         Iterator isList = fundtransferdetailList.iterator();

+ 94 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/MoneyReportServiceImpl.java

@@ -0,0 +1,94 @@
+package com.usoftchina.saas.money.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.money.mapper.*;
+import com.usoftchina.saas.money.service.MoneyReportService;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author heqw
+ * @date 2018/11/9 14:54
+ **/
+@Service
+public class MoneyReportServiceImpl implements MoneyReportService {
+    @Autowired
+    private VendorAcountViewMapper vendorAcountViewMapper;
+    @Autowired
+    private PaydetailViewMapper paydetailViewMapper;
+    @Autowired
+    private RecdetailViewMapper recdetailViewMapper;
+    @Autowired
+    private AcountbalanceViewMapper acountbalanceViewMapper;
+    @Autowired
+    private CustomerCheckViewMapper customerCheckViewMapper;
+
+    @Override
+    public PageInfo vendorCheck(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "Supplier");
+    }
+
+    @Override
+    public PageInfo payDetail(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "payDetail");
+    }
+
+    @Override
+    public PageInfo recDetail(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "recDetail");
+    }
+
+    @Override
+    public PageInfo acountBalance(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "acountBalance");
+    }
+
+    @Override
+    public PageInfo customercheck(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "customercheck");
+    }
+
+    private PageInfo getListDATA(PageRequest page, ListReqDTO req, String type) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+
+
+        //查询数据
+        List list = getListByType(req, type);
+        //取分页信息
+        PageInfo lists = new PageInfo(list);
+        return lists;
+    }
+
+    private List getListByType(ListReqDTO req, String type) {
+        List list = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        String con = req.getFinalCondition();
+        if (null == con) {
+            con = "1=1";
+        }
+        if ("Supplier".equals(type)) {
+            list = vendorAcountViewMapper.selectByCondition(con, companyId);
+        } else if("payDetail".equals(type)){
+            list = paydetailViewMapper.selectByCondition(con, companyId);
+        }else if("recDetail".equals(type)){
+            list = recdetailViewMapper.selectByCondition(con, companyId);
+        }else if ("acountBalance".equals(type)){
+            list = acountbalanceViewMapper.selectByCondition(con, companyId);
+        }else if ("customercheck".equals(type)){
+            list = customerCheckViewMapper.selectByCondition(con, companyId);
+        }
+        return list;
+    }
+}

+ 11 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthreceiptsServiceImpl.java

@@ -14,7 +14,10 @@ import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.money.mapper.BanksubledgerMapper;
 import com.usoftchina.saas.money.mapper.OthreceiptsMapper;
 import com.usoftchina.saas.money.mapper.OthreceiptsdetailMapper;
-import com.usoftchina.saas.money.po.*;
+import com.usoftchina.saas.money.po.Banksubledger;
+import com.usoftchina.saas.money.po.Othreceipts;
+import com.usoftchina.saas.money.po.Othreceiptsdetail;
+import com.usoftchina.saas.money.po.Othte;
 import com.usoftchina.saas.money.service.OthreceiptsService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -93,6 +96,13 @@ public class OthreceiptsServiceImpl implements OthreceiptsService {
             this.insert(othte);
         }else {
             othreceiptsMapper.updateByPrimaryKeySelective(othreceipts);
+            List<Othreceiptsdetail> othreceiptsdetailList = othte.getItems();
+            Iterator isList = othreceiptsdetailList.iterator();
+            while (isList.hasNext()){
+                Othreceiptsdetail fundtransferdetail = (Othreceiptsdetail) isList.next();
+                fundtransferdetail.setOr_date(othreceipts.getOr_date());
+                othreceiptsdetailMapper.updateByPrimaryKeySelective(fundtransferdetail);
+            }
         }
 
         Double amount = banksubledgerMapper.selectThisamount(othreceipts.getOr_bankcode());

+ 14 - 2
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthspendingsServiceImpl.java

@@ -11,8 +11,13 @@ import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.exception.BizException;
-import com.usoftchina.saas.money.mapper.*;
-import com.usoftchina.saas.money.po.*;
+import com.usoftchina.saas.money.mapper.BanksubledgerMapper;
+import com.usoftchina.saas.money.mapper.OthspendingsMapper;
+import com.usoftchina.saas.money.mapper.OthspendingsdetailMapper;
+import com.usoftchina.saas.money.po.Banksubledger;
+import com.usoftchina.saas.money.po.Othsp;
+import com.usoftchina.saas.money.po.Othspendings;
+import com.usoftchina.saas.money.po.Othspendingsdetail;
 import com.usoftchina.saas.money.service.OthspendingsService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -121,6 +126,13 @@ public class OthspendingsServiceImpl implements OthspendingsService {
             this.insert(othsp);
         }else {
             othspendingsMapper.updateByPrimaryKeySelective(othspendings);
+            List<Othspendingsdetail> othspendingsdetailList = othsp.getItems();
+            Iterator isList = othspendingsdetailList.iterator();
+            while (isList.hasNext()){
+                Othspendingsdetail othspendingsdetail = (Othspendingsdetail) isList.next();
+                othspendingsdetail.setOs_date(othspendings.getOs_date());
+                othspendingsdetailMapper.updateByPrimaryKeySelective(othspendingsdetail);
+            }
         }
 
         Double amount = banksubledgerMapper.selectThisamount(othspendings.getOs_bankcode());

+ 33 - 0
applications/money/money-server/src/main/resources/mapper/AcountbalanceViewMapper.xml

@@ -0,0 +1,33 @@
+<?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.usoftchina.saas.money.mapper.AcountbalanceViewMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.AcountbalanceView" >
+    <result column="bankcode" property="bankcode" jdbcType="VARCHAR" />
+    <result column="bankname" property="bankname" jdbcType="VARCHAR" />
+    <result column="bankid" property="bankid" jdbcType="INTEGER" />
+    <result column="date" property="date" jdbcType="TIMESTAMP" />
+    <result column="kind" property="kind" jdbcType="VARCHAR" />
+    <result column="outamount" property="outamount" jdbcType="DOUBLE" />
+    <result column="inamount" property="inamount" jdbcType="DOUBLE" />
+    <result column="thisamount" property="thisamount" jdbcType="DOUBLE" />
+    <result column="bcode" property="bcode" jdbcType="VARCHAR" />
+    <result column="bname" property="bname" jdbcType="VARCHAR" />
+    <result column="bmanname" property="bmanname" jdbcType="VARCHAR" />
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
+    <result column="companyId" property="companyId" jdbcType="INTEGER" />
+  </resultMap>
+
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from acountbalance_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by date desc
+  </select>
+
+</mapper>

+ 36 - 0
applications/money/money-server/src/main/resources/mapper/CustomerCheckViewMapper.xml

@@ -0,0 +1,36 @@
+<?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.usoftchina.saas.money.mapper.CustomerCheckViewMapper" >
+    <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.CustomerCheckView" >
+        <result column="pi_inoutno" property="pi_inoutno" jdbcType="VARCHAR" />
+        <result column="pi_class" property="pi_class" jdbcType="VARCHAR" />
+        <result column="pi_custcode" property="pi_custcode" jdbcType="VARCHAR" />
+        <result column="pi_custname" property="pi_custname" jdbcType="VARCHAR" />
+        <result column="pi_date" property="pi_date" jdbcType="TIMESTAMP" />
+        <result column="pd_pdno" property="pd_pdno" jdbcType="INTEGER" />
+        <result column="pr_code" property="pr_code" jdbcType="VARCHAR" />
+        <result column="pr_detail" property="pr_detail" jdbcType="VARCHAR" />
+        <result column="pr_spec" property="pr_spec" jdbcType="VARCHAR" />
+        <result column="pd_unit" property="pd_unit" jdbcType="VARCHAR" />
+        <result column="qty" property="qty" jdbcType="DOUBLE" />
+        <result column="pd_orderprice" property="pd_orderprice" jdbcType="DOUBLE" />
+        <result column="pd_taxrate" property="pd_taxrate" jdbcType="DOUBLE" />
+        <result column="pd_total" property="pd_total" jdbcType="DOUBLE" />
+        <result column="pd_netprice" property="pd_netprice" jdbcType="DOUBLE" />
+        <result column="pd_nettotal" property="pd_nettotal" jdbcType="DOUBLE" />
+    </resultMap>
+
+    <select id="selectByCondition" resultMap="BaseResultMap">
+        select  *  from customer_amount_view
+        <where>
+            <if test="con != null">
+                ${con}
+            </if>
+            <if test="companyId != null">
+                and  companyId = #{companyId}
+            </if>
+        </where>
+        order by pi_date desc
+    </select>
+
+</mapper>

+ 1 - 10
applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml

@@ -70,9 +70,7 @@
       <if test="ft_recorder != null" >
         ft_recorder,
       </if>
-      <if test="ft_recorddate != null" >
         ft_recorddate,
-      </if>
       <if test="ft_status != null" >
         ft_status,
       </if>
@@ -88,7 +86,6 @@
       <if test="updaterId != null" >
         updaterId,
       </if>
-        updatedate,
       <if test="ft_text1 != null" >
         ft_text1,
       </if>
@@ -118,9 +115,7 @@
       <if test="ft_recorder != null" >
         #{ft_recorder,jdbcType=VARCHAR},
       </if>
-      <if test="ft_recorddate != null" >
-        #{ft_recorddate,jdbcType=TIMESTAMP},
-      </if>
+        now(),
       <if test="ft_status != null" >
         #{ft_status,jdbcType=VARCHAR},
       </if>
@@ -136,7 +131,6 @@
       <if test="updaterId != null" >
         #{updaterId,jdbcType=INTEGER},
       </if>
-        #{now(),jdbcType=TIMESTAMP},
       <if test="ft_text1 != null" >
         #{ft_text1,jdbcType=VARCHAR},
       </if>
@@ -190,9 +184,6 @@
       <if test="updaterId != null" >
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updatedate != null" >
-        updatedate = #{updatedate,jdbcType=TIMESTAMP},
-      </if>
       <if test="ft_text1 != null" >
         ft_text1 = #{ft_text1,jdbcType=VARCHAR},
       </if>

+ 4 - 5
applications/money/money-server/src/main/resources/mapper/FundtransferdetailMapper.xml

@@ -6,6 +6,7 @@
     <result column="ftd_ftid" property="ftd_ftid" jdbcType="INTEGER" />
     <result column="ftd_detno" property="ftd_detno" jdbcType="INTEGER" />
     <result column="ftd_ym" property="ftd_ym" jdbcType="INTEGER" />
+      <result column="ft_date" property="ft_date" jdbcType="TIMESTAMP" />
     <result column="ftd_bankid" property="ftd_bankid" jdbcType="INTEGER" />
     <result column="ftd_bankcode" property="ftd_bankcode" jdbcType="VARCHAR" />
     <result column="ftd_bankname" property="ftd_bankname" jdbcType="VARCHAR" />
@@ -207,8 +208,8 @@
       <if test="ftd_detno != null" >
         ftd_detno = #{ftd_detno,jdbcType=INTEGER},
       </if>
-      <if test="ftd_ym != null" >
-        ftd_ym = to_char(#{ftd_ym,jdbcType=INTEGER},'yyyymm'),
+      <if test="ft_date != null" >
+        ftd_ym = CONVERT(date_format(#{ft_date,jdbcType=TIMESTAMP},'%Y%m'),SIGNED),
       </if>
       <if test="ftd_bankid != null" >
         ftd_bankid = #{ftd_bankid,jdbcType=INTEGER},
@@ -246,9 +247,7 @@
       <if test="updaterId != null" >
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updatedate != null" >
-        updatedate = #{updatedate,jdbcType=TIMESTAMP},
-      </if>
+        updatedate = now(),
       <if test="ftd_text1 != null" >
         ftd_text1 = #{ftd_text1,jdbcType=VARCHAR},
       </if>

+ 1 - 14
applications/money/money-server/src/main/resources/mapper/OthreceiptsMapper.xml

@@ -106,9 +106,7 @@
       <if test="or_recorder != null" >
         or_recorder,
       </if>
-      <if test="or_recorddate != null" >
         or_recorddate,
-      </if>
       <if test="or_status != null" >
         or_status,
       </if>
@@ -124,9 +122,6 @@
       <if test="updaterId != null" >
         updaterId,
       </if>
-      <if test="updatedate != null" >
-        updatedate,
-      </if>
       <if test="or_text1 != null" >
         or_text1,
       </if>
@@ -177,9 +172,7 @@
       <if test="or_recorder != null" >
         #{or_recorder,jdbcType=VARCHAR},
       </if>
-      <if test="or_recorddate != null" >
-        #{or_recorddate,jdbcType=TIMESTAMP},
-      </if>
+      now(),
       <if test="or_status != null" >
         #{or_status,jdbcType=VARCHAR},
       </if>
@@ -195,9 +188,6 @@
       <if test="updaterId != null" >
         #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updatedate != null" >
-        #{updatedate,jdbcType=TIMESTAMP},
-      </if>
       <if test="or_text1 != null" >
         #{or_text1,jdbcType=VARCHAR},
       </if>
@@ -272,9 +262,6 @@
       <if test="updaterId != null" >
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updatedate != null" >
-        updatedate = #{updatedate,jdbcType=TIMESTAMP},
-      </if>
       <if test="or_text1 != null" >
         or_text1 = #{or_text1,jdbcType=VARCHAR},
       </if>

+ 3 - 2
applications/money/money-server/src/main/resources/mapper/OthreceiptsdetailMapper.xml

@@ -6,6 +6,7 @@
     <result column="ord_orid" property="ord_orid" jdbcType="INTEGER" />
     <result column="ord_detno" property="ord_detno" jdbcType="INTEGER" />
     <result column="ord_ym" property="ord_ym" jdbcType="INTEGER" />
+    <result column="or_date" property="or_date" jdbcType="TIMESTAMP" />
     <result column="ord_type" property="ord_type" jdbcType="VARCHAR" />
     <result column="ord_nowbalance" property="ord_nowbalance" jdbcType="DOUBLE" />
     <result column="ord_remark" property="ord_remark" jdbcType="VARCHAR" />
@@ -149,8 +150,8 @@
       <if test="ord_detno != null" >
         ord_detno = #{ord_detno,jdbcType=INTEGER},
       </if>
-      <if test="ord_ym != null" >
-        ord_ym = to_char(#{ord_ym,jdbcType=INTEGER},'yyyymm'),
+      <if test="or_date != null" >
+        ord_ym = CONVERT(date_format(#{or_date,jdbcType=TIMESTAMP},'%Y%m'),SIGNED),
       </if>
       <if test="ord_type != null" >
         ord_type = #{ord_type,jdbcType=VARCHAR},

+ 2 - 14
applications/money/money-server/src/main/resources/mapper/OthspendingsMapper.xml

@@ -100,9 +100,7 @@
       <if test="os_recorder != null" >
         os_recorder,
       </if>
-      <if test="os_recorddate != null" >
         os_recorddate,
-      </if>
       <if test="os_status != null" >
         os_status,
       </if>
@@ -118,9 +116,6 @@
       <if test="updaterId != null" >
         updaterId,
       </if>
-      <if test="updatedate != null" >
-        updatedate,
-      </if>
       <if test="os_text1 != null" >
         os_text1,
       </if>
@@ -165,9 +160,7 @@
       <if test="os_amount != null" >
         #{os_amount,jdbcType=DOUBLE},
       </if>
-      <if test="os_recorderid != null" >
-        #{os_recorderid,jdbcType=INTEGER},
-      </if>
+      now(),
       <if test="os_recorder != null" >
         #{os_recorder,jdbcType=VARCHAR},
       </if>
@@ -189,9 +182,6 @@
       <if test="updaterId != null" >
         #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updatedate != null" >
-        #{updatedate,jdbcType=TIMESTAMP},
-      </if>
       <if test="os_text1 != null" >
         #{os_text1,jdbcType=VARCHAR},
       </if>
@@ -266,9 +256,7 @@
       <if test="updaterId != null" >
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updatedate != null" >
-        updatedate = #{updatedate,jdbcType=TIMESTAMP},
-      </if>
+      updatedate = now(),
       <if test="os_text1 != null" >
         os_text1 = #{os_text1,jdbcType=VARCHAR},
       </if>

+ 3 - 2
applications/money/money-server/src/main/resources/mapper/OthspendingsdetailMapper.xml

@@ -6,6 +6,7 @@
     <result column="osd_orid" property="osd_orid" jdbcType="INTEGER" />
     <result column="osd_detno" property="osd_detno" jdbcType="INTEGER" />
     <result column="osd_ym" property="osd_ym" jdbcType="INTEGER" />
+    <result column="os_date" property="os_date" jdbcType="TIMESTAMP" />
     <result column="osd_type" property="osd_type" jdbcType="VARCHAR" />
     <result column="osd_nowbalance" property="osd_nowbalance" jdbcType="DOUBLE" />
     <result column="osd_remark" property="osd_remark" jdbcType="VARCHAR" />
@@ -155,8 +156,8 @@
       <if test="osd_detno != null" >
         osd_detno = #{osd_detno,jdbcType=INTEGER},
       </if>
-      <if test="osd_ym != null" >
-        osd_ym = to_char(#{osd_ym,jdbcType=INTEGER}, 'yyyymm'),
+      <if test="os_date != null" >
+        osd_ym = CONVERT(date_format(#{os_date,jdbcType=TIMESTAMP},'%Y%m'),SIGNED),
       </if>
       <if test="osd_type != null" >
         osd_type = #{osd_type,jdbcType=VARCHAR},

+ 1 - 14
applications/money/money-server/src/main/resources/mapper/PaybalanceMapper.xml

@@ -183,9 +183,7 @@
       <if test="pb_recorder != null">
         pb_recorder,
       </if>
-      <if test="pb_recorddate != null">
         pb_recorddate,
-      </if>
       <if test="pb_status != null">
         pb_status,
       </if>
@@ -201,9 +199,6 @@
       <if test="updaterId != null">
         updaterId,
       </if>
-      <if test="updatedate != null">
-        updatedate,
-      </if>
       <if test="pb_text1 != null">
         pb_text1,
       </if>
@@ -263,9 +258,7 @@
       <if test="pb_recorder != null">
         #{pb_recorder,jdbcType=VARCHAR},
       </if>
-      <if test="pb_recorddate != null">
-        #{pb_recorddate,jdbcType=TIMESTAMP},
-      </if>
+      now(),
       <if test="pb_status != null">
         #{pb_status,jdbcType=INTEGER},
       </if>
@@ -281,9 +274,6 @@
       <if test="updaterId != null">
         #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updatedate != null">
-        #{updatedate,jdbcType=TIMESTAMP},
-      </if>
       <if test="pb_text1 != null">
         #{pb_text1,jdbcType=VARCHAR},
       </if>
@@ -374,9 +364,6 @@
       <if test="updaterId != null">
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updateTime != null">
-        updatedate = #{updateTime,jdbcType=TIMESTAMP},
-      </if>
       <if test="pb_text1 != null">
         pb_text1 = #{pb_text1,jdbcType=VARCHAR},
       </if>

+ 35 - 0
applications/money/money-server/src/main/resources/mapper/PaydetailViewMapper.xml

@@ -0,0 +1,35 @@
+<?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.usoftchina.saas.money.mapper.PaydetailViewMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.PaydetailView" >
+    <result column="pi_inoutno" property="pi_inoutno" jdbcType="VARCHAR" />
+    <result column="pi_vendcode" property="pi_vendcode" jdbcType="VARCHAR" />
+    <result column="pi_vendname" property="pi_vendname" jdbcType="VARCHAR" />
+    <result column="pi_class" property="pi_class" jdbcType="VARCHAR" />
+    <result column="PU_BUYERCODE" property="PU_BUYERCODE" jdbcType="VARCHAR" />
+    <result column="PU_BUYERNAME" property="PU_BUYERNAME" jdbcType="VARCHAR" />
+    <result column="pb_date" property="pb_date" jdbcType="TIMESTAMP" />
+    <result column="ve_beginapamount" property="ve_beginapamount" jdbcType="DOUBLE" />
+    <result column="pb_pdamount" property="pb_pdamount" jdbcType="DOUBLE" />
+    <result column="pb_pbdamount" property="pb_pbdamount" jdbcType="DOUBLE" />
+    <result column="mustpay" property="mustpay" jdbcType="DOUBLE" />
+    <result column="mustdate" property="mustdate" jdbcType="DECIMAL" />
+    <result column="pi_total" property="pi_total" jdbcType="DOUBLE" />
+    <result column="pi_remark" property="pi_remark" jdbcType="VARCHAR" />
+    <result column="companyId" property="companyId" jdbcType="INTEGER" />
+  </resultMap>
+
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from paydetail_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by pb_date desc
+  </select>
+
+</mapper>

+ 2 - 15
applications/money/money-server/src/main/resources/mapper/RecbalanceMapper.xml

@@ -23,7 +23,7 @@
     <result column="rb_remark" jdbcType="VARCHAR" property="rb_remark" />
     <result column="companyId" jdbcType="INTEGER" property="companyId" />
     <result column="updaterId" jdbcType="INTEGER" property="updaterId" />
-    <result column="updatedate" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="updatedate" jdbcType="TIMESTAMP" property="updatedate" />
     <result column="rb_text1" jdbcType="VARCHAR" property="rb_text1" />
     <result column="rb_text2" jdbcType="VARCHAR" property="rb_text2" />
     <result column="rb_text3" jdbcType="VARCHAR" property="rb_text3" />
@@ -224,9 +224,7 @@
       <if test="rb_recorder != null">
         rb_recorder,
       </if>
-      <if test="rb_recorddate != null">
         rb_recorddate,
-      </if>
       <if test="rb_status != null">
         rb_status,
       </if>
@@ -242,9 +240,6 @@
       <if test="updaterId != null">
         updaterId,
       </if>
-      <if test="updateTime != null">
-        updateTime,
-      </if>
       <if test="rb_text1 != null">
         rb_text1,
       </if>
@@ -304,9 +299,7 @@
       <if test="rb_recorder != null">
         #{rb_recorder,jdbcType=VARCHAR},
       </if>
-      <if test="rb_recorddate != null">
-        #{rb_recorddate,jdbcType=TIMESTAMP},
-      </if>
+      now(),
       <if test="rb_status != null">
         #{rb_status,jdbcType=INTEGER},
       </if>
@@ -322,9 +315,6 @@
       <if test="updaterId != null">
         #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updateTime != null">
-        #{updateTime,jdbcType=TIMESTAMP},
-      </if>
       <if test="rb_text1 != null">
         #{rb_text1,jdbcType=VARCHAR},
       </if>
@@ -536,9 +526,6 @@
       <if test="updaterId != null">
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updateTime != null">
-        updatedate = #{updateTime,jdbcType=TIMESTAMP},
-      </if>
       <if test="rb_text1 != null">
         rb_text1 = #{rb_text1,jdbcType=VARCHAR},
       </if>

+ 34 - 0
applications/money/money-server/src/main/resources/mapper/RecdetailViewMapper.xml

@@ -0,0 +1,34 @@
+<?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.usoftchina.saas.money.mapper.RecdetailViewMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.RecdetailView" >
+    <result column="pi_inoutno" property="pi_inoutno" jdbcType="VARCHAR" />
+    <result column="pi_custcode" property="pi_custcode" jdbcType="VARCHAR" />
+    <result column="pi_custname" property="pi_custname" jdbcType="VARCHAR" />
+    <result column="pi_class" property="pi_class" jdbcType="VARCHAR" />
+    <result column="PU_BUYERCODE" property="PU_BUYERCODE" jdbcType="VARCHAR" />
+    <result column="PU_BUYERNAME" property="PU_BUYERNAME" jdbcType="VARCHAR" />
+    <result column="pb_date" property="pb_date" jdbcType="TIMESTAMP" />
+    <result column="cu_beginaramount" property="cu_beginaramount" jdbcType="DOUBLE" />
+    <result column="pb_pdamount" property="pb_pdamount" jdbcType="DOUBLE" />
+    <result column="pb_pbdamount" property="pb_pbdamount" jdbcType="DOUBLE" />
+    <result column="mustpay" property="mustpay" jdbcType="DOUBLE" />
+    <result column="mustdate" property="mustdate" jdbcType="DOUBLE" />
+    <result column="pi_total" property="pi_total" jdbcType="DOUBLE" />
+    <result column="pi_remark" property="pi_remark" jdbcType="VARCHAR" />
+  <result column="companyId" property="companyId" jdbcType="INTEGER" />
+  </resultMap>
+
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from recdetail_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by pb_date desc
+  </select>
+</mapper>

+ 36 - 0
applications/money/money-server/src/main/resources/mapper/VendorAcountViewMapper.xml

@@ -0,0 +1,36 @@
+<?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.usoftchina.saas.money.mapper.VendorAcountViewMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.VendorAcountView" >
+    <result column="pi_inoutno" property="pi_inoutno" jdbcType="VARCHAR" />
+    <result column="pi_class" property="pi_class" jdbcType="VARCHAR" />
+    <result column="pi_vendcode" property="pi_vendcode" jdbcType="VARCHAR" />
+    <result column="pi_vendname" property="pi_vendname" jdbcType="VARCHAR" />
+    <result column="pi_date" property="pi_date" jdbcType="TIMESTAMP" />
+    <result column="pd_pdno" property="pd_pdno" jdbcType="INTEGER" />
+    <result column="pr_code" property="pr_code" jdbcType="VARCHAR" />
+    <result column="pr_detail" property="pr_detail" jdbcType="VARCHAR" />
+    <result column="pr_spec" property="pr_spec" jdbcType="VARCHAR" />
+    <result column="pd_unit" property="pd_unit" jdbcType="VARCHAR" />
+    <result column="qty" property="qty" jdbcType="DOUBLE" />
+    <result column="pd_orderprice" property="pd_orderprice" jdbcType="DOUBLE" />
+    <result column="pd_taxrate" property="pd_taxrate" jdbcType="DOUBLE" />
+    <result column="pd_total" property="pd_total" jdbcType="DOUBLE" />
+    <result column="pd_netprice" property="pd_netprice" jdbcType="DOUBLE" />
+    <result column="pd_nettotal" property="pd_nettotal" jdbcType="DOUBLE" />
+    <result column="companyId" property="companyId" jdbcType="INTEGER" />
+  </resultMap>
+
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from vendor_acount_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by pi_date desc
+  </select>
+</mapper>

+ 30 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseReportController.java

@@ -0,0 +1,30 @@
+package com.usoftchina.saas.purchase.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.purchase.service.PurchaseReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author: guq
+ * @create: 2018-11-08 19:18
+ **/
+@RestController
+@RequestMapping("/report")
+public class PurchaseReportController {
+
+    @Autowired
+    private PurchaseReportService purchaseReportService;
+
+    @GetMapping("/purchasePay")
+    public Result PurchasePay(PageRequest page, ListReqDTO req) {
+        PageInfo listData = purchaseReportService.getPurchasePayData(page, req);
+        return Result.success(listData);
+    }
+
+}

+ 10 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchasePayMapper.java

@@ -0,0 +1,10 @@
+package com.usoftchina.saas.purchase.mapper;
+
+import com.usoftchina.saas.purchase.po.report.PurchasePay;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface PurchasePayMapper {
+    List<PurchasePay> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+}

+ 3 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseList.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.purchase.po;
 
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import com.usoftchina.saas.document.dto.ProductDTO;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -116,4 +117,6 @@ public class PurchaseList extends CommonBaseEntity implements Serializable {
     private String pd_text5;
 
     private Double pd_yqty;
+
+    private ProductDTO productDTO;
 }

+ 40 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/report/PurchasePay.java

@@ -0,0 +1,40 @@
+package com.usoftchina.saas.purchase.po.report;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 14:22
+ **/
+@Data
+public class PurchasePay {
+    private Integer pb_id;
+
+    private String pb_code;
+
+    private String pu_vendcode;
+
+    private String pu_vendname;
+
+    private String pb_recorder;
+
+    private Date pb_recorddate;
+
+    private String pbd_slcode;
+
+    private String pbd_slkind;
+
+    private Double pbd_amount;
+
+    private Double pbd_nowbalance;
+
+    private Double pb_pbdamount;
+
+    private Double pb_payrate;
+
+    private String pd_remark;
+
+    private Integer companyid;
+}

+ 10 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/PurchaseReportService.java

@@ -0,0 +1,10 @@
+package com.usoftchina.saas.purchase.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+
+public interface PurchaseReportService {
+
+    PageInfo getPurchasePayData(PageRequest page, ListReqDTO req);
+}

+ 2 - 2
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java

@@ -83,9 +83,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             con = "1=1";
         }
         if (null == req || StringUtils.isEmpty(req.getMode()) || "MAIN".equals(req.getMode())) {
-              list = prodInOutListMapper.selectProdInOutListByCondition(con,companyId);
+                list = prodInOutListMapper.selectProdInOutBycondition(con,companyId);
         } else {
-              list = prodInOutListMapper.selectProdInOutBycondition(con,companyId);
+            list = prodInOutListMapper.selectProdInOutListByCondition(con,companyId);
         }
         return list;
     }

+ 56 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseReportServiceImpl.java

@@ -0,0 +1,56 @@
+package com.usoftchina.saas.purchase.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.purchase.mapper.PurchasePayMapper;
+import com.usoftchina.saas.purchase.service.PurchaseReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 14:33
+ **/
+@Service
+public class PurchaseReportServiceImpl implements PurchaseReportService{
+
+    @Autowired
+    private PurchasePayMapper purchasePayMapper;
+    @Override
+    public PageInfo getPurchasePayData(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "PurchasePay");
+    }
+
+    private PageInfo getListDATA(PageRequest page, ListReqDTO req, String type) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //查询数据
+        List lists = getListByType(req, type);
+        //取分页信息
+        PageInfo pageInfo = new PageInfo(lists);
+        return pageInfo;
+    }
+
+    private List getListByType(ListReqDTO req, String type) {
+        List list = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        String con = req.getFinalCondition();
+        if (null == con) {
+            con = "1=1";
+        }
+        if ("PurchasePay".equals(type)) {
+            list = purchasePayMapper.selectByCondition(con, companyId);
+        }
+        return list;
+    }
+}

+ 9 - 3
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java

@@ -323,6 +323,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
     private DocBaseDTO singleOpen(Long id) {
         Purchase purchase = purchaseMapper.selectByPrimaryKey(id);
         DocBaseDTO docBaseDTO = null;
+        Double acceptqty=new Double(0),qty=new Double(0);
+
         if(!Status.CLOSE.name().equals(purchase.getPu_acceptstatuscode())){
             throw new BizException(BizExceptionCode.BIZ_OPEN);
         }
@@ -331,10 +333,12 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         int partTurnCount = 0,turnCount = 0;
         if(purchaseDetailList != null && purchaseDetailList.size() > 0){
             for(PurchaseDetail purchaseDetail : purchaseDetailList){
+                acceptqty = purchaseDetail.getPd_acceptqty()==null?0:purchaseDetail.getPd_acceptqty();
+                qty = purchaseDetail.getPd_qty()==null?0:purchaseDetail.getPd_qty();
                 //入库数大于等于采购数
-                if(purchaseDetail.getPd_acceptqty() >= purchaseDetail.getPd_qty()){
+                if(acceptqty >= qty){
                     turnCount++;
-                }else if(purchaseDetail.getPd_acceptqty() > 0 && purchaseDetail.getPd_acceptqty() < purchaseDetail.getPd_qty()){
+                }else if(acceptqty > 0 && acceptqty < qty){
                     //     0 < 入库数 < 采购数
                     partTurnCount++;
                 }
@@ -478,12 +482,14 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         purchase.setId(id);
         purchase.setPu_status(Status.AUDITED.getDisplay());
         purchase.setPu_statuscode(Status.AUDITED.name());
+        purchase.setPu_acceptstatus(Status.UNTURNIN.getDisplay());
+        purchase.setPu_acceptstatuscode(Status.UNAUDITED.name());
         purchase.setUpdateTime(new Date());
         purchase.setUpdaterId(BaseContextHolder.getUserId());
         //更新存在字段
         purchaseMapper.updateByPrimaryKeySelective(purchase);
         //更新最新采购单价
-        productApi.updateLatestPurchasePrice(id);
+//        productApi.updateLatestPurchasePrice(id);
         //日志
         messageLogService.audit(docBaseDTO);
         return result;

+ 9 - 9
applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutListMapper.xml

@@ -73,30 +73,30 @@
 
   </resultMap>
 
-
-  <select id="selectProdInOutListByCondition"  resultMap="BaseResultMap">
-    select  *  from prodinout left join prodiodetail on pi_id = pd_piid
+  <select id="selectProdInOutBycondition"  resultMap="BaseResultMap">
+    select  *  from prodinout
     <where>
       <if test="con != null">
         ${con}
       </if>
       <if test="companyId != null">
-        and   prodinout.companyid = #{companyId}
+        and   companyid = #{companyId}
       </if>
-    </where>  order by pi_id,pd_pdno
+    </where>  order by pi_id desc
   </select>
 
-  <select id="selectProdInOutBycondition"  resultMap="BaseResultMap">
-    select  *  from prodinout
+  <select id="selectProdInOutListByCondition"  resultMap="BaseResultMap">
+    select  *  from prodinout left join prodiodetail on pi_id = pd_piid
+    left join product on pd_prodcode=pr_code
     <where>
       <if test="con != null">
         ${con}
       </if>
       <if test="companyId != null">
-        and  companyid = #{companyId}
+        and  prodinout.companyid = #{companyId}
       </if>
     </where>
-    order by pi_id
+    order by pi_id desc,pd_pdno desc
   </select>
 
 

+ 33 - 3
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseListMapper.xml

@@ -54,11 +54,41 @@
         <result column="pd_text4" property="pd_text4" jdbcType="VARCHAR" />
         <result column="pd_text5" property="pd_text5" jdbcType="VARCHAR" />
         <result column="pd_yqty" property="pd_yqty" jdbcType="DOUBLE" />
+        <association property="productDTO" javaType="com.usoftchina.saas.document.dto.ProductDTO">
+            <id column="pr_id" property="id"/>
+            <result column="pr_code" property="pr_code"/>
+            <result column="pr_detail" property="pr_detail"/>
+            <result column="pr_spec" property="pr_spec"/>
+            <result column="pr_unit" property="pr_unit"/>
+            <result column="pr_kind" property="pr_kind"/>
+            <result column="pr_orispeccode" property="pr_orispeccode"/>
+            <result column="pr_whid" property="pr_whid"/>
+            <result column="pr_whcode" property="pr_whcode"/>
+            <result column="pr_whname" property="pr_whname"/>
+            <result column="pr_zxbzs" property="pr_zxbzs"/>
+            <result column="pr_leadtime" property="pr_leadtime"/>
+            <result column="pr_brand" property="pr_brand"/>
+            <result column="pr_standardprice" property="pr_standardprice"/>
+            <result column="pr_purcprice" property="pr_purcprice"/>
+            <result column="pr_saleprice" property="pr_saleprice"/>
+            <result column="pr_vendid" property="pr_vendid"/>
+            <result column="pr_vendname" property="pr_vendname"/>
+            <result column="pr_vendcode" property="pr_vendcode"/>
+            <result column="pr_docdate" property="pr_docdate"/>
+            <result column="pr_recordmanid" property="pr_recordmanid"/>
+            <result column="pr_recordman" property="pr_recordman"/>
+            <result column="pr_status" property="pr_status"/>
+            <result column="pr_statuscode" property="pr_statuscode"/>
+            <result column="pr_text1" property="pr_text1"/>
+            <result column="pr_text2" property="pr_text2"/>
+            <result column="pr_text3" property="pr_text3"/>
+            <result column="pr_text4" property="pr_text4"/>
+        </association>
     </resultMap>
 
     <select id="selectPurchaseListByCondition"  resultMap="BaseResultMap">
         select  *  from purchase left join purchasedetail on pu_id=pd_puid
-        left join product on pd_prodcode=pr_code
+        left join product on pd_prodid=pr_id
         <where>
             <if test="con != null">
                  ${con}
@@ -66,7 +96,7 @@
             <if test="companyId != null">
               and   purchase.companyId = #{companyId}
             </if>
-        </where>  order by pu_id,pd_detno
+        </where>  order by pu_id desc,pd_detno desc
     </select>
 
     <select id="selectPurchaseBycondition"  resultMap="BaseResultMap">
@@ -79,7 +109,7 @@
                and  companyId = #{companyId}
             </if>
         </where>
-        order by pu_id
+        order by pu_id desc
     </select>
 
 </mapper>

+ 32 - 0
applications/purchase/purchase-server/src/main/resources/mapper/PurchasePayMapper.xml

@@ -0,0 +1,32 @@
+<?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.usoftchina.saas.purchase.mapper.PurchasePayMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.purchase.po.report.PurchasePay" >
+    <result column="pb_id" property="pb_id" jdbcType="INTEGER" />
+    <result column="pb_code" property="pb_code" jdbcType="VARCHAR" />
+    <result column="pu_vendcode" property="pu_vendcode" jdbcType="VARCHAR" />
+    <result column="pu_vendname" property="pu_vendname" jdbcType="VARCHAR" />
+    <result column="pb_recorder" property="pb_recorder" jdbcType="VARCHAR" />
+    <result column="pb_recorddate" property="pb_recorddate" jdbcType="TIMESTAMP" />
+    <result column="pbd_slcode" property="pbd_slcode" jdbcType="VARCHAR" />
+    <result column="pbd_slkind" property="pbd_slkind" jdbcType="VARCHAR" />
+    <result column="pbd_amount" property="pbd_amount" jdbcType="DOUBLE" />
+    <result column="pbd_nowbalance" property="pbd_nowbalance" jdbcType="DOUBLE" />
+    <result column="pb_pbdamount" property="pb_pbdamount" jdbcType="DOUBLE" />
+    <result column="pb_payrate" property="pb_payrate" jdbcType="DOUBLE" />
+    <result column="pd_remark" property="pd_remark" jdbcType="VARCHAR" />
+    <result column="companyid" property="companyid" jdbcType="INTEGER" />
+  </resultMap>
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from purchasepay_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by pb_recorddate desc
+  </select>
+</mapper>

+ 6 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/SaleDTO.java

@@ -59,4 +59,10 @@ public class SaleDTO extends CommonBaseDTO{
     private String sa_auditman;
 
     private Date sa_auditdate;
+
+    private Date sa_date;
+
+    private String sa_seller;
+
+    private String sa_sellercode;
 }

+ 36 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleReportController.java

@@ -0,0 +1,36 @@
+package com.usoftchina.saas.sale.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.sale.service.SaleReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 11:23
+ **/
+@RestController
+@RequestMapping("/report")
+public class SaleReportController {
+
+    @Autowired
+    private SaleReportService saleReportService;
+
+    @GetMapping("/saleProfit")
+    public Result SaleProfit(PageRequest page, ListReqDTO req) {
+        PageInfo listData = saleReportService.getSaleProfitData(page, req);
+        return Result.success(listData);
+    }
+
+    @GetMapping("/saleRec")
+    public Result SaleRec(PageRequest page, ListReqDTO req) {
+        PageInfo listData = saleReportService.getSaleRecData(page, req);
+        return Result.success(listData);
+    }
+
+}

+ 3 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleListMapper.java

@@ -8,7 +8,8 @@ import java.util.List;
 
 public interface SaleListMapper {
 
-    List<SaleList> selectPurchaseBycondition(@Param("con") String con, @Param("companyId") Long companyId);
+    List<SaleList> selectSaleListByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+
+    List<SaleList> selectSaleByCondition(@Param("con") String con, @Param("companyId") Long companyId);
 
-    List<SaleList> selectPurchaseListByCondition(@Param("con") String con, @Param("companyId") Long companyId);
 }

+ 11 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleProfitViewMapper.java

@@ -0,0 +1,11 @@
+package com.usoftchina.saas.sale.mapper;
+
+import com.usoftchina.saas.sale.po.report.SaleProfitView;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface SaleProfitViewMapper {
+
+    List<SaleProfitView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+}

+ 11 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SalerecViewMapper.java

@@ -0,0 +1,11 @@
+package com.usoftchina.saas.sale.mapper;
+
+import com.usoftchina.saas.sale.po.report.SalerecView;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface SalerecViewMapper {
+
+    List<SalerecView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+}

+ 6 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/Sale.java

@@ -58,4 +58,10 @@ public class Sale extends CommonBaseEntity{
     private String sa_auditman;
 
     private Date sa_auditdate;
+
+    private Date sa_date;
+
+    private String sa_seller;
+
+    private String sa_sellercode;
 }

+ 5 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/SaleList.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.sale.po;
 
+import com.usoftchina.saas.document.dto.ProductDTO;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -47,6 +48,8 @@ public class SaleList implements Serializable{
 
     private Date sa_recorddate;
 
+    private Date sa_date;
+
     private Integer companyid;
 
     private Integer updaterId;
@@ -102,4 +105,6 @@ public class SaleList implements Serializable{
     private String sd_text4;
 
     private String sd_text5;
+
+    private ProductDTO productDTO;
 }

+ 53 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/report/SaleProfitView.java

@@ -0,0 +1,53 @@
+package com.usoftchina.saas.sale.po.report;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 10:55
+ **/
+@Data
+public class SaleProfitView {
+
+    private Integer companyid;
+
+    private String sa_custcode;
+
+    private String sa_custname;
+
+    private String sa_sellercode;
+
+    private String sa_seller;
+
+    private Date sa_date;
+
+    private String pd_inoutno;
+
+    private String pd_piclass;
+
+    private String pr_kind;
+
+    private String pr_code;
+
+    private String pr_detail;
+
+    private String pr_spec;
+
+    private String pr_unit;
+
+    private Double pd_outqty;
+
+    private Double pd_sendprice;
+
+    private Double pd_taxrate;
+
+    private Double pd_ordertotal;
+
+    private Double pd_total;
+
+    private Double pd_profit;
+
+    private Double pd_profitpresent;
+}

+ 38 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/report/SalerecView.java

@@ -0,0 +1,38 @@
+package com.usoftchina.saas.sale.po.report;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 11:16
+ **/
+@Data
+public class SalerecView {
+    private Integer rb_id;
+
+    private String rb_code;
+
+    private String rb_custcode;
+
+    private String rb_custname;
+
+    private String rb_manname;
+
+    private Date rb_date;
+
+    private String rbd_slcode;
+
+    private String rbd_slkind;
+
+    private Double rbd_nowbalance;
+
+    private Double rb_rbdamount;
+
+    private Double rb_backrate;
+
+    private String rb_remark;
+
+    private Integer companyid;
+}

+ 12 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/SaleReportService.java

@@ -0,0 +1,12 @@
+package com.usoftchina.saas.sale.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.sale.po.report.SalerecView;
+
+public interface SaleReportService {
+    PageInfo getSaleProfitData(PageRequest page, ListReqDTO req);
+
+    PageInfo getSaleRecData(PageRequest page, ListReqDTO req);
+}

+ 67 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleReportServiceImpl.java

@@ -0,0 +1,67 @@
+package com.usoftchina.saas.sale.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.sale.mapper.SaleProfitViewMapper;
+import com.usoftchina.saas.sale.mapper.SalerecViewMapper;
+import com.usoftchina.saas.sale.service.SaleReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 11:43
+ **/
+@Service
+public class SaleReportServiceImpl implements SaleReportService{
+
+    @Autowired
+    private SaleProfitViewMapper saleProfitViewMapper;
+    @Autowired
+    private SalerecViewMapper salerecViewMapper;
+
+    @Override
+    public PageInfo getSaleProfitData(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "SaleProfit");
+    }
+
+    @Override
+    public PageInfo getSaleRecData(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "SaleRec");
+    }
+
+    private PageInfo getListDATA(PageRequest page, ListReqDTO req, String type) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //查询数据
+        List lists = getListByType(req, type);
+        //取分页信息
+        PageInfo pageInfo = new PageInfo(lists);
+        return pageInfo;
+    }
+
+    private List getListByType(ListReqDTO req, String type) {
+        List list = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        String con = req.getFinalCondition();
+        if (null == con) {
+            con = "1=1";
+        }
+        if ("SaleProfit".equals(type)) {
+            list = saleProfitViewMapper.selectByCondition(con, companyId);
+        } else if ("SaleRec".equals(type)){
+            list = salerecViewMapper.selectByCondition(con, companyId);
+        }
+        return list;
+    }
+}

+ 5 - 4
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java

@@ -334,10 +334,11 @@ public class SaleServiceImpl implements SaleService{
         if (null == con) {
             con = "1=1";
         }
+
         if (null == req || StringUtils.isEmpty(req.getMode()) || "MAIN".equals(req.getMode())) {
-            list = saleListMapper.selectPurchaseBycondition(con, companyId);
+            list = saleListMapper.selectSaleByCondition(con, companyId);
         } else {
-            list = saleListMapper.selectPurchaseListByCondition(con, companyId);
+            list = saleListMapper.selectSaleListByCondition(con, companyId);
         }
         return list;
     }
@@ -471,8 +472,8 @@ public class SaleServiceImpl implements SaleService{
             Map<String, Object> warehouse = getWareHouseByCode(saleDetail.getSd_prodcode());
             if (null != warehouse) {
                 prodIODetail.setPd_whid(warehouse.get("pr_whid") == null ? 0 : Integer.valueOf(warehouse.get("pr_whid").toString()));
-                prodIODetail.setPd_whcode(String.valueOf(warehouse.get("pr_whcode")));
-                prodIODetail.setPd_whname(String.valueOf(warehouse.get("pr_whname")));
+                prodIODetail.setPd_whcode(warehouse.get("pr_whcode") == null ? null : warehouse.get("pr_whcode").toString());
+                prodIODetail.setPd_whname(warehouse.get("pr_whname") == null ? null : warehouse.get("pr_whname").toString());
             }
             prodIODetailMapper.insertSelective(prodIODetail);
             //更新已转数

+ 33 - 2
applications/sale/sale-server/src/main/resources/mapper/SaleListMapper.xml

@@ -23,6 +23,7 @@
         <result column="companyid" property="companyid" jdbcType="INTEGER" />
         <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
         <result column="updatetime" property="updatetime" jdbcType="TIMESTAMP" />
+        <result column="sa_date" property="sa_date" jdbcType="TIMESTAMP" />
         <result column="sa_text1" property="sa_text1" jdbcType="VARCHAR" />
         <result column="sa_text2" property="sa_text2" jdbcType="VARCHAR" />
         <result column="sa_text3" property="sa_text3" jdbcType="VARCHAR" />
@@ -48,9 +49,39 @@
         <result column="sd_text3" property="sd_text3" jdbcType="VARCHAR" />
         <result column="sd_text4" property="sd_text4" jdbcType="VARCHAR" />
         <result column="sd_text5" property="sd_text5" jdbcType="VARCHAR" />
+        <association property="productDTO" javaType="com.usoftchina.saas.document.dto.ProductDTO">
+            <id column="pr_id" property="id"/>
+            <result column="pr_code" property="pr_code"/>
+            <result column="pr_detail" property="pr_detail"/>
+            <result column="pr_spec" property="pr_spec"/>
+            <result column="pr_unit" property="pr_unit"/>
+            <result column="pr_kind" property="pr_kind"/>
+            <result column="pr_orispeccode" property="pr_orispeccode"/>
+            <result column="pr_whid" property="pr_whid"/>
+            <result column="pr_whcode" property="pr_whcode"/>
+            <result column="pr_whname" property="pr_whname"/>
+            <result column="pr_zxbzs" property="pr_zxbzs"/>
+            <result column="pr_leadtime" property="pr_leadtime"/>
+            <result column="pr_brand" property="pr_brand"/>
+            <result column="pr_standardprice" property="pr_standardprice"/>
+            <result column="pr_purcprice" property="pr_purcprice"/>
+            <result column="pr_saleprice" property="pr_saleprice"/>
+            <result column="pr_vendid" property="pr_vendid"/>
+            <result column="pr_vendname" property="pr_vendname"/>
+            <result column="pr_vendcode" property="pr_vendcode"/>
+            <result column="pr_docdate" property="pr_docdate"/>
+            <result column="pr_recordmanid" property="pr_recordmanid"/>
+            <result column="pr_recordman" property="pr_recordman"/>
+            <result column="pr_status" property="pr_status"/>
+            <result column="pr_statuscode" property="pr_statuscode"/>
+            <result column="pr_text1" property="pr_text1"/>
+            <result column="pr_text2" property="pr_text2"/>
+            <result column="pr_text3" property="pr_text3"/>
+            <result column="pr_text4" property="pr_text4"/>
+        </association>
     </resultMap>
 
-    <select id="selectPurchaseListByCondition" resultMap="BaseResultMap">
+    <select id="selectSaleListByCondition" resultMap="BaseResultMap">
         select  *  from sale left join saledetail on sa_id=sd_said left join product
         on sd_prodid = pr_id and sale.companyId = product.companyid
         <where>
@@ -63,7 +94,7 @@
         </where>  order by sd_detno desc
     </select>
 
-    <select id="selectPurchaseBycondition" resultMap="BaseResultMap">
+    <select id="selectSaleByCondition" resultMap="BaseResultMap">
         select  *  from sale
         <where>
             <if test="con != null">

+ 32 - 1
applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml

@@ -30,12 +30,16 @@
     <result column="sa_text5" property="sa_text5" jdbcType="VARCHAR" />
     <result column="sa_auditman" property="sa_auditman" jdbcType="VARCHAR" />
     <result column="sa_auditdate" property="sa_auditdate" jdbcType="TIMESTAMP"/>
+    <result column="sa_seller" property="sa_seller" jdbcType="VARCHAR" />
+    <result column="sa_sellercode" property="sa_sellercode" jdbcType="VARCHAR" />
+    <result column="sa_date" property="sa_date" jdbcType="TIMESTAMP"/>
   </resultMap>
   <sql id="Base_Column_List" >
     sa_id, sa_code, sa_custid, sa_custcode, sa_custname, sa_toplace, sa_total, sa_totalupper, 
     sa_remark, sa_status, sa_statuscode, sa_sendstatuscode, sa_sendstatus, sa_printstatus, 
     sa_printstatuscode, sa_recorderid, sa_recorder, sa_recorddate, companyId, updaterId, 
-    updateTime, sa_text1, sa_text2, sa_text3, sa_text4, sa_text5,sa_auditman,sa_auditdate
+    updateTime, sa_text1, sa_text2, sa_text3, sa_text4, sa_text5,sa_auditman,sa_auditdate,
+    sa_seller,sa_sellercode,sa_date
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
     select 
@@ -148,6 +152,15 @@
       <if test="sa_text5 != null" >
         sa_text5,
       </if>
+      <if test="sa_seller != null" >
+        sa_seller,
+      </if>
+      <if test="sa_sellercode != null" >
+        sa_sellercode,
+      </if>
+      <if test="sa_date != null" >
+        sa_date,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
       <if test="sa_code != null" >
@@ -225,6 +238,15 @@
       <if test="sa_text5 != null" >
         #{sa_text5,jdbcType=VARCHAR},
       </if>
+      <if test="sa_seller != null" >
+        #{sa_seller,jdbcType=VARCHAR},
+      </if>
+      <if test="sa_sellercode != null" >
+        #{sa_sellercode,jdbcType=VARCHAR},
+      </if>
+      <if test="sa_date != null" >
+        #{sa_date,jdbcType=TIMESTAMP},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.sale.po.Sale" >
@@ -311,6 +333,15 @@
       <if test="sa_auditdate != null" >
         sa_auditdate = #{sa_auditdate,jdbcType=TIMESTAMP},
       </if>
+      <if test="sa_seller != null" >
+        sa_seller = #{sa_seller,jdbcType=VARCHAR},
+      </if>
+      <if test="sa_sellercode != null" >
+        sa_sellercode = #{sa_sellercode,jdbcType=VARCHAR},
+      </if>
+      <if test="sa_date != null" >
+        sa_date = #{sa_date,jdbcType=TIMESTAMP},
+      </if>
     </set>
     where sa_id = #{id,jdbcType=INTEGER}
   </update>

+ 38 - 0
applications/sale/sale-server/src/main/resources/mapper/SaleProfitViewMapper.xml

@@ -0,0 +1,38 @@
+<?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.usoftchina.saas.sale.mapper.SaleProfitViewMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.sale.po.report.SaleProfitView" >
+    <result column="sa_custcode" property="sa_custcode" jdbcType="VARCHAR" />
+    <result column="sa_custname" property="sa_custname" jdbcType="VARCHAR" />
+    <result column="sa_sellercode" property="sa_sellercode" jdbcType="VARCHAR" />
+    <result column="sa_seller" property="sa_seller" jdbcType="VARCHAR" />
+    <result column="sa_date" property="sa_date" jdbcType="TIMESTAMP" />
+    <result column="pd_inoutno" property="pd_inoutno" jdbcType="VARCHAR" />
+    <result column="pd_piclass" property="pd_piclass" jdbcType="VARCHAR" />
+    <result column="pr_kind" property="pr_kind" jdbcType="VARCHAR" />
+    <result column="pr_code" property="pr_code" jdbcType="VARCHAR" />
+    <result column="pr_detail" property="pr_detail" jdbcType="VARCHAR" />
+    <result column="pr_spec" property="pr_spec" jdbcType="VARCHAR" />
+    <result column="pr_unit" property="pr_unit" jdbcType="VARCHAR" />
+    <result column="pd_outqty" property="pd_outqty" jdbcType="DOUBLE" />
+    <result column="pd_sendprice" property="pd_sendprice" jdbcType="DOUBLE" />
+    <result column="pd_taxrate" property="pd_taxrate" jdbcType="DOUBLE" />
+    <result column="pd_ordertotal" property="pd_ordertotal" jdbcType="DOUBLE" />
+    <result column="pd_total" property="pd_total" jdbcType="DOUBLE" />
+    <result column="pd_profit" property="pd_profit" jdbcType="DOUBLE" />
+    <result column="pd_profitpresent" property="pd_profitpresent" jdbcType="DOUBLE" />
+    <result column="companyid" property="companyid" jdbcType="INTEGER" />
+  </resultMap>
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from Sale_Profit_View
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by sa_date desc
+  </select>
+ </mapper>

+ 31 - 0
applications/sale/sale-server/src/main/resources/mapper/SalerecViewMapper.xml

@@ -0,0 +1,31 @@
+<?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.usoftchina.saas.sale.mapper.SalerecViewMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.sale.po.report.SalerecView" >
+    <result column="rb_id" property="rb_id" jdbcType="INTEGER" />
+    <result column="rb_code" property="rb_code" jdbcType="VARCHAR" />
+    <result column="rb_custcode" property="rb_custcode" jdbcType="VARCHAR" />
+    <result column="rb_custname" property="rb_custname" jdbcType="VARCHAR" />
+    <result column="rb_manname" property="rb_manname" jdbcType="VARCHAR" />
+    <result column="rb_date" property="rb_date" jdbcType="TIMESTAMP" />
+    <result column="rbd_slcode" property="rbd_slcode" jdbcType="VARCHAR" />
+    <result column="rbd_slkind" property="rbd_slkind" jdbcType="VARCHAR" />
+    <result column="rbd_nowbalance" property="rbd_nowbalance" jdbcType="DOUBLE" />
+    <result column="rb_rbdamount" property="rb_rbdamount" jdbcType="DOUBLE" />
+    <result column="rb_backrate" property="rb_backrate" jdbcType="DOUBLE" />
+    <result column="rb_remark" property="rb_remark" jdbcType="VARCHAR" />
+    <result column="companyid" property="companyid" jdbcType="INTEGER" />
+  </resultMap>
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from Salerec_View
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by rb_date desc
+  </select>
+</mapper>

+ 13 - 0
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/report/ProdinoutCountView.java

@@ -0,0 +1,13 @@
+package com.usoftchina.saas.storage.po.report;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Created by zdw
+ * 2018-11-10 15:16.
+ */
+@Data
+public class ProdinoutCountView implements Serializable{
+}

+ 33 - 0
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/report/ProdiodetailView.java

@@ -0,0 +1,33 @@
+package com.usoftchina.saas.storage.po.report;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by zdw
+ * 2018-11-10 15:16.
+ */
+@Data
+public class ProdiodetailView implements Serializable{
+
+    private String pi_inoutno;
+    private String pi_class;
+    private String bizcode;
+    private String bizname;
+    private Date pi_date;
+    private Integer pd_pdno;
+    private String pr_kind;
+    private String pd_prodcode;
+    private String pr_detail;
+    private String pr_spec;
+    private String pr_unit;
+    private Double inqty;
+    private Double outqty;
+    private Double pd_price;
+    private String pd_remark;
+    private Integer companyid;
+
+
+}

+ 44 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/ProdInOutReportController.java

@@ -0,0 +1,44 @@
+package com.usoftchina.saas.storage.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.storage.service.ProdInOutReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/report")
+public class ProdInOutReportController {
+
+    @Autowired
+    private ProdInOutReportService prodInOutReportService;
+
+    /**
+     * 物料出入库明细表
+     * @param page
+     * @param req
+     * @return
+     */
+    @GetMapping("/prodioDetail")
+    public Result getProdiodetail(PageRequest page, ListReqDTO req){
+        PageInfo listData = prodInOutReportService.getProdiodetail(page, req);
+        return Result.success(listData);
+    }
+
+    /**
+     * 物料收发汇总表
+     * @param page
+     * @param req
+     * @return
+     */
+    @GetMapping("/prodinoutCount")
+    public Result getProdinoutCount(PageRequest page, ListReqDTO req){
+        PageInfo listData = prodInOutReportService.getProdinoutCount(page, req);
+        return Result.success(listData);
+    }
+
+}

+ 18 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/ProdInOutReportMapper.java

@@ -0,0 +1,18 @@
+package com.usoftchina.saas.storage.mapper;
+
+
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Created by zdw
+ * 2018-10-18 16:57.
+ */
+public interface ProdInOutReportMapper {
+
+
+    List selectProdiodetailByCondition(@Param("con") String con,@Param("companyId") Long companyId);
+
+    List selectProdinoutCountByCondition(@Param("con") String con,@Param("companyId") Long companyId);
+}

+ 15 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/ProdInOutReportService.java

@@ -0,0 +1,15 @@
+package com.usoftchina.saas.storage.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+
+/**
+ * Created by zdw
+ * 2018-11-09 16:57.
+ */
+public interface ProdInOutReportService {
+    PageInfo getProdiodetail(PageRequest page, ListReqDTO req);
+
+    PageInfo getProdinoutCount(PageRequest page, ListReqDTO req);
+}

+ 64 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInOutReportServiceImpl.java

@@ -0,0 +1,64 @@
+package com.usoftchina.saas.storage.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.storage.mapper.ProdInOutReportMapper;
+import com.usoftchina.saas.storage.service.ProdInOutReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * Created by zdw
+ * 2018-11-09 17:09.
+ */
+@Service
+public class ProdInOutReportServiceImpl implements ProdInOutReportService{
+    @Autowired
+    private ProdInOutReportMapper prodInOutReportMapper;
+
+    @Override
+    public PageInfo getProdiodetail(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "Prodiodetail");
+    }
+
+    @Override
+    public PageInfo getProdinoutCount(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "ProdinoutCount");
+    }
+
+    private PageInfo getListDATA(PageRequest page, ListReqDTO req, String type) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //查询数据
+        List lists = getListByType(req, type);
+        //取分页信息
+        PageInfo pageInfo = new PageInfo(lists);
+        return pageInfo;
+    }
+
+    private List getListByType(ListReqDTO req, String type) {
+        List list = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        String con = req.getFinalCondition();
+        if (null == con) {
+            con = "1=1";
+        }
+        if ("Prodiodetail".equals(type)) {
+            list = prodInOutReportMapper.selectProdiodetailByCondition(con, companyId);
+        } else if ("ProdinoutCount".equals(type)){
+            list = prodInOutReportMapper.selectProdinoutCountByCondition(con, companyId);
+        }
+        return list;
+    }
+
+}

+ 2 - 2
applications/storage/storage-server/src/main/resources/mapper/ProdInOutListMapper.xml

@@ -86,7 +86,7 @@
       <if test="companyId != null">
         and   prodinout.companyid = #{companyId}
       </if>
-    </where>  order by pi_id,pd_pdno
+    </where>  order by pi_id desc,pd_pdno desc
   </select>
 
   <select id="selectProdInOutBycondition"  resultMap="BaseResultMap">
@@ -99,7 +99,7 @@
         and  companyid = #{companyId}
       </if>
     </where>
-    order by pi_id
+    order by pi_id desc
   </select>
 
 

+ 56 - 0
applications/storage/storage-server/src/main/resources/mapper/ProdInOutReportMapper.xml

@@ -0,0 +1,56 @@
+<?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.usoftchina.saas.storage.mapper.ProdInOutReportMapper">
+
+  <resultMap id="ProdiodetailMap" type="com.usoftchina.saas.storage.po.report.ProdiodetailView">
+    <result column="pi_inoutno" jdbcType="VARCHAR" property="pi_inoutno" />
+    <result column="pi_class" jdbcType="VARCHAR" property="pi_class" />
+    <result column="bizcode" jdbcType="VARCHAR" property="bizcode" />
+    <result column="bizname" jdbcType="VARCHAR" property="bizname" />
+    <result column="pi_date" jdbcType="TIMESTAMP" property="pi_date" />
+    <result column="pd_pdno" jdbcType="INTEGER" property="pd_pdno" />
+    <result column="pr_kind" jdbcType="VARCHAR" property="pr_kind" />
+    <result column="pd_prodcode" jdbcType="VARCHAR" property="pd_prodcode" />
+    <result column="pr_detail" jdbcType="VARCHAR" property="pr_detail" />
+    <result column="pr_spec" jdbcType="VARCHAR" property="pr_spec" />
+    <result column="pr_unit" jdbcType="VARCHAR" property="pr_unit" />
+    <result column="inqty" jdbcType="DOUBLE" property="inqty" />
+    <result column="outqty" jdbcType="DOUBLE" property="outqty" />
+    <result column="pd_price" jdbcType="DOUBLE" property="pd_price" />
+    <result column="pd_remark" jdbcType="VARCHAR" property="pd_remark" />
+    <result column="companyid" jdbcType="INTEGER" property="companyid" />
+  </resultMap>
+
+
+
+  <select id="selectProdiodetailByCondition" resultMap="ProdiodetailMap">
+    select  *  from prodiodetail_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyid = #{companyId}
+      </if>
+    </where>
+    order by pi_date desc
+  </select>
+
+
+  <select id="selectProdinoutCountByCondition"  resultMap="ProdiodetailMap">
+    select  *  from prodinout
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyid = #{companyId}
+      </if>
+    </where>
+    order by pi_id
+  </select>
+
+
+
+
+</mapper>

+ 4 - 2
base-servers/account/account-server/src/main/resources/mapper/AccountMapper.xml

@@ -21,13 +21,15 @@
         ac_account.mobile,ac_account.type,ac_account.enabled,ac_account.creator_id,ac_account.create_time,
         ac_account.updater_id,ac_account.update_time
     </sql>
-    <insert id="insert" parameterType="com.usoftchina.saas.account.po.Account">
+    <insert id="insert" parameterType="com.usoftchina.saas.account.po.Account"
+            useGeneratedKeys="true" keyProperty="id">
         insert into ac_account(username,password,salt,realname,email,mobile,type,enabled,creator_id,create_time,updater_id,update_time)
         values (#{username,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR},
         #{realname,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{enabled,jdbcType=BOOLEAN},
         #{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP})
     </insert>
-    <insert id="insertSelective" parameterType="com.usoftchina.saas.account.po.Account">
+    <insert id="insertSelective" parameterType="com.usoftchina.saas.account.po.Account"
+            useGeneratedKeys="true" keyProperty="id">
         insert into ac_account
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="username != null">

+ 4 - 2
base-servers/account/account-server/src/main/resources/mapper/CompanyMapper.xml

@@ -19,13 +19,15 @@
     <sql id="baseColumns">
         id,name,business_code,address,creator_id,create_time,updater_id,update_time
     </sql>
-    <insert id="insert" parameterType="com.usoftchina.saas.account.po.Company">
+    <insert id="insert" parameterType="com.usoftchina.saas.account.po.Company"
+            useGeneratedKeys="true" keyProperty="id">
         insert into ac_company(name, business_code, address, logo_url, creator_id, create_time, updater_id, update_time)
         values (#{name,jdbcType=VARCHAR}, #{businessCode,jdbcType=VARCHAR},
         #{address,jdbcType=VARCHAR}, #{logoUrl,jdbcType=VARCHAR}, #{creatorId,jdbcType=BIGINT},
         #{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP})
     </insert>
-    <insert id="insertSelective" parameterType="com.usoftchina.saas.account.po.Company">
+    <insert id="insertSelective" parameterType="com.usoftchina.saas.account.po.Company"
+            useGeneratedKeys="true" keyProperty="id">
         insert into ac_company
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="name != null">

+ 4 - 0
base-servers/file/README.md

@@ -0,0 +1,4 @@
+## fastdfs
+
+* [环境配置](https://github.com/meiko-zhang/docker-compose-fastdfs-single) 
+* [java client](https://github.com/tobato/FastDFS_Client)

+ 9 - 10
base-servers/file/file-api/src/main/java/com/usoftchina/saas/file/api/FileApi.java

@@ -1,10 +1,9 @@
 package com.usoftchina.saas.file.api;
 
 import com.usoftchina.saas.base.Result;
-import com.usoftchina.saas.file.dto.FileDTO;
-import com.usoftchina.saas.file.dto.FileListDTO;
+import com.usoftchina.saas.file.dto.FileInfoDTO;
 import com.usoftchina.saas.file.dto.FolderDTO;
-import com.usoftchina.saas.file.dto.FolderToSaveDTO;
+import com.usoftchina.saas.file.dto.FolderSaveDTO;
 import feign.codec.Encoder;
 import feign.form.spring.SpringFormEncoder;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -20,7 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
  * @author yingp
  * @date 2018/9/29
  */
-@FeignClient(name = "gateway-server", configuration = FileApi.MultipartSupportConfig.class)
+@FeignClient(name = "file-server", configuration = FileApi.MultipartSupportConfig.class)
 public interface FileApi {
 
     @Configuration
@@ -37,8 +36,8 @@ public interface FileApi {
      * @param newFolder 待保存文件夹
      * @return
      */
-    @PostMapping(value = "/api/file/folder")
-    Result<FolderDTO> folder(@RequestBody FolderToSaveDTO newFolder);
+    @PostMapping(value = "/folder")
+    Result<FolderDTO> folder(FolderSaveDTO newFolder);
 
     /**
      * 根据id查看文件详情
@@ -46,8 +45,8 @@ public interface FileApi {
      * @param id
      * @return
      */
-    @GetMapping(value = "/api/file/{id}")
-    Result<FileDTO> get(@PathVariable(value = "id") Long id);
+    @GetMapping(value = "/info/{id}")
+    Result<FileInfoDTO> getFileInfo(@PathVariable(value = "id") Long id);
 
     /**
      * 上传文件到指定文件夹
@@ -57,6 +56,6 @@ public interface FileApi {
      * @return
      * @throws Exception
      */
-    @PostMapping(value = "/api/file/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    Result<FileListDTO> upload(@RequestParam(value = "folderId") Long folderId, @RequestPart(value = "file") MultipartFile file) throws Exception;
+    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    Result<FileInfoDTO> upload(Long folderId, @RequestPart(value = "file") MultipartFile file) throws Exception;
 }

+ 37 - 0
base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/BaseFileInfo.java

@@ -0,0 +1,37 @@
+package com.usoftchina.saas.file.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @author yingp
+ * @date 2018/9/29
+ */
+public abstract class BaseFileInfo {
+    /**
+     * 名称
+     */
+    @ApiModelProperty(value = "名称")
+    protected String name;
+
+    /**
+     * 父文件夹
+     */
+    @ApiModelProperty(value = "父文件夹ID")
+    protected Long folderId;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Long getFolderId() {
+        return folderId;
+    }
+
+    public void setFolderId(Long folderId) {
+        this.folderId = folderId;
+    }
+}

+ 0 - 60
base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/BaseFolder.java

@@ -1,60 +0,0 @@
-package com.usoftchina.saas.file.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * @author yingp
- * @date 2018/9/29
- */
-public abstract class BaseFolder {
-    /**
-     * 名称
-     */
-    @ApiModelProperty(value = "名称")
-    protected String originalFilename;
-
-    /**
-     * 父文件夹
-     */
-    @ApiModelProperty(value = "父文件夹ID")
-    protected Long parentId;
-
-    /**
-     * 排序
-     */
-    @ApiModelProperty(value = "排序")
-    protected Integer orderNum;
-
-    public String getOriginalFilename() {
-        return originalFilename;
-    }
-
-    public void setOriginalFilename(String originalFilename) {
-        this.originalFilename = originalFilename;
-    }
-
-    public Long getParentId() {
-        return parentId;
-    }
-
-    public void setParentId(Long parentId) {
-        this.parentId = parentId;
-    }
-
-    public Integer getOrderNum() {
-        return orderNum;
-    }
-
-    public void setOrderNum(Integer orderNum) {
-        this.orderNum = orderNum;
-    }
-
-    @Override
-    public String toString() {
-        return "BaseFolder{" +
-                "originalFilename='" + originalFilename + '\'' +
-                ", parentId=" + parentId +
-                ", orderNum=" + orderNum +
-                '}';
-    }
-}

+ 0 - 179
base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FileDTO.java

@@ -1,179 +0,0 @@
-package com.usoftchina.saas.file.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-import java.io.Serializable;
-
-/**
- * @author yingp
- * @date 2018/9/29
- */
-@ApiModel(value = "File", description = "文件")
-public class FileDTO implements Serializable {
-    @ApiModelProperty(value = "id")
-    private Long id;
-    /**
-     * 文件夹id
-     */
-    @ApiModelProperty(value = "文件夹id")
-    private Long folderId;
-
-    /**
-     * 文件夹名称
-     */
-    @ApiModelProperty(value = "文件夹名称")
-    private Long folderName;
-
-    /**
-     * 链接
-     */
-    @ApiModelProperty(value = "文件url")
-    private String url;
-
-    /**
-     * 类型
-     */
-    @ApiModelProperty(value = "文件mime类型")
-    private String mime;
-
-    /**
-     * 原始文件名
-     */
-    @ApiModelProperty(value = "原始文件名")
-    private String originalFilename;
-
-    /**
-     * 文件名
-     */
-    @ApiModelProperty(value = "唯一文件名")
-    private String filename;
-
-    /**
-     * 后缀 (没有.)
-     */
-    @ApiModelProperty(value = "后缀")
-    private String ext;
-
-    /**
-     * 大小
-     */
-    @ApiModelProperty(value = "大小")
-    private String size;
-
-    /**
-     * 图标
-     */
-    @ApiModelProperty(value = "图标")
-    private String icon;
-    /**
-     * 文件类型
-     */
-    @ApiModelProperty(value = "文件类型 IMAGE/VIDEO/AUDIO/DOC/OTHER/DIR", example = "IMAGE/VIDEO/AUDIO/DOC/OTHER/DIR")
-    private String dataType;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getFolderId() {
-        return folderId;
-    }
-
-    public void setFolderId(Long folderId) {
-        this.folderId = folderId;
-    }
-
-    public Long getFolderName() {
-        return folderName;
-    }
-
-    public void setFolderName(Long folderName) {
-        this.folderName = folderName;
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    public String getMime() {
-        return mime;
-    }
-
-    public void setMime(String mime) {
-        this.mime = mime;
-    }
-
-    public String getOriginalFilename() {
-        return originalFilename;
-    }
-
-    public void setOriginalFilename(String originalFilename) {
-        this.originalFilename = originalFilename;
-    }
-
-    public String getFilename() {
-        return filename;
-    }
-
-    public void setFilename(String filename) {
-        this.filename = filename;
-    }
-
-    public String getExt() {
-        return ext;
-    }
-
-    public void setExt(String ext) {
-        this.ext = ext;
-    }
-
-    public String getSize() {
-        return size;
-    }
-
-    public void setSize(String size) {
-        this.size = size;
-    }
-
-    public String getIcon() {
-        return icon;
-    }
-
-    public void setIcon(String icon) {
-        this.icon = icon;
-    }
-
-    public String getDataType() {
-        return dataType;
-    }
-
-    public void setDataType(String dataType) {
-        this.dataType = dataType;
-    }
-
-    @Override
-    public String toString() {
-        return "FileDTO{" +
-                "id=" + id +
-                ", folderId=" + folderId +
-                ", folderName=" + folderName +
-                ", url='" + url + '\'' +
-                ", mime='" + mime + '\'' +
-                ", originalFilename='" + originalFilename + '\'' +
-                ", filename='" + filename + '\'' +
-                ", ext='" + ext + '\'' +
-                ", size='" + size + '\'' +
-                ", icon='" + icon + '\'' +
-                ", dataType='" + dataType + '\'' +
-                '}';
-    }
-}

+ 109 - 0
base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FileInfoDTO.java

@@ -0,0 +1,109 @@
+package com.usoftchina.saas.file.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @author yingp
+ * @date 2018/9/29
+ */
+@ApiModel(value = "File", description = "文件")
+public class FileInfoDTO extends BaseFileInfo implements Serializable {
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    /**
+     * 链接
+     */
+    @ApiModelProperty(value = "文件path")
+    private String fullPath;
+
+    /**
+     * 类型
+     */
+    @ApiModelProperty(value = "文件mime类型")
+    private String mime;
+
+    /**
+     * 扩展名 (没有.)
+     */
+    @ApiModelProperty(value = "扩展名")
+    private String ext;
+
+    /**
+     * 大小
+     */
+    @ApiModelProperty(value = "大小")
+    private Long size;
+    /**
+     * 文件类型
+     */
+    @ApiModelProperty(value = "文件类型 IMAGE/TEXT/VIDEO/AUDIO/DOC/DIR/COMPRESS/OTHER", example = "IMAGE/TEXT/VIDEO/AUDIO/DOC/DIR/COMPRESS/OTHER")
+    private String type;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getFullPath() {
+        return fullPath;
+    }
+
+    public void setFullPath(String fullPath) {
+        this.fullPath = fullPath;
+    }
+
+    public String getMime() {
+        return mime;
+    }
+
+    public void setMime(String mime) {
+        this.mime = mime;
+    }
+
+    public String getExt() {
+        return ext;
+    }
+
+    public void setExt(String ext) {
+        this.ext = ext;
+    }
+
+    public Long getSize() {
+        return size;
+    }
+
+    public void setSize(Long size) {
+        this.size = size;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    @Override
+    public String toString() {
+        return "FileInfoDTO{" +
+                "id=" + id +
+                ", folderId=" + folderId +
+                ", name=" + name +
+                ", fullPath='" + fullPath + '\'' +
+                ", mime='" + mime + '\'' +
+                ", ext='" + ext + '\'' +
+                ", size=" + size +
+                ", type='" + type + '\'' +
+                ", name='" + name + '\'' +
+                ", folderId=" + folderId +
+                '}';
+    }
+}

+ 0 - 31
base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FileListDTO.java

@@ -1,31 +0,0 @@
-package com.usoftchina.saas.file.dto;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @author yingp
- * @date 2018/9/29
- */
-public class FileListDTO implements Serializable {
-    private List<FileDTO> files;
-
-    public FileListDTO(List<FileDTO> files) {
-        this.files = files;
-    }
-
-    public List<FileDTO> getFiles() {
-        return files;
-    }
-
-    public void setFiles(List<FileDTO> files) {
-        this.files = files;
-    }
-
-    @Override
-    public String toString() {
-        return "FileListDTO{" +
-                "files=" + files +
-                '}';
-    }
-}

+ 4 - 9
base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FolderDTO.java

@@ -1,15 +1,12 @@
 package com.usoftchina.saas.file.dto;
 
-import io.swagger.annotations.ApiModelProperty;
-
 import java.io.Serializable;
 
 /**
  * @author yingp
- * @date 2018/9/29
+ * @date 2018/11/9
  */
-public class FolderDTO extends BaseFolder implements Serializable{
-    @ApiModelProperty(value = "id", required = true)
+public class FolderDTO extends BaseFileInfo implements Serializable{
     private Long id;
 
     public Long getId() {
@@ -23,10 +20,8 @@ public class FolderDTO extends BaseFolder implements Serializable{
     @Override
     public String toString() {
         return "FolderDTO{" +
-                "id=" + id +
-                ", originalFilename='" + originalFilename + '\'' +
-                ", parentId=" + parentId +
-                ", orderNum=" + orderNum +
+                "name='" + name + '\'' +
+                ", folderId=" + folderId +
                 '}';
     }
 }

+ 17 - 0
base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FolderSaveDTO.java

@@ -0,0 +1,17 @@
+package com.usoftchina.saas.file.dto;
+
+import java.io.Serializable;
+
+/**
+ * @author yingp
+ * @date 2018/9/29
+ */
+public class FolderSaveDTO extends BaseFileInfo implements Serializable{
+    @Override
+    public String toString() {
+        return "FolderSaveDTO{" +
+                "name='" + name + '\'' +
+                ", folderId=" + folderId +
+                '}';
+    }
+}

+ 0 - 18
base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FolderToSaveDTO.java

@@ -1,18 +0,0 @@
-package com.usoftchina.saas.file.dto;
-
-import java.io.Serializable;
-
-/**
- * @author yingp
- * @date 2018/9/29
- */
-public class FolderToSaveDTO extends BaseFolder implements Serializable{
-    @Override
-    public String toString() {
-        return "FolderToSaveDTO{" +
-                "originalFilename='" + originalFilename + '\'' +
-                ", parentId=" + parentId +
-                ", orderNum=" + orderNum +
-                '}';
-    }
-}

+ 31 - 11
base-servers/file/file-server/pom.xml

@@ -15,24 +15,17 @@
     <dependencies>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
-            <artifactId>core</artifactId>
+            <artifactId>server-starter</artifactId>
         </dependency>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>file-dto</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-security</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>auth-client</artifactId>
         </dependency>
+        <!-- db -->
         <dependency>
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>
@@ -54,6 +47,33 @@
             <groupId>io.springfox</groupId>
             <artifactId>springfox-swagger2</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>com.github.tobato</groupId>
+            <artifactId>fastdfs-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-compress</artifactId>
+        </dependency>
+        <!-- sleuth -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-zipkin</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.amqp</groupId>
+            <artifactId>spring-rabbit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.logstash.logback</groupId>
+            <artifactId>logstash-logback-encoder</artifactId>
+        </dependency>
+        <!-- test -->
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>test-starter</artifactId>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 10 - 2
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/FileApplication.java

@@ -1,9 +1,14 @@
 package com.usoftchina.saas.file;
 
+import com.github.tobato.fastdfs.FdfsClientConfig;
+import com.usoftchina.saas.auth.client.EnableAuthClient;
+import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
-import org.springframework.cloud.netflix.hystrix.EnableHystrix;
+import org.springframework.context.annotation.EnableMBeanExport;
+import org.springframework.context.annotation.Import;
+import org.springframework.jmx.support.RegistrationPolicy;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 /**
@@ -12,8 +17,11 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
  */
 @SpringBootApplication
 @EnableEurekaClient
-@EnableHystrix
 @EnableTransactionManagement
+@MapperScan("com.usoftchina.saas.file.mapper")
+@EnableAuthClient
+@Import(FdfsClientConfig.class)
+@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
 public class FileApplication {
     public static void main(String[] args) {
         SpringApplication.run(FileApplication.class, args);

+ 12 - 0
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/constant/FileConstant.java

@@ -0,0 +1,12 @@
+package com.usoftchina.saas.file.constant;
+
+/**
+ * @author yingp
+ * @date 2018/11/9
+ */
+public class FileConstant {
+    /**
+     * 默认文件夹ID
+     */
+    public static final long DEFAULT_FOLDER_ID = 0;
+}

+ 50 - 0
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/constant/FileType.java

@@ -0,0 +1,50 @@
+package com.usoftchina.saas.file.constant;
+
+/**
+ * @author yingp
+ * @date 2018/11/9
+ */
+public enum FileType {
+    /**
+     * 文件夹
+     */
+    DIR,
+    /**
+     * 图片
+     */
+    IMAGE,
+    /**
+     * 文本
+     */
+    TEXT,
+    /**
+     * 文档
+     */
+    DOC,
+    /**
+     * 压缩文件
+     */
+    COMPRESS,
+    /**
+     * 视频
+     */
+    VIDEO,
+    /**
+     * 音频
+     */
+    AUDIO,
+    /**
+     * 其他
+     */
+    OTHER;
+
+    public static FileType of(String type) {
+        try {
+            if (null != type) {
+                return FileType.valueOf(type);
+            }
+        } catch (Exception e) {
+        }
+        return OTHER;
+    }
+}

+ 320 - 11
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/controller/FileController.java

@@ -1,18 +1,36 @@
 package com.usoftchina.saas.file.controller;
 
+import com.github.tobato.fastdfs.domain.StorePath;
+import com.github.tobato.fastdfs.service.FastFileStorageClient;
 import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.exception.ExceptionCode;
+import com.usoftchina.saas.file.constant.FileConstant;
+import com.usoftchina.saas.file.dto.FileInfoDTO;
 import com.usoftchina.saas.file.dto.FolderDTO;
-import com.usoftchina.saas.file.dto.FolderToSaveDTO;
-import com.usoftchina.saas.file.service.FileService;
+import com.usoftchina.saas.file.dto.FolderSaveDTO;
+import com.usoftchina.saas.file.po.FileInfo;
+import com.usoftchina.saas.file.service.FileInfoService;
+import com.usoftchina.saas.utils.BeanMapper;
 import com.usoftchina.saas.utils.BizAssert;
+import com.usoftchina.saas.utils.CollectionUtils;
+import com.usoftchina.saas.utils.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.compress.archivers.ArchiveOutputStream;
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
+import org.apache.commons.io.IOUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.List;
 
 /**
  * 文件接口
@@ -22,16 +40,307 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Api(value = "FileApi", description = "文件管理")
 @RestController
-@RequestMapping("/api/file")
+@RequestMapping
 public class FileController {
 
     @Autowired
-    private FileService fileService;
+    private FileInfoService fileService;
+
+    @Autowired
+    private FastFileStorageClient storageClient;
+    /**
+     * 文件访问服务baseUrl
+     *
+     * @Deprecated 文件需要权限限制,用nginx不好处理
+     */
+    @Value("${file.base-url}")
+    private String fileBaseUrl;
 
-    @ApiOperation(value = "保存文件夹")
+    /**
+     * 检查文件夹ID的有效性
+     *
+     * @param folderId
+     * @return
+     */
+    private FileInfo checkFolder(Long folderId) {
+        if (null == folderId || folderId == FileConstant.DEFAULT_FOLDER_ID) {
+            return FileInfo.newFolder(FileConstant.DEFAULT_FOLDER_ID, null, "");
+        } else if (folderId < 0) {
+            throw new BizException(ExceptionCode.FOLDER_INVALID);
+        } else {
+            FileInfo info = fileService.findByPrimaryKey(folderId);
+            if (null != info) {
+                if (!info.isFolder()) {
+                    throw new BizException(ExceptionCode.FILE_NOT_FOLDER);
+                }
+                return info;
+            } else {
+                throw new BizException(ExceptionCode.FOLDER_NOT_EXISTS);
+            }
+        }
+    }
+
+    @ApiOperation(value = "创建文件夹")
     @PostMapping(value = "/folder")
-    public Result<FolderDTO> folder(@RequestBody FolderToSaveDTO newFolder) {
-        BizAssert.notNull(newFolder.getOriginalFilename(), ExceptionCode.FOLDER_NAME_EMPTY);
+    public Result<FolderDTO> folder(FolderSaveDTO newFolder) {
+        BizAssert.notNull(newFolder.getName(), ExceptionCode.FOLDER_NAME_EMPTY);
+        // 检查父文件夹
+        FileInfo parent = checkFolder(newFolder.getFolderId());
+        FileInfo info = FileInfo.newFolder(parent.getId(), newFolder.getName());
+        fileService.save(info);
+        return Result.success(BeanMapper.map(info, FolderDTO.class));
+    }
+
+    @ApiOperation(value = "上传文件")
+    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    public Result<FileInfoDTO> upload(Long folderId, @RequestPart(value = "file") MultipartFile file) throws Exception {
+        // 检查父文件夹
+        FileInfo parent = checkFolder(folderId);
+        FileInfo info = FileInfo.newFile(file).folder(parent.getId())
+                .storeBy(storageClient).build();
+        fileService.save(info);
+        return Result.success(BeanMapper.map(info, FileInfoDTO.class));
+    }
+
+    @ApiOperation(value = "下载文件")
+    @GetMapping(value = "/download/{id}")
+    public void download(@PathVariable Long id, HttpServletResponse response) throws Exception {
+        FileInfo info = fileService.findByPrimaryKey(id);
+        if (null == info) {
+            throw new BizException(ExceptionCode.FILE_NOT_EXISTS);
+        }
+        download(info, response);
+    }
+
+    private void download(FileInfo info, HttpServletResponse response) throws Exception{
+        response.setContentType("application/force-download");
+        if (info.isFolder()) {
+            // 压缩后下载
+            try (ArchiveOutputStream out = new ZipArchiveOutputStream(response.getOutputStream());) {
+                cascadeOutput(info, null, out);
+                out.finish();
+            }
+        } else {
+            if (null != info.getFullPath()) {
+                response.setHeader("Content-disposition",
+                        "attachment; filename=" + URLEncoder.encode(info.getName(), "UTF-8"));
+                StorePath path = StorePath.praseFromUrl(info.getFullPath());
+                storageClient.downloadFile(path.getGroup(), path.getPath(),
+                        in -> IOUtils.copy(in, response.getOutputStream()));
+            }
+        }
+    }
+
+    @ApiOperation(value = "下载文件")
+    @GetMapping(value = "/download")
+    public void download(@RequestParam String path, HttpServletResponse response) throws Exception {
+        FileInfo info = fileService.findByFullPath(path);
+        if (null == info) {
+            throw new BizException(ExceptionCode.FILE_NOT_EXISTS);
+        }
+        download(info, response);
+    }
+
+    @ApiOperation(value = "查看文件")
+    @GetMapping(value = "/view/{id}")
+    public void view(@PathVariable Long id, HttpServletResponse response) throws Exception {
+        FileInfo info = fileService.findByPrimaryKey(id);
+        if (null == info) {
+            throw new BizException(ExceptionCode.FILE_NOT_EXISTS);
+        }
+        view(info, response);
+    }
+
+    private void view(FileInfo info, HttpServletResponse response) throws Exception{
+        if (info.isImage() || info.isText()) {
+            if (!StringUtils.isEmpty(info.getMime())) {
+                response.setContentType(info.getMime());
+            }
+            StorePath path = StorePath.praseFromUrl(info.getFullPath());
+            storageClient.downloadFile(path.getGroup(), path.getPath(),
+                    in -> IOUtils.copy(in, response.getOutputStream()));
+        } else {
+            // 无法直接查看的文件,下载到客户端
+            download(info.getId(), response);
+        }
+    }
+
+    @ApiOperation(value = "查看文件")
+    @GetMapping(value = "/view")
+    public void view(@RequestParam String path, HttpServletResponse response) throws Exception {
+        FileInfo info = fileService.findByFullPath(path);
+        if (null == info) {
+            throw new BizException(ExceptionCode.FILE_NOT_EXISTS);
+        }
+        view(info, response);
+    }
+
+    @ApiOperation(value = "查看文件信息")
+    @GetMapping(value = "/info/{id}")
+    public Result<FileInfoDTO> getFileInfo(@PathVariable Long id) {
+        FileInfo info = fileService.findByPrimaryKey(id);
+        if (null != info) {
+            return Result.success(BeanMapper.map(info, FileInfoDTO.class));
+        }
+        return Result.error(ExceptionCode.FILE_NOT_EXISTS);
+    }
+
+    @ApiOperation(value = "查看文件信息")
+    @GetMapping(value = "/info")
+    public Result<FileInfoDTO> getFileInfo(@RequestParam String path) {
+        FileInfo info = fileService.findByFullPath(path);
+        if (null != info) {
+            return Result.success(BeanMapper.map(info, FileInfoDTO.class));
+        }
+        return Result.error(ExceptionCode.FILE_NOT_EXISTS);
+    }
+
+    @ApiOperation(value = "查看子文件")
+    @GetMapping(value = "/list")
+    public Result<List<FileInfoDTO>> listFiles(Long folderId) {
+        List<FileInfo> files = fileService.findByFolderId(checkFolder(folderId).getId());
+        return Result.success(BeanMapper.mapList(files, FileInfoDTO.class));
+    }
+
+    /**
+     * 以压缩文件的方式,级联输出
+     *
+     * @param info
+     * @param directory
+     * @param out
+     * @throws IOException
+     */
+    private void cascadeOutput(FileInfo info, String directory, ArchiveOutputStream out) throws IOException{
+        if (info.isFolder()) {
+            if (null == directory) {
+                directory = "/";
+            } else {
+                directory = directory + info.getName() + "/";
+                out.putArchiveEntry(new ZipArchiveEntry(directory));
+                out.closeArchiveEntry();
+            }
+            List<FileInfo> files = fileService.findByFolderId(info.getId());
+            if (!CollectionUtils.isEmpty(files)) {
+                for (FileInfo f : files) {
+                    cascadeOutput(f, directory,out);
+                }
+            }
+        } else {
+            out.putArchiveEntry(new ZipArchiveEntry(directory + info.getName()));
+            StorePath path = StorePath.praseFromUrl(info.getFullPath());
+            storageClient.downloadFile(path.getGroup(), path.getPath(), in -> IOUtils.copy(in, out));
+            out.closeArchiveEntry();
+        }
+    }
+
+    /**
+     * 级联删除
+     *
+     * @param info
+     */
+    private void cascadeRemove(FileInfo info) {
+        if (info.isFolder()) {
+            List<FileInfo> files = fileService.findByFolderId(info.getId());
+            if (!CollectionUtils.isEmpty(files)) {
+                files.forEach(this::cascadeRemove);
+            }
+            fileService.removeByPrimaryKey(info.getId());
+        } else {
+            fileService.removeByPrimaryKey(info.getId());
+            storageClient.deleteFile(info.getFullPath());
+        }
+    }
+
+    /**
+     * 级联回收
+     *
+     * @param info
+     */
+    private void cascadeRetrieve(FileInfo info) {
+        if (info.isFolder()) {
+            List<FileInfo> files = fileService.findByFolderId(info.getId());
+            if (!CollectionUtils.isEmpty(files)) {
+                files.forEach(this::cascadeRetrieve);
+            }
+        }
+        info.retrieve();
+        fileService.updateByPrimaryKey(info);
+    }
+
+    /**
+     * 级联还原
+     *
+     * @param info
+     */
+    private void cascadeRestore(FileInfo info) {
+        info.restore();
+        fileService.updateByPrimaryKey(info);
+        if (info.isFolder()) {
+            List<FileInfo> files = fileService.findByFolderId(info.getId());
+            if (!CollectionUtils.isEmpty(files)) {
+                files.forEach(this::cascadeRestore);
+            }
+        }
+    }
+
+    @ApiOperation(value = "删除文件")
+    @GetMapping(value = "/delete/{id}")
+    public Result delete(@PathVariable Long id,
+                         @RequestParam(required = false, defaultValue = "false") Boolean purge) {
+        FileInfo info = fileService.findByPrimaryKey(id);
+        if (null != info) {
+            if (purge) {
+                cascadeRemove(info);
+            } else {
+                cascadeRetrieve(info);
+            }
+        }
+        return Result.success();
+    }
+
+    @ApiOperation(value = "删除文件")
+    @GetMapping(value = "/delete")
+    public Result delete(@RequestParam String path,
+                         @RequestParam(required = false, defaultValue = "false") Boolean purge) {
+        FileInfo info = fileService.findByFullPath(path);
+        if (null != info) {
+            if (purge) {
+                cascadeRemove(info);
+            } else {
+                cascadeRetrieve(info);
+            }
+        }
+        return Result.success();
+    }
+
+    @ApiOperation(value = "还原文件")
+    @GetMapping(value = "/restore/{id}")
+    public Result restore(@PathVariable Long id) {
+        FileInfo info = fileService.findByPrimaryKey(id);
+        if (null != info) {
+            cascadeRestore(info);
+        }
+        return Result.success();
+    }
+
+    @ApiOperation(value = "还原文件")
+    @GetMapping(value = "/restore")
+    public Result restore(@RequestParam String path) {
+        FileInfo info = fileService.findByFullPath(path);
+        if (null != info) {
+            cascadeRestore(info);
+        }
+        return Result.success();
+    }
+
+    @ApiOperation(value = "移动文件到文件夹")
+    @GetMapping(value = "/move")
+    public Result move(@RequestParam Long fileId, @RequestParam Long folderId) {
+        FileInfo info = fileService.findByPrimaryKey(fileId);
+        if (null != info) {
+            info.setFolderId(folderId);
+            fileService.updateByPrimaryKey(info);
+        }
         return Result.success();
     }
 }

+ 46 - 0
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/mapper/FileInfoMapper.java

@@ -0,0 +1,46 @@
+package com.usoftchina.saas.file.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.file.po.FileInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2018/9/29
+ */
+public interface FileInfoMapper extends CommonBaseMapper<FileInfo>{
+
+    /**
+     * 按文件夹名查找未删除的
+     *
+     * @param folderId
+     * @return
+     */
+    List<FileInfo> selectVisibleByFolderId(@Param("folderId") Long folderId);
+
+    /**
+     * 按文件夹名查找删除的
+     *
+     * @param folderId
+     * @return
+     */
+    List<FileInfo> selectDeletedByFolderId(@Param("folderId") Long folderId);
+
+    /**
+     * 按文件夹名查找
+     *
+     * @param folderId
+     * @return
+     */
+    List<FileInfo> selectByFolderId(@Param("folderId") Long folderId);
+
+    /**
+     * 按路径查找
+     *
+     * @param fullPath
+     * @return
+     */
+    FileInfo selectByFullPath(@Param("fullPath") String fullPath);
+}

+ 0 - 11
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/mapper/FileMapper.java

@@ -1,11 +0,0 @@
-package com.usoftchina.saas.file.mapper;
-
-import com.usoftchina.saas.base.mapper.CommonBaseMapper;
-import com.usoftchina.saas.file.po.File;
-
-/**
- * @author yingp
- * @date 2018/9/29
- */
-public interface FileMapper extends CommonBaseMapper<File>{
-}

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