Commit 957d6d1e by 林永健

refactor(service): 优化日期格式化和集合判空逻辑

- 使用DateUtil工具类替代原生日期格式化方法
- 引入DatePattern常量统一日期时间格式
- 使用CollectionUtils工具类替代手动集合判空检查
- 提高代码可读性和维护性
1 parent 5a20aefd
...@@ -17,6 +17,8 @@ import cn.com.glsx.merchants.model.request.MerchantOpenRequest; ...@@ -17,6 +17,8 @@ import cn.com.glsx.merchants.model.request.MerchantOpenRequest;
import cn.com.glsx.merchants.model.response.MerchantResponse; import cn.com.glsx.merchants.model.response.MerchantResponse;
import cn.com.glsx.merchants.remote.MerchantRemote; import cn.com.glsx.merchants.remote.MerchantRemote;
import cn.com.glsx.scrm.equity.enums.DeleteFlagEnum; import cn.com.glsx.scrm.equity.enums.DeleteFlagEnum;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -348,7 +350,8 @@ public class MarketingActivityService { ...@@ -348,7 +350,8 @@ public class MarketingActivityService {
activity.setUpdatedDate(new Date()); activity.setUpdatedDate(new Date());
marketingActivityMapper.updateByPrimaryKeySelective(activity); marketingActivityMapper.updateByPrimaryKeySelective(activity);
saveExtendLog(activity.getId(), activity.getUpdatedBy(), activity.getUpdatedBy(), cn.hutool.core.date.DateUtil.formatDateTime(newEndTime)); String dataFormat = DateUtil.format(newEndTime, DatePattern.NORM_DATETIME_MINUTE_FORMATTER);
saveExtendLog(activity.getId(), activity.getUpdatedBy(), activity.getUpdatedBy(), dataFormat);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
......
...@@ -84,7 +84,7 @@ public class MarketingGoodsService { ...@@ -84,7 +84,7 @@ public class MarketingGoodsService {
} }
public List<GoodsStoreRespDTO> stores(GoodsStoreReqDTO request) { public List<GoodsStoreRespDTO> stores(GoodsStoreReqDTO request) {
if (request.getMerchantIds() == null || request.getMerchantIds().isEmpty()) { if (CollectionUtils.isEmpty(request.getMerchantIds())) {
return Collections.emptyList(); return Collections.emptyList();
} }
return marketingGoodsQueryMapper.findStores(request); return marketingGoodsQueryMapper.findStores(request);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!