Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-store
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-store
Commits
5138d4f1
Commit
5138d4f1
authored
Jul 09, 2019
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义字段验证
parent
99209adb
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
273 additions
and
19 deletions
+273
-19
StoreFieldTextEnum.java
.../main/java/com/gic/store/constant/StoreFieldTextEnum.java
+15
-5
StoreException.java
...src/main/java/com/gic/store/exception/StoreException.java
+18
-0
StoreApiService.java
.../src/main/java/com/gic/store/service/StoreApiService.java
+8
-0
DateTypeField.java
...rc/main/java/com/gic/store/utils/field/DateTypeField.java
+20
-0
FieldBase.java
...pi/src/main/java/com/gic/store/utils/field/FieldBase.java
+28
-1
RadioField.java
...i/src/main/java/com/gic/store/utils/field/RadioField.java
+0
-1
RealNumberField.java
.../main/java/com/gic/store/utils/field/RealNumberField.java
+17
-0
TextField.java
...pi/src/main/java/com/gic/store/utils/field/TextField.java
+33
-2
TabStoreExtendMapper.java
...n/java/com/gic/store/dao/mapper/TabStoreExtendMapper.java
+3
-0
StoreExtendServiceImpl.java
...va/com/gic/store/service/impl/StoreExtendServiceImpl.java
+17
-0
StoreApiServiceImpl.java
...java/com/gic/store/service/outer/StoreApiServiceImpl.java
+103
-3
StoreFieldApiServiceImpl.java
...com/gic/store/service/outer/StoreFieldApiServiceImpl.java
+1
-1
TabStoreExtendMapper.xml
...ervice/src/main/resources/mapper/TabStoreExtendMapper.xml
+4
-1
StoreImportController.java
...a/com/gic/store/web/controller/StoreImportController.java
+5
-4
ExcelUtils.java
...web/src/main/java/com/gic/store/web/utils/ExcelUtils.java
+1
-1
No files found.
gic-store-api/src/main/java/com/gic/store/constant/StoreFieldTextEnum.java
View file @
5138d4f1
...
...
@@ -5,17 +5,19 @@ package com.gic.store.constant;
* @date 2019/7/1 9:20 AM
*/
public
enum
StoreFieldTextEnum
{
Chinese
(
1
,
"中文"
),
Number
(
2
,
"数字"
),
ABC
(
3
,
"字母"
),
Mark
(
4
,
"符号"
);
Chinese
(
1
,
"中文"
,
"[\\u4e00-\\u9fa5]{0,}"
),
Number
(
2
,
"数字"
,
"[0-9]*"
),
ABC
(
3
,
"字母"
,
"[A-Za-z]+"
),
Mark
(
4
,
"符号"
,
"[^\\w\\s]+"
);
private
int
code
;
private
String
message
;
private
String
pattern
;
private
StoreFieldTextEnum
(
int
code
,
String
message
)
{
private
StoreFieldTextEnum
(
int
code
,
String
message
,
String
pattern
)
{
this
.
code
=
code
;
this
.
message
=
message
;
this
.
pattern
=
pattern
;
}
public
int
getCode
()
{
...
...
@@ -33,4 +35,12 @@ public enum StoreFieldTextEnum {
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
String
getPattern
()
{
return
pattern
;
}
public
void
setPattern
(
String
pattern
)
{
this
.
pattern
=
pattern
;
}
}
gic-store-api/src/main/java/com/gic/store/exception/StoreException.java
0 → 100644
View file @
5138d4f1
package
com
.
gic
.
store
.
exception
;
/**
* @author guojx
* @date 2019/6/26 2:03 PM
*/
public
class
StoreException
extends
RuntimeException
{
private
String
errorCode
;
public
StoreException
(
String
errorCode
,
String
message
)
{
super
(
message
);
this
.
errorCode
=
errorCode
;
}
public
String
getErrorCode
()
{
return
errorCode
;
}
}
gic-store-api/src/main/java/com/gic/store/service/StoreApiService.java
View file @
5138d4f1
...
...
@@ -3,6 +3,7 @@ package com.gic.store.service;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.store.dto.StoreDTO
;
import
com.gic.store.dto.StoreFieldDTO
;
/**
* @author zhiwj
...
...
@@ -24,6 +25,13 @@ public interface StoreApiService {
ServiceResponse
<
StoreDTO
>
getStoreById
(
Integer
enterpriseId
,
Integer
storeId
);
/**
* 校验除 是否重复 外的所有条件
* @param value
* @return success:验证通过
*/
ServiceResponse
validateFieldExceptRepeat
(
String
value
,
StoreFieldDTO
storeFieldDTO
);
/**
* 门店成本主体转移
*/
ServiceResponse
<
Integer
>
costStoreMove
(
String
storeIds
,
String
toStoreId
);
...
...
gic-store-api/src/main/java/com/gic/store/utils/field/DateTypeField.java
0 → 100644
View file @
5138d4f1
package
com
.
gic
.
store
.
utils
.
field
;
/**
* @author zhiwj
* @date 2019/7/8
*/
public
class
DateTypeField
extends
FieldBase
{
private
String
dateType
;
public
String
getDateType
()
{
return
dateType
;
}
public
void
setDateType
(
String
dateType
)
{
this
.
dateType
=
dateType
;
}
}
gic-store-api/src/main/java/com/gic/store/utils/field/FieldBase.java
View file @
5138d4f1
package
com
.
gic
.
store
.
utils
.
field
;
import
java.util.List
;
/**
* @author zhiwj
* @date 2019/7/5
*/
public
class
FieldBase
{
public
abstract
class
FieldBase
{
private
Integer
allowEdit
;
private
Integer
isMust
;
private
Integer
allowRepeat
;
...
...
@@ -41,4 +44,28 @@ public class FieldBase {
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
String
validate
(
String
value
){
if
(
getIsMust
()
&&
(
value
==
null
||
""
.
equals
(
value
)))
{
return
"不能为空"
;
}
else
{
return
null
;
}
}
public
String
validateSelect
(
String
value
,
List
<
String
>
nameList
){
String
[]
values
=
value
.
split
(
","
);
for
(
String
val
:
values
)
{
boolean
exist
=
false
;
for
(
String
name
:
nameList
)
{
if
(
name
.
equals
(
val
))
{
exist
=
true
;
}
}
if
(!
exist
)
{
return
value
+
" 有选项不存在"
;
}
}
return
null
;
}
}
gic-store-api/src/main/java/com/gic/store/utils/field/RadioField.java
View file @
5138d4f1
...
...
@@ -5,5 +5,4 @@ package com.gic.store.utils.field;
* @date 2019/7/8
*/
public
class
RadioField
extends
FieldBase
{
}
gic-store-api/src/main/java/com/gic/store/utils/field/RealNumberField.java
View file @
5138d4f1
...
...
@@ -32,4 +32,20 @@ public class RealNumberField extends FieldBase{
public
void
setMinDigits
(
Integer
minDigits
)
{
this
.
minDigits
=
minDigits
;
}
@Override
public
String
validate
(
String
value
)
{
String
msg
=
super
.
validate
(
value
);
if
(
msg
!=
null
)
{
return
msg
;
}
String
[]
split
=
value
.
split
(
"\\."
);
if
(
minDigits
>
split
[
0
].
length
())
{
return
"长度不能小于最小位数"
;
}
if
(
maxDigits
<
split
[
0
].
length
())
{
return
"长度不能大于最大位数"
;
}
return
null
;
}
}
\ No newline at end of file
gic-store-api/src/main/java/com/gic/store/utils/field/TextField.java
View file @
5138d4f1
package
com
.
gic
.
store
.
utils
.
field
;
import
com.gic.store.constant.StoreFieldTextEnum
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.regex.Pattern
;
/**
* @author zhiwj
...
...
@@ -50,6 +55,32 @@ public class TextField extends FieldBase {
this
.
minLength
=
minLength
;
}
@Override
public
String
validate
(
String
value
)
{
String
msg
=
super
.
validate
(
value
);
if
(
msg
!=
null
)
{
return
msg
;
}
// 获取没有被选择的类型,然后验证是否有这些类型, 如果出现了这些类型,就报错
Map
<
Integer
,
StoreFieldTextEnum
>
textTypeList
=
new
HashMap
<>(
StoreFieldTextEnum
.
values
().
length
);
for
(
StoreFieldTextEnum
textEnum
:
StoreFieldTextEnum
.
values
())
{
textTypeList
.
put
(
textEnum
.
getCode
(),
textEnum
);
}
String
[]
filedText
=
textType
.
split
(
","
);
for
(
String
s
:
filedText
)
{
textTypeList
.
remove
(
Integer
.
valueOf
(
s
));
}
for
(
StoreFieldTextEnum
storeFieldTextEnum
:
textTypeList
.
values
())
{
if
(
Pattern
.
matches
(
storeFieldTextEnum
.
getPattern
(),
value
))
{
return
"不能出现"
+
storeFieldTextEnum
.
getMessage
()
+
"类型"
;
}
}
if
(
value
.
length
()
<
minLength
)
{
return
"长度过小"
;
}
if
(
value
.
length
()
>
maxLength
)
{
return
"长度过大"
;
}
return
null
;
}
}
gic-store-service/src/main/java/com/gic/store/dao/mapper/TabStoreExtendMapper.java
View file @
5138d4f1
...
...
@@ -59,4 +59,6 @@ public interface TabStoreExtendMapper {
TabStoreExtend
getStoreExtendByStoreIdAndStoreFieldId
(
@Param
(
"storeId"
)
Integer
storeId
,
@Param
(
"storeFieldId"
)
Integer
storeFieldId
);
int
countStoreExtendStoreField
(
@Param
(
"storeField"
)
Integer
storeField
,
@Param
(
"storeFieldSelectId"
)
Integer
storeFieldSelectId
);
int
countExtendByValue
(
@Param
(
"storeFieldId"
)
Integer
storeFieldId
,
@Param
(
"value"
)
String
value
);
}
\ No newline at end of file
gic-store-service/src/main/java/com/gic/store/service/impl/StoreExtendServiceImpl.java
View file @
5138d4f1
package
com
.
gic
.
store
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.store.dao.mapper.TabStoreExtendMapper
;
import
com.gic.store.dto.StoreExtendDTO
;
import
com.gic.store.entity.TabStoreExtend
;
import
com.gic.store.entity.TabStoreField
;
import
com.gic.store.exception.StoreException
;
import
com.gic.store.service.StoreExtendService
;
import
com.gic.store.service.StoreFieldService
;
import
com.gic.store.utils.ErrorCode
;
import
com.gic.store.utils.field.FieldBase
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Collections
;
import
java.util.Date
;
...
...
@@ -29,10 +34,22 @@ public class StoreExtendServiceImpl implements StoreExtendService {
private
StoreFieldService
storeFieldService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveOrUpdate
(
Integer
enterpriseId
,
Integer
storeId
,
List
<
StoreExtendDTO
>
storeExtendList
)
{
if
(
CollectionUtils
.
isNotEmpty
(
storeExtendList
))
{
List
<
TabStoreExtend
>
tabStoreExtendList
=
EntityUtil
.
changeEntityListByOrika
(
TabStoreExtend
.
class
,
storeExtendList
);
for
(
TabStoreExtend
tabStoreExtend
:
tabStoreExtendList
)
{
TabStoreField
field
=
storeFieldService
.
getStoreFieldById
(
tabStoreExtend
.
getStoreFieldId
());
String
fieldDetail
=
field
.
getStoreFieldDetail
();
FieldBase
fieldBase
=
JSON
.
parseObject
(
fieldDetail
,
FieldBase
.
class
);
if
(!
fieldBase
.
getAllowRepeat
())
{
// 不允许重复
int
count
=
tabStoreExtendMapper
.
countExtendByValue
(
field
.
getStoreFieldId
(),
tabStoreExtend
.
getValue
());
if
(
count
>
0
)
{
throw
new
StoreException
(
ErrorCode
.
ERR_5
.
getCode
(),
field
.
getStoreFieldName
()
+
"不允许重复"
);
}
}
tabStoreExtend
.
setEnterpriseId
(
enterpriseId
);
tabStoreExtend
.
setStoreId
(
storeId
);
if
(
tabStoreExtend
.
getStoreExtendId
()
==
null
)
{
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/StoreApiServiceImpl.java
View file @
5138d4f1
package
com
.
gic
.
store
.
service
.
outer
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.store.constant.StoreEnableOrDisAbleEnum
;
import
com.gic.store.constant.StoreFieldTypeEnum
;
import
com.gic.store.constant.StoreGroupConstant
;
import
com.gic.store.dao.mapper.TabStoreGroupMapper
;
import
com.gic.store.dto.*
;
import
com.gic.store.entity.*
;
import
com.gic.store.service.*
;
import
com.gic.store.utils.ErrorCode
;
import
org.apache.commons.lang.StringUtils
;
import
com.gic.store.utils.field.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -25,7 +32,7 @@ import java.util.stream.Collectors;
@Service
(
"storeApiService"
)
@SuppressWarnings
(
"unchecked"
)
public
class
StoreApiServiceImpl
implements
StoreApiService
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
StoreApiServiceImpl
.
class
);
@Autowired
private
StoreService
storeService
;
@Autowired
...
...
@@ -39,7 +46,13 @@ public class StoreApiServiceImpl implements StoreApiService {
@Autowired
private
StoreExtendService
storeExtendService
;
@Autowired
private
StoreFieldService
storeFieldService
;
private
StoreStrategyApiService
storeStrategyApiService
;
@Autowired
private
StoreGroupService
storeGroupService
;
@Autowired
private
StoreStrategyService
storeStrategyService
;
@Autowired
private
StoreFieldSelectService
storeFieldSelectService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -53,6 +66,13 @@ public class StoreApiServiceImpl implements StoreApiService {
storeDTO
.
setCompleteStatus
(
completeStatus
);
// 门店自身信息
if
(
storeDTO
.
getStoreId
()
==
null
)
{
// getGroup
String
msg
=
getGroup
(
storeDTO
);
if
(
StringUtils
.
isNotBlank
(
msg
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
ERR_5
.
getCode
(),
msg
);
}
// 启用策略
getStatus
(
storeDTO
);
Integer
id
=
storeService
.
save
(
storeDTO
);
storeDTO
.
setStoreId
(
id
);
}
else
{
...
...
@@ -77,6 +97,52 @@ public class StoreApiServiceImpl implements StoreApiService {
return
ServiceResponse
.
success
();
}
/**
* 根据策略判断启用状态
* @param storeDTO
*/
private
void
getStatus
(
StoreDTO
storeDTO
)
{
String
hitStrategy
=
storeStrategyService
.
isHitStrategy
(
storeDTO
,
StoreGroupConstant
.
STORE_STRATEGY_TYPE
);
storeDTO
.
setStatus
(
StringUtils
.
isNotBlank
(
hitStrategy
)
?
Integer
.
valueOf
(
hitStrategy
)
:
StoreEnableOrDisAbleEnum
.
DISABLE
.
getCode
());
}
/**
* 根据策略判断分组
* @param storeDTO
* @return
*/
private
String
getGroup
(
StoreDTO
storeDTO
)
{
if
(
Integer
.
valueOf
(
1
)
==
storeStrategyApiService
.
getStoreGroupStrategyWeight
(
storeDTO
.
getEnterpriseId
()).
getResult
())
{
// 不启用分组策略
if
(
StringUtils
.
isBlank
(
storeDTO
.
getStoreGroupName
()))
{
// 取 未分类 分组
TabStoreGroup
group
=
storeGroupService
.
selectUnGroupedStore
(
storeDTO
.
getEnterpriseId
());
storeDTO
.
setStoreGroupId
(
group
.
getStoreGroupId
());
}
else
{
// 判断分组是否存在
TabStoreGroup
group
=
storeGroupService
.
getStoreGroupByName
(
storeDTO
.
getStoreGroupName
(),
storeDTO
.
getEnterpriseId
());
if
(
group
!=
null
)
{
storeDTO
.
setStoreGroupId
(
group
.
getStoreGroupId
());
}
else
{
logger
.
info
(
"enterpriseId:{}, groupName:{}, 不存在该分组"
,
storeDTO
.
getEnterpriseId
(),
storeDTO
.
getStoreGroupName
());
return
"门店分组不存在"
;
}
}
}
else
{
// 启用分组策略
String
groupId
=
storeStrategyService
.
isHitStrategy
(
storeDTO
,
StoreGroupConstant
.
STORE_GROUP_STRATEGY_TYPE
);
if
(
StringUtils
.
isNotBlank
(
groupId
))
{
// 命中
storeDTO
.
setStoreGroupId
(
Integer
.
valueOf
(
groupId
));
}
else
{
// 未命中
TabStoreGroup
group
=
storeGroupService
.
selectUnGroupedStore
(
storeDTO
.
getEnterpriseId
());
storeDTO
.
setStoreGroupId
(
group
.
getStoreGroupId
());
}
}
return
null
;
}
@Override
public
ServiceResponse
<
Page
<
StoreDTO
>>
listStore
(
StoreDTO
storeDTO
,
Integer
pageNum
,
Integer
pageSize
)
{
// TODO es 暂时先查询数据库
...
...
@@ -119,6 +185,40 @@ public class StoreApiServiceImpl implements StoreApiService {
}
@Override
public
ServiceResponse
validateFieldExceptRepeat
(
String
value
,
StoreFieldDTO
storeFieldDTO
)
{
Integer
storeFieldType
=
storeFieldDTO
.
getStoreFieldType
();
String
storeFieldDetail
=
storeFieldDTO
.
getStoreFieldDetail
();
FieldBase
fieldBase
;
if
(
StoreFieldTypeEnum
.
TEXT
.
getCode
()
==
storeFieldType
)
{
fieldBase
=
JSON
.
parseObject
(
storeFieldDetail
,
TextField
.
class
);
}
else
if
(
StoreFieldTypeEnum
.
RADIO
.
getCode
()
==
storeFieldType
)
{
fieldBase
=
JSON
.
parseObject
(
storeFieldDetail
,
RadioField
.
class
);
}
else
if
(
StoreFieldTypeEnum
.
CHECK
.
getCode
()
==
storeFieldType
)
{
fieldBase
=
JSON
.
parseObject
(
storeFieldDetail
,
CheckField
.
class
);
}
else
if
(
StoreFieldTypeEnum
.
REAL_NUMBER
.
getCode
()
==
storeFieldType
)
{
fieldBase
=
JSON
.
parseObject
(
storeFieldDetail
,
RealNumberField
.
class
);
}
else
if
(
StoreFieldTypeEnum
.
DATE
.
getCode
()
==
storeFieldType
)
{
fieldBase
=
JSON
.
parseObject
(
storeFieldDetail
,
DateTypeField
.
class
);
}
else
{
return
ServiceResponse
.
failure
(
ErrorCode
.
ERR_5
.
getCode
(),
"不存在该自定义属性类型"
);
}
String
msg
;
if
(
StoreFieldTypeEnum
.
RADIO
.
getCode
()
==
storeFieldType
||
StoreFieldTypeEnum
.
CHECK
.
getCode
()
==
storeFieldType
)
{
List
<
TabStoreFieldSelect
>
fieldSelectList
=
storeFieldSelectService
.
listStoreFieldSelect
(
storeFieldDTO
.
getStoreFieldId
(),
null
,
1
,
Integer
.
MAX_VALUE
);
List
<
String
>
nameList
=
fieldSelectList
.
stream
().
map
(
TabStoreFieldSelect:
:
getStoreFieldSelectName
).
collect
(
Collectors
.
toList
());
msg
=
fieldBase
.
validateSelect
(
value
,
nameList
);
}
else
{
msg
=
fieldBase
.
validate
(
value
);
}
if
(
StringUtils
.
isBlank
(
msg
))
{
return
ServiceResponse
.
success
();
}
else
{
return
ServiceResponse
.
failure
(
ErrorCode
.
ERR_5
.
getCode
(),
storeFieldDTO
.
getStoreFieldName
()
+
" "
+
msg
);
}
}
@Override
public
ServiceResponse
<
Integer
>
costStoreMove
(
String
storeIds
,
String
toStoreId
)
{
return
null
;
}
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/StoreFieldApiServiceImpl.java
View file @
5138d4f1
...
...
@@ -211,7 +211,7 @@ public class StoreFieldApiServiceImpl implements StoreFieldApiService{
List
<
TabStoreField
>
tabStoreFieldList
=
storeFieldService
.
listStoreFieldByRegionId
(
regionId
);
if
(
tabStoreFieldList
==
null
)
{
return
ServiceResponse
.
success
(
new
ArrayList
<
StoreFieldDTO
>());
return
ServiceResponse
.
success
(
new
ArrayList
<>());
}
else
{
List
<
StoreFieldDTO
>
dtoList
=
EntityUtil
.
changeEntityListNew
(
StoreFieldDTO
.
class
,
tabStoreFieldList
);
return
ServiceResponse
.
success
(
dtoList
);
...
...
gic-store-service/src/main/resources/mapper/TabStoreExtendMapper.xml
View file @
5138d4f1
...
...
@@ -159,5 +159,7 @@
and brand_ids REGEXP '^${storeFieldSelectId}$|^${storeFieldSelectId},.*$|^.*,${storeFieldSelectId},.*$|^.*,${storeFieldSelectId}$'
</if>
</select>
<select
id=
"countExtendByValue"
resultType=
"java.lang.Integer"
>
select count(*) from tab_store_extend where store_field_id = #{storeField} and value = #{value}
</select>
</mapper>
\ No newline at end of file
gic-store-web/src/main/java/com/gic/store/web/controller/StoreImportController.java
View file @
5138d4f1
...
...
@@ -8,14 +8,13 @@ import com.gic.store.constant.StoreImportEnum;
import
com.gic.store.dto.*
;
import
com.gic.store.service.*
;
import
com.gic.store.utils.ErrorCode
;
import
com.gic.store.web.ExcelUtils
;
import
com.gic.store.web.
utils.
ExcelUtils
;
import
com.gic.store.web.qo.PageQO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.CellStyle
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.xssf.usermodel.XSSFCell
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
...
...
@@ -422,7 +421,6 @@ public class StoreImportController {
ServiceResponse
<
List
<
StoreFieldDTO
>>
fieldServiceResponse
=
storeFieldApiService
.
listStoreFieldByRegionId
(
regionId
);
List
<
StoreFieldDTO
>
fieldList
=
fieldServiceResponse
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
fieldList
))
{
List
<
StoreExtendDTO
>
extendDTOList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
fieldList
.
size
();
i
++)
{
StoreExtendDTO
storeExtendDTO
=
new
StoreExtendDTO
();
...
...
@@ -431,7 +429,10 @@ public class StoreImportController {
storeExtendDTO
.
setSort
(
fieldList
.
get
(
i
).
getSort
());
// 验证
if
(
validate
)
{
// String s = fieldValidate(storeExtendDTO.getValue(), fieldList.get(i).getStoreFieldDetail());
ServiceResponse
fieldResponse
=
this
.
storeApiService
.
validateFieldExceptRepeat
(
storeExtendDTO
.
getValue
(),
fieldList
.
get
(
i
));
if
(!
fieldResponse
.
isSuccess
())
{
bean
.
setErrorMessage
(
fieldResponse
.
getMessage
());
}
}
extendDTOList
.
add
(
storeExtendDTO
);
}
...
...
gic-store-web/src/main/java/com/gic/store/web/ExcelUtils.java
→
gic-store-web/src/main/java/com/gic/store/web/
utils/
ExcelUtils.java
View file @
5138d4f1
package
com
.
gic
.
store
.
web
;
package
com
.
gic
.
store
.
web
.
utils
;
import
com.gic.store.constant.Constants
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
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