1.分布式光伏台账相关
This commit is contained in:
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.user.api.fallback.DeptFeignClientFallbackFactory;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -45,4 +46,11 @@ public interface DeptFeignClient {
|
||||
*/
|
||||
@GetMapping("/getAreaIdByDeptId")
|
||||
HttpResult<String> getAreaIdByDeptId(@RequestParam("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* 获取所有部门
|
||||
*/
|
||||
@GetMapping("/allDeptList")
|
||||
HttpResult<List<PvTerminalTreeVO>> allDeptList();
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import com.njcn.user.utils.UserEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -55,6 +56,12 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory<DeptFeign
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据部门索引获取区域索引", cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<PvTerminalTreeVO>> allDeptList() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询所有部门异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.user.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/7/11
|
||||
*/
|
||||
@Data
|
||||
public class PvTerminalTreeVO {
|
||||
|
||||
@ApiModelProperty(name = "id",value = "id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(name = "pid",value = "父级id")
|
||||
private String pid;
|
||||
|
||||
@ApiModelProperty(name = "name",value = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "code",value = "code")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 0.单位 1.变电站 2.台区
|
||||
*/
|
||||
@ApiModelProperty(name = "level",value = "0.单位 1.变电站 2.台区")
|
||||
private Integer level;
|
||||
|
||||
@ApiModelProperty(name = "children",value = "子级")
|
||||
private List<PvTerminalTreeVO> children = new ArrayList<>();
|
||||
}
|
||||
@@ -16,9 +16,8 @@ import com.njcn.user.pojo.param.DeptParam;
|
||||
import com.njcn.user.pojo.vo.DeptAllTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptVO;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import com.njcn.user.service.IDeptService;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
import com.njcn.web.utils.ControllerUtil;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -256,5 +255,19 @@ public class DeptController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的部门
|
||||
* @author cdf
|
||||
* @date 2022/7/12
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/allDeptList")
|
||||
@ApiOperation("获取所有单位")
|
||||
public HttpResult<List<PvTerminalTreeVO>> allDeptList() {
|
||||
String methodDescribe = getMethodDescribe("allDeptList");
|
||||
List<PvTerminalTreeVO> result = deptService.allDeptList();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.DeptAllTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptVO;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -91,4 +92,7 @@ public interface DeptMapper extends BaseMapper<Dept> {
|
||||
* @return 后代部门索引
|
||||
*/
|
||||
List<DeptDTO> getDeptDescendantIndexes(@Param("id")String id, @Param("type")List<Integer> type);
|
||||
|
||||
|
||||
List<PvTerminalTreeVO> allDeptList();
|
||||
}
|
||||
|
||||
@@ -155,4 +155,9 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="allDeptList" resultType="DeptAllTreeVO">
|
||||
select id,name,pid, 0 as level from sys_dept where type = 0 and state = 1 order by sort
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.DeptAllTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptVO;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -131,4 +131,11 @@ public interface IDeptService extends IService<Dept> {
|
||||
* @date 2022/3/28 9:32
|
||||
*/
|
||||
String getTopDeptId();
|
||||
|
||||
/**
|
||||
* 获取所有的部门
|
||||
* @author cdf
|
||||
* @date 2022/7/12
|
||||
*/
|
||||
List<PvTerminalTreeVO> allDeptList();
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.user.pojo.vo.DeptAllTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptTreeVO;
|
||||
import com.njcn.user.pojo.vo.DeptVO;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import com.njcn.user.service.IDeptService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -251,6 +251,11 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
return this.lambdaQuery().eq(Dept::getPid,"0").one().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PvTerminalTreeVO> allDeptList(){
|
||||
return this.baseMapper.allDeptList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数,检查是否存在相同编码的部门
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user