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

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

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

parent da6daf38
...@@ -4,15 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -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.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto; import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponBasicVo; import com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponBasicVo;
import com.liquidnet.service.goblin.entity.GoblinStoreCoupon; 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.goblin.mapper.GoblinStoreCouponMapper;
import com.liquidnet.service.platform.utils.GoblinRedisUtils; import com.liquidnet.service.platform.utils.GoblinRedisUtils;
import com.mongodb.client.result.UpdateResult; import com.mongodb.client.result.UpdateResult;
...@@ -45,7 +41,9 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou ...@@ -45,7 +41,9 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou
queryWrapper.eq(GoblinStoreCoupon::getState, "0"); queryWrapper.eq(GoblinStoreCoupon::getState, "0");
queryWrapper.le(GoblinStoreCoupon::getStartTime, now); queryWrapper.le(GoblinStoreCoupon::getStartTime, now);
List<GoblinStoreCoupon> storeCouponList = this.list(queryWrapper); List<GoblinStoreCoupon> storeCouponList = null;
try {
storeCouponList = this.list(queryWrapper);
if (!CollectionUtils.isEmpty(storeCouponList)) { if (!CollectionUtils.isEmpty(storeCouponList)) {
List<String> storeCouponIdList = storeCouponList.stream().map(GoblinStoreCoupon::getStoreCouponId).collect(Collectors.toList()); List<String> storeCouponIdList = storeCouponList.stream().map(GoblinStoreCoupon::getStoreCouponId).collect(Collectors.toList());
...@@ -57,8 +55,8 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou ...@@ -57,8 +55,8 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou
updateWrapper.set(GoblinStoreCoupon::getState, "1"); updateWrapper.set(GoblinStoreCoupon::getState, "1");
updateWrapper.set(GoblinStoreCoupon::getUpdatedAt, now); updateWrapper.set(GoblinStoreCoupon::getUpdatedAt, now);
updateWrapper.set(GoblinStoreCoupon::getUpdatedBy, "task"); updateWrapper.set(GoblinStoreCoupon::getUpdatedBy, "task");
if (this.update(updateWrapper)) { if (this.update(updateWrapper)) {
try {
UpdateResult updateResult = mongoTemplate.getCollection(GoblinStoreCouponBasicVo.class.getSimpleName()).updateMany( UpdateResult updateResult = mongoTemplate.getCollection(GoblinStoreCouponBasicVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("delFlg").is("0").and("state").is("0").and("storeCouponId").in(storeCouponIdList)).getQueryObject(), 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() Update.update("state", "1").set("updatedAt", now).set("updatedBy", "task").getUpdateObject()
...@@ -77,10 +75,10 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou ...@@ -77,10 +75,10 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou
}); });
return storeCouponList.size(); 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; return 0;
} }
...@@ -91,7 +89,9 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou ...@@ -91,7 +89,9 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou
queryWrapper.eq(GoblinStoreCoupon::getState, "1"); queryWrapper.eq(GoblinStoreCoupon::getState, "1");
queryWrapper.le(GoblinStoreCoupon::getEndTime, now); queryWrapper.le(GoblinStoreCoupon::getEndTime, now);
List<GoblinStoreCoupon> storeCouponList = this.list(queryWrapper); List<GoblinStoreCoupon> storeCouponList = null;
try {
storeCouponList = this.list(queryWrapper);
if (!CollectionUtils.isEmpty(storeCouponList)) { if (!CollectionUtils.isEmpty(storeCouponList)) {
List<String> storeCouponIdList = storeCouponList.stream().map(GoblinStoreCoupon::getStoreCouponId).collect(Collectors.toList()); List<String> storeCouponIdList = storeCouponList.stream().map(GoblinStoreCoupon::getStoreCouponId).collect(Collectors.toList());
...@@ -104,7 +104,6 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou ...@@ -104,7 +104,6 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou
updateWrapper.set(GoblinStoreCoupon::getUpdatedAt, now); updateWrapper.set(GoblinStoreCoupon::getUpdatedAt, now);
updateWrapper.set(GoblinStoreCoupon::getUpdatedBy, "task"); updateWrapper.set(GoblinStoreCoupon::getUpdatedBy, "task");
if (this.update(updateWrapper)) { if (this.update(updateWrapper)) {
try {
UpdateResult updateResult = mongoTemplate.getCollection(GoblinStoreCouponBasicVo.class.getSimpleName()).updateMany( UpdateResult updateResult = mongoTemplate.getCollection(GoblinStoreCouponBasicVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("delFlg").is("0").and("state").is("1").and("storeCouponId").in(storeCouponIdList)).getQueryObject(), 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() Update.update("state", "2").set("updatedAt", now).set("updatedBy", "task").getUpdateObject()
...@@ -123,10 +122,10 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou ...@@ -123,10 +122,10 @@ public class PlatformGoblinStoreCouponService extends ServiceImpl<GoblinStoreCou
}); });
return storeCouponList.size(); 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; 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