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
9d689bb6
Commit
9d689bb6
authored
Jul 08, 2019
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加错误信息
parent
041f20d3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
44 deletions
+75
-44
Constants.java
...e-api/src/main/java/com/gic/store/constant/Constants.java
+4
-0
StoreApiService.java
.../src/main/java/com/gic/store/service/StoreApiService.java
+0
-3
StoreImportApiService.java
...ain/java/com/gic/store/service/StoreImportApiService.java
+2
-0
RealNumberField.java
.../main/java/com/gic/store/utils/field/RealNumberField.java
+28
-1
StoreApiServiceImpl.java
...java/com/gic/store/service/outer/StoreApiServiceImpl.java
+0
-33
StoreImportApiServiceImpl.java
...om/gic/store/service/outer/StoreImportApiServiceImpl.java
+35
-4
StoreImportController.java
...a/com/gic/store/web/controller/StoreImportController.java
+6
-3
No files found.
gic-store-api/src/main/java/com/gic/store/constant/Constants.java
View file @
9d689bb6
...
...
@@ -8,4 +8,8 @@ public interface Constants {
String
STORE_BATCH_IMPORT_MQ_KEY
=
"storeBulkImport"
;
// String STORE_BATCH_IMPORT_MQ_KEY = "tmpStoreBatchImportTaskMq4.0";
Integer
STORE_BATCH_IMPORT_TASK_TYPE
=
6
;
String
dateformat
=
"YYYY-MM-dd HH:mm:ss"
;
}
gic-store-api/src/main/java/com/gic/store/service/StoreApiService.java
View file @
9d689bb6
...
...
@@ -4,8 +4,6 @@ import com.gic.api.base.commons.Page;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.store.dto.StoreDTO
;
import
java.util.List
;
/**
* @author zhiwj
* @date 2019/6/24
...
...
@@ -30,5 +28,4 @@ public interface StoreApiService {
*/
ServiceResponse
<
Integer
>
costStoreMove
(
String
storeIds
,
String
toStoreId
);
ServiceResponse
<
List
<
List
<
String
>>>
listImportTitle
(
Integer
enterpriseId
,
Integer
regionId
);
}
gic-store-api/src/main/java/com/gic/store/service/StoreImportApiService.java
View file @
9d689bb6
...
...
@@ -42,4 +42,6 @@ public interface StoreImportApiService {
ServiceResponse
<
Page
>
pageError
(
Integer
enterpriseId
,
Integer
currentPage
,
Integer
pageSize
);
// List<StoreTmpDTO> listStoreTmp(Integer enterpriseId, Boolean isSuccess, Boolean isWait);
ServiceResponse
<
List
<
List
<
String
>>>
listImportTitle
(
Integer
enterpriseId
,
Integer
regionId
);
}
gic-store-api/src/main/java/com/gic/store/utils/field/RealNumberField.java
View file @
9d689bb6
...
...
@@ -4,6 +4,32 @@ package com.gic.store.utils.field;
* @author zhiwj
* @date 2019/7/8
*/
public
class
RealNumberField
{
public
class
RealNumberField
extends
FieldBase
{
private
Integer
floatDigits
;
private
Integer
maxDigits
;
private
Integer
minDigits
;
public
Integer
getFloatDigits
()
{
return
floatDigits
;
}
public
void
setFloatDigits
(
Integer
floatDigits
)
{
this
.
floatDigits
=
floatDigits
;
}
public
Integer
getMaxDigits
()
{
return
maxDigits
;
}
public
void
setMaxDigits
(
Integer
maxDigits
)
{
this
.
maxDigits
=
maxDigits
;
}
public
Integer
getMinDigits
()
{
return
minDigits
;
}
public
void
setMinDigits
(
Integer
minDigits
)
{
this
.
minDigits
=
minDigits
;
}
}
\ No newline at end of file
gic-store-service/src/main/java/com/gic/store/service/outer/StoreApiServiceImpl.java
View file @
9d689bb6
package
com
.
gic
.
store
.
service
.
outer
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
...
...
@@ -11,15 +9,12 @@ 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.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -127,32 +122,4 @@ public class StoreApiServiceImpl implements StoreApiService {
public
ServiceResponse
<
Integer
>
costStoreMove
(
String
storeIds
,
String
toStoreId
)
{
return
null
;
}
@Override
public
ServiceResponse
<
List
<
List
<
String
>>>
listImportTitle
(
Integer
enterpriseId
,
Integer
regionId
)
{
List
<
List
<
String
>>
list
=
new
ArrayList
<>();
String
[]
rowName
=
{
"序号"
,
"门店名称"
,
"门店代码"
,
"门店类型"
,
"门店状态"
,
"门店电话"
,
"门店所属分组"
,
"关联门店品牌"
,
"省"
,
"市"
,
"区县"
,
"门店地址(不包括省市区)"
,
"经度"
,
"纬度"
};
List
<
String
>
rowNameList
=
new
ArrayList
<>();
Collections
.
addAll
(
rowNameList
,
rowName
);
String
[]
description
=
{
""
,
"不能超过20个字"
,
"必填,不能超过20个字符,为erp系统中门店唯一识别码"
,
"门店类型描述"
,
"门店状态描述"
,
"门店电话描述"
,
"门店所属分组描述"
,
"用\"、\"隔开"
,
"省描述"
,
"市描述"
,
"区县描述"
,
"门店地址(不包括省市区)描述"
,
""
,
""
};
List
<
String
>
descriptionList
=
new
ArrayList
<>();
Collections
.
addAll
(
descriptionList
,
description
);
list
.
add
(
rowNameList
);
list
.
add
(
descriptionList
);
List
<
TabStoreField
>
fields
=
storeFieldService
.
listStoreFieldByRegionId
(
regionId
);
if
(
CollectionUtils
.
isNotEmpty
(
fields
))
{
for
(
TabStoreField
field
:
fields
)
{
rowNameList
.
add
(
field
.
getStoreFieldName
());
String
storeFieldDetail
=
field
.
getStoreFieldDetail
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
storeFieldDetail
);
descriptionList
.
add
(
jsonObject
.
getString
(
"tipMessage"
));
}
}
return
ServiceResponse
.
success
(
list
);
}
}
gic-store-service/src/main/java/com/gic/store/service/outer/StoreImportApiServiceImpl.java
View file @
9d689bb6
package
com
.
gic
.
store
.
service
.
outer
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
...
...
@@ -9,6 +10,7 @@ import com.gic.store.dto.StoreExtendDTO;
import
com.gic.store.dto.StoreTmpDTO
;
import
com.gic.store.entity.TabStoreBrand
;
import
com.gic.store.entity.TabStoreExtend
;
import
com.gic.store.entity.TabStoreField
;
import
com.gic.store.entity.TabStoreGroup
;
import
com.gic.store.service.*
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -19,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -40,9 +43,6 @@ public class StoreImportApiServiceImpl implements StoreImportApiService {
private
StoreService
storeService
;
@Autowired
private
StoreApiService
storeApiService
;
@Autowired
private
StoreImportService
storeImportService
;
@Autowired
...
...
@@ -54,6 +54,9 @@ public class StoreImportApiServiceImpl implements StoreImportApiService {
@Autowired
private
StoreExtendService
storeExtendService
;
@Autowired
private
StoreFieldService
storeFieldService
;
@Override
public
ServiceResponse
<
Boolean
>
hasImportingStore
(
Integer
enterpriseId
)
{
return
ServiceResponse
.
success
(
storeImportService
.
hasImportingStore
(
enterpriseId
));
...
...
@@ -149,7 +152,7 @@ public class StoreImportApiServiceImpl implements StoreImportApiService {
}
private
List
<
String
>
getTitle
(
Integer
enterpriseId
,
Integer
regionId
)
{
List
<
String
>
titleList
=
storeApiService
.
listImportTitle
(
enterpriseId
,
regionId
).
getResult
().
get
(
0
);
List
<
String
>
titleList
=
this
.
listImportTitle
(
enterpriseId
,
regionId
).
getResult
().
get
(
0
);
titleList
.
add
(
"错误信息"
);
return
titleList
;
}
...
...
@@ -205,4 +208,32 @@ public class StoreImportApiServiceImpl implements StoreImportApiService {
return
ServiceResponse
.
success
(
storeTaskService
.
importDataToStore
(
enterpriseId
,
userId
,
uuId
));
}
@Override
public
ServiceResponse
<
List
<
List
<
String
>>>
listImportTitle
(
Integer
enterpriseId
,
Integer
regionId
)
{
List
<
List
<
String
>>
list
=
new
ArrayList
<>();
String
[]
rowName
=
{
"序号"
,
"门店名称"
,
"门店代码"
,
"门店类型"
,
"门店状态"
,
"门店电话"
,
"门店所属分组"
,
"关联门店品牌"
,
"省"
,
"市"
,
"区县"
,
"门店地址(不包括省市区)"
,
"经度"
,
"纬度"
};
List
<
String
>
rowNameList
=
new
ArrayList
<>();
Collections
.
addAll
(
rowNameList
,
rowName
);
String
[]
description
=
{
""
,
"不能超过20个字"
,
"必填,不能超过20个字符,为erp系统中门店唯一识别码"
,
"门店类型描述"
,
"门店状态描述"
,
"门店电话描述"
,
"门店所属分组描述"
,
"用\"、\"隔开"
,
"省描述"
,
"市描述"
,
"区县描述"
,
"门店地址(不包括省市区)描述"
,
""
,
""
};
List
<
String
>
descriptionList
=
new
ArrayList
<>();
Collections
.
addAll
(
descriptionList
,
description
);
list
.
add
(
rowNameList
);
list
.
add
(
descriptionList
);
List
<
TabStoreField
>
fields
=
storeFieldService
.
listStoreFieldByRegionId
(
regionId
);
if
(
CollectionUtils
.
isNotEmpty
(
fields
))
{
for
(
TabStoreField
field
:
fields
)
{
rowNameList
.
add
(
field
.
getStoreFieldName
());
String
storeFieldDetail
=
field
.
getStoreFieldDetail
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
storeFieldDetail
);
descriptionList
.
add
(
jsonObject
.
getString
(
"tipMessage"
));
}
}
return
ServiceResponse
.
success
(
list
);
}
}
gic-store-web/src/main/java/com/gic/store/web/controller/StoreImportController.java
View file @
9d689bb6
...
...
@@ -14,6 +14,8 @@ 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
;
...
...
@@ -77,7 +79,7 @@ public class StoreImportController {
Integer
enterpriseId
=
1111
;
List
<
List
<
String
>>
list
=
new
ArrayList
<>();
ServiceResponse
<
List
<
List
<
String
>>>
titleServiceResponse
=
storeApiService
.
listImportTitle
(
enterpriseId
,
Integer
.
parseInt
(
regionIdStr
));
ServiceResponse
<
List
<
List
<
String
>>>
titleServiceResponse
=
store
Import
ApiService
.
listImportTitle
(
enterpriseId
,
Integer
.
parseInt
(
regionIdStr
));
// 测试数据
List
<
String
>
list3
=
new
ArrayList
<>();
Collections
.
addAll
(
list3
,
"1"
,
"杭州测试总店"
,
"A001"
,
"自营"
,
"上线"
,
"12345678912"
,
"杭州门店"
,
"品牌1、品牌2"
,
"浙江省"
,
"杭州市"
,
"西湖区"
,
"华星时代广场"
,
"经度"
,
"纬度"
);
...
...
@@ -134,13 +136,13 @@ public class StoreImportController {
return
RestResponse
.
failure
(
ErrorCode
.
ERR_5
.
getCode
(),
"门店域不存在"
);
}
List
<
Map
<
Integer
,
String
>>
data
=
ExcelUtils
.
readExcel
(
6
,
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
)
+
1
),
workbook
);
ServiceResponse
<
List
<
List
<
String
>>>
titleServiceResponse
=
storeApiService
.
listImportTitle
(
enterpriseId
,
storeRegion
.
getRegionId
());
ServiceResponse
<
List
<
List
<
String
>>>
titleServiceResponse
=
store
Import
ApiService
.
listImportTitle
(
enterpriseId
,
storeRegion
.
getRegionId
());
List
<
String
>
titleList
=
titleServiceResponse
.
getResult
().
get
(
0
);
// todo 这里在测试完成后放开
// if (CollectionUtils.isNotEmpty(data) && titleList.size() != data.get(0).size()) {
// return RestResponse.failure(ErrorCode.ERR_7.getCode(), "总列数与模板不一致");
// }
storeImportApiService
.
delStoreTmp
(
enterpriseId
);
//
storeImportApiService.delStoreTmp(enterpriseId);
for
(
Map
<
Integer
,
String
>
row
:
data
)
{
StoreTmpDTO
bean
=
this
.
validateData
(
row
,
enterpriseId
,
storeRegion
.
getRegionId
());
bean
.
setRegionId
(
storeRegion
.
getRegionId
());
...
...
@@ -487,6 +489,7 @@ public class StoreImportController {
XSSFSheet
sheet
=
workbook
.
getSheetAt
(
0
);
XSSFRow
row
=
sheet
.
getRow
(
0
);
XSSFCell
cell
=
row
.
getCell
(
0
);
cell
.
setCellType
(
Cell
.
CELL_TYPE_NUMERIC
);
ServiceResponse
<
StoreRegionDTO
>
serviceResponse
=
storeRegionApiService
.
getStoreRegionByRegion
(
enterpriseId
,
(
int
)
cell
.
getNumericCellValue
());
return
serviceResponse
.
isSuccess
()
?
serviceResponse
.
getResult
()
:
null
;
}
...
...
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