Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
Aidea
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
sa_aidea
Aidea
Commits
1fdef6e4
Commit
1fdef6e4
authored
Nov 27, 2020
by
卜远杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开票
parent
d0db96f5
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1941 additions
and
10 deletions
+1941
-10
pom.xml
aidea-modules/invoice-module-web/pom.xml
+30
-0
invoiceform.html
...eb/src/main/webapp/WEB-INF/views/invoice/invoiceform.html
+194
-0
invoicelist.html
...eb/src/main/webapp/WEB-INF/views/invoice/invoicelist.html
+388
-0
pom.xml
aidea-modules/invoice-module/pom.xml
+27
-0
InvoiceMapper.java
...e/src/main/java/com/cftech/invoice/dao/InvoiceMapper.java
+14
-0
InvoiceMapper.xml
...le/src/main/java/com/cftech/invoice/dao/InvoiceMapper.xml
+199
-0
Invoice.java
...odule/src/main/java/com/cftech/invoice/model/Invoice.java
+78
-0
InvoiceDto.java
...le/src/main/java/com/cftech/invoice/model/InvoiceDto.java
+51
-0
InvoiceService.java
.../main/java/com/cftech/invoice/service/InvoiceService.java
+14
-0
InvoiceServiceImpl.java
...a/com/cftech/invoice/service/impl/InvoiceServiceImpl.java
+31
-0
InvoiceController.java
...c/main/java/com/cftech/invoice/web/InvoiceController.java
+198
-0
orderlist.html
...le-web/src/main/webapp/WEB-INF/views/order/orderlist.html
+249
-3
pom.xml
aidea-modules/order-module/pom.xml
+17
-0
OrderMapper.xml
...module/src/main/java/com/cftech/order/dao/OrderMapper.xml
+18
-2
Order.java
...er-module/src/main/java/com/cftech/order/model/Order.java
+25
-1
OrderService.java
.../src/main/java/com/cftech/order/service/OrderService.java
+8
-0
OrderServiceImpl.java
.../java/com/cftech/order/service/impl/OrderServiceImpl.java
+75
-0
InvoiceUtil.java
...ule/src/main/java/com/cftech/order/utils/InvoiceUtil.java
+207
-0
MobileOrderController.java
...main/java/com/cftech/order/web/MobileOrderController.java
+12
-0
OrderController.java
...e/src/main/java/com/cftech/order/web/OrderController.java
+63
-1
pom.xml
aidea-modules/pom.xml
+2
-0
productform.html
...eb/src/main/webapp/WEB-INF/views/product/productform.html
+10
-0
ProductMapper.xml
...le/src/main/java/com/cftech/product/dao/ProductMapper.xml
+8
-2
Product.java
...odule/src/main/java/com/cftech/product/model/Product.java
+4
-0
common-test.properties
cftech-common-web/src/main/resources/common-test.properties
+18
-0
qyuserlist.html
...c/main/webapp/WEB-INF/views/managerqyuser/qyuserlist.html
+1
-1
No files found.
aidea-modules/invoice-module-web/pom.xml
0 → 100644
View file @
1fdef6e4
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<parent>
<artifactId>
aidea-modules
</artifactId>
<groupId>
com.cftech
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
invoice-module-web
</artifactId>
<packaging>
war
</packaging>
<name>
invoice-module-web Maven Webapp
</name>
<url>
http://maven.apache.org
</url>
<dependencies>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
3.8.1
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.cftech
</groupId>
<artifactId>
invoice-module
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
<finalName>
invoice-module-web
</finalName>
</build>
</project>
aidea-modules/invoice-module-web/src/main/webapp/WEB-INF/views/invoice/invoiceform.html
0 → 100644
View file @
1fdef6e4
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base
href=
"#springUrl('/assets/adminlte/')"
/>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<title>
工作台
</title>
<!-- Tell the browser to be responsive to screen width -->
<meta
content=
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
name=
"viewport"
>
<!-- Bootstrap 3.3.5 -->
<link
rel=
"stylesheet"
href=
"bootstrap/css/bootstrap.min.css"
>
<!-- Font Awesome -->
<link
rel=
"stylesheet"
href=
"plugins/font-awesome/css/font-awesome.min.css"
>
<!-- Ionicons -->
<link
rel=
"stylesheet"
href=
"plugins/ionicons/css/ionicons.min.css"
>
<!-- DataTables -->
<link
rel=
"stylesheet"
href=
"plugins/datatables/dataTables.bootstrap.css"
>
<!-- Theme style -->
<link
rel=
"stylesheet"
href=
"dist/css/AdminLTE.min.css"
>
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link
rel=
"stylesheet"
href=
"dist/css/skins/_all-skins.min.css"
>
<!-- iCheck -->
<link
rel=
"stylesheet"
href=
"plugins/iCheck/flat/blue.css"
>
<!-- Date Picker -->
<link
rel=
"stylesheet"
href=
"plugins/datepicker/datepicker3.css"
>
<!-- Daterange picker -->
<link
rel=
"stylesheet"
href=
"plugins/daterangepicker/daterangepicker-bs3.css"
>
<!-- bootstrap wysihtml5 - text editor -->
<link
rel=
"stylesheet"
href=
"plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css"
>
<!--validate css-->
<link
rel=
"stylesheet"
href=
"plugins/jquery-validation/css/validate.css"
>
<!--fileinput css-->
<link
rel=
"stylesheet"
href=
"plugins/bootstrap-fileinput/bootstrap-fileinput.css"
>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- END HEAD -->
<body
class=
"hold-transition skin-blue sidebar-mini"
>
<div
class=
"wrapper"
>
<div
class=
"content-wrapper"
style=
"margin-left:0;"
>
<section
class=
"content-header"
>
<h1>
开票信息管理
<small>
开票信息
</small>
</h1>
<ol
class=
"breadcrumb"
>
<li><a
href=
"#"
><i
class=
"fa fa-dashboard"
></i>
首页
</a></li>
<li><a
class=
"active"
>
开票信息
</a></li>
</ol>
</section>
<!-- Main content -->
<section
class=
"content"
>
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
<!-- general form elements disabled -->
<div
class=
"box box-primary"
>
<form
role=
"form"
id=
"myForm"
>
<input
name=
"id"
value=
"$!{data.id}"
hidden=
"true"
/>
<div
class=
"box-body"
>
</div>
<div
class=
"box-footer"
>
#if($shiro.hasPermission("qy:invoice:edit"))
<input
class=
"btn btn-primary"
id=
"save"
value=
"保存"
type=
"submit"
>
#end
<a
href=
"#springUrl('/a/invoice/list')"
class=
"btn btn-default"
>
取消
</a>
</div>
</form>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div
class=
"control-sidebar-bg"
></div>
</div>
<!-- ./wrapper -->
<script
src=
"plugins/jQuery/jQuery-2.1.4.min.js"
></script>
<!-- Bootstrap 3.3.5 -->
<script
src=
"bootstrap/js/bootstrap.min.js"
></script>
<!-- DataTables -->
<script
src=
"plugins/datatables/jquery.dataTables.min.js"
></script>
<script
src=
"plugins/datatables/extensions/i18n/lanauage_ch.js"
></script>
<script
src=
"plugins/datatables/dataTables.bootstrap.min.js"
></script>
<!-- SlimScroll -->
<script
src=
"plugins/slimScroll/jquery.slimscroll.min.js"
></script>
<!-- FastClick -->
<script
src=
"plugins/fastclick/fastclick.min.js"
></script>
<!--fileinput js-->
<script
src=
"plugins/bootstrap-fileinput/bootstrap-fileinput.js"
></script>
<!-- AdminLTE App -->
<script
src=
"dist/js/app.min.js"
></script>
<script
src=
"plugins/bootstrap-maxlength/bootstrap-maxlength.min.js"
type=
"text/javascript"
></script>
<script
src=
"plugins/security/sha256.js"
type=
"text/javascript"
></script>
<script
src=
"plugins/jquery-validation/js/jquery.validate.min.js"
></script>
<script
src=
"js/jquery.form.min.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
src=
"plugins/ueditor-min-1.4.3/ueditor.config.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
src=
"plugins/ueditor-min-1.4.3/ueditor.all.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
src=
"plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"
></script>
<script
src=
"common/js/cfapp.js"
></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
$
().
ready
(
function
()
{
Cfapp
.
init
();
recdTypeAdd
.
init
();
});
var
recdTypeAdd
=
function
()
{
var
initForm
=
function
()
{
var
initFormCtrl
=
function
()
{
bindEvent
();
};
var
bindEvent
=
function
()
{
$
(
"#myForm"
).
validate
({
rules
:
{},
messages
:
{},
submitHandler
:
function
(
form
)
{
$
(
"#save"
).
attr
(
"disabled"
,
true
);
$
.
getJSON
(
"#springUrl('/a/invoice/formData')"
,
$
(
"#myForm"
).
serialize
(),
function
(
returnobj
)
{
$
(
"#save"
).
attr
(
"disabled"
,
false
);
if
(
returnobj
.
errorNo
==
2
)
{
//保存成功
Cfapp
.
confirm
({
message
:
"添加成功"
,
btnoktext
:
"继续添加"
,
btncanceltext
:
"关闭"
,
success
:
function
()
{
location
.
href
=
"#springUrl('/a/invoice/form')"
;
},
cancel
:
function
()
{
location
.
href
=
"#springUrl('/a/invoice/list')"
;
}
});
}
else
if
(
returnobj
.
errorNo
==
0
)
{
//修改成功
Cfapp
.
alert
({
message
:
"更新成功"
,
btntext
:
"确定"
,
success
:
function
()
{
location
.
href
=
"#springUrl('/a/invoice/list')"
;
}
});
}
else
{
Cfapp
.
alert
({
message
:
"创建失败"
,
btntext
:
"确定"
,
success
:
function
()
{
location
.
href
=
"#springUrl('/a/invoice/list')"
;
}
});
}
});
}
})
}
initFormCtrl
();
}
return
{
//main function to initiate the module
init
:
function
()
{
initForm
();
}
};
}();
</script>
</body>
<!-- END BODY -->
</html>
\ No newline at end of file
aidea-modules/invoice-module-web/src/main/webapp/WEB-INF/views/invoice/invoicelist.html
0 → 100644
View file @
1fdef6e4
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base
href=
"#springUrl('/assets/adminlte/')"
/>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<title>
工作台
</title>
<!-- Tell the browser to be responsive to screen width -->
<meta
content=
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
name=
"viewport"
>
<!-- Bootstrap 3.3.5 -->
<link
rel=
"stylesheet"
href=
"bootstrap/css/bootstrap.min.css"
>
<!-- Font Awesome -->
<link
rel=
"stylesheet"
href=
"plugins/font-awesome/css/font-awesome.min.css"
>
<!-- Ionicons -->
<link
rel=
"stylesheet"
href=
"plugins/ionicons/css/ionicons.min.css"
>
<!-- DataTables -->
<link
rel=
"stylesheet"
href=
"plugins/datatables/dataTables.bootstrap.css"
>
<!-- Theme style -->
<link
rel=
"stylesheet"
href=
"dist/css/AdminLTE.min.css"
>
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link
rel=
"stylesheet"
href=
"dist/css/skins/_all-skins.min.css"
>
<!-- iCheck -->
<link
rel=
"stylesheet"
href=
"plugins/iCheck/flat/blue.css"
>
<!-- Morris chart -->
<link
rel=
"stylesheet"
href=
"plugins/morris/morris.css"
>
<!-- jvectormap -->
<link
rel=
"stylesheet"
href=
"plugins/jvectormap/jquery-jvectormap-1.2.2.css"
>
<!-- Date Picker -->
<link
rel=
"stylesheet"
href=
"plugins/datepicker/datepicker3.css"
>
<!-- Daterange picker -->
<link
rel=
"stylesheet"
href=
"plugins/daterangepicker/daterangepicker-bs3.css"
>
<link
rel=
"stylesheet"
href=
"plugins\bootstrap-fileinput\fileinput.min.css"
>
<!-- bootstrap wysihtml5 - text editor -->
<link
rel=
"stylesheet"
href=
"plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css"
>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body
class=
"hold-transition skin-blue sidebar-mini"
>
<div
class=
"wrapper"
>
<div
class=
"content-wrapper"
style=
"margin-left:0;"
>
<div
id=
"importExcelDiv"
></div>
<section
class=
"content-header"
>
<h1>
开票信息管理
<small>
开票信息
</small>
</h1>
<ol
class=
"breadcrumb"
>
<li><a><i
class=
"fa fa-dashboard"
></i>
首页
</a></li>
<li><a
class=
"active"
>
开票信息管理列表
</a></li>
</ol>
</section>
<!-- Main content -->
<section
class=
"content"
>
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
<div
class=
"box"
>
<div
class=
"box-header"
>
<form
id=
"seachTableForm"
action=
"#springUrl('/a/invoice/exportExcel')"
method=
"get"
>
<div
class=
"col-xs-2"
>
<input
type=
"text"
class=
"form-control "
name=
"invoiceTitle"
placeholder=
"发票抬头"
>
</div>
<div
class=
"col-xs-5"
>
<button
type=
"button"
class=
"search btn btn-primary"
>
搜索
</button>
#if($shiro.hasPermission("qy:invoice:edit"))
<!-- <a href="#springUrl('/a/invoice/form')" class="btn btn-primary">新增</a>-->
<button
type=
"submit"
class=
"btn btn-primary"
>
导出
</button>
<!-- <a onclick="importExcel();" class="btn btn-primary">导入</a>-->
#end
</div>
</form>
</div>
<!-- /.box-header -->
<div
class=
"box-body"
>
<table
id=
"table"
class=
"table table-bordered table-striped"
>
<thead>
<tr>
<td
hidden=
"true"
>
Id
</td>
<td>
发票抬头
</td>
<td>
抬头类型
</td>
<td>
发票内容
</td>
<td>
单位税号
</td>
<td>
发票类型
</td>
<td>
来源
</td>
<td>
开票人
</td>
<td>
订单编码
</td>
<td>
推送方式
</td>
<td>
推送邮箱
</td>
<td>
发票流水号
</td>
<th>
创建时间
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody
id=
"tablebody"
>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div
class=
"control-sidebar-bg"
></div>
</div>
<!-- ./wrapper -->
<!-- jQuery 2.1.4 -->
<script
src=
"plugins/jQuery/jQuery-2.1.4.min.js"
></script>
<!-- Bootstrap 3.3.5 -->
<script
src=
"bootstrap/js/bootstrap.min.js"
></script>
<!-- DataTables -->
<script
src=
"plugins/datatables/jquery.dataTables.min.js"
></script>
<script
src=
"plugins/datatables/extensions/i18n/lanauage_ch.js"
></script>
<script
src=
"plugins/datatables/dataTables.bootstrap.min.js"
></script>
<!-- SlimScroll -->
<script
src=
"plugins/slimScroll/jquery.slimscroll.min.js"
></script>
<script
src=
"plugins/datepicker/bootstrap-datepicker.js"
></script>
<script
src=
"plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"
></script>
<!-- FastClick -->
<script
src=
"plugins/fastclick/fastclick.min.js"
></script>
<!--fileinput js-->
<script
src=
"plugins\bootstrap-fileinput\fileinput.js"
></script>
<script
src=
"plugins/bootstrap-fileinput/zh.js"
></script>
<script
src=
"plugins/bootstrap-fileinput/zh2.js"
></script>
<!-- AdminLTE App -->
<script
src=
"dist/js/app.min.js"
></script>
<script
type=
"text/javascript"
src=
"plugins/jquery-validation/js/jquery.validate.min.js"
></script>
<!-- AdminLTE for demo purposes -->
<script
src=
"common/js/cfapp.js"
></script>
<script>
function
formatDates
(
now
)
{
var
now
=
new
Date
(
now
);
var
year
=
now
.
getFullYear
();
var
month
=
now
.
getMonth
()
+
1
;
var
date
=
now
.
getDate
();
var
hour
=
now
.
getHours
();
var
minute
=
now
.
getMinutes
();
var
second
=
now
.
getSeconds
();
return
year
+
"-"
+
month
+
"-"
+
date
+
" "
+
hour
+
":"
+
minute
+
":"
+
second
;
}
function
seachTable
()
{
var
sSource
=
"#springUrl('/a/invoice/listData')"
;
var
aoData
=
{
iDisplayStart
:
1
,
iDosplayLength
:
10
}
var
retrieveData
=
function
(
sSource
,
aoData
,
fnCallback
)
{
$
(
"#seachTableForm input"
).
each
(
function
()
{
var
params
=
{
name
:
$
(
this
).
attr
(
"name"
),
value
:
$
(
this
).
val
()
};
aoData
.
push
(
params
);
})
$
.
ajax
({
"type"
:
"GET"
,
"url"
:
sSource
,
"dataType"
:
"json"
,
"data"
:
aoData
,
//以json格式传递
"success"
:
fnCallback
});
};
$
(
'#table'
).
DataTable
({
"lengthChange"
:
false
,
"searching"
:
false
,
"ordering"
:
false
,
"bFiltered"
:
false
,
"bStateSave"
:
true
,
// save datatable state(pagination, sort, etc) in cookie.
"bProcessing"
:
true
,
"bServerSide"
:
true
,
"sAjaxSource"
:
sSource
,
"fnServerData"
:
retrieveData
,
"pagingType"
:
"full_numbers"
,
"aoColumns"
:
[
{
"mData"
:
"id"
},
{
"mData"
:
"invoiceTitle"
},
{
"mData"
:
"status"
},
{
"mData"
:
"invoiceContent"
},
{
"mData"
:
"unitTaxNumber"
},
{
"mData"
:
"invoiceType"
},
{
"mData"
:
"invoiceForm"
},
{
"mData"
:
"clerkId"
},
{
"mData"
:
"orderId"
},
{
"mData"
:
"pushMode"
},
{
"mData"
:
"email"
},
{
"mData"
:
"invoiceSerialNum"
},
{
"mData"
:
"createTime"
}],
"aoColumnDefs"
:
[
{
// set default column settings
'visible'
:
false
,
'targets'
:
[
0
]
},
{
"aTargets"
:
[
2
]
,
"mData"
:
"status"
,
"mRender"
:
function
(
a
,
b
,
c
,
d
){
if
(
a
==
0
){
return
"个人"
;
}
else
if
(
a
==
1
){
return
"企业"
;
}
else
{
return
""
;
}
}
},
{
"aTargets"
:
[
5
],
"mData"
:
"invoiceType"
,
"mRender"
:
function
(
a
,
b
,
c
,
d
)
{
if
(
a
==
1
){
return
"蓝票"
;
}
else
if
(
a
==
2
){
return
"红票"
;
}
else
{
return
""
;
}
}
},
{
"aTargets"
:
[
6
],
"mData"
:
"invoiceForm"
,
"mRender"
:
function
(
a
,
b
,
c
,
d
)
{
if
(
a
==
0
){
return
"移动端"
;
}
else
if
(
a
==
1
){
return
"后台"
;
}
else
{
return
""
;
}
}
},
{
"aTargets"
:
[
9
],
"mData"
:
"pushMode"
,
"mRender"
:
function
(
a
,
b
,
c
,
d
)
{
if
(
a
==
0
){
return
"邮箱"
;
}
else
{
return
""
;
}
}
},
{
"aTargets"
:
[
12
],
"mData"
:
"createTime"
,
"mRender"
:
function
(
a
,
b
,
c
,
d
)
{
return
formatDates
(
a
,
"yyyy-MM-dd HH:mm:ss"
);
}
},
]
});
}
jQuery
(
document
).
ready
(
function
()
{
seachTable
();
$
(
'.datepicker'
).
datepicker
({
show
:
true
,
format
:
'yyyy-mm-dd'
,
autoclose
:
true
,
language
:
'zh-CN'
,
todayBtn
:
'linked'
,
clearBtn
:
'linked'
});
$
(
'.search'
).
click
(
function
()
{
$
(
"#table"
).
dataTable
().
fnClearTable
();
});
});
Cfapp
.
init
();
function
removeData
(
data
)
{
Cfapp
.
confirm
({
message
:
"确定要删除吗"
,
btnoktext
:
"确定"
,
btncanceltext
:
"取消"
,
success
:
function
()
{
$
.
ajax
({
type
:
"POST"
,
url
:
"#springUrl('/a/invoice/delete')"
,
data
:
{
id
:
data
},
dataType
:
"json"
,
success
:
function
(
data
)
{
if
(
data
.
errorNo
==
0
)
{
Cfapp
.
alert
({
message
:
"删除成功"
,
btntext
:
"确定"
,
success
:
function
()
{
location
.
href
=
"#springUrl('/a/invoice/list')"
;
}
});
}
},
error
:
function
()
{
}
})
},
cancel
:
function
()
{
$
(
".modal-backdrop"
).
fadeOut
();
}
});
}
function
importExcel
()
{
var
templateExcelUrl
=
"#springUrl('/a/invoice/templateExcel')"
;
var
importExcelUrl
=
"#springUrl('/a/invoice/importExcel')"
;
Cfapp
.
importExcel
({
title
:
'开票信息导入'
,
importurl
:
importExcelUrl
,
templateurl
:
templateExcelUrl
,
cancel
:
function
()
{
},
success
:
function
()
{
}
});
}
</script>
</body>
</html>
aidea-modules/invoice-module/pom.xml
0 → 100644
View file @
1fdef6e4
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
aidea-modules
</artifactId>
<groupId>
com.cftech
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
invoice-module
</artifactId>
<dependencies>
<dependency>
<groupId>
com.cftech
</groupId>
<artifactId>
sys-module
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.nuonuo
</groupId>
<artifactId>
open-sdk
</artifactId>
<version>
1.0.4.1
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
aidea-modules/invoice-module/src/main/java/com/cftech/invoice/dao/InvoiceMapper.java
0 → 100644
View file @
1fdef6e4
package
com
.
cftech
.
invoice
.
dao
;
import
com.cftech.invoice.model.Invoice
;
import
com.cftech.core.generic.GenericDao
;
/**
* 开票信息Mapper
*
* @author Buyj
* @date: 2020-11-25 09:32
*/
public
interface
InvoiceMapper
extends
GenericDao
<
Invoice
>
{
}
\ No newline at end of file
aidea-modules/invoice-module/src/main/java/com/cftech/invoice/dao/InvoiceMapper.xml
0 → 100644
View file @
1fdef6e4
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.cftech.invoice.dao.InvoiceMapper"
>
<resultMap
id=
"resultMap"
type=
"com.cftech.invoice.model.Invoice"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"invoice_title"
property=
"invoiceTitle"
/>
<result
column=
"invoice_content"
property=
"invoiceContent"
/>
<result
column=
"unit_tax_number"
property=
"unitTaxNumber"
/>
<result
column=
"invoice_type"
property=
"invoiceType"
/>
<result
column=
"invoice_form"
property=
"invoiceForm"
/>
<result
column=
"clerk_id"
property=
"clerkId"
/>
<result
column=
"order_id"
property=
"orderId"
/>
<result
column=
"push_mode"
property=
"pushMode"
/>
<result
column=
"email"
property=
"email"
/>
<result
column=
"invoice_serial_num"
property=
"invoiceSerialNum"
/>
<result
column=
"product_id"
property=
"productId"
/>
<result
column=
"accounts_id"
property=
"accountsId"
/>
<result
column=
"del_flag"
property=
"delFlag"
/>
<result
column=
"status"
property=
"status"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"description"
property=
"description"
/>
<result
column=
"create_by"
property=
"createBy"
/>
<result
column=
"update_by"
property=
"updateBy"
/>
</resultMap>
<sql
id=
"sqlWhere"
>
<if
test=
"conds!=null"
>
<trim
prefix=
"WHERE"
prefixOverrides=
"AND|OR"
>
<foreach
collection=
"conds.conds"
index=
"index"
item=
"cond"
>
${cond.linkType}
<if
test=
"cond.condType == 'EQUAL'"
>
${cond.param} = #{cond.value}
</if>
<if
test=
"cond.condType == 'NOTEQUAL'"
>
${cond.param}
<>
#{cond.value}
</if>
<if
test=
"cond.condType == 'GREATEQUAL'"
>
${cond.param}
>
= #{cond.value}
</if>
<if
test=
"cond.condType == 'GREATTHAN'"
>
${cond.param}
>
#{cond.value}
</if>
<if
test=
"cond.condType == 'LESSEQUAL'"
>
${cond.param}
<
= #{cond.value}
</if>
<if
test=
"cond.condType == 'LESSTHAN'"
>
${cond.param}
<
#{cond.value}
</if>
<if
test=
"cond.condType == 'BETWEEN'"
>
${cond.param} BETWEEN #{cond.startValue} AND
#{cond.endValue}
</if>
<if
test=
"cond.condType == 'ISNULL'"
>
${cond.param} IS NULL
</if>
<if
test=
"cond.condType == 'NOTNULL'"
>
${cond.param} IS NOT NULL
</if>
<if
test=
"cond.condType == 'LIKE'"
>
${cond.param} LIKE #{cond.value}
</if>
<if
test=
"cond.condType == 'IN'"
>
${cond.param} IN
<foreach
item=
"item"
index=
"index"
collection=
"cond.value"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</foreach>
</trim>
</if>
</sql>
<sql
id=
"sqlColumns"
>
id,
invoice_title,
invoice_content,
unit_tax_number,
invoice_type,
invoice_form,
clerk_id,
order_id,
push_mode,
email,
invoice_serial_num,
product_id,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<insert
id=
"save"
parameterType=
"com.cftech.invoice.model.Invoice"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into t_aidea_invoice
(
<include
refid=
"sqlColumns"
/>
)
values
(
#{id, jdbcType=BIGINT},
#{invoiceTitle, jdbcType=VARCHAR},
#{invoiceContent, jdbcType=VARCHAR},
#{unitTaxNumber, jdbcType=VARCHAR},
#{invoiceType, jdbcType=VARCHAR},
#{invoiceForm, jdbcType=VARCHAR},
#{clerkId, jdbcType=VARCHAR},
#{orderId, jdbcType=VARCHAR},
#{pushMode, jdbcType=VARCHAR},
#{email, jdbcType=VARCHAR},
#{invoiceSerialNum, jdbcType=VARCHAR},
#{productId, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select
id=
"fetchById"
parameterType=
"java.lang.Long"
resultMap=
"resultMap"
>
SELECT
<include
refid=
"sqlColumns"
/>
FROM t_aidea_invoice t
WHERE t.id=#{id}
</select>
<select
id=
"count"
parameterType=
"java.util.Map"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1) FROM t_aidea_invoice
<include
refid=
"sqlWhere"
/>
</select>
<select
id=
"fetchSearchByPage"
parameterType=
"java.util.Map"
resultMap=
"resultMap"
>
SELECT
<include
refid=
"sqlColumns"
/>
FROM t_aidea_invoice
<include
refid=
"sqlWhere"
/>
<if
test=
"sort!=null"
>
ORDER BY ${sort.param} ${sort.type}
</if>
<if
test=
"limit>0"
>
limit #{offset},#{limit}
</if>
</select>
<update
id=
"update"
parameterType=
"com.cftech.invoice.model.Invoice"
>
update t_aidea_invoice
<set>
<if
test=
"id != null"
>
id = #{id, jdbcType=BIGINT},
</if>
<if
test=
"invoiceTitle != null"
>
invoice_title = #{invoiceTitle, jdbcType=VARCHAR},
</if>
<if
test=
"invoiceContent != null"
>
invoice_content = #{invoiceContent, jdbcType=VARCHAR},
</if>
<if
test=
"unitTaxNumber != null"
>
unit_tax_number = #{unitTaxNumber, jdbcType=VARCHAR},
</if>
<if
test=
"invoiceType != null"
>
invoice_type = #{invoiceType, jdbcType=VARCHAR},
</if>
<if
test=
"invoiceForm != null"
>
invoice_form = #{invoiceForm, jdbcType=VARCHAR},
</if>
<if
test=
"clerkId != null"
>
clerk_id = #{clerkId, jdbcType=VARCHAR},
</if>
<if
test=
"orderId != null"
>
order_id = #{orderId, jdbcType=VARCHAR},
</if>
<if
test=
"pushMode != null"
>
push_mode = #{pushMode, jdbcType=VARCHAR},
</if>
<if
test=
"email != null"
>
email = #{email, jdbcType=VARCHAR},
</if>
<if
test=
"invoiceSerialNum != null"
>
invoice_serial_num = #{invoiceSerialNum, jdbcType=VARCHAR},
</if>
<if
test=
"productId != null"
>
product_id = #{productId, jdbcType=VARCHAR},
</if>
<if
test=
"accountsId != null"
>
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if
test=
"delFlag != null"
>
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if
test=
"status != null"
>
status = #{status, jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if
test=
"description != null"
>
description = #{description, jdbcType=VARCHAR},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update
id=
"delete"
parameterType=
"java.lang.Long"
>
update t_aidea_invoice set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
aidea-modules/invoice-module/src/main/java/com/cftech/invoice/model/Invoice.java
0 → 100644
View file @
1fdef6e4
package
com
.
cftech
.
invoice
.
model
;
import
com.cftech.core.poi.ExportConfig
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 开票信息
*
* @author Buyj
* @date: 2020-11-25 09:32
*/
@Data
public
class
Invoice
implements
Serializable
{
/** 主键id */
private
Long
id
;
/** 发票抬头 */
@ExportConfig
(
value
=
"发票抬头"
,
width
=
100
,
showLevel
=
1
)
private
String
invoiceTitle
;
/** 发票内容 */
@ExportConfig
(
value
=
"发票内容"
,
width
=
100
,
showLevel
=
1
)
private
String
invoiceContent
;
/** 单位税号 */
@ExportConfig
(
value
=
"单位税号"
,
width
=
100
,
showLevel
=
1
)
private
String
unitTaxNumber
;
/** 发票类型(1:蓝票,2红票) */
@ExportConfig
(
value
=
"发票类型"
,
width
=
100
,
showLevel
=
1
)
private
String
invoiceType
;
/** 来源(0:移动端 1:后台) */
@ExportConfig
(
value
=
"来源"
,
width
=
100
,
showLevel
=
1
)
private
String
invoiceForm
;
/** 开票人id(移动端传opendId,后台传userid) */
@ExportConfig
(
value
=
"开票人"
,
width
=
100
,
showLevel
=
1
)
private
String
clerkId
;
/** 订单ID */
@ExportConfig
(
value
=
"订单编码"
,
width
=
100
,
showLevel
=
1
)
private
String
orderId
;
/** 推送方式(0:邮箱) */
@ExportConfig
(
value
=
"推送方式"
,
width
=
100
,
showLevel
=
1
)
private
String
pushMode
;
/** 推送邮箱 */
@ExportConfig
(
value
=
"推送邮箱"
,
width
=
100
,
showLevel
=
1
)
private
String
email
;
/** 发票流水号 */
@ExportConfig
(
value
=
"发票流水号"
,
width
=
100
,
showLevel
=
1
)
private
String
invoiceSerialNum
;
/** 商品ID 逗号隔开 */
private
String
productId
;
/** 所属的账号 */
private
Long
accountsId
;
/** 删除标识 */
private
boolean
delFlag
;
/** 状态 */
/**
* 状态( 0:个人 1:企业 )
*/
@ExportConfig
(
value
=
"抬头类型"
)
private
String
status
;
/** 创建时间 */
private
Date
createTime
;
/** 更新时间 */
private
Date
updateTime
;
/** 备注 */
private
String
description
;
/** 创建人 */
private
Long
createBy
;
/** 更新人 */
private
Long
updateBy
;
public
Invoice
()
{
this
.
delFlag
=
false
;
this
.
status
=
"0"
;
}
}
\ No newline at end of file
aidea-modules/invoice-module/src/main/java/com/cftech/invoice/model/InvoiceDto.java
0 → 100644
View file @
1fdef6e4
package
com
.
cftech
.
invoice
.
model
;
import
lombok.Data
;
/**
* 移动端开票所需传的参数
* @author BuYJ
*/
@Data
public
class
InvoiceDto
{
/**
* 订单ID 逗号隔开
*/
private
String
id
;
/**
* 抬头类型(0:个人 1:企业)
*/
private
String
type
;
/**
* 发票税号
*/
private
String
unitTaxNumber
;
/**
* 发票抬头
*/
private
String
invoiceTitle
;
/**
* 发票内容
*/
private
String
invoiceContent
;
/**
* 开票人ID
*/
private
String
openId
;
/**
* 邮箱
*/
private
String
email
;
private
String
appId
;
}
aidea-modules/invoice-module/src/main/java/com/cftech/invoice/service/InvoiceService.java
0 → 100644
View file @
1fdef6e4
package
com
.
cftech
.
invoice
.
service
;
import
com.cftech.invoice.model.Invoice
;
import
com.cftech.core.generic.GenericService
;
/**
* 开票信息Service
*
* @author Buyj
* @date: 2020-11-25 09:32
*/
public
interface
InvoiceService
extends
GenericService
<
Invoice
>
{
}
aidea-modules/invoice-module/src/main/java/com/cftech/invoice/service/impl/InvoiceServiceImpl.java
0 → 100644
View file @
1fdef6e4
package
com
.
cftech
.
invoice
.
service
.
impl
;
import
com.cftech.invoice.model.Invoice
;
import
com.cftech.invoice.dao.InvoiceMapper
;
import
com.cftech.invoice.service.InvoiceService
;
import
com.cftech.core.generic.GenericDao
;
import
com.cftech.core.generic.GenericServiceImpl
;
import
com.cftech.core.sql.Conds
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
/**
* 开票信息ServiceImpl
*
* @author Buyj
* @date: 2020-11-25 09:32
*/
@Service
(
"invoiceService"
)
public
class
InvoiceServiceImpl
extends
GenericServiceImpl
<
Invoice
>
implements
InvoiceService
{
@Autowired
@Qualifier
(
"invoiceMapper"
)
private
InvoiceMapper
invoiceMapper
;
@Override
public
GenericDao
<
Invoice
>
getGenericMapper
()
{
return
invoiceMapper
;
}
}
\ No newline at end of file
aidea-modules/invoice-module/src/main/java/com/cftech/invoice/web/InvoiceController.java
0 → 100644
View file @
1fdef6e4
package
com
.
cftech
.
invoice
.
web
;
import
com.alibaba.fastjson.JSONObject
;
import
com.cftech.invoice.model.Invoice
;
import
com.cftech.invoice.service.InvoiceService
;
import
com.cftech.core.poi.ExcelKit
;
import
com.cftech.core.scope.OrderType
;
import
com.cftech.core.sql.Conds
;
import
com.cftech.core.sql.Sort
;
import
com.cftech.core.util.Constants
;
import
com.cftech.sys.security.PermissionSign
;
import
com.cftech.sys.security.UserUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
/**
* 开票信息Controller
* <p>
* 权限字符串说明:
* 查看:public static final String INVOICE_VIEW = "qy:invoice:view"
* 查看:public static final String INVOICE_EDIT = "qy:invoice:edit"
*
* @author Buyj
* @date: 2020-11-25 09:32
*/
@Slf4j
@Controller
@RequestMapping
(
"/a/invoice"
)
public
class
InvoiceController
{
public
static
final
String
INVOICE_VIEW
=
"qy:invoice:view"
;
public
static
final
String
INVOICE_EDIT
=
"qy:invoice:edit"
;
@Autowired
private
InvoiceService
invoiceService
;
//列表页面
@RequiresPermissions
(
value
=
INVOICE_VIEW
)
@RequestMapping
(
"/list"
)
public
String
list
(
HttpServletRequest
request
,
Model
model
)
{
Long
accountId
=
UserUtils
.
getmpaccounts
(
request
);
model
.
addAttribute
(
"accountId"
,
accountId
);
return
"invoice/invoicelist"
;
}
//编辑页面(新增、修改)
@RequiresPermissions
(
value
=
INVOICE_VIEW
)
@RequestMapping
(
"/form"
)
public
String
form
(
HttpServletRequest
request
,
String
id
,
Model
model
)
{
if
(!
StringUtils
.
isEmpty
(
id
))
{
Invoice
invoice
=
invoiceService
.
fetchById
(
id
);
model
.
addAttribute
(
"data"
,
invoice
);
}
return
"invoice/invoiceform"
;
}
//提交数据(新增、修改)
@RequiresPermissions
(
value
=
INVOICE_EDIT
)
@RequestMapping
(
"/formData"
)
@ResponseBody
public
JSONObject
formData
(
Invoice
invoice
,
Model
model
,
HttpServletRequest
request
)
{
Long
accountsId
=
UserUtils
.
getmpaccounts
(
request
);
JSONObject
rtnJson
=
new
JSONObject
();
try
{
if
(
invoice
!=
null
&&
invoice
.
getId
()
!=
null
)
{
invoice
.
setUpdateBy
(
UserUtils
.
getUser
().
getId
());
invoiceService
.
update
(
invoice
);
rtnJson
.
put
(
"errorNo"
,
0
);
}
else
{
invoice
.
setAccountsId
(
accountsId
);
invoice
.
setDelFlag
(
false
);
invoice
.
setAccountsId
(
UserUtils
.
getmpaccounts
(
request
));
invoice
.
setCreateBy
(
UserUtils
.
getUser
().
getId
());
invoice
.
setUpdateBy
(
UserUtils
.
getUser
().
getId
());
invoiceService
.
save
(
invoice
);
rtnJson
.
put
(
"errorNo"
,
2
);
}
}
catch
(
Exception
e
)
{
rtnJson
.
put
(
"errorNo"
,
1
);
}
return
rtnJson
;
}
//获取列表数据
@RequiresPermissions
(
value
=
INVOICE_VIEW
)
@RequestMapping
(
value
=
"/listData"
)
@ResponseBody
public
JSONObject
listData
(
int
iDisplayStart
,
int
iDisplayLength
,
Invoice
invoice
,
HttpServletRequest
request
)
{
Long
accountsId
=
UserUtils
.
getmpaccounts
(
request
);
Conds
conds
=
new
Conds
();
conds
.
equal
(
"del_flag"
,
Constants
.
DEL_FLAG_0
);
conds
.
equal
(
"accounts_id"
,
accountsId
);
if
(!
StringUtils
.
isEmpty
(
invoice
.
getInvoiceTitle
())){
conds
.
like
(
"invoice_title"
,
invoice
.
getInvoiceTitle
());
}
Sort
sort
=
new
Sort
(
"create_time"
,
OrderType
.
DESC
);
List
<
Invoice
>
list
=
invoiceService
.
fetchSearchByPage
(
conds
,
sort
,
iDisplayStart
,
iDisplayLength
);
Integer
counts
=
invoiceService
.
count
(
conds
);
JSONObject
rtnJson
=
new
JSONObject
();
rtnJson
.
put
(
"iTotalRecords"
,
counts
);
rtnJson
.
put
(
"iTotalDisplayRecords"
,
counts
);
rtnJson
.
put
(
"aaData"
,
list
);
return
rtnJson
;
}
//删除数据
@RequiresPermissions
(
value
=
INVOICE_EDIT
)
@RequestMapping
(
"/delete"
)
@ResponseBody
public
JSONObject
delete
(
String
id
)
{
JSONObject
rtnJosn
=
new
JSONObject
();
try
{
invoiceService
.
delete
(
id
);
rtnJosn
.
put
(
"errorNo"
,
0
);
}
catch
(
Exception
e
)
{
rtnJosn
.
put
(
"errorNo"
,
1
);
}
return
rtnJosn
;
}
@RequestMapping
(
"/exportExcel"
)
@RequiresPermissions
(
value
=
INVOICE_VIEW
)
public
void
exportExcel
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Invoice
invoice
)
{
Long
accountId
=
UserUtils
.
getmpaccounts
(
request
);
Sort
sort
=
new
Sort
(
"create_time"
,
OrderType
.
ASC
);
Conds
conds
=
new
Conds
();
if
(!
StringUtils
.
isEmpty
(
invoice
.
getInvoiceTitle
())){
conds
.
like
(
"invoice_title"
,
invoice
.
getInvoiceTitle
());
}
conds
.
equal
(
"del_flag"
,
0
);
conds
.
equal
(
"accounts_id"
,
accountId
);
List
<
Invoice
>
list
=
invoiceService
.
fetchSearchByPage
(
conds
,
sort
,
0
,
0
);
if
(
list
.
size
()
>
0
){
for
(
Invoice
invoiceObj
:
list
)
{
invoiceObj
.
setInvoiceType
(
StringUtils
.
isEmpty
(
invoiceObj
.
getInvoiceType
())
?
""
:
invoiceObj
.
getInvoiceType
().
equals
(
"1"
)
?
"正票"
:
"红票"
);
invoiceObj
.
setInvoiceForm
(
StringUtils
.
isEmpty
(
invoiceObj
.
getInvoiceForm
())
?
""
:
invoiceObj
.
getInvoiceForm
().
equals
(
"0"
)
?
"移动端"
:
"后台"
);
invoiceObj
.
setPushMode
(
StringUtils
.
isEmpty
(
invoiceObj
.
getPushMode
())
?
""
:
"邮箱"
);
invoiceObj
.
setStatus
(
StringUtils
.
isEmpty
(
invoiceObj
.
getStatus
())
?
""
:
invoiceObj
.
getStatus
().
equals
(
"0"
)
?
"个人"
:
"企业"
);
}
}
ExcelKit
.
$Export
(
Invoice
.
class
,
response
).
toExcel
(
list
,
"开票信息信息"
);
}
@RequestMapping
(
"/templateExcel"
)
@RequiresPermissions
(
value
=
INVOICE_VIEW
)
public
void
templateExcel
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
ExcelKit
.
$Export
(
Invoice
.
class
,
response
).
toExcel
(
null
,
"开票信息信息"
);
}
@RequestMapping
(
"/importExcel"
)
@RequiresPermissions
(
value
=
INVOICE_EDIT
)
public
String
importExcel
(
HttpServletRequest
request
,
MultipartFile
file
,
Model
model
)
{
Long
accountId
=
UserUtils
.
getmpaccounts
(
request
);
if
(
file
==
null
)
{
return
list
(
request
,
model
);
}
// 构造临时路径来存储上传的文件
String
uploadPath
=
System
.
getProperty
(
"java.io.tmpdir"
);
File
uploadDir
=
new
File
(
uploadPath
);
if
(!
uploadDir
.
exists
())
{
uploadDir
.
mkdir
();
}
String
fileName
=
file
.
getOriginalFilename
();
String
filePath
=
uploadPath
+
File
.
separator
+
fileName
;
File
storeFile
=
new
File
(
filePath
);
try
{
file
.
transferTo
(
storeFile
);
ExcelKit
.
$Import
().
setEmptyCellValue
(
""
).
readExcel
(
storeFile
,
rowData
->
{
if
(!
StringUtils
.
isEmpty
(
rowData
.
get
(
0
)))
{
Invoice
invoice
=
new
Invoice
();
invoice
.
setAccountsId
(
accountId
);
invoiceService
.
save
(
invoice
);
}
});
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
());
}
return
list
(
request
,
model
);
}
}
aidea-modules/order-module-web/src/main/webapp/WEB-INF/views/order/orderlist.html
View file @
1fdef6e4
...
...
@@ -96,6 +96,28 @@
</ol>
</section>
<!-- 设置开发票推送的邮箱 -->
<div
id=
"peakButtom"
class=
"modal fade"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<h4
class=
"modal-title"
>
请填写邮箱
</h4>
</div>
<!-- dialog body -->
<div
class=
"modal-body"
>
<input
type=
"text"
class=
"form-control"
id=
"email"
name=
"email"
></input>
</div>
<div
style=
"text-align: center;padding-bottom: 20px;"
>
<button
style=
"width: 100px;"
type=
"button"
class=
"btn btn-primary"
onclick=
"exportInvoice()"
>
确定
</button>
<button
style=
"width: 100px;"
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
aria-label=
"Close"
>
取消
</button>
</div>
<!-- dialog buttons -->
</div>
</div>
</div>
<!-- Main content -->
<section
class=
"content"
>
...
...
@@ -184,6 +206,7 @@
#if($shiro.hasPermission("qy:order:edit"))
<!-- <a href="#springUrl('/a/order/form')" class="btn btn-primary">新增</a>-->
<button
type=
"submit"
class=
"btn btn-primary"
>
导出
</button>
<button
type=
"button"
class=
"abc btn btn-primary"
>
开发票
</button>
#end
<!-- <a onclick="importExcel();" class="btn btn-primary">导入</a>-->
...
...
@@ -194,7 +217,8 @@
<table
id=
"table"
class=
"table table-bordered table-striped"
>
<thead>
<tr>
<td
hidden=
"true"
>
Id
</td>
<!--<th><input hidden class='checkQyCode1' type="checkBox"></th>-->
<th><input
class=
'checkQyCode'
type=
"checkBox"
></th>
<th>
订单编码
</th>
<th>
咨询单编码
</th>
<th>
产品名称
</th>
...
...
@@ -254,6 +278,10 @@
<script
type=
"text/javascript"
src=
"plugins/jquery-validation/js/jquery.validate.min.js"
></script>
<!-- AdminLTE for demo purposes -->
<script>
var
csrfheader
=
{
name
:
'_csrf_header'
,
value
:
'${_csrf.headerName}'
};
var
csrftoken
=
{
name
:
'_csrf'
,
value
:
'${_csrf.token}'
};
</script>
<script
src=
"common/js/cfapp.js"
></script>
<script>
var
csrf
=
'${_csrf.token}'
;
...
...
@@ -265,6 +293,9 @@
$
(
'input[name="number"]'
).
val
(
`
${
orderCode
}
`
);
}
var
isCheckedQyCode
=
new
Array
();
var
str
=
0
;
//记录当前页面选中个数
var
len
=
0
;
//记录当前显示列表总记录数
function
formatDates
(
now
)
{
var
now
=
new
Date
(
now
);
var
year
=
now
.
getFullYear
();
...
...
@@ -389,9 +420,34 @@
],
"aoColumnDefs"
:
[
{
// set default column settings
'visible'
:
false
,
'targets'
:
[
0
]
//'visible': false,
'aTargets'
:
[
0
],
"mData"
:
"id"
,
"mRender"
:
function
(
a
,
b
,
c
,
d
){
if
(
c
.
status
==
4
){
if
(
isCheckedQyCode
.
indexOf
(
a
+
""
)
!=-
1
){
return
'<input class="isExport" checked value="'
+
a
+
'" type="checkBox">'
;
}
else
{
return
'<input class="isExport" value="'
+
a
+
'" type="checkBox">'
;
}
}
else
{
return
""
;
}
}
},
/*{
'targets': [1],
"mData":"id",
"mRender": function(a, b, c, d){
if(isCheckedQyCode.indexOf(a+"")!=-1){
return '<input class="isExport" checked value="'+a+'" type="checkBox">';
}else{
return '<input class="isExport" value="'+a+'" type="checkBox">';
}
}
},*/
{
"aTargets"
:
[
1
],
"mData"
:
"number"
,
...
...
@@ -583,6 +639,9 @@
if
(
c
.
status
!=
'4'
&&
c
.
status
!=
'5'
)
{
html
+=
'<li><a onclick="showModal('
+
a
+
')">订单关闭</a></li>'
;
}
/* if (c.status == 4){
html += '<li><a href="#springUrl("/a/order/invoice?id=' + a + '")">开发票</a></li>';
}*/
// if (c.status == '2') {//待发货才可以出库操作
// html += '
<
li
><
a
href
=
"#springUrl("
/
a
/
order
/
sendOut
?
id
=
' + a + '
")"
>
订单出库
<
/a></
li
>
';
// }
...
...
@@ -596,7 +655,46 @@
});
}
function
changeAllChecked
(){
var
flag
=
true
;
$
(
'#table tbody tr'
).
each
(
function
(){
if
(
!
$
(
this
).
find
(
'td'
).
find
(
'.isExport'
).
is
(
':checked'
)){
//没有选中
flag
=
false
;
return
false
;
}
})
if
(
flag
){
$
(
'.checkQyCode'
).
prop
(
"checked"
,
true
);
}
else
{
$
(
'.checkQyCode'
).
prop
(
"checked"
,
false
);
}
};
jQuery
(
document
).
ready
(
function
()
{
$
(
'.col-xs-12'
).
on
(
'click'
,
'.paginate_button'
,
function
()
{
//console.log('aaaaaaaaaaaaaa');
setTimeout
(
function
()
{
var
flag
=
true
;
$
(
'#table tbody tr'
).
each
(
function
(){
if
(
!
$
(
this
).
find
(
'td'
).
find
(
'.isExport'
).
is
(
':checked'
)){
//没有选中
flag
=
false
;
return
false
;
}
})
if
(
flag
){
$
(
'.checkQyCode'
).
prop
(
"checked"
,
true
);
}
else
{
$
(
'.checkQyCode'
).
prop
(
"checked"
,
false
);
}
},
400
)
len
=
0
;
str
=
0
;
});
seachTable
();
$
(
'.datepicker'
).
datepicker
({
show
:
true
,
...
...
@@ -610,6 +708,89 @@
$
(
'.search'
).
click
(
function
()
{
$
(
"#table"
).
dataTable
().
fnClearTable
();
});
//显示填写邮箱弹框
$
(
'.abc'
).
click
(
function
(){
$
(
"#peakButtom"
).
modal
(
'show'
);
})
changeAllChecked
();
$
(
'.checkQyCode'
).
prop
(
"checked"
,
false
);
//单选
$
(
'#table tbody'
).
on
(
"change"
,
"tr td .isExport"
,
function
(){
if
(
$
(
this
).
is
(
':checked'
)){
changeAllChecked
();
if
(
isCheckedQyCode
.
length
==
10
){
Cfapp
.
alert
({
message
:
"最多只能选中10条"
,
btntext
:
"确定"
,
success
:
function
()
{
}
})
$
(
'.checkQyCode'
).
prop
(
"checked"
,
false
);
$
(
this
).
prop
(
'checked'
,
false
);
}
else
{
isCheckedQyCode
.
push
(
$
(
this
).
val
());
}
}
else
{
isCheckedQyCode
.
splice
(
$
.
inArray
(
$
(
this
).
val
(),
isCheckedQyCode
),
1
);
changeAllChecked
();
}
})
//全选
$
(
'.checkQyCode'
).
change
(
function
(){
if
(
$
(
this
).
is
(
':checked'
)){
$
(
'#table tbody tr'
).
each
(
function
(){
if
(
$
(
this
).
find
(
"td"
).
find
(
".isExport"
).
is
(
':checked'
)){
str
++
;
}
len
++
;
})
//全部选中
$
(
'#table tbody tr'
).
each
(
function
(){
if
(
isCheckedQyCode
.
length
==
10
){
Cfapp
.
alert
({
message
:
"最多只能选中10条"
,
btntext
:
"确定"
,
success
:
function
()
{
if
(
str
!=
len
){
str
=
0
;
len
=
0
;
$
(
'.checkQyCode'
).
prop
(
"checked"
,
false
);
}
else
{
str
=
0
;
len
=
0
;
$
(
'.checkQyCode'
).
prop
(
"checked"
,
true
);
}
}
})
return
false
;
}
else
{
if
(
!
$
(
this
).
find
(
"td"
).
find
(
'.isExport'
).
is
(
':checked'
)){
//全选是 若没有选中则添加到数组
$
(
this
).
find
(
"td"
).
find
(
'.isExport'
).
prop
(
'checked'
,
true
);
isCheckedQyCode
.
push
(
$
(
this
).
find
(
"td"
).
find
(
".isExport"
).
val
());
str
++
;
}
}
//alert(isCheckedQyCode)
})
}
else
{
$
(
'#table tbody tr'
).
each
(
function
(){
$
(
this
).
find
(
"td"
).
find
(
'.isExport'
).
prop
(
'checked'
,
false
);
if
(
$
.
inArray
(
$
(
this
).
find
(
"td"
).
find
(
".isExport"
).
val
(),
isCheckedQyCode
)
!=
-
1
){
isCheckedQyCode
.
splice
(
$
.
inArray
(
$
(
this
).
find
(
"td"
).
find
(
".isExport"
).
val
(),
isCheckedQyCode
),
1
)
}
})
str
=
0
;
len
=
0
;
}
})
});
Cfapp
.
init
();
...
...
@@ -647,6 +828,71 @@
updateStatu
(
id
,
5
,
reason
);
}
//开发票
function
exportInvoice
(
data
)
{
var
qrCodeIds
=
isCheckedQyCode
.
join
(
","
);
var
email
=
$
(
"[name='email']"
).
val
();
$
(
'#peakButtom'
).
modal
(
'hide'
);
if
(
qrCodeIds
==
''
||
qrCodeIds
==
null
){
Cfapp
.
alert
({
message
:
"请勾选需求清单"
,
btntext
:
"确定"
,
success
:
function
()
{
}
});
return
;
}
if
(
email
==
''
||
email
==
null
){
Cfapp
.
alert
({
message
:
"请填写邮箱"
,
btntext
:
"确定"
,
success
:
function
()
{
}
});
return
;
}
$
.
ajax
({
type
:
"POST"
,
url
:
"#springUrl('/a/order/invoice')"
,
data
:
{
id
:
qrCodeIds
,
_csrfheader
:
csrfheader
.
value
,
_csrf
:
csrftoken
.
value
,
email
:
email
},
dataType
:
"json"
,
success
:
function
(
data
)
{
if
(
data
.
errorNo
==
0
)
{
Cfapp
.
alert
({
message
:
"开票成功"
,
btntext
:
"确定"
,
success
:
function
()
{
location
.
href
=
"#springUrl('/a/order/list')"
;
}
});
}
else
{
Cfapp
.
alert
({
message
:
"开票失败,失败原因:"
+
data
.
errorMsg
,
btntext
:
"确定"
,
success
:
function
()
{
location
.
href
=
"#springUrl('/a/order/list')"
;
}
});
}
},
error
:
function
()
{
}
})
/*Cfapp.confirm({
message: "确定要开发票吗",
btnoktext: "确定",
btncanceltext: "取消",
success: function () {
},
cancel: function () {
$(".modal-backdrop").fadeOut();
}
});*/
}
function
updateStatu
(
id
,
status
,
reason
)
{
var
url
=
"#springUrl('/a/order/updateStatus')"
$
.
ajax
({
...
...
aidea-modules/order-module/pom.xml
View file @
1fdef6e4
...
...
@@ -17,5 +17,22 @@
<artifactId>
order-detail-module
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.nuonuo
</groupId>
<artifactId>
open-sdk
</artifactId>
<version>
1.0.4.1
</version>
</dependency>
<dependency>
<groupId>
com.cftech
</groupId>
<artifactId>
invoice-module
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.cftech
</groupId>
<artifactId>
product-module
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
aidea-modules/order-module/src/main/java/com/cftech/order/dao/OrderMapper.xml
View file @
1fdef6e4
...
...
@@ -72,6 +72,11 @@
<result
column=
"address_des"
property=
"addressDes"
/>
<result
column=
"consultCode"
property=
"consultCode"
/>
<result
column=
"nickName"
property=
"nickName"
/>
<result
column=
"format"
property=
"format"
/>
<result
column=
"price"
property=
"price"
/>
<result
column=
"memberName"
property=
"memberName"
/>
<result
column=
"memberPhone"
property=
"memberPhone"
/>
<result
column=
"address"
property=
"address"
/>
<result
column=
"order_time"
property=
"orderTime"
/>
<result
column=
"cancel_time"
property=
"cancelTime"
/>
<result
column=
"sendExpressDateStr"
property=
"sendExpressDateStr"
/>
...
...
@@ -113,6 +118,8 @@
o.id,
o.openid,
t.product_number,
t.format,
t.price,
o.consult_id,
t.product_name,
o.number,
...
...
@@ -131,7 +138,10 @@
d.drugs_num,
o.courier_number,
o.address_des,
t.id as productId
t.id as productId,
CONVERT ( AES_DECRYPT( m.`name`, 'aideakey' ) USING UTF8 ) memberName,
CONVERT ( AES_DECRYPT( m.phone, 'aideakey' ) USING UTF8 ) memberPhone,
a.address
</sql>
<sql
id=
"sqlColumnFrom"
>
...
...
@@ -319,13 +329,19 @@
order_time,
cancel_time,
DATE_FORMAT(aw.send_express_date, '%Y-%m-%d %H:%i') sendExpressDateStr,
DATE_FORMAT(aw.accept_express_date, '%Y-%m-%d %H:%i') acceptExpressDateStr
DATE_FORMAT(aw.accept_express_date, '%Y-%m-%d %H:%i') acceptExpressDateStr,
t.id as productId,
CONVERT ( AES_DECRYPT( m.`name`, 'aideakey' ) USING UTF8 ) memberName,
CONVERT ( AES_DECRYPT( m.phone, 'aideakey' ) USING UTF8 ) memberPhone,
a.address
FROM t_order o
LEFT JOIN t_aidea_consult_sheet cs ON o.consult_id = cs.id
LEFT JOIN t_shipping_address s ON o.address_id = s.id
LEFT JOIN t_order_details d ON o.id = d.order_id
LEFT JOIN t_aidea_product t ON d.drugs_id = t.id
LEFT JOIN wx_mp_fanss f ON f.openid = o.openid
LEFT JOIN wx_mp_member m on m.open_id = o.openid
LEFT JOIN t_shipping_address a on a.id = o.address_id
LEFT JOIN t_aidea_waybill aw ON o.id = aw.order_id
<include
refid=
"sqlWhere"
/>
<if
test=
"userid != null"
>
AND (o.service_id = ${userid} or o.doctor_id =${userid} or o.clerk_id = ${userid})
</if>
...
...
aidea-modules/order-module/src/main/java/com/cftech/order/model/Order.java
View file @
1fdef6e4
...
...
@@ -16,6 +16,7 @@ import java.util.stream.Collectors;
* @author Licc
* @date: 2020-10-10 14:20
*/
@Data
public
class
Order
extends
OrderDetail
implements
Serializable
{
/* 主键id */
...
...
@@ -80,8 +81,8 @@ public class Order extends OrderDetail implements Serializable {
@ExportConfig
(
value
=
"订单员id"
,
width
=
100
,
showLevel
=
1
)
private
Long
clerkId
;
/* 创建时间 */
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
private
String
createTimeStr
;
/* 更新时间 */
private
Date
updateTime
;
...
...
@@ -99,12 +100,35 @@ public class Order extends OrderDetail implements Serializable {
private
Long
productId
;
/**
* 购方地址
*/
private
String
address
;
private
List
<
ProductVO
>
list
;
private
Date
cancelTime
;
/**
* 规格
*/
private
String
format
;
/**
* 商品单价
*/
private
Double
price
;
/**
* 会员名称
*/
private
String
memberName
;
/**
* 会员手机
*/
private
String
memberPhone
;
/**
* 搜索字段
*/
...
...
aidea-modules/order-module/src/main/java/com/cftech/order/service/OrderService.java
View file @
1fdef6e4
...
...
@@ -3,6 +3,7 @@ package com.cftech.order.service;
import
com.alibaba.fastjson.JSONObject
;
import
com.cftech.core.sql.Conds
;
import
com.cftech.core.sql.Sort
;
import
com.cftech.invoice.model.InvoiceDto
;
import
com.cftech.order.model.*
;
import
com.cftech.core.generic.GenericService
;
...
...
@@ -74,4 +75,11 @@ public interface OrderService extends GenericService<Order> {
* @param openid
*/
Integer
isThreeUsers
(
String
openid
);
/**
* 开票
* @param invoiceDto
* @return
*/
JSONObject
invoice
(
InvoiceDto
invoiceDto
);
}
aidea-modules/order-module/src/main/java/com/cftech/order/service/impl/OrderServiceImpl.java
View file @
1fdef6e4
package
com
.
cftech
.
order
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.cftech.accounts.model.MpAccountsEntity
;
import
com.cftech.accounts.service.MpAccountsService
;
import
com.cftech.core.sql.Sort
;
import
com.cftech.core.util.Constants
;
import
com.cftech.core.util.StringUtils
;
import
com.cftech.core.util.SystemConfig
;
import
com.cftech.invoice.model.Invoice
;
import
com.cftech.invoice.model.InvoiceDto
;
import
com.cftech.invoice.service.InvoiceService
;
import
com.cftech.order.model.*
;
import
com.cftech.order.dao.OrderMapper
;
import
com.cftech.order.service.OrderService
;
...
...
@@ -13,12 +19,14 @@ import com.cftech.core.generic.GenericDao;
import
com.cftech.core.generic.GenericServiceImpl
;
import
com.cftech.core.sql.Conds
;
import
com.cftech.order.utils.InvoiceUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.Serializable
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -40,6 +48,14 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
private
MpAccountsService
mpAccountsService
;
private
Order
orders
;
@Autowired
private
InvoiceUtil
invoiceUtil
;
@Autowired
private
InvoiceService
invoiceService
;
@Override
public
GenericDao
<
Order
>
getGenericMapper
()
{
return
orderMapper
;
...
...
@@ -274,4 +290,63 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
return
orderMapper
.
isThreeUsers
(
openid
);
}
@Override
public
JSONObject
invoice
(
InvoiceDto
invoiceDto
)
{
JSONObject
jsonObject
=
new
JSONObject
();
MpAccountsEntity
mpAccountsEntity
=
null
;
if
(
StringUtils
.
isNotBlank
(
invoiceDto
.
getAppId
())){
mpAccountsEntity
=
mpAccountsService
.
getMpAccountsAppid
(
invoiceDto
.
getAppId
());
}
else
{
jsonObject
.
put
(
"errorNo"
,
"2"
);
jsonObject
.
put
(
"errorMsg"
,
"appId不能为空"
);
return
jsonObject
;
}
try
{
Conds
conds
=
new
Conds
();
conds
.
in
(
"o.id"
,
invoiceDto
.
getId
().
split
(
","
));
conds
.
equal
(
"o.del_flag"
,
Constants
.
DEL_FLAG_0
);
List
<
Order
>
list
=
orderMapper
.
fetchSearchBy
(
conds
,
null
,
0
,
0
,
null
);
if
(
list
.
size
()
>
0
){
for
(
Order
order
:
list
){
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
order
.
setCreateTimeStr
(
format
.
format
(
order
.
getCreateTime
()));
String
str
=
invoiceUtil
.
startInvoice
(
order
,
order
.
getNickName
(),
invoiceDto
.
getEmail
(),
"0"
,
"0"
);
JSONObject
json
=
JSON
.
parseObject
(
str
);
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
json
.
getString
(
"code"
))
&&
json
.
getString
(
"code"
).
equals
(
"E0000"
)){
//开票成功 添加一条开票记录
//流水号
String
invoiceSerialNum
=
json
.
getJSONObject
(
"result"
).
getString
(
"invoiceSerialNum"
);
Invoice
invoice
=
new
Invoice
();
//发票抬头
if
(
invoiceDto
.
getType
().
equals
(
"1"
)){
//抬头类型为公司则设置发票抬头
invoice
.
setInvoiceTitle
(
invoiceDto
.
getInvoiceTitle
());
}
invoice
.
setInvoiceContent
(
invoiceDto
.
getInvoiceContent
());
invoice
.
setInvoiceType
(
"1"
);
invoice
.
setInvoiceForm
(
"1"
);
invoice
.
setClerkId
(
order
.
getMemberName
());
invoice
.
setOrderId
(
order
.
getNumber
());
invoice
.
setPushMode
(
"0"
);
invoice
.
setEmail
(
invoiceDto
.
getEmail
());
invoice
.
setStatus
(
"0"
);
invoice
.
setInvoiceSerialNum
(
invoiceSerialNum
);
invoice
.
setAccountsId
(
mpAccountsEntity
.
getId
());
invoiceService
.
save
(
invoice
);
jsonObject
.
put
(
"errorNo"
,
0
);
}
else
{
jsonObject
.
put
(
"errorNo"
,
1
);
jsonObject
.
put
(
"errorMsg"
,
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isEmpty
(
json
.
getString
(
"describe"
))
?
json
.
getString
(
"message"
)
:
json
.
getString
(
"describe"
));
}
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
jsonObject
.
put
(
"errorNo"
,
"1"
);
jsonObject
.
put
(
"errorMsg"
,
"程序异常"
);
}
return
jsonObject
;
}
}
\ No newline at end of file
aidea-modules/order-module/src/main/java/com/cftech/order/utils/InvoiceUtil.java
0 → 100644
View file @
1fdef6e4
package
com
.
cftech
.
order
.
utils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.cftech.core.util.SystemConfig
;
import
com.cftech.order.model.Order
;
import
com.cftech.product.model.Product
;
import
com.cftech.product.service.ProductService
;
import
lombok.extern.slf4j.Slf4j
;
import
nuonuo.open.sdk.NNOpenSDK
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.SimpleDateFormat
;
import
java.util.UUID
;
/**
* 开票工具类
* @author 13154
*/
@Component
@Slf4j
public
class
InvoiceUtil
{
@Autowired
private
ProductService
productService
;
/**
* 开票接口
* @param orderObj
* @param clerk 开票员
* @param email 邮箱
* @param type 0:
* @param from 0:移动端 1:后台
* @return
*/
public
String
startInvoice
(
Order
orderObj
,
String
clerk
,
String
email
,
String
type
,
String
from
){
NNOpenSDK
sdk
=
NNOpenSDK
.
getIntance
();
// 授权企业税号
String
taxNum
=
SystemConfig
.
p
.
getProperty
(
"INVOICE_TAX"
);
String
appKey
=
SystemConfig
.
p
.
getProperty
(
"APP_KEY"
);
String
appSecret
=
SystemConfig
.
p
.
getProperty
(
"APP_SECRET"
);
// API方法名
String
method
=
SystemConfig
.
p
.
getProperty
(
"INVOICE_API"
);
// 访问令牌
String
token
=
SystemConfig
.
p
.
getProperty
(
"INVOICE_TOKEN"
);
// SDK请求地址
String
url
=
SystemConfig
.
p
.
getProperty
(
"INVOICE_URL"
);
// 唯一标识,32位随机码,无需修改,保持默认即可
String
senId
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
JSONObject
order
=
new
JSONObject
();
order
.
put
(
"terminalNumber"
,
""
);
//购方电话 非必传
order
.
put
(
"buyerTel"
,
orderObj
.
getMemberPhone
());
//清单标志:非清单:0;清单:1,默认:0 非必传
order
.
put
(
"listFlag"
,
"0"
);
//推送方式:-1,不推送;0,邮箱;1,手机(默认);2,邮箱、手机 非必填
order
.
put
(
"pushMode"
,
"0"
);
//部门门店id(诺诺系统中的id) 非必填
order
.
put
(
"departmentId"
,
"9F7E9439CA8B4C60A2FFF3EA3290B088"
);
//开票员id(诺诺系统中的id) 非必填
order
.
put
(
"clerkId"
,
""
);
//备注 非必填
order
.
put
(
"remark"
,
""
);
//复核人 非必填
order
.
put
(
"checker"
,
SystemConfig
.
p
.
getProperty
(
"CHECKER"
));
//收款人 非必填
order
.
put
(
"payee"
,
SystemConfig
.
p
.
getProperty
(
"PAYEE"
));
//购方地址 非必填
order
.
put
(
"buyerAddress"
,
orderObj
.
getAddress
());
//购方税号(企业要填,个人可为空)
order
.
put
(
"buyerTaxNum"
,
""
);
//开票类型:1:蓝票;2:红票 必填
order
.
put
(
"invoiceType"
,
"1"
);
//发票种类:p,普通发票(电票)(默认);c,普通发票(纸票);s,专用发票;e,收购发票(电票);f,收购发票(纸质);r,普通发票(卷式) 非必填
order
.
put
(
"invoiceLine"
,
"p"
);
//推送邮箱(pushMode为0或2时,此项为必填) 必填
order
.
put
(
"email"
,
email
);
//销方银行账号和开户行地址 非必填
order
.
put
(
"salerAccount"
,
SystemConfig
.
p
.
getProperty
(
"KAIHUHANG_ADDRESS"
));
//销方电话 必填
order
.
put
(
"salerTel"
,
SystemConfig
.
p
.
getProperty
(
"SALER_TEL"
));
//订单号 (每个企业唯一) 必填
order
.
put
(
"orderNo"
,
"OD19980115"
);
//todo
// 开票完成回传发票信息地址 非必填
order
.
put
(
"callBackUrl"
,
"http:127.0.0.1/invoice/callback/"
);
// 购方名称 必填
if
(
type
.
equals
(
"0"
)){
order
.
put
(
"buyerName"
,
"个人"
);
}
else
{
order
.
put
(
"buyerName"
,
"企业名称"
);
}
// 订单时间 必填
order
.
put
(
"invoiceDate"
,
orderObj
.
getCreateTimeStr
());
//冲红时填写的对应蓝票发票代码(红票必填,不满12位请左补0) 非必填
order
.
put
(
"invoiceCode"
,
"125999915630"
);
//冲红时填写的对应蓝票发票号码(红票必填,不满8位请左补0) 非必填
order
.
put
(
"invoiceNum"
,
"00130865"
);
//销方地址 必填
order
.
put
(
"salerAddress"
,
SystemConfig
.
p
.
getProperty
(
"SALER_ADDRESS"
));
//开票员 必填
if
(
from
.
equals
(
"1"
)){
order
.
put
(
"clerk"
,
SystemConfig
.
p
.
getProperty
(
"CLERK"
));
}
else
{
order
.
put
(
"clerk"
,
clerk
);
}
//购方手机(pushMode为1或2时,此项为必填) 必填
order
.
put
(
"buyerPhone"
,
"18516234460"
);
//todo
//购方银行账号及开户行地址 非必填
order
.
put
(
"buyerAccount"
,
""
);
//成品油标志:非成品油(默认):0;成品油:1 非必填
order
.
put
(
"productOilFlag"
,
"0"
);
//分机号(只能为空或者数字) 非必填
order
.
put
(
"extensionNumber"
,
""
);
//销方税号(使用沙箱环境请求时消息体参数salerTaxNum和消息头参数userTax填写339901999999142) 必填
order
.
put
(
"salerTaxNum"
,
SystemConfig
.
p
.
getProperty
(
"INVOICE_TAX"
));
//清单项目名称:对应发票票面项目名称(listFlag为1时,必填,默认为“详见销货清单”) 非必填
order
.
put
(
"listName"
,
"详见销货清单"
);
//代开标志:0非代开;1代开。代开蓝票时备注要求填写文案:代开企业税号:***,代开企业名称:***;代开红票时备注要求填写文案:对应正数发票代码:***号码:***代开企业税号:***代开企业名称:*** 非必填
order
.
put
(
"proxyInvoiceFlag"
,
"0"
);
/* --------------------------------------------------商品详情-----------------------------------------------------**/
JSONObject
detail
=
null
;
JSONArray
detailArray
=
new
JSONArray
();
JSONArray
decArray
=
JSON
.
parseArray
(
orderObj
.
getDescription
());
//税率
BigDecimal
taxRate
=
new
BigDecimal
(
"0.13"
);
//商品含税单价
BigDecimal
price
=
null
;
//商品数量
BigDecimal
num
=
null
;
//不含税金额 不含税金额 = (商品含税单价*商品数量)/ (1+0.13)
BigDecimal
taxExcludedAmount
=
null
;
//税额 税额 = 不含税金额*税率
BigDecimal
tax
=
null
;
//含税金额 含税金额 = 不含税金额+税额
BigDecimal
taxIncludedAmount
=
null
;
for
(
int
i
=
0
;
i
<
decArray
.
size
();
i
++){
detail
=
new
JSONObject
();
JSONObject
jsonObject
=
decArray
.
getJSONObject
(
i
);
Product
product
=
productService
.
fetchById
(
jsonObject
.
getString
(
"productId"
));
price
=
new
BigDecimal
(
jsonObject
.
getString
(
"price"
));
num
=
new
BigDecimal
(
jsonObject
.
getString
(
"drugsNum"
));
taxExcludedAmount
=
(
price
.
multiply
(
num
)).
divide
(
new
BigDecimal
(
1
).
add
(
taxRate
),
2
,
RoundingMode
.
HALF_UP
);
tax
=
taxExcludedAmount
.
multiply
(
taxRate
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
taxIncludedAmount
=
taxExcludedAmount
.
add
(
tax
);
//规格型号 非必填
detail
.
put
(
"specType"
,
product
.
getFormat
());
// todo
// 不含税金额。红票为负。不含税金额、税额、含税金额任何一个不传时,会根据传入的单价,数量进行计算,可能和实际数值存在误差,建议都传入 非毕传
detail
.
put
(
"taxExcludedAmount"
,
taxExcludedAmount
.
toString
());
// 发票行性质:0,正常行;1,折扣行;2,被折扣行 非必填
detail
.
put
(
"invoiceLineProperty"
,
"0"
);
// 增值税特殊管理(优惠政策名称),当favouredPolicyFlag为1时,此项必填
detail
.
put
(
"favouredPolicyName"
,
"0"
);
//数量(开具红票时数量为负数) 非必填
detail
.
put
(
"num"
,
num
.
toString
());
//todo
//单价含税标志:0:不含税,1:含税 必填
detail
.
put
(
"withTaxFlag"
,
"1"
);
//税额,[不含税金额] * [税率] = [税额];税额允许误差为 0.06。红票为负。不含税金额、税额、含税金额任何一个不传时,会根据传入的单价,数量进行计算,可能和实际数值存在误差,建议都传入 非必填
//BigDecimal tax = new BigDecimal(orderObj.getPrice()).multiply(new BigDecimal(0.1));
detail
.
put
(
"tax"
,
tax
.
toString
());
//优惠政策标识:0,不使用;1,使用 非必填
detail
.
put
(
"favouredPolicyFlag"
,
"0"
);
//税率,注:纸票清单红票存在为null的情况 必填
detail
.
put
(
"taxRate"
,
"0.13"
);
//单位 非必填
detail
.
put
(
"unit"
,
product
.
getUnit
());
//todo
//扣除额,差额征收时填写,目前只支持填写一项。 注意:当传0、空或字段不传时,都表示非差额征税;传0.00才表示差额征税:0.00 非必填
detail
.
put
(
"deduction"
,
"0"
);
//单价,当单价(price)为空时,数量(num)也必须为空;(price)为空时,含税金额(taxIncludedAmount)、不含税金额(taxExcludedAmount)、税额(tax)都不能为空
detail
.
put
(
"price"
,
price
.
toString
());
//todo
//零税率标识 非必填
detail
.
put
(
"zeroRateFlag"
,
"0"
);
//商品编码(商品税收分类编码开发者自行填写)非必填
detail
.
put
(
"goodsCode"
,
"1090511030000000000"
);
//自行编码(可不填) 非必填
detail
.
put
(
"selfCode"
,
"130005426000000000"
);
//商品名称(如invoiceLineProperty =1,则此商品行为折扣行,折扣行不允许多行折扣,折扣行必须紧邻被折扣行,商品名称必须与被折扣行一致) 必填
detail
.
put
(
"goodsName"
,
product
.
getProductName
());
//todo
//含税金额,[不含税金额] + [税额] = [含税金额],红票为负。不含税金额、税额、含税金额任何一个不传时,会根据传入的单价,数量进行计算,可能和实际数值存在误差,建议都传入 非必填
//BigDecimal taxIncludedAmount = new BigDecimal(orderObj.getPrice()).add(tax);
detail
.
put
(
"taxIncludedAmount"
,
taxIncludedAmount
.
toString
());
detailArray
.
add
(
detail
);
}
order
.
put
(
"invoiceDetail"
,
detailArray
);
JSONObject
total
=
new
JSONObject
();
total
.
put
(
"order"
,
order
);
String
result
=
sdk
.
sendPostSyncRequest
(
url
,
senId
,
appKey
,
appSecret
,
token
,
taxNum
,
method
,
total
.
toString
());
log
.
error
(
result
);
return
result
;
}
}
aidea-modules/order-module/src/main/java/com/cftech/order/web/MobileOrderController.java
View file @
1fdef6e4
package
com
.
cftech
.
order
.
web
;
import
com.alibaba.fastjson.JSONObject
;
import
com.cftech.invoice.model.InvoiceDto
;
import
com.cftech.order.model.OrderMobileDto
;
import
com.cftech.order.service.OrderService
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -57,4 +58,15 @@ public class MobileOrderController {
public
JSONObject
orderList
(
OrderMobileDto
orderMobileDto
)
{
return
orderService
.
orderList
(
orderMobileDto
);
}
/**
* 开票接口
* @Author BuYJ
* @param invoiceDto
* @return
*/
@RequestMapping
(
value
=
"/invoice"
,
method
=
{
RequestMethod
.
POST
},
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
JSONObject
invoice
(
@RequestBody
InvoiceDto
invoiceDto
){
return
orderService
.
invoice
(
invoiceDto
);
}
}
aidea-modules/order-module/src/main/java/com/cftech/order/web/OrderController.java
View file @
1fdef6e4
package
com
.
cftech
.
order
.
web
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.cftech.core.util.SystemConfig
;
import
com.cftech.invoice.model.Invoice
;
import
com.cftech.invoice.service.InvoiceService
;
import
com.cftech.accounts.model.MpAccountsEntity
;
import
com.cftech.accounts.service.MpAccountsService
;
import
com.cftech.base.org.api.QyMsgUtil
;
...
...
@@ -20,6 +24,7 @@ import com.cftech.core.sql.Conds;
import
com.cftech.core.sql.Sort
;
import
com.cftech.core.util.Constants
;
import
com.cftech.order.utils.DoubleJSONFilter
;
import
com.cftech.order.utils.InvoiceUtil
;
import
com.cftech.orderdetail.web.OrderDetailsController
;
import
com.cftech.sys.security.UserUtils
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -38,7 +43,6 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.File
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -68,6 +72,12 @@ public class OrderController {
@Autowired
private
OrderDetailsController
orderDetailsController
;
@Autowired
private
InvoiceService
invoiceService
;
@Autowired
private
InvoiceUtil
invoiceUtil
;
@Autowired
private
MpAccountsService
accountsService
;
...
...
@@ -228,6 +238,58 @@ public class OrderController {
return
rtnJson
;
}
//开发票
@RequiresPermissions
(
value
=
ORDER_EDIT
)
@RequestMapping
(
"/invoice"
)
@ResponseBody
public
JSONObject
invoice
(
String
id
,
HttpServletRequest
request
,
String
email
){
JSONObject
jsonObject
=
new
JSONObject
();
Long
userid
=
UserUtils
.
getUser
().
getUserid
();
Long
accountsId
=
UserUtils
.
getmpaccounts
(
request
);
try
{
Conds
conds
=
new
Conds
();
conds
.
in
(
"o.id"
,
id
.
split
(
","
));
conds
.
equal
(
"o.del_flag"
,
Constants
.
DEL_FLAG_0
);
conds
.
equal
(
"o.accounts_id"
,
accountsId
);
List
<
Order
>
list
=
orderService
.
fetchSearchBy
(
conds
,
null
,
0
,
0
,
userid
);
if
(
list
.
size
()
>
0
){
for
(
Order
order
:
list
){
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
order
.
setCreateTimeStr
(
format
.
format
(
order
.
getCreateTime
()));
String
str
=
invoiceUtil
.
startInvoice
(
order
,
String
.
valueOf
(
userid
),
email
,
"0"
,
"1"
);
JSONObject
json
=
JSON
.
parseObject
(
str
);
if
(
StringUtils
.
isNotBlank
(
json
.
getString
(
"code"
))
&&
json
.
getString
(
"code"
).
equals
(
"E0000"
)){
//开票成功 添加一条开票记录
//流水号
String
invoiceSerialNum
=
json
.
getJSONObject
(
"result"
).
getString
(
"invoiceSerialNum"
);
Invoice
invoice
=
new
Invoice
();
//发票抬头
//invoice.setInvoiceTitle("0");
invoice
.
setInvoiceContent
(
"商品费用"
);
invoice
.
setInvoiceType
(
"1"
);
invoice
.
setInvoiceForm
(
"1"
);
invoice
.
setClerkId
(
SystemConfig
.
p
.
getProperty
(
"CLERK"
));
invoice
.
setOrderId
(
order
.
getNumber
());
invoice
.
setPushMode
(
"0"
);
invoice
.
setEmail
(
email
);
invoice
.
setStatus
(
"0"
);
invoice
.
setInvoiceSerialNum
(
invoiceSerialNum
);
invoice
.
setAccountsId
(
accountsId
);
invoiceService
.
save
(
invoice
);
jsonObject
.
put
(
"errorNo"
,
0
);
}
else
{
jsonObject
.
put
(
"errorNo"
,
1
);
jsonObject
.
put
(
"errorMsg"
,
StringUtils
.
isEmpty
(
json
.
getString
(
"describe"
))
?
json
.
getString
(
"message"
)
:
json
.
getString
(
"describe"
));
}
}
}
}
catch
(
Exception
e
)
{
jsonObject
.
put
(
"errorNo"
,
1
);
}
return
jsonObject
;
}
//删除数据
@RequiresPermissions
(
value
=
ORDER_EDIT
)
@RequestMapping
(
"/delete"
)
...
...
aidea-modules/pom.xml
View file @
1fdef6e4
...
...
@@ -32,6 +32,8 @@
<module>
waybill-module-web
</module>
<module>
authentication-module
</module>
<module>
authentication-module-web
</module>
<module>
invoice-module
</module>
<module>
invoice-module-web
</module>
</modules>
...
...
aidea-modules/product-module-web/src/main/webapp/WEB-INF/views/product/productform.html
View file @
1fdef6e4
...
...
@@ -208,6 +208,16 @@
name=
"price"
placeholder=
"价格"
>
</div>
<div
class=
"form-group form-md-line-input col-md-12"
>
<label>
单位
</label>
<select
name=
"unit"
class=
"form-control pull-right"
>
<option
label=
"盒"
value=
"盒"
>
盒
</option>
<option
label=
"瓶"
value=
"瓶"
#
if
($
data
.
unit =
=
'瓶')
selected
#
end
>
瓶
</option>
<option
label=
"包"
value=
"包"
#
if
($
data
.
unit =
=
'包')
selected
#
end
>
包
</option>
</select>
</div>
<input
type=
"hidden"
id=
"redingType"
name=
"redingType"
value=
"$!{data.isreading}"
/>
<input
type=
"hidden"
id=
"sizeType"
name=
"sizeType"
value=
"$!{data.size}"
/>
<div
class=
"form-group form-md-line-input col-md-12"
>
...
...
aidea-modules/product-module/src/main/java/com/cftech/product/dao/ProductMapper.xml
View file @
1fdef6e4
...
...
@@ -33,6 +33,7 @@
<result
column=
"reading"
property=
"reading"
/>
<result
column=
"size"
property=
"size"
/>
<result
column=
"isreading"
property=
"isreading"
/>
<result
column=
"unit"
property=
"unit"
/>
</resultMap>
<sql
id=
"sqlWhere"
>
...
...
@@ -92,7 +93,8 @@
is_rs,
reading,
size,
isreading
isreading,
unit
</sql>
<sql
id=
"productList"
>
...
...
@@ -159,7 +161,8 @@
#{isRs,jdbcType=VARCHAR},
#{reading,jdbcType=VARCHAR},
#{size, jdbcType=BIGINT},
#{isreading, jdbcType=BIGINT}
#{isreading, jdbcType=BIGINT},
#{unit,jdbcType=VARCHAR}
)
</insert>
...
...
@@ -347,6 +350,9 @@
<if
test=
"size != null"
>
size = #{size, jdbcType=BIGINT},
</if>
<if
test=
"unit != null"
>
unit = #{unit , jdbcType=VARCHAR},
</if>
<if
test=
"isreading != null"
>
isreading = #{isreading , jdbcType=BIGINT}
</if>
...
...
aidea-modules/product-module/src/main/java/com/cftech/product/model/Product.java
View file @
1fdef6e4
...
...
@@ -134,6 +134,10 @@ public class Product implements Serializable {
*/
@ExportConfig
(
value
=
"销量"
,
width
=
200
)
private
String
reading
;
/**
* 单位
*/
private
String
unit
;
/* 所属的账号 */
private
Long
accountsId
;
/* 删除标识 */
...
...
cftech-common-web/src/main/resources/common-test.properties
View file @
1fdef6e4
...
...
@@ -58,6 +58,24 @@ sf.checkWord=ExAMu7ADrjDeUMJCKOAf45Ywgo2q12Sd
#\u987A\u4E30\u6708\u7ED3\u5361\u53F7
sf.monthlyCard
=
7551234567
#INVOICE
INVOICE_TOKEN
=
4d02142a23eece11a0407f0sghefntms
SQ_INVOICE_TAX
=
91321000MA22HQQ953
INVOICE_TAX
=
339901999999824
SALER_TEL
=
0514-82360278
SALER_ADDRESS
=
\u
626C
\u
5DDE
\u
5E02
\u9097\u
6C5F
\u
533A
\u
79D1
\u6280\u
56ED
\u
8DEF18
\u
53F7
APP_KEY
=
SD76454598
APP_SECRET
=
SD25624CC1DF4AB7
KAIHUHANG_ADDRESS
=
\u
6C5F
\u
82CF
\u
94F6
\u
884C
\u
626C
\u
5DDE
\u5510\u
57CE
\u
652F
\u
884C 90160188000128434
CLERK
=
\u5415\u5029
CHECKER
=
\u7530\u
59DD
PAYEE
=
\u
6C6A
\u
8A00
\u
52C7
INVOICE_API
=
nuonuo.ElectronInvoice.requestBillingNew
INVOICE_URL
=
https://sandbox.nuonuocs.cn/open/v1/services
...
...
qy-modules/qy-orgunit-module-web/src/main/webapp/WEB-INF/views/managerqyuser/qyuserlist.html
View file @
1fdef6e4
...
...
@@ -502,7 +502,7 @@
success
:
function
()
{
$
.
ajax
({
"type"
:
"post"
,
"url"
:
setPeakValUrl
,
"url"
:
setPeakValUrl
,
"dataType"
:
"json"
,
"data"
:
{
id
:
$
(
"#peakId"
).
val
(),
peakVal
:
$
(
"#peakVal"
).
val
(),
_csrf_header
:
csrfheader
.
value
,
_csrf
:
csrftoken
.
value
},
//以json格式传递
"success"
:
function
(
data
)
{
...
...
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