2023-04-08-02

master
喻忠伟 2 years ago
parent 1e83257581
commit f05c26d52b
  1. 2
      ant-design-vue-jeecg/src/views/process/modules/ZyProcessForm.vue
  2. 86
      jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/XJobUtils.java

@ -9,7 +9,7 @@
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="服装类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="typeId">
<a-form-model-item label="服装类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="typeName ">
<j-popup
v-model="model.typeName"
field="type_name"

@ -0,0 +1,86 @@
package org.jeecg.common.util;
import org.springframework.util.StringUtils;
import java.beans.PropertyEditorSupport;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Random;
/**
* 定时类使用的方法
*/
public class XJobUtils{
/**
* 获取间隔时间
* @param start_Date
* @return
*/
public static Date randomIntervaltime(Date start_Date,int s,int e)
{
//将时间转为long类型
long start=start_Date.getTime();
//获取30-180秒对应毫秒
long intervalTime=randInt(s*60,s*60)*1000;
//总共花费时长
long timeMillis =start+intervalTime;
return longToDate(timeMillis);
}
/**
* 其实这是基于一个公式 如果要取一个范围在[min,max]之间的随机整数那么公式如下
* @param min
* @param max
* @return
*/
public static int randInt(int min,int max)
{
Random rand = new Random();
// nextInt通常不包含顶部值,因此加上1使其包含
int randomNum = rand.nextInt((max - min) + 1) + min;
return randomNum;
}
//将long转为日期
public static Date longToDate(long lo)
{
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//long转Date
Date date = null;
try {
date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(sd.format(new Date(lo)));
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
//间隔时间(秒)
public static long dateToLong(Date s,Date e)
{
long sl=s.getTime();
long el=e.getTime();
long r=el-sl;
return (el-sl)/1000;
}
//随机暂停s-e分钟()
public static void sleepTime(int s ,int e) throws InterruptedException {
Thread.sleep(randInt(60*1000*s,60*1000*e));
}
}
Loading…
Cancel
Save