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

Commit 547a10be authored by 张国柄's avatar 张国柄

~JOB:商城:商铺活动开启关闭;

parent da6daf38
......@@ -4,15 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.common.cache.redis.util.AbstractRedisUtil;
import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponBasicVo;
import com.liquidnet.service.goblin.entity.GoblinStoreCoupon;
import com.liquidnet.service.goblin.mapper.GoblinGoodsSkuMapper;
import com.liquidnet.service.goblin.mapper.GoblinStoreCouponMapper;
import com.liquidnet.service.platform.utils.GoblinRedisUtils;
import com.mongodb.client.result.UpdateResult;
......@@ -45,20 +41,22 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou
queryWrapper.eq(GoblinStoreCoupon::getState, "0");
queryWrapper.le(GoblinStoreCoupon::getStartTime, now);
List<GoblinStoreCoupon> storeCouponList = this.list(queryWrapper);
if (!CollectionUtils.isEmpty(storeCouponList)) {
List<String> storeCouponIdList = storeCouponList.stream().map(GoblinStoreCoupon::getStoreCouponId).collect(Collectors.toList());
List<GoblinStoreCoupon> storeCouponList = null;
try {
storeCouponList = this.list(queryWrapper);
if (!CollectionUtils.isEmpty(storeCouponList)) {
List<String> storeCouponIdList = storeCouponList.stream().map(GoblinStoreCoupon::getStoreCouponId).collect(Collectors.toList());
LambdaUpdateWrapper<GoblinStoreCoupon> updateWrapper = Wrappers.lambdaUpdate(GoblinStoreCoupon.class);
updateWrapper.eq(GoblinStoreCoupon::getDelFlg, "0");
updateWrapper.eq(GoblinStoreCoupon::getState, "0");
updateWrapper.in(GoblinStoreCoupon::getStoreCouponId, storeCouponIdList);
LambdaUpdateWrapper<GoblinStoreCoupon> updateWrapper = Wrappers.lambdaUpdate(GoblinStoreCoupon.class);
updateWrapper.eq(GoblinStoreCoupon::getDelFlg, "0");
updateWrapper.eq(GoblinStoreCoupon::getState, "0");
updateWrapper.in(GoblinStoreCoupon::getStoreCouponId, storeCouponIdList);
updateWrapper.set(GoblinStoreCoupon::getState, "1");
updateWrapper.set(GoblinStoreCoupon::getUpdatedAt, now);
updateWrapper.set(GoblinStoreCoupon::getUpdatedBy, "task");
if (this.update(updateWrapper)) {
try {
updateWrapper.set(GoblinStoreCoupon::getState, "1");
updateWrapper.set(GoblinStoreCoupon::getUpdatedAt, now);
updateWrapper.set(GoblinStoreCoupon::getUpdatedBy, "task");
if (this.update(updateWrapper)) {
UpdateResult updateResult = mongoTemplate.getCollection(GoblinStoreCouponBasicVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("delFlg").is("0").and("state").is("0").and("storeCouponId").in(storeCouponIdList)).getQueryObject(),
Update.update("state", "1").set("updatedAt", now).set("updatedBy", "task").getUpdateObject()
......@@ -77,10 +75,10 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou
});
return storeCouponList.size();
}
} catch (Exception e) {
log.error("###商铺活动:优惠券处理异常[now={},storeCouponList={}]", now, JsonUtils.toJson(storeCouponIdList), e);
}
}
} catch (Exception e) {
log.error("###商铺活动:优惠券处理异常[now={},storeCouponList.size={}]", now, null == storeCouponList ? -1 : storeCouponList.size(), e);
}
return 0;
}
......@@ -91,20 +89,21 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou
queryWrapper.eq(GoblinStoreCoupon::getState, "1");
queryWrapper.le(GoblinStoreCoupon::getEndTime, now);
List<GoblinStoreCoupon> storeCouponList = this.list(queryWrapper);
if (!CollectionUtils.isEmpty(storeCouponList)) {
List<String> storeCouponIdList = storeCouponList.stream().map(GoblinStoreCoupon::getStoreCouponId).collect(Collectors.toList());
List<GoblinStoreCoupon> storeCouponList = null;
try {
storeCouponList = this.list(queryWrapper);
if (!CollectionUtils.isEmpty(storeCouponList)) {
List<String> storeCouponIdList = storeCouponList.stream().map(GoblinStoreCoupon::getStoreCouponId).collect(Collectors.toList());
LambdaUpdateWrapper<GoblinStoreCoupon> updateWrapper = Wrappers.lambdaUpdate(GoblinStoreCoupon.class);
updateWrapper.eq(GoblinStoreCoupon::getDelFlg, "0");
updateWrapper.eq(GoblinStoreCoupon::getState, "1");
updateWrapper.in(GoblinStoreCoupon::getStoreCouponId, storeCouponIdList);
LambdaUpdateWrapper<GoblinStoreCoupon> updateWrapper = Wrappers.lambdaUpdate(GoblinStoreCoupon.class);
updateWrapper.eq(GoblinStoreCoupon::getDelFlg, "0");
updateWrapper.eq(GoblinStoreCoupon::getState, "1");
updateWrapper.in(GoblinStoreCoupon::getStoreCouponId, storeCouponIdList);
updateWrapper.set(GoblinStoreCoupon::getState, "2");
updateWrapper.set(GoblinStoreCoupon::getUpdatedAt, now);
updateWrapper.set(GoblinStoreCoupon::getUpdatedBy, "task");
if (this.update(updateWrapper)) {
try {
updateWrapper.set(GoblinStoreCoupon::getState, "2");
updateWrapper.set(GoblinStoreCoupon::getUpdatedAt, now);
updateWrapper.set(GoblinStoreCoupon::getUpdatedBy, "task");
if (this.update(updateWrapper)) {
UpdateResult updateResult = mongoTemplate.getCollection(GoblinStoreCouponBasicVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("delFlg").is("0").and("state").is("1").and("storeCouponId").in(storeCouponIdList)).getQueryObject(),
Update.update("state", "2").set("updatedAt", now).set("updatedBy", "task").getUpdateObject()
......@@ -123,10 +122,10 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou
});
return storeCouponList.size();
}
} catch (Exception e) {
log.error("###商铺活动:优惠券处理异常[now={},storeCouponList={}]", now, JsonUtils.toJson(storeCouponIdList));
}
}
} catch (Exception e) {
log.error("###商铺活动:优惠券处理异常[now={},storeCouponList.size={}]", now, null == storeCouponList ? -1 : storeCouponList.size(), e);
}
return 0;
}
......
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