Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Administrator
mall4cloudNew
Commits
3ab6e756
Commit
3ab6e756
authored
Dec 21, 2023
by
shengnan hu
Browse files
init
parents
Pipeline
#294
passed with stage
in 2 minutes and 13 seconds
Changes
678
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1905 additions
and
0 deletions
+1905
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/feign/ShopDetailFeignController.java
...ll4j/cloud/multishop/feign/ShopDetailFeignController.java
+61
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/mapper/HotSearchMapper.java
...va/com/mall4j/cloud/multishop/mapper/HotSearchMapper.java
+63
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/mapper/IndexImgMapper.java
...ava/com/mall4j/cloud/multishop/mapper/IndexImgMapper.java
+63
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/mapper/ShopDetailMapper.java
...a/com/mall4j/cloud/multishop/mapper/ShopDetailMapper.java
+111
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/mapper/ShopUserMapper.java
...ava/com/mall4j/cloud/multishop/mapper/ShopUserMapper.java
+70
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/model/HotSearch.java
...main/java/com/mall4j/cloud/multishop/model/HotSearch.java
+106
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/model/IndexImg.java
.../main/java/com/mall4j/cloud/multishop/model/IndexImg.java
+119
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/model/ShopDetail.java
...ain/java/com/mall4j/cloud/multishop/model/ShopDetail.java
+174
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/model/ShopUser.java
.../main/java/com/mall4j/cloud/multishop/model/ShopUser.java
+107
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/HotSearchService.java
.../com/mall4j/cloud/multishop/service/HotSearchService.java
+66
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/IndexImgService.java
...a/com/mall4j/cloud/multishop/service/IndexImgService.java
+66
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/ShopDetailService.java
...com/mall4j/cloud/multishop/service/ShopDetailService.java
+123
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/ShopUserAccountService.java
...all4j/cloud/multishop/service/ShopUserAccountService.java
+34
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/ShopUserService.java
...a/com/mall4j/cloud/multishop/service/ShopUserService.java
+59
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/impl/HotSearchServiceImpl.java
...4j/cloud/multishop/service/impl/HotSearchServiceImpl.java
+67
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/impl/IndexImgServiceImpl.java
...l4j/cloud/multishop/service/impl/IndexImgServiceImpl.java
+76
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/impl/ShopDetailServiceImpl.java
...j/cloud/multishop/service/impl/ShopDetailServiceImpl.java
+271
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/impl/ShopUserAccountServiceImpl.java
...ud/multishop/service/impl/ShopUserAccountServiceImpl.java
+83
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/impl/ShopUserServiceImpl.java
...l4j/cloud/multishop/service/impl/ShopUserServiceImpl.java
+94
-0
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/vo/HotSearchVO.java
.../main/java/com/mall4j/cloud/multishop/vo/HotSearchVO.java
+92
-0
No files found.
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/feign/ShopDetailFeignController.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.feign
;
import
com.mall4j.cloud.api.multishop.bo.EsShopDetailBO
;
import
com.mall4j.cloud.api.multishop.feign.ShopDetailFeignClient
;
import
com.mall4j.cloud.common.response.ServerResponseEntity
;
import
com.mall4j.cloud.multishop.model.ShopDetail
;
import
com.mall4j.cloud.multishop.service.ShopDetailService
;
import
com.mall4j.cloud.api.multishop.vo.ShopDetailVO
;
import
com.mall4j.cloud.common.util.BeanUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.Objects
;
/**
* @author FrozenWatermelon
* @date 2020/11/23
*/
@RestController
public
class
ShopDetailFeignController
implements
ShopDetailFeignClient
{
@Autowired
private
ShopDetailService
shopDetailService
;
@Override
public
ServerResponseEntity
<
String
>
getShopNameByShopId
(
Long
shopId
)
{
ShopDetailVO
shopDetail
=
shopDetailService
.
getByShopId
(
shopId
);
if
(
Objects
.
isNull
(
shopDetail
))
{
return
ServerResponseEntity
.
success
(
""
);
}
return
ServerResponseEntity
.
success
(
shopDetail
.
getShopName
());
}
@Override
public
ServerResponseEntity
<
EsShopDetailBO
>
getShopByShopId
(
Long
shopId
)
{
ShopDetailVO
shopDetail
=
shopDetailService
.
getByShopId
(
shopId
);
if
(
Objects
.
isNull
(
shopDetail
))
{
return
ServerResponseEntity
.
success
(
new
EsShopDetailBO
());
}
return
ServerResponseEntity
.
success
(
BeanUtil
.
map
(
shopDetail
,
EsShopDetailBO
.
class
));
}
@Override
public
ServerResponseEntity
<
List
<
ShopDetailVO
>>
listByShopIds
(
List
<
Long
>
shopIds
)
{
List
<
ShopDetail
>
shopDetail
=
shopDetailService
.
listByShopIds
(
shopIds
);
return
ServerResponseEntity
.
success
(
BeanUtil
.
mapAsList
(
shopDetail
,
ShopDetailVO
.
class
));
}
@Override
public
ServerResponseEntity
<
EsShopDetailBO
>
shopExtensionData
(
Long
shopId
)
{
return
ServerResponseEntity
.
success
(
shopDetailService
.
shopExtensionData
(
shopId
));
}
@Override
public
ServerResponseEntity
<
List
<
ShopDetailVO
>>
getShopDetailByShopIdAndShopName
(
List
<
Long
>
shopIds
,
String
shopName
)
{
return
ServerResponseEntity
.
success
(
shopDetailService
.
getShopDetailByShopIdAndShopName
(
shopIds
,
shopName
));
}
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/mapper/HotSearchMapper.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.mapper
;
import
com.mall4j.cloud.multishop.dto.HotSearchDTO
;
import
com.mall4j.cloud.multishop.model.HotSearch
;
import
com.mall4j.cloud.multishop.vo.HotSearchVO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 热搜
*
* @author YXF
* @date 2021-01-27 09:10:00
*/
public
interface
HotSearchMapper
{
/**
* 获取热搜列表
*
* @param hotSearchDTO 搜索参数
* @return 热搜列表
*/
List
<
HotSearchVO
>
list
(
@Param
(
"hotSearchDTO"
)
HotSearchDTO
hotSearchDTO
);
/**
* 根据热搜id获取热搜
*
* @param hotSearchId 热搜id
* @return 热搜
*/
HotSearchVO
getByHotSearchId
(
@Param
(
"hotSearchId"
)
Long
hotSearchId
);
/**
* 保存热搜
*
* @param hotSearch 热搜
*/
void
save
(
@Param
(
"hotSearch"
)
HotSearch
hotSearch
);
/**
* 更新热搜
*
* @param hotSearch 热搜
*/
void
update
(
@Param
(
"hotSearch"
)
HotSearch
hotSearch
);
/**
* 根据热搜id删除热搜
*
* @param hotSearchId
* @param shopId
*/
void
deleteById
(
@Param
(
"hotSearchId"
)
Long
hotSearchId
,
@Param
(
"shopId"
)
Long
shopId
);
/**
* 根据店铺id获取热搜列表
*
* @param shopId
* @return
*/
List
<
HotSearchVO
>
listByShopId
(
@Param
(
"shopId"
)
Long
shopId
);
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/mapper/IndexImgMapper.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.mapper
;
import
com.mall4j.cloud.multishop.dto.IndexImgDTO
;
import
com.mall4j.cloud.multishop.model.IndexImg
;
import
com.mall4j.cloud.multishop.vo.IndexImgVO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 轮播图
*
* @author YXF
* @date 2020-11-24 16:38:32
*/
public
interface
IndexImgMapper
{
/**
* 获取轮播图列表
* @param indexImgDTO
* @return 轮播图列表
*/
List
<
IndexImgVO
>
list
(
@Param
(
"indexImg"
)
IndexImgDTO
indexImgDTO
);
/**
* 根据轮播图id获取轮播图
* @param imgId 轮播图id
* @return 轮播图
*/
IndexImgVO
getByImgId
(
@Param
(
"imgId"
)
Long
imgId
);
/**
* 保存轮播图
* @param indexImg 轮播图
*/
void
save
(
@Param
(
"indexImg"
)
IndexImg
indexImg
);
/**
* 更新轮播图
* @param indexImg 轮播图
*/
void
update
(
@Param
(
"indexImg"
)
IndexImg
indexImg
);
/**
* 根据轮播图id删除轮播图
* @param imgId 轮播图id
* @param shopId 店铺id
*/
void
deleteByIdAndShopId
(
@Param
(
"imgId"
)
Long
imgId
,
@Param
(
"shopId"
)
Long
shopId
);
/**
* 根据店铺id,获取轮播图列表
* @param shopId
* @return
*/
List
<
IndexImgVO
>
getListByShopId
(
@Param
(
"shopId"
)
Long
shopId
);
/**
* 根据spuId清除轮播图的spuId
* @param spuId
*/
void
clearSpuIdBySpuId
(
Long
spuId
);
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/mapper/ShopDetailMapper.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.mapper
;
import
com.mall4j.cloud.api.multishop.bo.EsShopDetailBO
;
import
com.mall4j.cloud.multishop.dto.ShopDetailDTO
;
import
com.mall4j.cloud.multishop.model.ShopDetail
;
import
com.mall4j.cloud.api.multishop.vo.ShopDetailVO
;
import
com.mall4j.cloud.multishop.vo.ShopDetailAppVO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 店铺详情
*
* @author FrozenWatermelon
* @date 2020-12-05 15:50:25
*/
public
interface
ShopDetailMapper
{
/**
* 获取店铺详情列表
*
* @param shopDetailDTO 店铺搜索数据
* @return 店铺详情列表
*/
List
<
ShopDetailVO
>
list
(
@Param
(
"shopDetail"
)
ShopDetailDTO
shopDetailDTO
);
/**
* 根据店铺详情id获取店铺详情
*
* @param shopId 店铺详情id
* @return 店铺详情
*/
ShopDetailVO
getByShopId
(
@Param
(
"shopId"
)
Long
shopId
);
/**
* 保存店铺详情
*
* @param shopDetail 店铺详情
*/
void
save
(
@Param
(
"shopDetail"
)
ShopDetail
shopDetail
);
/**
* 更新店铺详情
*
* @param shopDetail 店铺详情
*/
void
update
(
@Param
(
"shopDetail"
)
ShopDetail
shopDetail
);
/**
* 根据店铺详情id删除店铺详情
*
* @param shopId
*/
void
deleteById
(
@Param
(
"shopId"
)
Long
shopId
);
/**
* 根据店铺id列表,获取店铺信息
* @param shopIds 店铺id列表
* @return 店铺列表
*/
List
<
ShopDetail
>
listByShopIds
(
@Param
(
"shopIds"
)
List
<
Long
>
shopIds
);
/**
* 店铺搜索列表
*
* @param shopDetailDTO
* @return
*/
List
<
ShopDetailAppVO
>
shopSearchList
(
@Param
(
"shopDetail"
)
ShopDetailDTO
shopDetailDTO
);
/**
* 统计该店铺名被其他用户使用的数量
*
* @param shopName
* @param shopId
* @return
*/
int
countShopName
(
@Param
(
"shopName"
)
String
shopName
,
@Param
(
"shopId"
)
Long
shopId
);
/**
* 改变店铺状态
*
* @param shopId
* @param shopStatus
*/
void
changeSpuStatus
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"shopStatus"
)
Integer
shopStatus
);
/**
* 获取店铺信息及扩展信息
*
* @param shopId
* @return
*/
EsShopDetailBO
shopExtensionData
(
@Param
(
"shopId"
)
Long
shopId
);
/**
* 获取店铺信息及扩展信息
* @param shopIds 店铺ids
* @param shopName 店铺名称
* @return 店铺信息列表
*/
List
<
ShopDetailVO
>
getShopDetailByShopIdAndShopName
(
@Param
(
"shopIds"
)
List
<
Long
>
shopIds
,
@Param
(
"shopName"
)
String
shopName
);
/**
* 根据店铺id获取店铺扩展信息
* @param shopId 店铺id
* @return 店铺扩展信息
*/
ShopDetailVO
getShoExtensionsByShopId
(
Long
shopId
);
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/mapper/ShopUserMapper.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.mapper
;
import
com.mall4j.cloud.multishop.model.ShopUser
;
import
com.mall4j.cloud.multishop.vo.ShopUserVO
;
import
com.mall4j.cloud.multishop.vo.ShopUserSimpleVO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author FrozenWatermelon
* @date 2020/09/03
*/
public
interface
ShopUserMapper
{
/**
* 根据用户id获取当前登陆的商家用户信息
*
* @param userId 用户id
* @return 商家用户信息
*/
ShopUserSimpleVO
getSimpleByUserId
(
@Param
(
"userId"
)
Long
userId
);
/**
* 获取店铺用户列表
*
* @param shopId 店铺id
* @param nickName 昵称
* @return 店铺用户列表
*/
List
<
ShopUserVO
>
listByShopId
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"nickName"
)
String
nickName
);
/**
* 根据用户id获取商家用户信息
*
* @param userId 用户id
* @return 商家用户信息
*/
ShopUserVO
getByUserId
(
@Param
(
"userId"
)
Long
userId
);
/**
* 保存商家用户信息
*
* @param shopUser
*/
void
save
(
@Param
(
"shopUser"
)
ShopUser
shopUser
);
/**
* 更新店铺用户信息
*
* @param shopUser
*/
void
update
(
@Param
(
"shopUser"
)
ShopUser
shopUser
);
/**
* 根据店铺用户id删除店铺用户
*
* @param shopUserId
*/
void
deleteById
(
@Param
(
"shopUserId"
)
Long
shopUserId
);
/**
* 获取店主账号的用户id-第一个创建的账号(仅用于审核店铺)
*
* @param shopId
* @return
*/
Long
getUserIdByShopId
(
@Param
(
"shopId"
)
Long
shopId
);
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/model/HotSearch.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.model
;
import
java.io.Serializable
;
import
com.mall4j.cloud.common.model.BaseModel
;
/**
* 热搜
*
* @author YXF
* @date 2021-01-27 09:10:00
*/
public
class
HotSearch
extends
BaseModel
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键
*/
private
Long
hotSearchId
;
/**
* 店铺ID 0为全局热搜
*/
private
Long
shopId
;
/**
* 内容
*/
private
String
content
;
/**
* 顺序
*/
private
Integer
seq
;
/**
* 状态 0下线 1上线
*/
private
Integer
status
;
/**
* 热搜标题
*/
private
String
title
;
public
Long
getHotSearchId
()
{
return
hotSearchId
;
}
public
void
setHotSearchId
(
Long
hotSearchId
)
{
this
.
hotSearchId
=
hotSearchId
;
}
public
Long
getShopId
()
{
return
shopId
;
}
public
void
setShopId
(
Long
shopId
)
{
this
.
shopId
=
shopId
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
Integer
getSeq
()
{
return
seq
;
}
public
void
setSeq
(
Integer
seq
)
{
this
.
seq
=
seq
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
@Override
public
String
toString
()
{
return
"HotSearch{"
+
"hotSearchId="
+
hotSearchId
+
", shopId="
+
shopId
+
", content='"
+
content
+
'\''
+
", seq="
+
seq
+
", status="
+
status
+
", title='"
+
title
+
'\''
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
'}'
;
}
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/model/IndexImg.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.model
;
import
java.io.Serializable
;
import
com.mall4j.cloud.common.model.BaseModel
;
/**
* 轮播图
*
* @author YXF
* @date 2020-11-24 16:38:32
*/
public
class
IndexImg
extends
BaseModel
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键
*/
private
Long
imgId
;
/**
* 店铺ID
*/
private
Long
shopId
;
/**
* 图片
*/
private
String
imgUrl
;
/**
* 状态
*/
private
Integer
status
;
/**
* 顺序
*/
private
Integer
seq
;
/**
* 关联商品id
*/
private
Long
spuId
;
/**
* 图片类型 0:小程序 1:pc
*/
private
Integer
imgType
;
public
Long
getImgId
()
{
return
imgId
;
}
public
void
setImgId
(
Long
imgId
)
{
this
.
imgId
=
imgId
;
}
public
Long
getShopId
()
{
return
shopId
;
}
public
void
setShopId
(
Long
shopId
)
{
this
.
shopId
=
shopId
;
}
public
String
getImgUrl
()
{
return
imgUrl
;
}
public
void
setImgUrl
(
String
imgUrl
)
{
this
.
imgUrl
=
imgUrl
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Integer
getSeq
()
{
return
seq
;
}
public
void
setSeq
(
Integer
seq
)
{
this
.
seq
=
seq
;
}
public
Long
getSpuId
()
{
return
spuId
;
}
public
void
setSpuId
(
Long
spuId
)
{
this
.
spuId
=
spuId
;
}
public
Integer
getImgType
()
{
return
imgType
;
}
public
void
setImgType
(
Integer
imgType
)
{
this
.
imgType
=
imgType
;
}
@Override
public
String
toString
()
{
return
"IndexImg{"
+
"imgId="
+
imgId
+
",shopId="
+
shopId
+
",imgUrl="
+
imgUrl
+
",status="
+
status
+
",seq="
+
seq
+
",spuId="
+
spuId
+
",imgType="
+
imgType
+
",createTime="
+
createTime
+
",updateTime="
+
updateTime
+
'}'
;
}
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/model/ShopDetail.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.model
;
import
java.io.Serializable
;
import
com.mall4j.cloud.common.model.BaseModel
;
/**
* 店铺详情
*
* @author FrozenWatermelon
* @date 2020-12-05 15:50:25
*/
public
class
ShopDetail
extends
BaseModel
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 店铺id
*/
private
Long
shopId
;
/**
* 店铺类型1自营店 2普通店
*/
private
Integer
type
;
/**
* 店铺名称
*/
private
String
shopName
;
/**
* 店铺简介
*/
private
String
intro
;
/**
* 店铺logo(可修改)
*/
private
String
shopLogo
;
/**
* 店铺状态(-1:已删除 0: 停业中 1:营业中)
*/
private
Integer
shopStatus
;
/**
* 营业执照
*/
private
String
businessLicense
;
/**
* 身份证正面
*/
private
String
identityCardFront
;
/**
* 身份证反面
*/
private
String
identityCardLater
;
/**
* 移动端背景图
*/
private
String
mobileBackgroundPic
;
/**
* pc背景图
*/
private
String
pcBackgroundPic
;
public
String
getMobileBackgroundPic
()
{
return
mobileBackgroundPic
;
}
public
void
setMobileBackgroundPic
(
String
mobileBackgroundPic
)
{
this
.
mobileBackgroundPic
=
mobileBackgroundPic
;
}
public
String
getPcBackgroundPic
()
{
return
pcBackgroundPic
;
}
public
void
setPcBackgroundPic
(
String
pcBackgroundPic
)
{
this
.
pcBackgroundPic
=
pcBackgroundPic
;
}
public
Long
getShopId
()
{
return
shopId
;
}
public
void
setShopId
(
Long
shopId
)
{
this
.
shopId
=
shopId
;
}
public
Integer
getType
()
{
return
type
;
}
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
}
public
String
getShopName
()
{
return
shopName
;
}
public
void
setShopName
(
String
shopName
)
{
this
.
shopName
=
shopName
;
}
public
String
getIntro
()
{
return
intro
;
}
public
void
setIntro
(
String
intro
)
{
this
.
intro
=
intro
;
}
public
String
getShopLogo
()
{
return
shopLogo
;
}
public
void
setShopLogo
(
String
shopLogo
)
{
this
.
shopLogo
=
shopLogo
;
}
public
Integer
getShopStatus
()
{
return
shopStatus
;
}
public
void
setShopStatus
(
Integer
shopStatus
)
{
this
.
shopStatus
=
shopStatus
;
}
public
String
getBusinessLicense
()
{
return
businessLicense
;
}
public
void
setBusinessLicense
(
String
businessLicense
)
{
this
.
businessLicense
=
businessLicense
;
}
public
String
getIdentityCardFront
()
{
return
identityCardFront
;
}
public
void
setIdentityCardFront
(
String
identityCardFront
)
{
this
.
identityCardFront
=
identityCardFront
;
}
public
String
getIdentityCardLater
()
{
return
identityCardLater
;
}
public
void
setIdentityCardLater
(
String
identityCardLater
)
{
this
.
identityCardLater
=
identityCardLater
;
}
@Override
public
String
toString
()
{
return
"ShopDetail{"
+
"shopId="
+
shopId
+
", type="
+
type
+
", shopName='"
+
shopName
+
'\''
+
", intro='"
+
intro
+
'\''
+
", shopLogo='"
+
shopLogo
+
'\''
+
", shopStatus="
+
shopStatus
+
", businessLicense='"
+
businessLicense
+
'\''
+
", identityCardFront='"
+
identityCardFront
+
'\''
+
", identityCardLater='"
+
identityCardLater
+
'\''
+
", mobileBackgroundPic='"
+
mobileBackgroundPic
+
'\''
+
", pcBackgroundPic='"
+
pcBackgroundPic
+
'\''
+
'}'
;
}
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/model/ShopUser.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.model
;
import
java.io.Serializable
;
import
com.mall4j.cloud.common.database.annotations.DistributedId
;
import
com.mall4j.cloud.common.model.BaseModel
;
/**
* 商家用户
*
* @author FrozenWatermelon
* @date 2020-12-05 15:50:25
*/
public
class
ShopUser
extends
BaseModel
implements
Serializable
{
/**
* 商家用户id
*/
@DistributedId
(
"mall4cloud-multishop-user"
)
private
Long
shopUserId
;
/**
* 关联店铺id
*/
private
Long
shopId
;
/**
* 昵称
*/
private
String
nickName
;
/**
* 员工编号
*/
private
String
code
;
/**
* 联系方式
*/
private
String
phoneNum
;
/**
* 是否已经设置账号
*/
private
Integer
hasAccount
;
public
Long
getShopUserId
()
{
return
shopUserId
;
}
public
void
setShopUserId
(
Long
shopUserId
)
{
this
.
shopUserId
=
shopUserId
;
}
public
Long
getShopId
()
{
return
shopId
;
}
public
void
setShopId
(
Long
shopId
)
{
this
.
shopId
=
shopId
;
}
public
String
getNickName
()
{
return
nickName
;
}
public
void
setNickName
(
String
nickName
)
{
this
.
nickName
=
nickName
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getPhoneNum
()
{
return
phoneNum
;
}
public
void
setPhoneNum
(
String
phoneNum
)
{
this
.
phoneNum
=
phoneNum
;
}
public
Integer
getHasAccount
()
{
return
hasAccount
;
}
public
void
setHasAccount
(
Integer
hasAccount
)
{
this
.
hasAccount
=
hasAccount
;
}
@Override
public
String
toString
()
{
return
"ShopUser{"
+
"shopUserId="
+
shopUserId
+
",createTime="
+
createTime
+
",updateTime="
+
updateTime
+
",shopId="
+
shopId
+
",nickName="
+
nickName
+
",code="
+
code
+
",phoneNum="
+
phoneNum
+
",hasAccount="
+
hasAccount
+
'}'
;
}
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/HotSearchService.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.service
;
import
com.mall4j.cloud.common.database.dto.PageDTO
;
import
com.mall4j.cloud.common.database.vo.PageVO
;
import
com.mall4j.cloud.multishop.dto.HotSearchDTO
;
import
com.mall4j.cloud.multishop.model.HotSearch
;
import
com.mall4j.cloud.multishop.vo.HotSearchVO
;
import
java.util.List
;
/**
* 热搜
*
* @author YXF
* @date 2021-01-27 09:10:00
*/
public
interface
HotSearchService
{
/**
* 分页获取热搜列表
* @param pageDTO 分页参数
* @param hotSearchDTO 搜索参数
* @return 热搜列表分页数据
*/
PageVO
<
HotSearchVO
>
page
(
PageDTO
pageDTO
,
HotSearchDTO
hotSearchDTO
);
/**
* 根据热搜id获取热搜
*
* @param hotSearchId 热搜id
* @return 热搜
*/
HotSearchVO
getByHotSearchId
(
Long
hotSearchId
);
/**
* 保存热搜
* @param hotSearch 热搜
*/
void
save
(
HotSearch
hotSearch
);
/**
* 更新热搜
* @param hotSearch 热搜
*/
void
update
(
HotSearch
hotSearch
);
/**
* 根据热搜id删除热搜
* @param hotSearchId 热搜id
* @param shopId 店铺id
*/
void
deleteById
(
Long
hotSearchId
,
Long
shopId
);
/**
* 获取热搜列表
* @param shopId
* @return
*/
List
<
HotSearchVO
>
listByShopId
(
Long
shopId
);
/**
* 清除热搜列表缓存
* @param shopId
*/
void
removeHotSearchListCache
(
Long
shopId
);
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/IndexImgService.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.service
;
import
com.mall4j.cloud.common.database.dto.PageDTO
;
import
com.mall4j.cloud.common.database.vo.PageVO
;
import
com.mall4j.cloud.multishop.dto.IndexImgDTO
;
import
com.mall4j.cloud.multishop.model.IndexImg
;
import
com.mall4j.cloud.multishop.vo.IndexImgVO
;
import
java.util.List
;
/**
* 轮播图
*
* @author YXF
* @date 2020-11-24 16:38:32
*/
public
interface
IndexImgService
{
/**
* 分页获取轮播图列表
* @param pageDTO 分页参数
* @param indexImgDTO
* @return 轮播图列表分页数据
*/
PageVO
<
IndexImgVO
>
page
(
PageDTO
pageDTO
,
IndexImgDTO
indexImgDTO
);
/**
* 根据轮播图id获取轮播图
* @param imgId 轮播图id
* @return 轮播图
*/
IndexImgVO
getByImgId
(
Long
imgId
);
/**
* 保存轮播图
* @param indexImg 轮播图
*/
void
save
(
IndexImg
indexImg
);
/**
* 更新轮播图
* @param indexImg 轮播图
*/
void
update
(
IndexImg
indexImg
);
/**
* 根据轮播图id删除轮播图
* @param imgId
* @param shopId
*/
void
deleteById
(
Long
imgId
,
Long
shopId
);
/**
* 根据店铺id,获取轮播图列表
* @param shopId
* @return
*/
List
<
IndexImgVO
>
getListByShopId
(
Long
shopId
);
/**
* 根据商品d删除轮播图信息
* @param spuId
* @param shopId
*/
void
deleteBySpuId
(
Long
spuId
,
Long
shopId
);
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/ShopDetailService.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.service
;
import
com.mall4j.cloud.api.multishop.bo.EsShopDetailBO
;
import
com.mall4j.cloud.common.database.dto.PageDTO
;
import
com.mall4j.cloud.common.database.vo.PageVO
;
import
com.mall4j.cloud.multishop.dto.ShopDetailDTO
;
import
com.mall4j.cloud.multishop.model.ShopDetail
;
import
com.mall4j.cloud.api.multishop.vo.ShopDetailVO
;
import
com.mall4j.cloud.multishop.vo.ShopDetailAppVO
;
import
java.util.List
;
/**
* 店铺详情
*
* @author FrozenWatermelon
* @date 2020-12-05 15:50:25
*/
public
interface
ShopDetailService
{
/**
* 分页获取店铺详情列表
*
* @param pageDTO 分页参数
* @param shopDetailDTO 店铺搜索数据
* @return 店铺详情列表分页数据
*/
PageVO
<
ShopDetailVO
>
page
(
PageDTO
pageDTO
,
ShopDetailDTO
shopDetailDTO
);
/**
* 根据店铺详情id获取店铺详情
*
* @param shopId 店铺详情id
* @return 店铺详情
*/
ShopDetailVO
getByShopId
(
Long
shopId
);
/**
* 保存店铺详情
* @param shopDetail 店铺详情
*/
void
save
(
ShopDetail
shopDetail
);
/**
* 更新店铺详情
* @param shopDetail 店铺详情
*/
void
update
(
ShopDetail
shopDetail
);
/**
* 根据店铺详情id删除店铺详情
* @param shopId
*/
void
deleteById
(
Long
shopId
);
/**
* 获取店铺列表信息
* @param shopIds
* @return
*/
List
<
ShopDetail
>
listByShopIds
(
List
<
Long
>
shopIds
);
/**
* 申请开店
*
* @param shopDetailDTO 申请开店信息
*/
void
applyShop
(
ShopDetailDTO
shopDetailDTO
);
/**
* 店铺搜索分页
*
* @param pageDTO 分页参数
* @param shopDetailDTO 店铺信息
* @return 店铺信息列表
*/
PageVO
<
ShopDetailAppVO
>
shopSearchPage
(
PageDTO
pageDTO
,
ShopDetailDTO
shopDetailDTO
);
/**
* 改变店铺状态
*
* @param shopId
* @param shopStatus
*/
void
changeSpuStatus
(
Long
shopId
,
Integer
shopStatus
);
/**
* 删除店铺缓存
*
* @param shopId
*/
void
removeCacheByShopId
(
Long
shopId
);
/**
* 获取店铺信息及扩展信息
*
* @param shopId
* @return
*/
EsShopDetailBO
shopExtensionData
(
Long
shopId
);
/**
* 创建店铺
*
* @param shopDetailDTO
*/
void
createShop
(
ShopDetailDTO
shopDetailDTO
);
/**
* 获取店铺信息及扩展信息
* @param shopIds 店铺ids
* @param shopName 店铺名称
* @return 店铺信息列表
*/
List
<
ShopDetailVO
>
getShopDetailByShopIdAndShopName
(
List
<
Long
>
shopIds
,
String
shopName
);
/**
* 验证店铺名称是否重名
* @param shopName
* @return
*/
Boolean
checkShopName
(
String
shopName
);
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/ShopUserAccountService.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.service
;
import
com.mall4j.cloud.api.auth.vo.AuthAccountVO
;
import
com.mall4j.cloud.common.response.ServerResponseEntity
;
import
com.mall4j.cloud.multishop.dto.ChangeAccountDTO
;
/**
* @author FrozenWatermelon
* @date 2020/09/03
*/
public
interface
ShopUserAccountService
{
/**
* 添加账户
* @param changeAccountDTO 账户信息
* @return void
*/
ServerResponseEntity
<
Void
>
save
(
ChangeAccountDTO
changeAccountDTO
);
/**
* 更新账户
* @param changeAccountDTO 账户信息
* @return
*/
ServerResponseEntity
<
Void
>
update
(
ChangeAccountDTO
changeAccountDTO
);
/**
* 根据用户id和系统类型获取用户信息
* @param userId 用户id
* @param sysType 系统类型
* @return void
*/
ServerResponseEntity
<
AuthAccountVO
>
getByUserIdAndSysType
(
Long
userId
,
Integer
sysType
);
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/ShopUserService.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.service
;
import
com.mall4j.cloud.common.database.dto.PageDTO
;
import
com.mall4j.cloud.common.database.vo.PageVO
;
import
com.mall4j.cloud.multishop.model.ShopUser
;
import
com.mall4j.cloud.multishop.vo.ShopUserVO
;
import
java.util.List
;
/**
* @author FrozenWatermelon
* @date 2020/09/03
*/
public
interface
ShopUserService
{
/**
* 分页获取店铺用户列表
* @param pageDTO 分页参数
* @param shopId 店铺id
* @param nickName 昵称
* @return 店铺用户列表
*/
PageVO
<
ShopUserVO
>
pageByShopId
(
PageDTO
pageDTO
,
Long
shopId
,
String
nickName
);
/**
* 根据用户id获取商家用户信息
*
* @param userId 用户id
* @return 商家用户信息
*/
ShopUserVO
getByUserId
(
Long
userId
);
/**
* 保存店铺用户信息
* @param shopUser 店铺用户id
* @param roleIds 角色id列表
*/
void
save
(
ShopUser
shopUser
,
List
<
Long
>
roleIds
);
/**
* 更新店铺用户信息
* @param shopUser 店铺用户id
* @param roleIds 角色id列表
*/
void
update
(
ShopUser
shopUser
,
List
<
Long
>
roleIds
);
/**
* 根据店铺用户id删除店铺用户信息
* @param shopUserId 店铺用户id
*/
void
deleteById
(
Long
shopUserId
);
/**
* 获取店主账号的用户id-第一个创建的账号(仅用于审核店铺)
* @param shopId
* @return
*/
Long
getUserIdByShopId
(
Long
shopId
);
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/impl/HotSearchServiceImpl.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.service.impl
;
import
com.mall4j.cloud.common.cache.constant.CacheNames
;
import
com.mall4j.cloud.common.database.dto.PageDTO
;
import
com.mall4j.cloud.common.database.util.PageUtil
;
import
com.mall4j.cloud.common.database.vo.PageVO
;
import
com.mall4j.cloud.multishop.dto.HotSearchDTO
;
import
com.mall4j.cloud.multishop.model.HotSearch
;
import
com.mall4j.cloud.multishop.mapper.HotSearchMapper
;
import
com.mall4j.cloud.multishop.service.HotSearchService
;
import
com.mall4j.cloud.multishop.vo.HotSearchVO
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
/**
* 热搜
*
* @author YXF
* @date 2021-01-27 09:10:00
*/
@Service
public
class
HotSearchServiceImpl
implements
HotSearchService
{
@Autowired
private
HotSearchMapper
hotSearchMapper
;
@Override
public
PageVO
<
HotSearchVO
>
page
(
PageDTO
pageDTO
,
HotSearchDTO
hotSearchDTO
)
{
return
PageUtil
.
doPage
(
pageDTO
,
()
->
hotSearchMapper
.
list
(
hotSearchDTO
));
}
@Override
public
HotSearchVO
getByHotSearchId
(
Long
hotSearchId
)
{
return
hotSearchMapper
.
getByHotSearchId
(
hotSearchId
);
}
@Override
public
void
save
(
HotSearch
hotSearch
)
{
hotSearchMapper
.
save
(
hotSearch
);
}
@Override
public
void
update
(
HotSearch
hotSearch
)
{
hotSearchMapper
.
update
(
hotSearch
);
}
@Override
public
void
deleteById
(
Long
hotSearchId
,
Long
shopId
)
{
hotSearchMapper
.
deleteById
(
hotSearchId
,
shopId
);
}
@Override
@Cacheable
(
cacheNames
=
CacheNames
.
HOT_SEARCH_LIST_KEY
,
key
=
"#shopId"
)
public
List
<
HotSearchVO
>
listByShopId
(
Long
shopId
)
{
return
hotSearchMapper
.
listByShopId
(
shopId
);
}
@Override
@CacheEvict
(
cacheNames
=
CacheNames
.
HOT_SEARCH_LIST_KEY
,
key
=
"#shopId"
)
public
void
removeHotSearchListCache
(
Long
shopId
)
{
}
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/impl/IndexImgServiceImpl.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.service.impl
;
import
com.mall4j.cloud.common.cache.constant.CacheNames
;
import
com.mall4j.cloud.common.database.dto.PageDTO
;
import
com.mall4j.cloud.common.database.util.PageUtil
;
import
com.mall4j.cloud.common.database.vo.PageVO
;
import
com.mall4j.cloud.multishop.dto.IndexImgDTO
;
import
com.mall4j.cloud.multishop.model.IndexImg
;
import
com.mall4j.cloud.multishop.mapper.IndexImgMapper
;
import
com.mall4j.cloud.multishop.service.IndexImgService
;
import
com.mall4j.cloud.multishop.vo.IndexImgVO
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Caching
;
import
org.springframework.stereotype.Service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
/**
* 轮播图
*
* @author YXF
* @date 2020-11-24 16:38:32
*/
@Service
public
class
IndexImgServiceImpl
implements
IndexImgService
{
@Autowired
private
IndexImgMapper
indexImgMapper
;
@Override
public
PageVO
<
IndexImgVO
>
page
(
PageDTO
pageDTO
,
IndexImgDTO
indexImgDTO
)
{
return
PageUtil
.
doPage
(
pageDTO
,
()
->
indexImgMapper
.
list
(
indexImgDTO
));
}
@Override
public
IndexImgVO
getByImgId
(
Long
imgId
)
{
return
indexImgMapper
.
getByImgId
(
imgId
);
}
@Override
@CacheEvict
(
cacheNames
=
CacheNames
.
INDEX_IMG_KEY
,
key
=
"#indexImg.shopId"
)
public
void
save
(
IndexImg
indexImg
)
{
indexImgMapper
.
save
(
indexImg
);
}
@Override
@CacheEvict
(
cacheNames
=
CacheNames
.
INDEX_IMG_KEY
,
key
=
"#indexImg.shopId"
)
public
void
update
(
IndexImg
indexImg
)
{
indexImgMapper
.
update
(
indexImg
);
}
@Override
@CacheEvict
(
cacheNames
=
CacheNames
.
INDEX_IMG_KEY
,
key
=
"#shopId"
)
public
void
deleteById
(
Long
imgId
,
Long
shopId
)
{
indexImgMapper
.
deleteByIdAndShopId
(
imgId
,
shopId
);
}
@Override
@Cacheable
(
cacheNames
=
CacheNames
.
INDEX_IMG_KEY
,
key
=
"#shopId"
,
sync
=
true
)
public
List
<
IndexImgVO
>
getListByShopId
(
Long
shopId
)
{
List
<
IndexImgVO
>
listByShopId
=
indexImgMapper
.
getListByShopId
(
shopId
);
return
listByShopId
;
}
@Override
@Caching
(
evict
=
{
@CacheEvict
(
cacheNames
=
CacheNames
.
INDEX_IMG_KEY
,
key
=
"#shopId"
),
@CacheEvict
(
cacheNames
=
CacheNames
.
INDEX_IMG_KEY
,
key
=
"0"
)
})
public
void
deleteBySpuId
(
Long
spuId
,
Long
shopId
)
{
indexImgMapper
.
clearSpuIdBySpuId
(
spuId
);
}
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/impl/ShopDetailServiceImpl.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.service.impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.mall4j.cloud.api.auth.bo.UserInfoInTokenBO
;
import
com.mall4j.cloud.api.auth.constant.SysTypeEnum
;
import
com.mall4j.cloud.api.auth.dto.AuthAccountDTO
;
import
com.mall4j.cloud.api.auth.feign.AccountFeignClient
;
import
com.mall4j.cloud.api.auth.vo.AuthAccountVO
;
import
com.mall4j.cloud.api.feign.SearchSpuFeignClient
;
import
com.mall4j.cloud.api.multishop.bo.EsShopDetailBO
;
import
com.mall4j.cloud.api.vo.search.SpuSearchVO
;
import
com.mall4j.cloud.common.cache.constant.CacheNames
;
import
com.mall4j.cloud.common.constant.Constant
;
import
com.mall4j.cloud.common.constant.UserAdminType
;
import
com.mall4j.cloud.common.constant.StatusEnum
;
import
com.mall4j.cloud.common.database.dto.PageDTO
;
import
com.mall4j.cloud.common.database.util.PageUtil
;
import
com.mall4j.cloud.common.database.vo.PageVO
;
import
com.mall4j.cloud.common.exception.Mall4cloudException
;
import
com.mall4j.cloud.common.response.ResponseEnum
;
import
com.mall4j.cloud.common.response.ServerResponseEntity
;
import
com.mall4j.cloud.common.security.AuthUserContext
;
import
com.mall4j.cloud.common.util.IpHelper
;
import
com.mall4j.cloud.common.util.PrincipalUtil
;
import
com.mall4j.cloud.multishop.constant.ShopStatus
;
import
com.mall4j.cloud.multishop.constant.ShopType
;
import
com.mall4j.cloud.multishop.dto.ShopDetailDTO
;
import
com.mall4j.cloud.multishop.mapper.ShopDetailMapper
;
import
com.mall4j.cloud.multishop.model.ShopDetail
;
import
com.mall4j.cloud.multishop.model.ShopUser
;
import
com.mall4j.cloud.multishop.service.ShopDetailService
;
import
com.mall4j.cloud.api.multishop.vo.ShopDetailVO
;
import
com.mall4j.cloud.multishop.service.ShopUserService
;
import
com.mall4j.cloud.multishop.vo.ShopDetailAppVO
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
com.mall4j.cloud.common.util.BeanUtil
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 店铺详情
*
* @author FrozenWatermelon
* @date 2020-11-23 16:24:29
*/
@Service
public
class
ShopDetailServiceImpl
implements
ShopDetailService
{
@Autowired
private
ShopDetailMapper
shopDetailMapper
;
@Autowired
private
SearchSpuFeignClient
searchSpuFeignClient
;
@Autowired
private
ShopUserService
shopUserService
;
@Autowired
private
PasswordEncoder
passwordEncoder
;
@Autowired
private
AccountFeignClient
accountFeignClient
;
@Override
public
PageVO
<
ShopDetailVO
>
page
(
PageDTO
pageDTO
,
ShopDetailDTO
shopDetailDTO
)
{
return
PageUtil
.
doPage
(
pageDTO
,
()
->
shopDetailMapper
.
list
(
shopDetailDTO
));
}
@Override
@Cacheable
(
cacheNames
=
CacheNames
.
SHOP_DETAIL_ID_KEY
,
key
=
"#shopId"
)
public
ShopDetailVO
getByShopId
(
Long
shopId
)
{
ServerResponseEntity
<
AuthAccountVO
>
accountRes
=
accountFeignClient
.
getMerchantInfoByTenantId
(
shopId
);
if
(!
accountRes
.
isSuccess
())
{
throw
new
Mall4cloudException
(
"商家信息获取失败"
);
}
AuthAccountVO
authAccountVO
=
accountRes
.
getData
();
ShopDetailVO
shopDetailVO
=
shopDetailMapper
.
getByShopId
(
shopId
);
if
(
Objects
.
nonNull
(
authAccountVO
))
{
shopDetailVO
.
setUsername
(
authAccountVO
.
getUsername
());
}
return
shopDetailVO
;
}
@Override
public
void
save
(
ShopDetail
shopDetail
)
{
shopDetailMapper
.
save
(
shopDetail
);
}
@Override
@CacheEvict
(
cacheNames
=
CacheNames
.
SHOP_DETAIL_ID_KEY
,
key
=
"#shopDetail.shopId"
)
public
void
update
(
ShopDetail
shopDetail
)
{
shopDetailMapper
.
update
(
shopDetail
);
}
@Override
@CacheEvict
(
cacheNames
=
CacheNames
.
SHOP_DETAIL_ID_KEY
,
key
=
"#shopId"
)
public
void
deleteById
(
Long
shopId
)
{
shopDetailMapper
.
deleteById
(
shopId
);
}
@Override
public
List
<
ShopDetail
>
listByShopIds
(
List
<
Long
>
shopIds
)
{
if
(
CollUtil
.
isEmpty
(
shopIds
))
{
return
new
ArrayList
<>();
}
return
shopDetailMapper
.
listByShopIds
(
shopIds
);
}
@Override
public
PageVO
<
ShopDetailAppVO
>
shopSearchPage
(
PageDTO
pageDTO
,
ShopDetailDTO
shopDetailDTO
)
{
PageVO
<
ShopDetailAppVO
>
page
=
PageUtil
.
doPage
(
pageDTO
,
()
->
shopDetailMapper
.
shopSearchList
(
shopDetailDTO
));
Set
<
Long
>
spuIdSet
=
page
.
getList
().
stream
().
map
(
ShopDetailAppVO:
:
getShopId
).
collect
(
Collectors
.
toSet
());
ServerResponseEntity
<
List
<
SpuSearchVO
>>
spuResponse
=
searchSpuFeignClient
.
limitSizeListByShopIds
(
new
ArrayList
<>(
spuIdSet
),
Constant
.
SPU_SIZE_FIVE
);
if
(!
Objects
.
equals
(
spuResponse
.
getCode
(),
ResponseEnum
.
OK
.
value
()))
{
throw
new
Mall4cloudException
(
spuResponse
.
getMsg
());
}
else
if
(
CollectionUtil
.
isEmpty
(
spuResponse
.
getData
()))
{
return
page
;
}
List
<
SpuSearchVO
>
data
=
spuResponse
.
getData
();
Map
<
Long
,
List
<
SpuSearchVO
>>
shopMap
=
data
.
stream
().
collect
(
Collectors
.
groupingBy
(
SpuSearchVO:
:
getShopId
));
for
(
ShopDetailAppVO
shopDetail
:
page
.
getList
())
{
shopDetail
.
setSpuList
(
shopMap
.
get
(
shopDetail
.
getShopId
()));
}
return
page
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
public
void
applyShop
(
ShopDetailDTO
shopDetailDTO
)
{
checkShopInfo
(
shopDetailDTO
);
ShopDetail
newShopDetail
=
BeanUtil
.
map
(
shopDetailDTO
,
ShopDetail
.
class
);
// 申请开店
newShopDetail
.
setShopStatus
(
ShopStatus
.
OPEN
.
value
());
newShopDetail
.
setType
(
ShopType
.
STOP
.
value
());
shopDetailMapper
.
save
(
newShopDetail
);
shopDetailDTO
.
setShopId
(
newShopDetail
.
getShopId
());
// 创建账号
createShopAccount
(
shopDetailDTO
,
StatusEnum
.
ENABLE
);
}
@Override
public
void
changeSpuStatus
(
Long
shopId
,
Integer
shopStatus
)
{
shopDetailMapper
.
changeSpuStatus
(
shopId
,
shopStatus
);
}
@Override
@CacheEvict
(
cacheNames
=
CacheNames
.
SHOP_DETAIL_ID_KEY
,
key
=
"#shopId"
)
public
void
removeCacheByShopId
(
Long
shopId
)
{
}
@Override
public
EsShopDetailBO
shopExtensionData
(
Long
shopId
)
{
return
shopDetailMapper
.
shopExtensionData
(
shopId
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
public
void
createShop
(
ShopDetailDTO
shopDetailDTO
)
{
checkShopInfo
(
shopDetailDTO
);
UserInfoInTokenBO
userInfoInTokenBO
=
AuthUserContext
.
get
();
if
(
Objects
.
nonNull
(
userInfoInTokenBO
.
getTenantId
()))
{
throw
new
Mall4cloudException
(
"该用户已经创建过店铺"
);
}
// 保存店铺
ShopDetail
shopDetail
=
BeanUtil
.
map
(
shopDetailDTO
,
ShopDetail
.
class
);
shopDetail
.
setShopStatus
(
ShopStatus
.
OPEN
.
value
());
shopDetailMapper
.
save
(
shopDetail
);
// 保存商家账号
// 保存到shopUser
ShopUser
shopUser
=
new
ShopUser
();
shopUser
.
setShopId
(
shopDetail
.
getShopId
());
shopUser
.
setHasAccount
(
1
);
shopUser
.
setNickName
(
shopDetailDTO
.
getShopName
());
shopUserService
.
save
(
shopUser
,
null
);
// 保存到authAccount
AuthAccountDTO
authAccountDTO
=
new
AuthAccountDTO
();
authAccountDTO
.
setTenantId
(
shopDetail
.
getShopId
());
authAccountDTO
.
setUsername
(
shopDetailDTO
.
getUsername
());
authAccountDTO
.
setPassword
(
shopDetailDTO
.
getPassword
());
authAccountDTO
.
setCreateIp
(
IpHelper
.
getIpAddr
());
authAccountDTO
.
setStatus
(
StatusEnum
.
ENABLE
.
value
());
authAccountDTO
.
setSysType
(
SysTypeEnum
.
MULTISHOP
.
value
());
authAccountDTO
.
setIsAdmin
(
UserAdminType
.
ADMIN
.
value
());
authAccountDTO
.
setUserId
(
shopUser
.
getShopUserId
());
accountFeignClient
.
save
(
authAccountDTO
);
userInfoInTokenBO
.
setTenantId
(
shopDetail
.
getShopId
());
ServerResponseEntity
<
Void
>
updateTenantIdRes
=
accountFeignClient
.
updateUserInfoByUserIdAndSysType
(
userInfoInTokenBO
,
AuthUserContext
.
get
().
getUserId
(),
SysTypeEnum
.
ORDINARY
.
value
());
if
(!
Objects
.
equals
(
updateTenantIdRes
.
getCode
(),
ResponseEnum
.
OK
.
value
()))
{
throw
new
Mall4cloudException
(
updateTenantIdRes
.
getMsg
());
}
}
@Override
public
List
<
ShopDetailVO
>
getShopDetailByShopIdAndShopName
(
List
<
Long
>
shopIds
,
String
shopName
)
{
return
shopDetailMapper
.
getShopDetailByShopIdAndShopName
(
shopIds
,
shopName
);
}
@Override
public
Boolean
checkShopName
(
String
shopName
)
{
int
count
=
shopDetailMapper
.
countShopName
(
shopName
,
null
);
return
count
<=
0
;
}
/**
* 检验店铺信息是否正确
* @param shopDetailDTO
*/
private
void
checkShopInfo
(
ShopDetailDTO
shopDetailDTO
)
{
// 店铺名称
if
(
StrUtil
.
isNotBlank
(
shopDetailDTO
.
getShopName
()))
{
shopDetailDTO
.
setShopName
(
shopDetailDTO
.
getShopName
().
trim
());
}
if
(
shopDetailMapper
.
countShopName
(
shopDetailDTO
.
getShopName
(),
null
)
>
0
)
{
throw
new
Mall4cloudException
(
"店铺名称已存在"
);
}
String
username
=
shopDetailDTO
.
getUsername
();
// 用户名
if
(!
PrincipalUtil
.
isUserName
(
username
))
{
throw
new
Mall4cloudException
(
"用户名格式不正确"
);
}
ServerResponseEntity
<
AuthAccountVO
>
accountResponse
=
accountFeignClient
.
getByUsernameAndSysType
(
username
,
SysTypeEnum
.
MULTISHOP
);
if
(!
Objects
.
equals
(
accountResponse
.
getCode
(),
ResponseEnum
.
OK
.
value
()))
{
throw
new
Mall4cloudException
(
accountResponse
.
getMsg
());
}
AuthAccountVO
authAccountVO
=
accountResponse
.
getData
();
if
(
Objects
.
nonNull
(
authAccountVO
))
{
throw
new
Mall4cloudException
(
"用户账号已存在"
);
}
}
/**
* 创建店铺初始账号
* @param shopDetailDTO
* @param statusEnum
*/
public
void
createShopAccount
(
ShopDetailDTO
shopDetailDTO
,
StatusEnum
statusEnum
)
{
ShopUser
shopUser
=
new
ShopUser
();
shopUser
.
setShopId
(
shopDetailDTO
.
getShopId
());
shopUser
.
setHasAccount
(
1
);
shopUser
.
setNickName
(
shopDetailDTO
.
getUsername
());
shopUserService
.
save
(
shopUser
,
null
);
AuthAccountDTO
authAccountDTO
=
new
AuthAccountDTO
();
authAccountDTO
.
setUsername
(
shopDetailDTO
.
getUsername
());
String
password
=
passwordEncoder
.
encode
(
shopDetailDTO
.
getPassword
().
trim
());
authAccountDTO
.
setPassword
(
password
);
authAccountDTO
.
setStatus
(
statusEnum
.
value
());
authAccountDTO
.
setSysType
(
SysTypeEnum
.
MULTISHOP
.
value
());
authAccountDTO
.
setCreateIp
(
IpHelper
.
getIpAddr
());
authAccountDTO
.
setTenantId
(
shopDetailDTO
.
getShopId
());
authAccountDTO
.
setUserId
(
shopUser
.
getShopUserId
());
authAccountDTO
.
setIsAdmin
(
UserAdminType
.
ADMIN
.
value
());
ServerResponseEntity
<
Long
>
save
=
accountFeignClient
.
save
(
authAccountDTO
);
if
(!
Objects
.
equals
(
save
.
getCode
(),
ResponseEnum
.
OK
.
value
()))
{
throw
new
Mall4cloudException
(
save
.
getMsg
());
}
}
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/impl/ShopUserAccountServiceImpl.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.service.impl
;
import
com.mall4j.cloud.api.auth.dto.AuthAccountDTO
;
import
com.mall4j.cloud.api.auth.bo.UserInfoInTokenBO
;
import
com.mall4j.cloud.api.auth.feign.AccountFeignClient
;
import
com.mall4j.cloud.api.auth.vo.AuthAccountVO
;
import
com.mall4j.cloud.common.response.ServerResponseEntity
;
import
com.mall4j.cloud.common.security.AuthUserContext
;
import
com.mall4j.cloud.common.util.IpHelper
;
import
com.mall4j.cloud.multishop.dto.ChangeAccountDTO
;
import
com.mall4j.cloud.multishop.mapper.ShopUserMapper
;
import
com.mall4j.cloud.multishop.model.ShopUser
;
import
com.mall4j.cloud.multishop.service.ShopUserAccountService
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
jakarta.annotation.Resource
;
/**
* @author FrozenWatermelon
* @date 2020/09/03
*/
@Service
public
class
ShopUserAccountServiceImpl
implements
ShopUserAccountService
{
@Resource
private
ShopUserMapper
shopUserMapper
;
@Autowired
private
AccountFeignClient
accountFeignClient
;
@Override
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ServerResponseEntity
<
Void
>
save
(
ChangeAccountDTO
changeAccountDTO
)
{
AuthAccountDTO
authAccountDTO
=
getAuthAccountDTO
(
changeAccountDTO
);
authAccountDTO
.
setCreateIp
(
IpHelper
.
getIpAddr
());
authAccountDTO
.
setIsAdmin
(
0
);
// 保存
ServerResponseEntity
<
Long
>
serverResponseEntity
=
accountFeignClient
.
save
(
authAccountDTO
);
if
(!
serverResponseEntity
.
isSuccess
())
{
return
ServerResponseEntity
.
transform
(
serverResponseEntity
);
}
ShopUser
shopUser
=
new
ShopUser
();
shopUser
.
setShopUserId
(
changeAccountDTO
.
getUserId
());
shopUser
.
setHasAccount
(
1
);
shopUser
.
setShopId
(
AuthUserContext
.
get
().
getTenantId
());
shopUserMapper
.
update
(
shopUser
);
return
ServerResponseEntity
.
success
();
}
@Override
public
ServerResponseEntity
<
Void
>
update
(
ChangeAccountDTO
changeAccountDTO
)
{
AuthAccountDTO
authAccountDTO
=
getAuthAccountDTO
(
changeAccountDTO
);
// 更新,不涉及分布式事务
ServerResponseEntity
<
Void
>
serverResponseEntity
=
accountFeignClient
.
update
(
authAccountDTO
);
if
(!
serverResponseEntity
.
isSuccess
())
{
return
serverResponseEntity
;
}
return
ServerResponseEntity
.
success
();
}
@Override
public
ServerResponseEntity
<
AuthAccountVO
>
getByUserIdAndSysType
(
Long
userId
,
Integer
sysType
)
{
return
accountFeignClient
.
getByUserIdAndSysType
(
userId
,
sysType
);
}
private
AuthAccountDTO
getAuthAccountDTO
(
ChangeAccountDTO
changeAccountDTO
)
{
AuthAccountDTO
authAccountDTO
=
new
AuthAccountDTO
();
UserInfoInTokenBO
userInfoInTokenBO
=
AuthUserContext
.
get
();
authAccountDTO
.
setPassword
(
changeAccountDTO
.
getPassword
());
authAccountDTO
.
setUsername
(
changeAccountDTO
.
getUsername
());
authAccountDTO
.
setStatus
(
changeAccountDTO
.
getStatus
());
authAccountDTO
.
setSysType
(
userInfoInTokenBO
.
getSysType
());
authAccountDTO
.
setTenantId
(
userInfoInTokenBO
.
getTenantId
());
authAccountDTO
.
setUserId
(
changeAccountDTO
.
getUserId
());
return
authAccountDTO
;
}
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/service/impl/ShopUserServiceImpl.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.service.impl
;
import
cn.hutool.core.collection.CollUtil
;
import
com.mall4j.cloud.api.auth.bo.UserInfoInTokenBO
;
import
com.mall4j.cloud.api.auth.feign.AccountFeignClient
;
import
com.mall4j.cloud.api.leaf.feign.SegmentFeignClient
;
import
com.mall4j.cloud.api.rbac.dto.UserRoleDTO
;
import
com.mall4j.cloud.api.rbac.feign.UserRoleFeignClient
;
import
com.mall4j.cloud.common.database.dto.PageDTO
;
import
com.mall4j.cloud.common.database.util.PageUtil
;
import
com.mall4j.cloud.common.database.vo.PageVO
;
import
com.mall4j.cloud.common.response.ServerResponseEntity
;
import
com.mall4j.cloud.common.security.AuthUserContext
;
import
com.mall4j.cloud.multishop.mapper.ShopUserMapper
;
import
com.mall4j.cloud.multishop.model.ShopUser
;
import
com.mall4j.cloud.multishop.service.ShopUserService
;
import
com.mall4j.cloud.multishop.vo.ShopUserVO
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
jakarta.annotation.Resource
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
* @author FrozenWatermelon
* @date 2020/09/03
*/
@Service
public
class
ShopUserServiceImpl
implements
ShopUserService
{
@Resource
private
ShopUserMapper
shopUserMapper
;
@Autowired
private
AccountFeignClient
accountFeignClient
;
@Autowired
private
UserRoleFeignClient
userRoleFeignClient
;
@Autowired
private
SegmentFeignClient
segmentFeignClient
;
@Override
public
PageVO
<
ShopUserVO
>
pageByShopId
(
PageDTO
pageDTO
,
Long
shopId
,
String
nickName
)
{
return
PageUtil
.
doPage
(
pageDTO
,
()
->
shopUserMapper
.
listByShopId
(
shopId
,
nickName
));
}
@Override
public
ShopUserVO
getByUserId
(
Long
userId
)
{
ShopUserVO
shopUser
=
shopUserMapper
.
getByUserId
(
userId
);
ServerResponseEntity
<
List
<
Long
>>
roleIds
=
userRoleFeignClient
.
getRoleIds
(
shopUser
.
getShopUserId
());
shopUser
.
setRoleIds
(
roleIds
.
getData
());
return
shopUser
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
save
(
ShopUser
shopUser
,
List
<
Long
>
roleIds
)
{
shopUserMapper
.
save
(
shopUser
);
if
(
CollUtil
.
isEmpty
(
roleIds
))
{
return
;
}
UserRoleDTO
userRoleDTO
=
new
UserRoleDTO
();
userRoleDTO
.
setRoleIds
(
roleIds
);
userRoleDTO
.
setUserId
(
shopUser
.
getShopUserId
());
userRoleFeignClient
.
saveByUserIdAndSysType
(
userRoleDTO
);
}
@Override
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
ShopUser
shopUser
,
List
<
Long
>
roleIds
)
{
UserRoleDTO
userRoleDTO
=
new
UserRoleDTO
();
userRoleDTO
.
setRoleIds
(
roleIds
);
userRoleDTO
.
setUserId
(
shopUser
.
getShopUserId
());
shopUserMapper
.
update
(
shopUser
);
userRoleFeignClient
.
updateByUserIdAndSysType
(
userRoleDTO
);
}
@Override
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteById
(
Long
shopUserId
)
{
UserInfoInTokenBO
userInfoInTokenBO
=
AuthUserContext
.
get
();
accountFeignClient
.
deleteByUserIdAndSysType
(
shopUserId
);
userRoleFeignClient
.
deleteByUserIdAndSysType
(
shopUserId
);
shopUserMapper
.
deleteById
(
shopUserId
);
}
@Override
public
Long
getUserIdByShopId
(
Long
shopId
)
{
return
shopUserMapper
.
getUserIdByShopId
(
shopId
);
}
}
mall4cloud-multishop/src/main/java/com/mall4j/cloud/multishop/vo/HotSearchVO.java
0 → 100644
View file @
3ab6e756
package
com.mall4j.cloud.multishop.vo
;
import
com.mall4j.cloud.common.vo.BaseVO
;
import
io.swagger.v3.oas.annotations.media.Schema
;
/**
* 热搜VO
*
* @author YXF
* @date 2021-01-27 09:10:00
*/
public
class
HotSearchVO
extends
BaseVO
{
private
static
final
long
serialVersionUID
=
1L
;
@Schema
(
description
=
"主键"
)
private
Long
hotSearchId
;
@Schema
(
description
=
"店铺ID 0为全局热搜"
)
private
Long
shopId
;
@Schema
(
description
=
"内容"
)
private
String
content
;
@Schema
(
description
=
"顺序"
)
private
Integer
seq
;
@Schema
(
description
=
"状态 0下线 1上线"
)
private
Integer
status
;
@Schema
(
description
=
"热搜标题"
)
private
String
title
;
public
Long
getHotSearchId
()
{
return
hotSearchId
;
}
public
void
setHotSearchId
(
Long
hotSearchId
)
{
this
.
hotSearchId
=
hotSearchId
;
}
public
Long
getShopId
()
{
return
shopId
;
}
public
void
setShopId
(
Long
shopId
)
{
this
.
shopId
=
shopId
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
Integer
getSeq
()
{
return
seq
;
}
public
void
setSeq
(
Integer
seq
)
{
this
.
seq
=
seq
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
@Override
public
String
toString
()
{
return
"HotSearchVO{"
+
"hotSearchId="
+
hotSearchId
+
",shopId="
+
shopId
+
",content="
+
content
+
",seq="
+
seq
+
",status="
+
status
+
",title="
+
title
+
'}'
;
}
}
Prev
1
…
21
22
23
24
25
26
27
28
29
…
34
Next
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