Skip to content

Commit

Permalink
4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
youtongluan committed Jan 27, 2024
1 parent 8743aaf commit 118f40f
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 99 deletions.
2 changes: 1 addition & 1 deletion sumk-base/src/main/java/org/yx/conf/Const.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class Const {

public static final String DEFAULT_DB_NAME = "sumk";

public static final int SUMK_VERSION = 0x312;
public static final int SUMK_VERSION = 0x400;

public static String sumkVersion() {
return new StringBuilder(10).append((Const.SUMK_VERSION >> 8) & 0x0F).append('.')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.test.web.client;
package org.test.client;

import java.net.URLEncoder;
import java.util.Arrays;
Expand All @@ -17,6 +17,7 @@
import org.apache.http.util.EntityUtils;
import org.junit.Assert;
import org.junit.Test;
import org.test.web.client.Encrypt;
import org.yx.common.util.S;
import org.yx.log.Log;

Expand All @@ -25,7 +26,7 @@
* 加解密部分需要些技术功底才好看明白。
* 好消息是:现在web应用一般都使用https了,就可以不用加解密方式了,就可以不看加解密部分
*/
public class AesClientTest {
public class HttpAesClientTest {

private String getUrl(String act) {
String url = "http://localhost:8080/rest/" + act;
Expand Down Expand Up @@ -122,7 +123,7 @@ public void aes_sign() throws Exception {
String sign = Encrypt.sign(S.json().toJson(map).getBytes(charset));
System.out.println("sign:" + sign);

HttpPost post = new HttpPost(getUrl(act) + "?_sign=" + sign);
HttpPost post = new HttpPost(getUrl(act) + "?__sign=" + sign);
post.setEntity(se);
resp = client.execute(post);
String line = resp.getStatusLine().toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.test.web.client;
package org.test.client;

import java.io.File;
import java.io.IOException;
Expand All @@ -24,14 +24,15 @@
import org.apache.http.util.EntityUtils;
import org.junit.Assert;
import org.junit.Test;
import org.test.web.client.Encrypt;
import org.yx.common.util.S;
import org.yx.demo.member.DemoUser;
import org.yx.log.Log;

/*
* 通过这个类,可以了解web的通讯。
*/
public class PlainClientTest {
public class HttpPlainClientTest {

private String getUrl(String act) {
return "http://localhost:8080/rest/" + act;
Expand Down Expand Up @@ -81,7 +82,7 @@ public void login_sign() throws Exception {
json.put("name", "小明");
String req = S.json().toJson(json);
String sign = Encrypt.sign(req.getBytes(charset));
HttpPost post = new HttpPost(getUrl(act) + "?_sign=" + sign);
HttpPost post = new HttpPost(getUrl(act) + "?__sign=" + sign);
StringEntity se = new StringEntity(req,charset);
post.setEntity(se);
HttpResponse resp = client.execute(post);
Expand Down Expand Up @@ -133,7 +134,7 @@ public void upload() throws IOException {
MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart("Api", StringBody.create("common", "text/plain", Charset.forName(charset)));
reqEntity.addPart("param", StringBody.create(req, "text/plain", Charset.forName(charset)));
reqEntity.addPart("img", new FileBody(new File("logo_bluce.jpg")));
reqEntity.addPart("img", new FileBody(new File("test.sql")));

post.setEntity(reqEntity);
HttpResponse resp = client.execute(post);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.test;
package org.test.client;

import java.io.IOException;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.test;
package org.test.client;

import java.util.Arrays;
import java.util.Random;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.test.soa.client;
package org.test.client;

import java.io.IOException;
import java.util.ArrayList;
Expand Down
2 changes: 1 addition & 1 deletion sumk-test/src/test/java/org/test/web/client/Encrypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static String sign(byte[] data) throws Exception {
}

public static byte[] encryptByte(byte[] data) throws Exception {
MessageDigest md = MessageDigest.getInstance("md5");
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(data);
return md.digest();
}
Expand Down
4 changes: 2 additions & 2 deletions sumk-test/src/test/java/org/test/web/demo/PlainServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public String upload(String name, @Param(required = true) Integer age) throws Fi
List<MultipartItem> files=WebUtil.getMultiParts();
Assert.assertEquals(2, files.size());
MultipartItem f=WebUtil.getPart("img");
Assert.assertEquals("logo_bluce.jpg", f.getSubmittedFileName());
Assert.assertEquals("test.sql", f.getSubmittedFileName());
byte[] data=IOUtil.readAllBytes(f.getInputStream(),false);
byte[] exp=Files.readAllBytes(new File("logo_bluce.jpg").toPath());
byte[] exp=Files.readAllBytes(new File("test.sql").toPath());
Assert.assertArrayEquals(exp, data);
return "姓名:"+name+",年龄:"+age;
}
Expand Down
170 changes: 85 additions & 85 deletions test.sql → sumk-test/test.sql
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
create database sumk;
use sumk;
SET FOREIGN_KEY_CHECKS=0;

DROP TABLE IF EXISTS `demo_user`;
CREATE TABLE `demo_user` (
`id` bigint(20) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`age` int(11) DEFAULT NULL,
`last_update` timestamp NULL DEFAULT NULL,
`enable` tinyint(4) DEFAULT '1' COMMENT '1表示有效记录,0表示记录已被删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `generate`;
CREATE TABLE `generate` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `multikey`;
CREATE TABLE `multikey` (
`id1` varchar(255) NOT NULL COMMENT '联合主键1',
`id2` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COMMENT '联合主键2',
`name` varchar(255) DEFAULT NULL,
`age` int(11) DEFAULT NULL,
PRIMARY KEY (`id1`,`id2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `odd`;
CREATE TABLE `odd` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`data` mediumblob,
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2208669043496333243 DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `school_fuzhou`;
CREATE TABLE `school_fuzhou` (
`id` bigint(20) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`lastUpdate` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `test_table`;
CREATE TABLE `test_table` (
`id` bigint(20) NOT NULL COMMENT 'Long 类型,第1列',
`userid` varchar(255) NOT NULL COMMENT 'String 类型,联合索引1,第2列',
`enable` bit(1) NOT NULL COMMENT 'boolean 类型,联合索引2,第3列',
`height` smallint(6) DEFAULT NULL COMMENT 'Short 类型,第4列',
`age` tinyint(4) DEFAULT NULL COMMENT 'byte 类型,第5列',
`f` decimal(12,3) DEFAULT NULL COMMENT 'float 类型,第6列',
`d` decimal(20,5) DEFAULT NULL COMMENT 'double 类型,第7列',
`valid` bit(1) DEFAULT b'1' COMMENT '1表示有效记录,0表示记录已被删除',
PRIMARY KEY (`id`),
KEY `testtable_index1` (`userid`,`enable`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用来测试表格自动生成';


DROP TABLE IF EXISTS `timedemo`;
CREATE TABLE `timedemo` (
`id` bigint(20) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`lastUpdate` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `user_detail`;
CREATE TABLE `user_detail` (
`id` bigint(20) NOT NULL,
`user_id` bigint(20) NOT NULL,
`addr` varchar(255) DEFAULT NULL,
`height` int(11) DEFAULT NULL,
`valid` char(1) DEFAULT '1' COMMENT '1表示有效记录,0表示记录已被删除',
PRIMARY KEY (`id`),
KEY `user_detail_index1` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create database sumk;
use sumk;
SET FOREIGN_KEY_CHECKS=0;

DROP TABLE IF EXISTS `demo_user`;
CREATE TABLE `demo_user` (
`id` bigint(20) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`age` int(11) DEFAULT NULL,
`last_update` timestamp NULL DEFAULT NULL,
`enable` tinyint(4) DEFAULT '1' COMMENT '1表示有效记录,0表示记录已被删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `generate`;
CREATE TABLE `generate` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `multikey`;
CREATE TABLE `multikey` (
`id1` varchar(255) NOT NULL COMMENT '联合主键1',
`id2` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COMMENT '联合主键2',
`name` varchar(255) DEFAULT NULL,
`age` int(11) DEFAULT NULL,
PRIMARY KEY (`id1`,`id2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `odd`;
CREATE TABLE `odd` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`data` mediumblob,
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2208669043496333243 DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `school_fuzhou`;
CREATE TABLE `school_fuzhou` (
`id` bigint(20) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`lastUpdate` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `test_table`;
CREATE TABLE `test_table` (
`id` bigint(20) NOT NULL COMMENT 'Long 类型,第1列',
`userid` varchar(255) NOT NULL COMMENT 'String 类型,联合索引1,第2列',
`enable` bit(1) NOT NULL COMMENT 'boolean 类型,联合索引2,第3列',
`height` smallint(6) DEFAULT NULL COMMENT 'Short 类型,第4列',
`age` tinyint(4) DEFAULT NULL COMMENT 'byte 类型,第5列',
`f` decimal(12,3) DEFAULT NULL COMMENT 'float 类型,第6列',
`d` decimal(20,5) DEFAULT NULL COMMENT 'double 类型,第7列',
`valid` bit(1) DEFAULT b'1' COMMENT '1表示有效记录,0表示记录已被删除',
PRIMARY KEY (`id`),
KEY `testtable_index1` (`userid`,`enable`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用来测试表格自动生成';


DROP TABLE IF EXISTS `timedemo`;
CREATE TABLE `timedemo` (
`id` bigint(20) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`lastUpdate` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `user_detail`;
CREATE TABLE `user_detail` (
`id` bigint(20) NOT NULL,
`user_id` bigint(20) NOT NULL,
`addr` varchar(255) DEFAULT NULL,
`height` int(11) DEFAULT NULL,
`valid` char(1) DEFAULT '1' COMMENT '1表示有效记录,0表示记录已被删除',
PRIMARY KEY (`id`),
KEY `user_detail_index1` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

0 comments on commit 118f40f

Please sign in to comment.