Parcourir la source

信息院版本

刘凡 il y a 2 ans
Parent
commit
6ac49c2e4e
36 fichiers modifiés avec 53 ajouts et 59 suppressions
  1. 1 1
      TestLaboratory/settings.py
  2. 50 56
      apps/software/views/report.py
  3. 0 0
      lims-frontend/dist/index.html
  4. 0 0
      lims-frontend/dist/js/app.479ab668.js
  5. 0 0
      lims-frontend/dist/js/chunk-0281b3aa.4cbe82fe.js
  6. 0 0
      lims-frontend/dist/js/chunk-10d2afba.4947abbe.js
  7. 0 0
      lims-frontend/dist/js/chunk-10d2afba.7c41cba7.js
  8. 0 0
      lims-frontend/dist/js/chunk-140ff0e2.05dba521.js
  9. 0 0
      lims-frontend/dist/js/chunk-140ff0e2.9e1f5dd5.js
  10. 0 0
      lims-frontend/dist/js/chunk-16c48c2e.5dcc00be.js
  11. 0 0
      lims-frontend/dist/js/chunk-241ed1ca.62b87cf9.js
  12. 0 0
      lims-frontend/dist/js/chunk-241ed1ca.8103bcd5.js
  13. 0 0
      lims-frontend/dist/js/chunk-28e0a0ac.3420e88c.js
  14. 0 0
      lims-frontend/dist/js/chunk-28e0a0ac.690fb85f.js
  15. 0 0
      lims-frontend/dist/js/chunk-2c8f5038.513dbbc6.js
  16. 0 0
      lims-frontend/dist/js/chunk-2c8f5038.c04eb362.js
  17. 0 0
      lims-frontend/dist/js/chunk-32c93460.7947519a.js
  18. 0 0
      lims-frontend/dist/js/chunk-3b2a3e5a.64d6686e.js
  19. 0 0
      lims-frontend/dist/js/chunk-3b2a3e5a.b0f060aa.js
  20. 0 0
      lims-frontend/dist/js/chunk-3fa938b0.1debc69f.js
  21. 0 0
      lims-frontend/dist/js/chunk-3fa938b0.ec19c96f.js
  22. 0 0
      lims-frontend/dist/js/chunk-48594924.2f8c9f8d.js
  23. 0 0
      lims-frontend/dist/js/chunk-48594924.f0b9284b.js
  24. 0 0
      lims-frontend/dist/js/chunk-61ad3c7e.211bd7a7.js
  25. 0 0
      lims-frontend/dist/js/chunk-61ad3c7e.6cf841b5.js
  26. 0 0
      lims-frontend/dist/js/chunk-6d88c632.220e4aa6.js
  27. 0 0
      lims-frontend/dist/js/chunk-6d88c632.970e4c1a.js
  28. 0 0
      lims-frontend/dist/js/chunk-6fb66e82.04521d53.js
  29. 0 0
      lims-frontend/dist/js/chunk-6fb66e82.45a03f3b.js
  30. 0 0
      lims-frontend/dist/js/chunk-7f50406f.b2e4147b.js
  31. 0 0
      lims-frontend/dist/js/chunk-7f50406f.ef617aba.js
  32. 0 0
      lims-frontend/dist/js/chunk-fd7a9eb6.156d0b8e.js
  33. 0 0
      lims-frontend/dist/js/chunk-fd7a9eb6.d23288bb.js
  34. 0 0
      lims-frontend/dist/js/chunk-vendors.664a9e6c.js
  35. BIN
      lims-frontend/dist/logo.png
  36. 2 2
      mysql-init/TestLaboratory.sql

+ 1 - 1
TestLaboratory/settings.py

@@ -30,7 +30,7 @@ CASE_TEMPLATE_ROOT = 'static/case-template/测试用例模版.xlsx'
 CASE_FILE_ROOT = 'static/case-file/'
 CASE_FILE_EXPORT = 'static/case-file-export/'
 USER_FILE_ROOT = 'static/user-file-export/'
-HTTP_HEAD = 'http://47.110.247.58:8003/'
+HTTP_HEAD = 'http://172.26.0.14:8003/'
 
 
 # Quick-start development settings - unsuitable for production

+ 50 - 56
apps/software/views/report.py

@@ -39,62 +39,56 @@ class Report(APIView):
             return HttpResponse(status=404, content='软件已删除或不存在')
         software = software[0]
 
-        beidou_cases = BeidouCase.objects.order_by('-create_time')
-
-        beidou_cases = beidou_cases.filter(software_id=software_id)
-
-        version = request.GET.get('version')
-        if version:
-            beidou_cases = beidou_cases.filter(version=version)
-
-        export_type = request.GET.get('export_type')
-
-        file_name = software.name + '-全部测试用例.xls'
-        if export_type:
-            if export_type == '2':
-                file_name = software.name + '-不合格测试用例.xls'
-                beidou_cases = beidou_cases.filter(state=2)
-
-        if not beidou_cases:
-            logger.error("无符合要求的测试用例")
-            return HttpResponse(status=404, content='无符合要求的测试用例')
-
-        update_time = datetime.datetime.now()
-        file_dir = SOFTWARE_ROOT + "/" + str(update_time)
-        if not os.path.exists(file_dir):
-            os.makedirs(file_dir)
-        file_path = file_dir + "/" + file_name
-
-        cases_info = [
-            ['测试项目', '版本', '测试内容', '定位精度', '定时精度', '伪距测量精度', '载波测量精度', '测速精度',
-             '捕获灵敏度', '接收灵敏度', '跟踪灵敏度', '功率范围', '自主完好性', '系统完好性', '首次捕获时间',
-             '失锁重捕时间', '定位测速更新率', '跟踪通道数', '最大速度', '最大加速度', '执行结果', '测试人员', '备注']]
-
-        for case in beidou_cases:
-            power = ''
-            if case.power_range_low and case.power_range_high:
-                power = str(case.power_range_low) + '-' + str(case.power_range_high)
-            state = '成功'
-            if case.state == 2:
-                state = '失败'
-            executor_name = User.objects.filter(id=case.executor_id)[0].username
-
-            cases_info.append(Report.convert_to_string(
-                [software.name, case.version, case.title, case.positioning_accuracy, case.timing_accuracy,
-                 case.pseudo_range_measurement_accuracy, case.carrier_measurement_accuracy,
-                 case.speed_measurement_accuracy, case.sensitivity_capture, case.receiving_sensitivity,
-                 case.sensitivity_track, power, case.self_integrity, case.system_integrity, case.capture_time,
-                 case.recapture_time, case.update_rate, case.trace_channels, case.max_velocity, case.max_acceleration,
-                 state, executor_name, case.remark]
-            ))
-
-        sio = write_to_xlsx(file_path, cases_info)
-        sio.seek(0)
-        response = HttpResponse(sio.getvalue(), content_type='application/vnd.ms-excel')
-        # response['Content-Disposition'] = 'attachment; filename*=UTF-8''{}'.format(escape_uri_path(file_name))
-        response['Content-Disposition'] = 'attachment; filename="{0}"'.format(file_name).encode('utf-8',
-                                                                                                'ISO-8859-1')
-        response.write(sio.getvalue())
+        executor_id = request.GET.get('executor_id')
+        if not executor_id:
+            logger.error("测试人员id不能为空")
+            return HttpResponse(status=404, content="测试人员id不能为空")
+        cases_info = {}
+        cases = software.testcase_set.filter(executor_id=executor_id, delete=False)
+        executors = set()
+        if cases:
+            for case in cases:
+                state = '未执行'
+                if case.state == 1:
+                    state = '执行成功'
+                elif case.state == 2:
+                    state = '执行失败'
+                cases_info[case.id_in_task] = {
+                    'id': case.id_in_task,
+                    'version': case.version,
+                    'name': case.name,
+                    'requisite': case.requisite,
+                    'priority': case.priority,
+                    'environment': case.environment,
+                    'type': case.type,
+                    'process': case.process,
+                    'expected_result': case.expected_result,
+                    'actual_result': case.actual_result,
+                    'state': state,
+                    'writer': case.writer,
+                    'assessor': case.assessor,
+                    'executor': case.executor,
+                    'remark': case.remark,
+                    'execute_time': str(case.update_time)[:10]
+                }
+                executors.add(case.executor)
+
+        creators = []
+        plans = software.testplan_set.filter(delete=False)
+        if plans:
+            for plan in plans:
+                creators.append(plan.creator.name)
+
+        version_number = software.version_set.order_by('-create_time')[0].number
+
+        file_name = '软件测试报告.docx'
+        print(str(software.create_time).split(' ')[0])
+        document = util_doc.process_doc(software.name, software.type, version_number, str(software.create_time)
+                                        .split(' ')[0], executors, cases_info)
+
+        response = HttpResponse(content_type='application/octet-stream')
+        response['Content-Disposition'] = 'attachment; filename="{0}"'.format(file_name).encode('utf-8', 'ISO-8859-1')
+        document.save(response)
         # executor, action, method = get_log(request)
         # gen_log(action, "测试任务", task.title, method, executor)
         return response

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/index.html


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/app.479ab668.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-0281b3aa.4cbe82fe.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-10d2afba.4947abbe.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-10d2afba.7c41cba7.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-140ff0e2.05dba521.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-140ff0e2.9e1f5dd5.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-16c48c2e.5dcc00be.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-241ed1ca.62b87cf9.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-241ed1ca.8103bcd5.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-28e0a0ac.3420e88c.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-28e0a0ac.690fb85f.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-2c8f5038.513dbbc6.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-2c8f5038.c04eb362.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-32c93460.7947519a.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-3b2a3e5a.64d6686e.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-3b2a3e5a.b0f060aa.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-3fa938b0.1debc69f.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-3fa938b0.ec19c96f.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-48594924.2f8c9f8d.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-48594924.f0b9284b.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-61ad3c7e.211bd7a7.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-61ad3c7e.6cf841b5.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-6d88c632.220e4aa6.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-6d88c632.970e4c1a.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-6fb66e82.04521d53.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-6fb66e82.45a03f3b.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-7f50406f.b2e4147b.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-7f50406f.ef617aba.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-fd7a9eb6.156d0b8e.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-fd7a9eb6.d23288bb.js


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
lims-frontend/dist/js/chunk-vendors.664a9e6c.js


BIN
lims-frontend/dist/logo.png


+ 2 - 2
mysql-init/TestLaboratory.sql

@@ -524,8 +524,8 @@ INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_20', '删除测
 INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_21', '执行测试任务', '/api/v1/test-tasks/.*/case-file/execute', 'POST', '2021-07-14 10:40:58.000000', '2021-07-14 10:41:01.000000', 0);
 INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_22', '导出测试用例', '/api/v1/test-tasks/.*/case-file', 'GET', '2021-07-14 10:42:06.000000', '2021-07-14 10:42:12.000000', 0);
 INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_23', '查看用户列表', '/api/v1/users', 'GET', '2021-07-15 11:22:54.000000', '2021-07-15 11:22:57.000000', 0);
-INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_24', '上传文件', '/api/v1/file', 'POST', '2021-07-17 11:08:14.000000', '2021-07-17 11:08:18.000000', 0);
-INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_25', '删除文件', '/api/v1/file', 'DELETE', '2021-07-17 11:08:14.000000', '2021-07-17 11:08:18.000000', 0);
+INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_24', '上传文件', '/api/v1/files', 'POST', '2021-07-17 11:08:14.000000', '2021-07-17 11:08:18.000000', 0);
+INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_25', '删除文件', '/api/v1/files', 'DELETE', '2021-07-17 11:08:14.000000', '2021-07-17 11:08:18.000000', 0);
 INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_26', '查看用户', '/api/v1/users/.*', 'GET', '2021-07-17 17:18:35.000000', '2021-07-17 17:18:38.000000', 0);
 INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_27', '编辑用户信息', '/api/v1/users/.*/edit', 'POST', '2021-07-15 11:22:54.000000', '2021-07-15 11:22:57.000000', 0);
 INSERT INTO `permission` VALUES ('TestLaboratory_V1_Permission_28', '查看版本列表', '/api/v1/software/versions', 'GET', '2021-07-20 17:32:29.000000', '2021-07-20 17:32:33.000000', 0);

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff