|
|
@@ -4,6 +4,7 @@
|
|
|
package com.jeeplus.modules.omcandidate.web;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -155,28 +156,22 @@ public class OmCandidateController extends BaseController {
|
|
|
//获取并解析该条求职记录的归属过程
|
|
|
List<String> list =
|
|
|
omCandidateTrackService.findTrackBelongList(track.getStatus(), track.getCandidateId(), Integer.parseInt(track.getId()), track.getGenerateTime());
|
|
|
- System.err.println("=====111======"+list.toString());
|
|
|
+ String[] strArray = null;
|
|
|
String followUp = "", name;
|
|
|
if (list!=null && list.size()>0) {
|
|
|
+ strArray = new String[list.size()];
|
|
|
for(int i=0;i<list.size();i++) {
|
|
|
name = list.get(i);
|
|
|
if(name==null || name=="null" || name.isEmpty()) {
|
|
|
- followUp = followUp+"黑名单"+"—>";
|
|
|
- }else {
|
|
|
- followUp = followUp+name+"—>";
|
|
|
+ name = "黑名单";
|
|
|
}
|
|
|
- }
|
|
|
- if(followUp.endsWith(">")) {
|
|
|
- followUp = followUp.substring(0,followUp.lastIndexOf("—"));
|
|
|
+ strArray[i] = name;
|
|
|
}
|
|
|
}
|
|
|
- System.err.println("=====222======"+followUp);
|
|
|
- followUp = removeAdjacentDuplicates(followUp);
|
|
|
- System.err.println("=====333======"+followUp);
|
|
|
+ followUp = removeAdjacentDuplicates(strArray);
|
|
|
if(followUp.contains("—") && followUp.endsWith(">")) {
|
|
|
followUp = followUp.substring(0,followUp.lastIndexOf("—"));
|
|
|
}
|
|
|
- System.err.println("=====444======"+followUp);
|
|
|
track.setBelongUserFlow(followUp);
|
|
|
}
|
|
|
}
|
|
|
@@ -352,47 +347,29 @@ public class OmCandidateController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 删除字符串中的所有相邻重复项
|
|
|
- * @param String str
|
|
|
+ * @param String[] array
|
|
|
* @return
|
|
|
*/
|
|
|
- public static String removeAdjacentDuplicates(String str) {
|
|
|
- String array[] =str.split("—>");
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
- String a="",b="";
|
|
|
- if(array.length==1) {
|
|
|
- sb.append(array[0]);
|
|
|
- }else if(array.length==2) {
|
|
|
- if(array[0].equals(array[1])) {
|
|
|
- sb.append(array[0]);
|
|
|
- }else {
|
|
|
- sb.append(array[0]).append("—>").append(array[1]);
|
|
|
- }
|
|
|
- }else {
|
|
|
- for(int i=0;i<array.length-1;i++){
|
|
|
- if(!array[i].equals(array[i+1])) {
|
|
|
- if(i==array.length-2) {
|
|
|
- a = array[i+1];
|
|
|
- }else if(i==0){
|
|
|
- a = array[i]+"—>";
|
|
|
- }else {
|
|
|
- a = array[i+1]+"—>";
|
|
|
- }
|
|
|
- if(a.equals(b)) {
|
|
|
- a = array[i+1]+"—>";
|
|
|
- continue;
|
|
|
- }
|
|
|
- b = a;
|
|
|
- }else {
|
|
|
- a = array[i+1]+"—>";
|
|
|
- if(a.equals(b)) {
|
|
|
- a = array[i+1]+"—>";
|
|
|
- continue;
|
|
|
- }
|
|
|
- b = a;
|
|
|
- }
|
|
|
- sb.append(a);
|
|
|
+ public static String removeAdjacentDuplicates(String[] array) {
|
|
|
+ if(array == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ int i = 0;
|
|
|
+ for(int j = 1; j < array.length; j ++) {
|
|
|
+ if(!array[j].equals(array[i])) {
|
|
|
+ i++;
|
|
|
+ array[i] = array[j];
|
|
|
}
|
|
|
}
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ String[] newArray = Arrays.copyOf(array, i+1);
|
|
|
+ for(String s:newArray){
|
|
|
+ sb.append(s).append("—>");
|
|
|
+ }
|
|
|
return sb.toString();
|
|
|
}
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String[] ss = {"李云龙","李云龙","李云龙"};
|
|
|
+ System.err.println(removeAdjacentDuplicates(ss));
|
|
|
+ }
|
|
|
}
|