Browse Source

feat:修改bug

dev
zhaobing 2 years ago
parent
commit
df0e55924b
  1. 6
      api/app/lib/controllers/operationData/index.js
  2. 2
      api/app/lib/controllers/problemData/index.js
  3. 26
      script/0.27/schema/create_equipment_maintenance_record.sql
  4. 9
      script/0.27/schema/create_equipment_maintenance_record_execute_user.sql
  5. 9
      script/0.27/schema/create_equipment_maintenance_record_project.sql
  6. 16
      script/0.27/schema/create_server_maintenance_record.sql
  7. 5
      script/0.27/schema/create_server_maintenance_record_repairman.sql
  8. 15
      script/0.28/schema/01create_sysyem_problem.sql
  9. 3
      web/client/src/sections/service/containers/maintenanceRecords.jsx

6
api/app/lib/controllers/operationData/index.js

@ -18,7 +18,7 @@ async function getFailureTime(ctx) {
from generate_series(1, 12) as t
) w on e.months = substring(to_char(w.wmonth,'yyyy-mm'),1,7)
GROUP BY w.wmonth,e.counts
ORDER BY w.wmonth desc`
ORDER BY w.wmonth asc`
)
console.log('111112232', res)
let resList = []
@ -60,7 +60,7 @@ async function getSystemAvailability(ctx) {
) w
on e.months = substring(to_char(w.wmonth,'yyyy-mm'),1,7)
GROUP BY w.wmonth,w.seconds,e.counts
ORDER BY w.wmonth DESC;`
ORDER BY w.wmonth asc`
)
let resList = []
if (res.length > 0) {
@ -111,7 +111,7 @@ async function getOperationsPersonnel(ctx) {
const { clickHouse } = ctx.app.fs
try {
//查询用户id
const res = await sequelize.query(`SELECT t.pep_user_id userId,count(1) FROM maintenance_plan_execute_user t GROUP BY pep_user_id`)
const res = await sequelize.query(`SELECT t.pep_user_id userId,count(1) FROM maintenance_record_execute_user t GROUP BY pep_user_id`)
let useList = new Set()
console.log('rss', res)
if (res.length > 0) {

2
api/app/lib/controllers/problemData/index.js

@ -121,7 +121,7 @@ async function getMaintenceTotal(ctx) {
//所有维修记录
const res = await sequelize.query(`
SELECT emrp.project_id,
count(case when record.status in ('维修中','待维修') then record.id end) incomplete,
count(case when record.status in ('维修中','待维修','维修完成') then record.id end) incomplete,
count(case when record.status in ('维修完成') then record.id end) completed
FROM equipment_maintenance_record record
RIGHT JOIN equipment_maintenance_record_project emrp

26
script/0.27/schema/create_equipment_maintenance_record.sql

@ -1,26 +0,0 @@
drop table if exists equipment_maintenance_record;
create table equipment_maintenance_record
(
id serial
primary key,
equipment_type varchar(32),
equipment_category varchar(32),
maintenance_reason varchar(1024),
solution varchar(1024),
report_time timestamp with time zone,
completed_time timestamp with time zone,
status varchar(32)
);
comment on column public.equipment_maintenance_record.equipment_type is '设备型号';
comment on column public.equipment_maintenance_record.equipment_category is '设备类型';
comment on column public.equipment_maintenance_record.maintenance_reason is '维修原因';
comment on column public.equipment_maintenance_record.solution is '解决方案';
comment on column public.equipment_maintenance_record.report_time is '上报时间';
comment on column public.equipment_maintenance_record.completed_time is '维修完成时间';
comment on column public.equipment_maintenance_record.status is '状态';

9
script/0.27/schema/create_equipment_maintenance_record_execute_user.sql

@ -1,9 +0,0 @@
create table equipment_maintenance_record_execute_user
(
id serial
primary key,
equipment_maintenance_record_id integer
constraint equipment_maintenance_record_equipment_maintenance_record_fkey1
references equipment_maintenance_record,
pep_user_id integer
);

9
script/0.27/schema/create_equipment_maintenance_record_project.sql

@ -1,9 +0,0 @@
create table equipment_maintenance_record_project
(
id serial
primary key,
equipment_maintenance_record_id integer
constraint equipment_maintenance_record__equipment_maintenance_record_fkey
references equipment_maintenance_record,
project_id integer
);

16
script/0.27/schema/create_server_maintenance_record.sql

@ -1,16 +0,0 @@
create table server_maintenance_record(
id serial primary key,
sketch varchar(512),
reason varchar(512),
remark varchar(1024),
maintenance_start_time timestamp with time zone,
maintenance_finish_time timestamp with time zone,
state varchar(32)
);
comment on column public.server_maintenance_record.sketch is '简述';
comment on column public.server_maintenance_record.reason is '维修原因';
comment on column public.server_maintenance_record.remark is '备注';
comment on column public.server_maintenance_record.maintenance_start_time is '维护开始时间';
comment on column public.server_maintenance_record.maintenance_finish_time is '维护结束时间';
comment on column public.server_maintenance_record.state is '维护结束时间';
comment on column public.server_maintenance_record.state is '完成状态 wait 待维修 / underway 维修中 / completed 维修完成 ';

5
script/0.27/schema/create_server_maintenance_record_repairman.sql

@ -1,5 +0,0 @@
create table server_maintenance_record_repairman(
id serial primary key,
server_maintenance_record_id integer references server_maintenance_record(id),
pep_user_id integer
)

15
script/0.28/schema/01create_sysyem_problem.sql

@ -1,15 +0,0 @@
create table public.system_problem(
id serial primary key,
type varchar(20)
);
comment on column public.system_problem.type is '问题类型:数据库异常、es异常、kafka异常、服务器异常、应用异常、其他';
insert into system_problem ( type)values ('es异常');
insert into system_problem (type)values ('数据库异常');
insert into system_problem (type)values ('应用异常');
insert into system_problem (type)values ('kafka异常');
insert into system_problem (type)values ('服务器异常');
insert into system_problem (type)values ('DAC进程异常');
insert into system_problem (type)values ('K8S集群异常');
insert into system_problem (type)values ('redis服务异常');
insert into system_problem (type)values ('其他');

3
web/client/src/sections/service/containers/maintenanceRecords.jsx

@ -214,7 +214,8 @@ const MaintenanceRecords = (props) => {
onClose={() => {
setAddVis(false);
setRecordRow(null);
getEquipment();
//getEquipment();
findHandler()
}}
recordRow={recordRow}
pepList={pepList}

Loading…
Cancel
Save