Browse Source

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

rainco 7 years ago
parent
commit
3633b54acc
100 changed files with 3671 additions and 756 deletions
  1. 3 2
      README.md
  2. 2 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/FundinouttypeController.java
  3. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/FundinouttypeMapper.java
  4. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/FundinouttypeService.java
  5. 2 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java
  6. 1 1
      applications/document/document-server/src/main/resources/mapper/CustomerListMapper.xml
  7. 8 0
      applications/document/document-server/src/main/resources/mapper/FundinouttypeMapper.xml
  8. 1 1
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  9. 58 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/MoneyReportColltroller.java
  10. 10 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/AcountbalanceViewMapper.java
  11. 11 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/CustomerCheckViewMapper.java
  12. 10 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/PaydetailViewMapper.java
  13. 10 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/RecdetailViewMapper.java
  14. 10 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/VendorAcountViewMapper.java
  15. 134 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/AcountbalanceView.java
  16. 165 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/CustomerCheckView.java
  17. 155 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/PaydetailView.java
  18. 154 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/RecdetailView.java
  19. 174 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/VendorAcountView.java
  20. 17 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/MoneyReportService.java
  21. 94 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/MoneyReportServiceImpl.java
  22. 7 69
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/PaybalanceServiceImpl.java
  23. 5 76
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/RecbalanceServiceImpl.java
  24. 33 0
      applications/money/money-server/src/main/resources/mapper/AcountbalanceViewMapper.xml
  25. 36 0
      applications/money/money-server/src/main/resources/mapper/CustomerCheckViewMapper.xml
  26. 1 6
      applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml
  27. 1 12
      applications/money/money-server/src/main/resources/mapper/OthreceiptsMapper.xml
  28. 1 11
      applications/money/money-server/src/main/resources/mapper/OthspendingsMapper.xml
  29. 1 12
      applications/money/money-server/src/main/resources/mapper/PaybalanceMapper.xml
  30. 35 0
      applications/money/money-server/src/main/resources/mapper/PaydetailViewMapper.xml
  31. 2 13
      applications/money/money-server/src/main/resources/mapper/RecbalanceMapper.xml
  32. 34 0
      applications/money/money-server/src/main/resources/mapper/RecdetailViewMapper.xml
  33. 36 0
      applications/money/money-server/src/main/resources/mapper/VendorAcountViewMapper.xml
  34. 30 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseReportController.java
  35. 10 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchasePayMapper.java
  36. 3 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseList.java
  37. 40 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/report/PurchasePay.java
  38. 10 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/PurchaseReportService.java
  39. 56 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseReportServiceImpl.java
  40. 9 3
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  41. 2 2
      applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutListMapper.xml
  42. 33 3
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseListMapper.xml
  43. 32 0
      applications/purchase/purchase-server/src/main/resources/mapper/PurchasePayMapper.xml
  44. 6 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/SaleDTO.java
  45. 2 2
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleReportController.java
  46. 6 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/Sale.java
  47. 2 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/SaleList.java
  48. 2 2
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  49. 1 0
      applications/sale/sale-server/src/main/resources/mapper/SaleListMapper.xml
  50. 32 1
      applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml
  51. 13 0
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/report/ProdinoutCountView.java
  52. 33 0
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/report/ProdiodetailView.java
  53. 44 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/ProdInOutReportController.java
  54. 18 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/ProdInOutReportMapper.java
  55. 15 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/ProdInOutReportService.java
  56. 64 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/ProdInOutReportServiceImpl.java
  57. 2 2
      applications/storage/storage-server/src/main/resources/mapper/ProdInOutListMapper.xml
  58. 56 0
      applications/storage/storage-server/src/main/resources/mapper/ProdInOutReportMapper.xml
  59. 4 2
      base-servers/account/account-server/src/main/resources/mapper/AccountMapper.xml
  60. 4 2
      base-servers/account/account-server/src/main/resources/mapper/CompanyMapper.xml
  61. 4 0
      base-servers/file/README.md
  62. 9 10
      base-servers/file/file-api/src/main/java/com/usoftchina/saas/file/api/FileApi.java
  63. 37 0
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/BaseFileInfo.java
  64. 0 60
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/BaseFolder.java
  65. 0 179
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FileDTO.java
  66. 109 0
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FileInfoDTO.java
  67. 0 31
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FileListDTO.java
  68. 4 9
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FolderDTO.java
  69. 17 0
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FolderSaveDTO.java
  70. 0 18
      base-servers/file/file-dto/src/main/java/com/usoftchina/saas/file/dto/FolderToSaveDTO.java
  71. 31 11
      base-servers/file/file-server/pom.xml
  72. 10 2
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/FileApplication.java
  73. 12 0
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/constant/FileConstant.java
  74. 50 0
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/constant/FileType.java
  75. 320 11
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/controller/FileController.java
  76. 46 0
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/mapper/FileInfoMapper.java
  77. 0 11
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/mapper/FileMapper.java
  78. 0 108
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/po/File.java
  79. 304 0
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/po/FileInfo.java
  80. 30 0
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/service/FileInfoService.java
  81. 0 12
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/service/FileService.java
  82. 36 0
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/service/impl/FileInfoServiceImpl.java
  83. 0 16
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/service/impl/FileServiceImpl.java
  84. 135 0
      base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/util/FileTypeUtils.java
  85. 58 7
      base-servers/file/file-server/src/main/resources/application.yml
  86. 0 15
      base-servers/file/file-server/src/main/resources/banner.txt
  87. 12 0
      base-servers/file/file-server/src/main/resources/config/application-docker-dev.yml
  88. 10 0
      base-servers/file/file-server/src/main/resources/config/application-docker.yml
  89. 58 9
      base-servers/file/file-server/src/main/resources/logback-spring.xml
  90. 219 0
      base-servers/file/file-server/src/main/resources/mapper/FileInfoMapper.xml
  91. 0 5
      base-servers/file/file-server/src/main/resources/mapper/FilePoMapper.xml
  92. 104 0
      base-servers/file/file-server/src/test/java/com/usoftchina/saas/file/controller/FileControllerTest.java
  93. 50 0
      base-servers/file/file-server/src/test/java/com/usoftchina/saas/file/util/RandomTextFile.java
  94. 5 7
      framework/core/src/main/java/com/usoftchina/saas/exception/ExceptionCode.java
  95. 8 0
      framework/core/src/main/java/com/usoftchina/saas/utils/BizAssert.java
  96. 10 0
      framework/core/src/main/java/com/usoftchina/saas/utils/StringUtils.java
  97. 23 0
      framework/test-starter/src/main/java/com.usoftchina.saas.test/BaseControllerTest.java
  98. 200 0
      frontend/saas-web/app/Application.scss
  99. 17 6
      frontend/saas-web/app/util/FormUtil.js
  100. 1 1
      frontend/saas-web/app/view/core/form/ConDateField.js

+ 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脚本

+ 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

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

@@ -63,7 +63,7 @@
         and customer.companyid = #{companyId}
       </if>
     </where>
-    order by cu_id
+    order by cu_id desc
   </select>
 
   <select id="selectCustomerBycondition"  resultMap="BaseResultMap">

+ 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>

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

@@ -142,7 +142,7 @@
         #{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_preamount,jdbcTyp=DOUBLE}
+        #{ve_preamount,jdbcType=DOUBLE}
         )
     </insert>
     <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Vendor" >

+ 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;
+    }
+}

+ 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);
+}

+ 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;
+    }
+}

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

@@ -10,10 +10,6 @@ import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
-import com.usoftchina.saas.document.entities.Bankinformation;
-import com.usoftchina.saas.document.entities.Vendor;
-import com.usoftchina.saas.document.mapper.BankinformationMapper;
-import com.usoftchina.saas.document.mapper.VendorMapper;
 import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.money.mapper.*;
 import com.usoftchina.saas.money.po.*;
@@ -46,10 +42,6 @@ public class PaybalanceServiceImpl implements PaybalanceService {
     private SubledgerMapper subledgerMapper;
     @Autowired
     private BanksubledgerMapper banksubledgerMapper;
-    @Autowired
-    private VendorMapper vendorMapper;
-    @Autowired
-    private BankinformationMapper bankinformationMapper;
 
     public DocBaseDTO insert(Pay pay) {
         Paybalance paybalance = pay.getMain();
@@ -192,74 +184,15 @@ public class PaybalanceServiceImpl implements PaybalanceService {
         Double amountTotal = new Double(0);
         for (Paybalancedet det: paybalancedet) {
             amountTotal = amountTotal + det.getPd_amount();
-            //更新账户资料金额
-            Bankinformation bankinformation = new Bankinformation();
-            Bankinformation nowBankInformation = bankinformationMapper.selectByPrimaryKey(det.getPd_bankid());
-            bankinformation.setBk_thisamount(nowBankInformation.getBk_thisamount()+det.getPd_amount());
-            bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
-        }
-        //更新主表pb_pbdamount=从表二金额合计
-        Double amountTotal2 = new Double(0);
-        for (Paybalancedetail detail : paybalancedetail){
-            amountTotal2 = amountTotal2 + detail.getPbd_amount();
         }
         updatePay.setId(pay.getMain().getId());
         updatePay.setPb_pdamount(amountTotal);
-        updatePay.setPb_pbdamount(amountTotal2);
-        paybalanceMapper.updateByPrimaryKeySelective(updatePay);
         //updateByPrimaryKeySelective
-        /**
-         * ve_preamount=nvl(ve_preamount,0)+pb_preamount,
-         * ve_payamount=nvl(ve_payamount,0)-pb_pbdamount,
-         * ve_leftamount=ve_beginapamount-ve_beginprepayamount+ve_payamount-ve_preamount;
-         */
-        Vendor vendorData = vendorMapper.selectByPrimaryKey(Long.valueOf(String.valueOf(paybalance.getPb_vendid())));
-        Double preamount = vendorData.getVe_preamount();
-        Double beginapamount = vendorData.getVe_beginapamount();
-        Double beginprepayamount= vendorData.getVe_beginprepayamount();
-        Double payamount = vendorData.getVe_payamount();
-
-        Vendor vendor = new Vendor();
-        vendor.setId(Long.valueOf(String.valueOf(paybalance.getPb_vendid())));
-        vendor.setVe_preamount(preamount+amountTotal);
-        vendor.setVe_payamount(payamount-amountTotal2);
-        vendor.setVe_leftamount(beginapamount-beginprepayamount+payamount-amountTotal2-preamount-amountTotal);
-        vendorMapper.updateByPrimaryKeySelective(vendor);
+
     }
 
     @Override
     public void unAudit(int id) {
-        //更新供应商资料
-        /**
-         * ve_preamount=nvl(ve_preamount,0)-pb_preamount,
-         * ve_payamount=nvl(ve_payamount,0)+pb_pbdamount,
-         * ve_leftamount=ve_beginapamount-ve_beginprepayamount+ve_payamount-ve_preamount;
-         */
-        Paybalance pay = paybalanceMapper.selectByPrimaryKey(Long.valueOf(id));
-        Double pay_preamount = pay.getPb_preamount();
-        Double pay_pbdamount = pay.getPb_pbdamount();
-        Vendor vendorData = vendorMapper.selectByPrimaryKey(Long.valueOf(String.valueOf(pay.getPb_vendid())));
-        Double preamount = vendorData.getVe_preamount();
-        Double beginapamount = vendorData.getVe_beginapamount();
-        Double beginprepayamount= vendorData.getVe_beginprepayamount();
-        Double payamount = vendorData.getVe_payamount();
-        Vendor vendor = new Vendor();
-        vendor.setId(Long.valueOf(String.valueOf(pay.getPb_vendid())));
-        vendor.setVe_preamount(preamount-pay_preamount);
-        vendor.setVe_payamount(payamount+pay_pbdamount);
-        vendor.setVe_leftamount(beginapamount-beginprepayamount+payamount+pay_pbdamount-preamount+pay_preamount);
-        vendorMapper.updateByPrimaryKeySelective(vendor);
-
-        //更新账户资料金额
-        List<Paybalancedet> paybalancedet = paybalancedetMapper.selectByPrimaryKey(id);
-        for (Paybalancedet det:paybalancedet) {
-            Bankinformation bankinformation = new Bankinformation();
-            Bankinformation nowBankInformation = bankinformationMapper.selectByPrimaryKey(det.getPd_bankid());
-            bankinformation.setBk_thisamount(nowBankInformation.getBk_thisamount()-det.getPd_amount());
-            bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
-        }
-
-
         Paybalance paybalance = new Paybalance();
         paybalance.setId(Long.valueOf(id));
         paybalance.setPb_status(com.usoftchina.saas.commons.po.Status.UNAUDITED.getDisplay());
@@ -271,7 +204,12 @@ public class PaybalanceServiceImpl implements PaybalanceService {
         subledgerMapper.deleteByPrimaryKey(paybalance.getPb_code(), paybalance.getPb_kind());
         banksubledgerMapper.deleteByPrimaryKey(paybalance.getPb_code(), paybalance.getPb_kind());
 
-
+        //更新供应商资料
+        /**
+         * ve_preamount=nvl(ve_preamount,0)-pb_preamount,
+         * ve_payamount=nvl(ve_payamount,0)+pb_pbdamount,
+         * ve_leftamount=ve_beginapamount-e_beginprepayamount+ve_payamount-ve_preamount;
+         */
     }
 
 

+ 5 - 76
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/RecbalanceServiceImpl.java

@@ -10,18 +10,11 @@ import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
-import com.usoftchina.saas.document.entities.Bankinformation;
-import com.usoftchina.saas.document.entities.Customer;
-import com.usoftchina.saas.document.entities.Vendor;
-import com.usoftchina.saas.document.mapper.BankinformationMapper;
-import com.usoftchina.saas.document.mapper.CustomerMapper;
-import com.usoftchina.saas.document.mapper.VendorMapper;
 import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.money.mapper.*;
 import com.usoftchina.saas.money.po.*;
 import com.usoftchina.saas.money.service.RecbalanceService;
 import com.usoftchina.saas.page.PageRequest;
-import io.netty.util.internal.MathUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
@@ -47,10 +40,6 @@ public class RecbalanceServiceImpl implements RecbalanceService {
     private BanksubledgerMapper banksubledgerMapper;
     @Autowired
     private SubledgerMapper subledgerMapper;
-    @Autowired
-    private CustomerMapper customerMapper;
-    @Autowired
-    private BankinformationMapper bankinformationMapper;
 
     @Override
     public DocBaseDTO insert(Rec rec) {
@@ -214,81 +203,21 @@ public class RecbalanceServiceImpl implements RecbalanceService {
             recbalanceMapper.updateByPrimaryKeySelective(recbalance);
         }
 
-        Recbalance updateRay = new Recbalance();
+        Recbalance updatePay = new Recbalance();
         List<Recbalancedet> recbalancedet = rec.getItems1();
         List<Recbalancedetail> recbalancedetail = rec.getItems2();
-        //更新主表付款金额:rb_rdamount=从表一金额合计
+        //更新主表付款金额:pb_pdamount=从表一金额合计
         Double amountTotal = new Double(0);
         for (Recbalancedet det: recbalancedet) {
             amountTotal = amountTotal + det.getRd_amount();
-            //更新账户资料金额
-            Bankinformation bankinformation = new Bankinformation();
-            Bankinformation nowBankInformation = bankinformationMapper.selectByPrimaryKey(det.getRd_bankid());
-            bankinformation.setBk_thisamount(nowBankInformation.getBk_thisamount()+det.getRd_amount());
-            bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
-        }
-        //更新主表pb_pbdamount=从表二金额合计
-        Double amountTotal2 = new Double(0);
-        for (Recbalancedetail detail : recbalancedetail){
-            amountTotal2 = amountTotal2 + detail.getRbd_amount();
         }
-        updateRay.setId(rec.getMain().getId());
-        updateRay.setRb_rdamount(amountTotal);
-        updateRay.setRb_rbdamount(amountTotal2);
-        recbalanceMapper.updateByPrimaryKeySelective(updateRay);
-        /**
-         * 更新客户资料
-         * cu_preamount=nvl(cu_preamount,0)+rb_preamount,
-         * cu_recamount=nvl(cu_recamount,0)-rb_rbdamount,
-         * cu_leftamount=cu_beginaramount-cu_beginprerecamount+cu_recamount-cu_preamount;
-         */
-        Customer customerData = customerMapper.selectByPrimaryKey(Long.valueOf(String.valueOf(recbalance.getRb_custid())));
-        Double preamount = customerData.getCu_preamount();
-        Double beginapamount = customerData.getCu_beginaramount();
-        Double beginprepayamount= customerData.getCu_beginprerecamount();
-        Double recamount = customerData.getCu_recamount();
-
-        Customer customer = new Customer();
-        customer.setId(Long.valueOf(String.valueOf(recbalance.getRb_custid())));
-        customer.setCu_preamount(preamount+amountTotal);
-        customer.setCu_recamount(recamount-amountTotal2);
-        customer.setCu_leftamount(beginapamount-beginprepayamount+recamount-amountTotal2-preamount-amountTotal);
-        customerMapper.updateByPrimaryKeySelective(customer);
+        updatePay.setId(rec.getMain().getId());
+        updatePay.setRb_rdamount(amountTotal);
+        //updateByPrimaryKeySelective
     }
 
     @Override
     public void unAudit(Long id) {
-        //更新供应商资料
-        /**
-         * ve_preamount=nvl(ve_preamount,0)-pb_preamount,
-         * ve_payamount=nvl(ve_payamount,0)+pb_pbdamount,
-         * ve_leftamount=ve_beginapamount-ve_beginprepayamount+ve_payamount-ve_preamount;
-         */
-        Recbalance rec = recbalanceMapper.selectByPrimaryKey(Long.valueOf(id));
-        Double pay_preamount = rec.getRb_preamount();
-        Double pay_pbdamount = rec.getRb_rbdamount();
-        Customer customerData = customerMapper.selectByPrimaryKey(Long.valueOf(String.valueOf(rec.getRb_custid())));
-        Double preamount = customerData.getCu_preamount();
-        Double beginapamount = customerData.getCu_beginaramount();
-        Double beginprepayamount= customerData.getCu_beginprerecamount();
-        Double recamount = customerData.getCu_recamount();
-        Customer customer = new Customer();
-        customer.setId(Long.valueOf(String.valueOf(rec.getRb_custid())));
-        customer.setCu_preamount(preamount-pay_preamount);
-        customer.setCu_recamount(recamount+pay_pbdamount);
-        customer.setCu_leftamount(beginapamount-beginprepayamount+recamount+pay_pbdamount-preamount+pay_preamount);
-        customerMapper.updateByPrimaryKeySelective(customer);
-
-        //更新账户资料金额
-        List<Recbalancedet> recbalancedet = recbalancedetMapper.selectByPrimaryKey(Math.toIntExact(id));
-        for (Recbalancedet det:recbalancedet) {
-            Bankinformation bankinformation = new Bankinformation();
-            Bankinformation nowBankInformation = bankinformationMapper.selectByPrimaryKey(det.getRd_bankid());
-            bankinformation.setBk_thisamount(nowBankInformation.getBk_thisamount()-det.getRd_amount());
-            bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
-        }
-
-
         Recbalance recbalance = new Recbalance();
         recbalance.setId(id);
         recbalance.setRb_status(Status.UNAUDITED.getDisplay());

+ 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 - 6
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>
@@ -117,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>
@@ -188,7 +184,6 @@
       <if test="updaterId != null" >
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
-      updatedate = now(),
       <if test="ft_text1 != null" >
         ft_text1 = #{ft_text1,jdbcType=VARCHAR},
       </if>

+ 1 - 12
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,7 +262,6 @@
       <if test="updaterId != null" >
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
-      updatedate = now(),
       <if test="or_text1 != null" >
         or_text1 = #{or_text1,jdbcType=VARCHAR},
       </if>

+ 1 - 11
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>

+ 1 - 12
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,7 +364,6 @@
       <if test="updaterId != null">
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
-      updatedate = now(),
       <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 - 13
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,7 +526,6 @@
       <if test="updaterId != null">
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
-      updatedate = now(),
       <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);
+}

+ 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;

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

@@ -82,7 +82,7 @@
       <if test="companyId != null">
         and   companyid = #{companyId}
       </if>
-    </where>  order by pi_id
+    </where>  order by pi_id desc
   </select>
 
   <select id="selectProdInOutListByCondition"  resultMap="BaseResultMap">
@@ -96,7 +96,7 @@
         and  prodinout.companyid = #{companyId}
       </if>
     </where>
-    order by pi_id,pd_pdno
+    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;
 }

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

@@ -21,13 +21,13 @@ public class SaleReportController {
     @Autowired
     private SaleReportService saleReportService;
 
-    @GetMapping("/SaleProfit")
+    @GetMapping("/saleProfit")
     public Result SaleProfit(PageRequest page, ListReqDTO req) {
         PageInfo listData = saleReportService.getSaleProfitData(page, req);
         return Result.success(listData);
     }
 
-    @GetMapping("/SaleRec")
+    @GetMapping("/saleRec")
     public Result SaleRec(PageRequest page, ListReqDTO req) {
         PageInfo listData = saleReportService.getSaleRecData(page, req);
         return Result.success(listData);

+ 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;
 }

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

@@ -48,6 +48,8 @@ public class SaleList implements Serializable{
 
     private Date sa_recorddate;
 
+    private Date sa_date;
+
     private Integer companyid;
 
     private Integer updaterId;

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

@@ -472,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);
             //更新已转数

+ 1 - 0
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" />

+ 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>

+ 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>{
-}

+ 0 - 108
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/po/File.java

@@ -1,108 +0,0 @@
-package com.usoftchina.saas.file.po;
-
-import com.usoftchina.saas.base.entity.CommonBaseEntity;
-
-import java.io.Serializable;
-
-/**
- * @author yingp
- * @date 2018/9/29
- */
-public class File extends CommonBaseEntity implements Serializable{
-    /**
-     * 文件夹id
-     */
-    private Long folderId;
-    /**
-     * 数据类型 IMAGE/VIDEO/AUDIO/DOC/OTHER/DIR
-     */
-    private String dataType;
-    /**
-     * 原始文件名
-     */
-    private String originalFilename;
-    /**
-     * 程序生成唯一文件名
-     */
-    private String filename;
-    /**
-     * mime类型
-     */
-    private String mime;
-    /**
-     * 后缀 (没有.)
-     */
-    private String ext;
-    /**
-     * 大小
-     */
-    private String size;
-    /**
-     * 图标
-     */
-    private String icon;
-
-    public Long getFolderId() {
-        return folderId;
-    }
-
-    public void setFolderId(Long folderId) {
-        this.folderId = folderId;
-    }
-
-    public String getDataType() {
-        return dataType;
-    }
-
-    public void setDataType(String dataType) {
-        this.dataType = dataType;
-    }
-
-    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 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 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;
-    }
-}

+ 304 - 0
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/po/FileInfo.java

@@ -0,0 +1,304 @@
+package com.usoftchina.saas.file.po;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.github.tobato.fastdfs.domain.StorePath;
+import com.github.tobato.fastdfs.service.FastFileStorageClient;
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.file.constant.FileType;
+import com.usoftchina.saas.file.util.FileTypeUtils;
+import com.usoftchina.saas.utils.StringUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author yingp
+ * @date 2018/9/29
+ */
+public class FileInfo extends CommonBaseEntity implements Serializable{
+    /**
+     * 文件夹id
+     */
+    private Long folderId;
+
+    /**
+     * 原始文件名
+     */
+    private String name;
+    /**
+     * 存储路径
+     */
+    private String fullPath;
+    /**
+     * Content-Type
+     */
+    private String mime;
+    /**
+     * 后缀 (没有.)
+     */
+    private String ext;
+    /**
+     * 大小
+     */
+    private long size;
+    /**
+     * 类型
+     * @see com.usoftchina.saas.file.constant.FileType
+     */
+    private String type;
+
+    /**
+     * 是否已删除
+     * 已删除的会保留7天,在回收站接口里面可以查看
+     * 7天后自动清除
+     */
+    private boolean deleted;
+
+    private Long deleterId;
+
+    private Date deleteTime;
+
+    public FileInfo() {
+    }
+
+    public FileInfo(Long id, Long folderId, String name) {
+        this.id = id;
+        this.folderId = folderId;
+        this.name = name;
+    }
+
+    public FileInfo(Long folderId, String name) {
+        this.folderId = folderId;
+        this.name = name;
+    }
+
+    public FileInfo(Long folderId, String name, String fullPath, String mime, String ext, String type, long size) {
+        this.folderId = folderId;
+        this.name = name;
+        this.fullPath = fullPath;
+        this.mime = mime;
+        this.ext = ext;
+        this.type = type;
+        this.size = size;
+    }
+
+    public Long getFolderId() {
+        return folderId;
+    }
+
+    public void setFolderId(Long folderId) {
+        this.folderId = folderId;
+    }
+
+    public String getMime() {
+        return mime;
+    }
+
+    public void setMime(String mime) {
+        this.mime = mime;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getFullPath() {
+        return fullPath;
+    }
+
+    public void setFullPath(String fullPath) {
+        this.fullPath = fullPath;
+    }
+
+    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;
+    }
+
+    public boolean isDeleted() {
+        return deleted;
+    }
+
+    public void setDeleted(boolean deleted) {
+        this.deleted = deleted;
+    }
+
+    public Long getDeleterId() {
+        return deleterId;
+    }
+
+    public void setDeleterId(Long deleterId) {
+        this.deleterId = deleterId;
+    }
+
+    public Date getDeleteTime() {
+        return deleteTime;
+    }
+
+    public void setDeleteTime(Date deleteTime) {
+        this.deleteTime = deleteTime;
+    }
+
+    /**
+     * 回收
+     */
+    public void retrieve() {
+        this.deleted = true;
+        this.deleterId = BaseContextHolder.getUserId();
+        this.deleteTime = new Date();
+    }
+
+    /**
+     * 从回收站还原
+     */
+    public void restore() {
+        this.deleteTime = null;
+        this.deleterId = null;
+        this.deleted = false;
+    }
+
+    @JsonIgnore
+    public boolean isFolder() {
+        return FileType.of(type) == FileType.DIR;
+    }
+
+    @JsonIgnore
+    public boolean isImage() {
+        return FileType.of(type) == FileType.IMAGE;
+    }
+
+    @JsonIgnore
+    public boolean isText() {
+        return FileType.of(type) == FileType.TEXT;
+    }
+
+    public static FileInfo newFolder(Long folderId, String name) {
+        FileInfo info = new FileInfo(folderId, name);
+        info.setType(FileType.DIR.name());
+        return info;
+    }
+
+    public static FileInfo newFolder(Long id, Long folderId, String name) {
+        FileInfo info = new FileInfo(id, folderId, name);
+        info.setType(FileType.DIR.name());
+        return info;
+    }
+
+    public static Builder newFile(MultipartFile file){
+        return new Builder(file);
+    }
+
+    /**
+     * FileInfo生成器
+     */
+    public static class Builder {
+        private Long folderId;
+        private String name;
+        private String fullPath;
+        private String mime;
+        private String ext;
+        private long size;
+        private String type;
+        private MultipartFile multipartFile;
+        private FastFileStorageClient storageClient;
+        private String baseUrl;
+
+        public Builder(MultipartFile file) {
+            this.name = file.getOriginalFilename();
+            this.ext = FilenameUtils.getExtension(file.getOriginalFilename());
+            this.size = file.getSize();
+            this.mime = file.getContentType();
+            this.type = FileTypeUtils.getFileType(mime, ext).name();
+            this.multipartFile = file;
+        }
+
+        public Builder folder(Long folderId) {
+            this.folderId = folderId;
+            return this;
+        }
+
+        public Builder name(String name) {
+            this.name = name;
+            return this;
+        }
+
+        public Builder fullPath(String fullPath) {
+            this.fullPath = fullPath;
+            return this;
+        }
+
+        public Builder mime(String mime) {
+            this.mime = mime;
+            return this;
+        }
+
+        public Builder ext(String ext) {
+            this.ext = ext;
+            return this;
+        }
+
+        public Builder size(long size) {
+            this.size = size;
+            return this;
+        }
+
+        public Builder type(String type) {
+            this.type = type;
+            return this;
+        }
+
+        public Builder storeBy(FastFileStorageClient storageClient){
+            this.storageClient = storageClient;
+            return this;
+        }
+
+        public Builder baseUrl(String baseUrl) {
+            this.baseUrl = baseUrl;
+            return this;
+        }
+
+        public FileInfo build() throws IOException{
+            if (null != storageClient) {
+                StorePath storePath;
+                if (FileType.of(type) == FileType.IMAGE) {
+                    // 保存图片 + 生成缩略图
+                    storePath = storageClient.uploadImageAndCrtThumbImage(multipartFile.getInputStream(),
+                            size, ext, null);
+                } else {
+                    storePath = storageClient.uploadFile(multipartFile.getInputStream(),
+                            size, ext, null);
+                }
+                this.fullPath = StringUtils.nullIf(baseUrl) + storePath.getFullPath();
+            }
+
+            return new FileInfo(folderId, name, fullPath, mime, ext, type, size);
+        }
+    }
+}

+ 30 - 0
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/service/FileInfoService.java

@@ -0,0 +1,30 @@
+package com.usoftchina.saas.file.service;
+
+import com.usoftchina.saas.base.service.CommonBaseService;
+import com.usoftchina.saas.file.mapper.FileInfoMapper;
+import com.usoftchina.saas.file.po.FileInfo;
+
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2018/9/30
+ */
+public interface FileInfoService extends CommonBaseService<FileInfoMapper, FileInfo> {
+
+    /**
+     * 按文件夹名查找
+     *
+     * @param folderId
+     * @return
+     */
+    List<FileInfo> findByFolderId(Long folderId);
+
+    /**
+     * 按路径查找
+     *
+     * @param fullPath
+     * @return
+     */
+    FileInfo findByFullPath(String fullPath);
+}

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

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

+ 36 - 0
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/service/impl/FileInfoServiceImpl.java

@@ -0,0 +1,36 @@
+package com.usoftchina.saas.file.service.impl;
+
+import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.file.mapper.FileInfoMapper;
+import com.usoftchina.saas.file.po.FileInfo;
+import com.usoftchina.saas.file.service.FileInfoService;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2018/9/30
+ */
+@Service
+public class FileInfoServiceImpl extends CommonBaseServiceImpl<FileInfoMapper, FileInfo> implements FileInfoService {
+
+    @Override
+    public List<FileInfo> findByFolderId(Long folderId) {
+        return getMapper().selectByFolderId(folderId);
+    }
+
+    @Override
+    public FileInfo findByFullPath(String fullPath) {
+        return getMapper().selectByFullPath(fullPath);
+    }
+
+    /**
+     * 清理回收站超过7天的文件
+     */
+    @Scheduled(cron = "0 15 0 * * ?")
+    public void clearRecycleBin() {
+
+    }
+}

+ 0 - 16
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/service/impl/FileServiceImpl.java

@@ -1,16 +0,0 @@
-package com.usoftchina.saas.file.service.impl;
-
-import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
-import com.usoftchina.saas.file.mapper.FileMapper;
-import com.usoftchina.saas.file.po.File;
-import com.usoftchina.saas.file.service.FileService;
-import org.springframework.stereotype.Service;
-
-/**
- * @author yingp
- * @date 2018/9/30
- */
-@Service
-public class FileServiceImpl extends CommonBaseServiceImpl<FileMapper, File> implements FileService{
-
-}

+ 135 - 0
base-servers/file/file-server/src/main/java/com/usoftchina/saas/file/util/FileTypeUtils.java

@@ -0,0 +1,135 @@
+package com.usoftchina.saas.file.util;
+
+import com.usoftchina.saas.file.constant.FileType;
+import com.usoftchina.saas.utils.StringUtils;
+
+/**
+ * @author yingp
+ * @date 2018/11/8
+ */
+public class FileTypeUtils {
+
+    /**
+     * 判断文件类型
+     *
+     * @param mime
+     * @param ext
+     * @return
+     */
+    public static FileType getFileType(String mime, String ext) {
+        FileType type = getFileTypeByExtension(ext);
+        if (type == FileType.OTHER) {
+            type = getFileTypeByMime(mime);
+        }
+        return type;
+    }
+
+    public static FileType getFileTypeByMime(String mime) {
+        if (!StringUtils.isEmpty(mime)) {
+            if (mime.startsWith("image/")) {
+                return FileType.IMAGE;
+            }
+            if (mime.startsWith("text/")) {
+                return FileType.TEXT;
+            }
+            if (mime.startsWith("application/")) {
+                switch (mime) {
+                    case "application/x-gzip":
+                    case "application/x-bzip2":
+                    case "application/zip":
+                    case "application/x-rar":
+                    case "application/x-tar":
+                    case "application/x-7z-compressed":
+                        return FileType.COMPRESS;
+                    default:
+                        return FileType.DOC;
+                }
+            }
+            if (mime.startsWith("video/")) {
+                return FileType.VIDEO;
+            }
+            if (mime.startsWith("audio/")) {
+                return FileType.AUDIO;
+            }
+        }
+        return FileType.OTHER;
+    }
+
+    public static FileType getFileTypeByExtension(String ext) {
+        if (!StringUtils.isEmpty(ext)) {
+            switch (ext) {
+                case "gif":
+                case "jpeg":
+                case "jpg":
+                case "bmp":
+                case "png":
+                case "tif":
+                case "tiff":
+                case "tga":
+                case "psd":
+                    return FileType.IMAGE;
+                case "txt":
+                case "php":
+                case "html":
+                case "htm":
+                case "js":
+                case "css":
+                case "rtf":
+                case "rtfd":
+                case "py":
+                case "java":
+                case "rb":
+                case "sh":
+                case "pl":
+                case "sql":
+                    return FileType.TEXT;
+                case "ai":
+                case "eps":
+                case "exe":
+                case "doc":
+                case "docx":
+                case "xls":
+                case "xlsx":
+                case "ppt":
+                case "pptx":
+                case "et":
+                case "pps":
+                case "pdf":
+                case "xml":
+                case "odt":
+                case "swf":
+                    return FileType.DOC;
+                case "avi":
+                case "dv":
+                case "mp4":
+                case "mpeg":
+                case "mpg":
+                case "mov":
+                case "wm":
+                case "flv":
+                case "mkv":
+                    return FileType.VIDEO;
+                case "mp3":
+                case "mid":
+                case "ogg":
+                case "mp4a":
+                case "wav":
+                case "wma":
+                    return FileType.AUDIO;
+                case "gz":
+                case "tgz":
+                case "bz":
+                case "bz2":
+                case "tbz":
+                case "zip":
+                case "rar":
+                case "tar":
+                case "7z":
+                    return FileType.COMPRESS;
+                default:
+                    break;
+            }
+        }
+        return FileType.OTHER;
+    }
+}

+ 58 - 7
base-servers/file/file-server/src/main/resources/application.yml

@@ -5,30 +5,69 @@ spring:
     user:
       name: admin
       password: select111***
+  rabbitmq:
+    host: 192.168.0.176
+    port: 5672
+    virtual-host: dev
+    username: saas
+    password: select123***
+  zipkin:
+    sender:
+      type: rabbit
+    locator:
+      discovery:
+        enabled: true
+  sleuth:
+    sampler:
+      probability: 1.0
   datasource:
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://192.168.253.12:3306/saas_file?characterEncoding=utf-8&useSSL=false
+    username: root
+    password: select111***
     hikari:
-      driver-class-name: com.mysql.cj.jdbc.Driver
-      jdbc-url: jdbc:mysql://192.168.253.12:3306/saas_file?characterEncoding=utf-8&useSSL=false
-      username: root
-      password: select111***
+      minimum-idle: 5
+      maximum-pool-size: 50
+      idle-timeout: 30000
+      max-lifetime: 1800000
+      connection-timeout: 30000
   messages:
     basename: i18n/messages
+  redis:
+    host: 192.168.253.12
+    port: 6379
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: GMT+8
 eureka:
   instance:
     leaseRenewalIntervalInSeconds: 10
     health-check-url-path: /actuator/health
     status-page-url-path: /actuator/info
+    prefer-ip-address: true
     metadata-map:
       user.name: ${spring.security.user.name}
       user.password: ${spring.security.user.password}
   client:
     registryFetchIntervalSeconds: 5
     serviceUrl:
-      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@127.0.0.1:8500/eureka/
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8510/eureka/
 server:
-  port: 8580
+  port: 8640
   tomcat:
     uri-encoding: UTF-8
+management:
+  endpoints:
+    web:
+      exposure:
+        include: "*"
+  endpoint:
+    health:
+      show-details: always
+    shutdown:
+      enabled: true
+    restart:
+      enabled: true
 info:
   name: '@project.artifactId@'
   description: '@project.description@'
@@ -37,4 +76,16 @@ info:
   spring-cloud-version: '@spring.cloud.version@'
 mybatis:
   type-aliases-package: com.usoftchina.saas.file.po
-  mapper-locations: classpath:mapper/*.xml
+  mapper-locations: classpath:mapper/*.xml
+auth:
+  public-key: auth/pub.key
+fdfs:
+  so-timeout: 1500
+  connect-timeout: 600
+  thumb-image:
+    width: 150
+    height: 150
+  tracker-list:
+    - 192.168.253.3:22122
+file:
+  base-url: http://192.168.253.3:8888/

+ 0 - 15
base-servers/file/file-server/src/main/resources/banner.txt

@@ -1,15 +0,0 @@
-${AnsiColor.BRIGHT_YELLOW}
-
-88        88   ad88888ba     ,ad8888ba,    88888888888  888888888888  ,ad8888ba,   88        88  88  888b      88         db
-88        88  d8"     "8b   d8"'    `"8b   88                88      d8"'    `"8b  88        88  88  8888b     88        d88b
-88        88  Y8,          d8'        `8b  88                88     d8'            88        88  88  88 `8b    88       d8'`8b
-88        88  `Y8aaaaa,    88          88  88aaaaa           88     88             88aaaaaaaa88  88  88  `8b   88      d8'  `8b
-88        88    `"""""8b,  88          88  88"""""           88     88             88""""""""88  88  88   `8b  88     d8YaaaaY8b
-88        88          `8b  Y8,        ,8P  88                88     Y8,            88        88  88  88    `8b 88    d8""""""""8b
-Y8a.    .a8P  Y8a     a8P   Y8a.    .a8P   88                88      Y8a.    .a8P  88        88  88  88     `8888   d8'        `8b
- `"Y8888Y"'    "Y88888P"     `"Y8888Y"'    88                88       `"Y8888Y"'   88        88  88  88      `888  d8'          `8b
-
-
-Application Version: ${application.version}${application.formatted-version}
-Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
-${AnsiColor.DEFAULT}

+ 12 - 0
base-servers/file/file-server/src/main/resources/config/application-docker-dev.yml

@@ -0,0 +1,12 @@
+eureka:
+  instance:
+    hostname: saas-file-server-dev
+    prefer-ip-address: false
+  client:
+    serviceUrl:
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@saas-eureka-server-dev:8510/eureka/
+spring:
+  rabbitmq:
+    virtual-host: dev
+server:
+  port: 8650

+ 10 - 0
base-servers/file/file-server/src/main/resources/config/application-docker.yml

@@ -0,0 +1,10 @@
+eureka:
+  instance:
+    hostname: saas-file-server
+    prefer-ip-address: false
+  client:
+    serviceUrl:
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@saas-eureka-server:8500/eureka/
+spring:
+  rabbitmq:
+    virtual-host: docker

+ 58 - 9
base-servers/file/file-server/src/main/resources/logback-spring.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
-    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
+    <include resource="org/springframework/boot/logging/logback/base.xml" />
     <jmxConfigurator/>
 
     <!--
@@ -28,10 +28,10 @@
     <springProperty scope="context" name="spring.profiles.active" source="spring.profiles.active" defaultValue="dev"/>
     <springProperty scope="context" name="common-pattern" source="logging.common-pattern" defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS}:[%5p] [%t:%r] [%C{1}:%M:%L] --> %m%n"/>
     <springProperty scope="context" name="log.level.console" source="logging.level.console" defaultValue="INFO"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.253.3:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 
-
     <appender name="CONSOLE_APPENDER" class="ch.qos.logback.core.ConsoleAppender">
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
             <level>${log.level.console}</level>
@@ -44,11 +44,9 @@
     <appender name="ROOT_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
         <file>${log.path}/root.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <!-- 每天一归档 -->
             <fileNamePattern>${log.path}/%d{yyyy-MM}/root-%d{yyyy-MM-dd}-%i.log.gz</fileNamePattern>
-            <!-- 单个日志文件最多 100MB, 60天的日志周期,最大不能超过20GB -->
             <maxFileSize>128MB</maxFileSize>
-            <maxHistory>60</maxHistory>
+            <maxHistory>7</maxHistory>
             <totalSizeCap>20GB</totalSizeCap>
         </rollingPolicy>
         <encoder>
@@ -56,9 +54,60 @@
         </encoder>
     </appender>
 
-    <root level="${log.level.console}">
-        <appender-ref ref="CONSOLE_APPENDER"/>
-        <appender-ref ref="ROOT_APPENDER"/>
-    </root>
+    <!-- Appender to log in a JSON format -->
+    <appender name="JSON_APPENDER" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
+        <destination>${log.destination}</destination>
+        <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
+            <providers>
+                <pattern>
+                    <pattern>
+                        {
+                        "severity": "%level",
+                        "service": "${spring.application.name:-}",
+                        "trace": "%X{X-B3-TraceId:-}",
+                        "span": "%X{X-B3-SpanId:-}",
+                        "parent": "%X{X-B3-ParentSpanId:-}",
+                        "exportable": "%X{X-Span-Export:-}",
+                        "pid": "${PID:-}",
+                        "thread": "%thread",
+                        "class": "%logger{40}",
+                        "rest": "%message"
+                        }
+                    </pattern>
+                </pattern>
+            </providers>
+        </encoder>
+    </appender>
+
+    <logger name="org.springframework" level="INFO"/>
+    <logger name="com.usoftchina.saas" level="INFO"/>
+
+    <springProfile name="dev">
+        <root level="INFO">
+            <appender-ref ref="CONSOLE_APPENDER"/>
+        </root>
+    </springProfile>
+
+    <springProfile name="test">
+        <root level="INFO">
+            <appender-ref ref="CONSOLE_APPENDER"/>
+            <appender-ref ref="ROOT_APPENDER"/>
+        </root>
+    </springProfile>
+
+    <springProfile name="docker">
+        <logger name="org.springframework" level="WARN"/>
+        <logger name="com.usoftchina.saas" level="WARN"/>
+        <root level="WARN">
+            <appender-ref ref="CONSOLE_APPENDER"/>
+            <appender-ref ref="JSON_APPENDER"/>
+        </root>
+    </springProfile>
+
+    <springProfile name="docker-dev">
+        <root level="INFO">
+            <appender-ref ref="CONSOLE_APPENDER"/>
+        </root>
+    </springProfile>
 
 </configuration>

+ 219 - 0
base-servers/file/file-server/src/main/resources/mapper/FileInfoMapper.xml

@@ -0,0 +1,219 @@
+<?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.file.mapper.FileInfoMapper">
+
+    <insert id="insert" parameterType="com.usoftchina.saas.file.po.FileInfo"
+            useGeneratedKeys="true" keyProperty="id">
+        insert into f_fileinfo(folder_id,name,full_path,mime,ext,type,size,company_id,
+        creator_id,create_time,updater_id,update_time,deleted,deleter_id,delete_time)
+        values (#{folderId,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{fullPath,jdbcType=VARCHAR},
+        #{mime,jdbcType=VARCHAR},#{ext,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR},#{size,jdbcType=BIGINT},
+        #{companyId,jdbcType=BIGINT},#{creatorId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},
+        #{updaterId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP},#{deleted,jdbcType=BOOLEAN},
+        #{deleterId,jdbcType=BIGINT},#{deleteTime,jdbcType=TIMESTAMP})
+    </insert>
+    <insert id="insertSelective" parameterType="com.usoftchina.saas.file.po.FileInfo"
+            useGeneratedKeys="true" keyProperty="id">
+        insert into ac_account
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="folderId != null">
+                folder_id,
+            </if>
+            <if test="name != null">
+                name,
+            </if>
+            <if test="fullPath != null">
+                full_path,
+            </if>
+            <if test="mime != null">
+                mime,
+            </if>
+            <if test="ext != null">
+                ext,
+            </if>
+            <if test="type != null">
+                type,
+            </if>
+            <if test="size != null">
+                size,
+            </if>
+            <if test="companyId != null">
+                company_id,
+            </if>
+            <if test="creatorId != null">
+                creator_id,
+            </if>
+            <if test="createTime != null">
+                create_time,
+            </if>
+            <if test="updaterId != null">
+                updater_id,
+            </if>
+            <if test="updateTime != null">
+                update_time,
+            </if>
+            <if test="deleted != null">
+                deleted,
+            </if>
+            <if test="deleterId != null">
+                deleter_id,
+            </if>
+            <if test="deleteTime != null">
+                delete_time,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="folderId != null">
+                #{folder_id,jdbcType=BIGINT},
+            </if>
+            <if test="name != null">
+                #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="fullPath != null">
+                #{full_path,jdbcType=VARCHAR},
+            </if>
+            <if test="mime != null">
+                #{mime,jdbcType=VARCHAR},
+            </if>
+            <if test="ext != null">
+                #{ext,jdbcType=VARCHAR},
+            </if>
+            <if test="type != null">
+                #{type,jdbcType=VARCHAR},
+            </if>
+            <if test="size != null">
+                #{size,jdbcType=BIGINT},
+            </if>
+            <if test="companyId != null">
+                #{company_id,jdbcType=BIGINT},
+            </if>
+            <if test="creatorId != null">
+                #{creatorId,jdbcType=BIGINT},
+            </if>
+            <if test="createTime != null">
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updaterId != null">
+                #{updaterId,jdbcType=BIGINT},
+            </if>
+            <if test="updateTime != null">
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="deleted != null">
+                #{deleted,jdbcType=BOOLEAN},
+            </if>
+            <if test="deleterId != null">
+                #{deleter_id,jdbcType=BIGINT},
+            </if>
+            <if test="deleteTime != null">
+                #{delete_time,jdbcType=TIMESTAMP},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.file.po.FileInfo">
+        update f_fileinfo set
+        folder_id=#{folderId,jdbcType=BIGINT},name=#{name,jdbcType=VARCHAR},full_path=#{fullPath,jdbcType=VARCHAR},
+        mime=#{mime,jdbcType=VARCHAR},ext=#{ext,jdbcType=VARCHAR},type=#{type,jdbcType=VARCHAR},
+        size=#{size,jdbcType=BIGINT},company_id=#{companyId,jdbcType=BIGINT},
+        creator_id=#{creatorId,jdbcType=BIGINT},create_time=#{createTime,jdbcType=TIMESTAMP},
+        updater_id=#{updaterId,jdbcType=BIGINT},update_time=#{updateTime,jdbcType=TIMESTAMP},
+        deleted=#{deleted,jdbcType=BOOLEAN},deleter_id=#{deleterId,jdbcType=BIGINT},
+        delete_time=#{deleteTime,jdbcType=TIMESTAMP} where id=#{id,jdbcType=BIGINT}
+    </update>
+    <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.file.po.FileInfo">
+        update f_fileinfo
+        <set>
+            <if test="folderId != null">
+                folder_id=#{folderId,jdbcType=BIGINT},
+            </if>
+            <if test="name != null">
+                name=#{name,jdbcType=VARCHAR},
+            </if>
+            <if test="fullPath != null">
+                full_path=#{fullPath,jdbcType=VARCHAR},
+            </if>
+            <if test="mime != null">
+                mime=#{mime,jdbcType=VARCHAR},
+            </if>
+            <if test="ext != null">
+                ext=#{ext,jdbcType=VARCHAR},
+            </if>
+            <if test="type != null">
+                type=#{type,jdbcType=VARCHAR},
+            </if>
+            <if test="size != null">
+                size=#{size,jdbcType=BIGINT},
+            </if>
+            <if test="companyId != null">
+                company_id=#{companyId,jdbcType=BIGINT},
+            </if>
+            <if test="creatorId != null">
+                creator_id=#{creatorId,jdbcType=BIGINT},
+            </if>
+            <if test="createTime != null">
+                create_time=#{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updaterId != null">
+                updater_id=#{updaterId,jdbcType=BIGINT},
+            </if>
+            <if test="updateTime != null">
+                update_time=#{updateTime,jdbcType=TIMESTAMP})
+            </if>
+            <if test="deleted != null">
+                deleted=#{deleted,jdbcType=BOOLEAN},
+            </if>
+            <if test="deleterId != null">
+                deleter_id=#{deleterId,jdbcType=BIGINT},
+            </if>
+            <if test="deleteTime != null">
+                delete_time=#{deleteTime,jdbcType=TIMESTAMP})
+            </if>
+        </set>
+        where id=#{id,jdbcType=BIGINT}
+    </update>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+        delete from f_fileinfo where id=#{id}
+    </delete>
+
+    <resultMap id="BaseResultMap" type="com.usoftchina.saas.file.po.FileInfo">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="folder_id" jdbcType="BIGINT" property="folderId"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="full_path" jdbcType="VARCHAR" property="fullPath"/>
+        <result column="mime" jdbcType="VARCHAR" property="mime"/>
+        <result column="ext" jdbcType="VARCHAR" property="ext"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="size" jdbcType="BIGINT" property="size"/>
+        <result column="company_id" jdbcType="INTEGER" property="companyId"/>
+        <result column="creator_id" jdbcType="BIGINT" property="creatorId"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="updater_id" jdbcType="BIGINT" property="updaterId"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="deleted" jdbcType="BOOLEAN" property="deleted"/>
+        <result column="deleter_id" jdbcType="BIGINT" property="deleterId"/>
+        <result column="delete_time" jdbcType="TIMESTAMP" property="deleteTime"/>
+    </resultMap>
+    <sql id="baseColumns">
+        f_fileinfo.id,f_fileinfo.folder_id,f_fileinfo.name,f_fileinfo.full_path,f_fileinfo.mime,f_fileinfo.ext,
+        f_fileinfo.type,f_fileinfo.size,f_fileinfo.company_id,f_fileinfo.creator_id,f_fileinfo.create_time,
+        f_fileinfo.updater_id,f_fileinfo.update_time,f_fileinfo.deleted,f_fileinfo.deleter_id,f_fileinfo.delete_time
+    </sql>
+
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from f_fileinfo where id=#{id}
+    </select>
+    <select id="selectByFullPath" parameterType="java.lang.String" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from f_fileinfo where full_path=#{fullPath}
+    </select>
+    <select id="selectByFolderId" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from f_fileinfo where folder_id=#{folderId} order by id
+    </select>
+    <select id="selectVisibleByFolderId" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from f_fileinfo where folder_id=#{folderId}
+        and deleted=false order by id
+    </select>
+    <select id="selectDeletedByFolderId" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from f_fileinfo where folder_id=#{folderId}
+        and deleted=true order by id
+    </select>
+</mapper>

+ 0 - 5
base-servers/file/file-server/src/main/resources/mapper/FilePoMapper.xml

@@ -1,5 +0,0 @@
-<?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.file.mapper.FileMapper">
-
-</mapper>

+ 104 - 0
base-servers/file/file-server/src/test/java/com/usoftchina/saas/file/controller/FileControllerTest.java

@@ -0,0 +1,104 @@
+package com.usoftchina.saas.file.controller;
+
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.file.dto.FileInfoDTO;
+import com.usoftchina.saas.file.dto.FolderDTO;
+import com.usoftchina.saas.file.util.RandomTextFile;
+import com.usoftchina.saas.test.BaseControllerTest;
+import org.apache.commons.lang.RandomStringUtils;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MvcResult;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class FileControllerTest extends BaseControllerTest {
+
+    public static Long folder_1;
+    public static Long folder_1_1;
+    public static Long folder_1_1_1;
+    public static Long file_1_1_1_1;
+    public static Long folder_1_2;
+    public static Long folder_1_2_1;
+
+    private FolderDTO newFolder(Long folderId, String name) throws Exception{
+        MvcResult mvcResult = mockMvc.perform(post("/folder")
+                .param("folderId", String.valueOf(folderId))
+                .param("name", name))
+                .andExpect(isSuccess())
+                .andReturn();
+        Result<FolderDTO> result = result(mvcResult, FolderDTO.class);
+        return result.getData();
+    }
+
+    @Test
+    public void testA_folder() throws Exception {
+        folder_1 = newFolder(0L, "项目").getId();
+
+        folder_1_1 = newFolder(folder_1, "采购").getId();
+        folder_1_1_1 = newFolder(folder_1_1, "报表").getId();
+
+        folder_1_2 = newFolder(folder_1, "销售").getId();
+        folder_1_2_1 = newFolder(folder_1_2, "报表").getId();
+    }
+
+    @Test
+    public void testB_upload() throws Exception {
+        MockMultipartFile file = new MockMultipartFile("file", "test.txt",
+                "text/plain", RandomStringUtils.random(32).getBytes());
+        MvcResult mvcResult = mockMvc.perform(multipart("/upload")
+                .file(file)
+                .param("folderId", String.valueOf(folder_1_1_1)))
+                .andExpect(isSuccess())
+                .andReturn();
+        Result<FileInfoDTO> result = result(mvcResult, FileInfoDTO.class);
+        file_1_1_1_1 = result.getData().getId();
+    }
+
+    @Test
+    public void testE_getFileInfo() throws Exception {
+        mockMvc.perform(get("/info/" + file_1_1_1_1)).andExpect(isSuccess());
+    }
+
+    @Test
+    public void testF_listFiles() throws Exception {
+        mockMvc.perform(get("/list")).andExpect(isSuccess());
+    }
+
+    @Test
+    public void testG_delete() throws Exception {
+        mockMvc.perform(get("/delete/" + folder_1)).andExpect(isSuccess());
+    }
+
+    @Test
+    public void testH_restore() throws Exception {
+        mockMvc.perform(get("/restore/" + folder_1)).andExpect(isSuccess());
+    }
+
+    @Test
+    public void testI_move() throws Exception {
+        mockMvc.perform(get("/move")
+                .param("fileId", String.valueOf(file_1_1_1_1))
+                .param("folderId", String.valueOf(folder_1_2_1)))
+                .andExpect(isSuccess());
+    }
+
+    /**
+     * 最后清除测试数据
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testZ_purge() throws Exception {
+        mockMvc.perform(get("/delete/" + folder_1)
+                .param("purge", "true"))
+                .andExpect(isSuccess());
+    }
+
+}

+ 50 - 0
base-servers/file/file-server/src/test/java/com/usoftchina/saas/file/util/RandomTextFile.java

@@ -0,0 +1,50 @@
+package com.usoftchina.saas.file.util;
+
+import org.apache.commons.lang.RandomStringUtils;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+/**
+ * @author yingp
+ * @date 2018/11/9
+ */
+public class RandomTextFile {
+    private String text;
+
+    private InputStream inputStream;
+
+    private long fileSize;
+
+    private String fileExtName = "text";
+
+    public RandomTextFile() {
+        this(RandomStringUtils.random(30));
+    }
+
+    public RandomTextFile(String text) {
+        this.text = text;
+        this.fileSize = text.getBytes().length;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public InputStream getInputStream() {
+        this.inputStream = new ByteArrayInputStream(text.getBytes());
+        return inputStream;
+    }
+
+    public long getFileSize() {
+        return fileSize;
+    }
+
+    public String getFileExtName() {
+        return fileExtName;
+    }
+
+    public byte[] toByte() {
+        return this.text.getBytes();
+    }
+}

+ 5 - 7
framework/core/src/main/java/com/usoftchina/saas/exception/ExceptionCode.java

@@ -43,13 +43,11 @@ public enum ExceptionCode implements BaseExceptionCode {
     MISSING_PERMISSIONS(53030, "权限缺失"),
 
     // 文件相关
-    FOLDER_NULL(55000, "文件夹为空"),
-    FOLDER_NAME_EMPTY(55001, "文件夹名称为空"),
-    FOLDER_PARENT_NULL(55002, "父文件夹为空"),
-
-    FILE_NULL(55500, "文件为空"),
-    FILE_NAME_EMPTY(55501, "文件名称为空"),
-    FILE_FOLDER_NULL(55502, "文件夹为空"),
+    FOLDER_NOT_EXISTS(55000, "文件夹不存在"),
+    FOLDER_INVALID(55001, "无效文件夹"),
+    FOLDER_NAME_EMPTY(55002, "文件夹名称为空"),
+    FILE_NOT_EXISTS(55500, "文件不存在"),
+    FILE_NOT_FOLDER(55501, "不是文件夹"),
 
     TURNIN_EXIST(60000,"已入库"),
     TURNINNUM_NOT_EXIST(60001,"无可转数"),

+ 8 - 0
framework/core/src/main/java/com/usoftchina/saas/utils/BizAssert.java

@@ -21,6 +21,14 @@ public class BizAssert {
         }
     }
 
+    public static void equals(Object object1, Object object2, BaseExceptionCode code) {
+        boolean equals = (null == object1 && null == object2) ||
+                (null != object1 && object1.equals(object2));
+        if (!equals) {
+            throw new BizException(code);
+        }
+    }
+
     public static void hasText(String text, BaseExceptionCode code) {
         if (!StringUtils.hasText(text)) {
             throw new BizException(code);

+ 10 - 0
framework/core/src/main/java/com/usoftchina/saas/utils/StringUtils.java

@@ -15,4 +15,14 @@ public abstract class StringUtils extends org.springframework.util.StringUtils{
     public static String nullIf(String target, String nullValue) {
         return (null == target || target.isEmpty()) ? nullValue : target;
     }
+
+    /**
+     * 为空取空字符串
+     *
+     * @param target
+     * @return
+     */
+    public static String nullIf(String target) {
+        return nullIf(target, "");
+    }
 }

+ 23 - 0
framework/test-starter/src/main/java/com.usoftchina.saas.test/BaseControllerTest.java

@@ -5,11 +5,13 @@ import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.utils.JsonUtils;
 import org.junit.Before;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
 import org.springframework.http.MediaType;
 import org.springframework.test.web.servlet.MockMvc;
 import org.springframework.test.web.servlet.MvcResult;
 import org.springframework.test.web.servlet.ResultMatcher;
 import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
+import org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder;
 import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
 import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 import org.springframework.web.context.WebApplicationContext;
@@ -56,6 +58,27 @@ public abstract class BaseControllerTest {
         return MockMvcRequestBuilders.post(urlTemplate, uriVars);
     }
 
+    /**
+     * 文件上传
+     *
+     * @param urlTemplate
+     * @param uriVars
+     * @return
+     */
+    public static MockMultipartHttpServletRequestBuilder multipart(String urlTemplate, Object... uriVars) {
+        return MockMvcRequestBuilders.multipart(urlTemplate, uriVars);
+    }
+
+    /**
+     * 请求
+     *
+     * @param urlTemplate
+     * @return
+     */
+    public static MockHttpServletRequestBuilder request(HttpMethod method, String urlTemplate, Object... uriVars) {
+        return MockMvcRequestBuilders.request(method, urlTemplate, uriVars);
+    }
+
     /**
      * POST Payload方式请求,使用@RequestBody注解情况下
      *

+ 200 - 0
frontend/saas-web/app/Application.scss

@@ -72,4 +72,204 @@ body.launching {
 
 .boldFont {
   font-weight: bold;
+}
+
+// default font-family
+.x-body,
+.x-btn-inner,
+.x-panel-body-default,
+.x-toolbar-text-default,
+.x-form-item-label-default,
+.x-form-text-default,
+.x-column-header,
+.x-grid-item,
+.x-grid-row-summary .x-grid-cell, .x-grid-row-summary .x-grid-rowwrap, .x-grid-row-summary .x-grid-cell-rowbody,
+.x-boundlist-item {
+  // font-family: 'pingFangSC-Regular';
+}
+
+.x-form-item-label-default {
+  // font-family: PingFangSC-Medium;
+  font-size: 14px;
+  color: #505363;
+  text-align: right;
+  line-height: 20px;
+}
+
+// toolbar button
+.x-btn-default-toolbar-small {
+  color: #fff;
+  background-color: #308ee0;
+  border-color: #308ee0;
+  min-width: 86px;
+  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
+
+  .x-btn-inner-default-toolbar-small {
+    color: #FFFFFF;
+  }
+}
+
+.x-form-item-default.x-form-readonly {
+  opacity: 1;
+
+  .x-form-item-label-default {
+    color: #8C97B2;
+  }
+
+  .x-form-text-default {
+    background: #EEF1F7;
+  }
+  .x-form-trigger {
+    background: #EEF1F7;
+  }
+}
+
+.x-btn.x-btn-menu-active.x-btn-default-toolbar-small,
+.x-btn.x-btn-pressed.x-btn-default-toolbar-small,
+.x-btn-over.x-btn-default-toolbar-small {
+  background: #34BAF6;
+  opacity: 0.72;
+}
+
+.x-keyboard-mode .x-btn-focus.x-btn-default-toolbar-small {
+  background: #34BAF6;
+  opacity: 0.72;
+  box-shadow: none;
+}
+.x-keyboard-mode .x-btn-focus.x-btn-over.x-btn-default-toolbar-small {
+  box-shadow: none;
+}
+
+.x-btn-wrap-default-toolbar-small.x-btn-arrow-right:after {
+  color: #FFFFFF;
+}
+
+.x-btn.x-btn-disabled.x-btn-default-toolbar-small {
+  border-color: #E6E6E6;
+  background: #E6E6E6;
+
+  .x-btn-inner-default-toolbar-small {
+    color: #606060;
+  }
+}
+
+
+.x-btn-default-toolbar-small{
+  border-radius: 2px !important;
+}
+
+.x-formpanel-btn-orange {
+  border-color: #f67f00;
+  background: linear-gradient(to bottom,#da7101 0,#f67f00 100%) !important;
+  
+  .x-btn-inner-default-toolbar-small{
+      color:#fff !important;
+  }
+}
+
+.x-formpanel-btn-blue {
+  border-color: #346fb9;
+  background: linear-gradient(to bottom,#3876c3 0,#346fb9 100%) !important;
+
+  .x-btn-inner-default-toolbar-small{
+      color:#fff !important;
+  }
+}
+
+.x-grid-body {
+  border-width: 1px;
+  border-color: #ABDAFF;
+}
+
+.x-column-header {
+  background: #E5F7FF;
+  border-right: 1px solid #ABDAFF;
+}
+
+.x-column-header-text-inner {
+  font-size: 14px;
+  color: #505363;
+  letter-spacing: 0;
+  text-align: center;
+  line-height: 20px;
+  // font-family: PingFangSC-Medium;
+  font-weight: normal;
+}
+
+.x-panel-default-outer-border-trbl {
+  border-color: #ABDAFF !important;
+}
+
+.x-form-trigger-wrap-default {
+  border-color: #CACFE1;
+  border-radius: 2px;
+}
+
+.x-form-trigger-default {
+  color: #5E5E5E;
+}
+
+.x-grid-header-ct {
+  border-top-color: #ABDAFF;
+  border-top-width: 1px;
+}
+
+.x-panel-default-outer-border-rl {
+  border-right-color: #ABDAFF;
+  border-right-width: 1px;
+  border-left-color: #ABDAFF;
+  border-left-width: 1px;
+}
+
+.x-grid-item-alt {
+  background-color: #F1F9FF;
+}
+
+.x-grid-locked .x-grid-inner-locked {
+  border-width: 0 1px 0 0;
+}
+
+.x-grid-scrollbar-clipper-locked, .x-grid-scrollbar-locked {
+  border-right-color: #ABDAFF;
+}
+
+.x-grid-inner-locked {
+  border-right-color: #ABDAFF;
+}
+
+.x-grid-with-row-lines .x-grid-item:first-child {
+  border-color: #ffffff;
+}
+
+.x-grid-with-row-lines .x-grid-item {
+  border-color: #ABDAFF;
+}
+
+.x-grid-item-over {
+  background-color: #bde5f7;
+}
+
+.x-grid-cell-special {
+  border-color: #ABDAFF;
+}
+
+
+
+/*滚动条样式*/
+div::-webkit-scrollbar {
+  width: 10px;
+  height: 10px;
+}
+div::-webkit-scrollbar-thumb {
+  background: #C2EAFC;
+  border-radius: 8px;
+
+  &:hover {
+    background: #74c3e6;
+  }
+}
+div::-webkit-scrollbar-track {
+  background: #fff;
+  border: 1px solid #e5e5e5;
+  border-radius: 8px;
 }

+ 17 - 6
frontend/saas-web/app/util/FormUtil.js

@@ -170,6 +170,7 @@ Ext.define('saas.util.FormUtil', {
             me.loadData(form);
         })
         .catch(function(response) {
+            showToast('错误:' + response.message);
             console.error(response);
         });
 
@@ -226,15 +227,14 @@ Ext.define('saas.util.FormUtil', {
                         var o = {};
                         o[form._codeField] = code;
 
-                        var formData = {
-                            main: o
-                        };
+                        var formData = {main: {}};
+                        Ext.apply(formData.main, o);
                         Ext.Array.each(detailGrids, function(grid, index) {
                             var detno = 0;
                             var detnoColumn = grid.detnoColumn;
                             var datas = [];
                             
-                            Ext.Array.each(new Array(10), function() {
+                            Ext.Array.each(new Array(5), function() {
                                 detno += 1;
                                 var data = {};
                                 data[detnoColumn] = detno;
@@ -243,10 +243,21 @@ Ext.define('saas.util.FormUtil', {
                             formData['detail' + index] = datas;
                         });
 
-                        form.initFormData(formData);
+                        return formData;
+                    }else {
+                        throw new Error('请求单据编号错误');
                     }
                 }
-            }).catch(function() {
+            }).then(function(formData) {
+                var initData = form.initData;
+                if(initData) {
+                    Ext.apply(initData.main, formData.main);
+                    form.setFormData(initData);
+                }else {
+                    form.initFormData(formData);
+                }
+            }).catch(function(res) {
+                showToast(res.message);
                 form.setLoading(false);
             })
         }

+ 1 - 1
frontend/saas-web/app/view/core/form/ConDateField.js

@@ -21,7 +21,7 @@ Ext.define('saas.view.core.form.ConDateField', {
             width: 100,
             editable: false,
             hidden: !me.showscope,
-            fieldStyle: 'background:#C1CDC1',
+            fieldStyle: 'background:#eef1f7',
             store: Ext.create('Ext.data.Store', {
                 fields: ['display', 'value'],
                 data : [

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