算法提交

This commit is contained in:
2023-12-11 17:03:22 +08:00
parent ec9d9bca64
commit e1f697f180
11 changed files with 222 additions and 34 deletions

View File

@@ -1,14 +1,21 @@
package com.njcn.user.api;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.user.api.fallback.DeptFeignClientFallbackFactory;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.user.pojo.po.Dept;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -133,4 +140,20 @@ public interface DeptFeignClient {
*/
@GetMapping("/getUpByDeptIds")
HttpResult<List<String>> getUpByDeptIds(@RequestParam("deptId") String deptId);
/**
* 根据单位集合查询对应部门
* @param list code集合
* @return
*/
@PostMapping("/getDeptByCodeList")
HttpResult<List<Dept>> getDeptByCodeList(@RequestBody List<String> list);
/**
* 获取所有的部门集合
* @author xy
* @date 2023/12/11
*/
@GetMapping("/getAllDept")
HttpResult<List<Dept>> getAllDept();
}

View File

@@ -128,6 +128,18 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory<DeptFeign
log.error("{}异常,降级处理,异常为:{}","根据部门id查询当前部门所有父级部门id",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<Dept>> getDeptByCodeList(List<String> list) {
log.error("{}异常,降级处理,异常为:{}","根据单位code集合查询对应部门:",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<Dept>> getAllDept() {
log.error("{}异常,降级处理,异常为:{}","获取所有单位:",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -458,8 +458,34 @@ public class DeptController extends BaseController {
}
/*++++++++++++++++++++++++++++++++pms专用+++++++++++++++++++++++++++++++begin*/
/**
* 根据单位集合查询对应部门
* @param list code集合
* @return
*/
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/getDeptByCodeList")
@ApiOperation("根据单位集合查询对应部门")
@ApiImplicitParam(name = "list", value = "code集合", required = true)
public HttpResult<List<Dept>> getDeptByCodeList(@RequestBody List<String> list) {
String methodDescribe = getMethodDescribe("getDeptByCodeList");
List<Dept> result = deptService.getDeptByCodeList(list);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/**
* 获取所有的部门集合
* @author xy
* @date 2023/12/11
*/
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@GetMapping("/getAllDept")
@ApiOperation("获取所有单位")
public HttpResult<List<Dept>> getAllDept() {
String methodDescribe = getMethodDescribe("getAllDept");
List<Dept> result = deptService.getAllDept();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/*++++++++++++++++++++++++++++++++pms专用+++++++++++++++++++++++++++++++end*/

View File

@@ -226,4 +226,19 @@ public interface IDeptService extends IService<Dept> {
* @Date: 2023/11/9 15:57
*/
List<String> getUpByDeptIds(String deptId);
/**
* @Description: 根据单位集合查询对应部门
* @param list code集合
* @Author: xuyang
* @Date: 2023/12/11 11:36
*/
List<Dept> getDeptByCodeList(List<String> list);
/**
* @Description: 获取所有单位
* @Author: xuyang
* @Date: 2023/12/11 14:50
*/
List<Dept> getAllDept();
}

View File

@@ -468,4 +468,14 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
list.add(deptId);
return list;
}
@Override
public List<Dept> getDeptByCodeList(List<String> list) {
return this.lambdaQuery().in(Dept::getCode,list).eq(Dept::getState,DataStateEnum.ENABLE.getCode()).list();
}
@Override
public List<Dept> getAllDept() {
return this.lambdaQuery().eq(Dept::getState,DataStateEnum.ENABLE.getCode()).list();
}
}