部门信息树形展示

master
shijie 4 years ago
parent 11b6078c3b
commit 015da39810
  1. 1
      dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java
  2. 2
      dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java
  3. 3
      dq-financial-crms/src/main/java/com/daqing/financial/crms/feign/HrmsFeignService.java
  4. 6
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
  5. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/DeptController.java
  6. 5
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java
  7. 8
      dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java

@ -1,5 +1,6 @@
package com.daqing.financial.hrms; package com.daqing.financial.hrms;
import com.daqing.framework.domain.hrms.ext.EmployeeTO;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

@ -48,7 +48,7 @@ public class CustomerController implements CustomerControllerApi {
public ResponseResult info(@PathVariable("id") Long id) { public ResponseResult info(@PathVariable("id") Long id) {
CustomerEntity customer = customerService.getById(id); CustomerEntity customer = customerService.getById(id);
return ResponseResult.SUCCESS(customer); return new ResponseResult<CustomerEntity>().SUCCESS(customer);
} }
/** /**

@ -1,5 +1,6 @@
package com.daqing.financial.crms.feign; package com.daqing.financial.crms.feign;
import com.daqing.framework.domain.hrms.ext.EmployeeTO;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -21,5 +22,5 @@ public interface HrmsFeignService {
ResponseResult list(@RequestParam Map<String, Object> params); ResponseResult list(@RequestParam Map<String, Object> params);
@GetMapping("/hrms/employee/getEmployeeAndDeptById/{ids}") @GetMapping("/hrms/employee/getEmployeeAndDeptById/{ids}")
ResponseResult getEmployeeAndDeptById(@PathVariable("ids") List<Long> ids); ResponseResult<List<EmployeeTO>> getEmployeeAndDeptById(@PathVariable("ids") List<Long> ids);
} }

@ -1,5 +1,6 @@
package com.daqing.financial.crms.service.impl; package com.daqing.financial.crms.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -70,8 +71,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
List<CustomerTO> customerTOS = new ArrayList<>(); List<CustomerTO> customerTOS = new ArrayList<>();
CustomerTO customerTO = new CustomerTO(); CustomerTO customerTO = new CustomerTO();
//TODO 远程调用查询客户经理信息的接口 //TODO 远程调用查询客户经理信息的接口
ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(ids); ResponseResult result = hrmsFeignService.getEmployeeAndDeptById(ids);
List<EmployeeTO> employeeTO = (List<EmployeeTO>) responseResult.getData(); List<EmployeeTO> employeeTO = (List<EmployeeTO>) result.getData();
/*String data = (String) responseResult.getData(); /*String data = (String) responseResult.getData();
List<EmployeeTO> employeeTO = JSON.parseArray(data, EmployeeTO.class);*/ List<EmployeeTO> employeeTO = JSON.parseArray(data, EmployeeTO.class);*/

@ -48,7 +48,7 @@ public class DeptController implements DeptControllerApi {
@GetMapping("/tree") @GetMapping("/tree")
public ResponseResult tree() { public ResponseResult tree() {
List<DeptEntity> list = deptService.listWithTree(); List<DeptEntity> list = deptService.listWithTree();
return ResponseResult.SUCCESS(list); return new ResponseResult<List<DeptEntity>>().SUCCESS(list);
} }

@ -3,6 +3,7 @@ package com.daqing.financial.hrms.controller;
import com.daqing.financial.hrms.EmployeeControllerApi; import com.daqing.financial.hrms.EmployeeControllerApi;
import com.daqing.financial.hrms.service.EmployeeService; import com.daqing.financial.hrms.service.EmployeeService;
import com.daqing.framework.domain.hrms.EmployeeEntity; import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.framework.domain.hrms.ext.EmployeeTO;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -82,7 +83,7 @@ public class EmployeeController implements EmployeeControllerApi{
@GetMapping("/getEmployeeAndDeptById/{ids}") @GetMapping("/getEmployeeAndDeptById/{ids}")
@Override @Override
public ResponseResult getEmployeeAndDeptById(@PathVariable("ids") List<Long> ids) { public ResponseResult getEmployeeAndDeptById(@PathVariable("ids") List<Long> ids) {
List<EmployeeTO> byId = employeeService.getEmployeeAndDeptById(ids);
return ResponseResult.SUCCESS(employeeService.getEmployeeAndDeptById(ids)); return new ResponseResult<List<EmployeeTO>>().SUCCESS(byId);
} }
} }

@ -15,7 +15,7 @@ import lombok.ToString;
@ToString @ToString
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class ResponseResult { public class ResponseResult<T> {
/** /**
* 操作是否成功 * 操作是否成功
*/ */
@ -29,7 +29,7 @@ public class ResponseResult {
/** /**
* 返回的数据 * 返回的数据
*/ */
private Object data; private T data;
/** /**
* 提示信息 * 提示信息
@ -52,8 +52,8 @@ public class ResponseResult {
return new ResponseResult(CommonCode.SUCCESS); return new ResponseResult(CommonCode.SUCCESS);
} }
public static ResponseResult SUCCESS(Object obj) { public ResponseResult SUCCESS(T t) {
return new ResponseResult(true, 10000, obj, "操作成功!"); return new ResponseResult<>(true, 10000, t, "操作成功!");
} }
public static ResponseResult FAIL() { public static ResponseResult FAIL() {

Loading…
Cancel
Save