Commit 32080dba by huangZW

Merge branch 'developer' of http://115.159.76.241/haoban3.0/haoban-manage3.0.git into developer

parents 6d435e5c c4e20d48
......@@ -99,5 +99,12 @@ public interface DepartmentApiService {
* @param fieldListString
*/
void syncGicDepartment(String fieldListString);
/**
* 分页查询
* @param parentId
* @param pageInfo
* @return
*/
Page<DepartmentDTO> pageByParentId(String parentId,String keyword, BasePageInfo pageInfo);
}
......@@ -85,8 +85,13 @@
<artifactId>haoban-message-api</artifactId>
<version>${haoban-message-api}</version>
</dependency>
</dependencies>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-wechat-api</artifactId>
<version>${gic-wechat-api}</version>
</dependency>
</dependencies>
<build>
<finalName>haoban-manage3-service</finalName>
......
......@@ -39,4 +39,6 @@ public interface DepartmentMapper {
Page<TabHaobanDepartment> pageFullStoreByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId,@Param("search")String search,@Param("minCount")int minCount);
TabHaobanDepartment getByRelatedId(@Param("relatedId")String relatedId);
Page<TabHaobanDepartment> pageByParentId(@Param("parentId")String parentId, @Param("keyword")String keyword);
}
\ No newline at end of file
......@@ -30,4 +30,6 @@ public interface DepartmentService {
DepartmentDTO getByRelatedId(String storeId);
Page<TabHaobanDepartment> pageByParentId(String parentId, String keyword);
}
......@@ -6,4 +6,6 @@ public interface WxEnterpriseService {
String add(WxEnterpriseDTO wxDTO);
WxEnterpriseDTO selectById(String wxEnterpriseId);
}
......@@ -116,4 +116,9 @@ public class DepartmentServiceImpl implements DepartmentService {
return EntityUtil.changeEntityByJSON(DepartmentDTO.class, tab);
}
@Override
public Page<TabHaobanDepartment> pageByParentId(String parentId, String keyword) {
return mapper.pageByParentId(parentId,keyword);
}
}
......@@ -28,4 +28,10 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
}
@Override
public WxEnterpriseDTO selectById(String wxEnterpriseId) {
//TabHaobanWxEnterprise wx
return null;
}
}
......@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONArray;
import com.gic.api.base.commons.JSONResponse;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
......@@ -20,6 +21,7 @@ import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.contacts.manage.api.dto.SyncJsonColumnDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.service.dao.mapper.DepartmentMapper;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
......@@ -27,6 +29,8 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
import com.github.pagehelper.PageHelper;
@Service
......@@ -45,6 +49,12 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
@Autowired
private com.gic.enterprise.api.service.DepartmentService gicDepartmentService;
@Autowired
private QywxDepartmentApiService qywxDepartmentApiService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Override
public List<DepartmentDTO> listByParentId(String parentId) {
......@@ -65,15 +75,20 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
hr.setErrorCode(1);
//调微信的新增接口
String wxDepartmentId = "";
if(StringUtils.isBlank(wxDepartmentId)) {
hr.setErrorCode(0);
hr.setMessage("微信新增部门失败");
return hr;
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(department.getWxEnterpriseId());
if(enterpriseDTO != null) {
//JSONResponse jp = qywxDepartmentApiService.createDepartment(enterpriseDTO.getCorpid(), enterpriseDTO.getsi, departmentDTO);
if(StringUtils.isBlank(wxDepartmentId)) {
hr.setErrorCode(0);
hr.setMessage("微信新增部门失败");
return hr;
}
department.setWxDepartmentId(wxDepartmentId);
String departmentId = departmentService.add(department);
department.setDepartmentId(departmentId);
hr.setResult(department);
}
department.setWxDepartmentId(wxDepartmentId);
String departmentId = departmentService.add(department);
department.setDepartmentId(departmentId);
hr.setResult(department);
return hr;
}
......@@ -244,4 +259,10 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
@Override
public Page<DepartmentDTO> pageByParentId(String parentId,String keyword, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
return PageUtil.changePageHelperToCurrentPage(departmentService.pageByParentId(parentId,keyword),DepartmentDTO.class);
}
}
......@@ -30,4 +30,6 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.WxEnterpriseApiService" ref="wxEnterpriseApiServiceImpl" timeout="10000" />
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxDepartmentApiService" id="qywxDepartmentApiService"/>
</beans>
\ No newline at end of file
......@@ -307,4 +307,19 @@
and status_flag = 1
</select>
<select id="pageByParentId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
<if test="parentId != null and parentId != ''">
and parent_department_id = #{parentId}
</if>
<if test="keyword != null and keyword != ''">
and (department_name like CONCAT('%',#{keyWord},'%') or department_id like CONCAT('%',#{keyWord},'%'))
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -3,7 +3,6 @@ package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
......@@ -11,7 +10,6 @@ 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.JSONArray;
import com.gic.api.base.commons.Page;
......@@ -26,14 +24,11 @@ import com.gic.haoban.manage.web.anno.IgnoreLogin;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.DepartmentAddQO;
import com.gic.haoban.manage.web.qo.DepartmentEditQO;
import com.gic.haoban.manage.web.utils.ListUtils;
import com.gic.haoban.manage.web.vo.LoginVO;
import com.gic.haoban.manage.web.vo.StoreVo;
......@@ -47,7 +42,33 @@ public class DepartmentContoller extends WebBaseController{
@Autowired
private StoreService storeService;
@RequestMapping("department-list")
public HaobanResponse departmentList(String parentId) {
public HaobanResponse departmentList(String parentId,BasePageInfo pageInfo,String keyword) {
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
String wxEnterpriseId = login.getWxEnterpriseId();
Page<DepartmentDTO> page = new Page<DepartmentDTO>();
List<DepartmentDTO> list = new ArrayList<DepartmentDTO>();
if(StringUtils.isNotBlank(parentId)) {
page = departmentApiService.pageByParentId(parentId,keyword,pageInfo);
}else {
DepartmentDTO dto = departmentApiService.getRootByEnterpriseId(wxEnterpriseId);
list.add(dto);
page.setTotalPage(1);
page.setTotalCount(1);
page.setResult(list);
}
PageResult<DepartmentDTO> pageVo = new PageResult<>();
pageVo.setList(page.getResult());
pageVo.setPageNum(page.getCurrentPage());
pageVo.setPages(page.getPages());
pageVo.setPageSize(page.getPageSize());
pageVo.setTotal(page.getTotalCount());
return resultResponse(HaoBanErrCode.ERR_1,pageVo);
}
@RequestMapping("department-level-list")
public HaobanResponse departmentLevelList(String parentId) {
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
String wxEnterpriseId = login.getWxEnterpriseId();
List<DepartmentDTO> list = new ArrayList<DepartmentDTO>();
......@@ -74,7 +95,7 @@ public class DepartmentContoller extends WebBaseController{
DepartmentDTO department = new DepartmentDTO();
department.setParentDepartmentId(parentId);
department.setDepartmentName(departmentName);
department.setWxEnterpriseId(dto.getWxDepartmentId());
department.setWxEnterpriseId(dto.getWxEnterpriseId());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setIsStore(0);
departmentApiService.add(department);
......
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