Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-webapp-plug
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
base_platform_enterprise
gic-webapp-plug
Commits
8f8543be
Commit
8f8543be
authored
Aug 12, 2019
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义字段接口
parent
9975badf
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
662 additions
and
0 deletions
+662
-0
pom.xml
pom.xml
+10
-0
ScreeningController.java
...java/com/gic/plug/web/controller/ScreeningController.java
+87
-0
ScreenBackStrategy.java
...in/java/com/gic/plug/web/strategy/ScreenBackStrategy.java
+5
-0
StoreAreaBackImpl.java
...ava/com/gic/plug/web/strategy/impl/StoreAreaBackImpl.java
+49
-0
StoreBackImpl.java
...in/java/com/gic/plug/web/strategy/impl/StoreBackImpl.java
+43
-0
StoreBrandBackImpl.java
...va/com/gic/plug/web/strategy/impl/StoreBrandBackImpl.java
+42
-0
StoreCustomBackImpl.java
...a/com/gic/plug/web/strategy/impl/StoreCustomBackImpl.java
+151
-0
StoreGroupBackImpl.java
...va/com/gic/plug/web/strategy/impl/StoreGroupBackImpl.java
+42
-0
StoreRegionBackImpl.java
...a/com/gic/plug/web/strategy/impl/StoreRegionBackImpl.java
+44
-0
StoreSelectBackImpl.java
...a/com/gic/plug/web/strategy/impl/StoreSelectBackImpl.java
+151
-0
StoreTagBackImpl.java
...java/com/gic/plug/web/strategy/impl/StoreTagBackImpl.java
+12
-0
ComputeBackUtil.java
src/main/java/com/gic/plug/web/utils/ComputeBackUtil.java
+26
-0
No files found.
pom.xml
View file @
8f8543be
...
...
@@ -123,6 +123,16 @@
<artifactId>
gic-redis-data
</artifactId>
<version>
${gic-redis-data}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-store-api
</artifactId>
<version>
${gic-store-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-search-business-api
</artifactId>
<version>
${gic-search-business-api}
</version>
</dependency>
</dependencies>
<build>
...
...
src/main/java/com/gic/plug/web/controller/ScreeningController.java
View file @
8f8543be
...
...
@@ -7,10 +7,18 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.constants.Constants
;
import
com.gic.enterprise.utils.UserDetailUtils
;
import
com.gic.plug.web.strategy.ScreenBackStrategy
;
import
com.gic.plug.web.strategy.impl.*
;
import
com.gic.search.business.api.constant.enums.OperateEnum
;
import
com.gic.store.constant.StoreESFieldsEnum
;
import
com.gic.widget.screening.api.dto.*
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -23,6 +31,8 @@ import com.gic.widget.screening.api.service.EsScreeningInitService;
import
com.gic.widget.screening.api.service.EsScreeningSearchService
;
import
com.gic.widget.screening.api.service.EsScreeningTemplateService
;
import
javax.annotation.PostConstruct
;
/**
*
*/
...
...
@@ -35,7 +45,49 @@ public class ScreeningController {
private
EsScreeningInitService
esScreeningInitService
;
@Autowired
private
EsScreeningTemplateService
esScreeningTemplateService
;
@Autowired
private
StoreAreaBackImpl
storeAreaBack
;
@Autowired
private
StoreBackImpl
storeBack
;
@Autowired
private
StoreBrandBackImpl
storeBrandBack
;
@Autowired
private
StoreCustomBackImpl
storeCustomBack
;
@Autowired
private
StoreGroupBackImpl
storeGroupBack
;
@Autowired
private
StoreRegionBackImpl
storeRegionBack
;
@Autowired
private
StoreSelectBackImpl
storeSelectBack
;
@Autowired
private
StoreTagBackImpl
storeTagBack
;
private
Map
<
String
,
ScreenBackStrategy
>
strategyMap
=
new
HashMap
<>();
@PostConstruct
public
void
init
(){
strategyMap
.
put
(
StoreESFieldsEnum
.
AREAIDS
.
getField
(),
storeAreaBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
STOREID
.
getField
(),
storeBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
STOREBRANDIDLIST
.
getField
(),
storeBrandBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
STOREGROUPIDLIST
.
getField
(),
storeGroupBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
REGIONID
.
getField
(),
storeRegionBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
STATUS
.
getField
(),
storeSelectBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
COMPLETESTATUS
.
getField
(),
storeSelectBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
CREATETYPE
.
getField
(),
storeSelectBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
STORETYPE
.
getField
(),
storeSelectBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
ERPSTATUS
.
getField
(),
storeSelectBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
STORETAG
.
getField
(),
storeTagBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
C1
.
getField
(),
storeCustomBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
C2
.
getField
(),
storeCustomBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
C3
.
getField
(),
storeCustomBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
C4
.
getField
(),
storeCustomBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
C5
.
getField
(),
storeCustomBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
C6
.
getField
(),
storeCustomBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
C7
.
getField
(),
storeCustomBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
C8
.
getField
(),
storeCustomBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
C9
.
getField
(),
storeCustomBack
);
strategyMap
.
put
(
StoreESFieldsEnum
.
C10
.
getField
(),
storeCustomBack
);
System
.
out
.
println
(
"对象初始化完成"
);
}
/**
* @return
* @throws
...
...
@@ -98,4 +150,39 @@ public class ScreeningController {
EsScreeningChainDetailDTO
dto
=
this
.
esScreeningInitService
.
findChainDetail
(
widgetChainId
);
return
RestResponse
.
success
(
dto
);
}
@RequestMapping
(
"screen-back"
)
@ResponseBody
public
String
screenBack
(
String
param
)
throws
ClassNotFoundException
{
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
JSONArray
array
=
JSON
.
parseArray
(
param
);
StringBuilder
backMessage
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
array
.
size
();
i
++){
JSONObject
jsonObject
=
array
.
getJSONObject
(
i
);
String
type
=
jsonObject
.
getString
(
"type"
);
if
(
StringUtils
.
isNotBlank
(
type
)){
if
(
OperateEnum
.
OPERATE_AND_NOT
.
getValue
().
equals
(
type
)){
backMessage
.
append
(
OperateEnum
.
OPERATE_AND_NOT
.
getDescribe
()).
append
(
" "
);
}
if
(
OperateEnum
.
OPERATE_OR
.
getValue
().
equals
(
type
)){
backMessage
.
append
(
OperateEnum
.
OPERATE_OR
.
getDescribe
()).
append
(
" "
);
}
}
JSONArray
list
=
jsonObject
.
getJSONArray
(
"list"
);
StringBuilder
stringBuilder
=
new
StringBuilder
(
"("
);
for
(
int
j
=
0
;
j
<
list
.
size
();
j
++){
JSONObject
json
=
list
.
getJSONObject
(
j
);
String
key
=
json
.
getJSONObject
(
"data"
).
getString
(
"key"
);
String
value
=
json
.
getJSONObject
(
"data"
).
getString
(
"value"
);
String
compute
=
json
.
getJSONObject
(
"data"
).
getString
(
"compute"
);
String
message
=
strategyMap
.
get
(
key
).
screenBack
(
compute
,
value
,
key
,
enterpriseId
);
stringBuilder
.
append
(
message
);
if
(
j
<
list
.
size
()-
1
){
stringBuilder
.
append
(
"并且"
);
}
}
stringBuilder
.
append
(
")"
);
}
return
""
;
}
}
src/main/java/com/gic/plug/web/strategy/ScreenBackStrategy.java
0 → 100644
View file @
8f8543be
package
com
.
gic
.
plug
.
web
.
strategy
;
public
interface
ScreenBackStrategy
{
String
screenBack
(
String
compute
,
String
value
,
String
key
,
Integer
enterpriseId
)
throws
ClassNotFoundException
;
}
src/main/java/com/gic/plug/web/strategy/impl/StoreAreaBackImpl.java
0 → 100644
View file @
8f8543be
package
com
.
gic
.
plug
.
web
.
strategy
.
impl
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.plug.web.strategy.ScreenBackStrategy
;
import
com.gic.plug.web.utils.ComputeBackUtil
;
import
com.gic.store.constant.StoreESFieldsEnum
;
import
com.gic.store.dto.CityDTO
;
import
com.gic.store.dto.ProvinceDTO
;
import
com.gic.store.service.ProvincesApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
public
class
StoreAreaBackImpl
implements
ScreenBackStrategy
{
@Autowired
private
ProvincesApiService
provincesApiService
;
@Override
public
String
screenBack
(
String
compute
,
String
value
,
String
key
,
Integer
enterpriseId
)
{
if
(
StringUtils
.
isNotBlank
(
value
)){
ServiceResponse
<
List
<
CityDTO
>>
cityResponse
=
this
.
provincesApiService
.
selectAllCity
();
StringBuilder
stringBuilder
=
new
StringBuilder
(
StoreESFieldsEnum
.
AREAIDS
.
getDesc
()).
append
(
" "
);
stringBuilder
.
append
(
ComputeBackUtil
.
getComputeBack
(
compute
)).
append
(
" "
);
if
(
cityResponse
.
isSuccess
()){
List
<
CityDTO
>
cityDTOList
=
cityResponse
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
cityDTOList
)){
String
[]
valueArr
=
value
.
split
(
" "
);
for
(
CityDTO
cityDTO
:
cityDTOList
){
for
(
String
s
:
valueArr
){
if
(
s
.
equals
(
cityDTO
.
getCityId
())){
String
provinceName
=
""
;
ServiceResponse
<
ProvinceDTO
>
provinceById
=
this
.
provincesApiService
.
getProvinceById
(
cityDTO
.
getProvinceId
());
if
(
provinceById
.
isSuccess
()){
provinceName
=
provinceById
.
getResult
().
getProvinceName
();
}
stringBuilder
.
append
(
"【"
).
append
(
cityDTO
.
getCityName
()).
append
(
"-"
).
append
(
provinceName
).
append
(
"】"
);
}
}
}
}
}
return
stringBuilder
.
toString
();
}
return
null
;
}
}
src/main/java/com/gic/plug/web/strategy/impl/StoreBackImpl.java
0 → 100644
View file @
8f8543be
package
com
.
gic
.
plug
.
web
.
strategy
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.plug.web.strategy.ScreenBackStrategy
;
import
com.gic.plug.web.utils.ComputeBackUtil
;
import
com.gic.store.constant.StoreESFieldsEnum
;
import
com.gic.store.dto.StoreSearchDTO
;
import
com.gic.store.service.StoreApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
public
class
StoreBackImpl
implements
ScreenBackStrategy
{
@Autowired
private
StoreApiService
storeApiService
;
@Override
public
String
screenBack
(
String
compute
,
String
value
,
String
key
,
Integer
enterpriseId
)
{
if
(
StringUtils
.
isNotBlank
(
value
)){
StringBuilder
stringBuilder
=
new
StringBuilder
(
StoreESFieldsEnum
.
STOREID
.
getDesc
()).
append
(
" "
);
stringBuilder
.
append
(
ComputeBackUtil
.
getComputeBack
(
compute
)).
append
(
" "
);
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
storeSearchDTO
.
setEnterpriseId
(
enterpriseId
);
storeSearchDTO
.
setStoreIds
(
value
);
ServiceResponse
response
=
this
.
storeApiService
.
listStore
(
storeSearchDTO
,
1
,
50
,
StoreESFieldsEnum
.
STORENAME
.
getField
());
if
(
response
.
isSuccess
()){
List
<
JSONObject
>
list
=
((
Page
)
response
.
getResult
()).
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
for
(
JSONObject
jsonObject
:
list
){
stringBuilder
.
append
(
"【"
).
append
(
jsonObject
.
getString
(
StoreESFieldsEnum
.
STORENAME
.
getField
())).
append
(
"】"
).
append
(
" "
);
}
}
}
return
stringBuilder
.
toString
();
}
return
null
;
}
}
src/main/java/com/gic/plug/web/strategy/impl/StoreBrandBackImpl.java
0 → 100644
View file @
8f8543be
package
com
.
gic
.
plug
.
web
.
strategy
.
impl
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.plug.web.strategy.ScreenBackStrategy
;
import
com.gic.plug.web.utils.ComputeBackUtil
;
import
com.gic.store.constant.StoreESFieldsEnum
;
import
com.gic.store.dto.StoreBrandDTO
;
import
com.gic.store.service.StoreBrandApiService
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
@Component
public
class
StoreBrandBackImpl
implements
ScreenBackStrategy
{
@Autowired
private
StoreBrandApiService
storeBrandApiService
;
@Override
public
String
screenBack
(
String
compute
,
String
value
,
String
key
,
Integer
enterpriseId
)
{
if
(
StringUtils
.
isNotBlank
(
value
)){
StringBuilder
stringBuilder
=
new
StringBuilder
(
StoreESFieldsEnum
.
STOREBRANDIDLIST
.
getDesc
()).
append
(
" "
);
stringBuilder
.
append
(
ComputeBackUtil
.
getComputeBack
(
compute
)).
append
(
" "
);
List
<
Integer
>
storeBrandIdList
=
new
ArrayList
<>();
String
[]
valueArr
=
value
.
split
(
" "
);
for
(
String
s
:
valueArr
){
storeBrandIdList
.
add
(
Integer
.
valueOf
(
s
));
}
ServiceResponse
<
List
<
StoreBrandDTO
>>
listServiceResponse
=
this
.
storeBrandApiService
.
listStoreBrandByIds
(
storeBrandIdList
);
if
(
listServiceResponse
.
isSuccess
()){
List
<
StoreBrandDTO
>
list
=
listServiceResponse
.
getResult
();
for
(
StoreBrandDTO
storeBrandDTO
:
list
){
stringBuilder
.
append
(
"【"
).
append
(
storeBrandDTO
.
getStoreBrandName
()).
append
(
"】"
).
append
(
" "
);
}
}
return
stringBuilder
.
toString
();
}
return
null
;
}
}
src/main/java/com/gic/plug/web/strategy/impl/StoreCustomBackImpl.java
0 → 100644
View file @
8f8543be
package
com
.
gic
.
plug
.
web
.
strategy
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.plug.web.strategy.ScreenBackStrategy
;
import
com.gic.plug.web.utils.ComputeBackUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.store.constant.StoreESFieldsEnum
;
import
com.gic.store.constant.StoreFieldDateEnum
;
import
com.gic.store.constant.StoreFieldTypeEnum
;
import
com.gic.store.dto.StoreFieldDTO
;
import
com.gic.store.dto.StoreFieldSelectDTO
;
import
com.gic.store.service.StoreFieldApiService
;
import
com.gic.store.service.StoreFieldSelectApiService
;
import
com.gic.store.utils.StoreRedisKeyUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
StoreCustomBackImpl
implements
ScreenBackStrategy
{
@Autowired
private
StoreFieldApiService
storeFieldApiService
;
@Autowired
private
StoreFieldSelectApiService
storeFieldSelectApiService
;
private
Map
<
Integer
,
String
>
methodMap
=
new
HashMap
<>();
@PostConstruct
public
void
init
(){
methodMap
.
put
(
StoreFieldDateEnum
.
YMDHMS
.
getCode
(),
"yyyyMMddHHmmssBack"
);
methodMap
.
put
(
StoreFieldDateEnum
.
YMD
.
getCode
(),
"yyyyMMddBack"
);
methodMap
.
put
(
StoreFieldDateEnum
.
YM
.
getCode
(),
"yyyyMM"
);
methodMap
.
put
(
StoreFieldDateEnum
.
MD
.
getCode
(),
"mmddBack"
);
methodMap
.
put
(
StoreFieldDateEnum
.
Hms
.
getCode
(),
"hhmmssBack"
);
}
@Override
public
String
screenBack
(
String
compute
,
String
value
,
String
key
,
Integer
enterpriseId
)
{
if
(
StringUtils
.
isNotBlank
(
value
))
{
Object
cache
=
RedisUtil
.
getCache
(
StoreRedisKeyUtils
.
getStoreFieldKeyC
(
enterpriseId
,
key
));
if
(
cache
!=
null
){
ServiceResponse
<
StoreFieldDTO
>
storeField
=
this
.
storeFieldApiService
.
getStoreField
((
Integer
)
cache
);
if
(
storeField
.
isSuccess
()){
if
(
storeField
.
getResult
()
!=
null
){
if
(
storeField
.
getResult
().
getStoreFieldType
()
==
StoreFieldTypeEnum
.
DATE
.
getCode
()){
return
this
.
dateBack
(
compute
,
value
,
storeField
.
getResult
());
}
else
{
return
this
.
selectBack
(
compute
,
value
,
enterpriseId
,
storeField
.
getResult
());
}
}
}
}
}
return
null
;
}
private
String
dateBack
(
String
compute
,
String
value
,
StoreFieldDTO
storeFieldDTO
){
StringBuilder
stringBuilder
=
new
StringBuilder
(
storeFieldDTO
.
getStoreFieldName
()).
append
(
" "
);
stringBuilder
.
append
(
ComputeBackUtil
.
getComputeBack
(
compute
)).
append
(
" "
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
storeFieldDTO
.
getStoreFieldDetail
());
int
dateType
=
jsonObject
.
getIntValue
(
"dateType"
);
String
methodName
=
this
.
methodMap
.
get
(
dateType
);
if
(
StringUtils
.
isNotBlank
(
methodName
)){
try
{
try
{
Method
method
=
this
.
getClass
().
getMethod
(
methodName
,
Class
.
forName
(
value
.
getClass
().
getCanonicalName
()));
try
{
String
message
=
(
String
)
method
.
invoke
(
this
,
value
);
return
stringBuilder
.
append
(
message
).
toString
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvocationTargetException
e
)
{
e
.
printStackTrace
();
}
}
catch
(
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
catch
(
NoSuchMethodException
e
)
{
e
.
printStackTrace
();
}
}
return
null
;
}
private
String
selectBack
(
String
compute
,
String
value
,
Integer
enterpriseId
,
StoreFieldDTO
storeFieldDTO
){
StringBuilder
stringBuilder
=
new
StringBuilder
(
storeFieldDTO
.
getStoreFieldName
()).
append
(
" "
);
stringBuilder
.
append
(
ComputeBackUtil
.
getComputeBack
(
compute
)).
append
(
" "
);
List
<
Integer
>
list
=
new
ArrayList
<>();
String
[]
valueArr
=
value
.
split
(
" "
);
for
(
String
s
:
valueArr
){
list
.
add
(
Integer
.
valueOf
(
s
));
}
ServiceResponse
<
List
<
StoreFieldSelectDTO
>>
listServiceResponse
=
this
.
storeFieldSelectApiService
.
listStoreFieldSelectByIds
(
enterpriseId
,
list
);
if
(
listServiceResponse
.
isSuccess
()){
List
<
StoreFieldSelectDTO
>
selectDTOS
=
listServiceResponse
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
selectDTOS
)){
for
(
StoreFieldSelectDTO
dto
:
selectDTOS
){
stringBuilder
.
append
(
"【"
).
append
(
dto
.
getStoreFieldSelectName
()).
append
(
"】"
).
append
(
" "
);
}
}
}
return
stringBuilder
.
toString
();
}
public
String
yyyyMMddHHmmssBack
(
String
value
)
throws
ParseException
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
SimpleDateFormat
simpleDateFormat1
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
return
this
.
dateBack
(
value
,
simpleDateFormat
,
simpleDateFormat1
);
}
public
String
yyyyMMddBack
(
String
value
)
throws
ParseException
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
SimpleDateFormat
simpleDateFormat1
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
return
this
.
dateBack
(
value
,
simpleDateFormat
,
simpleDateFormat1
);
}
public
String
yyyyMM
(
String
value
)
throws
ParseException
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMM"
);
SimpleDateFormat
simpleDateFormat1
=
new
SimpleDateFormat
(
"yyyy-MM"
);
return
this
.
dateBack
(
value
,
simpleDateFormat
,
simpleDateFormat1
);
}
public
String
mmddBack
(
String
value
)
throws
ParseException
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"MMdd"
);
SimpleDateFormat
simpleDateFormat1
=
new
SimpleDateFormat
(
"MM-dd"
);
return
this
.
dateBack
(
value
,
simpleDateFormat
,
simpleDateFormat1
);
}
public
String
hhmmssBack
(
String
value
)
throws
ParseException
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"HHmmss"
);
SimpleDateFormat
simpleDateFormat1
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
return
this
.
dateBack
(
value
,
simpleDateFormat
,
simpleDateFormat1
);
}
private
String
dateBack
(
String
value
,
SimpleDateFormat
simpleDateFormat
,
SimpleDateFormat
simpleDateFormat1
)
throws
ParseException
{
String
[]
valueArr
=
value
.
split
(
","
);
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
"【"
).
append
(
simpleDateFormat1
.
format
(
simpleDateFormat
.
parse
(
valueArr
[
0
]))).
append
(
"】"
).
append
(
" "
);
if
(
valueArr
.
length
>
1
){
stringBuilder
.
append
(
"至"
);
stringBuilder
.
append
(
"【"
).
append
(
simpleDateFormat1
.
format
(
simpleDateFormat
.
parse
(
valueArr
[
1
]))).
append
(
"】"
).
append
(
" "
);
}
return
stringBuilder
.
toString
();
}
}
src/main/java/com/gic/plug/web/strategy/impl/StoreGroupBackImpl.java
0 → 100644
View file @
8f8543be
package
com
.
gic
.
plug
.
web
.
strategy
.
impl
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.plug.web.strategy.ScreenBackStrategy
;
import
com.gic.plug.web.utils.ComputeBackUtil
;
import
com.gic.store.constant.StoreESFieldsEnum
;
import
com.gic.store.dto.StoreGroupDTO
;
import
com.gic.store.service.StoreGroupApiService
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
@Component
public
class
StoreGroupBackImpl
implements
ScreenBackStrategy
{
@Autowired
private
StoreGroupApiService
storeGroupApiService
;
@Override
public
String
screenBack
(
String
compute
,
String
value
,
String
key
,
Integer
enterpriseId
)
{
if
(
StringUtils
.
isNotBlank
(
value
)){
StringBuilder
stringBuilder
=
new
StringBuilder
(
StoreESFieldsEnum
.
STOREGROUPIDLIST
.
getDesc
()).
append
(
" "
);
stringBuilder
.
append
(
ComputeBackUtil
.
getComputeBack
(
compute
)).
append
(
" "
);
String
[]
valueArr
=
value
.
split
(
" "
);
List
<
Integer
>
storeGroupIdList
=
new
ArrayList
<>();
for
(
String
s
:
valueArr
){
storeGroupIdList
.
add
(
Integer
.
valueOf
(
s
));
}
ServiceResponse
<
List
<
StoreGroupDTO
>>
listServiceResponse
=
this
.
storeGroupApiService
.
listStoreGroupByIds
(
storeGroupIdList
,
enterpriseId
);
if
(
listServiceResponse
.
isSuccess
()){
if
(
listServiceResponse
.
getResult
()
!=
null
){
for
(
StoreGroupDTO
storeGroupDTO
:
listServiceResponse
.
getResult
()){
stringBuilder
.
append
(
"【"
).
append
(
storeGroupDTO
.
getStoreGroupName
()).
append
(
"】"
).
append
(
" "
);
}
}
}
return
stringBuilder
.
toString
();
}
return
null
;
}
}
src/main/java/com/gic/plug/web/strategy/impl/StoreRegionBackImpl.java
0 → 100644
View file @
8f8543be
package
com
.
gic
.
plug
.
web
.
strategy
.
impl
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.plug.web.strategy.ScreenBackStrategy
;
import
com.gic.plug.web.utils.ComputeBackUtil
;
import
com.gic.store.constant.StoreESFieldsEnum
;
import
com.gic.store.dto.StoreGroupDTO
;
import
com.gic.store.dto.StoreRegionDTO
;
import
com.gic.store.service.StoreRegionApiService
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.xml.ws.Action
;
import
java.util.ArrayList
;
import
java.util.List
;
@Component
public
class
StoreRegionBackImpl
implements
ScreenBackStrategy
{
@Autowired
private
StoreRegionApiService
storeRegionApiService
;
@Override
public
String
screenBack
(
String
compute
,
String
value
,
String
key
,
Integer
enterpriseId
)
{
if
(
StringUtils
.
isNotBlank
(
value
)){
StringBuilder
stringBuilder
=
new
StringBuilder
(
StoreESFieldsEnum
.
REGIONID
.
getDesc
()).
append
(
" "
);
stringBuilder
.
append
(
ComputeBackUtil
.
getComputeBack
(
compute
)).
append
(
" "
);
String
[]
valueArr
=
value
.
split
(
" "
);
List
<
Integer
>
storeRegionIdList
=
new
ArrayList
<>();
for
(
String
s
:
valueArr
){
storeRegionIdList
.
add
(
Integer
.
valueOf
(
s
));
}
ServiceResponse
<
List
<
StoreRegionDTO
>>
listServiceResponse
=
this
.
storeRegionApiService
.
listStoreRegionByIds
(
enterpriseId
,
storeRegionIdList
);
if
(
listServiceResponse
.
isSuccess
()){
if
(
listServiceResponse
.
getResult
()
!=
null
){
for
(
StoreRegionDTO
storeRegionDTO
:
listServiceResponse
.
getResult
()){
stringBuilder
.
append
(
"【"
).
append
(
storeRegionDTO
.
getRegionName
()).
append
(
"】"
).
append
(
" "
);
}
}
}
return
stringBuilder
.
toString
();
}
return
null
;
}
}
src/main/java/com/gic/plug/web/strategy/impl/StoreSelectBackImpl.java
0 → 100644
View file @
8f8543be
package
com
.
gic
.
plug
.
web
.
strategy
.
impl
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.plug.web.strategy.ScreenBackStrategy
;
import
com.gic.plug.web.utils.ComputeBackUtil
;
import
com.gic.store.constant.CreateTypeEnum
;
import
com.gic.store.constant.StoreCompleteEnum
;
import
com.gic.store.constant.StoreESFieldsEnum
;
import
com.gic.store.constant.StoreStatusEnum
;
import
com.gic.store.dto.StoreDictDTO
;
import
com.gic.store.service.StoreDictApiService
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
StoreSelectBackImpl
implements
ScreenBackStrategy
{
@Autowired
private
StoreDictApiService
storeDictApiService
;
private
Map
<
String
,
String
>
methodMap
=
new
HashMap
<>();
@PostConstruct
public
void
init
(){
methodMap
.
put
(
StoreESFieldsEnum
.
STATUS
.
getField
(),
"storeStatusBack"
);
methodMap
.
put
(
StoreESFieldsEnum
.
COMPLETESTATUS
.
getField
(),
"storeCompleteBack"
);
methodMap
.
put
(
StoreESFieldsEnum
.
CREATETYPE
.
getField
(),
"storeCreateTypeBack"
);
methodMap
.
put
(
StoreESFieldsEnum
.
STORETYPE
.
getField
(),
"storeTypeBack"
);
methodMap
.
put
(
StoreESFieldsEnum
.
ERPSTATUS
.
getField
(),
"erpStatusBack"
);
}
@Override
public
String
screenBack
(
String
compute
,
String
value
,
String
key
,
Integer
enterpriseId
){
String
methodName
=
methodMap
.
get
(
key
);
if
(
StringUtils
.
isNotBlank
(
methodName
)){
try
{
try
{
Method
method
=
this
.
getClass
().
getMethod
(
methodName
,
Class
.
forName
(
compute
.
getClass
().
getCanonicalName
()),
Class
.
forName
(
value
.
getClass
().
getCanonicalName
()),
Class
.
forName
(
enterpriseId
.
getClass
().
getCanonicalName
()));
try
{
String
message
=
(
String
)
method
.
invoke
(
this
,
compute
,
value
,
enterpriseId
);
return
message
;
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvocationTargetException
e
)
{
e
.
printStackTrace
();
}
}
catch
(
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
catch
(
NoSuchMethodException
e
)
{
e
.
printStackTrace
();
}
}
return
null
;
}
//单选
public
String
storeStatusBack
(
String
compute
,
String
value
,
Integer
enterpriseId
){
if
(
StringUtils
.
isNotBlank
(
value
)){
StringBuilder
stringBuilder
=
new
StringBuilder
(
StoreESFieldsEnum
.
STATUS
.
getDesc
()).
append
(
" "
);
stringBuilder
.
append
(
ComputeBackUtil
.
getComputeBack
(
compute
)).
append
(
" "
);
for
(
StoreStatusEnum
storeStatusEnum
:
StoreStatusEnum
.
values
()){
if
(
storeStatusEnum
.
getCode
()
==
Integer
.
valueOf
(
value
)){
stringBuilder
.
append
(
"【"
).
append
(
storeStatusEnum
.
getMessage
()).
append
(
"】 "
);
}
}
return
stringBuilder
.
toString
();
}
return
null
;
}
//单选
public
String
storeCompleteBack
(
String
compute
,
String
value
,
Integer
enterpriseId
){
if
(
StringUtils
.
isNotBlank
(
value
)){
StringBuilder
stringBuilder
=
new
StringBuilder
(
StoreESFieldsEnum
.
COMPLETESTATUS
.
getDesc
()).
append
(
" "
);
stringBuilder
.
append
(
ComputeBackUtil
.
getComputeBack
(
compute
)).
append
(
" "
);
for
(
StoreCompleteEnum
storeStatusEnum
:
StoreCompleteEnum
.
values
()){
if
(
storeStatusEnum
.
getCode
()
==
Integer
.
valueOf
(
value
)){
stringBuilder
.
append
(
"【"
).
append
(
storeStatusEnum
.
getMessage
()).
append
(
"】 "
);
}
}
return
stringBuilder
.
toString
();
}
return
null
;
}
//多选
public
String
storeCreateTypeBack
(
String
compute
,
String
value
,
Integer
enterpriseId
){
if
(
StringUtils
.
isNotBlank
(
value
)){
StringBuilder
stringBuilder
=
new
StringBuilder
(
StoreESFieldsEnum
.
CREATETYPE
.
getDesc
()).
append
(
" "
);
stringBuilder
.
append
(
ComputeBackUtil
.
getComputeBack
(
compute
)).
append
(
" "
);
String
[]
valueArr
=
value
.
split
(
" "
);
for
(
String
v
:
valueArr
){
for
(
CreateTypeEnum
createTypeEnum
:
CreateTypeEnum
.
values
()){
if
(
createTypeEnum
.
getCode
()
==
Integer
.
valueOf
(
v
)){
stringBuilder
.
append
(
"【"
).
append
(
createTypeEnum
.
getMessage
()).
append
(
"】 "
);
}
}
}
}
return
null
;
}
//多选
public
String
storeTypeBack
(
String
compute
,
String
value
,
Integer
enterpriseId
){
if
(
StringUtils
.
isNotBlank
(
value
)){
String
[]
valueArr
=
value
.
split
(
" "
);
ServiceResponse
<
List
<
StoreDictDTO
>>
serviceResponse
=
this
.
storeDictApiService
.
listStoreType
(
enterpriseId
);
if
(
serviceResponse
.
isSuccess
()){
List
<
StoreDictDTO
>
list
=
serviceResponse
.
getResult
();
StringBuilder
stringBuilder
=
new
StringBuilder
(
StoreESFieldsEnum
.
STORETYPE
.
getDesc
());
stringBuilder
.
append
(
" "
).
append
(
ComputeBackUtil
.
getComputeBack
(
compute
));
for
(
StoreDictDTO
dictDTO
:
list
){
for
(
String
v
:
valueArr
){
if
(
dictDTO
.
getKey
().
equals
(
v
)){
stringBuilder
.
append
(
" 【"
);
stringBuilder
.
append
(
dictDTO
.
getKey
()).
append
(
"】 "
);
}
}
}
return
stringBuilder
.
toString
();
}
}
return
null
;
}
//多选
public
String
erpStatusBack
(
String
compute
,
String
value
,
Integer
enterpriseId
){
if
(
StringUtils
.
isNotBlank
(
value
)){
String
[]
valueArr
=
value
.
split
(
" "
);
ServiceResponse
<
List
<
StoreDictDTO
>>
serviceResponse
=
this
.
storeDictApiService
.
listStoreStatus
(
enterpriseId
);
if
(
serviceResponse
.
isSuccess
()){
List
<
StoreDictDTO
>
list
=
serviceResponse
.
getResult
();
StringBuilder
stringBuilder
=
new
StringBuilder
(
StoreESFieldsEnum
.
STATUS
.
getDesc
());
stringBuilder
.
append
(
" "
).
append
(
ComputeBackUtil
.
getComputeBack
(
compute
));
for
(
StoreDictDTO
dictDTO
:
list
){
for
(
String
v
:
valueArr
){
if
(
dictDTO
.
getKey
().
equals
(
v
)){
stringBuilder
.
append
(
" 【"
);
stringBuilder
.
append
(
dictDTO
.
getKey
()).
append
(
"】 "
);
}
}
}
return
stringBuilder
.
toString
();
}
}
return
null
;
}
}
src/main/java/com/gic/plug/web/strategy/impl/StoreTagBackImpl.java
0 → 100644
View file @
8f8543be
package
com
.
gic
.
plug
.
web
.
strategy
.
impl
;
import
com.gic.plug.web.strategy.ScreenBackStrategy
;
import
org.springframework.stereotype.Component
;
@Component
public
class
StoreTagBackImpl
implements
ScreenBackStrategy
{
@Override
public
String
screenBack
(
String
compute
,
String
value
,
String
key
,
Integer
enterpriseId
)
{
return
null
;
}
}
src/main/java/com/gic/plug/web/utils/ComputeBackUtil.java
0 → 100644
View file @
8f8543be
package
com
.
gic
.
plug
.
web
.
utils
;
import
org.apache.commons.lang.StringUtils
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
ComputeBackUtil
{
public
static
Map
<
String
,
String
>
computeMap
=
new
HashMap
<>();
static
{
computeMap
.
put
(
"="
,
"为"
);
computeMap
.
put
(
">"
,
"大于"
);
computeMap
.
put
(
">="
,
"大于等于"
);
computeMap
.
put
(
"<"
,
"小于"
);
computeMap
.
put
(
"<="
,
"小于等于"
);
computeMap
.
put
(
"between"
,
"至"
);
computeMap
.
put
(
"contain"
,
"为"
);
}
public
static
String
getComputeBack
(
String
compute
){
String
back
=
computeMap
.
get
(
compute
);
if
(
StringUtils
.
isBlank
(
back
)){
back
=
"为"
;
}
return
back
;
}
}
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