feat: expand vehicle data platform capabilities

This commit is contained in:
lingniu
2026-07-27 16:46:15 +08:00
parent e3a1f80f86
commit 3c4bece72c
650 changed files with 62155 additions and 2552 deletions

View File

@@ -24,6 +24,35 @@ const candidateQuery = `SELECT
COALESCE(co.other_customer_id, co.customer_id),
COALESCE(co.contract_code, r.contract_code, ''),
COALESCE(co.project_name, r.project_name, ''),
COALESCE(ci.customer_name, r.customer_name, ''),
COALESCE(CAST(
CASE WHEN co.other_customer_id IS NOT NULL
THEN co.other_business_department_id
ELSE co.business_department_id
END AS CHAR
), ''),
COALESCE(
CASE WHEN co.other_customer_id IS NOT NULL
THEN co.other_business_department_name
ELSE co.business_department_name
END,
r.business_dept,
''
),
COALESCE(CAST(
CASE WHEN co.other_customer_id IS NOT NULL
THEN co.other_business_manager_id
ELSE co.business_manager_id
END AS CHAR
), ''),
COALESCE(
CASE WHEN co.other_customer_id IS NOT NULL
THEN co.other_business_manager_name
ELSE co.business_manager_name
END,
r.business_manager,
''
),
COALESCE(vs.operation_status, ''),
dv.delivery_time,
dv.update_time
@@ -89,12 +118,14 @@ func ReadCandidates(ctx context.Context, db *sql.DB) ([]Candidate, error) {
for rows.Next() {
var vehicleID, vehicleProfileID, customerID, customerProfileID sql.NullInt64
var contractID, contractProfileID, effectiveCustomerID sql.NullInt64
var vin, plate, contractCode, projectName, operationStatus string
var vin, plate, contractCode, projectName, customerName string
var departmentID, departmentName, responsibleUserID, responsibleUserName, operationStatus string
var scopeStart time.Time
var updatedAt sql.NullTime
if err := rows.Scan(
&vehicleID, &vehicleProfileID, &vin, &plate, &customerID, &customerProfileID,
&contractID, &contractProfileID, &effectiveCustomerID, &contractCode, &projectName,
&customerName, &departmentID, &departmentName, &responsibleUserID, &responsibleUserName,
&operationStatus, &scopeStart, &updatedAt,
); err != nil {
return nil, fmt.Errorf("scan OneOS scope candidate: %w", err)
@@ -108,8 +139,11 @@ func ReadCandidates(ctx context.Context, db *sql.DB) ([]Candidate, error) {
ContractID: contractID.Int64, ContractPresent: contractID.Valid,
ContractProfileExists: contractProfileID.Valid,
EffectiveCustomerID: effectiveCustomerID.Int64, EffectiveCustomerSet: effectiveCustomerID.Valid,
ContractCode: contractCode, ProjectName: projectName, OperationStatus: operationStatus,
ScopeStartAt: scopeStart,
CustomerName: customerName, ContractCode: contractCode, ProjectName: projectName,
DepartmentID: departmentID, DepartmentName: departmentName,
ResponsibleUserID: responsibleUserID, ResponsibleUserName: responsibleUserName,
OperationStatus: operationStatus,
ScopeStartAt: scopeStart,
}
if updatedAt.Valid {
value := updatedAt.Time