Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-fb
Overview
Overview
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
王衍超
cloud-fb
Commits
0f1f4285
Commit
0f1f4285
authored
Apr 22, 2021
by
王炜晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
需用计划分析 查询组件接口支持场站
parent
4fd00b93
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
739 additions
and
2 deletions
+739
-2
build.gradle
backend/xyst.dinas.biz/build.gradle
+2
-0
BizDataInitializerConfig.java
...a/com/xyst/dinas/biz/config/BizDataInitializerConfig.java
+24
-0
SandAdvancedQueryController.java
...a/com/xyst/dinas/biz/web/SandAdvancedQueryController.java
+126
-0
SandSceneController.java
...main/java/com/xyst/dinas/biz/web/SandSceneController.java
+130
-0
WarehouseAdvancedQueryController.java
.../xyst/dinas/biz/web/WarehouseAdvancedQueryController.java
+126
-0
WarehouseSceneController.java
...java/com/xyst/dinas/biz/web/WarehouseSceneController.java
+130
-0
NeedPlanAdvQuery.jmx
...rces/com/xyst/dinas/sales/advanquery/NeedPlanAdvQuery.jmx
+32
-0
NeedPlanQueryView.jmx
...ces/com/xyst/dinas/sales/advanquery/NeedPlanQueryView.jmx
+167
-0
SalesPlanAdvQuery.jmx
...ces/com/xyst/dinas/sales/advanquery/SalesPlanAdvQuery.jmx
+2
-2
No files found.
backend/xyst.dinas.biz/build.gradle
View file @
0f1f4285
...
@@ -9,12 +9,14 @@ dependencies {
...
@@ -9,12 +9,14 @@ dependencies {
compile
lib
.
jackson_datatype_jdk8
compile
lib
.
jackson_datatype_jdk8
compile
lib
.
jackson_datatype_jsr310
compile
lib
.
jackson_datatype_jsr310
compile
lib
.
json
compile
lib
.
json
compile
lib
.
bcp_advanced_query
compile
"com.beecode:bap2.participant:${aminoVersion}"
compile
"com.beecode:bap2.participant:${aminoVersion}"
compile
"com.beecode:bcp.org:${aminoVersion}"
compile
"com.beecode:bcp.org:${aminoVersion}"
compile
"com.beecode:bap2.department:${aminoVersion}"
compile
"com.beecode:bap2.department:${aminoVersion}"
compile
"com.beecode:bap2.staff:${aminoVersion}"
compile
"com.beecode:bap2.staff:${aminoVersion}"
compile
'com.deepoove:poi-tl:1.5.0'
compile
'com.deepoove:poi-tl:1.5.0'
compile
project
(
":inz.common"
)
compile
project
(
":inz.common"
)
compile
project
(
":inz.query"
)
compile
project
(
":inz.query"
)
compile
project
(
":inz.workflow"
)
compile
project
(
":inz.workflow"
)
...
...
backend/xyst.dinas.biz/src/main/java/com/xyst/dinas/biz/config/BizDataInitializerConfig.java
View file @
0f1f4285
...
@@ -3,6 +3,10 @@ package com.xyst.dinas.biz.config;
...
@@ -3,6 +3,10 @@ package com.xyst.dinas.biz.config;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
com.xyst.dinas.biz.init.OrganizationDataInitializer
;
import
com.xyst.dinas.biz.init.OrganizationDataInitializer
;
import
com.xyst.dinas.biz.web.SandAdvancedQueryController
;
import
com.xyst.dinas.biz.web.SandSceneController
;
import
com.xyst.dinas.biz.web.WarehouseAdvancedQueryController
;
import
com.xyst.dinas.biz.web.WarehouseSceneController
;
import
com.xyst.dinas.biz.handler.DinasPrepareEventHandlers
;
import
com.xyst.dinas.biz.handler.DinasPrepareEventHandlers
;
@Configuration
@Configuration
...
@@ -17,4 +21,24 @@ public class BizDataInitializerConfig {
...
@@ -17,4 +21,24 @@ public class BizDataInitializerConfig {
public
OrganizationDataInitializer
organizationDataInitializer
(){
public
OrganizationDataInitializer
organizationDataInitializer
(){
return
new
OrganizationDataInitializer
();
return
new
OrganizationDataInitializer
();
}
}
@Bean
(
"com.xyst.dinas.biz.web.SandAdvancedQueryController"
)
public
SandAdvancedQueryController
sandAdvancedQueryController
(){
return
new
SandAdvancedQueryController
();
}
@Bean
(
"com.xyst.dinas.biz.web.WarehouseAdvancedQueryController"
)
public
WarehouseAdvancedQueryController
warehouseAdvancedQueryController
(){
return
new
WarehouseAdvancedQueryController
();
}
@Bean
(
"com.xyst.dinas.biz.web.SandSceneController"
)
public
SandSceneController
sandSceneController
(){
return
new
SandSceneController
();
}
@Bean
(
"com.xyst.dinas.biz.web.OrganizationDataInitializer"
)
public
WarehouseSceneController
warehouseSceneController
(){
return
new
WarehouseSceneController
();
}
}
}
backend/xyst.dinas.biz/src/main/java/com/xyst/dinas/biz/web/SandAdvancedQueryController.java
0 → 100644
View file @
0f1f4285
package
com
.
xyst
.
dinas
.
biz
.
web
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.beecode.amino.common.Convert
;
import
com.beecode.amino.core.Amino
;
import
com.beecode.bcp.advanced.query.QueryPreprocessor
;
import
com.beecode.bcp.advanced.query.QueryPreprocessorFactory
;
import
com.beecode.bcp.advanced.query.bean.PaginationResult
;
import
com.beecode.bcp.advanced.query.bean.QueryParameter
;
import
com.beecode.bcp.advanced.query.bean.QueryTemplate
;
import
com.beecode.bcp.advanced.query.bean.QueryView
;
import
com.beecode.bcp.advanced.query.bean.RowData
;
import
com.beecode.bcp.advanced.query.service.QueryMetaService
;
import
com.beecode.bcp.advanced.query.service.QueryService
;
import
com.fasterxml.jackson.databind.JsonNode
;
@RestController
@RequestMapping
(
"/sand/user/bcp/query/advance"
)
public
class
SandAdvancedQueryController
{
@Autowired
private
QueryService
service
;
@Autowired
private
QueryMetaService
metaService
;
@PostMapping
(
value
=
"/view"
)
public
Object
getViewContent
(
@RequestParam
String
queryView
){
QueryView
view
=
Amino
.
getApplicationContext
().
getBean
(
queryView
,
QueryView
.
class
);
return
view
.
getViewContent
();
}
@PostMapping
(
value
=
"/query"
)
public
String
getQueryInfo
(
@RequestBody
QueryParameter
queryParameter
)
{
QueryTemplate
template
=
metaService
.
getQueryTemplate
(
queryParameter
.
getDatasource
());
QueryPreprocessor
preprocessor
=
QueryPreprocessorFactory
.
newInstance
(
queryParameter
,
template
);
List
<
RowData
>
rows
=
service
.
queryList
(
preprocessor
);
int
count
=
service
.
queryCount
(
preprocessor
);
PaginationResult
result
=
new
PaginationResult
();
result
.
setRows
(
rows
);
result
.
setTotalCount
(
count
);
return
result
.
toString
();
}
@PostMapping
(
value
=
"/count"
)
public
Object
getCount
(
@RequestBody
QueryParameter
queryParameter
)
{
QueryTemplate
template
=
metaService
.
getQueryTemplate
(
queryParameter
.
getDatasource
());
QueryPreprocessor
preprocessor
=
QueryPreprocessorFactory
.
newInstance
(
queryParameter
,
template
);
return
service
.
queryCount
(
preprocessor
);
}
@PostMapping
(
value
=
"/total"
)
public
String
queryTotal
(
@RequestBody
QueryParameter
queryParameter
)
{
QueryTemplate
template
=
metaService
.
getQueryTemplate
(
queryParameter
.
getDatasource
());
QueryPreprocessor
preprocessor
=
QueryPreprocessorFactory
.
newInstance
(
queryParameter
,
template
);
RowData
row
=
service
.
queryTotal
(
preprocessor
);
if
(
null
==
row
)
{
return
RowData
.
EMPTY
.
toString
();
}
return
row
.
toString
();
}
@PostMapping
(
value
=
"/subTotal"
)
public
String
querySubTotal
(
@RequestBody
QueryParameter
queryParameter
)
{
QueryTemplate
template
=
metaService
.
getQueryTemplate
(
queryParameter
.
getDatasource
());
QueryPreprocessor
preprocessor
=
QueryPreprocessorFactory
.
newInstance
(
queryParameter
,
template
);
RowData
row
=
service
.
querySubTotal
(
preprocessor
);
if
(
null
==
row
)
{
return
RowData
.
EMPTY
.
toString
();
}
return
row
.
toString
();
}
@PostMapping
(
value
=
"/counts"
)
public
List
<
Integer
>
getCounts
(
@RequestBody
List
<
QueryParameter
>
queryParameters
)
{
List
<
Integer
>
result
=
new
ArrayList
<>();
for
(
QueryParameter
qp
:
queryParameters
)
{
result
.
add
((
Integer
)
getCount
(
qp
));
}
return
result
;
}
@PostMapping
(
value
=
"/groupCount"
)
public
List
<
Integer
>
getGroupCount
(
@RequestBody
JsonNode
body
)
{
JsonNode
groupCount
=
body
.
get
(
"groupCount"
);
JsonNode
names
=
body
.
get
(
"groupNames"
);
String
datasource
=
groupCount
.
get
(
"dataSource"
).
asText
();
QueryTemplate
template
=
metaService
.
getQueryTemplate
(
datasource
);
QueryParameter
qp
=
new
QueryParameter
();
qp
.
setDatasource
(
datasource
);
QueryPreprocessor
preprocessor
=
QueryPreprocessorFactory
.
newInstance
(
qp
,
template
);
Map
<
String
,
Integer
>
valueMap
=
new
HashMap
<>();
List
<
RowData
>
rds
=
service
.
queryList
(
preprocessor
);
int
allcount
=
0
;
for
(
RowData
rd
:
rds
)
{
int
cv
=
Convert
.
toInt
(
rd
.
get
(
"value"
));
valueMap
.
put
((
String
)
rd
.
get
(
"key"
),
cv
);
allcount
+=
cv
;
}
if
(!
valueMap
.
containsKey
(
"all"
))
{
valueMap
.
put
(
"all"
,
allcount
);
}
List
<
Integer
>
result
=
new
ArrayList
<>();
JsonNode
keyMap
=
groupCount
.
get
(
"keyMap"
);
for
(
int
i
=
0
;
i
<
names
.
size
();
i
++)
{
String
name
=
names
.
get
(
i
).
asText
();
String
value
=
keyMap
.
get
(
name
).
asText
();
result
.
add
(
valueMap
.
get
(
value
));
}
return
result
;
}
}
backend/xyst.dinas.biz/src/main/java/com/xyst/dinas/biz/web/SandSceneController.java
0 → 100644
View file @
0f1f4285
package
com
.
xyst
.
dinas
.
biz
.
web
;
import
java.util.List
;
import
java.util.UUID
;
import
org.json.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.beecode.bcp.advanced.query.StringUtils
;
import
com.beecode.bcp.advanced.query.constant.CustomSceneConstant
;
import
com.beecode.bcp.advanced.query.exception.SceneException
;
import
com.beecode.bcp.advanced.query.service.SceneService
;
import
com.beecode.bcp.type.KClass
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.bcp.type.json.JSONObjectUtils
;
@RestController
@RequestMapping
(
value
=
"/sand/user/bcp/query/advance/scene"
)
public
class
SandSceneController
{
@Autowired
private
SceneService
service
;
@Autowired
@Qualifier
(
CustomSceneConstant
.
ENTITY
)
private
KClass
kclass
;
/**
* 创建新的场景
* @param scene 场景对象
*/
@PostMapping
(
value
=
"/create"
)
public
void
create
(
@RequestBody
String
scene
)
{
KObject
object
=
toKObject
(
scene
);
String
title
=
object
.
getString
(
CustomSceneConstant
.
TITLE
);
if
(
StringUtils
.
isBlank
(
title
))
{
throw
new
SceneException
(
"场景标题不能为空"
);
}
String
content
=
object
.
getString
(
CustomSceneConstant
.
CONTENT
);
if
(
StringUtils
.
isBlank
(
content
))
{
throw
new
SceneException
(
"场景内容不能为空"
);
}
service
.
create
(
object
);
}
/**
* 修改现有场景
* @param scene 场景对象
*/
@PostMapping
(
value
=
"/update"
)
public
void
update
(
@RequestBody
String
scene
)
{
KObject
object
=
toKObject
(
scene
);
// ContextUser user = CurrentInfo.getCurrentUser();
// if(null == user) {
// throw new SceneException("当前登录人信息获取失败");
// }
// UUID creatorId = object.getUuid(CustomSceneConstant.CREATOR_ID);
// if(null == creatorId) {
// throw new SceneException("不能修改非本人创建的场景");
// }
// UUID currentUserId = UUID.fromString(user.getId());
// if(!creatorId.equals(currentUserId)) {
// throw new SceneException("不能修改非本人创建的场景");
// }
service
.
update
(
object
);
}
/**
* 获取当前登录人的所有场景
* @param viewName 查询视图元数据名称
* @param group 查询页签名称
* @return
*/
@GetMapping
(
value
=
"/query"
)
public
String
query
(
@RequestParam
(
name
=
"viewName"
,
required
=
true
)
String
viewName
,
@RequestParam
(
name
=
"group"
,
required
=
true
)
String
group
)
{
// ContextUser user = CurrentInfo.getCurrentUser();
// if(null == user) {
// throw new SceneException("当前登录人信息获取失败");
// }
List
<
KObject
>
scenes
=
service
.
query
(
viewName
,
group
);
if
(
scenes
.
isEmpty
())
{
return
"[]"
;
}
return
JSONObjectUtils
.
toArrayNode
(
scenes
).
toString
();
}
/**
* 删除场景
* @param id 场景id
*/
@PostMapping
(
value
=
"/delete/{id}"
)
public
void
delete
(
@PathVariable
(
"id"
)
String
sid
)
{
if
(
StringUtils
.
isBlank
(
sid
))
{
return
;
}
UUID
id
=
UUID
.
fromString
(
sid
);
service
.
delete
(
id
);
}
private
KObject
toKObject
(
String
content
)
{
JSONObject
object
=
new
JSONObject
(
content
);
KObject
kobject
=
kclass
.
newInstance
();
UUID
id
=
getUUIDField
(
object
,
CustomSceneConstant
.
ID
);
kobject
.
set
(
CustomSceneConstant
.
ID
,
id
);
kobject
.
set
(
CustomSceneConstant
.
CREATE_TIME
,
object
.
opt
(
CustomSceneConstant
.
CREATE_TIME
));
kobject
.
set
(
CustomSceneConstant
.
MODIFY_TIME
,
object
.
opt
(
CustomSceneConstant
.
MODIFY_TIME
));
kobject
.
set
(
CustomSceneConstant
.
CREATOR_ID
,
getUUIDField
(
object
,
CustomSceneConstant
.
CREATOR_ID
));
kobject
.
set
(
CustomSceneConstant
.
CREATOR_NAME
,
object
.
optString
(
CustomSceneConstant
.
CREATOR_NAME
));
kobject
.
set
(
CustomSceneConstant
.
TITLE
,
object
.
optString
(
CustomSceneConstant
.
TITLE
));
kobject
.
set
(
CustomSceneConstant
.
VIEW_NAME
,
object
.
optString
(
CustomSceneConstant
.
VIEW_NAME
));
kobject
.
set
(
CustomSceneConstant
.
GROUP
,
object
.
optString
(
CustomSceneConstant
.
GROUP
));
kobject
.
set
(
CustomSceneConstant
.
CONTENT
,
object
.
optString
(
CustomSceneConstant
.
CONTENT
));
return
kobject
;
}
private
UUID
getUUIDField
(
JSONObject
json
,
String
field
)
{
String
sid
=
json
.
optString
(
field
);
return
StringUtils
.
isBlank
(
sid
)
?
null
:
UUID
.
fromString
(
sid
);
}
}
backend/xyst.dinas.biz/src/main/java/com/xyst/dinas/biz/web/WarehouseAdvancedQueryController.java
0 → 100644
View file @
0f1f4285
package
com
.
xyst
.
dinas
.
biz
.
web
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.beecode.amino.common.Convert
;
import
com.beecode.amino.core.Amino
;
import
com.beecode.bcp.advanced.query.QueryPreprocessor
;
import
com.beecode.bcp.advanced.query.QueryPreprocessorFactory
;
import
com.beecode.bcp.advanced.query.bean.PaginationResult
;
import
com.beecode.bcp.advanced.query.bean.QueryParameter
;
import
com.beecode.bcp.advanced.query.bean.QueryTemplate
;
import
com.beecode.bcp.advanced.query.bean.QueryView
;
import
com.beecode.bcp.advanced.query.bean.RowData
;
import
com.beecode.bcp.advanced.query.service.QueryMetaService
;
import
com.beecode.bcp.advanced.query.service.QueryService
;
import
com.fasterxml.jackson.databind.JsonNode
;
@RestController
@RequestMapping
(
"/warehouse/api/bcp/query/advance"
)
public
class
WarehouseAdvancedQueryController
{
@Autowired
private
QueryService
service
;
@Autowired
private
QueryMetaService
metaService
;
@PostMapping
(
value
=
"/view"
)
public
Object
getViewContent
(
@RequestParam
String
queryView
){
QueryView
view
=
Amino
.
getApplicationContext
().
getBean
(
queryView
,
QueryView
.
class
);
return
view
.
getViewContent
();
}
@PostMapping
(
value
=
"/query"
)
public
String
getQueryInfo
(
@RequestBody
QueryParameter
queryParameter
)
{
QueryTemplate
template
=
metaService
.
getQueryTemplate
(
queryParameter
.
getDatasource
());
QueryPreprocessor
preprocessor
=
QueryPreprocessorFactory
.
newInstance
(
queryParameter
,
template
);
List
<
RowData
>
rows
=
service
.
queryList
(
preprocessor
);
int
count
=
service
.
queryCount
(
preprocessor
);
PaginationResult
result
=
new
PaginationResult
();
result
.
setRows
(
rows
);
result
.
setTotalCount
(
count
);
return
result
.
toString
();
}
@PostMapping
(
value
=
"/count"
)
public
Object
getCount
(
@RequestBody
QueryParameter
queryParameter
)
{
QueryTemplate
template
=
metaService
.
getQueryTemplate
(
queryParameter
.
getDatasource
());
QueryPreprocessor
preprocessor
=
QueryPreprocessorFactory
.
newInstance
(
queryParameter
,
template
);
return
service
.
queryCount
(
preprocessor
);
}
@PostMapping
(
value
=
"/total"
)
public
String
queryTotal
(
@RequestBody
QueryParameter
queryParameter
)
{
QueryTemplate
template
=
metaService
.
getQueryTemplate
(
queryParameter
.
getDatasource
());
QueryPreprocessor
preprocessor
=
QueryPreprocessorFactory
.
newInstance
(
queryParameter
,
template
);
RowData
row
=
service
.
queryTotal
(
preprocessor
);
if
(
null
==
row
)
{
return
RowData
.
EMPTY
.
toString
();
}
return
row
.
toString
();
}
@PostMapping
(
value
=
"/subTotal"
)
public
String
querySubTotal
(
@RequestBody
QueryParameter
queryParameter
)
{
QueryTemplate
template
=
metaService
.
getQueryTemplate
(
queryParameter
.
getDatasource
());
QueryPreprocessor
preprocessor
=
QueryPreprocessorFactory
.
newInstance
(
queryParameter
,
template
);
RowData
row
=
service
.
querySubTotal
(
preprocessor
);
if
(
null
==
row
)
{
return
RowData
.
EMPTY
.
toString
();
}
return
row
.
toString
();
}
@PostMapping
(
value
=
"/counts"
)
public
List
<
Integer
>
getCounts
(
@RequestBody
List
<
QueryParameter
>
queryParameters
)
{
List
<
Integer
>
result
=
new
ArrayList
<>();
for
(
QueryParameter
qp
:
queryParameters
)
{
result
.
add
((
Integer
)
getCount
(
qp
));
}
return
result
;
}
@PostMapping
(
value
=
"/groupCount"
)
public
List
<
Integer
>
getGroupCount
(
@RequestBody
JsonNode
body
)
{
JsonNode
groupCount
=
body
.
get
(
"groupCount"
);
JsonNode
names
=
body
.
get
(
"groupNames"
);
String
datasource
=
groupCount
.
get
(
"dataSource"
).
asText
();
QueryTemplate
template
=
metaService
.
getQueryTemplate
(
datasource
);
QueryParameter
qp
=
new
QueryParameter
();
qp
.
setDatasource
(
datasource
);
QueryPreprocessor
preprocessor
=
QueryPreprocessorFactory
.
newInstance
(
qp
,
template
);
Map
<
String
,
Integer
>
valueMap
=
new
HashMap
<>();
List
<
RowData
>
rds
=
service
.
queryList
(
preprocessor
);
int
allcount
=
0
;
for
(
RowData
rd
:
rds
)
{
int
cv
=
Convert
.
toInt
(
rd
.
get
(
"value"
));
valueMap
.
put
((
String
)
rd
.
get
(
"key"
),
cv
);
allcount
+=
cv
;
}
if
(!
valueMap
.
containsKey
(
"all"
))
{
valueMap
.
put
(
"all"
,
allcount
);
}
List
<
Integer
>
result
=
new
ArrayList
<>();
JsonNode
keyMap
=
groupCount
.
get
(
"keyMap"
);
for
(
int
i
=
0
;
i
<
names
.
size
();
i
++)
{
String
name
=
names
.
get
(
i
).
asText
();
String
value
=
keyMap
.
get
(
name
).
asText
();
result
.
add
(
valueMap
.
get
(
value
));
}
return
result
;
}
}
backend/xyst.dinas.biz/src/main/java/com/xyst/dinas/biz/web/WarehouseSceneController.java
0 → 100644
View file @
0f1f4285
package
com
.
xyst
.
dinas
.
biz
.
web
;
import
java.util.List
;
import
java.util.UUID
;
import
org.json.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.beecode.bcp.advanced.query.StringUtils
;
import
com.beecode.bcp.advanced.query.constant.CustomSceneConstant
;
import
com.beecode.bcp.advanced.query.exception.SceneException
;
import
com.beecode.bcp.advanced.query.service.SceneService
;
import
com.beecode.bcp.type.KClass
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.bcp.type.json.JSONObjectUtils
;
@RestController
@RequestMapping
(
value
=
"/warehouse/api/bcp/query/advance/scene"
)
public
class
WarehouseSceneController
{
@Autowired
private
SceneService
service
;
@Autowired
@Qualifier
(
CustomSceneConstant
.
ENTITY
)
private
KClass
kclass
;
/**
* 创建新的场景
* @param scene 场景对象
*/
@PostMapping
(
value
=
"/create"
)
public
void
create
(
@RequestBody
String
scene
)
{
KObject
object
=
toKObject
(
scene
);
String
title
=
object
.
getString
(
CustomSceneConstant
.
TITLE
);
if
(
StringUtils
.
isBlank
(
title
))
{
throw
new
SceneException
(
"场景标题不能为空"
);
}
String
content
=
object
.
getString
(
CustomSceneConstant
.
CONTENT
);
if
(
StringUtils
.
isBlank
(
content
))
{
throw
new
SceneException
(
"场景内容不能为空"
);
}
service
.
create
(
object
);
}
/**
* 修改现有场景
* @param scene 场景对象
*/
@PostMapping
(
value
=
"/update"
)
public
void
update
(
@RequestBody
String
scene
)
{
KObject
object
=
toKObject
(
scene
);
// ContextUser user = CurrentInfo.getCurrentUser();
// if(null == user) {
// throw new SceneException("当前登录人信息获取失败");
// }
// UUID creatorId = object.getUuid(CustomSceneConstant.CREATOR_ID);
// if(null == creatorId) {
// throw new SceneException("不能修改非本人创建的场景");
// }
// UUID currentUserId = UUID.fromString(user.getId());
// if(!creatorId.equals(currentUserId)) {
// throw new SceneException("不能修改非本人创建的场景");
// }
service
.
update
(
object
);
}
/**
* 获取当前登录人的所有场景
* @param viewName 查询视图元数据名称
* @param group 查询页签名称
* @return
*/
@GetMapping
(
value
=
"/query"
)
public
String
query
(
@RequestParam
(
name
=
"viewName"
,
required
=
true
)
String
viewName
,
@RequestParam
(
name
=
"group"
,
required
=
true
)
String
group
)
{
// ContextUser user = CurrentInfo.getCurrentUser();
// if(null == user) {
// throw new SceneException("当前登录人信息获取失败");
// }
List
<
KObject
>
scenes
=
service
.
query
(
viewName
,
group
);
if
(
scenes
.
isEmpty
())
{
return
"[]"
;
}
return
JSONObjectUtils
.
toArrayNode
(
scenes
).
toString
();
}
/**
* 删除场景
* @param id 场景id
*/
@PostMapping
(
value
=
"/delete/{id}"
)
public
void
delete
(
@PathVariable
(
"id"
)
String
sid
)
{
if
(
StringUtils
.
isBlank
(
sid
))
{
return
;
}
UUID
id
=
UUID
.
fromString
(
sid
);
service
.
delete
(
id
);
}
private
KObject
toKObject
(
String
content
)
{
JSONObject
object
=
new
JSONObject
(
content
);
KObject
kobject
=
kclass
.
newInstance
();
UUID
id
=
getUUIDField
(
object
,
CustomSceneConstant
.
ID
);
kobject
.
set
(
CustomSceneConstant
.
ID
,
id
);
kobject
.
set
(
CustomSceneConstant
.
CREATE_TIME
,
object
.
opt
(
CustomSceneConstant
.
CREATE_TIME
));
kobject
.
set
(
CustomSceneConstant
.
MODIFY_TIME
,
object
.
opt
(
CustomSceneConstant
.
MODIFY_TIME
));
kobject
.
set
(
CustomSceneConstant
.
CREATOR_ID
,
getUUIDField
(
object
,
CustomSceneConstant
.
CREATOR_ID
));
kobject
.
set
(
CustomSceneConstant
.
CREATOR_NAME
,
object
.
optString
(
CustomSceneConstant
.
CREATOR_NAME
));
kobject
.
set
(
CustomSceneConstant
.
TITLE
,
object
.
optString
(
CustomSceneConstant
.
TITLE
));
kobject
.
set
(
CustomSceneConstant
.
VIEW_NAME
,
object
.
optString
(
CustomSceneConstant
.
VIEW_NAME
));
kobject
.
set
(
CustomSceneConstant
.
GROUP
,
object
.
optString
(
CustomSceneConstant
.
GROUP
));
kobject
.
set
(
CustomSceneConstant
.
CONTENT
,
object
.
optString
(
CustomSceneConstant
.
CONTENT
));
return
kobject
;
}
private
UUID
getUUIDField
(
JSONObject
json
,
String
field
)
{
String
sid
=
json
.
optString
(
field
);
return
StringUtils
.
isBlank
(
sid
)
?
null
:
UUID
.
fromString
(
sid
);
}
}
backend/xyst.dinas.sales/src/main/resources/com/xyst/dinas/sales/advanquery/NeedPlanAdvQuery.jmx
0 → 100644
View file @
0f1f4285
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
>
<specification>
1.0
</specification>
<id>
f21d842b-3613-4b14-9751-cfcb4b34e53c
</id>
<name>
com.xyst.dinas.sales.advanquery.NeedPlanAdvQuery
</name>
<title>
需用计划分析
</title>
<description>
需用计划分析
</description>
<define>
advanced.query.template
</define>
<define-version>
1.0
</define-version>
<content>
<template>
<sql-type>
SQL
</sql-type>
<sql>
SELECT
needPlan.id AS id,
xystorganization.NAME AS organization,
planningCycle.title AS planningCycleTitle,
projectFiled.projectName AS projectName,
'需用计划' AS type,
needPlan.needPlanTotalAmount AS needPlanTotalAmount,
salesPlan.planTotalAmount AS planTotalAmount
FROM
NeedPlan AS needPlan
LEFT JOIN xystOrganization AS xystorganization ON xystorganization.id = needPlan.regionalCompany
LEFT JOIN PlanningCycle AS planningCycle ON planningCycle.id = needPlan.planningCycle
LEFT JOIN SalesPlan AS salesPlan ON salesPlan.planningCycle = needPlan.planningCycle
LEFT JOIN ProjectFiled AS projectFiled ON projectFiled.id = needPlan.project
WHERE ( needPlan.DISCARD = FALSE OR needPlan.DISCARD IS NULL )
</sql>
</template>
</content>
</metadata>
backend/xyst.dinas.sales/src/main/resources/com/xyst/dinas/sales/advanquery/NeedPlanQueryView.jmx
0 → 100644
View file @
0f1f4285
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
>
<specification>
1.0
</specification>
<id>
36693223-9764-415d-9b49-17e8b2dfa608
</id>
<name>
com.xyst.dinas.sales.advanquery.NeedPlanQueryView
</name>
<title>
需用计划分析
</title>
<description>
需用计划分析
</description>
<define>
advanced.query.view
</define>
<define-version>
1.0
</define-version>
<content>
<view>
{
"name": "需用计划",
"title": "需用计划分析",
"description": "需用计划分析",
"actions": [],
"scenes" : {
"isShowScenes" : true
},
"fuzzySearch": [
],
"isShowTabCountZero": true,
"groups": [
{
"name": "all",
"title": "全部",
"content": {
"datasource": "com.xyst.dinas.sales.advanquery.NeedPlanAdvQuery"
}
}
],
"content": {
"isShowView": "table",
"datasource": "com.xyst.dinas.sales.advanquery.NeedPlanAdvQuery",
"arguments": {
"items": [
]
},
"actions": [
{
"param": [],
"enable": "ALL",
"name": "query_export",
"action": "query_export",
"title": "导出",
"type": ""
},
{
"name": "queryRefresh",
"title": "刷新",
"action": "queryRefresh",
"param": [],
"type": "",
"enable": "ALL"
}
],
"table": {
"selectType": "MULTI",
"serialNumber": "series",
"pageSize": 200,
"orders":[
],
"expand": false,
"columns": [
{
"type": "VALUE",
"title": "id",
"key": "id",
"columnType": {
"name" : "inner",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "区域公司",
"key": "organization",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "计划周期",
"key": "planningCycleTitle",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "项目名称",
"key": "projectName",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "计划类型",
"key": "type",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "需用计划量(吨)",
"key": "needPlanTotalAmount",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "销售计划量(吨)",
"key": "planTotalAmount",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type" : "ACTION",
"key" : "new_logo77b16046-4d20-4e43-b6bc-5e5e264014fe",
"title" : "操作列",
"width" : 150,
"actions" : [ {
"name" : "new_action",
"title" : "详情",
"action" : "openDetail",
"param" : {
"modelName" : "123"
},
"type" : ""
} ],
"nodeKey" : 13,
"align" : "center",
"isShow" : false
}
]
}
}
}
</view>
</content>
</metadata>
backend/xyst.dinas.sales/src/main/resources/com/xyst/dinas/sales/advanquery/SalesPlanAdvQuery.jmx
View file @
0f1f4285
...
@@ -25,8 +25,8 @@
...
@@ -25,8 +25,8 @@
LEFT JOIN xystOrganization AS xystorganization ON xystorganization.id = salesPlan.regionalCompany
LEFT JOIN xystOrganization AS xystorganization ON xystorganization.id = salesPlan.regionalCompany
LEFT JOIN PlanningCycle AS planningCycle ON planningCycle.id = salesPlan.planningCycle
LEFT JOIN PlanningCycle AS planningCycle ON planningCycle.id = salesPlan.planningCycle
LEFT JOIN NeedPlan AS needPlan ON needPlan.planningCycle = salesPlan.planningCycle
LEFT JOIN NeedPlan AS needPlan ON needPlan.planningCycle = salesPlan.planningCycle
LEFT JOIN ProjectFiled AS projectFiled ON projectFiled.id = needPlan.project
UNION
LEFT JOIN ProjectFiled AS projectFiled ON projectFiled.id = needPlan.project
WHERE ( salesPlan.DISCARD = FALSE OR salesPlan.DISCARD IS NULL )
WHERE ( salesPlan.DISCARD = FALSE OR salesPlan.DISCARD IS NULL )
UNION
SELECT
SELECT
salesPlanTemp.id AS id,
salesPlanTemp.id AS id,
xystorganizationrTemp.NAME AS organization,
xystorganizationrTemp.NAME AS organization,
...
...
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