|
@@ -2,9 +2,8 @@ package com.iotechn.unimall.admin.api.tourism.impl;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
-import com.iotechn.unimall.data.domain.DishClassifyInfo;
|
|
|
-import com.iotechn.unimall.data.domain.FoodInfo;
|
|
|
-import com.iotechn.unimall.data.domain.NoticeMessageInfo;
|
|
|
+import com.iotechn.unimall.data.domain.*;
|
|
|
+import com.iotechn.unimall.data.mapper.CommonUserInfoMapper;
|
|
|
import com.iotechn.unimall.data.mapper.NoticeMessageInfoMapper;
|
|
|
import org.apache.ibatis.session.RowBounds;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -16,7 +15,6 @@ import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
|
import com.iotechn.unimall.core.exception.ServiceException;
|
|
|
import com.iotechn.unimall.data.util.ExcelUtil;
|
|
|
import com.iotechn.unimall.data.mapper.HomestayInfoMapper;
|
|
|
-import com.iotechn.unimall.data.domain.HomestayInfo;
|
|
|
import com.iotechn.unimall.admin.api.tourism.IHomestayInfoService;
|
|
|
import com.iotechn.unimall.data.model.Page;
|
|
|
import java.util.Date;
|
|
@@ -34,13 +32,24 @@ public class HomestayInfoServiceImpl implements IHomestayInfoService{
|
|
|
private HomestayInfoMapper homestayInfoMapper;
|
|
|
@Autowired
|
|
|
private NoticeMessageInfoMapper noticeMessageInfoMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private CommonUserInfoMapper commonUserInfoMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean add(HomestayInfo homestayInfo) throws ServiceException {
|
|
|
Date now = new Date();
|
|
|
homestayInfo.setGmtCreate(now);
|
|
|
homestayInfo.setGmtUpdate(now);
|
|
|
homestayInfo.setStatus("审核中");
|
|
|
+ CommonUserInfo commonUserInfo=commonUserInfoMapper.selectById(homestayInfo.getCommonId());
|
|
|
+ if (commonUserInfo!=null){
|
|
|
+ if ("1".equals(homestayInfo.getType())){
|
|
|
+ commonUserInfo.setHomeEntry(commonUserInfo.getHomeEntry()+1);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ commonUserInfo.setHotelEntry(commonUserInfo.getHotelEntry()+1);
|
|
|
+ }
|
|
|
+ }
|
|
|
return homestayInfoMapper.insert(homestayInfo)>0;
|
|
|
}
|
|
|
|
|
@@ -92,6 +101,15 @@ public class HomestayInfoServiceImpl implements IHomestayInfoService{
|
|
|
if(tmp != null){
|
|
|
tmp.setDeleteFlag(1l);
|
|
|
homestayInfoMapper.updateById(tmp);
|
|
|
+ CommonUserInfo commonUserInfo=commonUserInfoMapper.selectById(tmp.getCommonId());
|
|
|
+ if (commonUserInfo!=null){
|
|
|
+ if ("1".equals(tmp.getType())){
|
|
|
+ commonUserInfo.setHomeEntry(commonUserInfo.getHomeEntry()-1);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ commonUserInfo.setHotelEntry(commonUserInfo.getHotelEntry()-1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return true;
|