rainco 7 years ago
parent
commit
e4d5b3cd66
100 changed files with 3277 additions and 264 deletions
  1. 1 1
      applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MaxnumberService.java
  2. 2 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  3. 148 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Bom.java
  4. 136 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/BomDetail.java
  5. 26 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/BomList.java
  6. 1 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/DocumentApplication.java
  7. 41 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/BomController.java
  8. 25 8
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CustomerController.java
  9. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/FundinouttypeController.java
  10. 4 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java
  11. 26 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BomDetailMapper.java
  12. 25 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BomMapper.java
  13. 48 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/BomService.java
  14. 4 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CustomerService.java
  15. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/VendorService.java
  16. 0 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/AddressServiceImpl.java
  17. 124 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BomServiceImpl.java
  18. 57 22
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java
  19. 15 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorServiceImpl.java
  20. 0 1
      applications/document/document-server/src/main/resources/application.yml
  21. 396 0
      applications/document/document-server/src/main/resources/mapper/BomDetailMapper.xml
  22. 251 0
      applications/document/document-server/src/main/resources/mapper/BomMapper.xml
  23. 1 1
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  24. 51 0
      applications/document/document-server/src/test/java/com/usoftchina/saas/document/mapper/CustomerMapperTest.java
  25. 0 4
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/ProdIODetailMapper.java
  26. 0 5
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/ProdInOutMapper.java
  27. 1 58
      applications/purchase/purchase-server/src/main/resources/mapper/ProdIODetailMapper.xml
  28. 0 24
      applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutMapper.xml
  29. 4 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java
  30. 5 6
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java
  31. 37 4
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  32. 11 0
      applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml
  33. 28 0
      base-servers/account/README.md
  34. 4 0
      base-servers/account/account-dto/pom.xml
  35. 48 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/constant/ResourceClassify.java
  36. 26 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/constant/RoleType.java
  37. 100 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/ResourceDTO.java
  38. 169 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/ResourceGroupDTO.java
  39. 49 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/ResourceModuleDTO.java
  40. 0 10
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/ResourcesDTO.java
  41. 75 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/RoleDTO.java
  42. 57 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/RoleSaveDTO.java
  43. 67 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/RoleUpdateDTO.java
  44. 57 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/UrlResourceDTO.java
  45. 5 5
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/AccountController.java
  46. 47 5
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/CompanyController.java
  47. 0 8
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/ResourceController.java
  48. 56 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/ResourcesController.java
  49. 115 1
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/RoleController.java
  50. 12 2
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/AccountCompanyMapper.java
  51. 7 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/AccountRoleMapper.java
  52. 33 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/CompanyAppMapper.java
  53. 10 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/CompanyMapper.java
  54. 21 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/ResourceGroupMapper.java
  55. 29 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/ResourceMapper.java
  56. 20 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/ResourceModuleMapper.java
  57. 0 11
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/ResourcesMapper.java
  58. 10 1
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/RoleResourceMapper.java
  59. 31 36
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/Resource.java
  60. 40 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/ResourceGroup.java
  61. 40 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/ResourceModule.java
  62. 13 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/Role.java
  63. 24 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/CompanyService.java
  64. 29 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/ResourceService.java
  65. 28 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/RoleService.java
  66. 2 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/AccountServiceImpl.java
  67. 27 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/CompanyServiceImpl.java
  68. 104 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/ResourceServiceImpl.java
  69. 58 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/RoleServiceImpl.java
  70. 17 2
      base-servers/account/account-server/src/main/resources/application.yml
  71. 3 0
      base-servers/account/account-server/src/main/resources/mapper/AccountCompanyMapper.xml
  72. 3 0
      base-servers/account/account-server/src/main/resources/mapper/AccountRoleMapper.xml
  73. 13 0
      base-servers/account/account-server/src/main/resources/mapper/CompanyAppMapper.xml
  74. 7 4
      base-servers/account/account-server/src/main/resources/mapper/CompanyMapper.xml
  75. 15 0
      base-servers/account/account-server/src/main/resources/mapper/ResourceGroupMapper.xml
  76. 24 0
      base-servers/account/account-server/src/main/resources/mapper/ResourceMapper.xml
  77. 15 0
      base-servers/account/account-server/src/main/resources/mapper/ResourceModuleMapper.xml
  78. 0 4
      base-servers/account/account-server/src/main/resources/mapper/ResourcesMapper.xml
  79. 98 1
      base-servers/account/account-server/src/main/resources/mapper/RoleMapper.xml
  80. 3 0
      base-servers/account/account-server/src/main/resources/mapper/RoleResourceMapper.xml
  81. 1 2
      base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/controller/AccountControllerTest.java
  82. 32 5
      base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/controller/CompanyControllerTest.java
  83. 33 0
      base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/controller/ResourcesControllerTest.java
  84. 47 0
      base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/service/ResourceServiceTest.java
  85. 1 0
      base-servers/auth/auth-client/src/main/java/com/usoftchina/saas/auth/client/interceptor/AuthRestInterceptor.java
  86. 2 0
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/jwt/JwtHelper.java
  87. 11 1
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/jwt/JwtInfo.java
  88. 1 1
      base-servers/auth/auth-server/src/main/java/com/usoftchina/saas/auth/controller/AuthController.java
  89. 4 0
      framework/core/src/main/java/com/usoftchina/saas/constant/CommonConstants.java
  90. 9 0
      framework/core/src/main/java/com/usoftchina/saas/context/BaseContextHolder.java
  91. 1 0
      framework/core/src/main/java/com/usoftchina/saas/exception/ExceptionCode.java
  92. 13 11
      framework/core/src/main/java/com/usoftchina/saas/utils/CollectionUtils.java
  93. 1 1
      framework/core/src/main/java/com/usoftchina/saas/utils/ObjectUtils.java
  94. 1 1
      framework/core/src/main/java/com/usoftchina/saas/utils/StringUtils.java
  95. 4 4
      framework/test-starter/src/main/java/com.usoftchina.saas.test/BaseControllerTest.java
  96. 10 0
      framework/test-starter/src/main/java/com.usoftchina.saas.test/TestConstant.java
  97. 1 0
      framework/test-starter/src/main/java/com.usoftchina.saas.test/TestContextListener.java
  98. 10 2
      frontend/saas-web/Readme.md
  99. 13 0
      frontend/saas-web/app/model/document/vendorcontact.js
  100. 1 0
      frontend/saas-web/app/model/purchase/prodIODetail.js

+ 1 - 1
applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MaxnumberService.java

@@ -28,6 +28,6 @@ public interface MaxnumberService {
      * @Author: guq
      * @Date: 2018/10/22
      */
-    @PostMapping("/numnber/getMaxnumber")
+    @PostMapping("/number/getMaxnumber")
     public Result<String> getMaxnumber(@RequestParam("caller") String caller, @RequestParam("update") boolean update);
 }

+ 2 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -21,7 +21,8 @@ public enum BizExceptionCode implements BaseExceptionCode {
     NULL_CODERULE(79100, "单据规则不存在,请先确定单据生成规则"),
     CODE_EXISTS(79200, "单据编号已存在"),
     BIZ_CLOSE(79301, "只能关闭已审核的单据"),
-    BIZ_OPEN(79002, "只能打开已关闭的单据"),
+    BIZ_OPEN(79302, "只能打开已关闭的单据"),
+    BOM_SAVE(79401, "产品编号+版本号已存在"),
     NO_DATA(79998, "未找到数据"),
     ILLEGAL_ID(79999, "id不正确"),
 

+ 148 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Bom.java

@@ -0,0 +1,148 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class Bom extends CommonBaseEntity implements Serializable {
+    private Integer bo_motherid;
+
+    private String bo_mothercode;
+
+    private String bo_mothername;
+
+    private String bo_version;
+
+    private String bo_status;
+
+    private String bo_statuscode;
+
+    private Integer bo_recorderid;
+
+    private String bo_recorder;
+
+    private Date bo_recorddate;
+
+    private String bo_text1;
+
+    private String bo_text2;
+
+    private String bo_text3;
+
+    private String bo_text4;
+
+    private String bo_text5;
+
+    public Integer getBo_motherid() {
+        return bo_motherid;
+    }
+
+    public void setBo_motherid(Integer bo_motherid) {
+        this.bo_motherid = bo_motherid;
+    }
+
+    public String getBo_mothercode() {
+        return bo_mothercode;
+    }
+
+    public void setBo_mothercode(String bo_mothercode) {
+        this.bo_mothercode = bo_mothercode == null ? null : bo_mothercode.trim();
+    }
+
+    public String getBo_mothername() {
+        return bo_mothername;
+    }
+
+    public void setBo_mothername(String bo_mothername) {
+        this.bo_mothername = bo_mothername == null ? null : bo_mothername.trim();
+    }
+
+    public String getBo_version() {
+        return bo_version;
+    }
+
+    public void setBo_version(String bo_version) {
+        this.bo_version = bo_version == null ? null : bo_version.trim();
+    }
+
+    public String getBo_status() {
+        return bo_status;
+    }
+
+    public void setBo_status(String bo_status) {
+        this.bo_status = bo_status == null ? null : bo_status.trim();
+    }
+
+    public String getBo_statuscode() {
+        return bo_statuscode;
+    }
+
+    public void setBo_statuscode(String bo_statuscode) {
+        this.bo_statuscode = bo_statuscode == null ? null : bo_statuscode.trim();
+    }
+
+    public Integer getBo_recorderid() {
+        return bo_recorderid;
+    }
+
+    public void setBo_recorderid(Integer bo_recorderid) {
+        this.bo_recorderid = bo_recorderid;
+    }
+
+    public String getBo_recorder() {
+        return bo_recorder;
+    }
+
+    public void setBo_recorder(String bo_recorder) {
+        this.bo_recorder = bo_recorder == null ? null : bo_recorder.trim();
+    }
+
+    public Date getBo_recorddate() {
+        return bo_recorddate;
+    }
+
+    public void setBo_recorddate(Date bo_recorddate) {
+        this.bo_recorddate = bo_recorddate;
+    }
+
+    public String getBo_text1() {
+        return bo_text1;
+    }
+
+    public void setBo_text1(String bo_text1) {
+        this.bo_text1 = bo_text1 == null ? null : bo_text1.trim();
+    }
+
+    public String getBo_text2() {
+        return bo_text2;
+    }
+
+    public void setBo_text2(String bo_text2) {
+        this.bo_text2 = bo_text2 == null ? null : bo_text2.trim();
+    }
+
+    public String getBo_text3() {
+        return bo_text3;
+    }
+
+    public void setBo_text3(String bo_text3) {
+        this.bo_text3 = bo_text3 == null ? null : bo_text3.trim();
+    }
+
+    public String getBo_text4() {
+        return bo_text4;
+    }
+
+    public void setBo_text4(String bo_text4) {
+        this.bo_text4 = bo_text4 == null ? null : bo_text4.trim();
+    }
+
+    public String getBo_text5() {
+        return bo_text5;
+    }
+
+    public void setBo_text5(String bo_text5) {
+        this.bo_text5 = bo_text5 == null ? null : bo_text5.trim();
+    }
+}

+ 136 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/BomDetail.java

@@ -0,0 +1,136 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import java.io.Serializable;
+
+public class BomDetail extends CommonBaseEntity implements Serializable {
+    private Long bd_bomid;
+
+    private Integer bd_detno;
+
+    private Integer bd_sonid;
+
+    private String bd_soncode;
+
+    private String bd_unit;
+
+    private Integer bd_baseqty;
+
+    private String bd_replace;
+
+    private String bd_remark;
+
+    private String bd_text1;
+
+    private String bd_text2;
+
+    private String bd_text3;
+
+    private String bd_text4;
+
+    private String bd_text5;
+
+    public Long getBd_bomid() {
+        return bd_bomid;
+    }
+
+    public void setBd_bomid(Long bd_bomid) {
+        this.bd_bomid = bd_bomid;
+    }
+
+    public Integer getBd_detno() {
+        return bd_detno;
+    }
+
+    public void setBd_detno(Integer bd_detno) {
+        this.bd_detno = bd_detno;
+    }
+
+    public Integer getBd_sonid() {
+        return bd_sonid;
+    }
+
+    public void setBd_sonid(Integer bd_sonid) {
+        this.bd_sonid = bd_sonid;
+    }
+
+    public String getBd_soncode() {
+        return bd_soncode;
+    }
+
+    public void setBd_soncode(String bd_soncode) {
+        this.bd_soncode = bd_soncode == null ? null : bd_soncode.trim();
+    }
+
+    public String getBd_unit() {
+        return bd_unit;
+    }
+
+    public void setBd_unit(String bd_unit) {
+        this.bd_unit = bd_unit == null ? null : bd_unit.trim();
+    }
+
+    public Integer getBd_baseqty() {
+        return bd_baseqty;
+    }
+
+    public void setBd_baseqty(Integer bd_baseqty) {
+        this.bd_baseqty = bd_baseqty;
+    }
+
+    public String getBd_text1() {
+        return bd_text1;
+    }
+
+    public void setBd_text1(String bd_text1) {
+        this.bd_text1 = bd_text1 == null ? null : bd_text1.trim();
+    }
+
+    public String getBd_text2() {
+        return bd_text2;
+    }
+
+    public void setBd_text2(String bd_text2) {
+        this.bd_text2 = bd_text2 == null ? null : bd_text2.trim();
+    }
+
+    public String getBd_text3() {
+        return bd_text3;
+    }
+
+    public void setBd_text3(String bd_text3) {
+        this.bd_text3 = bd_text3 == null ? null : bd_text3.trim();
+    }
+
+    public String getBd_text4() {
+        return bd_text4;
+    }
+
+    public void setBd_text4(String bd_text4) {
+        this.bd_text4 = bd_text4 == null ? null : bd_text4.trim();
+    }
+
+    public String getBd_text5() {
+        return bd_text5;
+    }
+
+    public void setBd_text5(String bd_text5) {
+        this.bd_text5 = bd_text5 == null ? null : bd_text5.trim();
+    }
+
+    public String getBd_replace() {
+        return bd_replace;
+    }
+
+    public void setBd_replace(String bd_replace) {
+        this.bd_replace = bd_replace;
+    }
+
+    public String getBd_remark() {
+        return bd_remark;
+    }
+
+    public void setBd_remark(String bd_remark) {
+        this.bd_remark = bd_remark;
+    }
+}

+ 26 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/BomList.java

@@ -0,0 +1,26 @@
+package com.usoftchina.saas.document.entities;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class BomList implements Serializable {
+
+    private Bom main;
+    private List<BomDetail> items;
+
+    public Bom getMain() {
+        return main;
+    }
+
+    public void setMain(Bom main) {
+        this.main = main;
+    }
+
+    public List<BomDetail> getItems() {
+        return items;
+    }
+
+    public void setItems(List<BomDetail> items) {
+        this.items = items;
+    }
+}

+ 1 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/DocumentApplication.java

@@ -13,10 +13,9 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 @EnableTransactionManagement
 @EnableFeignClients("com.usoftchina.saas")
 @MapperScan("com.usoftchina.saas.document.mapper")
-public class DocumentApplication  {
+public class DocumentApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(DocumentApplication.class);
     }
-
 }

+ 41 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/BomController.java

@@ -0,0 +1,41 @@
+package com.usoftchina.saas.document.controller;
+
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.document.entities.BomList;
+import com.usoftchina.saas.document.service.BomService;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.print.Doc;
+
+@RestController
+@RequestMapping("/bom")
+public class BomController {
+
+    @Autowired
+    private BomService bomService;
+
+    @PostMapping("/save")
+    public Result saveData(@RequestBody BomList bomList){
+        return Result.success(bomService.saveData(bomList));
+    }
+
+    @PostMapping("/delete/{id}")
+    public Result delete(@PathVariable("id") Long id){
+        bomService.delete(id);
+        return Result.success();
+    }
+
+    @GetMapping("/list")
+    public Result getListDataByCondition(PageRequest page, ListReqDTO listReqDTO){
+        return Result.success(bomService.getListDataByCondition(page, listReqDTO));
+    }
+
+    @GetMapping("/getDataById")
+    public Result getDataByCondition(@PathVariable("id") Long id){
+        return Result.success(bomService.getDataById(id));
+    }
+
+}

+ 25 - 8
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CustomerController.java

@@ -97,7 +97,7 @@ public class CustomerController {
     }
 
     /**
-     * 采购订单批量删除
+     * 客户资料批量删除
      *
      * @param baseDTOs
      * @return
@@ -120,6 +120,19 @@ public class CustomerController {
         return Result.success(close);
     }
 
+
+    /**
+     * 客户资料批量删除
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchClose")
+    public Result batchClose(@RequestBody BatchDealBaseDTO baseDTOs) {
+        customerService.batchClose(baseDTOs);
+        return Result.success();
+    }
+
     /**
      * 客户资料启用
      *
@@ -132,12 +145,16 @@ public class CustomerController {
         return Result.success(open);
     }
 
-
-
-
-
-
-
-
+    /**
+     * 客户资料批量启用
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchOpen")
+    public Result batchOpen(@RequestBody BatchDealBaseDTO baseDTOs) {
+        customerService.batchOpen(baseDTOs);
+        return Result.success();
+    }
 
 }

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

@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.*;
 import java.util.List;
 
 @RestController
-@RequestMapping("/fundinoutType")
+@RequestMapping("/fundinouttype")
 public class FundinouttypeController {
 
     @Autowired

+ 4 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java

@@ -40,7 +40,7 @@ public class VendorController {
      * @param id
      * @return
      */
-    @GetMapping("/getListById/{id}")
+    @GetMapping("/getDataById/{id}")
     public Result<VendorListDTO> getDataById(@PathVariable("id") Long id){
         VendorListDTO vendorListDTO = vendorService.getListById(id);
         return Result.success(vendorListDTO);
@@ -51,9 +51,9 @@ public class VendorController {
      * @param listReqDTO
      * @return
      */
-    @GetMapping("/getListDataByCondition")
-    public Result<List<VendorList>> getListDataByCondition(ListReqDTO listReqDTO){
-        return Result.success(vendorService.getListDataByCondition(listReqDTO));
+    @GetMapping("/list")
+    public Result<PageInfo<VendorList>> getListDataByCondition(PageRequest page, ListReqDTO listReqDTO){
+        return Result.success(vendorService.getListDataByCondition(page, listReqDTO));
     }
 
     /**

+ 26 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BomDetailMapper.java

@@ -0,0 +1,26 @@
+package com.usoftchina.saas.document.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.document.entities.BomDetail;
+
+import java.util.List;
+
+public interface BomDetailMapper extends CommonBaseMapper<BomDetail> {
+    int deleteByPrimaryKey(Long bd_id);
+
+    int insert(BomDetail record);
+
+    int insertSelective(BomDetail record);
+
+    BomDetail selectByPrimaryKey(Long bd_id);
+
+    int updateByPrimaryKeySelective(BomDetail record);
+
+    int updateByPrimaryKey(BomDetail record);
+
+    void batchInsert(List<BomDetail> bomDetailList);
+
+    void batchUpdate(List<BomDetail> bomDetailList);
+
+    void deleteByFK(Long id);
+}

+ 25 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BomMapper.java

@@ -0,0 +1,25 @@
+package com.usoftchina.saas.document.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.document.entities.Bom;
+import org.apache.ibatis.annotations.Param;
+
+public interface BomMapper extends CommonBaseMapper<Bom> {
+    int deleteByPrimaryKey(Long bo_id);
+
+    int insert(Bom record);
+
+    int insertSelective(Bom record);
+
+    Bom selectByPrimaryKey(Long bo_id);
+
+    int updateByPrimaryKeySelective(Bom record);
+
+    int updateByPrimaryKey(Bom record);
+
+    int validCodeAndVersion(@Param("code") String code, @Param("version") String version, @Param("companyId") Long companyId);
+
+    int validateCodeWhenInsert(@Param("code") String code, @Param("companyId") Long companyId);
+
+    int validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long company);
+}

+ 48 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/BomService.java

@@ -0,0 +1,48 @@
+package com.usoftchina.saas.document.service;
+
+import com.usoftchina.saas.base.service.CommonBaseService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.document.entities.Bom;
+import com.usoftchina.saas.document.entities.BomList;
+import com.usoftchina.saas.document.mapper.BomMapper;
+import com.usoftchina.saas.page.PageRequest;
+
+import java.util.List;
+
+public interface BomService extends CommonBaseService<BomMapper, Bom> {
+
+    /**
+     * 保存、更新BOM资料主从表数据
+     * @param bomList
+     * @return
+     */
+    DocBaseDTO saveData(BomList bomList);
+
+    /**
+     * 删除
+     * @param id
+     */
+    void delete(Long id);
+
+    /**
+     * BOM资料复制
+     * @param id
+     */
+    void copy(Long id);
+
+    /**
+     * 获取列表数据
+     * @param pageRequest   分页对象
+     * @param listReqDTO    条件对象
+     * @return
+     */
+    List<BomList> getListDataByCondition(PageRequest pageRequest, ListReqDTO listReqDTO);
+
+    /**
+     * 通过ID获取主从表数据
+     * @param id
+     * @return
+     */
+    BomList getDataById(Long id);
+}

+ 4 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CustomerService.java

@@ -33,4 +33,8 @@ public interface CustomerService extends CommonBaseService<CustomerMapper, Custo
     void deletecontact(Long id);
 
     void deleteaddress(Long id);
+
+    void batchClose(BatchDealBaseDTO baseDTOs);
+
+    void batchOpen(BatchDealBaseDTO baseDTOs);
 }

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

@@ -38,7 +38,7 @@ public interface VendorService extends CommonBaseService<VendorMapper, Vendor>{
      * @param listReqDTO  条件对象
      * @return List<VendorList>
      */
-    List<VendorList> getListDataByCondition(ListReqDTO listReqDTO);
+    PageInfo<VendorList> getListDataByCondition(PageRequest page, ListReqDTO listReqDTO);
 
     /**
      * 保存主从表数据

+ 0 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/AddressServiceImpl.java

@@ -3,7 +3,6 @@ package com.usoftchina.saas.document.service.impl;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
-import com.usoftchina.saas.commons.po.Messagelog;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Address;
 import com.usoftchina.saas.document.mapper.AddressMapper;

+ 124 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BomServiceImpl.java

@@ -0,0 +1,124 @@
+package com.usoftchina.saas.document.service.impl;
+
+import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MaxnumberService;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.BillCodeSeq;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.document.entities.Bom;
+import com.usoftchina.saas.document.entities.BomDetail;
+import com.usoftchina.saas.document.entities.BomList;
+import com.usoftchina.saas.document.mapper.BomDetailMapper;
+import com.usoftchina.saas.document.mapper.BomMapper;
+import com.usoftchina.saas.document.service.BomService;
+import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class BomServiceImpl extends CommonBaseServiceImpl<BomMapper, Bom> implements BomService {
+
+    @Autowired
+    private MaxnumberService maxnumberService;
+    @Autowired
+    private BomDetailMapper bomDetailMapper;
+    @Autowired
+    private MessageLogService messageLogService;
+
+    @Override
+    public DocBaseDTO saveData(BomList bomList) {
+        Long id = bomList.getMain().getId();
+        Long companyId = BaseContextHolder.getCompanyId();
+        Bom bom = bomList.getMain();
+        List<BomDetail> bomDetailList = bomList.getItems();
+        DocBaseDTO docBaseDTO = null;
+        if(id == 0){
+            //校验编号和版本 是否已存在
+            int count = getMapper().validCodeAndVersion(bom.getBo_mothercode(), bom.getBo_version(), companyId);
+            if(count == 0){
+                String code = pushMaxnubmer(bom.getBo_mothercode(), bom.getId());
+                bom.setBo_mothercode(code);
+                bom.setCompanyId(companyId);
+                //保存BOM
+                getMapper().insertSelective(bom);
+                //赋值BD_BOMID
+                for (BomDetail bomDetail : bomDetailList){
+                    bomDetail.setBd_bomid(bom.getId());
+                    bomDetail.setCompanyId(companyId);
+                }
+                bomDetailMapper.batchInsert(bomDetailList);
+                docBaseDTO = generateMsgObj(bom.getId());
+                //记录LOG
+                messageLogService.save(docBaseDTO);
+            }else{
+                throw new BizException(BizExceptionCode.BOM_SAVE);
+            }
+        }else{
+            //校验编号和版本 是否已存在
+            int count = getMapper().validCodeAndVersion(bom.getBo_mothercode(), bom.getBo_version(), companyId);
+            //更新主表
+            getMapper().updateByPrimaryKeySelective(bom);
+            //更新从表
+            bomDetailMapper.batchUpdate(bomDetailList);
+            //记录LOG
+            messageLogService.update(generateMsgObj(bom.getId()));
+        }
+        return docBaseDTO;
+    }
+
+    @Override
+    public void delete(Long id) {
+        if(id == null || id <= 0){
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+        getMapper().deleteByPrimaryKey(id);
+        bomDetailMapper.deleteByFK(id);
+    }
+
+    @Override
+    public void copy(Long id) {
+
+    }
+
+    @Override
+    public List<BomList> getListDataByCondition(PageRequest pageRequest, ListReqDTO listReqDTO) {
+        return null;
+    }
+
+    @Override
+    public BomList getDataById(Long id) {
+        return null;
+    }
+
+    /**
+     * 构造日记记录对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "Bom");
+    }
+
+    /**
+     * @Description: 检验获取并更新单号
+     * @Param: [code, id]
+     * @return: java.lang.String
+     * @Author: guq
+     * @Date: 2018/10/19
+     */
+    private String pushMaxnubmer(String code, Long id) {
+        if (null == code) {
+            throw new BizException(BizExceptionCode.NULL_CODE);
+        }
+        Long companyId = BaseContextHolder.getCompanyId();
+        Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
+                getMapper().validateCodeWhenUpdate(code, id, companyId);
+        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PURCHASE.getCaller()).getData();
+    }
+}

+ 57 - 22
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java

@@ -255,40 +255,75 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
 //        messageLogService.deleteDetail(docBaseDTO);
     }
 
+    private DocBaseDTO singleClose(Long id) {
+        DocBaseDTO docBaseDTO = null;
+        if (null!=id) {
+            Customer customer = getMapper().selectByPrimaryKey(id);
+            if(Status.CLOSE.name().equals(customer.getCu_statuscode())){
+                throw new BizException(BizExceptionCode.BIZ_CLOSE);
+            }
+            customer.setCu_statuscode(Status.CLOSE.name());
+            customer.setCu_status(Status.CLOSE.getDisplay());
+            getMapper().updateByPrimaryKeySelective(customer);
+            docBaseDTO = getBaseDTOById(id);
+            //日志
+//        messageLogService.close(docBaseDTO);
+        }
+        return docBaseDTO;
+    }
+
+
     @Override
     public DocBaseDTO close(long id) {
-        Customer customer = getMapper().selectByPrimaryKey(id);
-        if(Status.CLOSE.name().equals(customer.getCu_statuscode())){
-            throw new BizException(BizExceptionCode.BIZ_CLOSE);
+        return singleClose(id);
+    }
+
+    @Override
+    public void batchClose(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
         }
-        customer = new Customer();
-        customer.setId(id);
-        customer.setCu_statuscode(Status.CLOSE.name());
-        customer.setCu_status(Status.CLOSE.getDisplay());
-        getMapper().updateByPrimaryKeySelective(customer);
-        DocBaseDTO docBaseDTO = getBaseDTOById(id);
-        //日志
+        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
+            singleClose(base.getId());
+        }
+    }
+
+    private DocBaseDTO singleOpen(Long id) {
+        DocBaseDTO docBaseDTO = null;
+        if (null!=id) {
+            Customer customer = getMapper().selectByPrimaryKey(id);
+            if(Status.OPEN.name().equals(customer.getCu_statuscode())){
+                throw new BizException(BizExceptionCode.BIZ_OPEN);
+            }
+            customer.setCu_statuscode(Status.OPEN.name());
+            customer.setCu_status(Status.OPEN.getDisplay());
+            getMapper().updateByPrimaryKeySelective(customer);
+            docBaseDTO = getBaseDTOById(id);
+            //日志
 //        messageLogService.close(docBaseDTO);
+        }
         return docBaseDTO;
     }
 
+
     @Override
     public DocBaseDTO open(long id) {
-        Customer customer = getMapper().selectByPrimaryKey(id);
-        if(Status.OPEN.name().equals(customer.getCu_statuscode())){
-            throw new BizException(BizExceptionCode.BIZ_OPEN);
+        return singleOpen(id);
+    }
+
+    @Override
+    public void batchOpen(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
+        }
+        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
+            singleOpen(base.getId());
         }
-        customer = new Customer();
-        customer.setId(id);
-        customer.setCu_statuscode(Status.OPEN.name());
-        customer.setCu_status(Status.OPEN.getDisplay());
-        getMapper().updateByPrimaryKeySelective(customer);
-        DocBaseDTO docBaseDTO = getBaseDTOById(id);
-        //日志
-//        messageLogService.close(docBaseDTO);
-        return docBaseDTO;
     }
 
+
     private List<CustomerList> getListByMode(ListReqDTO req) {
         List<CustomerList> list = null;
         Long companyId = BaseContextHolder.getCompanyId();

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

@@ -71,9 +71,19 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
      * 返回列表数据
      * @return
      */
-    public List<VendorList> getListDataByCondition(ListReqDTO listReqDTO){
+    public PageInfo<VendorList> getListDataByCondition(PageRequest page, ListReqDTO listReqDTO){
+        //设置分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //取分页信息
         String condition = listReqDTO.getFinalCondition();
-        return getMapper().getListDataByCondition(condition, BaseContextHolder.getCompanyId());
+        List<VendorList> list = getMapper().getListDataByCondition(condition, BaseContextHolder.getCompanyId());
+        PageInfo<VendorList> pageInfo = new PageInfo<VendorList>(list);
+        return pageInfo;
     }
 
     /**
@@ -82,6 +92,9 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
      */
     @Override
     public DocBaseDTO saveFormData(VendorListDTO vendorListDTO) {
+        if (null == vendorListDTO || null == vendorListDTO.getMain()){
+            throw new BizException(500, "数据为空,请填写后再保存");
+        }
         Vendor main = vendorListDTO.getMain();
         main.setCompanyId(BaseContextHolder.getCompanyId());
         List<Vendorcontact> items = vendorListDTO.getItems();

+ 0 - 1
applications/document/document-server/src/main/resources/application.yml

@@ -48,7 +48,6 @@ eureka:
     registryFetchIntervalSeconds: 5
     serviceUrl:
       defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8510/eureka/
-#      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.253.31:8510/eureka/
 server:
   port: 9480
   tomcat:

+ 396 - 0
applications/document/document-server/src/main/resources/mapper/BomDetailMapper.xml

@@ -0,0 +1,396 @@
+<?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.document.mapper.BomDetailMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.BomDetail" >
+    <id column="bd_id" property="id" jdbcType="INTEGER" />
+    <result column="bd_bomid" property="bd_bomid" jdbcType="INTEGER" />
+    <result column="bd_detno" property="bd_detno" jdbcType="INTEGER" />
+    <result column="bd_sonid" property="bd_sonid" jdbcType="INTEGER" />
+    <result column="bd_soncode" property="bd_soncode" jdbcType="VARCHAR" />
+    <result column="bd_unit" property="bd_unit" jdbcType="VARCHAR" />
+    <result column="bd_baseqty" property="bd_baseqty" jdbcType="INTEGER" />
+    <result column="bd_replace" property="bd_replace" jdbcType="VARCHAR" />
+    <result column="bd_remark" property="bd_remark" jdbcType="VARCHAR" />
+    <result column="comapnyId" property="companyId" jdbcType="INTEGER" />
+    <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+    <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="bd_text1" property="bd_text1" jdbcType="VARCHAR" />
+    <result column="bd_text2" property="bd_text2" jdbcType="VARCHAR" />
+    <result column="bd_text3" property="bd_text3" jdbcType="VARCHAR" />
+    <result column="bd_text4" property="bd_text4" jdbcType="VARCHAR" />
+    <result column="bd_text5" property="bd_text5" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    bd_id, bd_bomid, bd_detno, bd_sonid, bd_soncode, bd_unit, bd_baseqty, bd_replace, 
+    bd_remark, comapnyId, updaterId, updateTime, bd_text1, bd_text2, bd_text3, bd_text4, 
+    bd_text5
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
+    select 
+    <include refid="Base_Column_List" />
+    from bomdetail
+    where bd_id = #{id}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+    delete from bomdetail
+    where bd_id = #{id}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.document.entities.BomDetail" >
+    insert into bomdetail (bd_bomid, bd_detno,
+      bd_sonid, bd_soncode, bd_unit, 
+      bd_baseqty, bd_replace, bd_remark, 
+      comapnyId, updaterId, updateTime, 
+      bd_text1, bd_text2, bd_text3, 
+      bd_text4, bd_text5)
+    values ( #{bd_bomid,jdbcType=INTEGER}, #{bd_detno,jdbcType=INTEGER},
+      #{bd_sonid,jdbcType=INTEGER}, #{bd_soncode,jdbcType=VARCHAR}, #{bd_unit,jdbcType=VARCHAR}, 
+      #{bd_baseqty,jdbcType=INTEGER}, #{bd_replace,jdbcType=VARCHAR}, #{bd_remark,jdbcType=VARCHAR}, 
+      #{comapnyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, 
+      #{bd_text1,jdbcType=VARCHAR}, #{bd_text2,jdbcType=VARCHAR}, #{bd_text3,jdbcType=VARCHAR}, 
+      #{bd_text4,jdbcType=VARCHAR}, #{bd_text5,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.BomDetail" >
+    insert into bomdetail
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="bd_bomid != null" >
+        bd_bomid,
+      </if>
+      <if test="bd_detno != null" >
+        bd_detno,
+      </if>
+      <if test="bd_sonid != null" >
+        bd_sonid,
+      </if>
+      <if test="bd_soncode != null" >
+        bd_soncode,
+      </if>
+      <if test="bd_unit != null" >
+        bd_unit,
+      </if>
+      <if test="bd_baseqty != null" >
+        bd_baseqty,
+      </if>
+      <if test="bd_replace != null" >
+        bd_replace,
+      </if>
+      <if test="bd_remark != null" >
+        bd_remark,
+      </if>
+      <if test="comapnyId != null" >
+        comapnyId,
+      </if>
+      <if test="updaterId != null" >
+        updaterId,
+      </if>
+      <if test="updateTime != null" >
+        updateTime,
+      </if>
+      <if test="bd_text1 != null" >
+        bd_text1,
+      </if>
+      <if test="bd_text2 != null" >
+        bd_text2,
+      </if>
+      <if test="bd_text3 != null" >
+        bd_text3,
+      </if>
+      <if test="bd_text4 != null" >
+        bd_text4,
+      </if>
+      <if test="bd_text5 != null" >
+        bd_text5,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="bd_bomid != null" >
+        #{bd_bomid,jdbcType=INTEGER},
+      </if>
+      <if test="bd_detno != null" >
+        #{bd_detno,jdbcType=INTEGER},
+      </if>
+      <if test="bd_sonid != null" >
+        #{bd_sonid,jdbcType=INTEGER},
+      </if>
+      <if test="bd_soncode != null" >
+        #{bd_soncode,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_unit != null" >
+        #{bd_unit,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_baseqty != null" >
+        #{bd_baseqty,jdbcType=INTEGER},
+      </if>
+      <if test="bd_replace != null" >
+        #{bd_replace,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_remark != null" >
+        #{bd_remark,jdbcType=VARCHAR},
+      </if>
+      <if test="comapnyId != null" >
+        #{comapnyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bd_text1 != null" >
+        #{bd_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text2 != null" >
+        #{bd_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text3 != null" >
+        #{bd_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text4 != null" >
+        #{bd_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text5 != null" >
+        #{bd_text5,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.BomDetail" >
+    update bomdetail
+    <set >
+      <if test="bd_bomid != null" >
+        bd_bomid = #{bd_bomid,jdbcType=INTEGER},
+      </if>
+      <if test="bd_detno != null" >
+        bd_detno = #{bd_detno,jdbcType=INTEGER},
+      </if>
+      <if test="bd_sonid != null" >
+        bd_sonid = #{bd_sonid,jdbcType=INTEGER},
+      </if>
+      <if test="bd_soncode != null" >
+        bd_soncode = #{bd_soncode,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_unit != null" >
+        bd_unit = #{bd_unit,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_baseqty != null" >
+        bd_baseqty = #{bd_baseqty,jdbcType=INTEGER},
+      </if>
+      <if test="bd_replace != null" >
+        bd_replace = #{bd_replace,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_remark != null" >
+        bd_remark = #{bd_remark,jdbcType=VARCHAR},
+      </if>
+      <if test="comapnyId != null" >
+        comapnyId = #{comapnyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        updaterId = #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bd_text1 != null" >
+        bd_text1 = #{bd_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text2 != null" >
+        bd_text2 = #{bd_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text3 != null" >
+        bd_text3 = #{bd_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text4 != null" >
+        bd_text4 = #{bd_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="bd_text5 != null" >
+        bd_text5 = #{bd_text5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where bd_id = #{id}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.BomDetail" >
+    update bomdetail
+    set bd_bomid = #{bd_bomid,jdbcType=INTEGER},
+      bd_detno = #{bd_detno,jdbcType=INTEGER},
+      bd_sonid = #{bd_sonid,jdbcType=INTEGER},
+      bd_soncode = #{bd_soncode,jdbcType=VARCHAR},
+      bd_unit = #{bd_unit,jdbcType=VARCHAR},
+      bd_baseqty = #{bd_baseqty,jdbcType=INTEGER},
+      bd_replace = #{bd_replace,jdbcType=VARCHAR},
+      bd_remark = #{bd_remark,jdbcType=VARCHAR},
+      comapnyId = #{comapnyId,jdbcType=INTEGER},
+      updaterId = #{updaterId,jdbcType=INTEGER},
+      updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      bd_text1 = #{bd_text1,jdbcType=VARCHAR},
+      bd_text2 = #{bd_text2,jdbcType=VARCHAR},
+      bd_text3 = #{bd_text3,jdbcType=VARCHAR},
+      bd_text4 = #{bd_text4,jdbcType=VARCHAR},
+      bd_text5 = #{bd_text5,jdbcType=VARCHAR}
+    where bd_id = #{id}
+  </update>
+  <insert id="batchInsert" parameterType="java.util.List">
+    <foreach collection="list" item="item" index="index" open="" close="" separator=",">
+      INSERT INTO BOMDETAIL
+      <trim prefix="(" suffix=")" suffixOverrides=",">
+        <if test="item.bd_bomid != null" >
+          bd_bomid,
+        </if>
+        <if test="item.bd_detno != null" >
+          bd_detno,
+        </if>
+        <if test="item.bd_sonid != null" >
+          bd_sonid,
+        </if>
+        <if test="item.bd_soncode != null" >
+          bd_soncode,
+        </if>
+        <if test="item.bd_unit != null" >
+          bd_unit,
+        </if>
+        <if test="item.bd_baseqty != null" >
+          bd_baseqty,
+        </if>
+        <if test="item.bd_replace != null" >
+          bd_replace,
+        </if>
+        <if test="item.bd_remark != null" >
+          bd_remark,
+        </if>
+        <if test="item.comapnyId != null" >
+          comapnyId,
+        </if>
+        <if test="item.updaterId != null" >
+          updaterId,
+        </if>
+        <if test="item.updateTime != null" >
+          updateTime,
+        </if>
+        <if test="item.bd_text1 != null" >
+          bd_text1,
+        </if>
+        <if test="item.bd_text2 != null" >
+          bd_text2,
+        </if>
+        <if test="item.bd_text3 != null" >
+          bd_text3,
+        </if>
+        <if test="item.bd_text4 != null" >
+          bd_text4,
+        </if>
+        <if test="item.bd_text5 != null" >
+          bd_text5,
+        </if>
+      </trim>
+      <trim prefix="values (" suffix=")" suffixOverrides="," >
+        <if test="item.bd_bomid != null" >
+          #{item.bd_bomid},
+        </if>
+        <if test="bd_detno != null" >
+          #{item.bd_detno,jdbcType=INTEGER},
+        </if>
+        <if test="bd_sonid != null" >
+          #{item.bd_sonid,jdbcType=INTEGER},
+        </if>
+        <if test="bd_soncode != null" >
+          #{item.bd_soncode,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_unit != null" >
+          #{item.bd_unit,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_baseqty != null" >
+          #{item.bd_baseqty,jdbcType=INTEGER},
+        </if>
+        <if test="bd_replace != null" >
+          #{item.bd_replace,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_remark != null" >
+          #{item.bd_remark,jdbcType=VARCHAR},
+        </if>
+        <if test="comapnyId != null" >
+          #{item.comapnyId,jdbcType=INTEGER},
+        </if>
+        <if test="updaterId != null" >
+          #{item.updaterId,jdbcType=INTEGER},
+        </if>
+        <if test="updateTime != null" >
+          #{item.updateTime,jdbcType=TIMESTAMP},
+        </if>
+        <if test="bd_text1 != null" >
+          #{item.bd_text1,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text2 != null" >
+          #{item.bd_text2,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text3 != null" >
+          #{item.bd_text3,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text4 != null" >
+          #{item.bd_text4,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text5 != null" >
+          #{item.bd_text5,jdbcType=VARCHAR},
+        </if>
+      </trim>
+    </foreach>
+  </insert>
+
+  <update id="batchUpdate" parameterType="com.usoftchina.saas.document.entities.BomDetail">
+    <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+      UPDATE BOMDETAIL
+      <set >
+        <if test="item.bd_bomid != null" >
+          bd_bomid = #{item.bd_bomid},
+        </if>
+        <if test="bd_detno != null" >
+          bd_detno = #{item.bd_detno,jdbcType=INTEGER},
+        </if>
+        <if test="bd_sonid != null" >
+          bd_sonid = #{item.bd_sonid,jdbcType=INTEGER},
+        </if>
+        <if test="bd_soncode != null" >
+          bd_soncode = #{item.bd_soncode,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_unit != null" >
+          bd_unit = #{item.bd_unit,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_baseqty != null" >
+          bd_baseqty = #{item.bd_baseqty,jdbcType=INTEGER},
+        </if>
+        <if test="bd_replace != null" >
+          bd_replace = #{item.bd_replace,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_remark != null" >
+          bd_remark = #{item.bd_remark,jdbcType=VARCHAR},
+        </if>
+        <if test="comapnyId != null" >
+          comapnyId = #{item.comapnyId,jdbcType=INTEGER},
+        </if>
+        <if test="updaterId != null" >
+          updaterId = #{item.updaterId,jdbcType=INTEGER},
+        </if>
+        <if test="updateTime != null" >
+          updateTime = #{item.updateTime,jdbcType=TIMESTAMP},
+        </if>
+        <if test="bd_text1 != null" >
+          bd_text1 = #{item.bd_text1,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text2 != null" >
+          bd_text2 = #{item.bd_text2,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text3 != null" >
+          bd_text3 = #{item.bd_text3,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text4 != null" >
+          bd_text4 = #{item.bd_text4,jdbcType=VARCHAR},
+        </if>
+        <if test="bd_text5 != null" >
+          bd_text5 = #{item.bd_text5,jdbcType=VARCHAR},
+        </if>
+      </set>
+      where bd_id = #{item.id}
+    </foreach>
+  </update>
+
+  <delete id="deleteByFK" parameterType="java.lang.Long">
+    DELETE FROM BOMDETAIL
+    WHERE BD_BOMID=#{id}
+  </delete>
+</mapper>

+ 251 - 0
applications/document/document-server/src/main/resources/mapper/BomMapper.xml

@@ -0,0 +1,251 @@
+<?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.document.mapper.BomMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Bom" >
+    <id column="bo_id" property="id" jdbcType="INTEGER" />
+    <result column="bo_motherid" property="bo_motherid" jdbcType="INTEGER" />
+    <result column="bo_mothercode" property="bo_mothercode" jdbcType="VARCHAR" />
+    <result column="bo_mothername" property="bo_mothername" jdbcType="VARCHAR" />
+    <result column="bo_version" property="bo_version" jdbcType="VARCHAR" />
+    <result column="bo_status" property="bo_status" jdbcType="VARCHAR" />
+    <result column="bo_statuscode" property="bo_statuscode" jdbcType="VARCHAR" />
+    <result column="bo_recorderid" property="bo_recorderid" jdbcType="INTEGER" />
+    <result column="bo_recorder" property="bo_recorder" jdbcType="VARCHAR" />
+    <result column="bo_recorddate" property="bo_recorddate" jdbcType="TIMESTAMP" />
+    <result column="companyId" property="companyId" jdbcType="INTEGER" />
+    <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+    <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="bo_text1" property="bo_text1" jdbcType="VARCHAR" />
+    <result column="bo_text2" property="bo_text2" jdbcType="VARCHAR" />
+    <result column="bo_text3" property="bo_text3" jdbcType="VARCHAR" />
+    <result column="bo_text4" property="bo_text4" jdbcType="VARCHAR" />
+    <result column="bo_text5" property="bo_text5" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    bo_id, bo_motherid, bo_mothercode, bo_mothername, bo_version, bo_status, bo_statuscode, 
+    bo_recorderid, bo_recorder, bo_recorddate, companyId, updaterId, updateTime, bo_text1, 
+    bo_text2, bo_text3, bo_text4, bo_text5
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
+    select 
+    <include refid="Base_Column_List" />
+    from bom
+    where bo_id = #{id}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+    delete from bom
+    where bo_id = #{id}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Bom" >
+    insert into bom (bo_motherid, bo_mothercode,
+      bo_mothername, bo_version, bo_status, 
+      bo_statuscode, bo_recorderid, bo_recorder, 
+      bo_recorddate, companyId, updaterId, 
+      updateTime, bo_text1, bo_text2, 
+      bo_text3, bo_text4, bo_text5
+      )
+    values (#{bo_motherid,jdbcType=INTEGER}, #{bo_mothercode,jdbcType=VARCHAR},
+      #{bo_mothername,jdbcType=VARCHAR}, #{bo_version,jdbcType=VARCHAR}, #{bo_status,jdbcType=VARCHAR}, 
+      #{bo_statuscode,jdbcType=VARCHAR}, #{bo_recorderid,jdbcType=INTEGER}, #{bo_recorder,jdbcType=VARCHAR}, 
+      #{bo_recorddate,jdbcType=TIMESTAMP}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, 
+      #{updateTime,jdbcType=TIMESTAMP}, #{bo_text1,jdbcType=VARCHAR}, #{bo_text2,jdbcType=VARCHAR}, 
+      #{bo_text3,jdbcType=VARCHAR}, #{bo_text4,jdbcType=VARCHAR}, #{bo_text5,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Bom" >
+    insert into bom
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="bo_motherid != null" >
+        bo_motherid,
+      </if>
+      <if test="bo_mothercode != null" >
+        bo_mothercode,
+      </if>
+      <if test="bo_mothername != null" >
+        bo_mothername,
+      </if>
+      <if test="bo_version != null" >
+        bo_version,
+      </if>
+      <if test="bo_status != null" >
+        bo_status,
+      </if>
+      <if test="bo_statuscode != null" >
+        bo_statuscode,
+      </if>
+      <if test="bo_recorderid != null" >
+        bo_recorderid,
+      </if>
+      <if test="bo_recorder != null" >
+        bo_recorder,
+      </if>
+      <if test="bo_recorddate != null" >
+        bo_recorddate,
+      </if>
+      <if test="companyId != null" >
+        companyId,
+      </if>
+      <if test="updaterId != null" >
+        updaterId,
+      </if>
+      <if test="updateTime != null" >
+        updateTime,
+      </if>
+      <if test="bo_text1 != null" >
+        bo_text1,
+      </if>
+      <if test="bo_text2 != null" >
+        bo_text2,
+      </if>
+      <if test="bo_text3 != null" >
+        bo_text3,
+      </if>
+      <if test="bo_text4 != null" >
+        bo_text4,
+      </if>
+      <if test="bo_text5 != null" >
+        bo_text5,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="bo_motherid != null" >
+        #{bo_motherid,jdbcType=INTEGER},
+      </if>
+      <if test="bo_mothercode != null" >
+        #{bo_mothercode,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_mothername != null" >
+        #{bo_mothername,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_version != null" >
+        #{bo_version,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_status != null" >
+        #{bo_status,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_statuscode != null" >
+        #{bo_statuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_recorderid != null" >
+        #{bo_recorderid,jdbcType=INTEGER},
+      </if>
+      <if test="bo_recorder != null" >
+        #{bo_recorder,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_recorddate != null" >
+        #{bo_recorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="companyId != null" >
+        #{companyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bo_text1 != null" >
+        #{bo_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text2 != null" >
+        #{bo_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text3 != null" >
+        #{bo_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text4 != null" >
+        #{bo_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text5 != null" >
+        #{bo_text5,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Bom" >
+    update bom
+    <set >
+      <if test="bo_motherid != null" >
+        bo_motherid = #{bo_motherid,jdbcType=INTEGER},
+      </if>
+      <if test="bo_mothercode != null" >
+        bo_mothercode = #{bo_mothercode,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_mothername != null" >
+        bo_mothername = #{bo_mothername,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_version != null" >
+        bo_version = #{bo_version,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_status != null" >
+        bo_status = #{bo_status,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_statuscode != null" >
+        bo_statuscode = #{bo_statuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_recorderid != null" >
+        bo_recorderid = #{bo_recorderid,jdbcType=INTEGER},
+      </if>
+      <if test="bo_recorder != null" >
+        bo_recorder = #{bo_recorder,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_recorddate != null" >
+        bo_recorddate = #{bo_recorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="companyId != null" >
+        companyId = #{companyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        updaterId = #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bo_text1 != null" >
+        bo_text1 = #{bo_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text2 != null" >
+        bo_text2 = #{bo_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text3 != null" >
+        bo_text3 = #{bo_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text4 != null" >
+        bo_text4 = #{bo_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="bo_text5 != null" >
+        bo_text5 = #{bo_text5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where bo_id = #{id}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Bom" >
+    update bom
+    set bo_motherid = #{bo_motherid,jdbcType=INTEGER},
+      bo_mothercode = #{bo_mothercode,jdbcType=VARCHAR},
+      bo_mothername = #{bo_mothername,jdbcType=VARCHAR},
+      bo_version = #{bo_version,jdbcType=VARCHAR},
+      bo_status = #{bo_status,jdbcType=VARCHAR},
+      bo_statuscode = #{bo_statuscode,jdbcType=VARCHAR},
+      bo_recorderid = #{bo_recorderid,jdbcType=INTEGER},
+      bo_recorder = #{bo_recorder,jdbcType=VARCHAR},
+      bo_recorddate = #{bo_recorddate,jdbcType=TIMESTAMP},
+      companyId = #{companyId,jdbcType=INTEGER},
+      updaterId = #{updaterId,jdbcType=INTEGER},
+      updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      bo_text1 = #{bo_text1,jdbcType=VARCHAR},
+      bo_text2 = #{bo_text2,jdbcType=VARCHAR},
+      bo_text3 = #{bo_text3,jdbcType=VARCHAR},
+      bo_text4 = #{bo_text4,jdbcType=VARCHAR},
+      bo_text5 = #{bo_text5,jdbcType=VARCHAR}
+    where bo_id = #{id}
+  </update>
+  <select id="validateCodeWhenInsert" resultType="int">
+    select count(*) from BOM where BO_MOTHERCODE = #{code} and companyId =#{companyId}
+  </select>
+  <select id="validateCodeWhenUpdate" resultType="int" >
+    select count(*) from BOM where BO_MOTHERCODE = #{code} and BO_ID != #{id} and companyId =#{companyId}
+  </select>
+  <select id="validCodeAndVersion" resultType="int">
+      SELECT COUNT(*) FROM BOM WHERE BO_MOTHERCODE = #{code} and BO_VERSION=#{version} and COMPANYID=#{companyId}
+  </select>
+</mapper>

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

@@ -89,7 +89,7 @@
     </resultMap>
 
     <select id="getListDataByCondition" resultMap="VendorListResultMapper">
-        SELECT * FROM VENDOR LEFT JOIN VENDORCONTACT ON VE_ID = VC_VEID
+        SELECT * FROM VENDOR LEFT JOIN VENDORCONTACT ON VE_ID = VC_VEID and vc_default = 1
         <where>
             <if test="condition!=null">
                 ${condition}

+ 51 - 0
applications/document/document-server/src/test/java/com/usoftchina/saas/document/mapper/CustomerMapperTest.java

@@ -0,0 +1,51 @@
+package com.usoftchina.saas.document.mapper;
+
+import com.usoftchina.saas.document.DocumentApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * Created by zdw
+ * 2018-10-26 14:44.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = DocumentApplication.class)
+@EnableAutoConfiguration
+public class CustomerMapperTest {
+    @Autowired
+    private CustomerMapper customerMapper;
+
+
+    @Test
+    public void deleteByPrimaryKey() throws Exception {
+    }
+
+    @Test
+    public void insertSelective() throws Exception {
+    }
+
+    @Test
+    public void selectByPrimaryKey() throws Exception {
+        System.out.println("---");
+        System.out.println(customerMapper.selectByPrimaryKey(new Long(24)).getCompanyId());
+
+
+    }
+
+    @Test
+    public void updateByPrimaryKeySelective() throws Exception {
+    }
+
+    @Test
+    public void updateByPrimaryKey() throws Exception {
+    }
+
+    @Test
+    public void selectCodeById() throws Exception {
+    }
+
+}

+ 0 - 4
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/ProdIODetailMapper.java

@@ -10,14 +10,10 @@ public interface ProdIODetailMapper extends CommonBaseMapper<ProdIODetail> {
 
     int deleteByPrimaryKey(Long pd_id);
 
-    int insert(ProdIODetail record);
-
     int insertSelective(ProdIODetail record);
 
-
     ProdIODetail selectByPrimaryKey(Integer pd_id);
 
-
     int updateByPrimaryKeySelective(ProdIODetail record);
 
     int updateByPrimaryKeyWithBLOBs(ProdIODetail record);

+ 0 - 5
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/ProdInOutMapper.java

@@ -8,15 +8,10 @@ public interface ProdInOutMapper extends CommonBaseMapper<ProdInOut> {
 
     int deleteByPrimaryKey(Long pi_id);
 
-    int insert(ProdInOut record);
-
     int insertSelective(ProdInOut record);
 
-
-
     ProdInOut selectByPrimaryKey(Long pi_id);
 
-
     int updateByPrimaryKeySelective(ProdInOut record);
 
     int updateByPrimaryKeyWithBLOBs(ProdInOut record);

+ 1 - 58
applications/purchase/purchase-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -97,37 +97,6 @@
     delete from prodiodetail
     where pd_id = #{pd_id,jdbcType=INTEGER}
   </delete>
-  <insert id="insert" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail">
-    insert into prodiodetail (pd_id, pd_piid, pd_inoutno, 
-      pd_piclass, pd_pdno, pd_ordercode, 
-      pd_orderdetno, pd_prodid, pd_prodcode, 
-      pd_unit, pd_inqty, pd_outqty, 
-      pd_orderprice, pd_sendprice, pd_price, 
-      pd_total, pd_taxrate, pd_netprice, 
-      pd_nettotal, pd_whid, pd_whcode, 
-      pd_whname, pd_inwhid, pd_inwhcode, 
-      pd_inwhname, pd_orderid, pd_sdid, 
-      pd_status, companyid, updaterid, 
-      updatetime, pd_text1, pd_text2, 
-      pd_text3, pd_text4, pd_text5, 
-      pd_ym, pd_yqty, pd_remark,pd_ioid
-      )
-    values (#{pd_id,jdbcType=INTEGER}, #{pd_piid,jdbcType=INTEGER}, #{pd_inoutno,jdbcType=VARCHAR}, 
-      #{pd_piclass,jdbcType=VARCHAR}, #{pd_pdno,jdbcType=INTEGER}, #{pd_ordercode,jdbcType=VARCHAR}, 
-      #{pd_orderdetno,jdbcType=INTEGER}, #{pd_prodid,jdbcType=INTEGER}, #{pd_prodcode,jdbcType=VARCHAR}, 
-      #{pd_unit,jdbcType=VARCHAR}, #{pd_inqty,jdbcType=DOUBLE}, #{pd_outqty,jdbcType=DOUBLE},
-      #{pd_orderprice,jdbcType=DOUBLE}, #{pd_sendprice,jdbcType=DOUBLE}, #{pd_price,jdbcType=DOUBLE}, 
-      #{pd_total,jdbcType=DOUBLE}, #{pd_taxrate,jdbcType=DOUBLE}, #{pd_netprice,jdbcType=DOUBLE},
-      #{pd_nettotal,jdbcType=DOUBLE}, #{pd_whid,jdbcType=INTEGER}, #{pd_whcode,jdbcType=VARCHAR}, 
-      #{pd_whname,jdbcType=VARCHAR}, #{pd_inwhid,jdbcType=INTEGER}, #{pd_inwhcode,jdbcType=VARCHAR}, 
-      #{pd_inwhname,jdbcType=VARCHAR}, #{pd_orderid,jdbcType=INTEGER}, #{pd_sdid,jdbcType=INTEGER}, 
-      #{pd_status,jdbcType=INTEGER}, #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER}, 
-      #{updatetime,jdbcType=TIMESTAMP}, #{pd_text1,jdbcType=VARCHAR}, #{pd_text2,jdbcType=VARCHAR}, 
-      #{pd_text3,jdbcType=VARCHAR}, #{pd_text4,jdbcType=VARCHAR}, #{pd_text5,jdbcType=VARCHAR}, 
-      #{pd_ym,jdbcType=INTEGER}, #{pd_yqty,jdbcType=DOUBLE}, #{pd_remark,jdbcType=LONGVARCHAR},
-      #{pd_ioid,jdbcType=INTEGER}
-      )
-  </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail">
     <selectKey resultType="java.lang.Long" keyProperty="id">
       SELECT LAST_INSERT_ID() AS ID
@@ -581,32 +550,6 @@
     where pd_id = #{pd_id,jdbcType=INTEGER}
   </update>
   <insert id="batchInsert" parameterType="java.util.List" >
-    insert into prodiodetail
-    (
-    pd_piid,pd_inoutno,pd_piclass,pd_pdno,pd_ordercode,
-    pd_orderdetno,pd_prodid,pd_prodcode,pd_unit,
-    pd_inqty,pd_outqty,pd_orderprice,pd_sendprice,pd_price,
-    pd_total,pd_taxrate,pd_netprice,pd_nettotal,
-    pd_whid,pd_whcode,pd_whname,pd_inwhid,pd_inwhcode,
-    pd_inwhname,pd_orderid,pd_sdid,pd_status,pd_remark,
-    companyid,updaterid,updatetime,pd_text1,pd_text2,
-    pd_text3,pd_text4,pd_text5,pd_ym,pd_yqty
-    )
-    values
-    <foreach collection="list" item="item" index="index" open="" close="" separator=",">
-      (
-      #{item.pd_piid,jdbcType=INTEGER},#{item.pd_inoutno,jdbcType=VARCHAR},#{item.pd_piclass,jdbcType=VARCHAR},#{item.pd_pdno,jdbcType=INTEGER},#{item.pd_ordercode,jdbcType=VARCHAR},
-      #{item.pd_orderdetno,jdbcType=INTEGER},#{item.pd_prodid,jdbcType=INTEGER},#{item.pd_prodcode,jdbcType=VARCHAR},#{item.pd_unit,jdbcType=VARCHAR},
-      #{item.pd_inqty,jdbcType=DOUBLE},#{item.pd_outqty,jdbcType=DOUBLE},#{item.pd_orderprice,jdbcType=DOUBLE},#{item.pd_sendprice,jdbcType=DOUBLE},#{item.pd_price,jdbcType=DOUBLE},
-      #{item.pd_total,jdbcType=DOUBLE},#{item.pd_taxrate,jdbcType=DOUBLE},#{item.pd_netprice,jdbcType=DOUBLE},#{item.pd_nettotal,jdbcType=DOUBLE},
-      #{item.pd_whid,jdbcType=INTEGER},#{item.pd_whcode,jdbcType=VARCHAR},#{item.pd_whname,jdbcType=VARCHAR},#{item.pd_inwhid,jdbcType=INTEGER},#{item.pd_inwhcode,jdbcType=VARCHAR},
-      #{item.pd_inwhname,jdbcType=VARCHAR},#{item.pd_orderid,jdbcType=INTEGER},#{item.pd_sdid,jdbcType=INTEGER},#{item.pd_status,jdbcType=VARCHAR},#{item.pd_remark,jdbcType=VARCHAR},
-      #{item.companyId,jdbcType=INTEGER},#{item.updaterId,jdbcType=INTEGER},#{item.updateTime,jdbcType=TIMESTAMP},#{item.pd_text1,jdbcType=VARCHAR},#{item.pd_text2,jdbcType=VARCHAR},
-      #{item.pd_text3,jdbcType=VARCHAR},#{item.pd_text4,jdbcType=VARCHAR},#{item.pd_text5,jdbcType=VARCHAR},#{item.pd_ym,jdbcType=INTEGER},#{item.pd_yqty,jdbcType=DOUBLE}
-      )
-    </foreach>
-  </insert>
-  <insert id="batchInsert1" parameterType="java.util.List" >
     <foreach collection="list" item="item" index="index" open="" close="" separator=",">
       insert into prodiodetail
       <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -847,9 +790,9 @@
           #{item.pd_ioid,jdbcType=INTEGER},
         </if>
       </trim>
-
     </foreach>
   </insert>
+
   <update id="batchUpdate" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail" >
     <foreach collection="list" item="item" index="index" open="" close="" separator=";">
       update prodiodetail <set>

+ 0 - 24
applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutMapper.xml

@@ -64,30 +64,6 @@
     where pi_id = #{pi_id,jdbcType=INTEGER}
   </delete>
 
-  <insert id="insert" parameterType="com.usoftchina.saas.purchase.po.ProdInOut">
-    insert into prodinout (pi_id, pi_inoutno, pi_class, 
-      pi_date, pi_vendid, pi_vendcode, 
-      pi_vendname, pi_custid, pi_custcode, 
-      pi_custname, pi_puid, pi_pucode, 
-      pi_said, pi_sacode, pi_total, 
-      pi_recordmanid, pi_recordman, pi_recorddate, 
-      pi_status, pi_statuscode, pi_printstatus, 
-      pi_printstatuscode, companyid, updaterid, 
-      updatetime, pi_text1, pi_text2, 
-      pi_text3, pi_text4, pi_text5,
-      pi_address)
-    values (#{pi_id,jdbcType=INTEGER}, #{pi_inoutno,jdbcType=VARCHAR}, #{pi_class,jdbcType=VARCHAR}, 
-      #{pi_date,jdbcType=TIMESTAMP}, #{pi_vendid,jdbcType=INTEGER}, #{pi_vendcode,jdbcType=VARCHAR}, 
-      #{pi_vendname,jdbcType=VARCHAR}, #{pi_custid,jdbcType=INTEGER}, #{pi_custcode,jdbcType=VARCHAR}, 
-      #{pi_custname,jdbcType=VARCHAR}, #{pi_puid,jdbcType=INTEGER}, #{pi_pucode,jdbcType=VARCHAR}, 
-      #{pi_said,jdbcType=INTEGER}, #{pi_sacode,jdbcType=VARCHAR}, #{pi_total,jdbcType=DOUBLE},
-      #{pi_recordmanid,jdbcType=INTEGER}, #{pi_recordman,jdbcType=VARCHAR}, #{pi_recorddate,jdbcType=TIMESTAMP}, 
-      #{pi_status,jdbcType=VARCHAR}, #{pi_statuscode,jdbcType=VARCHAR}, #{pi_printstatus,jdbcType=VARCHAR}, 
-      #{pi_printstatuscode,jdbcType=VARCHAR}, #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER}, 
-      #{updatetime,jdbcType=TIMESTAMP}, #{pi_text1,jdbcType=VARCHAR}, #{pi_text2,jdbcType=VARCHAR}, 
-      #{pi_text3,jdbcType=VARCHAR}, #{pi_text4,jdbcType=VARCHAR}, #{pi_text5,jdbcType=VARCHAR}, 
-      #{pi_address,jdbcType=LONGVARCHAR})
-  </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.ProdInOut">
     <selectKey resultType="java.lang.Long" keyProperty="id">
       SELECT LAST_INSERT_ID() AS ID

+ 4 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java

@@ -33,4 +33,8 @@ public interface SaleMapper {
     Integer validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long companyId);
 
     void updateTotal(Long id);
+
+    void updateTotalAndNetPrice(Long id);
+
+    void updateNetTotal(Long id);
 }

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

@@ -96,7 +96,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         prodInOut.setPi_date(new Date());
 
         //编号获取
-        pi_inoutno = pushMaxnubmer(pi_inoutno, pi_id,pi_class);
+        pi_inoutno = pushMaxnubmer(prodInOut);
         prodInOut.setPi_inoutno(pi_inoutno);
 
         prodInOut.setPi_class(main.getPi_class());
@@ -549,14 +549,13 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
      * @Author: guq
      * @Date: 2018/10/19
      */
-    private String pushMaxnubmer(String code, Long id,String pi_class) {
+    private String pushMaxnubmer(ProdInOut prodInOut) {
+        String code = prodInOut.getPi_inoutno();
+        Long id = prodInOut.getId();
+        String pi_class = prodInOut.getPi_class();
         if (null == code) {
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
-        ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(id);
-        if(prodInOut==null){
-            throw new BizException(BizExceptionCode.NO_DATA);
-        }
         Integer count = "0".equals(String.valueOf(id)) ? prodInOutMapper.validateCodeWhenInsert(code,pi_class) :
                 prodInOutMapper.validateCodeWhenUpdate(code, id);
         String caller ="";

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

@@ -137,7 +137,11 @@ public class SaleServiceImpl implements SaleService{
             }
             baseDTO = getBaseDTOById(sa_id);
             //更新销售金额
-            getTotal(sa_id);
+            updateTotal(sa_id);
+            //更新从表总额
+            updateTotalAndNetPrice(sa_id);
+            //更新从表不含税金额
+            updateNetTotal(sa_id);
             //日志记录
             messageLogService.save(baseDTO);
             return baseDTO;
@@ -165,7 +169,11 @@ public class SaleServiceImpl implements SaleService{
         }
         baseDTO = getBaseDTOById(sa_id);
         //更新销售金额
-        getTotal(sa_id);
+        updateTotal(sa_id);
+        //更新从表总额
+        updateTotalAndNetPrice(sa_id);
+        //更新从表不含税金额
+        updateNetTotal(sa_id);
         //日志
         messageLogService.update(baseDTO);
         return baseDTO;
@@ -252,7 +260,12 @@ public class SaleServiceImpl implements SaleService{
         sale.setUpdaterId(BaseContextHolder.getUserId());
         //更新存在字段
         saleMapper.updateByPrimaryKeySelective(sale);
-
+        //更新销售金额
+        updateTotal(id);
+        //更新从表总额
+        updateTotalAndNetPrice(id);
+        //更新从表不含税金额
+        updateNetTotal(id);
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
         messageLogService.audit(docBaseDTO);
@@ -489,11 +502,31 @@ public class SaleServiceImpl implements SaleService{
     }
 
     //更新最新销售总额
-    private void getTotal(Long id) {
+    private void updateTotal(Long id) {
         if (null == id) {
             return;
         }
         saleMapper.updateTotal(id);
     }
 
+    /**
+    * @Description: 更新从表总额与不含税单价
+    * @Param: [id]
+    * @return: void
+    * @Author: guq
+    * @Date: 2018/10/27
+    */
+    private void updateTotalAndNetPrice(Long id) {
+        if (null == id) {
+            return;
+        }
+        saleMapper.updateTotalAndNetPrice(id);
+    }
+
+    private void updateNetTotal(Long id) {
+        if (null == id) {
+            return;
+        }
+        saleMapper.updateNetTotal(id);
+    }
 }

+ 11 - 0
applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml

@@ -364,4 +364,15 @@
   <update id="updateTotal" parameterType="long">
     	update sale a set sa_total=(select sum(sd_price*sd_qty) from saledetail b where b.sd_said=a.sa_id ) where sa_id=#{id};
   </update>
+
+  <update id="updateTotalAndNetPrice" parameterType="long">
+    update saledetail a set sd_total=sd_qty*sd_price,
+    sd_netprice=round(ifnull(sd_price,0)/(1+ifnull(sd_taxrate,0)/100),6)
+     where sd_said=#{id}
+  </update>
+
+  <update id="updateNetTotal" parameterType="long">
+    update saledetail a set sd_nettotal=round(ifnull(sd_netprice,0)*nvl(sd_qty,0),2)
+    where sd_said=#{id}
+  </update>
 </mapper>

+ 28 - 0
base-servers/account/README.md

@@ -0,0 +1,28 @@
+
+> ac_resource_module 资源模块
+
+| 字段      |  说明 |
+| :----:   | ---------  |
+| id | 主键,自动生成  |
+| app_id | 所属应用:trade-app(贸易云), manufacture-app(制造云), solution-app(方案云) |
+| name | 名称,例如:采购、销售、库存、资金、资料 |
+
+> ac_resource_group 资源分组
+
+| 字段      |  说明 |
+| :----:   | ---------  |
+| id | 主键,自动生成  |
+| module_id | 资源模块ID,参考ac_resource_module表 |
+| name | 名称,例如:采购单、采购验收单 |
+
+> ac_resource 资源
+
+| 字段      |  说明 |
+| :----:   | ---------  |
+| id | 主键,自动生成  |
+| group_id | 资源分组ID,参考ac_resource_group、ac_resource_module表 |
+| name | 名称,统一叫法:查询、新增、修改、审核、反审核、删除、打印、(其它,字数≤5) |
+| type | 类型,MENU(Navigation的资源)、BUTTON (页面按钮资源)、API... |
+| url | 请求url |
+| method | http请求头方法:GET, POST, PUT, DELETE |
+| classify | 归类:QUERY, ADD, UPDATE, AUDIT, UNAUDIT, DELETE, PRINT, OTHER  |

+ 4 - 0
base-servers/account/account-dto/pom.xml

@@ -18,6 +18,10 @@
             <artifactId>springfox-swagger2</artifactId>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>commons-dto</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 48 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/constant/ResourceClassify.java

@@ -0,0 +1,48 @@
+package com.usoftchina.saas.account.constant;
+
+/**
+ * @author yingp
+ * @date 2018/10/26
+ */
+public enum ResourceClassify {
+    /**
+     * 查询
+     */
+    QUERY,
+    /**
+     * 新增
+     */
+    ADD,
+    /**
+     * 保存
+     */
+    UPDATE,
+    /**
+     * 删除
+     */
+    DELETE,
+    /**
+     * (批量)审批
+     */
+    AUDIT,
+    /**
+     * (批量)反审批
+     */
+    UNAUDIT,
+    /**
+     * 导入
+     */
+    IMPORT,
+    /**
+     * 导出
+     */
+    EXPORT,
+    /**
+     * 打印
+     */
+    PRINT,
+    /**
+     * 其它
+     */
+    OTHER
+}

+ 26 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/constant/RoleType.java

@@ -0,0 +1,26 @@
+package com.usoftchina.saas.account.constant;
+
+/**
+ * @author yingp
+ * @date 2018/10/23
+ */
+public enum RoleType {
+    /**
+     * 管理角色
+     */
+    ADMIN(0),
+    /**
+     * 普通角色
+     */
+    NORMAL(1);
+
+    private final int type;
+
+    RoleType(int type) {
+        this.type = type;
+    }
+
+    public int getType() {
+        return type;
+    }
+}

+ 100 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/ResourceDTO.java

@@ -0,0 +1,100 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+
+/**
+ * 用于资源权限分配
+ *
+ * @author yingp
+ * @date 2018/10/10
+ */
+public class ResourceDTO implements Serializable {
+    private Long id;
+    /**
+     * 名称
+     */
+    private String name;
+    /**
+     * 资源类型
+     * MENU - 菜单
+     * DIR - 目录
+     * BUTTON - 按钮
+     * URI - 页面上的url
+     * API - api
+     */
+    private String type;
+    /**
+     * url
+     */
+    private String url;
+
+    /**
+     * 资源请求方式 POST/GET/PUT/DELETE
+     */
+    private String method;
+    /**
+     * 资源分组
+     * @see com.usoftchina.saas.account.constant.ResourceClassify
+     */
+    private String classify;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public void setMethod(String method) {
+        this.method = method;
+    }
+
+    public String getClassify() {
+        return classify;
+    }
+
+    public void setClassify(String classify) {
+        this.classify = classify;
+    }
+
+    @Override
+    public String toString() {
+        return "ResourceDTO{" +
+                "id=" + id +
+                ", name='" + name + '\'' +
+                ", type='" + type + '\'' +
+                ", url='" + url + '\'' +
+                ", method='" + method + '\'' +
+                ", classify='" + classify + '\'' +
+                '}';
+    }
+}

+ 169 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/ResourceGroupDTO.java

@@ -0,0 +1,169 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 用于资源权限分配
+ *
+ * @author yingp
+ * @date 2018/10/26
+ */
+public class ResourceGroupDTO implements Serializable{
+    private Long id;
+    private String name;
+    /**
+     * 查询
+     */
+    private List<ResourceDTO> queries;
+    /**
+     * 新增
+     */
+    private List<ResourceDTO> adds;
+    /**
+     * 修改
+     */
+    private List<ResourceDTO> updates;
+    /**
+     * 删除
+     */
+    private List<ResourceDTO> deletes;
+    /**
+     * 审核
+     */
+    private List<ResourceDTO> audits;
+    /**
+     * 反审核
+     */
+    private List<ResourceDTO> unAudits;
+    /**
+     * 打印
+     */
+    private List<ResourceDTO> prints;
+    /**
+     * 导出
+     */
+    private List<ResourceDTO> exports;
+    /**
+     * 导入
+     */
+    private List<ResourceDTO> imports;
+    /**
+     * 其它
+     */
+    private List<ResourceDTO> others;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public List<ResourceDTO> getQueries() {
+        return queries;
+    }
+
+    public void setQueries(List<ResourceDTO> queries) {
+        this.queries = queries;
+    }
+
+    public List<ResourceDTO> getAdds() {
+        return adds;
+    }
+
+    public void setAdds(List<ResourceDTO> adds) {
+        this.adds = adds;
+    }
+
+    public List<ResourceDTO> getUpdates() {
+        return updates;
+    }
+
+    public void setUpdates(List<ResourceDTO> updates) {
+        this.updates = updates;
+    }
+
+    public List<ResourceDTO> getDeletes() {
+        return deletes;
+    }
+
+    public void setDeletes(List<ResourceDTO> deletes) {
+        this.deletes = deletes;
+    }
+
+    public List<ResourceDTO> getAudits() {
+        return audits;
+    }
+
+    public void setAudits(List<ResourceDTO> audits) {
+        this.audits = audits;
+    }
+
+    public List<ResourceDTO> getUnAudits() {
+        return unAudits;
+    }
+
+    public void setUnAudits(List<ResourceDTO> unAudits) {
+        this.unAudits = unAudits;
+    }
+
+    public List<ResourceDTO> getPrints() {
+        return prints;
+    }
+
+    public void setPrints(List<ResourceDTO> prints) {
+        this.prints = prints;
+    }
+
+    public List<ResourceDTO> getExports() {
+        return exports;
+    }
+
+    public void setExports(List<ResourceDTO> exports) {
+        this.exports = exports;
+    }
+
+    public List<ResourceDTO> getImports() {
+        return imports;
+    }
+
+    public void setImports(List<ResourceDTO> imports) {
+        this.imports = imports;
+    }
+
+    public List<ResourceDTO> getOthers() {
+        return others;
+    }
+
+    public void setOthers(List<ResourceDTO> others) {
+        this.others = others;
+    }
+
+    @Override
+    public String toString() {
+        return "ResourceGroupDTO{" +
+                "id=" + id +
+                ", name='" + name + '\'' +
+                ", queries=" + queries +
+                ", adds=" + adds +
+                ", updates=" + updates +
+                ", deletes=" + deletes +
+                ", audits=" + audits +
+                ", unAudits=" + unAudits +
+                ", prints=" + prints +
+                ", exports=" + exports +
+                ", imports=" + imports +
+                ", others=" + others +
+                '}';
+    }
+}

+ 49 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/ResourceModuleDTO.java

@@ -0,0 +1,49 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 用于资源权限分配
+ *
+ * @author yingp
+ * @date 2018/10/26
+ */
+public class ResourceModuleDTO implements Serializable{
+    private Long id;
+    private String name;
+    private List<ResourceGroupDTO> groups;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public List<ResourceGroupDTO> getGroups() {
+        return groups;
+    }
+
+    public void setGroups(List<ResourceGroupDTO> groups) {
+        this.groups = groups;
+    }
+
+    @Override
+    public String toString() {
+        return "ResourceModuleDTO{" +
+                "id=" + id +
+                ", name='" + name + '\'' +
+                ", groups=" + groups +
+                '}';
+    }
+}

+ 0 - 10
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/ResourcesDTO.java

@@ -1,10 +0,0 @@
-package com.usoftchina.saas.account.dto;
-
-import java.io.Serializable;
-
-/**
- * @author yingp
- * @date 2018/10/10
- */
-public class ResourcesDTO implements Serializable{
-}

+ 75 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/RoleDTO.java

@@ -0,0 +1,75 @@
+package com.usoftchina.saas.account.dto;
+
+import com.usoftchina.saas.base.dto.CommonBaseDTO;
+
+import java.io.Serializable;
+
+/**
+ * @author yingp
+ * @date 2018/10/24
+ */
+public class RoleDTO extends CommonBaseDTO implements Serializable{
+    /**
+     * 公司
+     */
+    private Long companyId;
+    /**
+     * 角色编码
+     */
+    private String code;
+    /**
+     * 角色名称
+     */
+    private String name;
+    /**
+     * 描述
+     */
+    private String description;
+
+    public Long getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Long companyId) {
+        this.companyId = companyId;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public String toString() {
+        return "RoleDTO{" +
+                "companyId=" + companyId +
+                ", code='" + code + '\'' +
+                ", name='" + name + '\'' +
+                ", description='" + description + '\'' +
+                ", id=" + id +
+                ", createTime=" + createTime +
+                ", creatorName='" + creatorName + '\'' +
+                ", updateTime=" + updateTime +
+                ", updaterName='" + updaterName + '\'' +
+                '}';
+    }
+}

+ 57 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/RoleSaveDTO.java

@@ -0,0 +1,57 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+
+/**
+ * 角色新增 数据传输对象
+ *
+ * @author yingp
+ * @date 2018/10/24
+ */
+public class RoleSaveDTO implements Serializable {
+    /**
+     * 编号
+     */
+    private String code;
+    /**
+     * 名称
+     */
+    private String name;
+    /**
+     * 描述
+     */
+    private String description;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public String toString() {
+        return "RoleSaveDTO{" +
+                "code='" + code + '\'' +
+                ", name='" + name + '\'' +
+                ", description='" + description + '\'' +
+                '}';
+    }
+}

+ 67 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/RoleUpdateDTO.java

@@ -0,0 +1,67 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+
+/**
+ * 角色修改 数据传输对象
+ *
+ * @author yingp
+ * @date 2018/10/24
+ */
+public class RoleUpdateDTO implements Serializable {
+    private Long id;
+    /**
+     * 编号
+     */
+    private String code;
+    /**
+     * 名称
+     */
+    private String name;
+    /**
+     * 描述
+     */
+    private String description;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public String toString() {
+        return "RoleSaveDTO{" +
+                "id=" + id +
+                ", code='" + code + '\'' +
+                ", name='" + name + '\'' +
+                ", description='" + description + '\'' +
+                '}';
+    }
+}

+ 57 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/UrlResourceDTO.java

@@ -0,0 +1,57 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+
+/**
+ * 用于url拦截判断的属性
+ *
+ * @author yingp
+ * @date 2018/10/26
+ */
+public class UrlResourceDTO implements Serializable{
+    /**
+     * 名称
+     */
+    private String name;
+    /**
+     * url
+     */
+    private String url;
+    /**
+     * 资源请求方式 POST/GET/PUT/DELETE
+     */
+    private String method;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public void setMethod(String method) {
+        this.method = method;
+    }
+
+    @Override
+    public String toString() {
+        return "UrlResourceDTO{" +
+                "name='" + name + '\'' +
+                ", url='" + url + '\'' +
+                ", method='" + method + '\'' +
+                '}';
+    }
+}

+ 5 - 5
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/AccountController.java

@@ -110,7 +110,7 @@ public class AccountController {
      * @param username
      * @return
      */
-    @GetMapping
+    @GetMapping("/read")
     public Result<AccountDTO> getAccount(@RequestParam(value = "username") String username) {
         Account account = getAccountByUsername(username);
         if (null == account) {
@@ -204,12 +204,12 @@ public class AccountController {
     /**
      * 账户删除
      *
-     * @param accountId
+     * @param id
      * @return
      */
-    @PostMapping("/delete")
-    public Result deleteAccount(@RequestParam long accountId) {
-        accountService.removeByPrimaryKey(accountId);
+    @PostMapping("/delete/{id}")
+    public Result deleteAccount(@PathVariable Long id) {
+        accountService.removeByPrimaryKey(id);
         return Result.success();
     }
 }

+ 47 - 5
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/CompanyController.java

@@ -5,6 +5,7 @@ import com.usoftchina.saas.account.dto.CompanyRegDTO;
 import com.usoftchina.saas.account.po.Company;
 import com.usoftchina.saas.account.service.CompanyService;
 import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.exception.ExceptionCode;
 import com.usoftchina.saas.utils.BeanMapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -51,7 +52,7 @@ public class CompanyController {
      * @param name
      * @return
      */
-    @GetMapping(params = "name")
+    @GetMapping(path = "/read", params = "name")
     public Result<CompanyDTO> getByName(@RequestParam String name) {
         Company company = companyService.findByName(name);
         if (null != company) {
@@ -67,7 +68,7 @@ public class CompanyController {
      * @param businessCode
      * @return
      */
-    @GetMapping(params = "businessCode")
+    @GetMapping(path = "/read", params = "businessCode")
     public Result<CompanyDTO> getByBusinessCode(@RequestParam String businessCode) {
         Company company = companyService.findByBusinessCode(businessCode);
         if (null != company) {
@@ -77,15 +78,56 @@ public class CompanyController {
         return Result.error(ExceptionCode.COMPANY_NOT_EXIST);
     }
 
+    /**
+     * 当前登录的公司的信息
+     *
+     * @return
+     */
+    @GetMapping(path = "/read/current")
+    public Result<CompanyDTO> getCurrentCompany() {
+        Company company = companyService.findByPrimaryKey(BaseContextHolder.getCompanyId());
+        if (null != company) {
+            CompanyDTO companyDTO = BeanMapper.map(company, CompanyDTO.class);
+            return Result.success(companyDTO);
+        }
+        return Result.error(ExceptionCode.COMPANY_NOT_EXIST);
+    }
+
     /**
      * 删除
      *
+     * @param id
+     * @return
+     */
+    @PostMapping("/delete/{id}")
+    public Result delete(@PathVariable Long id) {
+        companyService.removeByPrimaryKey(id);
+        return Result.success();
+    }
+
+    /**
+     * 公司绑定应用
+     *
+     * @param companyId
+     * @param appId
+     * @return
+     */
+    @PostMapping("/bind/app")
+    public Result bindApp(@RequestParam long companyId, @RequestParam String appId) {
+        companyService.bindApp(companyId, appId);
+        return Result.success();
+    }
+
+    /**
+     * 公司解除绑定应用
+     *
      * @param companyId
+     * @param appId
      * @return
      */
-    @PostMapping("/delete")
-    public Result delete(@RequestParam Long companyId) {
-        companyService.removeByPrimaryKey(companyId);
+    @PostMapping("/unbind/app")
+    public Result unbindApp(@RequestParam long companyId, @RequestParam String appId) {
+        companyService.unbindApp(companyId, appId);
         return Result.success();
     }
 }

+ 0 - 8
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/ResourceController.java

@@ -1,8 +0,0 @@
-package com.usoftchina.saas.account.controller;
-
-/**
- * @author yingp
- * @date 2018/10/2
- */
-public class ResourceController {
-}

+ 56 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/ResourcesController.java

@@ -0,0 +1,56 @@
+package com.usoftchina.saas.account.controller;
+
+import com.usoftchina.saas.account.dto.ResourceModuleDTO;
+import com.usoftchina.saas.account.dto.UrlResourceDTO;
+import com.usoftchina.saas.account.service.ResourceService;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.utils.StringUtils;
+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;
+
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2018/10/2
+ */
+@RestController
+@RequestMapping("/resource")
+public class ResourcesController {
+
+    @Autowired
+    private ResourceService resourcesService;
+
+    /**
+     * 查找应用分模块的全部资源
+     *
+     * @return
+     */
+    @GetMapping("/module/list")
+    public Result<List<ResourceModuleDTO>> getModulesByAppId(String appId) {
+        if (StringUtils.isEmpty(appId)) {
+            // 查找当前登录应用的全部资源
+            appId = BaseContextHolder.getAppId();
+        }
+        return Result.success(resourcesService.findModulesByAppId(appId));
+    }
+
+    /**
+     * 查找应用的全部url资源
+     *
+     * @param appId
+     * @return
+     */
+    @GetMapping("/url/list")
+    public Result<List<UrlResourceDTO>> getUrlResourcesByAppId(String appId) {
+        if (StringUtils.isEmpty(appId)) {
+            // 查找当前登录应用的全部资源
+            appId = BaseContextHolder.getAppId();
+        }
+        return Result.success(resourcesService.findUrlResourcesByAppId(appId));
+    }
+
+}

+ 115 - 1
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/RoleController.java

@@ -1,8 +1,122 @@
 package com.usoftchina.saas.account.controller;
 
+import com.usoftchina.saas.account.dto.RoleDTO;
+import com.usoftchina.saas.account.dto.RoleSaveDTO;
+import com.usoftchina.saas.account.dto.RoleUpdateDTO;
+import com.usoftchina.saas.account.po.Role;
+import com.usoftchina.saas.account.service.RoleService;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.exception.ExceptionCode;
+import com.usoftchina.saas.utils.BeanMapper;
+import com.usoftchina.saas.utils.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
 /**
  * @author yingp
  * @date 2018/10/2
  */
+@RestController
+@RequestMapping("/role")
 public class RoleController {
-}
+
+    @Autowired
+    private RoleService roleService;
+
+    /**
+     * 保存
+     *
+     * @param roleSaveDTO
+     * @return
+     */
+    @PostMapping("/save")
+    public Result<DocBaseDTO> save(@RequestBody RoleSaveDTO roleSaveDTO) {
+        Role role = BeanMapper.map(roleSaveDTO, Role.class);
+        roleService.save(role);
+        return Result.success(BeanMapper.map(role, DocBaseDTO.class));
+    }
+
+    /**
+     * 修改
+     *
+     * @param roleUpdateDTO
+     * @return
+     */
+    @PostMapping("/update")
+    public Result update(@RequestBody RoleUpdateDTO roleUpdateDTO) {
+        Role role = BeanMapper.map(roleUpdateDTO, Role.class);
+        roleService.updateByPrimaryKey(role);
+        return Result.success();
+    }
+
+    /**
+     * 删除
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/delete/{id}")
+    public Result delete(@PathVariable Long id) {
+        roleService.removeByPrimaryKey(id);
+        return Result.success();
+    }
+
+    /**
+     * 查找
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/read/{id}")
+    public Result<RoleDTO> get(@PathVariable Long id) {
+        Role role = roleService.findByPrimaryKey(id);
+        if (null == role) {
+            return Result.error(ExceptionCode.ROLE_NOT_EXIST);
+        }
+        return Result.success(BeanMapper.map(role, RoleDTO.class));
+    }
+
+    /**
+     * 查找当前登录公司的全部角色
+     *
+     * @return
+     */
+    @GetMapping("/list")
+    public Result<List<RoleDTO>> getByCompany() {
+        List<Role> roles = roleService.findByCompanyId(BaseContextHolder.getCompanyId());
+        if (CollectionUtils.isEmpty(roles)) {
+            return Result.success();
+        }
+        return Result.success(BeanMapper.mapList(roles, RoleDTO.class));
+    }
+
+    /**
+     * 角色绑定资源
+     *
+     * @param roleId
+     * @param resourceId
+     * @return
+     */
+    @PostMapping("/bind/resource")
+    public Result bindResource(@RequestParam long roleId, @RequestParam long resourceId) {
+        roleService.bindResource(roleId, resourceId);
+        return Result.success();
+    }
+
+    /**
+     * 角色解除绑定资源
+     *
+     * @param roleId
+     * @param resourceId
+     * @return
+     */
+    @PostMapping("/unbind/resource")
+    public Result unbindResource(@RequestParam long roleId, @RequestParam long resourceId) {
+        roleService.unbindResource(roleId, resourceId);
+        return Result.success();
+    }
+}

+ 12 - 2
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/AccountCompanyMapper.java

@@ -22,13 +22,23 @@ public interface AccountCompanyMapper {
      *
      * @param accountId
      * @param companyId
+     * @return
      */
-    void delete(@Param("accountId") Long accountId, @Param("companyId") Long companyId);
+    int delete(@Param("accountId") Long accountId, @Param("companyId") Long companyId);
 
     /**
      * 按账户删除
      *
      * @param accountId
+     * @return
+     */
+    int deleteByAccountId(@Param("accountId") Long accountId);
+
+    /**
+     * 按公司删除
+     *
+     * @param companyId
+     * @return
      */
-    void deleteByAccountId(@Param("accountId") Long accountId);
+    int deleteByCompanyId(@Param("companyId") Long companyId);
 }

+ 7 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/AccountRoleMapper.java

@@ -30,4 +30,11 @@ public interface AccountRoleMapper {
      * @param accountId
      */
     void deleteByAccountId(@Param("accountId") Long accountId);
+
+    /**
+     * 按角色删除
+     *
+     * @param roleId
+     */
+    void deleteByRoleId(@Param("roleId") Long roleId);
 }

+ 33 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/CompanyAppMapper.java

@@ -0,0 +1,33 @@
+package com.usoftchina.saas.account.mapper;
+
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @author yingp
+ * @date 2018/10/24
+ */
+public interface CompanyAppMapper {
+    /**
+     * 新增
+     *
+     * @param companyId
+     * @param appId
+     * @return
+     */
+    int insert(@Param("companyId") Long companyId, @Param("appId") String appId);
+
+    /**
+     * 删除
+     *
+     * @param companyId
+     * @param appId
+     */
+    void delete(@Param("companyId") Long companyId, @Param("appId") String appId);
+    /**
+     * 按公司删除
+     *
+     * @param companyId
+     * @return
+     */
+    int deleteByCompanyId(@Param("companyId") Long companyId);
+}

+ 10 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/CompanyMapper.java

@@ -27,6 +27,14 @@ public interface CompanyMapper {
      */
     int insertSelective(Company record);
 
+    /**
+     * 按主键查询
+     *
+     * @param id
+     * @return
+     */
+    Company selectByPrimaryKey(@Param("id") Long id);
+
     /**
      * 按名称查询
      *
@@ -58,4 +66,6 @@ public interface CompanyMapper {
      * @return
      */
     int deleteByPrimaryKey(@Param("id") Long id);
+
+
 }

+ 21 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/ResourceGroupMapper.java

@@ -0,0 +1,21 @@
+package com.usoftchina.saas.account.mapper;
+
+import com.usoftchina.saas.account.po.ResourceGroup;
+import com.usoftchina.saas.account.po.ResourceModule;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2018/10/26
+ */
+public interface ResourceGroupMapper {
+    /**
+     * 按资源模块查找
+     *
+     * @param moduleId
+     * @return
+     */
+    List<ResourceGroup> selectByModuleId(@Param("moduleId") Long moduleId);
+}

+ 29 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/ResourceMapper.java

@@ -0,0 +1,29 @@
+package com.usoftchina.saas.account.mapper;
+
+import com.usoftchina.saas.account.po.Resource;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2018/10/2
+ */
+public interface ResourceMapper {
+
+    /**
+     * 按资源组查找
+     *
+     * @param groupId
+     * @return
+     */
+    List<Resource> selectByGroupId(@Param("groupId") Long groupId);
+
+    /**
+     * 按应用查找
+     *
+     * @param appId
+     * @return
+     */
+    List<Resource> selectByAppId(@Param("appId") String appId);
+}

+ 20 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/ResourceModuleMapper.java

@@ -0,0 +1,20 @@
+package com.usoftchina.saas.account.mapper;
+
+import com.usoftchina.saas.account.po.ResourceModule;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2018/10/26
+ */
+public interface ResourceModuleMapper {
+    /**
+     * 按应用查找
+     *
+     * @param appId
+     * @return
+     */
+    List<ResourceModule> selectByAppId(@Param("appId") String appId);
+}

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

@@ -1,11 +0,0 @@
-package com.usoftchina.saas.account.mapper;
-
-import com.usoftchina.saas.account.po.Resources;
-import com.usoftchina.saas.base.mapper.CommonBaseMapper;
-
-/**
- * @author yingp
- * @date 2018/10/2
- */
-public interface ResourcesMapper extends CommonBaseMapper<Resources> {
-}

+ 10 - 1
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/RoleResourceMapper.java

@@ -21,6 +21,15 @@ public interface RoleResourceMapper {
      *
      * @param roleId
      * @param resourceId
+     * @return
+     */
+    int delete(@Param("roleId") Long roleId, @Param("resourceId") Long resourceId);
+
+    /**
+     * 按角色删除
+     *
+     * @param roleId
+     * @return
      */
-    void delete(@Param("roleId") Long roleId, @Param("resourceId") Long resourceId);
+    int deleteByRoleId(@Param("roleId") Long roleId);
 }

+ 31 - 36
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/Resources.java → base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/Resource.java

@@ -1,7 +1,5 @@
 package com.usoftchina.saas.account.po;
 
-import com.usoftchina.saas.base.entity.CommonBaseEntity;
-
 import java.io.Serializable;
 
 /**
@@ -10,15 +8,12 @@ import java.io.Serializable;
  * @author yingp
  * @date 2018/10/2
  */
-public class Resources extends CommonBaseEntity implements Serializable {
+public class Resource implements Serializable {
+    private Long id;
     /**
-     * 编号
+     * 资源组
      */
-    private String code;
-    /**
-     * 名称
-     */
-    private String name;
+    private Long groupId;
     /**
      * 资源类型
      * MENU - 菜单
@@ -28,6 +23,11 @@ public class Resources extends CommonBaseEntity implements Serializable {
      * API - api
      */
     private String type;
+    /**
+     * 资源分类
+     * @see com.usoftchina.saas.account.constant.ResourceClassify
+     */
+    private String classify;
     /**
      * url
      */
@@ -39,29 +39,16 @@ public class Resources extends CommonBaseEntity implements Serializable {
     private String method;
 
     /**
-     * 排序
-     */
-    private Integer orderNum;
-
-    /**
-     * 描述
+     * 名称
      */
-    private String description;
-
-    public String getCode() {
-        return code;
-    }
-
-    public void setCode(String code) {
-        this.code = code;
-    }
+    private String name;
 
-    public String getName() {
-        return name;
+    public Long getId() {
+        return id;
     }
 
-    public void setName(String name) {
-        this.name = name;
+    public void setId(Long id) {
+        this.id = id;
     }
 
     public String getType() {
@@ -72,6 +59,14 @@ public class Resources extends CommonBaseEntity implements Serializable {
         this.type = type;
     }
 
+    public String getClassify() {
+        return classify;
+    }
+
+    public void setClassify(String classify) {
+        this.classify = classify;
+    }
+
     public String getUrl() {
         return url;
     }
@@ -88,19 +83,19 @@ public class Resources extends CommonBaseEntity implements Serializable {
         this.method = method;
     }
 
-    public Integer getOrderNum() {
-        return orderNum;
+    public String getName() {
+        return name;
     }
 
-    public void setOrderNum(Integer orderNum) {
-        this.orderNum = orderNum;
+    public void setName(String name) {
+        this.name = name;
     }
 
-    public String getDescription() {
-        return description;
+    public Long getGroupId() {
+        return groupId;
     }
 
-    public void setDescription(String description) {
-        this.description = description;
+    public void setGroupId(Long groupId) {
+        this.groupId = groupId;
     }
 }

+ 40 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/ResourceGroup.java

@@ -0,0 +1,40 @@
+package com.usoftchina.saas.account.po;
+
+import java.io.Serializable;
+
+/**
+ * 资源组
+ * 可以按单据分组
+ *
+ * @author yingp
+ * @date 2018/10/25
+ */
+public class ResourceGroup implements Serializable {
+    private Long id;
+    private Long moduleId;
+    private String name;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getModuleId() {
+        return moduleId;
+    }
+
+    public void setModuleId(Long moduleId) {
+        this.moduleId = moduleId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 40 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/ResourceModule.java

@@ -0,0 +1,40 @@
+package com.usoftchina.saas.account.po;
+
+import java.io.Serializable;
+
+/**
+ * 资源模块
+ * 按采购、销售、资金...分模块
+ *
+ * @author yingp
+ * @date 2018/10/25
+ */
+public class ResourceModule implements Serializable {
+    private Long id;
+    private String appId;
+    private String name;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 13 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/Role.java

@@ -24,6 +24,11 @@ public class Role extends CommonBaseEntity implements Serializable {
      */
     private String description;
 
+    /**
+     * 角色类型:0 - 管理员角色, 1 - 普通角色
+     */
+    private Integer type;
+
     public String getCode() {
         return code;
     }
@@ -47,4 +52,12 @@ public class Role extends CommonBaseEntity implements Serializable {
     public void setDescription(String description) {
         this.description = description;
     }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
 }

+ 24 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/CompanyService.java

@@ -34,6 +34,14 @@ public interface CompanyService {
      */
     Company findByBusinessCode(String businessCode);
 
+    /**
+     * 按ID查找
+     *
+     * @param id
+     * @return
+     */
+    Company findByPrimaryKey(Long id);
+
     /**
      * 按个人账户查找全部绑定企业
      *
@@ -49,4 +57,20 @@ public interface CompanyService {
      * @return
      */
     boolean removeByPrimaryKey(Long id);
+
+    /**
+     * 公司绑定应用
+     *
+     * @param companyId
+     * @param appId
+     */
+    void bindApp(long companyId, String appId);
+
+    /**
+     * 公司解除绑定应用
+     *
+     * @param companyId
+     * @param appId
+     */
+    void unbindApp(long companyId, String appId);
 }

+ 29 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/ResourceService.java

@@ -0,0 +1,29 @@
+package com.usoftchina.saas.account.service;
+
+import com.usoftchina.saas.account.dto.ResourceModuleDTO;
+import com.usoftchina.saas.account.dto.UrlResourceDTO;
+import com.usoftchina.saas.account.po.Resource;
+
+import java.util.List;
+
+/**
+ * @author yingp
+ * @date 2018/10/24
+ */
+public interface ResourceService {
+    /**
+     * 按应用查找资源模块,以及模块下的资源分组 + 资源
+     *
+     * @param appId
+     * @return
+     */
+    List<ResourceModuleDTO> findModulesByAppId(String appId);
+
+    /**
+     * 按应用查找资源的url属性
+     *
+     * @param appId
+     * @return
+     */
+    List<UrlResourceDTO> findUrlResourcesByAppId(String appId);
+}

+ 28 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/RoleService.java

@@ -0,0 +1,28 @@
+package com.usoftchina.saas.account.service;
+
+import com.usoftchina.saas.account.mapper.RoleMapper;
+import com.usoftchina.saas.account.po.Role;
+import com.usoftchina.saas.base.service.CommonBaseService;
+
+/**
+ * @author yingp
+ * @date 2018/10/24
+ */
+public interface RoleService extends CommonBaseService<RoleMapper, Role>{
+
+    /**
+     * 角色绑定资源
+     *
+     * @param roleId
+     * @param resourceId
+     */
+    void bindResource(long roleId, long resourceId);
+
+    /**
+     * 角色解除绑定资源
+     *
+     * @param roleId
+     * @param resourceId
+     */
+    void unbindResource(long roleId, long resourceId);
+}

+ 2 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/AccountServiceImpl.java

@@ -7,6 +7,7 @@ import com.usoftchina.saas.account.po.Account;
 import com.usoftchina.saas.account.service.AccountService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.DigestUtils;
 
 /**
@@ -82,6 +83,7 @@ public class AccountServiceImpl implements AccountService {
         accountRoleMapper.delete(accountId, roleId);
     }
 
+    @Transactional(rollbackFor = Exception.class)
     @Override
     public boolean removeByPrimaryKey(Long id) {
         accountRoleMapper.deleteByAccountId(id);

+ 27 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/CompanyServiceImpl.java

@@ -1,5 +1,7 @@
 package com.usoftchina.saas.account.service.impl;
 
+import com.usoftchina.saas.account.mapper.AccountCompanyMapper;
+import com.usoftchina.saas.account.mapper.CompanyAppMapper;
 import com.usoftchina.saas.account.mapper.CompanyMapper;
 import com.usoftchina.saas.account.po.Company;
 import com.usoftchina.saas.account.service.CompanyService;
@@ -7,6 +9,7 @@ import com.usoftchina.saas.account.vo.CompanyBaseVO;
 import com.usoftchina.saas.context.BaseContextHolder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Date;
 import java.util.List;
@@ -21,6 +24,12 @@ public class CompanyServiceImpl implements CompanyService{
     @Autowired
     private CompanyMapper companyMapper;
 
+    @Autowired
+    private AccountCompanyMapper accountCompanyMapper;
+
+    @Autowired
+    private CompanyAppMapper companyAppMapper;
+
     @Override
     public boolean save(Company company) {
         Date nowDate = new Date();
@@ -42,13 +51,31 @@ public class CompanyServiceImpl implements CompanyService{
         return companyMapper.selectByBusinessCode(businessCode);
     }
 
+    @Override
+    public Company findByPrimaryKey(Long id) {
+        return companyMapper.selectByPrimaryKey(id);
+    }
+
     @Override
     public List<CompanyBaseVO> findBaseByAccountId(Long accountId) {
         return companyMapper.selectBaseByAccountId(accountId);
     }
 
+    @Transactional(rollbackFor = Exception.class)
     @Override
     public boolean removeByPrimaryKey(Long id) {
+        accountCompanyMapper.deleteByCompanyId(id);
+        companyAppMapper.deleteByCompanyId(id);
         return companyMapper.deleteByPrimaryKey(id) > 0;
     }
+
+    @Override
+    public void bindApp(long companyId, String appId) {
+        companyAppMapper.insert(companyId, appId);
+    }
+
+    @Override
+    public void unbindApp(long companyId, String appId) {
+        companyAppMapper.delete(companyId, appId);
+    }
 }

+ 104 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/ResourceServiceImpl.java

@@ -0,0 +1,104 @@
+package com.usoftchina.saas.account.service.impl;
+
+import com.usoftchina.saas.account.constant.ResourceClassify;
+import com.usoftchina.saas.account.dto.ResourceDTO;
+import com.usoftchina.saas.account.dto.ResourceGroupDTO;
+import com.usoftchina.saas.account.dto.ResourceModuleDTO;
+import com.usoftchina.saas.account.dto.UrlResourceDTO;
+import com.usoftchina.saas.account.mapper.ResourceGroupMapper;
+import com.usoftchina.saas.account.mapper.ResourceMapper;
+import com.usoftchina.saas.account.mapper.ResourceModuleMapper;
+import com.usoftchina.saas.account.po.Resource;
+import com.usoftchina.saas.account.po.ResourceGroup;
+import com.usoftchina.saas.account.po.ResourceModule;
+import com.usoftchina.saas.account.service.ResourceService;
+import com.usoftchina.saas.utils.BeanMapper;
+import com.usoftchina.saas.utils.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author yingp
+ * @date 2018/10/24
+ */
+@Service
+public class ResourceServiceImpl implements ResourceService {
+
+    @Autowired
+    private ResourceMapper resourceMapper;
+
+    @Autowired
+    private ResourceModuleMapper resourceModuleMapper;
+
+    @Autowired
+    private ResourceGroupMapper resourceGroupMapper;
+
+    @Override
+    public List<ResourceModuleDTO> findModulesByAppId(String appId) {
+        List<ResourceModule> modules = resourceModuleMapper.selectByAppId(appId);
+        if (!CollectionUtils.isEmpty(modules)) {
+            List<ResourceModuleDTO> moduleDTOS = BeanMapper.mapList(modules, ResourceModuleDTO.class);
+            moduleDTOS.parallelStream().forEach(moduleDTO -> {
+                moduleDTO.setGroups(findGroupsByModuleId(moduleDTO.getId()));
+            });
+            return moduleDTOS;
+        }
+        return null;
+    }
+
+    /**
+     * 模块下的资源分组
+     *
+     * @param moduleId
+     * @return
+     */
+    private List<ResourceGroupDTO> findGroupsByModuleId(Long moduleId) {
+        List<ResourceGroup> groups = resourceGroupMapper.selectByModuleId(moduleId);
+        if (!CollectionUtils.isEmpty(groups)) {
+            List<ResourceGroupDTO> groupDTOS = BeanMapper.mapList(groups, ResourceGroupDTO.class);
+            groupDTOS.parallelStream().forEach(groupDTO -> {
+                List<ResourceDTO> resources = findResourcesByGroupId(groupDTO.getId());
+                // 分类(分类后,方便快速设置)
+                Map<String, List<ResourceDTO>> map = CollectionUtils.groupBy(resources, ResourceDTO::getClassify);
+                groupDTO.setQueries(map.get(ResourceClassify.QUERY.name()));
+                groupDTO.setAdds(map.get(ResourceClassify.ADD.name()));
+                groupDTO.setUpdates(map.get(ResourceClassify.UPDATE.name()));
+                groupDTO.setDeletes(map.get(ResourceClassify.DELETE.name()));
+                groupDTO.setAudits(map.get(ResourceClassify.AUDIT.name()));
+                groupDTO.setUnAudits(map.get(ResourceClassify.UNAUDIT.name()));
+                groupDTO.setExports(map.get(ResourceClassify.EXPORT.name()));
+                groupDTO.setImports(map.get(ResourceClassify.IMPORT.name()));
+                groupDTO.setPrints(map.get(ResourceClassify.PRINT.name()));
+                groupDTO.setOthers(map.get(ResourceClassify.OTHER.name()));
+            });
+            return groupDTOS;
+        }
+        return null;
+    }
+
+    /**
+     * 资源组下的资源
+     *
+     * @param groupId
+     * @return
+     */
+    private List<ResourceDTO> findResourcesByGroupId(Long groupId) {
+        List<Resource> resources = resourceMapper.selectByGroupId(groupId);
+        if (!CollectionUtils.isEmpty(resources)) {
+            return BeanMapper.mapList(resources, ResourceDTO.class);
+        }
+        return null;
+    }
+
+    @Override
+    public List<UrlResourceDTO> findUrlResourcesByAppId(String appId) {
+        List<Resource> resources = resourceMapper.selectByAppId(appId);
+        if (!CollectionUtils.isEmpty(resources)) {
+            return BeanMapper.mapList(resources, UrlResourceDTO.class);
+        }
+        return null;
+    }
+}

+ 58 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/RoleServiceImpl.java

@@ -0,0 +1,58 @@
+package com.usoftchina.saas.account.service.impl;
+
+import com.usoftchina.saas.account.constant.RoleType;
+import com.usoftchina.saas.account.mapper.AccountRoleMapper;
+import com.usoftchina.saas.account.mapper.RoleMapper;
+import com.usoftchina.saas.account.mapper.RoleResourceMapper;
+import com.usoftchina.saas.account.po.Role;
+import com.usoftchina.saas.account.service.RoleService;
+import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.utils.StringUtils;
+import org.apache.commons.lang.RandomStringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author yingp
+ * @date 2018/10/24
+ */
+@Service
+public class RoleServiceImpl extends CommonBaseServiceImpl<RoleMapper, Role> implements RoleService{
+
+    private static final String ROLE_CODE_PREFIX = "ROLE_";
+
+    @Autowired
+    private RoleResourceMapper roleResourceMapper;
+
+    @Autowired
+    private AccountRoleMapper accountRoleMapper;
+
+    @Override
+    public boolean save(Role role) {
+        if (StringUtils.isEmpty(role.getCode())) {
+            role.setCode(ROLE_CODE_PREFIX + RandomStringUtils.randomAlphabetic(8));
+        }
+        // 新增的都是普通角色
+        role.setType(RoleType.NORMAL.getType());
+        return super.save(role);
+    }
+
+    @Override
+    public void bindResource(long roleId, long resourceId) {
+        roleResourceMapper.insert(roleId, resourceId);
+    }
+
+    @Override
+    public void unbindResource(long roleId, long resourceId) {
+        roleResourceMapper.delete(roleId, resourceId);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public boolean removeByPrimaryKey(Long id) {
+        accountRoleMapper.deleteByRoleId(id);
+        roleResourceMapper.deleteByRoleId(id);
+        return super.removeByPrimaryKey(id);
+    }
+}

+ 17 - 2
base-servers/account/account-server/src/main/resources/application.yml

@@ -7,8 +7,23 @@ 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.jdbc.Driver
+    driver-class-name: com.mysql.cj.jdbc.Driver
     url: jdbc:mysql://192.168.253.12:3306/saas_account?characterEncoding=utf-8&useSSL=false
     username: root
     password: select111***
@@ -31,7 +46,7 @@ eureka:
   client:
     registryFetchIntervalSeconds: 5
     serviceUrl:
-      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8500/eureka/
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8510/eureka/
 server:
   port: 8580
   tomcat:

+ 3 - 0
base-servers/account/account-server/src/main/resources/mapper/AccountCompanyMapper.xml

@@ -10,4 +10,7 @@
     <delete id="deleteByAccountId" parameterType="java.lang.Long">
         delete from ac_account_company where account_id=#{accountId}
     </delete>
+    <delete id="deleteByCompanyId" parameterType="java.lang.Long">
+        delete from ac_account_company where company_id=#{companyId}
+    </delete>
 </mapper>

+ 3 - 0
base-servers/account/account-server/src/main/resources/mapper/AccountRoleMapper.xml

@@ -10,4 +10,7 @@
     <delete id="deleteByAccountId" parameterType="java.lang.Long">
         delete from ac_account_role where account_id=#{accountId}
     </delete>
+    <delete id="deleteByRoleId" parameterType="java.lang.Long">
+        delete from ac_account_role where role_id=#{roleId}
+    </delete>
 </mapper>

+ 13 - 0
base-servers/account/account-server/src/main/resources/mapper/CompanyAppMapper.xml

@@ -0,0 +1,13 @@
+<?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.account.mapper.CompanyAppMapper">
+    <insert id="insert">
+        insert into ac_company_app(company_id,app_id) values (#{companyId,jdbcType=BIGINT}, #{appId,jdbcType=VARCHAR})
+    </insert>
+    <delete id="delete">
+        delete from ac_company_app where company_id=#{companyId,jdbcType=BIGINT} and app_id=#{appId,jdbcType=VARCHAR}
+    </delete>
+    <delete id="deleteByCompanyId" parameterType="java.lang.Long">
+        delete from ac_company_app where company_id=#{companyId}
+    </delete>
+</mapper>

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

@@ -80,17 +80,20 @@
             </if>
         </trim>
     </insert>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="FullResultMap">
+        select <include refid="baseColumns"/> from ac_company where id=#{id,jdbcType=BIGINT}
+    </select>
     <select id="selectByName" parameterType="java.lang.String" resultMap="FullResultMap">
-        select <include refid="baseColumns"/> from ac_company where name=#{name}
+        select <include refid="baseColumns"/> from ac_company where name=#{name,jdbcType=VARCHAR}
     </select>
     <select id="selectByBusinessCode" parameterType="java.lang.String" resultMap="FullResultMap">
-        select <include refid="baseColumns"/> from ac_company where business_code=#{businessCode}
+        select <include refid="baseColumns"/> from ac_company where business_code=#{businessCode,jdbcType=VARCHAR}
     </select>
     <select id="selectBaseByAccountId" parameterType="java.lang.Long" resultMap="BaseResultMap">
         select ac_company.id,ac_company.name,ac_company.logo_url from ac_account_company,ac_company
-        where ac_account_company.company_id=ac_company.id and ac_account_company.account_id=#{accountId}
+        where ac_account_company.company_id=ac_company.id and ac_account_company.account_id=#{accountId,jdbcType=BIGINT}
     </select>
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-        delete from ac_company where id=#{id}
+        delete from ac_company where id=#{id,jdbcType=BIGINT}
     </delete>
 </mapper>

+ 15 - 0
base-servers/account/account-server/src/main/resources/mapper/ResourceGroupMapper.xml

@@ -0,0 +1,15 @@
+<?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.account.mapper.ResourceGroupMapper">
+    <resultMap id="BaseResultMap" type="com.usoftchina.saas.account.po.ResourceGroup">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="module_id" jdbcType="BIGINT" property="moduleId"/>
+    </resultMap>
+    <sql id="baseColumns">
+        id,name,module_id
+    </sql>
+    <select id="selectByModuleId" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from ac_resource_group where module_id=#{moduleId,jdbcType=VARCHAR} order by id
+    </select>
+</mapper>

+ 24 - 0
base-servers/account/account-server/src/main/resources/mapper/ResourceMapper.xml

@@ -0,0 +1,24 @@
+<?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.account.mapper.ResourceMapper">
+    <resultMap id="BaseResultMap" type="com.usoftchina.saas.account.po.Resource">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="group_id" jdbcType="BIGINT" property="groupId"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="url" jdbcType="VARCHAR" property="url"/>
+        <result column="method" jdbcType="VARCHAR" property="method"/>
+        <result column="classify" jdbcType="VARCHAR" property="classify"/>
+    </resultMap>
+    <sql id="baseColumns">
+        ac_resource.id,ac_resource.name,ac_resource.group_id,ac_resource.type,ac_resource.url,ac_resource.method,ac_resource.classify
+    </sql>
+    <select id="selectByGroupId" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from ac_resource where group_id=#{groupId,jdbcType=BIGINT}
+    </select>
+    <select id="selectByAppId" parameterType="java.lang.String" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from ac_resource,ac_resource_module,ac_resource_group where
+        ac_resource_module.id=ac_resource_group.module_id and ac_resource_group.id=ac_resource.group_id
+        and ac_resource_module.app_id=#{appId,jdbcType=VARCHAR}
+    </select>
+</mapper>

+ 15 - 0
base-servers/account/account-server/src/main/resources/mapper/ResourceModuleMapper.xml

@@ -0,0 +1,15 @@
+<?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.account.mapper.ResourceModuleMapper">
+    <resultMap id="BaseResultMap" type="com.usoftchina.saas.account.po.ResourceModule">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="app_id" jdbcType="VARCHAR" property="appId"/>
+    </resultMap>
+    <sql id="baseColumns">
+        id,name,app_id
+    </sql>
+    <select id="selectByAppId" parameterType="java.lang.String" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from ac_resource_module where app_id=#{appId,jdbcType=VARCHAR} order by id
+    </select>
+</mapper>

+ 0 - 4
base-servers/account/account-server/src/main/resources/mapper/ResourcesMapper.xml

@@ -1,4 +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.account.mapper.ResourcesMapper">
-</mapper>

+ 98 - 1
base-servers/account/account-server/src/main/resources/mapper/RoleMapper.xml

@@ -1,5 +1,102 @@
 <?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.account.mapper.RoleMapper">
-
+    <resultMap id="BaseResultMap" type="com.usoftchina.saas.account.po.Role">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="code" jdbcType="VARCHAR" property="code"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="description" jdbcType="VARCHAR" property="description"/>
+        <result column="type" jdbcType="INTEGER" property="type"/>
+        <result column="company_id" jdbcType="BIGINT" 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"/>
+    </resultMap>
+    <sql id="baseColumns">
+        id,code,name,description,type,company_id,creator_id,create_time,updater_id,update_time
+    </sql>
+    <insert id="insert" parameterType="com.usoftchina.saas.account.po.Role"
+            useGeneratedKeys="true" keyProperty="id">
+        insert into ac_role(code,name,description,type,company_id,creator_id,create_time,updater_id,update_time)
+        values (#{code,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{companyId,jdbcType=BIGINT},
+        #{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP})
+    </insert>
+    <insert id="insertSelective" parameterType="com.usoftchina.saas.account.po.Role"
+            useGeneratedKeys="true" keyProperty="id">
+        insert into ac_role
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="code != null">
+                code,
+            </if>
+            <if test="name != null">
+                name,
+            </if>
+            <if test="description != null">
+                description,
+            </if>
+            <if test="type != null">
+                type,
+            </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>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="code != null">
+                #{code,jdbcType=VARCHAR},
+            </if>
+            <if test="name != null">
+                #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="description != null">
+                #{description,jdbcType=VARCHAR},
+            </if>
+            <if test="type != null">
+                #{type,jdbcType=INTEGER},
+            </if>
+            <if test="companyId != null">
+                #{companyId,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>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.account.po.Role">
+        update ac_role set code=#{code,jdbcType=VARCHAR},name=#{name,jdbcType=VARCHAR},
+        description=#{description,jdbcType=VARCHAR},type=#{type,jdbcType=INTEGER},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} where id=#{id,jdbcType=BIGINT}
+    </update>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+        delete from ac_role where id=#{id,jdbcType=BIGINT}
+    </delete>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from ac_role where id=#{id,jdbcType=BIGINT}
+    </select>
+    <select id="selectByCompanyId" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from ac_role where company_id=#{companyId,jdbcType=BIGINT}
+    </select>
 </mapper>

+ 3 - 0
base-servers/account/account-server/src/main/resources/mapper/RoleResourceMapper.xml

@@ -7,4 +7,7 @@
     <delete id="delete">
         delete from ac_role_resource where role_id=#{roleId} and resource_id=#{resourceId}
     </delete>
+    <delete id="deleteByRoleId" parameterType="java.lang.Long">
+        delete from ac_role_resource where role_id=#{roleId}
+    </delete>
 </mapper>

+ 1 - 2
base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/controller/AccountControllerTest.java

@@ -111,8 +111,7 @@ public class AccountControllerTest extends BaseControllerTest {
     @Test
     public void testI_deleteAccount() throws Exception {
         AccountDTO accountDTO = getAccountDTO();
-        mockMvc.perform(post("/account/delete")
-                .param("accountId", String.valueOf(accountDTO.getId())))
+        mockMvc.perform(post("/account/delete/{id}", accountDTO.getId()))
                 .andExpect(isSuccess());
     }
 }

+ 32 - 5
base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/controller/CompanyControllerTest.java

@@ -3,6 +3,7 @@ package com.usoftchina.saas.account.controller;
 import com.usoftchina.saas.account.dto.CompanyDTO;
 import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.test.BaseControllerTest;
+import com.usoftchina.saas.test.TestConstant;
 import org.junit.Assert;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -39,7 +40,7 @@ public class CompanyControllerTest extends BaseControllerTest {
     }
 
     private CompanyDTO getByName() throws Exception {
-        MvcResult mvcResult = mockMvc.perform(get("/company")
+        MvcResult mvcResult = mockMvc.perform(get("/company/read")
                 .param("name", name))
                 .andExpect(isSuccess())
                 .andReturn();
@@ -49,7 +50,7 @@ public class CompanyControllerTest extends BaseControllerTest {
     }
 
     private CompanyDTO getByBusinessCode() throws Exception {
-        MvcResult mvcResult = mockMvc.perform(get("/company")
+        MvcResult mvcResult = mockMvc.perform(get("/company/read")
                 .param("businessCode", businessCode))
                 .andExpect(isSuccess())
                 .andReturn();
@@ -65,10 +66,36 @@ public class CompanyControllerTest extends BaseControllerTest {
     }
 
     @Test
-    public void testD_delete() throws Exception {
+    public void testD_getCurrentCompany() throws Exception {
+        MvcResult mvcResult = mockMvc.perform(get("/company/read/current"))
+                .andExpect(isSuccess())
+                .andReturn();
+        Result<CompanyDTO> result = result(mvcResult, CompanyDTO.class);
+        System.out.println(result.getData());
+    }
+
+    @Test
+    public void testE_bindApp() throws Exception {
+        CompanyDTO companyDTO = getByName();
+        mockMvc.perform(post("/company/bind/app")
+                .param("companyId", String.valueOf(companyDTO.getId()))
+                .param("appId", TestConstant.DEFAULT_APP_ID))
+                .andExpect(isSuccess());
+    }
+
+    @Test
+    public void testF_unbindApp() throws Exception {
+        CompanyDTO companyDTO = getByName();
+        mockMvc.perform(post("/company/unbind/app")
+                .param("companyId", String.valueOf(companyDTO.getId()))
+                .param("appId", TestConstant.DEFAULT_APP_ID))
+                .andExpect(isSuccess());
+    }
+
+    @Test
+    public void testG_delete() throws Exception {
         CompanyDTO companyDTO = getByName();
-        mockMvc.perform(post("/company/delete")
-                .param("companyId", String.valueOf(companyDTO.getId())))
+        mockMvc.perform(post("/company/delete/{id}", companyDTO.getId()))
                 .andExpect(isSuccess());
     }
 

+ 33 - 0
base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/controller/ResourcesControllerTest.java

@@ -0,0 +1,33 @@
+package com.usoftchina.saas.account.controller;
+
+import com.usoftchina.saas.test.BaseControllerTest;
+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.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MvcResult;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ResourcesControllerTest extends BaseControllerTest{
+
+    @Test
+    public void testA_getModulesByAppId() throws Exception {
+        MvcResult mvcResult = mockMvc.perform(get("/resource/module/list"))
+                .andExpect(isSuccess())
+                .andReturn();
+        System.out.println(mvcResult.getResponse().getContentAsString());
+    }
+
+    @Test
+    public void testB_getUrlResourcesByAppId() throws Exception {
+        MvcResult mvcResult = mockMvc.perform(get("/resource/url/list"))
+                .andExpect(isSuccess())
+                .andReturn();
+        System.out.println(mvcResult.getResponse().getContentAsString());
+    }
+
+}

+ 47 - 0
base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/service/ResourceServiceTest.java

@@ -0,0 +1,47 @@
+package com.usoftchina.saas.account.service;
+
+import com.usoftchina.saas.account.dto.ResourceModuleDTO;
+import com.usoftchina.saas.account.dto.UrlResourceDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.List;
+import java.util.stream.IntStream;
+
+import static org.junit.Assert.*;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ResourceServiceTest {
+
+    @Autowired
+    private ResourceService resourceService;
+
+    @Test
+    public void testA_findModulesByAppId() throws Exception {
+        // 测试方法性能
+        IntStream.range(1, 21).forEach( i -> {
+            long time = System.currentTimeMillis();
+            List<ResourceModuleDTO> moduleDTOS = resourceService.findModulesByAppId(BaseContextHolder.getAppId());
+            System.out.println(String.format("----%s: %s, %s", i, moduleDTOS.size(), (System.currentTimeMillis() - time)));
+        });
+    }
+
+    @Test
+    public void testB_findUrlResourcesByAppId() throws Exception {
+        // 测试方法性能
+        IntStream.range(1, 21).forEach( i -> {
+            long time = System.currentTimeMillis();
+            List<UrlResourceDTO> resourceDTOS = resourceService.findUrlResourcesByAppId(BaseContextHolder.getAppId());
+            System.out.println(String.format("----%s: %s, %s", i, resourceDTOS.size(), (System.currentTimeMillis() - time)));
+        });
+    }
+
+}

+ 1 - 0
base-servers/auth/auth-client/src/main/java/com/usoftchina/saas/auth/client/interceptor/AuthRestInterceptor.java

@@ -38,6 +38,7 @@ public class AuthRestInterceptor extends HandlerInterceptorAdapter {
         }
         String token = request.getHeader(authConfig.getAuthHeader());
         JwtInfo infoFromToken = JwtHelper.getInfoFromToken(token, authConfig.getPublicKey());
+        BaseContextHolder.setAppId(infoFromToken.getAppId());
         BaseContextHolder.setUserId(infoFromToken.getUserId());
         BaseContextHolder.setCompanyId(infoFromToken.getCompanyId());
         BaseContextHolder.setToken(token);

+ 2 - 0
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/jwt/JwtHelper.java

@@ -37,6 +37,7 @@ public class JwtHelper {
                     Jwts.builder()
                             // 设置主题
                             .setSubject(jwtInfo.getUserName())
+                            .claim("appId", jwtInfo.getAppId())
                             .claim("userId", jwtInfo.getUserId())
                             .claim("companyId", jwtInfo.getCompanyId())
                             .claim("userName", jwtInfo.getUserName())
@@ -93,6 +94,7 @@ public class JwtHelper {
         Jws<Claims> claimsJws = parserToken(token, pubKeyPath);
         Claims body = claimsJws.getBody();
         return new JwtInfo(
+                ObjectUtils.getStringValue(body.get("appId")),
                 ObjectUtils.getLongValue(body.get("userId")),
                 ObjectUtils.getLongValue(body.get("companyId")),
                 ObjectUtils.getStringValue(body.get("userName"))

+ 11 - 1
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/jwt/JwtInfo.java

@@ -7,16 +7,26 @@ import java.io.Serializable;
  * @date 2018/10/2
  */
 public class JwtInfo implements Serializable{
+    private String appId;
     private Long companyId;
     private Long userId;
     private String userName;
 
-    public JwtInfo(Long companyId, Long userId, String userName) {
+    public JwtInfo(String appId, Long companyId, Long userId, String userName) {
+        this.appId = appId;
         this.companyId = companyId;
         this.userId = userId;
         this.userName = userName;
     }
 
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
     public Long getCompanyId() {
         return companyId;
     }

+ 1 - 1
base-servers/auth/auth-server/src/main/java/com/usoftchina/saas/auth/controller/AuthController.java

@@ -42,7 +42,7 @@ public class AuthController {
         if (result.isSuccess()) {
             AccountDTO accountDTO = result.getData();
             // TODO
-            JwtInfo info = new JwtInfo(null, accountDTO.getId(), accountDTO.getUsername());
+            JwtInfo info = new JwtInfo(null, null, accountDTO.getId(), accountDTO.getUsername());
             TokenVO tokenVO = JwtHelper.generateToken(info, privateKeyPath, expire);
             TokenDTO tokenDTO = BeanMapper.map(tokenVO, TokenDTO.class);
             return Result.success(tokenDTO);

+ 4 - 0
framework/core/src/main/java/com/usoftchina/saas/constant/CommonConstants.java

@@ -15,6 +15,10 @@ public class CommonConstants {
      * ThreadLocal中的登录用户Id key
      */
     public static final String CONTEXT_KEY_USER_ID = "currentUserId";
+    /***
+     * ThreadLocal中的登录应用Id key
+     */
+    public static final String CONTEXT_KEY_APP_ID = "currentAppId";
     /***
      * ThreadLocal中的登录用户Id key
      */

+ 9 - 0
framework/core/src/main/java/com/usoftchina/saas/context/BaseContextHolder.java

@@ -49,6 +49,15 @@ public class BaseContextHolder {
         set(CommonConstants.CONTEXT_KEY_COMPANY_ID, companyId);
     }
 
+    public static String getAppId() {
+        Object value = get(CommonConstants.CONTEXT_KEY_APP_ID);
+        return ObjectUtils.getStringValue(value);
+    }
+
+    public static void setAppId(String appId) {
+        set(CommonConstants.CONTEXT_KEY_APP_ID, appId);
+    }
+
     public static String getToken() {
         Object value = get(CommonConstants.CONTEXT_KEY_TOKEN);
         return ObjectUtils.getStringValue(value);

+ 1 - 0
framework/core/src/main/java/com/usoftchina/saas/exception/ExceptionCode.java

@@ -33,6 +33,7 @@ public enum ExceptionCode implements BaseExceptionCode {
     USER_PWD_NOT_EQUALS(53004, "密码与确认密码不一致"),
     USER_NOT_EXIST(53005, "用户不存在"),
     USER_NOT_ENABLE(53006, "用户禁止使用"),
+    ROLE_NOT_EXIST(53020, "角色不存在"),
 
     // 文件相关
     FOLDER_NULL(55000, "文件夹为空"),

+ 13 - 11
framework/core/src/main/java/com/usoftchina/saas/utils/ListUtils.java → framework/core/src/main/java/com/usoftchina/saas/utils/CollectionUtils.java

@@ -10,7 +10,7 @@ import java.util.function.Function;
  * @author yingp
  * @date 2018/10/10
  */
-public class ListUtils {
+public abstract class CollectionUtils extends org.springframework.util.CollectionUtils{
     /**
      * 按指定方法,将list分组返回map
      *
@@ -22,16 +22,18 @@ public class ListUtils {
      */
     public static <K, V> Map<K, List<V>> groupBy(List<V> sources, Function<V, K> keyGetter) {
         Map<K, List<V>> map = new HashMap<>(1);
-        sources.forEach(source -> {
-            K key = keyGetter.apply(source);
-            if (map.containsKey(key)) {
-                map.get(key).add(source);
-            } else {
-                List<V> childList = new ArrayList<>();
-                childList.add(source);
-                map.put(key, childList);
-            }
-        });
+        if (!isEmpty(sources)) {
+            sources.forEach(source -> {
+                K key = keyGetter.apply(source);
+                if (map.containsKey(key)) {
+                    map.get(key).add(source);
+                } else {
+                    List<V> childList = new ArrayList<>();
+                    childList.add(source);
+                    map.put(key, childList);
+                }
+            });
+        }
         return map;
     }
 }

+ 1 - 1
framework/core/src/main/java/com/usoftchina/saas/utils/ObjectUtils.java

@@ -4,7 +4,7 @@ package com.usoftchina.saas.utils;
  * @author yingp
  * @date 2018/10/2
  */
-public class ObjectUtils {
+public abstract class ObjectUtils extends org.springframework.util.ObjectUtils{
     public static String getStringValue(Object obj) {
         return null == obj ? "" : obj.toString();
     }

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

@@ -4,7 +4,7 @@ package com.usoftchina.saas.utils;
  * @author yingp
  * @date 2018/10/10
  */
-public class StringUtils {
+public abstract class StringUtils extends org.springframework.util.StringUtils{
     /**
      * 为空取值
      *

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

@@ -41,8 +41,8 @@ public abstract class BaseControllerTest {
      * @param urlTemplate
      * @return
      */
-    public static MockHttpServletRequestBuilder get(String urlTemplate) {
-        return MockMvcRequestBuilders.get(urlTemplate);
+    public static MockHttpServletRequestBuilder get(String urlTemplate, Object... uriVars) {
+        return MockMvcRequestBuilders.get(urlTemplate, uriVars);
     }
 
     /**
@@ -51,8 +51,8 @@ public abstract class BaseControllerTest {
      * @param urlTemplate
      * @return
      */
-    public static MockHttpServletRequestBuilder post(String urlTemplate) {
-        return MockMvcRequestBuilders.post(urlTemplate);
+    public static MockHttpServletRequestBuilder post(String urlTemplate, Object... uriVars) {
+        return MockMvcRequestBuilders.post(urlTemplate, uriVars);
     }
 
     /**

+ 10 - 0
framework/test-starter/src/main/java/com.usoftchina.saas.test/TestConstant.java

@@ -13,4 +13,14 @@ public class TestConstant {
      * 默认账户ID
      */
     public static final long DEFAULT_ACCOUNT_ID = 1;
+    /**
+     * 默认应用ID
+     * <p>
+     * trade-app - 贸易云
+     * manufacture-app - 制造云
+     * solution-app - 方案云
+     * ...
+     * </p>
+     */
+    public static final String DEFAULT_APP_ID = "trade-app";
 }

+ 1 - 0
framework/test-starter/src/main/java/com.usoftchina.saas.test/TestContextListener.java

@@ -14,5 +14,6 @@ public class TestContextListener extends AbstractTestExecutionListener {
         // 设置测试环境默认用户
         BaseContextHolder.setCompanyId(TestConstant.DEFAULT_COMPANY_ID);
         BaseContextHolder.setUserId(TestConstant.DEFAULT_ACCOUNT_ID);
+        BaseContextHolder.setAppId(TestConstant.DEFAULT_APP_ID);
     }
 }

+ 10 - 2
frontend/saas-web/Readme.md

@@ -90,7 +90,7 @@ viewModel: view.core.form.FormPanelModel
 | 字段 | 说明 | 必填 | 样例 |
 | --- | --- | --- | --- |
 | storeModel | grid model | √ | "saas.model.purchase.purchasedetail" |
-| detnoColumn | 序号列 | √ | "pud_detno" |
+| detnoColumn | 序号列,配置该项后无需再columns定义序号列 | √ | "pud_detno" |
 | columns[i].ignore | 是否忽略,为真时在调用保存方法时不会取到该列值 | x | true |
 | deleteDetailUrl | 删除明细接口 | √ | basePath + "purchase/purchase/deleteItem" |
 - 需要根据columns在models文件夹下添加storeModel对应的Model
@@ -148,5 +148,13 @@ viewModel: view.core.query.QueryPanelModel
 
 ### 前端配置调整日志
 
-2018-10-20 deleteDetailUrl 配置调整 formpanel.form->formpanel.detailGridField
+- 2018-10-20
+
+deleteDetailUrl 配置调整 formpanel.form->formpanel.detailGridField
+
+- 2018-10-27 10:10:33
+
+主从表从表配置detnoColumn属性说明变更
+
+
 

+ 13 - 0
frontend/saas-web/app/model/document/vendorcontact.js

@@ -0,0 +1,13 @@
+Ext.define('saas.model.document.vendorcontact', {
+    extend: 'saas.model.Base',
+    fields: [
+        { name: 'id', type: 'int' },
+        { name: 'vc_detno', type: 'int' },
+        { name: 'vc_name', type: 'string' },
+        { name: 'vc_tel', type: 'string' },
+        { name: 'vc_qq', type: 'string' },
+        { name: 'vc_email', type: 'string' },
+        { name: 'vc_default', type: 'string' },
+        { name: 'vc_veid', type: 'int' }
+    ]
+});

+ 1 - 0
frontend/saas-web/app/model/purchase/prodIODetail.js

@@ -20,6 +20,7 @@ Ext.define('saas.model.purchase.ProdIODetail', {
         { name: 'pd_price', type: 'float' },
         { name: 'pd_total', type: 'float' },
         { name: 'pd_taxrate', type: 'float' },
+        { name: 'pd_qty', type: 'int' },
         { name: 'pd_netprice', type: 'float' },
         { name: 'pd_nettotal', type: 'float' },
         { name: 'pd_whid', type: 'int' },

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