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

Commit 2e1a2d5f authored by 胡佳晨's avatar 胡佳晨

admin 正在下单 和 商品关联接口 待测

goblin 活动添加 商品sku 待测
goblin 正在下单 未测
parent ebb7d79a
......@@ -31,7 +31,7 @@ public class GoblinSelfMarketingVo implements Serializable, Cloneable {
@ApiModelProperty(value = "活动状态[-1-全部|0-等待开始|1-活动中|2-活动结束|7-停用]")
private Integer status;
@ApiModelProperty(value = "营销描述")
private String desc;
private String describes;
@ApiModelProperty(value = "营销开始时间")
private String startTime;
@ApiModelProperty(value = "营销结束时间营销为定金预售的时候,该时间也是第二阶段付款的时间营销为全款预售的时候,该时间也是发货时间")
......
......@@ -20,7 +20,7 @@ public class GoblinStoreMarketVo implements Cloneable {
@ApiModelProperty(value = " 商铺id")
private String storeId;
@ApiModelProperty(value = " 营销描述")
private String desc;
private String describes;
@ApiModelProperty(value = " 营销开始时间")
private String startTime;
@ApiModelProperty(value = " 营销结束时间营销为定金预售的时候,该时间也是第二阶段付款的时间营销为全款预售的时候,该时间也是发货时间")
......
......@@ -63,12 +63,12 @@ public class GoblinSelfZhengzaiController extends BaseController {
return getDataTable(list);
}
@PutMapping("zhengzai/status")
@ApiOperation("活动操作-正在下单")
@PostMapping("zhengzai/status")
@ApiOperation("活动操作-正在下单-修改状态")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "status", value = "活动状态[0-等待开始|7-停用]", example = "0"),
@ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "status", value = "活动状态[0-等待开始|7-停用|-1-删除]", example = "0"),
})
public ResponseDto<Boolean> purchasingStatus(@RequestParam(value = "marketId") @Valid String marketId,
@RequestParam(value = "status") @Valid Integer status) {
......@@ -104,7 +104,7 @@ public class GoblinSelfZhengzaiController extends BaseController {
@PostMapping("zhengzai/store")
@ApiOperation("活动详情-正在下单-配置店铺")
@ApiOperation("活动详情-正在下单-新增店铺")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动id", example = "1"),
......@@ -114,7 +114,7 @@ public class GoblinSelfZhengzaiController extends BaseController {
public ResponseDto<Boolean> purchasingStore(@RequestParam("marketId") @Valid String marketId,
@RequestParam("storeId") @Valid String storeId,
@RequestParam("showTime") @Valid String showTime) {
return goblinZhengzaiMarketService.zhengzaiStore(marketId,storeId,showTime);
return goblinZhengzaiMarketService.zhengzaiStore(marketId, storeId, showTime);
}
@PutMapping("zhengzai/store")
......@@ -130,7 +130,7 @@ public class GoblinSelfZhengzaiController extends BaseController {
@RequestParam("storeId") @Valid String storeId,
@RequestParam("showTime") @Valid String showTime,
@RequestParam("delTag") @Valid Integer delTag) {
return goblinZhengzaiMarketService.zhengzaiStore(marketId,storeId,showTime);
return goblinZhengzaiMarketService.zhengzaiStore(marketId, storeId, showTime, delTag);
}
......
......@@ -73,6 +73,17 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
@Override
public ResponseDto<Boolean> zhengzaiStatus(String marketId, int status) {
GoblinSelfMarketing selfMarketing = GoblinSelfMarketing.getNew();
if (status == -1) {
selfMarketing.setStatus(0);
selfMarketing.setDelFlag(1);
selfMarketing.setUpdatedAt(LocalDateTime.now());
//mysql
goblinSelfMarketingMapper.update(selfMarketing, Wrappers.lambdaUpdate(GoblinSelfMarketing.getNew()).eq(GoblinSelfMarketing::getSelfMarketId, marketId));
//mongo
goblinMongoUtils.delSelfMarket(marketId);
//redis
goblinRedisUtils.delSelfMarket(marketId);
} else {
selfMarketing.setStatus(status);
selfMarketing.setUpdatedAt(LocalDateTime.now());
//mysql
......@@ -83,6 +94,7 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
goblinMongoUtils.updateSelfMarket(marketId, vo);
//redis
goblinRedisUtils.setSelfMarket(marketId, vo);
}
return ResponseDto.success();
}
......@@ -95,6 +107,7 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
selfMarketing.setType(GoblinStatusConst.MarketingStatus.SELF_TYPE_ZHENGZAI.getValue());
selfMarketing.setStartTime(LocalDateTime.parse(st, DTF_YMD_HMS));
selfMarketing.setEndTime(LocalDateTime.parse(et, DTF_YMD_HMS));
selfMarketing.setCreatedAt(LocalDateTime.now());
//mysql
goblinSelfMarketingMapper.insert(selfMarketing);
//mongo
......@@ -132,7 +145,13 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
@Override
public ResponseDto<GoblinSelfMarketingVo> zhengzaiDetails(String marketId) {
return null;
GoblinSelfMarketing bean = goblinSelfMarketingMapper.selectOne(Wrappers.lambdaUpdate(GoblinSelfMarketing.getNew()).eq(GoblinSelfMarketing::getSelfMarketId, marketId));
GoblinSelfMarketingVo vo = GoblinSelfMarketingVo.getNew();
BeanUtils.copyProperties(bean, vo);
vo.setStartTime(DateUtil.Formatter.yyyyMMddHHmmss.format(bean.getStartTime()));
vo.setEndTime(DateUtil.Formatter.yyyyMMddHHmmss.format(bean.getEndTime()));
vo.setCreatedAt(DateUtil.Formatter.yyyyMMddHHmmss.format(bean.getCreatedAt()));
return ResponseDto.success(vo);
}
// @Override
......@@ -186,17 +205,22 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
if (delTag == 0) {
GoblinMarketingZhengzaiRelation entity = GoblinMarketingZhengzaiRelation.getNew();
entity.setShowTime(LocalDateTime.parse(showTime, DTF_YMD_HMS));
entity.setUpdatedAt(LocalDateTime.now());
//mysql
goblinMarketingZhengzaiRelationMapper.update(entity, Wrappers.lambdaUpdate(GoblinMarketingZhengzaiRelation.getNew()).eq(GoblinMarketingZhengzaiRelation::getSelfMarketId, marketId).eq(GoblinMarketingZhengzaiRelation::getStoreId, storeId));
//mongo
GoblinMarketingZhengzaiRelationVo vo = GoblinMarketingZhengzaiRelationVo.getNew();
BeanUtils.copyProperties(entity, vo);
vo.setShowTime(showTime);
vo.setCreatedAt(DateUtil.Formatter.yyyyMMddHHmmss.format(entity.getCreatedAt()));
goblinMongoUtils.updateZhengzaiRelation(marketId, storeId, vo);
//redis
goblinRedisUtils.setZhengzaiRelation(marketId, vo);
} else if (delTag == 1) {
GoblinMarketingZhengzaiRelation entity = GoblinMarketingZhengzaiRelation.getNew();
entity.setDelTag(1);
entity.setUpdatedAt(LocalDateTime.now());
//mysql
goblinMarketingZhengzaiRelationMapper.update(entity, Wrappers.lambdaUpdate(GoblinMarketingZhengzaiRelation.getNew()).eq(GoblinMarketingZhengzaiRelation::getSelfMarketId, marketId).eq(GoblinMarketingZhengzaiRelation::getStoreId, storeId));
//mongo
goblinMongoUtils.delZhengzaiRelation(marketId, storeId);
//redis
......
......@@ -33,6 +33,10 @@ public class GoblinMongoUtils {
object);
}
public DeleteResult delSelfMarket(String selfMarketId) {
return mongoTemplate.remove(Query.query(Criteria.where("selfMarketId").is(selfMarketId)), GoblinSelfMarketingVo.class.getSimpleName());
}
public GoblinMarketingZhengzaiRelationVo insertZhengzaiRelation(GoblinMarketingZhengzaiRelationVo data) {
return mongoTemplate.insert(data, GoblinMarketingZhengzaiRelationVo.class.getSimpleName());
}
......
......@@ -27,6 +27,16 @@ public class GoblinRedisUtils {
redisDataSourceUtil.getRedisGoblinUtil().set(redisKey, data);
}
/**
* 删除店铺活动
*
* @param selfMarketId
*/
public void delSelfMarket(String selfMarketId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SELF_MARKET.concat(selfMarketId);
redisDataSourceUtil.getRedisGoblinUtil().del(redisKey);
}
/**
* 正在下单 可参加商户
*
......
......@@ -73,7 +73,7 @@ public class GoblinBackOrder implements Serializable {
/**
* 问题说明
*/
private String desc;
private String describes;
/**
* 申请凭据[0-没有任何凭据|1-有发票|2-有质检报告]
......
......@@ -49,7 +49,7 @@ public class GoblinSelfMarketing implements Serializable, Cloneable {
/**
* 营销描述
*/
private String desc;
private String describes;
/**
* 营销开始时间
......
......@@ -54,7 +54,7 @@ public class GoblinStoreMarketing implements Serializable ,Cloneable{
/**
* 营销描述
*/
private String desc;
private String describes;
/**
* 营销开始时间
......
......@@ -49,7 +49,7 @@ public class GoblinStorePurchasingController {
return goblinStorePurchasingService.purchasingList(page, purchaseName, status, st, et, ct);
}
@PutMapping("purchasing/status")
@PostMapping("purchasing/status")
@ApiOperation("活动操作-限时秒杀")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
......
......@@ -12,6 +12,7 @@ import com.liquidnet.service.goblin.service.manage.IGoblinStorePurchasingService
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import me.chanjar.weixin.common.util.DataUtils;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -33,8 +34,19 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
@Override
public ResponseDto<PageInfo<GoblinStoreMarketVo>> purchasingList(int page, String purchaseName, int status, String st, String et, String ct) {
PageInfo pageInfo = new PageInfo();
LocalDateTime now = LocalDateTime.now();
HashMap<String, Object> map = goblinMongoUtils.getStoreMarketList(page, purchaseName, status, st, et, ct);
pageInfo.setList((List) map.get("data"));
List<GoblinStoreMarketVo> list = (List<GoblinStoreMarketVo>) map.get("data");
for (GoblinStoreMarketVo item : list) {
if (LocalDateTime.parse(item.getStartTime(), DTF_YMD_HMS).isAfter(now)) {
item.setStatus(0);
} else if (LocalDateTime.parse(item.getEndTime(), DTF_YMD_HMS).isBefore(now)) {
item.setStatus(2);
} else {
item.setStatus(1);
}
}
pageInfo.setList(list);
pageInfo.setTotal((Long) map.get("total"));
return ResponseDto.success(pageInfo);
}
......
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