This commit is contained in:
haotian 2025-01-14 15:21:08 +08:00
parent e674c2a070
commit e5eac833ff
8 changed files with 47 additions and 48 deletions

View File

@ -11,7 +11,8 @@ public class AppARController {
@PostMapping("/getSource")
public String getSource(){
return "{ source_id:111111,city:济南,scenic:泉城广场,part:A,coordinate:0101,work_address:https://iknow-pic.cdn.bcebos.com/37d12f2eb9389b507e7594cf9735e5dde6116ea0}";
System.out.println("AR发送数据");
return "获取消息成功";
}
@PostMapping("/getPeople")
public String getAR(){

View File

@ -950,6 +950,8 @@ public class AppSystemController extends BaseController {
for(PublishUserWorkDto publishUserWorkDto:publishUserWorkDtoList){
Long sourceId = publishUserWorkDto.getSourceId();
System.out.println("发布选中的资源位id: "+ sourceId);
Long workId = publishUserWorkDto.getWorkId();
Long day = publishUserWorkDto.getDay();
@ -1027,7 +1029,7 @@ public class AppSystemController extends BaseController {
List<List<String>> value = redisCache.getCacheObject("order_"+sourceId);
System.out.println("缓存中存在键值: order_"+value);
System.out.println("缓存中存在键值: order_"+sourceId+":"+value);
for(List<String> tList : value){
@ -1584,52 +1586,25 @@ public class AppSystemController extends BaseController {
@Transactional
public AjaxResult addLike(@PathVariable("workId") Long workId)
{
Long userId = SecurityUtils.getUserId();
SysUserLike sysUserLike = new SysUserLike();
Long userId = getUserId();
sysUserLike.setUserId(userId);
sysUserLike.setTargetId(workId);
// 点赞作品
sysUserLike.setTargetType("0");
// 作品点赞数加1
UserWork userWork = userWorkService.selectUserWorkByWorkId(workId);
userWork.setReceiveRockets(userWork.getReceiveRockets() + 1);
userWorkService.updateUserWork(userWork);
List<SysUserLike> sysUserLikeList = userLikeService.selectSysUserLikeList(sysUserLike);
if(sysUserLikeList.size() > 0){
return AjaxResult.warn("已点赞");
}
else{
// 发送点赞消息
SysUserNotification sysUserNotification = new SysUserNotification();
sysUserNotification.setSenderId(userId);
sysUserNotification.setUserId(userWork.getUserId());
sysUserNotification.setType("2");
sysUserNotification.setStatus("0");
sysUserNotification.setTargetId(workId);
sysUserNotification.setDetail("点赞了你的作品");
userNotificationService.insertSysUserNotification(sysUserNotification);
// 新增点赞消息
int back = userLikeService.insertSysUserLike(sysUserLike);
if(back == 0){
return AjaxResult.error("新增点赞失败");
}
//发送消息通知
SysUserNotification sysUserNotification = new SysUserNotification();
// 作品所有者id
UserWork userWork = userWorkService.selectUserWorkByWorkId(workId);
sysUserNotification.setUserId(userWork.getUserId());
System.out.println("用户id:"+userWork.getUserId());
// 目标作品id
sysUserNotification.setTargetId(workId);
// 点赞人id
sysUserNotification.setSenderId(userId);
// 2代表作品点赞消息
sysUserNotification.setType("2");
int back1 = userNotificationService.insertSysUserNotification(sysUserNotification);
if(back1 == 0){
return AjaxResult.error("新增点赞消息失败");
}
return AjaxResult.success("新增点赞成功");
}
return success("点赞成功");
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.domain;
import java.time.LocalDate;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
@ -43,7 +44,7 @@ public class DailySource extends BaseEntity
/** 每天时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "每天时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date date;
private LocalDate date;
public void setDailySourceId(Long dailySourceId)
{
@ -99,12 +100,12 @@ public class DailySource extends BaseEntity
{
return shares;
}
public void setDate(Date date)
public void setDate(LocalDate date)
{
this.date = date;
}
public Date getDate()
public LocalDate getDate()
{
return date;
}

View File

@ -73,4 +73,9 @@ public interface DailySourceMapper
* */
public DailyScenicDto getDailyScenicDto(@Param("date") LocalDate date, @Param("scenicId") Long scenicId);
/*
* 根据资源位id和日期查询资源位每天统计
* */
public DailySource getDailySourceBySourceIdAndDate(@Param("sourceId") Long sourceId, @Param("date") LocalDate date);
}

View File

@ -71,4 +71,9 @@ public interface IDailySourceService
* 各个景区的资源位每天统计
* */
public DailyScenicDto getDailyScenicDto(LocalDate date, Long scenicId);
/*
* 根据资源位id和日期查询资源位每天统计
* */
public DailySource getDailySourceBySourceIdAndDate(Long sourceId, LocalDate date);
}

View File

@ -110,4 +110,12 @@ public class DailySourceServiceImpl implements IDailySourceService
public DailyScenicDto getDailyScenicDto(LocalDate date, Long scenicId){
return dailySourceMapper.getDailyScenicDto(date,scenicId);
}
/*
* 根据资源位id和日期查询资源位每天统计
* */
@Override
public DailySource getDailySourceBySourceIdAndDate(Long sourceId, LocalDate date){
return dailySourceMapper.getDailySourceBySourceIdAndDate(sourceId,date);
}
}

View File

@ -64,6 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where date = #{date} and s.scenic_id = #{scenicId}
</select>
<select id="getDailySourceBySourceIdAndDate" resultMap="DailySourceResult">
select * from daily_source
where source_id = #{sourceId} and date = #{date}
</select>
<insert id="insertDailySource" parameterType="DailySource" useGeneratedKeys="true" keyProperty="dailySourceId">
insert into daily_source

View File

@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectUserWorkVo">
select work_id, user_id, work_name, work_address, coordinate, create_time, post_time, work_status, audit_opinion, source_id, price, receive_rockets, detail, delete_flag, scenic, part, city from user_work
select work_id, user_id, work_name, work_address, coordinate, create_time, post_time, work_status, audit_opinion, source_id, price, receive_rockets, detail, delete_flag, scenic, part, city , update_time from user_work
</sql>
<select id="selectUserWorkList" parameterType="UserWork" resultMap="UserWorkResult">