Commit 312a83e6 by 邹磊浩

修改代码

parent 7187501f
...@@ -14,6 +14,7 @@ import com.pz.merchant.domain.vo.EmployeesListVo; ...@@ -14,6 +14,7 @@ import com.pz.merchant.domain.vo.EmployeesListVo;
import com.pz.merchant.domain.vo.EmployeesVo; import com.pz.merchant.domain.vo.EmployeesVo;
import com.pz.merchant.domain.vo.OrderInfoVO; import com.pz.merchant.domain.vo.OrderInfoVO;
import com.pz.merchant.domain.vo.TodayOrderListVo; import com.pz.merchant.domain.vo.TodayOrderListVo;
import com.pz.merchant.service.ICompanyService;
import com.pz.merchant.service.IEmployeesService; import com.pz.merchant.service.IEmployeesService;
import com.pz.system.service.ISysUserService; import com.pz.system.service.ISysUserService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -39,6 +40,8 @@ public class AccompanyEmployeesController extends BaseController { ...@@ -39,6 +40,8 @@ public class AccompanyEmployeesController extends BaseController {
private final ISysUserService iSysUserService; private final ISysUserService iSysUserService;
private final ICompanyService iCompanyService;
/** /**
* 修改陪诊员个人信息 * 修改陪诊员个人信息
* *
...@@ -64,6 +67,7 @@ public class AccompanyEmployeesController extends BaseController { ...@@ -64,6 +67,7 @@ public class AccompanyEmployeesController extends BaseController {
Optional.ofNullable(iSysUserService.selectUserById(getUserId())) Optional.ofNullable(iSysUserService.selectUserById(getUserId()))
.ifPresent(sysUser -> { .ifPresent(sysUser -> {
employeesVo.setAvatar(sysUser.getAvatar()); employeesVo.setAvatar(sysUser.getAvatar());
employeesVo.setPhone(sysUser.getPhonenumber());
}); });
return R.ok(employeesVo); return R.ok(employeesVo);
} }
......
...@@ -89,7 +89,7 @@ public class AppletArticleController extends BaseController { ...@@ -89,7 +89,7 @@ public class AppletArticleController extends BaseController {
@RepeatSubmit() @RepeatSubmit()
@PostMapping("/Comment") @PostMapping("/Comment")
public R<Void> add(@Validated(AddGroup.class) @RequestBody ArticleCommentBo bo) { public R<Void> add(@Validated(AddGroup.class) @RequestBody ArticleCommentBo bo) {
bo.setUid(1); bo.setUid(getUserId());
return toAjax(iArticleService.insertByComment(bo)); return toAjax(iArticleService.insertByComment(bo));
} }
......
...@@ -2,6 +2,7 @@ package com.pz.applet; ...@@ -2,6 +2,7 @@ package com.pz.applet;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.pz.common.utils.DateUtils; import com.pz.common.utils.DateUtils;
import com.pz.system.domain.Message; import com.pz.system.domain.Message;
...@@ -184,7 +185,7 @@ public class WebSocketOneToOneController { ...@@ -184,7 +185,7 @@ public class WebSocketOneToOneController {
List<Object> list = sessionPool.get(sessionList.getToUserId()); List<Object> list = sessionPool.get(sessionList.getToUserId());
try { try {
if (list == null || list.isEmpty()) { if (CollectionUtils.isEmpty(list)) {
//增加对方未读数 //增加对方未读数
sessionListMapper.addUnReadCount(receiveId, sendId); sessionListMapper.addUnReadCount(receiveId, sendId);
//发送消息 //发送消息
......
...@@ -301,7 +301,7 @@ public class EmployeesServiceImpl implements IEmployeesService { ...@@ -301,7 +301,7 @@ public class EmployeesServiceImpl implements IEmployeesService {
Optional.ofNullable(companyMapper.selectVoById(employeesVo.getCompanyId())) Optional.ofNullable(companyMapper.selectVoById(employeesVo.getCompanyId()))
.ifPresent(companyVo -> employeesVo.setCompanyName(companyVo.getName())); .ifPresent(companyVo -> employeesVo.setCompanyName(companyVo.getName()));
return baseMapper.selectVoOne(Wrappers.<Employees>lambdaQuery().eq(Employees::getUid, userId)); return employeesVo;
} }
@Override @Override
......
...@@ -30,7 +30,7 @@ public class ArticleCommentBo extends BaseEntity { ...@@ -30,7 +30,7 @@ public class ArticleCommentBo extends BaseEntity {
/** /**
* 用户 * 用户
*/ */
private Integer uid; private Long uid;
/** /**
* 评论 * 评论
......
...@@ -8,8 +8,10 @@ import com.pz.common.core.domain.BaseEntity; ...@@ -8,8 +8,10 @@ import com.pz.common.core.domain.BaseEntity;
import com.pz.system.domain.Carousel; import com.pz.system.domain.Carousel;
import com.pz.system.domain.StoreGoodsTag; import com.pz.system.domain.StoreGoodsTag;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
...@@ -21,7 +23,7 @@ import java.util.List; ...@@ -21,7 +23,7 @@ import java.util.List;
*/ */
@Data @Data
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
public class StoreGoodsVo extends BaseEntity { public class StoreGoodsVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -125,4 +127,6 @@ public class StoreGoodsVo extends BaseEntity { ...@@ -125,4 +127,6 @@ public class StoreGoodsVo extends BaseEntity {
* 流水单号 * 流水单号
*/ */
private String logisticsCode; private String logisticsCode;
private Date updateTime;
} }
package com.pz.system.service.impl; package com.pz.system.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.pz.common.core.domain.entity.SysUser; import com.pz.common.core.domain.entity.SysUser;
...@@ -61,32 +62,62 @@ public class ArticleServiceImpl implements IArticleService { ...@@ -61,32 +62,62 @@ public class ArticleServiceImpl implements IArticleService {
LoginUser loginUser = LoginHelper.getLoginUser(); LoginUser loginUser = LoginHelper.getLoginUser();
ArticleVo articleVo = baseMapper.selectVoById(id); ArticleVo articleVo = baseMapper.selectVoById(id);
Long aLong = userAppreciateMapper.selectCount(Wrappers.<UserAppreciate>lambdaQuery().eq(UserAppreciate::getAid, id));
Long aLong2 = userAppreciateMapper.selectCount(Wrappers.<UserAppreciate>lambdaQuery().eq(UserAppreciate::getAid, id).eq(UserAppreciate::getUid,loginUser.getUserId()));
Long aLong1 = userCollectMapper.selectCount(Wrappers.<UserCollect>lambdaQuery().eq(UserCollect::getAid, id));
Long aLong3 = userCollectMapper.selectCount(Wrappers.<UserCollect>lambdaQuery().eq(UserCollect::getAid, id).eq(UserCollect::getUid,loginUser.getUserId()));
//是否点赞
articleVo.setAppreciate(aLong2 != 0);
//点赞数量
articleVo.setAppreciateNum(Math.toIntExact(aLong));
//是否收藏
articleVo.setCollect(aLong3 != 0);
//收藏数量
articleVo.setCollectNum(Math.toIntExact(aLong1));
//用户评论
List<ArticleCommentVo> articleCommentVos = articleCommentMapper.selectVoList(Wrappers.<ArticleComment>lambdaQuery().eq(ArticleComment::getAid, id).eq(ArticleComment::getUid,loginUser.getUserId()));
// 查询点赞数量和是否点赞
LambdaQueryWrapper<UserAppreciate> appreciateWrapper = Wrappers.<UserAppreciate>lambdaQuery().eq(UserAppreciate::getAid, id);
Long appreciateCount = userAppreciateMapper.selectCount(appreciateWrapper);
appreciateWrapper.eq(UserAppreciate::getUid, loginUser.getUserId());
boolean appreciated = userAppreciateMapper.selectCount(appreciateWrapper) != 0;
articleVo.setAppreciate(appreciated);
articleVo.setAppreciateNum(Math.toIntExact(appreciateCount));
// 查询收藏数量和是否收藏
LambdaQueryWrapper<UserCollect> collectWrapper = Wrappers.<UserCollect>lambdaQuery().eq(UserCollect::getAid, id);
Long collectCount = userCollectMapper.selectCount(collectWrapper);
collectWrapper.eq(UserCollect::getUid, loginUser.getUserId());
boolean collected = userCollectMapper.selectCount(collectWrapper) != 0;
articleVo.setCollect(collected);
articleVo.setCollectNum(Math.toIntExact(collectCount));
// 查询用户评论
List<ArticleCommentVo> articleCommentVos = articleCommentMapper.selectVoList(Wrappers.<ArticleComment>lambdaQuery()
.eq(ArticleComment::getAid, id).eq(ArticleComment::getUid, loginUser.getUserId()));
// 查询用户信息并设置到评论中
if (articleCommentVos != null && !articleCommentVos.isEmpty()) {
Set<Long> userIds = new HashSet<>();
for (ArticleCommentVo articleCommentVo : articleCommentVos) { for (ArticleCommentVo articleCommentVo : articleCommentVos) {
if (null != articleCommentVo.getUid()) { Long uid = articleCommentVo.getUid();
SysUser sysUser = sysUserMapper.selectById(loginUser.getUserId().intValue()); if (uid != null) {
userIds.add(uid);
}
}
Map<Long, SysUser> sysUserMap = new HashMap<>();
if (!userIds.isEmpty()) {
List<SysUser> sysUsers = sysUserMapper.selectBatchIds(userIds);
for (SysUser sysUser : sysUsers) {
sysUserMap.put(sysUser.getUserId(), sysUser);
}
}
for (ArticleCommentVo articleCommentVo : articleCommentVos) {
Long uid = articleCommentVo.getUid();
if (uid != null) {
SysUser sysUser = sysUserMap.get(uid);
if (sysUser != null) {
articleCommentVo.setAvatar(sysUser.getAvatar()); articleCommentVo.setAvatar(sysUser.getAvatar());
articleCommentVo.setUserName(sysUser.getUserName()); articleCommentVo.setUserName(sysUser.getUserName());
} }
} }
}
}
articleVo.setComment(articleCommentVos); articleVo.setComment(articleCommentVos);
return articleVo; return articleVo;
} }
/** /**
* 查询文章列表 * 查询文章列表
*/ */
...@@ -215,7 +246,7 @@ public class ArticleServiceImpl implements IArticleService { ...@@ -215,7 +246,7 @@ public class ArticleServiceImpl implements IArticleService {
//List<String> ids = JsonUtils.parseArray(articleVo.getCover(), String.class); //List<String> ids = JsonUtils.parseArray(articleVo.getCover(), String.class);
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
// 使用逗号分割字符串,并逐个转换为 Integer 添加到 List 中 // 使用逗号分割字符串,并逐个转换为 Integer 添加到 List 中
if(null != articleVo.getCover()){ if (null != articleVo.getCover()) {
Collections.addAll(ids, articleVo.getCover().split(",")); Collections.addAll(ids, articleVo.getCover().split(","));
articleVo.setCoverList(ids); articleVo.setCoverList(ids);
} }
...@@ -293,7 +324,7 @@ public class ArticleServiceImpl implements IArticleService { ...@@ -293,7 +324,7 @@ public class ArticleServiceImpl implements IArticleService {
@Override @Override
public Boolean insertByComment(ArticleCommentBo bo) { public Boolean insertByComment(ArticleCommentBo bo) {
ArticleComment add = BeanUtil.toBean(bo, ArticleComment.class); ArticleComment add = BeanUtil.toBean(bo, ArticleComment.class);
add.setUid(bo.getUid());
boolean flag = articleCommentMapper.insert(add) > 0; boolean flag = articleCommentMapper.insert(add) > 0;
if (flag) { if (flag) {
bo.setId(add.getId()); bo.setId(add.getId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment