Bläddra i källkod

Merge branch 'master' of http://old.hlzaojia.com:3000/root/k-server

root 5 år sedan
förälder
incheckning
5ec6578f60

+ 7 - 7
facade/src/app/routes/passport/login/login.component.html

@@ -1,6 +1,6 @@
1 1
 <br />
2 2
 <form nz-form [formGroup]="form" (ngSubmit)="submit()" role="form">
3
-  
3
+
4 4
   <nz-alert *ngIf="error" [nzType]="'error'" [nzMessage]="error" [nzShowIcon]="true" class="mb-lg"></nz-alert>
5 5
   <nz-form-item>
6 6
     <nz-form-control>
@@ -18,7 +18,7 @@
18 18
         <input nz-input type="password" formControlName="password" placeholder="密码">
19 19
       </nz-input-group>
20 20
       <nz-form-explain *ngIf="password.dirty && password.errors">
21
-        请输入密码! 
21
+        请输入密码!
22 22
       </nz-form-explain>
23 23
     </nz-form-control>
24 24
   </nz-form-item>
@@ -39,10 +39,10 @@
39 39
     </button>
40 40
   </nz-form-item>
41 41
 </form>
42
-<!-- <div class="other">
42
+<div class="other">
43 43
   {{ 'app.login.sign-in-with' | translate }}
44
-  <i nz-tooltip="in fact Auth0 via window" (click)="open('auth0', 'window')" nz-icon type="alipay-circle" class="icon"></i>
45
-  <i nz-tooltip="in fact Github via redirect" (click)="open('github')" nz-icon type="taobao-circle" class="icon"></i>
46
-  <i (click)="open('weibo', 'window')" nz-icon type="weibo-circle" class="icon"></i>
44
+  <i nz-tooltip="使用中联HIS登录" (click)="open('zlhis', 'window')" nz-icon type="alipay-circle" class="icon"></i>
45
+  <!-- <i nz-tooltip="in fact Github via redirect" (click)="open('github')" nz-icon type="taobao-circle" class="icon"></i>
46
+  <i (click)="open('weibo', 'window')" nz-icon type="weibo-circle" class="icon"></i> -->
47 47
   <a class="register" routerLink="/passport/register">{{ 'app.login.signup' | translate }}</a>
48
-</div> -->
48
+</div>

+ 5 - 0
facade/src/app/routes/passport/login/login.component.ts

@@ -186,6 +186,11 @@ export class UserLoginComponent implements OnDestroy {
186 186
           callback,
187 187
         )}`;
188 188
         break;
189
+      case 'zlhis':
190
+        url = `https://api.weibo.com/oauth2/authorize?client_id=1239507802&response_type=code&redirect_uri=${decodeURIComponent(
191
+          callback,
192
+        )}`;
193
+        break;
189 194
     }
190 195
     if (openType === 'window') {
191 196
       this.socialService

+ 25 - 8
src/main/java/com/kingkong/bljs/service/OracleDatabaseExecuter.java

@@ -47,22 +47,39 @@ public class OracleDatabaseExecuter extends DatabaseExecuter {
47 47
 
48 48
     @Override
49 49
     public long insert(String table, JObject data) throws Exception{
50
-        String strSQL =  "SELECT {0}_id.nextval ID from dual";
51
-        List<Map> tmp = this.select(strSQL,table);
50
+        TableColumnCollection columns = new TableColumnCollection(this.queryService.getTableColumns(table));
51
+        String strSQL = "";
52
+        String keys = "";
53
+        String values = "";
54
+        Object id = "0";
55
+        if(columns.containColumn("id")){
56
+            strSQL =  "SELECT {0}_id.nextval ID from dual";
57
+            List<Map> tmp = this.select(strSQL,table);
58
+
59
+            //Object id = pluck(strSQL,table);
60
+            if(null == tmp || tmp.size() == 0)
61
+                throw new Exception("表不存在对应的序列" + table);
62
+
63
+            id = tmp.get(0).get("id").toString();
64
+            keys += ",id";
65
+            values += ",'" + id.toString() + "'";
66
+        }
67
+
52 68
 
53
-        //Object id = pluck(strSQL,table);
54
-        if(null == tmp || tmp.size() == 0)
55
-            throw new Exception("表不存在对应的序列" + table);
56 69
 
57
-        Object id = tmp.get(0).get("id").toString();
58 70
 
59
-        String keys = "id";
60
-        String values = "'" + id.toString() + "'";
61 71
         for(Object key : data.keySet()){
62 72
             String k = key.toString();
63 73
             keys += "," + k;
64 74
             values += ",?";
65 75
         }
76
+        if(keys.startsWith(","))
77
+            keys = keys.substring(1);
78
+
79
+        if(values.startsWith(","))
80
+            values = values.substring(1);
81
+
82
+
66 83
         strSQL = StringUtil.format("insert into {0}({1}) values({2})",table,keys,values);
67 84
 
68 85
         this.execute(table,strSQL,data);

+ 1 - 1
src/main/java/com/kingkong/bljs/service/TableColumnCollection.java

@@ -23,7 +23,7 @@ public class TableColumnCollection {
23 23
      */
24 24
     public TableColumn getCol(String colName){ ;
25 25
         for(TableColumn col : list){
26
-            if (col.name.equals(colName))
26
+            if (col.name.toUpperCase().equals(colName.toUpperCase()))
27 27
                 return col;
28 28
         }
29 29
         return null;

+ 39 - 23
src/main/java/com/kingkong/bljs/service/UserService.java

@@ -37,6 +37,9 @@ public class UserService {
37 37
     @Value("${app.table.app_user}")
38 38
     private String k_app_user;
39 39
 
40
+    @Value("${app.type}")
41
+    private String appType;
42
+
40 43
     /***
41 44
      * 当前登录用户
42 45
      * @return
@@ -75,28 +78,41 @@ public class UserService {
75 78
             @Cacheable(cacheNames = {"user"},key = "#name")
76 79
     })
77 80
     public Map getUser(String name,String appid){
78
-        String strSQL = "select  t.id,t.name,null email,null avatar,t.is_super ,a.id staff_id,a.name staff,a.code staff_code,a.note,z.s_id,\n" +
79
-                "	case when a.gender = 1 then '男' else '女' end gender_name,a.tel,c.name department\n" +
80
-                "from " + k_user + " t\n" +
81
-                "LEFT JOIN k_user_staff z on z.u_id = t.id and z.app_id = {1}\n" +
82
-                "LEFT JOIN k_staff a on a.app_id = z.app_id and a.id = z.s_id\n" +
83
-                "LEFT JOIN k_staff_department b on b.s_id = a.id\n" +
84
-                "LEFT JOIN k_department c on c.app_id = z.app_id and c.id = b.d_id\n" +
85
-                "where t.name='{0}'";
86
-
87
-
88
-        Map user = queryService.find(strSQL,name,appid);
89
-
90
-
91
-        //查找部门信息
92
-        strSQL =  "select z.*\n" +
93
-                        "from k_staff_department t,k_department z\n" +
94
-                        "where  t.s_id={0} and z.id = t.d_id order by t.type desc";
95
-        if(null != user.get("staff_id") && !user.get("staff_id").toString().equals("")){
96
-            List<Map> departments =  queryService.select(strSQL,user.get("staff_id"));
97
-            user.put("departments",departments);
98
-        } else {
99
-            user.put("departments",new ArrayList<Map>());
81
+        Map user = null;
82
+        String strSQL = "";
83
+        if(appType.equals("1")) {   //中联账号体系
84
+
85
+            strSQL = "select  t.id,t.name,null email,null avatar,t.is_super ,a.id staff_id,a.name staff,a.code staff_code,a.note,z.s_id,\n" +
86
+                    "	case when a.gender = 1 then '男' else '女' end gender_name,a.tel,c.name department\n" +
87
+                    "from " + k_user + " t\n" +
88
+                    "LEFT JOIN k_user_staff z on z.u_id = t.id and z.app_id = {1}\n" +
89
+                    "LEFT JOIN k_staff a on a.app_id = z.app_id and a.id = z.s_id\n" +
90
+                    "LEFT JOIN k_staff_department b on b.s_id = a.id\n" +
91
+                    "LEFT JOIN k_department c on c.app_id = z.app_id and c.id = b.d_id\n" +
92
+                    "where t.name='{0}'";
93
+
94
+
95
+            user = queryService.find(strSQL, name, appid);
96
+
97
+
98
+            //查找部门信息
99
+            strSQL = "select z.*\n" +
100
+                    "from k_staff_department t,k_department z\n" +
101
+                    "where  t.s_id={0} and z.id = t.d_id order by t.type desc";
102
+            if (null != user.get("staff_id") && !user.get("staff_id").toString().equals("")) {
103
+                List<Map> departments = queryService.select(strSQL, user.get("staff_id"));
104
+                user.put("departments", departments);
105
+            } else {
106
+                user.put("departments", new ArrayList<Map>());
107
+            }
108
+        }else {
109
+            strSQL = "select  t.id,t.name,null email,null avatar,t.is_super ,null staff_id,null staff,null staff_code, null note,null s_id,\n" +
110
+                    "	null gender_name,null tel,null department\n" +
111
+                    "from " + k_user + " t\n" +
112
+                    "where t.name='{0}'";
113
+
114
+            user = queryService.find(strSQL, name, appid);
115
+            user.put("departments", new ArrayList<Map>());
100 116
         }
101 117
 
102 118
 
@@ -219,7 +235,7 @@ public class UserService {
219 235
                             "from k_role_priv t,k_module_priv z,k_module_priv_detail a\n" +
220 236
                             "where t.r_id in({0})\n" +
221 237
                             "      and t.p_code = z.code and a.code = z.code\n" +
222
-                            "      and a.type = 3";
238
+                            "      /*and a.type = 3*/";
223 239
 
224 240
             List<Map> list = queryService.select(strSQL,roleIds);
225 241
             load(list);

+ 5 - 5
src/main/resources/application-c.properties

@@ -1,4 +1,4 @@
1
-spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:test2
1
+spring.datasource.url=jdbc:oracle:thin:@192.168.1.150:1521:es
2 2
 spring.datasource.username=k_user
3 3
 spring.datasource.password=123
4 4
 spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
@@ -16,7 +16,7 @@ app.desc=
16 16
 app.origin.url=http://localhost:4200
17 17
 
18 18
 #应用类型1, 结合中联oracle
19
-app.type=1
19
+app.type=0
20 20
 #登录程序位置
21 21
 app.loginpath=D:/work/zllogin.exe
22 22
 #登录服务名
@@ -26,8 +26,8 @@ app.server=test2
26 26
 app.pdfpath=D:\\report-test\\pdf\\
27 27
 #报表打印程序位置
28 28
 app.printerpath=D:/report-test/ZLReportPrint.exe
29
-app.table.user=k_user2
30
-app.table.app_user=k_app_user2
29
+app.table.user=k_user
30
+app.table.app_user=k_app_user
31 31
 
32 32
 
33 33
 spring.jackson.default-property-inclusion=always
@@ -51,4 +51,4 @@ spring.thymeleaf.encoding=UTF-8
51 51
 #websocket配置
52 52
 netty-websocket.host=127.0.0.1
53 53
 netty-websocket.path=/
54
-netty-websocket.port=9021
54
+netty-websocket.port=9022