You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

40 lines
2.0 KiB

# -*- coding: utf-8 -*-
"""票 06:验证 fat jar 内嵌模块 jar 含新修复字节码。
判别依据(D-15/20/21/17 各取一特征):
1) 内嵌 crm-opportunity jar 须含 query/OpportunityViewFilter.class(D-15 新组件)
2) OpportunityTransitionImpl.class 含「商机状态:」oplog 文案(D-20 recordStatusFlowOplog)
3) OpportunitySubController.class 含 ATTACHMENT_BIZ_TYPES 常量字段名(D-21 bizType 值域)
4) Opportunity.class(实体)含 schemeCardStatus 字段名(D-17 C4 快照列)"""
import io, sys, os, time, zipfile
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
jar = r'e:\code\crm-backend-matt\crm-app\target\crm-app-1.0.0-SNAPSHOT.jar'
print('fat jar mtime =', time.strftime('%m-%d %H:%M:%S', time.localtime(os.stat(jar).st_mtime)))
z = zipfile.ZipFile(jar)
nested = [n for n in z.namelist() if n.startswith('BOOT-INF/lib/crm-opportunity-')]
print('[nested]', nested)
inner = zipfile.ZipFile(z.open(nested[0]))
# 判据 1:D-15 新组件类存在
has_filter = any(n.endswith('query/OpportunityViewFilter.class') for n in inner.namelist())
print('[D-15] OpportunityViewFilter.class present =', has_filter)
# 判据 2:D-20 oplog 文案
ti = [n for n in inner.namelist() if n.endswith('state/impl/OpportunityTransitionImpl.class')]
oplog_msg = '商机状态:'.encode('utf-8') in inner.read(ti[0])
print('[D-20] transition oplog msg present =', oplog_msg)
# 判据 3:D-21 bizType 值域常量
sc = [n for n in inner.namelist() if n.endswith('controller/OpportunitySubController.class')]
biz_const = b'ATTACHMENT_BIZ_TYPES' in inner.read(sc[0])
print('[D-21] ATTACHMENT_BIZ_TYPES present =', biz_const)
# 判据 4:D-17 C4 快照列字段
ent = [n for n in inner.namelist() if n.endswith('domain/entity/Opportunity.class')]
snap_field = b'schemeCardStatus' in inner.read(ent[0])
print('[D-17] entity schemeCardStatus present =', snap_field)
ok = has_filter and oplog_msg and biz_const and snap_field
print('VERDICT:', 'NEW-JAR-WITH-T06' if ok else 'OLD-JAR-T06-MISSING')