Browse Source

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

jinsy 7 years ago
parent
commit
527889064b
100 changed files with 3415 additions and 288 deletions
  1. 2 2
      applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/CommonService.java
  2. 2 2
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/CommonController.java
  3. 1 1
      applications/commons/commons-server/src/main/resources/application.yml
  4. 1 0
      applications/commons/commons-server/src/main/resources/i18n/messages.properties
  5. 3 3
      applications/commons/commons-server/src/main/resources/mapper/HomePageMapper.xml
  6. 19 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Bankinformation.java
  7. 3 3
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BankinformationServiceImpl.java
  8. 57 60
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java
  9. 8 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java
  10. 21 1
      applications/document/document-server/src/main/resources/mapper/BankinformationMapper.xml
  11. 31 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/BankinformationMapper.java
  12. 50 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransfer.java
  13. 30 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Othreceipts.java
  14. 32 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Othspendings.java
  15. 5 5
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Othspendingsdetail.java
  16. 18 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Paybalance.java
  17. 82 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Recbalance.java
  18. 46 14
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/FundtransferServiceImpl.java
  19. 6 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthreceiptsServiceImpl.java
  20. 1 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthspendingsServiceImpl.java
  21. 8 2
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/PaybalanceServiceImpl.java
  22. 8 2
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/RecbalanceServiceImpl.java
  23. 351 0
      applications/money/money-server/src/main/resources/mapper/BankinformationMapper.xml
  24. 18 7
      applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml
  25. 14 8
      applications/money/money-server/src/main/resources/mapper/OthreceiptsMapper.xml
  26. 16 6
      applications/money/money-server/src/main/resources/mapper/OthspendingsMapper.xml
  27. 13 13
      applications/money/money-server/src/main/resources/mapper/OthspendingsdetailMapper.xml
  28. 2 1
      applications/money/money-server/src/main/resources/mapper/PaybalanceMapper.xml
  29. 1 0
      applications/money/money-server/src/main/resources/mapper/RecbalanceMapper.xml
  30. 2 2
      applications/money/money-server/src/main/resources/mapper/StatsinfoMapper.xml
  31. 3 1
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseDetailDTO.java
  32. 1 0
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseListDTO.java
  33. 2 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseDetail.java
  34. 2 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseList.java
  35. 3 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/report/PurchasePay.java
  36. 32 17
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  37. 43 13
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  38. 9 4
      applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutListMapper.xml
  39. 62 28
      applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutMapper.xml
  40. 7 2
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseListMapper.xml
  41. 42 2
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml
  42. 6 6
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseReportMapper.xml
  43. 16 3
      applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml
  44. 2 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/SaleApplication.java
  45. 2 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java
  46. 2 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/SaleList.java
  47. 5 5
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java
  48. 3 6
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  49. 6 11
      applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml
  50. 1 0
      applications/sale/sale-server/src/main/resources/mapper/ProdInOutListMapper.xml
  51. 2 0
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/ProdInOut.java
  52. 43 5
      base-servers/account/account-api/src/main/java/com/usoftchina/saas/account/api/AccountApi.java
  53. 70 0
      base-servers/account/account-api/src/main/java/com/usoftchina/saas/account/api/CompanyApi.java
  54. 22 7
      base-servers/account/account-api/src/main/java/com/usoftchina/saas/account/cache/AccountCache.java
  55. 104 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/AccountCopyDTO.java
  56. 13 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/AccountDTO.java
  57. 13 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/AccountRegDTO.java
  58. 105 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/AccountUpdateDTO.java
  59. 77 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyCopyDTO.java
  60. 10 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyDTO.java
  61. 64 7
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/AccountController.java
  62. 57 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/CompanyController.java
  63. 8 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/AccountMapper.java
  64. 8 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/CompanyMapper.java
  65. 13 4
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/Account.java
  66. 13 4
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/Company.java
  67. 10 2
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/AccountService.java
  68. 8 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/CompanyService.java
  69. 10 1
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/AccountServiceImpl.java
  70. 5 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/CompanyServiceImpl.java
  71. 17 3
      base-servers/account/account-server/src/main/resources/mapper/AccountMapper.xml
  72. 14 3
      base-servers/account/account-server/src/main/resources/mapper/CompanyMapper.xml
  73. 6 0
      base-servers/auth/auth-common/pom.xml
  74. 74 0
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/cookie/CookieHelper.java
  75. 277 0
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/cookie/CookieInfo.java
  76. 115 0
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/cookie/CookieToken.java
  77. 126 0
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/cookie/CookieUtils.java
  78. 28 0
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/crypto/Hex.java
  79. 76 0
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/crypto/Rc4Utils.java
  80. 104 0
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/crypto/base64/UrlBase64.java
  81. 276 0
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/crypto/base64/UrlBase64Encoder.java
  82. 19 0
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/exception/AuthException.java
  83. 2 2
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/jwt/JwtHelper.java
  84. 3 3
      base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/jwt/JwtToken.java
  85. 5 0
      base-servers/auth/auth-server/pom.xml
  86. 4 1
      base-servers/auth/auth-server/src/main/java/com/usoftchina/saas/auth/AuthApplication.java
  87. 96 7
      base-servers/auth/auth-server/src/main/java/com/usoftchina/saas/auth/controller/AuthController.java
  88. 1 0
      base-servers/gateway-server/src/main/resources/application.yml
  89. 1 0
      base-servers/pom.xml
  90. 20 0
      base-servers/socket/pom.xml
  91. 24 0
      base-servers/socket/socket-api/pom.xml
  92. 32 0
      base-servers/socket/socket-api/src/main/java/com/usoftchina/saas/socket/api/SocketMessageApi.java
  93. 51 0
      base-servers/socket/socket-server/pom.xml
  94. 6 0
      base-servers/socket/socket-server/src/main/docker/Dockerfile
  95. 40 0
      base-servers/socket/socket-server/src/main/java/com/usoftchina/saas/socket/SocketApplication.java
  96. 43 0
      base-servers/socket/socket-server/src/main/java/com/usoftchina/saas/socket/controller/MessageController.java
  97. 65 0
      base-servers/socket/socket-server/src/main/resources/application.yml
  98. 12 0
      base-servers/socket/socket-server/src/main/resources/config/application-docker-dev.yml
  99. 10 0
      base-servers/socket/socket-server/src/main/resources/config/application-docker.yml
  100. 113 0
      base-servers/socket/socket-server/src/main/resources/logback-spring.xml

+ 2 - 2
applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/CommonService.java

@@ -7,6 +7,6 @@ import org.springframework.web.bind.annotation.RequestParam;
 public interface CommonService {
 
     @PostMapping("/action/audit")
-    public String commonAudit(@RequestParam String table, @RequestParam String keyvalue, @RequestParam String status,
-                                      @RequestParam String statuscode, @RequestParam String auditdate, @RequestParam String auditman);
+    public String commonAudit(@RequestParam("table") String table, @RequestParam("keyvalue") String keyvalue, @RequestParam("status") String status,
+                                      @RequestParam("statuscode") String statuscode, @RequestParam("auditdate") String auditdate, @RequestParam("auditman") String auditman);
 }

+ 2 - 2
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/CommonController.java

@@ -25,8 +25,8 @@ public class CommonController {
     }
 
     @PostMapping("/action/audit")
-    public DeferredResult commonAudit(@RequestParam String table, @RequestParam String keyvalue, @RequestParam String status,
-                              @RequestParam String statuscode, @RequestParam String auditdate, @RequestParam String auditman) {
+    public DeferredResult commonAudit(@RequestParam("table") String table, @RequestParam("keyvalue") String keyvalue, @RequestParam("status") String status,
+                                      @RequestParam("statuscode") String statuscode, @RequestParam("auditdate") String auditdate, @RequestParam("auditman") String auditman) {
 
         DeferredResult<String> deferredResult = new DeferredResult<>();
         CompletableFuture.supplyAsync(() -> commonService.commonAudit(table, keyvalue, status, statuscode, auditdate, auditman))

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

@@ -53,7 +53,7 @@ eureka:
   client:
     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.0.181:8510/eureka/
 server:
   port: 8920
   tomcat:

+ 1 - 0
applications/commons/commons-server/src/main/resources/i18n/messages.properties

@@ -0,0 +1 @@
+msg.nullifySuccess=

+ 3 - 3
applications/commons/commons-server/src/main/resources/mapper/HomePageMapper.xml

@@ -29,7 +29,7 @@
 (select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%c'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_4,
 
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_5,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%c'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_5,
 
 (select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%c'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_6)
  </select>
@@ -63,10 +63,10 @@
       select concat('[',five,',',other,']') from ((
 
     select GROUP_CONCAT(concat('{"x":"',si_custname,'","y":',IFNULL(round(si_amount/10000,2),0),'}')) five from (
-    select * from statsinfo where companyid=1 and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='SALE' ORDER BY si_amount desc limit 0,5
+    select * from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='SALE' ORDER BY si_amount desc limit 0,5
     ) c)d,(
 
-    select concat('{"x":"其它","y":',ifnull(round((all_sum - five_sum)/10000,2),0),'}') other from ( (select sum(si_amount) all_sum from statsinfo  where companyid=1 and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='SALE')a,
+    select concat('{"x":"其它","y":',ifnull(round((all_sum - five_sum)/10000,2),0),'}') other from ( (select sum(si_amount) all_sum from statsinfo  where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='SALE')a,
     (select sum(si_amount) five_sum from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='SALE' ORDER BY si_amount desc limit 0,5)b))e)
     </select>
 

+ 19 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Bankinformation.java

@@ -43,6 +43,25 @@ public class Bankinformation extends CommonBaseEntity implements Serializable {
 
     private String bk_remark;
 
+    private Double bk_income;
+    private Double bk_spending;
+
+    public Double getBk_income() {
+        return bk_income;
+    }
+
+    public void setBk_income(Double bk_income) {
+        this.bk_income = bk_income;
+    }
+
+    public Double getBk_spending() {
+        return bk_spending;
+    }
+
+    public void setBk_spending(Double bk_spending) {
+        this.bk_spending = bk_spending;
+    }
+
     public String getBk_bankcode() {
         return bk_bankcode;
     }

+ 3 - 3
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/BankinformationServiceImpl.java

@@ -39,9 +39,9 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
     @Override
     public boolean save(Bankinformation bankinformation){
         bankinformation.setCompanyId(BaseContextHolder.getCompanyId());
-        if (bankinformation.getBk_thisamount() == null || bankinformation.getBk_thisamount() == 0){
-            bankinformation.setBk_thisamount(bankinformation.getBk_beginamount());
-        }
+        bankinformation.setBk_thisamount(bankinformation.getBk_beginamount());
+        bankinformation.setBk_income(new Double(0));
+        bankinformation.setBk_spending(new Double(0));
 
         //判断编号
         String bktion = bankinformationMapper.selectBankcode(bankinformation.getBk_bankcode());

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

@@ -170,71 +170,68 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
             if (insertDetail2.size()>0) {
                 customeraddressMapper.batchInsert(insertDetail2);
             }
-            baseDTO = getBaseDTOById(cu_id);
-            //日志记录
-            messageLogService.save(baseDTO);
-            return baseDTO;
-        }
-        //检查名称和编号
-        int count = getMapper().validNameAndCodeWhenUpdate(customer);
-        if (count>0) {
-            throw new BizException(500, "客户名称或编号重复");
-        }
-
-        //检查期初日期是否已结转
-        count = getMapper().validFinish(cu_id,companyId);
-        if (count>0) {
-            Customer cutpl = getMapper().selectByPrimaryKey(cu_id);
-            //期初应收
-            customer.setCu_beginaramount(cutpl.getCu_beginaramount());
-            //期初预收
-            customer.setCu_beginprerecamount(cutpl.getCu_beginprerecamount());
-        }
+        }else {
+            //检查名称和编号
+            int count = getMapper().validNameAndCodeWhenUpdate(customer);
+            if (count > 0) {
+                throw new BizException(500, "客户名称或编号重复");
+            }
 
-        //更新操作
-        getMapper().updateByPrimaryKeySelective(customer);
-        //添加从表传输对象
-        for (CustomercontactDTO item : items1) {
-            Customercontact detail1 = BeanMapper.map(item,Customercontact.class);
-            detail1.setCc_cuid(cu_id);
-            detail1.setCompanyId(companyId);
-            detail1.setCreatorId(userId);
-            detail1.setCreateTime(new Date());
-            if (StringUtils.isEmpty(detail1.getId()) || "0".equals(detail1.getId().toString())) {
-                insertDetail1.add(detail1);
-            } else {
-                updateDetail1.add(detail1);
+            //检查期初日期是否已结转
+            count = getMapper().validFinish(cu_id, companyId);
+            if (count > 0) {
+                Customer cutpl = getMapper().selectByPrimaryKey(cu_id);
+                //期初应收
+                customer.setCu_beginaramount(cutpl.getCu_beginaramount());
+                //期初预收
+                customer.setCu_beginprerecamount(cutpl.getCu_beginprerecamount());
             }
-        }
-        //插入从表
-        if (insertDetail1.size()>0) {
-            customercontactMapper.batchInsert(insertDetail1);
-        }
-        //更新从表
-        if (updateDetail1.size()>0) {
-            customercontactMapper.batchUpdate(updateDetail1);
-        }
 
-        for (CustomeraddressDTO item : items2) {
-            Customeraddress detail2 = BeanMapper.map(item,Customeraddress.class);
-            detail2.setCa_cuid(cu_id);
-            detail2.setCompanyId(companyId);
-            detail2.setCreatorId(userId);
-            detail2.setCreateTime(new Date());
-            if (StringUtils.isEmpty(detail2.getId()) || "0".equals(detail2.getId().toString())) {
-                insertDetail2.add(detail2);
-            } else {
-                updateDetail2.add(detail2);
+            //更新操作
+            getMapper().updateByPrimaryKeySelective(customer);
+            //添加从表传输对象
+            for (CustomercontactDTO item : items1) {
+                Customercontact detail1 = BeanMapper.map(item, Customercontact.class);
+                detail1.setCc_cuid(cu_id);
+                detail1.setCompanyId(companyId);
+                detail1.setCreatorId(userId);
+                detail1.setCreateTime(new Date());
+                if (StringUtils.isEmpty(detail1.getId()) || "0".equals(detail1.getId().toString())) {
+                    insertDetail1.add(detail1);
+                } else {
+                    updateDetail1.add(detail1);
+                }
+            }
+            //插入从表
+            if (insertDetail1.size() > 0) {
+                customercontactMapper.batchInsert(insertDetail1);
+            }
+            //更新从表
+            if (updateDetail1.size() > 0) {
+                customercontactMapper.batchUpdate(updateDetail1);
             }
 
-        }
-        //插入从表
-        if (insertDetail2.size()>0) {
-            customeraddressMapper.batchInsert(insertDetail2);
-        }
-        //更新从表
-        if (updateDetail2.size()>0) {
-            customeraddressMapper.batchUpdate(updateDetail2);
+            for (CustomeraddressDTO item : items2) {
+                Customeraddress detail2 = BeanMapper.map(item, Customeraddress.class);
+                detail2.setCa_cuid(cu_id);
+                detail2.setCompanyId(companyId);
+                detail2.setCreatorId(userId);
+                detail2.setCreateTime(new Date());
+                if (StringUtils.isEmpty(detail2.getId()) || "0".equals(detail2.getId().toString())) {
+                    insertDetail2.add(detail2);
+                } else {
+                    updateDetail2.add(detail2);
+                }
+
+            }
+            //插入从表
+            if (insertDetail2.size() > 0) {
+                customeraddressMapper.batchInsert(insertDetail2);
+            }
+            //更新从表
+            if (updateDetail2.size() > 0) {
+                customeraddressMapper.batchUpdate(updateDetail2);
+            }
         }
 
         //更新应收余额

+ 8 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java

@@ -526,13 +526,17 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
      * @Author: chenwei
      * @Date: 2018/10/26
      */
-    private synchronized String pushMaxnubmer(String code, Long id) {
+    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.PRODUCT.getCaller()).getData();
+        String billCode = null;
+        synchronized (ProductServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? getMapper().validateCodeWhenInsert(code, companyId) :
+                    getMapper().validateCodeWhenUpdate(code, id, companyId);
+            billCode = maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PRODUCT.getCaller()).getData();
+        }
+        return billCode;
     }
 }

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

@@ -24,6 +24,8 @@
     <result column="bk_text4" property="bk_text4" jdbcType="VARCHAR" />
     <result column="bk_text5" property="bk_text5" jdbcType="VARCHAR" />
     <result column="bk_remark" property="bk_remark" jdbcType="VARCHAR" />
+    <result column="bk_spending" property="bk_spending" jdbcType="DOUBLE" />
+    <result column="bk_income" property="bk_income" jdbcType="DOUBLE" />
   </resultMap>
   <resultMap id="ResultMapWithBLOBs" type="com.usoftchina.saas.document.entities.Bankinformation" extends="BaseResultMap" >
     <result column="bk_remark" property="bk_remark" jdbcType="LONGVARCHAR" />
@@ -132,6 +134,12 @@
       <if test="bk_remark != null" >
         bk_remark,
       </if>
+      <if test="bk_spending != null" >
+        bk_spending,
+      </if>
+      <if test="bk_income != null" >
+        bk_income,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
       <if test="bk_bankcode != null" >
@@ -197,6 +205,12 @@
       <if test="bk_remark != null" >
         #{bk_remark,jdbcType=LONGVARCHAR},
       </if>
+      <if test="bk_spending != null" >
+        #{bk_spending,jdbcType=DOUBLE},
+      </if>
+      <if test="bk_income != null" >
+        #{bk_income,jdbcType=DOUBLE},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
@@ -265,6 +279,12 @@
       <if test="bk_remark != null" >
         bk_remark = #{bk_remark,jdbcType=LONGVARCHAR},
       </if>
+      <if test="bk_income != null" >
+        bk_income = #{bk_income,jdbcType=DOUBLE},
+      </if>
+      <if test="bk_spending != null" >
+        bk_spending = #{bk_spending,jdbcType=DOUBLE},
+      </if>
     </set>
     where bk_id = #{id,jdbcType=INTEGER}
   </update>
@@ -309,7 +329,7 @@
       <if test="companyId != null">
         and   bankinformation.companyId = #{companyId}
       </if>
-    </where>  order by bk_id
+    </where>  order by bk_date desc, bk_id desc
   </select>
   <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
         SELECT CONCAT(bk_bankcode,' ',bk_bankname) display,bk_bankname value FROM bankinformation WHERE COMPANYID=#{companyId}

+ 31 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/BankinformationMapper.java

@@ -0,0 +1,31 @@
+package com.usoftchina.saas.money.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.commons.dto.ComboDTO;
+import com.usoftchina.saas.money.po.Bankinformation;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface BankinformationMapper extends CommonBaseMapper<Bankinformation> {
+    int deleteByPrimaryKey(Integer bkId);
+
+//    int insert(Bankinformation record);
+
+    int insertSelective(Bankinformation record);
+
+    Bankinformation selectByPrimaryKey(Integer bkId);
+
+    int updateByPrimaryKeySelective(Bankinformation record);
+
+    int updateByPrimaryKeyWithBLOBs(Bankinformation record);
+
+    List<Bankinformation> selectBankinformationBycondition(@Param("con") String con, @Param("companyId") Long companyId);
+
+    List<ComboDTO> getCombo(@Param("companyId") Long companyId);
+    String selectBankcode(String bk_bankcode);
+
+    void updateBankAmount(@Param("id") Integer id, @Param("bk_thisamount") Double bk_thisamount);
+    Double selectThisamount(Integer id);
+
+}

+ 50 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransfer.java

@@ -35,6 +35,16 @@ public class Fundtransfer extends CommonBaseEntity implements Serializable {
 
     private String ft_text5;
 
+    private String ftd_bankname;
+
+    private String ftd_inbankname;
+
+    private Double ftd_nowbalance;
+
+    private String ftd_paymethod;
+
+    private String ftd_paycode;
+
     public String getFt_code() {
         return ft_code;
     }
@@ -146,4 +156,44 @@ public class Fundtransfer extends CommonBaseEntity implements Serializable {
     public void setFt_text5(String ft_text5) {
         this.ft_text5 = ft_text5;
     }
+
+    public String getFtd_bankname() {
+        return ftd_bankname;
+    }
+
+    public void setFtd_bankname(String ftd_bankname) {
+        this.ftd_bankname = ftd_bankname;
+    }
+
+    public String getFtd_inbankname() {
+        return ftd_inbankname;
+    }
+
+    public void setFtd_inbankname(String ftd_inbankname) {
+        this.ftd_inbankname = ftd_inbankname;
+    }
+
+    public Double getFtd_nowbalance() {
+        return ftd_nowbalance;
+    }
+
+    public void setFtd_nowbalance(Double ftd_nowbalance) {
+        this.ftd_nowbalance = ftd_nowbalance;
+    }
+
+    public String getFtd_paymethod() {
+        return ftd_paymethod;
+    }
+
+    public void setFtd_paymethod(String ftd_paymethod) {
+        this.ftd_paymethod = ftd_paymethod;
+    }
+
+    public String getFtd_paycode() {
+        return ftd_paycode;
+    }
+
+    public void setFtd_paycode(String ftd_paycode) {
+        this.ftd_paycode = ftd_paycode;
+    }
 }

+ 30 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Othreceipts.java

@@ -49,6 +49,12 @@ public class Othreceipts extends CommonBaseEntity implements Serializable {
 
     private String or_text5;
 
+    private String ord_type;
+
+    private Double ord_nowbalance;
+
+    private String ord_remark;
+
     public String getOr_code() {
         return or_code;
     }
@@ -217,6 +223,30 @@ public class Othreceipts extends CommonBaseEntity implements Serializable {
         this.or_text5 = or_text5;
     }
 
+    public String getOrd_type() {
+        return ord_type;
+    }
+
+    public void setOrd_type(String ord_type) {
+        this.ord_type = ord_type;
+    }
+
+    public Double getOrd_nowbalance() {
+        return ord_nowbalance;
+    }
+
+    public void setOrd_nowbalance(Double ord_nowbalance) {
+        this.ord_nowbalance = ord_nowbalance;
+    }
+
+    public String getOrd_remark() {
+        return ord_remark;
+    }
+
+    public void setOrd_remark(String ord_remark) {
+        this.ord_remark = ord_remark;
+    }
+
     @Override
     public String toString() {
         return "Othreceipts{" +

+ 32 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Othspendings.java

@@ -50,6 +50,14 @@ public class Othspendings extends CommonBaseEntity implements Serializable {
 
     private String os_text5;
 
+    private String osd_type;
+
+    private Double osd_nowbalance;
+
+    private String osd_remark;
+
+
+
     public String getOs_code() {
         return os_code;
     }
@@ -217,4 +225,28 @@ public class Othspendings extends CommonBaseEntity implements Serializable {
     public void setOs_text5(String os_text5) {
         this.os_text5 = os_text5;
     }
+
+    public String getOsd_type() {
+        return osd_type;
+    }
+
+    public void setOsd_type(String osd_type) {
+        this.osd_type = osd_type;
+    }
+
+    public Double getOsd_nowbalance() {
+        return osd_nowbalance;
+    }
+
+    public void setOsd_nowbalance(Double osd_nowbalance) {
+        this.osd_nowbalance = osd_nowbalance;
+    }
+
+    public String getOsd_remark() {
+        return osd_remark;
+    }
+
+    public void setOsd_remark(String osd_remark) {
+        this.osd_remark = osd_remark;
+    }
 }

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

@@ -7,7 +7,7 @@ import java.util.Date;
 
 public class Othspendingsdetail extends CommonBaseEntity implements Serializable {
 
-    private Integer osd_orid;
+    private Integer osd_osid;
 
     private Integer osd_detno;
 
@@ -41,12 +41,12 @@ public class Othspendingsdetail extends CommonBaseEntity implements Serializable
         this.os_date = os_date;
     }
 
-    public Integer getOsd_orid() {
-        return osd_orid;
+    public Integer getOsd_osid() {
+        return osd_osid;
     }
 
-    public void setOsd_orid(Integer osd_orid) {
-        this.osd_orid = osd_orid;
+    public void setOsd_osid(Integer osd_osid) {
+        this.osd_osid = osd_osid;
     }
 
     public Integer getOsd_detno() {

+ 18 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Paybalance.java

@@ -65,6 +65,8 @@ public class Paybalance extends CommonBaseEntity implements Serializable {
 
     private String pd_bankname;
 
+    private Double pd_amount;
+
     private String pd_paymethod;
 
     private String pd_paycode;
@@ -345,4 +347,20 @@ public class Paybalance extends CommonBaseEntity implements Serializable {
     public void setPd_remark(String pd_remark) {
         this.pd_remark = pd_remark;
     }
+
+    public Double getPd_amount() {
+        return pd_amount;
+    }
+
+    public void setPd_amount(Double pd_amount) {
+        this.pd_amount = pd_amount;
+    }
+
+    public String getPd_paycode() {
+        return pd_paycode;
+    }
+
+    public void setPd_paycode(String pd_paycode) {
+        this.pd_paycode = pd_paycode;
+    }
 }

+ 82 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Recbalance.java

@@ -65,6 +65,8 @@ public class Recbalance extends CommonBaseEntity implements Serializable {
 
     private String rd_bankname;
 
+    private Double rd_amount;
+
     private String rd_paymethod;
 
     private String rd_paycode;
@@ -283,4 +285,84 @@ public class Recbalance extends CommonBaseEntity implements Serializable {
     public void setCu_leftamount(Double cu_leftamount) {
         this.cu_leftamount = cu_leftamount;
     }
+
+    public String getRd_bankname() {
+        return rd_bankname;
+    }
+
+    public void setRd_bankname(String rd_bankname) {
+        this.rd_bankname = rd_bankname;
+    }
+
+    public Double getRd_amount() {
+        return rd_amount;
+    }
+
+    public void setRd_amount(Double rd_amount) {
+        this.rd_amount = rd_amount;
+    }
+
+    public String getRd_paymethod() {
+        return rd_paymethod;
+    }
+
+    public void setRd_paymethod(String rd_paymethod) {
+        this.rd_paymethod = rd_paymethod;
+    }
+
+    public String getRd_paycode() {
+        return rd_paycode;
+    }
+
+    public void setRd_paycode(String rd_paycode) {
+        this.rd_paycode = rd_paycode;
+    }
+
+    public String getRd_remark() {
+        return rd_remark;
+    }
+
+    public void setRd_remark(String rd_remark) {
+        this.rd_remark = rd_remark;
+    }
+
+    public String getRbd_slcode() {
+        return rbd_slcode;
+    }
+
+    public void setRbd_slcode(String rbd_slcode) {
+        this.rbd_slcode = rbd_slcode;
+    }
+
+    public String getRbd_slkind() {
+        return rbd_slkind;
+    }
+
+    public void setRbd_slkind(String rbd_slkind) {
+        this.rbd_slkind = rbd_slkind;
+    }
+
+    public Date getRbd_sldate() {
+        return rbd_sldate;
+    }
+
+    public void setRbd_sldate(Date rbd_sldate) {
+        this.rbd_sldate = rbd_sldate;
+    }
+
+    public Double getRbd_amount() {
+        return rbd_amount;
+    }
+
+    public void setRbd_amount(Double rbd_amount) {
+        this.rbd_amount = rbd_amount;
+    }
+
+    public Double getRbd_nowbalance() {
+        return rbd_nowbalance;
+    }
+
+    public void setRbd_nowbalance(Double rbd_nowbalance) {
+        this.rbd_nowbalance = rbd_nowbalance;
+    }
 }

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

@@ -42,6 +42,8 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
     private PaybalanceMapper paybalanceMapper;
     @Autowired
     private MessageLogService messageLogService;
+    @Autowired
+    private BankinformationMapper bankinformationMapper;
 
     @Override
     public DocBaseDTO insert(Fundtran fundtran) {
@@ -96,7 +98,6 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
         this.changBankUntil(fundtran);
         DocBaseDTO docBaseDTO = this.insert(fundtran);
         Long id = docBaseDTO.getId();
-        String ft_code = docBaseDTO.getCode();
 
         //取从表金额更新中间表、资金账号表
         List<Fundtransferdetail> fundtransferdetailList = fundtran.getItems();
@@ -115,15 +116,28 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
             //资金账号表
             int bk_id = fundtransferdetail.getFtd_bankid();
             int bk_inid = fundtransferdetail.getFtd_inbankid();
-            Double bk_amount = paybalanceMapper.selectThisamount(bk_id) == null ? new Double(0) : paybalanceMapper.selectThisamount(bk_id);
-            Double bk_inamount = paybalanceMapper.selectThisamount(bk_inid) == null ? new Double(0) : paybalanceMapper.selectThisamount(bk_inid);
 
-            Double thisamount = bk_amount - fundtransferdetail.getFtd_nowbalance();
-            if (thisamount < 0){
-                throw new BizException(500, BizExceptionCode.BANK_AMOUNT_NOTENOUGH.getMessage());
-            }
-            paybalanceMapper.updateBankAmount(thisamount, bk_id);
-            paybalanceMapper.updateBankAmount(bk_inamount + fundtransferdetail.getFtd_nowbalance(), bk_inid);
+            Double bk_amount = fundtransferdetail.getFtd_nowbalance();
+            //付款方
+            Bankinformation bankinformation = bankinformationMapper.selectByPrimaryKey(bk_id);
+            Double beginamount = bankinformation.getBk_beginamount();
+            Double spending = bankinformation.getBk_spending() == null ? new Double(0) : bankinformation.getBk_spending();
+            Double incomme = bankinformation.getBk_income() == null ? new Double(0) : bankinformation.getBk_income();
+            bankinformation.setBk_thisamount(beginamount + incomme - spending - bk_amount);
+            bankinformation.setBk_income(incomme);
+            bankinformation.setBk_spending(spending + bk_amount);
+
+            //收款方
+            Bankinformation inbankinformation = bankinformationMapper.selectByPrimaryKey(bk_inid);
+            Double inbeginamount = inbankinformation.getBk_beginamount();
+            Double inspending = inbankinformation.getBk_spending() == null ? new Double(0) : inbankinformation.getBk_spending();
+            Double inincomme = inbankinformation.getBk_income() == null ? new Double(0) : inbankinformation.getBk_income();
+            inbankinformation.setBk_thisamount(inbeginamount + inincomme - inspending + bk_amount);
+            inbankinformation.setBk_income(inincomme + bk_amount);
+            inbankinformation.setBk_spending(inspending);
+
+            bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
+            bankinformationMapper.updateByPrimaryKeySelective(inbankinformation);
         }
         DocBaseDTO baseDTO = getBaseDTOById(id);
         //日志记录
@@ -141,7 +155,7 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
 
         //删除中间表
         fundtransfer = fundtransferMapper.selectByPrimaryKey(id);
-        banksubledgerMapper.deleteByPrimaryKey(fundtransfer.getFt_code(), "其他收入单");
+        banksubledgerMapper.deleteByPrimaryKey(fundtransfer.getFt_code(), "资金转账");
 
         //资金
         //取从表金额
@@ -159,10 +173,28 @@ public class FundtransferServiceImpl extends CommonBaseServiceImpl<FundtransferM
             //资金账号表
             int bk_id = fundtransferdetail.getFtd_bankid();
             int bk_inid = fundtransferdetail.getFtd_inbankid();
-            Double bk_amount = paybalanceMapper.selectThisamount(bk_id) == null ? new Double(0) : paybalanceMapper.selectThisamount(bk_id);
-            Double bk_inamount = paybalanceMapper.selectThisamount(bk_inid) == null ? new Double(0) : paybalanceMapper.selectThisamount(bk_inid);
-            paybalanceMapper.updateBankAmount(bk_amount + fundtransferdetail.getFtd_nowbalance(), bk_id);
-            paybalanceMapper.updateBankAmount(bk_inamount - fundtransferdetail.getFtd_nowbalance(), bk_inid);
+
+            Double bk_amount = fundtransferdetail.getFtd_nowbalance();
+            //付款方
+            Bankinformation bankinformation = bankinformationMapper.selectByPrimaryKey(bk_id);
+            Double beginamount = bankinformation.getBk_beginamount();
+            Double spending = bankinformation.getBk_spending() == null ? new Double(0) : bankinformation.getBk_spending();
+            Double incomme = bankinformation.getBk_income() == null ? new Double(0) : bankinformation.getBk_income();
+            bankinformation.setBk_thisamount(beginamount + incomme - spending + bk_amount);
+            bankinformation.setBk_income(incomme);
+            bankinformation.setBk_spending(spending - bk_amount);
+
+            //收款方
+            Bankinformation inbankinformation = bankinformationMapper.selectByPrimaryKey(bk_inid);
+            Double inbeginamount = inbankinformation.getBk_beginamount();
+            Double inspending = inbankinformation.getBk_spending() == null ? new Double(0) : inbankinformation.getBk_spending();
+            Double inincomme = inbankinformation.getBk_income() == null ? new Double(0) : inbankinformation.getBk_income();
+            inbankinformation.setBk_thisamount(inbeginamount + inincomme - inspending - bk_amount);
+            inbankinformation.setBk_income(inincomme - bk_amount);
+            inbankinformation.setBk_spending(inspending);
+
+            bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
+            bankinformationMapper.updateByPrimaryKeySelective(inbankinformation);
         }
 
         DocBaseDTO baseDTO = getBaseDTOById(Long.valueOf(id));

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

@@ -3,6 +3,7 @@ package com.usoftchina.saas.money.service.impl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
@@ -46,6 +47,8 @@ public class OthreceiptsServiceImpl extends CommonBaseServiceImpl<OthreceiptsMap
     private StatsinfoMapper statsinfoMapper;
     @Autowired
     private MessageLogService messageLogService;
+//    @Autowired
+//    private CommonService commonService;
 
     @Override
     public DocBaseDTO insert(Othte othte) {
@@ -126,6 +129,9 @@ public class OthreceiptsServiceImpl extends CommonBaseServiceImpl<OthreceiptsMap
         }
 
         DocBaseDTO baseDTO = getBaseDTOById(id);
+//        commonService.commonAudit(BillCodeSeq.RECBALANCE.getCaller(),
+//                "rb_id="+baseDTO.getId(),"rb_status","rb_statuscode",
+//                "rb_auditdate","rb_auditman");
         //日志记录
         messageLogService.save(baseDTO);
         return baseDTO;

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

@@ -73,7 +73,7 @@ public class OthspendingsServiceImpl extends CommonBaseServiceImpl<OthspendingsM
         Iterator isdet = othspendingsdetails.iterator();
         while (isdet.hasNext()){
             Othspendingsdetail othspendingsdetail = (Othspendingsdetail) isdet.next();
-            othspendingsdetail.setOsd_orid(Math.toIntExact(id));
+            othspendingsdetail.setOsd_osid(Math.toIntExact(id));
             othspendingsdetail.setCompanyId(BaseContextHolder.getCompanyId());
             othspendingsdetail.setOs_date(othspendings.getOs_date());
             if (othspendingsdetail.getId() > 0 ){

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

@@ -3,6 +3,7 @@ package com.usoftchina.saas.money.service.impl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
@@ -46,6 +47,9 @@ public class PaybalanceServiceImpl extends CommonBaseServiceImpl<PaybalanceMappe
     private StatsinfoMapper statsinfoMapper;
     @Autowired
     private MessageLogService messageLogService;
+//    @Autowired
+//    private CommonService commonService;
+
 
     public DocBaseDTO insert(Pay pay) {
         Paybalance paybalance = pay.getMain();
@@ -173,9 +177,9 @@ public class PaybalanceServiceImpl extends CommonBaseServiceImpl<PaybalanceMappe
     public DocBaseDTO audit(Pay pay) {
         Long companyId = BaseContextHolder.getCompanyId();
         Paybalance paybalance = pay.getMain();
+        paybalance.setCompanyId(companyId);
         paybalance.setPb_status(Status.AUDITED.getDisplay());
         paybalance.setPb_statuscode(Status.AUDITED.name());
-        paybalance.setCompanyId(companyId);
         Subledger subledger = this.changSubledgerUntil(paybalance);
         if (subledger.getSl_code() == null){
             subledgerMapper.insertSelective(subledger);
@@ -262,6 +266,9 @@ public class PaybalanceServiceImpl extends CommonBaseServiceImpl<PaybalanceMappe
             statsinfoMapper.update(statsinfo);
         }
         DocBaseDTO baseDTO = getBaseDTOById(id);
+//        commonService.commonAudit(BillCodeSeq.PAYBALANCE.getCaller(),
+//                "pb_id="+baseDTO.getId(),"pb_status","pb_statuscode",
+//                "pb_auditdate","pb_auditman");
         //日志记录
         messageLogService.save(baseDTO);
         return baseDTO;
@@ -349,7 +356,6 @@ public class PaybalanceServiceImpl extends CommonBaseServiceImpl<PaybalanceMappe
         messageLogService.save(baseDTO);
     }
 
-
     public void delete(int id){
         paybalanceMapper.deleteByPrimaryKey(id);
         paybalancedetailMapper.deleteByPrimaryKey(id);

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

@@ -3,6 +3,7 @@ package com.usoftchina.saas.money.service.impl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
@@ -46,6 +47,8 @@ public class RecbalanceServiceImpl extends CommonBaseServiceImpl<RecbalanceMappe
     private StatsinfoMapper statsinfoMapper;
     @Autowired
     private MessageLogService messageLogService;
+    @Autowired
+    private CommonService commonService;
 
     @Override
     public DocBaseDTO insert(Rec rec) {
@@ -209,9 +212,9 @@ public class RecbalanceServiceImpl extends CommonBaseServiceImpl<RecbalanceMappe
     public DocBaseDTO audit(Rec rec) {
         Long companyId = BaseContextHolder.getCompanyId();
         Recbalance recbalance = rec.getMain();
+        recbalance.setCompanyId(companyId);
         recbalance.setRb_status(Status.AUDITED.getDisplay());
         recbalance.setRb_statuscode(Status.AUDITED.name());
-        recbalance.setCompanyId(companyId);
         Subledger subledger = this.changSubledgerUntil(recbalance);
         if (subledger.getSl_code() == null){
             subledgerMapper.insertSelective(subledger);
@@ -244,7 +247,7 @@ public class RecbalanceServiceImpl extends CommonBaseServiceImpl<RecbalanceMappe
         //更新主表pb_pbdamount=从表二金额合计
         Double amountTotal2 = new Double(0);
         for (Recbalancedetail detail : recbalancedetail){
-            amountTotal2 = amountTotal2 + detail.getRbd_amount();
+            amountTotal2 = amountTotal2 + detail.getRbd_nowbalance();
         }
         updateRay.setId(rec.getMain().getId());
         updateRay.setRb_rdamount(amountTotal);
@@ -299,6 +302,9 @@ public class RecbalanceServiceImpl extends CommonBaseServiceImpl<RecbalanceMappe
             statsinfoMapper.update(statsinfo);
         }
         DocBaseDTO baseDTO = getBaseDTOById(id);
+//        commonService.commonAudit(BillCodeSeq.RECBALANCE.getCaller(),
+//                "rb_id="+baseDTO.getId(),"rb_status","rb_statuscode",
+//                "rb_auditdate","rb_auditman");
         //日志记录
         messageLogService.save(baseDTO);
         return baseDTO;

+ 351 - 0
applications/money/money-server/src/main/resources/mapper/BankinformationMapper.xml

@@ -0,0 +1,351 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.usoftchina.saas.money.mapper.BankinformationMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.Bankinformation" >
+    <id column="bk_id" property="id" jdbcType="INTEGER" />
+    <result column="bk_bankcode" property="bk_bankcode" jdbcType="VARCHAR" />
+    <result column="bk_bankname" property="bk_bankname" jdbcType="VARCHAR" />
+    <result column="bk_date" property="bk_date" jdbcType="TIMESTAMP" />
+    <result column="bk_type" property="bk_type" jdbcType="VARCHAR" />
+    <result column="bk_beginamount" property="bk_beginamount" jdbcType="DOUBLE" />
+    <result column="bk_thisamount" property="bk_thisamount" jdbcType="DOUBLE" />
+    <result column="bk_status" property="bk_status" jdbcType="VARCHAR" />
+    <result column="bk_statuscode" property="bk_statuscode" jdbcType="VARCHAR" />
+    <result column="bk_recorderid" property="bk_recorderid" jdbcType="INTEGER" />
+    <result column="bk_recorder" property="bk_recorder" jdbcType="VARCHAR" />
+    <result column="bk_recorddate" property="bk_recorddate" jdbcType="TIMESTAMP" />
+    <result column="bk_ym" property="bk_ym" jdbcType="INTEGER" />
+    <result column="companyid" property="companyId" jdbcType="INTEGER" />
+    <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+    <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="bk_text1" property="bk_text1" jdbcType="VARCHAR" />
+    <result column="bk_text2" property="bk_text2" jdbcType="VARCHAR" />
+    <result column="bk_text3" property="bk_text3" jdbcType="VARCHAR" />
+    <result column="bk_text4" property="bk_text4" jdbcType="VARCHAR" />
+    <result column="bk_text5" property="bk_text5" jdbcType="VARCHAR" />
+    <result column="bk_remark" property="bk_remark" jdbcType="VARCHAR" />
+    <result column="bk_spending" property="bk_spending" jdbcType="DOUBLE" />
+    <result column="bk_income" property="bk_income" jdbcType="DOUBLE" />
+  </resultMap>
+  <resultMap id="ResultMapWithBLOBs" type="com.usoftchina.saas.money.po.Bankinformation" extends="BaseResultMap" >
+    <result column="bk_remark" property="bk_remark" jdbcType="LONGVARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    bk_id, bk_bankcode, bk_bankname, bk_date, bk_type, bk_beginamount, bk_thisamount, 
+    bk_status, bk_statuscode, bk_recorderid, bk_recorder, bk_recorddate, bk_ym, companyid, 
+    updaterId, updateTime, bk_text1, bk_text2, bk_text3, bk_text4, bk_text5, bk_remark
+  </sql>
+  <sql id="Blob_Column_List" >
+    bk_remark
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
+    select 
+    <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
+    from bankinformation
+    where bk_id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+    delete from bankinformation
+    where bk_id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.money.po.Bankinformation" >
+    insert into bankinformation (bk_id, bk_bankcode, bk_bankname, 
+      bk_date, bk_type, bk_beginamount, 
+      bk_thisamount, bk_status, bk_statuscode, 
+      bk_recorderid, bk_recorder, bk_recorddate, 
+      bk_ym, companyid, updaterId, 
+      updateTime, bk_text1, bk_text2, 
+      bk_text3, bk_text4, bk_text5, 
+      bk_remark)
+    values (#{bk_bankcode,jdbcType=VARCHAR}, #{bk_bankname,jdbcType=VARCHAR},
+      #{bk_date,jdbcType=TIMESTAMP}, #{bk_type,jdbcType=VARCHAR}, #{bk_beginamount,jdbcType=DOUBLE},
+      #{bk_thisamount,jdbcType=DOUBLE}, #{bk_status,jdbcType=VARCHAR}, #{bk_statuscode,jdbcType=VARCHAR},
+      #{bk_recorderid,jdbcType=INTEGER}, #{bk_recorder,jdbcType=VARCHAR}, #{bk_recorddate,jdbcType=TIMESTAMP},
+      #{bk_ym,jdbcType=INTEGER}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER},
+      #{updateTime,jdbcType=TIMESTAMP}, #{bk_text1,jdbcType=VARCHAR}, #{bk_text2,jdbcType=VARCHAR},
+      #{bk_text3,jdbcType=VARCHAR}, #{bk_text4,jdbcType=VARCHAR}, #{bk_text5,jdbcType=VARCHAR},
+      #{bk_remark,jdbcType=LONGVARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
+    insert into bankinformation
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="bk_bankcode != null" >
+        bk_bankcode,
+      </if>
+      <if test="bk_bankname != null" >
+        bk_bankname,
+      </if>
+      <if test="bk_date != null" >
+        bk_date,
+      </if>
+      <if test="bk_type != null" >
+        bk_type,
+      </if>
+      <if test="bk_beginamount != null" >
+        bk_beginamount,
+      </if>
+      <if test="bk_thisamount != null" >
+        bk_thisamount,
+      </if>
+      <if test="bk_status != null" >
+        bk_status,
+      </if>
+      <if test="bk_statuscode != null" >
+        bk_statuscode,
+      </if>
+      <if test="bk_recorderid != null" >
+        bk_recorderid,
+      </if>
+      <if test="bk_recorder != null" >
+        bk_recorder,
+      </if>
+      <if test="bk_recorddate != null" >
+        bk_recorddate,
+      </if>
+      <if test="bk_ym != null" >
+        bk_ym,
+      </if>
+      <if test="companyId != null" >
+        companyid,
+      </if>
+      <if test="updaterId != null" >
+        updaterId,
+      </if>
+      <if test="updateTime != null" >
+        updateTime,
+      </if>
+      <if test="bk_text1 != null" >
+        bk_text1,
+      </if>
+      <if test="bk_text2 != null" >
+        bk_text2,
+      </if>
+      <if test="bk_text3 != null" >
+        bk_text3,
+      </if>
+      <if test="bk_text4 != null" >
+        bk_text4,
+      </if>
+      <if test="bk_text5 != null" >
+        bk_text5,
+      </if>
+      <if test="bk_remark != null" >
+        bk_remark,
+      </if>
+      <if test="bk_spending != null" >
+        bk_spending,
+      </if>
+      <if test="bk_income != null" >
+        bk_income,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="bk_bankcode != null" >
+        #{bk_bankcode,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_bankname != null" >
+        #{bk_bankname,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_date != null" >
+        #{bk_date,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bk_type != null" >
+        #{bk_type,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_beginamount != null" >
+        #{bk_beginamount,jdbcType=DOUBLE},
+      </if>
+      <if test="bk_thisamount != null" >
+        #{bk_thisamount,jdbcType=DOUBLE},
+      </if>
+      <if test="bk_status != null" >
+        #{bk_status,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_statuscode != null" >
+        #{bk_statuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_recorderid != null" >
+        #{bk_recorderid,jdbcType=INTEGER},
+      </if>
+      <if test="bk_recorder != null" >
+        #{bk_recorder,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_recorddate != null" >
+        #{bk_recorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bk_ym != null" >
+        #{bk_ym,jdbcType=INTEGER},
+      </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="bk_text1 != null" >
+        #{bk_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_text2 != null" >
+        #{bk_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_text3 != null" >
+        #{bk_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_text4 != null" >
+        #{bk_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_text5 != null" >
+        #{bk_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_remark != null" >
+        #{bk_remark,jdbcType=LONGVARCHAR},
+      </if>
+      <if test="bk_spending != null" >
+        #{bk_spending,jdbcType=DOUBLE},
+      </if>
+      <if test="bk_income != null" >
+        #{bk_income,jdbcType=DOUBLE},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
+    update bankinformation
+    <set >
+      <if test="bk_bankcode != null" >
+        bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_bankname != null" >
+        bk_bankname = #{bk_bankname,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_date != null" >
+        bk_date = #{bk_date,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bk_type != null" >
+        bk_type = #{bk_type,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_beginamount != null" >
+        bk_beginamount = #{bk_beginamount,jdbcType=DOUBLE},
+      </if>
+      <if test="bk_thisamount != null" >
+        bk_thisamount = #{bk_thisamount,jdbcType=DOUBLE},
+      </if>
+      <if test="bk_status != null" >
+        bk_status = #{bk_status,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_statuscode != null" >
+        bk_statuscode = #{bk_statuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_recorderid != null" >
+        bk_recorderid = #{bk_recorderid,jdbcType=INTEGER},
+      </if>
+      <if test="bk_recorder != null" >
+        bk_recorder = #{bk_recorder,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_recorddate != null" >
+        bk_recorddate = #{bk_recorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="bk_ym != null" >
+        bk_ym = #{bk_ym,jdbcType=INTEGER},
+      </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="bk_text1 != null" >
+        bk_text1 = #{bk_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_text2 != null" >
+        bk_text2 = #{bk_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_text3 != null" >
+        bk_text3 = #{bk_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_text4 != null" >
+        bk_text4 = #{bk_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_text5 != null" >
+        bk_text5 = #{bk_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="bk_remark != null" >
+        bk_remark = #{bk_remark,jdbcType=LONGVARCHAR},
+      </if>
+      <if test="bk_income != null" >
+        bk_income = #{bk_income,jdbcType=DOUBLE},
+      </if>
+      <if test="bk_spending != null" >
+        bk_spending = #{bk_spending,jdbcType=DOUBLE},
+      </if>
+    </set>
+    where bk_id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.money.po.Bankinformation" >
+    update bankinformation
+    set bk_bankcode = #{bkBankcode,jdbcType=VARCHAR},
+      bk_bankname = #{bkBankname,jdbcType=VARCHAR},
+      bk_date = #{bkDate,jdbcType=TIMESTAMP},
+      bk_type = #{bkType,jdbcType=VARCHAR},
+      bk_beginamount = #{bkBeginamount,jdbcType=DOUBLE},
+      bk_thisamount = #{bkThisamount,jdbcType=DOUBLE},
+      bk_status = #{bkStatus,jdbcType=VARCHAR},
+      bk_statuscode = #{bkStatuscode,jdbcType=VARCHAR},
+      bk_recorderid = #{bkRecorderid,jdbcType=INTEGER},
+      bk_recorder = #{bkRecorder,jdbcType=VARCHAR},
+      bk_recorddate = #{bkRecorddate,jdbcType=TIMESTAMP},
+      bk_ym = #{bkYm,jdbcType=INTEGER},
+      companyid = #{companyId,jdbcType=INTEGER},
+      updaterId = #{updaterId,jdbcType=INTEGER},
+      updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      bk_text1 = #{bkText1,jdbcType=VARCHAR},
+      bk_text2 = #{bkText2,jdbcType=VARCHAR},
+      bk_text3 = #{bkText3,jdbcType=VARCHAR},
+      bk_text4 = #{bkText4,jdbcType=VARCHAR},
+      bk_text5 = #{bkText5,jdbcType=VARCHAR},
+      bk_remark = #{bkRemark,jdbcType=LONGVARCHAR}
+    where bk_id = #{bkId,jdbcType=INTEGER}
+  </update>
+
+  <select id="selectAll" resultMap="BaseResultMap">
+    SELECT * FROM bankinformation
+  </select>
+
+  <select id="selectBankinformationBycondition" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from bankinformation
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and   bankinformation.companyId = #{companyId}
+      </if>
+    </where>  order by bk_id
+  </select>
+  <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
+        SELECT CONCAT(bk_bankcode,' ',bk_bankname) display,bk_bankname value FROM bankinformation WHERE COMPANYID=#{companyId}
+    </select>
+
+
+  <select id="selectBankcode" parameterType="java.lang.String" resultType="java.lang.String">
+        select bk_bankcode from bankinformation where bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR}
+    </select>
+
+  <update id="updateBankAmount" >
+    update bankinformation set bk_thisamount = #{bk_thisamount,jdbcType=DOUBLE}
+     where bk_id = #{id,jdbcType=INTEGER}
+  </update>
+
+  <select id="selectThisamount" parameterType="java.lang.Integer" resultType="java.lang.Double">
+  select bk_beginamount from bankinformation where bk_id = #{id,jdbcType=INTEGER}
+</select>
+</mapper>

+ 18 - 7
applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml

@@ -19,11 +19,19 @@
     <result column="ft_text3" property="ft_text3" jdbcType="VARCHAR" />
     <result column="ft_text4" property="ft_text4" jdbcType="VARCHAR" />
     <result column="ft_text5" property="ft_text5" jdbcType="VARCHAR" />
+    <result column="ftd_bankname" property="ftd_bankname" jdbcType="VARCHAR" />
+    <result column="ftd_inbankname" property="ftd_inbankname" jdbcType="VARCHAR" />
+    <result column="ftd_nowbalance" property="ftd_nowbalance" jdbcType="DOUBLE" />
+    <result column="ftd_paymethod" property="ftd_paymethod" jdbcType="VARCHAR" />
+    <result column="ftd_paycode" property="ftd_paycode" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
     ft_id, ft_code, ft_date, ft_recorderid, ft_recorder, ft_recorddate, ft_status, ft_statuscode, 
-    ft_remark, companyId, updaterId, updatedate, ft_text1, ft_text2, ft_text3, ft_text4, 
-    ft_text5
+    ft_remark, fundtransfer.companyId, fundtransfer.updaterId, fundtransfer.updatedate,
+    ft_text1, ft_text2, ft_text3, ft_text4, ft_text5
+  </sql>
+  <sql id="Detail_Column_List" >
+    ftd_bankname,ftd_inbankname,ftd_nowbalance,ftd_paymethod,ftd_paycode
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 
@@ -232,8 +240,10 @@
 
   <select id="selectFundtransferBycondition" resultMap="BaseResultMap">
     select
-    <include refid="Base_Column_List" />
-    from Fundtransfer
+    <include refid="Base_Column_List" />,
+    <include refid="Detail_Column_List" />
+    from Fundtransfer left join fundtransferdetail on ftd_ftid=ft_id and
+    Fundtransfer.companyId= fundtransferdetail.companyId
     <where>
       <if test="con != null">
         ${con}
@@ -246,9 +256,10 @@
 
   <select id="selectFundtransferListByCondition" resultMap="BaseResultMap">
     select
-    <include refid="Base_Column_List" />
-    from fundtransfer
-    left join fundtransferdetail on ft_id=ftd_ftid
+    <include refid="Base_Column_List" />,
+    <include refid="Detail_Column_List" />
+    from Fundtransfer left join fundtransferdetail on ftd_ftid=ft_id and
+    Fundtransfer.companyId= fundtransferdetail.companyId
     <where>
       <if test="con != null">
         ${con}

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

@@ -26,12 +26,18 @@
     <result column="or_text3" property="or_text3" jdbcType="VARCHAR" />
     <result column="or_text4" property="or_text4" jdbcType="VARCHAR" />
     <result column="or_text5" property="or_text5" jdbcType="VARCHAR" />
+    <result column="ord_type" property="ord_type" jdbcType="VARCHAR" />
+    <result column="ord_nowbalance" property="ord_nowbalance" jdbcType="DOUBLE" />
+    <result column="ord_remark" property="ord_remark" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
     or_id, or_code, or_date, or_custid, or_custcode, or_custname, or_bankcode, or_bankid, 
     or_bankname, or_amount, or_recorderid, or_recorder, or_recorddate, or_status, or_statuscode, 
-    or_remark, companyId, updaterId, updatedate, or_text1, or_text2, or_text3, or_text4, 
-    or_text5
+    or_remark, Othreceipts.companyId, Othreceipts.updaterId, Othreceipts.updatedate, or_text1,
+    or_text2, or_text3, or_text4, or_text5
+  </sql>
+  <sql id="Detail_Column_List" >
+    ord_type,ord_nowbalance,ord_remark
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 
@@ -314,11 +320,11 @@
   <select id="validateCodeWhenUpdate" resultType="int" >
     select count(1) from othreceipts where or_code = #{code} and or_id != #{id} and companyId =#{companyId}
   </select>
-
   <select id="selectOthreceiptsBycondition" resultMap="BaseResultMap">
     select
-    <include refid="Base_Column_List" />
-    from Othreceipts
+    <include refid="Base_Column_List" />,
+    <include refid="Detail_Column_List" />
+    from Othreceipts left join othreceiptsdetail on ord_orid=or_id and Othreceipts.companyId=othreceiptsdetail.companyId
     <where>
       <if test="con != null">
         ${con}
@@ -331,9 +337,9 @@
 
   <select id="selectOthreceiptsListByCondition" resultMap="BaseResultMap">
     select
-    <include refid="Base_Column_List" />
-    from Othreceipts
-    left join othreceiptsdetail on or_id=ord_orid 
+    <include refid="Base_Column_List" />,
+    <include refid="Detail_Column_List" />
+    from Othreceipts left join othreceiptsdetail on ord_orid=or_id and Othreceipts.companyId=othreceiptsdetail.companyId
     <where>
       <if test="con != null">
         ${con}

+ 16 - 6
applications/money/money-server/src/main/resources/mapper/OthspendingsMapper.xml

@@ -26,13 +26,20 @@
     <result column="os_text3" property="os_text3" jdbcType="VARCHAR" />
     <result column="os_text4" property="os_text4" jdbcType="VARCHAR" />
     <result column="os_text5" property="os_text5" jdbcType="VARCHAR" />
+    <result column="osd_type" property="osd_type" jdbcType="VARCHAR" />
+    <result column="osd_nowbalance" property="osd_nowbalance" jdbcType="DOUBLE" />
+    <result column="osd_remark" property="osd_remark" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
     os_id, os_code, os_date, os_vendid, os_vendcode, os_vendname, os_bankid, os_bankcode, 
     os_bankname, os_amount, os_recorderid, os_recorder, os_recorddate, os_status, os_statuscode, 
-    os_remark, companyId, updaterId, updatedate, os_text1, os_text2, os_text3, os_text4, 
+    os_remark, othspendingsdetail.companyId, othspendingsdetail.updaterId,
+    othspendingsdetail.updatedate, os_text1, os_text2, os_text3, os_text4,
     os_text5
   </sql>
+  <sql id="Detail_Column_List" >
+    osd_type,osd_nowbalance,osd_remark
+  </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 
     <include refid="Base_Column_List" />
@@ -312,8 +319,10 @@
 
   <select id="selectOthspendingsBycondition" resultMap="BaseResultMap">
     select
-    <include refid="Base_Column_List" />
-    from Othspendings
+    <include refid="Base_Column_List" />,
+    <include refid="Detail_Column_List" />
+    from Othspendings left join othspendingsdetail on osd_osid=os_id
+    and Othspendings.companyId=othspendingsdetail.companyId
     <where>
       <if test="con != null">
         ${con}
@@ -326,9 +335,10 @@
 
   <select id="selectOthspendingsListByCondition" resultMap="BaseResultMap">
     select
-    <include refid="Base_Column_List" />
-    from Othspendings
-    left join othspendingsdetail on os_id=osd_orid
+    <include refid="Base_Column_List" />,
+    <include refid="Detail_Column_List" />
+    from Othspendings left join othspendingsdetail on osd_osid=os_id
+    and Othspendings.companyId=othspendingsdetail.companyId
     <where>
       <if test="con != null">
         ${con}

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

@@ -3,7 +3,7 @@
 <mapper namespace="com.usoftchina.saas.money.mapper.OthspendingsdetailMapper" >
   <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.Othspendingsdetail" >
     <id column="osd_id" property="id" jdbcType="INTEGER" />
-    <result column="osd_orid" property="osd_orid" jdbcType="INTEGER" />
+    <result column="osd_osid" property="osd_osid" jdbcType="INTEGER" />
     <result column="osd_detno" property="osd_detno" jdbcType="INTEGER" />
     <result column="osd_ym" property="osd_ym" jdbcType="INTEGER" />
     <result column="os_date" property="os_date" jdbcType="TIMESTAMP" />
@@ -20,18 +20,18 @@
     <result column="osd_text5" property="osd_text5" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
-    osd_id, osd_orid, osd_detno, osd_ym, osd_type, osd_nowbalance, osd_remark, companyId, 
+    osd_id, osd_osid, osd_detno, osd_ym, osd_type, osd_nowbalance, osd_remark, companyId,
     updaterId, updatedate, osd_text1, osd_text2, osd_text3, osd_text4, osd_text5
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 
     <include refid="Base_Column_List" />
     from othspendingsdetail
-    where osd_orid = #{id,jdbcType=INTEGER}
+    where osd_osid = #{id,jdbcType=INTEGER}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
     delete from othspendingsdetail
-    where osd_orid = #{id,jdbcType=INTEGER}
+    where osd_osid = #{id,jdbcType=INTEGER}
   </delete>
 
   <delete id="deleteItem" parameterType="java.lang.Integer" >
@@ -40,7 +40,7 @@
   </delete>
 
   <insert id="insert" parameterType="com.usoftchina.saas.money.po.Othspendingsdetail" >
-    insert into othspendingsdetail (osd_orid, osd_detno,
+    insert into othspendingsdetail (osd_osid, osd_detno,
       osd_ym, osd_type, osd_nowbalance, 
       osd_remark, companyId, updaterId, 
       updatedate, osd_text1, osd_text2, 
@@ -56,8 +56,8 @@
   <insert id="insertSelective" parameterType="com.usoftchina.saas.money.po.Othspendingsdetail" >
     insert into othspendingsdetail
     <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="osd_orid != null" >
-        osd_orid,
+      <if test="osd_osid != null" >
+        osd_osid,
       </if>
       <if test="osd_detno != null" >
         osd_detno,
@@ -100,8 +100,8 @@
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="osd_orid != null" >
-        #{osd_orid,jdbcType=INTEGER},
+      <if test="osd_osid != null" >
+        #{osd_osid,jdbcType=INTEGER},
       </if>
       <if test="osd_detno != null" >
         #{osd_detno,jdbcType=INTEGER},
@@ -150,8 +150,8 @@
   <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.money.po.Othspendingsdetail" >
     update othspendingsdetail
     <set >
-      <if test="osd_orid != null" >
-        osd_orid = #{osd_orid,jdbcType=INTEGER},
+      <if test="osd_osid != null" >
+        osd_osid = #{osd_osid,jdbcType=INTEGER},
       </if>
       <if test="osd_detno != null" >
         osd_detno = #{osd_detno,jdbcType=INTEGER},
@@ -197,7 +197,7 @@
   </update>
   <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.money.po.Othspendingsdetail" >
     update othspendingsdetail
-    set osd_orid = #{osdOrid,jdbcType=INTEGER},
+    set osd_osid = #{osdOrid,jdbcType=INTEGER},
       osd_detno = #{osdDetno,jdbcType=INTEGER},
       osd_ym = #{osdYm,jdbcType=INTEGER},
       osd_type = #{osdType,jdbcType=VARCHAR},
@@ -215,6 +215,6 @@
   </update>
 
   <select id="selectYm" parameterType="java.lang.Integer" resultType="java.lang.Integer">
-    select osd_ym from othspendingsdetail where osd_orid = #{id,jdbcType=INTEGER}
+    select osd_ym from othspendingsdetail where osd_osid = #{id,jdbcType=INTEGER}
   </select>
 </mapper>

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

@@ -34,6 +34,7 @@
     <result column="pd_paymethod" jdbcType="VARCHAR" property="pd_paymethod" />
     <result column="pd_paycode" jdbcType="VARCHAR" property="pd_paycode" />
     <result column="pd_remark" jdbcType="VARCHAR" property="pd_remark" />
+    <result column="pd_amount" jdbcType="DOUBLE" property="pd_amount" />
     <result column="pbd_slcode" jdbcType="VARCHAR" property="pbd_slcode" />
     <result column="pbd_slkind" jdbcType="VARCHAR" property="pbd_slkind" />
     <result column="pbd_sldate" jdbcType="TIMESTAMP" property="pbd_sldate" />
@@ -604,7 +605,7 @@
   </update>
 
 <select id="selectThisamount" parameterType="java.lang.Integer" resultType="java.lang.Double">
-  select bk_thisamount from bankinformation where bk_id = #{id,jdbcType=INTEGER}
+  select bk_beginamount from bankinformation where bk_id = #{id,jdbcType=INTEGER}
 </select>
 
 <!-- 供应商-->

+ 1 - 0
applications/money/money-server/src/main/resources/mapper/RecbalanceMapper.xml

@@ -31,6 +31,7 @@
     <result column="rb_text5" jdbcType="VARCHAR" property="rb_text5" />
     <result column="cu_leftamount" jdbcType="DOUBLE" property="cu_leftamount" />
     <result column="rd_bankname" jdbcType="VARCHAR" property="rd_bankname" />
+    <result column="rd_amount" jdbcType="DOUBLE" property="rd_amount" />
     <result column="rd_paymethod" jdbcType="VARCHAR" property="rd_paymethod" />
     <result column="rd_paycode" jdbcType="VARCHAR" property="rd_paycode" />
     <result column="rd_remark" jdbcType="VARCHAR" property="rd_remark" />

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

@@ -44,7 +44,7 @@
                 and pd_ym=#{si_yearmonth,jdbcType=INTEGER} and pb_statuscode='AUDITED',
             </if>
             <if test="si_amount_otherpay != null" >
-                (select sum(os_amount) from othspendings RIGHT JOIN othspendingsdetail on os_id = osd_orid
+                (select sum(os_amount) from othspendings RIGHT JOIN othspendingsdetail on os_id = osd_osid
                 where othspendingsdetail.companyId=#{companyid,jdbcType=INTEGER}
                 and osd_ym=#{si_yearmonth,jdbcType=INTEGER} and os_statuscode='AUDITED'),
             </if>
@@ -76,7 +76,7 @@
             </if>
             <if test="si_amount_otherpay != null" >
                 si_amount_otherpay =
-                (select sum(os_amount) from othspendings RIGHT JOIN othspendingsdetail on os_id = osd_orid
+                (select sum(os_amount) from othspendings RIGHT JOIN othspendingsdetail on os_id = osd_osid
                 where othspendingsdetail.companyId=#{companyid,jdbcType=INTEGER}
                 and osd_ym=#{si_yearmonth,jdbcType=INTEGER} and os_statuscode='AUDITED'),
             </if>

+ 3 - 1
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseDetailDTO.java

@@ -12,7 +12,7 @@ import java.util.Date;
  * @date 2018/10/9
  */
 @Data
-public class PurchaseDetailDTO extends CommonBaseDTO implements Serializable{
+public class PurchaseDetailDTO implements Serializable{
 
     private  Long pd_puid;
 
@@ -60,6 +60,8 @@ public class PurchaseDetailDTO extends CommonBaseDTO implements Serializable{
 
     private Double pd_yqty;
 
+    private String pd_remark;
+
     private ProductDTO productDTO;
 
 }

+ 1 - 0
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseListDTO.java

@@ -116,4 +116,5 @@ public class PurchaseListDTO extends CommonBaseDTO implements Serializable {
 
     private Double pd_yqty;
 
+    private String pd_remark;
 }

+ 2 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseDetail.java

@@ -56,5 +56,7 @@ public class PurchaseDetail extends CommonBaseEntity implements Serializable {
 
     private Double pd_yqty;
 
+    private  String pd_remark;
+
     private ProductDTO productDTO;
 }

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

@@ -118,6 +118,8 @@ public class PurchaseList extends CommonBaseEntity implements Serializable {
 
     private Double pd_yqty;
 
+    private String pd_remark;
+
     //private ProductDTO productDTO;
     private Long pr_id;
     private String pr_code;

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

@@ -1,7 +1,9 @@
 package com.usoftchina.saas.purchase.po.report;
 
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
 import lombok.Data;
 
+import java.io.Serializable;
 import java.util.Date;
 
 /**
@@ -9,7 +11,7 @@ import java.util.Date;
  * @create: 2018-11-09 14:22
  **/
 @Data
-public class PurchasePay {
+public class PurchasePay  extends CommonBaseEntity implements Serializable {
     private Integer pb_id;
 
     private String pb_code;

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

@@ -118,6 +118,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         Long companyId = BaseContextHolder.getCompanyId();
         //人员Id
         Long userId = BaseContextHolder.getUserId();
+        String userName = BaseContextHolder.getUserName();
 
         //获取主表信息
         ProdInOutDTO main = formdata.getMain();
@@ -126,28 +127,23 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         List<ProdIODetail> insertDetails = new ArrayList<>();
         //更新从表数据
         List<ProdIODetail> updateDetails = new ArrayList<>();
-        DocBaseDTO baseDTO = new DocBaseDTO();
         Long pi_id = main.getId();
         String pi_inoutno = main.getPi_inoutno();
         String pi_class = main.getPi_class();
         ProdInOut prodInOut = BeanMapper.map(main,ProdInOut.class);
-        prodInOut.setCompanyId(companyId);
-        prodInOut.setPi_recordmanid(userId.intValue());
-//        prodInOut.setPi_recordman(emp.get("em_name").toString());
-        prodInOut.setCreatorId(userId);
-        prodInOut.setCreateTime(prodInOut.getPi_recorddate()==null?new Date():prodInOut.getPi_recorddate());
-        prodInOut.setPi_date(prodInOut.getPi_date()==null?new Date():prodInOut.getPi_date());
-        prodInOut.setPi_puid(main.getPi_puid());
-        prodInOut.setPi_pucode(main.getPi_pucode());
+
+        //编号获取
+        DocBaseDTO baseDTO = new DocBaseDTO();
         baseDTO.setCode(pi_inoutno);
         baseDTO.setId(pi_id);
         baseDTO.setName(pi_class);
-        //编号获取
         pi_inoutno = pushMaxnubmer(baseDTO);
         prodInOut.setPi_inoutno(pi_inoutno);
 
         //判断更新与保存动作
         if (StringUtils.isEmpty(pi_id) || "0".equals(pi_id.toString())){
+            prodInOut.setCompanyId(companyId);
+            //setCreateInfo(prodInOut);
             //插入操作
             getMapper().insertSelective(prodInOut);
             pi_id = prodInOut.getId();
@@ -173,19 +169,25 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             //日志记录
             messageLogService.save(baseDTO);
             return baseDTO;
+        }else{
+            //setUpdateInfo(prodInOut);
         }
         //更新操作
         getMapper().updateByPrimaryKeySelective(prodInOut);
         //添加从表传输对象
         for (ProdIODetailDTO item : items) {
             ProdIODetail detail = BeanMapper.map(item, ProdIODetail.class);
-            detail.setPd_piid(pi_id);
-            detail.setPd_inoutno(pi_inoutno);
-            detail.setPd_piclass(prodInOut.getPi_class());
-            detail.setCompanyId(companyId);
-            detail.setCreatorId(userId);
-            detail.setCreateTime(new Date());
+            detail.setUpdaterId(userId);
+            detail.setUpdateTime(new Date());
+            detail.setUpdater(userName);
             if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
+                detail.setCompanyId(companyId);
+                detail.setCreatorId(userId);
+                detail.setCreateTime(new Date());
+
+                detail.setPd_piid(pi_id);
+                detail.setPd_inoutno(pi_inoutno);
+                detail.setPd_piclass(prodInOut.getPi_class());
                 insertDetails.add(detail);
             } else {
                 updateDetails.add(detail);
@@ -412,6 +414,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         ProdInOut sourcePi = getMapper().selectByPrimaryKey(id);
         Integer count=0;
         double pdInqty=0, pdYqty=0;
+        Long userId = BaseContextHolder.getUserId();
+        String userName = BaseContextHolder.getUserName();
         List<ProdIODetail> sourcePids =prodIODetailMapper.selectByFK(id);
         //检查从表
         for (ProdIODetail prodIODetail : sourcePids) {
@@ -443,6 +447,11 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         //设置公司id
         targetPi.setCompanyId(sourcePi.getCompanyId());
         targetPi.setCreateTime(new Date());
+        targetPi.setCreatorId(userId);
+        targetPi.setCreator(userName);
+        targetPi.setUpdaterId(userId);
+        targetPi.setUpdater(userName);
+        targetPi.setUpdateTime(new Date());
 
         //保存数据
         getMapper().insertSelective(targetPi);
@@ -475,7 +484,11 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
                  //公司id
                  targetPid.setCompanyId(sourcePid.getCompanyId());
                  targetPid.setCreateTime(new Date());
-
+                 targetPid.setCreatorId(userId);
+                 targetPid.setCreator(userName);
+                 targetPid.setUpdaterId(userId);
+                 targetPid.setUpdater(userName);
+                 targetPid.setUpdateTime(new Date());
                  //本次转单数
                  targetPid.setPd_outqty(pdInqty-pdYqty);
                  prodIODetailMapper.insertSelective(targetPid);
@@ -504,6 +517,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             }
             prodInOut.setPi_statuscode(Status.CLOSE.name());
             prodInOut.setPi_status(Status.CLOSE.getDisplay());
+            //setUpdateInfo(prodInOut);
             getMapper().updateByPrimaryKeySelective(prodInOut);
             docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class(),prodInOut.getPi_inoutno());
             //日志
@@ -538,6 +552,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             }
             prodInOut.setPi_statuscode(Status.OPEN.name());
             prodInOut.setPi_status(Status.OPEN.getDisplay());
+            //setUpdateInfo(prodInOut);
             getMapper().updateByPrimaryKeySelective(prodInOut);
             docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class(),prodInOut.getPi_inoutno());
             //日志

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

@@ -61,8 +61,6 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
     @Autowired
     private ProdInOutService prodInOutService;
 
-
-
     @Override
     public PageInfo<PurchaseList> getListData(PageRequest page, ListReqDTO req) {
         //设置默认分页
@@ -107,6 +105,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         Long companyId = BaseContextHolder.getCompanyId();
         //人员Id
         Long userId = BaseContextHolder.getUserId();
+        //人员名称
+        String userName = BaseContextHolder.getUserName();
         //获取主表信息
         PurchaseDTO main = formdata.getMain();
         List<PurchaseDetailDTO> items = formdata.getItems();
@@ -119,9 +119,6 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         Long pu_id = main.getId();
         String pu_code = main.getPu_code();
         Purchase purchase = BeanMapper.map(main, Purchase.class);
-        purchase.setCompanyId(companyId);
-        purchase.setCreatorId(userId);
-        purchase.setCreateTime(new Date());
 
         //编号校验
         pu_code = pushMaxnubmer(pu_code, pu_id);
@@ -129,6 +126,9 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         purchase.setPu_code(pu_code);
         //判断更新与保存动作
         if (StringUtils.isEmpty(pu_id) || "0".equals(pu_id.toString())) {
+            //录入人
+            purchase.setCompanyId(companyId);
+           // setCreateInfo(purchase);
             //插入操作
             purchaseMapper.insertSelective(purchase);
             pu_id = purchase.getId();
@@ -142,6 +142,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 detail.setCompanyId(companyId);
                 detail.setCreatorId(userId);
                 detail.setCreateTime(new Date());
+                detail.setCreatorId(userId);
+                detail.setUpdaterId(userId);
+                detail.setUpdater(userName);
+                detail.setUpdateTime(new Date());
                 insertDetails.add(detail);
             }
             //插入从表
@@ -154,6 +158,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
             //日志记录
             messageLogService.save(baseDTO);
             return baseDTO;
+        }else{
+           // setUpdateInfo(purchase);
         }
         //更新操作
         purchaseMapper.updateByPrimaryKeySelective(purchase);
@@ -163,10 +169,14 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
             detail.setPd_puid(pu_id);
             detail.setPd_code(pu_code);
             detail.setPd_delivery(item.getPd_delivery()==null?purchase.getPu_delivery():item.getPd_delivery());
-            detail.setCompanyId(companyId);
-            detail.setCreatorId(userId);
-            detail.setCreateTime(new Date());
+            detail.setUpdaterId(userId);
+            detail.setUpdater(userName);
+            detail.setUpdateTime(new Date());
             if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
+                detail.setCompanyId(companyId);
+                detail.setCreatorId(userId);
+                detail.setCreator(userName);
+                detail.setCreateTime(new Date());
                 insertDetails.add(detail);
             } else {
                 updateDetails.add(detail);
@@ -298,6 +308,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         purchase.setId(id);
         purchase.setPu_acceptstatuscode(Status.CLOSE.name());
         purchase.setPu_acceptstatus(Status.CLOSE.getDisplay());
+        //更新更新人信息
+        purchase.setUpdater(BaseContextHolder.getUserName());
+        purchase.setUpdaterId(BaseContextHolder.getUserId());
+        purchase.setUpdateTime(new Date());
         purchaseMapper.updateByPrimaryKeySelective(purchase);
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
@@ -358,6 +372,11 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 purchase.setPu_acceptstatus(Status.TURNIN.getDisplay());
                 purchase.setPu_acceptstatuscode(Status.TURNIN.name());
             }
+            //更新更新人信息
+            purchase.setUpdater(BaseContextHolder.getUserName());
+            purchase.setUpdaterId(BaseContextHolder.getUserId());
+            purchase.setUpdateTime(new Date());
+
             purchaseMapper.updateByPrimaryKeySelective(purchase);
             docBaseDTO = getBaseDTOById(id);
             //日志
@@ -379,6 +398,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         Long companyId = BaseContextHolder.getCompanyId();
         //人员Id
         Long userId = BaseContextHolder.getUserId();
+        //人员名
+        String userName = BaseContextHolder.getUserName();
 
         Purchase purchase = getMapper().selectByPrimaryKey(id);
 
@@ -420,12 +441,15 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         prodInOut.setPi_vendname(purchase.getPu_vendname());
         prodInOut.setPi_puid(purchase.getId().intValue());
         prodInOut.setPi_pucode(purchase.getPu_code());
-        prodInOut.setCompanyId(purchase.getCompanyId());
-        prodInOut.setCreateTime(new Date());
-
 
         //设置公司id
         prodInOut.setCompanyId(purchase.getCompanyId());
+        prodInOut.setCreatorId(userId);
+        prodInOut.setCreateTime(new Date());
+        prodInOut.setCreator(userName);
+        prodInOut.setUpdaterId(userId);
+        prodInOut.setUpdater(userName);
+        prodInOut.setUpdateTime(new Date());
 
         prodInOutMapper.insertSelective(prodInOut);
 
@@ -452,7 +476,12 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 prodIODetail.setPd_taxrate(purchaseDetail.getPd_taxrate());
                 //公司id
                 prodIODetail.setCompanyId(purchaseDetail.getCompanyId());
+                prodIODetail.setCreatorId(userId);
                 prodIODetail.setCreateTime(new Date());
+                prodIODetail.setCreator(userName);
+                prodIODetail.setUpdaterId(userId);
+                prodIODetail.setUpdateTime(new Date());
+                prodIODetail.setUpdater(userName);
                 //本次转单数
                 prodIODetail.setPd_inqty(pdQty-pdYqty);
                 prodIODetailMapper.insertSelective(prodIODetail);
@@ -488,6 +517,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         purchase.setPu_acceptstatuscode(Status.UNAUDITED.name());
         purchase.setUpdateTime(new Date());
         purchase.setUpdaterId(BaseContextHolder.getUserId());
+        purchase.setUpdater(BaseContextHolder.getUserName());
+       // setUpdateInfo(purchase);
         //更新存在字段
         purchaseMapper.updateByPrimaryKeySelective(purchase);
         //更新最新采购单价
@@ -509,8 +540,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         purchase.setId(id);
         purchase.setPu_status(Status.UNAUDITED.getDisplay());
         purchase.setPu_statuscode(Status.UNAUDITED.name());
-        purchase.setUpdateTime(new Date());
-        purchase.setUpdaterId(BaseContextHolder.getUserId());
+        //setUpdateInfo(purchase);
         //更新存在字段
         purchaseMapper.updateByPrimaryKeySelective(purchase);
         DocBaseDTO docBaseDTO = getBaseDTOById(id);

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

@@ -60,9 +60,13 @@
     <result column="pd_orderid" jdbcType="INTEGER" property="pd_orderid" />
     <result column="pd_sdid" jdbcType="INTEGER" property="pd_sdid" />
     <result column="pd_status" jdbcType="INTEGER" property="pd_status" />
-    <result column="companyid" jdbcType="INTEGER" property="companyId" />
-    <result column="updaterid" jdbcType="INTEGER" property="updaterId" />
-    <result column="updatetime" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="companyid" property="companyId" jdbcType="BIGINT" />
+    <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+    <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="updater" jdbcType="VARCHAR" property="updater" />
+    <result column="creatorid" property="creatorId" jdbcType="INTEGER"/>
+    <result column="createtime" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="creator" property="creator" jdbcType="VARCHAR" />
     <result column="pd_text1" jdbcType="VARCHAR" property="pd_text1" />
     <result column="pd_text2" jdbcType="VARCHAR" property="pd_text2" />
     <result column="pd_text3" jdbcType="VARCHAR" property="pd_text3" />
@@ -71,6 +75,7 @@
     <result column="pd_ym" jdbcType="INTEGER" property="pd_ym" />
     <result column="pd_yqty" jdbcType="DOUBLE" property="pd_yqty" />
     <result column="pd_ioid" jdbcType="INTEGER" property="pd_ioid" />
+    <result column="pd_remark" jdbcType="VARCHAR" property="pd_remark" />
     <result column="pr_id" property="pr_id"/>
     <result column="pr_code" property="pr_code"/>
     <result column="pr_detail" property="pr_detail"/>
@@ -114,7 +119,7 @@
   </select>
 
   <select id="selectProdInOutListByCondition"  resultMap="BaseResultMap">
-    select  *  from prodinout left join prodiodetail on pi_id = pd_piid
+    select  *  from prodinout left join prodiodetail on pi_id = pd_piid left join vendor on pi_vendid=ve_id
     left join product on pd_prodcode=pr_code
     <where>
       <if test="con != null">

+ 62 - 28
applications/purchase/purchase-server/src/main/resources/mapper/ProdInOutMapper.xml

@@ -24,9 +24,13 @@
     <result column="pi_statuscode" jdbcType="VARCHAR" property="pi_statuscode" />
     <result column="pi_printstatus" jdbcType="VARCHAR" property="pi_printstatus" />
     <result column="pi_printstatuscode" jdbcType="VARCHAR" property="pi_printstatuscode" />
-    <result column="companyid" jdbcType="INTEGER" property="companyId" />
-    <result column="updaterid" jdbcType="INTEGER" property="updaterId" />
-    <result column="updatetime" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="companyid" property="companyId" jdbcType="BIGINT" />
+    <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+    <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="updater" jdbcType="VARCHAR" property="updater" />
+    <result column="creatorid" property="creatorId" jdbcType="INTEGER"/>
+    <result column="createtime" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="creator" property="creator" jdbcType="VARCHAR" />
     <result column="pi_text1" jdbcType="VARCHAR" property="pi_text1" />
     <result column="pi_text2" jdbcType="VARCHAR" property="pi_text2" />
     <result column="pi_text3" jdbcType="VARCHAR" property="pi_text3" />
@@ -48,7 +52,7 @@
     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_auditdate,
+    companyid, updaterid, updatetime,updater,creatorid,createtime,creator, pi_text1, pi_text2, pi_text3, pi_text4, pi_text5,pi_auditdate,
     pi_auditman,pi_remark
   </sql>
   <sql id="Blob_Column_List">
@@ -62,6 +66,7 @@
     from prodinout
     where pi_id = #{pi_id,jdbcType=INTEGER}
   </select>
+
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     delete from prodinout
     where pi_id = #{pi_id,jdbcType=INTEGER}
@@ -122,9 +127,6 @@
       <if test="pi_recordman != null">
         pi_recordman,
       </if>
-      <if test="createTime != null">
-        pi_recorddate,
-      </if>
       <if test="pi_status != null">
         pi_status,
       </if>
@@ -137,18 +139,33 @@
       <if test="pi_printstatuscode != null">
         pi_printstatuscode,
       </if>
-      <if test="companyId != null">
+
+      <if test="companyId != null" >
         companyid,
       </if>
-      <if test="updaterId != null">
-        updaterid,
+      <if test="updaterId != null" >
+        updaterId,
+      </if>
+      <if test="updateTime != null" >
+        updateTime,
+      </if>
+      <if test="updater != null" >
+        updater,
       </if>
-      <if test="updateTime != null">
-        updatetime,
+      <if test="creatorId != null" >
+        creatorId,
       </if>
+      <if test="createTime != null" >
+        createTime,
+      </if>
+      <if test="creator != null" >
+        creator,
+      </if>
+
       <if test="pi_text1 != null">
         pi_text1,
       </if>
+
       <if test="pi_text2 != null">
         pi_text2,
       </if>
@@ -224,9 +241,6 @@
       <if test="pi_recordman != null">
         #{pi_recordman,jdbcType=VARCHAR},
       </if>
-      <if test="createTime != null">
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
       <if test="pi_status != null">
         #{pi_status,jdbcType=VARCHAR},
       </if>
@@ -239,15 +253,29 @@
       <if test="pi_printstatuscode != null">
         #{pi_printstatuscode,jdbcType=VARCHAR},
       </if>
-      <if test="companyId != null">
+
+      <if test="companyId != null" >
         #{companyId,jdbcType=INTEGER},
       </if>
-      <if test="updaterId != null">
+      <if test="updaterId != null" >
         #{updaterId,jdbcType=INTEGER},
       </if>
-      <if test="updateTime != null">
+      <if test="updateTime != null" >
         #{updateTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="updater != null" >
+        #{updater,jdbcType=VARCHAR},
+      </if>
+      <if test="creatorId != null" >
+        #{creatorId,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null" >
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="creator != null" >
+        #{creator,jdbcType=VARCHAR},
+      </if>
+
       <if test="pi_text1 != null">
         #{pi_text1,jdbcType=VARCHAR},
       </if>
@@ -345,14 +373,17 @@
       <if test="pi_printstatuscode != null">
         pi_printstatuscode = #{pi_printstatuscode,jdbcType=VARCHAR},
       </if>
-      <if test="companyId != null">
+      <if test="companyId != null" >
         companyid = #{companyId,jdbcType=INTEGER},
       </if>
-      <if test="updaterId != null">
-        updaterid = #{updaterId,jdbcType=INTEGER},
+      <if test="updaterId != null" >
+        updaterId = #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        updateTime = #{updateTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="updateTime != null">
-        updatetime = #{updateTime,jdbcType=TIMESTAMP},
+      <if test="updater != null" >
+        updater = #{updater,jdbcType=VARCHAR},
       </if>
       <if test="pi_text1 != null">
         pi_text1 = #{pi_text1,jdbcType=VARCHAR},
@@ -407,9 +438,11 @@
       pi_statuscode = #{pi_statuscode,jdbcType=VARCHAR},
       pi_printstatus = #{pi_printstatus,jdbcType=VARCHAR},
       pi_printstatuscode = #{pi_printstatuscode,jdbcType=VARCHAR},
-      companyid = #{companyid,jdbcType=INTEGER},
-      updaterid = #{updaterid,jdbcType=INTEGER},
-      updatetime = #{updatetime,jdbcType=TIMESTAMP},
+
+      companyid = #{companyId,jdbcType=INTEGER},
+      updaterId = #{updaterId,jdbcType=INTEGER},
+      updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      updater = #{updater,jdbcType=VARCHAR},
       pi_text1 = #{pi_text1,jdbcType=VARCHAR},
       pi_text2 = #{pi_text2,jdbcType=VARCHAR},
       pi_text3 = #{pi_text3,jdbcType=VARCHAR},
@@ -445,8 +478,9 @@
       pi_printstatus = #{pi_printstatus,jdbcType=VARCHAR},
       pi_printstatuscode = #{pi_printstatuscode,jdbcType=VARCHAR},
       companyid = #{companyId,jdbcType=INTEGER},
-      updaterid = #{updaterId,jdbcType=INTEGER},
-      updatetime = #{updateTime,jdbcType=TIMESTAMP},
+      updaterId = #{updaterId,jdbcType=INTEGER},
+      updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      updater = #{updater,jdbcType=VARCHAR},
       pi_text1 = #{pi_text1,jdbcType=VARCHAR},
       pi_text2 = #{pi_text2,jdbcType=VARCHAR},
       pi_text3 = #{pi_text3,jdbcType=VARCHAR},

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

@@ -24,8 +24,12 @@
         <result column="PU_STATUSCODE" property="pu_statuscode" jdbcType="VARCHAR" />
         <result column="PU_STATUS" property="pu_status" jdbcType="VARCHAR" />
         <result column="companyid" property="companyId" jdbcType="BIGINT" />
-        <result column="updatemanid" property="updaterId" jdbcType="INTEGER" />
-        <result column="updatedate" property="updateTime" jdbcType="TIMESTAMP" />
+        <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+        <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+        <result column="updater" jdbcType="VARCHAR" property="updater" />
+        <result column="creatorid" property="creatorId" jdbcType="INTEGER"/>
+        <result column="createtime" property="createTime" jdbcType="TIMESTAMP" />
+        <result column="creator" property="creator" jdbcType="VARCHAR" />
         <result column="pu_text1" property="pu_text1" jdbcType="VARCHAR" />
         <result column="pu_text2" property="pu_text2" jdbcType="VARCHAR" />
         <result column="pu_text3" property="pu_text3" jdbcType="VARCHAR" />
@@ -54,6 +58,7 @@
         <result column="pd_text4" property="pd_text4" jdbcType="VARCHAR" />
         <result column="pd_text5" property="pd_text5" jdbcType="VARCHAR" />
         <result column="pd_yqty" property="pd_yqty" jdbcType="DOUBLE" />
+        <result column="pd_remark" property="pd_remark" jdbcType="VARCHAR"/>
         <result column="pr_id" property="pr_id"/>
         <result column="pr_code" property="pr_code"/>
         <result column="pr_detail" property="pr_detail"/>

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

@@ -24,8 +24,14 @@
     <result column="PU_STATUSCODE" property="pu_statuscode" jdbcType="VARCHAR" />
     <result column="PU_STATUS" property="pu_status" jdbcType="VARCHAR" />
     <result column="companyid" property="companyId" jdbcType="BIGINT" />
-    <result column="updatemanid" property="updaterId" jdbcType="INTEGER" />
+    <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
     <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+
+    <result column="updater" jdbcType="VARCHAR" property="updater" />
+    <result column="creatorid" property="creatorId" jdbcType="INTEGER"/>
+    <result column="createtime" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="creator" property="creator" jdbcType="VARCHAR" />
+
     <result column="pu_text1" property="pu_text1" jdbcType="VARCHAR" />
     <result column="pu_text2" property="pu_text2" jdbcType="VARCHAR" />
     <result column="pu_text3" property="pu_text3" jdbcType="VARCHAR" />
@@ -40,7 +46,7 @@
     pu_id, pu_code, pu_date, pu_vendid, PU_VENDCODE, PU_VENDNAME, PU_BUYERID, PU_BUYERCODE, 
     PU_BUYERNAME, PU_DELIVERY, PU_TAXTOTAL, PU_TOTAL, PU_REMARK, PU_TOTALUPPER, PU_INDATE, 
     PU_PRINTSTATUS, PU_PRINTSTATUSCODE, PU_ACCEPTSTATUSCODE, PU_ACCEPTSTATUS, PU_STATUSCODE, 
-    PU_STATUS, companyid, updaterId, updateTime, pu_text1, pu_text2, pu_text3, pu_text4,
+    PU_STATUS, companyid, updaterId, updateTime,updater,creatorid,createtime,creator, pu_text1, pu_text2, pu_text3, pu_text4,
     pu_text5
   </sql>
   <sql id="Blob_Column_List" >
@@ -67,6 +73,7 @@
       PU_PRINTSTATUS, PU_PRINTSTATUSCODE, PU_ACCEPTSTATUSCODE, 
       PU_ACCEPTSTATUS, PU_STATUSCODE, PU_STATUS, 
       companyid, updaterId, updateTime,
+      ,updater,creatorid,createtime,creator
       pu_text1, pu_text2, pu_text3, 
       pu_text4, pu_text5, PU_SHIPADDRESSCODE
       )
@@ -78,6 +85,9 @@
       #{puPrintstatus,jdbcType=VARCHAR}, #{puPrintstatuscode,jdbcType=VARCHAR}, #{puAcceptstatuscode,jdbcType=VARCHAR}, 
       #{puAcceptstatus,jdbcType=VARCHAR}, #{puStatuscode,jdbcType=VARCHAR}, #{puStatus,jdbcType=VARCHAR}, 
       #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP},
+
+      #{updater,jdbcType=VARCHAR}, #{creatorid,jdbcType=INTEGER}, #{createtime,jdbcType=TIMESTAMP}, #{creator,jdbcType=VARCHAR},
+
       #{puText1,jdbcType=VARCHAR}, #{puText2,jdbcType=VARCHAR}, #{puText3,jdbcType=VARCHAR}, 
       #{puText4,jdbcType=VARCHAR}, #{puText5,jdbcType=VARCHAR}, #{puShipaddresscode,jdbcType=LONGVARCHAR}
       )
@@ -157,6 +167,17 @@
       <if test="updateTime != null" >
         updateTime,
       </if>
+
+      <if test="updater != null" >
+        updater,
+      </if><if test="creatorId != null" >
+      creatorId,
+      </if><if test="createTime != null" >
+      createTime,
+      </if><if test="creator != null" >
+      creator,
+      </if>
+
       <if test="pu_text1 != null" >
         pu_text1,
       </if>
@@ -246,6 +267,18 @@
       <if test="updateTime != null" >
         #{updateTime,jdbcType=TIMESTAMP},
       </if>
+
+      <if test="updater != null" >
+        #{updater,jdbcType=VARCHAR},
+      </if><if test="creatorId != null" >
+       #{creatorId,jdbcType=INTEGER},
+      </if><if test="createTime != null" >
+       #{createTime,jdbcType=TIMESTAMP},
+      </if><if test="creator != null" >
+       #{creator,jdbcType=VARCHAR},
+      </if>
+
+
       <if test="pu_text1 != null" >
         #{pu_text1,jdbcType=VARCHAR},
       </if>
@@ -335,9 +368,15 @@
       <if test="updaterId != null" >
         updaterId = #{updaterId,jdbcType=INTEGER},
       </if>
+
       <if test="updateTime != null" >
         updateTime = #{updateTime,jdbcType=TIMESTAMP},
       </if>
+
+      <if test="updater != null" >
+        updater = #{updater,jdbcType=VARCHAR},
+      </if>
+
       <if test="pu_text1 != null" >
         pu_text1 = #{pu_text1,jdbcType=VARCHAR},
       </if>
@@ -384,6 +423,7 @@
       companyid = #{companyId,jdbcType=INTEGER},
       updaterId = #{updaterId,jdbcType=INTEGER},
       updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      updater = #{updater,jdbcType=VARCHAR},
       pu_text1 = #{pu_text1,jdbcType=VARCHAR},
       pu_text2 = #{pu_text2,jdbcType=VARCHAR},
       pu_text3 = #{pu_text3,jdbcType=VARCHAR},

+ 6 - 6
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseReportMapper.xml

@@ -6,8 +6,6 @@
     <result column="pb_code" property="pb_code" jdbcType="VARCHAR" />
     <result column="pu_vendcode" property="pu_vendcode" jdbcType="VARCHAR" />
     <result column="pu_vendname" property="pu_vendname" jdbcType="VARCHAR" />
-    <result column="pb_recorder" property="pb_recorder" jdbcType="VARCHAR" />
-    <result column="pb_recorddate" property="pb_recorddate" jdbcType="TIMESTAMP" />
     <result column="pbd_slcode" property="pbd_slcode" jdbcType="VARCHAR" />
     <result column="pbd_slkind" property="pbd_slkind" jdbcType="VARCHAR" />
     <result column="pbd_amount" property="pbd_amount" jdbcType="DOUBLE" />
@@ -15,7 +13,11 @@
     <result column="pb_pbdamount" property="pb_pbdamount" jdbcType="DOUBLE" />
     <result column="pb_payrate" property="pb_payrate" jdbcType="DOUBLE" />
     <result column="pd_remark" property="pd_remark" jdbcType="VARCHAR" />
-    <result column="companyid" property="companyid" jdbcType="INTEGER" />
+    <result column="companyid" property="companyId" jdbcType="BIGINT" />
+
+    <result column="creatorid" property="creatorId" jdbcType="INTEGER"/>
+    <result column="createtime" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="creator" property="creator" jdbcType="VARCHAR" />
   </resultMap>
   <resultMap id="ListMap" type="com.usoftchina.saas.purchase.po.report.PurchaseReportDetail">
     <id column="pu_id" property="pu_id" jdbcType="INTEGER" />
@@ -40,8 +42,6 @@
     <result column="PU_STATUSCODE" property="pu_statuscode" jdbcType="VARCHAR" />
     <result column="PU_STATUS" property="pu_status" jdbcType="VARCHAR" />
     <result column="companyid" property="companyId" jdbcType="BIGINT" />
-    <result column="updatemanid" property="updaterId" jdbcType="INTEGER" />
-    <result column="updatedate" property="updateTime" jdbcType="TIMESTAMP" />
     <result column="pu_text1" property="pu_text1" jdbcType="VARCHAR" />
     <result column="pu_text2" property="pu_text2" jdbcType="VARCHAR" />
     <result column="pu_text3" property="pu_text3" jdbcType="VARCHAR" />
@@ -110,7 +110,7 @@
         and  companyId = #{companyId}
       </if>
     </where>
-    order by pb_recorddate desc
+    order by pb_id desc
   </select>
 
   <select id="selectDetailByCondition"  resultMap="ListMap">

+ 16 - 3
applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml

@@ -29,6 +29,7 @@
     <result column="pd_text4" property="pd_text4" jdbcType="VARCHAR" />
     <result column="pd_text5" property="pd_text5" jdbcType="VARCHAR" />
     <result column="pd_yqty" property="pd_yqty" jdbcType="DOUBLE" />
+    <result column="pd_remark" property="pd_remark" jdbcType="VARCHAR" />
     <association property="productDTO" javaType="com.usoftchina.saas.document.dto.ProductDTO">
       <id column="pr_id" property="id"/>
       <result column="pr_code" property="pr_code"/>
@@ -64,7 +65,7 @@
     PD_ID, PD_PUID, PD_CODE, PD_DETNO, PD_PRODID, PD_PRODCODE, PD_UNIT, PD_QTY, PD_PRICE,PD_TAXPRICE,
     PD_TOTAL, PD_TAXRATE,PD_TAXTOTAL, PD_ACCEPTQTY, PD_DELIVERY, PD_SALECODE, PD_SALEDETNO, PD_SDID,
     companyId, updaterId, updateTime, pd_text1, pd_text2, pd_text3, pd_text4, pd_text5,
-    pd_yqty
+    pd_yqty,pd_remark
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select
@@ -164,6 +165,9 @@
       <if test="pd_text5 != null">
         pd_text5,
       </if>
+      <if test="pd_remark != null">
+        pd_remark,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
 
@@ -245,6 +249,9 @@
       <if test="pd_text5 != null">
         #{pd_text5,jdbcType=VARCHAR},
       </if>
+      <if test="pd_remark !=null">
+        #{pd_remark,jdbcType=VARCHAR}
+      </if>
     </trim>
   </insert>
 
@@ -329,6 +336,9 @@
       <if test="pd_yqty != null" >
         pd_yqty = #{pd_yqty,jdbcType=DOUBLE},
       </if>
+      <if test="pd_remark != null" >
+        pd_remark = #{pd_remark,jdbcType=VARCHAR}
+      </if>
     </set>
     where PD_ID = #{id,jdbcType=INTEGER}
   </update>
@@ -342,7 +352,7 @@
     PD_SDID, companyId, updaterId,
     updateTime, pd_text1, pd_text2,
     pd_text3, pd_text4, pd_text5,
-    pd_yqty)
+    pd_yqty,pd_remark)
     values
     <foreach collection="list" item="item" index="index" open="" close="" separator=",">
       (
@@ -354,7 +364,7 @@
       #{item.pd_sdid,jdbcType=INTEGER}, #{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_yqty,jdbcType=DOUBLE}
+      #{item.pd_yqty,jdbcType=DOUBLE}, #{item.pd_remark,jdbcType=VARCHAR}
       )
     </foreach>
   </insert>
@@ -436,6 +446,9 @@
       <if test="item.pd_yqty != null" >
         pd_yqty = #{item.pd_yqty,jdbcType=DOUBLE},
       </if>
+      <if test="item.pd_remark !=null">
+        pd_remark = #{item.pd_remark,jdbcType=VARCHAR}
+      </if>
       </set>
       where PD_ID = #{item.id,jdbcType=INTEGER}
     </foreach>

+ 2 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/SaleApplication.java

@@ -17,8 +17,9 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 @EnableEurekaClient
 @EnableFeignClients("com.usoftchina.saas")
 @EnableAuthClient
-public class SaleApplication{
+public class SaleApplication  {
     public static void main(String[] args) {
         SpringApplication.run(SaleApplication.class, args);
     }
+
 }

+ 2 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java

@@ -1,11 +1,12 @@
 package com.usoftchina.saas.sale.mapper;
 
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.sale.po.Sale;
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
-public interface SaleMapper {
+public interface SaleMapper extends CommonBaseMapper<Sale> {
 
     int deleteByPrimaryKey(Long sa_id);
 

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

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.sale.po;
 
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
 import com.usoftchina.saas.document.dto.ProductDTO;
 import lombok.Data;
 
@@ -11,7 +12,7 @@ import java.util.Date;
  * @create: 2018-10-22 14:38
  **/
 @Data
-public class SaleList implements Serializable{
+public class SaleList implements Serializable {
     private Integer sa_id;
 
     private String sa_code;

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

@@ -172,7 +172,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         //更新明细金额等
         setTotal(prodInOutNow);
         //日志
-       messageLogService.update(baseDTO);
+        messageLogService.update(baseDTO);
         return baseDTO;
 
     }
@@ -415,7 +415,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         targetPi.setPi_recordmanid(BaseContextHolder.getUserId());
         targetPi.setPi_recorddate(new Date());
         targetPi.setPi_recordman("TESTADMIN");
-
+        targetPi.setPi_ioid(id);
         targetPi.setPi_inoutno(piInoutno);
         targetPi.setPi_class(BillCodeSeq.SALEIN.getName());
         targetPi.setPi_date(new Date());
@@ -623,14 +623,14 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             if(prodInOut.getPi_said()!=null) {
                 prodIODetailMapper.updateSaleYqty(prodInOut.getPi_said());
             }
-        }else{//销售退货单z
+        }else{//销售退货单
             //更新明细
             prodIODetailMapper.updatePDSaleIN(id);
             //更新主表
             prodInOutMapper.updatePiTotal(id);
             //出货单已转数
-            if(prodInOut.getPi_said()!=null){
-                prodIODetailMapper.updateSaleOutYqty(prodInOut.getPi_said());
+            if(prodInOut.getPi_ioid()!= null) {
+                prodIODetailMapper.updateSaleOutYqty(prodInOut.getPi_ioid());
             }
         }
     }

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

@@ -2,6 +2,7 @@ package com.usoftchina.saas.sale.service.impl;
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.api.CommonService;
 import com.usoftchina.saas.commons.api.MaxnumberService;
 import com.usoftchina.saas.commons.api.MessageLogService;
@@ -100,7 +101,7 @@ public class SaleServiceImpl implements SaleService{
         //人员Id
         Long userId = BaseContextHolder.getUserId();
         //获取主表信息
-         SaleDTO main = formdata.getMain();
+        SaleDTO main = formdata.getMain();
         List<SaleDetailDTO> items = formdata.getItems();
         //插入从表数据
         List<SaleDetail> insertDetails = new ArrayList<>();
@@ -111,11 +112,6 @@ public class SaleServiceImpl implements SaleService{
         Long sa_id = main.getId();
         String sa_code = main.getSa_code();
         Sale sale = BeanMapper.map(main, Sale.class);
-        sale.setCompanyId(companyId);
-        sale.setCreatorId(userId);
-        sale.setCreateTime(new Date());
-        sale.setSa_recorderid(userId);
-        sale.setSa_recorder("test");
         sale.setSa_sendstatus(Status.UNTURNOUT.getDisplay());
         sale.setSa_sendstatuscode(Status.UNTURNOUT.name());
 
@@ -125,6 +121,7 @@ public class SaleServiceImpl implements SaleService{
         sale.setSa_code(sa_code);
         //判断更新与保存动作
         if (StringUtils.isEmpty(sa_id) || "0".equals(sa_id.toString())) {
+            sale.setCompanyId(companyId);
             //插入操作
             saleMapper.insertSelective(sale);
             sa_id = sale.getId();

+ 6 - 11
applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -739,18 +739,13 @@
   </update>
 
   <update id="updateSaleOutYqty" parameterType="long">
-update prodiodetail a
-  set a.pd_yqty =ifnull((select  b.pd_inqty  from  (
+   update prodiodetail a
+   set a.pd_yqty =ifnull(
+	 (select  b.pd_inqty  from  (
 	select pd_ioid,sum(pd_inqty) pd_inqty from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='销售退货单'
-  and pi_said=#{id}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
-  where a.pd_piid = (select pi_id from prodinout where pi_said=#{id} and pi_class='出货单');
-  </update>
-  <update id="updateSaleYqty" parameterType="long">
-
-    update saledetail a set a.sd_yqty =IFNULL( ( select b.pd_outqty from (
-    select pd_sdid,sum(pd_outqty) pd_outqty from prodiodetail left join
-    prodinout on pd_piid = pi_id where pd_piclass='出货单' and pi_said=#{id}
-    GROUP BY pd_sdid) b where IFNULL(b.pd_sdid ,0) = a.sd_id ),0) where a.sd_said =#{id}
+  and pi_ioid=#{id}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),
+	0)
+  where a.pd_piid =#{id}
   </update>
 
   <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">

+ 1 - 0
applications/sale/sale-server/src/main/resources/mapper/ProdInOutListMapper.xml

@@ -89,6 +89,7 @@
 
   <select id="selectProdInOutBycondition"  resultMap="BaseResultMap">
     select  *  from prodinout left join prodiodetail on pi_id = pd_piid left join product on pr_id = pd_prodid
+    left join customer on pi_custid=cu_id
       <where>
         <if test="con != null">
           ${con}

+ 2 - 0
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/ProdInOut.java

@@ -70,4 +70,6 @@ public class ProdInOut extends CommonBaseEntity implements Serializable {
     private String pi_auditman;
 
     private String pi_remark;
+
+    private Long pi_ioid;
 }

+ 43 - 5
base-servers/account/account-api/src/main/java/com/usoftchina/saas/account/api/AccountApi.java

@@ -1,11 +1,12 @@
 package com.usoftchina.saas.account.api;
 
+import com.usoftchina.saas.account.dto.AccountCopyDTO;
 import com.usoftchina.saas.account.dto.AccountDTO;
+import com.usoftchina.saas.account.dto.AccountRegDTO;
+import com.usoftchina.saas.account.dto.AccountUpdateDTO;
 import com.usoftchina.saas.base.Result;
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author yingp
@@ -29,15 +30,52 @@ public interface AccountApi {
      * @param username
      * @return
      */
-    @GetMapping(value = "/account/read")
+    @GetMapping(value = "/account/read", params = "username")
     Result<AccountDTO> getAccount(@RequestParam(value = "username") String username);
 
+    /**
+     * 按用户uu查找账户
+     *
+     * @param uu
+     * @return
+     */
+    @GetMapping(value = "/account/read", params = "uu")
+    Result<AccountDTO> getAccountByUu(@RequestParam(value = "uu") Long uu);
+
     /**
      * 按用户名查找账户
      *
      * @param id
      * @return
      */
-    @GetMapping(value = "/account/{id}")
+    @GetMapping(value = "/account/read/{id}")
     Result<AccountDTO> getAccountById(@PathVariable("id") Long id);
+
+    /**
+     * 注册
+     *
+     * @param accountRegDTO
+     * @return
+     */
+    @PostMapping("/account/register")
+    Result register(@RequestBody AccountRegDTO accountRegDTO);
+
+    /**
+     * 从其他平台同步已注册用户信息
+     * 区别于普通注册:密码已经是加密后的密文
+     *
+     * @param accountSyncDTO
+     * @return
+     */
+    @PostMapping("/account/register/copy")
+    Result copyRegistration(@RequestBody AccountCopyDTO accountSyncDTO);
+
+    /**
+     * 修改
+     *
+     * @param accountUpdateDTO
+     * @return
+     */
+    @PostMapping("/account/update")
+    Result update(@RequestBody AccountUpdateDTO accountUpdateDTO);
 }

+ 70 - 0
base-servers/account/account-api/src/main/java/com/usoftchina/saas/account/api/CompanyApi.java

@@ -0,0 +1,70 @@
+package com.usoftchina.saas.account.api;
+
+import com.usoftchina.saas.account.dto.CompanyCopyDTO;
+import com.usoftchina.saas.account.dto.CompanyDTO;
+import com.usoftchina.saas.account.dto.CompanyRegDTO;
+import com.usoftchina.saas.base.Result;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author yingp
+ * @date 2018/11/15
+ */
+@FeignClient(name = "account-server")
+public interface CompanyApi {
+
+    /**
+     * 注册
+     *
+     * @param companyRegDTO
+     * @return
+     */
+    @PostMapping("/company/register")
+    Result register(@RequestBody CompanyRegDTO companyRegDTO);
+
+    /**
+     * 从其他平台复制已注册企业信息
+     *
+     * @param companyCopyDTO
+     * @return
+     */
+    @PostMapping("/company/register/copy")
+    Result copyRegistration(@RequestBody CompanyCopyDTO companyCopyDTO);
+
+    /**
+     * 按名称查找
+     *
+     * @param name
+     * @return
+     */
+    @GetMapping(path = "/company/read", params = "name")
+    Result<CompanyDTO> getCompanyByName(@RequestParam String name);
+
+    /**
+     * 按商业登记证号查找
+     *
+     * @param businessCode
+     * @return
+     */
+    @GetMapping(path = "/company/read", params = "businessCode")
+    Result<CompanyDTO> getCompanyByBusinessCode(@RequestParam String businessCode);
+
+    /**
+     * 按企业uu查找
+     *
+     * @param uu
+     * @return
+     */
+    @GetMapping(path = "/company/read", params = "uu")
+    Result<CompanyDTO> getCompanyByUu(@RequestParam Long uu);
+
+    /**
+     * 按ID查找
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(path = "/company/read/{id}")
+    Result<CompanyDTO> getCompanyById(@PathVariable Long id);
+}

+ 22 - 7
base-servers/account/account-api/src/main/java/com/usoftchina/saas/account/cache/AccountCache.java

@@ -18,18 +18,26 @@ import java.util.function.Supplier;
  * @date 2018/11/1
  */
 public class AccountCache extends RedisHashCache<String, String, String> {
-    private final long id;
+    private Long id;
+    private Long uu;
 
     private static final RedisTemplate<String, String> REDIS_TEMPLATE = SpringContextHolder.getBean("redisTemplate", RedisTemplate.class);
     private AccountApi accountApi;
 
-    private AccountCache(long id) {
+    private AccountCache() {
         super(() -> REDIS_TEMPLATE);
-        this.id = id;
     }
 
     public static AccountCache of(long id) {
-        return new AccountCache(id);
+        AccountCache cache = new AccountCache();
+        cache.id = id;
+        return cache;
+    }
+
+    public static AccountCache uu(long uu) {
+        AccountCache cache = new AccountCache();
+        cache.uu = uu;
+        return cache;
     }
 
     /**
@@ -38,12 +46,12 @@ public class AccountCache extends RedisHashCache<String, String, String> {
      * @return
      */
     public static AccountCache current() {
-        return new AccountCache(BaseContextHolder.getUserId());
+        return of(BaseContextHolder.getUserId());
     }
 
     @Override
     protected String field() {
-        return String.valueOf(id);
+        return String.valueOf(null == id ? ("uu:" + uu) : ("id:" + id));
     }
 
     @Override
@@ -57,7 +65,14 @@ public class AccountCache extends RedisHashCache<String, String, String> {
             if (null == accountApi) {
                 accountApi = SpringContextHolder.getBean(AccountApi.class);
             }
-            Result<AccountDTO> result = accountApi.getAccountById(id);
+            Result<AccountDTO> result = null;
+            if (null != id && id > 0) {
+                result = accountApi.getAccountById(id);
+            } else if (null != uu) {
+                result = accountApi.getAccountByUu(uu);
+            } else {
+                return null;
+            }
             if (result.isSuccess()) {
                 return JsonUtils.toJsonString(result.getData());
             }

+ 104 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/AccountCopyDTO.java

@@ -0,0 +1,104 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+
+/**
+ * 用于从其他平台复制已注册用户信息过来的接口
+ *
+ * @author yingp
+ * @date 2018/11/15
+ */
+public class AccountCopyDTO implements Serializable{
+    private String username;
+    /**
+     * 密文密码
+     */
+    private String password;
+    private String salt;
+    private String realname;
+    private String email;
+    private String mobile;
+    /**
+     * 账号类型 0 - 管理员
+     */
+    private Integer type;
+    private Long uu;
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getSalt() {
+        return salt;
+    }
+
+    public void setSalt(String salt) {
+        this.salt = salt;
+    }
+
+    public String getRealname() {
+        return realname;
+    }
+
+    public void setRealname(String realname) {
+        this.realname = realname;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Long getUu() {
+        return uu;
+    }
+
+    public void setUu(Long uu) {
+        this.uu = uu;
+    }
+
+    @Override
+    public String toString() {
+        return "AccountCopyDTO{" +
+                "username='" + username + '\'' +
+                ", password='" + password + '\'' +
+                ", salt='" + salt + '\'' +
+                ", realname='" + realname + '\'' +
+                ", email='" + email + '\'' +
+                ", mobile='" + mobile + '\'' +
+                ", type=" + type +
+                ", uu=" + uu +
+                '}';
+    }
+}

+ 13 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/AccountDTO.java

@@ -29,6 +29,10 @@ public class AccountDTO implements Serializable {
      * 账号类型 0 - 管理员
      */
     private Integer type;
+    /**
+     * uu
+     */
+    private Long uu;
     /**
      * 所有绑定的公司
      */
@@ -104,6 +108,14 @@ public class AccountDTO implements Serializable {
         this.type = type;
     }
 
+    public Long getUu() {
+        return uu;
+    }
+
+    public void setUu(Long uu) {
+        this.uu = uu;
+    }
+
     public List<CompanyBaseDTO> getCompanies() {
         return companies;
     }
@@ -165,6 +177,7 @@ public class AccountDTO implements Serializable {
                 ", mobile='" + mobile + '\'' +
                 ", avatarUrl='" + avatarUrl + '\'' +
                 ", type=" + type +
+                ", uu=" + uu +
                 ", companies=" + companies +
                 ", rolesMap=" + rolesMap +
                 ", resourcesTable=" + resourcesTable +

+ 13 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/AccountRegDTO.java

@@ -19,6 +19,10 @@ public class AccountRegDTO implements Serializable {
      * 账号类型 0 - 管理员
      */
     private Integer type;
+    /**
+     * 头像
+     */
+    private String avatarUrl;
     private Long companyId;
 
     public String getUsername() {
@@ -69,6 +73,14 @@ public class AccountRegDTO implements Serializable {
         this.type = type;
     }
 
+    public String getAvatarUrl() {
+        return avatarUrl;
+    }
+
+    public void setAvatarUrl(String avatarUrl) {
+        this.avatarUrl = avatarUrl;
+    }
+
     public Long getCompanyId() {
         return companyId;
     }
@@ -86,6 +98,7 @@ public class AccountRegDTO implements Serializable {
                 ", email='" + email + '\'' +
                 ", mobile='" + mobile + '\'' +
                 ", type=" + type +
+                ", avatarUrl='" + avatarUrl + '\'' +
                 ", companyId=" + companyId +
                 '}';
     }

+ 105 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/AccountUpdateDTO.java

@@ -0,0 +1,105 @@
+package com.usoftchina.saas.account.dto;
+
+import io.swagger.annotations.ApiModel;
+
+import java.io.Serializable;
+
+/**
+ * @author yingp
+ * @date 2018/10/2
+ */
+@ApiModel(value = "AccountSave", description = "账户信息修改")
+public class AccountUpdateDTO implements Serializable {
+    private Long id;
+    private String username;
+    private String realname;
+    private String email;
+    private String mobile;
+    /**
+     * 账号类型 0 - 管理员
+     */
+    private Integer type;
+    /**
+     * 头像
+     */
+    private String avatarUrl;
+    private Long uu;
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getRealname() {
+        return realname;
+    }
+
+    public void setRealname(String realname) {
+        this.realname = realname;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getAvatarUrl() {
+        return avatarUrl;
+    }
+
+    public void setAvatarUrl(String avatarUrl) {
+        this.avatarUrl = avatarUrl;
+    }
+
+    public Long getUu() {
+        return uu;
+    }
+
+    public void setUu(Long uu) {
+        this.uu = uu;
+    }
+
+    @Override
+    public String toString() {
+        return "AccountUpdateDTO{" +
+                "id=" + id +
+                ", username='" + username + '\'' +
+                ", realname='" + realname + '\'' +
+                ", email='" + email + '\'' +
+                ", mobile='" + mobile + '\'' +
+                ", type=" + type +
+                ", avatarUrl='" + avatarUrl + '\'' +
+                ", uu=" + uu +
+                '}';
+    }
+}

+ 77 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyCopyDTO.java

@@ -0,0 +1,77 @@
+package com.usoftchina.saas.account.dto;
+
+import io.swagger.annotations.ApiModel;
+
+import java.io.Serializable;
+
+/**
+ * 用于从其他平台复制已注册企业信息过来的接口
+ *
+ * @author yingp
+ * @date 2018/11/15
+ */
+@ApiModel(value = "CompanyCopy", description = "公司注册信息")
+public class CompanyCopyDTO implements Serializable{
+    /**
+     * 唯一名称
+     */
+    private String name;
+    /**
+     * 商业登记证号
+     */
+    private String businessCode;
+    private String address;
+    private String logoUrl;
+    private Long uu;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getBusinessCode() {
+        return businessCode;
+    }
+
+    public void setBusinessCode(String businessCode) {
+        this.businessCode = businessCode;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getLogoUrl() {
+        return logoUrl;
+    }
+
+    public void setLogoUrl(String logoUrl) {
+        this.logoUrl = logoUrl;
+    }
+
+    public Long getUu() {
+        return uu;
+    }
+
+    public void setUu(Long uu) {
+        this.uu = uu;
+    }
+
+    @Override
+    public String toString() {
+        return "CompanyCopyDTO{" +
+                "name='" + name + '\'' +
+                ", businessCode='" + businessCode + '\'' +
+                ", address='" + address + '\'' +
+                ", logoUrl='" + logoUrl + '\'' +
+                ", uu=" + uu +
+                '}';
+    }
+}

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

@@ -21,6 +21,7 @@ public class CompanyDTO implements Serializable{
     private String businessCode;
     private String address;
     private String logoUrl;
+    private Long uu;
 
     public Long getId() {
         return id;
@@ -62,6 +63,14 @@ public class CompanyDTO implements Serializable{
         this.logoUrl = logoUrl;
     }
 
+    public Long getUu() {
+        return uu;
+    }
+
+    public void setUu(Long uu) {
+        this.uu = uu;
+    }
+
     @Override
     public String toString() {
         return "CompanyDTO{" +
@@ -70,6 +79,7 @@ public class CompanyDTO implements Serializable{
                 ", businessCode='" + businessCode + '\'' +
                 ", address='" + address + '\'' +
                 ", logoUrl='" + logoUrl + '\'' +
+                ", uu=" + uu +
                 '}';
     }
 }

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

@@ -1,9 +1,6 @@
 package com.usoftchina.saas.account.controller;
 
-import com.usoftchina.saas.account.dto.AccountDTO;
-import com.usoftchina.saas.account.dto.AccountRegDTO;
-import com.usoftchina.saas.account.dto.CompanyBaseDTO;
-import com.usoftchina.saas.account.dto.RoleBaseDTO;
+import com.usoftchina.saas.account.dto.*;
 import com.usoftchina.saas.account.po.Account;
 import com.usoftchina.saas.account.po.RoleResource;
 import com.usoftchina.saas.account.service.AccountService;
@@ -73,6 +70,50 @@ public class AccountController {
         return Result.success();
     }
 
+    /**
+     * 从其他平台复制已注册用户信息
+     * 区别于普通注册:密码已经是加密后的密文
+     *
+     * @param accountCopyDTO
+     * @return
+     */
+    @PostMapping("/register/copy")
+    @IgnoreAuth
+    public Result copyRegistration(@RequestBody AccountCopyDTO accountCopyDTO) {
+        // 判断是否已注册
+        Account account = accountService.findByUsername(accountCopyDTO.getUsername());
+        if (null != account) {
+            return Result.error(ExceptionCode.USER_NAME_EXIST);
+        }
+        account = accountService.findByMobile(accountCopyDTO.getMobile());
+        if (null != account) {
+            return Result.error(ExceptionCode.USER_MOBILE_EXIST);
+        }
+        account = accountService.findByEmail(accountCopyDTO.getEmail());
+        if (null != account) {
+            return Result.error(ExceptionCode.USER_EMAIL_EXIST);
+        }
+
+        account = BeanMapper.map(accountCopyDTO, Account.class);
+        account.setEnabled(true);
+        accountService.save(account);
+
+        return Result.success();
+    }
+
+    /**
+     * 修改
+     *
+     * @param accountUpdateDTO
+     * @return
+     */
+    @PostMapping("/update")
+    public Result update(@RequestBody AccountUpdateDTO accountUpdateDTO) {
+        Account account = BeanMapper.map(accountUpdateDTO, Account.class);
+        accountService.updateByPrimaryKeySelective(account);
+        return Result.success();
+    }
+
     /**
      * 校验用户和密码
      *
@@ -114,7 +155,7 @@ public class AccountController {
         }
 
         account.setPassword(accountService.getEncryptedPassword(password, account.getSalt()));
-        accountService.updateByPrimaryKey(account);
+        accountService.updateByPrimaryKeySelective(account);
         return Result.success();
     }
 
@@ -168,7 +209,7 @@ public class AccountController {
      * @param username
      * @return
      */
-    @GetMapping("/read")
+    @GetMapping(value = "/read", params = "username")
     public Result<AccountDTO> getAccount(@RequestParam(value = "username") String username) {
         Account account = getAccountByUsername(username);
         if (null == account) {
@@ -178,6 +219,22 @@ public class AccountController {
         return Result.success(getAccountDTO(account));
     }
 
+    /**
+     * 按用户名查找账户
+     *
+     * @param uu
+     * @return
+     */
+    @GetMapping(value = "/read", params = "uu")
+    public Result<AccountDTO> getAccountByUu(@RequestParam(value = "uu") Long uu) {
+        Account account = accountService.findByUu(uu);
+        if (null == account) {
+            return Result.error(ExceptionCode.USER_NOT_EXIST);
+        }
+
+        return Result.success(getAccountDTO(account));
+    }
+
     /**
      * 按当前登录用户查找账户
      *
@@ -199,7 +256,7 @@ public class AccountController {
      * @param id
      * @return
      */
-    @GetMapping("/{id}")
+    @GetMapping("/read/{id}")
     public Result<AccountDTO> getAccountById(@PathVariable Long id) {
         Account account = accountService.findByPrimaryKey(id);
         if (null == account) {

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

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.account.controller;
 
+import com.usoftchina.saas.account.dto.CompanyCopyDTO;
 import com.usoftchina.saas.account.dto.CompanyDTO;
 import com.usoftchina.saas.account.dto.CompanyRegDTO;
 import com.usoftchina.saas.account.po.Company;
@@ -46,6 +47,30 @@ public class CompanyController {
         return Result.success();
     }
 
+    /**
+     * 从其他平台复制已注册企业信息
+     *
+     * @param companyCopyDTO
+     * @return
+     */
+    @PostMapping("/company/register/copy")
+    public Result copyRegistration(@RequestBody CompanyCopyDTO companyCopyDTO) {
+        // 判断是否已注册
+        Company company = companyService.findByName(companyCopyDTO.getName());
+        if (null != company) {
+            return Result.error(ExceptionCode.COMPANY_NAME_EXIST);
+        }
+        company = companyService.findByBusinessCode(companyCopyDTO.getBusinessCode());
+        if (null != company) {
+            return Result.error(ExceptionCode.COMPANY_CODE_EXIST);
+        }
+
+        company = BeanMapper.map(companyCopyDTO, Company.class);
+        companyService.save(company);
+
+        return Result.success();
+    }
+
     /**
      * 按名称查找
      *
@@ -78,6 +103,38 @@ public class CompanyController {
         return Result.error(ExceptionCode.COMPANY_NOT_EXIST);
     }
 
+    /**
+     * 按uu查找
+     *
+     * @param uu
+     * @return
+     */
+    @GetMapping(path = "/read", params = "uu")
+    public Result<CompanyDTO> getByUu(@RequestParam Long uu) {
+        Company company = companyService.findByUu(uu);
+        if (null != company) {
+            CompanyDTO companyDTO = BeanMapper.map(company, CompanyDTO.class);
+            return Result.success(companyDTO);
+        }
+        return Result.error(ExceptionCode.COMPANY_NOT_EXIST);
+    }
+
+    /**
+     * 按ID查找
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(path = "/read/{id}")
+    public Result<CompanyDTO> getCompanyById(@PathVariable Long id) {
+        Company company = companyService.findByPrimaryKey(id);
+        if (null != company) {
+            CompanyDTO companyDTO = BeanMapper.map(company, CompanyDTO.class);
+            return Result.success(companyDTO);
+        }
+        return Result.error(ExceptionCode.COMPANY_NOT_EXIST);
+    }
+
     /**
      * 当前登录的公司的信息
      *

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

@@ -74,6 +74,14 @@ public interface AccountMapper {
      */
     Account selectByEmail(@Param("email") String email);
 
+    /**
+     * 按uu查找
+     *
+     * @param uu
+     * @return
+     */
+    Account selectByUu(@Param("uu") Long uu);
+
     /**
      * 按角色查找
      *

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

@@ -43,6 +43,14 @@ public interface CompanyMapper {
      */
     Company selectByName(@Param("name") String name);
 
+    /**
+     * 按uu查询
+     *
+     * @param uu
+     * @return
+     */
+    Company selectByUu(@Param("uu") Long uu);
+
     /**
      * 按商业登记证号查询
      *

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

@@ -26,10 +26,11 @@ public class Account implements Serializable {
      */
     private Integer type;
     private boolean enabled;
-    protected Date createTime;
-    protected long creatorId;
-    protected Date updateTime;
-    protected long updaterId;
+    private Date createTime;
+    private long creatorId;
+    private Date updateTime;
+    private long updaterId;
+    private Long uu;
 
     public String getUsername() {
         return username;
@@ -142,4 +143,12 @@ public class Account implements Serializable {
     public void setUpdaterId(long updaterId) {
         this.updaterId = updaterId;
     }
+
+    public Long getUu() {
+        return uu;
+    }
+
+    public void setUu(Long uu) {
+        this.uu = uu;
+    }
 }

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

@@ -24,10 +24,11 @@ public class Company implements Serializable {
      * 企业logo
      */
     private String logoUrl;
-    protected Date createTime;
-    protected long creatorId;
-    protected Date updateTime;
-    protected long updaterId;
+    private Date createTime;
+    private long creatorId;
+    private Date updateTime;
+    private long updaterId;
+    private Long uu;
 
     public String getName() {
         return name;
@@ -100,4 +101,12 @@ public class Company implements Serializable {
     public void setUpdaterId(long updaterId) {
         this.updaterId = updaterId;
     }
+
+    public Long getUu() {
+        return uu;
+    }
+
+    public void setUu(Long uu) {
+        this.uu = uu;
+    }
 }

+ 10 - 2
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/AccountService.java

@@ -20,12 +20,12 @@ public interface AccountService {
     boolean save(Account account);
 
     /**
-     * 更新
+     * 更新(非空字段)
      *
      * @param account
      * @return
      */
-    boolean updateByPrimaryKey(Account account);
+    boolean updateByPrimaryKeySelective(Account account);
 
     /**
      * 按用户名查找
@@ -51,6 +51,14 @@ public interface AccountService {
      */
     Account findByEmail(String email);
 
+    /**
+     * 按uu查找
+     *
+     * @param uu
+     * @return
+     */
+    Account findByUu(Long uu);
+
     /**
      * 按主键查找
      *

+ 8 - 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);
 
+    /**
+     * 按uu查找
+     *
+     * @param uu
+     * @return
+     */
+    Company findByUu(Long uu);
+
     /**
      * 按ID查找
      *

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

@@ -53,7 +53,7 @@ public class AccountServiceImpl implements AccountService {
     }
 
     @Override
-    public boolean updateByPrimaryKey(Account account) {
+    public boolean updateByPrimaryKeySelective(Account account) {
         account.setUpdateTime(new Date());
         account.setUpdaterId(BaseContextHolder.getUserId());
         return accountMapper.updateByPrimaryKeySelective(account) > 0;
@@ -64,6 +64,11 @@ public class AccountServiceImpl implements AccountService {
         return accountMapper.selectByUsername(username);
     }
 
+    @Override
+    public Account findByUu(Long uu) {
+        return accountMapper.selectByUu(uu);
+    }
+
     @Override
     public Account findByMobile(String mobile) {
         return accountMapper.selectByMobile(mobile);
@@ -169,5 +174,9 @@ public class AccountServiceImpl implements AccountService {
     @Override
     public void clearCache(Long accountId) {
         AccountCache.of(accountId).hdel();
+        Account account = accountMapper.selectByPrimaryKey(accountId);
+        if (null != account && null != account.getUu()) {
+            AccountCache.uu(account.getUu()).hdel();
+        }
     }
 }

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

@@ -51,6 +51,11 @@ public class CompanyServiceImpl implements CompanyService{
         return companyMapper.selectByBusinessCode(businessCode);
     }
 
+    @Override
+    public Company findByUu(Long uu) {
+        return companyMapper.selectByUu(uu);
+    }
+
     @Override
     public Company findByPrimaryKey(Long id) {
         return companyMapper.selectByPrimaryKey(id);

+ 17 - 3
base-servers/account/account-server/src/main/resources/mapper/AccountMapper.xml

@@ -10,6 +10,7 @@
         <result column="email" jdbcType="VARCHAR" property="email"/>
         <result column="mobile" jdbcType="VARCHAR" property="mobile"/>
         <result column="type" jdbcType="INTEGER" property="type"/>
+        <result column="uu" jdbcType="BIGINT" property="uu"/>
         <result column="enabled" jdbcType="BOOLEAN" property="enabled"/>
         <result column="creator_id" jdbcType="BIGINT" property="creatorId"/>
         <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
@@ -18,14 +19,14 @@
     </resultMap>
     <sql id="baseColumns">
         ac_account.id,ac_account.username,ac_account.password,ac_account.salt,ac_account.realname,ac_account.email,
-        ac_account.mobile,ac_account.type,ac_account.enabled,ac_account.creator_id,ac_account.create_time,
+        ac_account.mobile,ac_account.type,ac_account.uu,ac_account.enabled,ac_account.creator_id,ac_account.create_time,
         ac_account.updater_id,ac_account.update_time
     </sql>
     <insert id="insert" parameterType="com.usoftchina.saas.account.po.Account"
             useGeneratedKeys="true" keyProperty="id">
-        insert into ac_account(username,password,salt,realname,email,mobile,type,enabled,creator_id,create_time,updater_id,update_time)
+        insert into ac_account(username,password,salt,realname,email,mobile,type,uu,enabled,creator_id,create_time,updater_id,update_time)
         values (#{username,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR},
-        #{realname,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{enabled,jdbcType=BOOLEAN},
+        #{realname,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{uu,jdbcType=BIGINT}, #{enabled,jdbcType=BOOLEAN},
         #{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP})
     </insert>
     <insert id="insertSelective" parameterType="com.usoftchina.saas.account.po.Account"
@@ -53,6 +54,9 @@
             <if test="type != null">
                 type,
             </if>
+            <if test="uu != null">
+                uu,
+            </if>
             <if test="enabled != null">
                 enabled,
             </if>
@@ -91,6 +95,9 @@
             <if test="type != null">
                 #{type,jdbcType=INTEGER},
             </if>
+            <if test="uu != null">
+                #{uu,jdbcType=BIGINT},
+            </if>
             <if test="enabled != null">
                 #{enabled,jdbcType=BOOLEAN},
             </if>
@@ -117,6 +124,7 @@
         email=#{email,jdbcType=VARCHAR},
         mobile=#{mobile,jdbcType=VARCHAR},
         type=#{type,jdbcType=INTEGER},
+        uu=#{uu,jdbcType=BIGINT},
         enabled=#{enabled,jdbcType=BOOLEAN},
         creator_id=#{creatorId,jdbcType=BIGINT},
         create_time=#{createTime,jdbcType=TIMESTAMP},
@@ -148,6 +156,9 @@
             <if test="type != null">
                 type=#{type,jdbcType=INTEGER},
             </if>
+            <if test="uu != null">
+                uu=#{uu,jdbcType=BIGINT},
+            </if>
             <if test="enabled != null">
                 enabled=#{enabled,jdbcType=BOOLEAN},
             </if>
@@ -178,6 +189,9 @@
     <select id="selectByEmail" parameterType="java.lang.String" resultMap="BaseResultMap">
         select <include refid="baseColumns"/> from ac_account where email=#{email}
     </select>
+    <select id="selectByUu" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from ac_account where uu=#{uu}
+    </select>
     <select id="selectByRoleId" parameterType="java.lang.Long" resultMap="BaseResultMap">
         select <include refid="baseColumns"/> from ac_account,ac_account_role where
         ac_account.id=ac_account_role.account_id and ac_account_role.role_id=#{roleId,jdbcType=BIGINT}

+ 14 - 3
base-servers/account/account-server/src/main/resources/mapper/CompanyMapper.xml

@@ -6,6 +6,8 @@
         <result column="name" jdbcType="VARCHAR" property="name"/>
         <result column="business_code" jdbcType="VARCHAR" property="businessCode"/>
         <result column="address" jdbcType="VARCHAR" property="address"/>
+        <result column="logo_url" jdbcType="VARCHAR" property="logoUrl"/>
+        <result column="uu" jdbcType="BIGINT" property="uu"/>
         <result column="creator_id" jdbcType="BIGINT" property="creatorId"/>
         <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
         <result column="updater_id" jdbcType="BIGINT" property="updaterId"/>
@@ -17,13 +19,13 @@
         <result column="logo_url" jdbcType="VARCHAR" property="logoUrl"/>
     </resultMap>
     <sql id="baseColumns">
-        id,name,business_code,address,creator_id,create_time,updater_id,update_time
+        id,name,business_code,address,uu,creator_id,create_time,updater_id,update_time
     </sql>
     <insert id="insert" parameterType="com.usoftchina.saas.account.po.Company"
             useGeneratedKeys="true" keyProperty="id">
-        insert into ac_company(name, business_code, address, logo_url, creator_id, create_time, updater_id, update_time)
+        insert into ac_company(name, business_code, address, logo_url, uu, creator_id, create_time, updater_id, update_time)
         values (#{name,jdbcType=VARCHAR}, #{businessCode,jdbcType=VARCHAR},
-        #{address,jdbcType=VARCHAR}, #{logoUrl,jdbcType=VARCHAR}, #{creatorId,jdbcType=BIGINT},
+        #{address,jdbcType=VARCHAR}, #{logoUrl,jdbcType=VARCHAR}, #{uu,jdbcType=BIGINT}, #{creatorId,jdbcType=BIGINT},
         #{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP})
     </insert>
     <insert id="insertSelective" parameterType="com.usoftchina.saas.account.po.Company"
@@ -42,6 +44,9 @@
             <if test="logoUrl != null">
                 logo_url,
             </if>
+            <if test="uu != null">
+                uu,
+            </if>
             <if test="creatorId != null">
                 creator_id,
             </if>
@@ -68,6 +73,9 @@
             <if test="logoUrl != null">
                 #{logoUrl,jdbcType=VARCHAR},
             </if>
+            <if test="uu != null">
+                #{uu,jdbcType=BIGINT},
+            </if>
             <if test="creatorId != null">
                 #{creatorId,jdbcType=BIGINT},
             </if>
@@ -88,6 +96,9 @@
     <select id="selectByName" parameterType="java.lang.String" resultMap="FullResultMap">
         select <include refid="baseColumns"/> from ac_company where name=#{name,jdbcType=VARCHAR}
     </select>
+    <select id="selectByUu" parameterType="java.lang.Long" resultMap="FullResultMap">
+        select <include refid="baseColumns"/> from ac_company where uu=#{uu,jdbcType=BIGINT}
+    </select>
     <select id="selectByBusinessCode" parameterType="java.lang.String" resultMap="FullResultMap">
         select <include refid="baseColumns"/> from ac_company where business_code=#{businessCode,jdbcType=VARCHAR}
     </select>

+ 6 - 0
base-servers/auth/auth-common/pom.xml

@@ -38,6 +38,12 @@
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-bus-amqp</artifactId>
         </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <scope>compile</scope>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
 
 </project>

+ 74 - 0
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/cookie/CookieHelper.java

@@ -0,0 +1,74 @@
+package com.usoftchina.saas.auth.common.cookie;
+
+import com.usoftchina.saas.auth.common.crypto.Rc4Utils;
+import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.exception.ExceptionCode;
+import com.usoftchina.saas.utils.JsonUtils;
+import com.usoftchina.saas.utils.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author yingp
+ * @date 2018/11/15
+ */
+public class CookieHelper {
+
+    private static final Logger logger = LoggerFactory.getLogger(CookieHelper.class);
+
+    private static final String CUT_SYMBOL = "#";
+
+    /**
+     * 解析token
+     *
+     * @param token      token
+     * @param secretKey  私钥
+     * @return
+     * @throws BizException
+     */
+    public static CookieToken parseToken(String token, String secretKey) throws BizException {
+        try {
+            String jsonToken = Rc4Utils.decrypt(token, secretKey);
+            return JsonUtils.fromJsonString(jsonToken.split(CUT_SYMBOL)[0], CookieToken.class);
+        } catch (Exception e) {
+            logger.error(e.getMessage());
+            throw new BizException(ExceptionCode.COOKIE_ILLEGAL_ARGUMENT);
+        }
+    }
+
+    /**
+     * 获取token中的用户信息
+     *
+     * @param token
+     * @param secretKey
+     * @return
+     * @throws BizException
+     */
+    public static CookieInfo geInfoFromToken(String token, String secretKey) throws BizException {
+        CookieToken cookieToken = parseToken(token, secretKey);
+        if (!StringUtils.isEmpty(cookieToken.getData())) {
+            return JsonUtils.fromJsonString(cookieToken.getData(), CookieInfo.class);
+        }
+        return null;
+    }
+
+    /**
+     * 获取token中的用户信息
+     *
+     * @param request
+     * @param cookieName
+     * @param secretKey
+     * @return
+     * @throws BizException
+     */
+    public static CookieInfo geInfoFromRequest(HttpServletRequest request, String cookieName, String secretKey) throws BizException {
+        Cookie cookie = CookieUtils.getCookie(request, cookieName);
+        if (null != cookie) {
+            return geInfoFromToken(cookie.getValue(), secretKey);
+        }
+        return null;
+    }
+}

+ 277 - 0
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/cookie/CookieInfo.java

@@ -0,0 +1,277 @@
+package com.usoftchina.saas.auth.common.cookie;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author yingp
+ * @date 2018/11/15
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class CookieInfo implements Serializable {
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * uu号
+     */
+    private Long userUU;
+
+    /**
+     * 会员名
+     */
+    private String vipName;
+
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 手机号所属区域(continent or Hongkong)
+     */
+    private String mobileArea;
+
+    /**
+     * 手机号认证状态
+     */
+    private Short mobileValidCode;
+
+    /**
+     * 用户密码
+     */
+    private String password;
+
+    /**
+     * 用户erp密码
+     */
+    private String erpPassword;
+
+    /**
+     * 盐值
+     */
+    private String salt;
+
+    /**
+     * 用户邮箱
+     */
+    private String email;
+
+    /**
+     * 用户邮箱认证状态
+     */
+    private Short emailValidCode;
+
+    /**
+     * 身份认证状态
+     */
+    private Short identityValidCode;
+
+    /**
+     * 账户是否冻结(1、冻结)
+     */
+    private Short lock;
+
+    /**
+     * 企业uu号
+     */
+    private Long spaceUU;
+
+    /**
+     * 企业名称
+     */
+    private String spaceName;
+
+    /**
+     * 营业执照号
+     */
+    private String businessCode;
+
+    /**
+     * 企业域名
+     */
+    private String spaceDomain;
+
+    /**
+     * 应用唯一标志
+     */
+    private String appId;
+
+    /**
+     * 上次登录时间
+     */
+    private Date lastLoginTime;
+
+    public Long getUserUU() {
+        return userUU;
+    }
+
+    public void setUserUU(Long userUU) {
+        this.userUU = userUU;
+    }
+
+    public String getVipName() {
+        return vipName;
+    }
+
+    public void setVipName(String vipName) {
+        this.vipName = vipName;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getMobileArea() {
+        return mobileArea;
+    }
+
+    public void setMobileArea(String mobileArea) {
+        this.mobileArea = mobileArea;
+    }
+
+    public Short getMobileValidCode() {
+        return mobileValidCode;
+    }
+
+    public void setMobileValidCode(Short mobileValidCode) {
+        this.mobileValidCode = mobileValidCode;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getErpPassword() {
+        return erpPassword;
+    }
+
+    public void setErpPassword(String erpPassword) {
+        this.erpPassword = erpPassword;
+    }
+
+    public String getSalt() {
+        return salt;
+    }
+
+    public void setSalt(String salt) {
+        this.salt = salt;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public Short getEmailValidCode() {
+        return emailValidCode;
+    }
+
+    public void setEmailValidCode(Short emailValidCode) {
+        this.emailValidCode = emailValidCode;
+    }
+
+    public Short getIdentityValidCode() {
+        return identityValidCode;
+    }
+
+    public void setIdentityValidCode(Short identityValidCode) {
+        this.identityValidCode = identityValidCode;
+    }
+
+    public Short getLock() {
+        return lock;
+    }
+
+    public void setLock(Short lock) {
+        this.lock = lock;
+    }
+
+    public Long getSpaceUU() {
+        return spaceUU;
+    }
+
+    public void setSpaceUU(Long spaceUU) {
+        this.spaceUU = spaceUU;
+    }
+
+    public String getSpaceName() {
+        return spaceName;
+    }
+
+    public void setSpaceName(String spaceName) {
+        this.spaceName = spaceName;
+    }
+
+    public String getBusinessCode() {
+        return businessCode;
+    }
+
+    public void setBusinessCode(String businessCode) {
+        this.businessCode = businessCode;
+    }
+
+    public String getSpaceDomain() {
+        return spaceDomain;
+    }
+
+    public void setSpaceDomain(String spaceDomain) {
+        this.spaceDomain = spaceDomain;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public Date getLastLoginTime() {
+        return lastLoginTime;
+    }
+
+    public void setLastLoginTime(Date lastLoginTime) {
+        this.lastLoginTime = lastLoginTime;
+    }
+
+    @Override
+    public String toString() {
+        return "CookieInfo{" +
+                "userUU=" + userUU +
+                ", vipName='" + vipName + '\'' +
+                ", mobile='" + mobile + '\'' +
+                ", mobileArea='" + mobileArea + '\'' +
+                ", mobileValidCode=" + mobileValidCode +
+                ", password='" + password + '\'' +
+                ", erpPassword='" + erpPassword + '\'' +
+                ", salt='" + salt + '\'' +
+                ", email='" + email + '\'' +
+                ", emailValidCode=" + emailValidCode +
+                ", identityValidCode=" + identityValidCode +
+                ", lock=" + lock +
+                ", spaceUU=" + spaceUU +
+                ", spaceName='" + spaceName + '\'' +
+                ", businessCode='" + businessCode + '\'' +
+                ", spaceDomain='" + spaceDomain + '\'' +
+                ", appId='" + appId + '\'' +
+                ", lastLoginTime=" + lastLoginTime +
+                '}';
+    }
+}

+ 115 - 0
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/cookie/CookieToken.java

@@ -0,0 +1,115 @@
+package com.usoftchina.saas.auth.common.cookie;
+
+import java.io.Serializable;
+
+/**
+ * @author yingp
+ * @date 2018/11/15
+ */
+public class CookieToken implements Serializable {
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+
+    /* 正常 */
+    public final static int FLAG_NORMAL = 0;
+
+    /* 缓存宕机 */
+    public final static int FLAG_CACHE_SHUT = 1;
+
+    /* 系统名称 */
+    private String app;
+
+    /* 登录类型 */
+    private Integer type;
+
+    /* 预留 */
+    private String data;
+
+    /* 用户 ID(长整型) */
+    private Long id;
+
+    /* 用户 ID(字符串类型,默认 fastjson 无值该参数不参与 json 序列化) */
+    private String uid;
+
+    /* 登录 IP */
+    private String ip;
+
+    /* 创建 token 当前系统时间 */
+    private long time = System.currentTimeMillis();
+
+    /**
+     * Token 状态标示
+     * <p>
+     * 默认正常执行
+     * </p>
+     */
+    private int flag = FLAG_NORMAL;
+
+    public String getApp() {
+        return app;
+    }
+
+    public void setApp(String app) {
+        this.app = app;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public String getIp() {
+        return ip;
+    }
+
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+
+    public int getFlag() {
+        return flag;
+    }
+
+    public void setFlag(int flag) {
+        this.flag = flag;
+    }
+
+    public long getTime() {
+        return time;
+    }
+
+    public void setTime(long time) {
+        this.time = time;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+}
+

+ 126 - 0
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/cookie/CookieUtils.java

@@ -0,0 +1,126 @@
+package com.usoftchina.saas.auth.common.cookie;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Optional;
+
+/**
+ * @author yingp
+ * @date 2018/1/25
+ */
+public class CookieUtils {
+
+    /**
+     * get cookie by name
+     *
+     * @param request
+     * @param cookieName
+     * @return
+     */
+    public static Cookie getCookie(HttpServletRequest request, String cookieName) {
+        return Optional.ofNullable(request.getCookies())
+                .map(Arrays::asList)
+                .orElse(Collections.emptyList()).stream()
+                .filter(cookie -> cookie.getName().equals(cookieName))
+                .findFirst().orElse(null);
+    }
+
+    /**
+     * set cookie
+     *
+     * @param request
+     * @param response
+     * @param cookieName
+     * @param cookieValue
+     */
+    public static void setCookie(HttpServletRequest request, HttpServletResponse response,
+                                 String cookieName, String cookieValue) {
+        Cookie cookie = getCookie(request, cookieName);
+        if (null == cookie) {
+            cookie = new Cookie(cookieName, cookieValue);
+            cookie.setPath("/");
+            cookie.setMaxAge(-1);
+        } else if (!cookie.getValue().equals(cookieValue)) {
+            cookie.setValue(cookieValue);
+        } else {
+            return;
+        }
+        addHttpOnlyCookie(response, cookie);
+    }
+
+    /**
+     *
+     * <p>
+     * 解决 servlet 3.0 以下版本不支持 HttpOnly
+     * </p>
+     *
+     * @param response
+     *            HttpServletResponse类型的响应
+     * @param cookie
+     *            要设置httpOnly的cookie对象
+     */
+    public static void addHttpOnlyCookie(HttpServletResponse response, Cookie cookie) {
+        if (cookie == null) {
+            return;
+        }
+        /**
+         * 依次取得cookie中的名称、值、 最大生存时间、路径、域和是否为安全协议信息
+         */
+        String cookieName = cookie.getName();
+        String cookieValue = cookie.getValue();
+        int maxAge = cookie.getMaxAge();
+        String path = cookie.getPath();
+        String domain = cookie.getDomain();
+        boolean isSecure = cookie.getSecure();
+        StringBuffer sf = new StringBuffer();
+        sf.append(cookieName + "=" + cookieValue + ";");
+
+        if (maxAge >= 0) {
+            sf.append("Max-Age=" + cookie.getMaxAge() + ";");
+        }
+
+        if (domain != null) {
+            sf.append("domain=" + domain + ";");
+        }
+
+        if (path != null) {
+            sf.append("path=" + path + ";");
+        }
+
+        if (isSecure) {
+            sf.append("secure;HTTPOnly;");
+        } else {
+            sf.append("HTTPOnly;");
+        }
+
+        response.addHeader("Set-Cookie", sf.toString());
+    }
+
+    /**
+     * 清除指定Cookie
+     *
+     * @param response
+     * @param cookieName
+     *            cookie name
+     * @return boolean
+     */
+    public static void clearCookie(HttpServletRequest request, HttpServletResponse response,
+                                   String cookieName) {
+        Cookie cookie = getCookie(request, cookieName);
+        if (null != cookie) {
+            Cookie newCookie = new Cookie(cookieName, "");
+            newCookie.setMaxAge(0);
+            if (null != cookie.getDomain()) {
+                newCookie.setDomain(cookie.getDomain());
+            }
+            newCookie.setPath(cookie.getPath());
+            newCookie.setSecure(cookie.getSecure());
+            newCookie.setHttpOnly(cookie.isHttpOnly());
+            addHttpOnlyCookie(response, newCookie);
+        }
+    }
+
+}

+ 28 - 0
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/crypto/Hex.java

@@ -0,0 +1,28 @@
+package com.usoftchina.saas.auth.common.crypto;
+
+/**
+ * @author yingp
+ * @date 2018/1/31
+ */
+public final class Hex {
+
+    private static final char[] HEX = {
+            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+    };
+
+    public static char[] encode(byte[] bytes) {
+        final int nBytes = bytes.length;
+        char[] result = new char[2*nBytes];
+
+        int j = 0;
+        for (int i=0; i < nBytes; i++) {
+            // Char for top 4 bits
+            result[j++] = HEX[(0xF0 & bytes[i]) >>> 4 ];
+            // Bottom 4
+            result[j++] = HEX[(0x0F & bytes[i])];
+        }
+
+        return result;
+    }
+
+}

+ 76 - 0
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/crypto/Rc4Utils.java

@@ -0,0 +1,76 @@
+package com.usoftchina.saas.auth.common.crypto;
+
+import com.usoftchina.saas.auth.common.crypto.base64.UrlBase64;
+import com.usoftchina.saas.auth.common.exception.AuthException;
+import org.springframework.util.DigestUtils;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * @author yingp
+ * @date 2018/1/25
+ */
+public class Rc4Utils {
+
+    final static String ALGORITHM = "RC4";
+
+    final static String defaultCharset = "UTF-8";
+
+    public static String encrypt(String value, String key) throws Exception {
+        byte[] b = UrlBase64.encode(encrypt(value.getBytes(), key));
+        return new String(b, defaultCharset);
+    }
+
+    public static String decrypt(String value, String key) throws Exception {
+        byte[] b = decrypt(UrlBase64.decode(value), key);
+        return new String(b, defaultCharset);
+    }
+
+    /**
+     * generate KEY
+     */
+    private static SecretKey toKey(String strKey) throws Exception {
+		/*
+		 * MD5 处理密钥
+		 */
+        byte[] key = DigestUtils.md5Digest(strKey.getBytes(defaultCharset));
+        return new SecretKeySpec(key, ALGORITHM);
+    }
+
+    /**
+     * 解密
+     *
+     * @param data
+     * @param key
+     * @return
+     */
+    public static byte[] decrypt(byte[] data, String key) {
+        try {
+            Cipher cipher = Cipher.getInstance(ALGORITHM);
+            cipher.init(Cipher.DECRYPT_MODE, toKey(key));
+            return cipher.doFinal(data);
+        } catch (Exception e) {
+            throw new AuthException(e);
+        }
+    }
+
+    /**
+     * 加密
+     *
+     * @param data
+     * @param key
+     * @return
+     */
+    public static byte[] encrypt(byte[] data, String key) {
+        try {
+            Cipher cipher = Cipher.getInstance(ALGORITHM);
+            cipher.init(Cipher.ENCRYPT_MODE, toKey(key));
+            return cipher.doFinal(data);
+        } catch (Exception e) {
+            throw new AuthException(e);
+        }
+    }
+
+}

+ 104 - 0
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/crypto/base64/UrlBase64.java

@@ -0,0 +1,104 @@
+package com.usoftchina.saas.auth.common.crypto.base64;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Convert binary data to and from UrlBase64 encoding. This is identical to
+ * Base64 encoding, except that the padding character is "." and the other
+ * non-alphanumeric characters are "-" and "_" instead of "+" and "/".
+ * <p>
+ * The purpose of UrlBase64 encoding is to provide a compact encoding of binary
+ * data that is safe for use as an URL parameter. Base64 encoding does not
+ * produce encoded values that are safe for use in URLs, since "/" can be
+ * interpreted as a path delimiter; "+" is the encoded form of a space; and "="
+ * is used to separate a name from the corresponding value in an URL parameter.
+ */
+public class UrlBase64 {
+
+	private static final UrlBase64Encoder encoder = new UrlBase64Encoder();
+
+	/**
+	 * Encode the input data producing a URL safe base 64 encoded byte array.
+	 *
+	 * @return a byte array containing the URL safe base 64 encoded data.
+	 */
+	public static byte[] encode(byte[] data) {
+		ByteArrayOutputStream bOut = new ByteArrayOutputStream();
+
+		try {
+			encoder.encode(data, 0, data.length, bOut);
+		} catch (Exception e) {
+			throw new IllegalStateException("exception encoding URL safe base64 data: " + e.getMessage(), e);
+		}
+
+		return bOut.toByteArray();
+	}
+
+	/**
+	 * Encode the byte data writing it to the given output stream.
+	 *
+	 * @return the number of bytes produced.
+	 */
+	public static int encode(byte[] data, OutputStream out) throws IOException {
+		return encoder.encode(data, 0, data.length, out);
+	}
+
+	/**
+	 * Decode the URL safe base 64 encoded input data - white space will be
+	 * ignored.
+	 *
+	 * @return a byte array representing the decoded data.
+	 */
+	public static byte[] decode(byte[] data) {
+		ByteArrayOutputStream bOut = new ByteArrayOutputStream();
+
+		try {
+			encoder.decode(data, 0, data.length, bOut);
+		} catch (Exception e) {
+			throw new IllegalStateException("exception decoding URL safe base64 string: " + e.getMessage(), e);
+		}
+
+		return bOut.toByteArray();
+	}
+
+	/**
+	 * decode the URL safe base 64 encoded byte data writing it to the given
+	 * output stream, whitespace characters will be ignored.
+	 *
+	 * @return the number of bytes produced.
+	 */
+	public static int decode(byte[] data, OutputStream out) throws IOException {
+		return encoder.decode(data, 0, data.length, out);
+	}
+
+	/**
+	 * decode the URL safe base 64 encoded String data - whitespace will be
+	 * ignored.
+	 *
+	 * @return a byte array representing the decoded data.
+	 */
+	public static byte[] decode(String data) {
+		ByteArrayOutputStream bOut = new ByteArrayOutputStream();
+
+		try {
+			encoder.decode(data, bOut);
+		} catch (Exception e) {
+			throw new IllegalStateException("exception decoding URL safe base64 string: " + e.getMessage(), e);
+		}
+
+		return bOut.toByteArray();
+	}
+
+	/**
+	 * Decode the URL safe base 64 encoded String data writing it to the given
+	 * output stream, whitespace characters will be ignored.
+	 *
+	 * @return the number of bytes produced.
+	 */
+	public static int decode(String data, OutputStream out) throws IOException {
+		return encoder.decode(data, out);
+	}
+
+}

+ 276 - 0
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/crypto/base64/UrlBase64Encoder.java

@@ -0,0 +1,276 @@
+package com.usoftchina.saas.auth.common.crypto.base64;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @author yingp
+ * @date 2018/1/26
+ */
+public class UrlBase64Encoder {
+    protected final byte[] encodingTable = { (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G',
+            (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P', (byte) 'Q',
+            (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a',
+            (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k',
+            (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o', (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't', (byte) 'u',
+            (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y', (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4',
+            (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) '-', (byte) '_' };
+
+    protected byte padding = (byte) '.';
+
+    /*
+     * set up the decoding table.
+     */
+    protected final byte[] decodingTable = new byte[128];
+
+    protected void initialiseDecodingTable() {
+        for (int i = 0; i < decodingTable.length; i++) {
+            decodingTable[i] = (byte) 0xff;
+        }
+
+        for (int i = 0; i < encodingTable.length; i++) {
+            decodingTable[encodingTable[i]] = (byte) i;
+        }
+    }
+
+    public UrlBase64Encoder() {
+        initialiseDecodingTable();
+    }
+
+    /**
+     * encode the input data producing a base 64 output stream.
+     *
+     * @return the number of bytes produced.
+     */
+    public int encode(byte[] data, int off, int length, OutputStream out) throws IOException {
+        int modulus = length % 3;
+        int dataLength = (length - modulus);
+        int a1, a2, a3;
+
+        for (int i = off; i < off + dataLength; i += 3) {
+            a1 = data[i] & 0xff;
+            a2 = data[i + 1] & 0xff;
+            a3 = data[i + 2] & 0xff;
+
+            out.write(encodingTable[(a1 >>> 2) & 0x3f]);
+            out.write(encodingTable[((a1 << 4) | (a2 >>> 4)) & 0x3f]);
+            out.write(encodingTable[((a2 << 2) | (a3 >>> 6)) & 0x3f]);
+            out.write(encodingTable[a3 & 0x3f]);
+        }
+
+		/*
+		 * process the tail end.
+		 */
+        int b1, b2, b3;
+        int d1, d2;
+
+        switch (modulus) {
+            case 0: /* nothing left to do */
+                break;
+            case 1:
+                d1 = data[off + dataLength] & 0xff;
+                b1 = (d1 >>> 2) & 0x3f;
+                b2 = (d1 << 4) & 0x3f;
+
+                out.write(encodingTable[b1]);
+                out.write(encodingTable[b2]);
+                out.write(padding);
+                out.write(padding);
+                break;
+            case 2:
+                d1 = data[off + dataLength] & 0xff;
+                d2 = data[off + dataLength + 1] & 0xff;
+
+                b1 = (d1 >>> 2) & 0x3f;
+                b2 = ((d1 << 4) | (d2 >>> 4)) & 0x3f;
+                b3 = (d2 << 2) & 0x3f;
+
+                out.write(encodingTable[b1]);
+                out.write(encodingTable[b2]);
+                out.write(encodingTable[b3]);
+                out.write(padding);
+                break;
+        }
+
+        return (dataLength / 3) * 4 + ((modulus == 0) ? 0 : 4);
+    }
+
+    private boolean ignore(char c) {
+        return (c == '\n' || c == '\r' || c == '\t' || c == ' ');
+    }
+
+    /**
+     * decode the base 64 encoded byte data writing it to the given output
+     * stream, whitespace characters will be ignored.
+     *
+     * @return the number of bytes produced.
+     */
+    public int decode(byte[] data, int off, int length, OutputStream out) throws IOException {
+        byte b1, b2, b3, b4;
+        int outLen = 0;
+
+        int end = off + length;
+
+        while (end > off) {
+            if (!ignore((char) data[end - 1])) {
+                break;
+            }
+
+            end--;
+        }
+
+        int i = off;
+        int finish = end - 4;
+
+        i = nextI(data, i, finish);
+
+        while (i < finish) {
+            b1 = decodingTable[data[i++]];
+
+            i = nextI(data, i, finish);
+
+            b2 = decodingTable[data[i++]];
+
+            i = nextI(data, i, finish);
+
+            b3 = decodingTable[data[i++]];
+
+            i = nextI(data, i, finish);
+
+            b4 = decodingTable[data[i++]];
+
+            if ((b1 | b2 | b3 | b4) < 0) {
+                throw new IOException("invalid characters encountered in base64 data");
+            }
+
+            out.write((b1 << 2) | (b2 >> 4));
+            out.write((b2 << 4) | (b3 >> 2));
+            out.write((b3 << 6) | b4);
+
+            outLen += 3;
+
+            i = nextI(data, i, finish);
+        }
+
+        outLen += decodeLastBlock(out, (char) data[end - 4], (char) data[end - 3], (char) data[end - 2], (char) data[end - 1]);
+
+        return outLen;
+    }
+
+    private int nextI(byte[] data, int i, int finish) {
+        while ((i < finish) && ignore((char) data[i])) {
+            i++;
+        }
+        return i;
+    }
+
+    /**
+     * decode the base 64 encoded String data writing it to the given output
+     * stream, whitespace characters will be ignored.
+     *
+     * @return the number of bytes produced.
+     */
+    public int decode(String data, OutputStream out) throws IOException {
+        byte b1, b2, b3, b4;
+        int length = 0;
+
+        int end = data.length();
+
+        while (end > 0) {
+            if (!ignore(data.charAt(end - 1))) {
+                break;
+            }
+
+            end--;
+        }
+
+        int i = 0;
+        int finish = end - 4;
+
+        i = nextI(data, i, finish);
+
+        while (i < finish) {
+            b1 = decodingTable[data.charAt(i++)];
+
+            i = nextI(data, i, finish);
+
+            b2 = decodingTable[data.charAt(i++)];
+
+            i = nextI(data, i, finish);
+
+            b3 = decodingTable[data.charAt(i++)];
+
+            i = nextI(data, i, finish);
+
+            b4 = decodingTable[data.charAt(i++)];
+
+            if ((b1 | b2 | b3 | b4) < 0) {
+                throw new IOException("invalid characters encountered in base64 data");
+            }
+
+            out.write((b1 << 2) | (b2 >> 4));
+            out.write((b2 << 4) | (b3 >> 2));
+            out.write((b3 << 6) | b4);
+
+            length += 3;
+
+            i = nextI(data, i, finish);
+        }
+
+        length += decodeLastBlock(out, data.charAt(end - 4), data.charAt(end - 3), data.charAt(end - 2), data.charAt(end - 1));
+
+        return length;
+    }
+
+    private int decodeLastBlock(OutputStream out, char c1, char c2, char c3, char c4) throws IOException {
+        byte b1, b2, b3, b4;
+
+        if (c3 == padding) {
+            b1 = decodingTable[c1];
+            b2 = decodingTable[c2];
+
+            if ((b1 | b2) < 0) {
+                throw new IOException("invalid characters encountered at end of base64 data");
+            }
+
+            out.write((b1 << 2) | (b2 >> 4));
+
+            return 1;
+        } else if (c4 == padding) {
+            b1 = decodingTable[c1];
+            b2 = decodingTable[c2];
+            b3 = decodingTable[c3];
+
+            if ((b1 | b2 | b3) < 0) {
+                throw new IOException("invalid characters encountered at end of base64 data");
+            }
+
+            out.write((b1 << 2) | (b2 >> 4));
+            out.write((b2 << 4) | (b3 >> 2));
+
+            return 2;
+        } else {
+            b1 = decodingTable[c1];
+            b2 = decodingTable[c2];
+            b3 = decodingTable[c3];
+            b4 = decodingTable[c4];
+
+            if ((b1 | b2 | b3 | b4) < 0) {
+                throw new IOException("invalid characters encountered at end of base64 data");
+            }
+
+            out.write((b1 << 2) | (b2 >> 4));
+            out.write((b2 << 4) | (b3 >> 2));
+            out.write((b3 << 6) | b4);
+
+            return 3;
+        }
+    }
+
+    private int nextI(String data, int i, int finish) {
+        while ((i < finish) && ignore(data.charAt(i))) {
+            i++;
+        }
+        return i;
+    }
+}

+ 19 - 0
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/exception/AuthException.java

@@ -0,0 +1,19 @@
+package com.usoftchina.saas.auth.common.exception;
+
+import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.exception.ExceptionCode;
+
+/**
+ * @author yingp
+ * @date 2018/11/15
+ */
+public class AuthException extends BizException{
+
+    public AuthException() {
+        super(ExceptionCode.AUTH_FAIL);
+    }
+
+    public AuthException(Exception e) {
+        super(ExceptionCode.AUTH_FAIL.getCode(), e.getMessage());
+    }
+}

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

@@ -30,7 +30,7 @@ public class JwtHelper {
      * @return
      * @throws Exception
      */
-    public static TokenVO generateToken(JwtInfo jwtInfo, String priKeyPath, int expire) throws BizException {
+    public static JwtToken generateToken(JwtInfo jwtInfo, String priKeyPath, int expire) throws BizException {
         try {
             String compactJws =
                     // 返回的字符串便是我们的jwt串了
@@ -47,7 +47,7 @@ public class JwtHelper {
                             .signWith(SignatureAlgorithm.RS256, RsaUtils.getPrivateKey(priKeyPath))
                             // 这个是全部设置完成后拼成jwt串的方法
                             .compact();
-            return new TokenVO(compactJws, expire);
+            return new JwtToken(compactJws, expire);
         } catch (IOException | NoSuchAlgorithmException | InvalidKeySpecException e) {
             log.error(e.getMessage());
             throw new BizException(ExceptionCode.JWT_GEN_TOKEN_FAIL.getCode(), ExceptionCode.JWT_GEN_TOKEN_FAIL.getMessage());

+ 3 - 3
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/jwt/TokenVO.java → base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/jwt/JwtToken.java

@@ -6,7 +6,7 @@ import java.io.Serializable;
  * @author yingp
  * @date 2018/10/2
  */
-public class TokenVO implements Serializable {
+public class JwtToken implements Serializable {
     /**
      * token
      */
@@ -18,7 +18,7 @@ public class TokenVO implements Serializable {
 
     private Long timestamp;
 
-    public TokenVO(String token, Integer expire) {
+    public JwtToken(String token, Integer expire) {
         this.token = token;
         this.expire = expire;
         this.timestamp = System.currentTimeMillis();
@@ -50,7 +50,7 @@ public class TokenVO implements Serializable {
 
     @Override
     public String toString() {
-        return "TokenVO{" +
+        return "JwtToken{" +
                 "token='" + token + '\'' +
                 ", expire=" + expire +
                 ", timestamp=" + timestamp +

+ 5 - 0
base-servers/auth/auth-server/pom.xml

@@ -70,6 +70,11 @@
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>test-starter</artifactId>
         </dependency>
+        <!-- socket -->
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>socket-api</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 4 - 1
base-servers/auth/auth-server/src/main/java/com/usoftchina/saas/auth/AuthApplication.java

@@ -12,7 +12,10 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
  */
 @SpringBootApplication
 @EnableEurekaClient
-@EnableFeignClients(basePackages = "com.usoftchina.saas.account.api")
+@EnableFeignClients(basePackages = {
+        "com.usoftchina.saas.account.api",
+        "com.usoftchina.saas.socket.api"
+})
 @MapperScan(basePackages = "com.usoftchina.saas.auth.mapper")
 public class AuthApplication {
     public static void main(String[] args) {

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

@@ -2,10 +2,14 @@ package com.usoftchina.saas.auth.controller;
 
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.account.api.AccountApi;
+import com.usoftchina.saas.account.constant.AccountType;
+import com.usoftchina.saas.account.dto.AccountCopyDTO;
 import com.usoftchina.saas.account.dto.AccountDTO;
+import com.usoftchina.saas.account.dto.AccountUpdateDTO;
+import com.usoftchina.saas.auth.common.cookie.CookieInfo;
 import com.usoftchina.saas.auth.common.jwt.JwtHelper;
 import com.usoftchina.saas.auth.common.jwt.JwtInfo;
-import com.usoftchina.saas.auth.common.jwt.TokenVO;
+import com.usoftchina.saas.auth.common.jwt.JwtToken;
 import com.usoftchina.saas.auth.dto.AuthDTO;
 import com.usoftchina.saas.auth.dto.AuthorizeLogDTO;
 import com.usoftchina.saas.auth.dto.TokenDTO;
@@ -13,11 +17,15 @@ import com.usoftchina.saas.auth.po.AuthorizeLog;
 import com.usoftchina.saas.auth.service.AuthorizeCountService;
 import com.usoftchina.saas.auth.service.AuthorizeLogService;
 import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.exception.ExceptionCode;
 import com.usoftchina.saas.page.PageDefault;
 import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.socket.api.SocketMessageApi;
 import com.usoftchina.saas.utils.BeanMapper;
 import com.usoftchina.saas.utils.CollectionUtils;
+import com.usoftchina.saas.utils.JsonUtils;
+import com.usoftchina.saas.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
@@ -56,6 +64,9 @@ public class AuthController {
     @Autowired
     private AuthorizeCountService authorizeCountService;
 
+    @Autowired
+    private SocketMessageApi socketMessageApi;
+
     /**
      * 登录认证获取token
      *
@@ -83,8 +94,8 @@ public class AuthController {
             String appId = "trade-app";
 
             JwtInfo info = new JwtInfo(appId, companyId, accountDTO.getId(), accountDTO.getUsername(), accountDTO.getRealname());
-            TokenVO tokenVO = JwtHelper.generateToken(info, privateKeyPath, expire);
-            TokenDTO tokenDTO = BeanMapper.map(tokenVO, TokenDTO.class);
+            JwtToken jwtToken = JwtHelper.generateToken(info, privateKeyPath, expire);
+            TokenDTO tokenDTO = BeanMapper.map(jwtToken, TokenDTO.class);
             // 登录日志
             authorizeLogService.save(AuthorizeLog.from(request)
                     .setAccountId(accountDTO.getId())
@@ -99,6 +110,84 @@ public class AuthController {
         return Result.error(result.getCode(), result.getMessage());
     }
 
+    /**
+     * 账户中心登录回调
+     *
+     * @param clientId 客户端唯一标志,发起请求到账户中心时带上
+     * @param info
+     * @return
+     */
+    @PostMapping("/sso/callback")
+    public Result ssoCallback(HttpServletRequest request, @RequestParam String clientId, CookieInfo info) {
+        if (null != info && null != info.getMobile()) {
+            AccountDTO accountDTO = null;
+            Result<AccountDTO> result = accountApi.getAccount(info.getMobile());
+            if (!result.isSuccess()) {
+                if (ExceptionCode.USER_NOT_EXIST.getCode() == result.getCode()) {
+                    // 新用户,自动注册
+                    accountDTO = createAccountByCookieInfo(info);
+                } else {
+                    return Result.error(result.getCode(), result.getMessage());
+                }
+            } else {
+                accountDTO = result.getData();
+                // 检测uu是否正确
+                if (null == accountDTO.getUu() || !info.getUserUU().equals(accountDTO.getUu())) {
+                    accountDTO.setUu(info.getUserUU());
+                    Result updateResult = accountApi.update(BeanMapper.map(accountDTO, AccountUpdateDTO.class));
+                    if (!updateResult.isSuccess()) {
+                        return Result.error(updateResult.getCode(), updateResult.getMessage());
+                    }
+                }
+            }
+            // TODO
+            String appId = "trade-app";
+            // 登录日志
+            authorizeLogService.save(AuthorizeLog.from(request)
+                    .setAccountId(accountDTO.getId())
+                    .setAppId(appId).build());
+            // 将登录信息推送到客户端
+            if (!StringUtils.isEmpty(clientId)) {
+                Long companyId = null;
+                if (!CollectionUtils.isEmpty(accountDTO.getCompanies())) {
+                    companyId = accountDTO.getCompanies().get(0).getId();
+                }
+                JwtInfo jwtInfo = new JwtInfo(appId, companyId, accountDTO.getId(), accountDTO.getUsername(), accountDTO.getRealname());
+                JwtToken jwtToken = JwtHelper.generateToken(jwtInfo, privateKeyPath, expire);
+                TokenDTO tokenDTO = BeanMapper.map(jwtToken, TokenDTO.class);
+                socketMessageApi.sendToClient(clientId, JsonUtils.toJsonString(new AuthDTO(tokenDTO, accountDTO)));
+            }
+            return Result.success();
+        }
+        return Result.error(ExceptionCode.COOKIE_ILLEGAL_ARGUMENT);
+    }
+
+    /**
+     * 如果在本平台不存在,就自动创建
+     *
+     * @param info
+     */
+    private AccountDTO createAccountByCookieInfo(CookieInfo info) {
+        AccountCopyDTO copyDTO = new AccountCopyDTO();
+        copyDTO.setUsername(info.getMobile());
+        copyDTO.setPassword(info.getPassword());
+        copyDTO.setSalt(info.getSalt());
+        copyDTO.setEmail(info.getEmail());
+        copyDTO.setMobile(info.getMobile());
+        copyDTO.setRealname(info.getVipName());
+        copyDTO.setType(AccountType.ADMIN.getType());
+        copyDTO.setUu(info.getUserUU());
+        Result result = accountApi.copyRegistration(copyDTO);
+        if (!result.isSuccess()) {
+            throw new BizException(result.getCode(), result.getMessage());
+        }
+        Result<AccountDTO> accountDTOResult = accountApi.getAccountByUu(info.getUserUU());
+        if (!accountDTOResult.isSuccess()) {
+            throw new BizException(accountDTOResult.getCode(), accountDTOResult.getMessage());
+        }
+        return accountDTOResult.getData();
+    }
+
     /**
      * 切换公司
      *
@@ -113,8 +202,8 @@ public class AuthController {
         if (isCompanyAvailable(infoFromToken, companyId)) {
             JwtInfo info = new JwtInfo(infoFromToken.getAppId(), companyId, infoFromToken.getUserId(),
                     infoFromToken.getUserName(), infoFromToken.getRealName());
-            TokenVO tokenVO = JwtHelper.generateToken(info, privateKeyPath, expire);
-            return Result.success(BeanMapper.map(tokenVO, TokenDTO.class));
+            JwtToken jwtToken = JwtHelper.generateToken(info, privateKeyPath, expire);
+            return Result.success(BeanMapper.map(jwtToken, TokenDTO.class));
         }
         return Result.error(ExceptionCode.COMPANY_NOT_BIND);
     }
@@ -131,8 +220,8 @@ public class AuthController {
         JwtInfo infoFromToken = JwtHelper.getInfoFromToken(token, publicKeyPath);
         Result<AccountDTO> result = accountApi.getAccount(infoFromToken.getUserName());
         if (result.isSuccess()) {
-            TokenVO tokenVO = JwtHelper.generateToken(infoFromToken, privateKeyPath, expire);
-            TokenDTO tokenDTO = BeanMapper.map(tokenVO, TokenDTO.class);
+            JwtToken jwtToken = JwtHelper.generateToken(infoFromToken, privateKeyPath, expire);
+            TokenDTO tokenDTO = BeanMapper.map(jwtToken, TokenDTO.class);
             return Result.success(new AuthDTO(tokenDTO, result.getData()));
         }
         return Result.error(result);

+ 1 - 0
base-servers/gateway-server/src/main/resources/application.yml

@@ -175,5 +175,6 @@ auth:
   public-key: auth/pub.key
   ignores:
     - /api/auth/authorize
+    - /api/auth/sso/callback
     - /api/account/account/register
     - /api/auth/info

+ 1 - 0
base-servers/pom.xml

@@ -22,6 +22,7 @@
         <module>sms</module>
         <module>account</module>
         <module>ui-server</module>
+        <module>socket</module>
     </modules>
 
 </project>

+ 20 - 0
base-servers/socket/pom.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>base-servers</artifactId>
+        <groupId>com.usoftchina.saas</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>socket</artifactId>
+    <packaging>pom</packaging>
+    <description>web socket</description>
+    <modules>
+        <module>socket-server</module>
+        <module>socket-api</module>
+    </modules>
+
+</project>

+ 24 - 0
base-servers/socket/socket-api/pom.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>socket</artifactId>
+        <groupId>com.usoftchina.saas</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>socket-api</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+    </dependencies>
+</project>

+ 32 - 0
base-servers/socket/socket-api/src/main/java/com/usoftchina/saas/socket/api/SocketMessageApi.java

@@ -0,0 +1,32 @@
+package com.usoftchina.saas.socket.api;
+
+import com.usoftchina.saas.base.Result;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+
+/**
+ * @author yingp
+ * @date 2018/11/15
+ */
+@FeignClient(name = "socket-server")
+public interface SocketMessageApi {
+    /**
+     * 发送信息给指定用户
+     *
+     * @param clientId
+     * @param message
+     * @return
+     */
+    @PostMapping("/clients/{clientId}")
+    Result sendToClient(@PathVariable String clientId, String message);
+
+    /**
+     * 广播信息
+     *
+     * @param message
+     * @return
+     */
+    @PostMapping("/clients")
+    Result sendToAllClients(String message);
+}

+ 51 - 0
base-servers/socket/socket-server/pom.xml

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>socket</artifactId>
+        <groupId>com.usoftchina.saas</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>socket-server</artifactId>
+    <description>web socket server</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>server-starter</artifactId>
+        </dependency>
+        <!-- sleuth -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-zipkin</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.amqp</groupId>
+            <artifactId>spring-rabbit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.logstash.logback</groupId>
+            <artifactId>logstash-logback-encoder</artifactId>
+        </dependency>
+        <!-- socket -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 6 - 0
base-servers/socket/socket-server/src/main/docker/Dockerfile

@@ -0,0 +1,6 @@
+FROM frolvlad/alpine-oraclejdk8:slim
+VOLUME /tmp
+ADD socket-server-1.0.0-SNAPSHOT.jar app.jar
+RUN sh -c 'touch /app.jar'
+ENV JAVA_OPTS=""
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]

+ 40 - 0
base-servers/socket/socket-server/src/main/java/com/usoftchina/saas/socket/SocketApplication.java

@@ -0,0 +1,40 @@
+package com.usoftchina.saas.socket;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.messaging.simp.config.MessageBrokerRegistry;
+import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
+import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
+import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
+
+/**
+ * @author yingp
+ * @date 2018/11/15
+ */
+@SpringBootApplication
+@EnableEurekaClient
+@EnableWebSocketMessageBroker
+public class SocketApplication implements WebSocketMessageBrokerConfigurer {
+
+    public static void main(String[] args) {
+        SpringApplication.run(SocketApplication.class, args);
+    }
+
+    @Override
+    public void registerStompEndpoints(StompEndpointRegistry registry) {
+        registry.addEndpoint("/ws")
+                .setAllowedOrigins("*")
+                .withSockJS();
+    }
+
+    @Override
+    public void configureMessageBroker(MessageBrokerRegistry registry) {
+        // 此域上可以向客户端发消息
+        registry.enableSimpleBroker("/topic","/queue","/clients");
+        // 服务端往客户端发送
+        registry.setUserDestinationPrefix("/clients/");
+        // 客户端往服务端发送
+        registry.setApplicationDestinationPrefixes("/server");
+    }
+}

+ 43 - 0
base-servers/socket/socket-server/src/main/java/com/usoftchina/saas/socket/controller/MessageController.java

@@ -0,0 +1,43 @@
+package com.usoftchina.saas.socket.controller;
+
+import com.usoftchina.saas.base.Result;
+import org.springframework.messaging.simp.SimpMessagingTemplate;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * @author yingp
+ * @date 2018/11/15
+ */
+@RestController
+@RequestMapping("/message")
+public class MessageController {
+
+    @Resource
+    private SimpMessagingTemplate simpMessagingTemplate;
+
+    @PostMapping("/clients/{clientId}")
+    public Result sendToClient(@PathVariable String clientId, String message) {
+        /**
+         * 前端使用
+         * <pre>
+         *     stomp.subscribe('/clients/{clientId}/message', function(message){});
+         * </pre>
+         */
+        simpMessagingTemplate.convertAndSendToUser(clientId, "/message", message);
+        return Result.success();
+    }
+
+    @PostMapping("/clients")
+    public Result sendToAllClients(String message) {
+        /**
+         * 前端使用
+         * <pre>
+         *     stomp.subscribe('/clients/message', function(message){});
+         * </pre>
+         */
+        simpMessagingTemplate.convertAndSend("/message", message);
+        return Result.success();
+    }
+}

+ 65 - 0
base-servers/socket/socket-server/src/main/resources/application.yml

@@ -0,0 +1,65 @@
+spring:
+  profiles:
+    active: dev
+  application:
+    name: socket-server
+  security:
+    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
+  redis:
+    host: 192.168.253.12
+    port: 6379
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: GMT+8
+eureka:
+  instance:
+    leaseRenewalIntervalInSeconds: 10
+    health-check-url-path: /actuator/health
+    status-page-url-path: /actuator/info
+    prefer-ip-address: true
+    metadata-map:
+      user.name: ${spring.security.user.name}
+      user.password: ${spring.security.user.password}
+  client:
+    registryFetchIntervalSeconds: 5
+    serviceUrl:
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8510/eureka/
+server:
+  port: 8680
+  tomcat:
+    uri-encoding: UTF-8
+management:
+  endpoints:
+    web:
+      exposure:
+        include: "*"
+  endpoint:
+    health:
+      show-details: always
+    shutdown:
+      enabled: true
+    restart:
+      enabled: true
+info:
+  name: '@project.artifactId@'
+  description: '@project.description@'
+  version: '@project.version@'
+  spring-boot-version: '@spring.boot.version@'
+  spring-cloud-version: '@spring.cloud.version@'

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

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

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

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

+ 113 - 0
base-servers/socket/socket-server/src/main/resources/logback-spring.xml

@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <include resource="org/springframework/boot/logging/logback/base.xml" />
+    <jmxConfigurator/>
+
+    <!--
+    %m
+    输出代码中指定的消息
+    %p
+    输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL
+    %r
+    输出自应用启动到输出该log信息耗费的毫秒数
+    %c
+    输出所属的类目,通常就是所在类的全名
+    %t
+    输出产生该日志事件的线程名
+    %n
+    输出一个回车换行符,Windows平台为“\r\n”,Unix平台为“\n”
+    %d
+    输出日志时间点的日期或时间,默认格式为ISO8601,也可以在其后指定格式,比如:%d{yyy MMM dd HH:mm:ss,SSS},
+    输出类似:2002年10月18日 22:10:28,921
+    %l
+    输出日志事件的发生位置,包括类目名、发生的线程,以及在代码中的行数。举例:Testlog4.main(TestLog4.java:10)
+    -->
+
+    <springProperty scope="context" name="log.path" source="logging.path" defaultValue="/var/log/saas/socket-server"/>
+    <springProperty scope="context" name="spring.application.name" source="spring.application.name" defaultValue="socket-server"/>
+    <springProperty scope="context" name="spring.profiles.active" source="spring.profiles.active" defaultValue="dev"/>
+    <springProperty scope="context" name="common-pattern" source="logging.common-pattern" defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS}:[%5p] [%t:%r] [%C{1}:%M:%L] --> %m%n"/>
+    <springProperty scope="context" name="log.level.console" source="logging.level.console" defaultValue="INFO"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.253.3:5000"/>
+
+    <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
+
+    <appender name="CONSOLE_APPENDER" class="ch.qos.logback.core.ConsoleAppender">
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>${log.level.console}</level>
+        </filter>
+        <encoder>
+            <pattern>${common-pattern}</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="ROOT_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}/root.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${log.path}/%d{yyyy-MM}/root-%d{yyyy-MM-dd}-%i.log.gz</fileNamePattern>
+            <maxFileSize>128MB</maxFileSize>
+            <maxHistory>7</maxHistory>
+            <totalSizeCap>20GB</totalSizeCap>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${common-pattern}</pattern>
+        </encoder>
+    </appender>
+
+    <!-- Appender to log in a JSON format -->
+    <appender name="JSON_APPENDER" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
+        <destination>${log.destination}</destination>
+        <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
+            <providers>
+                <pattern>
+                    <pattern>
+                        {
+                        "severity": "%level",
+                        "service": "${spring.application.name:-}",
+                        "trace": "%X{X-B3-TraceId:-}",
+                        "span": "%X{X-B3-SpanId:-}",
+                        "parent": "%X{X-B3-ParentSpanId:-}",
+                        "exportable": "%X{X-Span-Export:-}",
+                        "pid": "${PID:-}",
+                        "thread": "%thread",
+                        "class": "%logger{40}",
+                        "rest": "%message"
+                        }
+                    </pattern>
+                </pattern>
+            </providers>
+        </encoder>
+    </appender>
+
+    <logger name="org.springframework" level="INFO"/>
+    <logger name="com.usoftchina.saas" level="INFO"/>
+
+    <springProfile name="dev">
+        <root level="INFO">
+            <appender-ref ref="CONSOLE_APPENDER"/>
+        </root>
+    </springProfile>
+
+    <springProfile name="test">
+        <root level="INFO">
+            <appender-ref ref="CONSOLE_APPENDER"/>
+            <appender-ref ref="ROOT_APPENDER"/>
+        </root>
+    </springProfile>
+
+    <springProfile name="docker">
+        <logger name="org.springframework" level="WARN"/>
+        <logger name="com.usoftchina.saas" level="WARN"/>
+        <root level="WARN">
+            <appender-ref ref="CONSOLE_APPENDER"/>
+            <appender-ref ref="JSON_APPENDER"/>
+        </root>
+    </springProfile>
+
+    <springProfile name="docker-dev">
+        <root level="INFO">
+            <appender-ref ref="CONSOLE_APPENDER"/>
+        </root>
+    </springProfile>
+
+</configuration>

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