Browse Source

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

huangx 7 years ago
parent
commit
d231ceb3b0

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BankinformationMapper.java

@@ -24,7 +24,7 @@ public interface BankinformationMapper extends CommonBaseMapper<Bankinformation>
     List<Bankinformation> selectBankinformationBycondition(@Param("con") String con, @Param("companyId") Long companyId);
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
-    String selectBankcode(String bk_bankcode);
+    String selectBankcode(@Param("bk_bankcode") String bk_bankcode, @Param("companyId") Long companyId);
     Long selectBankId(String bk_bankcode);
 
     void check(Map<String, Object> map);

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

@@ -52,7 +52,7 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
         bankinformation.setCreatorName(BaseContextHolder.getUserName());
         int bid = Math.toIntExact(bankinformation.getId());
 
-        String bktion = bankinformationMapper.selectBankcode(bankinformation.getBk_bankcode());
+        String bktion = bankinformationMapper.selectBankcode(bankinformation.getBk_bankcode() ,BaseContextHolder.getCompanyId());
         //先判断ID,再判断编号
         if (bankinformation.getId() == 0)
         {

+ 3 - 2
applications/document/document-server/src/main/resources/mapper/BankinformationMapper.xml

@@ -321,8 +321,9 @@
     </select>
 
 
-  <select id="selectBankcode" parameterType="java.lang.String" resultType="java.lang.String">
-        select bk_bankcode from bankinformation where bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR}
+  <select id="selectBankcode" resultType="java.lang.String">
+        select bk_bankcode from bankinformation where
+        bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR} and companyId = #{companyId}
     </select>
 
   <select id="selectBankId" parameterType="java.lang.String" resultType="java.lang.Long">

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

@@ -128,6 +128,7 @@ public class StocktakingServiceImpl extends CommonBaseServiceImpl<StockTakingMap
                 prodInDetail.setCompanyId(companyId);
                 prodInDetail.setCreateTime(new Date());
                 prodInDetail.setCreatorId(userId);
+                prodInDetail.setPd_remark("盘盈单");
                 prodIODetailMapper.insertSelective(prodInDetail);
             }
             DocBaseDTO baseDTOIN = new DocBaseDTO(inid,piInno,"其它入库单");
@@ -167,6 +168,7 @@ public class StocktakingServiceImpl extends CommonBaseServiceImpl<StockTakingMap
                 prodOutDetail.setCompanyId(companyId);
                 prodOutDetail.setCreateTime(new Date());
                 prodOutDetail.setCreatorId(userId);
+                prodOutDetail.setPd_remark("盘亏单");
                 prodIODetailMapper.insertSelective(prodOutDetail);
             }
             DocBaseDTO baseDTOOUT = new DocBaseDTO(outid,piOutno,"其它出库单");

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

@@ -39,7 +39,7 @@ public interface CompanyApi {
      * @return
      */
     @GetMapping(path = "/company/read", params = "name")
-    Result<CompanyDTO> getCompanyByName(@RequestParam String name);
+    Result<CompanyDTO> getCompanyByName(@RequestParam("name") String name);
 
     /**
      * 按商业登记证号查找
@@ -48,7 +48,7 @@ public interface CompanyApi {
      * @return
      */
     @GetMapping(path = "/company/read", params = "businessCode")
-    Result<CompanyDTO> getCompanyByBusinessCode(@RequestParam String businessCode);
+    Result<CompanyDTO> getCompanyByBusinessCode(@RequestParam("businessCode") String businessCode);
 
     /**
      * 按企业uu查找
@@ -57,7 +57,7 @@ public interface CompanyApi {
      * @return
      */
     @GetMapping(path = "/company/read", params = "uu")
-    Result<CompanyDTO> getCompanyByUu(@RequestParam Long uu);
+    Result<CompanyDTO> getCompanyByUu(@RequestParam("uu") Long uu);
 
     /**
      * 按ID查找
@@ -66,5 +66,5 @@ public interface CompanyApi {
      * @return
      */
     @GetMapping(path = "/company/read/{id}")
-    Result<CompanyDTO> getCompanyById(@PathVariable Long id);
+    Result<CompanyDTO> getCompanyById(@PathVariable("id") Long id);
 }

+ 13 - 0
base-servers/auth/auth-dto/src/main/java/com/usoftchina/saas/auth/dto/AuthDTO.java

@@ -11,6 +11,19 @@ import java.io.Serializable;
 public class AuthDTO implements Serializable{
     private TokenDTO token;
     private AccountDTO account;
+    /**
+     * 用户登录优软云后,直接地址栏上进入saas系统.
+     * 通过cookie中的企业UU判断saas是否已开通,开通则返回companyId给前端直接登录该企业
+     */
+    private Long companyId;
+
+    public Long getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Long companyId) {
+        this.companyId = companyId;
+    }
 
     public AuthDTO() {
     }

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

@@ -2,14 +2,11 @@ package com.usoftchina.saas.auth.controller;
 
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.account.api.AccountApi;
+import com.usoftchina.saas.account.api.CompanyApi;
 import com.usoftchina.saas.account.constant.AccountType;
-import com.usoftchina.saas.account.dto.AccountCopyDTO;
-import com.usoftchina.saas.account.dto.AccountDTO;
-import com.usoftchina.saas.account.dto.AccountUpdateDTO;
-import com.usoftchina.saas.account.dto.CompanyBaseDTO;
+import com.usoftchina.saas.account.dto.*;
 import com.usoftchina.saas.auth.common.cookie.CookieHelper;
 import com.usoftchina.saas.auth.common.cookie.CookieInfo;
-import com.usoftchina.saas.auth.common.cookie.CookieUtils;
 import com.usoftchina.saas.auth.common.jwt.JwtHelper;
 import com.usoftchina.saas.auth.common.jwt.JwtInfo;
 import com.usoftchina.saas.auth.common.jwt.JwtToken;
@@ -34,8 +31,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.http.server.reactive.ServerHttpRequest;
-import org.springframework.http.server.reactive.ServerHttpResponse;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -57,6 +52,9 @@ public class AuthController {
     @Autowired
     private AccountApi accountApi;
 
+    @Autowired
+    private CompanyApi companyApi;
+
     @Value("${auth.public-key}")
     private String publicKeyPath;
 
@@ -203,7 +201,12 @@ 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);
-            return Result.success(new AuthDTO(tokenDTO, accountDTO));
+            AuthDTO authDTO = new AuthDTO(tokenDTO, accountDTO);
+            CompanyDTO companyDTO = companyApi.getCompanyByUu(info.getSpaceUU()).getData();
+            if (null != companyDTO){
+                authDTO.setCompanyId(companyDTO.getId());
+            }
+            return Result.success(authDTO);
         }
         return Result.error(ExceptionCode.COOKIE_ILLEGAL_ARGUMENT);
     }

+ 10 - 5
frontend/saas-portal-web/src/components/conenter/enterprise.vue

@@ -137,14 +137,19 @@ import { setTimeout } from 'timers';
             },
             //退出
             loginout(){
-                this.$router.push({path:'/name'});
-                this.loginout2()
-            },
-            loginout2(){
+                //this.$router.push({path:'/name'});
                 const frame = window.frames[window.frames.length - 1]
                 frame.postMessage('', '*')
                 Session.remove()
-            } 
+                window.location.href=this.$url.sso+'/logquit?appId=sp&returnURL=https://'+window.location.host
+                // this.loginout2()
+            }
+            // ,
+            // loginout2(){
+            //     const frame = window.frames[window.frames.length - 1]
+            //     frame.postMessage('', '*')
+            //     Session.remove()
+            // } 
         },
     }
 </script>

+ 21 - 22
frontend/saas-portal-web/src/components/conenter/home.vue

@@ -41,7 +41,7 @@
           </ul>
         </div>
         </div>
-        
+
     </div>
 
     <iframe hidden :src="setTokenPage"></iframe>
@@ -339,10 +339,8 @@
       }
     },
     created(){
-      var uid = this.getCookie('uid');
-      if(uid){
         this.$ajax({
-          url: '/api/auth/info',
+          url: this.$url.api+'/api/auth/info',
           method: 'get',
           async:false,
           withCredentials:true
@@ -352,11 +350,11 @@
           account.companies = account.companies || []
           session.account = account
           Session.set(session);
+          this.account = Session.getAccount();
         })
         .catch(err=>{
           console.log("请求失败",err)
         })
-      }
     },
     mounted() {
       this.clientId = Math.random().toString(36).substr(2)
@@ -379,20 +377,20 @@
       }
     },
     methods: {
-        getCookie(cookieName){  
-          var cookieValue="";  
-          if (document.cookie && document.cookie != '') {   
-              var cookies = document.cookie.split(';');  
-              for (var i = 0; i < cookies.length; i++) {   
-                  var cookie = cookies[i];  
-                  if (cookie.substring(0, cookieName.length + 2).trim() == cookieName.trim() + "=") {  
-                        cookieValue = cookie.substring(cookieName.length + 2, cookie.length);   
-                        break;  
-                  }  
-              }  
-          }   
-          return cookieValue;  
-      }, 
+      //   hasCookie(cookieName){
+      //     var hasUid=false;
+      //     if (document.cookie && document.cookie != '') {
+      //         var cookies = document.cookie.split(';');
+      //         for (var i = 0; i < cookies.length; i++) {
+      //             var cookie = cookies[i];
+      //             if (cookie.substring(0, cookieName.length+1).trim() == cookieName.trim() + "=") {
+      //                   hasUid=true;
+      //                   break;
+      //             }
+      //         }
+      //     }
+      //     return hasUid;
+      // },
       tab(i){
         this.Nowindex = i;
       },
@@ -418,7 +416,7 @@
               // 跳转应用页面
               window.location.href = me.$url.web
             }
-           } 
+           }
           }, false)
           frame.postMessage(JSON.stringify(session), '*')
         })
@@ -438,7 +436,8 @@
         const frame = window.frames[window.frames.length - 1]
         frame.postMessage('', '*')
         Session.remove()
-        this.$router.go(0); 
+        window.location.href=this.$url.sso+'/logquit?appId=sp&returnURL=https://'+window.location.host
+        //this.$router.go(0);
       },
       // 关闭窗口
       closeModal() {
@@ -495,7 +494,7 @@
                 // console.log("请求失败",err)
             })
           }
-        } 
+        }
       },
     }
   }

+ 3 - 2
frontend/saas-portal-web/src/components/footer/footer.vue

@@ -12,7 +12,7 @@
 					</div>
 					<div class="link">
 						<ul>
-							<li><span>常用链接</span></li>
+							<li><span>常用链接</span></li>
 							<li><a href="https://uas.usoftchina.com/" target="_blank">UAS官网</a></li>
 							<li><a href="https://www.usoftchina.com/" target="_blank">U软云</a></li>
 							<li><a href="http://www.yitoa.com/" target="_blank">英唐官网</a></li>
@@ -40,7 +40,8 @@
 					<div class="qr">
 						<div class="qr-top">
 							<div class="qr-tech qr-code">
-								<img src="/static/img/qr-tech.png" alt="">
+								<!-- <img src="/static/img/qr-tech.png" alt=""> -->
+								<img src="/static/img/qrusoftchina_1.jpg" alt="">
 								<div class="db-text">
 									<span>科技公众号</span>
 								</div>

BIN
frontend/saas-portal-web/static/img/qr_mall.jpg


BIN
frontend/saas-portal-web/static/img/qrusoftchina_1.jpg


+ 3 - 0
frontend/saas-web/app/view/core/base/ImportWindow.js

@@ -131,6 +131,9 @@ Ext.define('saas.view.core.base.ImportWindow', {
                     buttonConfig:{
                         xtype:'button',
                         handler:function(b){
+                            var caller = b.ownerCt.ownerCt.ownerCt.ownerCt.caller;
+                            //获取模版
+                            window.location.href = 'http://192.168.253.58:8560/api/commons/excel/import/templet?caller='+caller;
                         }
                     }
                 },{

+ 6 - 2
frontend/saas-web/app/view/viewport/ViewportController.js

@@ -76,7 +76,11 @@ Ext.define('saas.view.viewport.ViewportController', {
             //没有session时  判断cookie中的uid
             var hasValidCookie = Ext.util.Cookies.get('uid')?me.getAccountCookie():false;
             if(!hasValidCookie){
-                me.redirectTo('login', {replace: true});
+                if(window.location.host.indexOf('.usoftchina.com')>-1){
+                    window.location.href = Ext.manifest.server.accountCenter
+                }else{
+                    me.redirectTo('login', {replace: true});
+                }
             }else{
                 me.redirectTo('main', {replace: true});
             }
@@ -94,7 +98,7 @@ Ext.define('saas.view.viewport.ViewportController', {
     getAccountCookie:function(){
         var hasValidCookie = false;
         Ext.Ajax.request({
-            url: 'http://192.168.253.31:8560/api/auth/info',
+            url: '/api/auth/info',
             withCredentials: true,
             async:false,
             dataType: 'json',