From 685afc44df3474a49ef5e2d230ddfb5aef3aa3a3 Mon Sep 17 00:00:00 2001 From: haotianmingyue <2421912570@qq.com> Date: Mon, 9 Dec 2024 17:21:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90,=20=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=90=8E=E5=8F=B0=E5=85=85=E5=80=BC=E8=BF=98?= =?UTF-8?q?=E6=98=AF1=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/app/pay/PayController.java | 113 ------------- .../web/controller/app/pay/PayService.java | 147 ++++++++++++++++ .../controller/DailySourceController.java | 104 ++++++++++++ .../controller/SysUserFollowController.java | 104 ++++++++++++ .../controller/SysUserLikeController.java | 104 ++++++++++++ .../SysUserNotificationController.java | 104 ++++++++++++ .../com/ruoyi/system/domain/DailySource.java | 124 ++++++++++++++ .../ruoyi/system/domain/SysUserFollow.java | 81 +++++++++ .../com/ruoyi/system/domain/SysUserLike.java | 95 +++++++++++ .../system/domain/SysUserNotification.java | 123 ++++++++++++++ .../ruoyi/system/domain/dto/MRTimeDto.java | 2 + .../system/mapper/DailySourceMapper.java | 61 +++++++ .../system/mapper/SysUserFollowMapper.java | 61 +++++++ .../system/mapper/SysUserLikeMapper.java | 63 +++++++ .../mapper/SysUserNotificationMapper.java | 63 +++++++ .../system/service/IDailySourceService.java | 61 +++++++ .../service/impl/DailySourceServiceImpl.java | 93 +++++++++++ .../impl/SysUserFollowServiceImpl.java | 96 +++++++++++ .../service/impl/SysUserLikeServiceImpl.java | 101 +++++++++++ .../impl/SysUserNotificationServiceImpl.java | 157 ++++++++++++++++++ ...iceImpl.java => SysUserStServiceImpl.java} | 17 +- .../mapper/system/SysUserFollowMapper.xml | 74 +++++++++ .../mapper/system/SysUserLikeMapper.xml | 86 ++++++++++ .../system/SysUserNotificationMapper.xml | 94 +++++++++++ 24 files changed, 2012 insertions(+), 116 deletions(-) delete mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/pay/PayController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/pay/PayService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/controller/DailySourceController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserFollowController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserLikeController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserNotificationController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/DailySource.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserFollow.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserLike.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserNotification.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MRTimeDto.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/DailySourceMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserFollowMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserLikeMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserNotificationMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IDailySourceService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DailySourceServiceImpl.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserFollowServiceImpl.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserLikeServiceImpl.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserNotificationServiceImpl.java rename ruoyi-system/src/main/java/com/ruoyi/system/service/impl/{SysUserCountServiceImpl.java => SysUserStServiceImpl.java} (66%) create mode 100644 ruoyi-system/src/main/resources/mapper/system/SysUserFollowMapper.xml create mode 100644 ruoyi-system/src/main/resources/mapper/system/SysUserLikeMapper.xml create mode 100644 ruoyi-system/src/main/resources/mapper/system/SysUserNotificationMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/pay/PayController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/pay/PayController.java deleted file mode 100644 index 2dd614f4..00000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/pay/PayController.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.ruoyi.web.controller.app.pay; - - -import com.jeequan.jeepay.JeepayClient; -import com.jeequan.jeepay.response.PayOrderCreateResponse; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.redis.RedisCache; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.system.domain.SysSource; -import com.ruoyi.system.domain.UserWork; -import com.ruoyi.system.domain.dto.PublishUserWorkDto; -import com.ruoyi.system.domain.dto.SourcePriceDto; -import com.ruoyi.system.domain.vo.PayResponseVo; -import com.ruoyi.system.service.ISysSourceService; -import com.ruoyi.system.service.IUserWorkService; -import com.ruoyi.web.controller.app.baidu.GsonUtils; -import org.springframework.beans.factory.annotation.Autowired; -import com.ruoyi.common.utils.uuid.UUID; -import com.jeequan.jeepay.model.PayOrderCreateReqModel; -import com.jeequan.jeepay.request.PayOrderCreateRequest; -import com.alibaba.fastjson.JSONObject; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.concurrent.TimeUnit; - -//@RestController -//@RequestMapping("/pay") -public class PayController extends BaseController { - public static final String APPKEY = ""; - public static String APPID = ""; - public static String MCHNO = ""; - - @Autowired - private IUserWorkService userWorkService; - - @Autowired - ISysSourceService sysSourceService; - - @Autowired - private static RedisCache redisCache; - - public static boolean genOrder(List publishUserWorkDtoList,Long userId ,Long price){ - - String mchOrderNo = "M" + UUID.randomUUID().toString().replaceAll("-", ""); - redisCache.setCacheObject(mchOrderNo, userId + "_" + 0, 1, TimeUnit.DAYS); -// log.info("缓存订单和用户关系: mchOrderNo=" + mchOrderNo + ", userId=" + userId); - // 支付方式 - String wayCode = "QR_CASHIER"; - - Byte divisionMode = 0; - - // 前端明确了支付参数的类型 payDataType - String payDataType = "codeImgUrl"; - String authCode = "payurl"; - - PayOrderCreateRequest request = new PayOrderCreateRequest(); - PayOrderCreateReqModel model = new PayOrderCreateReqModel(); - request.setBizModel(model); - - - model.setMchNo(MCHNO); // 商户号 - model.setAppId(APPID); - model.setMchOrderNo(mchOrderNo); - model.setWayCode(wayCode); - model.setAmount(price); - model.setReturnUrl("http://"); - // paypal通道使用USD类型货币 - model.setCurrency("CNY"); - model.setClientIp("127.0.0.1"); - model.setSubject("" + MCHNO + ""); - model.setBody("正常订单" + "[" + MCHNO + "]"); - - model.setNotifyUrl("http://62.234.19.34:8991/wxPay/result/wxRechargeCallback/"); //回调地址 - model.setReturnUrl(""); - model.setDivisionMode(divisionMode); //分账模式 - - //设置扩展参数 - JSONObject extParams = new JSONObject(); - if (StringUtils.isNotEmpty(payDataType)) { - extParams.put("payDataType", payDataType.trim()); - } - if (StringUtils.isNotEmpty(authCode)) { - extParams.put("authCode", authCode.trim()); - } - model.setChannelExtra(extParams.toString()); - - JeepayClient jeepayClient = new JeepayClient("http://payment.pay.oetsoft.com", - APPKEY); - -// PayOrderCreateResponse payOrderCreateResponse = jeepayClient.execute(request); -// System.out.println(payOrderCreateResponse.toString()); -// PayResponseVo payResponseVo = JSONObject.parseObject(payOrderCreateResponse.toString(), PayResponseVo.class); -// String url = payResponseVo.getData().getPayData(); -// //设置Access-Control-Expose-Headers避免前端调用获取Content-Disposition出现Refused to get unsafe header异常 - -// response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); -// response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("img.jpg", "UTF-8")); - - - - - return true; - } - -// @PostMapping("/WechatPay") -// public AjaxResult WechatPay(@RequestBody List payDtoList){ -// return null; -// -// } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/pay/PayService.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/pay/PayService.java new file mode 100644 index 00000000..b776c58c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/pay/PayService.java @@ -0,0 +1,147 @@ +package com.ruoyi.web.controller.app.pay; + + +import com.jeequan.jeepay.JeepayClient; +import com.jeequan.jeepay.response.PayOrderCreateResponse; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysSource; +import com.ruoyi.system.domain.UserWork; +import com.ruoyi.system.domain.dto.PublishUserWorkDto; +import com.ruoyi.system.domain.dto.SourcePriceDto; +import com.ruoyi.system.domain.vo.PayResponseVo; +import com.ruoyi.system.service.ISysSourceService; +import com.ruoyi.system.service.IUserWorkService; +import com.ruoyi.web.controller.app.baidu.GsonUtils; +import org.springframework.beans.factory.annotation.Autowired; +import com.ruoyi.common.utils.uuid.UUID; +import com.jeequan.jeepay.model.PayOrderCreateReqModel; +import com.jeequan.jeepay.request.PayOrderCreateRequest; +import com.alibaba.fastjson.JSONObject; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +@Service +public class PayService { + public static final String APPKEY = ""; + public static String APPID = ""; + public static String MCHNO = ""; + + @Autowired + private IUserWorkService userWorkService; + + @Autowired + private ISysSourceService sysSourceService; + + @Autowired + private RedisCache redisCache; + + + + public boolean genOrder(List orderIdList, Long Price, Long userId) { + + + + try { + + // 订单号, 自己生成,用来标识这一次支付. + String mchOrderNo = "M" + UUID.randomUUID().toString().replaceAll("-", ""); + + // 将订单号以字符串拼接 + String result = orderIdList.stream() + .map(Object::toString) + .collect(Collectors.joining("_")); + + System.out.println("订单id: "+result); + + // 缓存订单和用户关系, + // 这里值应该是 orderIdList + Price + userId + System.out.println("userId"+userId); + System.out.println("mchOrderNo: " + mchOrderNo); + System.out.println(redisCache); + System.out.println("result: "+result); + + redisCache.setCacheObject(mchOrderNo, userId.toString() + "_" + result, 1, TimeUnit.DAYS); + System.out.println(redisCache.getCacheObject(mchOrderNo).toString()); +// log.info("缓存订单和用户关系: mchOrderNo=" + mchOrderNo + ", userId=" + userId); + + +// //---------------------------------------------------测试环境 先注释掉-------------------------------------------------------- +// // 支付方式 +// String wayCode = "QR_CASHIER"; +// +// Byte divisionMode = 0; +// +// // 前端明确了支付参数的类型 payDataType +// String payDataType = "codeImgUrl"; +// String authCode = "payurl"; +// +// PayOrderCreateRequest request = new PayOrderCreateRequest(); +// PayOrderCreateReqModel model = new PayOrderCreateReqModel(); +// request.setBizModel(model); +// +// +// model.setMchNo(MCHNO); // 商户号 +// model.setAppId(APPID); +// model.setMchOrderNo(mchOrderNo); +// model.setWayCode(wayCode); +// model.setAmount(Price); +// model.setReturnUrl("http://"); +// // paypal通道使用USD类型货币 +// model.setCurrency("CNY"); +// model.setClientIp("127.0.0.1"); +// model.setSubject("" + MCHNO + ""); +// model.setBody("正常订单" + "[" + MCHNO + "]"); +// +// // 支付回调地址 +// model.setNotifyUrl("http://62.234.19.34:8991/wxPay/result/wxRechargeCallback/"+result); //回调地址 +// model.setReturnUrl(""); +// model.setDivisionMode(divisionMode); //分账模式 +// +// //设置扩展参数 +// JSONObject extParams = new JSONObject(); +// if (StringUtils.isNotEmpty(payDataType)) { +// extParams.put("payDataType", payDataType.trim()); +// } +// if (StringUtils.isNotEmpty(authCode)) { +// extParams.put("authCode", authCode.trim()); +// } +// model.setChannelExtra(extParams.toString()); +// +// JeepayClient jeepayClient = new JeepayClient("http://payment.pay.oetsoft.com", +// APPKEY); +// +// PayOrderCreateResponse payOrderCreateResponse = jeepayClient.execute(request); +// System.out.println(payOrderCreateResponse.toString()); +// PayResponseVo payResponseVo = JSONObject.parseObject(payOrderCreateResponse.toString(), PayResponseVo.class); +// String url = payResponseVo.getData().getPayData(); +// +// //-------------------------------------------------测试环境先注释掉----------------------------------------------------------- + +// //设置Access-Control-Expose-Headers避免前端调用获取Content-Disposition出现Refused to get unsafe header异常 +// +// response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); +// response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("img.jpg", "UTF-8")); + + + return true; + }catch (Exception e){ + System.out.println(e); + return false; + } + } + +// @PostMapping("/WechatPay") +// public AjaxResult WechatPay(@RequestBody List payDtoList){ +// return null; +// +// } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/DailySourceController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/DailySourceController.java new file mode 100644 index 00000000..f7ed2edb --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/DailySourceController.java @@ -0,0 +1,104 @@ +package com.ruoyi.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +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.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.DailySource; +import com.ruoyi.system.service.IDailySourceService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 资源位每天统计Controller + * + * @author haotian + * @date 2024-12-09 + */ +@RestController +@RequestMapping("/system/source") +public class DailySourceController extends BaseController +{ + @Autowired + private IDailySourceService dailySourceService; + + /** + * 查询资源位每天统计列表 + */ + @PreAuthorize("@ss.hasPermi('system:source:list')") + @GetMapping("/list") + public TableDataInfo list(DailySource dailySource) + { + startPage(); + List list = dailySourceService.selectDailySourceList(dailySource); + return getDataTable(list); + } + + /** + * 导出资源位每天统计列表 + */ + @PreAuthorize("@ss.hasPermi('system:source:export')") + @Log(title = "资源位每天统计", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DailySource dailySource) + { + List list = dailySourceService.selectDailySourceList(dailySource); + ExcelUtil util = new ExcelUtil(DailySource.class); + util.exportExcel(response, list, "资源位每天统计数据"); + } + + /** + * 获取资源位每天统计详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:source:query')") + @GetMapping(value = "/{dailySourceId}") + public AjaxResult getInfo(@PathVariable("dailySourceId") Long dailySourceId) + { + return success(dailySourceService.selectDailySourceByDailySourceId(dailySourceId)); + } + + /** + * 新增资源位每天统计 + */ + @PreAuthorize("@ss.hasPermi('system:source:add')") + @Log(title = "资源位每天统计", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DailySource dailySource) + { + return toAjax(dailySourceService.insertDailySource(dailySource)); + } + + /** + * 修改资源位每天统计 + */ + @PreAuthorize("@ss.hasPermi('system:source:edit')") + @Log(title = "资源位每天统计", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DailySource dailySource) + { + return toAjax(dailySourceService.updateDailySource(dailySource)); + } + + /** + * 删除资源位每天统计 + */ + @PreAuthorize("@ss.hasPermi('system:source:remove')") + @Log(title = "资源位每天统计", businessType = BusinessType.DELETE) + @DeleteMapping("/{dailySourceIds}") + public AjaxResult remove(@PathVariable Long[] dailySourceIds) + { + return toAjax(dailySourceService.deleteDailySourceByDailySourceIds(dailySourceIds)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserFollowController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserFollowController.java new file mode 100644 index 00000000..fbe92f9d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserFollowController.java @@ -0,0 +1,104 @@ +package com.ruoyi.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +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.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.SysUserFollow; +import com.ruoyi.system.service.ISysUserFollowService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 用户关注Controller + * + * @author haotian + * @date 2024-12-02 + */ +@RestController +@RequestMapping("/system/follow") +public class SysUserFollowController extends BaseController +{ + @Autowired + private ISysUserFollowService sysUserFollowService; + + /** + * 查询用户关注列表 + */ + @PreAuthorize("@ss.hasPermi('system:follow:list')") + @GetMapping("/list") + public TableDataInfo list(SysUserFollow sysUserFollow) + { + startPage(); + List list = sysUserFollowService.selectSysUserFollowList(sysUserFollow); + return getDataTable(list); + } + + /** + * 导出用户关注列表 + */ + @PreAuthorize("@ss.hasPermi('system:follow:export')") + @Log(title = "用户关注", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysUserFollow sysUserFollow) + { + List list = sysUserFollowService.selectSysUserFollowList(sysUserFollow); + ExcelUtil util = new ExcelUtil(SysUserFollow.class); + util.exportExcel(response, list, "用户关注数据"); + } + + /** + * 获取用户关注详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:follow:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sysUserFollowService.selectSysUserFollowById(id)); + } + + /** + * 新增用户关注 + */ + @PreAuthorize("@ss.hasPermi('system:follow:add')") + @Log(title = "用户关注", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysUserFollow sysUserFollow) + { + return toAjax(sysUserFollowService.insertSysUserFollow(sysUserFollow)); + } + + /** + * 修改用户关注 + */ + @PreAuthorize("@ss.hasPermi('system:follow:edit')") + @Log(title = "用户关注", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysUserFollow sysUserFollow) + { + return toAjax(sysUserFollowService.updateSysUserFollow(sysUserFollow)); + } + + /** + * 删除用户关注 + */ + @PreAuthorize("@ss.hasPermi('system:follow:remove')") + @Log(title = "用户关注", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysUserFollowService.deleteSysUserFollowByIds(ids)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserLikeController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserLikeController.java new file mode 100644 index 00000000..f67f4710 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserLikeController.java @@ -0,0 +1,104 @@ +package com.ruoyi.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +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.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.SysUserLike; +import com.ruoyi.system.service.ISysUserLikeService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 用户点赞Controller + * + * @author haotian + * @date 2024-12-02 + */ +@RestController +@RequestMapping("/system/like") +public class SysUserLikeController extends BaseController +{ + @Autowired + private ISysUserLikeService sysUserLikeService; + + /** + * 查询用户点赞列表 + */ + @PreAuthorize("@ss.hasPermi('system:like:list')") + @GetMapping("/list") + public TableDataInfo list(SysUserLike sysUserLike) + { + startPage(); + List list = sysUserLikeService.selectSysUserLikeList(sysUserLike); + return getDataTable(list); + } + + /** + * 导出用户点赞列表 + */ + @PreAuthorize("@ss.hasPermi('system:like:export')") + @Log(title = "用户点赞", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysUserLike sysUserLike) + { + List list = sysUserLikeService.selectSysUserLikeList(sysUserLike); + ExcelUtil util = new ExcelUtil(SysUserLike.class); + util.exportExcel(response, list, "用户点赞数据"); + } + + /** + * 获取用户点赞详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:like:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sysUserLikeService.selectSysUserLikeById(id)); + } + + /** + * 新增用户点赞 + */ + @PreAuthorize("@ss.hasPermi('system:like:add')") + @Log(title = "用户点赞", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysUserLike sysUserLike) + { + return toAjax(sysUserLikeService.insertSysUserLike(sysUserLike)); + } + + /** + * 修改用户点赞 + */ + @PreAuthorize("@ss.hasPermi('system:like:edit')") + @Log(title = "用户点赞", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysUserLike sysUserLike) + { + return toAjax(sysUserLikeService.updateSysUserLike(sysUserLike)); + } + + /** + * 删除用户点赞 + */ + @PreAuthorize("@ss.hasPermi('system:like:remove')") + @Log(title = "用户点赞", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysUserLikeService.deleteSysUserLikeByIds(ids)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserNotificationController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserNotificationController.java new file mode 100644 index 00000000..89b34c91 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserNotificationController.java @@ -0,0 +1,104 @@ +package com.ruoyi.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +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.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.SysUserNotification; +import com.ruoyi.system.service.ISysUserNotificationService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 用户消息通知Controller + * + * @author haotian + * @date 2024-12-02 + */ +@RestController +@RequestMapping("/system/notification") +public class SysUserNotificationController extends BaseController +{ + @Autowired + private ISysUserNotificationService sysUserNotificationService; + + /** + * 查询用户消息通知列表 + */ + @PreAuthorize("@ss.hasPermi('system:notification:list')") + @GetMapping("/list") + public TableDataInfo list(SysUserNotification sysUserNotification) + { + startPage(); + List list = sysUserNotificationService.selectSysUserNotificationList(sysUserNotification); + return getDataTable(list); + } + + /** + * 导出用户消息通知列表 + */ + @PreAuthorize("@ss.hasPermi('system:notification:export')") + @Log(title = "用户消息通知", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysUserNotification sysUserNotification) + { + List list = sysUserNotificationService.selectSysUserNotificationList(sysUserNotification); + ExcelUtil util = new ExcelUtil(SysUserNotification.class); + util.exportExcel(response, list, "用户消息通知数据"); + } + + /** + * 获取用户消息通知详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:notification:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sysUserNotificationService.selectSysUserNotificationById(id)); + } + + /** + * 新增用户消息通知 + */ + @PreAuthorize("@ss.hasPermi('system:notification:add')") + @Log(title = "用户消息通知", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysUserNotification sysUserNotification) + { + return toAjax(sysUserNotificationService.insertSysUserNotification(sysUserNotification)); + } + + /** + * 修改用户消息通知 + */ + @PreAuthorize("@ss.hasPermi('system:notification:edit')") + @Log(title = "用户消息通知", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysUserNotification sysUserNotification) + { + return toAjax(sysUserNotificationService.updateSysUserNotification(sysUserNotification)); + } + + /** + * 删除用户消息通知 + */ + @PreAuthorize("@ss.hasPermi('system:notification:remove')") + @Log(title = "用户消息通知", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysUserNotificationService.deleteSysUserNotificationByIds(ids)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/DailySource.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/DailySource.java new file mode 100644 index 00000000..67f2a6b8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/DailySource.java @@ -0,0 +1,124 @@ +package com.ruoyi.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 资源位每天统计对象 daily_source + * + * @author haotian + * @date 2024-12-09 + */ +public class DailySource extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键自增 */ + private Long dailySourceId; + + /** 资源位id */ + @Excel(name = "资源位id") + private Long sourceId; + + /** 用户MR在线时长 */ + @Excel(name = "用户MR在线时长") + private Long uMrTime; + + /** 被购买总数 */ + @Excel(name = "被购买总数") + private Long bought; + + /** 互动次数 */ + @Excel(name = "互动次数") + private Long interactions; + + /** 分享次数 */ + @Excel(name = "分享次数") + private Long shares; + + /** 每天时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "每天时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date date; + + public void setDailySourceId(Long dailySourceId) + { + this.dailySourceId = dailySourceId; + } + + public Long getDailySourceId() + { + return dailySourceId; + } + public void setSourceId(Long sourceId) + { + this.sourceId = sourceId; + } + + public Long getSourceId() + { + return sourceId; + } + public void setuMrTime(Long uMrTime) + { + this.uMrTime = uMrTime; + } + + public Long getuMrTime() + { + return uMrTime; + } + public void setBought(Long bought) + { + this.bought = bought; + } + + public Long getBought() + { + return bought; + } + public void setInteractions(Long interactions) + { + this.interactions = interactions; + } + + public Long getInteractions() + { + return interactions; + } + public void setShares(Long shares) + { + this.shares = shares; + } + + public Long getShares() + { + return shares; + } + public void setDate(Date date) + { + this.date = date; + } + + public Date getDate() + { + return date; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("dailySourceId", getDailySourceId()) + .append("sourceId", getSourceId()) + .append("uMrTime", getuMrTime()) + .append("bought", getBought()) + .append("interactions", getInteractions()) + .append("shares", getShares()) + .append("date", getDate()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserFollow.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserFollow.java new file mode 100644 index 00000000..a39ee13e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserFollow.java @@ -0,0 +1,81 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 用户关注对象 sys_user_follow + * + * @author haotian + * @date 2024-12-02 + */ +public class SysUserFollow extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 关注人用户ID */ + @Excel(name = "关注人用户ID") + private Long userId; + + /** 被关注人用户ID */ + @Excel(name = "被关注人用户ID") + private Long followedUserId; + + /** 状态(0正常 */ + @Excel(name = "状态", readConverterExp = "状态(0正常") + private String status; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setFollowedUserId(Long followedUserId) + { + this.followedUserId = followedUserId; + } + + public Long getFollowedUserId() + { + return followedUserId; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("userId", getUserId()) + .append("followedUserId", getFollowedUserId()) + .append("status", getStatus()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserLike.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserLike.java new file mode 100644 index 00000000..47dabd87 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserLike.java @@ -0,0 +1,95 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 用户点赞对象 sys_user_like + * + * @author haotian + * @date 2024-12-02 + */ +public class SysUserLike extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 点赞人用户ID */ + @Excel(name = "点赞人用户ID") + private Long userId; + + /** 被点赞的目标ID */ + @Excel(name = "被点赞的目标ID") + private Long targetId; + + /** 点赞类型(1帖子 */ + @Excel(name = "点赞类型", readConverterExp = "点赞类型(1帖子") + private String targetType; + + /** 状态(0正常 */ + @Excel(name = "状态", readConverterExp = "状态(0正常") + private String status; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setTargetId(Long targetId) + { + this.targetId = targetId; + } + + public Long getTargetId() + { + return targetId; + } + public void setTargetType(String targetType) + { + this.targetType = targetType; + } + + public String getTargetType() + { + return targetType; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("userId", getUserId()) + .append("targetId", getTargetId()) + .append("targetType", getTargetType()) + .append("status", getStatus()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserNotification.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserNotification.java new file mode 100644 index 00000000..e71e7bdf --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserNotification.java @@ -0,0 +1,123 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 用户消息通知对象 sys_user_notification + * + * @author haotian + * @date 2024-12-02 + */ +public class SysUserNotification extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 接收消息的用户ID */ + @Excel(name = "接收消息的用户ID") + private Long userId; + + /** 发送消息的用户ID */ + @Excel(name = "发送消息的用户ID") + private Long senderId; + + /** 消息类型(1关注 */ + @Excel(name = "消息类型", readConverterExp = "消息类型(1关注") + private String type; + + /** 相关目标ID */ + @Excel(name = "相关目标ID") + private Long targetId; + + /** 目标类型(1帖子 */ + @Excel(name = "目标类型", readConverterExp = "目标类型(1帖子") + private String targetType; + + /** 状态(0未读 */ + @Excel(name = "状态", readConverterExp = "状态(0未读") + private String status; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setSenderId(Long senderId) + { + this.senderId = senderId; + } + + public Long getSenderId() + { + return senderId; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setTargetId(Long targetId) + { + this.targetId = targetId; + } + + public Long getTargetId() + { + return targetId; + } + public void setTargetType(String targetType) + { + this.targetType = targetType; + } + + public String getTargetType() + { + return targetType; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("userId", getUserId()) + .append("senderId", getSenderId()) + .append("type", getType()) + .append("targetId", getTargetId()) + .append("targetType", getTargetType()) + .append("status", getStatus()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MRTimeDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MRTimeDto.java new file mode 100644 index 00000000..3a6dec69 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MRTimeDto.java @@ -0,0 +1,2 @@ +package com.ruoyi.system.domain.dto;public class MRTimeDto { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DailySourceMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DailySourceMapper.java new file mode 100644 index 00000000..ff6f7941 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DailySourceMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.DailySource; + +/** + * 资源位每天统计Mapper接口 + * + * @author haotian + * @date 2024-12-09 + */ +public interface DailySourceMapper +{ + /** + * 查询资源位每天统计 + * + * @param dailySourceId 资源位每天统计主键 + * @return 资源位每天统计 + */ + public DailySource selectDailySourceByDailySourceId(Long dailySourceId); + + /** + * 查询资源位每天统计列表 + * + * @param dailySource 资源位每天统计 + * @return 资源位每天统计集合 + */ + public List selectDailySourceList(DailySource dailySource); + + /** + * 新增资源位每天统计 + * + * @param dailySource 资源位每天统计 + * @return 结果 + */ + public int insertDailySource(DailySource dailySource); + + /** + * 修改资源位每天统计 + * + * @param dailySource 资源位每天统计 + * @return 结果 + */ + public int updateDailySource(DailySource dailySource); + + /** + * 删除资源位每天统计 + * + * @param dailySourceId 资源位每天统计主键 + * @return 结果 + */ + public int deleteDailySourceByDailySourceId(Long dailySourceId); + + /** + * 批量删除资源位每天统计 + * + * @param dailySourceIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDailySourceByDailySourceIds(Long[] dailySourceIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserFollowMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserFollowMapper.java new file mode 100644 index 00000000..db2696f6 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserFollowMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysUserFollow; + +/** + * 用户关注Mapper接口 + * + * @author haotian + * @date 2024-12-02 + */ +public interface SysUserFollowMapper +{ + /** + * 查询用户关注 + * + * @param id 用户关注主键 + * @return 用户关注 + */ + public SysUserFollow selectSysUserFollowById(Long id); + + /** + * 查询用户关注列表 + * + * @param sysUserFollow 用户关注 + * @return 用户关注集合 + */ + public List selectSysUserFollowList(SysUserFollow sysUserFollow); + + /** + * 新增用户关注 + * + * @param sysUserFollow 用户关注 + * @return 结果 + */ + public int insertSysUserFollow(SysUserFollow sysUserFollow); + + /** + * 修改用户关注 + * + * @param sysUserFollow 用户关注 + * @return 结果 + */ + public int updateSysUserFollow(SysUserFollow sysUserFollow); + + /** + * 删除用户关注 + * + * @param id 用户关注主键 + * @return 结果 + */ + public int deleteSysUserFollowById(Long id); + + /** + * 批量删除用户关注 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysUserFollowByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserLikeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserLikeMapper.java new file mode 100644 index 00000000..dc3882a4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserLikeMapper.java @@ -0,0 +1,63 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysUserLike; + +/** + * 用户点赞Mapper接口 + * + * @author haotian + * @date 2024-12-02 + */ +public interface SysUserLikeMapper +{ + /** + * 查询用户点赞 + * + * @param id 用户点赞主键 + * @return 用户点赞 + */ + public SysUserLike selectSysUserLikeById(Long id); + + /** + * 查询用户点赞列表 + * + * @param sysUserLike 用户点赞 + * @return 用户点赞集合 + */ + public List selectSysUserLikeList(SysUserLike sysUserLike); + + /** + * 新增用户点赞 + * + * @param sysUserLike 用户点赞 + * @return 结果 + */ + public int insertSysUserLike(SysUserLike sysUserLike); + + /** + * 修改用户点赞 + * + * @param sysUserLike 用户点赞 + * @return 结果 + */ + public int updateSysUserLike(SysUserLike sysUserLike); + + /** + * 删除用户点赞 + * + * @param id 用户点赞主键 + * @return 结果 + */ + public int deleteSysUserLikeById(Long id); + + /** + * 批量删除用户点赞 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysUserLikeByIds(Long[] ids); + + public List selectSysUserLikeByUserIdAndTargetId(Long userId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserNotificationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserNotificationMapper.java new file mode 100644 index 00000000..cd7a3cc7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserNotificationMapper.java @@ -0,0 +1,63 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysUserNotification; + +/** + * 用户消息通知Mapper接口 + * + * @author haotian + * @date 2024-12-02 + */ +public interface SysUserNotificationMapper +{ + /** + * 查询用户消息通知 + * + * @param id 用户消息通知主键 + * @return 用户消息通知 + */ + public SysUserNotification selectSysUserNotificationById(Long id); + + /** + * 查询用户消息通知列表 + * + * @param sysUserNotification 用户消息通知 + * @return 用户消息通知集合 + */ + public List selectSysUserNotificationList(SysUserNotification sysUserNotification); + + /** + * 新增用户消息通知 + * + * @param sysUserNotification 用户消息通知 + * @return 结果 + */ + public int insertSysUserNotification(SysUserNotification sysUserNotification); + + /** + * 修改用户消息通知 + * + * @param sysUserNotification 用户消息通知 + * @return 结果 + */ + public int updateSysUserNotification(SysUserNotification sysUserNotification); + + /** + * 删除用户消息通知 + * + * @param id 用户消息通知主键 + * @return 结果 + */ + public int deleteSysUserNotificationById(Long id); + + /** + * 批量删除用户消息通知 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysUserNotificationByIds(Long[] ids); + + public List unreadNotifiaction(Long userId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IDailySourceService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IDailySourceService.java new file mode 100644 index 00000000..8bead38b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IDailySourceService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.DailySource; + +/** + * 资源位每天统计Service接口 + * + * @author haotian + * @date 2024-12-09 + */ +public interface IDailySourceService +{ + /** + * 查询资源位每天统计 + * + * @param dailySourceId 资源位每天统计主键 + * @return 资源位每天统计 + */ + public DailySource selectDailySourceByDailySourceId(Long dailySourceId); + + /** + * 查询资源位每天统计列表 + * + * @param dailySource 资源位每天统计 + * @return 资源位每天统计集合 + */ + public List selectDailySourceList(DailySource dailySource); + + /** + * 新增资源位每天统计 + * + * @param dailySource 资源位每天统计 + * @return 结果 + */ + public int insertDailySource(DailySource dailySource); + + /** + * 修改资源位每天统计 + * + * @param dailySource 资源位每天统计 + * @return 结果 + */ + public int updateDailySource(DailySource dailySource); + + /** + * 批量删除资源位每天统计 + * + * @param dailySourceIds 需要删除的资源位每天统计主键集合 + * @return 结果 + */ + public int deleteDailySourceByDailySourceIds(Long[] dailySourceIds); + + /** + * 删除资源位每天统计信息 + * + * @param dailySourceId 资源位每天统计主键 + * @return 结果 + */ + public int deleteDailySourceByDailySourceId(Long dailySourceId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DailySourceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DailySourceServiceImpl.java new file mode 100644 index 00000000..9183722b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DailySourceServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.DailySourceMapper; +import com.ruoyi.system.domain.DailySource; +import com.ruoyi.system.service.IDailySourceService; + +/** + * 资源位每天统计Service业务层处理 + * + * @author haotian + * @date 2024-12-09 + */ +@Service +public class DailySourceServiceImpl implements IDailySourceService +{ + @Autowired + private DailySourceMapper dailySourceMapper; + + /** + * 查询资源位每天统计 + * + * @param dailySourceId 资源位每天统计主键 + * @return 资源位每天统计 + */ + @Override + public DailySource selectDailySourceByDailySourceId(Long dailySourceId) + { + return dailySourceMapper.selectDailySourceByDailySourceId(dailySourceId); + } + + /** + * 查询资源位每天统计列表 + * + * @param dailySource 资源位每天统计 + * @return 资源位每天统计 + */ + @Override + public List selectDailySourceList(DailySource dailySource) + { + return dailySourceMapper.selectDailySourceList(dailySource); + } + + /** + * 新增资源位每天统计 + * + * @param dailySource 资源位每天统计 + * @return 结果 + */ + @Override + public int insertDailySource(DailySource dailySource) + { + return dailySourceMapper.insertDailySource(dailySource); + } + + /** + * 修改资源位每天统计 + * + * @param dailySource 资源位每天统计 + * @return 结果 + */ + @Override + public int updateDailySource(DailySource dailySource) + { + return dailySourceMapper.updateDailySource(dailySource); + } + + /** + * 批量删除资源位每天统计 + * + * @param dailySourceIds 需要删除的资源位每天统计主键 + * @return 结果 + */ + @Override + public int deleteDailySourceByDailySourceIds(Long[] dailySourceIds) + { + return dailySourceMapper.deleteDailySourceByDailySourceIds(dailySourceIds); + } + + /** + * 删除资源位每天统计信息 + * + * @param dailySourceId 资源位每天统计主键 + * @return 结果 + */ + @Override + public int deleteDailySourceByDailySourceId(Long dailySourceId) + { + return dailySourceMapper.deleteDailySourceByDailySourceId(dailySourceId); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserFollowServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserFollowServiceImpl.java new file mode 100644 index 00000000..c3748980 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserFollowServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.SysUserFollowMapper; +import com.ruoyi.system.domain.SysUserFollow; +import com.ruoyi.system.service.ISysUserFollowService; + +/** + * 用户关注Service业务层处理 + * + * @author haotian + * @date 2024-12-02 + */ +@Service +public class SysUserFollowServiceImpl implements ISysUserFollowService +{ + @Autowired + private SysUserFollowMapper sysUserFollowMapper; + + /** + * 查询用户关注 + * + * @param id 用户关注主键 + * @return 用户关注 + */ + @Override + public SysUserFollow selectSysUserFollowById(Long id) + { + return sysUserFollowMapper.selectSysUserFollowById(id); + } + + /** + * 查询用户关注列表 + * + * @param sysUserFollow 用户关注 + * @return 用户关注 + */ + @Override + public List selectSysUserFollowList(SysUserFollow sysUserFollow) + { + return sysUserFollowMapper.selectSysUserFollowList(sysUserFollow); + } + + /** + * 新增用户关注 + * + * @param sysUserFollow 用户关注 + * @return 结果 + */ + @Override + public int insertSysUserFollow(SysUserFollow sysUserFollow) + { + sysUserFollow.setCreateTime(DateUtils.getNowDate()); + return sysUserFollowMapper.insertSysUserFollow(sysUserFollow); + } + + /** + * 修改用户关注 + * + * @param sysUserFollow 用户关注 + * @return 结果 + */ + @Override + public int updateSysUserFollow(SysUserFollow sysUserFollow) + { + sysUserFollow.setUpdateTime(DateUtils.getNowDate()); + return sysUserFollowMapper.updateSysUserFollow(sysUserFollow); + } + + /** + * 批量删除用户关注 + * + * @param ids 需要删除的用户关注主键 + * @return 结果 + */ + @Override + public int deleteSysUserFollowByIds(Long[] ids) + { + return sysUserFollowMapper.deleteSysUserFollowByIds(ids); + } + + /** + * 删除用户关注信息 + * + * @param id 用户关注主键 + * @return 结果 + */ + @Override + public int deleteSysUserFollowById(Long id) + { + return sysUserFollowMapper.deleteSysUserFollowById(id); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserLikeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserLikeServiceImpl.java new file mode 100644 index 00000000..588216d9 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserLikeServiceImpl.java @@ -0,0 +1,101 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.SysUserLikeMapper; +import com.ruoyi.system.domain.SysUserLike; +import com.ruoyi.system.service.ISysUserLikeService; + +/** + * 用户点赞Service业务层处理 + * + * @author haotian + * @date 2024-12-02 + */ +@Service +public class SysUserLikeServiceImpl implements ISysUserLikeService +{ + @Autowired + private SysUserLikeMapper sysUserLikeMapper; + + /** + * 查询用户点赞 + * + * @param id 用户点赞主键 + * @return 用户点赞 + */ + @Override + public SysUserLike selectSysUserLikeById(Long id) + { + return sysUserLikeMapper.selectSysUserLikeById(id); + } + + /** + * 查询用户点赞列表 + * + * @param sysUserLike 用户点赞 + * @return 用户点赞 + */ + @Override + public List selectSysUserLikeList(SysUserLike sysUserLike) + { + return sysUserLikeMapper.selectSysUserLikeList(sysUserLike); + } + + /** + * 新增用户点赞 + * + * @param sysUserLike 用户点赞 + * @return 结果 + */ + @Override + public int insertSysUserLike(SysUserLike sysUserLike) + { + sysUserLike.setCreateTime(DateUtils.getNowDate()); + return sysUserLikeMapper.insertSysUserLike(sysUserLike); + } + + /** + * 修改用户点赞 + * + * @param sysUserLike 用户点赞 + * @return 结果 + */ + @Override + public int updateSysUserLike(SysUserLike sysUserLike) + { + sysUserLike.setUpdateTime(DateUtils.getNowDate()); + return sysUserLikeMapper.updateSysUserLike(sysUserLike); + } + + /** + * 批量删除用户点赞 + * + * @param ids 需要删除的用户点赞主键 + * @return 结果 + */ + @Override + public int deleteSysUserLikeByIds(Long[] ids) + { + return sysUserLikeMapper.deleteSysUserLikeByIds(ids); + } + + /** + * 删除用户点赞信息 + * + * @param id 用户点赞主键 + * @return 结果 + */ + @Override + public int deleteSysUserLikeById(Long id) + { + return sysUserLikeMapper.deleteSysUserLikeById(id); + } + + @Override + public List selectSysUserLikeByUserIdAndTargetId(Long userId) { + return sysUserLikeMapper.selectSysUserLikeByUserIdAndTargetId(userId); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserNotificationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserNotificationServiceImpl.java new file mode 100644 index 00000000..d7181fb9 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserNotificationServiceImpl.java @@ -0,0 +1,157 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.system.domain.SysUserFollow; +import com.ruoyi.system.domain.SysUserLike; +import com.ruoyi.system.domain.vo.UserMessageVo; +import com.ruoyi.system.service.ISysUserFollowService; +import com.ruoyi.system.service.ISysUserLikeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.SysUserNotificationMapper; +import com.ruoyi.system.domain.SysUserNotification; +import com.ruoyi.system.service.ISysUserNotificationService; + +/** + * 用户消息通知Service业务层处理 + * + * @author haotian + * @date 2024-12-02 + */ +@Service +public class SysUserNotificationServiceImpl implements ISysUserNotificationService +{ + @Autowired + private SysUserNotificationMapper sysUserNotificationMapper; + + @Autowired + private ISysUserFollowService userFollowService; + + @Autowired + private ISysUserLikeService userLikeService; + + /** + * 查询用户消息通知 + * + * @param id 用户消息通知主键 + * @return 用户消息通知 + */ + @Override + public SysUserNotification selectSysUserNotificationById(Long id) + { + return sysUserNotificationMapper.selectSysUserNotificationById(id); + } + + /** + * 查询用户消息通知列表 + * + * @param sysUserNotification 用户消息通知 + * @return 用户消息通知 + */ + @Override + public List selectSysUserNotificationList(SysUserNotification sysUserNotification) + { + return sysUserNotificationMapper.selectSysUserNotificationList(sysUserNotification); + } + + /** + * 新增用户消息通知 + * + * @param sysUserNotification 用户消息通知 + * @return 结果 + */ + @Override + public int insertSysUserNotification(SysUserNotification sysUserNotification) + { + sysUserNotification.setCreateTime(DateUtils.getNowDate()); + return sysUserNotificationMapper.insertSysUserNotification(sysUserNotification); + } + + /** + * 修改用户消息通知 + * + * @param sysUserNotification 用户消息通知 + * @return 结果 + */ + @Override + public int updateSysUserNotification(SysUserNotification sysUserNotification) + { + sysUserNotification.setUpdateTime(DateUtils.getNowDate()); + return sysUserNotificationMapper.updateSysUserNotification(sysUserNotification); + } + + /** + * 批量删除用户消息通知 + * + * @param ids 需要删除的用户消息通知主键 + * @return 结果 + */ + @Override + public int deleteSysUserNotificationByIds(Long[] ids) + { + return sysUserNotificationMapper.deleteSysUserNotificationByIds(ids); + } + + /** + * 删除用户消息通知信息 + * + * @param id 用户消息通知主键 + * @return 结果 + */ + @Override + public int deleteSysUserNotificationById(Long id) + { + return sysUserNotificationMapper.deleteSysUserNotificationById(id); + } + + @Override + public List unreadNotifiaction(Long userId) + { + return sysUserNotificationMapper.unreadNotifiaction(userId); + } + + + // 获取指定用户的id对应的消息 + @Override + public UserMessageVo getUserMessages(Long userId) + { + UserMessageVo userMessageVo = new UserMessageVo(); + + SysUserFollow followed = new SysUserFollow(); + followed.setFollowedUserId(userId); + + //获取关注我的相关信息 + userMessageVo.setFollowedByList(userFollowService.selectSysUserFollowList(followed)); + + //我关注的相关信息 + SysUserFollow following = new SysUserFollow(); + following.setUserId(userId); + userMessageVo.setFollowingList(userFollowService.selectSysUserFollowList(following)); + + //点赞我的列表, 查询所有给我的作品点赞的信息 + userMessageVo.setLikedByList(userLikeService.selectSysUserLikeByUserIdAndTargetId(userId)); + + //我点赞的列表 + SysUserLike myLike = new SysUserLike(); + myLike.setUserId(userId); + userMessageVo.setMyLikeList(userLikeService.selectSysUserLikeList(myLike)); + + // 未读消息列表 + + List unreadNotifications = sysUserNotificationMapper.unreadNotifiaction(userId); + + + userMessageVo.setLatestNotifications(unreadNotifications); + + + // 未读消息总数 + userMessageVo.setUnreadCount(Long.valueOf(unreadNotifications.size())); + + return userMessageVo; + + + + + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserCountServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserStServiceImpl.java similarity index 66% rename from ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserCountServiceImpl.java rename to ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserStServiceImpl.java index 362ef201..8b9a7ba3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserCountServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserStServiceImpl.java @@ -1,9 +1,9 @@ package com.ruoyi.system.service.impl; -import com.ruoyi.system.domain.DailySys; +import com.ruoyi.system.domain.dto.SeOnlineTimeDto; import com.ruoyi.system.domain.dto.SeUserCountDto; import com.ruoyi.system.service.IDailySysService; -import com.ruoyi.system.service.ISysUserCountService; +import com.ruoyi.system.service.ISysUserStService; import com.ruoyi.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -13,7 +13,7 @@ import java.util.List; @Service -public class SysUserCountServiceImpl implements ISysUserCountService { +public class SysUserStServiceImpl implements ISysUserStService { @Autowired private ISysUserService sysUserService; @@ -39,4 +39,15 @@ public class SysUserCountServiceImpl implements ISysUserCountService { return seUserCount; } + + @Override + public List getUserCountByTime(LocalDate startDate, LocalDate endDate){ + List seUserCount = dailySysService.getSeUserCount(startDate, endDate); + return seUserCount; + } + + @Override + public List gettOnlineTime(LocalDate startDate, LocalDate endDate){ + return dailySysService.gettOnlineTime(startDate, endDate); + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserFollowMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserFollowMapper.xml new file mode 100644 index 00000000..bf0db88e --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserFollowMapper.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + select id, user_id, followed_user_id, status, create_time, update_time from sys_user_follow + + + + + + + + insert into sys_user_follow + + user_id, + followed_user_id, + status, + create_time, + update_time, + + + #{userId}, + #{followedUserId}, + #{status}, + #{createTime}, + #{updateTime}, + + + + + update sys_user_follow + + user_id = #{userId}, + followed_user_id = #{followedUserId}, + status = #{status}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from sys_user_follow where id = #{id} + + + + delete from sys_user_follow where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserLikeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserLikeMapper.xml new file mode 100644 index 00000000..a8b80c33 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserLikeMapper.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + select id, user_id, target_id, target_type, status, create_time, update_time from sys_user_like + + + + + + + + + insert into sys_user_like + + user_id, + target_id, + target_type, + status, + create_time, + update_time, + + + #{userId}, + #{targetId}, + #{targetType}, + #{status}, + #{createTime}, + #{updateTime}, + + + + + update sys_user_like + + user_id = #{userId}, + target_id = #{targetId}, + target_type = #{targetType}, + status = #{status}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from sys_user_like where id = #{id} + + + + delete from sys_user_like where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserNotificationMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserNotificationMapper.xml new file mode 100644 index 00000000..f76c0525 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserNotificationMapper.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + select id, user_id, sender_id, type, target_id, target_type, status, create_time, update_time from sys_user_notification + + + + + + + + + insert into sys_user_notification + + user_id, + sender_id, + type, + target_id, + target_type, + status, + create_time, + update_time, + + + #{userId}, + #{senderId}, + #{type}, + #{targetId}, + #{targetType}, + #{status}, + #{createTime}, + #{updateTime}, + + + + + update sys_user_notification + + user_id = #{userId}, + sender_id = #{senderId}, + type = #{type}, + target_id = #{targetId}, + target_type = #{targetType}, + status = #{status}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from sys_user_notification where id = #{id} + + + + delete from sys_user_notification where id in + + #{id} + + + \ No newline at end of file