Мастер: 9 шагов — организация (реквизиты из DEPO, логотип) и QUIK МНП общими блоками из настроек; модули видны строго по лицензии; ЕСИА Финанс — отдельный модуль; логотип Фонтвьель только у Фонтвьель; пояснения по сторонним компонентам

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FsEKyJrYF69Cj9ZXzFLRi
This commit is contained in:
zuevav
2026-09-24 23:15:01 +03:00
parent d994350590
commit cabf2e2c17
12 changed files with 430 additions and 378 deletions
+36 -4
View File
@@ -175,6 +175,7 @@ type WizardData struct {
DepoEdition string // редакция SQL Server клиента (пусто — не определена)
DepoAgent bool // у SQL Server есть SQL Agent (не Express, не PostgreSQL)
DepoJobDef string // способ обработки по умолчанию для мастера
Fancy *SetupData // шаг 3: общий блок «Обмен Fancy» (тот же, что в настройках)
ValidataVer string // версия установленной «Валидаты Клиент L» (пусто — не установлена)
CryptoSvc string // состояние службы bj-crypto (systemctl is-active)
PGSummary string // куда подключена база bj, без пароля
@@ -185,6 +186,8 @@ type WizardData struct {
Done struct {
License bool
Depo bool
Org bool // организация (код участника, ИНН) задана
Quik bool // QUIK МНП проверен (или модуль не в лицензии)
Postgres bool
Crypto bool
Certs bool
@@ -253,17 +256,37 @@ func (h *setupHandlers) renderWizard(w http.ResponseWriter, r *http.Request) {
progress := wizardProgress()
step := progress + 1
if v := r.URL.Query().Get("step"); v != "" {
if n, err := strconv.Atoi(v); err == nil && n >= 1 && n <= 7 {
if n, err := strconv.Atoi(v); err == nil && n >= 1 && n <= wizardSteps {
step = n
if n-1 > progress {
setWizardProgress(n - 1)
}
}
}
if step > 7 {
step = 7
if step > wizardSteps {
step = wizardSteps
}
d.Step = step
if step == 4 && strings.TrimSpace(s.Fancy.Server) != "" && (orgCode(s) == "" || orgINN(s) == "") && depoDetectResult() == nil {
// организация ещё не задана, а база DEPO подключена — определяем реквизиты сами: карточка
// покажет их заполненными, пользователю остаётся проверить и сохранить
ctx, cancel := context.WithTimeout(r.Context(), 15*time.Second)
if res, err := depoDetectRequisites(ctx, s.Fancy); err == nil {
lastDepoDetect.mu.Lock()
lastDepoDetect.r = res
lastDepoDetect.mu.Unlock()
d.Suggest = res
} else {
log.Printf("wizard: реквизиты из DEPO не определены: %v", err)
}
cancel()
}
if step >= 3 && step <= 5 { // DEPO, организация, QUIK МНП — общие блоки из «Настройки»
fd := h.setupData(w, r, "")
d.Fancy = &fd
}
d.Done.Org = orgCode(s) != "" && orgINN(s) != ""
d.Done.Quik = !d.DepoLicensed || s.Quik.Verified
if step == 3 && d.DepoLicensed && strings.TrimSpace(s.Fancy.Server) != "" {
// Есть ли у сервера SQL Agent: у Express его нет, у PostgreSQL — тоже; тогда обработку
// запускает сам bj. Иначе по умолчанию джобу SQL Agent создаёт bj.
@@ -304,6 +327,10 @@ func depoServerEdition(ctx context.Context, f FancyMSSQLSettings) (string, bool)
return ed, eng != 4
}
// wizardSteps — шагов в мастере: 1 лицензия, 2 база bj, 3 учёт DEPO, 4 наша организация, 5 QUIK МНП,
// 6 Валидата, 7 сертификаты, 8 шлюз НРД, 9 проверка.
const wizardSteps = 9
// wizardProgressFile — номер последнего пройденного шага мастера (переход «Далее» на шаг N
// означает, что шаги до N пройдены).
const wizardProgressFile = "/var/lib/bj/.bj/wizard-progress"
@@ -477,6 +504,11 @@ func HealthLabel(name string) string {
}
func (h *setupHandlers) renderSetup(w http.ResponseWriter, req *http.Request, flash string) {
render(w, h.tpl.a.setup, h.setupData(w, req, flash))
}
// setupData — данные страницы «Настройка»; их же получает общий блок «Обмен Fancy» в мастере.
func (h *setupHandlers) setupData(w http.ResponseWriter, req *http.Request, flash string) SetupData {
s := h.rc.Snapshot()
r := h.rc.ReadinessSummary()
ready := 0
@@ -526,7 +558,7 @@ func (h *setupHandlers) renderSetup(w http.ResponseWriter, req *http.Request, fl
if errVal := errMsgFromQuery(_q(w)); errVal != "" {
data.Error = errVal
}
render(w, h.tpl.a.setup, data)
return data
}
func (h *setupHandlers) savePostgres(w http.ResponseWriter, r *http.Request) {