Commit 337efa91 by 陶光胜

日志

parent eb9cc1fe
......@@ -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
......@@ -290,10 +283,7 @@ public class StaffApiServiceImpl implements StaffApiService {
}
}
}
}
}
@Override
......@@ -602,7 +592,6 @@ public class StaffApiServiceImpl implements StaffApiService {
}
this.staffEdit(staff, departmentIds);
}
}
}
......@@ -611,4 +600,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);
}
}
}
}
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