Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
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-platform-enterprise
Commits
667a966f
Commit
667a966f
authored
Aug 08, 2019
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
品牌库接口
parent
d01bcaba
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
173 additions
and
33 deletions
+173
-33
PlatformBrandDTO.java
...rc/main/java/com/gic/enterprise/dto/PlatformBrandDTO.java
+5
-5
PlatformBrandApiService.java
...a/com/gic/enterprise/service/PlatformBrandApiService.java
+6
-6
TabPlatformBrandRefMapper.java
.../gic/enterprise/dao/mapper/TabPlatformBrandRefMapper.java
+4
-1
PlatformBrandRefService.java
...a/com/gic/enterprise/service/PlatformBrandRefService.java
+2
-0
PlatformBrandRefServiceImpl.java
.../enterprise/service/impl/PlatformBrandRefServiceImpl.java
+8
-1
PlatformBrandApiServiceImpl.java
...enterprise/service/outer/PlatformBrandApiServiceImpl.java
+18
-5
TabPlatformBrandRefMapper.xml
...e/src/main/resources/mapper/TabPlatformBrandRefMapper.xml
+7
-1
PlatformBrandController.java
...gic/operation/web/controller/PlatformBrandController.java
+70
-0
StoreBrandController.java
...om/gic/operation/web/controller/StoreBrandController.java
+0
-14
PlatformBrandQO.java
...c/main/java/com/gic/operation/web/qo/PlatformBrandQO.java
+53
-0
No files found.
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/dto/PlatformBrandDTO.java
View file @
667a966f
...
...
@@ -27,7 +27,7 @@ public class PlatformBrandDTO implements Serializable {
*/
private
Integer
createType
;
private
Integer
enterprise
b
randCount
;
private
Integer
enterprise
B
randCount
;
public
Integer
getPlatformBrandId
()
{
return
platformBrandId
;
...
...
@@ -69,11 +69,11 @@ public class PlatformBrandDTO implements Serializable {
this
.
createType
=
createType
;
}
public
Integer
getEnterprise
b
randCount
()
{
return
enterprise
b
randCount
;
public
Integer
getEnterprise
B
randCount
()
{
return
enterprise
B
randCount
;
}
public
void
setEnterprise
brandCount
(
Integer
enterpriseb
randCount
)
{
this
.
enterprise
brandCount
=
enterpriseb
randCount
;
public
void
setEnterprise
BrandCount
(
Integer
enterpriseB
randCount
)
{
this
.
enterprise
BrandCount
=
enterpriseB
randCount
;
}
}
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/PlatformBrandApiService.java
View file @
667a966f
...
...
@@ -50,11 +50,11 @@ public interface PlatformBrandApiService {
/**
* 查询品牌list, 条件为:名称:platformBrandName 类目:platformBrandCategoryId 来源:createType
* @Title: listPlatformBrand
* @Description:
* @author zhiwj
* @Description:
* @author zhiwj
* @param platformBrandDTO
* @return com.gic.api.base.commons.ServiceResponse<com.gic.api.base.commons.Page<com.gic.enterprise.dto.PlatformBrandDTO>>
* @throws
* @throws
*/
ServiceResponse
<
Page
<
PlatformBrandDTO
>>
listPlatformBrand
(
PlatformBrandDTO
platformBrandDTO
,
Integer
pageNum
,
Integer
pageSize
);
...
...
@@ -113,7 +113,7 @@ public interface PlatformBrandApiService {
* @return com.gic.api.base.commons.ServiceResponse<com.gic.api.base.commons.Page<com.gic.enterprise.dto.PlatformBrandRefDTO>>
* @throws
*/
ServiceResponse
<
Page
<
PlatformBrandRefDTO
>>
listByPlatformBrandRef
(
String
brandName
);
ServiceResponse
<
Page
<
PlatformBrandRefDTO
>>
listByPlatformBrandRef
(
String
brandName
,
Integer
pageNum
,
Integer
pageSize
);
/**
* 并入操作,将fromBrandId关联的商户品牌, 并入到toBrandId平台品牌下; 并删除fromBrandId平台品牌
...
...
@@ -121,11 +121,11 @@ public interface PlatformBrandApiService {
* @Description:
* @author zhiwj
* @param fromBrandId
* @param toBrand
Id
* @param toBrand
Name
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse
<
Integer
>
mergeBrandRef
(
Integer
fromBrandId
,
Integer
toBrandId
);
ServiceResponse
<
Integer
>
mergeBrandRef
(
Integer
fromBrandId
,
String
toBrandName
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/dao/mapper/TabPlatformBrandRefMapper.java
View file @
667a966f
...
...
@@ -62,5 +62,7 @@ public interface TabPlatformBrandRefMapper {
Integer
delRef
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"enterpriseBrandId"
)
Integer
enterpriseBrandId
);
Page
<
TabPlatformBrandRef
>
listByPlatformBrandRef
(
@Param
(
"brandName"
)
String
brandName
);
Page
<
TabPlatformBrandRef
>
listByPlatformBrandRef
(
TabPlatformBrandRef
brandRef
);
Integer
updateRef
(
@Param
(
"fromBrandId"
)
Integer
fromBrandId
,
@Param
(
"toBrandId"
)
Integer
toBrandId
);
}
\ No newline at end of file
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/PlatformBrandRefService.java
View file @
667a966f
...
...
@@ -17,4 +17,6 @@ public interface PlatformBrandRefService {
Integer
delRef
(
Integer
enterpriseId
,
Integer
enterpriseBrandId
);
Page
<
TabPlatformBrandRef
>
listByPlatformBrandRef
(
String
brandName
);
Integer
updateRef
(
Integer
fromBrandId
,
Integer
toBrandId
);
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/impl/PlatformBrandRefServiceImpl.java
View file @
667a966f
...
...
@@ -57,6 +57,13 @@ public class PlatformBrandRefServiceImpl implements PlatformBrandRefService {
@Override
public
Page
<
TabPlatformBrandRef
>
listByPlatformBrandRef
(
String
brandName
)
{
return
tabPlatformBrandRefMapper
.
listByPlatformBrandRef
(
brandName
);
TabPlatformBrandRef
brandRef
=
new
TabPlatformBrandRef
();
brandRef
.
setEnterpriseBrandName
(
brandName
);
return
tabPlatformBrandRefMapper
.
listByPlatformBrandRef
(
brandRef
);
}
@Override
public
Integer
updateRef
(
Integer
fromBrandId
,
Integer
toBrandId
)
{
return
tabPlatformBrandRefMapper
.
updateRef
(
fromBrandId
,
toBrandId
);
}
}
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/PlatformBrandApiServiceImpl.java
View file @
667a966f
...
...
@@ -13,6 +13,7 @@ import com.gic.enterprise.error.ErrorCode;
import
com.gic.enterprise.service.PlatformBrandApiService
;
import
com.gic.enterprise.service.PlatformBrandRefService
;
import
com.gic.enterprise.service.PlatformBrandService
;
import
com.github.pagehelper.PageHelper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -97,7 +98,7 @@ public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
List
<
Integer
>
platformBrandIdList
=
platformBrandDTOList
.
stream
().
map
(
PlatformBrandDTO:
:
getPlatformBrandId
).
collect
(
Collectors
.
toList
());
Map
<
Integer
,
Integer
>
map
=
platformBrandRefService
.
countByPlatformBrandIds
(
platformBrandIdList
);
for
(
PlatformBrandDTO
brandDTO
:
platformBrandDTOList
)
{
brandDTO
.
setEnterprise
b
randCount
(
map
.
get
(
brandDTO
.
getPlatformBrandId
()));
brandDTO
.
setEnterprise
B
randCount
(
map
.
get
(
brandDTO
.
getPlatformBrandId
()));
}
}
return
ServiceResponse
.
success
(
page
);
...
...
@@ -148,15 +149,27 @@ public class PlatformBrandApiServiceImpl implements PlatformBrandApiService {
}
@Override
public
ServiceResponse
<
Page
<
PlatformBrandRefDTO
>>
listByPlatformBrandRef
(
String
brandName
)
{
public
ServiceResponse
<
Page
<
PlatformBrandRefDTO
>>
listByPlatformBrandRef
(
String
brandName
,
Integer
pageNum
,
Integer
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
com
.
github
.
pagehelper
.
Page
<
TabPlatformBrandRef
>
brandRefPage
=
this
.
platformBrandRefService
.
listByPlatformBrandRef
(
brandName
);
Page
<
PlatformBrandRefDTO
>
page
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
brandRefPage
,
PlatformBrandRefDTO
.
class
);
return
ServiceResponse
.
success
(
page
);
}
@Override
public
ServiceResponse
<
Integer
>
mergeBrandRef
(
Integer
fromBrandId
,
Integer
toBrandId
)
{
return
null
;
public
ServiceResponse
<
Integer
>
mergeBrandRef
(
Integer
fromBrandId
,
String
toBrandName
)
{
if
(
fromBrandId
==
null
||
StringUtils
.
isBlank
(
toBrandName
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
ErrorCode
.
PARAMETER_ERROR
.
getMsg
());
}
TabPlatformBrand
platformBrand
=
this
.
platformBrandService
.
getByBrandName
(
toBrandName
);
if
(
platformBrand
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
NOTEXISTS
.
getCode
(),
"品牌名称不存在或已失效"
);
}
Integer
line
=
this
.
platformBrandRefService
.
updateRef
(
fromBrandId
,
platformBrand
.
getPlatformBrandId
());
if
(
line
>
0
)
{
return
this
.
delBrandById
(
fromBrandId
);
}
else
{
return
ServiceResponse
.
failure
(
ErrorCode
.
NOTEXISTS
.
getCode
(),
ErrorCode
.
NOTEXISTS
.
getMsg
());
}
}
}
gic-platform-enterprise-service/src/main/resources/mapper/TabPlatformBrandRefMapper.xml
View file @
667a966f
...
...
@@ -146,7 +146,7 @@
select count(1) from tab_platform_brand_ref where platform_brand_id = #{platformBrandId} and status = 1
</select>
<select
id=
"countByPlatformBrandIds"
resultType=
"java.util.HashMap"
>
select platform_brand_id platformBrandId , count(1)
b
randCount from tab_platform_brand_ref where
select platform_brand_id platformBrandId , count(1)
enterpriseB
randCount from tab_platform_brand_ref where
status = 1
<if
test=
"null != ids"
>
and platform_brand_id in
...
...
@@ -163,8 +163,14 @@
<include
refid=
"Base_Column_List"
/>
from tab_platform_brand_ref
where status = 1
<if
test=
"platformBrandId != null "
>
and platform_brand_id = #{platformBrandId}
</if>
<if
test=
"brandName != null and brandName != '' "
>
and brand_name = #{brandName}
</if>
</select>
<select
id=
"updateRef"
resultType=
"java.lang.Integer"
>
update tab_platform_brand_ref set platform_brand_id = #{toBrandId} where status = 1 and platform_brand_id = #{fromBrandId}
</select>
</mapper>
gic-platform-operation-web/src/main/java/com/gic/operation/web/controller/PlatformBrandController.java
0 → 100644
View file @
667a966f
package
com
.
gic
.
operation
.
web
.
controller
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.dto.PlatformBrandDTO
;
import
com.gic.enterprise.dto.PlatformBrandRefDTO
;
import
com.gic.enterprise.service.PlatformBrandApiService
;
import
com.gic.operation.web.qo.PageQO
;
import
com.gic.operation.web.qo.PlatformBrandQO
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
public
class
PlatformBrandController
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PlatformBrandController
.
class
);
@Autowired
private
PlatformBrandApiService
platformBrandApiService
;
@RequestMapping
(
"/brand-save"
)
public
RestResponse
saveBrand
(
@Validated
({
PlatformBrandQO
.
SavePlatformBrandValid
.
class
})
PlatformBrandQO
platformBrandQO
)
{
PlatformBrandDTO
platformBrandDTO
=
new
PlatformBrandDTO
();
platformBrandDTO
.
setPlatformBrandName
(
platformBrandQO
.
getPlatformBrandName
());
platformBrandDTO
.
setPlatformBrandCategoryId
(
platformBrandQO
.
getPlatformBrandCategoryId
());
ServiceResponse
<
Integer
>
serviceResponse
=
platformBrandApiService
.
saveOrUpdateBrandFromOperation
(
platformBrandDTO
);
if
(
serviceResponse
.
isSuccess
())
{
return
RestResponse
.
success
(
serviceResponse
.
getResult
());
}
else
{
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
}
@RequestMapping
(
"/brand-del"
)
public
RestResponse
delBrand
(
@Validated
({
PlatformBrandQO
.
SavePlatformBrandValid
.
class
})
PlatformBrandQO
platformBrandQO
)
{
ServiceResponse
<
Integer
>
serviceResponse
=
platformBrandApiService
.
delBrandById
(
platformBrandQO
.
getPlatformBrandId
());
if
(
serviceResponse
.
isSuccess
())
{
return
RestResponse
.
success
(
serviceResponse
.
getResult
());
}
else
{
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
}
@RequestMapping
(
"/brand-list"
)
public
RestResponse
listBrand
(
PlatformBrandQO
platformBrandQO
,
PageQO
pageQO
)
{
ServiceResponse
<
Page
<
PlatformBrandDTO
>>
serviceResponse
=
platformBrandApiService
.
listPlatformBrand
(
EntityUtil
.
changeEntityByOrika
(
PlatformBrandDTO
.
class
,
platformBrandQO
),
pageQO
.
getCurrentPage
(),
pageQO
.
getPageSize
());
if
(
serviceResponse
.
isSuccess
())
{
return
RestResponse
.
success
(
serviceResponse
.
getResult
());
}
else
{
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
}
@RequestMapping
(
"/brand-ref-list"
)
public
RestResponse
listBrandRef
(
PlatformBrandQO
platformBrandQO
,
PageQO
pageQO
)
{
ServiceResponse
<
Page
<
PlatformBrandRefDTO
>>
serviceResponse
=
platformBrandApiService
.
listByPlatformBrandRef
(
platformBrandQO
.
getPlatformBrandName
(),
pageQO
.
getCurrentPage
(),
pageQO
.
getPageSize
());
if
(
serviceResponse
.
isSuccess
())
{
return
RestResponse
.
success
(
serviceResponse
.
getResult
());
}
else
{
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
}
}
gic-platform-operation-web/src/main/java/com/gic/operation/web/controller/StoreBrandController.java
deleted
100644 → 0
View file @
d01bcaba
package
com
.
gic
.
operation
.
web
.
controller
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* @author zhiwj
* @date 2019/6/27
*/
@RestController
public
class
StoreBrandController
{
}
gic-platform-operation-web/src/main/java/com/gic/operation/web/qo/PlatformBrandQO.java
0 → 100644
View file @
667a966f
package
com
.
gic
.
operation
.
web
.
qo
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
public
class
PlatformBrandQO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3361955210762134043L
;
public
interface
SavePlatformBrandValid
{}
public
interface
DelPlatformBrandValid
{}
@NotNull
(
message
=
"请选择品牌"
,
groups
=
DelPlatformBrandValid
.
class
)
private
Integer
platformBrandId
;
@NotNull
(
message
=
"品牌名不能为空"
,
groups
=
{
SavePlatformBrandValid
.
class
})
private
String
platformBrandName
;
@NotNull
(
message
=
"经营类目不能为空"
,
groups
=
{
SavePlatformBrandValid
.
class
})
private
Integer
platformBrandCategoryId
;
private
Integer
createType
;
public
Integer
getPlatformBrandId
()
{
return
platformBrandId
;
}
public
void
setPlatformBrandId
(
Integer
platformBrandId
)
{
this
.
platformBrandId
=
platformBrandId
;
}
public
String
getPlatformBrandName
()
{
return
platformBrandName
;
}
public
void
setPlatformBrandName
(
String
platformBrandName
)
{
this
.
platformBrandName
=
platformBrandName
;
}
public
Integer
getPlatformBrandCategoryId
()
{
return
platformBrandCategoryId
;
}
public
void
setPlatformBrandCategoryId
(
Integer
platformBrandCategoryId
)
{
this
.
platformBrandCategoryId
=
platformBrandCategoryId
;
}
public
Integer
getCreateType
()
{
return
createType
;
}
public
void
setCreateType
(
Integer
createType
)
{
this
.
createType
=
createType
;
}
}
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