diff --git a/service-biz/service-wechat-applet/service-wechat-applet-biz/src/main/resources/application-dev.yml b/service-biz/service-wechat-applet/service-wechat-applet-biz/src/main/resources/application-dev.yml index 881f05e158f433e3f5996d01e564b869fc39e3f9..fb4f7e668019e2a2700a9618773ec728af592dd2 100644 --- a/service-biz/service-wechat-applet/service-wechat-applet-biz/src/main/resources/application-dev.yml +++ b/service-biz/service-wechat-applet/service-wechat-applet-biz/src/main/resources/application-dev.yml @@ -11,7 +11,7 @@ spring: # max-active: 5 # max-wait: 10000 # time-between-eviction-runs-millis: 3600000 - url: jdbc:mysql://192.168.2.106:3306/arxj?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull + url: jdbc:mysql://10.0.6.167:3306/arxj?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull username: root password: hncy@123 driver-class-name: com.mysql.cj.jdbc.Driver @@ -25,12 +25,12 @@ spring: cloud: nacos: discovery: - server-addr: 192.168.2.106:8002 + server-addr: 10.0.6.167:8002 #server-addr: 192.168.2.18 #namespace: d8b504aa-d27a-4b0a-96e4-2f39a957f082 #namespace: 7acba097-c4a9-45c4-aa72-013cfefc01a1 redis: - host: 192.168.2.106 + host: 10.0.6.167 port: 6379 password: hncy@123 diff --git a/service-biz/service-wechat-applet/service-wechat-applet-biz/src/main/resources/bootstrap.yml b/service-biz/service-wechat-applet/service-wechat-applet-biz/src/main/resources/bootstrap.yml index 2df31862418794fc6ac01ec30b17f785f9a08fe9..9948b9fa8fc3f40648a04156650b14f1f8badabb 100644 --- a/service-biz/service-wechat-applet/service-wechat-applet-biz/src/main/resources/bootstrap.yml +++ b/service-biz/service-wechat-applet/service-wechat-applet-biz/src/main/resources/bootstrap.yml @@ -4,7 +4,7 @@ spring: cloud: nacos: config: - server-addr: 192.168.2.106:8002 + server-addr: 10.0.6.167:8002 #server-addr: 192.168.2.18 file-extension: yaml #namespace: d8b504aa-d27a-4b0a-96e4-2f39a957f082 diff --git a/service-biz/service-wechat-applet/service-wechat-applet-biz/src/test/java/com/hncy/Test.java b/service-biz/service-wechat-applet/service-wechat-applet-biz/src/test/java/com/hncy/Test.java index 72029efb948ff79fec84545333e1d486608e3b20..dccff2c17015ae512413e9baae4b90cc0217bde8 100644 --- a/service-biz/service-wechat-applet/service-wechat-applet-biz/src/test/java/com/hncy/Test.java +++ b/service-biz/service-wechat-applet/service-wechat-applet-biz/src/test/java/com/hncy/Test.java @@ -14,6 +14,7 @@ import com.hncy.service.wechat.applet.biz.utils.CoordTransform; import com.hncy.service.wechat.applet.biz.vo.ComponentLocation; import org.springframework.beans.factory.annotation.Autowired; +import java.sql.SQLOutput; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -128,5 +129,77 @@ public class Test { } } + /** + * @Author: cs + * @Date: 2022/2/10 15:18 + * + * 一个数组有2n个元素,其中有n个奇数、n个偶数,数组无序,写一个算法使得奇数位置放置奇数,偶数位置放置偶数 + */ + @org.junit.Test + public void sort() { + int[] array = new int[]{1,2,1,2,1,1,1,2,2,2,2,1,1,2,2,2,2,2,2,2}; + for (int i=0; i < array.length-1; i++) { + int j = i+1; + if(i % 2 != 0) { //奇数位置 + if(array[i] % 2 == 1) { //不是偶数 + while (j< array.length-1) { + if(j % 2 == 0 && array[j] % 2 == 0) { + j++; + }else { + //如果是偶数则继续往后遍历 + if(array[j] % 2 == 1) { + j++; + }else { + break;//找到奇数 + } + } + } + int temp = array[j]; + array[j] = array[i]; + array[i] = temp; + } + }else { //偶数位置 + if(array[i] % 2 == 0) {//不是奇数 + while (j< array.length-1) { + //奇数位置放置的是奇数则往后遍历 + if(j % 2 != 0 && array[j] % 2 == 1) { + j++; + }else { + //如果是偶数则继续往后遍历 + if(array[j] % 2 == 0) { + j++; + }else { + break;//找到奇数 + } + } + } + int temp = array[j]; + array[j] = array[i]; + array[i] = temp; + } + } + } + for (int i : array) { + System.out.println(i); + } + } + + + @org.junit.Test + public void string() { +/* String A = "aaabbb"; + String B = new String("aaa")+new String("bbb"); + String C = B.intern(); + System.out.println(A==B); //false + System.out.println(A==C); //true +*/ + String B = new String("aaa")+new String("bbb"); + String C = B.intern(); + String A = "aaabbb"; + System.out.println(A==B); + System.out.println(A==C); + System.out.println(A.equals(B)); + System.out.println(A.equals(C)); + } }