|
@@ -6,6 +6,7 @@ import com.management.platform.mapper.*;
|
|
import com.management.platform.service.PlanProcedureTotalService;
|
|
import com.management.platform.service.PlanProcedureTotalService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
|
+import org.apache.logging.log4j.util.Chars;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
@@ -106,30 +107,47 @@ public class PlanProcedureTotalServiceImpl extends ServiceImpl<PlanProcedureTota
|
|
if(planSteelStampNumber.getSteelStampNumberEnd().equals(planSteelStampNumber.getSteelStampNumberStart())){
|
|
if(planSteelStampNumber.getSteelStampNumberEnd().equals(planSteelStampNumber.getSteelStampNumberStart())){
|
|
list.add(planSteelStampNumber.getSteelStampNumberStart());
|
|
list.add(planSteelStampNumber.getSteelStampNumberStart());
|
|
}else {
|
|
}else {
|
|
- //获取公有部分
|
|
|
|
- char[] chars = planSteelStampNumber.getSteelStampNumberStart().toCharArray();
|
|
|
|
- char[] chars2 = planSteelStampNumber.getSteelStampNumberEnd().toCharArray();
|
|
|
|
- int indexFor=0;
|
|
|
|
- for (int i = 0; i < chars.length; i++) {
|
|
|
|
- if(chars[i]!=chars2[i]){
|
|
|
|
- indexFor+=i;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- String allHasString=planSteelStampNumber.getSteelStampNumberStart().substring(0,indexFor);
|
|
|
|
- String start=planSteelStampNumber.getSteelStampNumberStart().substring(indexFor);
|
|
|
|
- String end=planSteelStampNumber.getSteelStampNumberEnd().substring(indexFor);
|
|
|
|
- //判断是否都是纯数字
|
|
|
|
- if(!start.matches("\\d+")||!end.matches("\\d+")){
|
|
|
|
- list.add(planSteelStampNumber.getSteelStampNumberStart());
|
|
|
|
- list.add(planSteelStampNumber.getSteelStampNumberEnd());
|
|
|
|
- }else {
|
|
|
|
|
|
+ if(planSteelStampNumber.getRuleIndexStart()!=null&&planSteelStampNumber.getRuleIndexEnd()!=null){
|
|
|
|
+ Integer startIndex = Integer.valueOf(planSteelStampNumber.getRuleIndexStart());
|
|
|
|
+ Integer endIndex = Integer.valueOf(planSteelStampNumber.getRuleIndexEnd());
|
|
|
|
+ int count = endIndex - startIndex;
|
|
|
|
+ String start=planSteelStampNumber.getSteelStampNumberStart().substring(startIndex-1,endIndex);
|
|
|
|
+ String end=planSteelStampNumber.getSteelStampNumberEnd().substring(startIndex-1,endIndex);
|
|
|
|
+ String subOne = planSteelStampNumber.getSteelStampNumberStart().substring(0, startIndex-1);
|
|
|
|
+ String subTwo = planSteelStampNumber.getSteelStampNumberStart().substring(endIndex);
|
|
|
|
+ //判断是否都是纯数字
|
|
int index=Integer.valueOf(start);
|
|
int index=Integer.valueOf(start);
|
|
while (Integer.valueOf(end)>index){
|
|
while (Integer.valueOf(end)>index){
|
|
- list.add(allHasString+String.valueOf(index));
|
|
|
|
|
|
+ list.add(subOne+String.format("%0"+(count+1)+"d",index)+subTwo);
|
|
index++;
|
|
index++;
|
|
}
|
|
}
|
|
- list.add(allHasString+end);
|
|
|
|
|
|
+ list.add(subOne+String.valueOf(index)+subTwo);
|
|
|
|
+ }else {
|
|
|
|
+ //获取公有部分
|
|
|
|
+ char[] chars = planSteelStampNumber.getSteelStampNumberStart().toCharArray();
|
|
|
|
+ char[] chars2 = planSteelStampNumber.getSteelStampNumberEnd().toCharArray();
|
|
|
|
+ int indexFor=0;
|
|
|
|
+ for (int i = 0; i < chars.length; i++) {
|
|
|
|
+ if(chars[i]!=chars2[i]){
|
|
|
|
+ indexFor+=i;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String allHasString=planSteelStampNumber.getSteelStampNumberStart().substring(0,indexFor);
|
|
|
|
+ String start=planSteelStampNumber.getSteelStampNumberStart().substring(indexFor);
|
|
|
|
+ String end=planSteelStampNumber.getSteelStampNumberEnd().substring(indexFor);
|
|
|
|
+ //判断是否都是纯数字
|
|
|
|
+ if(!start.matches("\\d+")||!end.matches("\\d+")){
|
|
|
|
+ list.add(planSteelStampNumber.getSteelStampNumberStart());
|
|
|
|
+ list.add(planSteelStampNumber.getSteelStampNumberEnd());
|
|
|
|
+ }else {
|
|
|
|
+ int index=Integer.valueOf(start);
|
|
|
|
+ while (Integer.valueOf(end)>index){
|
|
|
|
+ list.add(allHasString+String.valueOf(index));
|
|
|
|
+ index++;
|
|
|
|
+ }
|
|
|
|
+ list.add(allHasString+end);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -141,4 +159,29 @@ public class PlanProcedureTotalServiceImpl extends ServiceImpl<PlanProcedureTota
|
|
}
|
|
}
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ PlanSteelStampNumber planSteelStampNumber=new PlanSteelStampNumber();
|
|
|
|
+ planSteelStampNumber.setSteelStampNumberStart("LEW00021098-0001");
|
|
|
|
+ planSteelStampNumber.setSteelStampNumberEnd("LEW00021111-0001");
|
|
|
|
+ planSteelStampNumber.setRuleIndexStart(9);
|
|
|
|
+ planSteelStampNumber.setRuleIndexEnd(11);
|
|
|
|
+ //根据起始位置判断位数
|
|
|
|
+ List<String> list=new ArrayList<>();
|
|
|
|
+ Integer startIndex = Integer.valueOf(planSteelStampNumber.getRuleIndexStart());
|
|
|
|
+ Integer endIndex = Integer.valueOf(planSteelStampNumber.getRuleIndexEnd());
|
|
|
|
+ int count = endIndex - startIndex;
|
|
|
|
+ String start=planSteelStampNumber.getSteelStampNumberStart().substring(startIndex-1,endIndex);
|
|
|
|
+ String end=planSteelStampNumber.getSteelStampNumberEnd().substring(startIndex-1,endIndex);
|
|
|
|
+ String subOne = planSteelStampNumber.getSteelStampNumberStart().substring(0, startIndex-1);
|
|
|
|
+ String subTwo = planSteelStampNumber.getSteelStampNumberStart().substring(endIndex);
|
|
|
|
+ //判断是否都是纯数字
|
|
|
|
+ int index=Integer.valueOf(start);
|
|
|
|
+ while (Integer.valueOf(end)>index){
|
|
|
|
+ list.add(subOne+String.format("%0"+(count+1)+"d",index)+subTwo);
|
|
|
|
+ index++;
|
|
|
|
+ }
|
|
|
|
+ list.add(subOne+String.valueOf(index)+subTwo);
|
|
|
|
+ System.out.println(list);
|
|
|
|
+ }
|
|
}
|
|
}
|