|
|
|
@ -1,11 +1,21 @@ |
|
|
|
package org.jeecg.modules.api.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.aliyun.oss.OSS; |
|
|
|
import com.aliyun.oss.OSSClientBuilder; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import org.apache.commons.fileupload.FileItem; |
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.common.util.RedisUtil; |
|
|
|
import org.jeecg.config.shiro.ShiroRealm; |
|
|
|
import org.jeecg.modules.api.bean.HttpClientUtil; |
|
|
|
import org.jeecg.modules.api.bean.PageBean; |
|
|
|
import org.jeecg.modules.api.bean.WxQrCodeVo; |
|
|
|
import org.jeecg.modules.api.service.YaoDuApiService; |
|
|
|
import org.jeecg.modules.citiyClass.entity.CitiyClass; |
|
|
|
import org.jeecg.modules.citiyClass.service.ICitiyClassService; |
|
|
|
@ -22,6 +32,7 @@ import org.jeecg.modules.cityAddr.service.ICityAddrService; |
|
|
|
import org.jeecg.modules.cityAddressLog.service.ICityAddressLogService; |
|
|
|
import org.jeecg.modules.cityBanner.entity.CityBanner; |
|
|
|
import org.jeecg.modules.cityBanner.service.ICityBannerService; |
|
|
|
import org.jeecg.modules.cityComment.entity.CityComment; |
|
|
|
import org.jeecg.modules.cityComment.service.ICityCommentService; |
|
|
|
import org.jeecg.modules.cityConf.entity.CityConf; |
|
|
|
import org.jeecg.modules.cityConf.service.ICityConfService; |
|
|
|
@ -29,6 +40,8 @@ import org.jeecg.modules.cityHome.entity.CityHome; |
|
|
|
import org.jeecg.modules.cityHome.service.ICityHomeService; |
|
|
|
import org.jeecg.modules.cityIcon.entity.CityIcon; |
|
|
|
import org.jeecg.modules.cityIcon.service.ICityIconService; |
|
|
|
import org.jeecg.modules.cityJd.entity.CityJd; |
|
|
|
import org.jeecg.modules.cityJd.service.ICityJdService; |
|
|
|
import org.jeecg.modules.cityJob.entity.CityJob; |
|
|
|
import org.jeecg.modules.cityJob.service.ICityJobService; |
|
|
|
import org.jeecg.modules.cityPhoneLog.service.ICityPhoneLogService; |
|
|
|
@ -40,9 +53,18 @@ import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; |
|
|
|
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; |
|
|
|
import org.jeecg.modules.hanHaiMember.service.impl.HanHaiMemberServiceImpl; |
|
|
|
import org.jeecg.modules.webCase.entity.WebCase; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.http.HttpMethod; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.LinkedMultiValueMap; |
|
|
|
import org.springframework.util.MultiValueMap; |
|
|
|
import org.springframework.web.client.RestTemplate; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.*; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
@ -107,7 +129,25 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
|
//获取配置信息 |
|
|
|
@Resource |
|
|
|
private ICityConfService cityConfService; |
|
|
|
|
|
|
|
//获取景点信息 |
|
|
|
@Resource |
|
|
|
private ICityJdService cityJdService; |
|
|
|
@Value("${wechat.mpAppId}") |
|
|
|
private String appid; |
|
|
|
@Value("${wechat.mpAppSecret}") |
|
|
|
private String secret; |
|
|
|
@Value("${jeecg.oss.endpoint}") |
|
|
|
private String endpoint; |
|
|
|
@Value("${jeecg.oss.accessKey}") |
|
|
|
private String accessKey; |
|
|
|
@Value("${jeecg.oss.secretKey}") |
|
|
|
private String secretKey; |
|
|
|
@Value("${jeecg.oss.bucketName}") |
|
|
|
private String bucketName; |
|
|
|
|
|
|
|
//缓存 |
|
|
|
@Resource |
|
|
|
private RedisUtil redisUtil; |
|
|
|
|
|
|
|
//获取个人信息接口 |
|
|
|
@Override |
|
|
|
@ -155,12 +195,28 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
|
map.put("headImage",headImage.getKeyImage()); |
|
|
|
CityConf name = cityConfService.lambdaQuery().eq(CityConf::getKeyIcon, "name").one(); |
|
|
|
map.put("name",name.getKeyValue()); |
|
|
|
|
|
|
|
//获取客服二维码 |
|
|
|
CityConf kefu = cityConfService.lambdaQuery().eq(CityConf::getKeyIcon, "kefu").one(); |
|
|
|
map.put("kefu",kefu.getKeyImage()); |
|
|
|
map.put("details",kefu.getKeyValue()); |
|
|
|
|
|
|
|
//获取所有动态 |
|
|
|
Long count = cityTrendsService.lambdaQuery().count(); |
|
|
|
Long count = hanHaiMemberService.lambdaQuery().count(); |
|
|
|
Long count1 = cityTrendsService.lambdaQuery().count(); |
|
|
|
map.put("userNum",count); |
|
|
|
//获取用户人数 |
|
|
|
Long count1 = hanHaiMemberService.lambdaQuery().count(); |
|
|
|
map.put("num",count1); |
|
|
|
//租房信息数量 |
|
|
|
map.put("homeNum",cityHomeService.lambdaQuery().count()); |
|
|
|
//兼职信息数量 |
|
|
|
map.put("jobNum",cityJobService.lambdaQuery().count()); |
|
|
|
//门店信息数量 |
|
|
|
map.put("shopNum",cityShopService.lambdaQuery().count()); |
|
|
|
//活动信息数量 |
|
|
|
map.put("activityNum",cityActivityService.lambdaQuery().count()); |
|
|
|
//景点信息数量 |
|
|
|
map.put("jdNum",cityJdService.lambdaQuery().count()); |
|
|
|
return Result.OK(map); |
|
|
|
} |
|
|
|
|
|
|
|
@ -312,8 +368,14 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
|
|
|
|
|
//获取评论信息列表 |
|
|
|
@Override |
|
|
|
public Result<?> getCommentPage(PageBean pageBean){ |
|
|
|
return Result.OK(); |
|
|
|
public Result<?> getCommentPage(String orderId,String type,PageBean pageBean){ |
|
|
|
Page<CityComment> page = new Page<CityComment>(pageBean.getPageNo(), pageBean.getPageSize()); |
|
|
|
Page<CityComment> page1 = cityCommentService |
|
|
|
.lambdaQuery() |
|
|
|
.eq(CityComment::getOrderId,orderId) |
|
|
|
.orderByDesc(CityComment::getCreateTime) |
|
|
|
.page(page); |
|
|
|
return Result.OK(page1); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -326,6 +388,29 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
|
return Result.OK(list); |
|
|
|
} |
|
|
|
|
|
|
|
//获取景点列表带分页 |
|
|
|
@Override |
|
|
|
public Result<?> getScenicPage(PageBean pageBean){ |
|
|
|
Page<CityJd> page = new Page<CityJd>(pageBean.getPageNo(), pageBean.getPageSize()); |
|
|
|
Page<CityJd> page1 = cityJdService |
|
|
|
.lambdaQuery() |
|
|
|
.orderByDesc(CityJd::getCreateTime) |
|
|
|
.page(page); |
|
|
|
return Result.OK(page1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<?> getUserPage(PageBean pageBean){ |
|
|
|
Page<HanHaiMember> page = new Page<HanHaiMember>(pageBean.getPageNo(), pageBean.getPageSize()); |
|
|
|
Page<HanHaiMember> page1 = hanHaiMemberService |
|
|
|
.lambdaQuery() |
|
|
|
.orderByDesc(HanHaiMember::getCreateTime) |
|
|
|
.page(page); |
|
|
|
return Result.OK(page1); |
|
|
|
} |
|
|
|
|
|
|
|
//点击查看联系方式 类型 0帖子 1租房 2工作 3门店 |
|
|
|
@Override |
|
|
|
public Result<?> checkGivePhone(String token,String type, String id){ |
|
|
|
@ -358,10 +443,8 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
|
cityTrends.setCreateTime(new Date()); |
|
|
|
cityTrends.setSex(hanHaiMember.getSex()); |
|
|
|
cityTrends.setYearDate(hanHaiMember.getYearDate()); |
|
|
|
|
|
|
|
|
|
|
|
boolean save = cityTrendsService.save(cityTrends); |
|
|
|
return Result.OK("发布成功"); |
|
|
|
cityTrendsService.saveOrUpdate(cityTrends); |
|
|
|
return Result.OK("编辑成功"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -376,23 +459,318 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
|
@Override |
|
|
|
public Result<?> personalAuthentication(String token, CitiyUserAuthentication object){ |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
//查询该用户是否已有数据 |
|
|
|
CitiyUserAuthentication byId = cityUserAuthenticationService. |
|
|
|
lambdaQuery() |
|
|
|
.eq(CitiyUserAuthentication::getUserId,hanHaiMember.getId()) |
|
|
|
.one(); |
|
|
|
//有数据不要重复提交 |
|
|
|
if(byId!=null){ |
|
|
|
return Result.error("请勿重复提交"); |
|
|
|
} |
|
|
|
object.setUserId(hanHaiMember.getId()); |
|
|
|
object.setCreateTime(new Date()); |
|
|
|
cityUserAuthenticationService.save(object); |
|
|
|
return Result.OK("认证成功"); |
|
|
|
//修改用户实名状态 |
|
|
|
hanHaiMember.setIdCardOpen(0); |
|
|
|
hanHaiMemberService.updateById(hanHaiMember); |
|
|
|
return Result.OK("提交成功,等待审核"); |
|
|
|
} |
|
|
|
|
|
|
|
//企业认证 |
|
|
|
@Override |
|
|
|
public Result<?> companyAuthentication(String token, CitiyShopAuthentication object){ |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
//查询该用户是否已有数据 |
|
|
|
CitiyShopAuthentication byId = cityShopAuthenticationService. |
|
|
|
lambdaQuery() |
|
|
|
.eq(CitiyShopAuthentication::getUserId,hanHaiMember.getId()) |
|
|
|
.one(); |
|
|
|
if(byId!=null){ |
|
|
|
return Result.error("请勿重复提交"); |
|
|
|
} |
|
|
|
object.setUserId(hanHaiMember.getId()); |
|
|
|
object.setCreateTime(new Date()); |
|
|
|
cityShopAuthenticationService.save(object); |
|
|
|
return Result.OK("认证成功"); |
|
|
|
//修改用户实名状态 |
|
|
|
hanHaiMember.setIdCardOpen(0); |
|
|
|
hanHaiMemberService.updateById(hanHaiMember); |
|
|
|
return Result.OK("提交成功,等待审核"); |
|
|
|
} |
|
|
|
|
|
|
|
//我发布的帖子 |
|
|
|
@Override |
|
|
|
public Result<?> getMyPostPage(String token, PageBean pageBean){ |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
Page<CityTrends> page = new Page<CityTrends>(pageBean.getPageNo(), pageBean.getPageSize()); |
|
|
|
Page<CityTrends> page1 = cityTrendsService |
|
|
|
.lambdaQuery() |
|
|
|
.eq(CityTrends::getUserId,hanHaiMember.getId()) |
|
|
|
.orderByDesc(CityTrends::getCreateTime) |
|
|
|
.page(page); |
|
|
|
return Result.OK(page1); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//根据帖子标识编辑帖子 |
|
|
|
@Override |
|
|
|
public Result<?> editPost(String token, CityTrends bean){ |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
//判断标识不能为空 |
|
|
|
if(StringUtils.isEmpty(bean.getId())){ |
|
|
|
return Result.error("帖子标识不能为空"); |
|
|
|
} |
|
|
|
bean.setIsState(0); |
|
|
|
cityTrendsService.updateById(bean); |
|
|
|
return Result.OK("修改成功,等待审核"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//根据帖子标识删除帖子 |
|
|
|
@Override |
|
|
|
public Result<?> deletePost(String token, String id){ |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
//判断标识不能为空 |
|
|
|
if(StringUtils.isEmpty(id)){ |
|
|
|
return Result.error("帖子标识不能为空"); |
|
|
|
} |
|
|
|
//根据帖子标识查询帖子是否存在 |
|
|
|
CityTrends cityTrends = cityTrendsService |
|
|
|
.lambdaQuery() |
|
|
|
.eq(CityTrends::getUserId,hanHaiMember.getId()) |
|
|
|
.eq(CityTrends::getId,id) |
|
|
|
.one(); |
|
|
|
//不存在则返回 |
|
|
|
if(null==cityTrends){ |
|
|
|
return Result.error("帖子不存在"); |
|
|
|
} |
|
|
|
cityTrendsService.removeById(id); |
|
|
|
return Result.OK("删除成功"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取推广二维码 |
|
|
|
@Override |
|
|
|
public Result<?> getQrCode(String token){ |
|
|
|
HanHaiMember member = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
|
|
|
|
CityConf vsion = cityConfService.lambdaQuery() |
|
|
|
.eq(CityConf::getKeyIcon, "v_sion") |
|
|
|
.one(); |
|
|
|
Integer vsionStr = Integer.parseInt(vsion.getKeyValue()); |
|
|
|
String trial = "release"; |
|
|
|
if(vsionStr == 0){ |
|
|
|
trial= "release"; |
|
|
|
}else if(vsionStr == 1){ |
|
|
|
trial= "trial"; |
|
|
|
}else{ |
|
|
|
trial= "develop"; |
|
|
|
} |
|
|
|
|
|
|
|
WxQrCodeVo o = (WxQrCodeVo)redisUtil.get("CodeImage::" + trial+ member.getId()); |
|
|
|
if(o!=null){ |
|
|
|
|
|
|
|
|
|
|
|
o.setName("瑶都万能墙欢迎您的加入"); |
|
|
|
return Result.OK(o); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
|
|
|
|
CityConf xcxSharePage = cityConfService.lambdaQuery() |
|
|
|
.eq(CityConf::getKeyIcon, "xcxSharePage") |
|
|
|
.one(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String key = "shareId=" + member.getId(); |
|
|
|
|
|
|
|
param.put("path", xcxSharePage.getKeyValue() + "?" + key); //跳转页面 |
|
|
|
String accessToken = this.getAccessToken(); |
|
|
|
RestTemplate rest = new RestTemplate(); |
|
|
|
InputStream inputStream = null; |
|
|
|
OutputStream outputStream = null; |
|
|
|
File file = null; |
|
|
|
|
|
|
|
// LambdaQueryWrapper<DbConf> configImg = new LambdaQueryWrapper<>(); |
|
|
|
// configImg.eq(DbConf::getIsDel,0).eq(DbConf::getKeyValue,"codeImg"); |
|
|
|
// DbConf oneImg = confService.getOne(configImg); |
|
|
|
|
|
|
|
CityConf oneImage = cityConfService.lambdaQuery() |
|
|
|
.eq(CityConf::getKeyIcon, "codeImg") |
|
|
|
.one(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String codeImg = oneImage.getKeyValue(); |
|
|
|
try{ |
|
|
|
String url = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + accessToken; |
|
|
|
param.put("scene", member.getId()); |
|
|
|
param.put("width", 150); |
|
|
|
param.put("auto_color", false); |
|
|
|
param.put("env_version", trial); |
|
|
|
Map<String, Object> line_color = new HashMap<>(); |
|
|
|
line_color.put("r", 0); |
|
|
|
line_color.put("g", 0); |
|
|
|
line_color.put("b", 0); |
|
|
|
param.put("line_color", line_color); |
|
|
|
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
|
|
|
org.springframework.http.HttpEntity requestEntity = new org.springframework.http.HttpEntity(JSON.toJSONString(param), headers); |
|
|
|
ResponseEntity<byte[]> entity = rest.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); |
|
|
|
byte[] result = entity.getBody(); |
|
|
|
|
|
|
|
inputStream = new ByteArrayInputStream(result); |
|
|
|
String tempSave = codeImg; |
|
|
|
String filePath = tempSave; |
|
|
|
|
|
|
|
file = new File(filePath); |
|
|
|
if (!file.exists()) { |
|
|
|
file.createNewFile(); |
|
|
|
} |
|
|
|
outputStream = new FileOutputStream(file); |
|
|
|
int len = 0; |
|
|
|
byte[] buf = new byte[1024]; |
|
|
|
while ((len = inputStream.read(buf, 0, 1024)) != -1) { |
|
|
|
outputStream.write(buf, 0, len); |
|
|
|
} |
|
|
|
outputStream.flush(); |
|
|
|
/** |
|
|
|
* 将文件上传至阿里云 |
|
|
|
*/ |
|
|
|
DiskFileItemFactory factory = new DiskFileItemFactory(16, null); |
|
|
|
FileItem item = factory.createItem("File", "text/plain", true, file.getName()); |
|
|
|
int bytesRead = 0; |
|
|
|
byte[] buffer = new byte[8192]; |
|
|
|
try { |
|
|
|
FileInputStream fis = new FileInputStream(file); |
|
|
|
OutputStream os = item.getOutputStream(); |
|
|
|
while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) { |
|
|
|
os.write(buffer, 0, bytesRead); |
|
|
|
} |
|
|
|
os.close(); |
|
|
|
fis.close(); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
MultipartFile mf = new CommonsMultipartFile(item); |
|
|
|
//返回图片下载地址 |
|
|
|
WxQrCodeVo wxCodeVo = new WxQrCodeVo(); |
|
|
|
wxCodeVo.setUrl(this.uploadAliYunOss(mf)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxCodeVo.setName("瑶都万能墙欢迎您的加入"); |
|
|
|
|
|
|
|
redisUtil.set("CodeImage::"+trial+member.getId(),wxCodeVo); |
|
|
|
return Result.OK(wxCodeVo); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (inputStream != null) { |
|
|
|
try { |
|
|
|
inputStream.close(); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (outputStream != null) { |
|
|
|
try { |
|
|
|
outputStream.close(); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
//删除文件 |
|
|
|
if (file.exists()) { |
|
|
|
file.delete(); |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 获取令牌 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private String getAccessToken() { |
|
|
|
String requestUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret; |
|
|
|
String doGet2 = HttpClientUtil.doGet2(requestUrl); |
|
|
|
Map<String, String> map = JSON.parseObject(doGet2, new TypeReference<Map<String, String>>() { |
|
|
|
}); |
|
|
|
return map.get("access_token"); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 上传文件至阿里云oss |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private String uploadAliYunOss(MultipartFile mf) throws Exception { |
|
|
|
String uploadFile = "WxCodeFile"; |
|
|
|
String fileName = new StringBuffer(mf.getOriginalFilename()).append(".jpg").toString();// 获取文件名 |
|
|
|
String dbpath = uploadFile + File.separator + fileName; |
|
|
|
if (dbpath.contains("\\")) { |
|
|
|
dbpath = dbpath.replace("\\", "/"); |
|
|
|
} |
|
|
|
String endpoint = this.endpoint; |
|
|
|
String accessKey = this.accessKey; |
|
|
|
String secretKey = this.secretKey; |
|
|
|
// 创建OSSClient实例。 |
|
|
|
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKey, secretKey); |
|
|
|
// 上传Byte数组。 |
|
|
|
byte[] content = mf.getBytes(); |
|
|
|
String bucketName = this.bucketName; |
|
|
|
ossClient.putObject(bucketName, dbpath, new ByteArrayInputStream(content)); |
|
|
|
// 关闭OSSClient。 |
|
|
|
ossClient.shutdown(); |
|
|
|
return dbpath; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获取粉丝列表接口 |
|
|
|
public Result<?> getFansList(String token, PageBean pageBean) { |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
//根据用户标识查询粉丝列表带分页 |
|
|
|
Page<HanHaiMember> page = new Page<HanHaiMember>(pageBean.getPageNo(), pageBean.getPageSize()); |
|
|
|
Page<HanHaiMember> page1 = hanHaiMemberService |
|
|
|
.lambdaQuery() |
|
|
|
.orderByDesc(HanHaiMember::getCreateTime) |
|
|
|
.eq(HanHaiMember::getShareId, hanHaiMember.getId()) |
|
|
|
.page(page); |
|
|
|
return Result.OK(page1); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//发布评论 |
|
|
|
public Result<?> comment(String token,CityComment cityComment) { |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
cityComment.setUserId(hanHaiMember.getId()); |
|
|
|
cityComment.setUserName(hanHaiMember.getNickName()); |
|
|
|
cityComment.setUserHead(hanHaiMember.getHeadImage()); |
|
|
|
cityComment.setCreateTime(new Date()); |
|
|
|
cityCommentService.save(cityComment); |
|
|
|
return Result.OK("评论成功"); |
|
|
|
} |
|
|
|
|
|
|
|
//删除评论 |
|
|
|
public Result<?> deleteComment(String token,String id) { |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
cityCommentService.lambdaUpdate() |
|
|
|
.eq(CityComment::getUserId,hanHaiMember.getId()) |
|
|
|
.eq(CityComment::getId,id) |
|
|
|
.remove(); |
|
|
|
return Result.OK("删除成功"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |