Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
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
黄奎
Education
Commits
459087dd
Commit
459087dd
authored
Mar 30, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
教育合同
parent
5befc369
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1661 additions
and
3 deletions
+1661
-3
Config.cs
Edu.Common/Config.cs
+11
-0
ContractTypeEnum.cs
Edu.Common/Enum/Course/ContractTypeEnum.cs
+25
-0
StringHelper.cs
Edu.Common/Plugin/StringHelper.cs
+152
-0
ToPdfHelper.cs
Edu.Common/Plugin/ToPdfHelper.cs
+199
-0
RB_Education_Contract.cs
Edu.Model/Entity/Course/RB_Education_Contract.cs
+177
-0
RB_Order_Guest.cs
Edu.Model/Entity/Course/RB_Order_Guest.cs
+15
-0
RB_Group.cs
Edu.Model/Entity/User/RB_Group.cs
+15
-0
RB_Class_ViewModel.cs
Edu.Model/ViewModel/Course/RB_Class_ViewModel.cs
+5
-0
RB_Education_Contract_ViewModel.cs
...Model/ViewModel/Course/RB_Education_Contract_ViewModel.cs
+82
-0
RB_Order_ViewModel.cs
Edu.Model/ViewModel/Course/RB_Order_ViewModel.cs
+5
-0
RB_Account_ViewModel.cs
Edu.Model/ViewModel/User/RB_Account_ViewModel.cs
+5
-0
EducationContractModule.cs
Edu.Module.Course/EducationContractModule.cs
+274
-0
OrderModule.cs
Edu.Module.Course/OrderModule.cs
+132
-0
RB_ClassRepository.cs
Edu.Repository/Course/RB_ClassRepository.cs
+2
-1
RB_Education_ContractRepository.cs
Edu.Repository/Course/RB_Education_ContractRepository.cs
+141
-0
RB_Order_GuestRepository.cs
Edu.Repository/Course/RB_Order_GuestRepository.cs
+4
-0
RB_AccountRepository.cs
Edu.Repository/User/RB_AccountRepository.cs
+4
-0
EducationContractController.cs
Edu.WebApi/Controllers/Course/EducationContractController.cs
+273
-0
OrderController.cs
Edu.WebApi/Controllers/Course/OrderController.cs
+50
-0
UploadController.cs
Edu.WebApi/Controllers/Upload/UploadController.cs
+87
-0
appsettings.json
Edu.WebApi/appsettings.json
+3
-2
No files found.
Edu.Common/Config.cs
View file @
459087dd
...
...
@@ -242,6 +242,17 @@ namespace Edu.Common
}
}
/// <summary>
/// 获取wkhtmltopdf路径
/// </summary>
public
static
string
wkhtmltopdfConfig
{
get
{
return
ReadConfigKey
(
"WkHtmlToPdfPath"
);
}
}
/// <summary>
/// 上传文件预览站点
/// </summary>
...
...
Edu.Common/Enum/Course/ContractTypeEnum.cs
0 → 100644
View file @
459087dd
using
Edu.Common.Plugin
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Common.Enum.Course
{
/// <summary>
/// 合同类型枚举
/// </summary>
public
enum
ContractTypeEnum
{
/// <summary>
/// 培训
/// </summary>
[
EnumField
(
"培训"
)]
Train
=
1
,
/// <summary>
/// 留学
/// </summary>
[
EnumField
(
"留学"
)]
StudyAbroad
=
2
}
}
Edu.Common/Plugin/StringHelper.cs
View file @
459087dd
...
...
@@ -549,6 +549,158 @@ namespace Edu.Common.Plugin
}
#
endregion
#
region
金额相关
/// <summary>
/// 金额转中文大写金额
/// </summary>
/// <param name="LowerMoney"></param>
/// <returns></returns>
public
static
string
MoneyToUpper
(
string
LowerMoney
)
{
string
functionReturnValue
=
null
;
bool
IsNegative
=
false
;
// 是否是负数
if
(
LowerMoney
.
Trim
().
Substring
(
0
,
1
)
==
"-"
)
{
// 是负数则先转为正数
LowerMoney
=
LowerMoney
.
Trim
().
Remove
(
0
,
1
);
IsNegative
=
true
;
}
string
strLower
=
null
;
string
strUpart
=
null
;
string
strUpper
=
null
;
int
iTemp
=
0
;
// 保留两位小数 123.489→123.49 123.4→123.4
LowerMoney
=
Math
.
Round
(
double
.
Parse
(
LowerMoney
),
2
).
ToString
();
if
(
LowerMoney
.
IndexOf
(
"."
)
>
0
)
{
if
(
LowerMoney
.
IndexOf
(
"."
)
==
LowerMoney
.
Length
-
2
)
{
LowerMoney
+=
"0"
;
}
}
else
{
LowerMoney
+=
".00"
;
}
strLower
=
LowerMoney
;
iTemp
=
1
;
strUpper
=
""
;
while
(
iTemp
<=
strLower
.
Length
)
{
switch
(
strLower
.
Substring
(
strLower
.
Length
-
iTemp
,
1
))
{
case
"."
:
strUpart
=
"圆"
;
break
;
case
"0"
:
strUpart
=
"零"
;
break
;
case
"1"
:
strUpart
=
"壹"
;
break
;
case
"2"
:
strUpart
=
"贰"
;
break
;
case
"3"
:
strUpart
=
"叁"
;
break
;
case
"4"
:
strUpart
=
"肆"
;
break
;
case
"5"
:
strUpart
=
"伍"
;
break
;
case
"6"
:
strUpart
=
"陆"
;
break
;
case
"7"
:
strUpart
=
"柒"
;
break
;
case
"8"
:
strUpart
=
"捌"
;
break
;
case
"9"
:
strUpart
=
"玖"
;
break
;
}
strUpart
=
iTemp
switch
{
1
=>
strUpart
+
"分"
,
2
=>
strUpart
+
"角"
,
3
=>
strUpart
+
""
,
4
=>
strUpart
+
""
,
5
=>
strUpart
+
"拾"
,
6
=>
strUpart
+
"佰"
,
7
=>
strUpart
+
"仟"
,
8
=>
strUpart
+
"万"
,
9
=>
strUpart
+
"拾"
,
10
=>
strUpart
+
"佰"
,
11
=>
strUpart
+
"仟"
,
12
=>
strUpart
+
"亿"
,
13
=>
strUpart
+
"拾"
,
14
=>
strUpart
+
"佰"
,
15
=>
strUpart
+
"仟"
,
16
=>
strUpart
+
"万"
,
_
=>
strUpart
+
""
,
};
strUpper
=
strUpart
+
strUpper
;
iTemp
+=
1
;
}
strUpper
=
strUpper
.
Replace
(
"零拾"
,
"零"
);
strUpper
=
strUpper
.
Replace
(
"零佰"
,
"零"
);
strUpper
=
strUpper
.
Replace
(
"零仟"
,
"零"
);
strUpper
=
strUpper
.
Replace
(
"零零零"
,
"零"
);
strUpper
=
strUpper
.
Replace
(
"零零"
,
"零"
);
strUpper
=
strUpper
.
Replace
(
"零角零分"
,
"整"
);
strUpper
=
strUpper
.
Replace
(
"零分"
,
"整"
);
strUpper
=
strUpper
.
Replace
(
"零角"
,
"零"
);
strUpper
=
strUpper
.
Replace
(
"零亿零万零圆"
,
"亿圆"
);
strUpper
=
strUpper
.
Replace
(
"亿零万零圆"
,
"亿圆"
);
strUpper
=
strUpper
.
Replace
(
"零亿零万"
,
"亿"
);
strUpper
=
strUpper
.
Replace
(
"零万零圆"
,
"万圆"
);
strUpper
=
strUpper
.
Replace
(
"零亿"
,
"亿"
);
strUpper
=
strUpper
.
Replace
(
"零万"
,
"万"
);
strUpper
=
strUpper
.
Replace
(
"零圆"
,
"圆"
);
strUpper
=
strUpper
.
Replace
(
"零零"
,
"零"
);
// 对壹圆以下的金额的处理
if
(
strUpper
.
Substring
(
0
,
1
)
==
"圆"
)
{
strUpper
=
strUpper
[
1.
.];
}
if
(
strUpper
.
Substring
(
0
,
1
)
==
"零"
)
{
strUpper
=
strUpper
[
1.
.];
}
if
(
strUpper
.
Substring
(
0
,
1
)
==
"角"
)
{
strUpper
=
strUpper
[
1.
.];
}
if
(
strUpper
.
Substring
(
0
,
1
)
==
"分"
)
{
strUpper
=
strUpper
[
1.
.];
}
if
(
strUpper
.
Substring
(
0
,
1
)
==
"整"
)
{
strUpper
=
"零圆整"
;
}
functionReturnValue
=
strUpper
;
if
(
IsNegative
==
true
)
{
return
"负"
+
functionReturnValue
;
}
else
{
return
functionReturnValue
;
}
}
#
endregion
#
region
字符转换
...
...
Edu.Common/Plugin/ToPdfHelper.cs
0 → 100644
View file @
459087dd
using
System
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.IO
;
using
System.Net
;
using
System.Text
;
namespace
Edu.Common.Plugin
{
/// <summary>
/// 公共帮助类
/// </summary>
public
class
ToPdfHelper
{
/// <summary>
/// HtmlWJtoPdf
/// </summary>
/// <param name="path"></param>
/// <param name="url"></param>
/// <param name="noMargin"></param>
/// <param name="wkhtmltopdfConfig">工具路径</param>
/// <param name="headerHtmlPath">HeaderHTML路劲</param>
/// <param name="footerHtmlPath">HeaderHTML路劲</param>
/// <returns></returns>
public
bool
HtmlWJtoPdf
(
string
path
,
string
url
,
int
noMargin
=
0
,
string
wkhtmltopdfConfig
=
""
,
string
headerHtmlPath
=
""
,
string
footerHtmlPath
=
""
)
{
try
{
HtmlConvertToPdf
(
url
,
path
,
noMargin
,
wkhtmltopdfConfig
,
headerHtmlPath
,
footerHtmlPath
);
return
true
;
}
catch
(
Exception
)
{
return
false
;
}
}
/// <summary>
/// HTML转换为PDF
/// </summary>
/// <param name="htmlPath">可以是本地路径,也可以是网络地址</param>
/// <param name="savePath">PDF文件保存的路径</param>
/// <param name="noMargin">PDF文件保存的路径</param>
/// <param name="wkhtmltopdfConfig">工具路径</param>
/// <param name="headerHtmlPath">headerHtml路劲</param>
/// <param name="footerHtmlPath">footerHtml路劲</param>
/// <returns></returns>
public
bool
HtmlConvertToPdf
(
string
htmlPath
,
string
savePath
,
int
noMargin
,
string
wkhtmltopdfConfig
=
""
,
string
headerHtmlPath
=
""
,
string
footerHtmlPath
=
""
)
{
bool
flag
=
false
;
CheckFilePath
(
savePath
);
//这个路径为程序集的目录,因为我把应用程序 wkhtmltopdf.exe 放在了程序集同一个目录下
string
exePath
=
string
.
Empty
;
if
(
wkhtmltopdfConfig
==
""
)
{
exePath
=
Config
.
wkhtmltopdfConfig
+
"wkhtmltopdf.exe "
;
}
else
{
exePath
=
wkhtmltopdfConfig
+
"wkhtmltopdf.exe "
;
}
if
(!
File
.
Exists
(
exePath
))
{
throw
new
Exception
(
"No application wkhtmltopdf.exe was found."
);
}
try
{
ProcessStartInfo
processStartInfo
=
new
ProcessStartInfo
{
FileName
=
exePath
,
WorkingDirectory
=
Path
.
GetDirectoryName
(
exePath
),
UseShellExecute
=
false
,
CreateNoWindow
=
true
,
RedirectStandardInput
=
true
,
RedirectStandardOutput
=
true
,
RedirectStandardError
=
true
,
Arguments
=
GetArguments
(
htmlPath
,
savePath
,
noMargin
,
headerHtmlPath
,
footerHtmlPath
)
};
Process
process
=
new
Process
{
StartInfo
=
processStartInfo
};
process
.
Start
();
process
.
WaitForExit
(
6000
);
//用于查看是否返回错误信息
StreamReader
srone
=
process
.
StandardError
;
string
ss1
=
srone
.
ReadToEnd
();
srone
.
Close
();
srone
.
Dispose
();
process
.
Close
();
process
.
Dispose
();
flag
=
true
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"HtmlConvertToPdf"
);
flag
=
false
;
}
return
flag
;
}
/// <summary>
/// 获取命令行参数
/// </summary>
/// <param name="htmlPath"></param>
/// <param name="savePath"></param>
/// <param name="noMargin"></param>
/// <param name="headerHtmlPath">headerHTML路劲</param>
/// <param name="footerHtmlPath">footerHTML路劲</param>
/// <returns></returns>
private
string
GetArguments
(
string
htmlPath
,
string
savePath
,
int
noMargin
,
string
headerHtmlPath
=
""
,
string
footerHtmlPath
=
""
)
{
if
(
string
.
IsNullOrEmpty
(
htmlPath
))
{
throw
new
Exception
(
"HTML local path or network address can not be empty."
);
}
if
(
string
.
IsNullOrEmpty
(
savePath
))
{
throw
new
Exception
(
"The path saved by the PDF document can not be empty."
);
}
StringBuilder
stringBuilder
=
new
StringBuilder
();
//stringBuilder.Append(" --page-height 100 "); //页面高度100mm
//stringBuilder.Append(" --page-width 100 "); //页面宽度100mm
//stringBuilder.Append(" --header-center 我是页眉 "); //设置居中显示页眉
//stringBuilder.Append(" --header-line "); //页眉和内容之间显示一条直线
if
(
headerHtmlPath
!=
null
&&
!
string
.
IsNullOrEmpty
(
headerHtmlPath
))
{
//stringBuilder.Append(" --disable-smart-shrinking ");//禁止智能缩放
stringBuilder
.
Append
(
" --header-html "
+
headerHtmlPath
+
" "
);
}
if
(
footerHtmlPath
!=
null
&&
!
string
.
IsNullOrEmpty
(
footerHtmlPath
))
{
stringBuilder
.
Append
(
" --footer-html "
+
footerHtmlPath
+
" "
);
stringBuilder
.
Append
(
" --margin-left 5mm "
);
stringBuilder
.
Append
(
" --margin-right 5mm "
);
}
stringBuilder
.
Append
(
" --footer-left \""
+
DateTime
.
Now
.
ToString
(
"yyyy/MM/dd"
)
+
"\" "
);
//设置居中显示页脚
stringBuilder
.
Append
(
" --footer-right \"[page]/[topage]\" "
);
//设置居中显示页脚
stringBuilder
.
Append
(
" --footer-font-size 7 "
);
stringBuilder
.
Append
(
" --footer-spacing 5 "
);
if
(
noMargin
==
1
)
{
stringBuilder
.
Append
(
" --margin-left 0"
);
stringBuilder
.
Append
(
" --margin-right 0"
);
stringBuilder
.
Append
(
" --margin-top 0"
);
stringBuilder
.
Append
(
" --margin-bottom 0"
);
}
//stringBuilder.Append(" --footer-line "); //页脚和内容之间显示一条直线
stringBuilder
.
Append
(
" "
+
htmlPath
+
" "
);
//本地 HTML 的文件路径或网页 HTML 的URL地址
stringBuilder
.
Append
(
" "
+
savePath
+
" "
);
//生成的 PDF 文档的保存路径
return
stringBuilder
.
ToString
();
}
/// <summary>
/// 验证保存路径
/// </summary>
/// <param name="savePath"></param>
private
void
CheckFilePath
(
string
savePath
)
{
string
ext
=
string
.
Empty
;
string
path
=
string
.
Empty
;
string
fileName
=
string
.
Empty
;
ext
=
Path
.
GetExtension
(
savePath
);
if
(
string
.
IsNullOrEmpty
(
ext
)
||
ext
.
ToLower
()
!=
".pdf"
)
{
throw
new
Exception
(
"Extension error:This method is used to generate PDF files."
);
}
fileName
=
Path
.
GetFileName
(
savePath
);
if
(
string
.
IsNullOrEmpty
(
fileName
))
{
throw
new
Exception
(
"File name is empty."
);
}
try
{
path
=
savePath
.
Substring
(
0
,
savePath
.
IndexOf
(
fileName
));
if
(!
Directory
.
Exists
(
path
))
{
Directory
.
CreateDirectory
(
path
);
}
}
catch
{
throw
new
Exception
(
"The file path does not exist."
);
}
}
}
}
\ No newline at end of file
Edu.Model/Entity/Course/RB_Education_Contract.cs
0 → 100644
View file @
459087dd
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Course
;
using
VT.FW.DB
;
namespace
Edu.Model.Entity.Course
{
/// <summary>
/// 教育合同实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Education_Contract
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 合同类型:(1-培训 2-留学)
/// </summary>
public
ContractTypeEnum
CType
{
get
;
set
;
}
/// <summary>
/// 关联订单id
/// </summary>
public
int
OrderId
{
get
;
set
;
}
/// <summary>
/// 合同编号
/// </summary>
public
string
ContractNo
{
get
;
set
;
}
/// <summary>
/// 学生姓名
/// </summary>
public
string
StudentName
{
get
;
set
;
}
/// <summary>
/// 学校名称
/// </summary>
public
string
SchoolName
{
get
;
set
;
}
/// <summary>
/// 课程名称
/// </summary>
public
string
CourseName
{
get
;
set
;
}
/// <summary>
/// 课程内容
/// </summary>
public
string
CourseContent
{
get
;
set
;
}
/// <summary>
/// 大写金额
/// </summary>
public
string
CNYCaps
{
get
;
set
;
}
/// <summary>
/// 金额
/// </summary>
public
string
Money
{
get
;
set
;
}
/// <summary>
/// 乙方当前选择考试
/// </summary>
public
string
Exam
{
get
;
set
;
}
/// <summary>
/// 旅游代表签名
/// </summary>
public
string
Sign
{
get
;
set
;
}
/// <summary>
/// 集团编号
/// </summary>
public
int
Group_Id
{
get
;
set
;
}
/// <summary>
/// 学校id
/// </summary>
public
int
School_Id
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
int
CreateBy
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
CreateTime
{
get
;
set
;
}
/// <summary>
/// 修改人
/// </summary>
public
int
UpdateBy
{
get
;
set
;
}
/// <summary>
/// 修改时间
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
/// <summary>
/// 状态(0-草稿,1-提交审核,2-审核通过,3-驳回,4-取消)
/// </summary>
public
int
Status
{
get
;
set
;
}
/// <summary>
/// 是否盖章(0-未盖章,1-已盖章)
/// </summary>
public
int
IsCompanySeal
{
get
;
set
;
}
/// <summary>
/// 审核时间
/// </summary>
public
DateTime
?
AuditDate
{
get
;
set
;
}
/// <summary>
/// 签名时间
/// </summary>
public
DateTime
?
SignDate
{
get
;
set
;
}
/// <summary>
/// 盖章时间
/// </summary>
public
DateTime
?
SealDate
{
get
;
set
;
}
/// <summary>
/// 审核人
/// </summary>
public
int
AuditEmpId
{
get
;
set
;
}
/// <summary>
/// 学生名单id
/// </summary>
public
int
GuestId
{
get
;
set
;
}
/// <summary>
/// 性别 1男 2女 0未设置
/// </summary>
public
int
Sex
{
get
;
set
;
}
/// <summary>
/// 身份证
/// </summary>
public
string
IDCard
{
get
;
set
;
}
/// <summary>
/// 身份证居住地
/// </summary>
public
string
Domicile
{
get
;
set
;
}
/// <summary>
/// 联系地址
/// </summary>
public
string
ContactAddress
{
get
;
set
;
}
/// <summary>
/// 联系电话
/// </summary>
public
string
ContactMobile
{
get
;
set
;
}
/// <summary>
/// 紧急联系人
/// </summary>
public
string
EmergencyContact
{
get
;
set
;
}
/// <summary>
/// 紧急联系电话
/// </summary>
public
string
EmergencyMobile
{
get
;
set
;
}
}
}
Edu.Model/Entity/Course/RB_Order_Guest.cs
View file @
459087dd
...
...
@@ -125,5 +125,20 @@ namespace Edu.Model.Entity.Course
/// 退课备注
/// </summary>
public
string
DropOutRemark
{
get
;
set
;
}
/// <summary>
/// 身份证
/// </summary>
public
string
IDCard
{
get
;
set
;
}
/// <summary>
/// 身份证居住地
/// </summary>
public
string
Domicile
{
get
;
set
;
}
/// <summary>
/// 联系地址
/// </summary>
public
string
ContactAddress
{
get
;
set
;
}
}
}
Edu.Model/Entity/User/RB_Group.cs
View file @
459087dd
...
...
@@ -80,5 +80,20 @@ namespace Edu.Model.Entity.User
/// 更新时间
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
/// <summary>
/// 印章图片
/// </summary>
public
string
SealImage
{
get
;
set
;
}
/// <summary>
/// 合同公司名称
/// </summary>
public
string
ContractBranch
{
get
;
set
;
}
/// <summary>
/// 法定代表人
/// </summary>
public
string
LegalPerson
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Course/RB_Class_ViewModel.cs
View file @
459087dd
...
...
@@ -34,6 +34,11 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public
string
CourseName
{
get
;
set
;
}
/// <summary>
/// 课程分类
/// </summary>
public
string
CateName
{
get
;
set
;
}
/// <summary>
/// 助教名称
/// </summary>
...
...
Edu.Model/ViewModel/Course/RB_Education_Contract_ViewModel.cs
0 → 100644
View file @
459087dd
using
Edu.Model.Entity.Course
;
using
System.Collections.Generic
;
namespace
Edu.Model.ViewModel.Course
{
/// <summary>
/// 教育合同视图实体类
/// </summary>
public
class
RB_Education_Contract_ViewModel
:
RB_Education_Contract
{
/// <summary>
/// 创建人
/// </summary>
public
string
CreateByName
{
get
;
set
;
}
/// <summary>
/// 创建人头像
/// </summary>
public
string
CreateByPhoto
{
get
;
set
;
}
/// <summary>
/// 公司章
/// </summary>
public
string
CompanySealImage
{
get
;
set
;
}
/// <summary>
/// 合同公司名称
/// </summary>
public
string
ContractBranch
{
get
;
set
;
}
/// <summary>
/// 合同电话
/// </summary>
public
string
ContractTel
{
get
;
set
;
}
/// <summary>
/// 公司名称
/// </summary>
public
string
BranchName
{
get
;
set
;
}
/// <summary>
/// 法人代表
/// </summary>
public
string
LegalPerson
{
get
;
set
;
}
/// <summary>
/// 公司列表
/// </summary>
public
List
<
string
>
BranchNList
{
get
;
set
;
}
/// <summary>
/// 学生名单ids
/// </summary>
public
string
GuestIds
{
get
;
set
;
}
/// <summary>
/// 订单ids
/// </summary>
public
string
OrderIds
{
get
;
set
;
}
/// <summary>
/// 合同状态
/// </summary>
public
string
StatusStr
{
get
{
//状态(0-草稿,1-提交审核,2-审核通过,3-驳回)
string
str
=
""
;
switch
(
this
.
Status
)
{
case
0
:
str
=
"草稿"
;
break
;
case
1
:
str
=
"提交审核"
;
break
;
case
2
:
str
=
"审核通过"
;
break
;
case
3
:
str
=
"驳回"
;
break
;
case
4
:
str
=
"取消"
;
break
;
}
return
str
;
}
}
}
}
Edu.Model/ViewModel/Course/RB_Order_ViewModel.cs
View file @
459087dd
...
...
@@ -79,6 +79,11 @@ namespace Edu.Model.ViewModel.Course
/// 客人列表
/// </summary>
public
List
<
RB_Order_Guest_ViewModel
>
GuestList
{
get
;
set
;
}
/// <summary>
/// 合同列表
/// </summary>
public
List
<
RB_Education_Contract_ViewModel
>
ContractList
{
get
;
set
;
}
/// <summary>
/// 报名开始时间
/// </summary>
...
...
Edu.Model/ViewModel/User/RB_Account_ViewModel.cs
View file @
459087dd
...
...
@@ -13,6 +13,11 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public
string
AccountName
{
get
;
set
;
}
/// <summary>
/// 账号ids
/// </summary>
public
string
QIds
{
get
;
set
;
}
/// <summary>
/// 集团名称
/// </summary>
...
...
Edu.Module.Course/EducationContractModule.cs
0 → 100644
View file @
459087dd
This diff is collapsed.
Click to expand it.
Edu.Module.Course/OrderModule.cs
View file @
459087dd
...
...
@@ -75,6 +75,10 @@ namespace Edu.Module.Course
/// 账号
/// </summary>
private
readonly
RB_AccountRepository
accountRepository
=
new
RB_AccountRepository
();
/// <summary>
/// 合同
/// </summary>
private
readonly
RB_Education_ContractRepository
education_ContractRepository
=
new
RB_Education_ContractRepository
();
#
region
日语培训
...
...
@@ -505,6 +509,8 @@ namespace Edu.Module.Course
var
remarkList
=
order_RemarkRepository
.
GetList
(
new
RB_Order_Remark_ViewModel
()
{
},
orderIds
);
//获取名单列表
var
guestList
=
order_GuestRepository
.
GetList
(
new
RB_Order_Guest_ViewModel
()
{
OrderIds
=
orderIds
});
//获取合同列表
var
clist
=
education_ContractRepository
.
GetList
(
new
RB_Education_Contract_ViewModel
()
{
Group_Id
=
groupId
,
OrderIds
=
orderIds
,
Status
=
-
1
}).
Where
(
x
=>
x
.
Status
!=
4
).
ToList
();
foreach
(
var
item
in
orderList
)
{
item
.
SaleRemarkList
=
remarkList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
&&
x
.
Type
==
1
).
ToList
();
item
.
TeacherRemarkList
=
remarkList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
&&
x
.
Type
==
2
).
ToList
();
...
...
@@ -512,6 +518,22 @@ namespace Edu.Module.Course
item
.
DirectorRemarkList
=
remarkList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
&&
x
.
Type
==
4
).
ToList
();
item
.
GuestList
=
guestList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
ToList
();
item
.
ContractList
=
clist
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
ToList
();
var
ZList
=
item
.
GuestList
.
Where
(
x
=>
!
item
.
ContractList
.
Select
(
z
=>
z
.
GuestId
).
Contains
(
x
.
Id
)).
ToList
();
if
(
ZList
.
Any
()
&&
item
.
ContractList
.
Any
())
{
foreach
(
var
qitem
in
ZList
)
{
item
.
ContractList
.
Add
(
new
RB_Education_Contract_ViewModel
()
{
Id
=
0
,
StudentName
=
qitem
.
GuestName
,
ContractNo
=
""
,
GuestId
=
qitem
.
Id
,
Status
=
0
});
}
}
}
}
ClassInfo
=
new
...
...
@@ -1029,6 +1051,21 @@ namespace Edu.Module.Course
{
LogContent
+=
",性别由【"
+
gModel
.
Sex
+
"】修改为【"
+
dmodel
.
Sex
+
"】"
;
}
gModel
.
IDCard
=
dmodel
.
IDCard
;
if
(
gModel
.
IDCard
!=
dmodel
.
IDCard
)
{
LogContent
+=
",身份证由【"
+
gModel
.
IDCard
+
"】修改为【"
+
dmodel
.
IDCard
+
"】"
;
}
gModel
.
Domicile
=
dmodel
.
Domicile
;
if
(
gModel
.
Domicile
!=
dmodel
.
Domicile
)
{
LogContent
+=
",身份证居住地由【"
+
gModel
.
Domicile
+
"】修改为【"
+
dmodel
.
Domicile
+
"】"
;
}
gModel
.
ContactAddress
=
dmodel
.
ContactAddress
;
if
(
gModel
.
ContactAddress
!=
dmodel
.
ContactAddress
)
{
LogContent
+=
",联系地址由【"
+
gModel
.
ContactAddress
+
"】修改为【"
+
dmodel
.
ContactAddress
+
"】"
;
}
gModel
.
UpdateTime
=
dmodel
.
UpdateTime
;
bool
flag
=
order_GuestRepository
.
Update
(
gModel
);
if
(
flag
)
...
...
@@ -1225,6 +1262,8 @@ namespace Edu.Module.Course
var
remarkList
=
order_RemarkRepository
.
GetList
(
new
RB_Order_Remark_ViewModel
()
{
},
orderIds
);
//获取名单列表
var
guestList
=
order_GuestRepository
.
GetList
(
new
RB_Order_Guest_ViewModel
()
{
OrderIds
=
orderIds
});
//获取合同列表
var
clist
=
education_ContractRepository
.
GetList
(
new
RB_Education_Contract_ViewModel
()
{
Group_Id
=
demodel
.
Group_Id
,
OrderIds
=
orderIds
,
Status
=
-
1
}).
Where
(
x
=>
x
.
Status
!=
4
).
ToList
();
foreach
(
var
item
in
orderList
)
{
item
.
SaleRemarkList
=
remarkList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
&&
x
.
Type
==
1
).
ToList
();
...
...
@@ -1233,6 +1272,20 @@ namespace Edu.Module.Course
item
.
DirectorRemarkList
=
remarkList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
&&
x
.
Type
==
4
).
ToList
();
item
.
GuestList
=
guestList
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
ToList
();
item
.
ContractList
=
clist
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
ToList
();
var
ZList
=
item
.
GuestList
.
Where
(
x
=>
!
item
.
ContractList
.
Select
(
z
=>
z
.
GuestId
).
Contains
(
x
.
Id
)).
ToList
();
if
(
ZList
.
Any
()
&&
item
.
ContractList
.
Any
())
{
foreach
(
var
qitem
in
ZList
)
{
item
.
ContractList
.
Add
(
new
RB_Education_Contract_ViewModel
()
{
Id
=
0
,
StudentName
=
qitem
.
GuestName
,
ContractNo
=
""
,
GuestId
=
qitem
.
Id
,
Status
=
0
});
}
}
}
}
return
orderList
;
...
...
@@ -1246,6 +1299,85 @@ namespace Edu.Module.Course
public
RB_Order_ViewModel
GetMyOrderStatistics
(
RB_Order_ViewModel
demodel
)
{
return
orderRepository
.
GetMyOrderStatistics
(
demodel
);
}
/// <summary>
/// 订单领取合同
/// </summary>
/// <param name="orderId"></param>
/// <param name="guestId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
bool
SetOrderReceiveContract
(
int
orderId
,
int
guestId
,
UserInfo
userInfo
)
{
var
glist
=
order_GuestRepository
.
GetList
(
new
RB_Order_Guest_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
Id
=
guestId
,
OrderId
=
orderId
,
GuestState
=
1
});
if
(
glist
.
Any
())
{
//订单信息
var
omodel
=
orderRepository
.
GetEntity
(
orderId
);
decimal
Money
=
(
omodel
.
PreferPrice
-
omodel
.
DiscountMoney
)
/
glist
.
Count
();
//平均每人费用 (看是否根据订单单价)
string
dxMoney
=
StringHelper
.
MoneyToUpper
(
Money
.
ToString
());
//班级信息
var
classmodel
=
classRepository
.
GetClassAndCourseListRepository
(
new
RB_Class_ViewModel
()
{
ClassId
=
omodel
.
ClassId
}).
FirstOrDefault
();
string
newContractNum
=
"JH-CD0018"
;
var
totalCount
=
education_ContractRepository
.
GetContractCount
(
new
RB_Education_Contract_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
});
//查询已有合同的
string
guestIds
=
string
.
Join
(
","
,
glist
.
Select
(
x
=>
x
.
Id
));
var
clist
=
education_ContractRepository
.
GetList
(
new
RB_Education_Contract_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
OrderId
=
orderId
,
GuestIds
=
guestIds
,
Status
=
-
1
}).
Where
(
x
=>
x
.
Status
!=
4
).
ToList
();
foreach
(
var
item
in
glist
)
{
var
cmodel
=
clist
.
Where
(
x
=>
x
.
GuestId
==
item
.
Id
).
FirstOrDefault
();
if
(
cmodel
==
null
)
{
totalCount
+=
1
;
string
num
=
totalCount
.
ToString
();
switch
(
num
.
Length
)
{
case
1
:
num
=
"00000"
+
num
;
break
;
case
2
:
num
=
"0000"
+
num
;
break
;
case
3
:
num
=
"000"
+
num
;
break
;
case
4
:
num
=
"00"
+
num
;
break
;
case
5
:
num
=
"0"
+
num
;
break
;
}
string
ContractNo
=
newContractNum
+
num
;
education_ContractRepository
.
Insert
(
new
Model
.
Entity
.
Course
.
RB_Education_Contract
()
{
Id
=
0
,
GuestId
=
item
.
Id
,
ContractNo
=
ContractNo
,
CreateBy
=
userInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
CType
=
ContractTypeEnum
.
Train
,
Exam
=
""
,
Group_Id
=
userInfo
.
Group_Id
,
IsCompanySeal
=
0
,
CNYCaps
=
dxMoney
,
Money
=
Money
.
ToString
(),
OrderId
=
orderId
,
CourseName
=
classmodel
.
CateName
,
CourseContent
=
classmodel
.
CourseName
,
SchoolName
=
classmodel
.
SchoolName
,
School_Id
=
classmodel
.
School_Id
,
Sign
=
""
,
Status
=
0
,
StudentName
=
item
.
GuestName
,
UpdateBy
=
userInfo
.
Id
,
UpdateTime
=
DateTime
.
Now
,
ContactAddress
=
item
.
ContactAddress
,
Domicile
=
item
.
Domicile
,
IDCard
=
item
.
IDCard
,
ContactMobile
=
item
.
Mobile
,
EmergencyContact
=
item
.
Contact
,
EmergencyMobile
=
item
.
ContactMobile
,
Sex
=
item
.
Sex
});
}
}
}
return
true
;
}
#
endregion
#
region
订单操作
...
...
Edu.Repository/Course/RB_ClassRepository.cs
View file @
459087dd
...
...
@@ -67,8 +67,9 @@ WHERE 1=1
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*,B.CourseName,D.TeacherName,IFNULL(D.TeacherHead,'') AS TeacherHead ,E.SName AS SchoolName
SELECT A.*,B.CourseName,D.TeacherName,IFNULL(D.TeacherHead,'') AS TeacherHead ,E.SName AS SchoolName
,c.CateName
FROM rb_class AS A LEFT JOIN rb_course AS B ON A.CouseId=B.CourseId
left join rb_course_category c on b.CateId = c.CateId
LEFT JOIN rb_teacher AS D ON A.Teacher_Id=D.TId
LEFT JOIN rb_school AS E ON A.School_Id=E.SId
WHERE 1=1
...
...
Edu.Repository/Course/RB_Education_ContractRepository.cs
0 → 100644
View file @
459087dd
using
Edu.Common.Enum
;
using
Edu.Model.Entity.Course
;
using
Edu.Model.ViewModel.Course
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VT.FW.DB.Dapper
;
namespace
Edu.Repository.Course
{
/// <summary>
/// 教育合同仓储层
/// </summary>
public
class
RB_Education_ContractRepository
:
BaseRepository
<
RB_Education_Contract
>
{
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="demodel"></param>
/// <param name="orderIds"></param>
/// <returns></returns>
public
List
<
RB_Education_Contract_ViewModel
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Education_Contract_ViewModel
demodel
)
{
string
where
=
$@" 1=1"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(
demodel
.
School_Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
School_Id
)}
=
{
demodel
.
School_Id
}
"
;
}
if
(
demodel
.
OrderId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
OrderId
)}
=
{
demodel
.
OrderId
}
"
;
}
if
(
demodel
.
CType
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
CType
)}
=
{(
int
)
demodel
.
CType
}
"
;
}
if
(
demodel
.
Status
>=
0
)
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
Status
)}
=
{
demodel
.
Status
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ContractNo
))
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
ContractNo
)}
like '%
{
demodel
.
ContractNo
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
StudentName
))
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
StudentName
)}
like '%
{
demodel
.
StudentName
}
%'"
;
}
string
sql
=
$@" select * from RB_Education_Contract where
{
where
}
order by Id desc"
;
return
GetPage
<
RB_Education_Contract_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <param name="orderIds"></param>
/// <returns></returns>
public
List
<
RB_Education_Contract_ViewModel
>
GetList
(
RB_Education_Contract_ViewModel
demodel
)
{
string
where
=
$@" 1=1"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(
demodel
.
School_Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
School_Id
)}
=
{
demodel
.
School_Id
}
"
;
}
if
(
demodel
.
OrderId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
OrderId
)}
=
{
demodel
.
OrderId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
OrderIds
))
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
OrderId
)}
in(
{
demodel
.
OrderIds
}
)"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
GuestIds
))
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
GuestId
)}
in(
{
demodel
.
GuestIds
}
)"
;
}
if
(
demodel
.
CType
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
CType
)}
=
{(
int
)
demodel
.
CType
}
"
;
}
if
(
demodel
.
Status
>=
0
)
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
Status
)}
=
{
demodel
.
Status
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ContractNo
))
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
ContractNo
)}
like '%
{
demodel
.
ContractNo
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
StudentName
))
{
where
+=
$@" and
{
nameof
(
RB_Education_Contract_ViewModel
.
StudentName
)}
like '%
{
demodel
.
StudentName
}
%'"
;
}
string
sql
=
$@" select * from RB_Education_Contract where
{
where
}
order by Id desc"
;
return
Get
<
RB_Education_Contract_ViewModel
>(
sql
).
ToList
();
}
/// <summary>
/// 根据查询条件获取合同的总条数
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public
int
GetContractCount
(
RB_Education_Contract_ViewModel
where
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT COUNT(1) FROM RB_Education_Contract WHERE 1=1
"
);
if
(
where
!=
null
)
{
if
(
where
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
$" and
{
nameof
(
RB_Education_Contract_ViewModel
.
Group_Id
)}
=
{
where
.
Group_Id
}
"
);
}
if
(
where
.
ContractNo
!=
null
&&
!
string
.
IsNullOrEmpty
(
where
.
ContractNo
.
Trim
()))
{
builder
.
AppendFormat
(
" AND ContractNo LIKE '%{0}%' "
,
where
.
ContractNo
.
Trim
());
}
}
var
obj
=
base
.
ExecuteScalar
(
builder
.
ToString
());
return
obj
==
null
?
0
:
Convert
.
ToInt32
(
obj
);
}
}
}
Edu.Repository/Course/RB_Order_GuestRepository.cs
View file @
459087dd
...
...
@@ -30,6 +30,10 @@ namespace Edu.Repository.Course
{
where
+=
$@" and
{
nameof
(
RB_Order_Guest_ViewModel
.
School_Id
)}
=
{
demodel
.
School_Id
}
"
;
}
if
(
demodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Order_Guest_ViewModel
.
Id
)}
=
{
demodel
.
Id
}
"
;
}
if
(
demodel
.
OrderId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Order_Guest_ViewModel
.
OrderId
)}
=
{
demodel
.
OrderId
}
"
;
...
...
Edu.Repository/User/RB_AccountRepository.cs
View file @
459087dd
...
...
@@ -87,6 +87,10 @@ WHERE 1=1
{
where
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Account_ViewModel
.
Id
),
query
.
Id
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QIds
))
{
where
.
AppendFormat
(
" AND A.{0} IN({1}) "
,
nameof
(
RB_Account_ViewModel
.
Id
),
query
.
QIds
);
}
if
(
query
.
AccountId
>
0
)
{
where
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Account_ViewModel
.
AccountId
),
query
.
AccountId
);
...
...
Edu.WebApi/Controllers/Course/EducationContractController.cs
0 → 100644
View file @
459087dd
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
Edu.Cache.User
;
using
Edu.Common.API
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Plugin
;
using
Edu.Model.ViewModel.Course
;
using
Edu.Model.ViewModel.Log
;
using
Edu.Module.Course
;
using
Edu.WebApi.Filter
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json.Linq
;
namespace
Edu.WebApi.Controllers.Course
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
EducationContractController
:
BaseController
{
/// <summary>
/// 教育合同处理类对象
/// </summary>
private
readonly
EducationContractModule
educationContractModule
=
AOP
.
AOPHelper
.
CreateAOPObject
<
EducationContractModule
>();
#
region
合同列表
/// <summary>
/// 获取合同分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetEducationContractPageList
()
{
var
userInfo
=
base
.
UserInfo
;
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_Education_Contract_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
dmodel
.
Group_Id
=
userInfo
.
Group_Id
;
var
list
=
educationContractModule
.
GetEducationContractPageList
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
count
,
dmodel
);
pageModel
.
Count
=
Convert
.
ToInt32
(
count
);
pageModel
.
PageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
CType
,
CTypeName
=
x
.
CType
.
ToName
(),
x
.
OrderId
,
x
.
ContractNo
,
x
.
StudentName
,
x
.
SchoolName
,
x
.
CourseName
,
x
.
CourseContent
,
x
.
CNYCaps
,
x
.
Money
,
x
.
Exam
,
x
.
Sign
,
x
.
Status
,
x
.
StatusStr
,
x
.
IsCompanySeal
,
x
.
CreateBy
,
x
.
CreateByName
,
x
.
CreateByPhoto
,
x
.
Sex
,
x
.
IDCard
,
x
.
Domicile
,
x
.
ContactAddress
,
x
.
ContactMobile
,
x
.
EmergencyContact
,
x
.
EmergencyMobile
,
CreateTime
=
x
.
CreateTime
.
ToString
(
"yyyy-MM-dd HH:mm"
)
});
return
ApiResult
.
Success
(
""
,
pageModel
);
}
/// <summary>
/// 获取合同详情
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
GetEducationContractInfo
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
ContractId
=
parms
.
GetInt
(
"ContractId"
,
0
);
//合同id
var
model
=
educationContractModule
.
GetEducationContractInfo
(
ContractId
);
if
(
model
==
null
)
{
return
ApiResult
.
Failed
(
"合同不存在"
);
}
return
ApiResult
.
Success
(
""
,
new
{
model
.
Id
,
model
.
CType
,
CTypeName
=
model
.
CType
.
ToName
(),
model
.
OrderId
,
model
.
ContractNo
,
model
.
StudentName
,
model
.
SchoolName
,
model
.
CourseName
,
model
.
CourseContent
,
model
.
CNYCaps
,
model
.
Money
,
model
.
Exam
,
model
.
Sign
,
model
.
Status
,
model
.
StatusStr
,
model
.
IsCompanySeal
,
model
.
CompanySealImage
,
model
.
ContractBranch
,
model
.
ContractTel
,
model
.
BranchNList
,
model
.
BranchName
,
model
.
Sex
,
model
.
IDCard
,
model
.
Domicile
,
model
.
ContactAddress
,
model
.
ContactMobile
,
model
.
EmergencyContact
,
model
.
EmergencyMobile
,
model
.
LegalPerson
,
SignDate
=
model
.
SignDate
.
HasValue
?
model
.
SignDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
,
SealDate
=
model
.
SealDate
.
HasValue
?
model
.
SealDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
});
}
/// <summary>
/// 单独新增合同
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetEducationContractInfo
()
{
var
userInfo
=
base
.
UserInfo
;
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_Education_Contract_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
dmodel
.
StudentName
))
{
return
ApiResult
.
ParamIsNull
(
"请输入学生姓名"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
SchoolName
))
{
return
ApiResult
.
ParamIsNull
(
"请输入学校名称"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
CourseName
))
{
return
ApiResult
.
ParamIsNull
(
"请输入课程名称"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
CourseContent
))
{
return
ApiResult
.
ParamIsNull
(
"请输入课程内容"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
CNYCaps
))
{
return
ApiResult
.
ParamIsNull
(
"请输入大写金额"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Money
))
{
return
ApiResult
.
ParamIsNull
(
"请输入金额"
);
}
dmodel
.
Group_Id
=
userInfo
.
Group_Id
;
dmodel
.
School_Id
=
userInfo
.
School_Id
;
dmodel
.
CreateBy
=
userInfo
.
Id
;
dmodel
.
CreateTime
=
DateTime
.
Now
;
dmodel
.
UpdateBy
=
userInfo
.
Id
;
dmodel
.
UpdateTime
=
DateTime
.
Now
;
dmodel
.
Status
=
0
;
bool
flag
=
educationContractModule
.
SetEducationContractInfo
(
dmodel
,
userInfo
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 设置合同审核
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetEducationContractAudit
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
ContractId
=
parms
.
GetInt
(
"ContractId"
,
0
);
//合同id
int
State
=
parms
.
GetInt
(
"State"
,
1
);
// 状态 1提交审核 2通过 3驳回 4取消 5盖章
if
(
ContractId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递合同id"
);
}
bool
flag
=
educationContractModule
.
SetEducationContractAudit
(
ContractId
,
State
,
userInfo
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 合同复制
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetEducationContractCopy
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
ContractId
=
parms
.
GetInt
(
"ContractId"
,
0
);
//合同id
if
(
ContractId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递合同id"
);
}
bool
flag
=
educationContractModule
.
SetEducationContractCopy
(
ContractId
,
userInfo
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 合同签字
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
SetEducationContractSign
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
ContractId
=
parms
.
GetInt
(
"ContractId"
,
0
);
//合同id
string
Sign
=
parms
.
GetStringValue
(
"Sign"
);
//签名
if
(
ContractId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递合同id"
);
}
bool
flag
=
educationContractModule
.
SetEducationContractSign
(
ContractId
,
Sign
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 下载pdf
/// </summary>
/// <returns></returns>
public
ApiResult
GetDownLoadEducationContract
()
{
string
time
=
DateTime
.
Now
.
Ticks
.
ToString
();
string
path
=
"/upfile/Temporary/"
+
time
+
".pdf"
;
string
basepath
=
AppContext
.
BaseDirectory
;
string
tempPath
=
basepath
+
"\\upfile\\Temporary\\"
+
time
+
".pdf"
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
var
ID
=
parms
.
GetInt
(
"ContractId"
);
var
CType
=
parms
.
GetInt
(
"CType"
);
string
curl
=
Common
.
Config
.
UploadSiteUrl
+
string
.
Format
(
@"/Home/EducationContractInfo?ID={0}&CType={1}"
,
ID
,
CType
);
//string curl = "http://localhost:50034"+ string.Format(@"/Home/EducationContractInfo?ID={0}&CType={1}", ID, CType);
var
flag
=
new
ToPdfHelper
().
HtmlWJtoPdf
(
tempPath
,
curl
);
return
ApiResult
.
Success
(
""
,
path
);
}
#
endregion
}
}
Edu.WebApi/Controllers/Course/OrderController.cs
View file @
459087dd
...
...
@@ -192,6 +192,13 @@ namespace Edu.WebApi.Controllers.Course
z
.
Id
,
z
.
GuestName
,
z
.
GuestState
}),
ContractList
=
x
.
ContractList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
StudentName
,
z
.
ContractNo
,
z
.
GuestId
,
z
.
Status
})
}),
CancelList
=
orderList
.
Where
(
x
=>
x
.
OrderState
==
Common
.
Enum
.
Course
.
OrderStateEnum
.
Cancel
).
Select
(
x
=>
new
...
...
@@ -254,6 +261,13 @@ namespace Edu.WebApi.Controllers.Course
z
.
Id
,
z
.
GuestName
,
z
.
GuestState
}),
ContractList
=
x
.
ContractList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
StudentName
,
z
.
ContractNo
,
z
.
GuestId
,
z
.
Status
})
})
}
...
...
@@ -760,6 +774,9 @@ namespace Edu.WebApi.Controllers.Course
LearningGoalsName
=
x
.
LearningGoals
.
ToName
(),
x
.
Contact
,
x
.
ContactMobile
,
x
.
IDCard
,
x
.
ContactAddress
,
x
.
Domicile
,
UpdateTime
=
x
.
UpdateTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
IsShow
=
true
,
});
...
...
@@ -936,6 +953,13 @@ namespace Edu.WebApi.Controllers.Course
z
.
Id
,
z
.
GuestName
,
z
.
GuestState
}),
ContractList
=
x
.
ContractList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
StudentName
,
z
.
ContractNo
,
z
.
GuestId
,
z
.
Status
})
})
};
...
...
@@ -973,6 +997,32 @@ namespace Edu.WebApi.Controllers.Course
}
}
/// <summary>
/// 订单领取合同
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetOrderReceiveContract
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
prams
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
OrderId
=
prams
.
GetInt
(
"OrderId"
,
0
);
int
GuestId
=
prams
.
GetInt
(
"GuestId"
,
0
);
if
(
OrderId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递订单id"
);
}
bool
flag
=
orderModule
.
SetOrderReceiveContract
(
OrderId
,
GuestId
,
userInfo
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
#
region
退课申请
...
...
Edu.WebApi/Controllers/Upload/UploadController.cs
View file @
459087dd
...
...
@@ -89,5 +89,92 @@ namespace Edu.WebApi.Controllers.Upload
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 文件流下载
/// </summary>
/// <returns></returns>
[
HttpGet
]
[
AllowAnonymous
]
public
FileContentResult
DownloadFileForPdf
(
string
fileName
,
string
fPath
)
{
try
{
string
basepath
=
AppContext
.
BaseDirectory
;
string
tempPath
=
basepath
+
fPath
.
Replace
(
'/'
,
'\\'
);
for
(
var
i
=
0
;
i
<
10
;
i
++)
{
if
(
FileIsUsed
(
tempPath
))
{
//true 被占用
System
.
Threading
.
Thread
.
Sleep
(
1000
);
//停一秒
}
else
{
break
;
}
}
//以字符流的形式下载文件
FileStream
fs
=
new
FileStream
(
tempPath
,
FileMode
.
Open
);
byte
[]
bytes
=
new
byte
[(
int
)
fs
.
Length
];
fs
.
Read
(
bytes
,
0
,
bytes
.
Length
);
fs
.
Close
();
return
File
(
bytes
,
"application/octet-stream"
,
fileName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"DownLoad"
);
}
return
File
(
new
byte
[
0
],
"application/octet-stream"
,
fileName
);
}
/// <summary>
/// 返回指示文件是否已被其它程序使用的布尔值
/// </summary>
/// <param name="fileFullName">文件的完全限定名,例如:“C:\MyFile.txt”。</param>
/// <returns>如果文件已被其它程序使用,则为 true;否则为 false。</returns>
public
static
bool
FileIsUsed
(
String
fileFullName
)
{
bool
result
=
false
;
//判断文件是否存在,如果不存在,直接返回 false
if
(!
System
.
IO
.
File
.
Exists
(
fileFullName
))
{
result
=
false
;
}
//end: 如果文件不存在的处理逻辑
else
{
//如果文件存在,则继续判断文件是否已被其它程序使用
//逻辑:尝试执行打开文件的操作,如果文件已经被其它程序使用,则打开失败,抛出异常,根据此类异常可以判断文件是否已被其它程序使用。
System
.
IO
.
FileStream
fileStream
=
null
;
try
{
fileStream
=
System
.
IO
.
File
.
Open
(
fileFullName
,
System
.
IO
.
FileMode
.
Open
,
System
.
IO
.
FileAccess
.
ReadWrite
,
System
.
IO
.
FileShare
.
None
);
result
=
false
;
}
catch
(
System
.
IO
.
IOException
)
{
result
=
true
;
}
catch
(
System
.
Exception
)
{
result
=
true
;
}
finally
{
if
(
fileStream
!=
null
)
{
fileStream
.
Close
();
}
}
}
//end: 如果文件存在的处理逻辑
//返回指示文件是否已被其它程序使用的值
return
result
;
}
}
}
Edu.WebApi/appsettings.json
View file @
459087dd
...
...
@@ -2,7 +2,7 @@
"ConnectionStrings"
:
{
"DefaultConnection"
:
"server=192.168.1.214;user id=reborn;password=Reborn@2018;database=reborn_edu;CharSet=utf8mb4; Convert Zero Datetime=true; "
,
"DefaultConnectionPName"
:
"MySql.Data.MySqlClient"
,
"FinanceConnection"
:
"server=192.168.1.214;user id=reborn;password=Reborn@2018;database=reborn_finance;CharSet=utf8mb4; Convert Zero Datetime=true; "
,
"FinanceConnection"
:
"server=192.168.1.214;user id=reborn;password=Reborn@2018;database=
test_
reborn_finance;CharSet=utf8mb4; Convert Zero Datetime=true; "
,
"FinanceConnectionPName"
:
"MySql.Data.MySqlClient"
,
"DataStatisticsConnection"
:
"server=192.168.1.214;user id=reborn;password=Reborn@2018;database=reborn_datastatistics;CharSet=utf8mb4; Convert Zero Datetime=true; "
,
"DataStatisticsConnectionPName"
:
"MySql.Data.MySqlClient"
...
...
@@ -19,11 +19,12 @@
"IsSendMsg"
:
2
,
"AllowedHosts"
:
"*"
,
"OpenValidation"
:
"False"
,
"UploadSiteUrl"
:
"http://192.168.1.
214:8120
"
,
"UploadSiteUrl"
:
"http://192.168.1.
13:8086
"
,
"ViewFileSiteUrl"
:
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com"
,
"ErpViewFileSiteUrl"
:
"http://imgfile.oytour.com"
,
"Mongo"
:
"mongodb://47.96.25.130:27017"
,
"MongoDBName"
:
"Edu"
,
"WkHtmlToPdfPath"
:
"D:/wkhtmltopdf/bin/"
,
"FinanceKey"
:
"FinanceMallInsertToERPViitto2020"
,
"PaymentFinanceApi"
:
"http://192.168.1.13:8083/api/Mall/InsertFinanceBatchForMallOut"
,
"RabbitMqConfig"
:
{
...
...
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