java date cdate fasttime_基本功之Date.class源码

Java Date类详解
本文详细介绍了Java中的Date类,包括其构造方法、日期时间操作、序列化及克隆等功能。探讨了Date类如何表示特定瞬间,并说明了在JDK 1.1之后,推荐使用Calendar和DateFormat类进行日期和时间的操作。

package java.util;

import java.text.DateFormat;

import java.io.IOException;

import java.io.ObjectOutputStream;

import java.io.ObjectInputStream;

import java.lang.ref.SoftReference;

import sun.util.calendar.BaseCalendar;

import sun.util.calendar.CalendarDate;

import sun.util.calendar.CalendarSystem;

import sun.util.calendar.CalendarUtils;

import sun.util.calendar.Era;

import sun.util.calendar.Gregorian;

import sun.util.calendar.ZoneInfo;

类 Date 表示特定的瞬间,精确到毫秒。

在 JDK 1.1 之前,类 Date

有两个其他的函数。它允许把日期解释为年、月、日、小时、分钟和秒值。它也允许格式化和解析日期字符串。不过,这些函数的 API

不易于实现国际化。从 JDK 1.1 开始,应该使用 Calendar

类实现日期和时间字段之间转换,使用 DateFormat

类来格式化和解析日期字符串。Date 中的相应方法已废弃。

尽管 Date 类打算反映协调世界时 (UTC),但无法做到如此准确,这取决于 Java

虚拟机的主机环境。当前几乎所有操作系统都假定 1 天 =

24 × 60 × 60 =

86400 秒。但对于 UTC,大约每一两年出现一次额外的一秒,称为“闰秒”。闰秒始终作为当天的最后一秒增加,并且始终在 12 月

31 日或 6 月 30 日增加。例如,1995 年的最后一分钟是 61

秒,因为增加了闰秒。大多数计算机时钟不是特别的准确,因此不能反映闰秒的差别。

一些计算机标准是按照格林威治标准时 (GMT) 定义的,格林威治标准时和世界时 (UT) 是相等的。GMT

是标准的“民间”名称;UT 是相同标准的“科学”名称。UTC 和 UT 的区别是:UTC 是基于原子时钟的,UT

是基于天体观察的,两者在实际应用中难分轩轾。因为地球的旋转不是均匀的(它以复杂的方式减速和加速),所以 UT

始终不是均匀地流过。闰秒是根据需要引入 UTC 的,以便把 UTC 保持在 UT1 的 0.9 秒之内,UT1 是应用了某些更正的

UT 版本。还有其他的时间和日期系统;例如,基于卫星的全球定位系统 (GPS) 使用的时间刻度与 UTC 同步,但没有

针对闰秒进行调整。有关更多信息的一个有趣来源是美国海军天文台,特别是 Directorate of Time 的网址:

还有它们对 "Systems of Time" 的定义,网址为:

在类 Date

所有可以接受或返回年、月、日期、小时、分钟和秒值的方法中,将使用下面的表示形式:

年份 y 由整数

y - 1900

表示。

月份由从 0 至 11 的整数表示;0 是一月、1 是二月等等;因此 11 是十二月。

日期(一月中的某天)按通常方式由整数 1 至 31 表示。

小时由从 0 至 23 的整数表示。因此,从午夜到 1 a.m. 的时间是 0 点,从中午到 1 p.m. 的时间是 12

点。

分钟按通常方式由 0 至 59 的整数表示。

秒由 0 至 61 的整数表示;值 60 和 61 只对闰秒发生,尽管那样,也只用在实际正确跟踪闰秒的 Java

实现中。于按当前引入闰秒的方式,两个闰秒在同一分钟内发生是极不可能的,但此规范遵循 ISO C 的日期和时间约定。

在所有情形中,针对这些目的赋予方法的参数不需要在指定的范围内;例如,可以把日期指定为 1 月 32 日,并把它解释为 2 月 1

日的相同含义。

public class Date

implements

java.io.Serializable, Cloneable, Comparable

{

private static final

BaseCalendar gcal =

CalendarSystem.getGregorianCalendar();

private static

BaseCalendar jcal;

private transient long

fastTime;

private transient

BaseCalendar.Date cdate;

// Initialized just

before the value is used. See parse().

private static int

defaultCenturyStart;

private static final

long serialVersionUID = 7523967970034938905L;

分配Date对象并初始化此对象,以表示分配它的时间(精确到毫秒)。

public Date() {

this(System.currentTimeMillis());

}

分配Date对象并初始化此对象,以表示自从标准基准时间(称为“历元(epoch)”,即

1970 年 1 月 1 日 00:00:00 GMT)以来的指定毫秒数。

public Date(long date)

{

fastTime = date;

}

返回此对象的副本。

public Object clone()

{

Date d = null;

try {

d =

(Date)super.clone();

if (cdate != null)

{

d.cdate = (BaseCalendar.Date) cdate.clone();

}

} catch (CloneNotSupportedException e) {} //

Won't happen

return d;

}

private final static

String wtb[] = {

"am", "pm",

"monday", "tuesday", "wednesday", "thursday",

"friday",

"saturday", "sunday",

"january", "february", "march", "april", "may",

"june",

"july", "august", "september", "october",

"november", "december",

"gmt", "ut", "utc", "est", "edt", "cst",

"cdt",

"mst", "mdt", "pst", "pdt"

};

private final static int

ttb[] = {

14, 1, 0, 0, 0, 0, 0, 0, 0,

2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,

10000 + 0, 10000 + 0, 10000 + 0,

// GMT/UT/UTC

10000 + 5 * 60, 10000 + 4 * 60,

// EST/EDT

10000 + 6 * 60, 10000 + 5 * 60,

// CST/CDT

10000 + 7 * 60, 10000 + 6 * 60,

// MST/MDT

10000 + 8 * 60, 10000 + 7 * 60

//

PST/PDT

};

public long getTime()

{

return getTimeImpl();

}

private final long

getTimeImpl() {

if (cdate != null && !cdate.isNormalized()) {

normalize();

}

return fastTime;

}

public void setTime(long

time) {

fastTime = time;

cdate = null;

}

public boolean

before(Date when) {

return getMillisOf(this) <

getMillisOf(when);

}

public boolean

after(Date when) {

return getMillisOf(this) >

getMillisOf(when);

}

public boolean

equals(Object obj) {

return obj instanceof Date && getTime()

== ((Date) obj).getTime();

}

static final long

getMillisOf(Date date) {

if (date.cdate == null || date.cdate.isNormalized()) {

return

date.fastTime;

}

BaseCalendar.Date d = (BaseCalendar.Date)

date.cdate.clone();

return gcal.getTime(d);

}

public int

compareTo(Date anotherDate) {

long thisTime = getMillisOf(this);

long anotherTime = getMillisOf(anotherDate);

return (thisTime

}

public int hashCode()

{

long ht = this.getTime();

return (int) ht ^ (int) (ht >> 32);

}

public String toString()

{

// "EEE MMM dd HH:mm:ss zzz yyyy";

BaseCalendar.Date date = normalize();

StringBuilder sb = new StringBuilder(28);

int index = date.getDayOfWeek();

if (index == gcal.SUNDAY) {

index = 8;

}

convertToAbbr(sb, wtb[index]).append(' ');

// EEE

convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append('

');  // MMM

CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 2).append('

'); // dd

CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':');

// HH

CalendarUtils.sprintf0d(sb, date.getMinutes(), 2).append(':');

// mm

CalendarUtils.sprintf0d(sb, date.getSeconds(), 2).append(' ');

// ss

TimeZone zi = date.getZone();

if (zi != null) {

sb.append(zi.getDisplayName(date.isDaylightTime(), zi.SHORT,

Locale.US)); // zzz

} else {

sb.append("GMT");

}

sb.append(' ').append(date.getYear());  //

yyyy

return sb.toString();

}

private static final

StringBuilder convertToAbbr(StringBuilder sb, String name) {

sb.append(Character.toUpperCase(name.charAt(0)));

sb.append(name.charAt(1)).append(name.charAt(2));

return sb;

}

private final

BaseCalendar.Date getCalendarDate() {

if (cdate == null) {

BaseCalendar cal =

getCalendarSystem(fastTime);

cdate =

(BaseCalendar.Date) cal.getCalendarDate(fastTime,

TimeZone.getDefaultRef());

}

return cdate;

}

private final

BaseCalendar.Date normalize() {

if (cdate == null) {

BaseCalendar cal =

getCalendarSystem(fastTime);

cdate =

(BaseCalendar.Date) cal.getCalendarDate(fastTime,

TimeZone.getDefaultRef());

return cdate;

}

// Normalize cdate with the TimeZone in cdate first. This

is

// required for the compatible behavior.

if (!cdate.isNormalized()) {

cdate =

normalize(cdate);

}

// If the default TimeZone has changed, then recalculate

the

// fields with the new TimeZone.

TimeZone tz = TimeZone.getDefaultRef();

if (tz != cdate.getZone()) {

cdate.setZone(tz);

CalendarSystem cal =

getCalendarSystem(cdate);

cal.getCalendarDate(fastTime, cdate);

}

return cdate;

}

// fastTime and the

returned data are in sync upon return.

private final

BaseCalendar.Date normalize(BaseCalendar.Date date) {

int y = date.getNormalizedYear();

int m = date.getMonth();

int d = date.getDayOfMonth();

int hh = date.getHours();

int mm = date.getMinutes();

int ss = date.getSeconds();

int ms = date.getMillis();

TimeZone tz = date.getZone();

// If the specified year can't be handled using a long

value

// in milliseconds, GregorianCalendar is used for full

// compatibility with underflow and overflow. This is

required

// by some JCK tests. The limits are based max year values

-

// years that can be represented by max values of d, hh,

mm,

// ss and ms. Also, let GregorianCalendar handle the

default

// cutover year so that we don't need to worry about the

// transition here.

if (y == 1582 || y > 280000000 || y < -280000000)

{

if (tz == null) {

tz = TimeZone.getTimeZone("GMT");

}

GregorianCalendar gc =

new GregorianCalendar(tz);

gc.clear();

gc.set(gc.MILLISECOND,

ms);

gc.set(y, m-1, d, hh, mm,

ss);

fastTime =

gc.getTimeInMillis();

BaseCalendar cal =

getCalendarSystem(fastTime);

date =

(BaseCalendar.Date) cal.getCalendarDate(fastTime, tz);

return date;

}

BaseCalendar cal = getCalendarSystem(y);

if (cal != getCalendarSystem(date)) {

date =

(BaseCalendar.Date) cal.newCalendarDate(tz);

date.setNormalizedDate(y,

m, d).setTimeOfDay(hh, mm, ss, ms);

}

// Perform the GregorianCalendar-style normalization.

fastTime = cal.getTime(date);

// In case the normalized date requires the other

calendar

// system, we need to recalculate it using the other

one.

BaseCalendar ncal = getCalendarSystem(fastTime);

if (ncal != cal) {

date =

(BaseCalendar.Date) ncal.newCalendarDate(tz);

date.setNormalizedDate(y,

m, d).setTimeOfDay(hh, mm, ss, ms);

fastTime =

ncal.getTime(date);

}

return date;

}

private static final

BaseCalendar getCalendarSystem(int year) {

if (year >= 1582) {

return gcal;

}

return getJulianCalendar();

}

private static final

BaseCalendar getCalendarSystem(long utc) {

// Quickly check if the time stamp given by `utc' is the

Epoch

// or later. If it's before 1970, we convert the cutover

to

// local time to compare.

if (utc >= 0

|| utc >=

GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER

- TimeZone.getDefaultRef().getOffset(utc)) {

return gcal;

}

return getJulianCalendar();

}

private static final

BaseCalendar getCalendarSystem(BaseCalendar.Date cdate) {

if (jcal == null) {

return gcal;

}

if (cdate.getEra() != null) {

return jcal;

}

return gcal;

}

synchronized private

static final BaseCalendar getJulianCalendar() {

if (jcal == null) {

jcal = (BaseCalendar)

CalendarSystem.forName("julian");

}

return jcal;

}

private void

writeObject(ObjectOutputStream s)

throws IOException

{

s.writeLong(getTimeImpl());

}

private void

readObject(ObjectInputStream s)

throws IOException,

ClassNotFoundException

{

fastTime = s.readLong();

}

}

DELETE FROM amdw_ods.s41_trequeststat_test WHERE --d_cdate BETWEEN to_char(TO_DATE('${job.biz.date}', 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd') AND '${job.biz.date}'; D_CDATE >= to_char( TO_DATE(replace('${job.biz.nearly_tradeday}', '-', ''), 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd' ) AND D_CDATE <= ( SELECT n_next_trdy :: VARCHAR FROM amdw_dw.t00_base_date WHERE n_date = ${job.biz.date} LIMIT 1 ); INSERT INTO amdw_ods.s41_trequeststat_test ( D_CDATE, C_FUNDCODE, C_OTHERCODE, C_AGENCYNO, C_BUSINFLAG, L_COUNT, F_BALANCE, F_SHARES, L_VALIDCOUNT, F_VALIDBALANCE, F_VALIDSHARES, F_RATIONBALANCE, L_INVALIDCOUNT, F_INVALIDBALANCE, F_INVALIDSHARES, L_POSTCOUNT, F_POSTBALANCE, F_POSTSHARES, L_BESPEAKCOUNT, F_BESPEAKBALANCE, F_BESPEAKSHARES, F_CHGOUTSHAREATCHGIN ) WITH request_count_tmp AS ( SELECT count(1) AS num, SUM(COALESCE(application_vol, 0)) AS application_vol, SUM(COALESCE(application_amount, 0)) AS application_amount, a.transaction_cfm_date, a.fund_code, a.distributor_code, a.business_code1, a.check_result1 check_result FROM ( SELECT t.distributor_code, t.fund_code, t.transaction_cfm_date, t.application_amount, t.application_vol, t.sys_code, DECODE(t.check_result, '2', '0', '0', '0', '1') check_result1, DECODE( t.BUSINESS_CODE, '020', '01', '022', '02', '039', '02', '042', '03', '024', '03', '029', '07', '030', '50', '051', '51', '050', '52', '049', '54', '044', '70', '045', '71', '043', '74', '033', '12', '098', '12', '038', '13', '035', '14', '096', '14', '034', '15', '097', '15', '037', '16', '026', '20', '027', '21', '028', '22', '059', '90', '060', '93', '026', '04', '027', '05', '028', '06', '031', '10', '032', '11', t.BUSINESS_CODE ) AS BUSINESS_CODE1 FROM ( SELECT sys_code, application_vol, application_amount, transaction_cfm_date, fund_code, distributor_code, BUSINESS_CODE, check_result FROM amdw_ods.s40_trade_request WHERE sys_code = 'ZJ' --AND transaction_cfm_date BETWEEN to_char(TO_DATE('${job.biz.date}', 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd') AND '${job.biz.date}' AND transaction_cfm_date >= to_char( TO_DATE(replace('${job.biz.nearly_tradeday}', '-', ''), 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd' ) AND transaction_cfm_date <= ( SELECT n_next_trdy :: VARCHAR FROM amdw_dw.t00_base_date WHERE n_date = ${job.biz.date} LIMIT 1 ) UNION ALL SELECT sys_code, application_vol, application_amount, transaction_cfm_date, fund_code, distributor_code, BUSINESS_CODE, check_result FROM amdw_ods.s40_trade_request_log WHERE sys_code = 'ZJ' -- AND transaction_cfm_date BETWEEN to_char(TO_DATE('${job.biz.date}', 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd') AND '${job.biz.date}' AND transaction_cfm_date >= to_char( TO_DATE(replace('${job.biz.nearly_tradeday}', '-', ''), 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd' ) AND transaction_cfm_date <= ( SELECT n_next_trdy :: VARCHAR FROM amdw_dw.t00_base_date WHERE n_date = ${job.biz.date} LIMIT 1 ) ) t ) a GROUP BY a.transaction_cfm_date, a.fund_code, a.distributor_code, a.business_code1, a.check_result1 ), account_confirm_stat_tmp AS ( SELECT a.distributor_code, a.business_code, a.transaction_cfm_date, a.check_result, count(1) num FROM ( SELECT a.sys_code, a.distributor_code, a.business_code, a.transaction_cfm_date, a.check_result FROM amdw_ods.s40_account_request_log a WHERE sys_code = 'ZJ' --AND transaction_cfm_date BETWEEN to_char(TO_DATE('${job.biz.date}', 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd') AND '${job.biz.date}' AND transaction_cfm_date >= to_char( TO_DATE(replace('${job.biz.nearly_tradeday}', '-', ''), 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd' ) AND transaction_cfm_date <= ( SELECT n_next_trdy :: VARCHAR FROM amdw_dw.t00_base_date WHERE n_date = ${job.biz.date} LIMIT 1 ) UNION ALL SELECT a.sys_code, a.distributor_code, a.business_code, a.transaction_cfm_date, a.check_result FROM amdw_ods.s40_account_request a WHERE sys_code = 'ZJ' -- AND transaction_cfm_date BETWEEN to_char(TO_DATE('${job.biz.date}', 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd') AND '${job.biz.date}' AND transaction_cfm_date >= to_char( TO_DATE(replace('${job.biz.nearly_tradeday}', '-', ''), 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd' ) AND transaction_cfm_date <= ( SELECT n_next_trdy :: VARCHAR FROM amdw_dw.t00_base_date WHERE n_date = ${job.biz.date} LIMIT 1 ) ) a GROUP BY a.distributor_code, a.business_code, a.transaction_cfm_date, a.check_result ) SELECT t.D_CDATE AS D_CDATE, t.C_FUNDCODE AS C_FUNDCODE, t.C_OTHERCODE AS C_OTHERCODE, t.C_AGENCYNO AS C_AGENCYNO, t.C_BUSINFLAG AS C_BUSINFLAG, COALESCE(t.L_COUNT, 0) AS L_COUNT, t.F_BALANCE AS F_BALANCE, t.F_SHARES AS F_SHARES, COALESCE(t.L_VALIDCOUNT, 0) AS L_VALIDCOUNT, t.F_VALIDBALANCE AS F_VALIDBALANCE, t.F_VALIDSHARES AS F_VALIDSHARES, t.F_RATIONBALANCE AS F_RATIONBALANCE, COALESCE(t.L_INVALIDCOUNT, 0) AS L_INVALIDCOUNT, t.F_INVALIDBALANCE AS F_INVALIDBALANCE, t.F_INVALIDSHARES AS F_INVALIDSHARES, COALESCE(t.L_POSTCOUNT, 0) AS L_POSTCOUNT, t.F_POSTBALANCE AS F_POSTBALANCE, t.F_POSTSHARES AS F_POSTSHARES, COALESCE(t.L_BESPEAKCOUNT, 0) AS L_BESPEAKCOUNT, t.F_BESPEAKBALANCE AS F_BESPEAKBALANCE, t.F_BESPEAKSHARES AS F_BESPEAKSHARES, t.F_CHGOUTSHAREATCHGIN AS F_CHGOUTSHAREATCHGIN FROM ( SELECT D_CDATE AS D_CDATE, C_FUNDCODE AS C_FUNDCODE, C_OTHERCODE AS C_OTHERCODE, C_AGENCYNO AS C_AGENCYNO, C_BUSINFLAG AS C_BUSINFLAG, SUM(L_COUNT) L_COUNT, SUM(F_BALANCE) F_BALANCE, SUM(F_SHARES) F_SHARES, SUM(L_VALIDCOUNT) L_VALIDCOUNT, SUM(F_VALIDBALANCE) F_VALIDBALANCE, SUM(F_VALIDSHARES) F_VALIDSHARES, SUM(F_RATIONBALANCE) F_RATIONBALANCE, SUM(L_INVALIDCOUNT) L_INVALIDCOUNT, SUM(F_INVALIDBALANCE) F_INVALIDBALANCE, SUM(F_INVALIDSHARES) F_INVALIDSHARES, SUM(L_POSTCOUNT) L_POSTCOUNT, SUM(F_POSTBALANCE) F_POSTBALANCE, SUM(F_POSTSHARES) F_POSTSHARES, SUM(L_BESPEAKCOUNT) L_BESPEAKCOUNT, SUM(F_BESPEAKBALANCE) F_BESPEAKBALANCE, SUM(F_BESPEAKSHARES) F_BESPEAKSHARES, SUM(F_CHGOUTSHAREATCHGIN) F_CHGOUTSHAREATCHGIN FROM ( SELECT t.TRANSACTION_CFM_DATE AS D_CDATE, t.FUND_CODE AS C_FUNDCODE, '******' AS C_OTHERCODE, t.distributor_code AS C_AGENCYNO, substr(t.business_code1 (1,2)) AS C_BUSINFLAG, L_COUNT L_COUNT, F_BALANCE F_BALANCE, F_SHARES F_SHARES, t1.num L_VALIDCOUNT, t1.application_amount F_VALIDBALANCE, t1.application_vol F_VALIDSHARES, 0 F_RATIONBALANCE, t2.num L_INVALIDCOUNT, t2.application_amount F_INVALIDBALANCE, t2.application_vol F_INVALIDSHARES, 0 L_POSTCOUNT, 0 F_POSTBALANCE, 0 F_POSTSHARES, 0 L_BESPEAKCOUNT, 0 F_BESPEAKBALANCE, 0 F_BESPEAKSHARES, 0 F_CHGOUTSHAREATCHGIN FROM ( SELECT a.TRANSACTION_CFM_DATE AS TRANSACTION_CFM_DATE, a.FUND_CODE AS FUND_CODE, a.DISTRIBUTOR_CODE AS DISTRIBUTOR_CODE, a.business_code1 AS business_code1, count(1) AS L_COUNT, --笔数 SUM(COALESCE(a.APPLICATION_AMOUNT, 0)) AS F_BALANCE, --申请金额 SUM(COALESCE(a.APPLICATION_VOL, 0)) AS F_SHARES --申请份额 FROM ( SELECT tr.*, DECODE( tr.BUSINESS_CODE, '020', '01', '022', '02', '039', '02', '042', '03', '024', '03', '029', '07', '030', '50', '051', '51', '050', '52', '049', '54', '044', '70', '045', '71', '043', '74', '033', '12', '098', '12', '038', '13', '035', '14', '096', '14', '034', '15', '097', '15', '037', '16', '026', '20', '027', '21', '028', '22', '059', '90', '060', '93', '026', '04', '027', '05', '028', '06', '031', '10', '032', '11', tr.BUSINESS_CODE ) AS BUSINESS_CODE1 FROM ( SELECT sys_code, TRANSACTION_CFM_DATE, FUND_CODE, DISTRIBUTOR_CODE, BUSINESS_CODE, APPLICATION_AMOUNT, APPLICATION_VOL FROM amdw_ods.s40_trade_request WHERE sys_code = 'ZJ' --AND transaction_cfm_date BETWEEN to_char(TO_DATE('${job.biz.date}', 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd') AND '${job.biz.date}' AND transaction_cfm_date >= to_char( TO_DATE(replace('${job.biz.nearly_tradeday}', '-', ''), 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd' ) AND transaction_cfm_date <= ( SELECT n_next_trdy :: VARCHAR FROM amdw_dw.t00_base_date WHERE n_date = ${job.biz.date} LIMIT 1 ) UNION ALL SELECT sys_code, TRANSACTION_CFM_DATE, FUND_CODE, DISTRIBUTOR_CODE, BUSINESS_CODE, APPLICATION_AMOUNT, APPLICATION_VOL FROM amdw_ods.s40_trade_request_log WHERE sys_code = 'ZJ' -- AND transaction_cfm_date BETWEEN to_char(TO_DATE('${job.biz.date}', 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd') AND '${job.biz.date}' AND transaction_cfm_date >= to_char( TO_DATE(replace('${job.biz.nearly_tradeday}', '-', ''), 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd' ) AND transaction_cfm_date <= ( SELECT n_next_trdy :: VARCHAR FROM amdw_dw.t00_base_date WHERE n_date = ${job.biz.date} LIMIT 1 ) ) tr ) a GROUP BY a.transaction_cfm_date, a.fund_code, a.distributor_code, a.business_code1 ) t LEFT JOIN request_count_tmp t1 ON t.transaction_cfm_date = t1.transaction_cfm_date AND t.fund_code = t1.fund_code AND t.distributor_code = t1.distributor_code AND t.business_code1 = t1.business_code1 AND t1.check_result = '1' LEFT JOIN request_count_tmp t2 ON t.transaction_cfm_date = t2.transaction_cfm_date AND t.fund_code = t2.fund_code AND t.distributor_code = t2.distributor_code AND t.business_code1 = t2.business_code1 AND t2.check_result = '0' ) t GROUP BY D_CDATE, C_FUNDCODE, C_OTHERCODE, C_AGENCYNO, C_BUSINFLAG ) t UNION ALL SELECT t.transaction_cfm_date AS D_CDATE, '******' AS C_FUNDCODE, '******' AS C_OTHERCODE, t.distributor_code AS C_AGENCYNO, DECODE( t.BUSINESS_CODE, '008', '31', '001', '81', '002', '82', '003', '83', '004', '84', '005', '85', '008', '88', '009', '89', substr(t.BUSINESS_CODE(1,2))) AS C_BUSINFLAG, COALESCE(t1.num, 0) + COALESCE(t2.num, 0) L_COUNT, 0 F_BALANCE, 0 F_SHARES, COALESCE(t1.num, 0) L_VALIDCOUNT, 0 F_VALIDBALANCE, 0 F_VALIDSHARES, 0 F_RATIONBALANCE, COALESCE(t2.num, 0) L_INVALIDCOUNT, 0 F_INVALIDBALANCE, 0 F_INVALIDSHARES, 0 L_POSTCOUNT, 0 F_POSTBALANCE, 0 F_POSTSHARES, 0 L_BESPEAKCOUNT, 0 F_BESPEAKBALANCE, 0 F_BESPEAKSHARES, 0 F_CHGOUTSHAREATCHGIN FROM ( SELECT t.distributor_code, t.business_code, t.transaction_cfm_date FROM ( SELECT t.sys_code, t.distributor_code, t.business_code, t.transaction_cfm_date FROM amdw_ods.s40_account_request t WHERE sys_code = 'ZJ' --AND transaction_cfm_date BETWEEN to_char(TO_DATE('${job.biz.date}', 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd') AND '${job.biz.date}' AND transaction_cfm_date >= to_char( TO_DATE(replace('${job.biz.nearly_tradeday}', '-', ''), 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd' ) AND transaction_cfm_date <= ( SELECT n_next_trdy :: VARCHAR FROM amdw_dw.t00_base_date WHERE n_date = ${job.biz.date} LIMIT 1 ) UNION ALL SELECT t.sys_code, t.distributor_code, t.business_code, t.transaction_cfm_date FROM amdw_ods.s40_account_request_log t WHERE sys_code = 'ZJ' -- AND transaction_cfm_date BETWEEN to_char(TO_DATE('${job.biz.date}', 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd') AND '${job.biz.date}' AND transaction_cfm_date >= to_char( TO_DATE(replace('${job.biz.nearly_tradeday}', '-', ''), 'yyyymmdd') - ${job_biz_offset}, 'yyyymmdd' ) AND transaction_cfm_date <= ( SELECT n_next_trdy :: VARCHAR FROM amdw_dw.t00_base_date WHERE n_date = ${job.biz.date} LIMIT 1 ) ) t GROUP BY t.distributor_code, t.business_code, t.transaction_cfm_date ) t LEFT JOIN account_confirm_stat_tmp t1 ON t.transaction_cfm_date = t1.transaction_cfm_date AND t.distributor_code = t1.distributor_code AND t.business_code = t1.business_code AND t1.check_result = '1' LEFT JOIN account_confirm_stat_tmp t2 ON t.transaction_cfm_date = t2.transaction_cfm_date AND t.distributor_code = t2.distributor_code AND t.business_code = t2.business_code AND t2.check_result = '0'; 哪个地方缺少了一个t
10-01
-- 修数演练执行日志信息 select to_char(t.exec_time, 'yyyy-mm-dd hh24:mi:ss') as etime, t.* from t_datachange_execption_sql_log t order by t.exec_time desc; -- 查询包执行日志 select to_char(t.exec_date, 'yyyy-mm-dd hh24:mi:ss') as etime, t.* from omp_debuginfo_t t where upper(t.proc_name) like '%SYN_AUTOCLEAN_SP%' order by t.exec_date desc; -- 查询DB Job执行结果 select p.what, j.job_id, j.start_date, j.last_start_date, j.last_end_date, j.next_run_date, j.failure_msg from pg_job j left join pg_job_proc p on j.job_id = p.job_id order by j.start_date desc; -- 查询流程审批日志信息 select to_char(t.creation_date, 'yyyy-mm-dd hh24:mi:ss') as cdate, (select lname from tpl_user_t u where u.user_id = t.created_by) as cby, t.* from omp_workflow_log_t t where t.workflow_no in ('W20230504023N') order by t.workflow_no, t.creation_date; -- 查询立项操作日志 select to_char(creation_date) as cdate, t.* from omp_project_operationrecirds_t t where t.project_no = 'W20250415075N' order by t.creation_date desc; -- 查询分摊编码失效检测结果记录 select t.*, to_char(t.last_update_date, 'yyyy-mm-dd hh24:mi:ss') as ldate from omp_profit_share_invalid_t t where t.invalid_code = '069900'; -- 查询应用号推送记录 select to_char(t.creation_date, 'yyyy-mm-dd hh24:mi:ss') as cdate, t.* from omp_message_push_log_t t where t.to_user_account = 's00123123' and t.creation_date > date'2025-06-11'; select to_char(t.creation_date, 'yyyy-mm-dd hh24:mi:ss') as cdate, t.* from omp_message_push_log_t t where t.creation_date > date'2025-07-11' and t.content like '%TRP202507110003%'; -- 查询系统日志(很卡,需要设置好条件) -- M_REFUND -- M_EXPENSE_PAY -- M_EMP_ENTRY_PROJECT -- M_FRAME_PO -- M_TM_REWARD -- M_REGIONAL -- M_PCB -- M_TRIP -- M_EBUY -- M_TM_REWARD_PAY -- M_REVIEW -- M_DISPATCH -- M_TM_PAYMENT -- M_USER_CONF -- M_COOP -- M_PROJECT -- M_BUDGET select to_char(t.creation_date, 'yyyy-mm-dd hh24:mi:ss') as cdate, t.* from omp_log_events_t t where t.creation_date > to_date('2030-04-29 16:40:41', 'yyyy-mm-dd hh24:mi:ss') and t.creation_date < to_date('2024-04-29 16:57:41', 'yyyy-mm-dd hh24:mi:ss'); -- 查询指定人员的历史日志信息 select to_char(al.last_update_date, 'yyyy-mm-dd hh24:mi:ss') as 最后更新时间, (select lname from tpl_user_t where user_id = al.last_updated_by) as 操作人, to_char(al.dimission_date, 'yyyy-mm-dd hh24:mi:ss') as 离司时间, to_char(al.min_entry_project_date, 'yyyy-mm-dd hh24:mi:ss') as 最小入项时间, to_char(al.entry_project_date, 'yyyy-mm-dd hh24:mi:ss') as 入项时间, al.emp_workid, al.log_remark as 日志备注, al.hw_position as 职级, al.emp_state as 人员状态, ecul.emp_name as 姓名, ecul.emp_number as 外包服务编号, c.abbr_name as 供应商, ecul.vendor_code as 供应商编码, p.project_no as 项目编号, p.po_num as PO编号, to_char(sd.service_duration_begin_date, 'yyyy-mm-dd hh24:mi:ss') as 服务时长开始时间, to_char(sd.service_duration_end_date, 'yyyy-mm-dd hh24:mi:ss') as 服务时长结束时间, sd.service_duration as 服务时长, sd.execute_service_duration as 执行类服务时长, ecul.emp_employee_id as 外包合作人员表主键, al.activity_id as 人力大表主键, al.activity_log_id as 人力大表日志表主键 from omp_emp_activity_log_t al left join omp_emp_cooperate_user_log_t ecul on ecul.emp_employee_log_id = al.emp_employee_log_id left join omp_coop_t c on c.status = 'ACTIVE' and c.code = ecul.vendor_code left join omp_project_prpo_info_query_v p on p.entrust_order_id = al.entrust_order_id left join omp_emp_service_duration_t sd on sd.emp_employee_id = ecul.emp_employee_id where ecul.emp_number = 'WB123123' and al.emp_workid like '60032453%' order by ecul.emp_number, al.last_update_date desc; select to_char(t.operate_date, 'yyyy-mm-dd hh24:mi:ss') as odate, (select lname from tpl_user_t u where u.user_id = t.operate_user_id) as operate_user_name, t.* from omp_emp_resource_log_t t left join omp_emp_cooperate_user_t u on u.emp_employee_id = t.emp_employee_id where u.emp_number = 'WB084603' order by t.operate_date desc; select emp_workid, emp_state, emp_name, emp_position, emp_university_name, emp_speciality, emp_role, emp_sub_role, emp_skill, birthday, title from omp_activity_query_t where entrust_order_id = '9eeb3d8876d020800ed56f9c3b8fc630' and emp_state = 3 order by birthday desc; -- 查询人员日志 select to_char(t.operate_date, 'yyyy-mm-dd hh24:mi:ss') as odate, t.* from omp_emp_hr_log_t t left join omp_emp_cooperate_user_t u on u.emp_employee_id = t.emp_employee_id where u.emp_number = 'WB178015' order by t.operate_date desc; select to_char(t.operate_date, 'yyyy-mm-dd hh24:mi:ss') as odate, t.* from omp_emp_resource_log_t t left join omp_emp_cooperate_user_t u on u.emp_employee_id = t.emp_employee_id where u.emp_number = 'WB178015' order by t.operate_date desc; select * from omp_leave_query_t t where t.leave_project_employees like '%王文炳%'; select * from omp_entry_query_t t where t.entry_employees like '%王文炳%'; 帮我整理下,上面脚本的排版,并适当的添加注释
10-10
<TaskerData sr="" dvi="1" tv="6.1.12-rc"> <Profile sr="prof78" ve="2"> <cdate>1753214601798</cdate> <edate>1763295834233</edate> <flags>8</flags> <id>78</id> <mid0>43</mid0> <nme>车机KRC歌词</nme> <Event sr="con0" ve="2"> <code>2081</code> <pri>0</pri> <Bundle sr="arg0"> <Vals sr="val"> <net.dinglisch.android.tasker.RELEVANT_VARIABLES><StringArray sr=""><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0>%mt_app App 正在播放的应用的包名,使用应用信息操作以获取更多信息</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1>%mt_album 专辑 </_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES2>%mt_track 专辑名 </_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES2><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES3>%mt_year 年份 媒体被制作或出版的年份</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES3><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES4>%mt_all_metadata 所有元数据 此事件中存在的所有元数据的 JSON 结构</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES4><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES5>%mt_all_metadata_keys() 所有元数据 '%mt_all_metadata' JSON 结构中可用的所有 JSON 键</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES5><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES6>%mt_playing 播放中 如果音乐正在播放则为 true,否则false</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES6><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES7>%mt_rating 星级 </_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES7><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES8>%mt_duration 歌曲长度 歌曲长度的秒数</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES8><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES9>%mt_duration_formatted 歌曲长度 歌曲长度的秒数</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES9><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES10>%mt_genre 流派 </_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES10><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES11>%mt_state 状态 以下之一:无、已停止、正在播放、已暂停、快进、正在倒带、正在缓冲、出错、连接中、跳至上一个、跳至下一个、跳至队列项、未知</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES11><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES12>%mt_art 艺术家 </_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES12><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES13>%mt_artist 艺术家 </_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES13><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES14>%mt_queue_icons() 队列图标 队列音轨图标</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES14><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES15>%mt_queue_titles() 队列标题 排队曲目的歌曲名称</_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES15><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES16>%mt_track_number 音轨号 </_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES16><_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES17>%mt_number_tracks 音轨数 </_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES17></StringArray></net.dinglisch.android.tasker.RELEVANT_VARIABLES> <net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>[Ljava.lang.String;</net.dinglisch.android.tasker.RELEVANT_VARIABLES-type> </Vals> </Bundle> <Str sr="arg1" ve="3"/> <Str sr="arg2" ve="3"/> <Str sr="arg3" ve="3"/> <Str sr="arg4" ve="3"/> <Int sr="arg5" val="0"/> </Event> </Profile> <Task sr="task43"> <cdate>1736393158564</cdate> <edate>1763295956739</edate> <id>43</id> <nme>车机KRC歌词</nme> <pri>6</pri> <Action sr="act0" ve="7"> <code>49</code> <Str sr="arg0" ve="3">车机KRC歌词</Str> </Action> <Action sr="act1" ve="7"> <code>20</code> <on>false</on> <App sr="arg0"> <appClass>com.maxmpz.audioplayer.standard_adaptive</appClass> <appPkg>com.maxmpz.audioplayer</appPkg> <label>Poweramp</label> </App> <Str sr="arg1" ve="3"/> <Int sr="arg2" val="0"/> <Int sr="arg3" val="0"/> </Action> <Action sr="act10" ve="7"> <code>890</code> <Str sr="arg0" ve="3">%iii</Str> <Int sr="arg1" val="1"/> <Int sr="arg2" val="0"/> </Action> <Action sr="act11" ve="7"> <code>135</code> <Int sr="arg0" val="1"/> <Int sr="arg1" val="20"/> <Str sr="arg2" ve="3">时长</Str> <ConditionList sr="if"> <Condition sr="c0" ve="3"> <lhs>%http_data</lhs> <op>13</op> <rhs></rhs> </Condition> </ConditionList> </Action> <Action sr="act12" ve="7"> <code>135</code> <Int sr="arg0" val="1"/> <Int sr="arg1" val="20"/> <Str sr="arg2" ve="3">下载歌词</Str> </Action> <Action sr="act13" ve="7"> <code>43</code> <label>暂停</label> <ConditionList sr="if"> <Condition sr="c0" ve="3"> <lhs>%mt_playing</lhs> <op>0</op> <rhs>false</rhs> </Condition> <给我优化一下,使歌词显示更精准,歌词更漂亮
最新发布
11-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值