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
6371fdb1
Commit
6371fdb1
authored
Jan 21, 2020
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店批量导入
parent
98b72192
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
526 additions
and
65 deletions
+526
-65
ImportStoreBatchResultEnum.java
...va/com/gic/store/constant/ImportStoreBatchResultEnum.java
+91
-0
ProcessBatchStoreDTO.java
...src/main/java/com/gic/store/dto/ProcessBatchStoreDTO.java
+212
-0
StoreApiService.java
.../src/main/java/com/gic/store/service/StoreApiService.java
+69
-58
TabStoreBrandMapper.java
...in/java/com/gic/store/dao/mapper/TabStoreBrandMapper.java
+3
-0
StoreBrandService.java
...rc/main/java/com/gic/store/service/StoreBrandService.java
+2
-0
StoreBrandServiceImpl.java
...ava/com/gic/store/service/impl/StoreBrandServiceImpl.java
+5
-0
StoreApiServiceImpl.java
...com/gic/store/service/outer/impl/StoreApiServiceImpl.java
+130
-4
TabStoreBrandMapper.xml
...service/src/main/resources/mapper/TabStoreBrandMapper.xml
+14
-3
No files found.
gic-store-api/src/main/java/com/gic/store/constant/ImportStoreBatchResultEnum.java
0 → 100644
View file @
6371fdb1
package
com
.
gic
.
store
.
constant
;
/**
* 批处理导购返回信息
* @ClassName: ImportClerkBatchResultEnum
* @Description:
* @author guojuxing
* @date 2020/1/15 10:47 AM
*/
public
enum
ImportStoreBatchResultEnum
{
A1
(
"A1"
,
"门店信息"
,
"标记不导入"
,
"门店域"
,
"门店域为空"
),
A2
(
"A2"
,
"门店信息"
,
"标记不导入"
,
"门店域"
,
"该门店域不存在"
),
A3
(
"A3"
,
"门店信息"
,
"标记不导入"
,
"门店code"
,
"门店code重复"
),
A4
(
"A4"
,
"门店信息"
,
"标记不导入"
,
"门店code"
,
"门店code为空"
),
A5
(
"A5"
,
"门店信息"
,
"标记不导入"
,
"门店名称"
,
"门店名称为空"
),
B1
(
"B1"
,
"门店属性"
,
"标记不导入"
,
"店招品牌"
,
"店招品牌不存在"
),
B2
(
"B2"
,
"门店属性"
,
"标记不导入"
,
"门店类型"
,
"门店类型不存在"
),
B3
(
"B3"
,
"门店属性"
,
"标记导入"
,
"省市区"
,
"省市区为空"
),
B4
(
"B4"
,
"门店属性"
,
"标记不导入"
,
"省市区"
,
"省市区不存在"
),
B5
(
"B5"
,
"门店属性"
,
"标记不导入"
,
"自定义属性"
,
"必填属性XXX未填"
),
E1
(
"E1"
,
"商户信息"
,
"标记不导入"
,
"商户"
,
"商户ID非法"
),
;
/**
* 错误码
*/
private
String
code
;
/**
* 规则分类
*/
private
String
ruleClassfy
;
/**
* 处理规则
*/
private
String
processRule
;
/**
* 字段信息
*/
private
String
fieldInfo
;
/**
* 返回信息
*/
private
String
resultInfo
;
private
ImportStoreBatchResultEnum
(
String
code
,
String
ruleClassfy
,
String
processRule
,
String
fieldInfo
,
String
resultInfo
)
{
this
.
code
=
code
;
this
.
ruleClassfy
=
ruleClassfy
;
this
.
processRule
=
processRule
;
this
.
fieldInfo
=
fieldInfo
;
this
.
resultInfo
=
resultInfo
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getRuleClassfy
()
{
return
ruleClassfy
;
}
public
void
setRuleClassfy
(
String
ruleClassfy
)
{
this
.
ruleClassfy
=
ruleClassfy
;
}
public
String
getProcessRule
()
{
return
processRule
;
}
public
void
setProcessRule
(
String
processRule
)
{
this
.
processRule
=
processRule
;
}
public
String
getFieldInfo
()
{
return
fieldInfo
;
}
public
void
setFieldInfo
(
String
fieldInfo
)
{
this
.
fieldInfo
=
fieldInfo
;
}
public
String
getResultInfo
()
{
return
resultInfo
;
}
public
void
setResultInfo
(
String
resultInfo
)
{
this
.
resultInfo
=
resultInfo
;
}
}
gic-store-api/src/main/java/com/gic/store/dto/ProcessBatchStoreDTO.java
0 → 100644
View file @
6371fdb1
package
com
.
gic
.
store
.
dto
;
import
java.io.Serializable
;
/**
* @author zhiwj
* @Description:
* @date 2020-01-15 15:04
*/
public
class
ProcessBatchStoreDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3098313619184408793L
;
/**
*
*/
private
Integer
enterpriseId
;
/**
* 域id
*/
private
Integer
regionId
;
/**
* 门店名
*/
private
String
storeName
;
/**
* 门店code
*/
private
String
storeCode
;
/**
* 门店电话
*/
private
String
conactsPhone
;
/**
* 店招品牌
*/
private
String
brandName
;
/**
*
*/
private
String
province
;
/**
*
*/
private
String
city
;
/**
*
*/
private
String
county
;
/**
* 门店地址
*/
private
String
address
;
/**
* 经度
*/
private
String
longitude
;
/**
* 维度
*/
private
String
latitude
;
/**
* [
* {
* "fieldName":"", //自定义字段名
* "fieldValue:"" // 自定义字段值 如果是多选 用 ',' 隔开
* }
* ]
*/
private
String
customField
;
/**
*
*/
private
String
storeType
;
/**
*
*/
private
String
storeGroupName
;
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getRegionId
()
{
return
regionId
;
}
public
void
setRegionId
(
Integer
regionId
)
{
this
.
regionId
=
regionId
;
}
public
String
getStoreName
()
{
return
storeName
;
}
public
void
setStoreName
(
String
storeName
)
{
this
.
storeName
=
storeName
;
}
public
String
getStoreCode
()
{
return
storeCode
;
}
public
void
setStoreCode
(
String
storeCode
)
{
this
.
storeCode
=
storeCode
;
}
public
String
getConactsPhone
()
{
return
conactsPhone
;
}
public
void
setConactsPhone
(
String
conactsPhone
)
{
this
.
conactsPhone
=
conactsPhone
;
}
public
String
getBrandName
()
{
return
brandName
;
}
public
void
setBrandName
(
String
brandName
)
{
this
.
brandName
=
brandName
;
}
public
String
getProvince
()
{
return
province
;
}
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
;
}
public
String
getCity
()
{
return
city
;
}
public
void
setCity
(
String
city
)
{
this
.
city
=
city
;
}
public
String
getCounty
()
{
return
county
;
}
public
void
setCounty
(
String
county
)
{
this
.
county
=
county
;
}
public
String
getAddress
()
{
return
address
;
}
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
public
String
getLongitude
()
{
return
longitude
;
}
public
void
setLongitude
(
String
longitude
)
{
this
.
longitude
=
longitude
;
}
public
String
getLatitude
()
{
return
latitude
;
}
public
void
setLatitude
(
String
latitude
)
{
this
.
latitude
=
latitude
;
}
public
String
getCustomField
()
{
return
customField
;
}
public
void
setCustomField
(
String
customField
)
{
this
.
customField
=
customField
;
}
public
String
getStoreType
()
{
return
storeType
;
}
public
void
setStoreType
(
String
storeType
)
{
this
.
storeType
=
storeType
;
}
public
String
getStoreGroupName
()
{
return
storeGroupName
;
}
public
void
setStoreGroupName
(
String
storeGroupName
)
{
this
.
storeGroupName
=
storeGroupName
;
}
}
gic-store-api/src/main/java/com/gic/store/service/StoreApiService.java
View file @
6371fdb1
...
...
@@ -22,24 +22,24 @@ public interface StoreApiService {
* @throws
*/
ServiceResponse
<
Integer
>
saveOrUpdate
(
StoreDTO
storeDTO
);
/** @Description: 通过订单创建门店
* @author taogs
* @Date 19:07 2020/1/7
* @Param
* @return
* @Param
* @return
*/
ServiceResponse
<
Integer
>
saveStoreForOrder
(
Integer
enterpriseId
,
String
storeCode
,
String
storeName
,
Integer
regionId
,
String
orderNum
);
/**
* @Title: listStore
* @Description: 分页门店列表 查es
* @author zhiwj
* @author zhiwj
* @param storeSearchDTO
* @param pageNum
* @param pageSize
* @param returnFileds
* @return com.gic.api.base.commons.ServiceResponse
* @throws
* @throws
*/
ServiceResponse
<
Page
<
StoreDTO
>>
listStore
(
StoreSearchDTO
storeSearchDTO
,
Integer
pageNum
,
Integer
pageSize
,
String
returnFileds
);
...
...
@@ -57,20 +57,20 @@ public interface StoreApiService {
/**
* @Title: getStoreById
* @Description: 查询门店详情
* @author zhiwj
* @author zhiwj
* @param enterpriseId
* @param storeId
* @return com.gic.api.base.commons.ServiceResponse<com.gic.store.dto.StoreDTO>
* @throws
* @throws
*/
ServiceResponse
<
StoreDTO
>
getStoreById
(
Integer
enterpriseId
,
Integer
storeId
);
/** @Description: 通过企业id和storeInfoId查询门店
* @author taogs
* @Date 11:02 2020/1/7
* @Param
* @return
* @Param
* @return
*/
ServiceResponse
<
StoreDTO
>
getStoreByStoreInfoId
(
Integer
enterpriseId
,
Integer
storeInfoId
);
...
...
@@ -79,116 +79,116 @@ public interface StoreApiService {
/**
* @Title: validateFieldExceptRepeat
* @Description: 校验除 是否重复 外的所有条件
* @author zhiwj
* @author zhiwj
* @param value
* @param storeFieldDTO
* @return com.gic.api.base.commons.ServiceResponse
* @throws
* @throws
*/
ServiceResponse
<
Void
>
validateFieldExceptRepeat
(
String
value
,
StoreFieldDTO
storeFieldDTO
);
/**
* @Title: listStoreOverFlow
* @Description: 溢出门店列表
* @author zhiwj
* @author zhiwj
* @param enterpriseId
* @param page
* @param search
* @return com.gic.api.base.commons.ServiceResponse<com.gic.api.base.commons.Page<com.gic.store.dto.StoreDTO>>
* @throws
* @throws
*/
ServiceResponse
<
Page
<
StoreDTO
>>
listStoreOverFlow
(
Integer
enterpriseId
,
Page
<
StoreDTO
>
page
,
String
search
);
/**
* @Title: bulkUpdateStore
* @Description: 门店批量操作
* @author zhiwj
* @author zhiwj
* @param storeIds
* @param value
* @param enterpriseId
* @param type
* @return com.gic.api.base.commons.ServiceResponse
* @throws
* @throws
*/
ServiceResponse
bulkUpdateStore
(
String
storeIds
,
String
value
,
Integer
enterpriseId
,
int
type
,
Integer
operatorId
,
String
operatorName
);
/**
* @Title: getByStoreNameAndStoreCode
* @Description: 查询门店
* @author zhiwj
* @author zhiwj
* @param enterpriseId
* @param storeName
* @param storeCode
* @return com.gic.api.base.commons.ServiceResponse<com.gic.store.dto.StoreDTO>
* @throws
* @throws
*/
ServiceResponse
<
StoreDTO
>
getByStoreNameAndStoreCode
(
Integer
enterpriseId
,
String
storeName
,
String
storeCode
);
/**
* @Title: addStoreToIndex
* @Description: 添加单个门店到es
* @author zhiwj
* @author zhiwj
* @param enterpriseId
* @param storeId
* @return com.gic.api.base.commons.ServiceResponse
* @throws
* @throws
*/
ServiceResponse
<
Void
>
addStoreToIndex
(
Integer
enterpriseId
,
Integer
storeId
);
/**
* @Title: bulkAddStoreToIndex
* @Description: 批量添加门店到索引
* @author zhiwj
* @author zhiwj
* @param enterpriseId
* @return com.gic.api.base.commons.ServiceResponse
* @throws
* @throws
*/
ServiceResponse
<
Void
>
bulkAddStoreToIndex
(
Integer
enterpriseId
);
/**
* @Title: bulkAddStoreToIndex
* @Description: 批量添加门店到索引
* @author zhiwj
* @author zhiwj
* @param enterpriseId
* @param storeIdList
* @return com.gic.api.base.commons.ServiceResponse
* @throws
* @throws
*/
ServiceResponse
<
Void
>
bulkAddStoreToIndex
(
Integer
enterpriseId
,
List
<
Integer
>
storeIdList
);
/**
* @Title: updateStoreToIndex
* @Description: 批量编辑门店到索引
* @author zhiwj
* @author zhiwj
* @param enterpriseId
* @param storeId
* @param indexId
* @return com.gic.api.base.commons.ServiceResponse
* @throws
* @throws
*/
ServiceResponse
<
Void
>
updateStoreToIndex
(
Integer
enterpriseId
,
Integer
storeId
,
Long
indexId
);
/**
* @Title: bulkUpdateStoreToIndex
* @Description: 批量编辑门店到索引
* @author zhiwj
* @author zhiwj
* @param enterpriseId
* @return com.gic.api.base.commons.ServiceResponse
* @throws
* @throws
*/
ServiceResponse
<
Void
>
bulkUpdateStoreToIndex
(
Integer
enterpriseId
);
/**
* @Title: bulkUpdateStoreToIndex
* @Description: 批量编辑门店到索引
* @author zhiwj
* @author zhiwj
* @param enterpriseId
* @param storeIdList
* @return com.gic.api.base.commons.ServiceResponse
* @throws
* @throws
*/
ServiceResponse
<
Void
>
bulkUpdateStoreToIndex
(
Integer
enterpriseId
,
List
<
Integer
>
storeIdList
);
/**
* @Title: queryStoreFromES
* @Description: 查询es
...
...
@@ -199,31 +199,31 @@ public interface StoreApiService {
* @param sortJson
* @param returnFields
* @return com.gic.api.base.commons.ServiceResponse
* @throws
* @throws
*/
ServiceResponse
<
Void
>
queryStoreFromES
(
JSONObject
jsonObject
,
Integer
pageNum
,
Integer
pageSize
,
JSONObject
sortJson
,
String
returnFields
);
/** @Description: 查询门店数量 from es
* @author taogs
* @Date 13:37 2019/9/25
* @Param
* @return
* @Param
* @return
*/
ServiceResponse
<
Long
>
queryStoreCountFromES
(
StoreSearchDTO
storeSearchDTO
);
/** @Description: 删除门店 from es
* @author taogs
* @Date 18:44 2019/9/25
* @Param
* @return
* @Param
* @return
*/
ServiceResponse
<
Void
>
deleteStoreFromES
(
Integer
enterpriseId
,
Integer
storeId
);
/** @Description: 门店选择器参数转换
* @author taogs
* @Date 11:26 2019/8/23
* @Param
* @return
* @Param
* @return
*/
ServiceResponse
<
JSONObject
>
parseStoreSelectJson
(
String
searchJson
);
...
...
@@ -231,31 +231,42 @@ public interface StoreApiService {
ServiceResponse
<
List
<
StoreDTO
>>
listStore
(
String
search
,
Integer
enterpriseId
);
/** @Description: 小程序附近门店
* @author taogs
* @Date 19:41 2019/12/4
* @Param
* @return
* @Param
* @return
*/
ServiceResponse
<
Page
<
StoreDTO
>>
pageNearbyStore
(
WxSearchStoreSearchDTO
wxSearchStoreSearchDTO
);
/** @Description: 小程序卡券适用门店
* @author taogs
* @Date 17:22 2019/12/24
* @Param
* @return
* @Param
* @return
*/
ServiceResponse
<
Page
<
StoreDTO
>>
pageCoupApplyStore
(
WxSearchStoreSearchDTO
wxSearchStoreSearchDTO
);
/** @Description: 小程序开卡门店
* @author taogs
* @Date 18:38 2019/12/24
* @Param
* @return
*/
/** @Description: 小程序开卡门店
* @author taogs
* @Date 18:38 2019/12/24
* @Param
* @return
*/
ServiceResponse
<
Page
<
StoreDTO
>>
pageOpenCardStore
(
WxSearchStoreSearchDTO
wxSearchStoreSearchDTO
);
ServiceResponse
<
Void
>
storeQrcodeCallBack
(
String
param
);
/**
* 导入门店
* @Title: importStoreForOperation
* @Description:
* @author zhiwj
* @param processBatchStoreDTO
* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>
* @throws
*/
ServiceResponse
<
String
>
importStoreForOperation
(
ProcessBatchStoreDTO
processBatchStoreDTO
);
}
gic-store-service/src/main/java/com/gic/store/dao/mapper/TabStoreBrandMapper.java
View file @
6371fdb1
...
...
@@ -119,4 +119,6 @@ public interface TabStoreBrandMapper {
Integer
deleteByIds
(
@Param
(
"ids"
)
List
<
Integer
>
ids
);
List
<
TabStoreBrand
>
listStoreBrandByIds
(
@Param
(
"ids"
)
List
<
Integer
>
idList
);
TabStoreBrand
getByStoreBrandName
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"storeBrandName"
)
String
storeBrandName
);
}
\ No newline at end of file
gic-store-service/src/main/java/com/gic/store/service/StoreBrandService.java
View file @
6371fdb1
...
...
@@ -19,6 +19,8 @@ public interface StoreBrandService {
int
countByStoreBrandName
(
Integer
enterpriseId
,
String
storeBrandName
,
Integer
storeBrandId
);
TabStoreBrand
getByStoreBrandName
(
Integer
enterpriseId
,
String
storeBrandName
);
Page
<
TabStoreBrand
>
listStoreBrand
(
Integer
enterpriseId
,
String
search
,
Integer
pageNum
,
Integer
pageSize
);
List
<
TabStoreBrand
>
listAllStoreBrand
(
Integer
enterpriseId
,
String
search
);
...
...
gic-store-service/src/main/java/com/gic/store/service/impl/StoreBrandServiceImpl.java
View file @
6371fdb1
...
...
@@ -66,6 +66,11 @@ public class StoreBrandServiceImpl implements StoreBrandService {
}
@Override
public
TabStoreBrand
getByStoreBrandName
(
Integer
enterpriseId
,
String
storeBrandName
)
{
return
tabStoreBrandMapper
.
getByStoreBrandName
(
enterpriseId
,
storeBrandName
);
}
@Override
public
Page
<
TabStoreBrand
>
listStoreBrand
(
Integer
enterpriseId
,
String
search
,
Integer
pageNum
,
Integer
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
TabStoreBrand
>
storeBrandList
=
tabStoreBrandMapper
.
listStoreBrand
(
enterpriseId
,
search
);
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreApiServiceImpl.java
View file @
6371fdb1
...
...
@@ -40,10 +40,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
...
...
@@ -94,6 +91,10 @@ public class StoreApiServiceImpl implements StoreApiService {
private
StoreWidgetApiService
storeWidgetApiService
;
@Autowired
private
StoreWidgetService
storeWidgetService
;
@Autowired
private
ProvincesApiService
provincesApiService
;
@Autowired
private
StoreFieldService
storeFieldService
;
private
Map
<
String
,
BulkUpdateStoreStrtegy
>
storeStrtegyMap
=
new
ConcurrentHashMap
<>();
...
...
@@ -595,6 +596,126 @@ public class StoreApiServiceImpl implements StoreApiService {
}
@Override
public
ServiceResponse
<
String
>
importStoreForOperation
(
ProcessBatchStoreDTO
processBatchStoreDTO
)
{
logger
.
info
(
"批量处理门店:{}"
,
JSON
.
toJSONString
(
processBatchStoreDTO
));
// processBatchStoreDTO.get
StoreDTO
storeDTO
=
new
StoreDTO
();
ServiceResponse
enterpriseResult
=
enterpriseApiService
.
getEnterpriseById
(
processBatchStoreDTO
.
getEnterpriseId
());
if
(!
enterpriseResult
.
isSuccess
())
{
return
responseErrorElement
(
ImportStoreBatchResultEnum
.
E1
);
}
storeDTO
.
setEnterpriseId
(
processBatchStoreDTO
.
getEnterpriseId
());
if
(
processBatchStoreDTO
.
getRegionId
()
==
null
)
{
return
responseErrorElement
(
ImportStoreBatchResultEnum
.
A1
);
}
TabStoreRegion
storeRegion
=
storeRegionService
.
getById
(
processBatchStoreDTO
.
getEnterpriseId
(),
processBatchStoreDTO
.
getRegionId
());
if
(
storeRegion
==
null
)
{
return
responseErrorElement
(
ImportStoreBatchResultEnum
.
A2
);
}
storeDTO
.
setRegionId
(
storeRegion
.
getRegionId
());
if
(
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getStoreName
()))
{
return
responseErrorElement
(
ImportStoreBatchResultEnum
.
A5
);
}
storeDTO
.
setStoreName
(
processBatchStoreDTO
.
getStoreName
());
if
(
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getStoreCode
()))
{
return
responseErrorElement
(
ImportStoreBatchResultEnum
.
A4
);
}
storeDTO
.
setStoreCode
(
processBatchStoreDTO
.
getStoreCode
());
if
(
StringUtils
.
isNotBlank
(
processBatchStoreDTO
.
getBrandName
()))
{
TabStoreBrand
storeBrand
=
storeBrandService
.
getByStoreBrandName
(
processBatchStoreDTO
.
getEnterpriseId
(),
processBatchStoreDTO
.
getBrandName
());
if
(
storeBrand
==
null
)
{
return
responseErrorElement
(
ImportStoreBatchResultEnum
.
B1
);
}
storeDTO
.
setBrandIds
(
storeBrand
.
getStoreBrandId
().
toString
());
}
if
(
StringUtils
.
isNotBlank
(
processBatchStoreDTO
.
getStoreType
()))
{
ServiceResponse
<
List
<
StoreDictDTO
>>
serviceResponse
=
storeDictApiService
.
listStoreType
(
processBatchStoreDTO
.
getEnterpriseId
());
if
(
serviceResponse
.
isSuccess
())
{
List
<
StoreDictDTO
>
list
=
serviceResponse
.
getResult
();
final
String
storeTypeTmp
=
processBatchStoreDTO
.
getStoreType
().
trim
();
for
(
StoreDictDTO
storeDictDTO
:
list
)
{
if
(
storeDictDTO
.
getKey
().
equals
(
storeTypeTmp
))
{
storeDTO
.
setStoreType
(
Integer
.
valueOf
(
storeDictDTO
.
getValue
()));
break
;
}
}
}
else
{
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
UNKNOWN_ERROR
.
getCode
(),
"调用门店类型接口失败"
);
}
}
// 验证省市区数据的正确性
if
(!(
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getProvince
())
&&
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getCity
())
&&
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getCounty
())))
{
ServiceResponse
<
List
<
ProvinceDTO
>>
provinceResponse
=
provincesApiService
.
selectAllProvince
();
ServiceResponse
<
List
<
CityDTO
>>
cityResponse
=
provincesApiService
.
selectAllCity
();
ServiceResponse
<
List
<
CountyDTO
>>
countyResponse
=
provincesApiService
.
selectAllCounty
();
List
<
ProvinceDTO
>
provinceDTOList
=
provinceResponse
.
getResult
();
String
finalProvince
=
processBatchStoreDTO
.
getProvince
();
ProvinceDTO
provinceDTO
=
provinceDTOList
.
stream
().
filter
(
e
->
StringUtils
.
equals
(
e
.
getProvinceName
(),
finalProvince
)).
findFirst
().
orElse
(
null
);
List
<
CityDTO
>
cityDTOList
=
cityResponse
.
getResult
();
String
finalCity
=
processBatchStoreDTO
.
getCity
();
CityDTO
cityDTO
=
cityDTOList
.
stream
().
filter
(
e
->
StringUtils
.
equals
(
e
.
getCityName
(),
finalCity
)).
findFirst
().
orElse
(
null
);
List
<
CountyDTO
>
countyDTOList
=
countyResponse
.
getResult
();
String
finalCounty
=
processBatchStoreDTO
.
getCounty
();
CountyDTO
countyDTO
=
countyDTOList
.
stream
().
filter
(
e
->
StringUtils
.
equals
(
e
.
getCountyName
(),
finalCounty
)).
findFirst
().
orElse
(
null
);
if
(
countyDTO
==
null
||
cityDTO
==
null
||
provinceDTO
==
null
)
{
return
responseErrorElement
(
ImportStoreBatchResultEnum
.
B4
);
}
storeDTO
.
setProvinceId
(
countyDTO
.
getProvinceId
());
storeDTO
.
setCityId
(
countyDTO
.
getCityId
());
storeDTO
.
setAreaId
(
countyDTO
.
getCountyId
());
storeDTO
.
setProvinces
(
provinceDTO
.
getProvinceName
()
+
"/"
+
countyDTO
.
getCountyName
()
+
"/"
+
cityDTO
.
getCityName
());
}
List
<
StoreFieldDTO
>
fieldList
=
storeFieldService
.
listStoreFieldByRegionId
(
processBatchStoreDTO
.
getRegionId
());
String
customField
=
processBatchStoreDTO
.
getCustomField
();
if
(
StringUtils
.
isBlank
(
customField
))
{
customField
=
""
;
}
List
<
JSONObject
>
customFieldList
=
JSON
.
parseArray
(
customField
,
JSONObject
.
class
);
// logger.info("门店域的ID:{}, 自定义字段数据:{}", regionId, JSON.toJSONString(fieldList));
if
(
CollectionUtils
.
isNotEmpty
(
fieldList
))
{
List
<
StoreExtendDTO
>
extendDTOList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
fieldList
.
size
();
i
++)
{
StoreExtendDTO
storeExtendDTO
=
new
StoreExtendDTO
();
storeExtendDTO
.
setStoreFieldId
(
fieldList
.
get
(
i
).
getStoreFieldId
());
for
(
JSONObject
storeFieldObject
:
customFieldList
)
{
if
(
fieldList
.
get
(
i
).
getStoreFieldName
().
equals
(
storeFieldObject
.
getString
(
"fieldName"
)))
{
storeExtendDTO
.
setValue
(
storeFieldObject
.
getString
(
"fieldValue"
));
break
;
}
}
storeExtendDTO
.
setSort
(
fieldList
.
get
(
i
).
getSort
());
// 验证
ServiceResponse
fieldResponse
=
validateFieldExceptRepeat
(
storeExtendDTO
.
getValue
(),
fieldList
.
get
(
i
));
if
(!
fieldResponse
.
isSuccess
())
{
return
EnterpriseServiceResponse
.
failure
(
ImportStoreBatchResultEnum
.
B5
.
getCode
(),
fieldResponse
.
getMessage
());
}
extendDTOList
.
add
(
storeExtendDTO
);
}
storeDTO
.
setStoreExtendList
(
extendDTOList
);
}
else
{
storeDTO
.
setStoreExtendList
(
Collections
.
emptyList
());
}
storeDTO
.
setConactsPhone
(
processBatchStoreDTO
.
getConactsPhone
());
storeDTO
.
setAddress
(
processBatchStoreDTO
.
getAddress
());
storeDTO
.
setLongitude
(
processBatchStoreDTO
.
getLongitude
());
storeDTO
.
setLatitude
(
processBatchStoreDTO
.
getLatitude
());
storeDTO
.
setReason
(
StoreLogReasonEnum
.
EXTERNAL
.
getCode
());
// 保存门店
// this.storeService.save(storeDTO);
this
.
saveOrUpdate
(
storeDTO
);
if
((
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getProvince
())
&&
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getCity
())
&&
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getCounty
())))
{
return
responseErrorElement
(
ImportStoreBatchResultEnum
.
B3
);
}
else
{
return
EnterpriseServiceResponse
.
success
();
}
}
@Override
public
ServiceResponse
<
StoreDTO
>
getStoreById
(
Integer
enterpriseId
,
Integer
storeId
)
{
String
key
=
Constants
.
STORE_KEY
+
enterpriseId
+
":"
+
storeId
;
...
...
@@ -1067,4 +1188,9 @@ public class StoreApiServiceImpl implements StoreApiService {
enterpriseJson
=
QueryConditionAssemblyUtil
.
createListQueryNode
(
jsonObjectList
,
OperateEnum
.
OPERATE_AND
);
return
enterpriseJson
;
}
private
static
ServiceResponse
<
String
>
responseErrorElement
(
ImportStoreBatchResultEnum
error
)
{
return
ServiceResponse
.
failure
(
error
.
getCode
(),
error
.
getResultInfo
());
}
}
gic-store-service/src/main/resources/mapper/TabStoreBrandMapper.xml
View file @
6371fdb1
...
...
@@ -165,9 +165,9 @@
<if
test=
"enterpriseId != null "
>
and enterprise_id = #{enterpriseId}
</if>
<if
test=
"storeBrandCode != null and storeBrandCode != '' "
>
and store_brand_code = #{storeBrandCode}
</if
>
<!-- <if test="storeBrandCode != null and storeBrandCode != '' ">--
>
<!-- and store_brand_code = #{storeBrandCode}-->
<!-- </if>--
>
<if
test=
"storeBrandName != null and storeBrandName != '' "
>
and store_brand_name = #{storeBrandName}
</if>
...
...
@@ -241,4 +241,14 @@
</if>
order by sort
</select>
<select
id=
"getByStoreBrandName"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_store_brand
where status = 1
and enterprise_id = #{enterpriseId}
<if
test=
"storeBrandName != null "
>
and store_brand_name = #{storeBrandName}
</if>
</select>
</mapper>
\ No newline at end of file
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