feat: expose store status on props resources
This commit is contained in:
parent
d17f75e42d
commit
3fc5d4a4ff
@ -2,11 +2,13 @@ package com.red.circle.other.inner.endpoint.material.props.api;
|
||||
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.framework.dto.ResultResponse;
|
||||
import com.red.circle.other.inner.model.cmd.material.PropsCommodityStoreQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsCommodityStoreDTO;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.red.circle.other.inner.model.cmd.material.PropsCommodityStoreQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsCommodityStoreDTO;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
@ -23,13 +25,21 @@ public interface PropsCommodityStoreClientApi {
|
||||
* 获取平台指定资源.
|
||||
*/
|
||||
@GetMapping("/getPropsCommodityStore")
|
||||
ResultResponse<PropsCommodityStoreDTO> getPropsCommodityStore(
|
||||
@RequestParam("sysOrigin") String sysOrigin,
|
||||
@RequestParam("sourceId") Long sourceId
|
||||
);
|
||||
|
||||
/**
|
||||
* 商店分页列表.
|
||||
ResultResponse<PropsCommodityStoreDTO> getPropsCommodityStore(
|
||||
@RequestParam("sysOrigin") String sysOrigin,
|
||||
@RequestParam("sourceId") Long sourceId
|
||||
);
|
||||
|
||||
/**
|
||||
* 批量获取资源对应商品.
|
||||
*/
|
||||
@PostMapping("/mapBySourceIds")
|
||||
ResultResponse<Map<Long, PropsCommodityStoreDTO>> mapBySourceIds(
|
||||
@RequestParam("sysOrigin") String sysOrigin,
|
||||
@RequestBody Set<Long> sourceIds);
|
||||
|
||||
/**
|
||||
* 商店分页列表.
|
||||
*/
|
||||
@PostMapping("/pageOps")
|
||||
ResultResponse<PageResult<PropsCommodityStoreDTO>> pageOps(
|
||||
|
||||
@ -4,18 +4,21 @@ import com.red.circle.console.app.convertor.PropsAppConvertor;
|
||||
import com.red.circle.console.app.dto.clienobject.props.PropsResourcesOpsCO;
|
||||
import com.red.circle.console.app.dto.cmd.app.props.PropsSourceRecordSaveOrUpdateCmd;
|
||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.inner.endpoint.material.props.PropsRedPacketSkinClient;
|
||||
import com.red.circle.other.inner.endpoint.material.props.PropsSourceClient;
|
||||
import com.red.circle.other.inner.enums.material.ConsolePropsTypeEnum;
|
||||
import com.red.circle.other.inner.model.cmd.material.PropsSourceRecordQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsRedPacketSkinDTO;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsResourcesDTO;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.inner.endpoint.material.props.PropsCommodityStoreClient;
|
||||
import com.red.circle.other.inner.endpoint.material.props.PropsRedPacketSkinClient;
|
||||
import com.red.circle.other.inner.endpoint.material.props.PropsSourceClient;
|
||||
import com.red.circle.other.inner.enums.material.ConsolePropsTypeEnum;
|
||||
import com.red.circle.other.inner.model.cmd.material.PropsSourceRecordQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsCommodityStoreDTO;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsRedPacketSkinDTO;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsResourcesDTO;
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -33,9 +36,10 @@ import org.springframework.stereotype.Service;
|
||||
public class PropsSourceServiceImpl implements PropsSourceService {
|
||||
|
||||
@Qualifier("PropsAppConvertorNew")
|
||||
private final PropsAppConvertor propsAppConvertor;
|
||||
private final PropsSourceClient propsSourceClient;
|
||||
private final PropsRedPacketSkinClient propsRedPacketSkinClient;
|
||||
private final PropsAppConvertor propsAppConvertor;
|
||||
private final PropsSourceClient propsSourceClient;
|
||||
private final PropsRedPacketSkinClient propsRedPacketSkinClient;
|
||||
private final PropsCommodityStoreClient propsCommodityStoreClient;
|
||||
|
||||
@Override
|
||||
public List<PropsResourcesDTO> listSysOrigin(String sysOrigin, String type) {
|
||||
@ -62,14 +66,16 @@ public class PropsSourceServiceImpl implements PropsSourceService {
|
||||
if (CollectionUtils.isEmpty(pageResult.getRecords())) {
|
||||
return pageResult.emptyRecords();
|
||||
}
|
||||
Map<Long, PropsRedPacketSkinDTO> redPacketSkinMap = ResponseAssert.requiredSuccess(
|
||||
propsRedPacketSkinClient.mapRedPacketSkinByIds(
|
||||
pageResult.getRecords().stream().map(PropsResourcesDTO::getId).collect(
|
||||
Collectors.toSet())));
|
||||
|
||||
return pageResult.convert(propsResources -> {
|
||||
PropsResourcesOpsCO propsResourcesOpsCO = propsAppConvertor.toPropsResourcesOpsCO(propsResources);
|
||||
|
||||
Set<Long> sourceIds = pageResult.getRecords().stream().map(PropsResourcesDTO::getId).collect(
|
||||
Collectors.toSet());
|
||||
Map<Long, PropsRedPacketSkinDTO> redPacketSkinMap = ResponseAssert.requiredSuccess(
|
||||
propsRedPacketSkinClient.mapRedPacketSkinByIds(sourceIds));
|
||||
Map<Long, PropsCommodityStoreDTO> storeCommodityMap = ResponseAssert.requiredSuccess(
|
||||
propsCommodityStoreClient.mapBySourceIds(qryCmd.getSysOrigin(), sourceIds));
|
||||
|
||||
return pageResult.convert(propsResources -> {
|
||||
PropsResourcesOpsCO propsResourcesOpsCO = propsAppConvertor.toPropsResourcesOpsCO(propsResources);
|
||||
|
||||
PropsRedPacketSkinDTO redPacketSkin = redPacketSkinMap.get(propsResources.getId());
|
||||
if (Objects.nonNull(redPacketSkin)) {
|
||||
propsResourcesOpsCO.setImNotOpenedUrl(redPacketSkin.getImNotOpenedUrl());
|
||||
@ -77,12 +83,13 @@ public class PropsSourceServiceImpl implements PropsSourceService {
|
||||
propsResourcesOpsCO.setRoomNotOpenedUrl(redPacketSkin.getRoomNotOpenedUrl());
|
||||
propsResourcesOpsCO.setRoomOpenedUrl(redPacketSkin.getRoomOpenedUrl());
|
||||
propsResourcesOpsCO.setRoomSendCoverUrl(redPacketSkin.getRoomSendCoverUrl());
|
||||
propsResourcesOpsCO.setImSendCoverUrl(redPacketSkin.getImSendCoverUrl());
|
||||
propsResourcesOpsCO.setImOpenedUrlTwo(redPacketSkin.getImOpenedUrlTwo());
|
||||
}
|
||||
propsResourcesOpsCO.setTypeName(ConsolePropsTypeEnum.getDescValue(propsResources.getType()));
|
||||
return propsResourcesOpsCO;
|
||||
}
|
||||
propsResourcesOpsCO.setImSendCoverUrl(redPacketSkin.getImSendCoverUrl());
|
||||
propsResourcesOpsCO.setImOpenedUrlTwo(redPacketSkin.getImOpenedUrlTwo());
|
||||
}
|
||||
propsResourcesOpsCO.setStoreCommodity(storeCommodityMap.get(propsResources.getId()));
|
||||
propsResourcesOpsCO.setTypeName(ConsolePropsTypeEnum.getDescValue(propsResources.getType()));
|
||||
return propsResourcesOpsCO;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package com.red.circle.console.app.dto.clienobject.props;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.red.circle.framework.dto.ClientObject;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsResourcesDTO;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.red.circle.framework.dto.ClientObject;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsCommodityStoreDTO;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsResourcesDTO;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import lombok.Data;
|
||||
@ -63,13 +64,18 @@ public class PropsResourcesOpsCO extends ClientObject {
|
||||
*/
|
||||
private String expand;
|
||||
|
||||
/**
|
||||
* 底价.
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 0.未删除 1.已删除.
|
||||
/**
|
||||
* 底价.
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 对应道具商店商品.
|
||||
*/
|
||||
private PropsCommodityStoreDTO storeCommodity;
|
||||
|
||||
/**
|
||||
* 0.未删除 1.已删除.
|
||||
*/
|
||||
private Boolean del;
|
||||
|
||||
|
||||
@ -4,9 +4,11 @@ import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.framework.dto.ResultResponse;
|
||||
import com.red.circle.other.app.inner.service.material.props.PropsCommodityStoreClientService;
|
||||
import com.red.circle.other.inner.endpoint.material.props.api.PropsCommodityStoreClientApi;
|
||||
import com.red.circle.other.inner.model.cmd.material.PropsCommodityStoreQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsCommodityStoreDTO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.red.circle.other.inner.model.cmd.material.PropsCommodityStoreQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsCommodityStoreDTO;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -26,14 +28,21 @@ public class PropsCommodityStoreClientEndpoint implements PropsCommodityStoreCli
|
||||
private final PropsCommodityStoreClientService propsCommodityStoreClientService;
|
||||
|
||||
@Override
|
||||
public ResultResponse<PropsCommodityStoreDTO> getPropsCommodityStore(String sysOrigin,
|
||||
Long sourceId) {
|
||||
return ResultResponse.success(
|
||||
propsCommodityStoreClientService.getPropsCommodityStore(sysOrigin, sourceId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<PageResult<PropsCommodityStoreDTO>> pageOps(
|
||||
public ResultResponse<PropsCommodityStoreDTO> getPropsCommodityStore(String sysOrigin,
|
||||
Long sourceId) {
|
||||
return ResultResponse.success(
|
||||
propsCommodityStoreClientService.getPropsCommodityStore(sysOrigin, sourceId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<Map<Long, PropsCommodityStoreDTO>> mapBySourceIds(String sysOrigin,
|
||||
Set<Long> sourceIds) {
|
||||
return ResultResponse.success(
|
||||
propsCommodityStoreClientService.mapBySourceIds(sysOrigin, sourceIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<PageResult<PropsCommodityStoreDTO>> pageOps(
|
||||
PropsCommodityStoreQryCmd qryCmd) {
|
||||
return ResultResponse.success(propsCommodityStoreClientService.pageOps(qryCmd));
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.red.circle.other.app.inner.service.material.props;
|
||||
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.inner.model.cmd.material.PropsCommodityStoreQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsCommodityStoreDTO;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.inner.model.cmd.material.PropsCommodityStoreQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsCommodityStoreDTO;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 道具商店.
|
||||
@ -14,10 +16,15 @@ public interface PropsCommodityStoreClientService {
|
||||
/**
|
||||
* 获取平台指定资源.
|
||||
*/
|
||||
PropsCommodityStoreDTO getPropsCommodityStore(String sysOrigin, Long sourceId);
|
||||
|
||||
/**
|
||||
* 商店分页列表.
|
||||
PropsCommodityStoreDTO getPropsCommodityStore(String sysOrigin, Long sourceId);
|
||||
|
||||
/**
|
||||
* 批量获取资源对应商品.
|
||||
*/
|
||||
Map<Long, PropsCommodityStoreDTO> mapBySourceIds(String sysOrigin, Set<Long> sourceIds);
|
||||
|
||||
/**
|
||||
* 商店分页列表.
|
||||
*/
|
||||
PageResult<PropsCommodityStoreDTO> pageOps(PropsCommodityStoreQryCmd qryCmd);
|
||||
|
||||
|
||||
@ -4,13 +4,19 @@ import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.framework.mybatis.constant.PageConstant;
|
||||
import com.red.circle.other.app.inner.convertor.material.PropsCommodityStoreInnerConvertor;
|
||||
import com.red.circle.other.app.inner.service.material.props.PropsCommodityStoreClientService;
|
||||
import com.red.circle.other.infra.database.rds.entity.props.PropsCommodityStore;
|
||||
import com.red.circle.other.infra.database.rds.service.props.PropsCommodityStoreService;
|
||||
import com.red.circle.other.inner.model.cmd.material.PropsCommodityStoreQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsCommodityStoreDTO;
|
||||
import com.red.circle.tool.core.text.StringUtils;
|
||||
import java.util.Objects;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.red.circle.other.infra.database.rds.entity.props.PropsCommodityStore;
|
||||
import com.red.circle.other.infra.database.rds.service.props.PropsCommodityStoreService;
|
||||
import com.red.circle.other.inner.model.cmd.material.PropsCommodityStoreQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.material.PropsCommodityStoreDTO;
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import com.red.circle.tool.core.text.StringUtils;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -26,14 +32,33 @@ public class PropsCommodityStoreClientServiceImpl implements PropsCommodityStore
|
||||
private final PropsCommodityStoreInnerConvertor propsCommodityStoreInnerConvertor;
|
||||
|
||||
@Override
|
||||
public PropsCommodityStoreDTO getPropsCommodityStore(String sysOrigin, Long sourceId) {
|
||||
return propsCommodityStoreInnerConvertor.toPropsCommodityStoreDTO(
|
||||
propsCommodityStoreService.getSourceIdById(sysOrigin, sourceId)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PropsCommodityStoreDTO> pageOps(PropsCommodityStoreQryCmd qryCmd) {
|
||||
public PropsCommodityStoreDTO getPropsCommodityStore(String sysOrigin, Long sourceId) {
|
||||
return propsCommodityStoreInnerConvertor.toPropsCommodityStoreDTO(
|
||||
propsCommodityStoreService.getSourceIdById(sysOrigin, sourceId)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, PropsCommodityStoreDTO> mapBySourceIds(String sysOrigin, Set<Long> sourceIds) {
|
||||
if (StringUtils.isBlank(sysOrigin) || CollectionUtils.isEmpty(sourceIds)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
return propsCommodityStoreService.query()
|
||||
.eq(PropsCommodityStore::getSysOrigin, sysOrigin)
|
||||
.in(PropsCommodityStore::getSourceId, sourceIds)
|
||||
.eq(PropsCommodityStore::getDel, Boolean.FALSE)
|
||||
.orderByDesc(PropsCommodityStore::getUpdateTime)
|
||||
.list()
|
||||
.stream()
|
||||
.map(propsCommodityStoreInnerConvertor::toPropsCommodityStoreDTO)
|
||||
.collect(Collectors.toMap(
|
||||
PropsCommodityStoreDTO::getSourceId,
|
||||
Function.identity(),
|
||||
(first, ignored) -> first));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PropsCommodityStoreDTO> pageOps(PropsCommodityStoreQryCmd qryCmd) {
|
||||
return propsCommodityStoreInnerConvertor.toPagePropsCommodityStoreDTO(
|
||||
propsCommodityStoreService.query()
|
||||
.eq(Objects.nonNull(qryCmd.getId()), PropsCommodityStore::getId, qryCmd.getId())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user