公告、文章优化
This commit is contained in:
parent
fc10f9ff1e
commit
4264bcfd3e
|
@ -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 {
|
||||
}
|
|
@ -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;
|
||||
|
||||
}
|
|
@ -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 {
|
||||
}
|
|
@ -1,34 +1,37 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.domain.dto.SysNoticeQuery;
|
||||
import com.ruoyi.system.domain.vo.SysNoticeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知公告表 数据层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysNoticeMapper
|
||||
{
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 公告信息
|
||||
*/
|
||||
public SysNotice selectNoticeById(Long noticeId);
|
||||
public SysNoticeVO selectNoticeById(Long noticeId);
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 公告集合
|
||||
*/
|
||||
public List<SysNotice> selectNoticeList(SysNotice notice);
|
||||
public List<SysNoticeVO> selectNoticeList(SysNoticeQuery notice);
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -36,7 +39,7 @@ public interface SysNoticeMapper
|
|||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -44,7 +47,7 @@ public interface SysNoticeMapper
|
|||
|
||||
/**
|
||||
* 批量删除公告
|
||||
*
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -52,7 +55,7 @@ public interface SysNoticeMapper
|
|||
|
||||
/**
|
||||
* 批量删除公告信息
|
||||
*
|
||||
*
|
||||
* @param noticeIds 需要删除的公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
|
@ -1,34 +1,37 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.domain.dto.SysNoticeQuery;
|
||||
import com.ruoyi.system.domain.vo.SysNoticeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告 服务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysNoticeService
|
||||
{
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 公告信息
|
||||
*/
|
||||
public SysNotice selectNoticeById(Long noticeId);
|
||||
public SysNoticeVO selectNoticeById(Long noticeId);
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
*
|
||||
* @param query 公告信息
|
||||
* @return 公告集合
|
||||
*/
|
||||
public List<SysNotice> selectNoticeList(SysNotice notice);
|
||||
public List<SysNoticeVO> selectNoticeList(SysNoticeQuery query);
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -36,7 +39,7 @@ public interface ISysNoticeService
|
|||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -44,17 +47,19 @@ public interface ISysNoticeService
|
|||
|
||||
/**
|
||||
* 删除公告信息
|
||||
*
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeById(Long noticeId);
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除公告信息
|
||||
*
|
||||
*
|
||||
* @param noticeIds 需要删除的公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds(Long[] noticeIds);
|
||||
|
||||
SysNoticeVO selectOne(SysNoticeQuery query);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
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.service.ISysNoticeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告 服务层实现
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
|
@ -20,31 +25,31 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|||
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 公告信息
|
||||
*/
|
||||
@Override
|
||||
public SysNotice selectNoticeById(Long noticeId)
|
||||
public SysNoticeVO selectNoticeById(Long noticeId)
|
||||
{
|
||||
return noticeMapper.selectNoticeById(noticeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
*
|
||||
* @param query 公告信息
|
||||
* @return 公告集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysNotice> selectNoticeList(SysNotice notice)
|
||||
public List<SysNoticeVO> selectNoticeList(SysNoticeQuery query)
|
||||
{
|
||||
return noticeMapper.selectNoticeList(notice);
|
||||
return noticeMapper.selectNoticeList(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -56,7 +61,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -68,7 +73,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|||
|
||||
/**
|
||||
* 删除公告对象
|
||||
*
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -80,7 +85,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|||
|
||||
/**
|
||||
* 批量删除公告信息
|
||||
*
|
||||
*
|
||||
* @param noticeIds 需要删除的公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -89,4 +94,11 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|||
{
|
||||
return noticeMapper.deleteNoticeByIds(noticeIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysNoticeVO selectOne(SysNoticeQuery query) {
|
||||
PageHelper.startPage(1, 1);
|
||||
List<SysNoticeVO> list = this.selectNoticeList(query);
|
||||
return CollectionUtils.firstElement(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,31 +3,30 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.SysNoticeMapper">
|
||||
|
||||
<resultMap type="SysNotice" id="SysNoticeResult">
|
||||
<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>
|
||||
|
||||
|
||||
<resultMap type="SysNoticeVO" id="SysNoticeResult" autoMapping="true"/>
|
||||
|
||||
<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
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
|
||||
<include refid="selectNoticeVo"/>
|
||||
where notice_id = #{noticeId}
|
||||
</select>
|
||||
|
||||
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
|
||||
|
||||
<select id="selectNoticeList" parameterType="SysNoticeQuery" resultMap="SysNoticeResult">
|
||||
<include refid="selectNoticeVo"/>
|
||||
<where>
|
||||
<if test="noticeTitle != null and noticeTitle != ''">
|
||||
|
@ -39,9 +38,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createBy != null and createBy != ''">
|
||||
AND create_by like concat('%', #{createBy}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND `status` = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertNotice" parameterType="SysNotice">
|
||||
insert into sys_notice (
|
||||
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
|
||||
|
@ -61,9 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateNotice" parameterType="SysNotice">
|
||||
update sys_notice
|
||||
update sys_notice
|
||||
<set>
|
||||
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
|
||||
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
|
||||
|
@ -74,16 +76,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</set>
|
||||
where notice_id = #{noticeId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteNoticeById" parameterType="Long">
|
||||
delete from sys_notice where notice_id = #{noticeId}
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteNoticeByIds" parameterType="Long">
|
||||
delete from sys_notice where notice_id in
|
||||
delete from sys_notice where notice_id in
|
||||
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
|
||||
#{noticeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.ruoyi.iot.domain;
|
||||
|
||||
import com.ruoyi.ss.device.domain.enums.DeviceOutageWay;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
@ -14,7 +13,6 @@ import java.util.Date;
|
|||
* 2024/3/20
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class IotDeviceInfo {
|
||||
private String mac;
|
||||
|
||||
|
@ -35,18 +33,18 @@ public class IotDeviceInfo {
|
|||
private BigDecimal vxs; // 电压系数
|
||||
|
||||
public static IotDeviceInfo newDefaultInstance() {
|
||||
return IotDeviceInfo.builder()
|
||||
.v(BigDecimal.ZERO)
|
||||
.p(BigDecimal.ZERO)
|
||||
.a(BigDecimal.ZERO)
|
||||
.w(BigDecimal.ZERO)
|
||||
.s("0")
|
||||
.m(BigDecimal.ZERO)
|
||||
.set(DeviceOutageWay.IMMEDIATE.getValue())
|
||||
.time(BigDecimal.ZERO)
|
||||
.model(null)
|
||||
.version(null)
|
||||
.vxs(BigDecimal.ONE)
|
||||
.build();
|
||||
IotDeviceInfo info = new IotDeviceInfo();
|
||||
info.setV(BigDecimal.ZERO);
|
||||
info.setP(BigDecimal.ZERO);
|
||||
info.setA(BigDecimal.ZERO);
|
||||
info.setW(BigDecimal.ZERO);
|
||||
info.setS("0");
|
||||
info.setM(BigDecimal.ZERO);
|
||||
info.setSet(DeviceOutageWay.IMMEDIATE.getValue());
|
||||
info.setTime(BigDecimal.ZERO);
|
||||
info.setModel(null);
|
||||
info.setVersion(null);
|
||||
info.setVxs(BigDecimal.ONE);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)
|
||||
</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">
|
||||
and a.article_id in
|
||||
<foreach collection="articleIds" item="item" separator="," open="(" close=")">
|
||||
|
@ -91,7 +91,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectSmArticleByArticleId" parameterType="Long" resultMap="SmArticleResult">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.ss.device.service;
|
||||
|
||||
import com.ruoyi.iot.domain.IotDeviceInfo;
|
||||
import com.ruoyi.iot.domain.response.CommandResponse;
|
||||
import com.ruoyi.ss.device.domain.Device;
|
||||
import com.ruoyi.ss.device.domain.DeviceBO;
|
||||
|
@ -429,5 +430,5 @@ public interface DeviceService
|
|||
/**
|
||||
* 蓝牙同步设备信息
|
||||
*/
|
||||
int bltSyncIot(String sn, String info);
|
||||
int bltSyncIot(IotDeviceInfo info);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import com.ruoyi.iot.domain.IotDeviceInfo;
|
|||
import com.ruoyi.iot.domain.response.CommandResponse;
|
||||
import com.ruoyi.iot.enums.IotHttpStatus;
|
||||
import com.ruoyi.iot.service.IotService;
|
||||
import com.ruoyi.iot.util.IotUtil;
|
||||
import com.ruoyi.ss.commandLog.service.ICommandLogService;
|
||||
import com.ruoyi.ss.device.domain.Device;
|
||||
import com.ruoyi.ss.device.domain.DeviceBO;
|
||||
|
@ -933,43 +932,7 @@ public class DeviceServiceImpl implements DeviceService
|
|||
|
||||
// 更新设备信息
|
||||
device.setDeviceId(device.getDeviceId());
|
||||
if (deviceInfo != null) {
|
||||
device.setLastPullTime(deviceInfo.getAt());
|
||||
device.setPowerStatus(deviceInfo.getS());
|
||||
device.setRemainTime(deviceInfo.getTime());
|
||||
device.setRealTimePower(deviceInfo.getP());
|
||||
device.setVoltage(deviceInfo.getV());
|
||||
device.setElectricity(deviceInfo.getA());
|
||||
device.setVersion(deviceInfo.getVersion());
|
||||
device.setVxs(deviceInfo.getVxs());
|
||||
|
||||
// 判断是否支持WIFI,支持则更新
|
||||
if (ModelTag.hasTag(device.getModelTags(), ModelTag.WIFI)) {
|
||||
device.setWifi(deviceInfo.getWifi());
|
||||
}
|
||||
|
||||
// 判断是否支持电量,支持则更新
|
||||
if (ModelTag.hasTag(device.getModelTags(), ModelTag.ELE)) {
|
||||
device.setSurplusEle(deviceInfo.getM());
|
||||
} else {
|
||||
device.setSurplusEle(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
// 总用电量
|
||||
if (deviceInfo.getW() != null) {
|
||||
// 若有数据点中的值大于数据库中的值,则更新
|
||||
if (deviceInfo.getW().compareTo(device.getTotalElectriQuantity()) >= 0) {
|
||||
device.setTotalElectriQuantity(deviceInfo.getW());
|
||||
}
|
||||
// 若数据点小于数据库中的值,则发命令恢复物联网设备的总用电量
|
||||
else {
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
String reason = "拉取设备信息时,恢复总用电量,数据库值:" + device.getTotalElectriQuantity() + ",OneNet值:" + deviceInfo.getW();
|
||||
iotService.setTotalEle(device, device.getTotalElectriQuantity().multiply(new BigDecimal(1000)), reason);
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setDeviceInfo(device, deviceInfo);
|
||||
|
||||
// 判断设备是否正在使用
|
||||
// 若开关开启,则正在使用
|
||||
|
@ -998,6 +961,47 @@ public class DeviceServiceImpl implements DeviceService
|
|||
}
|
||||
}
|
||||
|
||||
private void setDeviceInfo(DeviceVO device, IotDeviceInfo deviceInfo) {
|
||||
if (device == null || deviceInfo == null) {
|
||||
return;
|
||||
}
|
||||
device.setLastPullTime(deviceInfo.getAt());
|
||||
device.setPowerStatus(deviceInfo.getS());
|
||||
device.setRemainTime(deviceInfo.getTime());
|
||||
device.setRealTimePower(deviceInfo.getP());
|
||||
device.setVoltage(deviceInfo.getV());
|
||||
device.setElectricity(deviceInfo.getA());
|
||||
device.setVersion(deviceInfo.getVersion());
|
||||
device.setVxs(deviceInfo.getVxs());
|
||||
|
||||
// 判断是否支持WIFI,支持则更新
|
||||
if (ModelTag.hasTag(device.getModelTags(), ModelTag.WIFI)) {
|
||||
device.setWifi(deviceInfo.getWifi());
|
||||
}
|
||||
|
||||
// 判断是否支持电量,支持则更新
|
||||
if (ModelTag.hasTag(device.getModelTags(), ModelTag.ELE)) {
|
||||
device.setSurplusEle(deviceInfo.getM());
|
||||
} else {
|
||||
device.setSurplusEle(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
// 总用电量
|
||||
if (deviceInfo.getW() != null) {
|
||||
// 若有数据点中的值大于数据库中的值,则更新
|
||||
if (deviceInfo.getW().compareTo(device.getTotalElectriQuantity()) >= 0) {
|
||||
device.setTotalElectriQuantity(deviceInfo.getW());
|
||||
}
|
||||
// 若数据点小于数据库中的值,则发命令恢复物联网设备的总用电量
|
||||
else {
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
String reason = "拉取设备信息时,恢复总用电量,数据库值:" + device.getTotalElectriQuantity() + ",OneNet值:" + deviceInfo.getW();
|
||||
iotService.setTotalEle(device, device.getTotalElectriQuantity().multiply(new BigDecimal(1000)), reason);
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setOnlineStatus(DeviceVO device, String onlineType) {
|
||||
// 是否在线
|
||||
String onlineStatus1 = iotService.getOnlineStatus(device.getMac(), device.getProductId(), onlineType);
|
||||
|
@ -1403,30 +1407,19 @@ public class DeviceServiceImpl implements DeviceService
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bltSyncIot(String sn, String info) {
|
||||
if (StringUtils.isAnyBlank(sn, info)) {
|
||||
public int bltSyncIot(IotDeviceInfo info) {
|
||||
if (info == null) {
|
||||
return 0;
|
||||
}
|
||||
// 解析蓝牙信息
|
||||
Map<String, String> map = IotUtil.parseBltInfo(info);
|
||||
|
||||
// 查询设备
|
||||
DeviceVO device = selectByDeviceNo(sn);
|
||||
DeviceVO device = selectByAnyMac(info.getMac());
|
||||
ServiceUtil.assertion(device == null, "设备不存在");
|
||||
|
||||
// 更新数据库总用电量
|
||||
String w = map.get("W");
|
||||
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);
|
||||
}
|
||||
}
|
||||
this.setDeviceInfo(device, info);
|
||||
|
||||
return 1;
|
||||
return this.updateIotInfo(device);
|
||||
}
|
||||
|
||||
private List<Long> selectIds(DeviceQuery query) {
|
||||
|
|
|
@ -289,10 +289,12 @@ public class TransactionBill extends BaseEntity
|
|||
|
||||
@Excel(name = "套餐是否开启语音播报")
|
||||
@ApiModelProperty("套餐是否开启语音播报")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private Boolean suitEnabledVoid;
|
||||
|
||||
@Excel(name = "套餐语音播报阈值", readConverterExp = "分=钟")
|
||||
@ApiModelProperty("套餐语音播报阈值")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private BigDecimal suitVoidMinute;
|
||||
|
||||
@Excel(name = "套餐语音播报设置结果", readConverterExp = "1=-成功,2-失败")
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
|
@ -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.vo.UserRealNameVO;
|
||||
import com.ruoyi.ss.user.domain.vo.UserRealRefreshVO;
|
||||
import com.ruoyi.ss.user.domain.vo.UserStatisticsVO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
@ -296,4 +297,6 @@ public interface UserService
|
|||
* 重置实名认证
|
||||
*/
|
||||
int resetRealName(Long userId);
|
||||
|
||||
UserStatisticsVO selectStatistics(Long userId);
|
||||
}
|
||||
|
|
|
@ -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.vo.UserRealNameVO;
|
||||
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.service.UserAssembler;
|
||||
import com.ruoyi.ss.user.service.UserService;
|
||||
import com.ruoyi.ss.user.service.UserValidator;
|
||||
import com.ruoyi.system.domain.enums.config.ConfigKey;
|
||||
|
@ -139,6 +141,9 @@ public class UserServiceImpl implements UserService
|
|||
@Autowired
|
||||
private AppConverter appConverter;
|
||||
|
||||
@Autowired
|
||||
private UserAssembler userAssembler;
|
||||
|
||||
/**
|
||||
* 查询普通用户信息
|
||||
*
|
||||
|
@ -746,6 +751,36 @@ public class UserServiceImpl implements UserService
|
|||
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) {
|
||||
PageHelper.startPage(1, 1);
|
||||
List<SmUserVO> list = this.selectSmUserList(query);
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
package com.ruoyi.task.bill;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.ss.payBill.domain.PayBillQuery;
|
||||
import com.ruoyi.ss.payBill.domain.PayBillVO;
|
||||
import com.ruoyi.ss.payBill.domain.enums.PayBillStatus;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
|
@ -19,7 +13,6 @@ import org.springframework.stereotype.Component;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
|
|
@ -10,9 +10,11 @@ import com.ruoyi.common.core.domain.ValidGroup;
|
|||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.enums.OperatorType;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
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.DeviceBO;
|
||||
import com.ruoyi.ss.device.domain.DeviceQuery;
|
||||
|
@ -310,8 +312,9 @@ public class AppDeviceController extends BaseController {
|
|||
|
||||
@ApiOperation("蓝牙同步设备物联网信息")
|
||||
@PutMapping("/bltSyncIot")
|
||||
public AjaxResult bltSyncIot(String sn, String info) {
|
||||
return toAjax(smDeviceService.bltSyncIot(sn, info));
|
||||
public AjaxResult bltSyncIot(@RequestBody IotDeviceInfo info) {
|
||||
info.setAt(DateUtils.getNowDate());
|
||||
return toAjax(smDeviceService.bltSyncIot(info));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
|
@ -8,10 +8,10 @@ import com.ruoyi.common.enums.BusinessType;
|
|||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
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.articleClassify.service.ISmArticleClassifyService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
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")
|
||||
public AjaxResult deptTree(SmArticleClassifyQuery classify)
|
||||
{
|
||||
|
|
|
@ -93,14 +93,8 @@ public class SmUserController extends BaseController
|
|||
{
|
||||
SmUserVO user = userService.selectSmUserByUserId(userId);
|
||||
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.assembleRealServiceRate(list);
|
||||
userService.desensitization(list);
|
||||
return success(user);
|
||||
}
|
||||
|
@ -158,4 +152,10 @@ public class SmUserController extends BaseController
|
|||
return toAjax(userService.resetRealName(userId));
|
||||
}
|
||||
|
||||
// 获取用户统计信息
|
||||
@GetMapping("/userStatistics")
|
||||
public AjaxResult userStatistics(Long userId) {
|
||||
return success(userService.selectStatistics(userId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,28 +1,24 @@
|
|||
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.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
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 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;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
|
@ -37,10 +33,10 @@ public class SysNoticeController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysNotice notice)
|
||||
public TableDataInfo list(SysNoticeQuery notice)
|
||||
{
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
List<SysNoticeVO> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user