Skip to content

Commit 9c5ab38

Browse files
committed
增加成员控制
1 parent 28b78e6 commit 9c5ab38

File tree

14 files changed

+389
-59
lines changed

14 files changed

+389
-59
lines changed

conf/nbs.db

0 Bytes
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.nbs.biz.data.dao;
2+
3+
import org.apache.ibatis.session.SqlSession;
4+
5+
/**
6+
* @Package : com.nbs.biz.data.dao
7+
* @Description : <p></p>
8+
* @Author : lambor.c
9+
* @Date : 2018/7/5-17:15
10+
* Copyright (c) 2018, NBS , lambor.c<[email protected]>.
11+
* All rights reserved.
12+
*/
13+
public class AttachmentInfoDao extends BasicDao {
14+
15+
public AttachmentInfoDao(SqlSession session) {
16+
super(session, AttachmentInfoDao.class);
17+
}
18+
}
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
package com.nbs.biz.data.entity;
2+
3+
import java.util.Date;
4+
5+
/**
6+
* @Package : com.nbs.biz.data.entity
7+
* @Description : <p></p>
8+
* @Author : lambor.c
9+
* @Date : 2018/7/5-17:06
10+
* Copyright (c) 2018, NBS , lambor.c<[email protected]>.
11+
* All rights reserved.
12+
*/
13+
public class AttachmentInfoEntity extends BasicEntity {
14+
15+
private String id;
16+
private String peerid;
17+
private String phash;
18+
private String hash58;
19+
private String fname;
20+
private String fsize;
21+
private String fsuffix;
22+
private String fromid;
23+
private String seqno;
24+
private Integer cached;
25+
private String cachedfile;
26+
private Integer inlocal;
27+
private String ftype;
28+
private Integer sortno;
29+
private Date ctime;
30+
private Long lmtime;
31+
32+
public String getId() {
33+
return id;
34+
}
35+
36+
public void setId(String id) {
37+
this.id = id;
38+
}
39+
40+
public String getHash58() {
41+
return hash58;
42+
}
43+
44+
public void setHash58(String hash58) {
45+
this.hash58 = hash58;
46+
}
47+
48+
public String getFname() {
49+
return fname;
50+
}
51+
52+
public void setFname(String fname) {
53+
this.fname = fname;
54+
}
55+
56+
public String getFsize() {
57+
return fsize;
58+
}
59+
60+
public void setFsize(String fsize) {
61+
this.fsize = fsize;
62+
}
63+
64+
public String getFsuffix() {
65+
return fsuffix;
66+
}
67+
68+
public void setFsuffix(String fsuffix) {
69+
this.fsuffix = fsuffix;
70+
}
71+
72+
public String getFromid() {
73+
return fromid;
74+
}
75+
76+
public void setFromid(String fromid) {
77+
this.fromid = fromid;
78+
}
79+
80+
public String getSeqno() {
81+
return seqno;
82+
}
83+
84+
public void setSeqno(String seqno) {
85+
this.seqno = seqno;
86+
}
87+
88+
public Integer getCached() {
89+
return cached;
90+
}
91+
92+
public void setCached(Integer cached) {
93+
this.cached = cached;
94+
}
95+
96+
public String getCachedfile() {
97+
return cachedfile;
98+
}
99+
100+
public void setCachedfile(String cachedfile) {
101+
this.cachedfile = cachedfile;
102+
}
103+
104+
public Integer getInlocal() {
105+
return inlocal;
106+
}
107+
108+
public void setInlocal(Integer inlocal) {
109+
this.inlocal = inlocal;
110+
}
111+
112+
public String getFtype() {
113+
return ftype;
114+
}
115+
116+
public void setFtype(String ftype) {
117+
this.ftype = ftype;
118+
}
119+
120+
public Date getCtime() {
121+
return ctime;
122+
}
123+
124+
public void setCtime(Date ctime) {
125+
this.ctime = ctime;
126+
}
127+
128+
public Long getLmtime() {
129+
return lmtime;
130+
}
131+
132+
public void setLmtime(Long lmtime) {
133+
this.lmtime = lmtime;
134+
}
135+
136+
public String getPeerid() {
137+
return peerid;
138+
}
139+
140+
public void setPeerid(String peerid) {
141+
this.peerid = peerid;
142+
}
143+
144+
public String getPhash() {
145+
return phash;
146+
}
147+
148+
public void setPhash(String phash) {
149+
this.phash = phash;
150+
}
151+
152+
public Integer getSortno() {
153+
return sortno;
154+
}
155+
156+
public void setSortno(Integer sortno) {
157+
this.sortno = sortno;
158+
}
159+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.nbs.biz.service;
2+
3+
import com.nbs.biz.data.dao.AttachmentInfoDao;
4+
import com.nbs.biz.data.entity.AttachmentInfoEntity;
5+
import org.apache.ibatis.session.SqlSession;
6+
7+
/**
8+
* @Package : com.nbs.biz.service
9+
* @Description : <p></p>
10+
* @Author : lambor.c
11+
* @Date : 2018/7/5-17:36
12+
* Copyright (c) 2018, NBS , lambor.c<[email protected]>.
13+
* All rights reserved.
14+
*/
15+
public class AttachmentInfoService extends BasicService<AttachmentInfoDao,AttachmentInfoEntity> {
16+
17+
public AttachmentInfoService(SqlSession sqlSession) {
18+
dao = new AttachmentInfoDao(sqlSession);
19+
setDao(dao);
20+
}
21+
}

src/main/java/com/nbs/biz/service/PeerContactsService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
public class PeerContactsService extends BasicService<PeerContactsDao,PeerContactsEntity> {
1616
public PeerContactsService(SqlSession sqlSession) {
1717
dao = new PeerContactsDao(sqlSession);
18+
setDao(dao);
1819
}
1920
}

src/main/java/com/nbs/ui/panels/ContactsPanel.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717
import io.nbs.client.cnsts.ColorCnst;
1818
import io.nbs.client.ui.components.GBC;
1919
import io.nbs.client.ui.components.NbsListView;
20-
import io.nbs.commons.utils.Base64CodecUtil;
21-
import io.nbs.commons.utils.DbUtil;
2220
import io.nbs.client.ui.panels.ParentAvailablePanel;
23-
import io.nbs.commons.helper.RadomCharactersHelper;
2421
import io.ipfs.api.IPFS;
2522
import io.ipfs.api.JSONParser;
23+
import io.nbs.commons.utils.DataBaseUtil;
2624
import org.slf4j.Logger;
2725
import org.slf4j.LoggerFactory;
2826

@@ -78,7 +76,7 @@ public class ContactsPanel extends ParentAvailablePanel {
7876
public ContactsPanel(JPanel parent) {
7977
super(parent);
8078
context = this;
81-
service = new ContactsService(DbUtil.getSqlSession());
79+
service = new ContactsService(DataBaseUtil.getSqlSession());
8280
initComponent();
8381
initView();
8482
initData();

src/main/java/io/nbs/client/adapter/ReceiverMessageAdapter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
import com.nbs.biz.data.entity.PeerMessageEntity;
55
import com.nbs.biz.service.PeerMessageService;
6-
import io.nbs.client.cnsts.AppGlobalCnst;
6+
77
import io.nbs.client.listener.IPFSSubscribeListener;
88
import io.nbs.client.services.IpfsMessageSender;
99
import io.nbs.client.ui.components.NbsListView;
1010
import io.nbs.client.ui.frames.MainFrame;
1111
import io.nbs.client.ui.panels.im.IMPeersPanel;
1212
import io.nbs.client.vo.ContactsItem;
13-
import io.nbs.commons.helper.ConfigurationHelper;
14-
import io.nbs.commons.utils.DbUtil;
13+
14+
import io.nbs.commons.utils.DataBaseUtil;
1515
import io.nbs.commons.utils.UUIDGenerator;
1616
import io.nbs.sdk.beans.MessageItem;
1717
import io.nbs.sdk.beans.OnlineMessage;
@@ -39,7 +39,7 @@ public class ReceiverMessageAdapter implements IPFSSubscribeListener {
3939
public ReceiverMessageAdapter(List<MessageItem> items, NbsListView listView) {
4040
this.items = items;
4141
this.listView = listView;
42-
SqlSession sqlSession = DbUtil.getSqlSession();
42+
SqlSession sqlSession = DataBaseUtil.getSqlSession();
4343
peerMessageService = new PeerMessageService(sqlSession);
4444
}
4545

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package io.nbs.client.listener;
2+
3+
import com.nbs.biz.service.AttachmentInfoService;
4+
import io.ipfs.api.IPFS;
5+
import io.ipfs.api.MerkleNode;
6+
import io.ipfs.api.NamedStreamable;
7+
import io.nbs.sdk.beans.MessageItem;
8+
import org.apache.ibatis.session.SqlSession;
9+
10+
import java.io.File;
11+
import java.io.IOException;
12+
import java.util.List;
13+
14+
/**
15+
* @Package : io.nbs.client.listener
16+
* @Description : <p></p>
17+
* @Author : lambor.c
18+
* @Date : 2018/7/5-17:18
19+
* Copyright (c) 2018, NBS , lambor.c<[email protected]>.
20+
* All rights reserved.
21+
*/
22+
public class IPFSFileUploader {
23+
private static IPFS ipfs;
24+
private AttachmentInfoService service;
25+
26+
/**
27+
*
28+
* @param ipfs
29+
* @param sqlSession
30+
*/
31+
public IPFSFileUploader(IPFS ipfs, SqlSession sqlSession) {
32+
this.ipfs = ipfs;
33+
this.service = new AttachmentInfoService(sqlSession);
34+
}
35+
36+
/**
37+
*
38+
* @param file
39+
*/
40+
public void addFileToIPFS(File file){
41+
42+
if(!file.exists()||file.isDirectory())return;
43+
44+
try {
45+
NamedStreamable.FileWrapper fileWrapper = new NamedStreamable.FileWrapper(file);
46+
List<MerkleNode> list = ipfs.add(fileWrapper);
47+
uploadSuccessNotify();
48+
uploadSuccessSaveDB(list);
49+
} catch (IOException e) {
50+
e.printStackTrace();
51+
}
52+
}
53+
54+
55+
56+
/**
57+
* 上传成功系统展示
58+
*/
59+
private void uploadSuccessNotify(){
60+
61+
}
62+
63+
/**
64+
* 存库
65+
*/
66+
private void uploadSuccessSaveDB( List<MerkleNode> list){
67+
68+
}
69+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.nbs.client.ui.panels.file;
2+
3+
import javax.swing.*;
4+
5+
/**
6+
* @Package : io.nbs.client.ui.panels.file
7+
* @Description : <p></p>
8+
* @Author : lambor.c
9+
* @Date : 2018/7/5-16:42
10+
* Copyright (c) 2018, NBS , lambor.c<[email protected]>.
11+
* All rights reserved.
12+
*/
13+
public class FileMasterPanel extends JPanel {
14+
15+
16+
}

src/main/java/io/nbs/commons/utils/DbUtil.java

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)