# Conflicts:
#	psdc-admin/src/main/java/com/psdc/PsdcApplication.java
#	psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java
#	psdc-business/src/main/java/com/psdc/service/impl/PsdcDeviceServiceImpl.java
master
林颖晨 2 years ago
commit 6d475cfca5
  1. 4
      psdc-admin/src/main/java/com/psdc/PsdcApplication.java
  2. 29
      psdc-business/src/main/java/com/psdc/entity/PsdcDevice.java
  3. 11
      psdc-business/src/main/java/com/psdc/mapper/PsdcDeviceMapper.java
  4. 19
      psdc-business/src/main/java/com/psdc/service/IPsdcDeviceService.java
  5. 169
      psdc-business/src/main/java/com/psdc/service/impl/PsdcDeviceServiceImpl.java
  6. 21
      psdc-business/src/main/resources/mapper/business/PsdcDeviceMapper.xml
  7. 4
      psdc-system/src/main/java/com/psdc/mapper/SysUserMapper.java
  8. 201
      psdc-system/src/main/java/com/psdc/service/impl/SysUserServiceImpl.java
  9. 7
      psdc-system/src/main/resources/mapper/system/SysUserMapper.xml
  10. 275
      psdc-ui/src/views/analyse/nhfx/index.vue
  11. 307
      psdc-ui/src/views/analyse/nhtj/index.vue
  12. 19
      psdc-ui/src/views/bigview/index.vue
  13. 123
      psdc-ui/src/views/control/manual/index.vue
  14. 226
      psdc-ui/src/views/control/timer/index.vue
  15. 186
      psdc-ui/src/views/emonitor/db/index.vue
  16. 36
      psdc-ui/src/views/emonitor/drgl/index.vue
  17. 228
      psdc-ui/src/views/emonitor/frdl/index.vue
  18. 243
      psdc-ui/src/views/emonitor/kqyrb/index.vue
  19. 74
      psdc-ui/src/views/emonitor/wdcgq/index.vue
  20. 243
      psdc-ui/src/views/emonitor/xrgl/index.vue
  21. 174
      psdc-web/src/main/java/com/psdc/controller/manager/PsdcDeviceController.java
  22. BIN
      psdc-web/src/main/resources/template/AllDevicesData.xlsx

@ -2,18 +2,20 @@ package com.psdc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication()
@EnableScheduling
@EnableAsync
@EnableTransactionManagement
public class PsdcApplication
{
public static void main(String[] args)
{
SpringApplication.run(PsdcApplication.class, args);
System.out.println("《= = = 系统启动成功 = = =》");
}

@ -1,5 +1,6 @@
package com.psdc.entity;
import com.psdc.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -17,25 +18,43 @@ import java.util.Date;
public class PsdcDevice {
/** 设备id */
@Excel(name = "设备Id", cellType = Excel.ColumnType.NUMERIC)
private Integer deviceId ;
/** 用户id */
private Integer userId ;
/** 用户名称 */
@Excel(name = "用户名称")
private String userName ;
/** 设备类型:1-监测设备,2-运行设备 */
private Integer deviceType ;
/** 设备sn */
private String deviceSn ;
/** 设备类型:1-监测设备,2-运行设备 */
@Excel(name = "设备类型")
private String devType ;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName ;
/** 设备sn */
@Excel(name = "设备Sn")
private String deviceSn ;
/** 硬件版本 */
@Excel(name = "硬件版本")
private String hardVersion ;
/** 软件版本 */
@Excel(name = "软件版本")
private String softVersion ;
/** 安装地址 */
@Excel(name = "安装地址")
private String deviceAddress ;
/** 启用时间 */
private Date startTime ;
@Excel(name = "启用时间")
private String startTime ;
/** 设备状态:1-未激活,2-禁用,3-在线,4-离线 */
private Integer deviceStatus ;
/** 设备状态:1-未激活,2-禁用,3-在线,4-离线 */
@Excel(name = "设备状态")
private String devStatus ;
/** 图片地址 */
private String photoUrl ;
/** 创建者 */
@ -46,8 +65,12 @@ public class PsdcDevice {
private String updateBy ;
/** 修改时间 */
private Date updateTime ;
/** 设备运行状态:1-开启,2-关闭 */
private Integer deviceRunstatus ;
/** 设备运行状态:1-开启,2-关闭 */
@Excel(name = "设备运行状态")
private String devRunstatus ;
}

@ -36,10 +36,9 @@ public interface PsdcDeviceMapper{
* 分页查询指定行数据
*
* @param psdcDevice 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<PsdcDevice> queryAllByLimit(PsdcDevice psdcDevice, @Param("pageable") Pageable pageable);
List<PsdcDevice> queryAllByLimit(PsdcDevice psdcDevice);
/**
* 统计总行数
*
@ -64,10 +63,10 @@ public interface PsdcDeviceMapper{
/**
* 通过主键删除数据
*
* @param deviceId 主键
* @param deviceIds 主键
* @return 影响行数
*/
int deleteById(Integer deviceId);
int deleteById(@Param(value = "deviceIds") Long[] deviceIds);
/**
* 根据用户id查询设备
@ -84,6 +83,7 @@ public interface PsdcDeviceMapper{
int updateDevRunStatusByDevId(@Param(value = "deviceId") Integer deviceId,
@Param(value = "runStatus") Integer runStatus);
/**
* 根据设备id查询设备名称
* @param deviceId
@ -92,4 +92,7 @@ public interface PsdcDeviceMapper{
String queryDeviceNameByDeviceId(Integer deviceId);
void saveDevicesData(@Param(value = "devRecord") List<PsdcDevice> devRecord);
}

@ -2,6 +2,7 @@ package com.psdc.service;
import com.psdc.entity.PsdcDevice;
import com.psdc.entity.vo.DeviceStatusVo;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List;
@ -38,7 +39,15 @@ public interface IPsdcDeviceService {
* @param psdcDevice 实例对象
* @return 实例对象
*/
PsdcDevice insert(PsdcDevice psdcDevice);
Integer insert(PsdcDevice psdcDevice);
/**
* 分页查询指定行数据
*
* @param psdcDevice 查询条件
* @return 对象列表
*/
List<PsdcDevice> queryAllByLimit(PsdcDevice psdcDevice);
/**
* 更新数据
@ -46,14 +55,16 @@ public interface IPsdcDeviceService {
* @param psdcDevice 实例对象
* @return 实例对象
*/
PsdcDevice update(PsdcDevice psdcDevice);
Integer update(PsdcDevice psdcDevice);
/**
* 通过主键删除数据
*
* @param deviceId 主键
* @param deviceIds 主键
* @return 是否成功
*/
boolean deleteById(Integer deviceId);
boolean deleteById(Long[] deviceIds);
boolean daoruDevicesData(MultipartFile file, String cjr);
/**
* 更新设备状态

@ -9,20 +9,26 @@ import com.psdc.mapper.PsdcControlLogMapper;
import com.psdc.mapper.PsdcDeviceMapper;
import com.psdc.service.IPsdcDeviceService;
import com.psdc.utils.SecurityUtils;
import com.psdc.utils.poi.ExcelUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import static org.springframework.transaction.annotation.Propagation.REQUIRES_NEW;
@Service
@Slf4j
public class PsdcDeviceServiceImpl implements IPsdcDeviceService{
public class PsdcDeviceServiceImpl implements IPsdcDeviceService {
@Resource
private PsdcDeviceMapper psdcDeviceMapper;
@ -36,21 +42,25 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService{
* @param deviceId 主键
* @return 实例对象
*/
public PsdcDevice queryById(Integer deviceId){
public PsdcDevice queryById(Integer deviceId) {
return psdcDeviceMapper.queryById(deviceId);
}
/**
* 根据用户id查询设备列表
<<<<<<< HEAD
* @return 设备列表
=======
*
* @return
>>>>>>> e7257650302fdf30d685bfae8df3cc0405bb51f6
*/
public List<PsdcDevice> queryByUserId(){
public List<PsdcDevice> queryByUserId() {
return psdcDeviceMapper.queryByUserId(SecurityUtils.getUserId());
}
public List<DeviceStatusVo> queryDeviceStatus(){
public List<DeviceStatusVo> queryDeviceStatus() {
List<PsdcDevice> psdcDevices = psdcDeviceMapper.queryByUserId(SecurityUtils.getUserId());
return psdcDevices.stream().map(psdcDevice -> {
DeviceStatusVo deviceStatusVo = new DeviceStatusVo();
@ -70,9 +80,20 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService{
* @param psdcDevice 实例对象
* @return 实例对象
*/
public PsdcDevice insert(PsdcDevice psdcDevice){
psdcDeviceMapper.insert(psdcDevice);
return psdcDevice;
public Integer insert(PsdcDevice psdcDevice) {
return psdcDeviceMapper.insert(psdcDevice);
}
@Override
public List<PsdcDevice> queryAllByLimit(PsdcDevice psdcDevice) {
List<PsdcDevice> list = psdcDeviceMapper.queryAllByLimit(psdcDevice);
for (PsdcDevice dev : list){
dev.setDevType(s("t", dev.getDeviceType()));
dev.setDevStatus(s("s", dev.getDeviceStatus()));
dev.setDevRunstatus(s("r", dev.getDeviceRunstatus()));
}
return list;
}
/**
@ -81,54 +102,88 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService{
* @param psdcDevice 实例对象
* @return 实例对象
*/
public PsdcDevice update(PsdcDevice psdcDevice){
psdcDeviceMapper.update(psdcDevice);
return queryById(psdcDevice.getDeviceId());
public Integer update(PsdcDevice psdcDevice) {
return psdcDeviceMapper.update(psdcDevice);
}
/**
* 通过主键删除数据
* @param deviceId 主键
*
* @param deviceIds 主键
* @return 是否成功
*/
public boolean deleteById(Integer deviceId){
int total = psdcDeviceMapper.deleteById(deviceId);
public boolean deleteById(Long[] deviceIds) {
int total = psdcDeviceMapper.deleteById(deviceIds);
return total > 0;
}
@Override
@Transactional(propagation = REQUIRES_NEW)
public boolean daoruDevicesData(MultipartFile file, String cjr) {
try {
// 需要将上传文件转成Stream流
InputStream in = file.getInputStream();
ExcelUtil<PsdcDevice> util = new ExcelUtil<>(PsdcDevice.class);
List<PsdcDevice> devices = util.importExcel(in);
for (PsdcDevice pd : devices){
pd.setCreateBy(cjr);
pd.setCreateTime(new Date());
pd.setDeviceType(Integer.parseInt(pd.getDevType()));
// 新导入的设备默认状态为: 未激活
// 新导入的设备默认启动时间为null,请在设备激活后手动修改!
pd.setDeviceStatus(1);
// 新导入的设备默认运行状态为: 关闭
pd.setDeviceRunstatus(2);
}
psdcDeviceMapper.saveDevicesData(devices);
return true;
} catch (Exception e) {
e.printStackTrace();
log.info("Sorry,导入设备数据失败!+ 错误原因: {}", e.getMessage());
return false;
}
}
/**
* 更新设备状态
*
* @param deviceId
* @param runStatus
* @return
*/
@Override
public int updateDeviceRunStatus(Integer deviceId, Integer runStatus) {
return psdcDeviceMapper.updateDevRunStatusByDevId(deviceId,runStatus);
return psdcDeviceMapper.updateDevRunStatusByDevId(deviceId, runStatus);
}
/**
* 控制设备启动停止
<<<<<<< HEAD
* @param deviceId 主键
* @param runStatus 状态
* @return 条数
=======
*
* @param deviceId
* @param runStatus
* @return
>>>>>>> e7257650302fdf30d685bfae8df3cc0405bb51f6
*/
@Override
public int controlDeviceStartAndStop(Integer deviceId, Integer runStatus,String controlBy,Integer controlMethod) {
public int controlDeviceStartAndStop(Integer deviceId, Integer runStatus, String controlBy, Integer controlMethod) {
String value = "";
if(runStatus == 1){
if (runStatus == 1) {
value = "启动";
} else {
if ( runStatus == 2 ) {
value = "停止";
}
} else if (runStatus == 2) {
value = "停止";
}
log.info("设备id:{}",deviceId);
log.info("设备id:{}", deviceId);
PsdcDevice psdcDevice = psdcDeviceMapper.queryById(deviceId);
if(psdcDevice == null){
psdcControlLogMapper.insert(new PsdcControlLog(deviceId,null,null,"设备启停",value,controlMethod,3,"未找到该设备",controlBy));
if (psdcDevice == null) {
psdcControlLogMapper.insert(new PsdcControlLog(deviceId, null, null, "设备启停", value, controlMethod, 3, "未找到该设备", controlBy));
throw new ControlException("控制失败,未找到该设备");
}
@ -136,21 +191,22 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService{
// psdcControlLogMapper.insert(new PsdcControlLog(deviceId,psdcDevice.getDeviceName(),psdcDevice.getDeviceSn(),"设备启停",value,controlMethod,3,"手动控制,等待终端响应超时",controlBy));
// 发送成功
psdcControlLogMapper.insert(new PsdcControlLog(deviceId,psdcDevice.getDeviceName(),psdcDevice.getDeviceSn(),"设备启停",value,controlMethod,2,"手动控制,控制成功",controlBy));
return psdcDeviceMapper.updateDevRunStatusByDevId(deviceId,runStatus);
psdcControlLogMapper.insert(new PsdcControlLog(deviceId,psdcDevice.getDeviceName(), psdcDevice.getDeviceSn(), "设备启停", value, controlMethod, 2, "手动控制,控制成功", controlBy));
return psdcDeviceMapper.updateDevRunStatusByDevId(deviceId, runStatus);
}
@Override
public int setTemperature(Integer deviceId, List<HashMap> data, String controlBy,Integer controlMethod) {
public int setTemperature(Integer deviceId, List<HashMap> data, String controlBy, Integer controlMethod) {
log.info("设备id:{}",deviceId);
log.info("控制指令:{}",data);
log.info("设备id:{}", deviceId);
log.info("控制指令:{}", data);
PsdcDevice psdcDevice = psdcDeviceMapper.queryById(deviceId);
if(psdcDevice == null){
psdcControlLogMapper.insert(new PsdcControlLog(deviceId,null,null,"设定温度",null,controlMethod,3,"未找到该设备",controlBy));
if (psdcDevice == null) {
psdcControlLogMapper.insert(new PsdcControlLog(deviceId, null, null, "设定温度", null, controlMethod, 3, "未找到该设备", controlBy));
throw new ControlException("控制失败,未找到该设备");
}
@ -166,7 +222,7 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService{
// psdcControlLogMapper.insert(new PsdcControlLog(deviceId,psdcDevice.getDeviceName(),psdcDevice.getDeviceSn(),controlContext,controlValue,controlMethod,3,"等待终端响应超时",controlBy));
//发送成功
psdcControlLogMapper.insert(new PsdcControlLog(deviceId,psdcDevice.getDeviceName(),psdcDevice.getDeviceSn(),controlContext,controlValue,controlMethod,2,"控制成功",controlBy));
psdcControlLogMapper.insert(new PsdcControlLog(deviceId, psdcDevice.getDeviceName(), psdcDevice.getDeviceSn(), controlContext, controlValue, controlMethod, 2, "控制成功", controlBy));
atomicInteger.incrementAndGet();
}
return atomicInteger.get();
@ -174,6 +230,7 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService{
/**
* 单条控制指令
*
* @param deviceId
* @param key
* @param value
@ -182,17 +239,17 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService{
* @return
*/
@Override
public int setTemperature(Integer deviceId, String key,String value, String controlBy,Integer controlMethod) {
public int setTemperature(Integer deviceId, String key, String value, String controlBy, Integer controlMethod) {
log.info("设备id:{}",deviceId);
log.info("控制指令:{}",key);
log.info("控制内容:{}",value);
log.info("设备id:{}", deviceId);
log.info("控制指令:{}", key);
log.info("控制内容:{}", value);
String controlContext = ControlKeyEnum.getControlContext(key);
PsdcDevice psdcDevice = psdcDeviceMapper.queryById(deviceId);
if(psdcDevice == null){
psdcControlLogMapper.insert(new PsdcControlLog(deviceId,null,null,controlContext,null,controlMethod,3,"未找到该设备",controlBy));
if (psdcDevice == null) {
psdcControlLogMapper.insert(new PsdcControlLog(deviceId, null, null, controlContext, null, controlMethod, 3, "未找到该设备", controlBy));
throw new ControlException("控制失败,未找到该设备");
}
@ -202,7 +259,39 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService{
// psdcControlLogMapper.insert(new PsdcControlLog(deviceId,psdcDevice.getDeviceName(),psdcDevice.getDeviceSn(),controlContext,value,controlMethod,3,"等待终端响应超时",controlBy));
//发送成功
return psdcControlLogMapper.insert(new PsdcControlLog(deviceId,psdcDevice.getDeviceName(),psdcDevice.getDeviceSn(),controlContext,value,controlMethod,2,"控制成功",controlBy));
return psdcControlLogMapper.insert(new PsdcControlLog(deviceId, psdcDevice.getDeviceName(), psdcDevice.getDeviceSn(), controlContext, value, controlMethod, 2, "控制成功", controlBy));
}
private String s(String s, int i) {
switch (s) {
case "s":
switch (i) {
case 1:
return "未激活";
case 2:
return "禁用";
case 3:
return "在线";
case 4:
return "离线";
}
case "t":
switch (i) {
case 1:
return "监测设备";
case 2:
return "运行设备";
}
case "r":
switch (i) {
case 1:
return "开启";
case 2:
return "关闭";
}
default:
return s;
}
}
}

@ -145,7 +145,6 @@
and update_time = #{updateTime}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
@ -214,6 +213,17 @@
#{updateTime})
</insert>
<insert id="saveDevicesData" parameterType="com.psdc.entity.PsdcDevice" useGeneratedKeys="true">
Insert into psdc_device(user_id, device_type, device_sn, device_name, hard_version, soft_version,
device_address, start_time, device_status, device_runstatus, photo_url, create_by,
create_time, update_by, update_time)
Values
<foreach collection="devRecord" item="entity" separator=",">
(NULL, #{entity.deviceType}, #{entity.deviceSn}, #{entity.deviceName}, #{entity.hardVersion}, #{entity.softVersion}, #{entity.deviceAddress},
#{entity.startTime}, #{entity.deviceStatus}, #{entity.deviceRunstatus}, #{entity.photoUrl}, #{entity.createBy}, #{entity.createTime}, NULL, NULL)
</foreach>
</insert>
<!-- 更新数据 -->
<update id="update">
update psdc_device
@ -249,7 +259,7 @@
device_status = #{deviceStatus},
</if>
<if test="deviceRunstatus != null and deviceRunstatus != ''">
and device_runstatus = #{deviceRunstatus}
device_runstatus = #{deviceRunstatus},
</if>
<if test="photoUrl != null and photoUrl != ''">
photo_url = #{photoUrl},
@ -263,7 +273,7 @@
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null and updateTime != ''">
<if test="updateTime != null ">
update_time = #{updateTime},
</if>
</set>
@ -272,7 +282,10 @@
<!--通过主键删除-->
<delete id="deleteById">
delete from psdc_device where device_id = #{deviceId}
delete from psdc_device where device_id in
<foreach collection="deviceIds" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</delete>

@ -19,7 +19,9 @@ public interface SysUserMapper
* @param sysUser 用户信息
* @return 用户信息集合信息
*/
public List<SysUser> selectUserList(SysUser sysUser);
List<SysUser> selectUserList(SysUser sysUser);
List<SysUser> selectUserList2();
/**
* 根据条件分页查询已配用户角色列表

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,12 +28,11 @@ import com.psdc.service.ISysUserService;
/**
* 用户 业务层处理
*
*
* @author
*/
@Service
public class SysUserServiceImpl implements ISysUserService
{
public class SysUserServiceImpl implements ISysUserService {
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
@Autowired
@ -52,76 +52,72 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 根据条件分页查询用户列表
*
*
* @param user 用户信息
* @return 用户信息集合信息
*/
@Override
public List<SysUser> selectUserList(SysUser user)
{
public List<SysUser> selectUserList(SysUser user) {
if (null == user){
return userMapper.selectUserList2();
}
return userMapper.selectUserList(user);
}
/**
* 根据条件分页查询已分配用户角色列表
*
*
* @param user 用户信息
* @return 用户信息集合信息
*/
@Override
public List<SysUser> selectAllocatedList(SysUser user)
{
public List<SysUser> selectAllocatedList(SysUser user) {
return userMapper.selectAllocatedList(user);
}
/**
* 根据条件分页查询未分配用户角色列表
*
*
* @param user 用户信息
* @return 用户信息集合信息
*/
@Override
public List<SysUser> selectUnallocatedList(SysUser user)
{
public List<SysUser> selectUnallocatedList(SysUser user) {
return userMapper.selectUnallocatedList(user);
}
/**
* 通过用户名查询用户
*
*
* @param userName 用户名
* @return 用户对象信息
*/
@Override
public SysUser selectUserByUserName(String userName)
{
public SysUser selectUserByUserName(String userName) {
return userMapper.selectUserByUserName(userName);
}
/**
* 通过用户ID查询用户
*
*
* @param userId 用户ID
* @return 用户对象信息
*/
@Override
public SysUser selectUserById(Long userId)
{
public SysUser selectUserById(Long userId) {
return userMapper.selectUserById(userId);
}
/**
* 查询用户所属角色组
*
*
* @param userName 用户名
* @return 结果
*/
@Override
public String selectUserRoleGroup(String userName)
{
public String selectUserRoleGroup(String userName) {
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
if (CollectionUtils.isEmpty(list))
{
if (CollectionUtils.isEmpty(list)) {
return StringUtils.EMPTY;
}
return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
@ -130,17 +126,15 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 校验用户名称是否唯一
*
*
* @param user 用户信息
* @return 结果
*/
@Override
public boolean checkUserNameUnique(SysUser user)
{
public boolean checkUserNameUnique(SysUser user) {
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
SysUser info = userMapper.checkUserNameUnique(user.getUserName());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@ -153,12 +147,10 @@ public class SysUserServiceImpl implements ISysUserService
* @return
*/
@Override
public boolean checkPhoneUnique(SysUser user)
{
public boolean checkPhoneUnique(SysUser user) {
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@ -171,12 +163,10 @@ public class SysUserServiceImpl implements ISysUserService
* @return
*/
@Override
public boolean checkEmailUnique(SysUser user)
{
public boolean checkEmailUnique(SysUser user) {
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
SysUser info = userMapper.checkEmailUnique(user.getEmail());
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
@ -184,33 +174,28 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 校验用户是否允许操作
*
*
* @param user 用户信息
*/
@Override
public void checkUserAllowed(SysUser user)
{
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
{
public void checkUserAllowed(SysUser user) {
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
throw new ServiceException("不允许操作超级管理员用户");
}
}
/**
* 校验用户是否有数据权限
*
*
* @param userId 用户id
*/
@Override
public void checkUserDataScope(Long userId)
{
if (!SysUser.isAdmin(SecurityUtils.getUserId()))
{
public void checkUserDataScope(Long userId) {
if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
SysUser user = new SysUser();
user.setUserId(userId);
List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user);
if (StringUtils.isEmpty(users))
{
if (StringUtils.isEmpty(users)) {
throw new ServiceException("没有权限访问用户数据!");
}
}
@ -218,14 +203,13 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 新增保存用户信息
*
*
* @param user 用户信息
* @return 结果
*/
@Override
@Transactional
public int insertUser(SysUser user)
{
public int insertUser(SysUser user) {
// 新增用户信息
int rows = userMapper.insertUser(user);
// 新增用户与角色管理
@ -235,26 +219,24 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 注册用户信息
*
*
* @param user 用户信息
* @return 结果
*/
@Override
public boolean registerUser(SysUser user)
{
public boolean registerUser(SysUser user) {
return userMapper.insertUser(user) > 0;
}
/**
* 修改保存用户信息
*
*
* @param user 用户信息
* @return 结果
*/
@Override
@Transactional
public int updateUser(SysUser user)
{
public int updateUser(SysUser user) {
Long userId = user.getUserId();
// 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId);
@ -265,105 +247,95 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 用户授权角色
*
* @param userId 用户ID
*
* @param userId 用户ID
* @param roleIds 角色组
*/
@Override
@Transactional
public void insertUserAuth(Long userId, Long[] roleIds)
{
public void insertUserAuth(Long userId, Long[] roleIds) {
userRoleMapper.deleteUserRoleByUserId(userId);
insertUserRole(userId, roleIds);
}
/**
* 修改用户状态
*
*
* @param user 用户信息
* @return 结果
*/
@Override
public int updateUserStatus(SysUser user)
{
public int updateUserStatus(SysUser user) {
return userMapper.updateUser(user);
}
/**
* 修改用户基本信息
*
*
* @param user 用户信息
* @return 结果
*/
@Override
public int updateUserProfile(SysUser user)
{
public int updateUserProfile(SysUser user) {
return userMapper.updateUser(user);
}
/**
* 修改用户头像
*
*
* @param userName 用户名
* @param avatar 头像地址
* @param avatar 头像地址
* @return 结果
*/
@Override
public boolean updateUserAvatar(String userName, String avatar)
{
public boolean updateUserAvatar(String userName, String avatar) {
return userMapper.updateUserAvatar(userName, avatar) > 0;
}
/**
* 重置用户密码
*
*
* @param user 用户信息
* @return 结果
*/
@Override
public int resetPwd(SysUser user)
{
public int resetPwd(SysUser user) {
return userMapper.updateUser(user);
}
/**
* 重置用户密码
*
*
* @param userName 用户名
* @param password 密码
* @return 结果
*/
@Override
public int resetUserPwd(String userName, String password)
{
public int resetUserPwd(String userName, String password) {
return userMapper.resetUserPwd(userName, password);
}
/**
* 新增用户角色信息
*
*
* @param user 用户对象
*/
public void insertUserRole(SysUser user)
{
public void insertUserRole(SysUser user) {
this.insertUserRole(user.getUserId(), user.getRoleIds());
}
/**
* 新增用户角色信息
*
* @param userId 用户ID
*
* @param userId 用户ID
* @param roleIds 角色组
*/
public void insertUserRole(Long userId, Long[] roleIds)
{
if (StringUtils.isNotEmpty(roleIds))
{
public void insertUserRole(Long userId, Long[] roleIds) {
if (StringUtils.isNotEmpty(roleIds)) {
// 新增用户与角色管理
List<SysUserRole> list = new ArrayList<SysUserRole>(roleIds.length);
for (Long roleId : roleIds)
{
for (Long roleId : roleIds) {
SysUserRole ur = new SysUserRole();
ur.setUserId(userId);
ur.setRoleId(roleId);
@ -375,14 +347,13 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 通过用户ID删除用户
*
*
* @param userId 用户ID
* @return 结果
*/
@Override
@Transactional
public int deleteUserById(Long userId)
{
public int deleteUserById(Long userId) {
// 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId);
return userMapper.deleteUserById(userId);
@ -390,16 +361,14 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 批量删除用户信息
*
*
* @param userIds 需要删除的用户ID
* @return 结果
*/
@Override
@Transactional
public int deleteUserByIds(Long[] userIds)
{
for (Long userId : userIds)
{
public int deleteUserByIds(Long[] userIds) {
for (Long userId : userIds) {
checkUserAllowed(new SysUser(userId));
checkUserDataScope(userId);
}
@ -410,17 +379,15 @@ public class SysUserServiceImpl implements ISysUserService
/**
* 导入用户数据
*
* @param userList 用户数据列表
*
* @param userList 用户数据列表
* @param isUpdateSupport 是否更新支持如果已存在则进行更新数据
* @param operName 操作用户
* @param operName 操作用户
* @return 结果
*/
@Override
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName)
{
if (StringUtils.isNull(userList) || userList.size() == 0)
{
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) {
if (StringUtils.isNull(userList) || userList.size() == 0) {
throw new ServiceException("导入用户数据不能为空!");
}
int successNum = 0;
@ -428,23 +395,18 @@ public class SysUserServiceImpl implements ISysUserService
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
String password = configService.selectConfigByKey("sys.user.initPassword");
for (SysUser user : userList)
{
try
{
for (SysUser user : userList) {
try {
// 验证是否存在这个用户
SysUser u = userMapper.selectUserByUserName(user.getUserName());
if (StringUtils.isNull(u))
{
if (StringUtils.isNull(u)) {
BeanValidators.validateWithException(validator, user);
user.setPassword(SecurityUtils.encryptPassword(password));
user.setCreateBy(operName);
this.insertUser(user);
successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
}
else if (isUpdateSupport)
{
} else if (isUpdateSupport) {
BeanValidators.validateWithException(validator, user);
checkUserAllowed(user);
checkUserDataScope(user.getUserId());
@ -452,28 +414,21 @@ public class SysUserServiceImpl implements ISysUserService
this.updateUser(user);
successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
}
else
{
} else {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在");
}
}
catch (Exception e)
{
} catch (Exception e) {
failureNum++;
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
}
else
{
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();

@ -64,6 +64,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</select>
<select id="selectUserList2" resultMap="SysUserResult">
Select user_id, nick_name, user_name, email, avatar, phonenumber, sex, status,
del_flag, login_ip, login_date, create_by, create_time, remark
From sys_user
Where del_flag != '2'
</select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
Select distinct u.user_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time

@ -1,16 +1,289 @@
<template>
<div class="app-container home">
<h1>能耗分析</h1>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="同比分析" name="first">
<el-form :inline="true" class="demo-form-inline">
<el-form-item label="日期:"><el-date-picker v-model="dateValue1" type="date" placeholder="请选择日期" size="default"/></el-form-item>
<el-form-item><el-button type="primary" @click="lastDay"><el-icon><ArrowLeft /></el-icon></el-button></el-form-item>
<el-form-item><el-button type="primary" @click="nextDay">下一日<el-icon><ArrowRight /></el-icon></el-button></el-form-item>
<el-form-item><el-button type="primary" icon="Search" @click="handleQuery1">查询</el-button></el-form-item>
</el-form>
<div class="chartBox">
<div id="chart"></div>
</div>
<div class="tableBox1">
<el-table :data="tbfxDataTable" height="400px">
<el-table-column label="月份" align="center" prop="month" width="100"/>
<el-table-column label="本期" align="center" prop="currentPeriod"/>
<el-table-column label="同期" align="center" prop="theSameTerm"/>
<el-table-column label="同比(%)" align="center" prop="yearOnYear"/>
<el-table-column label="累计同比(%)" align="center" prop="totalYearOnYear"/>
</el-table>
<el-pagination
v-model:current-page="tbfxCurrentPage"
v-model:page-size="tbfxPageSize"
:page-sizes="[5, 10, 20, 50]"
:small="tbfxSmall"
:disabled="tbfxDisabled"
:background="tbfxBackground"
layout="total, sizes, prev, pager, next, jumper"
:total="tbfxDataTable.length"
@size-change="tbfxHandleSizeChange"
@current-change="tbfxHandleCurrentChange"/>
</div>
</el-tab-pane>
<el-tab-pane label="环比分析" name="second">
<!-- @submit.native.prevent阻止默认提交事件-->
<el-form :inline="true" class="demo-form-inline" @submit.native.prevent>
<el-form-item class="mr0"><button class="myBtn btn1" :class="{active : activeIndex === 0}" @click="handleDaily">按日</button></el-form-item>
<el-form-item ><button class="myBtn btn2" :class="{active : activeIndex === 1}" @click="handleMonthly">按月</button></el-form-item>
<el-form-item label="日期:"><el-date-picker v-model="dateValue2" :type="dateType" :format="format" :value-format="valueFormat" placeholder="请选择日期" size="default"/></el-form-item>
<el-form-item><el-button type="primary" icon="Search" @click="handleQuery2">查询</el-button></el-form-item>
</el-form>
<div class="tableBox2">
<el-table :data="hbfxDataTable">
<el-table-column label="用能设备" align="center" prop="type"/>
<el-table-column :label="label1" align="center" :prop="prop1"/>
<el-table-column :label="label2" align="center" :prop="prop2"/>
<el-table-column label="增加值" align="center" prop="addValue"/>
<el-table-column label="环比(%)" align="center" prop="relative"/>
<el-table-column label="操作" align="center">
<template v-slot="scope">
<el-button type="primary" size="small" :icon="Histogram" @click="handleChart">图表</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:current-page="hbfxCurrentPage"
v-model:page-size="hbfxPageSize"
:page-sizes="[5, 10, 20, 50]"
:small="hbfxSmall"
:disabled="hbfxDisabled"
:background="hbfxBackground"
layout="total, sizes, prev, pager, next, jumper"
:total="hbfxDataTable.length"
@size-change="hbfxHandleSizeChange"
@current-change="hbfxHandleCurrentChange"/>
</div>
<!-- 生成图表弹出窗 -->
<el-dialog class="mrt" :title="title" v-model="open" width="1000px" append-to-body>
<div class="chartBox">
<div id="chart"></div>
</div>
</el-dialog>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup name="Index">
import {Histogram} from '@element-plus/icons-vue'
import {ref,reactive} from "vue";
/** 切换按钮操作*/
const activeName = ref('first')
/** ----------同比分析----------*/
/** 过滤查询*/
const dateValue1 = ref(new Date())
function lastDay(){
const current = dateValue1.value;
const previous = new Date(current.getFullYear(), current.getMonth(), current.getDate() - 1);
dateValue1.value = previous;
}
function nextDay(){
const current = dateValue1.value;
const next = new Date(current.getFullYear(), current.getMonth(), current.getDate() + 1);
dateValue1.value = next;
}
function handleQuery1(){}
/** 数据表格处理*/
//
const tbfxDataTable = reactive([
{
month:'01月',
currentPeriod: '1265',
theSameTerm:'3254',
yearOnYear:'30',
totalYearOnYear:'32',
}
])
const tbfxCurrentPage = ref(1)
const tbfxPageSize = ref(5)
const tbfxSmall = ref(false)
const tbfxBackground = ref(false)
const tbfxDisabled = ref(false)
const tbfxHandleSizeChange = (val) => {
console.log(`${val}`)
}
const tbfxHandleCurrentChange = (val) => {
console.log(`${val}`)
}
/** ----------环比分析----------*/
/** 过滤查询*/
const activeIndex = ref(0)
const dateValue2 = ref()
const dateType = ref('date')
const format = ref('YYYY-MM-DD')
const valueFormat = ref('YYYY-MM-DD')
function handleDaily(){
activeIndex.value = 0;
prop1.value = 'toDay'
label1.value = '当日用电/kWh'
prop2.value = 'lastDay'
label2.value = '上日用电/kWh';
dateType.value = 'date'
format.value = 'YYYY-MM-DD'
valueFormat.value = 'YYYY-MM-DD'
}
function handleMonthly(){
activeIndex.value = 1;
prop1.value = 'toMonth'
label1.value = '当月用电/kWh'
prop2.value = 'lastMonth'
label2.value = '上月用电/kWh';
dateType.value = 'month'
format.value = 'YYYY-MM'
valueFormat.value = 'YYYY-MM'
}
function handleQuery2(){}
/** 数据表格处理*/
//
const hbfxDataTable = reactive([
{month:'01月', currentPeriod: '1265', theSameTerm:'3254', yearOnYear:'30', totalYearOnYear:'32'}
])
const prop1 = ref('toDay')
const label1 = ref('当日用电/kWh')
const prop2 = ref('lastDay')
const label2 = ref('上日用电/kWh')
const hbfxCurrentPage = ref(1)
const hbfxPageSize = ref(5)
const hbfxSmall = ref(false)
const hbfxBackground = ref(false)
const hbfxDisabled = ref(false)
const hbfxHandleSizeChange = (val) => {
console.log(`${val}`)
}
const hbfxHandleCurrentChange = (val) => {
console.log(`${val}`)
}
/** 生成图表按鈕操作*/
const title = ref()
const open = ref(false)
function handleChart(){
open.value = true;
console.log('图表按钮')
};
</script>
<style scoped lang="scss">
.home{
width: 100%;
height: calc(100vh - 84px);
overflow: auto;
}
.chartBox{
width: 100%;
height: 300px;
border: 1px solid #fff;
margin-bottom: 18px;
overflow: hidden;
#chart{
width: 100%;
height: 100%;
}
}
.tableBox1{
width: 100%;
height: 402px;
overflow: hidden;
}
.tableBox2{
width: 100%;
height: 717px;
background-color: #2F3D8A;
overflow: hidden;
}
.mr0{
margin-right: 0px !important;
}
.myBtn{
padding: 7px 25px;
background-color: #1B2965;
border: 1px solid #409EFF;
color: #fff;
cursor: pointer;
}
.btn1{
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
.btn2{
margin-left: -1px;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
}
.active{
background-color: #409EFF !important;
color: #fff !important;
}
::v-deep .el-tabs__item{
color: #fff;
}
::v-deep .el-tabs__item.is-active{
color: #409EFF;
}
::v-deep .el-tabs__nav-wrap::after{
background-color: #313d70;
}
::v-deep .el-button{
border-radius: 2px;
}
::v-deep .el-pagination{
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
}
::v-deep .el-pagination__total{
color: #f3ffff;
}
::v-deep .el-pagination__jump{
color: #f3ffff;
}
::v-deep .el-pager{
margin: 0 5px;
}
::v-deep .el-table .el-table__body-wrapper{
background-color: #2F3D8A;
}
::v-deep .el-form--inline .el-form-item{
margin-right: 12px;
}
::v-deep .el-input__inner{
color: #f3ffff;
}
</style>

@ -1,16 +1,321 @@
<template>
<div class="app-container home">
<h1>能耗统计</h1>
<el-row :gutter="20">
<el-col :span="24" :xs="24">
<el-form :model="filterForm" ref="queryRef" :inline="true" label-width="68px">
<el-form-item label="能源类型" prop="week">
<el-select v-model="filterForm.type" placeholder="请选择" style="width: 240px">
<el-option label="电" value="1" />
</el-select>
</el-form-item>
<el-form-item label="耗能设备" prop="week">
<el-select v-model="filterForm.dev" placeholder="请选择" style="width: 240px">
<el-option label="电热锅炉" value="1" />
<el-option label="蓄热锅炉" value="2" />
<el-option label="风机盘管" value="3" />
<el-option label="空气源热泵" value="4" />
<el-option label="发热电缆" value="5" />
<el-option label="水泵" value="6" />
<el-option label="沙盘" value="7" />
</el-select>
</el-form-item>
<el-form-item label="时段" style="width: 308px;">
<el-date-picker v-model="dateRange" value-format="YYYY-MM-DD" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button class="my-btn btn1" type="primary" :class="{ active: activeIndex === 0 }" @click="handleHour"></el-button>
<el-button class="my-btn btn2" type="primary" :class="{ active: activeIndex === 1 }" @click="handleDay"></el-button>
<el-button class="my-btn btn3" type="primary" :class="{ active: activeIndex === 2 }" @click="handleMonth"></el-button>
</el-col>
</el-row>
<div class="dev_control_table">
<el-table :data="dataTable" height="690px">
<el-table-column label="序号" align="center" width="50" fixed/>
<el-table-column label="耗能设备" align="center" prop="dev" width="120" fixed/>
<el-table-column label="日期" align="center" prop="date" width="150" fixed/>
<el-table-column v-for="item in theadList" :key="item.prop" :prop="item.prop" :label="item.label" :fixed="item.fixed"/>
<el-table-column label="操作" fixed="right">
<template v-slot="scope">
<el-button type="primary" size="small" :icon="Histogram" @click="handleChart">图表</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[5, 10, 20, 50]"
:small="small"
:disabled="disabled"
:background="background"
layout="total, sizes, prev, pager, next, jumper"
:total="dataTable.length"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-col>
</el-row>
<!-- 生成图表弹出窗 -->
<el-dialog class="mrt" :title="title" v-model="open" width="1000px" append-to-body>
<div class="chartBox">
<div id="chart"></div>
</div>
</el-dialog>
</div>
</template>
<script setup name="Index">
import {Delete,Histogram} from '@element-plus/icons-vue'
import {ref,reactive} from "vue";
/** 筛选处理 */
const dateRange = ref([]);
const data = reactive({
filterForm: {
type: '',
dev: '',
}
});
//
function handleQuery(){
}
//
function resetQuery(){
dateRange.value = []
}
/** 数据表格处理 */
//
const theadList = ref([
{prop:'00:00', label:'00:00'},
{prop:'01:00', label:'01:00'},
{prop:'02:00', label:'02:00'},
{prop:'03:00', label:'03:00'},
{prop:'04:00', label:'04:00'},
{prop:'05:00', label:'05:00'},
{prop:'06:00', label:'06:00'},
{prop:'07:00', label:'07:00'},
{prop:'08:00', label:'08:00'},
{prop:'09:00', label:'09:00'},
{prop:'10:00', label:'10:00'},
{prop:'11:00', label:'11:00'},
{prop:'12:00', label:'12:00'},
{prop:'13:00', label:'13:00'},
{prop:'14:00', label:'14:00'},
{prop:'15:00', label:'15:00'},
{prop:'16:00', label:'16:00'},
{prop:'17:00', label:'17:00'},
{prop:'18:00', label:'18:00'},
{prop:'19:00', label:'19:00'},
{prop:'20:00', label:'20:00'},
{prop:'21:00', label:'21:00'},
{prop:'22:00', label:'22:00'},
{prop:'23:00', label:'23:00'},
])
//
const dataTable = reactive([
{
dev:'蓄热锅炉',
date: '20230-05-11',
'00:00':'10',
}
])
const currentPage = ref(1)
const pageSize = ref(5)
const small = ref(false)
const background = ref(false)
const disabled = ref(false)
const handleSizeChange = (val) => {
console.log(`${val}`)
}
const handleCurrentChange = (val) => {
console.log(`${val}`)
}
/** 日月年按钮操作 */
const activeIndex = ref(0)
function handleHour() {
activeIndex.value = 0
theadList.value = [
{prop:'00:00', label:'00:00'},
{prop:'01:00', label:'01:00'},
{prop:'02:00', label:'02:00'},
{prop:'03:00', label:'03:00'},
{prop:'04:00', label:'04:00'},
{prop:'05:00', label:'05:00'},
{prop:'06:00', label:'06:00'},
{prop:'07:00', label:'07:00'},
{prop:'08:00', label:'08:00'},
{prop:'09:00', label:'09:00'},
{prop:'10:00', label:'10:00'},
{prop:'11:00', label:'11:00'},
{prop:'12:00', label:'12:00'},
{prop:'13:00', label:'13:00'},
{prop:'14:00', label:'14:00'},
{prop:'15:00', label:'15:00'},
{prop:'16:00', label:'16:00'},
{prop:'17:00', label:'17:00'},
{prop:'18:00', label:'18:00'},
{prop:'19:00', label:'19:00'},
{prop:'20:00', label:'20:00'},
{prop:'21:00', label:'21:00'},
{prop:'22:00', label:'22:00'},
{prop:'23:00', label:'23:00'},
]
};
function handleDay() {
activeIndex.value = 1
theadList.value = [
{prop:'01', label:'01日'},
{prop:'02', label:'02日'},
{prop:'03', label:'03日'},
{prop:'04', label:'04日'},
{prop:'05', label:'05日'},
{prop:'06', label:'06日'},
{prop:'07', label:'07日'},
{prop:'08', label:'08日'},
{prop:'09', label:'09日'},
{prop:'10', label:'10日'},
{prop:'11', label:'11日'},
{prop:'12', label:'12日'},
{prop:'13', label:'13日'},
{prop:'14', label:'14日'},
{prop:'15', label:'15日'},
{prop:'16', label:'16日'},
{prop:'17', label:'17日'},
{prop:'18', label:'18日'},
{prop:'19', label:'19日'},
{prop:'20', label:'20日'},
{prop:'21', label:'21日'},
{prop:'22', label:'22日'},
{prop:'23', label:'23日'},
{prop:'24', label:'24日'},
{prop:'25', label:'25日'},
{prop:'26', label:'26日'},
{prop:'27', label:'27日'},
{prop:'28', label:'28日'},
{prop:'29', label:'29日'},
{prop:'30', label:'30日'},
{prop:'31', label:'31日'},
]
};
function handleMonth() {
activeIndex.value = 2
theadList.value = [
{prop:'01月', label:'01月'},
{prop:'02月', label:'02月'},
{prop:'03月', label:'03月'},
{prop:'04月', label:'04月'},
{prop:'05月', label:'05月'},
{prop:'06月', label:'06月'},
{prop:'07月', label:'07月'},
{prop:'08月', label:'08月'},
{prop:'09月', label:'09月'},
{prop:'10月', label:'10月'},
{prop:'11月', label:'11月'},
{prop:'12月', label:'12月'},
]
};
/** 生成图表按鈕操作*/
const title = ref()
const open = ref(false)
function handleChart(){
open.value = true;
console.log('图表按钮')
};
const { filterForm } = toRefs(data);
</script>
<style scoped lang="scss">
.dev_control_table{
position: relative;
width: 100%;
min-height: 745px;
background-color: #2F3D8A;
}
.my-btn{
padding: 0 25px;
background-color: #2F8EED40;
border: 1px solid #2F8EED;
}
.btn2,.btn3{
margin-left: -1px;
}
.btn1{
border-top-right-radius: 0px !important;
border-bottom-right-radius: 0px !important;
}
.btn2{
border-radius: 0px !important;
}
.btn3{
border-top-left-radius: 0px !important;
border-bottom-left-radius: 0px !important;
}
.active{
background-color: #409eff !important;
color: #fff !important;
}
.chartBox{
width: 100%;
height: 300px;
#chart{
width: 100%;
height: 100%;
}
}
::v-deep .el-button{
border-radius: 2px;
}
::v-deep .el-pagination{
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
}
::v-deep .el-pagination__total{
color: #f3ffff;
}
::v-deep .el-pagination__jump{
color: #f3ffff;
}
::v-deep .el-pager{
margin: 0 5px;
}
::v-deep .el-table .el-table__body-wrapper{
background-color: #2F3D8A;
}
::v-deep .el-table__body-wrapper tr td.el-table-fixed-column--left{
background-color: #2F3D8A;
}
::v-deep .el-table__body-wrapper tr td.el-table-fixed-column--right{
background-color: #2F3D8A;
}
::v-deep .el-input__inner{
color: #f3ffff;
}
::v-deep .el-date-editor .el-range-input{
color: #f3ffff;
}
</style>

@ -2,7 +2,7 @@
<div class="home">
<div class="header">
<h2>电能替代分布式控制试验平台</h2>
<router-link :to="{path:'control/manual'}" tag="div" class="back">返回后台</router-link>
<router-link :to="{path:'/control/manual'}" tag="div" class="back">返回后台</router-link>
</div>
<div class="main">
<div class="left">
@ -149,14 +149,15 @@
// import {ref,reactive} from 'vue'
import {getTemperature} from '../../api/bigview/bigview'
// getWendu();
getWendu();
// const wendi1 = ref(0)
// function getWendu(){
// getTemperature().then((res)=>{
// console.log(res.data.data)
// })
// }
const wendi1 = ref(0)
function getWendu(){
console.log('请求接口')
getTemperature().then((res)=>{
console.log(res.data)
})
}
@ -281,7 +282,7 @@ import {getTemperature} from '../../api/bigview/bigview'
.my3D_img{
width: 100%;
height: 100%;
padding: 20px 60px 0 60px;
padding: 20px 70px 0 70px;
img{
width: 100%;
height: 100%;

@ -1,6 +1,6 @@
<template>
<div class="app-container home">
<el-button type="primary" :icon="Download">策略导入</el-button>
<el-button type="primary" :icon="Download" @click="drawerIshow = true">策略导入</el-button>
<div class="dev_control_wrapper">
<div class="dev_control_item">
<div class="item_header">
@ -126,37 +126,50 @@
<div class="dev_control_table">
<div class="control_header"><span>调控日志</span></div>
<div class="control_table">
<el-table v-loading="loading" :data="controlList" @selection-change="handleSelectionChange">
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[3].visible" width="120" />
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[4].visible" width="160">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table :data="controlList">
<el-table-column label="序号" align="center" width="50"/>
<el-table-column label="设备名称" align="center" prop="devName"/>
<el-table-column label="操作内容" align="center" prop="content" width="700"/>
<el-table-column label="操作时间" align="center" prop="time"/>
<el-table-column label="操作人员" align="center" prop="person"/>
<el-table-column label="操作结果" align="center" prop="result"></el-table-column>
</el-table>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[5, 10, 20, 50]"
:small="small"
:disabled="disabled"
:background="background"
layout="total, sizes, prev, pager, next, jumper"
:total="controlList.length"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</div>
<el-drawer v-model="drawerIshow">
<template #header><h4>策略导入</h4></template>
<template #default>
<el-radio v-model="radio" label="策略1" size="large">策略1</el-radio>
<el-radio v-model="radio" label="策略2" size="large">策略2</el-radio>
</template>
<template #footer>
<div style="flex: auto">
<el-button type="primary" @click="confirmClick">执行</el-button>
</div>
</template>
</el-drawer>
</div>
</template>
<script setup name="Index">
import { Share,Download } from '@element-plus/icons-vue' //element
import { ref,reactive } from 'vue'
import { ElMessageBox } from 'element-plus'
//
const value1 = ref(true)
const value2 = ref(false)
const value3 = ref(false)
@ -175,7 +188,6 @@ const form2 = reactive({
const form3 = reactive({
now:'',
})
const onSubmit1 = () => {
console.log('确定')
}
@ -186,7 +198,57 @@ const onSubmit3 = () => {
console.log('确定')
}
//
const controlList = reactive([
{
devName:'11',
content:'22',
time:'33',
person:'44',
result:'55',
},
{
devName:'11',
content:'22',
time:'33',
person:'44',
result:'55',
},
{
devName:'11',
content:'22',
time:'33',
person:'44',
result:'55',
},
{
devName:'11',
content:'22',
time:'33',
person:'44',
result:'55',
}
])
const currentPage = ref(1)
const pageSize = ref(5)
const small = ref(false)
const background = ref(false)
const disabled = ref(false)
const handleSizeChange = (val) => {
console.log(`${val} items per page`)
}
const handleCurrentChange = (val) => {
console.log(`current page: ${val}`)
}
//
const drawerIshow = ref(false)
const radio = ref()
function confirmClick() {
ElMessageBox.confirm(`确定执行 ${radio.value} ?`).then(() => {
drawerIshow.value = false;
})
}
</script>
@ -284,9 +346,9 @@ const onSubmit3 = () => {
}
}
.control_table{
position: relative;
width: 100%;
height: 90%;
border: 1px solid red;
}
}
}
@ -306,5 +368,20 @@ const onSubmit3 = () => {
::v-deep .el-input__inner{
color: #f3ffff;
}
::v-deep .el-pagination{
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
}
::v-deep .el-pagination__total{
color: #f3ffff;
}
::v-deep .el-pagination__jump{
color: #f3ffff;
}
::v-deep .el-pager{
margin: 0 5px;
}
</style>

@ -1,16 +1,240 @@
<template>
<div class="app-container home">
<h1>定时控制</h1>
<el-row :gutter="20">
<el-col :span="24" :xs="24">
<el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px">
<el-form-item label="有效星期" prop="week">
<el-select v-model="queryParams.week" placeholder="请选择" style="width: 240px">
<el-option label="无有效星期" value="null" />
<el-option label="星期一" value="one" />
</el-select>
</el-form-item>
<el-form-item label="执行时间" prop="time">
<el-select v-model="queryParams.time" placeholder="请选择" style="width: 240px">
<el-option label="00:00-02:00" value="1" />
<el-option label="02:00-03:00" value="2" />
</el-select>
</el-form-item>
<el-form-item label="有效日期" style="width: 308px;">
<el-date-picker v-model="dateRange" value-format="YYYY-MM-DD" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
</el-col>
</el-row>
<div class="dev_control_table">
<el-table :data="timingList" height="500px">
<el-table-column label="序号" align="center" width="50"/>
<el-table-column label="指令内容" align="center" prop="content" width="700"/>
<el-table-column label="执行时间" align="center" prop="time"/>
<el-table-column label="有效日期" align="center" prop="dateRange"/>
<el-table-column label="有效星期" align="center" prop="week"/>
<el-table-column label="操作" align="center" prop="handle">
<template v-slot="scope">
<el-button type="danger" size="small" :icon="Delete">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[5, 10, 20, 50]"
:small="small"
:disabled="disabled"
:background="background"
layout="total, sizes, prev, pager, next, jumper"
:total="timingList.length"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-col>
</el-row>
<!-- 新增对话框 -->
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
<el-form :model="timingForm" ref="userRef" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="指令内容" prop="content">
<el-input v-model="timingForm.content" placeholder="请输入指令内容" maxlength="11" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="执行星期">
<el-radio-group v-model="timingForm.day">
<el-radio style='width:90px' label="每天" @change="handleEveryday"/>
</el-radio-group>
<el-collapse v-model="activeName" accordion>
<el-collapse-item title="星期几" name="1">
<el-checkbox-group v-model="timingForm.week">
<el-checkbox style='width:90px' label="1" key="1">星期一</el-checkbox>
<el-checkbox style='width:90px' label="2" key="2">星期二</el-checkbox>
<el-checkbox style='width:90px' label="3" key="3">星期三</el-checkbox>
<el-checkbox style='width:90px' label="4" key="4">星期四</el-checkbox>
<el-checkbox style='width:90px' label="5" key="5">星期五</el-checkbox>
<el-checkbox style='width:90px' label="6" key="6">星期六</el-checkbox>
<el-checkbox style='width:90px' label="7" key="7">星期日</el-checkbox>
</el-checkbox-group>
</el-collapse-item>
</el-collapse>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="执行时间" prop="executeTime">
<el-time-picker v-model="timingForm.executeTime" placeholder="请选择执行时间" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Index">
import {Delete} from '@element-plus/icons-vue'
import {ref,reactive,watch} from "vue";
/** 筛选处理 */
const dateRange = ref([]);
const data = reactive({
queryParams: {
week: '',
time: '',
}
});
//
function handleQuery(){
}
//
function resetQuery(){
dateRange.value = []
}
/** 数据表格处理 */
const timingList = reactive([
{
content:'11',
time:'22',
dateRange:'44',
week:'55',
},
{
content:'11',
time:'22',
dateRange:'44',
week:'55',
}
])
const currentPage = ref(1)
const pageSize = ref(5)
const small = ref(false)
const background = ref(false)
const disabled = ref(false)
const handleSizeChange = (val) => {
console.log(`${val}`)
}
const handleCurrentChange = (val) => {
console.log(`${val}`)
}
/** 新增定时处理 */
const open = ref(false);
const title = ref();
const activeName = ref('1')
const timingForm = reactive({
content:'',
day:'',
week:[],
executeTime:'',
})
const watchWeek = watch(()=> timingForm.week,(val) => {
console.log('监听勾选的星期',val)
if(timingForm.week.length === 7){
timingForm.day = '每天'
}else{
timingForm.day = ''
}
})
// const watchTime = watch(()=> timingForm.executeTime, (val) => {
// // console.log(val.toLocaleString())
// let date = new Date(val)
// let hours = date.getHours()
// let minutes = date.getMinutes()
// let seconds = date.getSeconds()
// console.log(`${hours}:${minutes}:${seconds}`)
// })
function handleEveryday(){
console.log('点击每天')
}
function handleAdd() {
open.value = true;
title.value = "新增定时任务";
};
function submitForm() {
open.value = false;
};
function cancel() {
open.value = false;
};
const { queryParams } = toRefs(data);
</script>
<style scoped lang="scss">
.dev_control_table{
position: relative;
width: 100%;
min-height: 745px;
background-color: #2F3D8A;
}
::v-deep .el-button{
border-radius: 2px;
}
::v-deep .el-pagination{
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
}
::v-deep .el-pagination__total{
color: #f3ffff;
}
::v-deep .el-pagination__jump{
color: #f3ffff;
}
::v-deep .el-pager{
margin: 0 5px;
}
::v-deep .el-table .el-table__body-wrapper{
background-color: #2F3D8A;
}
::v-deep .el-form-item__content{
//display: flex;
}
</style>

@ -35,17 +35,13 @@
<div class="mid1-1">
当前功率
</div>
<div>
pic
</div>
<div id="myEcharts1" style="width: 100%; height: 88.6%"></div>
</div>
<div class="mid2">
<div class="mid2-1">
当前功率总览
</div>
<div>
pic
</div>
<div id="myEcharts2" style="width: 100%; height: 88.6%"></div>
</div>
</div>
<div class="bottom">
@ -53,16 +49,186 @@
<div class="bottom1-1">
今日用电量总览
</div>
<div>
pic
</div>
<div id="myEcharts3" style="width: 100%; height: 88.6%"></div>
</div>
</div>
</div>
</template>
<script setup name="Index">
<script name="Index">
import { onMounted ,onUnmounted } from "vue";
import * as echarts from 'echarts';
export default {
name: "db",
setup() {
onMounted(() => {//element,onMountedHook
echarts.init(document.getElementById("myEcharts1")).dispose()
let myChart1 = echarts.init(document.getElementById("myEcharts1"));
let option1 = {
series: [
{
type: 'gauge',
axisLine: {
lineStyle: {
width: 10,
color: [
[0.3, '#67e0e3'],
[0.7, '#37a2da'],
[1, '#fd666d']
]
}
},
pointer: {
itemStyle: {
color: 'inherit'
}
},
// axisTick: {
// distance: -30,
// length: 8,
// lineStyle: {
// color: '#fff',
// width: 2
// }
// },
// splitLine: {
// distance: -30,
// length: 30,
// lineStyle: {
// color: '#fff',
// width: 4
// }
// },
axisLabel: {
color: 'inherit',
distance: 10,
fontSize: 10
},
detail: {
valueAnimation: true,
formatter: '{value} kW',
color: 'inherit'
},
data: [
{
value: 70
}
]
}
]
}
myChart1.setOption(option1);
window.onresize = function () {//
myChart1.resize();
};
echarts.init(document.getElementById("myEcharts2")).dispose()
let myChart2 = echarts.init(document.getElementById("myEcharts2"));
//
myChart2.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "当前功率",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart2.resize();
};
echarts.init(document.getElementById("myEcharts3")).dispose()
let myChart3 = echarts.init(document.getElementById("myEcharts3"));
myChart3.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "今日用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart3.resize();
};
});
},
components: {},
mounted() {},
};
</script>

@ -73,6 +73,10 @@ export default {
name: "drgl",
setup() {
onMounted(() => {//element,onMountedHook
echarts.init(document.getElementById("myEcharts")).dispose()
echarts.init(document.getElementById("myEcharts2")).dispose()
echarts.init(document.getElementById("myEcharts3")).dispose()
echarts.init(document.getElementById("myEcharts4")).dispose()
let myChart = echarts.init(document.getElementById("myEcharts"));
let myChart2 = echarts.init(document.getElementById("myEcharts2"));
let myChart3 = echarts.init(document.getElementById("myEcharts3"));
@ -95,6 +99,7 @@ export default {
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
@ -112,7 +117,7 @@ export default {
},
series: [
{
name: "用户量",
name: "日用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
@ -141,6 +146,7 @@ export default {
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
@ -158,7 +164,7 @@ export default {
},
series: [
{
name: "用户量",
name: "月用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
@ -187,6 +193,7 @@ export default {
},
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
@ -204,7 +211,7 @@ export default {
},
series: [
{
name: "用户量",
name: "当前功率",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
@ -219,6 +226,12 @@ export default {
myChart4.setOption({
title: {},
tooltip: {},
legend: {
data: ['进水', '出水'],
textStyle:{
color:'#BEC3DA'
}
},
textStyle:{
color:'#BEC3DA'
},
@ -233,6 +246,7 @@ export default {
},
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
@ -250,12 +264,22 @@ export default {
},
series: [
{
name: "用户量",
type: "line",
data: [5, 20, 36, 10, 10, 20],
name: '进水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '出水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: [220, 182, 191, 234, 290, 330, 310]
},
],
});

@ -38,40 +38,240 @@
<div class="bottom1-1">
日用电量
</div>
<div>
pic
</div>
<div id="myEcharts" style="width: 100%; height: 86.7%"></div>
</div>
<div class="bottom1">
<div class="bottom1-1">
月用电量
</div>
<div>
pic
</div>
<div id="myEcharts2" style="width: 100%; height: 86.7%"></div>
</div>
<div class="bottom1">
<div class="bottom1-1">
当前功率
</div>
<div>
pic
</div>
<div id="myEcharts3" style="width: 100%; height: 86.7%"></div>
</div>
<div class="bottom1">
<div class="bottom1-1">
当前温度
</div>
<div>
pic
</div>
<div id="myEcharts4" style="width: 100%; height: 86.7%"></div>
</div>
</div>
</div>
</template>
<script setup name="Index">
<script name="Index">
import { onMounted } from "vue";
import * as echarts from 'echarts';
export default {
name: "frdl",
setup() {
onMounted(() => {//element,onMountedHook
echarts.init(document.getElementById("myEcharts")).dispose()
echarts.init(document.getElementById("myEcharts2")).dispose()
echarts.init(document.getElementById("myEcharts3")).dispose()
echarts.init(document.getElementById("myEcharts4")).dispose()
let myChart = echarts.init(document.getElementById("myEcharts"));
let myChart2 = echarts.init(document.getElementById("myEcharts2"));
let myChart3 = echarts.init(document.getElementById("myEcharts3"));
let myChart4 = echarts.init(document.getElementById("myEcharts4"));
//
myChart.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "日用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
myChart2.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "月用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart2.resize();
};
myChart3.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "当前功率",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart3.resize();
};
myChart4.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: '当前温度',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: [120, 132, 101, 134, 90, 230, 210]
},
],
});
window.onresize = function () {//
myChart4.resize();
};
});
},
components: {},
mounted() {},
};
</script>

@ -42,40 +42,255 @@
<div class="bottom1-1">
日用电量
</div>
<div>
pic
</div>
<div id="myEcharts" style="width: 100%; height: 86.7%"></div>
</div>
<div class="bottom1">
<div class="bottom1-1">
月用电量
</div>
<div>
pic
</div>
<div id="myEcharts2" style="width: 100%; height: 86.7%"></div>
</div>
<div class="bottom1">
<div class="bottom1-1">
当前功率
</div>
<div>
pic
</div>
<div id="myEcharts3" style="width: 100%; height: 86.7%"></div>
</div>
<div class="bottom1">
<div class="bottom1-1">
当前温度
</div>
<div>
pic
</div>
<div id="myEcharts4" style="width: 100%; height: 86.7%"></div>
</div>
</div>
</div>
</template>
<script setup name="Index">
<script name="Index">
import { onMounted } from "vue";
import * as echarts from 'echarts';
export default {
name: "kqyrb",
setup() {
onMounted(() => {//element,onMountedHook
echarts.init(document.getElementById("myEcharts")).dispose()
echarts.init(document.getElementById("myEcharts2")).dispose()
echarts.init(document.getElementById("myEcharts3")).dispose()
echarts.init(document.getElementById("myEcharts4")).dispose()
let myChart = echarts.init(document.getElementById("myEcharts"));
let myChart2 = echarts.init(document.getElementById("myEcharts2"));
let myChart3 = echarts.init(document.getElementById("myEcharts3"));
let myChart4 = echarts.init(document.getElementById("myEcharts4"));
//
myChart.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "日用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
myChart2.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "月用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart2.resize();
};
myChart3.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "当前功率",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart3.resize();
};
myChart4.setOption({
title: {},
tooltip: {},
legend: {
data: ['进水', '出水'],
textStyle:{
color:'#BEC3DA'
}
},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: '进水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '出水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: [220, 182, 191, 234, 290, 330, 310]
},
],
});
window.onresize = function () {//
myChart4.resize();
};
});
},
components: {},
mounted() {},
};
</script>

@ -64,16 +64,80 @@
<div class="bottom1-1">
实时温度总览
</div>
<div>
pic
</div>
<div id="myEcharts" style="width: 100%; height: 91%"></div>
</div>
</div>
</div>
</template>
<script setup name="Index">
<script name="Index">
import { onMounted } from "vue";
import * as echarts from 'echarts';
export default {
name: "wdcgq",
setup() {
onMounted(() => {//element,onMountedHook
echarts.init(document.getElementById("myEcharts")).dispose()
let myChart = echarts.init(document.getElementById("myEcharts"));
//
myChart.setOption({
title: {},
tooltip: {},
legend: {
data: ['温度传感器1','温度传感器2'],
textStyle:{
color:'#BEC3DA'
}
},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "温度传感器1",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
});
},
components: {},
mounted() {},
};
</script>

@ -42,40 +42,255 @@
<div class="bottom1-1">
日用电量
</div>
<div>
pic
</div>
<div id="myEcharts" style="width: 100%; height: 86.7%"></div>
</div>
<div class="bottom1">
<div class="bottom1-1">
月用电量
</div>
<div>
pic
</div>
<div id="myEcharts2" style="width: 100%; height: 86.7%"></div>
</div>
<div class="bottom1">
<div class="bottom1-1">
当前功率
</div>
<div>
pic
</div>
<div id="myEcharts3" style="width: 100%; height: 86.7%"></div>
</div>
<div class="bottom1">
<div class="bottom1-1">
当前温度
</div>
<div>
pic
</div>
<div id="myEcharts4" style="width: 100%; height: 86.7%"></div>
</div>
</div>
</div>
</template>
<script setup name="Index">
<script name="Index">
import { onMounted } from "vue";
import * as echarts from 'echarts';
export default {
name: "xrgl",
setup() {
onMounted(() => {//element,onMountedHook
echarts.init(document.getElementById("myEcharts")).dispose()
echarts.init(document.getElementById("myEcharts2")).dispose()
echarts.init(document.getElementById("myEcharts3")).dispose()
echarts.init(document.getElementById("myEcharts4")).dispose()
let myChart = echarts.init(document.getElementById("myEcharts"));
let myChart2 = echarts.init(document.getElementById("myEcharts2"));
let myChart3 = echarts.init(document.getElementById("myEcharts3"));
let myChart4 = echarts.init(document.getElementById("myEcharts4"));
//
myChart.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "日用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart.resize();
};
myChart2.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kWh",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "月用电量",
type: "bar",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart2.resize();
};
myChart3.setOption({
title: {},
tooltip: {},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "kW",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: "当前功率",
type: "line",
data: [5, 20, 36, 10, 10, 20],
itemStyle:{
color:'#2F8EE0'
},
},
],
});
window.onresize = function () {//
myChart3.resize();
};
myChart4.setOption({
title: {},
tooltip: {},
legend: {
data: ['进水', '出水'],
textStyle:{
color:'#BEC3DA'
}
},
textStyle:{
color:'#BEC3DA'
},
xAxis: {
data: ["12-3", "12-4", "12-5", "12-6", "12-7", "12-8"],
axisLine:{
lineStyle:{
color:'#BEC3DA',
type:'dashed'
}
}
},
yAxis: {
type: 'value',
name: "℃",
splitLine:{
show:true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
axisLine: {
show: true,
lineStyle:{
type:'dashed',
color:'#BEC3DA'
}
},
},
series: [
{
name: '进水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '出水',
type: 'line',
stack: 'Total',
itemStyle:{
color:'#2F8EE0'
},
data: [220, 182, 191, 234, 290, 330, 310]
},
],
});
window.onresize = function () {//
myChart4.resize();
};
});
},
components: {},
mounted() {},
};
</script>

@ -0,0 +1,174 @@
package com.psdc.controller.manager;
import com.alibaba.fastjson2.JSONObject;
import com.psdc.annotation.Log;
import com.psdc.core.controller.BaseController;
import com.psdc.core.domain.AjaxResult;
import com.psdc.core.domain.entity.SysUser;
import com.psdc.core.page.TableDataInfo;
import com.psdc.entity.PsdcDevice;
import com.psdc.enums.BusinessType;
import com.psdc.service.IPsdcDeviceService;
import com.psdc.service.ISysUserService;
import com.psdc.utils.SecurityUtils;
import com.psdc.utils.poi.ExcelUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.*;
/**
* @Author戴仕崑
* @Projectpsdc
* @FilenamePsdcDeviceController
* @Date2023/5/11 15:13
* @Version 1.0
*/
@RestController
@RequestMapping("/manager/device")
public class PsdcDeviceController extends BaseController {
@Autowired
IPsdcDeviceService psdcDeviceService;
@Autowired
ISysUserService sysUserService;
@PreAuthorize("@ss.hasPermi('manager:device:list')")
@Log(title = "设备管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody PsdcDevice pd) {
long userId = SecurityUtils.getUserId();
pd.setCreateBy(sysUserService.selectUserById(userId).getUserName());
pd.setCreateTime(new Date());
return toAjax(psdcDeviceService.insert(pd));
}
@PreAuthorize("@ss.hasPermi('manager:device:list')")
@Log(title = "设备管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody PsdcDevice pd) {
long userId = SecurityUtils.getUserId();
pd.setUpdateBy(sysUserService.selectUserById(userId).getUserName());
pd.setUpdateTime(new Date());
return toAjax(psdcDeviceService.update(pd));
}
@PreAuthorize("@ss.hasPermi('manager:device:list')")
@Log(title = "设备管理", businessType = BusinessType.DELETE)
@DeleteMapping
public AjaxResult remove(@Validated @RequestBody Long[] deviceIds) {
return toAjax(psdcDeviceService.deleteById(deviceIds));
}
@PreAuthorize("@ss.hasPermi('manager:device:list')")
@RequestMapping(value = "/selusers", method = RequestMethod.GET)
public AjaxResult selAllUsers() {
List<Map> maps = new ArrayList<>();
List<SysUser> list = sysUserService.selectUserList(null);
for (SysUser dd : list){
Map<String, Object> map = new HashMap<>();
map.put("label", dd.getUserName());
map.put("value", dd.getUserId());
maps.add(map);
}
return AjaxResult.success("用户下拉列表", maps);
}
@PreAuthorize("@ss.hasPermi('manager:device:list')")
@RequestMapping(value = "/devicesList", method = RequestMethod.POST)
public TableDataInfo controlLogList(@RequestBody JSONObject jsonObject) {
// PageMethod.startPage(jsonObject.getInteger("pageNum"),jsonObject.getInteger("pageSize"));
// PsdcDevice deviceVo = JSON.parseObject(String.valueOf(jsonObject), PsdcDevice.class);
PsdcDevice deviceVo = myPage(jsonObject, PsdcDevice.class);
List<PsdcDevice> list = psdcDeviceService.queryAllByLimit(deviceVo);
return getDataTable(list);
}
/**
excel文件的下载
*/
@PreAuthorize("@ss.hasPermi('manager:device:list')")
@Log(title = "设备管理", businessType = BusinessType.EXPORT)
@RequestMapping(value = "/daochuDevs", method = RequestMethod.POST)
public void daochuDevDta(HttpServletResponse response, @RequestBody PsdcDevice pd) {
List<PsdcDevice> list = psdcDeviceService.queryAllByLimit(pd);
for (PsdcDevice dev : list){
dev.setUserName(sysUserService.selectUserById(Long.valueOf(dev.getUserId())).getUserName());
}
ExcelUtil<PsdcDevice> util = new ExcelUtil<>(PsdcDevice.class);
util.exportExcel(response, list, "角色数据");
}
/**
* 下载设备信息模板
* @param response
*/
@PreAuthorize("@ss.hasPermi('manager:device:list')")
@Log(title = "设备管理", businessType = BusinessType.EXPORT)
@RequestMapping(value = "/downloadDevTemplate", method = RequestMethod.GET)
public void downloadTemplate(HttpServletResponse response) {
// 获取要下载的模板名称
String fileName = "devTemplate.xlsx";
// 设置要下载的文件的名称
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
// 通知客服文件的MIME类型
response.setContentType("application/vnd.ms-template;charset=UTF-8");
// 获取文件的路径
try (InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/AllDevicesData.xlsx")) {
//读取excel模板
XSSFWorkbook wb = new XSSFWorkbook(inputStream);
wb.setSelectedTab(1);
XSSFSheet sheet = wb.createSheet("设备类型表");
XSSFRow row0 = sheet.createRow(0);
XSSFRow row1 = sheet.createRow(1);
XSSFRow row2 = sheet.createRow(2);
row0.createCell(0).setCellValue("设备类型Id");
row0.createCell(1).setCellValue("设备类型名称");
row1.createCell(0).setCellValue("1");
row1.createCell(1).setCellValue("监测设备");
row2.createCell(0).setCellValue("2");
row2.createCell(1).setCellValue("运行设备");
OutputStream os = new BufferedOutputStream(response.getOutputStream());
wb.write(os);
os.flush();
os.close();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("下载设备模板出错");
}
}
/**
excel文件的读取
*/
@RequestMapping("/daoruDevData")
@PreAuthorize("@ss.hasPermi('manager:device:list')")
@Log(title = "设备管理", businessType = BusinessType.IMPORT)
@Transactional(rollbackFor = Exception.class)
public AjaxResult daoruDevData(@RequestPart("file") MultipartFile file) {
long userId = SecurityUtils.getUserId();
String cjr = sysUserService.selectUserById(userId).getUserName();
return toAjax(psdcDeviceService.daoruDevicesData(file, cjr));
}
}
Loading…
Cancel
Save