main
王宇航 2024-05-27 11:28:24 +08:00
parent b72ad7e2b0
commit eb8c94b58a
30 changed files with 816 additions and 113 deletions

View File

@ -0,0 +1,114 @@
package com.ruoyi.app.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.app.domain.AppCountry;
import com.ruoyi.app.service.IAppCountryService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author wyh
* @date 2024-05-26
*/
@RestController
@RequestMapping("/country")
@Api(tags = "国外的国家" , description = "国外的国家")
public class AppCountryController extends BaseController
{
@Autowired
private IAppCountryService appCountryService;
/**
*
*/
@RequiresPermissions("app:country:list")
@GetMapping("/list")
@ApiOperation(value = "查询国外的国家", notes = "查询国外的国家", httpMethod = "GET")
public TableDataInfo list(AppCountry appCountry)
{
startPage();
List<AppCountry> list = appCountryService.selectAppCountryList(appCountry);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("app:country:export")
@Log(title = "国外的国家", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AppCountry appCountry)
{
List<AppCountry> list = appCountryService.selectAppCountryList(appCountry);
ExcelUtil<AppCountry> util = new ExcelUtil<AppCountry>(AppCountry.class);
util.exportExcel(response, list, "国外的国家数据");
}
/**
*
*/
@RequiresPermissions("app:country:query")
@GetMapping(value = "/{id}")
@ApiOperation(value = "获取国外的国家详细信息", notes = "获取国外的国家详细信息", httpMethod = "GET")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(appCountryService.selectAppCountryById(id));
}
/**
*
*/
@RequiresPermissions("app:country:add")
@ApiOperation(value = "新增国外的国家", notes = "新增国外的国家", httpMethod = "POST")
@Log(title = "国外的国家", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody AppCountry appCountry)
{
return toAjax(appCountryService.insertAppCountry(appCountry));
}
/**
*
*/
@RequiresPermissions("app:country:edit")
@ApiOperation(value = "修改国外的国家", notes = "修改国外的国家", httpMethod = "PUT")
@Log(title = "国外的国家", businessType = BusinessType.UPDATE)
@PutMapping("/edit")
public AjaxResult edit(@RequestBody AppCountry appCountry)
{
return toAjax(appCountryService.updateAppCountry(appCountry));
}
/**
*
*/
@RequiresPermissions("app:country:remove")
@Log(title = "国外的国家", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(appCountryService.deleteAppCountryByIds(ids));
}
}

View File

@ -69,41 +69,46 @@ public class AppLoginController {
@PostMapping("/register")
@ApiOperation(value = "注册", notes = "注册")
public R<?> register(@RequestBody RegisterForm registerForm) {
//判断用户是否已注册或已存在
AppUser appUser = appUserService.selectAppUserByPhone(registerForm.getPhoneNumber());
AppRegister register = appRegisterService.selectAppRegisterByphone(registerForm.getPhoneNumber());
Assert.isNull(appUser, "手机号已注册");
//查看是否提交过注册申请
AppRegister register = appRegisterService.selectAppRegisterByphone(registerForm.getPhoneNumber());
Assert.notNull(registerForm.getSchoolId(), "学校id不能为空");
//TODO
AppSchool appSchool = schoolService.selectAppSchoolById(
registerForm.getSchoolId()
);
Assert.isNull(appUser, "手机号已注册");
if (StringUtils.isNotEmpty(registerForm.getEmail())) {
//校验邮箱格式
// Assert.isTrue(MailUtil.validEmail(registerForm.getEmail()), "邮箱格式不正确") ;
AppRegister appRegister = setAppRegister(registerForm);
//校验邮箱是否已注册
AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail());
Assert.isNull(emailUser, "邮箱已注册");
redisService.setCacheMapValue(IdUtils.fastUUID(),registerForm.getEmail() , registerForm);
try {
String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
+ "<p>请点击下面的网址确认您的注册:</p>"
+ "<p>http://101.133.172.2:9204/app/activation/"+ IdUtils.fastUUID() + "/" + registerForm.getEmail() + "</p>"
+ "</body></html>";
MailUtil.send_mail(registerForm.getEmail(), EM);
} catch (MessagingException e) {
throw new RuntimeException(e);
}
} else {
// if (StringUtils.isNotEmpty(registerForm.getEmail())) {
// //校验邮箱格式
//// Assert.isTrue(MailUtil.validEmail(registerForm.getEmail()), "邮箱格式不正确") ;
// AppRegister appRegister = setAppRegister(registerForm);
// //校验邮箱是否已注册
// AppUser emailUser = appUserService.selectAppUserByEmail(registerForm.getEmail());
// Assert.isNull(emailUser, "邮箱已注册");
// redisService.setCacheMapValue(IdUtils.fastUUID(),registerForm.getEmail() , registerForm);
// try {
// String EM = "<html><body><h2>欢迎来到我们的服务!!</h2>"
// + "<p>请点击下面的网址确认您的注册:</p>"
// + "<p>http://101.133.172.2:9204/app/activation/"+ IdUtils.fastUUID() + "/" + registerForm.getEmail() + "</p>"
// + "</body></html>";
//
// MailUtil.send_mail(registerForm.getEmail(), EM);
// } catch (MessagingException e) {
// throw new RuntimeException(e);
// }
// } else {
if (register != null && register.getStatus() != null) {
switch (register.getStatus()) {
case 0:
return R.fail(201, "注册失败,您的账号正在审核中!");
return R.fail(201, "请等待,您的账号正在审核中!");
case 1:
return R.fail(201, "您的账号已通过");
case 2:
@ -116,7 +121,7 @@ public class AppLoginController {
int i = appRegisterService.insertAppRegister(appRegister);
Assert.isTrue(i > 0, "注册失败");
}
}
// }
return R.ok(null, "申请成功,请等待审核结果!");
}
@ -125,6 +130,7 @@ public class AppLoginController {
public R<?> login(@RequestBody LoginForm loginForm) {
AppUser appUser = appUserService.selectAppUserByPhone(loginForm.getPhoneNumber());
Assert.notNull(appUser, "手机号未注册");
// Object cacheObject = redisService.getCacheObject(loginForm.getPhoneNumber());
// if (cacheObject != null) {
// String code = (String) cacheObject;
@ -145,15 +151,23 @@ public class AppLoginController {
private static AppRegister setAppRegister(RegisterForm registerForm) {
AppRegister appRegister = new AppRegister();
appRegister.setPushId(registerForm.getPushId());
appRegister.setEducation(registerForm.getEducation());
appRegister.setMajor(registerForm.getMajor());
appRegister.setCompanyName(registerForm.getCompanyName());
appRegister.setPhone(registerForm.getPhoneNumber());
appRegister.setUsername(registerForm.getUsername());
appRegister.setProve(registerForm.getProve());
appRegister.setAvatarUrl(registerForm.getAvatarUrl());
appRegister.setSex(registerForm.getSex());
appRegister.setAddress(registerForm.getAddress());
appRegister.setNickname(registerForm.getNickname());
appRegister.setSchoolId(registerForm.getSchoolId());
appRegister.setEmail(registerForm.getEmail());
appRegister.setInvitationCode(registerForm.getInvitationCode());
appRegister.setProvinceId(registerForm.getProvinceId());
appRegister.setCityId(registerForm.getCityId());
appRegister.setTownId(registerForm.getTownId());
appRegister.setStatus(0);
return appRegister;
}

View File

@ -1,6 +1,9 @@
package com.ruoyi.app.controller;
import com.ruoyi.app.domain.AppRegister;
import com.ruoyi.app.service.IAppRegisterService;
import com.ruoyi.app.utils.aliyun.sms.SendNoteUtil;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import io.swagger.annotations.Api;
@ -21,11 +24,26 @@ public class PhoneCodeController {
@Autowired
private SendNoteUtil sendNoteUtil;
@Autowired
private IAppRegisterService appRegisterService;
@GetMapping(value = "/send")
@ApiOperation(value = "发送短信验证码", notes = "发送短信验证码", httpMethod = "GET")
public AjaxResult sendCode(@RequestParam("phoneNumber") String phoneNum){
public AjaxResult sendCode(@RequestParam("phoneNumber") String phoneNum , @RequestParam("type") Integer type){
String send = "";
if (type == 1) {
String send = sendNoteUtil.sendNoteMessgae(phoneNum);
AppRegister appRegister = appRegisterService.selectAppRegisterByphone(phoneNum);
if (appRegister != null && appRegister.getStatus() == 0) {
return AjaxResult.error(201, "请等待,您的账号正在审核中!");
}
if (appRegister != null && appRegister.getStatus() == 2) {
return AjaxResult.error(201, "您的账号申请被驳回");
}
send = sendNoteUtil.sendNoteMessgae(phoneNum);
}else {
send = sendNoteUtil.sendMessage(phoneNum);
}
if ("OK".equals(send)) {
return AjaxResult.success();

View File

@ -0,0 +1,65 @@
package com.ruoyi.app.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* app_country
*
* @author wyh
* @date 2024-05-26
*/
public class AppCountry extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Integer id;
/** 国家名称 */
@Excel(name = "国家名称")
private String name;
/** 父级id */
@Excel(name = "父级id")
private Long parentId;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public Long getParentId()
{
return parentId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("parentId", getParentId())
.toString();
}
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.app.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
@ -11,6 +13,8 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
* @author wyh
* @date 2024-04-23
*/
@Data
public class AppRegister extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -57,6 +61,28 @@ public class AppRegister extends BaseEntity
@Excel(name = "审核状态")
private Integer status;
@ApiModelProperty("推送id")
private String pushId;
/** 学历 */
@Excel(name = "学历")
private String education;
/** 专业 */
@Excel(name = "专业")
private String major;
/** 公司名称 */
@Excel(name = "公司名称")
private String companyName;
private String nickname;
private Integer provinceId;
private Integer cityId;
private Integer townId;
public void setId(Long id)
{
this.id = id;

View File

@ -174,6 +174,8 @@ public class AppUser extends BaseEntity
private String backGroundImg;
private String pushId;
/** 订单记录 */
@Excel(name = "订单记录")
private Long orderId;
@ -188,6 +190,13 @@ public class AppUser extends BaseEntity
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date orderEndTime;
private Integer provinceId;
private Integer cityId;
private Integer townId;
public void setId(Long id)
{
this.id = id;

View File

@ -75,6 +75,10 @@ public class AppUserDynamic extends BaseEntity
private List<Long> dynamicIds;
private Integer check;
private Boolean isOwner;
public void setIsTop(Long isTop)
{
this.isTop = isTop;

View File

@ -3,6 +3,7 @@ package com.ruoyi.app.domain.vo;
import com.ruoyi.app.domain.AppDynamicComment;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -15,6 +16,7 @@ import java.util.List;
* @author wyh
* @date 2024-04-24
*/
@Data
public class AppDynamicCommentVo extends AppDynamicComment
{
private static final long serialVersionUID = 1L;
@ -25,6 +27,12 @@ public class AppDynamicCommentVo extends AppDynamicComment
@Excel(name = "用户头像")
private String avatarUrl;
private Integer check;
/** 昵称 */
@Excel(name = "昵称")
private String nickname;
private List<AppDynamicCommentVo> children = new ArrayList<>();
public void setChildren(List<AppDynamicCommentVo> children) {

View File

@ -21,6 +21,8 @@ public class AppUserDataVo
private static final long serialVersionUID = 1L;
private String username;
private String nickname;
private Integer check;
private String avatarUrl;

View File

@ -25,6 +25,8 @@ public class AppUserDynamicVo extends AppUserDynamic
{
private static final long serialVersionUID = 1L;
private Integer isFans;
private String username;
private String avatarUrl;
@ -66,6 +68,7 @@ public class AppUserDynamicVo extends AppUserDynamic
private String townName;
private Integer check;
// 话题
private List<AppTopic> appTopicList = new ArrayList<>();

View File

@ -3,6 +3,7 @@ package com.ruoyi.app.domain.vo;
import com.ruoyi.app.domain.AppUserFriend;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -12,6 +13,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @author wyh
* @date 2024-04-24
*/
@Data
public class AppUserFriendVo extends AppUserFriend
{
private static final long serialVersionUID = 1L;
@ -19,6 +21,9 @@ public class AppUserFriendVo extends AppUserFriend
/** 我的id */
@Excel(name = "名字")
private String username;
private String nickname;
private Integer check;
/** 好友id */
@Excel(name = "头像")

View File

@ -27,6 +27,18 @@ public class AppUserVo extends AppUser
@Excel(name = "学校名称")
private String schoolName;
private String schoolImg;
private Integer provinceId;
private Integer cityId;
private Integer townId;
private String provinceName;
private String townName;
private List<AppSkill> userSkillList;
private String cityName;
@ -37,6 +49,8 @@ public class AppUserVo extends AppUser
private Integer attentionNum;
private int fansNum;
public void setUserSkillList(List<AppSkill> userSkillList) {
this.userSkillList = userSkillList;

View File

@ -1,6 +1,7 @@
package com.ruoyi.app.form;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -36,6 +37,29 @@ public class RegisterForm {
@ApiModelProperty("学校证明")
private String prove;
@ApiModelProperty("推送id")
private String pushId;
/** 学历 */
@Excel(name = "学历")
private String education;
/** 专业 */
@Excel(name = "专业")
private String major;
/** 公司名称 */
@Excel(name = "公司名称")
private String companyName;
private String nickname;
private Integer provinceId;
private Integer cityId;
private Integer townId;
@JsonIgnore
private Integer status;
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppCountry;
/**
* Mapper
*
* @author wyh
* @date 2024-05-26
*/
public interface AppCountryMapper
{
/**
*
*
* @param id
* @return
*/
public AppCountry selectAppCountryById(Long id);
/**
*
*
* @param appCountry
* @return
*/
public List<AppCountry> selectAppCountryList(AppCountry appCountry);
/**
*
*
* @param appCountry
* @return
*/
public int insertAppCountry(AppCountry appCountry);
/**
*
*
* @param appCountry
* @return
*/
public int updateAppCountry(AppCountry appCountry);
/**
*
*
* @param id
* @return
*/
public int deleteAppCountryById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteAppCountryByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.app.service;
import java.util.List;
import com.ruoyi.app.domain.AppCountry;
/**
* Service
*
* @author wyh
* @date 2024-05-26
*/
public interface IAppCountryService
{
/**
*
*
* @param id
* @return
*/
public AppCountry selectAppCountryById(Long id);
/**
*
*
* @param appCountry
* @return
*/
public List<AppCountry> selectAppCountryList(AppCountry appCountry);
/**
*
*
* @param appCountry
* @return
*/
public int insertAppCountry(AppCountry appCountry);
/**
*
*
* @param appCountry
* @return
*/
public int updateAppCountry(AppCountry appCountry);
/**
*
*
* @param ids
* @return
*/
public int deleteAppCountryByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAppCountryById(Long id);
}

View File

@ -0,0 +1,93 @@
package com.ruoyi.app.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.AppCountryMapper;
import com.ruoyi.app.domain.AppCountry;
import com.ruoyi.app.service.IAppCountryService;
/**
* Service
*
* @author wyh
* @date 2024-05-26
*/
@Service
public class AppCountryServiceImpl implements IAppCountryService
{
@Autowired
private AppCountryMapper appCountryMapper;
/**
*
*
* @param id
* @return
*/
@Override
public AppCountry selectAppCountryById(Long id)
{
return appCountryMapper.selectAppCountryById(id);
}
/**
*
*
* @param appCountry
* @return
*/
@Override
public List<AppCountry> selectAppCountryList(AppCountry appCountry)
{
return appCountryMapper.selectAppCountryList(appCountry);
}
/**
*
*
* @param appCountry
* @return
*/
@Override
public int insertAppCountry(AppCountry appCountry)
{
return appCountryMapper.insertAppCountry(appCountry);
}
/**
*
*
* @param appCountry
* @return
*/
@Override
public int updateAppCountry(AppCountry appCountry)
{
return appCountryMapper.updateAppCountry(appCountry);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteAppCountryByIds(Long[] ids)
{
return appCountryMapper.deleteAppCountryByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteAppCountryById(Long id)
{
return appCountryMapper.deleteAppCountryById(id);
}
}

View File

@ -166,7 +166,7 @@ public class AppDynamicCommentServiceImpl implements IAppDynamicCommentService
public static List<AppDynamicCommentVo> getChildrenAppDynamicCommentVoById(Long parentId, List<AppDynamicCommentVo> AppDynamicCommentVos) {
List<AppDynamicCommentVo> children = new ArrayList<AppDynamicCommentVo>();
for (AppDynamicCommentVo node : AppDynamicCommentVos) {
if (node.getParentId() == parentId) {
if (parentId.equals(node.getParentId())) {
//装载parentId对应的子节点
children.add(node);
}

View File

@ -7,9 +7,11 @@ import java.util.Map;
import java.util.stream.Collectors;
import com.ruoyi.app.domain.AppCity;
import com.ruoyi.app.domain.AppCountry;
import com.ruoyi.app.domain.AppTown;
import com.ruoyi.app.domain.vo.AreaVo;
import com.ruoyi.app.mapper.AppCityMapper;
import com.ruoyi.app.mapper.AppCountryMapper;
import com.ruoyi.app.mapper.AppTownMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -34,6 +36,9 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
@Autowired
private AppTownMapper appTownMapper;
@Autowired
private AppCountryMapper appCountryMapper;
/**
*
*
@ -113,6 +118,7 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
areaVo.setIsLeaf(false);
List<AreaVo> list = new ArrayList<>();
List<AppCity> appCities = appCityMapper.selectAppCityListByProvinceId(appProvince.getId());
boolean flag = true;
for (AppCity appCity : appCities) {
if (appCity.getName().equals(areaVo.getName())) {
@ -154,57 +160,22 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
}
areaVos.add(areaVo);
}
areaVos.stream().filter(area -> area.getId()==35).forEach(area -> {
AppCountry appCountry = new AppCountry();
appCountry.setParentId(35L);
List<AppCountry> appCountries = appCountryMapper.selectAppCountryList(appCountry);
List<AreaVo> collect = appCountries.stream().map(country -> {
AreaVo areaVo = new AreaVo();
areaVo.setId(country.getId());
areaVo.setName(country.getName());
areaVo.setLevel(2);
return areaVo;
}).collect(Collectors.toList());
area.setChildren(collect);
area.setIsLeaf(false);
});
return areaVos;
// List<AreaVo> collect = appProvinces.stream()
// .map(appProvince -> {
// AreaVo areaVo = new AreaVo();
// areaVo.setId(appProvince.getId());
// areaVo.setName(appProvince.getName());
// areaVo.setLevel(1);
// areaVo.setIsLeaf(false);
//
// List<AppCity> appCities = appCityMapper.selectAppCityListByProvinceId(appProvince.getId());
// if (appCities == null || appCities.isEmpty()) {
// return areaVo;
// }
//
// List<AreaVo> children = appCities.stream()
// .map(appCity -> {
// AreaVo child = new AreaVo();
// child.setId(appCity.getId());
// child.setName(appCity.getName());
// child.setLevel(2);
// child.setIsLeaf(false);
//
// List<AppTown> appTowns = appTownMapper.getTownByCityId(appCity.getId());
// if (appTowns == null || appTowns.isEmpty()) {
// return child;
// }
//
// List<AreaVo> townChildren = appTowns.stream()
//// .filter(!appTown -> !appTown.getId().equals(appCity.getId())) // Filter out where child id is same as parent id
// .map(appTown -> {
// AreaVo townChild = new AreaVo();
// townChild.setId(appTown.getId());
// townChild.setName(appTown.getName());
// townChild.setLevel(3);
// townChild.setIsLeaf(true);
// return townChild;
// })
// .collect(Collectors.toList());
//
// child.setChildren(townChildren);
// return child;
// })
// .collect(Collectors.toList());
//
// areaVo.setChildren(children);
// return areaVo;
// })
// .collect(Collectors.toList());
//
// return collect;
}
}

View File

@ -135,13 +135,30 @@ public class AppRegisterServiceImpl implements IAppRegisterService
public int passAppRegister(Long id) {
AppRegister appRegister = appRegisterMapper.selectAppRegisterById(id);
Assert.isTrue(appRegister != null, "该申请不存在");
Assert.isTrue(appRegister.getStatus() == 0, "该申请已审核");
Assert.isTrue( appRegister.getStatus()!= null && appRegister.getStatus() == 0, "该申请已审核");
appRegister.setStatus(1);
appRegister.setUpdateTime(DateUtils.getNowDate());
int i = appRegisterMapper.updateAppRegister(appRegister);
if (i != 0) {
if (i > 0) {
AppUser appUser = new AppUser();
BeanUtils.copyBeanProp(appUser, appRegister);
BeanUtils.copyProperties(appRegister, appUser);
appUser.setCreateTime(DateUtils.getNowDate());
appUser.setUpdateTime(DateUtils.getNowDate());
appUser.setPhone(appRegister.getPhone() != null ? appRegister.getPhone():null);
appUser.setEmail(appRegister.getEmail() != null ? appRegister.getEmail():null);
appUser.setSchool(appRegister.getSchoolId() != null ? appRegister.getSchoolId():null);
appUser.setUsername(appRegister.getUsername() != null ? appRegister.getUsername():null);
appUser.setAddress(appRegister.getAddress() != null ? appRegister.getAddress():null);
appUser.setSex(Long.valueOf(appRegister.getSex() != null ? appRegister.getSex():null));
appUser.setAvatarUrl(appRegister.getAvatarUrl() != null ? appRegister.getAvatarUrl():null);
appUser.setCompanyName(appRegister.getCompanyName() != null ? appRegister.getCompanyName():null);
appUser.setEducation(appRegister.getEducation() != null ? appRegister.getEducation():null);
appUser.setMajor(appRegister.getMajor() != null ? appRegister.getMajor():null);
appUser.setPushId(appRegister.getPushId() != null ? appRegister.getPushId():null);
appUser.setNickname(appRegister.getNickname() != null ? appRegister.getNickname():null);
appUser.setProvinceId(appRegister.getProvinceId() != null ? appRegister.getProvinceId():null);
appUser.setCityId(appRegister.getCityId() != null ? appRegister.getCityId():null);
appUser.setTownId(appRegister.getTownId() != null ? appRegister.getTownId():null);
appUserMapper.insertAppUser(appUser);
}
return i;

View File

@ -1,5 +1,6 @@
package com.ruoyi.app.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -214,6 +215,21 @@ public class AppUserDynamicServiceImpl implements IAppUserDynamicService
AppDynamicComment appDynamicComment = new AppDynamicComment();
appDynamicComment.setDynamicId(id);
appUserDynamicVo.setCountComment(appDynamicCommentMapper.selectAppDynamicCommentList(appDynamicComment).size());
AppUserFriend appUserFriend = new AppUserFriend();
appUserFriend.setUserId(appUserDynamic.getUserId());
List<AppUserFriend> friends = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
if (friends.stream().map(AppUserFriend::getFriendId).collect(Collectors.toList()).contains(appUserDynamicVo.getUserId())) {
appUserDynamicVo.setIsFans(0);
}else {
appUserDynamicVo.setIsFans(1);
}
}
List<AppUserDynamicVo> collect = new ArrayList<>();
if (appUserDynamic.getIsOwner() != null) {
collect = list.stream().filter(x -> x.getPrivacyStatus() != 1).collect(Collectors.toList());
return collect;
}
return list;
}

View File

@ -9,6 +9,9 @@ import com.ruoyi.app.domain.vo.AppUserInfoVo;
import com.ruoyi.app.domain.vo.AppUserNetVo;
import com.ruoyi.app.domain.vo.AppUserVo;
import com.ruoyi.app.mapper.*;
import com.ruoyi.app.service.IAppCityService;
import com.ruoyi.app.service.IAppProvinceService;
import com.ruoyi.app.service.IAppTownService;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
@ -19,13 +22,12 @@ import com.ruoyi.app.service.IAppUserService;
/**
* appService
*
*
* @author wyh
* @date 2024-04-23
*/
@Service
public class AppUserServiceImpl implements IAppUserService
{
public class AppUserServiceImpl implements IAppUserService {
@Autowired
private AppUserMapper appUserMapper;
@ -44,9 +46,17 @@ public class AppUserServiceImpl implements IAppUserService
@Autowired
private AppSkillMapper appSkillMapper;
@Autowired
private AppProvinceMapper appProvinceMapper;
@Autowired
private AppCityMapper appCityMapper;
@Autowired
private AppTownMapper appTownMapper;
/**
* app
*
*
* @param id app
* @return app
*/
@ -54,11 +64,37 @@ public class AppUserServiceImpl implements IAppUserService
public AppUserVo selectAppUserById(Long id) {
AppUserVo appUser = appUserMapper.selectAppUserById(id);
List<AppSkill> appSkills = new ArrayList<>();
if (appUser.getSkillId() != null) {
List<String> skillIds = Arrays.asList(appUser.getSkillId().split(","));
for (String skillId : skillIds) {
AppSkill appSkill = appSkillMapper.selectAppSkillById(Long.valueOf(skillId));
appSkills.add(appSkill);
// if (appUser.getSkillId() != null) {
// List<String> skillIds = Arrays.asList(appUser.getSkillId().split(","));
// for (String skillId : skillIds) {
// AppSkill appSkill = appSkillMapper.selectAppSkillById(Long.valueOf(skillId));
// appSkills.add(appSkill);
// }
// }
if (appUser.getSchool() != null) {
AppSchool appSchool = appSchoolMapper.selectAppSchoolById(appUser.getSchool());
if (appSchool != null) {
appUser.setSchoolName(appSchool.getName());
appUser.setSchoolImg(appSchool.getSchoolImg());
}
}
if (appUser.getProvinceId() != null) {
AppProvince appProvince = appProvinceMapper.selectAppProvinceById(appUser.getProvinceId());
if (appProvince != null) {
appUser.setProvinceName(appProvince.getName());
}
}
if (appUser.getCityId() != null) {
AppCity appCity = appCityMapper.selectAppCityById(Long.valueOf(appUser.getCityId()));
if (appCity != null) {
appUser.setCityName(appCity.getName());
}
}
if (appUser.getTownId() != null) {
AppTown appTown = appTownMapper.selectAppTownById(Long.valueOf(appUser.getTownId()));
if (appTown != null) {
appUser.setTownName(appTown.getName());
}
}
appUser.setUserSkillList(appSkills);
@ -67,13 +103,12 @@ public class AppUserServiceImpl implements IAppUserService
/**
* app
*
*
* @param appUser app
* @return app
*/
@Override
public List<AppUserVo> selectAppUserList(AppUser appUser)
{
public List<AppUserVo> selectAppUserList(AppUser appUser) {
List<AppUser> appUsers = appUserMapper.selectAppUserList(appUser);
List<AppUserVo> appUserVos = new ArrayList<>();
if (CollectionUtils.isNotEmpty(appUsers)) {
@ -95,26 +130,24 @@ public class AppUserServiceImpl implements IAppUserService
/**
* app
*
*
* @param appUser app
* @return
*/
@Override
public int insertAppUser(AppUser appUser)
{
public int insertAppUser(AppUser appUser) {
appUser.setCreateTime(DateUtils.getNowDate());
return appUserMapper.insertAppUser(appUser);
}
/**
* app
*
*
* @param appUser app
* @return
*/
@Override
public int updateAppUser(AppUser appUser)
{
public int updateAppUser(AppUser appUser) {
appUser.setUpdateTime(DateUtils.getNowDate());
/*if (StringUtils.isNotBlank(appUser.getSkills())) {
// 删除标签
@ -133,7 +166,7 @@ public class AppUserServiceImpl implements IAppUserService
/**
* app
*
*
* @param ids app
* @return
*/
@ -147,7 +180,7 @@ public class AppUserServiceImpl implements IAppUserService
/**
* app
*
*
* @param id app
* @return
*/
@ -173,7 +206,7 @@ public class AppUserServiceImpl implements IAppUserService
AppUserFriend appUserFriend = new AppUserFriend();
appUserFriend.setUserId(appUser.getAppId());
List<AppUserFriend> appUserFriends = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
List<Long> ids = appUserFriends.stream().map(x->x.getFriendId()).collect(Collectors.toList());
List<Long> ids = appUserFriends.stream().map(x -> x.getFriendId()).collect(Collectors.toList());
AppUser entity = new AppUser();
entity.setIds(ids);
@ -223,25 +256,25 @@ public class AppUserServiceImpl implements IAppUserService
public List<AppUserInfoVo> listUser(AppUser appUser) {
int status = appUser.getStatus();
List<Long> ids = new ArrayList<>();
switch (status){
switch (status) {
case 1://好友
AppUserFriend appUserFriend = new AppUserFriend();
appUserFriend.setUserId(appUser.getAppId());
List<AppUserFriend> list = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
ids = list.stream().map(x->x.getFriendId()).collect(Collectors.toList());
ids = list.stream().map(x -> x.getFriendId()).collect(Collectors.toList());
break;
case 2://关注
AppUserFans appUserFans = new AppUserFans();
appUserFans.setUserId(appUser.getAppId());
List<AppUserFans> userFans = appUserFansMapper.selectAppUserFansList(appUserFans);
ids = userFans.stream().map(x->x.getFriendId()).collect(Collectors.toList());
ids = userFans.stream().map(x -> x.getFriendId()).collect(Collectors.toList());
break;
case 3://粉丝
appUserFans = new AppUserFans();
appUserFans.setUserId(null);
appUserFans.setFriendId(appUser.getAppId());
userFans = appUserFansMapper.selectAppUserFansList(appUserFans);
ids = userFans.stream().map(x->x.getFriendId()).collect(Collectors.toList());
ids = userFans.stream().map(x -> x.getFriendId()).collect(Collectors.toList());
break;
}
appUser.setIds(ids);

View File

@ -30,12 +30,11 @@ public class OssServiceImpl implements OssService {
try {
//4、 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(schema + endpoint, accessKeyId, accessKeySecret);
String fileName = file.getOriginalFilename();//获取上传文件的名称
String fileName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));//获取上传文件的名称
InputStream inputStream = file.getInputStream();
// 通过ossClient上传文件 参数1桶名 参数2上传后的文件路径+文件名 ,参数3要上传的文件流
String objectName = new DateTime().toString("yyyy/MM/dd/") +
UUID.randomUUID().toString().replace("-", "").substring(0, 16) +
"_" + fileName;//使用UUID+源文件名称后缀拼接生成objectName
UUID.randomUUID().toString().replace("-", "").substring(0, 16) + fileName;//使用UUID+源文件名称后缀拼接生成objectName
ossClient.putObject(bucketName, objectName, inputStream);
// 关闭OSSClient。
ossClient.shutdown();
@ -61,7 +60,7 @@ public class OssServiceImpl implements OssService {
InputStream inputStream = file.getInputStream();
// 通过ossClient上传文件 参数1桶名 参数2上传后的文件路径+文件名 ,参数3要上传的文件流
String objectName = new DateTime().toString("yyyy/MM/dd/") +
UUID.randomUUID().toString().replace("-", "").substring(0, 16) +
UUID.randomUUID().toString().replace("-", "").substring(0, 8) +
"_" + fileName;//使用UUID+源文件名称后缀拼接生成objectName
ossClient.putObject(bucketName, objectName, inputStream);
// 关闭OSSClient。

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.app.mapper.AppCountryMapper">
<resultMap type="AppCountry" id="AppCountryResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="parentId" column="parent_id" />
</resultMap>
<sql id="selectAppCountryVo">
select id, name, parent_id from app_country
</sql>
<select id="selectAppCountryList" parameterType="AppCountry" resultMap="AppCountryResult">
<include refid="selectAppCountryVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
</where>
</select>
<select id="selectAppCountryById" parameterType="Long" resultMap="AppCountryResult">
<include refid="selectAppCountryVo"/>
where id = #{id}
</select>
<insert id="insertAppCountry" parameterType="AppCountry">
insert into app_country
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null">name,</if>
<if test="parentId != null">parent_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null">#{name},</if>
<if test="parentId != null">#{parentId},</if>
</trim>
</insert>
<update id="updateAppCountry" parameterType="AppCountry">
update app_country
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAppCountryById" parameterType="Long">
delete from app_country where id = #{id}
</delete>
<delete id="deleteAppCountryByIds" parameterType="String">
delete from app_country where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -32,7 +32,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.content as "content",
a.create_time as "createTime",
u.username as "username",
u.avatar_url as "avatarUrl"
u.avatar_url as "avatarUrl",
u.`check` as "check",
u.nickname as "nickname"
from app_dynamic_comment a
LEFT JOIN app_user u on u.id = a.user_id
where a.dynamic_id = #{dynamicId}

View File

@ -21,10 +21,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="email" column="email" />
<result property="invitationCode" column="invitation_code" />
<result property="status" column="status" />
<result property="pushId" column="push_id" />
<result property="education" column="education" />
<result property="major" column="major" />
<result property="companyName" column="company_name" />
<result property="nickname" column="nickname" />
</resultMap>
<sql id="selectAppRegisterVo">
select id, phone, create_time, update_time, create_by, updateBy, remark, username, prove, avatar_url, sex, address, school_id, email ,invitation_code ,status from app_register
select id, phone, create_time, update_time, create_by, updateBy, remark, username, prove, avatar_url, sex, address, school_id, email ,invitation_code ,status , push_id , education , major , company_name , nickname from app_register
</sql>
<select id="selectAppRegisterList" parameterType="AppRegister" resultMap="AppRegisterResult">
@ -65,6 +70,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">email,</if>
<if test="invitationCode != null">invitation_code,</if>
<if test="status != null">status,</if>
<if test="pushId != null">push_id,</if>
<if test="education != null">education,</if>
<if test="major != null">major,</if>
<if test="companyName != null">company_name,</if>
<if test="nickname != null">nickname,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="phone != null">#{phone},</if>
@ -82,7 +92,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">#{email},</if>
<if test="invitationCode != null">#{invitationCode},</if>
<if test="status != null">#{status},</if>
</trim>
<if test="pushId != null">#{pushId},</if>
<if test="education != null">#{education},</if>
<if test="major != null">#{major},</if>
<if test="companyName != null">#{companyName},</if>
<if test="nickname != null">#{nickname},</if>
</trim>
</insert>
<update id="updateAppRegister" parameterType="AppRegister">
@ -103,6 +118,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">email = #{email},</if>
<if test="invitationCode != null">invitation_code = #{invitationCode},</if>
<if test="status != null">status = #{status},</if>
<if test="pushId != null">push_id = #{pushId},</if>
<if test="education != null">education = #{education},</if>
<if test="major != null">major = #{major},</if>
<if test="companyName != null">company_name = #{companyName},</if>
<if test="nickname != null">nickname = #{nickname},</if>
</trim>
where id = #{id}
</update>
@ -138,6 +158,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="schoolId != null">school_id = #{schoolId},</if>
<if test="email != null">email = #{email},</if>
<if test="invitationCode != null">invitation_code = #{invitationCode},</if>
<if test="education != null">education = #{education},</if>
<if test="major != null">major = #{major},</if>
<if test="companyName != null">company_name = #{companyName},</if>
<if test="pushId != null">push_id = #{pushId},</if>
<if test="nickname != null">nickname = #{nickname},</if>
status = 0,
</trim>
where phone = #{phone}

View File

@ -56,7 +56,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.city_id as "cityId",
c.name as "cityName",
t.name as "townName",
p.name as "provinceName"
p.name as "provinceName",
u.`check` as "check",
u.nickname as "nickname"
from app_user_dynamic a
left join app_user u on u.id = a.user_id
left join app_city c on c.id = a.city_id

View File

@ -45,7 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectFriendList" parameterType="AppUserFriend" resultType="com.ruoyi.app.domain.vo.AppUserFriendVo">
select a.id as "id",a.user_id as "userId",a.friend_id as "friendId",a.status as "status",a.create_time as "createTime",
u.username as "username",
u.avatar_url as "avatarUrl"
u.avatar_url as "avatarUrl",
u.nickname as "nickname",
u.`check` as "check"
from app_user_friend a
left join app_user u on u.id = a.friend_id
<where>

View File

@ -140,6 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
s.name as "schoolName",
t.name as "cityName",
a.id as "userId",
a.job_end_time as "jobEndTime",
count(DISTINCT(r.id)) as "friendNum",
count(DISTINCT(l.id)) as "likeNum",
count(DISTINCT(f.id)) as "attentionNum",
@ -317,6 +318,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="education != null">education = #{education},</if>
<if test="school != null">school = #{school},</if>
<if test="major != null">major = #{major},</if>
<if test="isMember != null">is_member = #{isMember},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="experience != null">experience = #{experience},</if>

View File

@ -42,3 +42,11 @@ export function delSchool(id) {
method: 'delete'
})
}
export function uploadAvatar(data) {
return request({
url: '/api/oss/upload',
method: 'post',
data: data
})
}

View File

@ -107,6 +107,20 @@
<el-form-item label="学校名称" prop="name">
<el-input v-model="form.name" placeholder="请输入学校名称" />
</el-form-item>
<el-form-item label="邮箱域名" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱域名" />
</el-form-item>
<el-form-item label="学校头像">
<el-upload
class="avatar-uploader"
action="http://localhost:1024/dev-api//api/oss/upload"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -117,7 +131,7 @@
</template>
<script>
import { listSchool, getSchool, delSchool, addSchool, updateSchool } from "@/api/app/school";
import { listSchool, getSchool, delSchool, addSchool, updateSchool , uploadAvatar } from "@/api/app/school";
export default {
name: "School",
@ -255,3 +269,31 @@ export default {
}
};
</script>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>