fix(QywxScheduleJob): 添加suiteAccessToken为空时的错误处理
feat(ShopController): 新增获取商店列表接口并重命名分页接口 refactor(ShopApplicationService): 拆分获取商店列表和分页逻辑
This commit is contained in:
parent
2091d1e925
commit
ff811ab6f6
|
@ -102,11 +102,18 @@ public class ShopController extends BaseController {
|
|||
|
||||
@Operation(summary = "商店列表")
|
||||
@GetMapping
|
||||
public ResponseDTO<PageDTO<ShopDTO>> list(SearchShopQuery<ShopEntity> query) {
|
||||
PageDTO<ShopDTO> page = shopApplicationService.getShopList(query);
|
||||
public ResponseDTO<PageDTO<ShopDTO>> page(SearchShopQuery<ShopEntity> query) {
|
||||
PageDTO<ShopDTO> page = shopApplicationService.getShopPage(query);
|
||||
return ResponseDTO.ok(page);
|
||||
}
|
||||
|
||||
@Operation(summary = "商店列表")
|
||||
@GetMapping("/list")
|
||||
public ResponseDTO<List<ShopDTO>> list(SearchShopQuery<ShopEntity> query) {
|
||||
List<ShopDTO> list = shopApplicationService.getShopList(query);
|
||||
return ResponseDTO.ok(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取商店详情")
|
||||
@GetMapping("/{id}")
|
||||
public ResponseDTO<ShopDTO> getShopById(@PathVariable Long id) {
|
||||
|
|
|
@ -121,6 +121,10 @@ public class QywxScheduleJob {
|
|||
String suiteAccessToken = templateApplicationService.getSuiteAccessToken(template.getSuiteId(), template.getSecret(),
|
||||
template.getSuiteTicket());
|
||||
|
||||
if (StringUtils.isBlank(suiteAccessToken)) {
|
||||
log.error("getSuiteAccessToken suiteAccessToken is null");
|
||||
return;
|
||||
}
|
||||
UpdateTemplateCommand command = new UpdateTemplateCommand();
|
||||
command.setId(template.getId());
|
||||
command.setSuiteAccessToken(suiteAccessToken);
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ShopApplicationService {
|
|||
private final ShopService shopService;
|
||||
private final ShopModelFactory shopModelFactory;
|
||||
|
||||
public PageDTO<ShopDTO> getShopList(SearchShopQuery<ShopEntity> query) {
|
||||
public PageDTO<ShopDTO> getShopPage(SearchShopQuery<ShopEntity> query) {
|
||||
Page<ShopEntity> page = shopService.getShopList(query.toPage(), query.toQueryWrapper());
|
||||
List<ShopDTO> dtoList = page.getRecords().stream()
|
||||
.map(ShopDTO::new)
|
||||
|
@ -32,6 +32,13 @@ public class ShopApplicationService {
|
|||
return new PageDTO<>(dtoList, page.getTotal());
|
||||
}
|
||||
|
||||
public List<ShopDTO> getShopList(SearchShopQuery<ShopEntity> query) {
|
||||
List<ShopEntity> list = shopService.list();
|
||||
return list.stream()
|
||||
.map(ShopDTO::new)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public ShopDTO getShopById(Long shopId) {
|
||||
ShopEntity shopEntity = shopService.getById(shopId);
|
||||
return new ShopDTO(shopEntity);
|
||||
|
|
Loading…
Reference in New Issue