Commit 42f60320 by huangZW

新增接口,staff信息

parent 88983819
......@@ -56,4 +56,6 @@ public interface StaffApiService {
public String insertUserLoginLog(UserLoginLogDTO userLoginLogDTO);
public int countByDepartmentIds(List<String> departmentIds);
public List<StaffDTO> listByPhoneNumber(String phoneNumber);
}
......@@ -32,4 +32,6 @@ public interface StaffMapper {
TabHaobanStaff selectByUserIdAndEnterpriseId(@Param("userId")String userId,@Param("wxEnterpriseId")String wxEnterpriseId);
TabHaobanStaff selectSuperByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
List<TabHaobanStaff> listByPhoneNumber(@Param("phoneNumber")String phoneNumber);
}
\ No newline at end of file
......@@ -91,6 +91,11 @@ public class StaffApiServiceImpl implements StaffApiService {
TabHaobanStaff staff = staffService.selectById(staffId);
return EntityUtil.changeEntityByJSON(StaffDTO.class, staff);
}
@Override
public List<StaffDTO> listByPhoneNumber(String phoneNumber) {
List<TabHaobanStaff> staffs = staffMapper.listByPhoneNumber(phoneNumber);
return EntityUtil.changeEntityListByJSON(StaffDTO.class, staffs);
}
@Override
public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber) {
......
......@@ -251,6 +251,14 @@
and status_flag = 1
</select>
<select id="listByPhoneNumber" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff
where phone_number = #{phoneNumber}
and status_flag = 1
</select>
<select id="pageStaff" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
......
package com.gic.haoban.manage.web.controller;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.UserLoginLogDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.interceptor.WebInterceptor;
import com.gic.haoban.manage.web.vo.AppStaffVo;
import com.gic.haoban.manage.web.vo.InfoVo;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
......@@ -81,4 +92,24 @@ public class InfoController extends WebBaseController{
}
@RequestMapping("get-staff-info")
public HaobanResponse getStaffInfo(String phoneNumber) {
if (StringUtils.isBlank(phoneNumber)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
List<StaffDTO> list = staffApiService.listByPhoneNumber(phoneNumber);
if(CollectionUtil.isNotEmpty(list)){
List<AppStaffVo> staffs = EntityUtil.changeEntityListByJSON(AppStaffVo.class, list);
Set<String> wxEnterpriseIds = list.stream().map(s->s.getWxEnterpriseId()).collect(Collectors.toSet());
List<YwWxEnterpriseDTO> enterprises = wxEnterpriseApiService.listByIds(wxEnterpriseIds);
Map<String,YwWxEnterpriseDTO> map = com.gic.commons.util.CollectionUtil.toMap(enterprises, "wxEnterpriseId");
for(AppStaffVo vo:staffs){
String wxEnterpriseId = vo.getWxEnterpriseId();
String corpName = map.get(wxEnterpriseId) == null?"":map.get(wxEnterpriseId).getCorpName();
vo.setWxEnterpriseName(corpName);
}
}
return resultResponse(HaoBanErrCode.ERR_1,list);
}
}
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
/**
* Created 2018/10/22.
*
* @author hua
*/
public class AppStaffVo implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String staffId;
private String staffName;
private String nationCode;
private String phoneNumber;
private String wxEnterpriseId;
private String wxEnterpriseName;
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getNationCode() {
return nationCode;
}
public void setNationCode(String nationCode) {
this.nationCode = nationCode;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getWxEnterpriseName() {
return wxEnterpriseName;
}
public void setWxEnterpriseName(String wxEnterpriseName) {
this.wxEnterpriseName = wxEnterpriseName;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment