Commit 41fca5e1 by qwmqiuwenmin

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

parents 8b9a7887 4b19e745
......@@ -43,4 +43,5 @@ public interface StaffApiService {
StaffDepartmentRelatedDTO getDepartmentIdAndCode(String departmentId, String code);
void initWxUser(String corpid, String suiteid, String wxEnterpriseId, Integer wxDepartmentId);
}
......@@ -9,6 +9,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.manage.api.service.StaffApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......@@ -49,32 +50,26 @@ import com.github.pagehelper.PageHelper;
public class DepartmentApiServiceImpl implements DepartmentApiService {
private static Logger logger = LoggerFactory.getLogger(DepartmentApiServiceImpl.class);
@Autowired
private DepartmentService departmentService;
@Autowired
private StaffDepartmentRelatedService staffDepartmentService;
@Autowired
private DepartmentMapper departmentMapper;
@Autowired
private com.gic.enterprise.api.service.DepartmentService gicDepartmentService;
@Autowired
private QywxDepartmentApiService qywxDepartmentApiService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Autowired
private WxApplicationService wxApplicationService;
@Autowired
private StoreService storeService;
@Autowired
private StoreGroupService storeGroupService;
@Autowired
private StaffApiService staffApiService;
@Override
......@@ -480,12 +475,13 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listDepartment(corpid, suiteid, null);
logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
if(CollectionUtils.isNotEmpty(list)){
this.addAllDepartment(list, 0, wxEnterpriseId);
this.addAllDepartment(list, 0, wxEnterpriseId, corpid, suiteid);
}
}
private void addAllDepartment(List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list, Integer parentId, String wxEnterpriseId){
private void addAllDepartment(List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list, Integer parentId,
String wxEnterpriseId, String corpid, String suiteid){
int level = 1;
String chainId = "0";
String chainName = "0";
......@@ -515,7 +511,8 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
dto.setIsStore(0);
this.departmentService.add(dto);
}
this.addAllDepartment(list, departmentDTO.getId(), wxEnterpriseId);
this.addAllDepartment(list, departmentDTO.getId(), wxEnterpriseId, corpid, suiteid);
this.staffApiService.initWxUser(corpid, suiteid, wxEnterpriseId, departmentDTO.getId());
}
}
}
......
......@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -146,9 +147,6 @@ public class StaffApiServiceImpl implements StaffApiService {
wxUserId = staffId;
}
}
if(StringUtils.isNotBlank(wxUserId)){
String[] departmentIdArr = departmentIds.split(",");
for (String string : departmentIdArr) {
......@@ -165,9 +163,7 @@ public class StaffApiServiceImpl implements StaffApiService {
hr.setErrorCode(0);
hr.setMessage("微信端新增失败");
}
hr.setResult(staffId);
return hr;
}
......@@ -179,7 +175,6 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public Page<StaffDTO> pageStaff(String departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(departmentId);
Set<String> staffIds = new HashSet<String>();
for (TabHaobanStaffDepartmentRelated tabHaobanStaffDepartmentRelated : list) {
......@@ -204,7 +199,6 @@ public class StaffApiServiceImpl implements StaffApiService {
}else{
return new ArrayList<StaffDTO>();
}
}
@Override
......@@ -238,7 +232,6 @@ public class StaffApiServiceImpl implements StaffApiService {
staffEdit(EntityUtil.changeEntityByJSON(StaffDTO.class, staff), departmentIds);
}
}
}
@Override
......@@ -295,10 +288,7 @@ public class StaffApiServiceImpl implements StaffApiService {
}
}
}
}
}
@Override
......@@ -607,7 +597,6 @@ public class StaffApiServiceImpl implements StaffApiService {
}
this.staffEdit(staff, departmentIds);
}
}
}
......@@ -616,4 +605,14 @@ public class StaffApiServiceImpl implements StaffApiService {
return EntityUtil.changeEntityByJSON(StaffDepartmentRelatedDTO.class, staffDepartmentRelatedMapper.getDepartmentIdAndCode(departmentId,code));
}
@Override
public void initWxUser(String corpid, String suiteid, String wxEnterpriseId, Integer wxDepartmentId) {
List<UserDTO> list = this.qywxUserApiService.listDepartmentUser(corpid, suiteid, wxDepartmentId.toString(), 0);
if(CollectionUtils.isNotEmpty(list)){
for(UserDTO dto : list){
this.wxGetAdd(dto.getUserid(), wxEnterpriseId);
}
}
}
}
package com.gic.haoban.manage.web.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.Page;
import com.gic.clerk.api.service.ClerkService;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreSearchDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.PageResult;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
@RestController
@RequestMapping("/store")
public class StoreController extends WebBaseController{
@Autowired
private ClerkService clerkService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private DepartmentApiService departmentApiService;
@Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
@Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired
private StoreService storeService;
//门店列表
@RequestMapping("/find-simple-page")
public HaobanResponse storeList(String enterpriseId,BasePageInfo basePageInfo) {
Page page = new Page<>();
page.setCurrentPage(basePageInfo.getPageNum());
page.setPageSize(basePageInfo.getPageSize());
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
Page<StoreDTO> resultPage = storeService.storeListPage(page, storeSearchDTO);
List<StoreDTO> resultList = resultPage.getResult();
PageResult<StoreDTO> pageVo = new PageResult<>();
pageVo.setList(resultList);
pageVo.setPageNum(page.getCurrentPage());
pageVo.setPages(resultPage.getPages());
pageVo.setPageSize(page.getPageSize());
pageVo.setTotal(resultPage.getTotalCount());
return resultResponse(HaoBanErrCode.ERR_1,pageVo);
}
}
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