Commit fd178bdd by huang

111

parent 39fc1461
......@@ -11,7 +11,10 @@ import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
public interface StaffApiService {
public StaffDTO selectById(String staffId);
public List<StaffDTO> listByIds(List<String> staffIds);
public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber);
public HaobanResponse add(StaffDTO staff, String departmentIds);
......
package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
......@@ -21,6 +22,8 @@ public interface StaffMapper {
int updateByPrimaryKey(TabHaobanStaff record);
TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber);
List<TabHaobanStaff> listByIds(@Param("staffIds")List<String> staffIds);
Page<TabHaobanStaff> pageStaff(@Param("staffIds")Set<String> staffIds, @Param("activeFlag")Integer activeFlag, @Param("keyword")String keyword);
}
\ No newline at end of file
package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -8,6 +9,8 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
......@@ -17,6 +20,7 @@ import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
......@@ -28,7 +32,8 @@ public class StaffApiServiceImpl implements StaffApiService {
@Autowired
StaffService staffService;
@Autowired
StaffMapper staffMapper;
@Autowired
StaffDepartmentRelatedService staffDepartmentRelatedService;
......@@ -92,4 +97,16 @@ public class StaffApiServiceImpl implements StaffApiService {
return PageUtil.changePageHelperToCurrentPage(staffService.pageStaff(staffIds, activeFlag, keyword),StaffDTO.class);
}
@Override
public List<StaffDTO> listByIds(List<String> staffIds) {
List<TabHaobanStaff> staffs = staffMapper.listByIds(staffIds);
if(CollectionUtil.isNotEmpty(staffs)){
List<StaffDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDTO.class, staffs);
return resultList;
}else{
return new ArrayList<StaffDTO>();
}
}
}
......@@ -225,4 +225,17 @@
</foreach>
</if>
</select>
<select id="listByIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff
where status_flag = 1
<if test="staffIds != null and staffIds.size() > 0">
and staff_id IN
<foreach collection="staffIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
package com.gic.haoban.manage.web.controller;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.clerk.api.service.ClerkService;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
@RestController
public class ClerkController extends WebBaseController{
@Autowired
private ClerkService clerkService;
@Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
//成员绑定
@RequestMapping("/staff-bind")
public HaobanResponse staffBind(String clerkCode,String staffDepartmentRelatedId) {
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
dto.setStaffDepartmentRelatedId(staffDepartmentRelatedId);
dto.setClerkCode(clerkCode);
dto.setUpdateTime(new Date());
staffDepartmentRelatedApiService.updateById(dto);
return resultResponse(HaoBanErrCode.ERR_1);
}
//成员换绑定
@RequestMapping("/clerk-unbind")
public HaobanResponse clerkUnbind(String clerkCode,String staffDepartmentRelatedId) {
StaffDepartmentRelatedDTO one = staffDepartmentRelatedApiService.getOneByClerkCode(clerkCode);
if(one != null){
//存在,则先置空
one.setClerkCode(null);
one.setUpdateTime(new Date());
staffDepartmentRelatedApiService.deleteCode(one);
}
//不存在,则更新
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
dto.setStaffDepartmentRelatedId(staffDepartmentRelatedId);
dto.setClerkCode(clerkCode);
dto.setUpdateTime(new Date());
staffDepartmentRelatedApiService.updateById(dto);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
......@@ -15,7 +15,9 @@ import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.ClerkVo;
......@@ -25,6 +27,8 @@ public class ClerkController extends WebBaseController{
@Autowired
private ClerkService clerkService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
@RequestMapping("/clerk-list")
......@@ -66,6 +70,15 @@ public class ClerkController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1,result);
}
//选择成员列表
@RequestMapping("/staff-list")
public HaobanResponse staffList(String departmentId) {
List<StaffDepartmentRelatedDTO> list = staffDepartmentRelatedApiService.listByDepartmentId(departmentId);
List<String> staffIds = list.stream().map(s->s.getStaffId()).collect(Collectors.toList());
List<StaffDTO> resultlist= staffApiService.listByIds(staffIds);
return resultResponse(HaoBanErrCode.ERR_1,resultlist);
}
//成员绑定
@RequestMapping("/staff-bind")
public HaobanResponse staffBind(String clerkCode,String staffDepartmentRelatedId) {
......
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