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

master
马雪伟 8 months ago
parent b0aafc8d33
commit f41dcc7468

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

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

@ -2,6 +2,7 @@ package com.ruoyi.business.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.business.domain.HwDeviceModeFunction; import com.ruoyi.business.domain.HwDeviceModeFunction;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper * Mapper
@ -58,4 +59,7 @@ public interface HwDeviceModeFunctionMapper
* @return * @return
*/ */
public int deleteHwDeviceModeFunctionByModeFunctionIds(Long[] modeFunctionIds); 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(); Set<String> functionIdentifiers = deviceLatestDataMap.keySet();
for (String dataFunctionIdentifier : functionIdentifiers) { for (String dataFunctionIdentifier : functionIdentifiers) {
if (functionIndentifierNameMap.get(dataFunctionIdentifier) != null) { 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), ddValueMap.put(functionIndentifierNameMap.get(dataFunctionIdentifier),
deviceLatestDataMap.get(dataFunctionIdentifier)); value);
} }
} }
}); });

@ -20,11 +20,11 @@ public class UnitExcelUtils {
@Autowired @Autowired
private HwAlarmInfoMapper hwAlarmInfoMapper; 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(); Workbook bk = new XSSFWorkbook();
for (Long aLong : map.keySet()) { for (String aLong : map.keySet()) {
List<LinkedHashMap> list3 = map.get(aLong); List<LinkedHashMap> list3 = map.get(aLong);
Sheet unitId = bk.createSheet(aLong.toString()); Sheet unitId = bk.createSheet(aLong);
int row = 0; int row = 0;
for (row = 0;row < list3.size();row++){ for (row = 0;row < list3.size();row++){
if (row == 0){ 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="alarmReleatedId != null "> and alarm_releated_id = #{alarmReleatedId}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if> <if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="monitorUnitId != null "> and monitor_unit_id = #{monitorUnitId}</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="sceneId != null "> and hai.scene_id = #{sceneId}</if>
<if test="alarmLevelId != null "> and alarm_level_id = #{alarmLevelId}</if> <if test="alarmLevelId != null "> and alarm_level_id = #{alarmLevelId}</if>
<if test="alarmTypeId != null "> and alarm_type_id = #{alarmTypeId}</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, select hai.monitor_unit_id,hai.alarm_info_id,
hai.alarm_time, hai.alarm_time,
hmu.monitor_unit_name, hmu.monitor_unit_name,
hal.alarm_level_name, -- hal.alarm_level_name,
hat.alarm_type_name, hat.alarm_type_name,
ha.area_name, ha.area_name,
-- hmu.monitor_unit_id, -- hmu.monitor_unit_id,

@ -61,7 +61,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectHwDeviceModeFunctionVo"/> <include refid="selectHwDeviceModeFunctionVo"/>
where mode_function_id = #{modeFunctionId} where mode_function_id = #{modeFunctionId}
</select> </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 id="insertHwDeviceModeFunction" parameterType="HwDeviceModeFunction" useGeneratedKeys="true" keyProperty="modeFunctionId">
insert into hw_device_mode_function insert into hw_device_mode_function
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

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

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

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

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

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

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

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

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

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

@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null and userId != 0"> <if test="userId != null and userId != 0">
AND u.user_id = #{userId} AND u.user_id = #{userId}
</if> </if>
<if test="tenantId != null and tenantId != 0"> <if test="tenantId != null and tenantId != 0 and tenantId != 1">
AND u.tenant_id = #{tenantId} AND u.tenant_id = #{tenantId}
</if> </if>
<if test="userName != null and userName != ''"> <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) )) 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> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} -- ${params.dataScope}
<!-- 租户数据范围过滤 --> <!-- 租户数据范围过滤 -->
${params.tenantDataScope} -- ${params.tenantDataScope}
</select> </select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">

Loading…
Cancel
Save