自定义组件代码bug解决
This commit is contained in:
@@ -334,6 +334,17 @@ public class InfluxDBResultMapperCn {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LocalDateTime.class.isAssignableFrom(fieldType)) {
|
||||||
|
LocalDateTime localDateTime;
|
||||||
|
if (value instanceof String) {
|
||||||
|
localDateTime = LocalDateTime.ofInstant(Instant.from(DateTimeFormatter.ISO_DATE_TIME.parse(String.valueOf(value))), ZoneId.systemDefault());
|
||||||
|
} else {
|
||||||
|
throw new InfluxDBMapperException("Unsupported type " + field.getClass() + " for field " + field.getName());
|
||||||
|
}
|
||||||
|
field.set(object, localDateTime);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,10 +130,12 @@ public class DeviceInfoParam implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty("开始时间")
|
@ApiModelProperty("开始时间")
|
||||||
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
||||||
|
@NotBlank(message = "起始时间不可为空")
|
||||||
private String searchBeginTime;
|
private String searchBeginTime;
|
||||||
|
|
||||||
@ApiModelProperty("结束时间")
|
@ApiModelProperty("结束时间")
|
||||||
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
||||||
|
@NotBlank(message = "结束时间不可为空")
|
||||||
private String searchEndTime;
|
private String searchEndTime;
|
||||||
|
|
||||||
@ApiModelProperty("时间范围标志 0.查询展示天 1.查询展示月")
|
@ApiModelProperty("时间范围标志 0.查询展示天 1.查询展示月")
|
||||||
@@ -146,10 +148,12 @@ public class DeviceInfoParam implements Serializable {
|
|||||||
public static class CompareBusinessParam extends BusinessParam{
|
public static class CompareBusinessParam extends BusinessParam{
|
||||||
|
|
||||||
@ApiModelProperty("比较开始时间")
|
@ApiModelProperty("比较开始时间")
|
||||||
|
@NotBlank(message = "比较开始时间不可为空")
|
||||||
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
||||||
private String periodBeginTime;
|
private String periodBeginTime;
|
||||||
|
|
||||||
@ApiModelProperty("比较结束时间")
|
@ApiModelProperty("比较结束时间")
|
||||||
|
@NotBlank(message = "比较结束时间不可为空")
|
||||||
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
||||||
private String periodEndTime;
|
private String periodEndTime;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.njcn.device.pojo.vo;
|
package com.njcn.device.pojo.vo;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -12,6 +14,8 @@ import java.math.BigDecimal;
|
|||||||
* @date 2022/6/29
|
* @date 2022/6/29
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class AreaLineInfoVO implements Serializable {
|
public class AreaLineInfoVO implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(name = "lineId",value = "监测点id")
|
@ApiModelProperty(name = "lineId",value = "监测点id")
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ public class TerminalTreeController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||||
@PostMapping("getTerminalTreeForFive")
|
@PostMapping("getTerminalTreeForFive")
|
||||||
@ApiImplicitParam(name = "deviceInfoParam", value = "台账查询参数", required = true)
|
@ApiImplicitParam(name = "deviceInfoParam", value = "台账查询参数", required = true)
|
||||||
@Validated
|
|
||||||
public HttpResult<List<TerminalTree>> getTerminalTreeForFive(@RequestBody @Validated DeviceInfoParam deviceInfoParam){
|
public HttpResult<List<TerminalTree>> getTerminalTreeForFive(@RequestBody @Validated DeviceInfoParam deviceInfoParam){
|
||||||
String methodDescribe = getMethodDescribe("getTerminalTreeForFive");
|
String methodDescribe = getMethodDescribe("getTerminalTreeForFive");
|
||||||
List<TerminalTree> tree = terminalTreeService.getTerminalTreeForFive(deviceInfoParam);
|
List<TerminalTree> tree = terminalTreeService.getTerminalTreeForFive(deviceInfoParam);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import org.influxdb.annotation.Measurement;
|
|||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cdf
|
* @author cdf
|
||||||
@@ -22,7 +23,7 @@ public class EventDetailNew {
|
|||||||
|
|
||||||
@Column(name = "time")
|
@Column(name = "time")
|
||||||
@DateTimeFormat(pattern = "yyyy-mm-dd")
|
@DateTimeFormat(pattern = "yyyy-mm-dd")
|
||||||
private Instant timeId;
|
private LocalDateTime timeId;
|
||||||
|
|
||||||
@Column(name = "event_describe")
|
@Column(name = "event_describe")
|
||||||
private String eventDescribe;
|
private String eventDescribe;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.user.mapper;
|
package com.njcn.user.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.user.pojo.po.Role;
|
||||||
import com.njcn.user.pojo.po.UserRole;
|
import com.njcn.user.pojo.po.UserRole;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -21,4 +22,14 @@ public interface UserRoleMapper extends BaseMapper<UserRole> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<UserRole> selectUserRole(@Param("ids")List<String> ids);
|
List<UserRole> selectUserRole(@Param("ids")List<String> ids);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取角色详情
|
||||||
|
* @param userId 用户id
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/9/8
|
||||||
|
* @return 角色结果集
|
||||||
|
*/
|
||||||
|
List<Role> getRoleListByUserId(String userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,4 +10,12 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getRoleListByUserId" resultType="Role">
|
||||||
|
select b.* from sys_user_role a
|
||||||
|
inner join sys_role b on a.role_id = b.id
|
||||||
|
where a.user_id = #{userId}
|
||||||
|
and b.state = 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -78,4 +78,6 @@ public interface IRoleService extends IService<Role> {
|
|||||||
boolean deleteRole(List<String> ids);
|
boolean deleteRole(List<String> ids);
|
||||||
|
|
||||||
Boolean selectRelevance(List<String> ids);
|
Boolean selectRelevance(List<String> ids);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.user.service;
|
package com.njcn.user.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.user.pojo.po.Role;
|
||||||
import com.njcn.user.pojo.po.UserRole;
|
import com.njcn.user.pojo.po.UserRole;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -45,4 +46,14 @@ public interface IUserRoleService extends IService<UserRole> {
|
|||||||
* @date 2022/1/13 14:14
|
* @date 2022/1/13 14:14
|
||||||
*/
|
*/
|
||||||
boolean updateUserRole(String id,List<String> roles);
|
boolean updateUserRole(String id,List<String> roles);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id获取角色详情
|
||||||
|
* @param userId 用户id
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/9/8
|
||||||
|
* @return 角色结果集
|
||||||
|
*/
|
||||||
|
List<Role> getRoleListByUserId(String userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,12 @@ import com.njcn.user.pojo.constant.FunctionState;
|
|||||||
import com.njcn.user.pojo.dto.ComponentDTO;
|
import com.njcn.user.pojo.dto.ComponentDTO;
|
||||||
import com.njcn.user.pojo.param.ComponentParam;
|
import com.njcn.user.pojo.param.ComponentParam;
|
||||||
import com.njcn.user.pojo.po.Component;
|
import com.njcn.user.pojo.po.Component;
|
||||||
|
import com.njcn.user.pojo.po.Role;
|
||||||
import com.njcn.user.pojo.vo.ComponentVO;
|
import com.njcn.user.pojo.vo.ComponentVO;
|
||||||
import com.njcn.user.service.IComponentService;
|
import com.njcn.user.service.IComponentService;
|
||||||
import com.njcn.user.service.IRoleComponentService;
|
import com.njcn.user.service.IRoleComponentService;
|
||||||
import com.njcn.user.service.IRoleService;
|
import com.njcn.user.service.IRoleService;
|
||||||
|
import com.njcn.user.service.IUserRoleService;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -40,6 +42,8 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
|||||||
|
|
||||||
private final IRoleService roleService;
|
private final IRoleService roleService;
|
||||||
|
|
||||||
|
private final IUserRoleService iUserRoleService;
|
||||||
|
|
||||||
private final IRoleComponentService roleComponentService;
|
private final IRoleComponentService roleComponentService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -102,11 +106,16 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
|||||||
public List<ComponentVO> getUserComponentTree() {
|
public List<ComponentVO> getUserComponentTree() {
|
||||||
List<ComponentVO> result = new ArrayList<>();
|
List<ComponentVO> result = new ArrayList<>();
|
||||||
List<ComponentVO> componentVOList = new ArrayList<>();
|
List<ComponentVO> componentVOList = new ArrayList<>();
|
||||||
List<String> roleList = roleService.getIdByUserId(RequestUtil.getUserIndex());
|
List<Role> roleList = iUserRoleService.getRoleListByUserId(RequestUtil.getUserIndex());
|
||||||
if (!CollectionUtils.isEmpty(roleList)) {
|
if (!CollectionUtils.isEmpty(roleList)) {
|
||||||
List<String> componentList = roleComponentService.selectRoleComponent(roleList);
|
List<ComponentDTO> list;
|
||||||
if (!CollectionUtils.isEmpty(componentList)){
|
if (roleList.stream().anyMatch(item -> "root".equals(item.getCode()))) {
|
||||||
List<ComponentDTO> list = componentMapper.getComponentByList(componentList);
|
list = componentMapper.getAllComponent();
|
||||||
|
} else {
|
||||||
|
List<String> componentList = roleComponentService.selectRoleComponent(roleList.stream().map(Role::getId).collect(Collectors.toList()));
|
||||||
|
list = componentMapper.getComponentByList(componentList);
|
||||||
|
}
|
||||||
|
|
||||||
list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
ComponentVO componentVO = new ComponentVO();
|
ComponentVO componentVO = new ComponentVO();
|
||||||
BeanUtil.copyProperties(item, componentVO);
|
BeanUtil.copyProperties(item, componentVO);
|
||||||
@@ -118,7 +127,6 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
|||||||
.peek(funS -> funS.setChildren(getChildCategoryList(funS, componentVOList)))
|
.peek(funS -> funS.setChildren(getChildCategoryList(funS, componentVOList)))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
import com.njcn.user.mapper.UserMapper;
|
import com.njcn.user.mapper.UserMapper;
|
||||||
import com.njcn.user.mapper.UserRoleMapper;
|
import com.njcn.user.mapper.UserRoleMapper;
|
||||||
|
import com.njcn.user.pojo.po.Role;
|
||||||
import com.njcn.user.pojo.po.UserRole;
|
import com.njcn.user.pojo.po.UserRole;
|
||||||
import com.njcn.user.service.IUserRoleService;
|
import com.njcn.user.service.IUserRoleService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@@ -94,4 +95,9 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i
|
|||||||
// }
|
// }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Role> getRoleListByUserId(String userId) {
|
||||||
|
return this.baseMapper.getRoleListByUserId(userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user