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

Commit bbd6dd56 authored by zhengfuxin's avatar zhengfuxin

修改秒杀

parent 3da7b275
...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil; import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.entity.GoblinGoods;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -29,16 +31,19 @@ public class GoblinFrontSelectGoodsParam implements Serializable { ...@@ -29,16 +31,19 @@ public class GoblinFrontSelectGoodsParam implements Serializable {
/** /**
* 商品id * 商品id
*/ */
@ApiModelProperty(value = "精选商品id")
private String selectGoodsId; private String selectGoodsId;
/** /**
* spu的 ids拼接 * spu的 ids拼接
*/ */
@ApiModelProperty(value = "spu的 ids拼接")
private String spuId; private String spuId;
/** /**
* 0未删除1已删除 * 0未删除1已删除
*/ */
@ApiModelProperty(value = "0未删除1已删除")
private Integer delTag; private Integer delTag;
/** /**
...@@ -55,7 +60,11 @@ public class GoblinFrontSelectGoodsParam implements Serializable { ...@@ -55,7 +60,11 @@ public class GoblinFrontSelectGoodsParam implements Serializable {
/** /**
* 1、上架时间2、销量3、价格高到低4、价格低到高 * 1、上架时间2、销量3、价格高到低4、价格低到高
*/ */
@ApiModelProperty(value = "1、上架时间2、销量3、价格高到低4、价格低到高")
private int orderType; private int orderType;
@ApiModelProperty(value = "spu信息")
private GoblinGoods goblinGoods;
} }
...@@ -69,11 +69,11 @@ public class GoblinFrontSeckillController extends BaseController { ...@@ -69,11 +69,11 @@ public class GoblinFrontSeckillController extends BaseController {
return AjaxResult.success(list); return AjaxResult.success(list);
} }
/** /* *//**
* @author zhangfuxin * @author zhangfuxin
* @Description:限时秒杀添加 * @Description:限时秒杀添加
* @date 2021/12/29 下午2:51 * @date 2021/12/29 下午2:51
*/ *//*
@PostMapping("create") @PostMapping("create")
@ApiOperation(value = "增加秒杀") @ApiOperation(value = "增加秒杀")
@ResponseBody @ResponseBody
...@@ -88,21 +88,21 @@ public class GoblinFrontSeckillController extends BaseController { ...@@ -88,21 +88,21 @@ public class GoblinFrontSeckillController extends BaseController {
return error("操作失败"); return error("操作失败");
} }
} }
*/
/** /**
* @author zhangfuxin * @author zhangfuxin
* @Description:限时秒杀修改 * @Description:限时秒杀修改
* @date 2021/12/29 下午2:52 * @date 2021/12/29 下午2:52
*/ */
@PostMapping("update") @PostMapping("updateOrCreate")
@ApiOperation(value = "限时秒杀修改") @ApiOperation(value = "限时秒杀修改或者增加")
@ResponseBody @ResponseBody
public AjaxResult update( @RequestBody GoblinFrontSeckillBuildParam goblinFrontSeckillBuildParam) { public AjaxResult updateOrCreate( @RequestBody GoblinFrontSeckillBuildParam goblinFrontSeckillBuildParam) {
GoblinFrontSeckill goblinFrontSeckill=new GoblinFrontSeckill(); GoblinFrontSeckill goblinFrontSeckill=new GoblinFrontSeckill();
BeanUtils.copyProperties(goblinFrontSeckillBuildParam,goblinFrontSeckill); BeanUtils.copyProperties(goblinFrontSeckillBuildParam,goblinFrontSeckill);
logger.info("限时秒杀修改{}", JSON.toJSONString(goblinFrontSeckill)); logger.info("限时秒杀修改{}", JSON.toJSONString(goblinFrontSeckill));
boolean result=goblinFrontSeckillService.update(goblinFrontSeckill); boolean result=goblinFrontSeckillService.updateOrCreate(goblinFrontSeckill);
if (result ) { if (result ) {
return success("操作成功"); return success("操作成功");
} else { } else {
...@@ -135,8 +135,8 @@ public class GoblinFrontSeckillController extends BaseController { ...@@ -135,8 +135,8 @@ public class GoblinFrontSeckillController extends BaseController {
* @Description:限时秒杀分页 * @Description:限时秒杀分页
* @date 2021/12/29 下午2:52 * @date 2021/12/29 下午2:52
*/ */
@PostMapping("page") @PostMapping("list")
@ApiOperation(value = "分页") @ApiOperation(value = "list")
@ResponseBody @ResponseBody
//@RequestParam(name = "pageSize", required = true) int pageSize,@RequestParam(name = "pageNumber", required = true)int pageNumber,@RequestBody GoblinFrontSeckillBuildParam goblinFrontSeckillBuildParam //@RequestParam(name = "pageSize", required = true) int pageSize,@RequestParam(name = "pageNumber", required = true)int pageNumber,@RequestBody GoblinFrontSeckillBuildParam goblinFrontSeckillBuildParam
public AjaxResult page( ) { public AjaxResult page( ) {
......
...@@ -45,7 +45,7 @@ public class GoblinFrontSelectGoodsController extends BaseController { ...@@ -45,7 +45,7 @@ public class GoblinFrontSelectGoodsController extends BaseController {
* @date 2022/1/4 下午2:46 * @date 2022/1/4 下午2:46
*/ */
@GetMapping("goodsList") @GetMapping("goodsList")
@ApiOperation(value = "商品列表") @ApiOperation(value = "商品列表,type(1、上架时间2、销量3、价格高到低4、价格低到高)")
@ResponseBody @ResponseBody
public AjaxResult goodsList(@RequestParam(name = "type", required = false) String type) { public AjaxResult goodsList(@RequestParam(name = "type", required = false) String type) {
LambdaQueryWrapper<GoblinGoods> queryWrapper = Wrappers.lambdaQuery(GoblinGoods.class); LambdaQueryWrapper<GoblinGoods> queryWrapper = Wrappers.lambdaQuery(GoblinGoods.class);
......
...@@ -66,10 +66,16 @@ public class GoblinFrontSeckillServiceImpl extends ServiceImpl<GoblinFrontSeckil ...@@ -66,10 +66,16 @@ public class GoblinFrontSeckillServiceImpl extends ServiceImpl<GoblinFrontSeckil
* @Description: 修改 * @Description: 修改
* @date 2021/12/27 下午4:03 * @date 2021/12/27 下午4:03
*/ */
public boolean update(GoblinFrontSeckill goblinFrontSeckill){ public boolean updateOrCreate(GoblinFrontSeckill goblinFrontSeckill){
goblinFrontSeckill.setUpdateTime(LocalDateTime.now()); if(goblinFrontSeckill.getMid()>0){
//数据库修改 goblinFrontSeckill.setUpdateTime(LocalDateTime.now());
goblinFrontSeckillMapper.updateById(goblinFrontSeckill); //数据库修改
goblinFrontSeckillMapper.updateById(goblinFrontSeckill);
}else{
this.create(goblinFrontSeckill);
}
/* //修改所有的展示形式 /* //修改所有的展示形式
UpdateWrapper updateWrapper = new UpdateWrapper(); UpdateWrapper updateWrapper = new UpdateWrapper();
updateWrapper.set("activityType", goblinFrontSeckill.getActivityType()); updateWrapper.set("activityType", goblinFrontSeckill.getActivityType());
...@@ -85,7 +91,9 @@ public class GoblinFrontSeckillServiceImpl extends ServiceImpl<GoblinFrontSeckil ...@@ -85,7 +91,9 @@ public class GoblinFrontSeckillServiceImpl extends ServiceImpl<GoblinFrontSeckil
public boolean delte(Long id){ public boolean delte(Long id){
GoblinFrontSeckill goblinFrontSeckill=goblinFrontSeckillMapper.selectById(id); GoblinFrontSeckill goblinFrontSeckill=goblinFrontSeckillMapper.selectById(id);
goblinFrontSeckill.setDelTag(1); goblinFrontSeckill.setDelTag(1);
this.update(goblinFrontSeckill); goblinFrontSeckill.setUpdateTime(LocalDateTime.now());
//数据库修改
goblinFrontSeckillMapper.updateById(goblinFrontSeckill);
return true; return true;
} }
/** /**
......
...@@ -8,10 +8,13 @@ import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinFrontSelectGood ...@@ -8,10 +8,13 @@ import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinFrontSelectGood
import com.liquidnet.common.cache.redis.util.RedisGoblinUtil; import com.liquidnet.common.cache.redis.util.RedisGoblinUtil;
import com.liquidnet.commons.lang.util.IDGenerator; import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils; import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.entity.GoblinFrontSelectGoods; import com.liquidnet.service.goblin.entity.GoblinFrontSelectGoods;
import com.liquidnet.service.goblin.mapper.GoblinFrontSelectGoodsMapper; import com.liquidnet.service.goblin.mapper.GoblinFrontSelectGoodsMapper;
import com.liquidnet.service.goblin.param.GoblinFrontSelectGoodsParam;
import com.mongodb.BasicDBObject; import com.mongodb.BasicDBObject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
...@@ -75,7 +78,22 @@ public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSe ...@@ -75,7 +78,22 @@ public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSe
public List getList(){ public List getList(){
LambdaQueryWrapper<GoblinFrontSelectGoods> queryWrapper = Wrappers.lambdaQuery(GoblinFrontSelectGoods.class); LambdaQueryWrapper<GoblinFrontSelectGoods> queryWrapper = Wrappers.lambdaQuery(GoblinFrontSelectGoods.class);
queryWrapper.eq(GoblinFrontSelectGoods::getDelTag,0); queryWrapper.eq(GoblinFrontSelectGoods::getDelTag,0);
List<GoblinFrontSelectGoods> list= goblinFrontSelectGoodsMapper.selectList(queryWrapper);
for(GoblinFrontSelectGoods goblinFrontSelectGoods:list){
String spuids=goblinFrontSelectGoods.getSpuId();
if(StringUtil.isNotBlank(spuids)){
String[] spuIds=spuids.split(",");
}
GoblinFrontSelectGoodsParam goblinFrontSelectGoodsParam=new GoblinFrontSelectGoodsParam();
BeanUtils.copyProperties(goblinFrontSelectGoods,goblinFrontSelectGoodsParam);
}
return goblinFrontSelectGoodsMapper.selectList(queryWrapper); return goblinFrontSelectGoodsMapper.selectList(queryWrapper);
} }
public boolean online(){ public boolean online(){
//查询 //查询
......
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