Changes提交修改
This commit is contained in:
@@ -101,11 +101,13 @@ public class SysLoginController
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
Set<String> fpermissions = permissionService.getMenuPermissionF(user);
|
||||
AppPreferences appPreferences = appPreferencesService.selectAppPreferencesByUserId(user.getUserId());
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
ajax.put("fpermissions", fpermissions);
|
||||
ajax.put("mqtt",enabled);
|
||||
ajax.put("language", appPreferences.getLanguage());
|
||||
return ajax;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class SysNoticeController extends BaseController
|
||||
{
|
||||
notice.setDeptId(getDeptId());
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
List<SysNotice> list = noticeService.selectNoticeIndexList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,4 +76,36 @@ public class SysPermissionService
|
||||
}
|
||||
return perms;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单数据权限
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 菜单权限信息
|
||||
*/
|
||||
public Set<String> getMenuPermissionF(SysUser user)
|
||||
{
|
||||
Set<String> perms = new HashSet<String>();
|
||||
// 管理员拥有所有权限
|
||||
if (user.isAdmin()) {
|
||||
perms.add("*:*:*");
|
||||
} else {
|
||||
List<SysRole> roles = user.getRoles();
|
||||
if (!roles.isEmpty() && roles.size() > 1)
|
||||
{
|
||||
// 多角色设置permissions属性,以便数据权限匹配权限
|
||||
for (SysRole role : roles)
|
||||
{
|
||||
Set<String> rolePerms = menuService.selectMenuPermsByRoleIdF(role.getRoleId());
|
||||
role.setPermissions(rolePerms);
|
||||
perms.addAll(rolePerms);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
perms.addAll(menuService.selectMenuPermsByUserIdF(user.getUserId()));
|
||||
}
|
||||
}
|
||||
return perms;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.xinda.itsm.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xinda.common.core.domain.entity.SysUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.xinda.common.annotation.Log;
|
||||
import com.xinda.common.core.controller.BaseController;
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.enums.BusinessType;
|
||||
import com.xinda.itsm.domain.DutyRecord;
|
||||
import com.xinda.itsm.service.IDutyRecordService;
|
||||
import com.xinda.common.utils.poi.ExcelUtil;
|
||||
import com.xinda.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 交班记录Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2025-07-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/itsm/dutyRecord")
|
||||
@Api(tags = "交班记录")
|
||||
public class DutyRecordController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDutyRecordService dutyRecordService;
|
||||
|
||||
/**
|
||||
* 查询交班记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('itsm:dutyRecord:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询交班记录列表")
|
||||
public TableDataInfo list(DutyRecord dutyRecord)
|
||||
{
|
||||
SysUser user = getLoginUser().getUser();
|
||||
dutyRecord.setTenantId(user.getDeptId());
|
||||
startPage();
|
||||
List<DutyRecord> list = dutyRecordService.selectDutyRecordList(dutyRecord);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出交班记录列表
|
||||
*/
|
||||
@ApiOperation("导出交班记录列表")
|
||||
@PreAuthorize("@ss.hasPermi('itsm:dutyRecord:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DutyRecord dutyRecord)
|
||||
{
|
||||
List<DutyRecord> list = dutyRecordService.selectDutyRecordList(dutyRecord);
|
||||
ExcelUtil<DutyRecord> util = new ExcelUtil<DutyRecord>(DutyRecord.class);
|
||||
util.exportExcel(response, list, "交班记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取交班记录详细信息
|
||||
*/
|
||||
@GetMapping(value = "/lastInfo")
|
||||
@ApiOperation("获取交班记录详细信息")
|
||||
public AjaxResult lastInfo()
|
||||
{
|
||||
DutyRecord dutyRecord = new DutyRecord();
|
||||
SysUser user = getLoginUser().getUser();
|
||||
// dutyRecord.setTenantId(user.getDeptId());
|
||||
dutyRecord.setReId(user.getUserId());
|
||||
return success(dutyRecordService.selectLastDutyRecord(dutyRecord));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{dutyId}")
|
||||
@ApiOperation("获取交班记录详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("dutyId") Long dutyId)
|
||||
{
|
||||
return success(dutyRecordService.selectDutyRecordByDutyId(dutyId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交班记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('itsm:dutyRecord:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("新增交班记录")
|
||||
public AjaxResult add(@RequestBody DutyRecord dutyRecord)
|
||||
{
|
||||
SysUser user = getLoginUser().getUser();
|
||||
dutyRecord.setTenantId(user.getDeptId());
|
||||
return toAjax(dutyRecordService.insertDutyRecord(dutyRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交班记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('itsm:dutyRecord:edit')")
|
||||
@PutMapping
|
||||
@ApiOperation("修改交班记录")
|
||||
public AjaxResult edit(@RequestBody DutyRecord dutyRecord)
|
||||
{
|
||||
return toAjax(dutyRecordService.updateDutyRecord(dutyRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交班记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('itsm:dutyRecord:remove')")
|
||||
@DeleteMapping("/{dutyIds}")
|
||||
@ApiOperation("删除交班记录")
|
||||
public AjaxResult remove(@PathVariable Long[] dutyIds)
|
||||
{
|
||||
return toAjax(dutyRecordService.deleteDutyRecordByDutyIds(dutyIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.xinda.itsm.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xinda.common.annotation.Excel;
|
||||
import com.xinda.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 交班记录对象 duty_record
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2025-07-21
|
||||
*/
|
||||
@ApiModel(value = "DutyRecord",description = "交班记录 duty_record")
|
||||
@Data
|
||||
public class DutyRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 值班id */
|
||||
private Long dutyId;
|
||||
|
||||
/** 值班日期 */
|
||||
@Excel(name = "值班日期")
|
||||
@ApiModelProperty("值班日期")
|
||||
private String dutyDate;
|
||||
|
||||
/** 值班人员id */
|
||||
@Excel(name = "值班人员id")
|
||||
@ApiModelProperty("值班人员id")
|
||||
private Long onId;
|
||||
|
||||
/** 值班人员 */
|
||||
@Excel(name = "值班人员")
|
||||
@ApiModelProperty("值班人员")
|
||||
private String onDuty;
|
||||
|
||||
/** 值班时间段 */
|
||||
@Excel(name = "值班时间段")
|
||||
@ApiModelProperty("值班时间段")
|
||||
private String dutyPeriod;
|
||||
|
||||
|
||||
/** 替班id */
|
||||
@Excel(name = "替班id")
|
||||
@ApiModelProperty("替班id")
|
||||
private Long reId;
|
||||
/** 替班人员 */
|
||||
@Excel(name = "替班人员")
|
||||
@ApiModelProperty("替班人员")
|
||||
private String relief;
|
||||
|
||||
@Excel(name = "本班情况")
|
||||
@ApiModelProperty("本班情况")
|
||||
private String situation;
|
||||
|
||||
|
||||
|
||||
/** 值班类型 */
|
||||
@Excel(name = "值班类型")
|
||||
@ApiModelProperty("值班类型")
|
||||
private String type;
|
||||
|
||||
/** 值班状态 */
|
||||
@Excel(name = "值班状态")
|
||||
@ApiModelProperty("值班状态")
|
||||
private String status;
|
||||
|
||||
/** 机构id */
|
||||
@Excel(name = "机构id")
|
||||
@ApiModelProperty("机构id")
|
||||
private Long tenantId;
|
||||
|
||||
}
|
||||
@@ -69,4 +69,12 @@ private static final long serialVersionUID = 1L;
|
||||
/** 租户id */
|
||||
@Excel(name = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
@Excel(name = "批阅状态", readConverterExp = "0=待批阅,1=已通过,2=未通过")
|
||||
@ApiModelProperty("批阅状态")
|
||||
private String reviewStatus;
|
||||
|
||||
@Excel(name = "批阅回复")
|
||||
@ApiModelProperty("批阅回复")
|
||||
private String reviewReply;
|
||||
}
|
||||
|
||||
@@ -84,4 +84,7 @@ private static final long serialVersionUID = 1L;
|
||||
/** 租户id */
|
||||
@Excel(name = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
@ApiModelProperty("图片")
|
||||
private String imgUrl;
|
||||
}
|
||||
|
||||
@@ -46,13 +46,13 @@ private static final long serialVersionUID = 1L;
|
||||
private String projectName;
|
||||
|
||||
/** 计划巡检时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
@Excel(name = "计划巡检时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("计划巡检时间")
|
||||
private Date planTime;
|
||||
|
||||
/** 实际巡检时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
@Excel(name = "实际巡检时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("实际巡检时间")
|
||||
private Date inspectionTime;
|
||||
@@ -90,4 +90,6 @@ private static final long serialVersionUID = 1L;
|
||||
/** 租户id */
|
||||
@Excel(name = "租户id")
|
||||
private Long tenantId;
|
||||
@ApiModelProperty("图片")
|
||||
private String imgUrl;
|
||||
}
|
||||
|
||||
@@ -60,4 +60,8 @@ private static final long serialVersionUID = 1L;
|
||||
/** 租户id */
|
||||
@Excel(name = "租户id")
|
||||
private Long tenantId;
|
||||
/** 预案关键词 */
|
||||
@Excel(name = "docOssId")
|
||||
@ApiModelProperty("docOssId")
|
||||
private String docOssId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.xinda.itsm.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.itsm.domain.DutyRecord;
|
||||
|
||||
/**
|
||||
* 交班记录Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2025-07-21
|
||||
*/
|
||||
public interface DutyRecordMapper
|
||||
{
|
||||
/**
|
||||
* 查询交班记录
|
||||
*
|
||||
* @param dutyId 交班记录主键
|
||||
* @return 交班记录
|
||||
*/
|
||||
public DutyRecord selectDutyRecordByDutyId(Long dutyId);
|
||||
|
||||
/**
|
||||
* 查询交班记录列表
|
||||
*
|
||||
* @param dutyRecord 交班记录
|
||||
* @return 交班记录集合
|
||||
*/
|
||||
public List<DutyRecord> selectDutyRecordList(DutyRecord dutyRecord);
|
||||
|
||||
/**
|
||||
* 新增交班记录
|
||||
*
|
||||
* @param dutyRecord 交班记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDutyRecord(DutyRecord dutyRecord);
|
||||
|
||||
/**
|
||||
* 修改交班记录
|
||||
*
|
||||
* @param dutyRecord 交班记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDutyRecord(DutyRecord dutyRecord);
|
||||
|
||||
/**
|
||||
* 删除交班记录
|
||||
*
|
||||
* @param dutyId 交班记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDutyRecordByDutyId(Long dutyId);
|
||||
|
||||
/**
|
||||
* 批量删除交班记录
|
||||
*
|
||||
* @param dutyIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDutyRecordByDutyIds(Long[] dutyIds);
|
||||
|
||||
DutyRecord selectLastDutyRecord(DutyRecord dutyRecord);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.xinda.itsm.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.itsm.domain.DutyRecord;
|
||||
|
||||
/**
|
||||
* 交班记录Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2025-07-21
|
||||
*/
|
||||
public interface IDutyRecordService
|
||||
{
|
||||
/**
|
||||
* 查询交班记录
|
||||
*
|
||||
* @param dutyId 交班记录主键
|
||||
* @return 交班记录
|
||||
*/
|
||||
public DutyRecord selectDutyRecordByDutyId(Long dutyId);
|
||||
|
||||
public DutyRecord selectLastDutyRecord(DutyRecord dutyRecord);
|
||||
|
||||
/**
|
||||
* 查询交班记录列表
|
||||
*
|
||||
* @param dutyRecord 交班记录
|
||||
* @return 交班记录集合
|
||||
*/
|
||||
public List<DutyRecord> selectDutyRecordList(DutyRecord dutyRecord);
|
||||
|
||||
/**
|
||||
* 新增交班记录
|
||||
*
|
||||
* @param dutyRecord 交班记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDutyRecord(DutyRecord dutyRecord);
|
||||
|
||||
/**
|
||||
* 修改交班记录
|
||||
*
|
||||
* @param dutyRecord 交班记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDutyRecord(DutyRecord dutyRecord);
|
||||
|
||||
/**
|
||||
* 批量删除交班记录
|
||||
*
|
||||
* @param dutyIds 需要删除的交班记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDutyRecordByDutyIds(Long[] dutyIds);
|
||||
|
||||
/**
|
||||
* 删除交班记录信息
|
||||
*
|
||||
* @param dutyId 交班记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDutyRecordByDutyId(Long dutyId);
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.xinda.itsm.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.xinda.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xinda.itsm.mapper.DutyRecordMapper;
|
||||
import com.xinda.itsm.domain.DutyRecord;
|
||||
import com.xinda.itsm.service.IDutyRecordService;
|
||||
|
||||
/**
|
||||
* 交班记录Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2025-07-21
|
||||
*/
|
||||
@Service
|
||||
public class DutyRecordServiceImpl implements IDutyRecordService
|
||||
{
|
||||
@Autowired
|
||||
private DutyRecordMapper dutyRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询交班记录
|
||||
*
|
||||
* @param dutyId 交班记录主键
|
||||
* @return 交班记录
|
||||
*/
|
||||
@Override
|
||||
public DutyRecord selectDutyRecordByDutyId(Long dutyId)
|
||||
{
|
||||
return dutyRecordMapper.selectDutyRecordByDutyId(dutyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DutyRecord selectLastDutyRecord(DutyRecord dutyRecord) {
|
||||
return dutyRecordMapper.selectLastDutyRecord(dutyRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交班记录列表
|
||||
*
|
||||
* @param dutyRecord 交班记录
|
||||
* @return 交班记录
|
||||
*/
|
||||
@Override
|
||||
public List<DutyRecord> selectDutyRecordList(DutyRecord dutyRecord)
|
||||
{
|
||||
return dutyRecordMapper.selectDutyRecordList(dutyRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交班记录
|
||||
*
|
||||
* @param dutyRecord 交班记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDutyRecord(DutyRecord dutyRecord)
|
||||
{
|
||||
dutyRecord.setCreateTime(DateUtils.getNowDate());
|
||||
return dutyRecordMapper.insertDutyRecord(dutyRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交班记录
|
||||
*
|
||||
* @param dutyRecord 交班记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDutyRecord(DutyRecord dutyRecord)
|
||||
{
|
||||
dutyRecord.setUpdateTime(DateUtils.getNowDate());
|
||||
return dutyRecordMapper.updateDutyRecord(dutyRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除交班记录
|
||||
*
|
||||
* @param dutyIds 需要删除的交班记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDutyRecordByDutyIds(Long[] dutyIds)
|
||||
{
|
||||
return dutyRecordMapper.deleteDutyRecordByDutyIds(dutyIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交班记录信息
|
||||
*
|
||||
* @param dutyId 交班记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDutyRecordByDutyId(Long dutyId)
|
||||
{
|
||||
return dutyRecordMapper.deleteDutyRecordByDutyId(dutyId);
|
||||
}
|
||||
}
|
||||
136
xinda-itsm/src/main/resources/mapper/itsm/DutyRecordMapper.xml
Normal file
136
xinda-itsm/src/main/resources/mapper/itsm/DutyRecordMapper.xml
Normal file
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xinda.itsm.mapper.DutyRecordMapper">
|
||||
|
||||
<resultMap type="DutyRecord" id="DutyRecordResult">
|
||||
<result property="dutyId" column="duty_id" />
|
||||
<result property="dutyDate" column="duty_date" />
|
||||
<result property="onId" column="on_id" />
|
||||
<result property="onDuty" column="on_duty" />
|
||||
<result property="dutyPeriod" column="duty_period" />
|
||||
<result property="relief" column="relief" />
|
||||
<result property="reId" column="re_id" />
|
||||
<result property="type" column="type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="situation" column="situation" />
|
||||
<result property="remark" column="remark" />
|
||||
<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="tenantId" column="tenant_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDutyRecordVo">
|
||||
select duty_id, duty_date, on_id, on_duty, duty_period, relief, re_id, type, status, situation,remark, create_by, create_time, update_by, update_time, tenant_id from duty_record
|
||||
</sql>
|
||||
|
||||
<select id="selectDutyRecordList" parameterType="DutyRecord" resultMap="DutyRecordResult">
|
||||
<include refid="selectDutyRecordVo"/>
|
||||
<where>
|
||||
<if test="dutyDate != null and dutyDate != ''"> and duty_date = #{dutyDate}</if>
|
||||
<if test="onId != null "> and on_id = #{onId}</if>
|
||||
<if test="onDuty != null and onDuty != ''"> and on_duty = #{onDuty}</if>
|
||||
<if test="dutyPeriod != null and dutyPeriod != ''"> and duty_period = #{dutyPeriod}</if>
|
||||
<if test="relief != null and relief != ''"> and relief = #{relief}</if>
|
||||
<if test="reId != null "> and re_id = #{reId}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="tenantId != null ">
|
||||
and ( tenant_id in (SELECT dept_id FROM sys_dept
|
||||
WHERE FIND_IN_SET(#{tenantId}, ancestors) OR dept_id = #{tenantId})
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDutyRecordByDutyId" parameterType="Long" resultMap="DutyRecordResult">
|
||||
<include refid="selectDutyRecordVo"/>
|
||||
where duty_id = #{dutyId}
|
||||
</select>
|
||||
|
||||
<select id="selectLastDutyRecord" parameterType="DutyRecord" resultMap="DutyRecordResult">
|
||||
<include refid="selectDutyRecordVo"/>
|
||||
<where>
|
||||
<if test="reId != null "> and re_id = #{reId}</if>
|
||||
</where>
|
||||
<!-- 按创建时间降序排序,取最新的一条记录 -->
|
||||
order by create_time desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<insert id="insertDutyRecord" parameterType="DutyRecord" useGeneratedKeys="true" keyProperty="dutyId">
|
||||
insert into duty_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dutyDate != null">duty_date,</if>
|
||||
<if test="onId != null">on_id,</if>
|
||||
<if test="onDuty != null">on_duty,</if>
|
||||
<if test="dutyPeriod != null">duty_period,</if>
|
||||
<if test="relief != null">relief,</if>
|
||||
<if test="reId != null">re_id,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="situation != null">situation,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dutyDate != null">#{dutyDate},</if>
|
||||
<if test="onId != null">#{onId},</if>
|
||||
<if test="onDuty != null">#{onDuty},</if>
|
||||
<if test="dutyPeriod != null">#{dutyPeriod},</if>
|
||||
<if test="relief != null">#{relief},</if>
|
||||
<if test="reId != null">#{reId},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="situation != null">#{situation},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDutyRecord" parameterType="DutyRecord">
|
||||
update duty_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dutyDate != null">duty_date = #{dutyDate},</if>
|
||||
<if test="onId != null">on_id = #{onId},</if>
|
||||
<if test="onDuty != null">on_duty = #{onDuty},</if>
|
||||
<if test="dutyPeriod != null">duty_period = #{dutyPeriod},</if>
|
||||
<if test="relief != null">relief = #{relief},</if>
|
||||
<if test="reId != null">re_id = #{reId},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="situation != null">remark = #{situation},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
</trim>
|
||||
where duty_id = #{dutyId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDutyRecordByDutyId" parameterType="Long">
|
||||
delete from duty_record where duty_id = #{dutyId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDutyRecordByDutyIds" parameterType="String">
|
||||
delete from duty_record where duty_id in
|
||||
<foreach item="dutyId" collection="array" open="(" separator="," close=")">
|
||||
#{dutyId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -19,10 +19,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="startDate" column="start_date" />
|
||||
<result property="endDate" column="end_date" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="reviewStatus" column="review_status" />
|
||||
<result property="reviewReply" column="review_reply" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectExampleReportVo">
|
||||
select example_report_id, type, cycle, content, push_method, user_id, receiver, create_by, create_time, update_by, update_time, start_date, end_date from example_report
|
||||
select example_report_id, type, cycle, content, push_method, user_id, receiver, create_by, create_time, update_by, update_time, start_date, end_date,review_status,review_reply from example_report
|
||||
</sql>
|
||||
|
||||
<select id="selectExampleReportList" parameterType="ExampleReport" resultMap="ExampleReportResult">
|
||||
@@ -41,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHERE FIND_IN_SET(#{tenantId}, ancestors) OR dept_id = #{tenantId})
|
||||
)
|
||||
</if>
|
||||
<if test="reviewStatus != null and reviewStatus != ''"> and review_status = #{reviewStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -66,6 +69,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="startDate != null">start_date,</if>
|
||||
<if test="endDate != null">end_date,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="reviewStatus != null">review_status,</if>
|
||||
<if test="reviewReply != null">review_reply,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="exampleReportId != null">#{exampleReportId},</if>
|
||||
@@ -82,6 +87,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="startDate != null">#{startDate},</if>
|
||||
<if test="endDate != null">#{endDate},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||
<if test="reviewReply != null">#{reviewReply},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -100,7 +107,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="startDate != null">start_date = #{startDate},</if>
|
||||
<if test="endDate != null">end_date = #{endDate},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
||||
<if test="reviewReply != null">review_reply = #{reviewReply},</if>
|
||||
</trim>
|
||||
where example_report_id = #{exampleReportId}
|
||||
</update>
|
||||
|
||||
@@ -23,10 +23,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="imgUrl" column="img_url" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInspectionPlanVo">
|
||||
select id, plan_name, plan_content, project_name, start_date, end_date, inspection_cycle, inspection_person,inspection, user_id, set_date, set_time, status, create_by, create_time, update_by, update_time,tenant_id from inspection_plan
|
||||
select id, plan_name, plan_content, project_name, start_date, end_date, inspection_cycle, inspection_person,inspection, user_id, set_date, set_time, status, create_by, create_time, update_by, update_time,tenant_id,img_url from inspection_plan
|
||||
</sql>
|
||||
|
||||
<select id="selectInspectionPlanList" parameterType="InspectionPlan" resultMap="InspectionPlanResult">
|
||||
@@ -78,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="imgUrl != null">img_url,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -98,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="imgUrl != null">#{imgUrl},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -121,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
||||
|
||||
</trim>
|
||||
where id = #{id}
|
||||
|
||||
@@ -23,10 +23,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="imgUrl" column="img_url" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInspectionRecordVo">
|
||||
select id, plan_id, plan_name, plan_content, project_name, plan_time, inspection_time, inspection_person, user_id, inspection_cycle, cycle, inspection_status, inspection_remark, create_by, create_time, update_by, update_time,tenant_id from inspection_record
|
||||
select id, plan_id, plan_name, plan_content, project_name, plan_time, inspection_time, inspection_person, user_id, inspection_cycle, cycle, inspection_status, inspection_remark, create_by, create_time, update_by, update_time,tenant_id,img_url from inspection_record
|
||||
</sql>
|
||||
|
||||
<select id="selectInspectionRecordList" parameterType="InspectionRecord" resultMap="InspectionRecordResult">
|
||||
@@ -78,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="imgUrl != null">img_url,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -98,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="imgUrl != null">#{imgUrl},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -121,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -18,10 +18,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="docOssId" column="doc_oss_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrePlanVo">
|
||||
select pre_plan_id, number, type, station, device, content, prepared_by, keywords, create_by, create_time, update_by, update_time,tenant_id from pre_plan
|
||||
select pre_plan_id, number, type, station, device, content, prepared_by, keywords, create_by, create_time, update_by, update_time,tenant_id,doc_oss_id from pre_plan
|
||||
</sql>
|
||||
|
||||
<select id="selectPrePlanList" parameterType="PrePlan" resultMap="PrePlanResult">
|
||||
@@ -63,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="docOssId != null">doc_oss_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="prePlanId != null">#{prePlanId},</if>
|
||||
@@ -78,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="docOssId != null">#{docOssId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -96,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="docOssId != null">doc_oss_id = #{docOssId},</if>
|
||||
</trim>
|
||||
where pre_plan_id = #{prePlanId}
|
||||
</update>
|
||||
|
||||
@@ -41,7 +41,7 @@ public class DeviceDocController extends BaseController
|
||||
/**
|
||||
* 查询设备档案管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:deviecDoc:list')")
|
||||
//@PreAuthorize("@ss.hasPermi('iot:deviecDoc:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询设备档案管理列表")
|
||||
public TableDataInfo list(DeviceDoc deviceDoc)
|
||||
@@ -55,7 +55,7 @@ public class DeviceDocController extends BaseController
|
||||
* 导出设备档案管理列表
|
||||
*/
|
||||
@ApiOperation("导出设备档案管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('iot:deviecDoc:export')")
|
||||
// @PreAuthorize("@ss.hasPermi('iot:deviecDoc:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DeviceDoc deviceDoc)
|
||||
{
|
||||
@@ -67,7 +67,7 @@ public class DeviceDocController extends BaseController
|
||||
/**
|
||||
* 获取设备档案管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:deviecDoc:query')")
|
||||
// @PreAuthorize("@ss.hasPermi('iot:deviecDoc:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取设备档案管理详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
@@ -78,7 +78,7 @@ public class DeviceDocController extends BaseController
|
||||
/**
|
||||
* 新增设备档案管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:deviecDoc:add')")
|
||||
// @PreAuthorize("@ss.hasPermi('iot:deviecDoc:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("新增设备档案管理")
|
||||
public AjaxResult add(@RequestBody DeviceDoc deviceDoc)
|
||||
@@ -89,7 +89,7 @@ public class DeviceDocController extends BaseController
|
||||
/**
|
||||
* 修改设备档案管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:deviecDoc:edit')")
|
||||
// @PreAuthorize("@ss.hasPermi('iot:deviecDoc:edit')")
|
||||
@PutMapping
|
||||
@ApiOperation("修改设备档案管理")
|
||||
public AjaxResult edit(@RequestBody DeviceDoc deviceDoc)
|
||||
@@ -100,7 +100,7 @@ public class DeviceDocController extends BaseController
|
||||
/**
|
||||
* 删除设备档案管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:deviecDoc:remove')")
|
||||
// @PreAuthorize("@ss.hasPermi('iot:deviecDoc:remove')")
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除设备档案管理")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
|
||||
@@ -53,6 +53,15 @@ public class DocController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/alllist")
|
||||
@ApiOperation("查询档案管理列表")
|
||||
public TableDataInfo alllist(Doc doc)
|
||||
{
|
||||
startPage();
|
||||
List<Doc> list = docService.selectDocAllList(doc);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出档案管理列表
|
||||
*/
|
||||
|
||||
@@ -1,26 +1,33 @@
|
||||
package com.xinda.data.controller.datacenter;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xinda.common.annotation.Anonymous;
|
||||
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
import com.xinda.iot.domain.DeviceLog;
|
||||
|
||||
import com.xinda.common.utils.poi.ExcelUtil;
|
||||
import com.xinda.iot.model.AlertCountVO;
|
||||
import com.xinda.iot.model.DeviceHistoryParam;
|
||||
import com.xinda.iot.model.HistoryModel;
|
||||
|
||||
import com.xinda.iot.model.ThingsModelLogCountVO;
|
||||
import com.xinda.iot.model.param.DataCenterParam;
|
||||
import com.xinda.iot.model.scenemodel.SceneHistoryParam;
|
||||
import com.xinda.iot.service.DataCenterService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.xinda.common.utils.SecurityUtils.getLoginUser;
|
||||
|
||||
@@ -32,6 +39,7 @@ import static com.xinda.common.utils.SecurityUtils.getLoginUser;
|
||||
*/
|
||||
@Api(tags = "数据中心管理")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/data/center")
|
||||
public class DataCenterController {
|
||||
|
||||
@@ -55,6 +63,24 @@ public class DataCenterController {
|
||||
return AjaxResult.success(jsonObject);
|
||||
}
|
||||
|
||||
@ApiOperation("导出设备的历史数据为Excel")
|
||||
@PostMapping("/deviceHistoryExport")
|
||||
public void deviceHistoryExport(@RequestBody DeviceHistoryParam deviceHistoryParam, HttpServletResponse response) {
|
||||
if (StringUtils.isEmpty(deviceHistoryParam.getSerialNumber())) {
|
||||
try {
|
||||
response.setContentType("application/json");
|
||||
response.getWriter().print(JSON.toJSONString(AjaxResult.error("请选择设备")));
|
||||
} catch (IOException e) {
|
||||
log.error("导出失败", e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
dataCenterService.deviceHistoryExport(deviceHistoryParam, response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation("查询场景变量历史数据")
|
||||
@PreAuthorize("@ss.hasPermi('dataCenter:history:list')")
|
||||
@GetMapping("/sceneHistory")
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xinda.data.controller.datacenter;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.xinda.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DeviceHistoryData {
|
||||
@Excel(name = "时间")
|
||||
private String time;
|
||||
|
||||
@Excel(name = "数据")
|
||||
private String value;
|
||||
}
|
||||
@@ -58,4 +58,6 @@ public interface DocMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDocByIds(Long[] ids);
|
||||
|
||||
List<Doc> selectDocAllList(Doc doc);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.xinda.iot.model.ThingsModelLogCountVO;
|
||||
import com.xinda.iot.model.param.DataCenterParam;
|
||||
import com.xinda.iot.model.scenemodel.SceneHistoryParam;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -55,4 +56,6 @@ public interface DataCenterService {
|
||||
* @return com.xinda.common.core.domain.AjaxResult
|
||||
*/
|
||||
List<ThingsModelLogCountVO> countThingsModelInvoke(DataCenterParam dataCenterParam);
|
||||
|
||||
void deviceHistoryExport(DeviceHistoryParam deviceHistoryParam, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -62,4 +62,5 @@ public interface IDocService
|
||||
*/
|
||||
public int deleteDocById(Long id);
|
||||
|
||||
List<Doc> selectDocAllList(Doc doc);
|
||||
}
|
||||
|
||||
@@ -191,6 +191,9 @@ public class AlertLogServiceImpl implements IAlertLogService {
|
||||
}
|
||||
if (alertLog.getEnable()==1) {
|
||||
RepairOrder order = alertLog.getOrder();
|
||||
SysUser user = getLoginUser().getUser();
|
||||
order.setTenantId(user.getDeptId());
|
||||
order.setCreateTime(DateUtils.getNowDate());
|
||||
repairOrderMapper.insertRepairOrder(order);
|
||||
alertLog.setOrderId(order.getId());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.xinda.iot.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.enums.scenemodel.SceneModelVariableTypeEnum;
|
||||
import com.xinda.common.utils.DateUtils;
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
@@ -15,9 +18,16 @@ import com.xinda.iot.model.param.DataCenterParam;
|
||||
import com.xinda.iot.model.scenemodel.SceneHistoryParam;
|
||||
import com.xinda.iot.service.*;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -182,4 +192,79 @@ public class DataCenterServiceImpl implements DataCenterService {
|
||||
resultList.addAll(functionLogService.countThingsModelInvoke(dataCenterParam));
|
||||
return resultList;
|
||||
}
|
||||
@Override
|
||||
public void deviceHistoryExport(DeviceHistoryParam deviceHistoryParam, HttpServletResponse response) {
|
||||
// 1. 获取历史数据
|
||||
List<JSONObject> dataList = this.deviceHistory(deviceHistoryParam);
|
||||
|
||||
// 2. 提取所有标识符(去重)
|
||||
Set<String> allIdentifiers = new HashSet<>();
|
||||
for (JSONObject obj : dataList) {
|
||||
for (String timeKey : obj.keySet()) {
|
||||
JSONArray items = obj.getJSONArray(timeKey);
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
JSONObject item = items.getJSONObject(i);
|
||||
allIdentifiers.addAll(item.keySet());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 创建Excel工作簿
|
||||
try (Workbook workbook = new XSSFWorkbook()) {
|
||||
Sheet sheet = workbook.createSheet("设备历史数据");
|
||||
|
||||
// 4. 创建表头
|
||||
Row headerRow = sheet.createRow(0);
|
||||
int colIndex = 0;
|
||||
headerRow.createCell(colIndex++).setCellValue("时间");
|
||||
for (String identifier : allIdentifiers) {
|
||||
headerRow.createCell(colIndex++).setCellValue(identifier);
|
||||
}
|
||||
|
||||
// 5. 填充数据
|
||||
int rowIndex = 1;
|
||||
for (JSONObject obj : dataList) {
|
||||
for (String timeKey : obj.keySet()) {
|
||||
Row dataRow = sheet.createRow(rowIndex++);
|
||||
int cellIndex = 0;
|
||||
dataRow.createCell(cellIndex++).setCellValue(timeKey); // 时间列
|
||||
|
||||
JSONArray items = obj.getJSONArray(timeKey);
|
||||
Map<String, String> valueMap = new HashMap<>();
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
JSONObject item = items.getJSONObject(i);
|
||||
item.forEach((key, value) -> valueMap.put(key, value.toString()));
|
||||
}
|
||||
|
||||
// 按表头顺序填充数据
|
||||
for (String identifier : allIdentifiers) {
|
||||
String value = valueMap.getOrDefault(identifier, "");
|
||||
dataRow.createCell(cellIndex++).setCellValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 6. 自动调整列宽
|
||||
for (int i = 0; i < allIdentifiers.size() + 1; i++) {
|
||||
sheet.autoSizeColumn(i);
|
||||
}
|
||||
|
||||
// 7. 设置响应头
|
||||
String fileName = URLEncoder.encode("设备历史数据_" + System.currentTimeMillis(), "UTF-8") + ".xlsx";
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
|
||||
|
||||
// 8. 写入响应流
|
||||
workbook.write(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
log.error("导出Excel失败", e);
|
||||
try {
|
||||
response.setContentType("application/json");
|
||||
response.getWriter().print(JSON.toJSONString(AjaxResult.error("导出失败")));
|
||||
} catch (IOException ex) {
|
||||
log.error("错误处理失败", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,6 +52,15 @@ public class DocServiceImpl implements IDocService
|
||||
return docMapper.selectDocList(doc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Doc> selectDocAllList(Doc doc)
|
||||
{
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
//添加设备
|
||||
doc.setDeptId(sysUser.getDept().getDeptId());
|
||||
return docMapper.selectDocAllList(doc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增档案管理
|
||||
*
|
||||
|
||||
@@ -39,6 +39,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="tenantName != null and tenantName != ''"> and d.tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDocAllList" parameterType="Doc" resultMap="DocResult">
|
||||
<include refid="selectDocVo"/>
|
||||
<where>
|
||||
<!-- <if test="deptId != null "> and dept_id = #{deptId}</if>-->
|
||||
<if test="deptId != null and deptId != 0 ">
|
||||
and d.dept_id in (
|
||||
SELECT #{deptId} AS dept_id
|
||||
UNION ALL
|
||||
SELECT DISTINCT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(ancestors, ',', n.n), ',', -1) AS SIGNED) AS dept_id
|
||||
FROM sys_dept de
|
||||
JOIN (
|
||||
SELECT 1 AS n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5
|
||||
UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10
|
||||
) n ON CHAR_LENGTH(ancestors) - CHAR_LENGTH(REPLACE(ancestors, ',', '')) >= n.n - 1
|
||||
WHERE de.dept_id = #{deptId}
|
||||
AND SUBSTRING_INDEX(SUBSTRING_INDEX(ancestors, ',', n.n), ',', -1) != ''
|
||||
)
|
||||
</if>
|
||||
<if test="fileName != null and fileName != ''"> and d.file_name like concat('%', #{fileName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectDocById" parameterType="Long" resultMap="DocResult">
|
||||
<include refid="selectDocVo"/>
|
||||
|
||||
@@ -42,7 +42,7 @@ public interface SysMenuMapper
|
||||
* @return 权限列表
|
||||
*/
|
||||
public List<String> selectMenuPermsByRoleId(Long roleId);
|
||||
|
||||
public List<String> selectMenuPermsByRoleIdF(Long roleId);
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
*
|
||||
@@ -50,7 +50,7 @@ public interface SysMenuMapper
|
||||
* @return 权限列表
|
||||
*/
|
||||
public List<String> selectMenuPermsByUserId(Long userId);
|
||||
|
||||
public List<String> selectMenuPermsByUserIdF(Long userId);
|
||||
/**
|
||||
* 根据用户ID查询菜单
|
||||
*
|
||||
|
||||
@@ -57,4 +57,6 @@ public interface SysNoticeMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds(Long[] noticeIds);
|
||||
|
||||
List<SysNotice> selectNoticeIndexList(SysNotice notice);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface ISysMenuService
|
||||
* @return 权限列表
|
||||
*/
|
||||
public Set<String> selectMenuPermsByUserId(Long userId);
|
||||
|
||||
public Set<String> selectMenuPermsByUserIdF(Long userId);
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
@@ -46,7 +46,7 @@ public interface ISysMenuService
|
||||
* @return 权限列表
|
||||
*/
|
||||
public Set<String> selectMenuPermsByRoleId(Long roleId);
|
||||
|
||||
public Set<String> selectMenuPermsByRoleIdF(Long roleId);
|
||||
/**
|
||||
* 根据用户ID查询菜单树信息
|
||||
*
|
||||
|
||||
@@ -57,4 +57,6 @@ public interface ISysNoticeService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds(Long[] noticeIds);
|
||||
|
||||
List<SysNotice> selectNoticeIndexList(SysNotice notice);
|
||||
}
|
||||
|
||||
@@ -134,6 +134,21 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
return permsSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> selectMenuPermsByUserIdF(Long userId)
|
||||
{
|
||||
List<String> perms = menuMapper.selectMenuPermsByUserIdF(userId);
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (String perm : perms)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(perm))
|
||||
{
|
||||
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
@@ -155,6 +170,21 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
return permsSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> selectMenuPermsByRoleIdF(Long roleId)
|
||||
{
|
||||
List<String> perms = menuMapper.selectMenuPermsByRoleIdF(roleId);
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (String perm : perms)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(perm))
|
||||
{
|
||||
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单
|
||||
*
|
||||
|
||||
@@ -42,6 +42,11 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
||||
return noticeMapper.selectNoticeList(notice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysNotice> selectNoticeIndexList(SysNotice notice)
|
||||
{
|
||||
return noticeMapper.selectNoticeIndexList(notice);
|
||||
}
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
|
||||
@@ -48,7 +48,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectNoticeIndexList" parameterType="SysNotice" resultMap="SysNoticeResult">
|
||||
<include refid="selectNoticeVo"/>
|
||||
<where>
|
||||
<if test="deptId != null and deptId != 0 ">
|
||||
and n.dept_id in (
|
||||
SELECT #{deptId} AS dept_id
|
||||
UNION ALL
|
||||
SELECT DISTINCT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(ancestors, ',', n.n), ',', -1) AS SIGNED) AS dept_id
|
||||
FROM sys_dept d
|
||||
JOIN (
|
||||
SELECT 1 AS n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5
|
||||
UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10
|
||||
) n ON CHAR_LENGTH(ancestors) - CHAR_LENGTH(REPLACE(ancestors, ',', '')) >= n.n - 1
|
||||
WHERE d.dept_id = #{deptId}
|
||||
AND SUBSTRING_INDEX(SUBSTRING_INDEX(ancestors, ',', n.n), ',', -1) != ''
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<insert id="insertNotice" parameterType="SysNotice">
|
||||
insert into sys_notice (
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
|
||||
Reference in New Issue
Block a user