业务申请列表,据userId获取用户名以及部门名称

master
shijie 4 years ago
parent 1ad7ec0366
commit 10177e0a23
  1. 42
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgApplyAmountInfoController.java
  2. 8
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/HrmsFeignService.java
  3. 4
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgApplyAmountInfoMapper.java
  4. 24
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/BusinessApplicationListResponse.java
  5. 2
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgApplyAmountInfoService.java
  6. 4
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgApplyAmountInfoServiceImpl.java
  7. 13
      dq-financial-guarantee/src/main/resources/mapper/guarantee/DgApplyAmountInfoMapper.xml
  8. 13
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java
  9. 4
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java
  10. 4
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java
  11. 7
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java
  12. 9
      dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml
  13. 36
      dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/response/EmployeeMessageResponse.java

@ -3,21 +3,25 @@ package com.daqing.financial.guarantee.controller;
import com.daqing.financial.guarantee.DgApplyAmountInfoControllerApi;
import com.daqing.financial.guarantee.feign.CrmsFeignService;
import com.daqing.financial.guarantee.feign.HrmsFeignService;
import com.daqing.financial.guarantee.model.request.BusinessApplicationRequest;
import com.daqing.financial.guarantee.model.response.BusinessApplicationListResponse;
import com.daqing.financial.guarantee.service.IDgApplyAmountInfoService;
import com.daqing.framework.domain.crms.request.DgApplyAmountInfoRequest;
import com.daqing.framework.domain.guarantee.DgApplyAmountInfo;
import com.daqing.framework.domain.guarantee.response.EmployeeMessageResponse;
import com.daqing.framework.model.response.PromptSuccess;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.util.RedisUtil;
import com.daqing.framework.utils.PageUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -47,6 +51,9 @@ public class DgApplyAmountInfoController implements DgApplyAmountInfoControllerA
@Autowired
private IDgApplyAmountInfoService applyAmountInfoService;
@Resource
private HrmsFeignService hrmsFeignService;
/**
* 根据客户编号/客户名称获取企业信息
* @param applyAmountInfo
@ -143,19 +150,40 @@ public class DgApplyAmountInfoController implements DgApplyAmountInfoControllerA
*/
@PostMapping("/businessApplicationList")
@ApiOperation(value = "业务申请列表")
public ResponseResult businessApplicationList(@RequestParam("page") Integer page,@RequestParam("size") Integer size
/* @RequestParam(value = "CustomerNumberOrName", required = false) String CustomerNumberOrName*/){
PageUtils data = applyAmountInfoService.queryPage(page, size);
public ResponseResult businessApplicationList(@RequestParam("page") Integer page,@RequestParam("size") Integer size,
@RequestParam(value = "CustomerNumberOrName", required = false) String CustomerNumberOrName){
//获取当前登录用户id
String userId = null;
try{
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String token = request.getHeader("token");
userId = RedisUtil.get("dq:token:"+token);
System.out.println(userId);
} catch (Exception e) {
e.printStackTrace();
}
//根据userId获取用户名以及部门名称
ResponseResult<EmployeeMessageResponse> employeeMessage = hrmsFeignService.getAccountAndDeptNameById(Long.valueOf(userId));
PageUtils data = applyAmountInfoService.queryPage(page, size,CustomerNumberOrName);
//遍历data里面的数据提单人id,找出匹配id,将用户名以及部门名称赋值进去
List<BusinessApplicationListResponse> list = (List<BusinessApplicationListResponse>) data.getList();
for (BusinessApplicationListResponse response:list) {
if(response.getPresenterId().equals(employeeMessage.getData().getId())){//如果userId相同情况下,就往对象里面赋值
response.setAccount(employeeMessage.getData().getAccount());
response.setDeptName(employeeMessage.getData().getDeptName());
}
}
return new ResponseResult<PageUtils>().SUCCESS(data);
}
/**
* 业务申请列表
* 业务申请列表测试
* @param
* @return
*/
@PostMapping("/businessApplicationList2")
@ApiOperation(value = "业务申请列表")
public ResponseResult businessApplicationList2(){
List<DgApplyAmountInfo> data = applyAmountInfoService.selectList();
return new ResponseResult().SUCCESS(data);

@ -1,5 +1,6 @@
package com.daqing.financial.guarantee.feign;
import com.daqing.framework.domain.guarantee.response.EmployeeMessageResponse;
import com.daqing.framework.domain.hrms.ext.EmployeeTO;
import com.daqing.framework.domain.hrms.ext.EmployeeVO;
import com.daqing.framework.model.response.ResponseResult;
@ -8,7 +9,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
/**
* 这是一个声明式的远程调用
@ -33,4 +33,10 @@ public interface HrmsFeignService {
*/
@GetMapping("/hrms/dept/listEmployeeByDeptId")
ResponseResult<List<EmployeeVO>> listEmployeeByDeptId(@RequestParam("deptId") Long deptId);
/**
* 根据userId获取用户名以及部门名称
*/
@GetMapping("hrms/employee/getAccountAndDeptNameById")
ResponseResult<EmployeeMessageResponse> getAccountAndDeptNameById(@RequestParam("userId") Long userId);
}

@ -21,9 +21,7 @@ import java.util.List;
@Mapper
public interface DgApplyAmountInfoMapper extends BaseMapper<DgApplyAmountInfo> {
//IPage<DgApplyAmountInfo> pageByCondition(Page page, @Param("queryMsg")String queryMsg);
IPage<DgApplyAmountInfo> pageByCondition(Page page);
IPage<BusinessApplicationListResponse> pageByCondition(Page page, @Param("CustomerNumberOrName")String CustomerNumberOrName);
List<DgApplyAmountInfo> selectAmountList();
}

@ -63,5 +63,29 @@ public class BusinessApplicationListResponse implements Serializable {
@ApiModelProperty(value = "业务编号")
private String businessCode;
/**
* 客户名称
*/
@ApiModelProperty(value = "客户名称")
private String name;
/**
* 联系电话
*/
@ApiModelProperty(value = "联系电话")
private String phone;
/**
* 提单人
*/
@ApiModelProperty(value = "提单人")
private String account;
/**
* 部门名称
*/
@ApiModelProperty(value = "部门名称")
private String deptName;
}

@ -19,7 +19,7 @@ public interface IDgApplyAmountInfoService extends IService<DgApplyAmountInfo> {
int businessApplication(BusinessApplicationRequest businessApplication);
PageUtils queryPage(Integer page, Integer size);
PageUtils queryPage(Integer page, Integer size, String CustomerNumberOrName);
List<DgApplyAmountInfo> selectList();
}

@ -99,7 +99,7 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
}
@Override
public PageUtils queryPage(Integer page, Integer size) {
public PageUtils queryPage(Integer page, Integer size, String CustomerNumberOrName) {
//分页参数
if (page <= 0) {
page = 1;
@ -107,7 +107,7 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
if (size <= 0) {
size = 10;
}
IPage<DgApplyAmountInfo> positionVO = this.getBaseMapper().pageByCondition(new Page(page, size));
IPage<BusinessApplicationListResponse> positionVO = this.getBaseMapper().pageByCondition(new Page(page, size),CustomerNumberOrName);
return new PageUtils(positionVO);
}

@ -17,18 +17,19 @@
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- <select id="pageByCondition" resultType="com.daqing.financial.guarantee.model.response.BusinessApplicationListResponse">
<select id="pageByCondition" resultType="com.daqing.financial.guarantee.model.response.BusinessApplicationListResponse">
select ai.company_id,ai.presenter_id,ai.business_code,ai.business_type,ai.apply_amount,ai.apply_time,ai.create_time,
ai.status,cc.name,cc.phone
from dg_apply_amount_info ai
left join crms_company_customer ccl on ai.company_id = ccl.id
left join crms_customer cc on cc.id = ccl.customer_id
</select>-->
<select id="pageByCondition" resultMap="BaseResultMap">
select *
from dg_apply_amount_info
<where>
<if test="CustomerNumberOrName != null and CustomerNumberOrName != ''">
AND ai.business_code LIKE CONCAT('%',#{CustomerNumberOrName},'%') OR cc.name LIKE CONCAT('%',#{CustomerNumberOrName},'%')
</if>
</where>
</select>
<select id="selectAmountList" resultMap="BaseResultMap">
select *
from dg_apply_amount_info

@ -4,6 +4,7 @@ package com.daqing.financial.hrms.controller;
import com.daqing.financial.hrms.EmployeeControllerApi;
import com.daqing.financial.hrms.service.EmployeeService;
import com.daqing.framework.domain.crms.request.EmployeeDisableRequest;
import com.daqing.framework.domain.guarantee.response.EmployeeMessageResponse;
import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.framework.domain.hrms.UserEntity;
import com.daqing.framework.domain.hrms.ext.EmployeeInfoVO;
@ -21,7 +22,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -230,4 +230,15 @@ public class EmployeeController implements EmployeeControllerApi {
public ResponseResult getEmployeeByUserId(@RequestParam("userId") Long userId) {
return new ResponseResult<EmployeeEntity>().SUCCESS(employeeService.getEmployeeByUserId(userId));
}
/**
* 根据userId获取用户名以及部门名称
* @param userId
* @return
*/
@GetMapping("/getAccountAndDeptNameById")
public ResponseResult getAccountAndDeptNameById(@RequestParam("userId") Long userId) {
return new ResponseResult<EmployeeMessageResponse>().SUCCESS(employeeService.getAccountAndDeptNameById(userId));
}
}

@ -2,11 +2,13 @@ package com.daqing.financial.hrms.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.daqing.framework.domain.guarantee.response.EmployeeMessageResponse;
import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.daqing.framework.domain.hrms.UserEntity;
import com.daqing.framework.domain.hrms.ext.*;
import com.daqing.framework.domain.hrms.request.EmployeeRequest;
import com.daqing.framework.model.response.ResponseResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -90,4 +92,6 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
Integer employeeJobNumberCount(String jobNumber);
EmployeeRepetition getEmployeeRepetitionByEmpId(Long empId);
EmployeeMessageResponse getAccountAndDeptNameById(Long userId);
}

@ -2,6 +2,7 @@ package com.daqing.financial.hrms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.daqing.framework.domain.crms.request.EmployeeDisableRequest;
import com.daqing.framework.domain.guarantee.response.EmployeeMessageResponse;
import com.daqing.framework.domain.hrms.UserEntity;
import com.daqing.framework.domain.hrms.ext.EmployeeAndUserVO;
import com.daqing.framework.domain.hrms.ext.EmployeeInfoVO;
@ -9,6 +10,7 @@ import com.daqing.framework.domain.hrms.ext.EmployeeTO;
import com.daqing.framework.domain.hrms.ext.EmployeeVO;
import com.daqing.framework.domain.hrms.request.EmployeeRequest;
import com.daqing.framework.domain.hrms.response.RolePermissionResponse;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.domain.hrms.EmployeeEntity;
import org.springframework.web.multipart.MultipartFile;
@ -60,5 +62,7 @@ public interface EmployeeService extends IService<EmployeeEntity> {
Boolean excelImport(MultipartFile file);
EmployeeEntity getEmployeeByUserId(Long userId);
EmployeeMessageResponse getAccountAndDeptNameById(Long userId);
}

@ -7,6 +7,7 @@ import com.daqing.financial.hrms.dao.*;
import com.daqing.financial.hrms.service.EmployeeService;
import com.daqing.framework.domain.crms.request.EmployeeDisableRequest;
import com.daqing.framework.domain.crms.response.CrmsCode;
import com.daqing.framework.domain.guarantee.response.EmployeeMessageResponse;
import com.daqing.framework.domain.hrms.*;
import com.daqing.framework.domain.hrms.ext.*;
import com.daqing.framework.domain.hrms.request.EmployeeRequest;
@ -15,6 +16,7 @@ import com.daqing.framework.domain.hrms.response.RolePermissionResponse;
import com.daqing.framework.exception.ExceptionCast;
import com.daqing.framework.model.response.CommonCode;
import com.daqing.framework.model.response.PromptSuccess;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.util.Md5Util;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.utils.excel.ExcelUtil;
@ -587,4 +589,9 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
public EmployeeEntity getEmployeeByUserId(Long userId) {
return this.getBaseMapper().getEmployeeEntityByUserId(userId);
}
@Override
public EmployeeMessageResponse getAccountAndDeptNameById(Long userId) {
return this.getBaseMapper().getAccountAndDeptNameById(userId);
}
}

@ -502,4 +502,13 @@
AND e.id = #{empId}
</select>
<select id="getAccountAndDeptNameById" parameterType="long" resultType="com.daqing.framework.domain.guarantee.response.EmployeeMessageResponse">
select hu.id, hu.account, GROUP_CONCAT(hd.`name` SEPARATOR '/')deptName
from hrms_employee_dept ed
LEFT JOIN hrms_dept hd on hd.id=ed.dept_id
LEFT JOIN hrms_employee he on he.id=ed.employee_id
LEFT JOIN hrms_user hu on hu.id = he.user_id
where hu.id=#{userId}
</select>
</mapper>

@ -0,0 +1,36 @@
package com.daqing.framework.domain.guarantee.response;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
public class EmployeeMessageResponse implements Serializable {
/**
* 主键id
*/
@ApiModelProperty(value = "userId")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 员工账号
*/
@ApiModelProperty(value = "员工账号")
private String account;
/**
* 部门名称
*/
@ApiModelProperty(value = "部门名称")
private String deptName;
}
Loading…
Cancel
Save