-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f952e0e
commit 75ae2ff
Showing
43 changed files
with
233 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>whatsmars-earth</artifactId> | ||
<groupId>org.hongxi</groupId> | ||
<version>Rocket.S1</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>whatsmars-earth-common</artifactId> | ||
<packaging>jar</packaging> | ||
<name>${project.artifactId}</name> | ||
<description>Earth Utils 公共模块</description> | ||
|
||
<dependencies> | ||
<!-- 图片压缩工具 --> | ||
<dependency> | ||
<groupId>org.imgscalr</groupId> | ||
<artifactId>imgscalr-lib</artifactId> | ||
<version>4.2</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.mongodb</groupId> | ||
<artifactId>mongo-java-driver</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.codehaus.jackson</groupId> | ||
<artifactId>jackson-mapper-asl</artifactId> | ||
<version>1.9.13</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpmime</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>net.sf.json-lib</groupId> | ||
<artifactId>json-lib</artifactId> | ||
<version>${json-lib.version}</version> | ||
<classifier>jdk15</classifier> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.sf.ezmorph</groupId> | ||
<artifactId>ezmorph</artifactId> | ||
<version>1.0.6</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-email</artifactId> | ||
<version>1.3.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.mail</groupId> | ||
<artifactId>mail</artifactId> | ||
<version>1.4.7</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.velocity</groupId> | ||
<artifactId>velocity</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.itextpdf</groupId> | ||
<artifactId>itextpdf</artifactId> | ||
<version>5.5.6</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.itextpdf</groupId> | ||
<artifactId>itext-asian</artifactId> | ||
<version>5.2.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.itextpdf.tool</groupId> | ||
<artifactId>xmlworker</artifactId> | ||
<version>5.5.6</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>dom4j</groupId> | ||
<artifactId>dom4j</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
|
||
</project> |
2 changes: 1 addition & 1 deletion
2
...gxi/whatsmars/common/CommonConstants.java → ...atsmars/earth/common/CommonConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ongxi/whatsmars/common/ImageSizeEnum.java → ...whatsmars/earth/common/ImageSizeEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...whatsmars/common/mongo/MongoDBClient.java → ...ars/earth/common/mongo/MongoDBClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rs/common/mongo/object/MongoDBConfig.java → ...th/common/mongo/object/MongoDBConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ommon/mongo/object/MongoDBCredential.java → ...ommon/mongo/object/MongoDBCredential.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rs/common/mongo/object/MongoDBDriver.java → ...th/common/mongo/object/MongoDBDriver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../common/mongo/object/ObjectIdCreator.java → .../common/mongo/object/ObjectIdCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...go/serializer/CustomDateDeserializer.java → ...go/serializer/CustomDateDeserializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ongo/serializer/CustomDateSerializer.java → ...ongo/serializer/CustomDateSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../hongxi/whatsmars/common/pojo/Result.java → ...i/whatsmars/earth/common/pojo/Result.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...gxi/whatsmars/common/pojo/ResultCode.java → ...atsmars/earth/common/pojo/ResultCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../whatsmars/common/util/Authenticator.java → ...mars/earth/common/util/Authenticator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...whatsmars-earth-common/src/main/java/org/hongxi/whatsmars/earth/common/util/DESUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.hongxi.whatsmars.earth.common.util; | ||
|
||
import org.apache.commons.codec.binary.Base64; | ||
|
||
import javax.crypto.Cipher; | ||
import javax.crypto.SecretKey; | ||
import javax.crypto.SecretKeyFactory; | ||
import javax.crypto.spec.DESKeySpec; | ||
import java.security.SecureRandom; | ||
|
||
|
||
public class DESUtils { | ||
private static final String DES = "DES"; | ||
private static final String PADDING = "DES/ECB/PKCS5Padding"; | ||
private static final String DEFAULT_ENCODING = "utf-8"; | ||
|
||
public final static String encrypt(String code, String key) { | ||
try { | ||
return Base64.encodeBase64String(encrypt(code.getBytes(DEFAULT_ENCODING), key | ||
.getBytes(DEFAULT_ENCODING))); | ||
} catch (Exception e) { | ||
// | ||
} | ||
return null; | ||
|
||
} | ||
|
||
public static byte[] encrypt(byte[] src, byte[] key) throws Exception { | ||
SecureRandom sr = new SecureRandom(); | ||
DESKeySpec dks = new DESKeySpec(key); | ||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES); | ||
SecretKey securekey = keyFactory.generateSecret(dks); | ||
Cipher cipher = Cipher.getInstance(PADDING); | ||
cipher.init(Cipher.ENCRYPT_MODE, securekey, sr); | ||
return cipher.doFinal(src); | ||
|
||
} | ||
|
||
public final static String decrypt(String data, String key) { | ||
try { | ||
//base64,default-charset is UTF-8 | ||
return new String(decrypt(Base64.decodeBase64(data), | ||
key.getBytes(DEFAULT_ENCODING)), DEFAULT_ENCODING); | ||
|
||
} catch (Exception e) { | ||
// | ||
} | ||
return null; | ||
} | ||
|
||
public static byte[] decrypt(byte[] src, byte[] key) throws Exception { | ||
SecureRandom sr = new SecureRandom(); | ||
DESKeySpec dks = new DESKeySpec(key); | ||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES); | ||
SecretKey securekey = keyFactory.generateSecret(dks); | ||
Cipher cipher = Cipher.getInstance(PADDING); | ||
cipher.init(Cipher.DECRYPT_MODE, securekey, sr); | ||
return cipher.doFinal(src); | ||
} | ||
|
||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...gxi/whatsmars/common/util/EmailUtils.java → ...atsmars/earth/common/util/EmailUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...xi/whatsmars/common/util/IdCardUtils.java → ...tsmars/earth/common/util/IdCardUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...smars/common/util/JSONConverterUtils.java → ...earth/common/util/JSONConverterUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.