公告、文章优化

This commit is contained in:
磷叶 2025-01-15 17:14:48 +08:00
parent fc10f9ff1e
commit 4264bcfd3e
21 changed files with 339 additions and 168 deletions

View File

@ -0,0 +1,12 @@
package com.ruoyi.system.domain.dto;
import com.ruoyi.system.domain.vo.SysNoticeVO;
import lombok.Data;
/**
* @author wjh
* 2025/1/15
*/
@Data
public class SysNoticeQuery extends SysNoticeVO {
}

View File

@ -0,0 +1,20 @@
package com.ruoyi.system.domain.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author wjh
* 2025/1/15
*/
@Getter
@AllArgsConstructor
public enum NoticeStatus {
ENABLED("0", "启用"),
DISABLED("1", "禁用");
private final String status;
private final String msg;
}

View File

@ -0,0 +1,12 @@
package com.ruoyi.system.domain.vo;
import com.ruoyi.system.domain.SysNotice;
import lombok.Data;
/**
* @author wjh
* 2025/1/15
*/
@Data
public class SysNoticeVO extends SysNotice {
}

View File

@ -1,7 +1,10 @@
package com.ruoyi.system.mapper; package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.domain.dto.SysNoticeQuery;
import com.ruoyi.system.domain.vo.SysNoticeVO;
import java.util.List;
/** /**
* 通知公告表 数据层 * 通知公告表 数据层
@ -16,7 +19,7 @@ public interface SysNoticeMapper
* @param noticeId 公告ID * @param noticeId 公告ID
* @return 公告信息 * @return 公告信息
*/ */
public SysNotice selectNoticeById(Long noticeId); public SysNoticeVO selectNoticeById(Long noticeId);
/** /**
* 查询公告列表 * 查询公告列表
@ -24,7 +27,7 @@ public interface SysNoticeMapper
* @param notice 公告信息 * @param notice 公告信息
* @return 公告集合 * @return 公告集合
*/ */
public List<SysNotice> selectNoticeList(SysNotice notice); public List<SysNoticeVO> selectNoticeList(SysNoticeQuery notice);
/** /**
* 新增公告 * 新增公告

View File

@ -1,7 +1,10 @@
package com.ruoyi.system.service; package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.domain.dto.SysNoticeQuery;
import com.ruoyi.system.domain.vo.SysNoticeVO;
import java.util.List;
/** /**
* 公告 服务层 * 公告 服务层
@ -16,15 +19,15 @@ public interface ISysNoticeService
* @param noticeId 公告ID * @param noticeId 公告ID
* @return 公告信息 * @return 公告信息
*/ */
public SysNotice selectNoticeById(Long noticeId); public SysNoticeVO selectNoticeById(Long noticeId);
/** /**
* 查询公告列表 * 查询公告列表
* *
* @param notice 公告信息 * @param query 公告信息
* @return 公告集合 * @return 公告集合
*/ */
public List<SysNotice> selectNoticeList(SysNotice notice); public List<SysNoticeVO> selectNoticeList(SysNoticeQuery query);
/** /**
* 新增公告 * 新增公告
@ -57,4 +60,6 @@ public interface ISysNoticeService
* @return 结果 * @return 结果
*/ */
public int deleteNoticeByIds(Long[] noticeIds); public int deleteNoticeByIds(Long[] noticeIds);
SysNoticeVO selectOne(SysNoticeQuery query);
} }

View File

@ -1,11 +1,16 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.List; import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired; import com.ruoyi.common.utils.collection.CollectionUtils;
import org.springframework.stereotype.Service;
import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.domain.dto.SysNoticeQuery;
import com.ruoyi.system.domain.vo.SysNoticeVO;
import com.ruoyi.system.mapper.SysNoticeMapper; import com.ruoyi.system.mapper.SysNoticeMapper;
import com.ruoyi.system.service.ISysNoticeService; import com.ruoyi.system.service.ISysNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 公告 服务层实现 * 公告 服务层实现
@ -25,7 +30,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
* @return 公告信息 * @return 公告信息
*/ */
@Override @Override
public SysNotice selectNoticeById(Long noticeId) public SysNoticeVO selectNoticeById(Long noticeId)
{ {
return noticeMapper.selectNoticeById(noticeId); return noticeMapper.selectNoticeById(noticeId);
} }
@ -33,13 +38,13 @@ public class SysNoticeServiceImpl implements ISysNoticeService
/** /**
* 查询公告列表 * 查询公告列表
* *
* @param notice 公告信息 * @param query 公告信息
* @return 公告集合 * @return 公告集合
*/ */
@Override @Override
public List<SysNotice> selectNoticeList(SysNotice notice) public List<SysNoticeVO> selectNoticeList(SysNoticeQuery query)
{ {
return noticeMapper.selectNoticeList(notice); return noticeMapper.selectNoticeList(query);
} }
/** /**
@ -89,4 +94,11 @@ public class SysNoticeServiceImpl implements ISysNoticeService
{ {
return noticeMapper.deleteNoticeByIds(noticeIds); return noticeMapper.deleteNoticeByIds(noticeIds);
} }
@Override
public SysNoticeVO selectOne(SysNoticeQuery query) {
PageHelper.startPage(1, 1);
List<SysNoticeVO> list = this.selectNoticeList(query);
return CollectionUtils.firstElement(list);
}
} }

View File

@ -4,21 +4,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysNoticeMapper"> <mapper namespace="com.ruoyi.system.mapper.SysNoticeMapper">
<resultMap type="SysNotice" id="SysNoticeResult"> <resultMap type="SysNoticeVO" id="SysNoticeResult" autoMapping="true"/>
<result property="noticeId" column="notice_id" />
<result property="noticeTitle" column="notice_title" />
<result property="noticeType" column="notice_type" />
<result property="noticeContent" column="notice_content" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectNoticeVo"> <sql id="selectNoticeVo">
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark select
notice_id,
notice_title,
notice_type,
cast(notice_content as char) as notice_content,
status,
create_by,
create_time,
update_by,
update_time,
remark
from sys_notice from sys_notice
</sql> </sql>
@ -27,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where notice_id = #{noticeId} where notice_id = #{noticeId}
</select> </select>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult"> <select id="selectNoticeList" parameterType="SysNoticeQuery" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/> <include refid="selectNoticeVo"/>
<where> <where>
<if test="noticeTitle != null and noticeTitle != ''"> <if test="noticeTitle != null and noticeTitle != ''">
@ -39,6 +38,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''"> <if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%') AND create_by like concat('%', #{createBy}, '%')
</if> </if>
<if test="status != null and status != ''">
AND `status` = #{status}
</if>
</where> </where>
</select> </select>

View File

@ -1,7 +1,6 @@
package com.ruoyi.iot.domain; package com.ruoyi.iot.domain;
import com.ruoyi.ss.device.domain.enums.DeviceOutageWay; import com.ruoyi.ss.device.domain.enums.DeviceOutageWay;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@ -14,7 +13,6 @@ import java.util.Date;
* 2024/3/20 * 2024/3/20
*/ */
@Data @Data
@Builder
public class IotDeviceInfo { public class IotDeviceInfo {
private String mac; private String mac;
@ -35,18 +33,18 @@ public class IotDeviceInfo {
private BigDecimal vxs; // 电压系数 private BigDecimal vxs; // 电压系数
public static IotDeviceInfo newDefaultInstance() { public static IotDeviceInfo newDefaultInstance() {
return IotDeviceInfo.builder() IotDeviceInfo info = new IotDeviceInfo();
.v(BigDecimal.ZERO) info.setV(BigDecimal.ZERO);
.p(BigDecimal.ZERO) info.setP(BigDecimal.ZERO);
.a(BigDecimal.ZERO) info.setA(BigDecimal.ZERO);
.w(BigDecimal.ZERO) info.setW(BigDecimal.ZERO);
.s("0") info.setS("0");
.m(BigDecimal.ZERO) info.setM(BigDecimal.ZERO);
.set(DeviceOutageWay.IMMEDIATE.getValue()) info.setSet(DeviceOutageWay.IMMEDIATE.getValue());
.time(BigDecimal.ZERO) info.setTime(BigDecimal.ZERO);
.model(null) info.setModel(null);
.version(null) info.setVersion(null);
.vxs(BigDecimal.ONE) info.setVxs(BigDecimal.ONE);
.build(); return info;
} }
} }

View File

@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) )
</if> </if>
<if test="isHot != null and isHot != ''"> and a.is_hot = #{isHot}</if> <if test="isHot != null and isHot != ''"> and a.is_hot = #{isHot}</if>
<if test="classifyAncestorId != null">and find_in_set(#{classifyAncestorId}, sc.ancestors)</if> <if test="classifyAncestorId != null">and ( sc.classify_id = #{classifyAncestorId} or ( find_in_set(#{classifyAncestorId}, sc.ancestors)))</if>
<if test="articleIds != null and articleIds.size() > 0"> <if test="articleIds != null and articleIds.size() > 0">
and a.article_id in and a.article_id in
<foreach collection="articleIds" item="item" separator="," open="(" close=")"> <foreach collection="articleIds" item="item" separator="," open="(" close=")">
@ -91,7 +91,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</if> </if>
</where> </where>
order by a.create_time desc
</select> </select>
<select id="selectSmArticleByArticleId" parameterType="Long" resultMap="SmArticleResult"> <select id="selectSmArticleByArticleId" parameterType="Long" resultMap="SmArticleResult">

View File

@ -1,5 +1,6 @@
package com.ruoyi.ss.device.service; package com.ruoyi.ss.device.service;
import com.ruoyi.iot.domain.IotDeviceInfo;
import com.ruoyi.iot.domain.response.CommandResponse; import com.ruoyi.iot.domain.response.CommandResponse;
import com.ruoyi.ss.device.domain.Device; import com.ruoyi.ss.device.domain.Device;
import com.ruoyi.ss.device.domain.DeviceBO; import com.ruoyi.ss.device.domain.DeviceBO;
@ -429,5 +430,5 @@ public interface DeviceService
/** /**
* 蓝牙同步设备信息 * 蓝牙同步设备信息
*/ */
int bltSyncIot(String sn, String info); int bltSyncIot(IotDeviceInfo info);
} }

View File

@ -16,7 +16,6 @@ import com.ruoyi.iot.domain.IotDeviceInfo;
import com.ruoyi.iot.domain.response.CommandResponse; import com.ruoyi.iot.domain.response.CommandResponse;
import com.ruoyi.iot.enums.IotHttpStatus; import com.ruoyi.iot.enums.IotHttpStatus;
import com.ruoyi.iot.service.IotService; import com.ruoyi.iot.service.IotService;
import com.ruoyi.iot.util.IotUtil;
import com.ruoyi.ss.commandLog.service.ICommandLogService; import com.ruoyi.ss.commandLog.service.ICommandLogService;
import com.ruoyi.ss.device.domain.Device; import com.ruoyi.ss.device.domain.Device;
import com.ruoyi.ss.device.domain.DeviceBO; import com.ruoyi.ss.device.domain.DeviceBO;
@ -933,7 +932,39 @@ public class DeviceServiceImpl implements DeviceService
// 更新设备信息 // 更新设备信息
device.setDeviceId(device.getDeviceId()); device.setDeviceId(device.getDeviceId());
if (deviceInfo != null) { this.setDeviceInfo(device, deviceInfo);
// 判断设备是否正在使用
// 若开关开启则正在使用
boolean hasOpen = DevicePowerStatus.ON.getStatus().equals(device.getPowerStatus());
// 若设备有正在使用中的订单则正在使用
boolean hasUsingBill = device.getUsingBillCount() != null && device.getUsingBillCount() > 0;
if (hasOpen || hasUsingBill) {
device.setStatus(DeviceStatus.USING.getStatus());
} else {
device.setStatus(DeviceStatus.NORMAL.getStatus());
}
}
}
// 异步更新设备信息
for (DeviceVO device : list) {
scheduledExecutorService.schedule(() -> {
if (StringUtils.hasText(onlineType)) {
// 获取并设置在线状态
this.setOnlineStatus(device, onlineType);
}
// 更新数据库
this.updateIotInfo(device);
}, 0, TimeUnit.SECONDS);
}
}
private void setDeviceInfo(DeviceVO device, IotDeviceInfo deviceInfo) {
if (device == null || deviceInfo == null) {
return;
}
device.setLastPullTime(deviceInfo.getAt()); device.setLastPullTime(deviceInfo.getAt());
device.setPowerStatus(deviceInfo.getS()); device.setPowerStatus(deviceInfo.getS());
device.setRemainTime(deviceInfo.getTime()); device.setRemainTime(deviceInfo.getTime());
@ -971,33 +1002,6 @@ public class DeviceServiceImpl implements DeviceService
} }
} }
// 判断设备是否正在使用
// 若开关开启则正在使用
boolean hasOpen = DevicePowerStatus.ON.getStatus().equals(device.getPowerStatus());
// 若设备有正在使用中的订单则正在使用
boolean hasUsingBill = device.getUsingBillCount() != null && device.getUsingBillCount() > 0;
if (hasOpen || hasUsingBill) {
device.setStatus(DeviceStatus.USING.getStatus());
} else {
device.setStatus(DeviceStatus.NORMAL.getStatus());
}
}
}
// 异步更新设备信息
for (DeviceVO device : list) {
scheduledExecutorService.schedule(() -> {
if (StringUtils.hasText(onlineType)) {
// 获取并设置在线状态
this.setOnlineStatus(device, onlineType);
}
// 更新数据库
this.updateIotInfo(device);
}, 0, TimeUnit.SECONDS);
}
}
private void setOnlineStatus(DeviceVO device, String onlineType) { private void setOnlineStatus(DeviceVO device, String onlineType) {
// 是否在线 // 是否在线
String onlineStatus1 = iotService.getOnlineStatus(device.getMac(), device.getProductId(), onlineType); String onlineStatus1 = iotService.getOnlineStatus(device.getMac(), device.getProductId(), onlineType);
@ -1403,30 +1407,19 @@ public class DeviceServiceImpl implements DeviceService
} }
@Override @Override
public int bltSyncIot(String sn, String info) { public int bltSyncIot(IotDeviceInfo info) {
if (StringUtils.isAnyBlank(sn, info)) { if (info == null) {
return 0; return 0;
} }
// 解析蓝牙信息
Map<String, String> map = IotUtil.parseBltInfo(info);
// 查询设备 // 查询设备
DeviceVO device = selectByDeviceNo(sn); DeviceVO device = selectByAnyMac(info.getMac());
ServiceUtil.assertion(device == null, "设备不存在"); ServiceUtil.assertion(device == null, "设备不存在");
// 更新数据库总用电量 // 更新数据库总用电量
String w = map.get("W"); this.setDeviceInfo(device, info);
if (StringUtils.hasText(w)) {
BigDecimal totalEle = new BigDecimal(w);
if (device.getTotalElectriQuantity() == null || totalEle.compareTo(device.getTotalElectriQuantity()) > 0) {
Device data = new Device();
data.setDeviceId(device.getDeviceId());
data.setTotalElectriQuantity(totalEle);
return updateByIot(data);
}
}
return 1; return this.updateIotInfo(device);
} }
private List<Long> selectIds(DeviceQuery query) { private List<Long> selectIds(DeviceQuery query) {

View File

@ -289,10 +289,12 @@ public class TransactionBill extends BaseEntity
@Excel(name = "套餐是否开启语音播报") @Excel(name = "套餐是否开启语音播报")
@ApiModelProperty("套餐是否开启语音播报") @ApiModelProperty("套餐是否开启语音播报")
@JsonView(JsonViewProfile.App.class)
private Boolean suitEnabledVoid; private Boolean suitEnabledVoid;
@Excel(name = "套餐语音播报阈值", readConverterExp = "分=钟") @Excel(name = "套餐语音播报阈值", readConverterExp = "分=钟")
@ApiModelProperty("套餐语音播报阈值") @ApiModelProperty("套餐语音播报阈值")
@JsonView(JsonViewProfile.App.class)
private BigDecimal suitVoidMinute; private BigDecimal suitVoidMinute;
@Excel(name = "套餐语音播报设置结果", readConverterExp = "1=-成功2-失败") @Excel(name = "套餐语音播报设置结果", readConverterExp = "1=-成功2-失败")

View File

@ -0,0 +1,37 @@
package com.ruoyi.ss.user.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 用户统计数据
* @author wjh
* 2025/1/15
*/
@Data
public class UserStatisticsVO {
@ApiModelProperty("余额")
private BigDecimal balance;
@ApiModelProperty("店铺数量")
private Integer storeCount;
@ApiModelProperty("设备数量")
private Integer deviceCount;
@ApiModelProperty("待分成金额")
private BigDecimal waitBonusAmount;
@ApiModelProperty("总收入")
private BigDecimal totalIncome;
@ApiModelProperty("总提现")
private BigDecimal totalWithdraw;
@ApiModelProperty("总消费")
private BigDecimal totalConsume;
}

View File

@ -10,6 +10,7 @@ import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.domain.dto.UserRealNameDTO; import com.ruoyi.ss.user.domain.dto.UserRealNameDTO;
import com.ruoyi.ss.user.domain.vo.UserRealNameVO; import com.ruoyi.ss.user.domain.vo.UserRealNameVO;
import com.ruoyi.ss.user.domain.vo.UserRealRefreshVO; import com.ruoyi.ss.user.domain.vo.UserRealRefreshVO;
import com.ruoyi.ss.user.domain.vo.UserStatisticsVO;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -296,4 +297,6 @@ public interface UserService
* 重置实名认证 * 重置实名认证
*/ */
int resetRealName(Long userId); int resetRealName(Long userId);
UserStatisticsVO selectStatistics(Long userId);
} }

View File

@ -51,7 +51,9 @@ import com.ruoyi.ss.user.domain.dto.UserFaceDTO;
import com.ruoyi.ss.user.domain.dto.UserRealNameDTO; import com.ruoyi.ss.user.domain.dto.UserRealNameDTO;
import com.ruoyi.ss.user.domain.vo.UserRealNameVO; import com.ruoyi.ss.user.domain.vo.UserRealNameVO;
import com.ruoyi.ss.user.domain.vo.UserRealRefreshVO; import com.ruoyi.ss.user.domain.vo.UserRealRefreshVO;
import com.ruoyi.ss.user.domain.vo.UserStatisticsVO;
import com.ruoyi.ss.user.mapper.SmUserMapper; import com.ruoyi.ss.user.mapper.SmUserMapper;
import com.ruoyi.ss.user.service.UserAssembler;
import com.ruoyi.ss.user.service.UserService; import com.ruoyi.ss.user.service.UserService;
import com.ruoyi.ss.user.service.UserValidator; import com.ruoyi.ss.user.service.UserValidator;
import com.ruoyi.system.domain.enums.config.ConfigKey; import com.ruoyi.system.domain.enums.config.ConfigKey;
@ -139,6 +141,9 @@ public class UserServiceImpl implements UserService
@Autowired @Autowired
private AppConverter appConverter; private AppConverter appConverter;
@Autowired
private UserAssembler userAssembler;
/** /**
* 查询普通用户信息 * 查询普通用户信息
* *
@ -746,6 +751,36 @@ public class UserServiceImpl implements UserService
return smUserMapper.resetRealName(userId); return smUserMapper.resetRealName(userId);
} }
@Override
public UserStatisticsVO selectStatistics(Long userId) {
if (userId == null) {
return null;
}
SmUserVO user = this.selectSimpleById(userId);
if (user == null) {
return null;
}
UserStatisticsVO vo = new UserStatisticsVO();
List<SmUserVO> list = Collections.singletonList(user);
userAssembler.assembleStoreCount(list);
userAssembler.assembleDeviceCount(list);
userAssembler.assembleWaitBonusAmount(list);
userAssembler.assembleTotalIncome(list);
userAssembler.assembleWithdrawAmount(list);
userAssembler.assembleRechargeAmount(list);
vo.setBalance(user.getBalance());
vo.setStoreCount(user.getStoreCount());
vo.setDeviceCount(user.getDeviceCount());
vo.setWaitBonusAmount(user.getWaitBonusAmount());
vo.setTotalIncome(user.getTotalIncome());
vo.setTotalWithdraw(user.getWithDrawlAmount());
vo.setTotalConsume(user.getRechargeAmount());
return vo;
}
private SmUserVO selectOne(SmUserQuery query) { private SmUserVO selectOne(SmUserQuery query) {
PageHelper.startPage(1, 1); PageHelper.startPage(1, 1);
List<SmUserVO> list = this.selectSmUserList(query); List<SmUserVO> list = this.selectSmUserList(query);

View File

@ -1,16 +1,10 @@
package com.ruoyi.task.bill; package com.ruoyi.task.bill;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.collection.CollectionUtils; import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.payBill.domain.PayBillQuery; import com.ruoyi.ss.payBill.domain.PayBillQuery;
import com.ruoyi.ss.payBill.domain.PayBillVO; import com.ruoyi.ss.payBill.domain.PayBillVO;
import com.ruoyi.ss.payBill.domain.enums.PayBillStatus; import com.ruoyi.ss.payBill.domain.enums.PayBillStatus;
import com.ruoyi.ss.payBill.service.PayBillService; import com.ruoyi.ss.payBill.service.PayBillService;
import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
@ -19,7 +13,6 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;

View File

@ -10,9 +10,11 @@ import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OperatorType; import com.ruoyi.common.enums.OperatorType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil; import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.collection.CollectionUtils; import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.iot.domain.IotDeviceInfo;
import com.ruoyi.ss.device.domain.Device; import com.ruoyi.ss.device.domain.Device;
import com.ruoyi.ss.device.domain.DeviceBO; import com.ruoyi.ss.device.domain.DeviceBO;
import com.ruoyi.ss.device.domain.DeviceQuery; import com.ruoyi.ss.device.domain.DeviceQuery;
@ -310,8 +312,9 @@ public class AppDeviceController extends BaseController {
@ApiOperation("蓝牙同步设备物联网信息") @ApiOperation("蓝牙同步设备物联网信息")
@PutMapping("/bltSyncIot") @PutMapping("/bltSyncIot")
public AjaxResult bltSyncIot(String sn, String info) { public AjaxResult bltSyncIot(@RequestBody IotDeviceInfo info) {
return toAjax(smDeviceService.bltSyncIot(sn, info)); info.setAt(DateUtils.getNowDate());
return toAjax(smDeviceService.bltSyncIot(info));
} }
} }

View File

@ -0,0 +1,45 @@
package com.ruoyi.web.controller.app;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.dto.SysNoticeQuery;
import com.ruoyi.system.domain.enums.NoticeStatus;
import com.ruoyi.system.service.ISysNoticeService;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author wjh
* 2025/1/15
*/
@RestController
@RequestMapping("/app/notice")
public class AppNoticeController extends BaseController {
@Autowired
private ISysNoticeService noticeService;
@ApiOperation("获取最新的公告")
@GetMapping("/new")
@Anonymous
public AjaxResult getNewNotice() {
PageHelper.orderBy("create_time desc");
SysNoticeQuery query = new SysNoticeQuery();
query.setStatus(NoticeStatus.ENABLED.getStatus());
return success(noticeService.selectOne(query));
}
@ApiOperation("获取公告详情")
@GetMapping("/{noticeId}")
@Anonymous
public AjaxResult getNotice(@PathVariable Long noticeId) {
return success(noticeService.selectNoticeById(noticeId));
}
}

View File

@ -8,10 +8,10 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ss.article.domain.SmArticle; import com.ruoyi.ss.article.domain.SmArticle;
import com.ruoyi.ss.articleClassify.domain.SmArticleClassifyQuery;
import com.ruoyi.ss.article.domain.SmArticleQuery; import com.ruoyi.ss.article.domain.SmArticleQuery;
import com.ruoyi.ss.articleClassify.service.ISmArticleClassifyService;
import com.ruoyi.ss.article.service.ISmArticleService; import com.ruoyi.ss.article.service.ISmArticleService;
import com.ruoyi.ss.articleClassify.domain.SmArticleClassifyQuery;
import com.ruoyi.ss.articleClassify.service.ISmArticleClassifyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -127,7 +127,7 @@ public class SmArticleController extends BaseController
/** /**
* 获取分类树列表 * 获取分类树列表
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") @PreAuthorize("@ss.hasPermi('system:article:list')")
@GetMapping("/classifyTree") @GetMapping("/classifyTree")
public AjaxResult deptTree(SmArticleClassifyQuery classify) public AjaxResult deptTree(SmArticleClassifyQuery classify)
{ {

View File

@ -93,14 +93,8 @@ public class SmUserController extends BaseController
{ {
SmUserVO user = userService.selectSmUserByUserId(userId); SmUserVO user = userService.selectSmUserByUserId(userId);
List<SmUserVO> list = Collections.singletonList(user); List<SmUserVO> list = Collections.singletonList(user);
userAssembler.assembleStoreCount(list);
userAssembler.assembleDeviceCount(list);
userAssembler.assembleRealServiceRate(list);
userAssembler.assembleWaitBonusAmount(list);
userAssembler.assembleTotalIncome(list);
userAssembler.assembleWithdrawAmount(list);
userAssembler.assembleRechargeAmount(list);
userAssembler.assembleChannelList(list); userAssembler.assembleChannelList(list);
userAssembler.assembleRealServiceRate(list);
userService.desensitization(list); userService.desensitization(list);
return success(user); return success(user);
} }
@ -158,4 +152,10 @@ public class SmUserController extends BaseController
return toAjax(userService.resetRealName(userId)); return toAjax(userService.resetRealName(userId));
} }
// 获取用户统计信息
@GetMapping("/userStatistics")
public AjaxResult userStatistics(Long userId) {
return success(userService.selectStatistics(userId));
}
} }

View File

@ -1,24 +1,20 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
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.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.domain.dto.SysNoticeQuery;
import com.ruoyi.system.domain.vo.SysNoticeVO;
import com.ruoyi.system.service.ISysNoticeService; import com.ruoyi.system.service.ISysNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 公告 信息操作处理 * 公告 信息操作处理
@ -37,10 +33,10 @@ public class SysNoticeController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:notice:list')") @PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysNotice notice) public TableDataInfo list(SysNoticeQuery notice)
{ {
startPage(); startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice); List<SysNoticeVO> list = noticeService.selectNoticeList(notice);
return getDataTable(list); return getDataTable(list);
} }