fix: 修复查询系统日志报错问题,修复添加直播商品报错问题

This commit is contained in:
paulGao 2022-09-20 19:06:21 +08:00
parent a80b5ed961
commit 88db57c64b
4 changed files with 8 additions and 9 deletions

View File

@ -53,7 +53,7 @@ public interface StudioService extends IService<Studio> {
* @param storeId 店铺ID * @param storeId 店铺ID
* @return 操作结果 * @return 操作结果
*/ */
Boolean push(Integer roomId,Integer goodsId, String storeId); Boolean push(Integer roomId,Integer liveGoodsId, String storeId, String goodsId);
/** /**
* 删除商品 * 删除商品

View File

@ -161,12 +161,12 @@ public class StudioServiceImpl extends ServiceImpl<StudioMapper, Studio> impleme
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean push(Integer roomId, Integer goodsId, String storeId) { public Boolean push(Integer roomId, Integer liveGoodsId, String storeId, String goodsId) {
//判断直播间是否已添加商品 //判断直播间是否已添加商品
if (studioCommodityService.getOne( if (studioCommodityService.getOne(
new LambdaQueryWrapper<StudioCommodity>().eq(StudioCommodity::getRoomId, roomId) new LambdaQueryWrapper<StudioCommodity>().eq(StudioCommodity::getRoomId, roomId)
.eq(StudioCommodity::getGoodsId, goodsId)) != null) { .eq(StudioCommodity::getGoodsId, liveGoodsId)) != null) {
throw new ServiceException(ResultCode.STODIO_GOODS_EXIST_ERROR); throw new ServiceException(ResultCode.STODIO_GOODS_EXIST_ERROR);
} }
@ -176,8 +176,8 @@ public class StudioServiceImpl extends ServiceImpl<StudioMapper, Studio> impleme
} }
//调用微信接口添加直播间商品并进行记录 //调用微信接口添加直播间商品并进行记录
if (Boolean.TRUE.equals(wechatLivePlayerUtil.pushGoods(roomId, goodsId))) { if (Boolean.TRUE.equals(wechatLivePlayerUtil.pushGoods(roomId, liveGoodsId))) {
studioCommodityService.save(new StudioCommodity(roomId, goodsId)); studioCommodityService.save(new StudioCommodity(roomId, liveGoodsId));
//添加直播间商品数量 //添加直播间商品数量
Studio studio = this.getByRoomId(roomId); Studio studio = this.getByRoomId(roomId);
studio.setRoomGoodsNum(studio.getRoomGoodsNum() != null ? studio.getRoomGoodsNum() + 1 : 1); studio.setRoomGoodsNum(studio.getRoomGoodsNum() != null ? studio.getRoomGoodsNum() + 1 : 1);

View File

@ -9,7 +9,6 @@ import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
@ -42,7 +41,7 @@ public class SystemLogVO implements Serializable {
@ApiModelProperty(value = "日志记录时间") @ApiModelProperty(value = "日志记录时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@Field(type = FieldType.Date, format = DateFormat.basic_date_time, fielddata = true) @Field(type = FieldType.Date, fielddata = true)
private Date createTime = new Date(); private Date createTime = new Date();
@ApiModelProperty(value = "请求用户") @ApiModelProperty(value = "请求用户")

View File

@ -74,9 +74,9 @@ public class StudioStoreController {
@ApiImplicitParam(name = "liveGoodsId", value = "直播商品ID", required = true, dataType = "Integer", paramType = "path") @ApiImplicitParam(name = "liveGoodsId", value = "直播商品ID", required = true, dataType = "Integer", paramType = "path")
}) })
@PutMapping(value = "/push/{roomId}/{liveGoodsId}") @PutMapping(value = "/push/{roomId}/{liveGoodsId}")
public ResultMessage<Studio> push(@PathVariable Integer roomId, @PathVariable Integer liveGoodsId) { public ResultMessage<Studio> push(@PathVariable Integer roomId, @PathVariable Integer liveGoodsId, @RequestParam String goodsId) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId(); String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
if (Boolean.TRUE.equals(studioService.push(roomId, liveGoodsId, storeId))) { if (Boolean.TRUE.equals(studioService.push(roomId, liveGoodsId, storeId, goodsId))) {
return ResultUtil.success(ResultCode.SUCCESS); return ResultUtil.success(ResultCode.SUCCESS);
} }
throw new ServiceException(ResultCode.ERROR); throw new ServiceException(ResultCode.ERROR);