forked from lilishop/lilishop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
104 changed files
with
3,812 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
buyer-api/src/main/java/cn/lili/controller/store/StoreAddressBuyerController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package cn.lili.controller.store; | ||
|
||
import cn.lili.common.enums.ResultUtil; | ||
import cn.lili.common.security.OperationalJudgment; | ||
import cn.lili.common.security.context.UserContext; | ||
import cn.lili.common.vo.PageVO; | ||
import cn.lili.common.vo.ResultMessage; | ||
import cn.lili.modules.store.entity.dos.StoreAddress; | ||
import cn.lili.modules.store.service.StoreAddressService; | ||
import com.baomidou.mybatisplus.core.metadata.IPage; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiImplicitParam; | ||
import io.swagger.annotations.ApiOperation; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* 买家端,商家地址(自提点)接口 | ||
* | ||
* @author chc | ||
* @since 2022/6/2114:46 | ||
*/ | ||
@RestController | ||
@Api(tags = "买家端,商家地址(自提点)接口") | ||
@RequestMapping("/buyer/store/address") | ||
public class StoreAddressBuyerController { | ||
|
||
/** | ||
* 店铺自提点 | ||
*/ | ||
@Autowired | ||
private StoreAddressService storeAddressService; | ||
|
||
@ApiOperation(value = "获取商家自提点分页") | ||
@ApiImplicitParam(name = "storeId", value = "店铺Id", required = true, dataType = "String", paramType = "path") | ||
@GetMapping("/page/{storeId}") | ||
public ResultMessage<IPage<StoreAddress>> get(PageVO pageVo,@PathVariable String storeId) { | ||
return ResultUtil.data(storeAddressService.getStoreAddress(storeId, pageVo)); | ||
} | ||
|
||
@ApiOperation(value = "获取商家自提点信息") | ||
@ApiImplicitParam(name = "id", value = "自提点ID", required = true, paramType = "path") | ||
@GetMapping("/{id}") | ||
public ResultMessage<StoreAddress> get(@PathVariable String id) { | ||
StoreAddress address = OperationalJudgment.judgment(storeAddressService.getById(id)); | ||
return ResultUtil.data(address); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
consumer/src/main/java/cn/lili/event/MemberInfoChangeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package cn.lili.event; | ||
|
||
import cn.lili.modules.member.entity.dos.Member; | ||
|
||
/** | ||
* @author chc | ||
* @since 2022/6/2114:46 | ||
*/ | ||
public interface MemberInfoChangeEvent { | ||
|
||
/** | ||
* 会员信息更改消息 | ||
* | ||
* @param member 会员信息 | ||
*/ | ||
void memberInfoChange(Member member); | ||
} |
18 changes: 18 additions & 0 deletions
18
consumer/src/main/java/cn/lili/event/StoreSettingChangeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package cn.lili.event; | ||
|
||
|
||
import cn.lili.modules.store.entity.dos.Store; | ||
|
||
/** | ||
* @author chc | ||
* @since 2022/6/2114:46 | ||
*/ | ||
public interface StoreSettingChangeEvent { | ||
|
||
/** | ||
* 店铺信息更改消息 | ||
* | ||
* @param store 店铺信息 | ||
*/ | ||
void storeSettingChange(Store store); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
consumer/src/main/java/cn/lili/event/impl/ImTalkExecute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package cn.lili.event.impl; | ||
|
||
import cn.lili.event.MemberInfoChangeEvent; | ||
import cn.lili.event.StoreSettingChangeEvent; | ||
import cn.lili.modules.im.entity.dos.ImTalk; | ||
import cn.lili.modules.im.service.ImTalkService; | ||
import cn.lili.modules.member.entity.dos.Member; | ||
import cn.lili.modules.store.entity.dos.Store; | ||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Im对话消息 | ||
* | ||
* @author chc | ||
* @since 2022/6/2114:46 | ||
*/ | ||
@Service | ||
public class ImTalkExecute implements MemberInfoChangeEvent, StoreSettingChangeEvent { | ||
|
||
@Autowired | ||
private ImTalkService imTalkService; | ||
|
||
@Override | ||
public void memberInfoChange(Member member) { | ||
//当与UserId1相等时 | ||
List<ImTalk> imTalkList1 = imTalkService.list(new LambdaQueryWrapper<ImTalk>().eq(ImTalk::getUserId1, member.getId())); | ||
for (ImTalk imTalk : imTalkList1) { | ||
imTalk.setName1(member.getNickName()); | ||
imTalk.setFace1(member.getFace()); | ||
} | ||
imTalkService.updateBatchById(imTalkList1); | ||
List<ImTalk> imTalkList2 = imTalkService.list(new LambdaQueryWrapper<ImTalk>().eq(ImTalk::getUserId2, member.getId())); | ||
for (ImTalk imTalk : imTalkList2) { | ||
imTalk.setName2(member.getNickName()); | ||
imTalk.setFace2(member.getFace()); | ||
} | ||
imTalkService.updateBatchById(imTalkList2); | ||
} | ||
|
||
@Override | ||
public void storeSettingChange(Store store) { | ||
//当与UserId1相等时 | ||
List<ImTalk> imTalkList1 = imTalkService.list(new LambdaQueryWrapper<ImTalk>().eq(ImTalk::getUserId1, store.getId())); | ||
for (ImTalk imTalk : imTalkList1) { | ||
imTalk.setName1(store.getStoreName()); | ||
imTalk.setFace1(store.getStoreLogo()); | ||
} | ||
imTalkService.updateBatchById(imTalkList1); | ||
List<ImTalk> imTalkList2 = imTalkService.list(new LambdaQueryWrapper<ImTalk>().eq(ImTalk::getUserId2, store.getId())); | ||
for (ImTalk imTalk : imTalkList2) { | ||
imTalk.setName2(store.getStoreName()); | ||
imTalk.setFace2(store.getStoreLogo()); | ||
} | ||
imTalkService.updateBatchById(imTalkList2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
consumer/src/main/java/cn/lili/listener/StoreMessageListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package cn.lili.listener; | ||
|
||
import cn.hutool.json.JSONUtil; | ||
import cn.lili.event.MemberRegisterEvent; | ||
import cn.lili.event.StoreSettingChangeEvent; | ||
import cn.lili.modules.member.entity.dos.Member; | ||
import cn.lili.modules.store.entity.dos.Store; | ||
import cn.lili.rocketmq.tags.StoreTagsEnum; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.rocketmq.common.message.MessageExt; | ||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; | ||
import org.apache.rocketmq.spring.core.RocketMQListener; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 店铺消息 | ||
* @author chc | ||
* @since 2022/6/2114:46 | ||
*/ | ||
@Component | ||
@Slf4j | ||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.store-topic}", consumerGroup = "${lili.data.rocketmq.store-group}") | ||
public class StoreMessageListener implements RocketMQListener<MessageExt> { | ||
@Autowired | ||
private List<StoreSettingChangeEvent> storeSettingChangeEventList; | ||
|
||
@Override | ||
public void onMessage(MessageExt messageExt) { | ||
switch (StoreTagsEnum.valueOf(messageExt.getTags())){ | ||
//修改店铺 | ||
case EDIT_STORE_SETTING: | ||
for (StoreSettingChangeEvent storeSettingChangeEvent : storeSettingChangeEventList) { | ||
try { | ||
Store store = JSONUtil.toBean(new String(messageExt.getBody()), Store.class); | ||
storeSettingChangeEvent.storeSettingChange(store); | ||
} catch (Exception e) { | ||
log.error("会员{},在{}业务中,状态修改事件执行异常", | ||
new String(messageExt.getBody()), | ||
storeSettingChangeEvent.getClass().getName(), | ||
e); | ||
} | ||
} | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.