Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-collect-api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyi.chen
data-collect-api
Commits
36a7e3c2
Commit
36a7e3c2
authored
Apr 07, 2024
by
wenyi.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V1确定版本
parent
1ab962f8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
162 deletions
+25
-162
.env
+2
-2
app/api/controller/ExcelFile.php
+7
-0
app/api/controller/Norm.php
+13
-5
app/api/controller/NormCollectsaaaaaa.php
+0
-154
config/config.php
+1
-1
runtime/session/sess_aceda99728b4cad53e142c99e1252f38
+2
-0
No files found.
.env
View file @
36a7e3c2
APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai ###项目初始化配置 [init] // 项目名称 entry_name = data-collect-dev // 是否开启调试日志 log = true ###数据库配置 [database] type = mysql hostname = huisheng_mysql database = data-collect-dev username = root password = Huisheng@12345 hostport = 3306 charset = utf8 debug = true ###redis配置 [redis] hostname = huisheng_redis port = 6379 debug = true [LANG] default_lang = zh-cn
\ No newline at end of file
APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai ###项目初始化配置 [init] // 项目名称 entry_name = data-collect-dev // 是否开启调试日志 log = true ###数据库配置 [database] type = mysql hostname = huisheng_mysql database = data-collect username = root password = Huisheng@12345 hostport = 3306 charset = utf8 debug = true ###redis配置 [redis] hostname = huisheng_redis port = 6379 debug = true [LANG] default_lang = zh-cn
\ No newline at end of file
...
...
app/api/controller/ExcelFile.php
View file @
36a7e3c2
...
...
@@ -543,6 +543,7 @@ class ExcelFile extends BaseController
$val
[
'sort'
]
=
'/'
;
}
$data
=
[
'norm'
=>
$value
[
'name'
],
'name'
=>
$val
[
'name'
],
'level'
=>
$val
[
'level'
],
'refer'
=>
$val
[
'refer'
],
...
...
@@ -693,6 +694,7 @@ class ExcelFile extends BaseController
$val
[
'sort'
]
=
'/'
;
}
$data
=
[
'norm'
=>
$norm
[
'name'
],
'name'
=>
$val
[
'name'
],
'level'
=>
$val
[
'level'
],
'refer'
=>
$val
[
'refer'
],
...
...
@@ -843,6 +845,7 @@ class ExcelFile extends BaseController
$val
[
'sort'
]
=
'/'
;
}
$data
=
[
'norm'
=>
$value
[
'name'
],
'name'
=>
$val
[
'name'
],
'level'
=>
$val
[
'level'
],
'refer'
=>
$val
[
'refer'
],
...
...
@@ -931,6 +934,7 @@ class ExcelFile extends BaseController
->
setFillType
(
\PhpOffice\PhpSpreadsheet\Style\Fill
::
FILL_SOLID
)
->
getStartColor
()
->
setARGB
(
'C5D9F1'
);
// FF后面的六位数是颜色的RGB值
$title
=
[
'子任务名称'
,
'指标名称'
,
'难度等级'
,
'参考信源'
,
...
...
@@ -975,6 +979,9 @@ class ExcelFile extends BaseController
$position
=
0
;
$sheet
=
$spreadsheet
->
getActiveSheet
();
// 指标名称
$sheet
->
setCellValue
(
$column
[
$num
+
$position
]
.
$row
,
$value
[
'norm'
]);
$position
++
;
// 指标名称
$sheet
->
setCellValue
(
$column
[
$num
+
$position
]
.
$row
,
$value
[
'name'
]);
$position
++
;
// 难度等级
...
...
app/api/controller/Norm.php
View file @
36a7e3c2
...
...
@@ -246,13 +246,21 @@ class Norm
$NormListExtendBus
=
new
CommonBus
(
'NormListExtendBus'
);
// 通过公共业务初始化指标类
$data
[
'receivesList'
][
$index
][
'norm_list_extend'
]
=
$NormListExtendBus
->
getConditionalQueryAll
([
'norm_list_id'
=>
$vlues
[
'norm_list_id'
]]);
$NormCollectsBus
=
new
CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
$collectsInfo
=
$NormCollectsBus
->
getConditionalQuery
All
([
'norm_receive_id'
=>
$vlues
[
'id'
]]);
$collectsInfo
=
$NormCollectsBus
->
getConditionalQuery
([
'norm_receive_id'
=>
$vlues
[
'id'
]]);
if
(
$collectsInfo
){
$data
[
'receivesList'
][
$index
][
'receives_status'
]
=
1
;
$data
[
'receivesList'
][
$index
][
'completion_status'
]
=
1
;
$NormCollectsExtendBus
=
new
CommonBus
(
'NormCollectsExtendBus'
);
// 通过公共业务初始化指标类
$normCollectsExtend
=
$NormCollectsExtendBus
->
getConditionalQueryAll
([
'norm_collects_id'
=>
$collectsInfo
[
'id'
]]);
$data
[
'receivesList'
][
$index
][
'refer_type'
]
=
$collectsInfo
[
'refer_type'
];
$data
[
'receivesList'
][
$index
][
'remark'
]
=
$collectsInfo
[
'remark'
];
$data
[
'receivesList'
][
$index
][
'imgPath'
]
=
$collectsInfo
[
'imgPath'
];
$data
[
'receivesList'
][
$index
][
'normCollectsExtend'
]
=
$normCollectsExtend
;
}
else
{
$data
[
'receivesList'
][
$index
][
'receives_status'
]
=
1
;
$data
[
'receivesList'
][
$index
][
'completion_status'
]
=
0
;
$normExtendBus
=
new
CommonBus
(
'NormExtendBus'
);
$res
=
$normExtendBus
->
getConditionalQueryAll
([
'norm_id'
=>
$id
,
'user_filled'
=>
1
]);
$data
[
'receivesList'
][
$index
][
'refer_type'
]
=
''
;
$data
[
'receivesList'
][
$index
][
'remark'
]
=
''
;
$data
[
'receivesList'
][
$index
][
'imgPath'
]
=
''
;
$data
[
'receivesList'
][
$index
][
'normCollectsExtend'
]
=
$res
;
}
}
}
...
...
app/api/controller/NormCollectsaaaaaa.php
deleted
100644 → 0
View file @
1ab962f8
<?php
/**
* 用户填写指标详情
* User: raisound
*/
namespace
app\api\controller
;
use
app\common\business\CommonBus
as
CommonBus
;
use
app\common\model\redis\RedisModel
;
use
think\facade\Db
;
class
NormCollectsaaaaaa
extends
AuthBase
{
/**
* 指标领取
*
* @param \think\Request $request
* @return \think\Response
*/
public
function
add
()
{
try
{
$queryArr
=
json_decode
(
file_get_contents
(
'php://input'
),
true
);
$data
=
array
();
$data
[
'norm_list_id'
]
=
trim
(
$queryArr
[
'addItem'
][
'norm_list_id'
]);
$data
[
'task_id'
]
=
trim
(
$queryArr
[
'addItem'
][
'task_id'
]);
$data
[
'norm_id'
]
=
trim
(
$queryArr
[
'addItem'
][
'norm_id'
]);
$data
[
'norm_receive_id'
]
=
trim
(
$queryArr
[
'addItem'
][
'norm_receive_id'
]);
$data
[
'refer_type'
]
=
trim
(
$queryArr
[
'addItem'
][
'refer_type'
]);
$data
[
'remark'
]
=
trim
(
$queryArr
[
'addItem'
][
'remark'
]);
$data
[
'imgPath'
]
=
$queryArr
[
'editorImgList'
];
$data
[
'editorContent'
]
=
$queryArr
[
'editorContent'
];
$data
[
'user_id'
]
=
$this
->
userId
;
if
(
empty
(
$data
[
'norm_list_id'
])
||
empty
(
$data
[
'task_id'
])
||
empty
(
$data
[
'norm_id'
])
||
empty
(
$data
[
'norm_receive_id'
])
||
empty
(
$data
[
'user_id'
])){
errorRecord
(
'NormCollects.add'
,
json_encode
(
$data
),
true
);
return
returnResult
(
config
(
"config.code.error"
),
'无法获取相关信息!'
,
''
);
}
$NormCollectsBus
=
new
\app\api\business\NormReceivesBus
;
// 通过公共业务初始化指标类
$res
=
$NormCollectsBus
->
getConditionalQuery
([
'id'
=>
$data
[
'norm_receive_id'
]]);
if
(
$res
[
'status'
]
==
3
||
$res
[
'status'
]
==
4
){
errorRecord
(
'NormCollects.add'
,
$res
[
'status'
],
true
);
return
returnResult
(
config
(
"config.code.error"
),
'管理员已审核无法修改!'
,
''
);
}
// 开启数据库事务
Db
::
startTrans
();
$index
=
1
;
// 查询是否已经填写了
$arr
=
[
'norm_list_id'
=>
$data
[
'norm_list_id'
],
'task_id'
=>
$data
[
'task_id'
],
'norm_id'
=>
$data
[
'norm_id'
],
'user_id'
=>
$data
[
'user_id'
]
];
if
(
$data
[
'imgPath'
]){
$data
[
'imgPath'
]
=
implode
(
','
,
$data
[
'imgPath'
]);
}
else
{
$data
[
'imgPath'
]
=
''
;
}
$NormCollectsBus
=
new
\app\api\business\CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
$res
=
$NormCollectsBus
->
getConditionalQuery
(
$arr
);
if
(
empty
(
$res
)){
$add
=
$NormCollectsBus
->
addData
(
$data
);
if
(
empty
(
$add
)){
$index
++
;
}
}
else
{
$where
=
[
'norm_list_id'
=>
$data
[
'norm_list_id'
],
'task_id'
=>
$data
[
'task_id'
],
'norm_id'
=>
$data
[
'norm_id'
],
'user_id'
=>
$data
[
'user_id'
],
];
$updateData
=
[
'refer_type'
=>
$data
[
'refer_type'
],
'remark'
=>
$data
[
'remark'
],
'imgPath'
=>
$data
[
'imgPath'
],
'editorContent'
=>
$data
[
'editorContent'
],
];
$update
=
$NormCollectsBus
->
updateData
(
$updateData
,
$where
);
if
(
empty
(
$update
)){
$index
++
;
}
}
// 用户填写区域
$userFilled
=
$queryArr
[
'userFilled'
];
$NormExtendBus
=
new
\app\api\business\CommonBus
(
'NormExtendBus'
);
// 通过公共业务初始化指标类
foreach
(
$userFilled
as
$value
){
$update
=
$NormExtendBus
->
updateData
([
'id'
=>
$value
[
'id'
],
'extend_value'
=>
$value
[
'value'
]]);
if
(
empty
(
$update
)){
$index
++
;
}
}
$NormReceivesBus
=
new
\app\api\business\NormReceivesBus
;
$res
=
$NormReceivesBus
->
updateData
([
'id'
=>
$data
[
'norm_receive_id'
],
'status'
=>
1
]);
if
(
empty
(
$res
)){
$index
++
;
}
if
(
$index
==
1
){
Db
::
commit
();
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$res
);
}
else
{
Db
::
rollback
();
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.null_data"
),[]);
}
}
catch
(
\Exception
$e
){
exception
(
$e
,
'NormCollects.add'
);
}
}
/**
* 数据保存
* @return void
*/
public
function
preserve
()
{
try
{
$data
=
[];
$data
[
'norm_receive_id'
]
=
input
(
"param.norm_receive_id"
,
''
,
"trim"
);
$data
[
'content'
]
=
input
(
"param.content"
,
''
,
"trim"
);
$data
[
'editor'
]
=
input
(
"param.editor"
);
$PreserveBus
=
new
\app\api\business\CommonBus
(
'PreserveBus'
);
// 通过公共业务初始化指标类
$info
=
$PreserveBus
->
getConditionalQuery
([
'norm_receive_id'
=>
$data
[
'norm_receive_id'
]]);
if
(
empty
(
$info
)){
$res
=
$PreserveBus
->
addData
(
$data
);
}
else
{
$res
=
$PreserveBus
->
updateData
([
'content'
=>
$data
[
'content'
],
'editor'
=>
$data
[
'editor'
]],[
'norm_receive_id'
=>
$data
[
'norm_receive_id'
]]);
}
if
(
$res
){
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$res
);
}
else
{
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.null_data"
),[]);
}
}
catch
(
\Exception
$e
){
exception
(
$e
,
'NormCollects.preserve'
);
}
}
/**
* 数据保存
* @return void
*/
public
function
getPreserve
()
{
try
{
$id
=
input
(
"param.id"
,
''
,
"trim"
);
$PreserveBus
=
new
\app\api\business\CommonBus
(
'PreserveBus'
);
// 通过公共业务初始化指标类
$info
=
$PreserveBus
->
getConditionalQuery
([
'norm_receive_id'
=>
$id
]);
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$info
);
}
catch
(
\Exception
$e
){
exception
(
$e
,
'NormCollects.getPreserve'
);
}
}
}
\ No newline at end of file
config/config.php
View file @
36a7e3c2
...
...
@@ -70,5 +70,5 @@ return [
],
// "resource_address"=>'https://data-collect.raisound.com/data-collect-api/',
// "resource_address"=>'http://192.168.10.168/data-collect-api/'
"resource_address"
=>
'http://gcspider.raisound.com:81/data-collect-api
-dev
/'
"resource_address"
=>
'http://gcspider.raisound.com:81/data-collect-api/'
];
runtime/session/sess_aceda99728b4cad53e142c99e1252f38
0 → 100644
View file @
36a7e3c2
a:1:{s:5:"users";a:10:{s:2:"id";i:3;s:4:"name";s:10:"管理员1";s:5:"phone";s:11:"18417180202";s:7:"account";s:8:"admin001";s:8:"password";s:32:"e10adc3949ba59abbe56e057f20f883e";s:6:"status";i:1;s:4:"type";i:1;s:11:"create_time";s:10:"1709196711";s:5:"email";s:0:"";s:13:"department_id";i:1;}}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment