Browse Source

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

zhuth 7 years ago
parent
commit
f1f0c46b37

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

@@ -25,6 +25,7 @@ import com.usoftchina.saas.page.PageDefault;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.server.web.ServletUtils;
 import com.usoftchina.saas.socket.api.SocketMessageApi;
+import com.usoftchina.saas.socket.dto.ClientMessage;
 import com.usoftchina.saas.utils.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -261,8 +262,8 @@ public class AuthController {
                 JwtInfo jwtInfo = new JwtInfo(appId, companyId, accountDTO.getId(), accountDTO.getUsername(), accountDTO.getRealname());
                 JwtToken jwtToken = JwtHelper.generateToken(jwtInfo, privateKeyPath, expire);
                 TokenDTO tokenDTO = BeanMapper.map(jwtToken, TokenDTO.class);
-                socketMessageApi.sendToClient(clientId, "/sso/callback",
-                        JsonUtils.toJsonString(new AuthDTO(tokenDTO, accountDTO)));
+                socketMessageApi.sendToClient(new ClientMessage(clientId, "/sso/callback",
+                        JsonUtils.toJsonString(new AuthDTO(tokenDTO, accountDTO))));
             }
             ServletUtils.writeJsonPMessage(response, callback, true);
         }

+ 4 - 9
base-servers/socket/socket-api/src/main/java/com/usoftchina/saas/socket/api/SocketMessageApi.java

@@ -1,9 +1,10 @@
 package com.usoftchina.saas.socket.api;
 
 import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.socket.dto.ClientMessage;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestBody;
 
 /**
  * @author yingp
@@ -14,24 +15,18 @@ public interface SocketMessageApi {
     /**
      * 发送信息给指定用户
      *
-     * @param clientId
-     * @param dest
      * @param message
      * @return
      */
     @PostMapping("/message/clients")
-    Result sendToClient(@RequestParam("clientId") String clientId,
-                        @RequestParam(value = "dest", required = false) String dest,
-                        @RequestParam("message") String message);
+    Result sendToClient(@RequestBody ClientMessage message);
 
     /**
      * 广播信息
      *
-     * @param dest
      * @param message
      * @return
      */
     @PostMapping("/message/clients/all")
-    Result sendToAllClients(@RequestParam(value = "dest", required = false) String dest,
-                            @RequestParam("message") String message);
+    Result sendToAllClients(@RequestBody ClientMessage message);
 }

+ 60 - 0
base-servers/socket/socket-api/src/main/java/com/usoftchina/saas/socket/dto/ClientMessage.java

@@ -0,0 +1,60 @@
+package com.usoftchina.saas.socket.dto;
+
+import java.io.Serializable;
+
+/**
+ * @author yingp
+ * @date 2018/12/12
+ */
+public class ClientMessage implements Serializable{
+    /**
+     * 客户端ID
+     */
+    private String clientId;
+    /**
+     * destination
+     */
+    private String dest;
+    /**
+     * 消息内容
+     */
+    private String message;
+
+    public ClientMessage() {
+    }
+
+    public ClientMessage(String dest, String message) {
+        this.dest = dest;
+        this.message = message;
+    }
+
+    public ClientMessage(String clientId, String dest, String message) {
+        this.clientId = clientId;
+        this.dest = dest;
+        this.message = message;
+    }
+
+    public String getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+
+    public String getDest() {
+        return dest;
+    }
+
+    public void setDest(String dest) {
+        this.dest = dest;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+}

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

@@ -35,6 +35,10 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-websocket</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>socket-api</artifactId>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

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

@@ -1,6 +1,10 @@
 package com.usoftchina.saas.socket.controller;
 
 import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.exception.ExceptionCode;
+import com.usoftchina.saas.socket.api.SocketMessageApi;
+import com.usoftchina.saas.socket.dto.ClientMessage;
+import com.usoftchina.saas.utils.BizAssert;
 import org.springframework.messaging.simp.SimpMessagingTemplate;
 import org.springframework.web.bind.annotation.*;
 
@@ -12,7 +16,7 @@ import javax.annotation.Resource;
  */
 @RestController
 @RequestMapping("/message")
-public class MessageController {
+public class MessageController implements SocketMessageApi{
 
     @Resource
     private SimpMessagingTemplate simpMessagingTemplate;
@@ -20,39 +24,41 @@ public class MessageController {
     /**
      * 发送信息给指定用户
      *
-     * @param clientId
-     * @param dest
      * @param message
      * @return
      */
+    @Override
     @PostMapping("/clients")
-    public Result sendToClient(@RequestParam String clientId, String dest, @RequestParam String message) {
+    public Result sendToClient(@RequestBody ClientMessage message) {
+        BizAssert.hasText(message.getClientId(), ExceptionCode.ILLEGAL_ARGUMENTS);
+        BizAssert.hasText(message.getDest(), ExceptionCode.ILLEGAL_ARGUMENTS);
         /**
          * 前端使用
          * <pre>
          *     stomp.subscribe('/clients/{clientId}/{dest}', function(message){});
          * </pre>
          */
-        simpMessagingTemplate.convertAndSendToUser(clientId, dest, message);
+        simpMessagingTemplate.convertAndSendToUser(message.getClientId(), message.getDest(), message.getMessage());
         return Result.success();
     }
 
     /**
      * 广播信息
      *
-     * @param dest
      * @param message
      * @return
      */
+    @Override
     @PostMapping("/clients/all")
-    public Result sendToAllClients(String dest, @RequestParam String message) {
+    public Result sendToAllClients(@RequestBody ClientMessage message) {
+        BizAssert.hasText(message.getDest(), ExceptionCode.ILLEGAL_ARGUMENTS);
         /**
          * 前端使用
          * <pre>
          *     stomp.subscribe('/clients/{dest}', function(message){});
          * </pre>
          */
-        simpMessagingTemplate.convertAndSend(dest, message);
+        simpMessagingTemplate.convertAndSend(message.getDest(), message.getMessage());
         return Result.success();
     }
 }

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

@@ -10,6 +10,7 @@ public enum ExceptionCode implements BaseExceptionCode {
     SYSTEM_TIMEOUT(-2, "系统超时,请稍候再试"),
 
     INVALID_DEFAULT_PAGE(10001, "无效默认分页参数"),
+    ILLEGAL_ARGUMENTS(20001, "参数错误"),
     // jwt token 相关 start
     // 过期
     JWT_TOKEN_EXPIRED(40001, "token超时,请检查 token 的有效期"),

+ 8 - 5
frontend/saas-portal-web/src/components/conenter/home.vue

@@ -269,11 +269,14 @@
         withCredentials:true
       })
       .then(res=>{
-        const data=res.data.data,session = data.token, account = data.account
-        account.companies = account.companies || []
-        session.account = account
-        Session.set(session);
-        this.account = Session.getAccount();
+        const data=res.data.data;
+        if(data&&data!=null){
+          const session = data.token, account = data.account
+          account.companies = account.companies || []
+          session.account = account
+          Session.set(session);
+          this.account = Session.getAccount();
+        }
       })
     },
     mounted() {

+ 0 - 25
frontend/saas-portal-web/src/pages/remove-token/remove-token.html

@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <title>Document</title>
-</head>
-<body>
-    <div id="app">hello</div>
-    <script>
-        // iframe接收消息
-        window.addEventListener('message', function(e) {
-            if (e.data == 'removeToken') {
-                if (e.source != window.parent) {
-                    return;
-                }
-                var storeKey = 'app-state-session';
-                localStorage.removeItem(storeKey);
-                window.parent.postMessage("success", "*");
-            }
-        });
-    </script>
-</body>
-</html>

+ 0 - 0
frontend/saas-portal-web/src/pages/remove-token/remove-token.js


+ 0 - 15
frontend/saas-portal-web/src/pages/remove-token/remove-token.vue

@@ -1,15 +0,0 @@
-<template>
-    <div>
-
-    </div>
-</template>
-
-<script>
-    export default {
-        
-    }
-</script>
-
-<style scoped>
-
-</style>

+ 1 - 2
frontend/saas-web/app/view/document/customer/FormPanel.js

@@ -163,8 +163,7 @@ Ext.define('saas.view.document.customer.FormPanel', {
     }, {
         xtype : "employeeDbfindTrigger", 
         name : "cu_sellername", 
-        fieldLabel : "业务员", 
-        allowBlank : false, 
+        fieldLabel : "业务员",  
         columnWidth : 0.25
     },{
         xtype : "hidden", 

+ 17 - 16
frontend/saas-web/app/view/purchase/purchase/FormPanel.js

@@ -172,6 +172,21 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
                             var format = '0,000.' + xr.join('');
                             return Ext.util.Format.number(v, format);
                         },
+                    }, 
+                    {
+                        text : "税率", 
+                        xtype: 'numbercolumn',
+                        dataIndex : "pd_taxrate", 
+                        width : 80.0,
+                        editor : {
+                            xtype : "numberfield",
+                            decimalPrecision: 0,
+                            minValue: 0,
+                            maxValue: 100
+                        },
+                        renderer : function(v) {
+                            return Ext.util.Format.number(v, '0');
+                        }
                     },
                     {
                         text : "已转数", 
@@ -197,21 +212,6 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
                             var format = '0.' + xr.join('');
                             return Ext.util.Format.number(v, format);
                         }
-                    }, 
-                    {
-                        text : "税率", 
-                        xtype: 'numbercolumn',
-                        dataIndex : "pd_taxrate", 
-                        width : 80.0,
-                        editor : {
-                            xtype : "numberfield",
-                            decimalPrecision: 0,
-                            minValue: 0,
-                            maxValue: 100
-                        },
-                        renderer : function(v) {
-                            return Ext.util.Format.number(v, '0');
-                        }
                     },{
                         text : "需求日期", 
                         dataIndex : "pd_delivery", 
@@ -287,7 +287,8 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
                     {
                         text : "关联销售单号", 
                         dataIndex : "pd_salecode", 
-                        width : 150.0
+                        width : 150.0,
+                        ignore:true,
                     },{
                         text : "备注", 
                         dataIndex : "pd_remark",

+ 14 - 14
frontend/saas-web/app/view/sale/saleIn/FormPanel.js

@@ -228,6 +228,20 @@ Ext.define('saas.view.sale.saleIn.FormPanel', {
                     var format = '0,000.' + xr.join('');
                     return Ext.util.Format.number(v, format);
                 },
+            }, {
+                text : "税率", 
+                xtype: 'numbercolumn',
+                dataIndex : "pd_taxrate", 
+                width : 80.0, 
+                editor : {
+                    xtype : "numberfield",
+                    decimalPrecision: 0,
+                    minValue: 0,
+                    maxValue: 100
+                },
+                renderer : function(v) {
+                    return Ext.util.Format.number(v, '0');
+                },
             }, 
            {
                 text : "含税金额", 
@@ -247,20 +261,6 @@ Ext.define('saas.view.sale.saleIn.FormPanel', {
                     var format = '0,000.' + xr.join('');
                     return Ext.util.Format.number(v, format);
                 }
-            }, {
-                text : "税率", 
-                xtype: 'numbercolumn',
-                dataIndex : "pd_taxrate", 
-                width : 80.0, 
-                editor : {
-                    xtype : "numberfield",
-                    decimalPrecision: 0,
-                    minValue: 0,
-                    maxValue: 100
-                },
-                renderer : function(v) {
-                    return Ext.util.Format.number(v, '0');
-                },
             },
             {
                 text : "未税金额", 

+ 14 - 14
frontend/saas-web/app/view/sale/saleOut/FormPanel.js

@@ -240,6 +240,20 @@ Ext.define('saas.view.sale.saleout.FormPanel', {
                     var format = '0,000.' + xr.join('');
                     return Ext.util.Format.number(v, format);
                 },
+            }, {
+                text : "税率", 
+                xtype: 'numbercolumn',
+                dataIndex : "pd_taxrate", 
+                width : 80.0, 
+                editor : {
+                    xtype : "numberfield",
+                    decimalPrecision: 0,
+                    minValue: 0,
+                    maxValue: 100
+                }, 
+                renderer : function(v) {
+                    return Ext.util.Format.number(v, '0');
+                }
             }, 
            {
                 text : "含税金额", 
@@ -259,20 +273,6 @@ Ext.define('saas.view.sale.saleout.FormPanel', {
                     var format = '0,000.' + xr.join('');
                     return Ext.util.Format.number(v, format);
                 }
-            }, {
-                text : "税率", 
-                xtype: 'numbercolumn',
-                dataIndex : "pd_taxrate", 
-                width : 80.0, 
-                editor : {
-                    xtype : "numberfield",
-                    decimalPrecision: 0,
-                    minValue: 0,
-                    maxValue: 100
-                }, 
-                renderer : function(v) {
-                    return Ext.util.Format.number(v, '0');
-                }
             },
             {
                 text : "未税金额", 

+ 14 - 14
frontend/saas-web/app/view/stock/otherIn/FormPanel.js

@@ -220,6 +220,20 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
                     var format = '0,000.' + xr.join('');
                     return Ext.util.Format.number(v, format);
                 },
+            }, {
+                text : "税率", 
+                xtype: 'numbercolumn',
+                dataIndex : "pd_taxrate", 
+                width : 80.0,
+                editor : {
+                    xtype : "numberfield",
+                    decimalPrecision: 0,
+                    minValue: 0,
+                    maxValue: 100
+                },
+                renderer : function(v) {
+                    return Ext.util.Format.number(v, '0');
+                }
             }, 
            {
                 text : "含税金额", 
@@ -244,20 +258,6 @@ Ext.define('saas.view.stock.otherIn.FormPanel', {
                     var format = '0,000.' + xr.join('');
                     return Ext.util.Format.number(v, format);
                 }
-            }, {
-                text : "税率", 
-                xtype: 'numbercolumn',
-                dataIndex : "pd_taxrate", 
-                width : 80.0,
-                editor : {
-                    xtype : "numberfield",
-                    decimalPrecision: 0,
-                    minValue: 0,
-                    maxValue: 100
-                },
-                renderer : function(v) {
-                    return Ext.util.Format.number(v, '0');
-                }
             },
             {
                 text : "未税金额", 

+ 14 - 14
frontend/saas-web/app/view/stock/otherOut/FormPanel.js

@@ -198,6 +198,20 @@ Ext.define('saas.view.stock.otherOut.FormPanel', {
                     var format = '0,000.' + xr.join('');
                     return Ext.util.Format.number(v, format);
                 }
+            }, {
+                text: "税率",
+                xtype: 'numbercolumn',
+                dataIndex: "pd_taxrate", 
+                width : 80.0,
+                editor : {
+                    xtype : "numberfield",
+                    decimalPrecision: 0,
+                    minValue: 0,
+                    maxValue: 100
+                },
+                renderer : function(v) {
+                    return Ext.util.Format.number(v, '0');
+                }
             },
             {
                 text: "含税金额",
@@ -217,20 +231,6 @@ Ext.define('saas.view.stock.otherOut.FormPanel', {
                     var format = '0,000.' + xr.join('');
                     return Ext.util.Format.number(v, format);
                 }
-            }, {
-                text: "税率",
-                xtype: 'numbercolumn',
-                dataIndex: "pd_taxrate", 
-                width : 80.0,
-                editor : {
-                    xtype : "numberfield",
-                    decimalPrecision: 0,
-                    minValue: 0,
-                    maxValue: 100
-                },
-                renderer : function(v) {
-                    return Ext.util.Format.number(v, '0');
-                }
             },
             {
                 text: "未税金额",