导出sheet名修改,三级页面历史记录得参数单位添加

breach-zhy
马雪伟 3 months ago
parent b0aafc8d33
commit f41dcc7468

@ -462,11 +462,11 @@ public class HwMonitorPlatformController extends BaseController {
@RequiresPermissions("business:monitor:alarm")
public void AlarmInfosExport(HttpServletResponse response,Date startTime,Date endTime) throws IOException, NoSuchFieldException, IllegalAccessException {
List<Long> list1 = hwAlarmInfoService.selectUnitId();
HashMap<Long, List<LinkedHashMap>> map = new HashMap<>();
HashMap<String, List<LinkedHashMap>> map = new HashMap<>();
for (Long unitId : list1) {
List<AlarmInfoExportVo> list2 = hwAlarmInfoService.selectAlarmInfoExport1(unitId,startTime,endTime);
List<HwMonitorUnitAttribute> attributes = hwMonitorUnitAttributeService.selectAttributes(unitId);
HwMonitorUnit hwMonitorUnit = hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(unitId);
List<LinkedHashMap> excelMap = new ArrayList<LinkedHashMap>();
LinkedHashMap attributeMap = new LinkedHashMap();
for (HwMonitorUnitAttribute attribute : attributes) {
@ -502,7 +502,7 @@ public class HwMonitorPlatformController extends BaseController {
excelMap.add(voMap);
}
if (CollectionUtil.isNotEmpty(excelMap)){
map.put(unitId,excelMap);
map.put(hwMonitorUnit.getMonitorUnitName(),excelMap);
}
}

@ -19,8 +19,8 @@ public class AlarmInfoExportVo {
@Excel(name = "报警位置")
private String monitorUnitName;
@Excel(name = "报警级别名称")
private String alarmLevelName;
// @Excel(name = "报警级别名称")
// private String alarmLevelName;
@Excel(name = "报警类型名称")
private String alarmTypeName;

@ -2,6 +2,7 @@ package com.ruoyi.business.mapper;
import java.util.List;
import com.ruoyi.business.domain.HwDeviceModeFunction;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -58,4 +59,7 @@ public interface HwDeviceModeFunctionMapper
* @return
*/
public int deleteHwDeviceModeFunctionByModeFunctionIds(Long[] modeFunctionIds);
String selectUbitByIdAndName(@Param("dataFunctionIdentifier") String dataFunctionIdentifier,@Param("modeId") Long modeId);
}

@ -535,8 +535,20 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
Set<String> functionIdentifiers = deviceLatestDataMap.keySet();
for (String dataFunctionIdentifier : functionIdentifiers) {
if (functionIndentifierNameMap.get(dataFunctionIdentifier) != null) {
String unit;
if (dataFunctionIdentifier.equals("value1")){
unit = hwDevieModeFunctionMapper.selectUbitByIdAndName("value",hwDevice.getDeviceModeId());
}else {
unit = hwDevieModeFunctionMapper.selectUbitByIdAndName(dataFunctionIdentifier,hwDevice.getDeviceModeId());
}
Object value;
if (unit == null){
value = deviceLatestDataMap.get(dataFunctionIdentifier);
}else {
value = deviceLatestDataMap.get(dataFunctionIdentifier) + unit;
}
ddValueMap.put(functionIndentifierNameMap.get(dataFunctionIdentifier),
deviceLatestDataMap.get(dataFunctionIdentifier));
value);
}
}
});

@ -20,11 +20,11 @@ public class UnitExcelUtils {
@Autowired
private HwAlarmInfoMapper hwAlarmInfoMapper;
public void exportAlarmInfos(HttpServletResponse response, HashMap<Long, List<LinkedHashMap>> map) throws IOException {
public void exportAlarmInfos(HttpServletResponse response, HashMap<String, List<LinkedHashMap>> map) throws IOException {
Workbook bk = new XSSFWorkbook();
for (Long aLong : map.keySet()) {
for (String aLong : map.keySet()) {
List<LinkedHashMap> list3 = map.get(aLong);
Sheet unitId = bk.createSheet(aLong.toString());
Sheet unitId = bk.createSheet(aLong);
int row = 0;
for (row = 0;row < list3.size();row++){
if (row == 0){

@ -135,7 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="alarmReleatedId != null "> and alarm_releated_id = #{alarmReleatedId}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="monitorUnitId != null "> and monitor_unit_id = #{monitorUnitId}</if>
<if test="tenantId != null "> and hai.tenant_id = #{tenantId}</if>
<if test="tenantId != null and tenantId != 1"> and hai.tenant_id = #{tenantId}</if>
<if test="sceneId != null "> and hai.scene_id = #{sceneId}</if>
<if test="alarmLevelId != null "> and alarm_level_id = #{alarmLevelId}</if>
<if test="alarmTypeId != null "> and alarm_type_id = #{alarmTypeId}</if>
@ -295,7 +295,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select hai.monitor_unit_id,hai.alarm_info_id,
hai.alarm_time,
hmu.monitor_unit_name,
hal.alarm_level_name,
-- hal.alarm_level_name,
hat.alarm_type_name,
ha.area_name,
-- hmu.monitor_unit_id,

@ -61,6 +61,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectHwDeviceModeFunctionVo"/>
where mode_function_id = #{modeFunctionId}
</select>
<select id="selectUbitByIdAndName" resultType="java.lang.String">
SELECT x.property_unit property_unit FROM `hwsaas-cloud`.hw_device_mode_function x WHERE function_identifier like concat("%",#{dataFunctionIdentifier},"%") and x.device_mode_id = #{modeId}
</select>
<insert id="insertHwDeviceModeFunction" parameterType="HwDeviceModeFunction" useGeneratedKeys="true" keyProperty="modeFunctionId">
insert into hw_device_mode_function

@ -51,8 +51,9 @@ public class SysDeptController extends BaseController {
@RequiresPermissions("system:dept:list")
@GetMapping("/list")
public AjaxResult list(SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept);
Long tenantId = SecurityUtils.getTenantId();
dept.setTenantId(tenantId);
List<SysDept> depts = deptService.selectDeptList(dept);
if (tenantId.equals(HwDictConstants.ADMINISTRATOR_TENANT_ID)) {
depts.forEach(d -> {
if (!d.getTenantId().equals(tenantId)) {

@ -52,6 +52,8 @@ public class SysPostController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysPost post)
{
Long tenantId = SecurityUtils.getTenantId();
post.setTenantId(tenantId);
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);

@ -52,9 +52,12 @@ public class SysRoleController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysRole role)
{
Long tenantId = SecurityUtils.getTenantId();
role.setTenantId(tenantId);
startPage();
List<SysRole> list = roleService.selectRoleList(role);
Long tenantId = SecurityUtils.getTenantId();
if(tenantId.equals(HwDictConstants.ADMINISTRATOR_TENANT_ID)){
list.forEach(r->{
if(!r.getTenantId().equals(tenantId)){

@ -164,6 +164,9 @@ public class SysUserController extends BaseController {
public AjaxResult getAddedInfo(@PathVariable(value = "tenantId", required = false) Long tenantId) {
userService.checkUserDataScope(null);
AjaxResult ajax = AjaxResult.success();
if (tenantId==null){
tenantId = SecurityUtils.getLoginUser().getSysUser().getTenantId();
}
SysRole querySysRole = new SysRole();
querySysRole.setTenantId(tenantId);

@ -5,6 +5,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.constant.UserConstants;
@ -44,6 +45,9 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override
@DataScope(deptAlias = "d", tenantAlias = "d")
public List<SysDept> selectDeptList(SysDept dept) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long tenantId = loginUser.getSysUser().getTenantId();
dept.setTenantId(tenantId);
return deptMapper.selectDeptList(dept);
}

@ -5,6 +5,7 @@ import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Validator;
import com.ruoyi.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -70,6 +71,10 @@ public class SysUserServiceImpl implements ISysUserService {
@Override
@DataScope(deptAlias = "d", userAlias = "u", tenantAlias = "u")
public List<SysUser> selectUserList(SysUser user) {
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
Long tenantId = sysUser.getTenantId();
user.setTenantId(tenantId);
return userMapper.selectUserList(user);
}

@ -44,13 +44,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">
AND d.status = #{status}
</if>
<if test="tenantId != null and tenantId!=0">
<if test="tenantId != null and tenantId!=0 and tenantId!=1">
AND d.tenant_id = #{tenantId}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
<!-- ${params.dataScope}-->
<!-- &lt;!&ndash; 租户数据范围过滤 &ndash;&gt;-->
<!-- ${params.tenantDataScope}-->
order by d.parent_id, d.order_num
</select>

@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/>
<where>
1=1
<if test="postCode != null and postCode != ''">
AND p.post_code like concat('%', #{postCode}, '%')
</if>
@ -36,11 +37,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="postName != null and postName != ''">
AND p.post_name like concat('%', #{postName}, '%')
</if>
<if test="tenantId != null and tenantId!=0">
<if test="tenantId != null and tenantId!=0 and tenantId!=1">
AND p.tenant_id = #{tenantId}
</if>
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
-- ${params.tenantDataScope}
</where>
order by p.tenant_id,p.post_sort
</select>

@ -54,13 +54,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="tenantId != null and tenantId != 0">
<if test="tenantId != null and tenantId != 0 and tenantId != 1">
AND r.tenant_id = #{tenantId}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
-- ${params.tenantDataScope}
order by r.tenant_id,r.role_sort
</select>

@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}
</if>
<if test="tenantId != null and tenantId != 0">
<if test="tenantId != null and tenantId != 0 and tenantId != 1">
AND u.tenant_id = #{tenantId}
</if>
<if test="userName != null and userName != ''">
@ -88,9 +88,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
-- ${params.dataScope}
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
-- ${params.tenantDataScope}
</select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">

Loading…
Cancel
Save