Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
20c90b06
Commit
20c90b06
authored
Aug 21, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
65b6587e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
32 deletions
+29
-32
UploadFileService.php
application/api_broker/service/UploadFileService.php
+1
-3
CostParameter.php
application/index/controller/CostParameter.php
+28
-28
AStore.php
application/model/AStore.php
+0
-1
No files found.
application/api_broker/service/UploadFileService.php
View file @
20c90b06
...
@@ -23,9 +23,7 @@ class UploadFileService
...
@@ -23,9 +23,7 @@ class UploadFileService
*/
*/
public
function
upload
(
$_upload_file
,
$type
,
$size
=
15000000
,
$ext
=
[
'jpg'
,
'png'
,
'jpeg'
,
'xlsx'
,
'doc'
,
'docx'
,
'pdf'
,
'ppt'
,
'pptx'
,
'xls'
,
'gif'
,
'mp4'
,
'video/mp4'
])
public
function
upload
(
$_upload_file
,
$type
,
$size
=
15000000
,
$ext
=
[
'jpg'
,
'png'
,
'jpeg'
,
'xlsx'
,
'doc'
,
'docx'
,
'pdf'
,
'ppt'
,
'pptx'
,
'xls'
,
'gif'
,
'mp4'
,
'video/mp4'
])
{
{
dump
(
$_upload_file
);
dump
(
$type
);
dump
(
$ext
);
/**
/**
*
*
* upload($_FILE['file'])
* upload($_FILE['file'])
...
...
application/index/controller/CostParameter.php
View file @
20c90b06
...
@@ -586,18 +586,14 @@ class CostParameter extends Basic
...
@@ -586,18 +586,14 @@ class CostParameter extends Basic
if
(
!
checkTimeData
(
$params
[
'setting_date'
])){
if
(
!
checkTimeData
(
$params
[
'setting_date'
])){
return
$this
->
response
(
"101"
,
'非法时间'
);
return
$this
->
response
(
"101"
,
'非法时间'
);
}
}
// $file = $_FILES['file'];
// $type = request()->param('type');
dump
(
$_FILES
);
// $uploadFileService = new UploadFileService();
$file
=
$_FILES
[
'excel_import'
];
$file
=
$_FILES
[
'excel_import'
];
$type
=
$params
[
'type'
];
//excel_import
$type
=
$params
[
'type'
];
//excel_import
$uploadFileService
=
new
UploadFileService
();
$uploadFileService
=
new
UploadFileService
();
$uploadResult
=
$uploadFileService
->
upload
(
$file
,
$type
,
15000000
,
[
'xls'
,
'xlsx'
]);
$uploadResult
=
$uploadFileService
->
upload
(
$file
,
$type
,
15000000
,
[
'xls'
,
'xlsx'
]);
if
(
$uploadResult
[
"code"
]
==
200
)
{
if
(
$uploadResult
[
"code"
]
==
200
)
{
$path
=
$_FILES
[
'excel_import'
][
'tmp_name'
];
$result
=
$this
->
saveExcelData
(
$uploadResult
[
"msg"
][
"img_path"
],
$params
[
'setting_date'
]);
$result
=
$this
->
saveExcelData
(
$path
,
$params
[
'setting_date'
]);
if
(
$result
[
"code"
]
==
200
)
{
if
(
$result
[
"code"
]
==
200
)
{
return
$this
->
response
(
"200"
,
"excel导入成功"
);
return
$this
->
response
(
"200"
,
"excel导入成功"
);
}
else
{
}
else
{
...
@@ -620,41 +616,45 @@ class CostParameter extends Basic
...
@@ -620,41 +616,45 @@ class CostParameter extends Basic
if
(
!
$list
)
if
(
!
$list
)
return
[
"code"
=>
101
,
"msg"
=>
"空excel"
];
return
[
"code"
=>
101
,
"msg"
=>
"空excel"
];
foreach
(
$list
as
$k
=>
$v
)
{
foreach
(
$list
as
$k
=>
$v
)
{
dump
(
$v
);
$is_office_store
=
$this
->
m_store
->
getStoreCost
(
"b.office_name"
,
[
"a.id"
=>
$v
[
'store_id'
]]);
$is_office_store
=
$this
->
m_store
->
getStoreCost
(
"b.office_name"
,
[
"a.id"
=>
$v
[
'store_id'
]]);
if
(
!
$is_office_store
[
"office_name"
]){
return
[
"code"
=>
101
,
"msg"
=>
"门店:
{
$v
[
"store_id"
]
}
不存在办公室,导入失败!"
];
}
}
dump
(
$is_office_store
);
exit
;
$this
->
addStoreCost
(
$list
,
$setting_date
);
return
[
"code"
=>
200
,
"msg"
=>
"成功"
];
$f_params
[
'c.store_id'
]
=
$v
[
'id'
];
}
/**
* 保存数据
* @param $list
* @param $setting_date
* @return bool
*/
public
function
addStoreCost
(
$list
,
$setting_date
){
foreach
(
$list
as
$k
=>
$v
)
{
$f_params
[
'c.store_id'
]
=
$v
[
'store_id'
];
$f_params
[
'c.setting_date'
]
=
$setting_date
;
$f_params
[
'c.setting_date'
]
=
$setting_date
;
$f_params
[
'c.is_del'
]
=
0
;
$f_params
[
'c.is_del'
]
=
0
;
$field
=
'a.id,a.store_name,b.office_name,d.name,d.phone,c.is_discounts,
$field
=
'a.id,a.store_name'
;
c.transfer_charge,c.social_security_fee,c.attendance_num,c.official_receipts,
c.last_official_receipts,c.deduct'
;
$store_data_res
=
$this
->
m_store
->
getStoreCostParameter
(
$field
,
$f_params
);
$store_data_res
=
$this
->
m_store
->
getStoreCostParameter
(
$field
,
$f_params
);
if
(
!
$store_data_res
)
{
if
(
!
$store_data_res
)
{
if
(
!
$v
[
'store_id'
])
if
(
!
$v
[
'store_id'
])
continue
;
continue
;
$transfer_charge
=
$this
->
getTransferCharge
(
$v
[
'store_id'
],
$setting_date
);
$transfer_charge
=
$this
->
getTransferCharge
(
$v
[
'store_id'
],
$setting_date
);
$list
[
$k
][
'transfer_charge'
]
=
$transfer_charge
;
//手续费
$social_security_fee
=
$this
->
getLastSocialSecurityFee
(
$v
[
'id'
],
$setting_date
);
$social_security_fee
=
$this
->
getLastSocialSecurityFee
(
$v
[
'id'
],
$setting_date
);
$list
[
$k
][
'social_security_fee'
]
=
$social_security_fee
;
//当月社保报销
$list
[
$k
][
'attendance_num'
]
=
0
;
//当月考勤
$list
[
$k
][
'official_receipts'
]
=
0
;
//当月合计总实收
$list
[
$k
][
'last_official_receipts'
]
=
0
;
//当月守护者实收
$list
[
$k
][
'deduct'
]
=
0
;
//盈利不足2万扣除
$save_params
[
'store_id'
]
=
$v
[
'id'
];
$v
[
'setting_date'
]
=
$setting_date
;
$save_params
[
'setting_date'
]
=
$setting_date
;
$v
[
'is_del'
]
=
0
;
$save_params
[
'is_del'
]
=
0
;
$v
[
'transfer_charge'
]
=
$transfer_charge
;
$save_params
[
'transfer_charge'
]
=
$transfer_charge
;
$v
[
'social_security_fee'
]
=
$social_security_fee
;
$save_params
[
'social_security_fee'
]
=
$social_security_fee
;
$this
->
saveStoreData
(
$v
);
$this
->
saveStoreData
(
$save_params
);
}
}
}
}
return
[
"code"
=>
200
,
"msg"
=>
"成功"
];
return
true
;
}
}
...
@@ -669,7 +669,7 @@ class CostParameter extends Basic
...
@@ -669,7 +669,7 @@ class CostParameter extends Basic
$reader
->
setReadDataOnly
(
true
);
$reader
->
setReadDataOnly
(
true
);
$spreadsheet
=
""
;
$spreadsheet
=
""
;
try
{
try
{
$spreadsheet
=
$reader
->
load
(
$file_path
);
$spreadsheet
=
$reader
->
load
(
"static/excel/"
.
$file_path
);
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
return
[
"code"
=>
101
,
"msg"
=>
"找不到文件路径"
];
return
[
"code"
=>
101
,
"msg"
=>
"找不到文件路径"
];
}
}
...
@@ -681,7 +681,7 @@ class CostParameter extends Basic
...
@@ -681,7 +681,7 @@ class CostParameter extends Basic
}
}
$data
=
array
();
$data
=
array
();
for
(
$row
=
0
;
$row
<=
$highestRow
;
$row
++
)
{
for
(
$row
=
0
;
$row
<=
$highestRow
;
$row
++
)
{
for
(
$row
=
1
;
$row
<=
$highestRow
;
$row
++
)
{
for
(
$row
=
3
;
$row
<=
$highestRow
;
$row
++
)
{
$tempData
[
'store_id'
]
=
$sheet
->
getCellByColumnAndRow
(
1
,
$row
)
->
getValue
();
$tempData
[
'store_id'
]
=
$sheet
->
getCellByColumnAndRow
(
1
,
$row
)
->
getValue
();
$tempData
[
'social_security_fee'
]
=
$sheet
->
getCellByColumnAndRow
(
2
,
$row
)
->
getValue
();
$tempData
[
'social_security_fee'
]
=
$sheet
->
getCellByColumnAndRow
(
2
,
$row
)
->
getValue
();
$tempData
[
'attendance_num'
]
=
$sheet
->
getCellByColumnAndRow
(
3
,
$row
)
->
getValue
();
$tempData
[
'attendance_num'
]
=
$sheet
->
getCellByColumnAndRow
(
3
,
$row
)
->
getValue
();
...
...
application/model/AStore.php
View file @
20c90b06
...
@@ -473,7 +473,6 @@ class AStore extends BaseModel
...
@@ -473,7 +473,6 @@ class AStore extends BaseModel
->
join
(
'f_office b'
,
'a.office_id = b.id'
,
'left'
)
->
join
(
'f_office b'
,
'a.office_id = b.id'
,
'left'
)
->
where
(
$params
)
->
where
(
$params
)
->
find
();
->
find
();
dump
(
$this
->
getLastSql
());
return
$result
;
return
$result
;
}
}
...
...
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