main
parent
5df75f9511
commit
2e09d39736
|
|
@ -3,9 +3,11 @@ package com.ruoyi.app.controller;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.ruoyi.app.domain.vo.AppDynamicCommentVo;
|
import com.ruoyi.app.domain.vo.AppDynamicCommentVo;
|
||||||
|
import com.ruoyi.app.mapper.AppDynamicCommentMapper;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -27,6 +29,8 @@ import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
import static com.ruoyi.common.core.utils.PageUtils.startPage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态评论Controller
|
* 动态评论Controller
|
||||||
*
|
*
|
||||||
|
|
@ -41,6 +45,9 @@ public class AppDynamicCommentController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAppDynamicCommentService appDynamicCommentService;
|
private IAppDynamicCommentService appDynamicCommentService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AppDynamicCommentMapper appDynamicCommentMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询动态评论列表
|
* 查询动态评论列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -119,7 +126,10 @@ public class AppDynamicCommentController extends BaseController
|
||||||
@GetMapping("/treeList")
|
@GetMapping("/treeList")
|
||||||
@ApiOperation(value = "评论树列表", notes = "评论树列表", httpMethod = "GET")
|
@ApiOperation(value = "评论树列表", notes = "评论树列表", httpMethod = "GET")
|
||||||
public AjaxResult treeList(AppDynamicComment appDynamicComment) {
|
public AjaxResult treeList(AppDynamicComment appDynamicComment) {
|
||||||
Map list = appDynamicCommentService.treeList(appDynamicComment);
|
List<AppDynamicCommentVo> list = appDynamicCommentMapper.selectCommentList(appDynamicComment);
|
||||||
|
startPage();
|
||||||
|
Map map = appDynamicCommentService.treeList(appDynamicComment);
|
||||||
|
map.put("countNum",list.size());
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,12 +128,9 @@ public class AppDynamicCommentServiceImpl implements IAppDynamicCommentService
|
||||||
if (appDynamicComment.getDynamicId() == null) {
|
if (appDynamicComment.getDynamicId() == null) {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
List<AppDynamicCommentVo> list = appDynamicCommentMapper.selectCommentList(appDynamicComment);
|
|
||||||
startPage();
|
|
||||||
List<AppDynamicCommentVo> appDynamicComments = appDynamicCommentMapper.selectCommentList(appDynamicComment);
|
List<AppDynamicCommentVo> appDynamicComments = appDynamicCommentMapper.selectCommentList(appDynamicComment);
|
||||||
List<AppDynamicCommentVo> parentList = appDynamicComments.stream().filter(entity -> entity.getParentId() == null).collect(Collectors.toList());
|
List<AppDynamicCommentVo> parentList = appDynamicComments.stream().filter(entity -> entity.getParentId() == null).collect(Collectors.toList());
|
||||||
List<AppDynamicCommentVo> srcList = appDynamicComments.stream().filter(entity -> entity.getParentId() != null).collect(Collectors.toList());
|
List<AppDynamicCommentVo> srcList = appDynamicComments.stream().filter(entity -> entity.getParentId() != null).collect(Collectors.toList());
|
||||||
map.put("countNum",list.size());
|
|
||||||
map.put("list",buildList(parentList,srcList));
|
map.put("list",buildList(parentList,srcList));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ public class AppUserFriendServiceImpl implements IAppUserFriendService
|
||||||
public AjaxResult insertAppUserFriend(AppUserFriend appUserFriend)
|
public AjaxResult insertAppUserFriend(AppUserFriend appUserFriend)
|
||||||
{
|
{
|
||||||
appUserFriend.setCreateTime(DateUtils.getNowDate());
|
appUserFriend.setCreateTime(DateUtils.getNowDate());
|
||||||
appUserFriend.setStatus(appUserFriend.getStatus() == null ? 0l : appUserFriend.getStatus());
|
appUserFriend.setStatus(appUserFriend.getStatus() == null ? 2l : appUserFriend.getStatus());
|
||||||
AppUserFriend entity = new AppUserFriend();
|
AppUserFriend entity = new AppUserFriend();
|
||||||
entity.setUserId(appUserFriend.getUserId());
|
entity.setUserId(appUserFriend.getUserId());
|
||||||
entity.setFriendId(appUserFriend.getFriendId());
|
entity.setFriendId(appUserFriend.getFriendId());
|
||||||
|
|
@ -71,12 +71,12 @@ public class AppUserFriendServiceImpl implements IAppUserFriendService
|
||||||
if (list != null && list.size() > 0) {
|
if (list != null && list.size() > 0) {
|
||||||
return AjaxResult.error(2001,"已添加过好友!");
|
return AjaxResult.error(2001,"已添加过好友!");
|
||||||
}
|
}
|
||||||
AppUserFriend friend = new AppUserFriend();
|
/* AppUserFriend friend = new AppUserFriend();
|
||||||
friend.setStatus(0l);
|
friend.setStatus(0l);
|
||||||
friend.setCreateTime(DateUtils.getNowDate());
|
friend.setCreateTime(DateUtils.getNowDate());
|
||||||
friend.setUserId(appUserFriend.getFriendId());
|
friend.setUserId(appUserFriend.getFriendId());
|
||||||
friend.setFriendId(appUserFriend.getUserId());
|
friend.setFriendId(appUserFriend.getUserId());
|
||||||
appUserFriendMapper.insertAppUserFriend(friend);
|
appUserFriendMapper.insertAppUserFriend(friend);*/
|
||||||
return AjaxResult.success(appUserFriendMapper.insertAppUserFriend(appUserFriend));
|
return AjaxResult.success(appUserFriendMapper.insertAppUserFriend(appUserFriend));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,9 +87,17 @@ public class AppUserFriendServiceImpl implements IAppUserFriendService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateAppUserFriend(AppUserFriend appUserFriend)
|
public int updateAppUserFriend(AppUserFriend appUserFriend) {
|
||||||
{
|
|
||||||
appUserFriend.setUpdateTime(DateUtils.getNowDate());
|
appUserFriend.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
if (appUserFriend.getStatus() == 0) {
|
||||||
|
AppUserFriend entity = appUserFriendMapper.selectAppUserFriendById(appUserFriend.getId());
|
||||||
|
AppUserFriend friend = new AppUserFriend();
|
||||||
|
friend.setStatus(0l);
|
||||||
|
friend.setCreateTime(DateUtils.getNowDate());
|
||||||
|
friend.setUserId(entity.getFriendId());
|
||||||
|
friend.setFriendId(entity.getUserId());
|
||||||
|
appUserFriendMapper.insertAppUserFriend(friend);
|
||||||
|
}
|
||||||
return appUserFriendMapper.updateAppUserFriend(appUserFriend);
|
return appUserFriendMapper.updateAppUserFriend(appUserFriend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,8 +108,17 @@ public class AppUserFriendServiceImpl implements IAppUserFriendService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteAppUserFriendByIds(Long[] ids)
|
public int deleteAppUserFriendByIds(Long[] ids) {
|
||||||
{
|
for (Long id : ids) {
|
||||||
|
AppUserFriend appUserFriend = appUserFriendMapper.selectAppUserFriendById(id);
|
||||||
|
AppUserFriend entity = new AppUserFriend();
|
||||||
|
entity.setUserId(appUserFriend.getFriendId());
|
||||||
|
entity.setFriendId(appUserFriend.getUserId());
|
||||||
|
List<AppUserFriend> list = appUserFriendMapper.selectAppUserFriendList(entity);
|
||||||
|
for (AppUserFriend friend : list) {
|
||||||
|
appUserFriendMapper.deleteAppUserFriendById(friend.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
return appUserFriendMapper.deleteAppUserFriendByIds(ids);
|
return appUserFriendMapper.deleteAppUserFriendByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -301,8 +301,7 @@ public class AppUserServiceImpl implements IAppUserService {
|
||||||
entity.setCompanyName(null);
|
entity.setCompanyName(null);
|
||||||
List<AppUserDataVo> friendList = appUserMapper.selectList(entity);
|
List<AppUserDataVo> friendList = appUserMapper.selectList(entity);
|
||||||
if (friendList == null || friendList.size() == 0) {
|
if (friendList == null || friendList.size() == 0) {
|
||||||
entity.setFriendIds(null);
|
friendList = new ArrayList<>();
|
||||||
friendList = appUserMapper.selectList(entity);
|
|
||||||
}
|
}
|
||||||
Collections.shuffle(friendList);
|
Collections.shuffle(friendList);
|
||||||
if (friendList.size() > limit) {
|
if (friendList.size() > limit) {
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ public class SendNoteUtil {
|
||||||
return "Redis存入失败";
|
return "Redis存入失败";
|
||||||
}
|
}
|
||||||
if (!isChineseMobileNumber(PhoneNumber)) {
|
if (!isChineseMobileNumber(PhoneNumber)) {
|
||||||
|
PhoneNumber = PhoneNumber.replace("+","");
|
||||||
return sendForeign(PhoneNumber,randomNumber);
|
return sendForeign(PhoneNumber,randomNumber);
|
||||||
}
|
}
|
||||||
CommonRequest request = new CommonRequest();
|
CommonRequest request = new CommonRequest();
|
||||||
|
|
@ -186,9 +187,10 @@ public class SendNoteUtil {
|
||||||
return number.matches(regex);
|
return number.matches(regex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String sendForeign(String phone,String code){
|
private static String sendForeign(String phone,String code){
|
||||||
|
DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou","LTAI5tQMf7PG2rH4U2mZBQnK", "3l8t7cVJGTGGu89AepWtq0CddgZNfU");
|
||||||
|
IAcsClient client = new DefaultAcsClient(profile);
|
||||||
CommonRequest request = new CommonRequest();
|
CommonRequest request = new CommonRequest();
|
||||||
|
|
||||||
request.setSysMethod(MethodType.POST);
|
request.setSysMethod(MethodType.POST);
|
||||||
request.setSysDomain("dysmsapi.aliyuncs.com");
|
request.setSysDomain("dysmsapi.aliyuncs.com");
|
||||||
request.setSysVersion("2017-05-25");
|
request.setSysVersion("2017-05-25");
|
||||||
|
|
@ -204,7 +206,7 @@ public class SendNoteUtil {
|
||||||
String returnStr = response.getData();
|
String returnStr = response.getData();
|
||||||
System.out.println(returnStr);
|
System.out.println(returnStr);
|
||||||
String data = response.getData();
|
String data = response.getData();
|
||||||
return JSONObject.parseObject(data).getString("Message");
|
return JSONObject.parseObject(data).getString("Code");
|
||||||
} catch (ServerException e) {
|
} catch (ServerException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return e.getErrMsg();
|
return e.getErrMsg();
|
||||||
|
|
@ -234,4 +236,12 @@ public class SendNoteUtil {
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String phone = "1+4049014566";
|
||||||
|
if (!isChineseMobileNumber(phone)) {
|
||||||
|
phone = phone.replace("+","");
|
||||||
|
System.out.println(phone);
|
||||||
|
System.out.println(sendForeign(phone,"1234"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue