Browse Source

调试接口

jinsy 7 years ago
parent
commit
36f4add56c
100 changed files with 1809 additions and 392 deletions
  1. 0 1
      .gitignore
  2. 3 3
      README.md
  3. 6 3
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  4. 1 0
      applications/commons/commons-server/src/main/resources/i18n/messages_zh_CN.properties
  5. 1 1
      applications/commons/commons-server/src/main/resources/logback-spring.xml
  6. 9 4
      applications/commons/commons-server/src/main/resources/mapper/HomePageMapper.xml
  7. 1 1
      applications/document/document-server/src/main/resources/logback-spring.xml
  8. 1 1
      applications/document/document-server/src/main/resources/mapper/CustomerMapper.xml
  9. 1 1
      applications/money/money-dto/src/main/java/com/usoftchina/saas/money/dto/VerificationDTO.java
  10. 5 1
      applications/money/money-dto/src/main/java/com/usoftchina/saas/money/dto/VerificationdetDTO.java
  11. 5 1
      applications/money/money-dto/src/main/java/com/usoftchina/saas/money/dto/VerificationdetailDTO.java
  12. 8 6
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/MoneyReportColltroller.java
  13. 1 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/AccountDetailsViewMapper.java
  14. 1 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/AcountbalanceViewMapper.java
  15. 1 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/CustomerCheckViewMapper.java
  16. 1 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/PaydetailViewMapper.java
  17. 1 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/RecdetailViewMapper.java
  18. 1 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/VendorAcountViewMapper.java
  19. 2 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/VerificationMapper.java
  20. 53 35
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/AccountDetailsView.java
  21. 9 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransfer.java
  22. 3 3
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/PaydetailView.java
  23. 9 8
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/RecdetailView.java
  24. 0 14
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Verification.java
  25. 20 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Verificationdet.java
  26. 20 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Verificationdetail.java
  27. 8 6
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/MoneyReportService.java
  28. 48 13
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/MoneyReportServiceImpl.java
  29. 4 4
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/PaybalanceServiceImpl.java
  30. 4 4
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/RecbalanceServiceImpl.java
  31. 631 9
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/VerificationServiceImpl.java
  32. 1 1
      applications/money/money-server/src/main/resources/logback-spring.xml
  33. 21 7
      applications/money/money-server/src/main/resources/mapper/AccountDetailsViewMapper.xml
  34. 13 1
      applications/money/money-server/src/main/resources/mapper/AcountbalanceViewMapper.xml
  35. 13 1
      applications/money/money-server/src/main/resources/mapper/CustomerCheckViewMapper.xml
  36. 2 1
      applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml
  37. 14 2
      applications/money/money-server/src/main/resources/mapper/PaydetailViewMapper.xml
  38. 14 2
      applications/money/money-server/src/main/resources/mapper/RecdetailViewMapper.xml
  39. 13 1
      applications/money/money-server/src/main/resources/mapper/VendorAcountViewMapper.xml
  40. 3 2
      applications/money/money-server/src/main/resources/mapper/VerificationListMapper.xml
  41. 14 13
      applications/money/money-server/src/main/resources/mapper/VerificationMapper.xml
  42. 16 15
      applications/money/money-server/src/main/resources/mapper/VerificationdetMapper.xml
  43. 17 18
      applications/money/money-server/src/main/resources/mapper/VerificationdetailMapper.xml
  44. 14 0
      applications/purchase/purchase-api/pom.xml
  45. 14 0
      applications/purchase/purchase-api/src/main/java/com/usoftchina/saas/purchase/api/PurchaseService.java
  46. 4 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseController.java
  47. 2 0
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseDetail.java
  48. 1 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/PurchaseService.java
  49. 4 9
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  50. 15 7
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  51. 1 1
      applications/purchase/purchase-server/src/main/resources/application.yml
  52. 1 1
      applications/purchase/purchase-server/src/main/resources/logback-spring.xml
  53. 2 2
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdIODetailDTO.java
  54. 2 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/PurchaseDetailDTO.java
  55. 4 0
      applications/sale/sale-server/pom.xml
  56. 2 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java
  57. 44 28
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  58. 1 1
      applications/sale/sale-server/src/main/resources/logback-spring.xml
  59. 9 3
      applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml
  60. 1 1
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/dto/ProdIODetailDTO.java
  61. 1 1
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/Make.java
  62. 3 121
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/MakeMaterial.java
  63. 2 2
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/ProdIODetail.java
  64. 2 2
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/StockTaking.java
  65. 28 2
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/StocktakingController.java
  66. 1 1
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/MakeMapper.java
  67. 7 1
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/StockTakingMapper.java
  68. 5 0
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/StocktakingService.java
  69. 1 1
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/MakeServiceImpl.java
  70. 156 2
      applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/StocktakingServiceImpl.java
  71. 1 1
      applications/storage/storage-server/src/main/resources/logback-spring.xml
  72. 18 1
      applications/storage/storage-server/src/main/resources/mapper/StockTakingMapper.xml
  73. 9 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/AccountRegDTO.java
  74. 25 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/BindCompanyDTO.java
  75. 42 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyAccountDTO.java
  76. 17 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyListDTO.java
  77. 76 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyRspDTO.java
  78. 9 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/PowerDTO.java
  79. 49 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/AccountCenterController.java
  80. 25 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/AccountCompanyMapper.java
  81. 17 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/PowerInfo.java
  82. 33 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/AccountCenterService.java
  83. 126 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/AccountCenterServiceImpl.java
  84. 2 2
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/RoleServiceImpl.java
  85. 1 1
      base-servers/account/account-server/src/main/resources/application.yml
  86. 1 1
      base-servers/account/account-server/src/main/resources/logback-spring.xml
  87. 12 0
      base-servers/account/account-server/src/main/resources/mapper/AccountCompanyMapper.xml
  88. 1 1
      base-servers/account/account-server/src/main/resources/mapper/AccountMapper.xml
  89. 3 0
      base-servers/account/account-server/src/main/resources/mapper/CompanyMapper.xml
  90. 5 4
      base-servers/account/account-server/src/main/resources/mapper/RoleResourceMapper.xml
  91. 1 1
      base-servers/admin-server/src/main/resources/logback-spring.xml
  92. 1 1
      base-servers/auth/auth-server/src/main/resources/logback-spring.xml
  93. 1 1
      base-servers/eureka-server/src/main/resources/logback-spring.xml
  94. 2 2
      base-servers/file/file-server/src/main/resources/application.yml
  95. 1 1
      base-servers/file/file-server/src/main/resources/logback-spring.xml
  96. 1 1
      base-servers/gateway-server/src/main/resources/logback-spring.xml
  97. 1 1
      base-servers/mail/mail-server/src/main/resources/logback-spring.xml
  98. 1 1
      base-servers/socket/socket-server/src/main/resources/logback-spring.xml
  99. 1 1
      base-servers/ui-server/src/main/resources/logback-spring.xml
  100. 1 1
      base-servers/zipkin-server/src/main/resources/application.yml

+ 0 - 1
.gitignore

@@ -29,7 +29,6 @@ applications/**/build/
 base-servers/**/build/
 framework/**/build/
 frontend/saas-web/build/
-frontend/saas-portal-web/build/
 nbbuild/
 dist/
 node_modules/

+ 3 - 3
README.md

@@ -111,9 +111,9 @@
 
 > 日志
 
-* [kibana](http://192.168.253.3:5601)
-* [logstash](tcp://192.168.253.3:5000)
-* [elasticsearch](http://192.168.253.3:9200/_search?pretty)
+* [kibana](http://192.168.0.63:5601)
+* [logstash](tcp://192.168.0.63:5000)
+* [elasticsearch](http://192.168.0.63:9200/_search?pretty)
 
 > 服务
 

+ 6 - 3
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -58,7 +58,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     PURCHASE_UNAUDIT_ERROR(71001,"采购订单已转采购验收单,无法反审核"),
     PURCHASE_DETAIL_OVERNUM(70001, "明细行数量超过来源采购验收单明细行数量"),
     PURCHASE_ORDER_HASAUDIT(70002, "存在已审核单据,单据编号:%s"),
-
+    PURCHASE_ORDER_HASUNAUDIT(70003, "存在未审核单据,单据编号:%s"),
 
     //销售
     SALE_ALL_TURNOUT(72000, "该销售单已全部转出货,无法转出货单"),
@@ -70,16 +70,19 @@ public enum BizExceptionCode implements BaseExceptionCode {
     SALEOUT_POST_ERROR(72005,""),
     SALEOUT_UNAUDIT_ERROR(72006,"销售订单已转出货单,无法反审核"),
     SALE_ORDER_HASAUDIT(72003, "存在已审核单据,单据编号:%s"),
+    SALE_EXISTS_PURCHASE(72004, "存在已转的采购单据,单据编号:%s"),
 
     //资金
     PAYBALANCE_OUTNOWBALANCE(74001,"本次核销金额不能大于未核销金额"),
     PAYBALANCE_UNIQUESOURCECODE(74002, "保存失败!不能选择重复的源单"),
-    PAYBALANCE_NOWAMOUNT_POSITIVE(74005, "单据类型为<u>%s</u>的单据,核销金额必须为正数"),
-    PAYBALANCE_NOWAMOUNT_NEGATIVE(74005, "单据类型为<u>%s</u>的单据,核销金额必须为负数"),
+    MONEY_NOWAMOUNT_POSITIVE(74005, "单据类型为<u>%s</u>的单据,核销金额必须为正数"),
+    MONEY_NOWAMOUNT_NEGATIVE(74005, "单据类型为<u>%s</u>的单据,核销金额必须为负数"),
     RECALANCE_OUTNOWBALANCE(74003,"本次核销金额不能大于未核销金额"),
     BEFORE_UNAUDIT(74006, "单据:<u>%s</u>未审核,无法反审核"),
     BANK_AMOUNT_NOTENOUGH(74004, "资金账号不足"),
     SUBLEDGER_NOT_EXIS(74005,"来源单据不存在"),
+    CHECK_SETACOUNT_EXIS(74006, "不能删除单据日期小于等于结账期间<u>%s</u>的单据"),
+    VERIFICATION_CHECK_BALANCE(74007,"核销金额不能大于未核销金额"),
 
 
 

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

@@ -34,6 +34,7 @@ msg.checkSuccess=\u6838\u5bf9\u6210\u529f
 msg.printSuccess=\u6253\u5370\u6210\u529f
 msg.bannedSuccess=\u7981\u7528\u6210\u529f
 msg.enableSuccess=\u542f\u7528\u6210\u529f
+msg.enable=\u542f\u7528\u64cd\u4f5c
 msg.resBannedSuccess=\u53cd\u7981\u7528\u6210\u529f
 msg.modifySuccess=\u6570\u636e\u66f4\u65b0\u6210\u529f
 msg.modifyDetailSuccess=\u66f4\u65b0\u660e\u7ec6\u6570\u636e\u6210\u529f

+ 1 - 1
applications/commons/commons-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

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

@@ -11,9 +11,14 @@
     </select>
 
     <select id="getPurchaseDataNow" parameterType="long" resultType="string">
-        select concat('[',GROUP_CONCAT(concat('{"x":"',ifnull(si_vendname,''),'","y":',IFNULL(round(si_amount/10000,2),0),'}')),']')  from (
-        select * from statsinfo
-        where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc limit 10) a
+      select concat('[',five,',',other,']') from (
+	      select GROUP_CONCAT(concat('{"x":"',ifnull(si_vendname,''),'","y":',IFNULL(round(si_amount/10000,2),0),'}')) five from (
+        select * from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc limit 5) a ) a1,
+      (
+	  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='PURC')a,
+        (select sum(si_amount) five_sum from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc limit 0,5) b)
+	  ) b1
     </select>
 
     <select id="getPurchaseDataInSixMonth" parameterType="long" resultType="string">
@@ -72,7 +77,7 @@
 
     <select id="getSaleFutureData" parameterType="long" resultType="string">
        	select concat('[',d1,',',d2,',',d3,',',d4,',',d5,',',d6,']') from (
-        (select concat('{"x":',DATE_FORMAT(now(),'%c'),',"sale":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),',"saleback":',ifnull(ROUND(sum((ifnull(si_amount_rec/10000,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='SALE' ORDER BY si_amount desc) data_1,
+        (select concat('{"x":',DATE_FORMAT(now(),'%c'),',"sale":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),',"saleback":',ifnull(ROUND(sum((ifnull(si_amount_rec/10000,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='SALERETURN' ORDER BY si_amount desc) data_1,
 
         (select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%c'),',"sale":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),',"saleback":',ifnull(ROUND(sum((ifnull(si_amount_rec/10000,0))),2),'0'),'}') d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='SALERETURN' ORDER BY si_amount desc)data_2,
 

+ 1 - 1
applications/document/document-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

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

@@ -404,7 +404,7 @@
 
   <select id="validNameAndCodeWhenRelated" parameterType="com.usoftchina.saas.document.entities.Customer" resultType="int">
     select count(1) from customer where (cu_code != #{cu_code,jdbcType=VARCHAR} or cu_name != #{cu_name,jdbcType=VARCHAR})
-    and cu_id != #{id} and companyId =#{companyId}
+    and cu_id = #{id} and companyId =#{companyId}
   </select>
 
 

+ 1 - 1
applications/money/money-dto/src/main/java/com/usoftchina/saas/money/dto/VerificationDTO.java

@@ -15,7 +15,7 @@ import java.util.Date;
  */
 @Data
 @ApiModel(value = "Verification", description = "核销单")
-public class VerificationDTO implements Serializable {
+public class VerificationDTO extends  CommonBaseDTO implements Serializable {
     private Integer vc_id;
 
     private String vc_code;

+ 5 - 1
applications/money/money-dto/src/main/java/com/usoftchina/saas/money/dto/VerificationdetDTO.java

@@ -14,7 +14,7 @@ import java.util.Date;
  */
 @Data
 @ApiModel(value = "Verificationdet", description = "核销单明细一")
-public class VerificationdetDTO  implements Serializable {
+public class VerificationdetDTO  extends  CommonBaseDTO implements Serializable {
     private Integer vd_id;
 
     private Integer vd_vcid;
@@ -46,4 +46,8 @@ public class VerificationdetDTO  implements Serializable {
     private String vd_text4;
 
     private String vd_text5;
+
+    private Double sl_yamount;
+
+    private Double sl_namount;
 }

+ 5 - 1
applications/money/money-dto/src/main/java/com/usoftchina/saas/money/dto/VerificationdetailDTO.java

@@ -14,7 +14,7 @@ import java.util.Date;
  */
 @Data
 @ApiModel(value = "Verificationdetail", description = "核销单明细二")
-public class VerificationdetailDTO implements Serializable {
+public class VerificationdetailDTO extends  CommonBaseDTO implements Serializable {
     private Integer vcd_id;
 
     private Integer vcd_vcid;
@@ -47,4 +47,8 @@ public class VerificationdetailDTO implements Serializable {
 
     private String vcd_text5;
 
+    private Double sl_yamount;
+
+    private Double sl_namount;
+
 }

+ 8 - 6
applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/MoneyReportColltroller.java

@@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Map;
+
 /**
  * @author heqw
  * @date 2018/11/9 14:21
@@ -24,42 +26,42 @@ public class MoneyReportColltroller {
     //供应商对账
     @GetMapping("/vendorCheck")
     public Result vendorCheck(PageRequest page, ListReqDTO req) {
-        PageInfo listData = moneyReportService.vendorCheck(page, req);
+        Map<String, Object> listData = moneyReportService.vendorCheck(page, req);
         return Result.success(listData);
     }
 
     //应付账款明细
     @GetMapping("/payDetail")
     public Result payDetail(PageRequest page, ListReqDTO req) {
-        PageInfo listData = moneyReportService.payDetail(page, req);
+        Map<String, Object> listData = moneyReportService.payDetail(page, req);
         return Result.success(listData);
     }
 
     //应收款明细表
     @GetMapping("/recDetail")
     public Result recDetail(PageRequest page, ListReqDTO req) {
-        PageInfo listData = moneyReportService.recDetail(page, req);
+        Map<String, Object> listData = moneyReportService.recDetail(page, req);
         return Result.success(listData);
     }
 
     //资金账号余额表
     @GetMapping("/accountBalance")
     public Result acountBalance(PageRequest page, ListReqDTO req) {
-        PageInfo listData = moneyReportService.acountBalance(page, req);
+        Map<String, Object> listData = moneyReportService.acountBalance(page, req);
         return Result.success(listData);
     }
 
     //客户对账单
     @GetMapping("/customercheck")
     public Result customercheck(PageRequest page, ListReqDTO req) {
-        PageInfo listData = moneyReportService.customercheck(page, req);
+        Map<String, Object> listData = moneyReportService.customercheck(page, req);
         return Result.success(listData);
     }
 
     //冲账明细表
     @GetMapping("/accountdetails")
     public Result accountdetails(PageRequest page, ListReqDTO req) {
-        PageInfo listData = moneyReportService.accountdetails(page, req);
+        Map<String, Object> listData = moneyReportService.accountdetails(page, req);
         return Result.success(listData);
     }
 }

+ 1 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/AccountDetailsViewMapper.java

@@ -7,4 +7,5 @@ import java.util.List;
 
 public interface AccountDetailsViewMapper {
     List<AccountDetailsView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+    String selectCalculateFields(@Param("fields") String fields, @Param("con") String con, @Param("companyId") Long companyId);
 }

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

@@ -7,4 +7,5 @@ import java.util.List;
 
 public interface AcountbalanceViewMapper {
     List<AcountbalanceView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+    String selectCalculateFields(@Param("fields") String fields, @Param("con") String con, @Param("companyId") Long companyId);
 }

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

@@ -8,4 +8,5 @@ import java.util.List;
 
 public interface CustomerCheckViewMapper {
     List<CustomerCheckView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+    String selectCalculateFields(@Param("fields") String fields, @Param("con") String con, @Param("companyId") Long companyId);
 }

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

@@ -7,4 +7,5 @@ import java.util.List;
 
 public interface PaydetailViewMapper {
     List<PaydetailView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+    String selectCalculateFields(@Param("fields") String fields, @Param("con") String con, @Param("companyId") Long companyId);
 }

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

@@ -7,4 +7,5 @@ import java.util.List;
 
 public interface RecdetailViewMapper {
     List<RecdetailView> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+    String selectCalculateFields(@Param("fields") String fields, @Param("con") String con, @Param("companyId") Long companyId);
 }

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

@@ -7,4 +7,5 @@ import java.util.List;
 
 public interface VendorAcountViewMapper {
     List<VendorAcountView> selectByCondition(@Param("con")String con, @Param("companyId")Long companyId);
+    String selectCalculateFields(@Param("fields") String fields, @Param("con") String con, @Param("companyId") Long companyId);
 }

+ 2 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/VerificationMapper.java

@@ -38,4 +38,6 @@ public interface VerificationMapper extends CommonBaseMapper<Verification> {
     String selectCodeById(Long id);
 
     String validateResAudit(Long id);
+
+    int validateSetAcount(int detno);
 }

+ 53 - 35
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/AccountDetailsView.java

@@ -3,22 +3,40 @@ package com.usoftchina.saas.money.po;
 import java.util.Date;
 
 public class AccountDetailsView {
-    private String SL_CODE;
+    private String sl_code;
 
-    private String SL_KIND;
+    private String sl_kind;
 
-    private String VE_NAME;
+    private String ve_name;
+    private String cu_name;
 
-    private Double SL_AMOUNT;
+    private Double sl_amount;
 
-    private Integer PB_ID;
+    private Integer pb_id;
 
-    private String PB_KIND;
+    private String pb_kind;
 
-    private String PB_CODE;
+    private String pb_code;
 
     private Double total;
     private Date date;
+    private Long companyId;
+
+    public String getCu_name() {
+        return cu_name;
+    }
+
+    public void setCu_name(String cu_name) {
+        this.cu_name = cu_name;
+    }
+
+    public Long getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Long companyId) {
+        this.companyId = companyId;
+    }
 
     public Date getDate() {
         return date;
@@ -28,60 +46,60 @@ public class AccountDetailsView {
         this.date = date;
     }
 
-    public String getSL_CODE() {
-        return SL_CODE;
+    public String getSl_code() {
+        return sl_code;
     }
 
-    public void setSL_CODE(String SL_CODE) {
-        this.SL_CODE = SL_CODE == null ? null : SL_CODE.trim();
+    public void setSl_code(String sl_code) {
+        this.sl_code = sl_code;
     }
 
-    public String getSL_KIND() {
-        return SL_KIND;
+    public String getSl_kind() {
+        return sl_kind;
     }
 
-    public void setSL_KIND(String SL_KIND) {
-        this.SL_KIND = SL_KIND == null ? null : SL_KIND.trim();
+    public void setSl_kind(String sl_kind) {
+        this.sl_kind = sl_kind;
     }
 
-    public String getVE_NAME() {
-        return VE_NAME;
+    public String getVe_name() {
+        return ve_name;
     }
 
-    public void setVE_NAME(String VE_NAME) {
-        this.VE_NAME = VE_NAME == null ? null : VE_NAME.trim();
+    public void setVe_name(String ve_name) {
+        this.ve_name = ve_name;
     }
 
-    public Double getSL_AMOUNT() {
-        return SL_AMOUNT;
+    public Double getSl_amount() {
+        return sl_amount;
     }
 
-    public void setSL_AMOUNT(Double SL_AMOUNT) {
-        this.SL_AMOUNT = SL_AMOUNT;
+    public void setSl_amount(Double sl_amount) {
+        this.sl_amount = sl_amount;
     }
 
-    public Integer getPB_ID() {
-        return PB_ID;
+    public Integer getPb_id() {
+        return pb_id;
     }
 
-    public void setPB_ID(Integer PB_ID) {
-        this.PB_ID = PB_ID;
+    public void setPb_id(Integer pb_id) {
+        this.pb_id = pb_id;
     }
 
-    public String getPB_KIND() {
-        return PB_KIND;
+    public String getPb_kind() {
+        return pb_kind;
     }
 
-    public void setPB_KIND(String PB_KIND) {
-        this.PB_KIND = PB_KIND == null ? null : PB_KIND.trim();
+    public void setPb_kind(String pb_kind) {
+        this.pb_kind = pb_kind;
     }
 
-    public String getPB_CODE() {
-        return PB_CODE;
+    public String getPb_code() {
+        return pb_code;
     }
 
-    public void setPB_CODE(String PB_CODE) {
-        this.PB_CODE = PB_CODE == null ? null : PB_CODE.trim();
+    public void setPb_code(String pb_code) {
+        this.pb_code = pb_code;
     }
 
     public Double getTotal() {

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

@@ -44,12 +44,21 @@ public class Fundtransfer extends CommonBaseEntity implements Serializable {
     private String ftd_paymethod;
 
     private String ftd_paycode;
+    private String ftd_remark;
 
     private String ft_auditman;
 
     private Date ft_auditdate;
 
 
+    public String getFtd_remark() {
+        return ftd_remark;
+    }
+
+    public void setFtd_remark(String ftd_remark) {
+        this.ftd_remark = ftd_remark;
+    }
+
     public String getFt_auditman() {
         return ft_auditman;
     }

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

@@ -25,7 +25,7 @@ public class PaydetailView {
 
     private Double mustpay;
 
-    private Long mustdate;
+    private Date mustdate;
 
     private Double pi_total;
 
@@ -129,11 +129,11 @@ public class PaydetailView {
         this.mustpay = mustpay;
     }
 
-    public Long getMustdate() {
+    public Date getMustdate() {
         return mustdate;
     }
 
-    public void setMustdate(Long mustdate) {
+    public void setMustdate(Date mustdate) {
         this.mustdate = mustdate;
     }
 

+ 9 - 8
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/RecdetailView.java

@@ -25,13 +25,21 @@ public class RecdetailView {
 
     private Double mustpay;
 
-    private Double mustdate;
+    private Date mustdate;
 
     private Double pi_total;
 
     private String pi_remark;
     private Integer companyId;
 
+    public Date getMustdate() {
+        return mustdate;
+    }
+
+    public void setMustdate(Date mustdate) {
+        this.mustdate = mustdate;
+    }
+
     public Integer getCompanyId() {
         return companyId;
     }
@@ -104,13 +112,6 @@ public class RecdetailView {
         this.mustpay = mustpay;
     }
 
-    public Double getMustdate() {
-        return mustdate;
-    }
-
-    public void setMustdate(Double mustdate) {
-        this.mustdate = mustdate;
-    }
 
     public Double getPi_total() {
         return pi_total;

+ 0 - 14
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Verification.java

@@ -303,19 +303,5 @@ public class Verification extends CommonBaseEntity implements Serializable {
         this.vc_text5 = vc_text5 == null ? null : vc_text5.trim();
     }
 
-    @Override
-    public void setCreatorId(long creatorId) {
 
-    }
-
-    @Override
-    public void setUpdaterId(long updaterId) {
-
-    }
-
-
-    @Override
-    public void setCompanyId(long companyId) {
-
-    }
 }

+ 20 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Verificationdet.java

@@ -44,6 +44,10 @@ public class Verificationdet extends CommonBaseEntity implements Serializable {
 
     private String vd_text5;
 
+    private Double sl_yamount;
+
+    private Double sl_namount;
+
     public Integer getVd_id() {
         return vd_id;
     }
@@ -171,4 +175,20 @@ public class Verificationdet extends CommonBaseEntity implements Serializable {
     public void setVd_text5(String vd_text5) {
         this.vd_text5 = vd_text5 == null ? null : vd_text5.trim();
     }
+
+    public Double getSl_yamount() {
+        return sl_yamount;
+    }
+
+    public void setSl_yamount(Double sl_yamount) {
+        this.sl_yamount = sl_yamount;
+    }
+
+    public Double getSl_namount() {
+        return sl_namount;
+    }
+
+    public void setSl_namount(Double sl_namount) {
+        this.sl_namount = sl_namount;
+    }
 }

+ 20 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Verificationdetail.java

@@ -44,6 +44,10 @@ public class Verificationdetail extends CommonBaseEntity implements Serializable
 
     private String vcd_text5;
 
+    private Double sl_yamount;
+
+    private Double sl_namount;
+
     public Integer getVcd_id() {
         return vcd_id;
     }
@@ -171,4 +175,20 @@ public class Verificationdetail extends CommonBaseEntity implements Serializable
     public void setVcd_text5(String vcd_text5) {
         this.vcd_text5 = vcd_text5 == null ? null : vcd_text5.trim();
     }
+
+    public Double getSl_yamount() {
+        return sl_yamount;
+    }
+
+    public void setSl_yamount(Double sl_yamount) {
+        this.sl_yamount = sl_yamount;
+    }
+
+    public Double getSl_namount() {
+        return sl_namount;
+    }
+
+    public void setSl_namount(Double sl_namount) {
+        this.sl_namount = sl_namount;
+    }
 }

+ 8 - 6
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/MoneyReportService.java

@@ -4,15 +4,17 @@ import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.page.PageRequest;
 
+import java.util.Map;
+
 /**
  * @author heqw
  * @date 2018/11/9 14:50
  **/
 public interface MoneyReportService {
-    PageInfo vendorCheck(PageRequest page, ListReqDTO req);
-    PageInfo payDetail(PageRequest page, ListReqDTO req);
-    PageInfo recDetail(PageRequest page, ListReqDTO req);
-    PageInfo acountBalance(PageRequest page, ListReqDTO req);
-    PageInfo customercheck(PageRequest page, ListReqDTO req);
-    PageInfo accountdetails(PageRequest page, ListReqDTO req);
+    Map<String, Object> vendorCheck(PageRequest page, ListReqDTO req);
+    Map<String, Object> payDetail(PageRequest page, ListReqDTO req);
+    Map<String, Object> recDetail(PageRequest page, ListReqDTO req);
+    Map<String, Object> acountBalance(PageRequest page, ListReqDTO req);
+    Map<String, Object> customercheck(PageRequest page, ListReqDTO req);
+    Map<String, Object> accountdetails(PageRequest page, ListReqDTO req);
 }

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

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.money.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
@@ -9,8 +10,11 @@ import com.usoftchina.saas.money.service.MoneyReportService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author heqw
@@ -32,36 +36,36 @@ public class MoneyReportServiceImpl implements MoneyReportService {
     private AccountDetailsViewMapper accountDetailsViewMapper;
 
     @Override
-    public PageInfo vendorCheck(PageRequest page, ListReqDTO req) {
+    public Map<String, Object> vendorCheck(PageRequest page, ListReqDTO req) {
         return getListDATA(page, req, "Supplier");
     }
 
     @Override
-    public PageInfo payDetail(PageRequest page, ListReqDTO req) {
+    public Map<String, Object> payDetail(PageRequest page, ListReqDTO req) {
         return getListDATA(page, req, "payDetail");
     }
 
     @Override
-    public PageInfo recDetail(PageRequest page, ListReqDTO req) {
+    public Map<String, Object> recDetail(PageRequest page, ListReqDTO req) {
         return getListDATA(page, req, "recDetail");
     }
 
     @Override
-    public PageInfo acountBalance(PageRequest page, ListReqDTO req) {
+    public Map<String, Object> acountBalance(PageRequest page, ListReqDTO req) {
         return getListDATA(page, req, "acountBalance");
     }
 
     @Override
-    public PageInfo customercheck(PageRequest page, ListReqDTO req) {
+    public Map<String, Object> customercheck(PageRequest page, ListReqDTO req) {
         return getListDATA(page, req, "customercheck");
     }
 
     @Override
-    public PageInfo accountdetails(PageRequest page, ListReqDTO req) {
+    public Map<String, Object> accountdetails(PageRequest page, ListReqDTO req) {
         return getListDATA(page, req, "accountdetails");
     }
 
-    private PageInfo getListDATA(PageRequest page, ListReqDTO req, String type) {
+    private Map<String, Object> getListDATA(PageRequest page, ListReqDTO req, String type) {
         //设置默认分页
         if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
             page = new PageRequest();
@@ -70,34 +74,65 @@ public class MoneyReportServiceImpl implements MoneyReportService {
         }
         PageHelper.startPage(page.getNumber(), page.getSize());
 
-
         //查询数据
-        List list = getListByType(req, type);
+        Map<String, Object> map = getListByType(req, type);
         //取分页信息
-        PageInfo lists = new PageInfo(list);
-        return lists;
+        PageInfo lists = new PageInfo((List) map.get("list"));
+        map.remove("list");
+        map.put("list", lists);
+        return map;
     }
 
-    private List getListByType(ListReqDTO req, String type) {
+    private Map<String, Object> getListByType(ListReqDTO req, String type) {
         List list = null;
         Long companyId = BaseContextHolder.getCompanyId();
         String con = req.getFinalCondition();
+        String calculateFieldsSql = req.getCalculateFieldsSql();
+        JSONArray arr = null;
         if (null == con) {
             con = "1=1";
         }
+
+        String res = null;
         if ("Supplier".equals(type)) {
             list = vendorAcountViewMapper.selectByCondition(con, companyId);
+            if (!StringUtils.isEmpty(calculateFieldsSql)) {
+                res = vendorAcountViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
+            }
         } else if("payDetail".equals(type)){
             list = paydetailViewMapper.selectByCondition(con, companyId);
+            if (!StringUtils.isEmpty(calculateFieldsSql)) {
+                res = paydetailViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
+            }
         }else if("recDetail".equals(type)){
             list = recdetailViewMapper.selectByCondition(con, companyId);
+            if (!StringUtils.isEmpty(calculateFieldsSql)) {
+                res = recdetailViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
+            }
         }else if ("acountBalance".equals(type)){
             list = acountbalanceViewMapper.selectByCondition(con, companyId);
+            if (!StringUtils.isEmpty(calculateFieldsSql)) {
+                res = acountbalanceViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
+            }
         }else if ("customercheck".equals(type)){
             list = customerCheckViewMapper.selectByCondition(con, companyId);
+            if (!StringUtils.isEmpty(calculateFieldsSql)) {
+                res = customerCheckViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
+            }
         }else if ("accountdetails".equals(type)){
             list = accountDetailsViewMapper.selectByCondition(con, companyId);
+            if (!StringUtils.isEmpty(calculateFieldsSql)) {
+                res = accountDetailsViewMapper.selectCalculateFields(calculateFieldsSql, con, companyId);
+            }
+        }
+
+        try {
+            arr = JSONArray.parseArray(res);
+        } catch (Exception e) {
         }
-        return list;
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("list", list);
+        map.put("calculate", arr);
+        return map;
     }
 }

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

@@ -153,14 +153,14 @@ public class PaybalanceServiceImpl extends CommonBaseServiceImpl<PaybalanceMappe
             //单据金额
             Double amount = detail.getPbd_amount();
             if(amount>0 && nowbalance<0){
-                String msg = BizExceptionCode.PAYBALANCE_NOWAMOUNT_POSITIVE.getMessage();
-                int code = BizExceptionCode.PAYBALANCE_NOWAMOUNT_POSITIVE.getCode();
+                String msg = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getMessage();
+                int code = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getCode();
                 String error = String.format(msg, detail.getPbd_slkind());
                 throw new BizException(code, error);
             }
             if(amount<0 && nowbalance>0){
-                String msg = BizExceptionCode.PAYBALANCE_NOWAMOUNT_NEGATIVE.getMessage();
-                int code = BizExceptionCode.PAYBALANCE_NOWAMOUNT_NEGATIVE.getCode();
+                String msg = BizExceptionCode.MONEY_NOWAMOUNT_NEGATIVE.getMessage();
+                int code = BizExceptionCode.MONEY_NOWAMOUNT_NEGATIVE.getCode();
                 String error = String.format(msg, detail.getPbd_slkind());
                 throw new BizException(code, error);
             }

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

@@ -151,14 +151,14 @@ public class RecbalanceServiceImpl extends CommonBaseServiceImpl<RecbalanceMappe
             //单据金额
             Double amount = detail.getRbd_amount();
             if(amount>0 && nowbalance<0){
-                String msg = BizExceptionCode.PAYBALANCE_NOWAMOUNT_POSITIVE.getMessage();
-                int code = BizExceptionCode.PAYBALANCE_NOWAMOUNT_POSITIVE.getCode();
+                String msg = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getMessage();
+                int code = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getCode();
                 String error = String.format(msg, detail.getRbd_slkind());
                 throw new BizException(500, error);
             }
             if(amount<0 && nowbalance>0){
-                String msg = BizExceptionCode.PAYBALANCE_NOWAMOUNT_POSITIVE.getMessage();
-                int code = BizExceptionCode.PAYBALANCE_NOWAMOUNT_POSITIVE.getCode();
+                String msg = BizExceptionCode.MONEY_NOWAMOUNT_NEGATIVE.getMessage();
+                int code = BizExceptionCode.MONEY_NOWAMOUNT_NEGATIVE.getCode();
                 String error = String.format(msg, detail.getRbd_slkind());
                 throw new BizException(code, error);
             }

+ 631 - 9
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/VerificationServiceImpl.java

@@ -16,10 +16,7 @@ import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.money.dto.*;
-import com.usoftchina.saas.money.mapper.VerificationListMapper;
-import com.usoftchina.saas.money.mapper.VerificationMapper;
-import com.usoftchina.saas.money.mapper.VerificationdetMapper;
-import com.usoftchina.saas.money.mapper.VerificationdetailMapper;
+import com.usoftchina.saas.money.mapper.*;
 import com.usoftchina.saas.money.po.*;
 import com.usoftchina.saas.money.service.VerificationService;
 import com.usoftchina.saas.page.PageRequest;
@@ -29,10 +26,12 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
 import javax.print.DocFlavor;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
+import java.util.logging.SimpleFormatter;
 
 @Service
 public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationMapper,Verification> implements VerificationService {
@@ -48,6 +47,12 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
     private VerificationListMapper verificationListMapper;
     @Autowired
     private MessageLogService messageLogService;
+    @Autowired
+    private SubledgerMapper subledgerMapper;
+    @Autowired
+    private RecbalanceMapper recbalanceMapper;
+    @Autowired
+    private PaybalanceMapper paybalanceMapper;
 
 
     @Override
@@ -93,6 +98,8 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
 
         List<Verificationdetail> verificationdetail = verificationdetailMapper.selectByFK(id);
         List<VerificationdetailDTO> items2 = BeanMapper.mapList(verificationdetail, VerificationdetailDTO.class);
+        String type = main.getVc_kind();
+        main.setVc_kind(transferKind(type));
         verificationFormDTO.setMain(main);
         verificationFormDTO.setItems1(items1);
         verificationFormDTO.setItems2(items2);
@@ -122,32 +129,40 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
         List<Verificationdet> updateDetails1 = new ArrayList<>();
         List<Verificationdetail> updateDetails2 = new ArrayList<>();
         DocSavedDTO saveDTO = new DocSavedDTO();
-        Long id = Long.valueOf(String.valueOf(main.getVc_id()));
+        Long id = main.getId();
         String code = main.getVc_code();
         Verification verification = BeanMapper.map(main,Verification.class);
         verification.setCompanyId(companyId);
         verification.setCreatorId(userId);
         verification.setCreateTime(new Date());
+        String kind = verification.getVc_kind();
+        verification.setVc_kind(transferKind(kind));
+
         //编号获取
         code = pushMaxnubmer(code,id);
-//        code = "1";
         verification.setVc_code(code);
         saveDTO.setCode(code);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYYMM");
+        String dateYM = simpleDateFormat.format(verification.getVc_date());
+        Integer numberYM = Integer.valueOf(dateYM);
         //判断更新与保存动作
         if (StringUtils.isEmpty(id) || "0".equals(id.toString())){
             //插入操作
             getMapper().insertSelective(verification);
             id = verification.getId();
+
             //添加从表传输对象
             for (VerificationdetDTO item : items1) {
                 Verificationdet detail = BeanMapper.map(item,Verificationdet.class);
                 detail.setVd_vcid(id);
                 detail.setCompanyId(companyId);
+                detail.setVd_ym(numberYM);
                 insertDetails1.add(detail);
             }
             for (VerificationdetailDTO item : items2) {
                 Verificationdetail detail = BeanMapper.map(item,Verificationdetail.class);
                 detail.setVcd_vcid(id);
+                detail.setVcd_ym(numberYM);
                 detail.setCompanyId(companyId);
                 insertDetails2.add(detail);
             }
@@ -158,8 +173,6 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
             if (insertDetails2.size()>0) {
                 verificationdetailMapper.batchInsert(insertDetails2);
             }
-            saveDTO.setId(id);
-            return saveDTO;
         }
         //更新操作
         getMapper().updateByPrimaryKeySelective(verification);
@@ -167,6 +180,7 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
         for (VerificationdetDTO item : items1) {
             Verificationdet detail = BeanMapper.map(item, Verificationdet.class);
             detail.setVd_vcid(id);
+            detail.setVd_ym(numberYM);
             detail.setCompanyId(companyId);
             if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
                 insertDetails1.add(detail);
@@ -177,6 +191,7 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
         for (VerificationdetailDTO item : items2) {
             Verificationdetail detail = BeanMapper.map(item, Verificationdetail.class);
             detail.setVcd_vcid(id);
+            detail.setVcd_ym(numberYM);
             detail.setCompanyId(companyId);
             if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
                 insertDetails2.add(detail);
@@ -198,19 +213,186 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
         if (updateDetails2.size()>0) {
             verificationdetailMapper.batchUpdate(updateDetails2);
         }
-
+        updateCorrespondingData(formdata);
         saveDTO.setId(id);
         return saveDTO;
     }
 
+    private void updateCorrespondingData(VerificationFormDTO formdata) {
+        //获取主表信息
+        VerificationDTO main = formdata.getMain();
+        //获取从表1
+        List<VerificationdetDTO> items1 = formdata.getItems1();
+        //获取从表2
+        List<VerificationdetailDTO> items2 = formdata.getItems2();
+
+        String type = main.getVc_kind();
+        if(type.equals("receipts_offset_receivable") || type.equals("prepaid_offset_payable") ||
+                type.equals("receivable_offset_payable")){
+            Double total1 = new Double(0);
+            for(VerificationdetDTO det : items1){
+                Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
+                total1 += nowbalanceDet;
+
+                //单据金额
+                Double amount = det.getVd_amount();
+                //核销金额
+                if(amount>0 && nowbalanceDet<0){
+                    String msg = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getMessage();
+                    int code = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getCode();
+                    String error = String.format(msg, det.getVd_slkind());
+                    throw new BizException(code, error);
+                }
+                if(amount<0 && nowbalanceDet>0){
+                    String msg = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getMessage();
+                    int code = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getCode();
+                    String error = String.format(msg, det.getVd_slkind());
+                    throw new BizException(code, error);
+                }
+            }
+            Double total2 = new Double(0);
+            for(VerificationdetailDTO detail : items2){
+                Double nowbalanceDet = detail.getVcd_nowbalance()==null?new Double(0):detail.getVcd_nowbalance();
+                total2 += nowbalanceDet;
+
+                //单据金额
+                Double amount = detail.getVcd_amount();
+                //核销金额
+                if(amount>0 && nowbalanceDet<0){
+                    String msg = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getMessage();
+                    int code = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getCode();
+                    String error = String.format(msg, detail.getVcd_slkind());
+                    throw new BizException(code, error);
+                }
+                if(amount<0 && nowbalanceDet>0){
+                    String msg = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getMessage();
+                    int code = BizExceptionCode.MONEY_NOWAMOUNT_POSITIVE.getCode();
+                    String error = String.format(msg, detail.getVcd_slkind());
+                    throw new BizException(code, error);
+                }
+            }
+            if(total1.doubleValue()!=total2.doubleValue()){
+                throw new BizException(500, BizExceptionCode.VERIFICATION_CHECK_BALANCE.getMessage());
+            }
+        }else if(type.equals("receivable_to_receivable") || type.equals("payable_to_payable")){
+            for(VerificationdetDTO det : items1){
+                Double namount = det.getSl_namount()==null?new Double(0):det.getSl_namount();
+                Double nowbalance = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
+                if(namount<nowbalance){
+                    throw new BizException(500, BizExceptionCode.VERIFICATION_CHECK_BALANCE.getMessage());
+                }
+            }
+        }
+
+    }
+
+    //插入中间表
+    private Subledger changSubledgerUntil(VerificationDTO verification){
+        Subledger subledger = new Subledger();
+        String kind = verification.getVc_kind();
+        subledger.setCompanyId(BaseContextHolder.getCompanyId());
+        subledger.setSl_code(verification.getVc_code());
+        subledger.setSl_kind(kind);
+        if(kind.equals("receipts_offset_receivable") || kind.equals("prepaid_offset_payable") ||
+                kind.equals("receivable_offset_payable")){
+            subledger.setSl_custid(0);
+            subledger.setSl_vendid(verification.getVc_vendid());
+        }else{
+            subledger.setSl_custid(verification.getVc_custid());
+            subledger.setSl_vendid(0);
+        }
+
+        subledger.setSl_date(verification.getVc_date());
+        subledger.setSl_amount(-verification.getVc_amount2());
+        subledger.setSl_orderamount(new Double(0));
+        subledger.setSl_yamount(new Double(0));
+        subledger.setSl_remark(verification.getVc_remark());
+        subledger.setSl_discount(new Double(0));
+        if(kind.equals("receipts_offset_receivable") || kind.equals("prepaid_offset_payable")){
+            subledger.setSl_preamount(-verification.getVc_amount1());
+        }else{
+            subledger.setSl_preamount(new Double(0));
+        }
+        return subledger;
+    }
+    /**
+     * 审核更新来源单据的已核销,未核销
+     * @param id
+     * @param nowBalance
+     */
+    private void updateAuditSubledeger(int id , Double nowBalance){
+        Subledger subledger = subledgerMapper.selectByPrimaryKey(id);
+        Subledger newSubledeger = new Subledger();
+        newSubledeger.setId(Long.valueOf(String.valueOf(id)));
+        Double newNamout = subledger.getSl_namount()==null?new Double(0):subledger.getSl_namount()-nowBalance;
+        Double newYamout = subledger.getSl_yamount()==null?new Double(0):subledger.getSl_yamount()+nowBalance;
+        newSubledeger.setSl_yamount(newYamout);
+        newSubledeger.setSl_namount(newNamout);
+        newSubledeger.setCompanyId(BaseContextHolder.getCompanyId());
+        newSubledeger.setUpdaterName(BaseContextHolder.getUserName());
+        newSubledeger.setUpdaterId(BaseContextHolder.getUserId());
+        newSubledeger.setUpdateTime(new Date());
+        subledgerMapper.updateByPrimaryKey(newSubledeger);
+    }
+    /**
+     * 反审核更新来源单据的已核销,未核销
+     * @param id
+     * @param nowBalance
+     */
+    private void updateResAuditSubledeger(int id , Double nowBalance){
+        Subledger subledger = subledgerMapper.selectByPrimaryKey(id);
+        Subledger newSubledeger = new Subledger();
+        newSubledeger.setId(Long.valueOf(String.valueOf(id)));
+        Double newNamout = subledger.getSl_namount()==null?new Double(0):subledger.getSl_namount()+nowBalance;
+        Double newYamout = subledger.getSl_yamount()==null?new Double(0):subledger.getSl_yamount()-nowBalance;
+        newSubledeger.setSl_yamount(newYamout);
+        newSubledeger.setSl_namount(newNamout);
+        newSubledeger.setCompanyId(BaseContextHolder.getCompanyId());
+        newSubledeger.setUpdaterName(BaseContextHolder.getUserName());
+        newSubledeger.setUpdaterId(BaseContextHolder.getUserId());
+        newSubledeger.setUpdateTime(new Date());
+        subledgerMapper.updateByPrimaryKey(newSubledeger);
+    }
+    /**
+     * 转换核销单类型
+     * @param kind
+     * @return
+     */
+    private String transferKind(String kind) {
+        switch (kind) {
+            case  "receipts_offset_receivable" :
+                return "预收冲应收";
+            case "prepaid_offset_payable":
+                return "预付冲应付";
+            case "receivable_offset_payable":
+                return "应收冲应付";
+            case "receivable_to_receivable":
+                return "应收转应收";
+            case "payable_to_payable":
+                return "应付转应付";
+                default:return "";
+        }
+    }
+
     @Override
     public void delete(Long id) {
         if (null != id) {
+            Verification verification = verificationMapper.selectByPrimaryKey(Math.toIntExact(id));
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM");
+            String ym = simpleDateFormat.format(verification.getVc_date());
+            int detno = Integer.valueOf(ym);
+            if(checkSetAcount(detno)){
+                throw new BizException(500, BizExceptionCode.CHECK_SETACOUNT_EXIS.getMessage());
+            }
+            //删除中间表
+            subledgerMapper.deleteByPrimaryKey(verification.getVc_code(),verification.getVc_kind());
+
             //从表删除
             verificationdetMapper.deleteByParentPrimaryKey(id);
             verificationdetailMapper.deleteByParentPrimaryKey(id);
             //主表删除
             verificationMapper.deleteByPrimaryKey(id);
+
             String code = verificationMapper.selectCodeById(id);
             DocBaseDTO baseDTO = new DocBaseDTO();
             baseDTO.setId(id);
@@ -221,6 +403,18 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
         }
     }
 
+    /**
+     *
+     * @param id
+     */
+    private boolean checkSetAcount(Integer detno){
+        boolean isSetAcount = false;
+        int count = verificationMapper.validateSetAcount(detno);
+        if(count>0){
+            isSetAcount = true;
+        }
+        return isSetAcount;
+    }
     @Override
     public void deleteDetail1(Long id) {
         if (null != id) {
@@ -266,11 +460,202 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
             verification.setVc_statuscode(Status.AUDITED.name());
             verification.setVc_id(Integer.valueOf(String.valueOf(id)));
             verificationMapper.updateByPrimaryKeySelective(verification);
+
+
+            VerificationDTO verificationDTO = formData.getMain();
+            Subledger subledger = changSubledgerUntil(verificationDTO);
+            subledgerMapper.insertSelective(subledger);
+
+            //更新客户或者供应商的金额
+            updateAuditCustomer(verificationDTO);
+            updateAuditVendor(verificationDTO);
+
+            //更新源单金额
+            //获取从表1
+            List<VerificationdetDTO> items1 = formData.getItems1();
+            //获取从表2
+            List<VerificationdetailDTO> items2 = formData.getItems2();
+            for(VerificationdetDTO det : items1){
+                Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
+                updateAuditSubledeger(det.getVd_slid(),nowbalanceDet);
+            }
+            for(VerificationdetailDTO detail : items2){
+                Double nowbalanceDet = detail.getVcd_nowbalance()==null?new Double(0):detail.getVcd_nowbalance();
+                updateAuditSubledeger(detail.getVcd_slid(),nowbalanceDet);
+            }
         }
         savedDTO.setId(id);
         return savedDTO;
     }
 
+    /**
+     * 审核更新客户金额
+     * @param verificationDTO
+     * @return
+     */
+    private void updateAuditCustomer(VerificationDTO verificationDTO){
+        String kind = verificationDTO.getVc_kind();
+        if(kind.equals("receipts_offset_receivable")){
+            Customer customerData = recbalanceMapper.selectCustomerByPrimaryKey(verificationDTO.getVc_custid());
+            Double preamount = customerData.getCu_preamount()==null?new Double(0):customerData.getCu_preamount();
+            Double beginapamount = customerData.getCu_beginaramount()==null?new Double(0):customerData.getCu_beginaramount();
+            Double beginprepayamount= customerData.getCu_beginprerecamount()==null?new Double(0):customerData.getCu_beginprerecamount();
+            Double recamount = customerData.getCu_recamount()==null?new Double(0):customerData.getCu_recamount();
+
+            Customer customer = new Customer();
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            customer.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_custid())));
+            customer.setCompanyId(BaseContextHolder.getCompanyId());
+            customer.setUpdaterId(BaseContextHolder.getUserId());
+            customer.setUpdaterName(BaseContextHolder.getUserName());
+            customer.setUpdateTime(new Date());
+            customer.setCu_preamount(preamount+amount1);
+            customer.setCu_recamount(recamount-amount2);
+            customer.setCu_leftamount(beginapamount-beginprepayamount+recamount-amount2-preamount-amount1);
+            recbalanceMapper.updateCustomerByPrimaryKeySelective(customer);
+        }else if(kind.equals("receivable_offset_payable")){
+            Customer customerData = recbalanceMapper.selectCustomerByPrimaryKey(verificationDTO.getVc_custid());
+            Double preamount = customerData.getCu_preamount()==null?new Double(0):customerData.getCu_preamount();
+            Double beginapamount = customerData.getCu_beginaramount()==null?new Double(0):customerData.getCu_beginaramount();
+            Double beginprepayamount= customerData.getCu_beginprerecamount()==null?new Double(0):customerData.getCu_beginprerecamount();
+            Double recamount = customerData.getCu_recamount()==null?new Double(0):customerData.getCu_recamount();
+
+            Customer customer = new Customer();
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            customer.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_custid())));
+            customer.setCompanyId(BaseContextHolder.getCompanyId());
+            customer.setUpdaterId(BaseContextHolder.getUserId());
+            customer.setUpdaterName(BaseContextHolder.getUserName());
+            customer.setUpdateTime(new Date());
+            customer.setCu_recamount(recamount-amount1);
+            customer.setCu_leftamount(beginapamount-beginprepayamount+recamount-amount1-preamount);
+            recbalanceMapper.updateCustomerByPrimaryKeySelective(customer);
+        }else if(kind.equals("receivable_to_receivable")){
+            //转入客户
+            Customer customerIn = recbalanceMapper.selectCustomerByPrimaryKey(verificationDTO.getVc_turncustid());
+            //转出客户
+            Customer customerOut = recbalanceMapper.selectCustomerByPrimaryKey(verificationDTO.getVc_custid());
+
+            Double preamountIn = customerIn.getCu_preamount()==null?new Double(0):customerIn.getCu_preamount();
+            Double beginapamountIn = customerIn.getCu_beginaramount()==null?new Double(0):customerIn.getCu_beginaramount();
+            Double beginprepayamountIn = customerIn.getCu_beginprerecamount()==null?new Double(0):customerIn.getCu_beginprerecamount();
+            Double recamountIn = customerIn.getCu_recamount()==null?new Double(0):customerIn.getCu_recamount();
+
+            Double preamountOut = customerOut.getCu_preamount()==null?new Double(0):customerOut.getCu_preamount();
+            Double beginapamountOut = customerOut.getCu_beginaramount()==null?new Double(0):customerOut.getCu_beginaramount();
+            Double beginprepayamountOut = customerOut.getCu_beginprerecamount()==null?new Double(0):customerOut.getCu_beginprerecamount();
+            Double recamountOut = customerOut.getCu_recamount()==null?new Double(0):customerOut.getCu_recamount();
+
+
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            Customer newCustomerIn = new Customer();
+            newCustomerIn.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_turncustid())));
+            newCustomerIn.setCompanyId(BaseContextHolder.getCompanyId());
+            newCustomerIn.setUpdaterId(BaseContextHolder.getUserId());
+            newCustomerIn.setUpdaterName(BaseContextHolder.getUserName());
+            newCustomerIn.setUpdateTime(new Date());
+            newCustomerIn.setCu_recamount(recamountIn-amount1);
+            newCustomerIn.setCu_leftamount(beginapamountIn-beginprepayamountIn+recamountIn-amount1-preamountIn);
+            recbalanceMapper.updateCustomerByPrimaryKeySelective(newCustomerIn);
+
+            Customer newCustomerOut = new Customer();
+            newCustomerOut.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_custid())));
+            newCustomerOut.setCompanyId(BaseContextHolder.getCompanyId());
+            newCustomerOut.setUpdaterId(BaseContextHolder.getUserId());
+            newCustomerOut.setUpdaterName(BaseContextHolder.getUserName());
+            newCustomerOut.setUpdateTime(new Date());
+            newCustomerOut.setCu_recamount(recamountOut-amount1);
+            newCustomerOut.setCu_leftamount(beginapamountOut-beginprepayamountOut+recamountOut-amount1-preamountOut);
+            recbalanceMapper.updateCustomerByPrimaryKeySelective(newCustomerOut);
+        }
+    }
+
+    /**
+     * 审核更新供应商金额
+     * @param verificationDTO
+     * @return
+     */
+    private void updateAuditVendor(VerificationDTO verificationDTO){
+        String kind = verificationDTO.getVc_kind();
+        if(kind.equals("prepaid_offset_payable")){
+            Vendor vendorData = paybalanceMapper.selectVendorByPrimaryKey(verificationDTO.getVc_vendid());
+            Double preamount = vendorData.getVe_preamount()==null?new Double(0):vendorData.getVe_preamount();
+            Double beginapamount = vendorData.getVe_beginapamount()==null?new Double(0):vendorData.getVe_beginapamount();
+            Double beginprepayamount= vendorData.getVe_beginprepayamount()==null?new Double(0):vendorData.getVe_beginprepayamount();
+            Double payamount = vendorData.getVe_payamount()==null?new Double(0):vendorData.getVe_payamount();
+
+            Vendor vendor = new Vendor();
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            vendor.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_vendid())));
+            vendor.setCompanyId(BaseContextHolder.getCompanyId());
+            vendor.setUpdaterId(BaseContextHolder.getUserId());
+            vendor.setUpdaterName(BaseContextHolder.getUserName());
+            vendor.setUpdateTime(new Date());
+            vendor.setVe_preamount(preamount-amount1);
+            vendor.setVe_payamount(payamount+amount2);
+            vendor.setVe_leftamount(beginapamount-beginprepayamount+payamount+amount2-preamount+amount1);
+            paybalanceMapper.updateVendorByPrimaryKeySelective(vendor);
+        }else if(kind.equals("receivable_offset_payable")){
+            Vendor vendorData = paybalanceMapper.selectVendorByPrimaryKey(verificationDTO.getVc_vendid());
+            Double preamount = vendorData.getVe_preamount()==null?new Double(0):vendorData.getVe_preamount();
+            Double beginapamount = vendorData.getVe_beginapamount()==null?new Double(0):vendorData.getVe_beginapamount();
+            Double beginprepayamount= vendorData.getVe_beginprepayamount()==null?new Double(0):vendorData.getVe_beginprepayamount();
+            Double payamount = vendorData.getVe_payamount()==null?new Double(0):vendorData.getVe_payamount();
+
+            Vendor vendor = new Vendor();
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            vendor.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_vendid())));
+            vendor.setVe_payamount(payamount+amount2);
+            vendor.setUpdaterId(BaseContextHolder.getUserId());
+            vendor.setUpdaterName(BaseContextHolder.getUserName());
+            vendor.setUpdateTime(new Date());
+            vendor.setVe_leftamount(beginapamount-beginprepayamount+payamount+amount2-preamount);
+            paybalanceMapper.updateVendorByPrimaryKeySelective(vendor);
+        }else if(kind.equals("payable_to_payable")){
+            //转入供应商
+            Vendor vendorIn = paybalanceMapper.selectVendorByPrimaryKey(verificationDTO.getVc_turnvendid());
+            //转出供应商
+            Vendor vendorOut = paybalanceMapper.selectVendorByPrimaryKey(verificationDTO.getVc_vendid());
+
+            Double preamountIn = vendorIn.getVe_preamount()==null?new Double(0):vendorIn.getVe_preamount();
+            Double beginapamountIn = vendorIn.getVe_beginapamount()==null?new Double(0):vendorIn.getVe_beginapamount();
+            Double beginprepayamountIn = vendorIn.getVe_beginprepayamount()==null?new Double(0):vendorIn.getVe_beginprepayamount();
+            Double payamountIn = vendorIn.getVe_payamount()==null?new Double(0):vendorIn.getVe_payamount();
+
+            Double preamountOut = vendorOut.getVe_preamount()==null?new Double(0):vendorOut.getVe_preamount();
+            Double beginapamountOut = vendorOut.getVe_beginapamount()==null?new Double(0):vendorOut.getVe_beginapamount();
+            Double beginprepayamountOut = vendorOut.getVe_beginprepayamount()==null?new Double(0):vendorOut.getVe_beginprepayamount();
+            Double payamountOut = vendorOut.getVe_payamount()==null?new Double(0):vendorOut.getVe_payamount();
+
+
+
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            Vendor newVendorIn = new Vendor();
+            newVendorIn.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_turnvendid())));
+            newVendorIn.setUpdaterId(BaseContextHolder.getUserId());
+            newVendorIn.setUpdaterName(BaseContextHolder.getUserName());
+            newVendorIn.setUpdateTime(new Date());
+            newVendorIn.setVe_payamount(payamountIn+amount1);
+            newVendorIn.setVe_leftamount(beginapamountIn-beginprepayamountIn+payamountIn+amount1-preamountIn);
+            paybalanceMapper.updateVendorByPrimaryKeySelective(newVendorIn);
+
+            Vendor newVendorOut = new Vendor();
+            newVendorOut.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_vendid())));
+            newVendorOut.setUpdaterId(BaseContextHolder.getUserId());
+            newVendorOut.setUpdaterName(BaseContextHolder.getUserName());
+            newVendorOut.setUpdateTime(new Date());
+            newVendorOut.setVe_payamount(payamountOut-amount1);
+            newVendorOut.setVe_leftamount(beginapamountOut-beginprepayamountOut+payamountOut-amount1-preamountOut);
+            paybalanceMapper.updateVendorByPrimaryKeySelective(newVendorOut);
+
+        }
+    }
     @Override
     public void resAudit(Long id) {
         if (null == id) {
@@ -282,6 +667,27 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
             int errCode = BizExceptionCode.BEFORE_UNAUDIT.getCode();
             throw new BizException(errCode, String.format(msg, code));
         }
+
+        //更新客户或者供应商的金额
+        Verification nowverification = verificationMapper.selectByPrimaryKey(id);
+        VerificationDTO verificationDTO = BeanMapper.map(nowverification,VerificationDTO.class);
+        updateResAuditCustomer(verificationDTO);
+        updateResAuditVendor(verificationDTO);
+
+        //更新源单金额
+        //获取从表1
+        List<Verificationdet> items1 = verificationdetMapper.selectByFK(id);
+        //获取从表2
+        List<Verificationdetail> items2 = verificationdetailMapper.selectByFK(id);
+        for(Verificationdet det : items1){
+            Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
+            updateAuditSubledeger(det.getVd_slid(),nowbalanceDet);
+        }
+        for(Verificationdetail detail : items2){
+            Double nowbalanceDet = detail.getVcd_nowbalance()==null?new Double(0):detail.getVcd_nowbalance();
+            updateAuditSubledeger(detail.getVcd_slid(),nowbalanceDet);
+        }
+
         Verification verification = new Verification();
         //生成更新对象
         verification.setVc_id(Integer.valueOf(String.valueOf(id)));
@@ -298,17 +704,209 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
         //日志
         messageLogService.unAudit(baseDTO);
     }
+    /**
+     * 反审核更新客户金额
+     * @param verificationDTO
+     * @return
+     */
+    private void updateResAuditCustomer(VerificationDTO verificationDTO){
+        String kind = verificationDTO.getVc_kind();
+        if(kind.equals("receipts_offset_receivable")){
+            Customer customerData = recbalanceMapper.selectCustomerByPrimaryKey(verificationDTO.getVc_custid());
+            Double preamount = customerData.getCu_preamount()==null?new Double(0):customerData.getCu_preamount();
+            Double beginapamount = customerData.getCu_beginaramount()==null?new Double(0):customerData.getCu_beginaramount();
+            Double beginprepayamount= customerData.getCu_beginprerecamount()==null?new Double(0):customerData.getCu_beginprerecamount();
+            Double recamount = customerData.getCu_recamount()==null?new Double(0):customerData.getCu_recamount();
+
+            Customer customer = new Customer();
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            customer.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_custid())));
+            customer.setCompanyId(BaseContextHolder.getCompanyId());
+            customer.setUpdaterId(BaseContextHolder.getUserId());
+            customer.setUpdaterName(BaseContextHolder.getUserName());
+            customer.setUpdateTime(new Date());
+            customer.setCu_preamount(preamount-amount1);
+            customer.setCu_recamount(recamount+amount2);
+            customer.setCu_leftamount(beginapamount-beginprepayamount+recamount+amount2-preamount+amount1);
+            recbalanceMapper.updateCustomerByPrimaryKeySelective(customer);
+        }else if(kind.equals("receivable_offset_payable")){
+            Customer customerData = recbalanceMapper.selectCustomerByPrimaryKey(verificationDTO.getVc_custid());
+            Double preamount = customerData.getCu_preamount()==null?new Double(0):customerData.getCu_preamount();
+            Double beginapamount = customerData.getCu_beginaramount()==null?new Double(0):customerData.getCu_beginaramount();
+            Double beginprepayamount= customerData.getCu_beginprerecamount()==null?new Double(0):customerData.getCu_beginprerecamount();
+            Double recamount = customerData.getCu_recamount()==null?new Double(0):customerData.getCu_recamount();
+
+            Customer customer = new Customer();
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            customer.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_custid())));
+            customer.setCompanyId(BaseContextHolder.getCompanyId());
+            customer.setUpdaterId(BaseContextHolder.getUserId());
+            customer.setUpdaterName(BaseContextHolder.getUserName());
+            customer.setUpdateTime(new Date());
+            customer.setCu_recamount(recamount+amount1);
+            customer.setCu_leftamount(beginapamount-beginprepayamount+recamount+amount1-preamount);
+            recbalanceMapper.updateCustomerByPrimaryKeySelective(customer);
+        }else if(kind.equals("receivable_to_receivable")){
+            //转入客户
+            Customer customerIn = recbalanceMapper.selectCustomerByPrimaryKey(verificationDTO.getVc_turncustid());
+            //转出客户
+            Customer customerOut = recbalanceMapper.selectCustomerByPrimaryKey(verificationDTO.getVc_custid());
+
+            Double preamountIn = customerIn.getCu_preamount()==null?new Double(0):customerIn.getCu_preamount();
+            Double beginapamountIn = customerIn.getCu_beginaramount()==null?new Double(0):customerIn.getCu_beginaramount();
+            Double beginprepayamountIn = customerIn.getCu_beginprerecamount()==null?new Double(0):customerIn.getCu_beginprerecamount();
+            Double recamountIn = customerIn.getCu_recamount()==null?new Double(0):customerIn.getCu_recamount();
+
+            Double preamountOut = customerOut.getCu_preamount()==null?new Double(0):customerOut.getCu_preamount();
+            Double beginapamountOut = customerOut.getCu_beginaramount()==null?new Double(0):customerOut.getCu_beginaramount();
+            Double beginprepayamountOut = customerOut.getCu_beginprerecamount()==null?new Double(0):customerOut.getCu_beginprerecamount();
+            Double recamountOut = customerOut.getCu_recamount()==null?new Double(0):customerOut.getCu_recamount();
+
+
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            Customer newCustomerIn = new Customer();
+            newCustomerIn.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_turncustid())));
+            newCustomerIn.setCompanyId(BaseContextHolder.getCompanyId());
+            newCustomerIn.setUpdaterId(BaseContextHolder.getUserId());
+            newCustomerIn.setUpdaterName(BaseContextHolder.getUserName());
+            newCustomerIn.setUpdateTime(new Date());
+            newCustomerIn.setCu_recamount(recamountIn-amount1);
+            newCustomerIn.setCu_leftamount(beginapamountIn-beginprepayamountIn+recamountIn+amount1-preamountIn);
+            recbalanceMapper.updateCustomerByPrimaryKeySelective(newCustomerIn);
+
+            Customer newCustomerOut = new Customer();
+            newCustomerOut.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_custid())));
+            newCustomerOut.setCompanyId(BaseContextHolder.getCompanyId());
+            newCustomerOut.setUpdaterId(BaseContextHolder.getUserId());
+            newCustomerOut.setUpdaterName(BaseContextHolder.getUserName());
+            newCustomerOut.setUpdateTime(new Date());
+            newCustomerOut.setCu_recamount(recamountOut+amount1);
+            newCustomerOut.setCu_leftamount(beginapamountOut-beginprepayamountOut+recamountOut+amount1-preamountOut);
+            recbalanceMapper.updateCustomerByPrimaryKeySelective(newCustomerOut);
+        }
+    }
+
+    /**
+     * 审核更新供应商金额
+     * @param verificationDTO
+     * @return
+     */
+    private void updateResAuditVendor(VerificationDTO verificationDTO){
+        String kind = verificationDTO.getVc_kind();
+        if(kind.equals("prepaid_offset_payable")){
+            Vendor vendorData = paybalanceMapper.selectVendorByPrimaryKey(verificationDTO.getVc_vendid());
+            Double preamount = vendorData.getVe_preamount()==null?new Double(0):vendorData.getVe_preamount();
+            Double beginapamount = vendorData.getVe_beginapamount()==null?new Double(0):vendorData.getVe_beginapamount();
+            Double beginprepayamount= vendorData.getVe_beginprepayamount()==null?new Double(0):vendorData.getVe_beginprepayamount();
+            Double payamount = vendorData.getVe_payamount()==null?new Double(0):vendorData.getVe_payamount();
+
+            Vendor vendor = new Vendor();
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            vendor.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_vendid())));
+            vendor.setCompanyId(BaseContextHolder.getCompanyId());
+            vendor.setUpdaterId(BaseContextHolder.getUserId());
+            vendor.setUpdaterName(BaseContextHolder.getUserName());
+            vendor.setUpdateTime(new Date());
+            vendor.setVe_preamount(preamount+amount1);
+            vendor.setVe_payamount(payamount-amount2);
+            vendor.setVe_leftamount(beginapamount-beginprepayamount+payamount-amount2-preamount-amount1);
+            paybalanceMapper.updateVendorByPrimaryKeySelective(vendor);
+        }else if(kind.equals("receivable_offset_payable")){
+            Vendor vendorData = paybalanceMapper.selectVendorByPrimaryKey(verificationDTO.getVc_vendid());
+            Double preamount = vendorData.getVe_preamount()==null?new Double(0):vendorData.getVe_preamount();
+            Double beginapamount = vendorData.getVe_beginapamount()==null?new Double(0):vendorData.getVe_beginapamount();
+            Double beginprepayamount= vendorData.getVe_beginprepayamount()==null?new Double(0):vendorData.getVe_beginprepayamount();
+            Double payamount = vendorData.getVe_payamount()==null?new Double(0):vendorData.getVe_payamount();
+
+            Vendor vendor = new Vendor();
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            vendor.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_vendid())));
+            vendor.setVe_payamount(payamount+amount2);
+            vendor.setUpdaterId(BaseContextHolder.getUserId());
+            vendor.setUpdaterName(BaseContextHolder.getUserName());
+            vendor.setUpdateTime(new Date());
+            vendor.setVe_leftamount(beginapamount-beginprepayamount+payamount+amount2-preamount);
+            paybalanceMapper.updateVendorByPrimaryKeySelective(vendor);
+        }else if(kind.equals("payable_to_payable")){
+            //转入供应商
+            Vendor vendorIn = paybalanceMapper.selectVendorByPrimaryKey(verificationDTO.getVc_turnvendid());
+            //转出供应商
+            Vendor vendorOut = paybalanceMapper.selectVendorByPrimaryKey(verificationDTO.getVc_vendid());
+
+            Double preamountIn = vendorIn.getVe_preamount()==null?new Double(0):vendorIn.getVe_preamount();
+            Double beginapamountIn = vendorIn.getVe_beginapamount()==null?new Double(0):vendorIn.getVe_beginapamount();
+            Double beginprepayamountIn = vendorIn.getVe_beginprepayamount()==null?new Double(0):vendorIn.getVe_beginprepayamount();
+            Double payamountIn = vendorIn.getVe_payamount()==null?new Double(0):vendorIn.getVe_payamount();
+
+            Double preamountOut = vendorOut.getVe_preamount()==null?new Double(0):vendorOut.getVe_preamount();
+            Double beginapamountOut = vendorOut.getVe_beginapamount()==null?new Double(0):vendorOut.getVe_beginapamount();
+            Double beginprepayamountOut = vendorOut.getVe_beginprepayamount()==null?new Double(0):vendorOut.getVe_beginprepayamount();
+            Double payamountOut = vendorOut.getVe_payamount()==null?new Double(0):vendorOut.getVe_payamount();
+
 
+
+            Double amount1 = verificationDTO.getVc_amount1()==null?new Double(0):verificationDTO.getVc_amount1();
+            Double amount2 = verificationDTO.getVc_amount2()==null?new Double(0):verificationDTO.getVc_amount2();
+            Vendor newVendorIn = new Vendor();
+            newVendorIn.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_turnvendid())));
+            newVendorIn.setUpdaterId(BaseContextHolder.getUserId());
+            newVendorIn.setUpdaterName(BaseContextHolder.getUserName());
+            newVendorIn.setUpdateTime(new Date());
+            newVendorIn.setVe_payamount(payamountIn+amount1);
+            newVendorIn.setVe_leftamount(beginapamountIn-beginprepayamountIn+payamountIn+amount1-preamountIn);
+            paybalanceMapper.updateVendorByPrimaryKeySelective(newVendorIn);
+
+            Vendor newVendorOut = new Vendor();
+            newVendorOut.setId(Long.valueOf(String.valueOf(verificationDTO.getVc_vendid())));
+            newVendorOut.setUpdaterId(BaseContextHolder.getUserId());
+            newVendorOut.setUpdaterName(BaseContextHolder.getUserName());
+            newVendorOut.setUpdateTime(new Date());
+            newVendorOut.setVe_payamount(payamountOut+amount1);
+            newVendorOut.setVe_leftamount(beginapamountOut-beginprepayamountOut+payamountOut+amount1-preamountOut);
+            paybalanceMapper.updateVendorByPrimaryKeySelective(newVendorOut);
+
+        }
+    }
     @Override
     public void batchAudit(BatchDealBaseDTO baseDTO) {
         Iterator isList = baseDTO.getBaseDTOs().iterator();
         while (isList.hasNext()){
             DocBaseDTO docBaseDTO = (DocBaseDTO) isList.next();
             Long id = docBaseDTO.getId();
+
+            //更新客户或者供应商的金额
+            Verification nowverification = verificationMapper.selectByPrimaryKey(id);
+            VerificationDTO verificationDTO = BeanMapper.map(nowverification,VerificationDTO.class);
+            updateAuditCustomer(verificationDTO);
+            updateAuditVendor(verificationDTO);
+
+            //更新源单金额
+            //获取从表1
+            List<Verificationdet> items1 = verificationdetMapper.selectByFK(id);
+            //获取从表2
+            List<Verificationdetail> items2 = verificationdetailMapper.selectByFK(id);
+            for(Verificationdet det : items1){
+                Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
+                updateAuditSubledeger(det.getVd_slid(),nowbalanceDet);
+            }
+            for(Verificationdetail detail : items2){
+                Double nowbalanceDet = detail.getVcd_nowbalance()==null?new Double(0):detail.getVcd_nowbalance();
+                updateAuditSubledeger(detail.getVcd_slid(),nowbalanceDet);
+            }
+
             Verification verification = new Verification();
             verification.setVc_status(Status.AUDITED.getDisplay());
             verification.setVc_statuscode(Status.AUDITED.name());
             verification.setVc_id(Integer.valueOf(String.valueOf(id)));
+            verification.setCompanyId(BaseContextHolder.getCompanyId());
+            verification.setUpdaterId(BaseContextHolder.getUserId());
+            verification.setUpdaterName(BaseContextHolder.getUserName());
+            verification.setUpdateTime(new Date());
             verificationMapper.updateByPrimaryKeySelective(verification);
         }
     }
@@ -319,10 +917,34 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
         while (isList.hasNext()){
             DocBaseDTO docBaseDTO = (DocBaseDTO) isList.next();
             Long id = docBaseDTO.getId();
+
+            //更新客户或者供应商的金额
+            Verification nowverification = verificationMapper.selectByPrimaryKey(id);
+            VerificationDTO verificationDTO = BeanMapper.map(nowverification,VerificationDTO.class);
+            updateResAuditCustomer(verificationDTO);
+            updateResAuditVendor(verificationDTO);
+
+            //更新源单金额
+            //获取从表1
+            List<Verificationdet> items1 = verificationdetMapper.selectByFK(id);
+            //获取从表2
+            List<Verificationdetail> items2 = verificationdetailMapper.selectByFK(id);
+            for(Verificationdet det : items1){
+                Double nowbalanceDet = det.getVd_nowbalance()==null?new Double(0):det.getVd_nowbalance();
+                updateAuditSubledeger(det.getVd_slid(),nowbalanceDet);
+            }
+            for(Verificationdetail detail : items2){
+                Double nowbalanceDet = detail.getVcd_nowbalance()==null?new Double(0):detail.getVcd_nowbalance();
+                updateAuditSubledeger(detail.getVcd_slid(),nowbalanceDet);
+            }
+
             Verification verification = new Verification();
             verification.setVc_status(Status.UNAUDITED.getDisplay());
             verification.setVc_statuscode(Status.UNAUDITED.name());
             verification.setVc_id(Integer.valueOf(String.valueOf(id)));
+            verification.setUpdaterId(BaseContextHolder.getUserId());
+            verification.setUpdaterName(BaseContextHolder.getUserName());
+            verification.setUpdateTime(new Date());
             verificationMapper.updateByPrimaryKeySelective(verification);
         }
     }

+ 1 - 1
applications/money/money-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

+ 21 - 7
applications/money/money-server/src/main/resources/mapper/AccountDetailsViewMapper.xml

@@ -2,15 +2,17 @@
 <!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.AccountDetailsViewMapper" >
   <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.AccountDetailsView" >
-    <result column="SL_CODE" property="SL_CODE" jdbcType="VARCHAR" />
-    <result column="SL_KIND" property="SL_KIND" jdbcType="VARCHAR" />
-    <result column="VE_NAME" property="VE_NAME" jdbcType="VARCHAR" />
-    <result column="SL_AMOUNT" property="SL_AMOUNT" jdbcType="DOUBLE" />
-    <result column="PB_ID" property="PB_ID" jdbcType="INTEGER" />
-    <result column="PB_KIND" property="PB_KIND" jdbcType="VARCHAR" />
-    <result column="PB_CODE" property="PB_CODE" jdbcType="VARCHAR" />
+    <result column="sl_code" property="sl_code" jdbcType="VARCHAR" />
+    <result column="sl_kind" property="sl_kind" jdbcType="VARCHAR" />
+    <result column="ve_name" property="ve_name" jdbcType="VARCHAR" />
+    <result column="cu_name" property="cu_name" jdbcType="VARCHAR" />
+    <result column="sl_amount" property="sl_amount" jdbcType="DOUBLE" />
+    <result column="pb_id" property="pb_id" jdbcType="INTEGER" />
+    <result column="pb_kind" property="pb_kind" jdbcType="VARCHAR" />
+    <result column="pb_code" property="pb_code" jdbcType="VARCHAR" />
     <result column="total" property="total" jdbcType="DOUBLE" />
     <result column="date" property="date" jdbcType="TIMESTAMP" />
+    <result column="companyId" property="companyId" jdbcType="INTEGER" />
   </resultMap>
   <select id="selectByCondition" resultMap="BaseResultMap">
     select  *  from account_details_view
@@ -24,4 +26,16 @@
     </where>
     order by date desc
   </select>
+
+  <select id="selectCalculateFields" resultType="string">
+    select   ${fields}  from account_details_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+  </select>
 </mapper>

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

@@ -27,7 +27,19 @@
         and  companyId = #{companyId}
       </if>
     </where>
-    order by bankname, date, bankid desc
+    order by bankname asc, date desc, bankid desc
+  </select>
+
+  <select id="selectCalculateFields" resultType="string">
+    select   ${fields}  from acountbalance_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
   </select>
 
 </mapper>

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

@@ -30,7 +30,19 @@
                 and  companyId = #{companyId}
             </if>
         </where>
-        order by pi_date desc
+        order by pi_custname asc, pi_date desc, pi_custcode desc
+    </select>
+
+    <select id="selectCalculateFields" resultType="string">
+        select   ${fields}  from customer_amount_view
+        <where>
+            <if test="con != null">
+                ${con}
+            </if>
+            <if test="companyId != null">
+                and  companyId = #{companyId}
+            </if>
+        </where>
     </select>
 
 </mapper>

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

@@ -24,6 +24,7 @@
     <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" />
+    <result column="ftd_remark" property="ftd_remark" jdbcType="VARCHAR" />
     <result column="creatorName" property="creatorName" jdbcType="VARCHAR" />
     <result column="updaterName" property="updaterName" jdbcType="VARCHAR" />
     <result column="ft_auditman" property="ft_auditman" jdbcType="VARCHAR" />
@@ -37,7 +38,7 @@
     ft_auditman, ft_auditdate
   </sql>
   <sql id="Detail_Column_List" >
-    ftd_bankname,ftd_inbankname,ftd_nowbalance,ftd_paymethod,ftd_paycode
+    ftd_bankname,ftd_inbankname,ftd_nowbalance,ftd_paymethod,ftd_paycode,ftd_remark
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 

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

@@ -13,7 +13,7 @@
     <result column="pb_pdamount" property="pb_pdamount" jdbcType="DOUBLE" />
     <result column="pb_pbdamount" property="pb_pbdamount" jdbcType="DOUBLE" />
     <result column="mustpay" property="mustpay" jdbcType="DOUBLE" />
-    <result column="mustdate" property="mustdate" jdbcType="DECIMAL" />
+    <result column="mustdate" property="mustdate" jdbcType="TIMESTAMP" />
     <result column="pi_total" property="pi_total" jdbcType="DOUBLE" />
     <result column="pi_remark" property="pi_remark" jdbcType="VARCHAR" />
     <result column="companyId" property="companyId" jdbcType="INTEGER" />
@@ -29,7 +29,19 @@
         and  companyId = #{companyId}
       </if>
     </where>
-    order by pb_date desc
+    order by pi_vendname asc, pb_date desc,pi_vendcode desc
+  </select>
+
+  <select id="selectCalculateFields" resultType="string">
+    select   ${fields}  from paydetail_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
   </select>
 
 </mapper>

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

@@ -13,7 +13,7 @@
     <result column="rb_rdamount" property="rb_rdamount" jdbcType="DOUBLE" />
     <result column="rb_rbdamount" property="rb_rbdamount" jdbcType="DOUBLE" />
     <result column="mustpay" property="mustpay" jdbcType="DOUBLE" />
-    <result column="mustdate" property="mustdate" jdbcType="DOUBLE" />
+    <result column="mustdate" property="mustdate" jdbcType="TIMESTAMP" />
     <result column="pi_total" property="pi_total" jdbcType="DOUBLE" />
     <result column="pi_remark" property="pi_remark" jdbcType="VARCHAR" />
   <result column="companyId" property="companyId" jdbcType="INTEGER" />
@@ -29,6 +29,18 @@
         and  companyId = #{companyId}
       </if>
     </where>
-    order by rb_date desc
+    order by pi_custname asc, rb_date desc, pi_custcode desc
+  </select>
+
+  <select id="selectCalculateFields" resultType="string">
+    select   ${fields}  from recdetail_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
   </select>
 </mapper>

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

@@ -32,6 +32,18 @@
         and  companyId = #{companyId}
       </if>
     </where>
-    order by pi_date desc
+    order by pi_vendname asc, pi_date desc, pi_vendcode desc
+  </select>
+
+  <select id="selectCalculateFields" resultType="string">
+    select   ${fields}  from vendor_acount_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
   </select>
 </mapper>

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

@@ -46,12 +46,13 @@
 
     </resultMap>
     <sql id="Base_Column_List">
-    vc_id, vc_code, vc_kind, vc_date, vc_vendid, vc_vendcode
+    vc_id, vc_code, vc_kind, vc_date, vc_vendid, vc_vendcode ,vc_custcode ,vc_custid ,vc_amount1
   </sql>
     <select id="selectVerificationListByCondition"  resultMap="BaseResultMap">
         select
         <include refid="Base_Column_List" />
         from verification left join verificationdet on vc_id=vd_vcid
+        and verification.companyid=verificationdet.companyid
         <where>
             <if test="con != null">
                 ${con}
@@ -59,7 +60,7 @@
             <if test="companyId!=null">
                 and verification.companyId=#{companyId}
             </if>
-            order by vc_id
+            order by vc_date desc,vc_id desc
         </where>
     </select>
 

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

@@ -2,7 +2,7 @@
 <!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.VerificationMapper" >
   <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.Verification" >
-    <id column="vc_id" property="vc_id" jdbcType="INTEGER" />
+    <id column="vc_id" property="id" jdbcType="INTEGER" />
     <result column="vc_code" property="vc_code" jdbcType="VARCHAR" />
     <result column="vc_kind" property="vc_kind" jdbcType="VARCHAR" />
     <result column="vc_date" property="vc_date" jdbcType="TIMESTAMP" />
@@ -157,9 +157,6 @@
   <insert id="insertSelective" parameterType="com.usoftchina.saas.money.po.Verification" >
     insert into verification
     <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="vc_id != null" >
-        vc_id,
-      </if>
       <if test="vc_code != null" >
         vc_code,
       </if>
@@ -255,9 +252,6 @@
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="vc_id != null" >
-        #{vc_id,jdbcType=INTEGER},
-      </if>
       <if test="vc_code != null" >
         #{vc_code,jdbcType=VARCHAR},
       </if>
@@ -352,6 +346,9 @@
         #{vc_text5,jdbcType=VARCHAR},
       </if>
     </trim>
+    <selectKey resultType="Long" keyProperty="id" order="AFTER">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
   </insert>
   <select id="countByExample" parameterType="com.usoftchina.saas.money.po.VerificationExample" resultType="java.lang.Integer" >
     select count(*) from verification
@@ -362,8 +359,8 @@
   <update id="updateByExampleSelective" parameterType="map" >
     update verification
     <set >
-      <if test="record.vc_id != null" >
-        vc_id = #{record.vc_id,jdbcType=INTEGER},
+      <if test="record.id != null" >
+        vc_id = #{record.id,jdbcType=INTEGER},
       </if>
       <if test="record.vc_code != null" >
         vc_code = #{record.vc_code,jdbcType=VARCHAR},
@@ -465,7 +462,7 @@
   </update>
   <update id="updateByExample" parameterType="map" >
     update verification
-    set vc_id = #{record.vc_id,jdbcType=INTEGER},
+    set vc_id = #{record.id,jdbcType=INTEGER},
       vc_code = #{record.vc_code,jdbcType=VARCHAR},
       vc_kind = #{record.vc_kind,jdbcType=VARCHAR},
       vc_date = #{record.vc_date,jdbcType=TIMESTAMP},
@@ -598,7 +595,7 @@
         vc_text5 = #{vc_text5,jdbcType=VARCHAR},
       </if>
     </set>
-    where vc_id = #{vc_id,jdbcType=INTEGER}
+    where vc_id = #{id,jdbcType=INTEGER}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.money.po.Verification" >
     update verification
@@ -633,7 +630,7 @@
       vc_text3 = #{vc_text3,jdbcType=VARCHAR},
       vc_text4 = #{vc_text4,jdbcType=VARCHAR},
       vc_text5 = #{vc_text5,jdbcType=VARCHAR}
-    where vc_id = #{vc_id,jdbcType=INTEGER}
+    where vc_id = #{id,jdbcType=INTEGER}
   </update>
   <select id="validateCodeWhenInsert" resultType="int" parameterType="string" >
     select count(1) from Verification where vc_code = #{code}
@@ -645,6 +642,10 @@
     select vc_code from Verification where vc_id=#{id}
   </select>
   <select id="validateResAudit" parameterType="long" resultType="java.lang.String">
-    select vc_code from Verification where vc_id = #{vc_id} and IFNULL(vc_statuscode,'UNAUDITED')='UNAUDITED'
+    select vc_code from Verification where vc_id = #{id} and IFNULL(vc_statuscode,'UNAUDITED')='UNAUDITED'
+  </select>
+
+  <select id="validateSetAcount" parameterType="long" resultType="java.lang.String">
+    select count(1) from periodsdetail where pd_detno = #{detno} and IFNULL(pd_status,0)=0
   </select>
 </mapper>

+ 16 - 15
applications/money/money-server/src/main/resources/mapper/VerificationdetMapper.xml

@@ -2,7 +2,7 @@
 <!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.VerificationdetMapper" >
   <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.Verificationdet" >
-    <id column="vd_id" property="vd_id" jdbcType="INTEGER" />
+    <id column="vd_id" property="id" jdbcType="INTEGER" />
     <result column="vd_vcid" property="vd_vcid" jdbcType="INTEGER" />
     <result column="vd_detno" property="vd_detno" jdbcType="INTEGER" />
     <result column="vd_ym" property="vd_ym" jdbcType="INTEGER" />
@@ -82,7 +82,8 @@
   </sql>
   <sql id="Base_Column_List" >
     vd_id, vd_vcid, vd_detno, vd_ym, vd_slid, vd_slcode, vd_slkind, vd_sldate, vd_amount, 
-    vd_nowbalance, vd_remark, companyId, updaterId, updateTime, vd_text1, vd_text2, vd_text3, 
+    vd_nowbalance, vd_remark, verificationdet.companyId, verificationdet.updaterId,
+    verificationdet.updateTime, vd_text1, vd_text2, vd_text3,
     vd_text4, vd_text5
   </sql>
   <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.usoftchina.saas.money.po.VerificationdetExample" >
@@ -116,14 +117,14 @@
     </if>
   </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.money.po.Verificationdet" >
-    insert into verificationdet (vd_id, vd_vcid, vd_detno, 
+    insert into verificationdet ( vd_vcid, vd_detno,
       vd_ym, vd_slid, vd_slcode, 
       vd_slkind, vd_sldate, vd_amount, 
       vd_nowbalance, vd_remark, companyId, 
       updaterId, updateTime, vd_text1, 
       vd_text2, vd_text3, vd_text4, 
       vd_text5)
-    values (#{vd_id,jdbcType=INTEGER}, #{vd_vcid,jdbcType=INTEGER}, #{vd_detno,jdbcType=INTEGER}, 
+    values (#{vd_vcid,jdbcType=INTEGER}, #{vd_detno,jdbcType=INTEGER},
       #{vd_ym,jdbcType=INTEGER}, #{vd_slid,jdbcType=INTEGER}, #{vd_slcode,jdbcType=VARCHAR}, 
       #{vd_slkind,jdbcType=VARCHAR}, #{vd_sldate,jdbcType=TIMESTAMP}, #{vd_amount,jdbcType=DOUBLE}, 
       #{vd_nowbalance,jdbcType=DOUBLE}, #{vd_remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, 
@@ -134,9 +135,6 @@
   <insert id="insertSelective" parameterType="com.usoftchina.saas.money.po.Verificationdet" >
     insert into verificationdet
     <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="vd_id != null" >
-        vd_id,
-      </if>
       <if test="vd_vcid != null" >
         vd_vcid,
       </if>
@@ -193,9 +191,6 @@
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="vd_id != null" >
-        #{vd_id,jdbcType=INTEGER},
-      </if>
       <if test="vd_vcid != null" >
         #{vd_vcid,jdbcType=INTEGER},
       </if>
@@ -433,14 +428,13 @@
   <insert id="batchInsert" parameterType="java.util.List" >
     insert into verificationdet
     (
-    vd_id,vd_vcid,vd_detno,vd_ym,vd_slid,vd_slcode,vd_slkind,vd_sldate,
+    vd_vcid,vd_detno,vd_ym,vd_slid,vd_slcode,vd_slkind,vd_sldate,
     vd_amount,vd_nowbalance,vd_remark,companyId,updaterId,updateTime,
     vd_text1,vd_text2,vd_text3,vd_text4,vd_text5
     )
     values
     <foreach collection="list" item="items1" index="index" open="" close="" separator=",">
-      (
-      #{items1.vd_id,jdbcType=INTEGER},#{items1.vd_vcid,jdbcType=INTEGER},#{items1.vd_detno,jdbcType=INTEGER},#{items1.vd_ym,jdbcType=INTEGER},#{items1.vd_slid,jdbcType=INTEGER},
+      (#{items1.vd_vcid,jdbcType=INTEGER},#{items1.vd_detno,jdbcType=INTEGER},#{items1.vd_ym,jdbcType=INTEGER},#{items1.vd_slid,jdbcType=INTEGER},
       #{items1.vd_slcode,jdbcType=VARCHAR},#{items1.vd_slkind,jdbcType=VARCHAR},#{items1.vd_sldate,jdbcType=DATE},#{items1.vd_amount,jdbcType=DOUBLE},
       #{items1.vd_nowbalance,jdbcType=DOUBLE},#{items1.vd_remark,jdbcType=VARCHAR},#{items1.companyId,jdbcType=INTEGER},#{items1.updaterId,jdbcType=INTEGER},#{items1.updateTime,jdbcType=DATE},
       #{items1.vd_text1,jdbcType=VARCHAR},#{items1.vd_text2,jdbcType=VARCHAR},#{items1.vd_text3,jdbcType=VARCHAR},#{items1.vd_text4,jdbcType=VARCHAR},
@@ -451,7 +445,7 @@
   <update id="batchUpdate" parameterType="com.usoftchina.saas.money.po.Verificationdet" >
     <foreach collection="list" item="items1" index="index" open="" close="" separator=";">
       update Verificationdet <set>
-      vd_id = #{items1.vd_id},
+      vd_id = #{items1.id},
       vd_vcid = #{items1.vd_vcid},
       vd_detno = #{items1.vd_detno},
       vd_ym = #{items1.vd_ym},
@@ -478,8 +472,15 @@
     delete from verificationdet
     where vd_id = #{vd_vcid,jdbcType=INTEGER}
   </delete>
+  <sql id="subledger_Column_List" >
+    sl_yamount,sl_namount
+  </sql>
   <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
-    select * from verificationdet
+    select
+    <include refid="Base_Column_List" />,
+    <include refid="subledger_Column_List" />
+    from verificationdet left join subledger on sl_id=vd_slid and subledger.companyid=verificationdet.companyId
       where vd_vcid=#{vc_id} order by vd_id
   </select>
+
 </mapper>

+ 17 - 18
applications/money/money-server/src/main/resources/mapper/VerificationdetailMapper.xml

@@ -2,7 +2,7 @@
 <!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.VerificationdetailMapper" >
   <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.Verificationdetail" >
-    <id column="vcd_id" property="vcd_id" jdbcType="INTEGER" />
+    <id column="vcd_id" property="id" jdbcType="INTEGER" />
     <result column="vcd_vcid" property="vcd_vcid" jdbcType="INTEGER" />
     <result column="vcd_detno" property="vcd_detno" jdbcType="INTEGER" />
     <result column="vcd_ym" property="vcd_ym" jdbcType="INTEGER" />
@@ -82,7 +82,8 @@
   </sql>
   <sql id="Base_Column_List" >
     vcd_id, vcd_vcid, vcd_detno, vcd_ym, vcd_slid, vcd_slcode, vcd_slkind, vcd_sldate,
-    vcd_amount, vcd_nowbalance, vcd_remark, companyId, updaterId, updateTime, vcd_text1,
+    vcd_amount, vcd_nowbalance, vcd_remark, Verificationdetail.companyId,
+    Verificationdetail.updaterId, Verificationdetail.updateTime, vcd_text1,
     vcd_text2, vcd_text3, vcd_text4, vcd_text5
   </sql>
   <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.usoftchina.saas.money.po.VerificationdetailExample" >
@@ -116,14 +117,14 @@
     </if>
   </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.money.po.Verificationdetail" >
-    insert into verificationdetail (vcd_id, vcd_vcid, vcd_detno,
+    insert into verificationdetail ( vcd_vcid, vcd_detno,
       vcd_ym, vcd_slid, vcd_slcode,
       vcd_slkind, vcd_sldate, vcd_amount,
       vcd_nowbalance, vcd_remark, companyId,
       updaterId, updateTime, vcd_text1,
       vcd_text2, vcd_text3, vcd_text4,
       vcd_text5)
-    values (#{vcd_id,jdbcType=INTEGER}, #{vcd_vcid,jdbcType=INTEGER}, #{vcd_detno,jdbcType=INTEGER},
+    values ( #{vcd_vcid,jdbcType=INTEGER}, #{vcd_detno,jdbcType=INTEGER},
       #{vcd_ym,jdbcType=INTEGER}, #{vcd_slid,jdbcType=INTEGER}, #{vcd_slcode,jdbcType=VARCHAR},
       #{vcd_slkind,jdbcType=VARCHAR}, #{vcd_sldate,jdbcType=TIMESTAMP}, #{vcd_amount,jdbcType=DOUBLE},
       #{vcd_nowbalance,jdbcType=DOUBLE}, #{vcd_remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER},
@@ -134,9 +135,6 @@
   <insert id="insertSelective" parameterType="com.usoftchina.saas.money.po.Verificationdetail" >
     insert into verificationdetail
     <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="vcd_id != null" >
-        vcd_id,
-      </if>
       <if test="vcd_vcid != null" >
         vcd_vcid,
       </if>
@@ -192,10 +190,7 @@
         vcd_text5,
       </if>
     </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="vcd_id != null" >
-        #{vcd_id,jdbcType=INTEGER},
-      </if>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >-0--0
       <if test="vcd_vcid != null" >
         #{vcd_vcid,jdbcType=INTEGER},
       </if>
@@ -432,15 +427,13 @@
   </update>
   <insert id="batchInsert" parameterType="java.util.List" >
     insert into verificationdetail
-    (
-    vcd_id,vcd_vcid,vcd_detno,vcd_ym,vcd_slid,vcd_slcode,vcd_slkind,vcd_sldate,
+    (vcd_vcid,vcd_detno,vcd_ym,vcd_slid,vcd_slcode,vcd_slkind,vcd_sldate,
     vcd_amount,vcd_nowbalance,vcd_remark,companyId,updaterId,updateTime,vcd_text1,
     vcd_text2,vcd_text3,vcd_text4,vcd_text5
     )
     values
     <foreach collection="list" item="items2" index="index" open="" close="" separator=",">
-      (
-      #{items2.vcd_id,jdbcType=INTEGER},#{items2.vcd_vcid,jdbcType=INTEGER},#{items2.vcd_detno,jdbcType=INTEGER},#{items2.vcd_ym,jdbcType=INTEGER},#{items2.vcd_slid,jdbcType=INTEGER},
+      (#{items2.vcd_vcid,jdbcType=INTEGER},#{items2.vcd_detno,jdbcType=INTEGER},#{items2.vcd_ym,jdbcType=INTEGER},#{items2.vcd_slid,jdbcType=INTEGER},
       #{items2.vcd_slcode,jdbcType=VARCHAR},#{items2.vcd_slkind,jdbcType=VARCHAR},#{items2.vcd_sldate,jdbcType=DATE},#{items2.vcd_amount,jdbcType=DOUBLE},
       #{items2.vcd_nowbalance,jdbcType=DOUBLE},#{items2.vcd_remark,jdbcType=VARCHAR},#{items2.companyId,jdbcType=INTEGER},#{items2.updaterId,jdbcType=INTEGER},#{items2.updateTime,jdbcType=DATE},
       #{items2.vcd_text1,jdbcType=VARCHAR},#{items2.vcd_text2,jdbcType=VARCHAR},#{items2.vcd_text3,jdbcType=VARCHAR},#{items2.vcd_text4,jdbcType=VARCHAR},
@@ -478,8 +471,14 @@
     delete from verificationdetail
     where vcd_id = #{vcd_vcid,jdbcType=INTEGER}
   </delete>
+  <sql id="subledger_Column_List" >
+    sl_yamount,sl_namount
+  </sql>
   <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
-    select * from verificationdetail
-      where vcd_vcid=#{vc_id} order by vcd_id
-  </select>
+  select
+  <include refid="Base_Column_List" />,
+  <include refid="subledger_Column_List" />
+  from verificationdetail left join subledger on sl_id=vcd_slid and subledger.companyid=verificationdetail.companyId
+  where vcd_vcid=#{vc_id} order by vcd_id
+</select>
 </mapper>

+ 14 - 0
applications/purchase/purchase-api/pom.xml

@@ -13,4 +13,18 @@
     <description>purchase server api</description>
 
 
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>purchase-dto</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>core</artifactId>
+        </dependency>
+    </dependencies>
 </project>

+ 14 - 0
applications/purchase/purchase-api/src/main/java/com/usoftchina/saas/purchase/api/PurchaseService.java

@@ -0,0 +1,14 @@
+package com.usoftchina.saas.purchase.api;
+
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+@FeignClient("purchase-server")
+public interface PurchaseService {
+
+    @PostMapping("/purchase/getPurchaseCode")
+    public String getPurchaseCode(@RequestBody DocBaseDTO baseDTO);
+
+}

+ 4 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseController.java

@@ -174,4 +174,8 @@ public class PurchaseController {
         return purchaseService.turnProdin(id);
     }
 
+    @PostMapping("/getPurchaseCode")
+    public String getPurchaseCode(@RequestBody DocBaseDTO baseDTO) {
+        return purchaseService.getPurchaseCode(baseDTO);
+    }
 }

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

@@ -42,6 +42,8 @@ public class PurchaseDetail extends CommonBaseEntity implements Serializable {
 
     private Integer pd_saledetno;
 
+    private Long pd_saleid;
+
     private Integer pd_sdid;
 
     private String pd_text1;

+ 1 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/PurchaseService.java

@@ -136,5 +136,5 @@ public interface PurchaseService extends CommonBaseService<PurchaseMapper, Purch
      */
     Result turnProdin(Long id);
 
-
+    String getPurchaseCode(DocBaseDTO baseDTO);
 }

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

@@ -171,8 +171,6 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             //日志记录
             messageLogService.save(baseDTO);
             return baseDTO;
-        }else{
-            //setUpdateInfo(prodInOut);
         }
         //更新操作
         getMapper().updateByPrimaryKeySelective(prodInOut);
@@ -181,7 +179,6 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
             ProdIODetail detail = BeanMapper.map(item, ProdIODetail.class);
             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);
@@ -438,7 +435,6 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         targetPi.setPi_date(new Date());
         targetPi.setPi_status("未审核");
         targetPi.setPi_statuscode("UNAUDITED");
-        targetPi.setPi_recorddate(new Date());
         targetPi.setPi_vendid(sourcePi.getPi_vendid());
         targetPi.setPi_vendcode(sourcePi.getPi_vendcode());
         targetPi.setPi_vendname(sourcePi.getPi_vendname());
@@ -449,9 +445,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         targetPi.setCompanyId(sourcePi.getCompanyId());
         targetPi.setCreateTime(new Date());
         targetPi.setCreatorId(userId);
-//        targetPi.setCreator(userName);
+        targetPi.setCreatorName(userName);
         targetPi.setUpdaterId(userId);
-//        targetPi.setUpdater(userName);
+        targetPi.setUpdaterName(userName);
         targetPi.setUpdateTime(new Date());
 
         //保存数据
@@ -486,9 +482,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
                  targetPid.setCompanyId(sourcePid.getCompanyId());
                  targetPid.setCreateTime(new Date());
                  targetPid.setCreatorId(userId);
-//                 targetPid.setCreator(userName);
+                 targetPid.setCreatorName(userName);
                  targetPid.setUpdaterId(userId);
-//                 targetPid.setUpdater(userName);
+                 targetPid.setUpdaterName(userName);
                  targetPid.setUpdateTime(new Date());
                  //本次转单数
                  targetPid.setPd_outqty(pdInqty-pdYqty);
@@ -515,7 +511,6 @@ 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());
             //日志

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

@@ -282,8 +282,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
 
         String msg = purchaseMapper.validateBatchUnAudit(baseDTOs.getBaseDTOs());
         if (null != msg) {
-            String message = BizExceptionCode.PURCHASE_ORDER_HASAUDIT.getMessage();
-            int code = BizExceptionCode.PURCHASE_ORDER_HASAUDIT.getCode();
+            String message = BizExceptionCode.PURCHASE_ORDER_HASUNAUDIT.getMessage();
+            int code = BizExceptionCode.PURCHASE_ORDER_HASUNAUDIT.getCode();
             throw new BizException(code, String.format(message, msg));
         }
         for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
@@ -442,9 +442,9 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         prodInOut.setCompanyId(purchase.getCompanyId());
         prodInOut.setCreatorId(userId);
         prodInOut.setCreateTime(new Date());
-//        prodInOut.setCreator(userName);
+        prodInOut.setCreatorName(userName);
         prodInOut.setUpdaterId(userId);
-//        prodInOut.setUpdater(userName);
+        prodInOut.setUpdaterName(userName);
         prodInOut.setUpdateTime(new Date());
         prodInOutMapper.insertSelective(prodInOut);
         //插入验收单从表
@@ -472,10 +472,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 prodIODetail.setCompanyId(purchaseDetail.getCompanyId());
                 prodIODetail.setCreatorId(userId);
                 prodIODetail.setCreateTime(new Date());
-//                prodIODetail.setCreator(userName);
+                prodIODetail.setCreatorName(userName);
                 prodIODetail.setUpdaterId(userId);
                 prodIODetail.setUpdateTime(new Date());
-//                prodIODetail.setUpdater(userName);
+                prodIODetail.setUpdaterName(userName);
                 //本次转单数
                 prodIODetail.setPd_inqty(pdQty-pdYqty);
                 prodIODetailMapper.insertSelective(prodIODetail);
@@ -484,6 +484,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 purchasedetailMapper.updateByPrimaryKeySelective(purchaseDetail);
             }
         }
+        //取默认仓库
+        prodIODetailMapper.getDefaultWarehouseByProduct(pi_id);
         //采购验收单相关计算
         prodInOutService.calcProdInout(pi_id,"采购验收单");
         //日志记录到采购单
@@ -594,7 +596,13 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         }
         return billCode;
     }
-    
+
+    @Override
+    public String getPurchaseCode(DocBaseDTO baseDTO) {
+       String caller = baseDTO.getName();
+       String code = maxnumberService.getMaxnumber(caller, false).getData();
+       return pushMaxnubmer(code, baseDTO.getId());
+    }
     /** 
     * @Description
     * @Param: [id]

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

@@ -47,7 +47,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}@localhost:8500/eureka/
 management:
   endpoints:
     web:

+ 1 - 1
applications/purchase/purchase-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

+ 2 - 2
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdIODetailDTO.java

@@ -52,13 +52,13 @@ public class ProdIODetailDTO implements Serializable {
 
     private Double pd_nettotal;
 
-    private Integer pd_whid;
+    private Long pd_whid;
 
     private String pd_whcode;
 
     private String pd_whname;
 
-    private Integer pd_inwhid;
+    private Long pd_inwhid;
 
     private String pd_inwhcode;
 

+ 2 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/PurchaseDetailDTO.java

@@ -42,6 +42,8 @@ public class PurchaseDetailDTO extends CommonBaseEntity implements Serializable
 
     private Integer pd_saledetno;
 
+    private Long pd_saleid;
+
     private Integer pd_sdid;
 
     private String pd_text1;

+ 4 - 0
applications/sale/sale-server/pom.xml

@@ -88,6 +88,10 @@
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>commons-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>purchase-api</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

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

@@ -50,4 +50,6 @@ public interface SaleMapper extends CommonBaseMapper<Sale> {
     void turnPurchaseDetail(List<PurchaseDetailDTO> list);
 
     Integer selectPurchaseId(@Param("code") String code,@Param("companyid") Long companyid);
+
+    String checkIsTurnPurchase(@Param("id") Long id,@Param("companyid") Long companyid);
 }

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

@@ -19,6 +19,7 @@ import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageDefault;
 import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.purchase.api.PurchaseService;
 import com.usoftchina.saas.sale.dto.*;
 import com.usoftchina.saas.sale.mapper.*;
 import com.usoftchina.saas.sale.po.Sale;
@@ -29,6 +30,7 @@ import com.usoftchina.saas.sale.service.SaleService;
 import com.usoftchina.saas.storage.po.ProdIODetail;
 import com.usoftchina.saas.storage.po.ProdInOut;
 import com.usoftchina.saas.utils.BeanMapper;
+import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -61,6 +63,8 @@ public class SaleServiceImpl implements SaleService{
     private ProdInOutService prodInOutService;
     @Autowired
     private CommonService commonService;
+    @Autowired
+    private PurchaseService purchaseService;
 
     @Override
     public PageInfo<SaleList> getListData(@PageDefault(size = 10) PageRequest page, ListReqDTO req) {
@@ -285,6 +289,12 @@ public class SaleServiceImpl implements SaleService{
         if (num > 0) {
             throw new BizException(BizExceptionCode.SALEOUT_UNAUDIT_ERROR);
         }
+        //检查是否转采购订单
+        String purchaseCode = saleMapper.checkIsTurnPurchase(id,BaseContextHolder.getCompanyId());
+        if (purchaseCode != null && purchaseCode.length()>0){
+            throw new BizException(BizExceptionCode.SALE_EXISTS_PURCHASE.getCode(),
+                    String.format(BizExceptionCode.SALE_EXISTS_PURCHASE.getMessage(),purchaseCode));
+        }
         singleUnAudit(id);
     }
 
@@ -479,7 +489,7 @@ public class SaleServiceImpl implements SaleService{
             //获取物料默认仓库
             Map<String, Object> warehouse = getWareHouseByCode(saleDetail.getSd_prodcode());
             if (null != warehouse) {
-                prodIODetail.setPd_whid(warehouse.get("pr_whid") == null ? 0 : Integer.valueOf(warehouse.get("pr_whid").toString()));
+                prodIODetail.setPd_whid(warehouse.get("pr_whid") == null ? 0 : Long.valueOf(warehouse.get("pr_whid").toString()));
                 prodIODetail.setPd_whcode(warehouse.get("pr_whcode") == null ? null : warehouse.get("pr_whcode").toString());
                 prodIODetail.setPd_whname(warehouse.get("pr_whname") == null ? null : warehouse.get("pr_whname").toString());
             }
@@ -534,12 +544,22 @@ public class SaleServiceImpl implements SaleService{
         Sale sale = saleMapper.selectByPrimaryKey(id);
         List<SaleList> dateilList = saleListMapper.selectSaleListByCondition("sa_id="+id,BaseContextHolder.getCompanyId());
 
+        //判断是否已转采购单
+        String purchaseCode = saleMapper.checkIsTurnPurchase(id,BaseContextHolder.getCompanyId());
+        if (purchaseCode != null && purchaseCode.length()>0){
+            throw new BizException(BizExceptionCode.SALE_EXISTS_PURCHASE.getCode(),
+                    String.format(BizExceptionCode.SALE_EXISTS_PURCHASE.getMessage(),purchaseCode));
+        }
+
         PurchaseDTO purchase = new PurchaseDTO();
         List<PurchaseDetailDTO> listPurchaseDetail = new ArrayList<PurchaseDetailDTO>();
-
+        DocBaseDTO baseDTO = new DocBaseDTO();
         //销售主表转采购主表
-        Result<String> result = maxnumberService.getMaxnumber(BillCodeSeq.PURCHASE.getCaller(),false);
-        purchase.setPu_code(result.getData());
+       // Result<String> result = maxnumberService.getMaxnumber(BillCodeSeq.PURCHASE.getCaller(),false);
+        baseDTO.setId(0l);
+        baseDTO.setName(BillCodeSeq.PURCHASE.getCaller());
+        String result = purchaseService.getPurchaseCode(baseDTO);
+        purchase.setPu_code(result);
         purchase.setPu_status(Status.UNAUDITED.getDisplay());
         purchase.setPu_statuscode(Status.UNAUDITED.toString());
         purchase.setCompanyId(BaseContextHolder.getCompanyId());
@@ -550,35 +570,31 @@ public class SaleServiceImpl implements SaleService{
 
         Long purchaseId = purchase.getId();
         for (SaleList detail : dateilList){
-            PurchaseDetailDTO purchaseDetailDTO = new PurchaseDetailDTO();
+            PurchaseDetailDTO purchaseDetail = new PurchaseDetailDTO();
             Double taxPrice = detail.getPr_purcprice()==null?new Double(0):Double.valueOf(detail.getPr_purcprice());
             Double taxrate = detail.getSd_taxrate()==null?new Double(0):detail.getSd_taxrate();
             Double qty = detail.getSd_qty()==null?new Double(0):detail.getSd_qty();
-            purchaseDetailDTO.setPd_prodid(Long.valueOf(String.valueOf(detail.getSd_prodid())));
-            purchaseDetailDTO.setPd_prodcode(detail.getSd_prodcode());
-            purchaseDetailDTO.setPd_detno(detail.getSd_detno());
-            purchaseDetailDTO.setPd_qty(detail.getSd_qty());
-            purchaseDetailDTO.setPd_price(taxPrice/(1+taxrate));
-            purchaseDetailDTO.setPd_salecode(sale.getSa_code());
-            purchaseDetailDTO.setPd_saledetno(detail.getSd_detno());
-            purchaseDetailDTO.setPd_taxrate(taxrate);
-            purchaseDetailDTO.setPd_taxprice(taxPrice);
-            purchaseDetailDTO.setPd_taxtotal(taxPrice*qty);
-            purchaseDetailDTO.setCompanyId(BaseContextHolder.getCompanyId());
-            purchaseDetailDTO.setCreatorId(BaseContextHolder.getUserId());
-            purchaseDetailDTO.setCreateTime(new Date());
-            purchaseDetailDTO.setCreatorName(BaseContextHolder.getUserName());
-            purchaseDetailDTO.setPd_puid(purchaseId);
-            purchaseDetailDTO.setPd_code(result.getData());
-            listPurchaseDetail.add(purchaseDetailDTO);
+            purchaseDetail.setPd_prodid(Long.valueOf(String.valueOf(detail.getSd_prodid())));
+            purchaseDetail.setPd_prodcode(detail.getSd_prodcode());
+            purchaseDetail.setPd_detno(detail.getSd_detno());
+            purchaseDetail.setPd_qty(detail.getSd_qty());
+            purchaseDetail.setPd_price(taxPrice/(1+taxrate));
+            purchaseDetail.setPd_salecode(sale.getSa_code());
+            purchaseDetail.setPd_saledetno(detail.getSd_detno());
+            purchaseDetail.setPd_saleid(sale.getId());
+            purchaseDetail.setPd_taxrate(taxrate);
+            purchaseDetail.setPd_taxprice(taxPrice);
+            purchaseDetail.setPd_taxtotal(taxPrice*qty);
+            purchaseDetail.setCompanyId(BaseContextHolder.getCompanyId());
+            purchaseDetail.setCreatorId(BaseContextHolder.getUserId());
+            purchaseDetail.setCreateTime(new Date());
+            purchaseDetail.setCreatorName(BaseContextHolder.getUserName());
+            purchaseDetail.setPd_puid(purchaseId);
+            purchaseDetail.setPd_code(result);
+            listPurchaseDetail.add(purchaseDetail);
         }
-
         saleMapper.turnPurchaseDetail(listPurchaseDetail);
-
-
-
-        DocBaseDTO baseDTO = new DocBaseDTO();
-        baseDTO.setCode(result.getData());
+        baseDTO.setCode(result);
         baseDTO.setId(Long.valueOf(String.valueOf(purchaseId)));
         baseDTO.setName(BillCodeSeq.PURCHASE.getName());
         return baseDTO;

+ 1 - 1
applications/sale/sale-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

+ 9 - 3
applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml

@@ -421,7 +421,13 @@
   <update id="updateCreator">
     update sale set creatorId = #{userId} , creatorName=#{userName} where sa_id=#{id}
   </update>
-  
+
+  <select id="checkIsTurnPurchase"  resultType="java.lang.String">
+    select distinct pu_code from purchasedetail left join purchase on pd_puid=pu_id and
+    purchasedetail.companyid = purchase.companyid
+    where pd_saleid = #{id}
+    and purchasedetail.companyid= #{companyid}
+  </select>
   
   
   <!-- 销售订单转采购单-->
@@ -633,7 +639,7 @@
     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_DELIVERY, PD_SALECODE, PD_SALEDETNO,PD_SALEID,
     PD_SDID, companyId, updaterId,
     updateTime, pd_text1, pd_text2,
     pd_text3, pd_text4, pd_text5,
@@ -645,7 +651,7 @@
       #{item.pd_detno,jdbcType=INTEGER}, #{item.pd_prodid,jdbcType=INTEGER}, #{item.pd_prodcode,jdbcType=VARCHAR},
       #{item.pd_unit,jdbcType=VARCHAR}, #{item.pd_qty,jdbcType=DOUBLE}, #{item.pd_price,jdbcType=DOUBLE},#{item.pd_taxprice,jdbcType=DOUBLE},
       #{item.pd_total,jdbcType=DOUBLE},#{item.pd_taxrate,jdbcType=DOUBLE}, #{item.pd_taxtotal,jdbcType=DOUBLE}, #{item.pd_acceptqty,jdbcType=DOUBLE},
-      #{item.pd_delivery,jdbcType=DOUBLE}, #{item.pd_salecode,jdbcType=VARCHAR}, #{item.pd_saledetno,jdbcType=INTEGER},
+      #{item.pd_delivery,jdbcType=DOUBLE}, #{item.pd_salecode,jdbcType=VARCHAR}, #{item.pd_saledetno,jdbcType=INTEGER},#{item.pd_saleid,jdbcType=INTEGER},
       #{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},

+ 1 - 1
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/dto/ProdIODetailDTO.java

@@ -49,7 +49,7 @@ public class ProdIODetailDTO extends CommonBaseDTO implements Serializable {
 
     private Double pd_nettotal;
 
-    private Integer pd_whid;
+    private Long pd_whid;
 
     private String pd_whcode;
 

+ 1 - 1
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/Make.java

@@ -30,7 +30,7 @@ public class Make extends CommonBaseEntity implements Serializable {
 
     private Double ma_qty;
 
-    private Integer ma_whid;
+    private Long ma_whid;
 
     private String ma_whcode;
 

+ 3 - 121
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/MakeMaterial.java

@@ -2,16 +2,16 @@ package com.usoftchina.saas.storage.po;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
 import com.usoftchina.saas.document.dto.ProductDTO;
-import com.usoftchina.saas.document.entities.Product;
+import lombok.Data;
 
 import java.io.Serializable;
-import java.util.Date;
 
 /**
  * 制造单明细
  * @author chenwei
  * @date 2018/10/29
  */
+@Data
 public class MakeMaterial extends CommonBaseEntity implements Serializable {
     private Long mm_maid;
 
@@ -21,7 +21,7 @@ public class MakeMaterial extends CommonBaseEntity implements Serializable {
 
     private String mm_prodcode;
 
-    private Integer mm_whid;
+    private Long mm_whid;
 
     private String mm_whcode;
 
@@ -41,123 +41,5 @@ public class MakeMaterial extends CommonBaseEntity implements Serializable {
 
     private ProductDTO productDTO;
 
-    public String getMm_whname() {
-        return mm_whname;
-    }
 
-    public void setMm_whname(String mm_whname) {
-        this.mm_whname = mm_whname;
-    }
-
-    public ProductDTO getProductDTO() {
-        return productDTO;
-    }
-
-    public void setProductDTO(ProductDTO productDTO) {
-        this.productDTO = productDTO;
-    }
-
-    public Long getMm_maid() {
-        return mm_maid;
-    }
-
-    public void setMm_maid(Long mm_maid) {
-        this.mm_maid = mm_maid;
-    }
-
-    public Integer getMm_detno() {
-        return mm_detno;
-    }
-
-    public void setMm_detno(Integer mm_detno) {
-        this.mm_detno = mm_detno;
-    }
-
-    public Long getMm_prodid() {
-        return mm_prodid;
-    }
-
-    public void setMm_prodid(Long mm_prodid) {
-        this.mm_prodid = mm_prodid;
-    }
-
-    public String getMm_prodcode() {
-        return mm_prodcode;
-    }
-
-    public void setMm_prodcode(String mm_prodcode) {
-        this.mm_prodcode = mm_prodcode == null ? null : mm_prodcode.trim();
-    }
-
-    public Integer getMm_whid() {
-        return mm_whid;
-    }
-
-    public void setMm_whid(Integer mm_whid) {
-        this.mm_whid = mm_whid;
-    }
-
-    public String getMm_whcode() {
-        return mm_whcode;
-    }
-
-    public void setMm_whcode(String mm_whcode) {
-        this.mm_whcode = mm_whcode == null ? null : mm_whcode.trim();
-    }
-
-    public Double getMm_price() {
-        return mm_price;
-    }
-
-    public void setMm_price(Double mm_price) {
-        this.mm_price = mm_price;
-    }
-
-    public Double getMm_oneuseqty() {
-        return mm_oneuseqty;
-    }
-
-    public void setMm_oneuseqty(Double mm_oneuseqty) {
-        this.mm_oneuseqty = mm_oneuseqty;
-    }
-
-    public Double getMm_qty() {
-        return mm_qty;
-    }
-
-    public void setMm_qty(Double mm_qty) {
-        this.mm_qty = mm_qty;
-    }
-
-    public Double getMm_amount() {
-        return mm_amount;
-    }
-
-    public void setMm_amount(Double mm_amount) {
-        this.mm_amount = mm_amount;
-    }
-
-    public String getMm_repprodcode() {
-        return mm_repprodcode;
-    }
-
-    public void setMm_repprodcode(String mm_repprodcode) {
-        this.mm_repprodcode = mm_repprodcode == null ? null : mm_repprodcode.trim();
-    }
-
-    public String getMm_remark() {
-        return mm_remark;
-    }
-
-    public void setMm_remark(String mm_remark) {
-        this.mm_remark = mm_remark == null ? null : mm_remark.trim();
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
 }

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

@@ -45,13 +45,13 @@ public class ProdIODetail extends CommonBaseEntity implements Serializable {
 
     private Double pd_nettotal;
 
-    private Integer pd_whid;
+    private Long pd_whid;
 
     private String pd_whcode;
 
     private String pd_whname;
 
-    private Integer pd_inwhid;
+    private Long pd_inwhid;
 
     private String pd_inwhcode;
 

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

@@ -7,7 +7,7 @@ import java.io.Serializable;
 @Data
 public class StockTaking extends CommonBaseEntity implements Serializable {
 
-    private Integer st_prodid;
+    private Long st_prodid;
 
     private String st_prodcode;
 
@@ -19,7 +19,7 @@ public class StockTaking extends CommonBaseEntity implements Serializable {
 
     private String st_produnit;
 
-    private Integer st_whid;
+    private Long st_whid;
 
     private String st_whcode;
 

+ 28 - 2
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/controller/StocktakingController.java

@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/stocktaking")
@@ -22,6 +23,17 @@ public class StocktakingController {
     @Autowired
     private StocktakingService stocktakingService;
 
+    /**
+     * 生成临时表数据
+     * @param page
+     * @param listReqDTO
+     * @return
+     */
+    @PostMapping("/build")
+    public Result buildListDataByCondition(@RequestBody ListReqDTO listReqDTO){
+        stocktakingService.buildListDataByCondition(listReqDTO);
+        return Result.success();
+    }
 
 
     /**
@@ -35,8 +47,11 @@ public class StocktakingController {
         return Result.success(stocktakingService.getList(page, listReqDTO));
     }
 
-
-
+    /**
+     * 保存
+     * @param list
+     * @return
+     */
     @PostMapping("/save")
     public Result save(@RequestBody List<StockTakingDTO> list){
         DocBaseDTO docBaseDTO = stocktakingService.saveOrUpdate(list);
@@ -44,6 +59,17 @@ public class StocktakingController {
     }
 
 
+    /**
+     * 生成盘点单据
+     * @param list
+     * @return
+     */
+    @GetMapping("/stock")
+    public Result stock(){
+        Map<String,Object> map = stocktakingService.stock();
+        return Result.success(map);
+    }
+
 
 
 }

+ 1 - 1
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/MakeMapper.java

@@ -26,7 +26,7 @@ public interface MakeMapper extends CommonBaseMapper<Make> {
 
     int validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long company);
 
-    Double getOnHand(@Param("prodid") Long prodid, @Param("whid") Integer whid, @Param("companyId") Long companyId);
+    Double getOnHand(@Param("prodid") Long prodid, @Param("whid") Long whid, @Param("companyId") Long companyId);
 
     ProdInOut selectMakeInOutCode(@Param("code") String code, @Param("companyId") Long companyId, @Param("type") String type);
 

+ 7 - 1
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/mapper/StockTakingMapper.java

@@ -15,5 +15,11 @@ public interface StockTakingMapper extends CommonBaseMapper<StockTaking> {
 
     int updateByPrimaryKeySelective(StockTaking record);
 
-    List<StockTaking> selectStockTakingBycondition(@Param("con") String con, @Param("companyId") Long companyId);
+    List<StockTaking> selectStockTakingBycondition(@Param("con") String con,@Param("companyId") Long companyId);
+
+    void deleteByCompany(@Param("companyId") Long companyId);
+
+    void insertFormProductWh(@Param("con") String con,@Param("companyId") Long companyId);
+
+    Double getPurcpriceByProduct(Long id);
 }

+ 5 - 0
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/StocktakingService.java

@@ -11,10 +11,15 @@ import com.usoftchina.saas.storage.mapper.StockTakingMapper;
 import com.usoftchina.saas.storage.po.StockTaking;
 
 import java.util.List;
+import java.util.Map;
 
 public interface StocktakingService extends CommonBaseService<StockTakingMapper, StockTaking> {
 
     PageInfo<StockTaking>  getList(PageRequest page, ListReqDTO listReqDTO);
 
     DocBaseDTO saveOrUpdate(List<StockTakingDTO> list);
+
+    void buildListDataByCondition(ListReqDTO listReqDTO);
+
+    Map<String,Object> stock();
 }

+ 1 - 1
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/MakeServiceImpl.java

@@ -177,7 +177,7 @@ public class MakeServiceImpl extends CommonBaseServiceImpl<MakeMapper, Make> imp
                 double qty = makeMaterial.getMm_qty()==null?0:makeMaterial.getMm_qty();
                 double onHand = 0;
                 try {
-                    onHand = getMapper().getOnHand(make.getMa_prodid(),make.getMa_whid(), BaseContextHolder.getCompanyId());
+                    onHand = getMapper().getOnHand(makeMaterial.getMm_prodid(),makeMaterial.getMm_whid(), BaseContextHolder.getCompanyId());
                 }catch (Exception e){
                     String msg = BizExceptionCode.UNENOUGH_DETAIL_STOCK.getMessage();
                     int code = BizExceptionCode.SALE_ORDER_HASAUDIT.getCode();

+ 156 - 2
applications/storage/storage-server/src/main/java/com/usoftchina/saas/storage/service/impl/StocktakingServiceImpl.java

@@ -3,19 +3,31 @@ package com.usoftchina.saas.storage.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.MaxnumberService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.storage.dto.StockTakingDTO;
+import com.usoftchina.saas.storage.mapper.ProdIODetailMapper;
+import com.usoftchina.saas.storage.mapper.ProdInOutMapper;
 import com.usoftchina.saas.storage.mapper.StockTakingMapper;
+import com.usoftchina.saas.storage.po.ProdIODetail;
+import com.usoftchina.saas.storage.po.ProdInOut;
 import com.usoftchina.saas.storage.po.StockTaking;
 import com.usoftchina.saas.storage.service.StocktakingService;
 import com.usoftchina.saas.utils.BeanMapper;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by zdw
@@ -24,6 +36,15 @@ import java.util.List;
 @Service
 public class StocktakingServiceImpl extends CommonBaseServiceImpl<StockTakingMapper, StockTaking> implements StocktakingService {
 
+    @Autowired
+    private MaxnumberService maxnumberService;
+    @Autowired
+    private ProdInOutMapper prodInOutMapper;
+    @Autowired
+    private ProdIODetailMapper prodIODetailMapper;
+
+
+
     @Override
     public PageInfo<StockTaking> getList(PageRequest page, ListReqDTO listReqDTO) {
         PageHelper.startPage(page.getNumber(), page.getSize());
@@ -44,14 +65,147 @@ public class StocktakingServiceImpl extends CommonBaseServiceImpl<StockTakingMap
         return baseDTO;
     }
 
-    private List<StockTaking> getList(ListReqDTO listReqDTO) {
+    @Override
+    @Transactional
+    public void buildListDataByCondition(ListReqDTO listReqDTO) {
         List<StockTaking> list = null;
         Long companyId = BaseContextHolder.getCompanyId();
         String con = listReqDTO.getFinalCondition();
+        //删除该companyid的数据
+        getMapper().deleteByCompany(companyId);
         if (null == con) {
             con = "1=1";
         }
-        list = getMapper().selectStockTakingBycondition(con,companyId);
+        //查询存入临时表
+        getMapper().insertFormProductWh(con,companyId);
+    }
+
+    @Override
+    @Transactional
+    public Map<String,Object> stock() {
+        Map<String,Object> resultMap = new HashMap();
+
+        Long companyId = BaseContextHolder.getCompanyId();
+        Long userId = BaseContextHolder.getUserId();
+        //生成入库单
+        ProdInOut prodIn = new ProdInOut();
+        String piInno = getMaxnumber(BillCodeSeq.OTHERIN);
+        prodIn.setPi_inoutno(piInno);
+        prodIn.setPi_class(BillCodeSeq.OTHERIN.getName());
+        prodIn.setPi_date(new Date());
+        prodIn.setPi_status("未审核");
+        prodIn.setPi_statuscode("UNAUDITED");
+        prodIn.setCompanyId(companyId);
+        prodIn.setCreateTime(new Date());
+        prodIn.setCreatorId(userId);
+        prodIn.setPi_remark("盘盈单");
+        prodInOutMapper.insertSelective(prodIn);
+        long inid = prodIn.getId();
+
+        Double purcprice = null;
+
+        List<StockTaking> inlist  = getMapper().selectStockTakingBycondition("st_num>0",companyId);
+        for (int i=0;i<inlist.size();i++) {
+            StockTaking st = inlist.get(i);
+            ProdIODetail prodInDetail = new ProdIODetail();
+            prodInDetail.setPd_piid(inid);
+            prodInDetail.setPd_inoutno(piInno);
+            prodInDetail.setPd_piclass(BillCodeSeq.OTHERIN.getName());
+            prodInDetail.setPd_pdno(i+1);
+
+            purcprice = getMapper().getPurcpriceByProduct(st.getSt_prodid());
+            prodInDetail.setPd_orderprice(purcprice==null?0:purcprice);
+            prodInDetail.setPd_prodid(st.getSt_prodid());
+            prodInDetail.setPd_prodcode(st.getSt_prodcode());
+            prodInDetail.setPd_inqty(st.getSt_num());
+            //仓库
+            prodInDetail.setPd_whid(st.getSt_whid());
+            prodInDetail.setPd_whcode(st.getSt_whcode());
+            prodInDetail.setPd_whname(st.getSt_whname());
+            prodInDetail.setCompanyId(companyId);
+            prodInDetail.setCreateTime(new Date());
+            prodInDetail.setCreatorId(userId);
+            prodIODetailMapper.insertSelective(prodInDetail);
+        }
+
+        //生成出库单
+        ProdInOut prodOut = new ProdInOut();
+        String piOutno = getMaxnumber(BillCodeSeq.OTHEROUT);
+        prodOut.setPi_inoutno(piOutno);
+        prodOut.setPi_class(BillCodeSeq.OTHEROUT.getName());
+        prodOut.setPi_date(new Date());
+        prodOut.setPi_status("未审核");
+        prodOut.setPi_statuscode("UNAUDITED");
+        prodOut.setCompanyId(companyId);
+        prodOut.setCreateTime(new Date());
+        prodOut.setCreatorId(userId);
+        prodOut.setPi_remark("盘亏单");
+        prodInOutMapper.insertSelective(prodOut);
+        long outid = prodOut.getId();
+
+        List<StockTaking> outlist  = getMapper().selectStockTakingBycondition("st_num<0",companyId);
+        for (int i=0;i<outlist.size();i++) {
+            StockTaking st = outlist.get(i);
+            ProdIODetail prodOutDetail = new ProdIODetail();
+            prodOutDetail.setPd_piid(outid);
+            prodOutDetail.setPd_inoutno(piOutno);
+            prodOutDetail.setPd_piclass(BillCodeSeq.OTHERIN.getName());
+            prodOutDetail.setPd_pdno(i+1);
+            prodOutDetail.setPd_prodid(st.getSt_prodid());
+            prodOutDetail.setPd_prodcode(st.getSt_prodcode());
+            prodOutDetail.setPd_outqty(-st.getSt_num());
+            //仓库
+            prodOutDetail.setPd_whid(st.getSt_whid());
+            prodOutDetail.setPd_whcode(st.getSt_whcode());
+            prodOutDetail.setPd_whname(st.getSt_whname());
+            prodOutDetail.setCompanyId(companyId);
+            prodOutDetail.setCreateTime(new Date());
+            prodOutDetail.setCreatorId(userId);
+            prodIODetailMapper.insertSelective(prodOutDetail);
+        }
+        DocBaseDTO baseDTOIN = new DocBaseDTO(inid,piInno,"其它入库单");
+        DocBaseDTO baseDTOOUT = new DocBaseDTO(outid,piOutno,"其它出库单");
+        resultMap.put("inData",baseDTOIN);
+        resultMap.put("outData",baseDTOOUT);
+        return resultMap;
+    }
+
+    private List<StockTaking> getList(ListReqDTO listReqDTO) {
+        List<StockTaking> list = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        list = getMapper().selectStockTakingBycondition(null,companyId);
         return list;
     }
+
+
+    public String getMaxnumber(BillCodeSeq bill) {
+        String code = maxnumberService.getMaxnumber(bill.getCaller(), false).getData();
+        DocBaseDTO base = new DocBaseDTO(0l, code, bill.getName());
+        return pushMaxnubmer(base);
+    }
+
+    public String pushMaxnubmer(DocBaseDTO baseDTO) {
+        String pi_inoutno = baseDTO.getCode();
+        String pi_class = baseDTO.getName();
+        Long id = baseDTO.getId();
+        if (null == pi_inoutno) {
+            throw new BizException(BizExceptionCode.NULL_CODE);
+        }
+        Long companyId = BaseContextHolder.getCompanyId();
+        String billCode = null;
+        synchronized (ProdInOutServiceImpl.class) {
+            Integer count = "0".equals(String.valueOf(id)) ? prodInOutMapper.validateCodeWhenInsert(pi_inoutno, companyId) :
+                    prodInOutMapper.validateCodeWhenUpdate(pi_inoutno, id, companyId);
+            String caller ="";
+            if("其它入库单".equals(pi_class)){
+                caller = BillCodeSeq.OTHERIN.getCaller();
+            }else if("其它出库单".equals(pi_class)) {
+                caller = BillCodeSeq.OTHEROUT.getCaller();
+            }
+            billCode = maxnumberService.pushMaxnubmer(count, pi_inoutno, caller).getData();
+        }
+        return billCode;
+    }
+
+
 }

+ 1 - 1
applications/storage/storage-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

+ 18 - 1
applications/storage/storage-server/src/main/resources/mapper/StockTakingMapper.xml

@@ -238,11 +238,28 @@
         ${con}
       </if>
       <if test="companyId != null">
-        and  companyId = #{companyId}
+      and companyId = #{companyId}
       </if>
+
     </where>
     order by st_id desc
   </select>
 
+  <delete id="deleteByCompany" parameterType="long">
+    delete from stocktaking
+    where companyId = #{companyId,jdbcType=INTEGER}
+  </delete>
+
+  <insert id="insertFormProductWh">
+    insert into stocktaking (st_prodid,st_prodcode,st_proddetail,st_prodorispeccode,st_prodkind,st_produnit,st_whid,st_whcode,st_whname,st_batchqty,companyId)
+    select pr_id,pr_code,pr_detail,pr_orispeccode,pr_kind,pr_unit,wh_id,wh_code,wh_description,pw_onhand,#{companyId} from productwh left join product on pw_prodid = pr_id  left join warehouse on pw_whid = wh_id
+    where productwh.companyid=#{companyId,jdbcType=INTEGER} and product.companyid =#{companyId,jdbcType=INTEGER} and warehouse.companyId=#{companyId,jdbcType=INTEGER}
+    and ${con}
+  </insert>
+
+  <select id="getPurcpriceByProduct"  resultType="double">
+    select pr_purcprice from product where pr_id = #{id}
+  </select>
+
 
 </mapper>

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

@@ -15,6 +15,7 @@ public class AccountRegDTO implements Serializable {
     private String realname;
     private String email;
     private String mobile;
+    private String uu;
     /**
      * 账号类型 0 - 管理员
      */
@@ -25,6 +26,14 @@ public class AccountRegDTO implements Serializable {
     private String avatarUrl;
     private Long companyId;
 
+    public String getUu() {
+        return uu;
+    }
+
+    public void setUu(String uu) {
+        this.uu = uu;
+    }
+
     public String getUsername() {
         return username;
     }

+ 25 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/BindCompanyDTO.java

@@ -0,0 +1,25 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+
+public class BindCompanyDTO implements Serializable {
+
+    private Long companyId;
+    private Long accountId;
+
+    public Long getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Long companyId) {
+        this.companyId = companyId;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    public void setAccountId(Long accountId) {
+        this.accountId = accountId;
+    }
+}

+ 42 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyAccountDTO.java

@@ -0,0 +1,42 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+
+/**
+ * 公司+账户 传输对象, 用于开通企业时的企业信息及管理员信息完善
+ */
+public class CompanyAccountDTO implements Serializable {
+
+    private CompanyRegDTO companyRegDTO;
+    private AccountRegDTO accountRegDTO;
+    /**
+     * 操作类型
+     *  0: 创建企业
+     *  1: 开通SAAS
+     */
+    private String type;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public CompanyRegDTO getCompanyRegDTO() {
+        return companyRegDTO;
+    }
+
+    public void setCompanyRegDTO(CompanyRegDTO companyRegDTO) {
+        this.companyRegDTO = companyRegDTO;
+    }
+
+    public AccountRegDTO getAccountRegDTO() {
+        return accountRegDTO;
+    }
+
+    public void setAccountRegDTO(AccountRegDTO accountRegDTO) {
+        this.accountRegDTO = accountRegDTO;
+    }
+}

+ 17 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyListDTO.java

@@ -0,0 +1,17 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class CompanyListDTO implements Serializable {
+
+    private List<CompanyBaseDTO> companies;
+
+    public List<CompanyBaseDTO> getCompanies() {
+        return companies;
+    }
+
+    public void setCompanies(List<CompanyBaseDTO> companies) {
+        this.companies = companies;
+    }
+}

+ 76 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyRspDTO.java

@@ -0,0 +1,76 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+
+public class CompanyRspDTO implements Serializable {
+
+    private Long id;
+    /**
+     * 唯一名称
+     */
+    private String name;
+    /**
+     * 商业登记证号
+     */
+    private String businessCode;
+    private String address;
+    private boolean default_;
+    private boolean saas_;
+    private String uu;
+
+    public String getUu() {
+        return uu;
+    }
+
+    public void setUu(String uu) {
+        this.uu = uu;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public boolean isSaas_() {
+        return saas_;
+    }
+
+    public void setSaas_(boolean saas_) {
+        this.saas_ = saas_;
+    }
+
+    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 boolean isDefault_() {
+        return default_;
+    }
+
+    public void setDefault_(boolean default_) {
+        this.default_ = default_;
+    }
+}

+ 9 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/PowerDTO.java

@@ -6,6 +6,7 @@ public class PowerDTO {
     private Long groupId;
     private String moduleName;
     private String groupName;
+    private Long moduleId;
     private Boolean query;
     private Boolean add;
     private Boolean update;
@@ -17,6 +18,14 @@ public class PowerDTO {
     private Boolean fileImport;
     private List<OtherPowerDTO> other;
 
+    public Long getModuleId() {
+        return moduleId;
+    }
+
+    public void setModuleId(Long moduleId) {
+        this.moduleId = moduleId;
+    }
+
     public Long getGroupId() {
         return groupId;
     }

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

@@ -0,0 +1,49 @@
+package com.usoftchina.saas.account.controller;
+
+import com.usoftchina.saas.account.dto.BindCompanyDTO;
+import com.usoftchina.saas.account.dto.CompanyAccountDTO;
+import com.usoftchina.saas.account.dto.CompanyListDTO;
+import com.usoftchina.saas.account.service.AccountCenterService;
+import com.usoftchina.saas.base.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/accountCenter")
+public class AccountCenterController {
+
+    @Autowired
+    private AccountCenterService accountCenterService;
+
+    /**
+     * 信息完善界面   保存接口
+     * @param companyAccountDTO
+     * @return
+     */
+    @PostMapping("/companyAccount/save")
+    public Result saveCompanyAccount(@RequestBody CompanyAccountDTO companyAccountDTO){
+        return Result.success(accountCenterService.saveCompanyAccount(companyAccountDTO));
+    }
+
+    /**
+     * 获取企业信息列表
+     * @param mobile      用户UU号
+     * @return
+     */
+    @GetMapping("/company/list")
+    public Result companyList(@RequestParam("mobile") String mobile){
+        return Result.success(accountCenterService.getCompanyList(mobile));
+    }
+
+    /**
+     * 绑定默认企业
+     * @param bindCompanyDTO
+     * @return
+     */
+    @PostMapping("/bind/defaultCompany")
+    public Result bindDefaultCompany(@RequestBody BindCompanyDTO bindCompanyDTO){
+        accountCenterService.bindDefaultCompany(bindCompanyDTO.getCompanyId(), bindCompanyDTO.getAccountId());
+        return Result.success();
+    }
+
+}

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

@@ -1,7 +1,10 @@
 package com.usoftchina.saas.account.mapper;
 
+import com.usoftchina.saas.account.dto.CompanyRspDTO;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * @author yingp
  * @date 2018/10/10
@@ -41,4 +44,26 @@ public interface AccountCompanyMapper {
      * @return
      */
     int deleteByCompanyId(@Param("companyId") Long companyId);
+
+    /**
+     * 通过账户UU号查询企业列表
+     * @param mobile
+     * @return
+     */
+    List<CompanyRspDTO> getCompanyListByAccountMobile(@Param("mobile") String mobile);
+
+    /**
+     * 解除账户绑定的默认企业
+     * @param accountId
+     * @return
+     */
+    boolean unBindDefault(@Param("accountId") Long accountId);
+
+    /**
+     *
+     * @param accountId
+     * @param companyId
+     * @return
+     */
+    boolean bindDefault(@Param("accountId") Long accountId, @Param("companyId") Long companyId);
 }

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

@@ -8,6 +8,23 @@ public class PowerInfo implements Serializable {
     private Long groupId;
     private String groupName;
     private String moduleName;
+    private Long moduleId;
+
+    public Long getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(Long groupId) {
+        this.groupId = groupId;
+    }
+
+    public Long getModuleId() {
+        return moduleId;
+    }
+
+    public void setModuleId(Long moduleId) {
+        this.moduleId = moduleId;
+    }
 
     public String getClassify() {
         return classify;

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

@@ -0,0 +1,33 @@
+package com.usoftchina.saas.account.service;
+
+import com.usoftchina.saas.account.dto.CompanyAccountDTO;
+import com.usoftchina.saas.account.dto.CompanyListDTO;
+import com.usoftchina.saas.account.dto.CompanyRspDTO;
+import com.usoftchina.saas.base.Result;
+
+import java.util.List;
+
+public interface AccountCenterService {
+
+    /**
+     * 企业账户信息完善 保存
+     * @param companyAccountDTO
+     * @return
+     */
+    Result saveCompanyAccount(CompanyAccountDTO companyAccountDTO);
+
+    /**
+     * 获取企业信息列表
+     * @param mobile
+     * @return
+     */
+    List<CompanyRspDTO> getCompanyList(String mobile);
+
+    /**
+     * 更新默认企业
+     * @param companyId
+     * @param accountId
+     * @return
+     */
+    boolean bindDefaultCompany(Long companyId, Long accountId);
+}

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

@@ -0,0 +1,126 @@
+package com.usoftchina.saas.account.service.impl;
+
+import com.usoftchina.saas.account.dto.*;
+import com.usoftchina.saas.account.mapper.AccountCompanyMapper;
+import com.usoftchina.saas.account.po.Account;
+import com.usoftchina.saas.account.po.Company;
+import com.usoftchina.saas.account.service.AccountCenterService;
+import com.usoftchina.saas.account.service.AccountService;
+import com.usoftchina.saas.account.service.CompanyService;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.exception.ExceptionCode;
+import com.usoftchina.saas.utils.BeanMapper;
+import com.usoftchina.saas.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class AccountCenterServiceImpl implements AccountCenterService {
+
+    @Autowired
+    private CompanyService companyService;
+    @Autowired
+    private AccountService accountService;
+    @Autowired
+    private AccountCompanyMapper accountCompanyMapper;
+
+    private final String ACCOUNTCNETER_URL_DEV = "http://192.168.253.12:32323";
+    //private final String ACCOUNTCNETER_URL_PROD = "https://sso.ubtob.com";
+
+    @Override
+    @Transactional
+    public Result saveCompanyAccount(CompanyAccountDTO companyAccountDTO) {
+        CompanyRegDTO companyRegDTO = companyAccountDTO.getCompanyRegDTO();
+        AccountRegDTO accountRegDTO = companyAccountDTO.getAccountRegDTO();
+        String type = companyAccountDTO.getType();
+        Long accountId = accountService.findByMobile(accountRegDTO.getMobile()).getId();
+        //1.保存企业信息
+        //a. 判断是否已注册
+        Company company = companyService.findByName(companyRegDTO.getName());
+        if (null != company) {
+            return Result.error(ExceptionCode.COMPANY_NAME_EXIST);
+        }
+        company = companyService.findByBusinessCode(companyRegDTO.getBusinessCode());
+        if (null != company) {
+            return Result.error(ExceptionCode.COMPANY_CODE_EXIST);
+        }
+        company = BeanMapper.map(companyRegDTO, Company.class);
+        //生成随机 营业执照号
+        if (StringUtils.isEmpty(company.getBusinessCode())){
+            company.setBusinessCode(StringUtils.createBusinessCode());
+        }
+        companyService.save(company);
+        //b. 同步企业信息到优软云 ——>  创建企业
+        if ("0".equals(type)) {
+            String result = postToAccount(company.getName(), company.getBusinessCode(), accountRegDTO.getUu());
+            accountCompanyMapper.insert(accountId, company.getId());
+        }
+        //2.更新账户信息
+        Account account = BeanMapper.map(accountRegDTO, Account.class);
+
+        account.setId(accountId);
+        accountService.updateByPrimaryKeySelective(account);
+        return null;
+    }
+
+    /**
+     * 将企业信息同步到优软云
+     * @param spaceName
+     * @param businesscode
+     * @param uu
+     * @return
+     */
+    private String postToAccount(String spaceName, String businesscode, String uu) {
+        String url = "/sso/userspace/register/admin";
+        RestTemplate restTemplate = new RestTemplate();
+        MultiValueMap<String, String> requestEntity = new LinkedMultiValueMap<>();
+        requestEntity.add("spaceName", spaceName);
+        requestEntity.add("businessCode", businesscode);
+        requestEntity.add("userUU", uu);
+        String result = restTemplate.postForObject(ACCOUNTCNETER_URL_DEV + url, requestEntity, String.class);
+        return result;
+    }
+
+    @Override
+    public List<CompanyRspDTO> getCompanyList(String mobile) {
+        List<CompanyRspDTO> result = new ArrayList<CompanyRspDTO>();
+        //1、获取本SAAS系统的企业信息
+        List<CompanyRspDTO> companyRspDTOList = accountCompanyMapper.getCompanyListByAccountMobile(mobile);
+        //如果只有一条记录,将该企业设置为默认企业
+        if (companyRspDTOList.size() == 1 && !companyRspDTOList.get(0).isDefault_()){
+            Long accountId = accountService.findByMobile(mobile).getId();
+            Long companyId = companyRspDTOList.get(0).getId();
+            accountCompanyMapper.bindDefault(accountId, companyId);
+        }
+        result.addAll(companyRspDTOList);
+        //2、优软云返回的企业信息
+        //TODO 通过接口获取优软云的企业信息
+
+        //3、去重复
+        /*for (CompanyRspDTO companyRspDTO : companyRspDTOList){
+            for (CompanyBaseDTO companyBaseDTO : companyBaseDTOList){
+                if (companyRspDTO.getName().equals(companyBaseDTO.getName())){
+                    companyBaseDTOList.remove(companyRspDTO);
+                }
+            }
+        }
+        List<CompanyRspDTO> companyBaseRspDTOList = BeanMapper.mapList(companyBaseDTOList, CompanyRspDTO.class);
+        result.addAll(companyBaseRspDTOList);*/
+        return result;
+    }
+
+    @Override
+    public boolean bindDefaultCompany(Long companyId, Long accountId) {
+        accountCompanyMapper.unBindDefault(accountId);
+        accountCompanyMapper.bindDefault(accountId, companyId);
+        return true;
+    }
+
+}

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

@@ -100,6 +100,7 @@ public class RoleServiceImpl extends CommonBaseServiceImpl<RoleMapper, Role> imp
             powerDTO.setGroupId(powerInfo.getGrougId());
             powerDTO.setModuleName(powerInfo.getModuleName());
             powerDTO.setGroupName(powerInfo.getGroupName());
+            powerDTO.setModuleId(powerInfo.getModuleId());
             //赋值默认权限,在权限列表中的资源默认置为false
             setPowerValue(powerDTO, powerInfo.getClassify(), false);
             //赋值权限
@@ -166,7 +167,7 @@ public class RoleServiceImpl extends CommonBaseServiceImpl<RoleMapper, Role> imp
     private void setOtherPower(PowerDTO powerDTO, Long groupId, Long roleId, List<OtherPower> otherPowerList) {
         List<OtherPower> otherPowers = new ArrayList<OtherPower>();
         for (OtherPower otherPower : otherPowerList){
-            if (groupId.equals(otherPower.getGroupId())){
+            if (groupId.equals(otherPower.getGroupId()) && roleId.equals(otherPower.getRoleId())){
                 otherPowers.add(otherPower);
             }
         }
@@ -180,7 +181,6 @@ public class RoleServiceImpl extends CommonBaseServiceImpl<RoleMapper, Role> imp
             switch (array[i]){
                 case "QUERY":
                     powerDTO.setQuery(status);
-                    powerDTO.setFileExport(status);
                     break;
                 case "ADD":
                     powerDTO.setAdd(status);

+ 1 - 1
base-servers/account/account-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}@127.0.0.1:8500/eureka/
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8510/eureka/
 server:
   port: 8580
   tomcat:

+ 1 - 1
base-servers/account/account-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

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

@@ -13,4 +13,16 @@
     <delete id="deleteByCompanyId" parameterType="java.lang.Long">
         delete from ac_account_company where company_id=#{companyId}
     </delete>
+    <select id="getCompanyListByAccountMobile" resultType="com.usoftchina.saas.account.dto.CompanyRspDTO">
+        SELECT cmp.id,cmp.name,cmp.uu,cmp.business_code businessCode,cmp.address,accmp.is_default default_,'1' saas_ from ac_company cmp
+        left join ac_account_company accmp on accmp.company_id=cmp.id
+        left join ac_account ac on ac.id = accmp.account_id
+        where ac.mobile = #{mobile};
+    </select>
+    <update id="unBindDefault" >
+        UPDATE AC_ACCOUNT_COMPANY SET IS_DEFAULT = 0 WHERE ACCOUNT_ID = #{accountId}
+    </update>
+    <update id="bindDefault" >
+        UPDATE AC_ACCOUNT_COMPANY SET IS_DEFAULT = 1 WHERE ACCOUNT_ID = #{accountId} AND COMPANY_ID = #{companyId}
+    </update>
 </mapper>

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

@@ -172,7 +172,7 @@
                 updater_id=#{updaterId,jdbcType=BIGINT},
             </if>
             <if test="updateTime != null">
-                update_time=#{updateTime,jdbcType=TIMESTAMP})
+                update_time=#{updateTime,jdbcType=TIMESTAMP}
             </if>
         </set>
         where id=#{id,jdbcType=BIGINT}

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

@@ -28,6 +28,9 @@
     </sql>
     <insert id="insert" parameterType="com.usoftchina.saas.account.po.Company"
             useGeneratedKeys="true" keyProperty="id">
+        <selectKey resultType="java.lang.Long" keyProperty="id">
+            SELECT LAST_INSERT_ID() AS ID
+        </selectKey>
         insert into ac_company(name, business_code, address, logo_url, creator_id, create_time, updater_id, update_time,
         tel, fax, signet, uu)
         values (#{name,jdbcType=VARCHAR}, #{businessCode,jdbcType=VARCHAR},

+ 5 - 4
base-servers/account/account-server/src/main/resources/mapper/RoleResourceMapper.xml

@@ -32,12 +32,13 @@
         GROUP BY GROUP_ID
     </select>
     <select id="selectPowerInfo" parameterType="java.lang.Long" resultType="com.usoftchina.saas.account.po.PowerInfo">
-        SELECT GROUP_CONCAT(classify) classify,group_id groupId,groupname,modulename FROM (
-          SELECT classify,group_id,s.name groupname,M.NAME modulename FROM AC_RESOURCE R
+        SELECT GROUP_CONCAT(classify) classify,group_id groupId,groupname,moduleId,modulename FROM (
+          SELECT classify,group_id,s.name groupname,M.NAME modulename,M.id moduleId FROM AC_RESOURCE R
 				LEFT JOIN AC_RESOURCE_GROUP S ON R.GROUP_ID = S.ID
 				LEFT JOIN AC_RESOURCE_MODULE M ON S.MODULE_ID = M.ID
-          GROUP BY GROUP_ID,CLASSIFY,s.name,M.NAME) A
-        GROUP BY GROUP_ID,groupname,modulename
+          GROUP BY GROUP_ID,CLASSIFY,s.name,M.NAME,M.id) A
+        GROUP BY GROUP_ID,groupname,modulename,moduleId
+		ORDER BY MODULEID
     </select>
     <resultMap id="OtherPowerResultMap" type="com.usoftchina.saas.account.po.OtherPower">
         <result column="name" property="name" jdbcType="VARCHAR" />

+ 1 - 1
base-servers/admin-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

+ 1 - 1
base-servers/auth/auth-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

+ 1 - 1
base-servers/eureka-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

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

@@ -86,6 +86,6 @@ fdfs:
     width: 150
     height: 150
   tracker-list:
-    - 192.168.253.3:22122
+    - 192.168.0.63:22122
 file:
-  base-url: http://192.168.253.3:8888/
+  base-url: http://192.168.0.63:8888/

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

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

+ 1 - 1
base-servers/gateway-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

+ 1 - 1
base-servers/mail/mail-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

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

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

+ 1 - 1
base-servers/ui-server/src/main/resources/logback-spring.xml

@@ -28,7 +28,7 @@
     <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"/>
+    <springProperty scope="context" name="log.destination" source="logging.destination" defaultValue="192.168.0.63:5000"/>
 
     <contextName>${spring.application.name}-${spring.profiles.active}-logback</contextName>
 

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

@@ -41,7 +41,7 @@ zipkin:
   storage:
     type: elasticsearch
     elasticsearch:
-      hosts: 192.168.253.3:9200
+      hosts: 192.168.0.63:9200
       index: zipkin
       index-shards: 5
       index-replicas: 1

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