Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
Jz-Php
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
PHP
Jz-Php
Commits
b3ce09a0
提交
b3ce09a0
authored
5月 09, 2020
作者:
chengye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
payment to oa api
上级
86f770ac
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
357 行增加
和
92 行删除
+357
-92
common.php
application/em/common.php
+0
-6
Payment.php
application/em/controller/Payment.php
+148
-56
EmPaymentFk.php
application/em/model/EmPaymentFk.php
+7
-0
detail.html
application/em/view/payment/detail.html
+10
-30
pay_oa.html
application/em/view/payment/pay_oa.html
+179
-0
oafk.php
config/oafk.php
+11
-0
admin.php
route/admin.php
+2
-0
没有找到文件。
application/em/common.php
浏览文件 @
b3ce09a0
...
...
@@ -107,12 +107,6 @@ function createPass(){
return
substr
(
md5
(
config
(
'admin.passwd_salt'
)
.
time
()),
0
,
10
);
}
//生成10位的随机密码
//将密码返回给控制器
//控制器通过MD加密之后存储到数据库
/**
* 基站状态递归实现无限极分类
* @param $array 分类数据
...
...
application/em/controller/Payment.php
浏览文件 @
b3ce09a0
...
...
@@ -5,18 +5,18 @@
*/
namespace
app\em\controller
;
use
app\admin\controller\Base
;
use
app\admin\model\DepartmentModel
;
use
app\admin\model\ElectricMeter
;
use
app\em\model\EmAccount
;
use
app\em\model\EmCert
;
use
app\em\model\EmInvoice
;
use
app\em\model\EmInvoiceHistory
;
use
app\em\model\EmPayment
;
use
app\em\model\EmPaymentFk
;
use
app\em\model\EmPaymentInvoice
;
use
app\em\model\EmPaymentInvoiceBalance
;
use
app\em\model\EmPaymentReceipt
;
use
app\em\model\Staff
;
use
app\em\validate\AddPaymentValidate
;
use
function
Sodium
\library_version_major
;
use
think\Exception
;
use
think\facade\Request
;
use
think\facade\Session
;
...
...
@@ -219,60 +219,6 @@ class Payment extends Base
return
$this
->
fetch
();
}
//更新缴费数据 即保存缴费 记录一次缴费
// public function update(){
// $data = Request::post();
//
// //更新缴费信息
// $payment = EmPayment::get(['payment_id'=>$data['payment_id']]);
// $payment->amount = $data['paid_totle']; //记录凭证金额
// $payment->staff_id = $data['staff_id'];
// //等待审核1,2已审核 1阶段暂忽略
// //$payment->status = 1;
// $payment->status = 2;
// $payment->save();
//
// //更新账单状态
// //1.查询所有账单
// $invArr = [];
// foreach ($data['paid'] as $key => $item) {
// $invArr['invoice_id'] = $key;
// $invArr['paid_amount'] = $item['paid_amount'];
// }
// /*
// * 循环查询账单 并计算balance的数值 更新balance,并将当前的状态,同步到历史数据一份进行销账的追踪
// * 通过与balance的计算结果比较 如果balance=0,则账单状态更新为已缴费 如果不为0则更新为部分缴费
// * 账单与缴费凭证关系的建立 通过缴费单与凭证的关联关系获取,显示在账单详情中
// */
// foreach ($invArr as $item){
// $inv = EmInvoice::get(['invoice_id'=>$item['invoice_id']]);
//
// $balance = $inv->payment_balance - $inv['paid_amount'];
//
// //计算状态
// if($balance == 0){
// $inv->status = setInvoiceStatus($inv->status,self::PAYMENT_FULL_CODE,self::PAYMENT_STATUS_INDEX);
// } else {
// $inv->status = setInvoiceStatus($inv->status,self::PAYMENT_PARTIAL_CODE,self::PAYMENT_STATUS_INDEX);
// }
//
// $inv->payment_balance = $balance;
//
// //更新账单信息
// $inv->save();
// //保存销账明细,复制当前对象数据 到history表
//
// $invHistory = new EmInvoiceHistory();
//
// if(!$invHistory->save($inv->toarray())){
// throw new Exception('保存销账明细错误!');
// } else {
// return json(['status'=>1,'message'=>'缴费成功!']);
// }
// }
//
// }
//缴费单详情
public
function
detail
(){
$payment_id
=
Request
::
param
(
'payment_id'
);
...
...
@@ -280,6 +226,16 @@ class Payment extends Base
//查询缴费单基本信息
$payment
=
$epModel
->
where
(
'payment_id'
,
'='
,
$payment_id
)
->
find
();
if
(
$payment
->
status_fk
!=
0
){
$fkModel
=
EmPaymentFk
::
get
([
'payment_id'
=>
$payment
->
payment_id
]);
$fkModel
->
link
=
config
(
'oafk.base_url'
)
.
config
(
'oafk.link'
)
.
$fkModel
->
oafk_id
;
}
else
{
$fkModel
=
new
EmPaymentFk
();
$fkModel
->
oafk_numb
=
''
;
$fkModel
->
link
=
''
;
}
$this
->
assign
(
'fk'
,
$fkModel
);
switch
(
$payment
->
status
){
case
0
:
$payment
->
statusTitle
=
'未缴费'
;
...
...
@@ -443,4 +399,139 @@ class Payment extends Base
$this
->
assign
(
'data'
,
$eibs
);
return
$this
->
fetch
();
}
public
function
payoa
(){
$payment_id
=
Request
::
param
(
'payment_id'
);
$user
=
Session
::
get
(
'user'
);
$staff
=
Staff
::
get
(
$user
[
'user_id'
]);
$this
->
assign
(
'payment_id'
,
$payment_id
);
$this
->
assign
(
'payee'
,
$this
->
getGys
(
$staff
->
email
));
$this
->
assign
(
'payOrg'
,
$this
->
getFkInfo
(
2
));
$this
->
assign
(
'payType'
,
$this
->
getFkInfo
(
1
));
return
$this
->
fetch
(
'pay_oa'
);
}
public
function
docnumb
(){
$user
=
Session
::
get
(
'user'
);
$staff
=
Staff
::
get
(
$user
[
'user_id'
]);
$dept
=
DepartmentModel
::
get
(
$staff
->
d_id
);
$post
=
Request
::
post
();
$payment
=
EmPayment
::
get
([
'payment_id'
=>
$post
[
'payment_id'
]]);
if
(
$this
->
checkFkStatus
(
$post
[
'payment_id'
]))
return
json
([
'status'
=>
0
,
'message'
=>
'该缴费单已经创建付款单无法再次创建.'
]);
$account
=
EmAccount
::
get
([
'account_id'
=>
$payment
->
account_id
]);
$em
=
\app\em\model\Em
::
with
(
'rule'
)
->
get
(
$account
->
em_id
);
$station
=
(
new
\app\em\model\Em
)
->
getBaseInfo
(
$account
->
em_id
);
if
(
$user
[
'is_admin'
])
$staffName
=
'admin'
;
else
$staffName
=
substr
(
$staff
->
email
,
0
,
strpos
(
$staff
->
email
,
'@'
));
$invs
=
(
new
EmPayment
())
->
getinvsInfo
(
$payment
->
payment_id
);
$amount
=
0
;
foreach
(
$invs
as
$inv
){
if
(
$inv
->
payment_balance
==
0
){
$amount
+=
0
;
}
else
if
(
$inv
->
payment_amount
==
$inv
->
payment_balance
){
$amount
+=
$inv
->
payment_amount
;
}
else
{
$amount
+=
$inv
->
payment_amount
-
$inv
->
payment_balance
;
}
}
$amount
=
round
(
$amount
,
2
);
$data
=
[
'title'
=>
$post
[
'title'
],
'uname'
=>
$staffName
,
'payType'
=>
$post
[
'payType'
],
'dept'
=>
$dept
->
name
,
'payee'
=>
$post
[
'payee'
],
'payOrg'
=>
$post
[
'payOrg'
],
'fkinfo'
=>
$post
[
'fkinfo'
],
'remarks'
=>
$post
[
'remark'
],
'type'
=>
2
,
'date'
=>
$post
[
'date'
],
'details'
=>
[
[
'chargeType'
=>
"维护电费"
,
'amount'
=>
$amount
,
'projectNumber'
=>
$station
->
proj_number
,
'contractNumber'
=>
$em
->
rule
->
pay_protocol_numb
,
'receipt'
=>
''
]
]
];
foreach
(
$data
as
$k
=>
$v
){
if
(
empty
(
$v
))
return
json
([
'status'
=>
0
,
'message'
=>
'字段值全部必填,请检查'
]);
if
(
$k
==
'details'
)
{
foreach
(
$v
as
$a
=>
$b
){
foreach
(
$b
as
$aa
=>
$bb
){
if
(
$aa
!=
'receipt'
){
if
(
empty
(
$bb
))
return
json
([
'status'
=>
0
,
'message'
=>
'金额为空,或成本中心编码不存在'
]);
}
}
}
}
}
$res
=
$this
->
createFkNumb
(
$data
);
$result
=
false
;
if
(
!
empty
(
$res
[
'data'
])){
$payment
->
status_fk
=
1
;
$fkModel
=
new
EmPaymentFk
();
$fkModel
->
payment_id
=
$payment
->
payment_id
;
$fkModel
->
oafk_id
=
$res
[
'data'
][
'id'
];
$fkModel
->
oafk_numb
=
$res
[
'data'
][
'numb'
];
$result
=
$payment
->
save
()
&&
$fkModel
->
save
();
}
if
(
$result
)
return
json
([
'status'
=>
1
,
'message'
=>
'创建单据成功'
]);
else
return
json
([
'status'
=>
0
,
'message'
=>
'创建单据失败'
]);
}
public
function
apiKey
(){
return
md5
(
config
(
'oafk.oa_key'
));
}
public
function
getGys
(
$email
)
{
$url
=
config
(
'oafk.base_url'
)
.
config
(
'oafk.gys'
)
.
$this
->
apiKey
();
$data
=
[
'email'
=>
$email
];
$res
=
httpPOST
(
$url
,
$data
);
$res
=
json_decode
(
$res
,
true
);
foreach
(
$res
[
'data'
]
as
$k
=>
$v
){
if
(
!
empty
(
$v
[
'bank_info'
])){
foreach
(
$v
[
'bank_info'
]
as
$a
=>
$b
){
$temp
[
$a
]
=
'银行名称: '
.
$b
[
'open_bank_name'
]
.
'账号: '
.
$b
[
'bank_code'
];
}
$res
[
'data'
][
$k
][
'bankInfo'
]
=
json_encode
(
$temp
);
}
}
return
$res
[
'data'
];
}
public
function
getFkInfo
(
$type
){
$url
=
config
(
'oafk.base_url'
)
.
config
(
'oafk.type'
)
.
$this
->
apiKey
();
$data
=
[
'type'
=>
$type
];
$res
=
httpPOST
(
$url
,
$data
);
$res
=
json_decode
(
$res
,
true
);
return
$res
[
'data'
];
}
public
function
createFkNumb
(
$data
){
$url
=
config
(
'oafk.base_url'
)
.
config
(
'oafk.fk'
)
.
$this
->
apiKey
();
$res
=
httpPOST
(
$url
,
[
'data'
=>
json_encode
(
$data
)]);
$res
=
json_decode
(
$res
,
true
);
return
$res
;
}
public
function
checkFkStatus
(
$payment_id
){
$res
=
(
new
EmPaymentFk
())
->
get
([
'payment_id'
=>
$payment_id
]);
return
$res
?
true
:
false
;
}
}
\ No newline at end of file
application/em/model/EmPaymentFk.php
0 → 100644
浏览文件 @
b3ce09a0
<?php
namespace
app\em\model
;
class
EmPaymentFk
extends
Base
{
protected
$table
=
'em_payment_fk'
;
}
\ No newline at end of file
application/em/view/payment/detail.html
浏览文件 @
b3ce09a0
...
...
@@ -70,10 +70,7 @@
缴费凭证:
</label>
<div
class=
"layui-input-inline"
>
<a
class=
"layui-btn layui-btn-normal layui-right"
lay-submit
lay-filter=
"showCert"
onclick=
"return false;"
>
查看
</a>
{if $payment.status
<
=
3
}
<
button
class=
"layui-btn layui-btn-normal layui-right"
lay-submit
lay-filter=
"addCert"
onclick=
"return false;"
><i
class=
"layui-icon layui-icon-add-circle-fine"
></i></button>
{/if}
<a
href=
"{$fk.link}"
>
{$fk.oafk_numb|default='无'}
</a>
</div>
</div>
</div>
...
...
@@ -130,7 +127,6 @@
</div>
{/if}
<div
class=
"layui-form-item layui-col-md-offset4"
>
{if $payment.status
<
=
3
}
<
button
class=
"layui-btn"
lay-filter=
"save"
lay-submit=
""
>
提交
</button>
...
...
@@ -140,7 +136,7 @@
审核
</button>
{/if}
{if $
payment.oa
_numb == ''}
{if $
fk.oafk
_numb == ''}
<button
class=
"layui-btn"
lay-filter=
"pay"
lay-submit=
""
>
创建付款
</button>
...
...
@@ -182,8 +178,6 @@
time
:
time
,
});
}
form
.
on
(
'submit(submit)'
,
function
(
data
)
{
$
.
ajax
({
...
...
@@ -239,6 +233,14 @@
}
);
form
.
on
(
'submit(pay)'
,
function
(
data
)
{
$url
=
'/payment/payoa/{$payment.payment_id}'
xadmin
.
open
(
'补充付款信息'
,
$url
)
return
false
;
}
);
//保存信息
form
.
on
(
'submit(save)'
,
function
(
data
)
{
...
...
@@ -282,28 +284,6 @@
return
false
;
});
//审核通过
form
.
on
(
'submit(pay)'
,
function
(
data
)
{
$
.
ajax
({
url
:
'/payment/payoa'
,
method
:
"POST"
,
data
:
data
.
field
,
dataType
:
"json"
,
success
:
function
(
data
)
{
if
(
data
.
status
==
1
)
{
layer
.
msg
(
data
.
message
,{
icon
:
6
,
time
:
2000
},
function
(){
window
.
location
.
href
=
"/payment"
})
}
else
{
layer
.
msg
(
data
.
message
||
data
.
msg
,{
icon
:
5
,
time
:
1000
})
}
}
});
return
false
;
});
//上传电表照片
var
upPhoto
=
upload
.
render
({
elem
:
'#up_photo'
,
...
...
application/em/view/payment/pay_oa.html
0 → 100644
浏览文件 @
b3ce09a0
{extend name="public:base" /}
{block name="body"}
<div
class=
"layui-row"
>
<div
class=
"layui-col-md12"
>
<div
class=
"layui-card"
>
<form
class=
"layui-form"
>
<!--添加结算凭证-->
<div
class=
"layui-form-box"
>
<div
class=
"layui-form-body"
>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label layui-text-left"
>
缴费单号:
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"payment_id"
autocomplete=
"off"
class=
"layui-input"
value=
"{$payment_id}"
disabled=
"disabled"
>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label layui-text-left"
>
单据抬头:
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"title"
autocomplete=
"off"
class=
"layui-input"
value=
"电费付款"
>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label layui-text-left"
>
汇款方式:
</label>
<div
class=
"layui-input-inline"
>
<select
name=
"payType"
id=
"payType"
>
{volist name="payType" id="item"}
<option
value=
"{$item.name}"
>
{$item.name}
</option>
{/volist}
</select>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label layui-text-left"
>
收款方:
</label>
<div
class=
"layui-input-inline"
>
<select
name=
"payee"
id=
"payee"
lay-filter=
"change"
>
{volist name="payee" id="item"}
<option
value=
"{$item.name}"
data-info=
'{$item.bankInfo|default='
'}'
>
{$item.name}
</option>
{/volist}
</select>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label layui-text-left"
>
付款组织:
</label>
<div
class=
"layui-input-inline"
>
<select
name=
"payOrg"
id=
"payOrg"
>
{volist name="payOrg" id="item"}
<option
value=
"{$item.name}"
>
{$item.name}
</option>
{/volist}
</select>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label layui-text-left"
>
付款日期:
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"date"
id=
"date"
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label layui-text-left"
>
付款信息:
</label>
<div
class=
"layui-input-inline"
>
<textarea
class=
"layui-textarea"
name=
"fkinfo"
id=
"fkinfo"
></textarea>
</div>
</div>
</div>
<div
class=
"layui-col-md5"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label layui-text-left"
>
备注:
</label>
<div
class=
"layui-input-inline"
>
<textarea
class=
"layui-textarea"
name=
"remark"
id=
"remark"
></textarea>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item layui-col-md-offset4"
>
<button
class=
"layui-btn"
lay-filter=
"submit"
lay-submit=
""
>
创建
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
{/block}
{block name="js"}
<script
type=
"text/javascript"
>
//初始化Layui控件
layui
.
use
([
'form'
,
'layer'
,
'laydate'
,
'upload'
],
function
()
{
$
=
layui
.
jquery
;
var
form
=
layui
.
form
,
layer
=
layui
.
layer
,
laydate
=
layui
.
laydate
;
form
.
on
(
'select(change)'
,
function
(
data
)
{
var
that
=
$
(
data
.
elem
);
var
info
=
that
.
find
(
'option:selected'
).
data
(
'info'
);
$
(
"#fkinfo"
).
text
(
info
);
});
laydate
.
render
({
elem
:
'#date'
,
trigger
:
'click'
,
});
//消息提示
function
layMsg
(
msg
,
type
=
6
,
time
=
1000
)
{
layer
.
msg
(
msg
,
{
icon
:
type
,
time
:
time
,
});
}
//生成缴费单
form
.
on
(
'submit(submit)'
,
function
(
data
)
{
$
.
ajax
({
url
:
'/payment/docnumb'
,
method
:
"POST"
,
data
:
data
.
field
,
dataType
:
"json"
,
success
:
function
(
data
)
{
if
(
data
.
status
==
1
)
{
layer
.
msg
(
data
.
message
,
{
icon
:
6
,
time
:
3000
},
function
()
{
xadmin
.
close
();
// 可以对父窗口进行刷新
xadmin
.
father_reload
();
})
}
else
{
layer
.
msg
(
data
.
message
,
{
icon
:
5
,
time
:
3000
})
}
}
});
return
false
;
});
});
</script>
{/block}
config/oafk.php
0 → 100644
浏览文件 @
b3ce09a0
<?php
return
[
'oa_key'
=>
'5bdfcedb618e1e03abf18e391278c1f4'
,
'base_url'
=>
'http://chengye-dev.gonn.tech'
,
'gys'
=>
'/api.php?m=opensupplier&a=list&openkey='
,
'type'
=>
'/api.php?m=openfkinfo&a=fkinfor&openkey='
,
'fk'
=>
'/api.php?m=openfk&a=create&openkey='
,
'link'
=>
'/task.php?a=p&num=oayfk&mid='
];
?>
\ No newline at end of file
route/admin.php
浏览文件 @
b3ce09a0
...
...
@@ -168,6 +168,8 @@ Route::post('payment/createAll','em/payment/createAll');
Route
::
post
(
'payment/update'
,
'em/payment/update'
);
Route
::
post
(
'payment/save'
,
'em/payment/store'
);
Route
::
post
(
'payment/confirm'
,
'em/payment/confirm'
);
Route
::
get
(
'payment/payoa/:payment_id'
,
'em/payment/payoa'
);
Route
::
post
(
'payment/docnumb'
,
'em/payment/docnumb'
);
//结算
Route
::
get
(
'settle'
,
'em/settle/index'
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论