Skip to content

Commit

Permalink
feat:类型不选择时预约最近的门店
Browse files Browse the repository at this point in the history
  • Loading branch information
oddfar committed Aug 19, 2023
1 parent ef26997 commit 8e2373c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 25 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ build/

~/
### mac ###
.DS_Store
.DS_Store

.flattened-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,15 @@ public R sendCode(String mobile, String deviceId) {
@PreAuthorize("@ss.resourceAuth()")
public R reservation(String mobile) {
IUser user = iUserMapper.selectById(mobile);
if (user == null || StringUtils.isEmpty(user.getItemCode())) {
return R.error("用户不存在或配置不对");
} else {
imtService.reservation(user);
return R.ok();
if (user == null) {
return R.error("用户不存在");
}
if (StringUtils.isEmpty(user.getItemCode())) {
return R.error("商品预约code为空");
}

imtService.reservation(user);
return R.ok();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class IUser extends BaseEntity {
private String randomMinute;

/**
* 类型
* 类型(1:预约本市出货量最大的门店,2:预约你的位置附近门店)
*/
private int shopType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ default PageResult<IUser> selectPage(IUser iUser, Long userId) {

default List<IUser> selectReservationUser() {
return selectList(new LambdaQueryWrapperX<IUser>()
// .gt(IUser::getExpireTime, new Date())
.ne(IUser::getLat, "")
.ne(IUser::getLng, "")
.ne(IUser::getShopType, "")
.ne(IUser::getItemCode, "")
// .gt(IUser::getExpireTime, new Date())
.ne(IUser::getLat, "")
.ne(IUser::getLng, "")
.ne(IUser::getItemCode, "")
.isNotNull(IUser::getItemCode)

);

Expand All @@ -57,12 +57,12 @@ default List<IUser> selectReservationUser() {
*/
default List<IUser> selectReservationUserByMinute(int minute) {
return selectList(new LambdaQueryWrapperX<IUser>()
.eq(IUser::getMinute, minute)
// .gt(IUser::getExpireTime, new Date())
.ne(IUser::getLat, "")
.ne(IUser::getLng, "")
.ne(IUser::getShopType, "")
.ne(IUser::getItemCode, "")
.eq(IUser::getMinute, minute)
// .gt(IUser::getExpireTime, new Date())
.ne(IUser::getLat, "")
.ne(IUser::getLng, "")
.ne(IUser::getItemCode, "")
.isNotNull(IUser::getItemCode)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ public void refreshItem() {

@Override
public IShop selectByIShopId(String iShopId) {
return iShopMapper.selectOne(IShop::getIShopId,iShopId);
List<IShop> iShopList = iShopMapper.selectList("i_shop_id", iShopId);
if (iShopList != null && iShopList.size() > 0) {
return iShopList.get(0);
} else {
return null;
}
// return iShopMapper.selectOne(IShop::getIShopId, iShopId);
}

@Override
Expand Down Expand Up @@ -198,15 +204,18 @@ public String getShopId(int shopType, String itemId, String province, String cit
//本市没有则预约本省最近的
shopId = getMinDistanceShopId(list, province, lat, lng);
}
}

if (shopType == 2) {
// 预约本省距离最近的门店
} else {
//预约本省距离最近的门店
shopId = getMinDistanceShopId(list, province, lat, lng);
}

if (StringUtils.isEmpty(shopId)){
// if (shopType == 2) {
// // 预约本省距离最近的门店
// shopId = getMinDistanceShopId(list, province, lat, lng);
// }

if (StringUtils.isEmpty(shopId)) {
throw new ServiceException("申购时根据类型获取的门店商品id为空");
}


Expand Down
1 change: 0 additions & 1 deletion vue_campus_admin/src/views/imt/user/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ export default {
address: null,
lat: null,
lng: null,
shopType: null,
jsonResult: null,
createTime: null,
minute: 5,
Expand Down

0 comments on commit 8e2373c

Please sign in to comment.