Compare commits
4
Commits
b3082156bd
...
9b16d8c362
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b16d8c362 | ||
|
|
2ca3d4b6cf | ||
|
|
a36d5c061b | ||
|
|
68ea39907b |
@@ -22,6 +22,8 @@ import * as upload from '@midwayjs/upload';
|
||||
// import * as rpc from '@cool-midway/rpc';
|
||||
import { FileserverMonitorService } from './modules/center/service/fileserver-monitor';
|
||||
import { CenterLogService } from './modules/center/service/logstore';
|
||||
import { CenterNotifyWsService } from './modules/center/service/notify-ws';
|
||||
import { CenterRbacService } from './modules/center/service/rbac';
|
||||
|
||||
@Configuration({
|
||||
imports: [
|
||||
@@ -75,9 +77,46 @@ export class MainConfiguration {
|
||||
// 集中日志保留期清理(启动清理一次 + 周期清理,随进程启停)
|
||||
const logStore = await this.app.getApplicationContext().getAsync(CenterLogService);
|
||||
logStore.start();
|
||||
// 控制台 RBAC 幂等种子(initDB/initMenu=false,兜底超管角色、业务菜单、运行期账号)
|
||||
this.seedRbac();
|
||||
}
|
||||
|
||||
/** RBAC 种子:最多重试 3 次(等数据库连接就绪),失败仅记日志不阻断启动 */
|
||||
private seedRbac(attempt = 1) {
|
||||
this.app
|
||||
.getApplicationContext()
|
||||
.getAsync(CenterRbacService)
|
||||
.then(rbac => rbac.ensureSeed())
|
||||
.catch(e => {
|
||||
if (attempt < 3) {
|
||||
setTimeout(() => this.seedRbac(attempt + 1), 3000);
|
||||
return;
|
||||
}
|
||||
this.logger.error('[rbac] 控制台权限种子初始化失败:%s', (e as Error)?.message || e);
|
||||
});
|
||||
}
|
||||
|
||||
/** HTTP server 起来后挂载通知 WebSocket(与 8800 共用端口,执行机 notifier.js 直连) */
|
||||
async onServerReady() {
|
||||
try {
|
||||
const framework: any = (this.app as any).getFramework?.();
|
||||
const server = typeof framework?.getServer === 'function' ? framework.getServer() : null;
|
||||
const wsService = await this.app.getApplicationContext().getAsync(CenterNotifyWsService);
|
||||
if (!wsService.attach(server)) {
|
||||
console.warn('[notify-ws] 未取到 http.Server,通知 WS 未启用(轮询兜底仍然可用)');
|
||||
}
|
||||
} catch (e: any) {
|
||||
console.warn(`[notify-ws] 挂载异常:${e?.message || e}(轮询兜底仍然可用)`);
|
||||
}
|
||||
}
|
||||
|
||||
async onStop() {
|
||||
try {
|
||||
const wsService = await this.app.getApplicationContext().getAsync(CenterNotifyWsService);
|
||||
wsService.stop();
|
||||
} catch (e) {
|
||||
/* ignore */
|
||||
}
|
||||
try {
|
||||
const monitor = await this.app.getApplicationContext().getAsync(FileserverMonitorService);
|
||||
monitor.stop();
|
||||
|
||||
@@ -11,22 +11,23 @@ import * as entity8 from './modules/plugin/entity/info';
|
||||
import * as entity9 from './modules/dict/entity/type';
|
||||
import * as entity10 from './modules/dict/entity/info';
|
||||
import * as entity11 from './modules/demo/entity/goods';
|
||||
import * as entity12 from './modules/center/entity/runtime';
|
||||
import * as entity13 from './modules/center/entity/resource';
|
||||
import * as entity14 from './modules/center/entity/plugin';
|
||||
import * as entity15 from './modules/center/entity/dict';
|
||||
import * as entity16 from './modules/center/entity/account';
|
||||
import * as entity17 from './modules/base/entity/base';
|
||||
import * as entity18 from './modules/base/entity/sys/user_role';
|
||||
import * as entity19 from './modules/base/entity/sys/user';
|
||||
import * as entity20 from './modules/base/entity/sys/role_menu';
|
||||
import * as entity21 from './modules/base/entity/sys/role_department';
|
||||
import * as entity22 from './modules/base/entity/sys/role';
|
||||
import * as entity23 from './modules/base/entity/sys/param';
|
||||
import * as entity24 from './modules/base/entity/sys/menu';
|
||||
import * as entity25 from './modules/base/entity/sys/log';
|
||||
import * as entity26 from './modules/base/entity/sys/department';
|
||||
import * as entity27 from './modules/base/entity/sys/conf';
|
||||
import * as entity12 from './modules/center/entity/sdk';
|
||||
import * as entity13 from './modules/center/entity/runtime';
|
||||
import * as entity14 from './modules/center/entity/resource';
|
||||
import * as entity15 from './modules/center/entity/plugin';
|
||||
import * as entity16 from './modules/center/entity/dict';
|
||||
import * as entity17 from './modules/center/entity/account';
|
||||
import * as entity18 from './modules/base/entity/base';
|
||||
import * as entity19 from './modules/base/entity/sys/user_role';
|
||||
import * as entity20 from './modules/base/entity/sys/user';
|
||||
import * as entity21 from './modules/base/entity/sys/role_menu';
|
||||
import * as entity22 from './modules/base/entity/sys/role_department';
|
||||
import * as entity23 from './modules/base/entity/sys/role';
|
||||
import * as entity24 from './modules/base/entity/sys/param';
|
||||
import * as entity25 from './modules/base/entity/sys/menu';
|
||||
import * as entity26 from './modules/base/entity/sys/log';
|
||||
import * as entity27 from './modules/base/entity/sys/department';
|
||||
import * as entity28 from './modules/base/entity/sys/conf';
|
||||
export const entities = [
|
||||
...Object.values(entity0),
|
||||
...Object.values(entity1),
|
||||
@@ -56,4 +57,5 @@ export const entities = [
|
||||
...Object.values(entity25),
|
||||
...Object.values(entity26),
|
||||
...Object.values(entity27),
|
||||
...Object.values(entity28),
|
||||
];
|
||||
|
||||
@@ -20,6 +20,7 @@ export * from './modules/plugin/entity/info';
|
||||
export * from './modules/dict/entity/type';
|
||||
export * from './modules/dict/entity/info';
|
||||
export * from './modules/demo/entity/goods';
|
||||
export * from './modules/center/entity/sdk';
|
||||
export * from './modules/center/entity/runtime';
|
||||
export * from './modules/center/entity/resource';
|
||||
export * from './modules/center/entity/plugin';
|
||||
@@ -43,6 +44,7 @@ export * from './modules/center/service/dingtalk';
|
||||
export * from './modules/center/service/notify';
|
||||
export * from './modules/center/service/fileserver-monitor';
|
||||
export * from './modules/center/service/logstore';
|
||||
export * from './modules/center/service/notify-ws';
|
||||
export * from './modules/center/service/rbac';
|
||||
export * from './interface';
|
||||
export * from './modules/base/service/sys/conf';
|
||||
@@ -91,6 +93,7 @@ export * from './modules/center/controller/admin/menu';
|
||||
export * from './modules/center/controller/admin/notes';
|
||||
export * from './modules/center/controller/admin/ops';
|
||||
export * from './modules/center/controller/admin/plugin';
|
||||
export * from './modules/center/controller/admin/sdk';
|
||||
export * from './modules/center/controller/admin/sys';
|
||||
export * from './modules/center/controller/api/creds';
|
||||
export * from './modules/center/controller/api/device';
|
||||
@@ -102,6 +105,7 @@ export * from './modules/center/controller/api/misc';
|
||||
export * from './modules/center/controller/api/notes';
|
||||
export * from './modules/center/controller/api/ping';
|
||||
export * from './modules/center/controller/api/plugins';
|
||||
export * from './modules/center/controller/api/sdks';
|
||||
export * from './modules/center/controller/api/shell';
|
||||
export * from './modules/center/controller/api/ticket';
|
||||
export * from './modules/center/service/dept-scope';
|
||||
|
||||
@@ -1,118 +1,22 @@
|
||||
import { CoolController, BaseController } from '@cool-midway/core';
|
||||
import { Get, Headers, Inject, Provide } from '@midwayjs/core';
|
||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { AccountEntity } from '../../entity/account';
|
||||
import { CenterAuthService, ApiError } from '../../service/auth';
|
||||
import { CenterRbacService } from '../../service/rbac';
|
||||
|
||||
/**
|
||||
* 控制台业务菜单(RBAC 驱动)。
|
||||
* - GET /api/admin/me/menus:返回当前操作者的业务菜单树 + 权限标识集合。
|
||||
* 管理员(is_admin=1)返回全量;非管理员按 cool-admin 角色权限过滤(预留,2F 用户体系落地后生效)。
|
||||
* - GET /api/admin/me/menus:按当前账号角色从 base_sys_menu 过滤组树,返回业务菜单树 + 权限标识集合。
|
||||
* 超管(admin 用户 / label='admin' 角色)返回全部;普通账号仅返回其角色勾选的菜单(含祖先自动补全)。
|
||||
* - 前端据此驱动动态路由与按钮权限("菜单要权限"落点)。
|
||||
*/
|
||||
|
||||
interface MenuNode {
|
||||
path: string;
|
||||
name: string;
|
||||
component: string;
|
||||
meta: {
|
||||
title: string;
|
||||
icon: string;
|
||||
perms: string[];
|
||||
roles?: string[];
|
||||
/** 侧栏隐藏(如个人中心,仅从用户菜单进入) */
|
||||
isHide?: boolean;
|
||||
};
|
||||
children?: MenuNode[];
|
||||
}
|
||||
|
||||
/** 控制台菜单目录(path/component 与前端视图一一对应;perms 为按钮/页面权限标识) */
|
||||
const CONSOLE_MENUS: MenuNode[] = [
|
||||
{
|
||||
path: '/overview', name: 'Overview', component: '/overview/index',
|
||||
meta: { title: '概览', icon: 'ri:pie-chart-line', perms: ['center:overview:view'] },
|
||||
},
|
||||
{
|
||||
path: '/stats', name: 'Stats', component: '/stats/index',
|
||||
meta: { title: '数据看板', icon: 'ri:bar-chart-2-line', perms: ['center:stats:view'] },
|
||||
},
|
||||
{
|
||||
path: '/plugins', name: 'Plugins', component: '/plugins/index',
|
||||
meta: { title: '插件管理', icon: 'ri:box-3-line', perms: ['center:plugin:list'] },
|
||||
},
|
||||
{
|
||||
path: '/accounts', name: 'Accounts', component: '/accounts/index',
|
||||
meta: { title: '账号管理', icon: 'ri:user-3-line', perms: ['center:account:list'] },
|
||||
},
|
||||
{
|
||||
path: '/grants', name: 'Grants', component: '/grants/index',
|
||||
meta: { title: '权限授权', icon: 'ri:key-2-line', perms: ['center:grant:list'] },
|
||||
},
|
||||
{
|
||||
path: '/audit', name: 'Audit', component: '/audit/index',
|
||||
meta: { title: '审计报表', icon: 'ri:file-list-3-line', perms: ['center:audit:list'] },
|
||||
},
|
||||
{
|
||||
path: '/reports', name: 'Reports', component: '/reports/index',
|
||||
meta: { title: '运行记录', icon: 'ri:terminal-box-line', perms: ['center:report:list'] },
|
||||
},
|
||||
{
|
||||
path: '/logs', name: 'Logs', component: '/logs/index',
|
||||
meta: { title: '运行日志', icon: 'ri:file-text-line', perms: ['center:log:list'] },
|
||||
},
|
||||
{
|
||||
path: '/devices', name: 'Devices', component: '/devices/index',
|
||||
meta: { title: '执行机设备', icon: 'ri:computer-line', perms: ['center:device:list'] },
|
||||
},
|
||||
{
|
||||
path: '/upgrade', name: 'Upgrade', component: '/upgrade/index',
|
||||
meta: { title: '升级进度', icon: 'ri:rocket-2-line', perms: ['center:device:summary'] },
|
||||
},
|
||||
{
|
||||
path: '/notify', name: 'Notify', component: '/notify/index',
|
||||
meta: { title: '通知推送', icon: 'ri:notification-3-line', perms: ['center:notify:list'] },
|
||||
},
|
||||
{
|
||||
path: '/creds', name: 'Creds', component: '/creds/index',
|
||||
meta: { title: '敏感凭证', icon: 'ri:shield-keyhole-line', perms: ['center:creds:list'] },
|
||||
},
|
||||
{
|
||||
path: '/file-sources', name: 'FileSources', component: '/file-sources/index',
|
||||
meta: { title: '大文件源', icon: 'ri:database-2-line', perms: ['center:fileSource:list'] },
|
||||
},
|
||||
{
|
||||
// 嵌套菜单的父级 component 必须是布局容器(RoutesAlias.Layout='/index/index'),
|
||||
// 否则一级带 children 的路由不会包 Layout,子页面渲染不出(空白页)
|
||||
path: '/system', name: 'System', component: '/index/index',
|
||||
meta: { title: '系统管理', icon: 'ri:settings-3-line', perms: [] },
|
||||
children: [
|
||||
{ path: 'user', name: 'SysUser', component: '/system/user', meta: { title: '用户管理', icon: '', perms: ['center:sys:user'] } },
|
||||
{ path: 'role', name: 'SysRole', component: '/system/role', meta: { title: '角色管理', icon: '', perms: ['center:sys:role'] } },
|
||||
{ path: 'menu', name: 'SysMenu', component: '/system/menu', meta: { title: '菜单管理', icon: '', perms: ['center:sys:menu'] } },
|
||||
{ path: 'department', name: 'SysDept', component: '/system/department', meta: { title: '部门管理', icon: '', perms: ['center:sys:dept'] } },
|
||||
// 个人中心:从头像下拉进入,不在侧栏显示(自助改密 + 头像)
|
||||
{ path: 'user-center', name: 'UserCenter', component: '/system/user-center', meta: { title: '个人中心', icon: '', perms: [], isHide: true } },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
/** 全部权限标识集合(供按钮级 v-permission 使用) */
|
||||
function allPerms(nodes: MenuNode[]): string[] {
|
||||
const out: string[] = [];
|
||||
const walk = (ns: MenuNode[]) => ns.forEach(n => { out.push(...n.meta.perms); if (n.children) walk(n.children); });
|
||||
walk(nodes);
|
||||
return out;
|
||||
}
|
||||
|
||||
@Provide()
|
||||
@CoolController('/api/admin')
|
||||
export class AdminMenuController extends BaseController {
|
||||
@Inject()
|
||||
centerAuthService: CenterAuthService;
|
||||
|
||||
@InjectEntityModel(AccountEntity)
|
||||
accountRepo: Repository<AccountEntity>;
|
||||
@Inject()
|
||||
centerRbacService: CenterRbacService;
|
||||
|
||||
/** GET /api/admin/me/menus */
|
||||
@Get('/me/menus')
|
||||
@@ -130,13 +34,6 @@ export class AdminMenuController extends BaseController {
|
||||
}
|
||||
// 无效身份 → 401(触发前端自动登出,避免 200-空菜单被误判后跳 500)
|
||||
if (!account) throw new ApiError(401, '登录态无效或已过期,请重新登录');
|
||||
const row = await this.accountRepo.findOneBy({ account });
|
||||
if (!row || !Number(row.status)) throw new ApiError(401, '登录态无效或已过期,请重新登录');
|
||||
const isAdmin = !!Number(row.isAdmin);
|
||||
// 非管理员:按 cool-admin 角色权限过滤(2F 用户体系落地后生效;当前业务控制台仍以 is_admin 为准)
|
||||
if (isAdmin) {
|
||||
return { account, menus: CONSOLE_MENUS, perms: allPerms(CONSOLE_MENUS), is_admin: true };
|
||||
}
|
||||
return { account, menus: [], perms: [], is_admin: false };
|
||||
return this.centerRbacService.menusForUser(account);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import { ClientCredEntity } from '../../entity/account';
|
||||
import { CenterAuthService, ApiError } from '../../service/auth';
|
||||
import { rsaEncrypt } from '../../service/crypto';
|
||||
import { CenterLogService } from '../../service/logstore';
|
||||
import { CenterNotifyWsService } from '../../service/notify-ws';
|
||||
import { PKG_DIR, SHELL_DIR, AVATAR_DIR } from '../../comm/conf';
|
||||
import { pageBounds, readUploadFile } from '../../comm/util';
|
||||
|
||||
@@ -39,6 +40,9 @@ export class AdminOpsController extends BaseController {
|
||||
@Inject()
|
||||
centerLogService: CenterLogService;
|
||||
|
||||
@Inject()
|
||||
centerNotifyWsService: CenterNotifyWsService;
|
||||
|
||||
@InjectEntityModel(PluginEntity) pluginRepo: Repository<PluginEntity>;
|
||||
@InjectEntityModel(PluginVersionEntity) pluginVersionRepo: Repository<PluginVersionEntity>;
|
||||
@InjectEntityModel(AccountPluginEntity) accountPluginRepo: Repository<AccountPluginEntity>;
|
||||
@@ -552,7 +556,16 @@ export class AdminOpsController extends BaseController {
|
||||
'INSERT INTO notifications(title, content, level, target, account, expires_at) VALUES (?,?,?,?,?,?)',
|
||||
[title, (b?.content || '').trim(), b?.level, b?.target, (b?.account || '').trim(), b?.expires_at ? String(b.expires_at).replace('T', ' ').slice(0, 19) : null]);
|
||||
await this.centerAuthService.audit(login, 'notify-create', `通知 #${r.insertId} ${title} → ${b?.target}`);
|
||||
return { ok: true, id: r.insertId, title, target: b?.target, pushed: 0 };
|
||||
// 实时推送:在线执行机秒达;未在线的由 GET /api/notifications 轮询兜底
|
||||
const pushed = this.centerNotifyWsService.pushNotification({
|
||||
id: r.insertId,
|
||||
title,
|
||||
content: (b?.content || '').trim(),
|
||||
level: b?.level,
|
||||
target: b?.target,
|
||||
account: b?.target === 'account' ? (b?.account || '').trim() : '',
|
||||
});
|
||||
return { ok: true, id: r.insertId, title, target: b?.target, pushed };
|
||||
}
|
||||
|
||||
@Put('/notifications/:nid')
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
import { Provide } from '@midwayjs/core';
|
||||
import type { IncomingMessage, Server } from 'http';
|
||||
import type { Duplex } from 'stream';
|
||||
|
||||
// ws 未自带类型声明(项目未装 @types/ws),用 require 引入,避免多一个构建期依赖
|
||||
const { WebSocketServer } = require('ws');
|
||||
|
||||
export const NOTIFY_WS_PATH = '/ws/notifications';
|
||||
|
||||
const HEARTBEAT_MS = 30 * 1000;
|
||||
const WS_OPEN = 1;
|
||||
|
||||
function log(msg: string) {
|
||||
console.log(`[notify-ws] ${msg}`);
|
||||
}
|
||||
|
||||
function warn(msg: string) {
|
||||
console.warn(`[notify-ws] ${msg}`);
|
||||
}
|
||||
|
||||
export interface NotifyFrame {
|
||||
id: number;
|
||||
title: string;
|
||||
content?: string;
|
||||
level?: string;
|
||||
target?: string;
|
||||
account?: string;
|
||||
}
|
||||
|
||||
// ==================== 连接状态(模块级单例) ====================
|
||||
// 挂载发生在上游生命周期、推送发生在控制器请求里,两处取到的 provider 实例不保证同一个,
|
||||
// 因此状态放在模块作用域,保证「谁调都是同一份连接表」,与容器 scope 无关。
|
||||
let WSS: any = null;
|
||||
let HEARTBEAT: NodeJS.Timeout | null = null;
|
||||
// account → 该账号当前在线的连接集合(同账号多台执行机/多次连接都保留)
|
||||
const CLIENTS: Map<string, Set<any>> = new Map();
|
||||
|
||||
function online(): number {
|
||||
let n = 0;
|
||||
for (const set of CLIENTS.values()) n += set.size;
|
||||
return n;
|
||||
}
|
||||
|
||||
function rejectUpgrade(socket: Duplex, code: number, text: string) {
|
||||
try {
|
||||
socket.write(`HTTP/1.1 ${code} ${text}\r\nConnection: close\r\nContent-Length: 0\r\n\r\n`);
|
||||
} catch (e) {
|
||||
/* 忽略 */
|
||||
}
|
||||
try {
|
||||
socket.destroy();
|
||||
} catch (e) {
|
||||
/* 忽略 */
|
||||
}
|
||||
}
|
||||
|
||||
function drop(account: string, ws: any) {
|
||||
const set = CLIENTS.get(account);
|
||||
if (!set) return;
|
||||
if (!set.delete(ws)) return;
|
||||
if (!set.size) {
|
||||
CLIENTS.delete(account);
|
||||
log(`连接断开(${account}),当前 ${online()} 个连接`);
|
||||
}
|
||||
}
|
||||
|
||||
/** 心跳:30s 未回 pong 视为半开连接,terminate 掉让客户端重连 */
|
||||
function sweep() {
|
||||
for (const [account, set] of CLIENTS) {
|
||||
for (const ws of [...set]) {
|
||||
if (ws.isAlive === false) {
|
||||
try {
|
||||
ws.terminate();
|
||||
} catch (e) {
|
||||
/* 忽略 */
|
||||
}
|
||||
drop(account, ws);
|
||||
continue;
|
||||
}
|
||||
ws.isAlive = false;
|
||||
try {
|
||||
ws.ping();
|
||||
} catch (e) {
|
||||
/* 忽略,下轮按 isAlive 清理 */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onConnection(ws: any, req: IncomingMessage) {
|
||||
const account = String(ws.__account || '');
|
||||
let set = CLIENTS.get(account);
|
||||
if (!set) {
|
||||
set = new Set();
|
||||
CLIENTS.set(account, set);
|
||||
}
|
||||
set.add(ws);
|
||||
ws.isAlive = true;
|
||||
ws.on('pong', () => {
|
||||
ws.isAlive = true;
|
||||
});
|
||||
// 客户端不上行业务消息(ws 库默认自动回 pong),忽略即可
|
||||
ws.on('message', () => {});
|
||||
ws.on('close', () => drop(account, ws));
|
||||
ws.on('error', () => drop(account, ws));
|
||||
log(`连接建立(${account},${req.socket?.remoteAddress || '-'}),当前 ${online()} 个连接`);
|
||||
}
|
||||
|
||||
function handleUpgrade(wss: any, req: IncomingMessage, socket: Duplex, head: Buffer) {
|
||||
let url: URL;
|
||||
try {
|
||||
url = new URL(req.url || '/', 'http://localhost');
|
||||
} catch (e) {
|
||||
return rejectUpgrade(socket, 400, 'Bad Request');
|
||||
}
|
||||
// 本服务只接通知通道;其它 upgrade 请求直接拒绝(避免 socket 悬挂)
|
||||
if (url.pathname !== NOTIFY_WS_PATH) return rejectUpgrade(socket, 404, 'Not Found');
|
||||
|
||||
// 机器凭证:与 REST 侧 checkApiToken 一致(CONTROLPLANE_TOKEN 为空时不校验)
|
||||
const token = (process.env.CONTROLPLANE_TOKEN || '').trim();
|
||||
if (token) {
|
||||
const got = String(req.headers['x-api-token'] || '').trim();
|
||||
if (got !== token) {
|
||||
warn(`拒绝连接:X-API-Token 无效(${req.socket?.remoteAddress || '-'})`);
|
||||
return rejectUpgrade(socket, 401, 'Unauthorized');
|
||||
}
|
||||
}
|
||||
|
||||
const account = (url.searchParams.get('account') || '').trim();
|
||||
if (!account) return rejectUpgrade(socket, 400, 'Missing account');
|
||||
|
||||
wss.handleUpgrade(req, socket, head, (ws: any) => {
|
||||
ws.__account = account;
|
||||
wss.emit('connection', ws, req);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知实时推送(WebSocket `/ws/notifications`)—— 对齐执行机壳 `electron/notifier.js` 契约:
|
||||
* - 连接:`ws://<控制面>/ws/notifications?account=<账号>`,握手头 `X-API-Token`(CONTROLPLANE_TOKEN,非空时强制)
|
||||
* - 下行帧:`{"type":"notify","notification":{id,title,content,level,target,account}}`
|
||||
* - 与 `GET /api/notifications` 轮询兜底并存;客户端按通知 id 去重,重复推送无副作用
|
||||
*
|
||||
* 实现:挂到 Koa 的同一个 http.Server(8800)的 `upgrade` 事件上,不额外占端口;
|
||||
* 进程内广播(现网 systemd 单实例);若将来多实例部署需换 Redis pub/sub。
|
||||
*/
|
||||
@Provide()
|
||||
export class CenterNotifyWsService {
|
||||
/** 挂载到已启动的 http.Server(onServerReady 阶段调用,幂等) */
|
||||
attach(server: Server): boolean {
|
||||
if (WSS) return true;
|
||||
if (!server) {
|
||||
warn('挂载失败:未拿到 http.Server');
|
||||
return false;
|
||||
}
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
WSS = wss;
|
||||
server.on('upgrade', (req: IncomingMessage, socket: Duplex, head: Buffer) => {
|
||||
try {
|
||||
handleUpgrade(wss, req, socket, head);
|
||||
} catch (e: any) {
|
||||
warn(`upgrade 处理异常:${e?.message || e}`);
|
||||
rejectUpgrade(socket, 400, 'Bad Request');
|
||||
}
|
||||
});
|
||||
wss.on('connection', (ws: any, req: IncomingMessage) => onConnection(ws, req));
|
||||
HEARTBEAT = setInterval(() => sweep(), HEARTBEAT_MS);
|
||||
HEARTBEAT.unref?.();
|
||||
log(`已挂载 ${NOTIFY_WS_PATH}(与 HTTP 共用端口)`);
|
||||
return true;
|
||||
}
|
||||
|
||||
stop(): void {
|
||||
if (HEARTBEAT) {
|
||||
clearInterval(HEARTBEAT);
|
||||
HEARTBEAT = null;
|
||||
}
|
||||
for (const set of CLIENTS.values()) {
|
||||
for (const ws of set) {
|
||||
try {
|
||||
ws.terminate();
|
||||
} catch (e) {
|
||||
/* 忽略 */
|
||||
}
|
||||
}
|
||||
}
|
||||
CLIENTS.clear();
|
||||
if (WSS) {
|
||||
try {
|
||||
WSS.close();
|
||||
} catch (e) {
|
||||
/* 忽略 */
|
||||
}
|
||||
WSS = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送一条通知(管理台新建通知时调用)。
|
||||
* @returns 实际送达的连接数(0 = 无在线执行机,客户端下次轮询会兜底拿到)
|
||||
*/
|
||||
pushNotification(n: NotifyFrame): number {
|
||||
const id = Number(n?.id);
|
||||
if (!id) return 0;
|
||||
const total = online();
|
||||
if (!WSS || !total) {
|
||||
log(`通知 #${id} 无在线连接,跳过实时推送(等客户端轮询兜底)`);
|
||||
return 0;
|
||||
}
|
||||
const frame = JSON.stringify({
|
||||
type: 'notify',
|
||||
notification: {
|
||||
id,
|
||||
title: n.title || '',
|
||||
content: n.content || '',
|
||||
level: n.level || 'info',
|
||||
target: n.target || 'all',
|
||||
account: n.account || '',
|
||||
},
|
||||
});
|
||||
const sets: Set<any>[] = [];
|
||||
if ((n.target || 'all') === 'account') {
|
||||
const hit = CLIENTS.get(String(n.account || '').trim());
|
||||
if (hit) sets.push(hit);
|
||||
} else {
|
||||
for (const set of CLIENTS.values()) sets.push(set);
|
||||
}
|
||||
let sent = 0;
|
||||
for (const set of sets) {
|
||||
for (const ws of set) {
|
||||
if (ws.readyState !== WS_OPEN) continue;
|
||||
try {
|
||||
ws.send(frame);
|
||||
sent++;
|
||||
} catch (e) {
|
||||
/* 单条失败不影响其它连接 */
|
||||
}
|
||||
}
|
||||
}
|
||||
log(`通知 #${id} 实时推送 → ${sent}/${total} 个连接(target=${n.target || 'all'})`);
|
||||
return sent;
|
||||
}
|
||||
|
||||
/** 运行状态(运维排查用) */
|
||||
stats() {
|
||||
return {
|
||||
path: NOTIFY_WS_PATH,
|
||||
mounted: !!WSS,
|
||||
accounts: CLIENTS.size,
|
||||
connections: online(),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@ renderer/dist/
|
||||
_cp_sessions.json
|
||||
.env
|
||||
|
||||
# 原生模块二进制(Node/Electron 两套 ABI,由 scripts/pack.js 下载与切换,不入库)
|
||||
native/
|
||||
|
||||
# 便携 Python 环境包产物(体积大,构建/下载生成,不入库)
|
||||
build/
|
||||
dist-env/
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
# 更新日志
|
||||
|
||||
## 未发布(本地改动,待发版时并入下一个版本)
|
||||
## 1.10.10(2026-11-10)
|
||||
|
||||
### 修复(1.10.9 全员启动崩)
|
||||
|
||||
- **启动失败 `NODE_MODULE_VERSION 137 vs 123`**:打包时把系统 Node(ABI 137) 编的
|
||||
`better_sqlite3.node` 原样打进安装包,Electron 30 运行时只认 ABI 123,`require` 即抛错,
|
||||
壳子在启动链路最前面就崩(窗口都出不来)。
|
||||
- 打包改走 `npm run pack`(`scripts/pack.js`):自动准备 Electron ABI 二进制
|
||||
(官方 release,GitHub 直连被墙时走 gh-proxy 镜像,缓存 `native/`)、打包前切换、
|
||||
打包后恢复,本地 `npm start`(系统 Node)不受影响
|
||||
- `scripts/after-pack.js` 增加**包内原生模块 ABI 哈希校验**,不一致直接让打包失败,
|
||||
杜绝再产出装不上的安装包
|
||||
- `electron/db.js` 原生模块加载失败时改为**降级容错**(记录 ERROR,壳子照常启动,
|
||||
仅「场景配置方案」相关接口报错),避免单个原生依赖再拖垮整个客户端
|
||||
|
||||
## 1.10.9(2026-11-10)
|
||||
|
||||
### 新增
|
||||
|
||||
@@ -9,6 +24,14 @@
|
||||
默认过滤 Excel `xlsx/xlsm`)。用于「台账模板 / 数据源文件」这类**单文件**参数,
|
||||
`/api/dialog/directory` 只能选目录、选不了文件
|
||||
|
||||
### 修复
|
||||
|
||||
- 通知推送 WebSocket 连接更稳:启动时尚未登录的话,登录后随 60 秒轮询自动补连
|
||||
(原来不重建连接,只能靠重启壳子才恢复);旧连接的关闭事件不再把新连接顶掉,
|
||||
避免重复连接与重连抖动
|
||||
- 配套中心机新增 `WS /ws/notifications` 实时通道:通知从"最长 60 秒延迟"变为秒达,
|
||||
原 `GET /api/notifications` 轮询继续作为兜底(中心机未升级时仍按轮询工作)
|
||||
|
||||
## 1.10.2(2026-11-06)
|
||||
|
||||
### 新增
|
||||
|
||||
@@ -3,13 +3,15 @@
|
||||
// 说明:
|
||||
// - 既有 JSON(license/active/schedules/run_history/creds 等)是和老客户端(Python webhost)
|
||||
// 共享的契约文件,保持原样不动;**新增数据一律入 SQLite**,避免再堆 JSON。
|
||||
// - better-sqlite3 为原生模块:CLI 模式用系统 Node 的二进制;打包(electron-builder)时
|
||||
// 自动 rebuild 为 Electron ABI,产物无需额外处理。
|
||||
// - better-sqlite3 为原生模块:ABI 必须与运行时一致——CLI 模式(系统 Node)用 Node ABI 二进制,
|
||||
// 打包必须用 Electron ABI 二进制(由 scripts/pack.js 在打包时切换,scripts/after-pack.js 校验)。
|
||||
// ⚠️ 事故记录(1.10.9):打包时未切 ABI,把 Node ABI(137) 的 .node 打进 Electron 30(123) 安装包,
|
||||
// require 直接抛 NODE_MODULE_VERSION 不匹配,整个壳子**启动即崩**、全员打不开。
|
||||
// 因此这里一律降级容错:加载失败只记录 ERROR,壳子照常启动,仅「方案配置」相关接口报错。
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const Database = require("better-sqlite3");
|
||||
const config = require("./config");
|
||||
const { makeLogger } = require("./logger");
|
||||
|
||||
@@ -24,12 +26,36 @@ try {
|
||||
/* 忽略:只读环境等极端情况由后续建库报错兜底 */
|
||||
}
|
||||
|
||||
// 降级桩:启动不受影响,真正调用 SQLite 的接口给出明确错误
|
||||
function makeStub(err) {
|
||||
const boom = () => {
|
||||
throw Object.assign(
|
||||
new Error(`本地 SQLite 不可用(${err && err.message ? err.message : "未知原因"})`),
|
||||
{ status: 500 }
|
||||
);
|
||||
};
|
||||
return { pragma: () => undefined, exec: boom, prepare: boom, close: () => undefined };
|
||||
}
|
||||
|
||||
// 打开即建库建表(幂等);WAL 提升并发读性能,写仍同步
|
||||
const db = new Database(DB_PATH);
|
||||
db.pragma("journal_mode = WAL");
|
||||
function openSqlite() {
|
||||
try {
|
||||
const Database = require("better-sqlite3");
|
||||
const instance = new Database(DB_PATH);
|
||||
instance.pragma("journal_mode = WAL");
|
||||
return { instance, error: null };
|
||||
} catch (e) {
|
||||
logger.error(`SQLite 加载失败,方案配置功能降级不可用:${e.message}`);
|
||||
return { instance: null, error: e };
|
||||
}
|
||||
}
|
||||
|
||||
const { instance: sqlite, error: loadError } = openSqlite();
|
||||
const db = sqlite || makeStub(loadError);
|
||||
|
||||
function migrate() {
|
||||
db.exec(`
|
||||
if (!sqlite) return; // 降级态不建表,避免二次抛错
|
||||
sqlite.exec(`
|
||||
-- 场景配置方案(多配置):同一场景多套命名参数,运行台/定时任务按需选用
|
||||
CREATE TABLE IF NOT EXISTS plugin_configs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -47,4 +73,4 @@ function migrate() {
|
||||
|
||||
migrate();
|
||||
|
||||
module.exports = { db, DB_PATH };
|
||||
module.exports = { db, DB_PATH, sqliteAvailable: Boolean(sqlite) };
|
||||
|
||||
@@ -96,15 +96,16 @@ function connectWs(account) {
|
||||
wsAccount = account;
|
||||
try {
|
||||
const { WebSocket } = require("ws");
|
||||
ws = new WebSocket(wsUrl(account), {
|
||||
const sock = new WebSocket(wsUrl(account), {
|
||||
headers: cp.machineHeaders(),
|
||||
handshakeTimeout: 8000,
|
||||
});
|
||||
ws.on("open", () => {
|
||||
ws = sock;
|
||||
sock.on("open", () => {
|
||||
wsRetry = 0;
|
||||
logger.info(`通知 WebSocket 已连接(${account})`);
|
||||
});
|
||||
ws.on("message", (data) => {
|
||||
sock.on("message", (data) => {
|
||||
try {
|
||||
const msg = JSON.parse(String(data));
|
||||
if (msg.type === "notify" && msg.notification) {
|
||||
@@ -114,11 +115,15 @@ function connectWs(account) {
|
||||
/* 忽略坏帧 */
|
||||
}
|
||||
});
|
||||
ws.on("ping", () => {
|
||||
try { ws.pong(); } catch (e) { /* 忽略 */ }
|
||||
sock.on("ping", () => {
|
||||
try { sock.pong(); } catch (e) { /* 忽略 */ }
|
||||
});
|
||||
ws.on("close", () => { scheduleWsReconnect(wsAccount); });
|
||||
ws.on("error", (e) => { logger.warning(`通知 WS 错误:${e.message}`); });
|
||||
// 只有「当前这一条」连接关闭才安排重连,避免旧连接把新连接顶掉(重复连接/定时器抖动)
|
||||
sock.on("close", () => {
|
||||
if (ws !== sock) return;
|
||||
scheduleWsReconnect(wsAccount);
|
||||
});
|
||||
sock.on("error", (e) => { logger.warning(`通知 WS 错误:${e.message}`); });
|
||||
} catch (e) {
|
||||
logger.warning(`通知 WS 连接失败:${e.message}`);
|
||||
scheduleWsReconnect(account);
|
||||
@@ -143,6 +148,8 @@ async function pollOnce() {
|
||||
const active = config.CONTROLPLANE_ACCOUNT || session.sessActiveAccount();
|
||||
if (active) accts.add(active);
|
||||
if (!accts.size) return;
|
||||
// 启动时可能还没登录(connectWs 无账号直接返回),随轮询补连;已连/连接中幂等返回
|
||||
if (active) connectWs(active);
|
||||
|
||||
for (const account of accts) {
|
||||
try {
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "37du-electron-shell",
|
||||
"version": "1.10.8",
|
||||
"version": "1.10.10",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "37du-electron-shell",
|
||||
"version": "1.10.8",
|
||||
"version": "1.10.10",
|
||||
"dependencies": {
|
||||
"adm-zip": "^0.5.18",
|
||||
"better-sqlite3": "12.4.1",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "37du-electron-shell",
|
||||
"productName": "37du 自动化工作台",
|
||||
"version": "1.10.8",
|
||||
"version": "1.10.10",
|
||||
"description": "37du 执行机 Node/Electron 客户端(替代 Python webhost 底座,插件保持 Python 子进程执行)",
|
||||
"main": "electron/main.js",
|
||||
"private": true,
|
||||
@@ -10,7 +10,9 @@
|
||||
"start": "node electron/main.js --cli",
|
||||
"dev": "node electron/main.js --cli --dev",
|
||||
"electron": "electron .",
|
||||
"pack": "electron-builder --win nsis",
|
||||
"pack": "node scripts/pack.js",
|
||||
"pack:raw": "electron-builder --win nsis",
|
||||
"native:fetch": "node scripts/pack.js --fetch-only",
|
||||
"copy-renderer": "powershell -NoProfile -ExecutionPolicy Bypass -File scripts/copy-renderer.ps1"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,14 +1,58 @@
|
||||
// electron-builder afterPack 钩子:把 package.json 版本号写入 exe 同级 shell.version。
|
||||
// shell-updater 靠这个文件判定"打包态 + 本机版本",缺失会被误判为源码开发模式、
|
||||
// 不参与壳子自更新(win-unpacked 根目录 = 安装后 exe 同级目录)。
|
||||
// electron-builder afterPack 钩子:
|
||||
// 1) 把 package.json 版本号写入 exe 同级 shell.version(shell-updater 靠它判定"打包态 + 本机版本",
|
||||
// 缺失会被误判为源码开发模式、不参与壳子自更新;win-unpacked 根目录 = 安装后 exe 同级目录)
|
||||
// 2) 校验打进包里的 better-sqlite3 原生模块是 **Electron ABI**(1.10.9 全员启动崩事故的守门人:
|
||||
// 当时打进的是系统 Node ABI(137) 二进制,Electron 30 只认 123,装机后 require 即抛错)。
|
||||
// 不一致直接让打包失败,绝不产出装不上的安装包。
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const crypto = require("crypto");
|
||||
|
||||
const ROOT = path.join(__dirname, "..");
|
||||
const NATIVE_BIN = path.join(ROOT, "native", "electron", "build", "Release", "better_sqlite3.node");
|
||||
|
||||
function sha256(file) {
|
||||
return crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
|
||||
}
|
||||
|
||||
function verifyNativeAbi(context) {
|
||||
const packed = path.join(
|
||||
context.appOutDir,
|
||||
"resources",
|
||||
"app.asar.unpacked",
|
||||
"node_modules",
|
||||
"better-sqlite3",
|
||||
"build",
|
||||
"Release",
|
||||
"better_sqlite3.node"
|
||||
);
|
||||
if (!fs.existsSync(packed)) {
|
||||
throw new Error(`[after-pack] 包内未找到 better-sqlite3 原生模块:${packed}`);
|
||||
}
|
||||
if (!fs.existsSync(NATIVE_BIN)) {
|
||||
throw new Error(
|
||||
`[after-pack] 缺少 Electron ABI 参考二进制:${NATIVE_BIN}\n` +
|
||||
"请用 npm run pack 打包(会自动准备并切换 ABI),不要直接跑 electron-builder"
|
||||
);
|
||||
}
|
||||
const got = sha256(packed);
|
||||
const want = sha256(NATIVE_BIN);
|
||||
if (got !== want) {
|
||||
throw new Error(
|
||||
"[after-pack] 包内 better-sqlite3 不是 Electron ABI,装机会启动即崩!\n" +
|
||||
` 包内 sha256=${got}\n 期望 sha256=${want}\n` +
|
||||
"请用 npm run pack 打包(它会先切换 ABI),不要直接跑 electron-builder"
|
||||
);
|
||||
}
|
||||
console.log(`[after-pack] 原生模块 ABI 校验通过(sha256=${got.slice(0, 12)})`);
|
||||
}
|
||||
|
||||
exports.default = async function afterPack(context) {
|
||||
const pkg = require(path.join(__dirname, "..", "package.json"));
|
||||
const pkg = require(path.join(ROOT, "package.json"));
|
||||
const target = path.join(context.appOutDir, "shell.version");
|
||||
fs.writeFileSync(target, `${pkg.version}\n`, "utf-8");
|
||||
console.log(`[after-pack] shell.version -> ${target} (${pkg.version})`);
|
||||
verifyNativeAbi(context);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
// 打包入口(替代裸 `electron-builder`):负责把 better-sqlite3 原生模块切成 **Electron ABI** 再打包。
|
||||
//
|
||||
// 背景(1.10.9 全员启动崩事故):better-sqlite3 是原生模块,.node 二进制的 NODE_MODULE_VERSION
|
||||
// 必须与运行时一致——系统 Node v24 = 137,Electron 30 = 123。而 electron-builder 配置里
|
||||
// npmRebuild=false(不重编译),会直接把 node_modules 里 Node ABI 的二进制打进安装包,
|
||||
// 结果装机后 require 即抛 "compiled against a different Node.js version" → 壳子启动即崩。
|
||||
//
|
||||
// 本脚本流程:
|
||||
// 1) 确保 native/electron/.../better_sqlite3.node(Electron ABI)存在,缺失则按需下载
|
||||
// (better-sqlite3 官方 GitHub release,走 gh-proxy 镜像兜底,缓存在 native/cache/)
|
||||
// 2) 备份当前 Node ABI 二进制到 native/node/(供 `npm start` 本地 CLI 运行)
|
||||
// 3) 把 Electron ABI 二进制切进 node_modules/better-sqlite3/build/Release/
|
||||
// 4) 跑 electron-builder(after-pack.js 会校验打进包里的二进制哈希,不一致即打包失败)
|
||||
// 5) 无论成败,恢复 Node ABI 二进制,保证本地 `npm start` 仍可用
|
||||
//
|
||||
// 用法:npm run pack [-- <electron-builder 额外参数>],或 npm run native:fetch 只准备二进制。
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const https = require("https");
|
||||
const crypto = require("crypto");
|
||||
const { spawnSync } = require("child_process");
|
||||
|
||||
const ROOT = path.join(__dirname, "..");
|
||||
const BS3_DIR = path.join(ROOT, "node_modules", "better-sqlite3");
|
||||
const TARGET_BIN = path.join(BS3_DIR, "build", "Release", "better_sqlite3.node");
|
||||
const NATIVE_DIR = path.join(ROOT, "native");
|
||||
const NODE_BIN = path.join(NATIVE_DIR, "node", "better_sqlite3.node");
|
||||
const ELECTRON_BIN = path.join(NATIVE_DIR, "electron", "build", "Release", "better_sqlite3.node");
|
||||
const CACHE_DIR = path.join(NATIVE_DIR, "cache");
|
||||
|
||||
const MIRRORS = ["https://gh-proxy.com/", "https://ghfast.top/"]; // GitHub 直连会 ECONNRESET,走镜像
|
||||
|
||||
function log(msg) {
|
||||
console.log(`[pack] ${msg}`);
|
||||
}
|
||||
|
||||
function die(msg) {
|
||||
console.error(`[pack] 失败:${msg}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function sha256(file) {
|
||||
return crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
|
||||
}
|
||||
|
||||
function readJson(file) {
|
||||
return JSON.parse(fs.readFileSync(file, "utf-8"));
|
||||
}
|
||||
|
||||
// 已安装的 Electron 版本(取实际安装版本,不取 ^range)
|
||||
function electronVersion() {
|
||||
const pkg = path.join(ROOT, "node_modules", "electron", "package.json");
|
||||
if (!fs.existsSync(pkg)) die("未安装 electron,请先 npm install");
|
||||
const ver = readJson(pkg).version;
|
||||
if (!ver) die("读取 electron 版本失败");
|
||||
return ver;
|
||||
}
|
||||
|
||||
function electronAbi(version) {
|
||||
let abi;
|
||||
try {
|
||||
abi = require("node-abi").getAbi(version, "electron");
|
||||
} catch (e) {
|
||||
die(`解析 Electron ABI 失败(${version}):${e.message}`);
|
||||
}
|
||||
if (!abi) die(`node-abi 未收录 Electron ${version} 的 ABI,请升级 node-abi`);
|
||||
return abi;
|
||||
}
|
||||
|
||||
function prebuildUrls() {
|
||||
const bs3Ver = readJson(path.join(BS3_DIR, "package.json")).version;
|
||||
const abi = electronAbi(electronVersion());
|
||||
const name = `better-sqlite3-v${bs3Ver}-electron-v${abi}-win32-x64.tar.gz`;
|
||||
const official = `https://github.com/WiseLibs/better-sqlite3/releases/download/v${bs3Ver}/${name}`;
|
||||
return { name, abi, urls: [...MIRRORS.map((m) => m + official), official] };
|
||||
}
|
||||
|
||||
function httpDownload(url, dest, redirects = 5) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = https.get(url, { headers: { "User-Agent": "37du-pack" } }, (res) => {
|
||||
const code = res.statusCode || 0;
|
||||
if (code >= 300 && code < 400 && res.headers.location && redirects > 0) {
|
||||
res.resume();
|
||||
const next = new URL(res.headers.location, url).toString();
|
||||
resolve(httpDownload(next, dest, redirects - 1));
|
||||
return;
|
||||
}
|
||||
if (code !== 200) {
|
||||
res.resume();
|
||||
reject(new Error(`HTTP ${code}`));
|
||||
return;
|
||||
}
|
||||
const out = fs.createWriteStream(dest);
|
||||
res.pipe(out);
|
||||
out.on("finish", () => out.close(() => resolve(dest)));
|
||||
out.on("error", reject);
|
||||
});
|
||||
req.on("error", reject);
|
||||
req.setTimeout(180000, () => req.destroy(new Error("下载超时")));
|
||||
});
|
||||
}
|
||||
|
||||
async function ensureElectronBinary() {
|
||||
if (fs.existsSync(ELECTRON_BIN)) return ELECTRON_BIN;
|
||||
const { name, abi, urls } = prebuildUrls();
|
||||
fs.mkdirSync(CACHE_DIR, { recursive: true });
|
||||
const tgz = path.join(CACHE_DIR, name);
|
||||
if (!fs.existsSync(tgz)) {
|
||||
let lastErr = null;
|
||||
for (const url of urls) {
|
||||
try {
|
||||
log(`下载 Electron ABI ${abi} 预编译二进制:${url}`);
|
||||
await httpDownload(url, tgz);
|
||||
if (fs.statSync(tgz).size < 100 * 1024) throw new Error("下载内容过小,可能被拦截");
|
||||
lastErr = null;
|
||||
log(`下载完成 ${fs.statSync(tgz).size} 字节`);
|
||||
break;
|
||||
} catch (e) {
|
||||
lastErr = e;
|
||||
log(`该源失败(${e.message}),换下一个`);
|
||||
try {
|
||||
fs.unlinkSync(tgz);
|
||||
} catch (_) {
|
||||
/* 忽略 */
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lastErr) die(`Electron ABI 预编译二进制下载失败:${lastErr.message}`);
|
||||
}
|
||||
// 解压到 native/electron/(bsdtar 自带于 Win10+,无需第三方)
|
||||
fs.mkdirSync(path.dirname(ELECTRON_BIN), { recursive: true });
|
||||
const r = spawnSync("tar", ["-xzf", tgz, "-C", path.dirname(path.dirname(path.dirname(ELECTRON_BIN)))], {
|
||||
stdio: "inherit",
|
||||
});
|
||||
if (r.status !== 0 || !fs.existsSync(ELECTRON_BIN)) {
|
||||
die(`解压失败,请手动解压 ${tgz} 到 native/electron/(需要 build/Release/better_sqlite3.node)`);
|
||||
}
|
||||
log(`Electron ABI 二进制就绪:${ELECTRON_BIN}`);
|
||||
return ELECTRON_BIN;
|
||||
}
|
||||
|
||||
// 备份 / 恢复 Node ABI 二进制(本地 CLI 模式用)
|
||||
function backupNodeBinary() {
|
||||
if (fs.existsSync(NODE_BIN)) return;
|
||||
if (!fs.existsSync(TARGET_BIN)) die("未找到 node_modules/better-sqlite3 的 .node 二进制,请先 npm install");
|
||||
if (sha256(TARGET_BIN) === sha256(ELECTRON_BIN)) {
|
||||
log("当前 node_modules 里已是 Electron ABI 二进制,跳过备份(本地 `npm start` 需自行 npm rebuild better-sqlite3)");
|
||||
return;
|
||||
}
|
||||
fs.mkdirSync(path.dirname(NODE_BIN), { recursive: true });
|
||||
fs.copyFileSync(TARGET_BIN, NODE_BIN);
|
||||
log(`已备份系统 Node ABI 二进制 → ${NODE_BIN}`);
|
||||
}
|
||||
|
||||
function useElectronBinary() {
|
||||
fs.mkdirSync(path.dirname(TARGET_BIN), { recursive: true });
|
||||
fs.copyFileSync(ELECTRON_BIN, TARGET_BIN);
|
||||
log(`已切换到 Electron ABI 二进制(sha256=${sha256(TARGET_BIN).slice(0, 12)})`);
|
||||
}
|
||||
|
||||
function restoreNodeBinary() {
|
||||
if (!fs.existsSync(NODE_BIN)) {
|
||||
log("无 Node ABI 备份可恢复,本地 CLI 模式可能不可用(执行 npm rebuild better-sqlite3 可修复)");
|
||||
return;
|
||||
}
|
||||
fs.copyFileSync(NODE_BIN, TARGET_BIN);
|
||||
log("已恢复系统 Node ABI 二进制(本地 CLI 模式不受影响)");
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const args = process.argv.slice(2);
|
||||
await ensureElectronBinary();
|
||||
if (args.includes("--fetch-only")) {
|
||||
log("仅准备二进制,打包跳过");
|
||||
return;
|
||||
}
|
||||
backupNodeBinary();
|
||||
useElectronBinary();
|
||||
try {
|
||||
const bin = path.join(ROOT, "node_modules", ".bin", process.platform === "win32" ? "electron-builder.cmd" : "electron-builder");
|
||||
if (!fs.existsSync(bin)) die("未安装 electron-builder,请先 npm install");
|
||||
const extra = args.filter((a) => a !== "--fetch-only");
|
||||
const buildArgs = extra.length ? extra : ["--win", "nsis"];
|
||||
log(`执行 electron-builder ${buildArgs.join(" ")}`);
|
||||
const r = spawnSync(bin, buildArgs, { cwd: ROOT, stdio: "inherit", shell: process.platform === "win32" });
|
||||
if (r.status !== 0) die(`electron-builder 退出码 ${r.status}`);
|
||||
} finally {
|
||||
restoreNodeBinary();
|
||||
}
|
||||
log("打包完成(after-pack 已校验包内原生模块为 Electron ABI)");
|
||||
}
|
||||
|
||||
main().catch((e) => die(e && e.message ? e.message : String(e)));
|
||||
@@ -86,7 +86,7 @@ npm install
|
||||
npm run copy-renderer # 前端有改动时:frontend/ → renderer/dist
|
||||
npm run electron # Electron 窗口模式
|
||||
npm start # 纯 Node CLI 模式(无窗口,node electron/main.js --cli)
|
||||
npm run pack # electron-builder --win nsis → dist-app/setup-37du-shell-<version>.exe
|
||||
npm run pack # scripts/pack.js(切 Electron ABI + electron-builder)→ dist-app/setup-37du-shell-<version>.exe
|
||||
```
|
||||
|
||||
前端源码单独开发时:`cd frontend && npm run dev`(Vite),最终仍需 `copy-renderer` 同步进 asar。
|
||||
@@ -168,6 +168,7 @@ powershell -NoProfile -ExecutionPolicy Bypass -File scripts\build-python-env.ps1
|
||||
| 定时/流程备份 | `POST/GET /api/schedules/backup`(同一槽位含 `schedules` + `flows`) |
|
||||
| 运行备注 | `GET/POST /api/plugin-notes` |
|
||||
| 通知 / 头像 / 文件源列表 | `GET /api/notifications`、`GET /api/avatar/{account}`、`GET /api/file-sources/{category}` |
|
||||
| 通知实时推送(WS) | `WS /ws/notifications?account=<账号>`(握手头 `X-API-Token`),下行帧 `{"type":"notify","notification":{id,title,content,level,target,account}}`;与 HTTP 共用 8800 端口,连不上时仍由 `GET /api/notifications` 60s 轮询兜底 |
|
||||
| 凭证下发 | `POST /api/creds/register`、`GET /api/creds` |
|
||||
| 钉钉扫码 | `GET /api/dingtalk/login-url`、`POST /auth/exchange`(钉钉 code → 建号 + 云端 token) |
|
||||
|
||||
|
||||
@@ -40,10 +40,15 @@ npm run copy-renderer # frontend/ → renderer/dist(前端有改动时
|
||||
|
||||
```powershell
|
||||
npm install # 首次或依赖变更后
|
||||
npm run pack # electron-builder --win nsis
|
||||
npm run pack # scripts/pack.js:切 better-sqlite3 为 Electron ABI → electron-builder --win nsis
|
||||
# 产物:dist-app\setup-37du-shell-<version>.exe
|
||||
```
|
||||
|
||||
⚠️ **不要直接跑 `electron-builder`(或 `npm run pack:raw`)**:`npmRebuild=false` 会跳过原生模块重编译,
|
||||
把系统 Node ABI 的 `better_sqlite3.node` 打进包(Electron 只认自己的 ABI),装完启动即崩
|
||||
(1.10.9 全员事故)。`npm run pack` 会自动切换 ABI 并缓存到 `native/`(不入库),
|
||||
`scripts/after-pack.js` 还会校验包内二进制哈希,不一致直接打包失败。
|
||||
|
||||
打包配置要点(`package.json` → `build`):`appId=com.37du.automation`、`productName=37du 自动化工作台`、`asar=true`、
|
||||
`extraResources` 把 `.env.packaged` 映射为 `resources/.env`、`artifactName=setup-37du-shell-${version}.exe`、
|
||||
NSIS `oneClick=false`(可选安装目录、perMachine=false)、`afterPack=scripts/after-pack.js`。
|
||||
|
||||
@@ -143,6 +143,11 @@ curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8800/api/shell/version
|
||||
curl -s http://127.0.0.1:8090/ | head -c 200
|
||||
# 文件服务器
|
||||
curl -s http://127.0.0.1:8802/
|
||||
# 通知 WS 端点已挂载(未带票据应为 401;返回 404 说明该版本后端还没有 /ws/notifications)
|
||||
curl -s -o /dev/null -w '%{http_code}\n' \
|
||||
-H 'Connection: Upgrade' -H 'Upgrade: websocket' -H 'Sec-WebSocket-Version: 13' \
|
||||
-H 'Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==' \
|
||||
'http://127.0.0.1:8800/ws/notifications?account=test'
|
||||
```
|
||||
|
||||
本机发版 CLI 预检:
|
||||
|
||||
@@ -85,7 +85,8 @@
|
||||
### 5. ②「是否续签=是」逐条处理(process_renew)
|
||||
- **前置默认**:`电子签期望推送日期` 空 → `datetime.now().date()`,记 `prefill`;`电子签接收电话号码` 归一后为空 → 查花名册取 `hr_staff_base.mobile_phone`,取到记 `prefill`,取不到 → 状态「异常」返回;
|
||||
- **手机号闸门**(`renew_contract` 第 0 步):AI 号码须 `1[3-9]\d{9}`;与花名册一致放行;不一致且合法 → 先 `validate_mobile_phone_unique`(`POST HrTableEngine/ajaxValidate.mc?sqlId=sql_hr_staff_base_mobile_phone_unique_module_conf`,`staffId`=本人 `base_id` 排除自己,与花名册编辑保存前端同款)——重复 → 「异常」中断该员工(`_dup_phone`,回写 AI 表「异常描述」+ 钉钉);通过 → `_fix_hr_mobile_phone`(`getTableData` 读全量裸键化 → 改 `mobile_phone` → `saveTableData` 全量回传 `compeletCount=52` → 复查花名册 5 次×3 秒确认落库)后继续;非法/查无此人/缺 `base_id`/重复/修正失败 → 「异常」;
|
||||
- **完整性**(第 1 步):期限(月)/续签开始日期/续签截止日期/续签类型任一缺失 → 「跳过」转人工;`TREATY_MAP` 不命中(非 劳动合同/超龄用工协议)→ 「失败」;`_deadline_code` 解析不出整数月 → 「失败」;
|
||||
- **完整性**(第 1 步):续签开始日期/续签截止日期/续签类型任一缺失 → 「跳过」转人工;`TREATY_MAP` 不命中(非 劳动合同/超龄用工协议)→ 「失败」;
|
||||
- **期限推算**(第 1.5 步,2026-11-10 修正):AI 表「期限(月)」是**旧合同**期限(刘瑶 12.00),界面「新合同/协议续签信息」下的「续签期限(月)」是新合同期限(刘瑶 36)但属钉钉公式列、OpenAPI 的 fields/records 都不返回;HR 台账「合同期限」也是页面计算字段(`CalTypeOfDateAndPeriod=1`,接口拿不到也不重算,落库值=提交传入值)。故改为 `_renew_months(start, end, old_expire)` → `new_contract_deadline`(刘瑶 37014980 旧版取旧合同 12,推成 12 个月 + 2029-12-18 截止的矛盾合同);**2026-11-10 二次修正(用户给出 AI 表公式)**:`续签期限(月) = ROUND(DATEDIF([合同/协议到期日], [续签截止日期]+1, "M"), 0)`,代码用 `_datedif_months()` 复刻 DATEDIF 完整月数口径(`day(end) < day(start)` 少算 1 个月,月末对齐与 Excel 一致),旧到期日缺省用续签开始日-1 兜底;算不出或 ≤0 → 「异常」不发起;
|
||||
- **定位生效合同**(第 2 步):`query_active_contract` 按工号精确匹配【生效中合同】,取 `contract_id` + 行快照;查无 → 「失败」;
|
||||
- **防重**(第 3 步):
|
||||
- `query_wait_effect_rows` 有行 → `max` 按 `contract_start_date` 取最新行,逐项比对 开始/截止日期、期限(月)、续签类型、(AI 表填了签署单位且名->code 映射成功才比对 `si_area`);全一致且行内 `ext_push_time` 非空 → 「防重」+ `ai["_push_time"]`;有 diff → 「异常」;无推送时间 → 「异常」;
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
12. 花名册缺 base_id / 修正读存失败 / 复查未变更 → 异常暂不处理;
|
||||
13. AI 表新合同信息不全(期限/开始/截止/类型任一缺)→ 跳过转人工;
|
||||
14. 续签类型无法识别(非 劳动合同/超龄用工协议)→ 失败;
|
||||
15. 期限(月)无法解析(`_deadline_code`)→ 失败;
|
||||
15. 期限(月)按 AI 表同款公式 `ROUND(DATEDIF(旧合同到期日, 续签截止日+1, "M"), 0)` 复算(`_renew_months`),算不出/≤0 → 异常不发起;AI 表「期限(月)」为旧合同期限,不一致只记日志;
|
||||
16. 【生效中合同】查无此人 / 无 contract_id → 失败(不静默);
|
||||
17. 防重-待生效有行:最新行 开始/截止日期、期限(月)、续签类型、(填了才核对)单位 code 全一致且行内有 `ext_push_time` → 防重并回填该行推送时间;
|
||||
18. 防重-待生效有行:任一不一致 / 行内无推送时间 → 异常待人工核对;
|
||||
@@ -114,7 +114,7 @@
|
||||
12. 花名册缺 base_id → 异常(无法修正联系方式);
|
||||
13. 联系方式修正失败(读取/保存 `state!=1`,或保存成功但复查 5 次未变更)→ 异常并附原因;
|
||||
14. AI 表新合同信息不全 → 跳过转人工(只记日志);
|
||||
15. 续签类型无法识别 / 期限(月)无法解析 → 失败;
|
||||
15. 续签类型无法识别 → 失败;续签起止日期非整月跨度(期限无法推算)→ 异常不发起;
|
||||
16. 【生效中合同】查无此人 → 失败;
|
||||
17. 防重命中但待生效合同与 AI 表不一致 → 异常待人工核对;
|
||||
18. 防重命中但行内无 `ext_push_time` → 异常(无法回填推送时间);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
1. 用工类型同步:AI 表格「用工类型是否调整」填有合法目标值时,把 HR 花名册(hr_staff_base.identity)的用工类型改为该值;与手机号修正同口径——仅当 HR 当前值与目标值不一致时才改;字段为空、0、0.0、否、不调整、#N/A 等公式残留占位值一律跳过,不在用工类型字典(COMMON.IDENTITY,名↔code 共 28 项,如全日制用工=1、事务代理=2、劳务外包人员=3、实习生=5、退休返聘人员=6、非全日制用工=ext_20、兼职人员=ext_24、劳务派遣人员=gov_identity_03)内的值跳过并记日志;AI 表格可直接填中文名或 code;同一工号在多条批次行中的目标值冲突时,该工号本次全部跳过不改(避免改错);
|
||||
2. 默认值处理:电子签期望推送日期为空时按当天处理并回填;电子签接收电话号码为空时取员工花名册联系方式回填,花名册无号码的记为异常暂不处理;
|
||||
3. 手机号校验:AI 表格号码经归一化处理(全角折叠、去除非数字字符、去除 +86 前缀)后须为 11 位且以 1[3-9] 开头;与花名册一致的予以放行;不一致但格式合法的,**先调 HR 花名册同款唯一校验接口**(`HrTableEngine/ajaxValidate.mc?sqlId=sql_hr_staff_base_mobile_phone_unique_module_conf`,staffId 传本人 base_id 排除自己;HR 页面编辑保存会调该接口,saveTableData 接口不调)——校验通过才自动修正 HR 员工基本信息联系方式并复查落库后继续;校验不通过(号码重复)则中断该员工操作(不更新花名册、不提交续签),把重复号码与 HR 校验提示写入 AI 表格「异常描述」列并推送钉钉;格式非法、花名册查无此人、缺少 base_id、号码重复或修正失败的,记为异常暂不处理;
|
||||
4. 新合同信息直接取 AI 表格字段,不得自行推导:期限(月)、续签开始日期、续签截止日期、续签类型任一缺失的记为跳过并转人工补充;续签类型仅支持劳动合同(映射 1)与超龄用工协议(映射 ext_8);合同期限如「12.00」归一为「12」,无法识别或解析失败的记为失败;合同签署单位仅在填写后覆盖原合同单位,映射失败时沿用原单位并记录告警;
|
||||
4. 新合同信息直接取 AI 表格字段,不得自行推导:续签开始日期、续签截止日期、续签类型任一缺失的记为跳过并转人工补充;续签类型仅支持劳动合同(映射 1)与超龄用工协议(映射 ext_8);**合同期限(月) 不由 AI 表格决定**——AI 表格「期限(月)」是旧合同期限,界面「新合同/协议续签信息」下的「续签期限(月)」是新合同期限但属钉钉公式列、OpenAPI 读不到,HR 台账「合同期限」同样是页面计算字段(按起止日期联动算出,接口拿不到、服务端不重算);插件按 AI 表格同款公式复算期限(`ROUND(DATEDIF([合同/协议到期日], [续签截止日期]+1, "M"), 0)`),算不出或 ≤0 记为异常不发起;合同签署单位仅在填写后覆盖原合同单位,映射失败时沿用原单位并记录告警;
|
||||
5. 防重校验:先查询【待生效合同】,存在员工记录时取开始日期最新一条,核对开始/截止日期、期限(月)、续签类型,以及(AI 表格填写签署单位时)单位是否与 AI 表格一致,全部一致的判定为防重并回填该行推送时间;任一不一致或行内无推送时间的记为异常待人工核对;无待生效记录时,以 AI 表格「合同/协议到期日」为界,生效中合同截止日期大于该日期的视为已是续签后新合同,判定为防重;
|
||||
6. 旧合同到期日校验:确认仍为旧合同且即将发起续签前,AI 表格「合同/协议到期日」须与【生效中合同】截止日期完全一致;为空或不一致的记为异常不发起,并推送钉钉告警;
|
||||
7. 电子合同模板校验:签署单位未配置电子签模板(sign_way=ext_1、ext_is_esign=1)时记为异常不提交,待人资在 HR【合同签署单位配置】补配后重新执行;
|
||||
|
||||
@@ -27,7 +27,7 @@ base=`YndMj49yWjPmvXXDFb1OBGAoJ3pmz5aA`,table=`agznnlF`,操作人固定为
|
||||
| 电子签接收电话号码 | 文本 | 与花名册 `hr_staff_base.mobile_phone` 比对的闸门;为空 → 取花名册号码回填 AI 表 |
|
||||
| 电子签期望推送日期 | 日期 | 映射 HR 电子签推送时间 `ext_push_time`;为空 → 默认处理当天并回填 |
|
||||
| 推送时间 | 日期(回填) | 回填值 = 期望推送日期;防重命中时 = 待生效合同行 `hr_staff_contract_ext.ext_push_time` |
|
||||
| 期限(月) | 文本 | 如 `"12.00"` 归一为 `"12"` → `new_contract_deadline` |
|
||||
| 期限(月) | 文本 | **这是旧合同期限,不是新合同期限**(如刘瑶 12.00):仅作参考,不参与提交。界面「新合同/协议续签信息」分组下的「续签期限(月)」才是新合同期限(刘瑶 36),但它是钉钉公式列,OpenAPI 的 fields/records 均不返回、读不到;HR 台账「合同期限」同样是页面计算字段(`CalTypeOfDateAndPeriod=1`,按起止日期联动算出,接口拿不到也不重算)。因此新合同期限按 AI 表同款公式复算:`ROUND(DATEDIF([合同/协议到期日], [续签截止日期]+1, "M"), 0)`(`_renew_months`,2026-11-10 起;该列公式由用户提供,代码按 DATEDIF 完整月数口径复刻) |
|
||||
| 续签开始日期 | 日期 | → `new_contract_start_date`;核验时与最新合同开始日期比对 |
|
||||
| 续签截止日期 | 日期 | → `new_contract_end_date`;核验时与最新合同截止日期比对 |
|
||||
| 续签类型 | 文本 | 劳动合同 → `"1"`、超龄用工协议 → `"ext_8"`(`TREATY_MAP`)→ `new_treaty_type` |
|
||||
@@ -64,9 +64,9 @@ base=`YndMj49yWjPmvXXDFb1OBGAoJ3pmz5aA`,table=`agznnlF`,操作人固定为
|
||||
- 校验通过 → 自动修正 HR 联系方式(基本信息编辑接口,读→改→存→复查 5 次×3 秒)后继续(试算模式只报「正式跑将自动修正」,但唯一校验仍会调);
|
||||
- 校验不通过(重复)→ 「异常」并**中断该员工**(不改花名册、不提交续签),重复号码 + HR 提示写 AI 表「异常描述」列并推钉钉;
|
||||
- 格式非法 / 花名册查无此人 / 缺 `base_id` / 修正失败 → 「异常」暂不处理。
|
||||
3. **新合同信息直接取 AI 表字段,不自行推导**:期限(月)、续签开始/截止日期、续签类型缺一 → 「跳过」转人工补充;续签类型仅支持 劳动合同/超龄用工协议;合同期限 `"12.00"` 归一 `"12"`;电子签期望推送日期 → `ext_push_time` 且 `ext_is_push_esign="1"`;合同签署单位填了才覆盖 `si_area`。
|
||||
3. **新合同信息直接取 AI 表字段,不自行推导**:续签开始/截止日期、续签类型缺一 → 「跳过」转人工补充;续签类型仅支持 劳动合同/超龄用工协议;**合同期限(月) 按 AI 表同款公式复算**(`_renew_months` = `ROUND(DATEDIF(旧合同到期日, 续签截止日+1, "M"), 0)`;旧到期日取 AI 表「合同/协议到期日」,缺省用续签开始日-1 兜底;算不出或 ≤0 → 「异常」不发起)——AI 表「期限(月)」是旧合同期限(刘瑶 12),「续签期限(月)」是 API 读不到的公式列(刘瑶 36),两者都不能直接用;电子签期望推送日期 → `ext_push_time` 且 `ext_is_push_esign="1"`;合同签署单位填了才覆盖 `si_area`。
|
||||
4. **防重**(每条先查 HR 再决定是否发起):
|
||||
- 【待生效合同】已有该员工行 = 此前已推送过 → 取该行按开始日期最新一条,核对 开始/截止日期、期限(月)、续签类型、(AI 表填了签署单位才核对单位 code)全部与 AI 表一致 → 「防重」并回填该行 `ext_push_time` 为推送时间;任一不一致 或 行内无推送时间 → 「异常」待人工核对;
|
||||
- 【待生效合同】已有该员工行 = 此前已推送过 → 取该行按开始日期最新一条,核对 开始/截止日期、期限(月)(与其自身日期跨度一致)、续签类型、(AI 表填了签署单位才核对单位 code)全部与 AI 表一致 → 「防重」并回填该行 `ext_push_time` 为推送时间;任一不一致 或 行内无推送时间 → 「异常」待人工核对;
|
||||
- 待生效无行 → 以 AI 表「合同/协议到期日」(旧合同到期日)为界:生效中合同截止日期 **>** 旧合同到期日 = 已是续签后的新合同(即使 AI 表续签期填错也算已续签)→ 「防重」;AI 表缺该字段时兜底:生效中行有 `ext_push_time` 或 `is_initiate_sign=2` 视为已续签 → 「防重」。
|
||||
5. **旧合同到期日一致性闸门**(2026-10-26 用户要求):确认仍为旧合同、即将发起续签前,AI 表「合同/协议到期日」须与【生效中合同】截止日期**完全一致**;为空或不一致 → 「异常」不发起(该类异常**会**推送钉钉告警通知)。
|
||||
6. **电子合同模板防呆**:签署单位未配置 `sign_way=ext_1` 电子签模板 → 「异常」不提交,转人资在 HR【合同签署单位配置】补配后再跑(否则提交后 HR 报「合同模板不能为空」)。
|
||||
|
||||
@@ -20,16 +20,21 @@ HR【劳动关系-合同台账-生效中合同】属性页「续签合同」提
|
||||
(propertyPageId=8fbd80cb471d470d83dbb2f8534726e0)提交续签。
|
||||
★ 新合同信息直接使用 AI 表字段(不自行推导):
|
||||
续签类型 -> treaty_type(劳动合同="1" / 超龄用工协议="ext_8")
|
||||
期限(月) -> contract_deadline("12.00" 归一为 "12")
|
||||
续签开始日期 -> contract_start_date
|
||||
续签截止日期 -> contract_end_date
|
||||
期限(月) -> **按 AI 表同款公式复算**:AI 表「期限(月)」是**旧合同**期限(刘瑶 12,
|
||||
不能用);界面「续签期限(月)」(刘瑶 36)是钉钉公式列,OpenAPI
|
||||
读不到,其公式为
|
||||
`ROUND(DATEDIF([合同/协议到期日], [续签截止日期]+1, "M"), 0)`。
|
||||
代码用 `_renew_months()` 复刻同一公式(旧合同到期日 -> 续签截止日
|
||||
次日取完整月数),保证与 AI 表显示一致(2026-11-10 刘瑶 37014980)
|
||||
电子签期望推送日期 -> ext_push_time + ext_is_push_esign="1"
|
||||
合同签署单位 -> si_area(填了才覆盖:名->code 映射,失败沿用属性页原值)
|
||||
成功后 AI 表回填「人资是否推送=是」「推送时间=电子签期望推送日期」。
|
||||
前置默认(2026-10-16 用户要求):「电子签接收电话号码」为空 -> 取花名册
|
||||
联系方式回填 AI 表;「电子签期望推送日期」为空 -> 默认处理当天并回填
|
||||
AI 表;补全后继续完整续签流程(不再跳过)。AI 信息不全的记录不提交
|
||||
(期限/开始/截止/类型缺失 -> 不提交,日志报出)。
|
||||
(开始/截止日期、续签类型缺失 -> 不提交,日志报出)。
|
||||
4. 通知(2026-10-16 精简,块格式与加班审批一致):只推送 续签推送成功数量 /
|
||||
核验完成数量 / 核验未完成数量 / 续签失败明细;防重、试算、跳过、「是否续签=否」
|
||||
回填均只记日志不通知。例外:合同到期日与生效中合同不一致的异常推送
|
||||
@@ -95,7 +100,7 @@ HR【劳动关系-合同台账-生效中合同】属性页「续签合同」提
|
||||
import re
|
||||
import time
|
||||
import unicodedata
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from .xq_common import (
|
||||
AITABLE_BASE_ID, AITABLE_OPERATOR_UNIONID, AITABLE_PAGE_SIZE, AITABLE_WRITE_BATCH,
|
||||
@@ -120,7 +125,11 @@ F_EXPECT = "电子签期望推送日期" # date -> ext_push_time
|
||||
F_PUSH_DATE = "推送时间" # date(回填=期望推送日期)
|
||||
F_CODE = "工号"
|
||||
F_NAME = "姓名"
|
||||
F_MONTHS = "期限(月)" # text 如 "12.00" -> contract_deadline
|
||||
F_MONTHS = "期限(月)" # ⚠️ 这是**旧合同**的期限(如刘瑶 12.00),不是新合同期限!
|
||||
# 界面「新合同/协议续签信息」分组里的「续签期限(月)」= 新合同期限
|
||||
# (刘瑶 36)是钉钉公式列,OpenAPI 的 fields/records 都不返回,
|
||||
# 读不到 -> 新合同期限按同款公式复算(_renew_months)。
|
||||
# 本字段仅作"旧合同期限"参考,不参与提交,见 2026-11-10 修正
|
||||
F_START = "续签开始日期" # date -> contract_start_date
|
||||
F_END = "续签截止日期" # date -> contract_end_date
|
||||
F_TYPE = "续签类型" # text 劳动合同/超龄用工协议 -> treaty_type
|
||||
@@ -440,7 +449,10 @@ def validate_sheet_fields(step):
|
||||
"""
|
||||
need = {F_CODE, F_NAME, F_RENEW, F_PUSHED}
|
||||
if step in (STEP_ALL, STEP_PUSH):
|
||||
need |= {F_EXPECT, F_PUSH_DATE, F_MONTHS, F_START, F_END, F_TYPE, F_UNIT,
|
||||
# ⚠️ F_MONTHS(旧合同期限)不在必填集内:自 2026-11-10 起新合同期限按续签起止
|
||||
# 日期推算(界面「续签期限(月)」是公式列,API 读不到),该列仅作参考,
|
||||
# 缺失/改名不应让整轮直接不处理
|
||||
need |= {F_EXPECT, F_PUSH_DATE, F_START, F_END, F_TYPE, F_UNIT,
|
||||
F_PHONE, F_EXPIRE, F_EMP_TYPE}
|
||||
if step in (STEP_ALL, STEP_VERIFY):
|
||||
need |= {F_DONE, F_START, F_END}
|
||||
@@ -519,6 +531,54 @@ def _deadline_code(raw):
|
||||
return str(int(f)) if f == int(f) else str(f)
|
||||
|
||||
|
||||
def _datedif_months(start, end):
|
||||
"""Excel / 钉钉 AI 表格 `DATEDIF(start, end, "M")` 语义:两日期之间的**完整月数**。
|
||||
|
||||
⚠️ 2026-11-10 用户给出 AI 表「续签期限(月)」的计算公式(该列是钉钉公式列,
|
||||
OpenAPI 读不到):
|
||||
ROUND( DATEDIF([合同/协议到期日], [续签截止日期]+1, "M"), 0 )
|
||||
即以**旧合同到期日**为起点、**续签截止日期次日**为终点取完整月数(DATEDIF 本身
|
||||
返回整数,ROUND 只是保险)。代码按同款公式复算,保证与 AI 表显示值一致——
|
||||
实测对得上:程思兰 7、李章英 8、马敬芳 3、梁文霞 8、刘瑶 36、郑斌 36
|
||||
(此前"取最近整月"的口径普遍多算 1 个月,已废弃)。
|
||||
|
||||
DATEDIF 的月末特性与 Excel 一致:day(end) < day(start) 则少算一个月
|
||||
(如 2026-01-31 → 2026-02-28 = 0 个月)。
|
||||
|
||||
Returns:
|
||||
完整月数(可为 0 或负);start/end 缺失返回 None
|
||||
"""
|
||||
if start is None or end is None:
|
||||
return None
|
||||
months = (end.year - start.year) * 12 + (end.month - start.month)
|
||||
if end.day < start.day:
|
||||
months -= 1
|
||||
return months
|
||||
|
||||
|
||||
def _renew_months(start, end, old_expire):
|
||||
"""新合同期限(月) = ROUND(DATEDIF(旧合同到期日, 续签截止日+1, "M"), 0)(与 AI 表同款公式)。
|
||||
|
||||
Args:
|
||||
start: 续签开始日期(date)
|
||||
end: 续签截止日期(date)
|
||||
old_expire: 旧合同到期日(AI 表「合同/协议到期日」);缺省时用 start - 1 天兜底
|
||||
(续签一般紧接旧合同次日开始,两者等价)
|
||||
|
||||
Returns:
|
||||
(月数 N, 计算基准说明);参数不足/结果 <=0 返回 (None, 原因)
|
||||
"""
|
||||
if start is None or end is None:
|
||||
return None, "续签开始/截止日期为空"
|
||||
base = old_expire or (start - timedelta(days=1))
|
||||
n = _datedif_months(base, end + timedelta(days=1))
|
||||
if n is None:
|
||||
return None, "起止日期无法计算"
|
||||
if n <= 0:
|
||||
return None, f"续签截止日({end})不晚于旧合同到期日({base})"
|
||||
return n, f"DATEDIF({base}, {end + timedelta(days=1)})={n}"
|
||||
|
||||
|
||||
def renew_contract(session, ai, dry_run):
|
||||
"""对单条候选执行 HR 续签(AI 表新合同信息直接使用,不推导)。
|
||||
|
||||
@@ -568,16 +628,28 @@ def renew_contract(session, ai, dry_run):
|
||||
ai["_phone_fixed"] = note
|
||||
|
||||
# 1) AI 表新合同信息完整性(缺失 -> 不提交,转人工补充)
|
||||
miss = [n for n, v in (("期限(月)", ai["months_raw"]), ("续签开始日期", ai["start"]),
|
||||
# 期限(月) 不参与校验:HR 台账期限是页面计算字段,统一按续签开始/截止日期推算
|
||||
miss = [n for n, v in (("续签开始日期", ai["start"]),
|
||||
("续签截止日期", ai["end"]), ("续签类型", ai["rtype"])) if not v]
|
||||
if miss:
|
||||
return "跳过", f"AI表新合同信息不全(缺 {'、'.join(miss)}),转人工补充"
|
||||
treaty = TREATY_MAP.get(ai["rtype"])
|
||||
if not treaty:
|
||||
return "失败", f"续签类型无法识别:{ai['rtype']}(仅支持 劳动合同/超龄用工协议)"
|
||||
months = _deadline_code(ai["months_raw"])
|
||||
if not months:
|
||||
return "失败", f"期限(月)无法解析:{ai['months_raw']}"
|
||||
# 新合同期限 = ROUND(DATEDIF(旧合同到期日, 续签截止日+1, "M"), 0),与 AI 表
|
||||
# 「续签期限(月)」公式完全一致(该列是钉钉公式列,OpenAPI 读不到)。
|
||||
# AI 表「期限(月)」是**旧合同**期限(刘瑶 12),不能用——旧版取它导致
|
||||
# 「12 个月 + 2029-12-18 截止」的矛盾合同。
|
||||
months, basis = _renew_months(ai["start"], ai["end"], ai.get("expire"))
|
||||
if months is None:
|
||||
return "异常", (f"续签期限(月)无法计算:{basis}"
|
||||
f"(续签期 {ai['start']}~{ai['end']},旧合同到期日 {ai.get('expire') or '未填'}),"
|
||||
f"不发起续签,请人资核对日期")
|
||||
months_old = _deadline_code(ai["months_raw"])
|
||||
if months_old and months_old != str(months):
|
||||
logger.info("【%s】AI表「期限(月)」为旧合同期限 %s,本次续签按公式算得 %s 个月"
|
||||
"(%s)", code, ai["months_raw"], months, basis)
|
||||
months = str(months)
|
||||
|
||||
# 2) 生效中合同定位 contract_id
|
||||
act = query_active_contract(session, code)
|
||||
@@ -603,7 +675,7 @@ def renew_contract(session, ai, dry_run):
|
||||
diffs.append(f"截止日期 待生效={w_end or '?'} AI表={ai['end']}")
|
||||
w_months = _deadline_code(latest_w.get("hr_staff_contract.contract_deadline"))
|
||||
if w_months != months:
|
||||
diffs.append(f"期限(月) 待生效={w_months or '?'} AI表={months}")
|
||||
diffs.append(f"期限(月) 待生效={w_months or '?'} 按日期应为={months}")
|
||||
w_treaty = _s(latest_w.get("hr_staff_contract.treaty_type"))
|
||||
if w_treaty != treaty:
|
||||
diffs.append(f"续签类型 待生效={w_treaty or '?'} AI表={ai['rtype']}({treaty})")
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"schema_version": 1,
|
||||
"id": "xq0034",
|
||||
"name": "续签电子签",
|
||||
"version": "1.0.29",
|
||||
"description": "XQ0034 续签电子签(全流程/仅推送/仅核验):钉钉AI表格【续签名单到期跟进-月更新】驱动——否续签回填人资是否推送=否;是续签先补全电话/期望日期并与花名册校验(写联系方式前调 HR 同款 ajaxValidate 号码唯一校验,重复则中断该人、异常写AI表「异常描述」并推钉钉;未重复且不一致才自动修正联系方式),核对到期日后在HR生效中合同属性页「续签合同」推送电子签并回填;核验最新合同is_initiate_sign=2才回填完成签署=是;推送阶段按「用工类型是否调整」同步花名册用工类型(不一致才改);执行前校验字段不符不处理并推钉钉",
|
||||
"version": "1.0.30",
|
||||
"description": "XQ0034 续签电子签(全流程/仅推送/仅核验):钉钉AI表格【续签名单到期跟进-月更新】驱动——否续签回填人资是否推送=否;是续签先补全电话/期望日期并与花名册校验(写联系方式前调 HR 同款 ajaxValidate 号码唯一校验,重复则中断该人、异常写AI表「异常描述」并推钉钉;未重复且不一致才自动修正联系方式),核对到期日后在HR生效中合同属性页「续签合同」推送电子签并回填;合同期限(月)按AI表同款公式复算(ROUND(DATEDIF(旧合同到期日, 续签截止日+1, M), 0);AI表「期限(月)」是旧合同期限、界面「续签期限(月)」是接口读不到的公式列,HR 台账期限也是页面计算字段;算不出或≤0则异常不发起);核验最新合同is_initiate_sign=2才回填完成签署=是;推送阶段按「用工类型是否调整」同步花名册用工类型(不一致才改);执行前校验字段不符不处理并推钉钉",
|
||||
"category": "人事考勤",
|
||||
"icon": "",
|
||||
"platform": "hr",
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
判定,台账Tab,工号,姓名,合同开始,合同截止,台账期限(月),按日期应为(月),AI表旧合同期限,AI表续签期,AI表是否续签,AI表人资推送,推送时间,签署状态,签订方式,contract_id,AI表record
|
||||
A-取了旧合同期限(15),应为12,待生效,37000158,龙云容,2026-12-14,2027-12-13,15,12,15.00,2026-12-14~2027-12-13,是,是,2026-11-09,1,3,dfef127e-d9ab-11f1-a7d9-000c296f9469,MYruLssPBw
|
||||
A-取了旧合同期限(7),应为36,待生效,37000164,郑斌,2026-12-25,2029-12-24,7,36,7.00,2026-12-25~2029-12-24,是,是,2026-11-08,1,3,1e58695e-d9ac-11f1-a7d9-000c296f9469,vVNo9GrCDa
|
||||
A-取了旧合同期限(14),应为12,待生效,37001227,李世坤,2026-12-11,2027-12-10,14,12,14.00,2026-12-11~2027-12-10,是,是,2026-11-10,1,3,0b99851f-da4b-11f1-a7d9-000c296f9469,n0RZYiqREO
|
||||
A-取了旧合同期限(14),应为12,待生效,37002142,龚小利,2026-12-11,2027-12-10,14,12,14.00,2026-12-11~2027-12-10,是,是,2026-11-10,1,3,08d13f25-da4b-11f1-a7d9-000c296f9469,jo6PGnOv1X
|
||||
A-取了旧合同期限(4),应为12,待生效,37009199,李春容,2026-12-31,2027-12-30,4,12,4.00,2026-12-31~2027-12-30,是,是,2026-11-10,1,2,37c27238-dc07-11f1-a7d9-000c296f9469,abDHCK1GCm
|
||||
A-取了旧合同期限(12),应为36,待生效,37014980,刘瑶,2026-12-19,2029-12-18,12,36,12.00,2026-12-19~2029-12-18,是,是,2026-11-09,1,2,340203e2-db70-11f1-a7d9-000c296f9469,445fONDUKK
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37023979,程思兰,2026-12-11,2027-08-03,12,非整月,12.00,2026-12-11~2027-08-03,是,是,2026-11-10,1,2,2a52a8f2-dc07-11f1-a7d9-000c296f9469,OKTuhtF14q
|
||||
A-取了旧合同期限(1),应为12,待生效,37026029,黄廷花,2026-11-24,2027-11-23,1,12,1.00,2026-11-24~2027-11-23,是,是,2026-11-04,1,2,985d9d2f-d819-11f1-a7d9-000c296f9469,xgSXNkaAbg
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37037826,梁文霞,2026-11-06,2027-07-24,8,非整月,,,,,2026-11-09,1,1,967779ce-dc3f-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37000253,江英,2026-08-01,2027-05-08,9,非整月,,,,,2026-08-21,2,1,f583d943-9d43-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37000299,刘汉容,2026-11-16,2028-01-08,13,非整月,12.00,2026-11-16~2028-01-08,是,是,2026-10-13,2,2,d0df2e55-c618-11f1-a7d9-000c296f9469,ixUd14n2SR
|
||||
A-取了旧合同期限(14),应为12,待生效,37000320,陈友群,2026-12-04,2027-12-03,14,12,14.00,2026-12-04~2027-12-03,是,是,2026-11-05,2,3,becf5750-d9ab-11f1-a7d9-000c296f9469,CLPfsZ0mkX
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37000549,彭海全,2026-09-01,2029-07-17,35,非整月,,,,,2026-09-14,2,3,dd430510-b1b1-11f1-a7d9-000c296f9469,
|
||||
A-取了旧合同期限(14),应为12,待生效,37000793,张琼,2026-12-22,2027-12-21,14,12,14.00,2026-12-22~2027-12-21,是,是,2026-11-20,,3,f537f587-da4a-11f1-a7d9-000c296f9469,WCX4TBtBmJ
|
||||
A-取了旧合同期限(11),应为12,待生效,37000834,朱进珏,2026-12-28,2027-12-27,11,12,11.00,2026-12-28~2027-12-27,是,是,2026-11-27,,2,711dddf3-d819-11f1-a7d9-000c296f9469,Rx4uovh0oY
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37001003,黄治琼,2026-12-01,2027-11-28,12,非整月,12.00,2026-12-01~2027-11-28,是,是,2026-10-08,2,2,d673abd5-c2ee-11f1-a7d9-000c296f9469,IAegilcxNj
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37001046,李进华,2026-08-01,2027-08-12,13,非整月,,,,,2026-08-21,2,1,bca7bb7c-9d41-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37001101,付英英,2026-10-28,2027-01-14,2,非整月,,,,,2026-10-31,2,3,ccc9dead-d8f7-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37001163,李德琼,2026-11-06,2026-12-01,1,非整月,12.00,2026-11-06~2026-12-01,是,是,2026-10-06,2,2,136e7a46-c133-11f1-a7d9-000c296f9469,hGgmpkQFqA
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37001231,李章英,2026-12-13,2027-08-29,14,非整月,14.00,2026-12-13~2027-08-29,是,是,2026-11-15,,3,0e6a1b84-da4b-11f1-a7d9-000c296f9469,n8JHjJ4NAL
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37001484,李元连,2026-08-08,2027-02-08,6,非整月,,,,,2026-08-21,2,3,4f7c85f8-9e97-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37001665,罗洪素,2026-09-01,2027-12-05,16,非整月,,,,,2026-09-14,2,3,1824c34c-b0a8-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37001666,张秀华,2026-09-01,2027-10-10,14,非整月,,,,,2026-09-16,2,3,6cf905c7-b1d7-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37001987,余洪梅,2026-08-01,2027-06-19,12,非整月,,,,,2026-08-20,2,3,1a502b98-9d4a-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37002088,陈国秀,2026-08-01,2027-01-01,5,非整月,,,,,2026-08-21,2,1,20263265-9d41-11f1-a7d9-000c296f9469,
|
||||
A-取了旧合同期限(4),应为12,待生效,37002135,周光芬,2026-12-22,2027-12-21,4,12,4.00,2026-12-22~2027-12-21,是,是,2026-11-09,2,2,399aefa1-db70-11f1-a7d9-000c296f9469,90Bsx9Z2gi
|
||||
A-取了旧合同期限(13),应为12,待生效,37002206,游淼,2026-11-28,2027-11-27,13,12,13.00,2026-11-28~2027-11-27,是,是,2026-11-07,2,3,fd7b70ae-da4a-11f1-a7d9-000c296f9469,bBsGCP33Q5
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37002208,韦敏英,2026-11-28,2027-03-21,4,非整月,12.00,2026-11-28~2027-03-21,是,是,2026-10-15,2,2,20e2a262-c2f2-11f1-a7d9-000c296f9469,y3tJmIxSSE
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37002276,黄桃花,2026-10-23,2027-03-19,4,非整月,,,,,2026-10-23,2,3,bf584470-cf91-11f1-a7d9-000c296f9469,
|
||||
A-取了旧合同期限(3),应为12,待生效,37007876,张纪芳,2026-12-29,2027-12-28,3,12,3.00,2026-12-29~2027-12-28,是,是,2026-11-28,,2,818b0ef7-d819-11f1-a7d9-000c296f9469,dNsjQcAwVO
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37008061,王女兵,2027-01-01,2027-09-16,12,非整月,12.00,2027-01-01~2027-09-16,是,是,2026-11-07,2,2,09de2847-daa7-11f1-a7d9-000c296f9469,80u1j1JEUa
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37008913,谭善英,2026-12-09,2027-09-07,9,非整月,,,,,2026-09-02,2,2,d71fb2d5-b704-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37008913,谭善英,2026-09-08,2026-12-08,3,非整月,12.00,2026-09-08~2026-12-08,是,是,2026-09-02,2,2,827618a4-a6bd-11f1-a7d9-000c296f9469,ymGmNLOIXy
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37010091,马敬芳,2026-12-22,2027-03-24,12,非整月,12.00,2026-12-22~2027-03-24,是,是,2026-11-11,,2,d22c7dc7-da4a-11f1-a7d9-000c296f9469,2csn5hfPvJ
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37014530,张彩丽,2026-11-01,2027-02-04,3,非整月,12.00,2026-11-01~2027-02-04,是,是,2026-09-06,8,2,a5583d11-a9b8-11f1-a7d9-000c296f9469,xBjDUH2ArD
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37018725,罗继梅,2026-08-01,2027-02-21,6,非整月,,,,,2026-08-20,2,3,df20c9c9-9fa1-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37019904,景会莉,2026-10-18,2027-05-26,7,非整月,12.00,2026-10-18~2027-05-26,是,是,2026-09-23,2,2,24305be9-b276-11f1-a7d9-000c296f9469,OKfJ6iBBp3
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37020579,黄春玲,2026-11-06,2027-02-06,3,非整月,12.00,2026-11-06~2027-02-06,是,是,2026-10-06,2,2,0910a087-c134-11f1-a7d9-000c296f9469,6VW5iKzhRY
|
||||
A-取了旧合同期限(14),应为12,待生效,37020591,钟炎芳,2026-12-08,2027-12-07,14,12,14.00,2026-12-08~2027-12-07,是,是,2026-11-05,2,3,aaea7e98-d9ab-11f1-a7d9-000c296f9469,8GOgEXznyF
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37020663,刘小琴,2026-12-14,2027-12-04,12,非整月,12.00,2026-12-14~2027-12-04,是,是,2026-11-12,,2,13b814e9-d9ac-11f1-a7d9-000c296f9469,quONCKov8H
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37023062,高金伪,2026-08-01,2027-02-17,7,非整月,,,,,2026-08-20,2,3,8913abeb-9e02-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37023694,冉小琴,2026-12-26,2027-02-10,2,非整月,12.00,2026-12-26~2027-02-10,是,是,2026-11-04,2,2,f71c2774-d803-11f1-a7d9-000c296f9469,FRRvcd615V
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37025323,李富辉,2026-09-01,2028-07-09,23,非整月,,,,,2026-09-14,2,3,fbe7ff95-b09c-11f1-a7d9-000c296f9469,
|
||||
A-取了旧合同期限(8),应为12,生效中,37025785,王焕秀,2026-11-10,2027-11-09,8,12,8.00,2026-11-10~2027-11-09,是,是,,3,3,2e9d8154-cde9-11f1-a7d9-000c296f9469,rngDxht8vT
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37026029,黄廷花,2026-10-19,2026-11-23,1,非整月,12.00,2026-10-19~2026-11-23,是,是,2026-09-21,2,2,ff80f5b8-b565-11f1-a7d9-000c296f9469,4lAnfEzYa5
|
||||
A-取了旧合同期限(14),应为12,待生效,37026802,罗海燕,2026-12-08,2027-12-07,14,12,14.00,2026-12-08~2027-12-07,是,是,2026-11-05,2,3,0ed79790-d9ac-11f1-a7d9-000c296f9469,nbqyOzYxE3
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37028629,左艳萍,2026-10-19,2028-09-09,23,非整月,,,,,2026-10-21,2,3,676ba3d3-ceaf-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37031379,高小青,2026-10-07,2027-03-24,5,非整月,,,,,2026-10-11,2,3,f9a44362-c7aa-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37031432,吴双连,2026-10-14,2027-10-06,12,非整月,12.00,2026-10-14~2027-10-06,是,是,2026-09-23,2,2,7bff261e-af62-11f1-a7d9-000c296f9469,uZ89uvMVU2
|
||||
C-日期非整月(无法判定期限,需核对日期),待生效,37031890,胡花娥,2026-11-11,2027-07-22,8,非整月,12.00,2026-11-11~2027-07-22,是,是,2026-10-09,2,2,9d6e6b2e-c393-11f1-a7d9-000c296f9469,fOkf9qlUqy
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37031983,蔡小琼,2026-09-01,2027-06-16,10,非整月,,,,,2026-09-17,2,3,ba863262-b278-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37033117,沈开华,2026-08-01,2027-03-03,8,非整月,,,,,2026-08-20,2,3,ff44b672-9edd-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37036162,杨柳靖,2026-09-23,2027-09-09,12,非整月,,,,,2026-09-24,2,1,d2b75f7a-b7db-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37036829,王凤琼,2026-08-22,2027-03-18,6,非整月,,,,,2026-08-26,2,1,d114dec5-a0eb-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37036966,文兰英,2026-09-30,2026-12-30,3,非整月,,,,,2026-10-01,2,1,67782420-bd36-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37037143,曾菊香,2026-10-01,2027-10-02,12,非整月,,,,,2026-10-18,2,3,59b2e7f2-cac3-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37037218,蒋群华,2026-10-01,2027-09-25,12,非整月,,,,,2026-10-18,2,3,4740a851-cac3-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37037292,王艳琼,2026-09-13,2027-07-20,10,非整月,,,,,2026-09-18,2,1,8c68fb9b-b300-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37037548,岳良全,2026-09-22,2027-01-01,3,非整月,,,,,2026-09-30,2,1,ccd07901-bc72-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37038002,梁红丽,2026-10-21,2027-08-09,10,非整月,,,,,2026-11-03,2,1,3aa58a46-d05b-11f1-a7d9-000c296f9469,
|
||||
C-日期非整月(无法判定期限,需核对日期),生效中,37038242,杨春兰,2026-11-01,2027-04-08,6,非整月,,,,,2026-11-05,2,1,a2825080-d8fb-11f1-a7d9-000c296f9469,
|
||||
B-期限≠日期跨度,应为18,生效中,37000147,李克其,2025-09-01,2027-02-28,36,18,,,,,,,3,0320607d-9e77-11f0-a0a5-000c296f9469,
|
||||
B-期限≠日期跨度,应为35,生效中,37000214,牟成雄,2025-06-01,2028-04-30,36,35,,,,,,,3,40a1b616-5576-11f0-a0a5-000c296f9469,
|
||||
B-期限≠日期跨度,应为37,生效中,37000239,李林,2025-06-01,2028-06-30,36,37,,,,,,,3,eab7b36c-5575-11f0-a0a5-000c296f9469,
|
||||
B-期限≠日期跨度,应为23,生效中,37000371,蒋敏,2026-07-01,2028-05-31,36,23,,,,,,,3,81264fd1-706b-11f1-a7d9-000c296f9469,
|
||||
B-期限≠日期跨度,应为37,生效中,37000403,李厚强,2025-06-01,2028-06-30,36,37,,,,,,,3,b7eee4d6-5583-11f0-a0a5-000c296f9469,
|
||||
B-期限≠日期跨度,应为21,生效中,37000967,董斌,2025-09-01,2027-05-31,36,21,,,,,,,3,02df86e2-9e77-11f0-a0a5-000c296f9469,
|
||||
B-期限≠日期跨度,应为21,生效中,37001410,邓礼军,2026-07-01,2028-03-31,36,21,,,,,,,3,65ea8f46-706b-11f1-a7d9-000c296f9469,
|
||||
B-期限≠日期跨度,应为8,生效中,37002192,聂春艳,2026-07-01,2027-02-28,36,8,,,,,,,3,1c82dc77-706b-11f1-a7d9-000c296f9469,
|
||||
B-期限≠日期跨度,应为36,生效中,37004218,彭永琴,2026-07-01,2029-06-30,12,36,,,,,,,3,6d971bc9-8a4d-11f1-a7d9-000c296f9469,
|
||||
B-期限≠日期跨度,应为36,生效中,37016866,蒋亭,2026-07-01,2029-06-30,12,36,,,,,,,3,6d8c7e47-8a4d-11f1-a7d9-000c296f9469,
|
||||
B-期限≠日期跨度,应为23,生效中,37020522,陈春容,2025-01-01,2026-11-30,36,23,,,,,,,3,2485f76d-e851-11ef-a0a5-000c296f9469,
|
||||
B-期限≠日期跨度,应为34,生效中,37026251,田燕,2025-01-01,2027-10-31,36,34,,,,,,,3,23b4a46c-e851-11ef-a0a5-000c296f9469,
|
||||
B-期限≠日期跨度,应为7,待生效,37029050,龚小侠,2025-10-18,2026-05-17,12,7,,,,,,,2,487b551c-394c-11f0-a0a5-000c296f9469,
|
||||
|
Reference in New Issue
Block a user