Commit 10e655d5 by qwmqiuwenmin

fix

parent ddb403b4
......@@ -82,7 +82,7 @@ public interface DepartmentApiService {
* 回收站恢复
* @param departmentId
*/
HaobanResponse repairRecycle(String departmentId);
HaobanResponse repairRecycle(String departmentId,String parentId);
/**
* 获取根节点
* @param wxEnterpriseId
......
......@@ -26,7 +26,7 @@ public interface DepartmentService {
Page<TabHaobanDepartment> pageDepartmentByParams(String wxEnterpriseId, String keyword, Integer storeFlag, Integer recycleFlag);
void repairRecycle(String departmentId);
void repairRecycle(TabHaobanDepartment tab);
DepartmentDTO getRootByEnterpriseId(String wxEnterpriseId);
......
......@@ -108,8 +108,7 @@ public class DepartmentServiceImpl implements DepartmentService {
}
@Override
public void repairRecycle(String departmentId) {
TabHaobanDepartment tab = mapper.selectByPrimaryKey(departmentId);
public void repairRecycle(TabHaobanDepartment tab) {
if(tab != null) {
tab.setRecycleFlag(0);
tab.setUpdateTime(new Date());
......
......@@ -89,7 +89,6 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(department.getWxEnterpriseId());
TabHaobanWxApplication application = wxApplicationService.selectByWxEnterpriseIdAndApplicationType(department.getWxEnterpriseId(),1);
logger.info("【部门新增】enterpriseDTO = {}",JSON.toJSONString(enterpriseDTO));
logger.info("【部门新增】application = {}",JSON.toJSONString(application));
if(enterpriseDTO != null) {
if(application != null) {
com.gic.wechat.api.dto.qywx.DepartmentDTO dto = new com.gic.wechat.api.dto.qywx.DepartmentDTO();
......@@ -198,6 +197,21 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
public HaobanResponse recycle(String departmentId) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(1);
//调微信的新增接口
TabHaobanDepartment department = departmentService.selectById(departmentId);
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(department.getWxEnterpriseId());
TabHaobanWxApplication application = wxApplicationService.selectByWxEnterpriseIdAndApplicationType(department.getWxEnterpriseId(),1);
if(enterpriseDTO != null) {
if(application != null) {
JSONResponse jp = qywxDepartmentApiService.deleteDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), Integer.parseInt(department.getWxDepartmentId()));
if(jp.getErrorCode() != 0) {
hr.setErrorCode(0);
hr.setMessage("微信删除部门失败");
return hr;
}
}
}
departmentService.recycle(departmentId);
return hr;
}
......@@ -210,10 +224,39 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
@Override
public HaobanResponse repairRecycle(String departmentId) {
public HaobanResponse repairRecycle(String departmentId,String parentId) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(0);
departmentService.repairRecycle(departmentId);
TabHaobanDepartment tab = departmentService.selectById(departmentId);
//调微信的新增接口
String wxDepartmentId = "";
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(tab.getWxEnterpriseId());
TabHaobanWxApplication application = wxApplicationService.selectByWxEnterpriseIdAndApplicationType(tab.getWxEnterpriseId(),1);
logger.info("【部门新增】enterpriseDTO = {}",JSON.toJSONString(enterpriseDTO));
if(enterpriseDTO != null) {
if(application != null) {
com.gic.wechat.api.dto.qywx.DepartmentDTO dto = new com.gic.wechat.api.dto.qywx.DepartmentDTO();
dto.setCorpid(enterpriseDTO.getCorpid());
dto.setName(tab.getDepartmentName());
dto.setOrder(tab.getSort());
TabHaobanDepartment parent = departmentService.selectById(parentId);
dto.setParentid(Integer.valueOf(parent.getWxDepartmentId()));
logger.info("【部门新增】corpid() = {},siteId={},dto={}",enterpriseDTO.getCorpid(),application.getSiteId(),JSON.toJSONString(dto));
JSONResponse jp = qywxDepartmentApiService.createDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), dto);
logger.info("【部门新增】jp = {}",JSON.toJSONString(jp));
if(jp.getErrorCode() != 0) {
hr.setErrorCode(0);
hr.setMessage("微信新增部门失败");
return hr;
}
wxDepartmentId = jp.getResult().toString();
tab.setWxDepartmentId(wxDepartmentId);
tab.setParentDepartmentId(parentId);
logger.info("【部门新增】wxDepartmentId = {}",wxDepartmentId);
}
}
departmentService.repairRecycle(tab);
return hr;
}
......
......@@ -339,12 +339,12 @@ public class DepartmentContoller extends WebBaseController{
}
@RequestMapping("department-repair")
public HaobanResponse departmentRepair(String departmentId) {
public HaobanResponse departmentRepair(String departmentId,String parentId) {
DepartmentDTO dto = departmentApiService.selectById(departmentId);
if(dto == null || dto.getStatusFlag() == 0) {
return resultResponse(HaoBanErrCode.ERR_10003);
}
departmentApiService.repairRecycle(departmentId);
departmentApiService.repairRecycle(departmentId,parentId);
return resultResponse(HaoBanErrCode.ERR_1);
}
......
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