-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cim 1.0.5
- Loading branch information
Showing
38 changed files
with
404 additions
and
789 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
12 changes: 12 additions & 0 deletions
12
cim-client/src/main/java/com/crossoverjie/cim/client/constant/Emoji.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,12 @@ | ||
package com.crossoverjie.cim.client.constant; | ||
|
||
/** | ||
* Function: | ||
* | ||
* @author crossoverJie | ||
* Date: 2019-08-24 22:53 | ||
* @since JDK 1.8 | ||
*/ | ||
public class Emoji { | ||
|
||
} |
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
18 changes: 18 additions & 0 deletions
18
cim-client/src/main/java/com/crossoverjie/cim/client/service/EchoService.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,18 @@ | ||
package com.crossoverjie.cim.client.service; | ||
|
||
/** | ||
* Function: | ||
* | ||
* @author crossoverJie | ||
* Date: 2019-08-27 22:35 | ||
* @since JDK 1.8 | ||
*/ | ||
public interface EchoService { | ||
|
||
/** | ||
* echo msg to terminal | ||
* @param msg message | ||
* @param replace | ||
*/ | ||
void echo(String msg, Object... replace) ; | ||
} |
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
72 changes: 72 additions & 0 deletions
72
cim-client/src/main/java/com/crossoverjie/cim/client/service/impl/EchoServiceImpl.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,72 @@ | ||
package com.crossoverjie.cim.client.service.impl; | ||
|
||
import com.crossoverjie.cim.client.config.AppConfiguration; | ||
import com.crossoverjie.cim.client.service.EchoService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Function: | ||
* | ||
* @author crossoverJie | ||
* Date: 2019-08-27 22:37 | ||
* @since JDK 1.8 | ||
*/ | ||
@Service | ||
public class EchoServiceImpl implements EchoService { | ||
|
||
private static final String PREFIX = "$"; | ||
|
||
@Autowired | ||
private AppConfiguration appConfiguration; | ||
|
||
@Override | ||
public void echo(String msg,Object... replace) { | ||
msg = "\033[31;4m" + appConfiguration.getUserName() + PREFIX + "\033[0m" + " " + msg; | ||
|
||
String log = print(msg, replace); | ||
|
||
System.out.println(log); | ||
} | ||
|
||
|
||
/** | ||
* print msg | ||
* @param msg | ||
* @param place | ||
* @return | ||
*/ | ||
private String print(String msg, Object... place) { | ||
StringBuilder sb = new StringBuilder(); | ||
int k = 0; | ||
for (int i = 0; i < place.length; i++) { | ||
int index = msg.indexOf("{}", k); | ||
|
||
if (index == -1){ | ||
return msg; | ||
} | ||
|
||
if (index != 0) { | ||
sb.append(msg, k, index); | ||
sb.append(place[i]); | ||
|
||
if (place.length == 1) { | ||
sb.append(msg, index + 2, msg.length()); | ||
} | ||
|
||
} else { | ||
sb.append(place[i]); | ||
if (place.length == 1) { | ||
sb.append(msg, index + 2, msg.length()); | ||
} | ||
} | ||
|
||
k = index + 2; | ||
} | ||
if (sb.toString().equals("")){ | ||
return msg ; | ||
}else { | ||
return sb.toString(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.