Merge remote-tracking branch 'origin/master'

master
zhaoxiaolin 7 months ago
commit 3ef576ff0f

@ -164,4 +164,12 @@ public class Constants {
//ZL0030-品质异常流程
public static final Integer WORKFLOWID_ZL0030=26256;
//榄菊集团缩写
public static final String LJ="LJ";
//产出状态
public static final String OUTPUT_STATUS_A="A";
}

@ -1,15 +1,15 @@
package com.op.common.core.utils;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
import org.springframework.util.AntPathMatcher;
import com.op.common.core.constant.Constants;
import com.op.common.core.text.StrFormatter;
/**
*
*
*
* @author OP
*/
public class StringUtils extends org.apache.commons.lang3.StringUtils {
@ -21,7 +21,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
*
*
*
* @param value defaultValue value
* @return value
*/
@ -31,7 +31,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* * Collection ListSetQueue
*
*
* @param coll Collection
* @return true false
*/
@ -41,7 +41,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* * CollectionListSetQueue
*
*
* @param coll Collection
* @return true false
*/
@ -51,7 +51,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* *
*
*
* @param objects
** @return true false
*/
@ -61,7 +61,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* *
*
*
* @param objects
* @return true false
*/
@ -71,7 +71,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* * Map
*
*
* @param map Map
* @return true false
*/
@ -81,7 +81,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* * Map
*
*
* @param map Map
* @return true false
*/
@ -91,7 +91,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* *
*
*
* @param str String
* @return true false
*/
@ -101,7 +101,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* *
*
*
* @param str String
* @return true false
*/
@ -111,7 +111,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* *
*
*
* @param object Object
* @return true false
*/
@ -121,7 +121,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* *
*
*
* @param object Object
* @return true false
*/
@ -131,7 +131,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* * Java
*
*
* @param object
* @return true false
*/
@ -148,7 +148,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
*
*
*
* @param str
* @param start
* @return
@ -174,7 +174,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
*
*
*
* @param str
* @param start
* @param end
@ -212,7 +212,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
*
*
*
* @param str value
* @return
*/
@ -238,7 +238,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* 使format("this is {} for {}", "a", "b") -> this is a for b<br>
* {} format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
* \ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
*
*
* @param template {}
* @param params
* @return
@ -252,7 +252,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* http(s)://开头
*
*
* @param link
* @return
*/
@ -321,7 +321,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
*
*
*
* @param str
* @param strs
* @return true
@ -340,7 +340,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* 线线
* HELLO_WORLD->HelloWorld
*
*
* @param name 线
* @return
*/
@ -398,7 +398,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
*
*
*
* @param str
* @param strs
* @return
@ -417,7 +417,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* url: ? ; * ; ** ;
*
*
* @param pattern
* @param url url
* @return
@ -434,7 +434,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* 0使size size
*
*
* @param num
* @param size
* @return
@ -445,7 +445,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* ssizesize
*
*
* @param s
* @param size
* @param c
@ -470,4 +470,35 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
}
return sb.toString();
}
/**
*
* @param factoryCode
* @param lineCode 线
* @param productDate
* @param version
* @param productStatus A
* @param content (0)
* @return
*/
public static final List<String> batchAutoCreate(String factoryCode, String lineCode, Date productDate,String version, String content,int batchNum){
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyyMMdd");
// Create a Calendar instance and set it to the current date
Calendar calendar = Calendar.getInstance();
calendar.setTime(productDate);
// Add three years to the current date
calendar.add(Calendar.YEAR, 3);
// Subtract one day from the new date
calendar.add(Calendar.DAY_OF_MONTH, -1);
// Get the new date
Date futureDate = calendar.getTime();
// Format the new date
String toValidity = targetFormat.format(futureDate);
List<String> batchList=new ArrayList<>();
for (char letter = 'A'; letter < 'A' + batchNum; letter++) {
String BatchCode=toValidity+Constants.LJ+targetFormat.format(productDate)+lineCode+factoryCode+letter+Constants.OUTPUT_STATUS_A+content+version;
batchList.add(BatchCode);
}
return batchList;
}
}

Loading…
Cancel
Save