记得上下班打卡 | git大法好,push需谨慎

Commit f07beae8 authored by 胡佳晨's avatar 胡佳晨

提交接口

parent 431765eb
...@@ -12,7 +12,7 @@ public class GoblinRedisConst { ...@@ -12,7 +12,7 @@ public class GoblinRedisConst {
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
public static final String REDIS_GOBLIN_SELF_MARKET = PREFIX.concat("self:market:"); public static final String REDIS_GOBLIN_SELF_MARKET = PREFIX.concat("self:market:");
public static final String REDIS_GOBLIN_ZHENGZAI_RELATION = PREFIX.concat("zhengzai:market:"); public static final String REDIS_GOBLIN_ZHENGZAI_RELATION = PREFIX.concat("zhengzai:market:");
public static final String REDIS_GOBLIN_STORE_SELF_RELATION = PREFIX.concat("zhengzai:storeId:");
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
} }
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel
@Data
public class GoblinZhengzaiVo implements Cloneable{
@ApiModelProperty(value = "活动id")
String marketId;
@ApiModelProperty(value = "活动名称")
String name;
@ApiModelProperty(value = "活动状态[-1-全部|0-等待开始|1-活动中|2-活动结束|7-停用]")
Integer status;
@ApiModelProperty(value = "开始时间")
String startTime;
@ApiModelProperty(value = "结束时间")
String endTime;
@ApiModelProperty(value = "创建时间")
String createdAt;
private static final GoblinZhengzaiVo obj = new GoblinZhengzaiVo();
public static GoblinZhengzaiVo getNew() {
try {
return (GoblinZhengzaiVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinZhengzaiVo();
}
}
}
package com.liquidnet.service.goblin.service.manage;
import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import java.util.List;
public interface IGoblinZhengzaiService {
List<GoblinSelfMarketingVo> zhengzaiCanJoin(String storeId);
GoblinSelfMarketingVo zhengzaiCanJoinDetails(String marketId,String storeId);
}
...@@ -5,8 +5,8 @@ import com.liquidnet.client.admin.common.core.page.TableDataInfo; ...@@ -5,8 +5,8 @@ import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinZhengzaiMarketService; import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinZhengzaiMarketService;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreZhengzaiParam; import com.liquidnet.service.goblin.dto.manage.GoblinStoreZhengzaiParam;
import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import com.liquidnet.service.goblin.dto.vo.GoblinZhengzaiStoreListVo; import com.liquidnet.service.goblin.dto.vo.GoblinZhengzaiStoreListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinZhengzaiVo;
import com.liquidnet.service.goblin.entity.GoblinSelfMarketing; import com.liquidnet.service.goblin.entity.GoblinSelfMarketing;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -98,7 +98,7 @@ public class GoblinSelfZhengzaiController extends BaseController { ...@@ -98,7 +98,7 @@ public class GoblinSelfZhengzaiController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动id", example = "1"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动id", example = "1"),
}) })
public ResponseDto<GoblinZhengzaiVo> purchasingDetails(@RequestParam("marketId") @Valid String marketId) { public ResponseDto<GoblinSelfMarketingVo> purchasingDetails(@RequestParam("marketId") @Valid String marketId) {
return goblinZhengzaiMarketService.zhengzaiDetails(marketId); return goblinZhengzaiMarketService.zhengzaiDetails(marketId);
} }
......
package com.liquidnet.client.admin.zhengzai.goblin.service; package com.liquidnet.client.admin.zhengzai.goblin.service;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.manage.GoblinStorePurchaseItemParam; import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import com.liquidnet.service.goblin.dto.vo.GoblinZhengzaiStoreListVo; import com.liquidnet.service.goblin.dto.vo.GoblinZhengzaiStoreListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinZhengzaiVo;
import com.liquidnet.service.goblin.entity.GoblinSelfMarketing; import com.liquidnet.service.goblin.entity.GoblinSelfMarketing;
import java.util.List; import java.util.List;
...@@ -60,7 +59,7 @@ public interface IGoblinZhengzaiMarketService { ...@@ -60,7 +59,7 @@ public interface IGoblinZhengzaiMarketService {
* @param marketId 活动秒杀id * @param marketId 活动秒杀id
* @return * @return
*/ */
ResponseDto<GoblinZhengzaiVo> zhengzaiDetails(String marketId); ResponseDto<GoblinSelfMarketingVo> zhengzaiDetails(String marketId);
/** /**
* 获取活动内sku列表 * 获取活动内sku列表
......
...@@ -7,6 +7,9 @@ import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo; ...@@ -7,6 +7,9 @@ import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component @Component
public class GoblinRedisUtils { public class GoblinRedisUtils {
...@@ -31,12 +34,42 @@ public class GoblinRedisUtils { ...@@ -31,12 +34,42 @@ public class GoblinRedisUtils {
* @param data * @param data
*/ */
public void setZhengzaiRelation(String selfMarketId, GoblinMarketingZhengzaiRelationVo data) { public void setZhengzaiRelation(String selfMarketId, GoblinMarketingZhengzaiRelationVo data) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ZHENGZAI_RELATION.concat(selfMarketId).concat(":store_id:"+data.getStoreId()); String redisKey = GoblinRedisConst.REDIS_GOBLIN_ZHENGZAI_RELATION.concat(selfMarketId).concat(":store_id:" + data.getStoreId());
redisDataSourceUtil.getRedisGoblinUtil().set(redisKey, data); redisDataSourceUtil.getRedisGoblinUtil().set(redisKey, data);
} }
public void delZhengzaiRelation(String selfMarketId,String storeId){ public void delZhengzaiRelation(String selfMarketId, String storeId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ZHENGZAI_RELATION.concat(selfMarketId).concat(":store_id:"+storeId); String redisKey = GoblinRedisConst.REDIS_GOBLIN_ZHENGZAI_RELATION.concat(selfMarketId).concat(":store_id:" + storeId);
redisDataSourceUtil.getRedisGoblinUtil().del(redisKey); redisDataSourceUtil.getRedisGoblinUtil().del(redisKey);
} }
/**
* 获取 当前商铺能参与的官方活动id列表
* @param storeId
* @return
*/
public List<String> getZhengzaiRelation(String storeId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_STORE_SELF_RELATION.concat(storeId);
Object obj = redisDataSourceUtil.getRedisGoblinUtil().get(redisKey);
if (obj == null) {
return new ArrayList();
} else {
return (List<String>) obj;
}
}
public void addStoreSelfRelation(String selfMarketId, String storeId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_STORE_SELF_RELATION.concat(storeId);
List<String> list = getZhengzaiRelation(storeId);
list.add(selfMarketId);
redisDataSourceUtil.getRedisGoblinUtil().set(redisKey, list);
}
public void delStoreSelfRelation(String selfMarketId, String storeId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_STORE_SELF_RELATION.concat(storeId);
List<String> list = getZhengzaiRelation(storeId);
list.remove(selfMarketId);
redisDataSourceUtil.getRedisGoblinUtil().set(redisKey, list);
}
} }
package com.liquidnet.service.goblin.controller.manage; package com.liquidnet.service.goblin.controller.manage;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.manage.GoblinStorePurchaseItemParam; import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import com.liquidnet.service.goblin.dto.manage.GoblinStorePurchaseParam; import com.liquidnet.service.goblin.service.manage.IGoblinZhengzaiService;
import com.liquidnet.service.goblin.dto.vo.GoblinPurchasingVo;
import com.liquidnet.service.goblin.service.manage.IGoblinStorePurchasingService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -24,7 +21,7 @@ import java.util.List; ...@@ -24,7 +21,7 @@ import java.util.List;
public class GoblinZhengzaiController { public class GoblinZhengzaiController {
@Autowired @Autowired
IGoblinStorePurchasingService goblinStorePurchasingService; IGoblinZhengzaiService goblinZhengzaiService;
@GetMapping("zhengzai/list") @GetMapping("zhengzai/list")
@ApiOperation("活动详情-正在下单-可参与活动列表") @ApiOperation("活动详情-正在下单-可参与活动列表")
...@@ -32,8 +29,8 @@ public class GoblinZhengzaiController { ...@@ -32,8 +29,8 @@ public class GoblinZhengzaiController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1") @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1")
}) })
public ResponseDto<Boolean> zhengzaiCanJoin(@RequestParam("storeId") @Valid String storeId) { public ResponseDto<List<GoblinSelfMarketingVo>> zhengzaiCanJoin(@RequestParam("storeId") @Valid String storeId) {
return null; return ResponseDto.success(goblinZhengzaiService.zhengzaiCanJoin(storeId));
} }
@GetMapping("zhengzai/detals") @GetMapping("zhengzai/detals")
...@@ -43,13 +40,13 @@ public class GoblinZhengzaiController { ...@@ -43,13 +40,13 @@ public class GoblinZhengzaiController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "selfMarketId", value = "官方活动id", example = "1") @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "selfMarketId", value = "官方活动id", example = "1")
}) })
public ResponseDto<Boolean> zhengzaiCanJoinDetails(@RequestParam("storeId") @Valid String storeId, public ResponseDto<GoblinSelfMarketingVo> zhengzaiCanJoinDetails(@RequestParam("storeId") @Valid String storeId,
@RequestParam("selfMarketId") @Valid String selfMarketId) { @RequestParam("selfMarketId") @Valid String selfMarketId) {
return null; return ResponseDto.success(goblinZhengzaiService.zhengzaiCanJoinDetails(selfMarketId, storeId));
} }
@DeleteMapping("zhengzai/config") @PostMapping("zhengzai/config")
@ApiOperation("活动详情-正在下单-配置商铺") @ApiOperation("活动详情-正在下单-配置商铺sku")
@ApiResponse(code = 200, message = "接口返回对象参数") @ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1"),
...@@ -61,4 +58,47 @@ public class GoblinZhengzaiController { ...@@ -61,4 +58,47 @@ public class GoblinZhengzaiController {
return null; return null;
} }
@GetMapping("zhengzai/config/spu")
@ApiOperation("活动详情-正在下单-获取商铺spu")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "selfMarketId", value = "官方活动id", example = "1")
})
public ResponseDto<Boolean> zhengzaiStoreConfigSpuList(@RequestParam("storeId") @Valid String storeId,
@RequestParam("selfMarketId") @Valid String selfMarketId) {
//todo
return null;
}
@GetMapping("zhengzai/config/sku")
@ApiOperation("活动详情-正在下单-获取商铺sku")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "selfMarketId", value = "官方活动id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "spuId", value = "spuId", example = "1")
})
public ResponseDto<Boolean> zhengzaiStoreConfigSkuList(@RequestParam("storeId") @Valid String storeId,
@RequestParam("spuId") @Valid String spuId,
@RequestParam("selfMarketId") @Valid String selfMarketId) {
//todo
return null;
}
@DeleteMapping("zhengzai/config")
@ApiOperation("活动详情-正在下单-删除商铺sku")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "selfMarketId", value = "官方活动id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "skuId", value = "skuId", example = "1"),
})
public ResponseDto<Boolean> zhengzaiStoreDel(@RequestParam("storeId") @Valid String storeId,
@RequestParam("selfMarketId") @Valid String selfMarketId,
@RequestParam("skuId") @Valid String skuId) {
//todo
return null;
}
} }
package com.liquidnet.service.goblin.service.impl.manage;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.dto.vo.GoblinMarketingZhengzaiRelationVo;
import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import com.liquidnet.service.goblin.service.manage.IGoblinZhengzaiService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class GoblinZhengzaiServiceImpl implements IGoblinZhengzaiService {
@Autowired
GoblinRedisUtils redisUtils;
@Override
public List<GoblinSelfMarketingVo> zhengzaiCanJoin(String storeId) {
List<String> marketIds = redisUtils.getStoreZhengzaiRelation(storeId);
List<GoblinSelfMarketingVo> voList = ObjectUtil.getGoblinSelfMarketingVoList();
for (String selfMarketId : marketIds) {
GoblinMarketingZhengzaiRelationVo zhengzaiRelationVo = redisUtils.getZhengzaiRelation(selfMarketId, storeId);
if (DateUtil.compareStrDay(DateUtil.getNowTime(), zhengzaiRelationVo.getShowTime()) == 1) {
voList.add(redisUtils.getSelfMarket(selfMarketId));
}
}
return voList;
}
@Override
public GoblinSelfMarketingVo zhengzaiCanJoinDetails(String marketId, String storeId) {
GoblinMarketingZhengzaiRelationVo zhengzaiRelationVo = redisUtils.getZhengzaiRelation(marketId, storeId);
if (DateUtil.compareStrDay(DateUtil.getNowTime(), zhengzaiRelationVo.getShowTime()) == 1) {
return redisUtils.getSelfMarket(marketId);
}
return null;
}
}
package com.liquidnet.service.goblin.util; package com.liquidnet.service.goblin.util;
import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil; import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.vo.GoblinMarketingZhengzaiRelationVo;
import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component @Component
public class GoblinRedisUtils { public class GoblinRedisUtils {
@Autowired @Autowired
RedisDataSourceUtil redisDataSourceUtil; RedisUtil redisUtil;
/**
* 获取 当前商铺能参与的官方活动id列表
*
* @param storeId
* @return
*/
public List<String> getStoreZhengzaiRelation(String storeId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_STORE_SELF_RELATION.concat(storeId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return null;
} else {
return (List<String>) obj;
}
}
/**
* 正在下单 可参加商户关系 详情
*
* @param selfMarketId
* @param storeId
*/
public GoblinMarketingZhengzaiRelationVo getZhengzaiRelation(String selfMarketId, String storeId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ZHENGZAI_RELATION.concat(selfMarketId).concat(":store_id:" + storeId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return null;
} else {
return (GoblinMarketingZhengzaiRelationVo) obj;
}
}
/**
* 正在下单 可参加商户 详情
*
* @param selfMarketId
*/
public GoblinSelfMarketingVo getSelfMarket(String selfMarketId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SELF_MARKET.concat(selfMarketId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return null;
} else {
return (GoblinSelfMarketingVo) obj;
}
}
} }
...@@ -2,6 +2,7 @@ package com.liquidnet.service.goblin.util; ...@@ -2,6 +2,7 @@ package com.liquidnet.service.goblin.util;
import com.liquidnet.service.base.PagedResult; import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo; import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinSelfMarketingVo;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner; import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -9,6 +10,7 @@ import java.util.ArrayList; ...@@ -9,6 +10,7 @@ import java.util.ArrayList;
public class ObjectUtil { public class ObjectUtil {
private static final PagedResult<GoblinStoreMgtGoodsListVo> goblinStoreMgtGoodsVoPagedResult = new PagedResult<>(); private static final PagedResult<GoblinStoreMgtGoodsListVo> goblinStoreMgtGoodsVoPagedResult = new PagedResult<>();
private static final ArrayList<GoblinFrontBanner> goblinFrontBannerArrayList = new ArrayList<>(); private static final ArrayList<GoblinFrontBanner> goblinFrontBannerArrayList = new ArrayList<>();
private static final ArrayList<GoblinSelfMarketingVo> goblinSelfMarketingVoArrayList = new ArrayList<>();
public static PagedResult<GoblinStoreMgtGoodsListVo> getGoblinStoreMgtGoodsVoPagedResult() { public static PagedResult<GoblinStoreMgtGoodsListVo> getGoblinStoreMgtGoodsVoPagedResult() {
return goblinStoreMgtGoodsVoPagedResult.clone(); return goblinStoreMgtGoodsVoPagedResult.clone();
...@@ -16,4 +18,8 @@ public class ObjectUtil { ...@@ -16,4 +18,8 @@ public class ObjectUtil {
public static ArrayList<GoblinFrontBanner> getGoblinFrontBannerArrayList() { public static ArrayList<GoblinFrontBanner> getGoblinFrontBannerArrayList() {
return (ArrayList<GoblinFrontBanner>) goblinFrontBannerArrayList.clone(); return (ArrayList<GoblinFrontBanner>) goblinFrontBannerArrayList.clone();
} }
public static ArrayList<GoblinSelfMarketingVo> getGoblinSelfMarketingVoList() {
return (ArrayList<GoblinSelfMarketingVo>) goblinSelfMarketingVoArrayList.clone();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment