Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PropertyEdu
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
liudong1993
PropertyEdu
Commits
10b4b775
Commit
10b4b775
authored
May 08, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
耗材出库 兼容非班级 , 消息推送接入
parent
3491c9ee
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
344 additions
and
14 deletions
+344
-14
Config.cs
Property.Common/Config.cs
+37
-0
FinanceConfigTypeEnum.cs
Property.Common/Enum/Edu/FinanceConfigTypeEnum.cs
+8
-3
MessageHelper.cs
Property.Common/Message/MessageHelper.cs
+94
-0
PushMessageModel.cs
Property.Common/Message/PushMessageModel.cs
+73
-0
RabbitConfig.cs
Property.Common/Message/RabbitConfig.cs
+38
-0
PushMessageCategoryEnum.cs
Property.Common/Models/PushMessageCategoryEnum.cs
+43
-0
Property.Common.csproj
Property.Common/Property.Common.csproj
+1
-0
RB_Supplies_StockOutApplyFor.cs
...rty.Model/Entity/Supplies/RB_Supplies_StockOutApplyFor.cs
+5
-0
SuppliesModule.cs
Property.Modele.FixedAssets/SuppliesModule.cs
+9
-3
RB_Supplies_StockOutApplyForRepository.cs
...sitory/Supplies/RB_Supplies_StockOutApplyForRepository.cs
+4
-0
SuppliesController.cs
Property.WebApi/Controllers/Property/SuppliesController.cs
+22
-8
appsettings.json
Property.WebApi/appsettings.json
+10
-0
No files found.
Property.Common/Config.cs
View file @
10b4b775
...
...
@@ -147,6 +147,31 @@ namespace REBORN.Common
}
}
/// <summary>
/// 读取配置文件key的值
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public
static
string
ReadConfigKey
(
string
key
,
string
subKey
=
""
)
{
string
valueStr
=
""
;
try
{
if
(!
string
.
IsNullOrWhiteSpace
(
subKey
))
{
valueStr
=
new
ConfigurationBuilder
().
Add
(
new
JsonConfigurationSource
{
Path
=
"appsettings.json"
}).
Build
().
GetSection
(
key
)[
subKey
].
ToString
();
}
else
{
valueStr
=
new
ConfigurationBuilder
().
Add
(
new
JsonConfigurationSource
{
Path
=
"appsettings.json"
}).
Build
().
GetSection
(
key
).
Value
;
}
}
catch
{
}
return
valueStr
;
}
/// <summary>
/// 阿里云oss域名
/// </summary>
...
...
@@ -302,5 +327,17 @@ namespace REBORN.Common
return
new
ConfigurationBuilder
().
Add
(
new
JsonConfigurationSource
{
Path
=
"appsettings.json"
}).
Build
().
GetSection
(
"ManagersId"
).
Value
;
}
}
/// <summary>
/// 消息推送AppId
/// </summary>
public
static
string
PushAppId
{
get
{
return
ReadConfigKey
(
"PushAppId"
);
}
}
}
}
\ No newline at end of file
Property.Common/Enum/Edu/FinanceConfigTypeEnum.cs
View file @
10b4b775
...
...
@@ -41,9 +41,14 @@ namespace REBORN.Common.Enum
[
EnumField
(
"耗材费用"
)]
SuppliesCost
=
6
,
/// <summary>
/// 耗材出库
///
主营
耗材出库
/// </summary>
[
EnumField
(
"耗材出库"
)]
SuppliesStockOut
=
7
[
EnumField
(
"主营耗材出库"
)]
SuppliesStockOut
=
7
,
/// <summary>
/// 其他耗材出库
/// </summary>
[
EnumField
(
"其他耗材出库"
)]
OtherSuppliesStockOut
=
8
}
}
Property.Common/Message/MessageHelper.cs
0 → 100644
View file @
10b4b775
using
RabbitMQ.Client
;
using
REBORN.Common
;
using
REBORN.Common.Plugin
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Property.Common.Message
{
/// <summary>
/// 消息发送
/// </summary>
public
class
MessageHelper
{
/// <summary>
/// 获取连接
/// </summary>
/// <param name="rabbitConfig">连接配置实体</param>
/// <returns></returns>
private
static
ConnectionFactory
GetConnectionFactory
(
RabbitConfig
rabbitConfig
)
{
ConnectionFactory
factory
=
new
ConnectionFactory
{
HostName
=
rabbitConfig
.
HostName
,
//默认端口
Port
=
rabbitConfig
.
Port
,
UserName
=
rabbitConfig
.
UserName
,
Password
=
rabbitConfig
.
Password
,
};
return
factory
;
}
/// <summary>
/// 发送信息
/// </summary>
/// <param name="message"></param>
public
static
void
SendMessage
(
PushMessageModel
message
)
{
Int32
.
TryParse
(
Config
.
ReadConfigKey
(
"RabbitMqConfig"
,
subKey
:
"Port"
),
out
int
Port
);
RabbitConfig
rabbitConfig
=
new
RabbitConfig
()
{
HostName
=
Config
.
ReadConfigKey
(
"RabbitMqConfig"
,
subKey
:
"HostName"
),
Password
=
Config
.
ReadConfigKey
(
"RabbitMqConfig"
,
subKey
:
"Password"
),
Port
=
Port
,
UserName
=
Config
.
ReadConfigKey
(
"RabbitMqConfig"
,
subKey
:
"UserName"
),
QueenName
=
Config
.
ReadConfigKey
(
"RabbitMqConfig"
,
subKey
:
"QueenName"
)
};
var
obj
=
new
{
Id
=
0
,
// 主键
message
.
Title
,
message
.
Content
,
message
.
CoverImg
,
message
.
CategoryId
,
message
.
Platform
,
message
.
SendType
,
message
.
SendTime
,
message
.
ReceiveId
,
message
.
JumpUrl
,
message
.
CreateByName
,
message
.
MsgSign
,
message
.
MsgTemplateCode
,
Status
=
0
,
CreateTime
=
DateTime
.
Now
,
AppId
=
Config
.
PushAppId
,
IsRead
=
0
,
};
using
(
IConnection
conn
=
GetConnectionFactory
(
rabbitConfig
).
CreateConnection
())
{
using
(
IModel
channel
=
conn
.
CreateModel
())
{
//在MQ上定义一个持久化队列,如果名称相同不会重复创建
channel
.
QueueDeclare
(
rabbitConfig
.
QueenName
,
true
,
false
,
false
,
null
);
byte
[]
buffer
=
Encoding
.
UTF8
.
GetBytes
(
JsonHelper
.
Serialize
(
obj
));
IBasicProperties
properties
=
channel
.
CreateBasicProperties
();
properties
.
DeliveryMode
=
2
;
channel
.
BasicPublish
(
""
,
rabbitConfig
.
QueenName
,
properties
,
buffer
);
}
}
}
/// <summary>
/// 批量推送
/// </summary>
/// <param name="msgList"></param>
public
static
void
SendMessage
(
List
<
PushMessageModel
>
msgList
)
{
foreach
(
var
item
in
msgList
)
{
SendMessage
(
item
);
}
}
}
}
Property.Common/Message/PushMessageModel.cs
0 → 100644
View file @
10b4b775
using
System
;
using
Property.Common.Models
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Property.Common.Message
{
/// <summary>
/// 消息推送实体
/// </summary>
public
class
PushMessageModel
{
/// <summary>
/// 推送标题
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// 推送内容
/// </summary>
public
string
Content
{
get
;
set
;
}
/// <summary>
/// 封面图
/// </summary>
public
string
CoverImg
{
get
;
set
;
}
/// <summary>
/// 所属分类
/// </summary>
public
PushMessageCategoryEnum
CategoryId
{
get
;
set
;
}
/// <summary>
/// 推送平台[1-手机端,2-Web端,3-短信,4-邮件]
/// </summary>
public
int
Platform
{
get
;
set
;
}
/// <summary>
/// 推送类型(0-立即推送,1-指定时间推送)
/// </summary>
public
int
SendType
{
get
;
set
;
}
/// <summary>
/// 推送时间
/// </summary>
public
DateTime
SendTime
{
get
;
set
;
}
/// <summary>
/// 接收人员
/// </summary>
public
string
ReceiveId
{
get
;
set
;
}
/// <summary>
/// 跳转地址
/// </summary>
public
string
JumpUrl
{
get
;
set
;
}
/// <summary>
/// 创建人姓名
/// </summary>
public
string
CreateByName
{
get
;
set
;
}
/// <summary>
/// 短信模板代码
/// </summary>
public
string
MsgTemplateCode
{
get
;
set
;
}
/// <summary>
/// 短信签名
/// </summary>
public
string
MsgSign
{
get
;
set
;
}
}
}
Property.Common/Message/RabbitConfig.cs
0 → 100644
View file @
10b4b775
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Property.Common.Message
{
/// <summary>
/// 消息队列配置文件
/// </summary>
public
class
RabbitConfig
{
/// <summary>
/// 主机名:ip地址
/// </summary>
public
string
HostName
{
get
;
set
;
}
/// <summary>
/// 端口
/// </summary>
public
int
Port
{
get
;
set
;
}
/// <summary>
/// 用户名
/// </summary>
public
string
UserName
{
get
;
set
;
}
/// <summary>
/// 密码
/// </summary>
public
string
Password
{
get
;
set
;
}
/// <summary>
/// 队列名称
/// </summary>
public
string
QueenName
{
get
;
set
;
}
}
}
Property.Common/Models/PushMessageCategoryEnum.cs
0 → 100644
View file @
10b4b775
using
REBORN.Common.Plugin
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Property.Common.Models
{
/// <summary>
/// 消息推送类型
/// </summary>
public
enum
PushMessageCategoryEnum
{
/// <summary>
/// 老师备案评论
/// </summary>
[
EnumField
(
"老师备案评论"
)]
LessonComment
=
1
,
/// <summary>
/// 值班信息
/// </summary>
[
EnumField
(
"值班信息"
)]
UserDuty
=
2
,
/// <summary>
/// 资产审核
/// </summary>
[
EnumField
(
"资产审核"
)]
Property
=
3
,
/// <summary>
/// 请购单审核
/// </summary>
[
EnumField
(
"请购单审核"
)]
BuyingRequisition
=
4
,
/// <summary>
/// 财务单据审核
/// </summary>
[
EnumField
(
"财务单据审核"
)]
Finance
=
5
,
}
}
Property.Common/Property.Common.csproj
View file @
10b4b775
...
...
@@ -12,6 +12,7 @@
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NPOI" Version="2.4.1" />
<PackageReference Include="QRCoder" Version="1.3.6" />
<PackageReference Include="RabbitMQ.Client" Version="5.1.2" />
<PackageReference Include="StackExchange.Redis" Version="2.0.601" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.6.0" />
</ItemGroup>
...
...
Property.Model/Entity/Supplies/RB_Supplies_StockOutApplyFor.cs
View file @
10b4b775
...
...
@@ -92,5 +92,10 @@ namespace Property.Model.Entity
/// </summary>
public
DateTime
?
AuditDate
{
get
;
set
;
}
/// <summary>
/// 类型 1主营业务 2其他业务
/// </summary>
public
int
Type
{
get
;
set
;
}
}
}
\ No newline at end of file
Property.Modele.FixedAssets/SuppliesModule.cs
View file @
10b4b775
...
...
@@ -4528,7 +4528,13 @@ namespace Property.Module.FixedAssets
if
(
oldModel
.
AuditStatus
!=
2
)
{
return
"未审核通过,无法出库"
;
}
if
(
oldModel
.
StockOutStatus
==
3
)
{
return
"已出库完毕"
;
}
var
configModel
=
finance_ConfigRepository
.
GetList
(
new
RB_Finance_Config_ViewModel
()
{
Group_Id
=
userInfo
.
RB_Group_id
,
Type
=
FinanceConfigTypeEnum
.
SuppliesStockOut
}).
FirstOrDefault
();
RB_Finance_Config_ViewModel
configModel
=
null
;
if
(
oldModel
.
Type
==
1
)
{
configModel
=
finance_ConfigRepository
.
GetList
(
new
RB_Finance_Config_ViewModel
()
{
Group_Id
=
userInfo
.
RB_Group_id
,
Type
=
FinanceConfigTypeEnum
.
SuppliesStockOut
}).
FirstOrDefault
();
}
else
{
configModel
=
finance_ConfigRepository
.
GetList
(
new
RB_Finance_Config_ViewModel
()
{
Group_Id
=
userInfo
.
RB_Group_id
,
Type
=
FinanceConfigTypeEnum
.
OtherSuppliesStockOut
}).
FirstOrDefault
();
}
if
(
configModel
==
null
)
{
return
"未配置费用/流程信息,请联系管理员"
;
}
var
list
=
supplies_StockOutApplyForDetailRepository
.
GetList
(
new
RB_Supplies_StockOutApplyForDetail_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
ApplyForId
=
demodel
.
Id
});
...
...
@@ -4742,7 +4748,7 @@ namespace Property.Module.FixedAssets
Number
=
item
.
WaitStockOutNum
,
OriginalMoney
=
UnitPrice
*
item
.
WaitStockOutNum
,
UnitPrice
,
Remark
=
item
.
ClassName
+
" "
+
mModel
.
Name
+
"("
+
mModel
.
SuppliesNum
+
") "
Remark
=
(
classId
>
0
?
item
.
ClassName
+
" "
:
""
)
+
mModel
.
Name
+
"("
+
mModel
.
SuppliesNum
+
") "
});
TotalCostMoney
+=
UnitPrice
*
item
.
WaitStockOutNum
;
}
...
...
@@ -4765,7 +4771,7 @@ namespace Property.Module.FixedAssets
RB_Depart_Id
=
userInfo
.
RB_Department_Id
,
ReFinanceId
=
StockOutId
,
ReFinanceId2
=
demodel
.
Id
,
TCIDList
=
new
List
<
int
>()
{
classId
}
,
TCIDList
=
classId
>
0
?
new
List
<
int
>()
{
classId
}
:
new
List
<
int
>()
,
FinanceType
=
2
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
RB_CreateByName
=
userInfo
.
emName
,
...
...
Property.Repository/Supplies/RB_Supplies_StockOutApplyForRepository.cs
View file @
10b4b775
...
...
@@ -34,6 +34,10 @@ namespace Property.Repository
{
where
+=
" and pc."
+
nameof
(
RB_Supplies_StockOutApplyFor_Extend
.
StockOutStatus
)
+
"="
+
dmodel
.
StockOutStatus
;
}
if
(
dmodel
.
Type
>
0
)
{
where
+=
" and pc."
+
nameof
(
RB_Supplies_StockOutApplyFor_Extend
.
Type
)
+
"="
+
dmodel
.
Type
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
StartTime
))
{
where
+=
" and pc."
+
nameof
(
RB_Supplies_StockOutApplyFor_Extend
.
CreateDate
)
+
" >='"
+
dmodel
.
StartTime
+
"'"
;
...
...
Property.WebApi/Controllers/Property/SuppliesController.cs
View file @
10b4b775
...
...
@@ -3078,6 +3078,7 @@ namespace Property.WebApi.Controllers.User
x
.
StockOutStatus
,
x
.
AuditStatus
,
x
.
AuditRemark
,
x
.
Type
,
DetailList
=
x
.
DetailList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
ClassId
,
...
...
@@ -3125,6 +3126,7 @@ namespace Property.WebApi.Controllers.User
model
.
StockOutStatus
,
model
.
AuditStatus
,
model
.
AuditRemark
,
model
.
Type
,
DetailList
=
model
.
DetailList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
ClassId
,
...
...
@@ -3159,16 +3161,28 @@ namespace Property.WebApi.Controllers.User
if
(
demodel
.
DetailList
==
null
||
!
demodel
.
DetailList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请选择出库耗材"
);
}
demodel
.
Type
=
demodel
.
Type
==
0
?
1
:
demodel
.
Type
;
List
<
int
>
ClassIdList
=
new
List
<
int
>();
foreach
(
var
item
in
demodel
.
DetailList
)
{
if
(
item
.
ClassId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递班级id"
);
}
if
(
string
.
IsNullOrEmpty
(
item
.
ClassName
))
{
return
ApiResult
.
ParamIsNull
(
"请传递班级名称"
);
if
(
demodel
.
Type
==
1
)
{
if
(
item
.
ClassId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递班级id"
);
}
if
(
string
.
IsNullOrEmpty
(
item
.
ClassName
))
{
return
ApiResult
.
ParamIsNull
(
"请传递班级名称"
);
}
if
(
string
.
IsNullOrEmpty
(
item
.
CourseName
))
{
return
ApiResult
.
ParamIsNull
(
"请传递课程名称"
);
}
}
if
(
string
.
IsNullOrEmpty
(
item
.
CourseName
))
{
return
ApiResult
.
ParamIsNull
(
"请传递课程名称"
);
else
{
item
.
ClassId
=
0
;
item
.
ClassName
=
""
;
item
.
CourseName
=
""
;
}
if
(
item
.
SchoolId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递校区id"
);
...
...
@@ -3188,7 +3202,7 @@ namespace Property.WebApi.Controllers.User
foreach
(
var
item
in
ClassIdList
)
{
var
classList
=
demodel
.
DetailList
.
Where
(
x
=>
x
.
ClassId
==
item
).
ToList
();
if
(
classList
.
Count
()
!=
classList
.
Select
(
x
=>
x
.
SuppliesId
).
Distinct
().
Count
())
{
return
ApiResult
.
Failed
(
"班级("
+
item
+
")存在重复
数量
,请核实后再试"
);
return
ApiResult
.
Failed
(
"班级("
+
item
+
")存在重复
耗材
,请核实后再试"
);
}
}
...
...
Property.WebApi/appsettings.json
View file @
10b4b775
...
...
@@ -42,5 +42,15 @@
"RedisPort"
:
"6379"
,
"RedisPwd"
:
"Viitto2018"
},
"RabbitMqConfig"
:
{
"HostName"
:
"47.96.25.130"
,
"VirtualHost"
:
"/"
,
"Port"
:
5672
,
"UserName"
:
"guest"
,
"Password"
:
"viitto2019"
,
"QueenName"
:
"vt_sys_message_test"
},
//消息推送AppId
"PushAppId"
:
"JiaHeJiaoYu"
,
"accessSiteStr"
:
"http://testzcys.oytour.com,http://testzc2erp.oytour.com,http://testzc3erp.oytour.com"
}
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