Skip to content

Commit

Permalink
fix:门店缓存数据重复加入
Browse files Browse the repository at this point in the history
feat:批量插入
  • Loading branch information
oddfar committed Aug 31, 2023
1 parent 8e2373c commit 0108ed1
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 27 deletions.
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,20 @@ i茅台app,每日自动预约茅台

<img src="https://note.oddfar.com/img/my-wechat.jpg" alt="wechat" style="height:280px;" />

## 拓展

以下是各位大佬拓展了本项目

- https://github.com/Abeiheng/iimaotai

1.限制注册用户的新增小茅用户额度 2.修改小茅用户信息面板美化 3.删除注册用户,一并删除二级用户创建的小茅用户

- https://github.com/wuhbin/imaotai/tree/20230805

增加查询每日申购结果定时任务

## 贡献代码

若您有好的想法,发现一些 **BUG** 并修复了,欢迎提交 **Pull Request** 参与开源贡献

发起 pull request 请求,提交到 master 分支,等待作者合并

## 友情链接

- 葫芦娃项目

yize8888-maotai: https://github.com/yize8888/maotai

## 演示图

| i茅台预约 | |
Expand All @@ -76,9 +72,6 @@ i茅台app,每日自动预约茅台
| ![image-20230707144703842](.github/image-20230707144703842.png) | ![image-20230707145525709](.github/image-20230707145525709.png) |


## 友情链接

yize8888-maotai: https://github.com/yize8888/maotai

## 声明

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public interface IMTService {
* @return
*/
void getTravelReward(IUser iUser);
//
// /**
// * 获取累计申购奖励
// * @param iUser
// */
// void getCumulatively(IUser iUser);

/**
* 批量预约
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.oddfar.campus.business.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.oddfar.campus.business.domain.IMTItemInfo;
import com.oddfar.campus.business.entity.IShop;

import java.util.List;

public interface IShopService {
public interface IShopService extends IService<IShop> {

List<IShop> selectShopList();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.oddfar.campus.business.service.impl;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.Method;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONException;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.oddfar.campus.business.domain.IMTItemInfo;
import com.oddfar.campus.business.domain.MapPoint;
import com.oddfar.campus.business.entity.IItem;
Expand All @@ -32,7 +32,7 @@
import java.util.stream.Collectors;

@Service
public class IShopServiceImpl implements IShopService {
public class IShopServiceImpl extends ServiceImpl<IShopMapper, IShop> implements IShopService {

private static final Logger logger = LoggerFactory.getLogger(IShopServiceImpl.class);

Expand All @@ -47,18 +47,17 @@ public class IShopServiceImpl implements IShopService {
@Override
public List<IShop> selectShopList() {

List<IShop> shopList = Convert.toList(IShop.class, redisCache.getCacheList("mt_shop_list"));
List<IShop> shopList = redisCache.getCacheList("mt_shop_list");

if (ObjectUtil.isNotEmpty(shopList)) {
if (shopList != null && shopList.size() > 0) {
return shopList;
}
shopList = iShopMapper.selectList();
if (ObjectUtil.isEmpty(shopList)) {
}else {
refreshShop();
shopList = iShopMapper.selectList();
}

redisCache.setCacheList("mt_shop_list", shopList);
shopList = iShopMapper.selectList();


return shopList;
}

Expand All @@ -80,12 +79,15 @@ public void refreshShop() {

JSONObject jsonObject = JSONObject.parseObject(s);
Set<String> shopIdSet = jsonObject.keySet();

List<IShop> list = new ArrayList<>();
for (String iShopId : shopIdSet) {
JSONObject shop = jsonObject.getJSONObject(iShopId);
IShop iShop = new IShop(iShopId, shop);
iShopMapper.insert(iShop);
// iShopMapper.insert(iShop);
list.add(iShop);
}
this.saveBatch(list);
redisCache.setCacheList("mt_shop_list", list);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</modules>

<properties>
<revision>1.0.7</revision>
<revision>1.0.8</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<bitwalker.version>1.21</bitwalker.version>
Expand Down
2 changes: 1 addition & 1 deletion vue_campus_admin/src/views/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
data() {
return {
// 版本号
version: "1.0.7",
version: "1.0.8",
};
},
methods: {
Expand Down

0 comments on commit 0108ed1

Please sign in to comment.