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

Commit a5c02246 authored by GaoHu's avatar GaoHu

exit

parent 7f19ae1f
......@@ -79,6 +79,7 @@ public class GoblinGoodsAnticipateVo implements Serializable {
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime updateDate;
/**
......
......@@ -167,8 +167,17 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
@Override
public ResponseDto<Object> delete(String antId) {
//mysql删除
LinkedList<Object[]> sqlValue = CollectionUtil.linkedListObjectArr();
sqlValue.add(new Object[]{
antId
});
//预约库删除
sendRedis("goblin_goods_anticipate_delete",sqlValue);
//预约关联库删除
sendRedis("goblin_goods_anticipate_value_delete",sqlValue);
//删除mongodb
if (goblinMongoUtils.delGoodsAnticipteVo(antId)) {
if (goblinMongoUtils.delGoodsAnticipateVo(antId)) {
return ResponseDto.success();
}
log.error("delete() antId:{}", antId);
......
......@@ -5,6 +5,7 @@ import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinGoodsAnticipateValueVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
......@@ -102,16 +103,24 @@ public class GoblinMongoUtils {
* 根据antId修改 预约人数
*/
public void updateGoblinGoodsAnticipateVo(GoblinGoodsAnticipateUpdateParam goodsAnticipateUpdateParam) {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
Query query = Query.query(Criteria.where("antId").is(goodsAnticipateUpdateParam.getAutId()));
Update update = new Update().set("name", goodsAnticipateUpdateParam.getName()).set("rule", goodsAnticipateUpdateParam.getRule()).set("updateDate", df.format(LocalDateTime.now()));
Update update = new Update().set("name", goodsAnticipateUpdateParam.getName()).set("rule", goodsAnticipateUpdateParam.getRule()).set("updateDate",LocalDateTime.now());
mongoTemplate.updateFirst(query, update, GoblinGoodsAnticipateVo.class.getSimpleName());
}
/**
* 根据amtId删除VO
*/
public boolean delGoodsAnticipteVo(String antId) {
public boolean delGoodsAnticipateVo(String antId) {
//查询该预约下有多少个开启预约的skuId
GoblinGoodsAnticipateVo anticipateVo = getAnticipateVo(antId);
List<GoblinGoodsAnticipateValueVo> goodsAnticipateValues = anticipateVo.getGoodsAnticipateValues();
if (goodsAnticipateValues!=null && goodsAnticipateValues.size()>0){
goodsAnticipateValues.forEach(goblinGoodsAnticipateValueVo -> {
redisUtils.delGoodsAnticipateVo(goblinGoodsAnticipateValueVo.getSkuId());
});
}
redisUtils.delGoodsAnticipateVo(antId);
Query query = Query.query(Criteria.where("antId").is(antId));
return mongoTemplate.remove(query, GoblinGoodsAnticipateVo.class.getSimpleName()).getDeletedCount() > 0;
}
......@@ -119,11 +128,19 @@ public class GoblinMongoUtils {
/**
* 根据用户预约
*/
public void delGoodsAnticipteUserVo(String uid,String skuId) {
public void delGoodsAnticipateUserVo(String uid,String skuId) {
Query query = Query.query(Criteria.where("uid").is(uid).and("skuId").is(skuId));
mongoTemplate.remove(query, GoblinGoodsAnticipateVo.class.getSimpleName()).getDeletedCount();
}
/**
* 根据预约ID获取预约详情
*/
public GoblinGoodsAnticipateVo getAnticipateVo(String autId) {
return mongoTemplate.findOne(Query.query(Criteria.where("autId").is(autId)),
GoblinGoodsAnticipateVo.class, GoblinGoodsAnticipateVo.class.getSimpleName());
}
/* ---------------------------------------- 平台分类数据源 ---------------------------------------- */
......
......@@ -44,6 +44,9 @@ public class GoblinRedisUtils {
/* ---------------------------------------- 预约相关 ---------------------------------------- */
/**
* 该skuId已开启预约
*/
public void setAnticipate(String skuId){
redisUtil.set(GoblinRedisConst.ANTICIPATE_SKUID.concat(skuId),1);
}
......@@ -64,7 +67,7 @@ public class GoblinRedisUtils {
* 删除用户预约
*/
public void delUserAboutSku(String skuId, String uid) {
goblinMongoUtils.delGoodsAnticipteUserVo(uid, skuId);
goblinMongoUtils.delGoodsAnticipateUserVo(uid, skuId);
redisUtil.del(GoblinRedisConst.USER_ANTICIPATE_STATE.concat(skuId).concat(uid));
}
......@@ -81,6 +84,13 @@ public class GoblinRedisUtils {
}
}
/**
* 删除预约
*/
public void delGoodsAnticipateVo(String skuId) {
redisUtil.del(GoblinRedisConst.ANTICIPATE_SKUID.concat(skuId));
}
/* ---------------------------------------- sku库存相关 ---------------------------------------- */
public void setSkuStock(String marketPre, String skuId, Integer stock) {
String rk = GoblinRedisConst.REAL_STOCK_SKU;
......
......@@ -135,7 +135,9 @@ goblin_user_digital_artwork.update_for_unboxing=UPDATE goblin_user_digital_artwo
#----
#---- \u9884\u7EA6
goblin_goods_anticipate=INSERT INTO goblin_goods_anticipate(ant_id,`name`,`rule`,actual_people,about_start_date,about_end_date,created_date,del_tag) VALUES(?,?,?,0,?,?,NOW(),0)
goblin_goods_anticipate_delete=UPDATE goblin_goods_anticipate SET `del_tag` = 1 WHERE ant_id = ?
goblin_goods_anticipate_value=INSERT INTO goblin_goods_anticipate_value (ant_id,sku_name,sku_id,spu_id,about_start_date,about_end_date,created_date,del_tag) VALUES(?,?,?,?,?,?,NOW(),0)
goblin_goods_anticipate_value_delete=UPDATE goblin_goods_anticipate_value SET `del_tag` = 1 WHERE ant_id = ?
goblin_goods_anticipate_update=UPDATE goblin_goods_anticipate SET `name` = ?,`rule`= ? WHERE ant_id = ?
goblin_goods_anticipate_update_proper=UPDATE goblin_goods_anticipate SET about_people = ? WHERE ant_id = ?
goblin_goods_anticipate_user=INSERT INTO goblin_goods_anticipate_user(uid,sku_id,phone,state) VALUES(?,?,?,?)
......
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