Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
管店云开源进销存
开源进销存系统
提交
93c39725
开源进销存系统
项目概览
管店云开源进销存
/
开源进销存系统
通知
193
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
开源进销存系统
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
93c39725
编写于
8月 12, 2023
作者:
L
lsh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完成系统设置controller
上级
3bcedd00
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
910 addition
and
38 deletion
+910
-38
psi-common/src/main/java/com/bytechainx/psi/common/Permissions.java
.../src/main/java/com/bytechainx/psi/common/Permissions.java
+0
-8
psi-common/src/main/java/com/bytechainx/psi/common/model/TenantOrg.java
.../main/java/com/bytechainx/psi/common/model/TenantOrg.java
+4
-0
psi-web/src/main/java/com/bytechainx/psi/web/App.java
psi-web/src/main/java/com/bytechainx/psi/web/App.java
+0
-30
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/ConfigPrintController.java
...psi/web/web/controller/setting/ConfigPrintController.java
+219
-0
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/ConfigSystemController.java
...si/web/web/controller/setting/ConfigSystemController.java
+214
-0
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/SystemOperLogController.java
...i/web/web/controller/setting/SystemOperLogController.java
+69
-0
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/TenantAdminController.java
...psi/web/web/controller/setting/TenantAdminController.java
+195
-0
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/TenantInfoController.java
.../psi/web/web/controller/setting/TenantInfoController.java
+67
-0
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/TenantRoleController.java
.../psi/web/web/controller/setting/TenantRoleController.java
+142
-0
未找到文件。
psi-common/src/main/java/com/bytechainx/psi/common/Permissions.java
浏览文件 @
93c39725
...
...
@@ -375,14 +375,6 @@ public enum Permissions {
setting_system_reset
(
"系统重置"
,
Modules
.
core
),
setting_system_operLog
(
"操作日志"
,
Modules
.
core
),
// 系统重置权限点
setting_system_reset_show
(
"查看"
,
Modules
.
core
),
// 系统重置-查看
setting_system_reset_create
(
"重置"
,
Modules
.
core
),
// 系统重置-重置
// 数据恢复权限点
setting_system_restore_show
(
"查看"
,
Modules
.
core
),
// 数据恢复-查看
setting_system_restore_create
(
"恢复"
,
Modules
.
core
),
// 数据恢复-恢复
// 操作日志权限点
setting_system_operLog_show
(
"查看"
,
Modules
.
core
),
// 操作日志-查看
...
...
psi-common/src/main/java/com/bytechainx/psi/common/model/TenantOrg.java
浏览文件 @
93c39725
...
...
@@ -37,5 +37,9 @@ public class TenantOrg extends BaseTenantOrg<TenantOrg> {
return
TenantConfig
.
dao
.
findByKeyCache
(
configEnum
);
}
public
TenantOrg
findTop
()
{
return
TenantOrg
.
dao
.
findFirst
(
"select * from tenant_org limit 1"
);
}
}
psi-web/src/main/java/com/bytechainx/psi/web/App.java
浏览文件 @
93c39725
package
com.bytechainx.psi.web
;
import
java.io.File
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
com.bytechainx.psi.common.plugin.RedisSessionManagerFactory
;
import
com.bytechainx.psi.web.config.AppConfig
;
import
com.jfinal.kit.Prop
;
import
com.jfinal.kit.PropKit
;
import
com.jfinal.server.undertow.UndertowServer
;
import
redis.clients.jedis.Protocol
;
/**
* 启动入口
*/
public
class
App
{
public
static
void
main
(
String
[]
args
)
{
UndertowServer
undertowServer
=
UndertowServer
.
create
(
AppConfig
.
class
);
undertowServer
.
configWeb
(
builder
->
{
try
{
Prop
prop
=
PropKit
.
useFirstFound
(
"app-config-pro.txt"
,
"app-config-dev.txt"
);
Prop
commonProp
=
PropKit
.
append
(
new
File
(
prop
.
get
(
"common.config.path"
)+
File
.
separator
+
"app-config-dev.txt"
));
String
redisHost
=
commonProp
.
get
(
"redis.ip"
);
int
redisPort
=
commonProp
.
getInt
(
"redis.port"
);
int
redisDb
=
Protocol
.
DEFAULT_DATABASE
;
String
redisUri
=
"redis://"
+
redisHost
+
":"
+
redisPort
+
"/"
+
redisDb
;
builder
.
getDeploymentInfo
().
setSessionManagerFactory
(
new
RedisSessionManagerFactory
(
new
URI
(
redisUri
)));
}
catch
(
URISyntaxException
e
)
{
e
.
printStackTrace
();
System
.
exit
(-
1
);
}
// 配置WebSocket需使用ServerEndpoint注解
// builder.addWebSocketEndpoint("cn.york.common.websocket.WebSocketEndpoint");
});
undertowServer
.
start
();
}
...
...
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/ConfigPrintController.java
0 → 100644
浏览文件 @
93c39725
package
com.bytechainx.psi.web.web.controller.setting
;
import
java.util.Arrays
;
import
java.util.Date
;
import
com.alibaba.fastjson.JSONObject
;
import
com.bytechainx.psi.common.EnumConstant.TenantConfigEnum
;
import
com.bytechainx.psi.common.Permissions
;
import
com.bytechainx.psi.common.annotation.Permission
;
import
com.bytechainx.psi.common.model.TenantConfig
;
import
com.bytechainx.psi.common.model.TenantPrintTemplate
;
import
com.bytechainx.psi.common.service.setting.ConfigPrintService
;
import
com.bytechainx.psi.web.web.controller.base.BaseController
;
import
com.jfinal.aop.Before
;
import
com.jfinal.aop.Inject
;
import
com.jfinal.core.Path
;
import
com.jfinal.kit.Kv
;
import
com.jfinal.kit.Ret
;
import
com.jfinal.plugin.activerecord.Page
;
import
com.jfinal.plugin.activerecord.tx.Tx
;
/**
* 打印设置
*/
@Path
(
"/setting/config/print"
)
public
class
ConfigPrintController
extends
BaseController
{
@Inject
private
ConfigPrintService
configPrintService
;
/**
* 首页
*/
@Permission
(
Permissions
.
setting_config_print
)
public
void
index
()
{
}
/**
* 列表
*/
@Permission
(
Permissions
.
setting_config_print
)
public
void
list
()
{
int
pageNumber
=
getInt
(
"pageNumber"
,
1
);
Kv
condKv
=
Kv
.
create
();
conditionFilterStore
(
condKv
,
null
);
// 添加门店过滤条件
Page
<
TenantPrintTemplate
>
page
=
configPrintService
.
paginate
(
condKv
,
pageNumber
,
maxPageSize
);
JSONObject
orderPrintConfig
=
TenantConfig
.
dao
.
findJsonByKeyCahce
(
TenantConfigEnum
.
create_order_print_confirm
);
setAttr
(
"page"
,
page
);
setAttr
(
"orderPrintConfig"
,
orderPrintConfig
);
}
/**
* 查询
*/
public
void
showJson
()
{
Integer
id
=
getInt
(
"id"
);
if
(
id
==
null
||
id
<=
0
)
{
renderError
(
404
);
return
;
}
TenantPrintTemplate
printTemplate
=
TenantPrintTemplate
.
dao
.
findById
(
id
);
if
(
printTemplate
==
null
)
{
renderError
(
404
);
return
;
}
renderJson
(
Ret
.
ok
().
set
(
"data"
,
printTemplate
));
}
/**
* 导入打印模板
*/
@Permission
(
Permissions
.
setting_config_print_tplSetting
)
public
void
importTplList
()
{
int
pageNumber
=
getInt
(
"pageNumber"
,
1
);
Kv
condKv
=
Kv
.
create
();
conditionFilterStore
(
condKv
,
null
);
// 添加门店过滤条件
Page
<
TenantPrintTemplate
>
page
=
configPrintService
.
paginate
(
condKv
,
pageNumber
,
maxPageSize
);
setAttr
(
"page"
,
page
);
}
/**
* 添加
*/
@Permission
(
Permissions
.
setting_config_print_tplSetting
)
public
void
add
()
{
Integer
orderType
=
getInt
(
"order_type"
);
// 单据类型
TenantPrintTemplate
printTemplate
=
TenantPrintTemplate
.
dao
.
findDefault
(
orderType
);
if
(
printTemplate
==
null
)
{
printTemplate
=
TenantPrintTemplate
.
dao
.
findDefault
(
orderType
);
}
printTemplate
.
remove
(
"id"
);
setAttr
(
"printTemplate"
,
printTemplate
);
}
/**
* 修改
*/
@Permission
(
Permissions
.
setting_config_print_tplSetting
)
public
void
create
()
{
TenantPrintTemplate
printTemplate
=
getModel
(
TenantPrintTemplate
.
class
,
""
,
true
);
Ret
ret
=
configPrintService
.
create
(
printTemplate
);
renderJson
(
ret
);
}
/**
* 编辑
*/
@Permission
(
Permissions
.
setting_config_print_tplSetting
)
public
void
edit
()
{
Integer
id
=
getInt
(
"id"
);
if
(
id
==
null
||
id
<=
0
)
{
renderError
(
404
);
return
;
}
TenantPrintTemplate
printTemplate
=
TenantPrintTemplate
.
dao
.
findById
(
id
);
if
(
printTemplate
==
null
)
{
renderError
(
404
);
return
;
}
setAttr
(
"printTemplate"
,
printTemplate
);
}
/**
* 修改
*/
@Permission
(
Permissions
.
setting_config_print_tplSetting
)
public
void
update
()
{
TenantPrintTemplate
printTemplate
=
getModel
(
TenantPrintTemplate
.
class
,
""
,
true
);
Ret
ret
=
configPrintService
.
update
(
printTemplate
);
renderJson
(
ret
);
}
/**
* 删除
*/
@Permission
(
Permissions
.
setting_config_print_tplSetting
)
@Before
(
Tx
.
class
)
public
void
delete
()
{
Integer
id
=
getInt
(
"id"
);
if
(
id
==
null
||
id
<=
0
)
{
renderJson
(
Ret
.
fail
(
"ID不能为空"
));
return
;
}
Ret
ret
=
configPrintService
.
delete
(
Arrays
.
asList
(
id
));
renderJson
(
ret
);
}
/**
* 重置模板
*/
@Permission
(
Permissions
.
setting_config_print_tplSetting
)
public
void
reset
()
{
Integer
id
=
getInt
(
"id"
);
if
(
id
!=
null
&&
id
>
0
)
{
TenantPrintTemplate
printTemplate
=
TenantPrintTemplate
.
dao
.
findById
(
id
);
renderJson
(
Ret
.
ok
().
set
(
"data"
,
printTemplate
));
return
;
}
Integer
orderType
=
getInt
(
"order_type"
);
// 单据类型
TenantPrintTemplate
printTemplate
=
TenantPrintTemplate
.
dao
.
findDefault
(
orderType
);
if
(
printTemplate
==
null
)
{
printTemplate
=
TenantPrintTemplate
.
dao
.
findDefault
(
orderType
);
}
printTemplate
.
remove
(
"id"
);
renderJson
(
Ret
.
ok
().
set
(
"data"
,
printTemplate
));
}
/**
* 单据打印开关配置
*/
@Permission
(
Permissions
.
setting_config_print_orderSetting
)
public
void
orderPrintConfigUpdate
()
{
TenantConfig
orderPrintConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
create_order_print_confirm
);
updateConfig
(
orderPrintConfig
);
renderJson
(
Ret
.
ok
());
}
/**
* 更新通知配置
* @param sencOpen
* @param sencConfig
*/
@Permission
(
Permissions
.
setting_config_print_orderSetting
)
private
void
updateConfig
(
TenantConfig
config
)
{
TenantConfigEnum
tenantConfigEnum
=
TenantConfigEnum
.
getEnum
(
config
.
getAttrKey
());
JSONObject
configValue
=
JSONObject
.
parseObject
(
tenantConfigEnum
.
getValue
());
for
(
String
key
:
configValue
.
keySet
())
{
configValue
.
put
(
key
,
get
(
key
));
// 字段名就是KEY
}
config
.
setAttrValue
(
configValue
.
toJSONString
());
if
(
config
.
getId
()
==
null
||
config
.
getId
()
<=
0
)
{
config
.
setCreatedAt
(
new
Date
());
config
.
setUpdatedAt
(
new
Date
());
config
.
save
();
}
else
{
config
.
setUpdatedAt
(
new
Date
());
config
.
update
();
}
}
}
\ No newline at end of file
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/ConfigSystemController.java
0 → 100644
浏览文件 @
93c39725
package
com.bytechainx.psi.web.web.controller.setting
;
import
java.util.Date
;
import
java.util.Enumeration
;
import
java.util.List
;
import
org.apache.commons.lang.StringUtils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.bytechainx.psi.common.EnumConstant.FundFlowEnum
;
import
com.bytechainx.psi.common.EnumConstant.TenantConfigEnum
;
import
com.bytechainx.psi.common.Permissions
;
import
com.bytechainx.psi.common.annotation.Permission
;
import
com.bytechainx.psi.common.kit.StrUtil
;
import
com.bytechainx.psi.common.model.TenantAdmin
;
import
com.bytechainx.psi.common.model.TenantConfig
;
import
com.bytechainx.psi.common.model.TraderFundType
;
import
com.bytechainx.psi.fund.service.AccountFundTypeService
;
import
com.bytechainx.psi.web.web.controller.base.BaseController
;
import
com.jfinal.aop.Inject
;
import
com.jfinal.core.Path
;
import
com.jfinal.kit.Kv
;
import
com.jfinal.kit.Ret
;
import
com.jfinal.plugin.activerecord.Page
;
/**
* 系统设置
*/
@Path
(
"/setting/config/system"
)
public
class
ConfigSystemController
extends
BaseController
{
@Inject
private
AccountFundTypeService
accountFundTypeService
;
/**
* 首页
*/
@Permission
(
Permissions
.
setting_config_system
)
public
void
index
()
{
}
/**
* 列表
*/
@Permission
(
Permissions
.
setting_config_system
)
public
void
list
()
{
Kv
tenantConfigKv
=
Kv
.
create
();
List
<
TenantConfig
>
configList
=
TenantConfig
.
dao
.
find
(
"select * from tenant_config "
);
for
(
TenantConfig
tenantConfig
:
configList
)
{
if
(
StringUtils
.
equals
(
tenantConfig
.
getAttrKey
(),
TenantConfigEnum
.
common_order_code_rule
.
name
()))
{
if
(
StringUtils
.
isEmpty
(
tenantConfig
.
getAttrValue
()))
{
tenantConfig
.
setAttrValue
(
TenantConfigEnum
.
common_order_code_rule
.
getValue
());
}
JSONObject
json
=
JSONObject
.
parseObject
(
tenantConfig
.
getAttrValue
());
tenantConfigKv
.
set
(
"common_order_code_rule_type"
,
json
.
getInteger
(
"type"
));
tenantConfigKv
.
set
(
"common_order_code_rule_seq"
,
json
.
getInteger
(
"seq"
));
}
else
{
tenantConfigKv
.
set
(
tenantConfig
.
getAttrKey
(),
tenantConfig
.
getAttrValue
());
}
}
Kv
incomeFundTypeCondKv
=
Kv
.
create
();
incomeFundTypeCondKv
.
set
(
"fund_flow"
,
FundFlowEnum
.
income
.
getValue
());
Page
<
TraderFundType
>
incomeFundTypePage
=
accountFundTypeService
.
paginate
(
incomeFundTypeCondKv
,
1
,
maxPageSize
);
Kv
expensesFundTypeCondKv
=
Kv
.
create
();
expensesFundTypeCondKv
.
set
(
"fund_flow"
,
FundFlowEnum
.
expenses
.
getValue
());
Page
<
TraderFundType
>
expensesFundTypePage
=
accountFundTypeService
.
paginate
(
expensesFundTypeCondKv
,
1
,
maxPageSize
);
TenantConfig
feeSaleOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
fee_sale_order
);
TenantConfig
costSaleOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
cost_sale_order
);
TenantConfig
feeSaleRejectOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
fee_sale_reject_order
);
TenantConfig
costSaleRejectOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
cost_sale_reject_order
);
TenantConfig
feePurchaseOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
fee_purchase_order
);
TenantConfig
costPurchaseOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
cost_purchase_order
);
TenantConfig
feePurchaseRejectOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
fee_purchase_reject_order
);
TenantConfig
costPurchaseRejectOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
cost_purchase_reject_order
);
JSONObject
oancConfig
=
TenantConfig
.
dao
.
findJsonByKeyCahce
(
TenantConfigEnum
.
order_audit_notice_config
);
Integer
auditorId
=
oancConfig
.
getInteger
(
"purchaseOrder_auditor_id"
);
if
(
auditorId
!=
null
&&
auditorId
>
0
)
{
TenantAdmin
tenantAdmin
=
TenantAdmin
.
dao
.
findById
(
auditorId
);
oancConfig
.
put
(
"purchaseOrder_auditor_name"
,
tenantAdmin
.
getRealName
());
}
auditorId
=
oancConfig
.
getInteger
(
"saleOrder_auditor_id"
);
if
(
auditorId
!=
null
&&
auditorId
>
0
)
{
TenantAdmin
tenantAdmin
=
TenantAdmin
.
dao
.
findById
(
auditorId
);
oancConfig
.
put
(
"saleOrder_auditor_name"
,
tenantAdmin
.
getRealName
());
}
auditorId
=
oancConfig
.
getInteger
(
"fundOrder_auditor_id"
);
if
(
auditorId
!=
null
&&
auditorId
>
0
)
{
TenantAdmin
tenantAdmin
=
TenantAdmin
.
dao
.
findById
(
auditorId
);
oancConfig
.
put
(
"fundOrder_auditor_name"
,
tenantAdmin
.
getRealName
());
}
setAttr
(
"feeSaleOrderFields"
,
StrUtil
.
beforeAfterAppendComma
(
feeSaleOrderConfig
.
getAttrValue
()));
setAttr
(
"costSaleOrderFields"
,
StrUtil
.
beforeAfterAppendComma
(
costSaleOrderConfig
.
getAttrValue
()));
setAttr
(
"feeSaleRejectOrderFields"
,
StrUtil
.
beforeAfterAppendComma
(
feeSaleRejectOrderConfig
.
getAttrValue
()));
setAttr
(
"costSaleRejectOrderFields"
,
StrUtil
.
beforeAfterAppendComma
(
costSaleRejectOrderConfig
.
getAttrValue
()));
setAttr
(
"feePurchaseOrderFields"
,
StrUtil
.
beforeAfterAppendComma
(
feePurchaseOrderConfig
.
getAttrValue
()));
setAttr
(
"costPurchaseOrderFields"
,
StrUtil
.
beforeAfterAppendComma
(
costPurchaseOrderConfig
.
getAttrValue
()));
setAttr
(
"feePurchaseRejectOrderFields"
,
StrUtil
.
beforeAfterAppendComma
(
feePurchaseRejectOrderConfig
.
getAttrValue
()));
setAttr
(
"costPurchaseRejectOrderFields"
,
StrUtil
.
beforeAfterAppendComma
(
costPurchaseRejectOrderConfig
.
getAttrValue
()));
setAttr
(
"incomeFundTypePage"
,
incomeFundTypePage
);
setAttr
(
"expensesFundTypePage"
,
expensesFundTypePage
);
setAttr
(
"tenantConfig"
,
tenantConfigKv
);
setAttr
(
"oancConfig"
,
oancConfig
);
}
/**
* 修改
*/
@Permission
(
Permissions
.
setting_config_system_update
)
public
void
update
()
{
Integer
commonOrderCodeRuleType
=
getInt
(
"common_order_code_rule_type"
);
Integer
commonOrderCodeRuleSeq
=
getInt
(
"common_order_code_rule_seq"
);
TenantConfig
orderCodeRuleConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
common_order_code_rule
);
JSONObject
orderCodeRuleJson
=
new
JSONObject
();
orderCodeRuleJson
.
put
(
"type"
,
commonOrderCodeRuleType
);
orderCodeRuleJson
.
put
(
"seq"
,
commonOrderCodeRuleSeq
);
orderCodeRuleConfig
.
setAttrValue
(
orderCodeRuleJson
.
toJSONString
());
updateConfig
(
orderCodeRuleConfig
);
String
[]
feeSaleOrderFields
=
getParaValues
(
"fee_sale_order_field"
);
String
[]
costSaleOrderFields
=
getParaValues
(
"cost_sale_order_field"
);
TenantConfig
feeSaleOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
fee_sale_order
);
feeSaleOrderConfig
.
setAttrValue
(
StringUtils
.
join
(
feeSaleOrderFields
,
","
));
updateConfig
(
feeSaleOrderConfig
);
TenantConfig
costSaleOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
cost_sale_order
);
costSaleOrderConfig
.
setAttrValue
(
StringUtils
.
join
(
costSaleOrderFields
,
","
));
updateConfig
(
costSaleOrderConfig
);
String
[]
feeSaleRejectOrderFields
=
getParaValues
(
"fee_sale_reject_order_field"
);
String
[]
costSaleRejectOrderFields
=
getParaValues
(
"cost_sale_reject_order_field"
);
TenantConfig
feeSaleRejectOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
fee_sale_reject_order
);
feeSaleRejectOrderConfig
.
setAttrValue
(
StringUtils
.
join
(
feeSaleRejectOrderFields
,
","
));
updateConfig
(
feeSaleRejectOrderConfig
);
TenantConfig
costSaleRejectOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
cost_sale_reject_order
);
costSaleRejectOrderConfig
.
setAttrValue
(
StringUtils
.
join
(
costSaleRejectOrderFields
,
","
));
updateConfig
(
costSaleRejectOrderConfig
);
String
[]
feePurchaseOrderFields
=
getParaValues
(
"fee_purchase_order_field"
);
String
[]
costPurchaseOrderFields
=
getParaValues
(
"cost_purchase_order_field"
);
TenantConfig
feePurchaseOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
fee_purchase_order
);
feePurchaseOrderConfig
.
setAttrValue
(
StringUtils
.
join
(
feePurchaseOrderFields
,
","
));
updateConfig
(
feePurchaseOrderConfig
);
TenantConfig
costPurchaseOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
cost_purchase_order
);
costPurchaseOrderConfig
.
setAttrValue
(
StringUtils
.
join
(
costPurchaseOrderFields
,
","
));
updateConfig
(
costPurchaseOrderConfig
);
String
[]
feePurchaseRejectOrderFields
=
getParaValues
(
"fee_purchase_reject_order_field"
);
String
[]
costPurchaseRejectOrderFields
=
getParaValues
(
"cost_purchase_reject_order_field"
);
TenantConfig
feePurchaseRejectOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
fee_purchase_reject_order
);
feePurchaseRejectOrderConfig
.
setAttrValue
(
StringUtils
.
join
(
feePurchaseRejectOrderFields
,
","
));
updateConfig
(
feePurchaseRejectOrderConfig
);
TenantConfig
costPurchaseRejectOrderConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
cost_purchase_reject_order
);
costPurchaseRejectOrderConfig
.
setAttrValue
(
StringUtils
.
join
(
costPurchaseRejectOrderFields
,
","
));
updateConfig
(
costPurchaseRejectOrderConfig
);
TenantConfig
oancConfig
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
order_audit_notice_config
);
TenantConfigEnum
tenantConfigEnum
=
TenantConfigEnum
.
getEnum
(
oancConfig
.
getAttrKey
());
JSONObject
configValue
=
JSONObject
.
parseObject
(
tenantConfigEnum
.
getValue
());
for
(
String
key
:
configValue
.
keySet
())
{
configValue
.
put
(
key
,
get
(
key
));
// 字段名就是KEY
}
configValue
.
put
(
"config_open"
,
true
);
oancConfig
.
setAttrValue
(
configValue
.
toJSONString
());
updateConfig
(
oancConfig
);
Enumeration
<
String
>
paraNames
=
getParaNames
();
while
(
paraNames
.
hasMoreElements
())
{
String
paraName
=
paraNames
.
nextElement
();
String
paraValue
=
get
(
paraName
);
TenantConfig
config
=
TenantConfig
.
dao
.
findByKeyCache
(
TenantConfigEnum
.
getEnum
(
paraName
));
if
(
config
==
null
)
{
continue
;
}
if
(
StringUtils
.
isEmpty
(
paraValue
))
{
paraValue
=
"false"
;
}
config
.
setAttrValue
(
paraValue
);
updateConfig
(
config
);
}
renderJson
(
Ret
.
ok
());
}
/**更新或者创建配置
* @param config
*/
private
void
updateConfig
(
TenantConfig
config
)
{
if
(
config
.
getId
()
==
null
||
config
.
getId
()
<=
0
)
{
config
.
setCreatedAt
(
new
Date
());
config
.
setUpdatedAt
(
new
Date
());
config
.
save
();
}
else
{
config
.
setUpdatedAt
(
new
Date
());
config
.
update
();
}
}
}
\ No newline at end of file
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/SystemOperLogController.java
0 → 100644
浏览文件 @
93c39725
package
com.bytechainx.psi.web.web.controller.setting
;
import
com.bytechainx.psi.common.EnumConstant.FlagEnum
;
import
com.bytechainx.psi.common.EnumConstant.UserActiveStatusEnum
;
import
com.bytechainx.psi.common.Permissions
;
import
com.bytechainx.psi.common.annotation.Permission
;
import
com.bytechainx.psi.common.model.TenantAdmin
;
import
com.bytechainx.psi.common.model.TenantOperLog
;
import
com.bytechainx.psi.common.service.setting.SystemOperLogService
;
import
com.bytechainx.psi.common.service.setting.TenantAdminService
;
import
com.bytechainx.psi.web.web.controller.base.BaseController
;
import
com.jfinal.aop.Inject
;
import
com.jfinal.core.Path
;
import
com.jfinal.kit.Kv
;
import
com.jfinal.kit.Ret
;
import
com.jfinal.plugin.activerecord.Page
;
/**
* 操作日志
*/
@Path
(
"/setting/system/operLog"
)
public
class
SystemOperLogController
extends
BaseController
{
@Inject
private
SystemOperLogService
operLogService
;
@Inject
private
TenantAdminService
adminService
;
/**
* 首页
*/
@Permission
(
Permissions
.
setting_system_operLog
)
public
void
index
()
{
Kv
condkv
=
Kv
.
create
();
condkv
.
set
(
"active_status"
,
UserActiveStatusEnum
.
enable
.
getValue
());
condkv
.
set
(
"login_flag"
,
FlagEnum
.
YES
.
getValue
());
Page
<
TenantAdmin
>
adminPage
=
adminService
.
paginate
(
condkv
,
1
,
maxPageSize
);
setAttr
(
"adminPage"
,
adminPage
);
}
/**
* 列表
*/
@Permission
(
Permissions
.
setting_system_operLog
)
public
void
list
()
{
int
pageNumber
=
getInt
(
"pageNumber"
,
1
);
Kv
condkv
=
Kv
.
create
();
condkv
.
set
(
"tenant_admin_id"
,
getInt
(
"tenant_admin_id"
));
condkv
.
set
(
"log_type"
,
getInt
(
"log_type"
));
condkv
.
set
(
"oper_desc"
,
get
(
"keyword"
));
String
startTime
=
get
(
"start_time"
);
String
endTime
=
get
(
"end_time"
);
Page
<
TenantOperLog
>
page
=
operLogService
.
paginate
(
condkv
,
startTime
,
endTime
,
pageNumber
,
pageSize
);
setAttr
(
"page"
,
page
);
}
/**
* 查看
*/
@Permission
(
Permissions
.
setting_system_operLog_show
)
public
void
show
()
{
renderJson
(
Ret
.
ok
());
}
}
\ No newline at end of file
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/TenantAdminController.java
0 → 100644
浏览文件 @
93c39725
package
com.bytechainx.psi.web.web.controller.setting
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
com.bytechainx.psi.common.EnumConstant.UserActiveStatusEnum
;
import
com.bytechainx.psi.common.Permissions
;
import
com.bytechainx.psi.common.annotation.Permission
;
import
com.bytechainx.psi.common.dto.ConditionFilter
;
import
com.bytechainx.psi.common.dto.ConditionFilter.Operator
;
import
com.bytechainx.psi.common.model.TenantAdmin
;
import
com.bytechainx.psi.common.service.setting.TenantAdminService
;
import
com.bytechainx.psi.common.service.setting.TenantRoleService
;
import
com.bytechainx.psi.purchase.service.StockWarehouseService
;
import
com.bytechainx.psi.web.web.controller.base.BaseController
;
import
com.jfinal.aop.Before
;
import
com.jfinal.aop.Inject
;
import
com.jfinal.core.Path
;
import
com.jfinal.kit.Kv
;
import
com.jfinal.kit.Ret
;
import
com.jfinal.plugin.activerecord.Page
;
import
com.jfinal.plugin.activerecord.tx.Tx
;
/**
* 员工管理
*/
@Path
(
"/setting/tenant/admin"
)
public
class
TenantAdminController
extends
BaseController
{
@Inject
private
TenantAdminService
adminService
;
@Inject
private
TenantRoleService
roleService
;
@Inject
private
StockWarehouseService
warehouseService
;
/**
* 首页
*/
@Permission
(
Permissions
.
setting_tenant_admin
)
public
void
index
()
{
setAttr
(
"hideStopFlag"
,
true
);
}
/**
* 列表
*/
@Permission
(
Permissions
.
setting_tenant_admin
)
public
void
list
()
{
int
pageNumber
=
getInt
(
"pageNumber"
,
1
);
Boolean
hideStopFlag
=
getBoolean
(
"hide_stop_flag"
,
true
);
// 隐藏停用
Kv
condKv
=
Kv
.
create
();
if
(
hideStopFlag
)
{
ConditionFilter
filter
=
new
ConditionFilter
();
filter
.
setOperator
(
Operator
.
neq
);
filter
.
setValue
(
UserActiveStatusEnum
.
disable
.
getValue
());
condKv
.
set
(
"active_status"
,
filter
);
}
Page
<
TenantAdmin
>
page
=
adminService
.
paginate
(
condKv
,
pageNumber
,
pageSize
);
setAttr
(
"page"
,
page
);
}
/**
* 查看
*/
@Permission
(
Permissions
.
setting_tenant_admin_show
)
public
void
show
()
{
renderJson
(
Ret
.
ok
());
}
/**
* 添加
*/
@Permission
(
Permissions
.
setting_tenant_admin_create
)
public
void
add
()
{
setAttrCommon
();
}
/**
* 修改
*/
@Permission
(
Permissions
.
setting_tenant_admin_create
)
@Before
(
Tx
.
class
)
public
void
create
()
{
TenantAdmin
admin
=
getModel
(
TenantAdmin
.
class
,
""
,
true
);
Ret
ret
=
adminService
.
create
(
admin
);
renderJson
(
ret
);
}
/**
* 编辑
*/
@Permission
(
Permissions
.
setting_tenant_admin_update
)
public
void
edit
()
{
Integer
id
=
getInt
(
"id"
);
if
(
id
==
null
||
id
<=
0
)
{
renderError
(
404
);
return
;
}
TenantAdmin
admin
=
TenantAdmin
.
dao
.
findById
(
id
);
if
(
admin
==
null
)
{
renderError
(
404
);
return
;
}
setAttrCommon
();
admin
.
remove
(
"password"
,
"encrypt"
);
setAttr
(
"tenantAdmin"
,
admin
);
}
/**
* 修改
*/
@Permission
(
Permissions
.
setting_tenant_admin_update
)
@Before
(
Tx
.
class
)
public
void
update
()
{
TenantAdmin
admin
=
getModel
(
TenantAdmin
.
class
,
""
,
true
);
Ret
ret
=
adminService
.
update
(
admin
);
renderJson
(
ret
);
}
/**
* 停用
*/
@Permission
(
Permissions
.
setting_tenant_admin_disable
)
@Before
(
Tx
.
class
)
public
void
disable
()
{
Integer
id
=
getInt
(
"id"
);
if
(
id
==
null
||
id
<=
0
)
{
renderJson
(
Ret
.
fail
(
"ID不能为空"
));
return
;
}
Ret
ret
=
adminService
.
disable
(
Arrays
.
asList
(
id
));
renderJson
(
ret
);
}
/**
* 启用
*/
@Permission
(
Permissions
.
setting_tenant_admin_disable
)
@Before
(
Tx
.
class
)
public
void
enable
()
{
Integer
id
=
getInt
(
"id"
);
if
(
id
==
null
||
id
<=
0
)
{
renderJson
(
Ret
.
fail
(
"ID不能为空"
));
return
;
}
Ret
ret
=
adminService
.
enable
(
Arrays
.
asList
(
id
));
renderJson
(
ret
);
}
/**
* 加载公共数据
*/
private
void
setAttrCommon
()
{
Page
<?>
rolePage
=
roleService
.
paginate
(
1
,
maxPageSize
);
setAttr
(
"roleList"
,
rolePage
.
getList
());
}
/**
* 经手人列表
*/
@Permission
({
Permissions
.
inventory_purchase
,
Permissions
.
inventory_stock
,
Permissions
.
fund
,
Permissions
.
sale
})
public
void
listByJson
()
{
int
pageNumber
=
getInt
(
"pageNumber"
,
1
);
String
keyword
=
get
(
"keyword"
);
Kv
condKv
=
Kv
.
create
();
condKv
.
set
(
"active_status"
,
UserActiveStatusEnum
.
enable
.
getValue
());
condKv
.
set
(
"real_name,code"
,
keyword
);
// 多字段模糊查询
TenantAdmin
currentAdmin
=
getCurrentAdmin
();
List
<
TenantAdmin
>
adminList
=
new
ArrayList
<>();
Page
<
TenantAdmin
>
page
=
adminService
.
paginate
(
condKv
,
pageNumber
,
maxPageSize
);
for
(
TenantAdmin
admin
:
page
.
getList
())
{
// 当前用户是主帐号,或者遍历员工是主帐号,或者遍历员工有所有门店权限
if
(
currentAdmin
.
getMainAccountFlag
()
||
admin
.
getMainAccountFlag
())
{
adminList
.
add
(
admin
);
continue
;
}
}
page
.
setList
(
adminList
);
renderJson
(
Ret
.
ok
().
set
(
"data"
,
page
.
getList
()));
}
}
\ No newline at end of file
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/TenantInfoController.java
0 → 100644
浏览文件 @
93c39725
package
com.bytechainx.psi.web.web.controller.setting
;
import
com.bytechainx.psi.common.Permissions
;
import
com.bytechainx.psi.common.annotation.Permission
;
import
com.bytechainx.psi.common.model.TenantOrg
;
import
com.bytechainx.psi.common.service.setting.TenantInfoService
;
import
com.bytechainx.psi.web.web.controller.base.BaseController
;
import
com.jfinal.aop.Inject
;
import
com.jfinal.core.Path
;
import
com.jfinal.kit.Ret
;
/**
* 商户信息
*/
@Path
(
"/setting/tenant/info"
)
public
class
TenantInfoController
extends
BaseController
{
@Inject
private
TenantInfoService
infoService
;
/**
* 首页
*/
@Permission
(
Permissions
.
setting_tenant_info
)
public
void
index
()
{
}
/**
* 列表
*/
@Permission
(
Permissions
.
setting_tenant_info
)
public
void
list
()
{
setAttr
(
"tenantInfo"
,
TenantOrg
.
dao
.
findTop
());
}
/**
* 查看
*/
@Permission
(
Permissions
.
setting_tenant_info_show
)
public
void
show
()
{
renderJson
(
Ret
.
ok
());
}
/**
* 编辑
*/
@Permission
(
Permissions
.
setting_tenant_info_update
)
public
void
edit
()
{
setAttr
(
"tenantInfo"
,
TenantOrg
.
dao
.
findTop
());
}
/**
* 修改
*/
@Permission
(
Permissions
.
setting_tenant_info_update
)
public
void
update
()
{
TenantOrg
tenantOrg
=
getModel
(
TenantOrg
.
class
,
""
,
true
);
Ret
ret
=
infoService
.
update
(
tenantOrg
);
renderJson
(
ret
);
}
}
\ No newline at end of file
psi-web/src/main/java/com/bytechainx/psi/web/web/controller/setting/TenantRoleController.java
0 → 100644
浏览文件 @
93c39725
package
com.bytechainx.psi.web.web.controller.setting
;
import
java.util.Arrays
;
import
java.util.List
;
import
com.bytechainx.psi.common.Permissions
;
import
com.bytechainx.psi.common.annotation.Permission
;
import
com.bytechainx.psi.common.model.SystemOper
;
import
com.bytechainx.psi.common.model.TenantRole
;
import
com.bytechainx.psi.common.service.setting.TenantRoleService
;
import
com.bytechainx.psi.web.web.controller.base.BaseController
;
import
com.jfinal.aop.Before
;
import
com.jfinal.aop.Inject
;
import
com.jfinal.core.Path
;
import
com.jfinal.kit.Ret
;
import
com.jfinal.plugin.activerecord.Page
;
import
com.jfinal.plugin.activerecord.tx.Tx
;
/**
* 角色管理
*/
@Path
(
"/setting/tenant/role"
)
public
class
TenantRoleController
extends
BaseController
{
@Inject
private
TenantRoleService
roleService
;
/**
* 首页
*/
@Permission
(
Permissions
.
setting_tenant_role
)
public
void
index
()
{
}
/**
* 列表
*/
@Permission
(
Permissions
.
setting_tenant_role_show
)
public
void
list
()
{
int
pageNumber
=
getInt
(
"pageNumber"
,
1
);
Page
<
TenantRole
>
page
=
roleService
.
paginate
(
pageNumber
,
pageSize
);
setAttr
(
"page"
,
page
);
}
/**
* 查看
*/
@Permission
(
Permissions
.
setting_tenant_role_show
)
public
void
show
()
{
renderJson
(
Ret
.
ok
());
}
/**
* 添加
*/
@Permission
(
Permissions
.
setting_tenant_role_create
)
public
void
add
()
{
setAttrCommon
();
}
/**
* 修改
*/
@Permission
(
Permissions
.
setting_tenant_role_create
)
@Before
(
Tx
.
class
)
public
void
create
()
{
TenantRole
role
=
getModel
(
TenantRole
.
class
,
""
,
true
);
role
.
setOperCodes
(
getParaValues
(
"operCodes"
));
Ret
ret
=
roleService
.
create
(
role
);
renderJson
(
ret
);
}
/**
* 编辑
*/
@Permission
(
Permissions
.
setting_tenant_role_update
)
public
void
edit
()
{
Integer
id
=
getInt
(
"id"
);
if
(
id
==
null
||
id
<=
0
)
{
renderError
(
404
);
return
;
}
TenantRole
role
=
TenantRole
.
dao
.
findById
(
id
);
if
(
role
==
null
)
{
renderError
(
404
);
return
;
}
setAttrCommon
();
setAttr
(
"tenantRole"
,
role
);
}
/**
* 修改
*/
@Permission
(
Permissions
.
setting_tenant_role_update
)
@Before
(
Tx
.
class
)
public
void
update
()
{
TenantRole
role
=
getModel
(
TenantRole
.
class
,
""
,
true
);
role
.
setOperCodes
(
getParaValues
(
"operCodes"
));
Ret
ret
=
roleService
.
update
(
role
);
renderJson
(
ret
);
}
/**
* 删除
*/
@Permission
(
Permissions
.
setting_tenant_role_delete
)
@Before
(
Tx
.
class
)
public
void
delete
()
{
Integer
id
=
getInt
(
"id"
);
if
(
id
==
null
||
id
<=
0
)
{
renderJson
(
Ret
.
fail
(
"ID不能为空"
));
return
;
}
Ret
ret
=
roleService
.
delete
(
Arrays
.
asList
(
id
));
renderJson
(
ret
);
}
/**
* 加载公共数据
*/
private
void
setAttrCommon
()
{
List
<
SystemOper
>
topDataList
=
SystemOper
.
dao
.
findDataTopList
();
List
<
SystemOper
>
topFeatureList
=
SystemOper
.
dao
.
findFeatureTopList
();
setAttr
(
"topDataList"
,
topDataList
);
setAttr
(
"topFeatureList"
,
topFeatureList
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录