Commit 9078ddd0 by qwmqiuwenmin

fix

parent cb82f8ca
...@@ -52,11 +52,6 @@ ...@@ -52,11 +52,6 @@
<artifactId>haoban-base-api</artifactId> <artifactId>haoban-base-api</artifactId>
<version>${haoban-base-api}</version> <version>${haoban-base-api}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-common</artifactId>
<version>${haoban-common}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.gic.haoban.manage.api.dto; package com.gic.haoban.manage.api.dto;
import javax.persistence.criteria.CriteriaBuilder;
import java.io.Serializable; import java.io.Serializable;
/** /**
......
...@@ -4,7 +4,7 @@ import java.util.List; ...@@ -4,7 +4,7 @@ import java.util.List;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
public interface DepartmentApiService { public interface DepartmentApiService {
...@@ -47,19 +47,19 @@ public interface DepartmentApiService { ...@@ -47,19 +47,19 @@ public interface DepartmentApiService {
* @param department * @param department
* @return * @return
*/ */
HaobanResponse add(DepartmentDTO department); ServiceResponse add(DepartmentDTO department);
/** /**
* 修改部门 * 修改部门
* @param department * @param department
* @return * @return
*/ */
HaobanResponse edit(DepartmentDTO department); ServiceResponse edit(DepartmentDTO department);
/** /**
* 删除部门 * 删除部门
* @param departmentId * @param departmentId
* @return * @return
*/ */
HaobanResponse del(String departmentId); ServiceResponse del(String departmentId);
/** /**
* 根据关联id 获取部门 * 根据关联id 获取部门
* @param departId * @param departId
...@@ -71,7 +71,7 @@ public interface DepartmentApiService { ...@@ -71,7 +71,7 @@ public interface DepartmentApiService {
* @param departmentId * @param departmentId
* @return * @return
*/ */
HaobanResponse recycle(String departmentId); ServiceResponse recycle(String departmentId);
/** /**
* 根据参数查询 * 根据参数查询
...@@ -88,7 +88,7 @@ public interface DepartmentApiService { ...@@ -88,7 +88,7 @@ public interface DepartmentApiService {
* 回收站恢复 * 回收站恢复
* @param departmentId * @param departmentId
*/ */
HaobanResponse repairRecycle(String departmentId,String parentId); ServiceResponse repairRecycle(String departmentId,String parentId);
/** /**
* 获取根节点 * 获取根节点
* @param wxEnterpriseId * @param wxEnterpriseId
...@@ -132,13 +132,13 @@ public interface DepartmentApiService { ...@@ -132,13 +132,13 @@ public interface DepartmentApiService {
* @param departmentId * @param departmentId
* @return * @return
*/ */
HaobanResponse wxCallBackDel(String departmentId); ServiceResponse wxCallBackDel(String departmentId);
/** /**
* 微信回调放回收站 * 微信回调放回收站
* @param departmentId * @param departmentId
* @return * @return
*/ */
HaobanResponse wxCallBackrecycle(String departmentId); ServiceResponse wxCallBackrecycle(String departmentId);
/** /**
* 判断节点下面有没有子节点 * 判断节点下面有没有子节点
* @param departmentId * @param departmentId
...@@ -149,6 +149,6 @@ public interface DepartmentApiService { ...@@ -149,6 +149,6 @@ public interface DepartmentApiService {
* gic回调删除部门 * gic回调删除部门
* @param departmentId * @param departmentId
*/ */
HaobanResponse gicDel(String departmentId); ServiceResponse gicDel(String departmentId);
} }
...@@ -4,7 +4,7 @@ import java.util.List; ...@@ -4,7 +4,7 @@ import java.util.List;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.GicClerkDTO; import com.gic.haoban.manage.api.dto.GicClerkDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
...@@ -21,7 +21,7 @@ public interface StaffApiService { ...@@ -21,7 +21,7 @@ public interface StaffApiService {
public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber); public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber);
public HaobanResponse add(StaffDTO staff, String departmentIds); public ServiceResponse add(StaffDTO staff, String departmentIds);
public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId); public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId);
......
...@@ -7,7 +7,6 @@ import com.gic.haoban.base.api.common.BasePageInfo; ...@@ -7,7 +7,6 @@ import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO; import com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO; import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.github.pagehelper.Page;
public interface WxEnterpriseApiService { public interface WxEnterpriseApiService {
......
...@@ -8,6 +8,7 @@ import java.util.Map; ...@@ -8,6 +8,7 @@ import java.util.Map;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.gic.haoban.base.api.common.Constant; import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -27,7 +28,6 @@ import com.gic.enterprise.api.dto.StoreGroupDTO; ...@@ -27,7 +28,6 @@ import com.gic.enterprise.api.dto.StoreGroupDTO;
import com.gic.enterprise.api.service.StoreGroupService; import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.contacts.manage.api.dto.SyncJsonColumnDTO; import com.gic.haoban.contacts.manage.api.dto.SyncJsonColumnDTO;
...@@ -86,9 +86,9 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -86,9 +86,9 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override @Override
public HaobanResponse add(DepartmentDTO department) { public ServiceResponse add(DepartmentDTO department) {
HaobanResponse hr = new HaobanResponse(); ServiceResponse hr = new ServiceResponse();
hr.setErrorCode(1); hr.setCode(1);
//调微信的新增接口 //调微信的新增接口
String wxDepartmentId = ""; String wxDepartmentId = "";
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(department.getWxEnterpriseId()); WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(department.getWxEnterpriseId());
...@@ -112,7 +112,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -112,7 +112,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
JSONResponse jp = qywxDepartmentApiService.createDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), dto); JSONResponse jp = qywxDepartmentApiService.createDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), dto);
logger.info("【部门新增】jp = {}",JSON.toJSONString(jp)); logger.info("【部门新增】jp = {}",JSON.toJSONString(jp));
if(jp.getErrorCode() != 0) { if(jp.getErrorCode() != 0) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("微信新增部门失败"); hr.setMessage("微信新增部门失败");
return hr; return hr;
} }
...@@ -153,14 +153,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -153,14 +153,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override @Override
public HaobanResponse edit(DepartmentDTO department) { public ServiceResponse edit(DepartmentDTO department) {
HaobanResponse hr = new HaobanResponse(); ServiceResponse hr = new ServiceResponse();
hr.setErrorCode(1); hr.setCode(1);
hr.setResult(department); hr.setResult(department);
//调微信的修改接口 //调微信的修改接口
TabHaobanDepartment tab = departmentService.selectById(department.getDepartmentId()); TabHaobanDepartment tab = departmentService.selectById(department.getDepartmentId());
if(tab == null){ if(tab == null){
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("部门不存在"); hr.setMessage("部门不存在");
return hr; return hr;
} }
...@@ -179,7 +179,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -179,7 +179,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
JSONResponse jp = qywxDepartmentApiService.updateDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), dto); JSONResponse jp = qywxDepartmentApiService.updateDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), dto);
logger.info("【部门修改】jp={}",JSON.toJSONString(jp)); logger.info("【部门修改】jp={}",JSON.toJSONString(jp));
if(jp.getErrorCode() != 0) { if(jp.getErrorCode() != 0) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("微信修改部门失败"); hr.setMessage("微信修改部门失败");
return hr; return hr;
} }
...@@ -191,14 +191,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -191,14 +191,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override @Override
public HaobanResponse del(String departmentId) { public ServiceResponse del(String departmentId) {
HaobanResponse hr = new HaobanResponse(); ServiceResponse hr = new ServiceResponse();
hr.setErrorCode(1); hr.setCode(1);
List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId); List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId);
logger.info("【部门删除】list.size={}",list.size()); logger.info("【部门删除】list.size={}",list.size());
if(!list.isEmpty()) { if(!list.isEmpty()) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("存在子部门,删除部门失败"); hr.setMessage("存在子部门,删除部门失败");
return hr; return hr;
} }
...@@ -206,14 +206,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -206,14 +206,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId); List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId);
logger.info("【部门删除】staffList.size={}",staffList.size()); logger.info("【部门删除】staffList.size={}",staffList.size());
if(!staffList.isEmpty()) { if(!staffList.isEmpty()) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("存在成员,删除部门失败"); hr.setMessage("存在成员,删除部门失败");
return hr; return hr;
} }
//调微信的删除接口 //调微信的删除接口
TabHaobanDepartment department = departmentService.selectById(departmentId); TabHaobanDepartment department = departmentService.selectById(departmentId);
if(department == null){ if(department == null){
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("不存在部门,删除部门失败"); hr.setMessage("不存在部门,删除部门失败");
return hr; return hr;
} }
...@@ -223,7 +223,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -223,7 +223,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
if(application != null) { if(application != null) {
JSONResponse jp = qywxDepartmentApiService.deleteDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), Integer.parseInt(department.getWxDepartmentId())); JSONResponse jp = qywxDepartmentApiService.deleteDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), Integer.parseInt(department.getWxDepartmentId()));
if(jp.getErrorCode() != 0) { if(jp.getErrorCode() != 0) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("微信删除部门失败"); hr.setMessage("微信删除部门失败");
return hr; return hr;
} }
...@@ -235,14 +235,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -235,14 +235,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override @Override
public HaobanResponse wxCallBackDel(String departmentId){ public ServiceResponse wxCallBackDel(String departmentId){
HaobanResponse hr = new HaobanResponse(); ServiceResponse hr = new ServiceResponse();
hr.setErrorCode(1); hr.setCode(1);
List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId); List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId);
logger.info("【部门删除】list.size={}",list.size()); logger.info("【部门删除】list.size={}",list.size());
if(!list.isEmpty()) { if(!list.isEmpty()) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("存在子部门,删除部门失败"); hr.setMessage("存在子部门,删除部门失败");
return hr; return hr;
} }
...@@ -250,7 +250,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -250,7 +250,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId); List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId);
logger.info("【部门删除】staffList.size={}",staffList.size()); logger.info("【部门删除】staffList.size={}",staffList.size());
if(!staffList.isEmpty()) { if(!staffList.isEmpty()) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("存在成员,删除部门失败"); hr.setMessage("存在成员,删除部门失败");
return hr; return hr;
} }
...@@ -265,14 +265,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -265,14 +265,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override @Override
public HaobanResponse recycle(String departmentId) { public ServiceResponse recycle(String departmentId) {
HaobanResponse hr = new HaobanResponse(); ServiceResponse hr = new ServiceResponse();
hr.setErrorCode(1); hr.setCode(1);
List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId); List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId);
logger.info("【部门删除】list.size={}",list.size()); logger.info("【部门删除】list.size={}",list.size());
if(!list.isEmpty()) { if(!list.isEmpty()) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("存在子部门,删除部门失败"); hr.setMessage("存在子部门,删除部门失败");
return hr; return hr;
} }
...@@ -280,7 +280,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -280,7 +280,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId); List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId);
logger.info("【部门删除】staffList.size={}",staffList.size()); logger.info("【部门删除】staffList.size={}",staffList.size());
if(!staffList.isEmpty()) { if(!staffList.isEmpty()) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("存在成员,删除部门失败"); hr.setMessage("存在成员,删除部门失败");
return hr; return hr;
} }
...@@ -292,7 +292,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -292,7 +292,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
if(application != null) { if(application != null) {
JSONResponse jp = qywxDepartmentApiService.deleteDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), Integer.parseInt(department.getWxDepartmentId())); JSONResponse jp = qywxDepartmentApiService.deleteDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), Integer.parseInt(department.getWxDepartmentId()));
if(jp.getErrorCode() != 0) { if(jp.getErrorCode() != 0) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("微信删除部门失败"); hr.setMessage("微信删除部门失败");
return hr; return hr;
} }
...@@ -304,14 +304,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -304,14 +304,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override @Override
public HaobanResponse wxCallBackrecycle(String departmentId) { public ServiceResponse wxCallBackrecycle(String departmentId) {
HaobanResponse hr = new HaobanResponse(); ServiceResponse hr = new ServiceResponse();
hr.setErrorCode(1); hr.setCode(1);
List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId); List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId);
logger.info("【部门删除】list.size={}",list.size()); logger.info("【部门删除】list.size={}",list.size());
if(!list.isEmpty()) { if(!list.isEmpty()) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("存在子部门,删除部门失败"); hr.setMessage("存在子部门,删除部门失败");
return hr; return hr;
} }
...@@ -319,7 +319,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -319,7 +319,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId); List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId);
logger.info("【部门删除】staffList.size={}",staffList.size()); logger.info("【部门删除】staffList.size={}",staffList.size());
if(!staffList.isEmpty()) { if(!staffList.isEmpty()) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("存在成员,删除部门失败"); hr.setMessage("存在成员,删除部门失败");
return hr; return hr;
} }
...@@ -336,9 +336,9 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -336,9 +336,9 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override @Override
public HaobanResponse repairRecycle(String departmentId,String parentId) { public ServiceResponse repairRecycle(String departmentId,String parentId) {
HaobanResponse hr = new HaobanResponse(); ServiceResponse hr = new ServiceResponse();
hr.setErrorCode(0); hr.setCode(0);
TabHaobanDepartment tab = departmentService.selectById(departmentId); TabHaobanDepartment tab = departmentService.selectById(departmentId);
//调微信的新增接口 //调微信的新增接口
String wxDepartmentId = ""; String wxDepartmentId = "";
...@@ -357,7 +357,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -357,7 +357,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
JSONResponse jp = qywxDepartmentApiService.createDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), dto); JSONResponse jp = qywxDepartmentApiService.createDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), dto);
logger.info("【部门新增】jp = {}",JSON.toJSONString(jp)); logger.info("【部门新增】jp = {}",JSON.toJSONString(jp));
if(jp.getErrorCode() != 0) { if(jp.getErrorCode() != 0) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("微信新增部门失败"); hr.setMessage("微信新增部门失败");
return hr; return hr;
} }
...@@ -491,6 +491,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -491,6 +491,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
@Override @Override
public void initwxDepartment(String corpid, String suiteid, String wxEnterpriseId) { public void initwxDepartment(String corpid, String suiteid, String wxEnterpriseId) {
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listDepartment(corpid, suiteid, null); List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listDepartment(corpid, suiteid, null);
logger.info("企业所有部门数据:{}", JSON.toJSONString(list)); logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
if(CollectionUtils.isNotEmpty(list)){ if(CollectionUtils.isNotEmpty(list)){
this.addAllDepartment(list, 0, wxEnterpriseId, corpid, suiteid); this.addAllDepartment(list, 0, wxEnterpriseId, corpid, suiteid);
...@@ -509,7 +510,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -509,7 +510,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
if(parent != null){ if(parent != null){
level = parent.getLevel() + 1; level = parent.getLevel() + 1;
chainId = parent.getChainId() + Constant.ID_SEPARATOR + parent.getDepartmentId(); chainId = parent.getChainId() + Constant.ID_SEPARATOR + parent.getDepartmentId();
chainName = parent.getChainName() + Constant.NAME_SEPARATOR + parent.getChainName(); chainName = parent.getChainName() + Constant.NAME_SEPARATOR + parent.getDepartmentName();
pId = parent.getDepartmentId(); pId = parent.getDepartmentId();
} }
} }
...@@ -551,14 +552,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -551,14 +552,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
@Override @Override
public HaobanResponse gicDel(String departmentId) { public ServiceResponse gicDel(String departmentId) {
HaobanResponse hr = new HaobanResponse(); ServiceResponse hr = new ServiceResponse();
hr.setErrorCode(1); hr.setCode(1);
List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId); List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId);
logger.info("【部门删除】list.size={}",list.size()); logger.info("【部门删除】list.size={}",list.size());
if(!list.isEmpty()) { if(!list.isEmpty()) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("存在子部门,删除部门失败"); hr.setMessage("存在子部门,删除部门失败");
//return hr; //return hr;
TabHaobanDepartment department = departmentService.selectById(departmentId); TabHaobanDepartment department = departmentService.selectById(departmentId);
...@@ -571,7 +572,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -571,7 +572,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId); List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId);
logger.info("【部门删除】staffList.size={}",staffList.size()); logger.info("【部门删除】staffList.size={}",staffList.size());
if(!staffList.isEmpty()) { if(!staffList.isEmpty()) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("存在成员,删除部门失败"); hr.setMessage("存在成员,删除部门失败");
//return hr; //return hr;
TabHaobanDepartment department = departmentService.selectById(departmentId); TabHaobanDepartment department = departmentService.selectById(departmentId);
...@@ -588,7 +589,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -588,7 +589,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
if(application != null) { if(application != null) {
JSONResponse jp = qywxDepartmentApiService.deleteDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), Integer.parseInt(department.getWxDepartmentId())); JSONResponse jp = qywxDepartmentApiService.deleteDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), Integer.parseInt(department.getWxDepartmentId()));
if(jp.getErrorCode() != 0) { if(jp.getErrorCode() != 0) {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("微信删除部门失败"); hr.setMessage("微信删除部门失败");
return hr; return hr;
} }
......
...@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON; ...@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil; import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.base.api.common.Constant; import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.GicMessageDTO; import com.gic.haoban.manage.api.dto.GicMessageDTO;
import com.gic.haoban.manage.api.dto.QywxCallBackDTO; import com.gic.haoban.manage.api.dto.QywxCallBackDTO;
...@@ -105,12 +105,12 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -105,12 +105,12 @@ public class MessageApiServiceImpl implements MessageApiService {
} }
departmentDTO.setWxEnterpriseId(enterprise.getWxEnterpriseId()); departmentDTO.setWxEnterpriseId(enterprise.getWxEnterpriseId());
if(dto.getChangeType() == GicEditType.ADD.getCode()){ if(dto.getChangeType() == GicEditType.ADD.getCode()){
HaobanResponse response = this.departmentApiService.add(departmentDTO); ServiceResponse response = this.departmentApiService.add(departmentDTO);
log.info("添加结果:{}", JSON.toJSONString(response)); log.info("添加结果:{}", JSON.toJSONString(response));
}else if(dto.getChangeType() == GicEditType.UPDATE.getCode()){ }else if(dto.getChangeType() == GicEditType.UPDATE.getCode()){
TabHaobanDepartment department = this.departmentService.selectByRelatedId(dto.getId()); TabHaobanDepartment department = this.departmentService.selectByRelatedId(dto.getId());
if(department == null){ if(department == null){
HaobanResponse response = this.departmentApiService.add(departmentDTO); ServiceResponse response = this.departmentApiService.add(departmentDTO);
log.info("添加结果:{}", JSON.toJSONString(response)); log.info("添加结果:{}", JSON.toJSONString(response));
}else { }else {
departmentDTO.setDepartmentId(department.getDepartmentId()); departmentDTO.setDepartmentId(department.getDepartmentId());
......
...@@ -33,7 +33,7 @@ import com.gic.enterprise.api.dto.StoreGroupDTO; ...@@ -33,7 +33,7 @@ import com.gic.enterprise.api.dto.StoreGroupDTO;
import com.gic.enterprise.api.service.StoreGroupService; import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
...@@ -99,9 +99,9 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -99,9 +99,9 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
@Override @Override
public HaobanResponse add(StaffDTO staff, String departmentIds) { public ServiceResponse add(StaffDTO staff, String departmentIds) {
HaobanResponse hr = new HaobanResponse(); ServiceResponse hr = new ServiceResponse();
hr.setErrorCode(1); hr.setCode(1);
Integer activeFlag = staff.getActiveFlag(); Integer activeFlag = staff.getActiveFlag();
staff.setActiveFlag(0); staff.setActiveFlag(0);
Integer syncPostionFlag = staff.getSyncPostionFlag(); Integer syncPostionFlag = staff.getSyncPostionFlag();
...@@ -142,8 +142,8 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -142,8 +142,8 @@ public class StaffApiServiceImpl implements StaffApiService {
JSONResponse jp = qywxUserApiService.createWorkWxUser(userDTO, enterpriseDTO.getCorpid(), application.getSiteId()); JSONResponse jp = qywxUserApiService.createWorkWxUser(userDTO, enterpriseDTO.getCorpid(), application.getSiteId());
logger.info("【店员新增】jp = {}",JSON.toJSONString(jp)); logger.info("【店员新增】jp = {}",JSON.toJSONString(jp));
if(jp.getErrorCode() != 0) { if(jp.getErrorCode() != 0) {
hr.setErrorCode(0); hr.setCode(0);
hr.setDetailError("微信新增失败"); hr.setMessage("微信新增失败");
return hr; return hr;
} }
staffService.add(tab); staffService.add(tab);
...@@ -164,7 +164,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -164,7 +164,7 @@ public class StaffApiServiceImpl implements StaffApiService {
staffDepartmentRelatedService.add(related); staffDepartmentRelatedService.add(related);
} }
}else { }else {
hr.setErrorCode(0); hr.setCode(0);
hr.setMessage("微信端新增失败"); hr.setMessage("微信端新增失败");
} }
hr.setResult(staffId); hr.setResult(staffId);
...@@ -636,8 +636,8 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -636,8 +636,8 @@ public class StaffApiServiceImpl implements StaffApiService {
isCodeExist.setClerkCode(null); isCodeExist.setClerkCode(null);
staffDepartmentRelatedMapper.updateByPrimaryKey(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, isCodeExist)); staffDepartmentRelatedMapper.updateByPrimaryKey(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, isCodeExist));
} }
HaobanResponse hr = this.add(staff, department.getDepartmentId()); ServiceResponse hr = this.add(staff, department.getDepartmentId());
if(hr.getErrorCode() == 1){ if(hr.getCode() == 1){
StaffDepartmentRelatedDTO staffRelated = this.getDepartmentIdAndStaffId(departmentId, hr.getResult().toString()); StaffDepartmentRelatedDTO staffRelated = this.getDepartmentIdAndStaffId(departmentId, hr.getResult().toString());
logger.info("【gic导购新增】staffRelated={}",JSON.toJSONString(staffRelated)); logger.info("【gic导购新增】staffRelated={}",JSON.toJSONString(staffRelated));
//绑定 //绑定
......
...@@ -34,6 +34,7 @@ import com.gic.enterprise.api.service.StoreService; ...@@ -34,6 +34,7 @@ import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.Constant; import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.base.api.common.PageResult; import com.gic.haoban.base.api.common.PageResult;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.web.anno.IgnoreLogin; import com.gic.haoban.manage.web.anno.IgnoreLogin;
import com.gic.haoban.manage.web.auth.AuthRequestUtil; import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.common.utils.EntityUtil; import com.gic.haoban.common.utils.EntityUtil;
...@@ -185,8 +186,8 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -185,8 +186,8 @@ public class DepartmentContoller extends WebBaseController{
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId()); department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setIsStore(0); department.setIsStore(0);
department.setLevel(dto.getLevel() + 1); department.setLevel(dto.getLevel() + 1);
HaobanResponse hr = departmentApiService.add(department); ServiceResponse hr = departmentApiService.add(department);
if(hr.getErrorCode() != 1){ if(hr.getCode() != 1){
return resultResponse(HaoBanErrCode.ERR_DEFINE, hr.getMessage(), null, hr.getMessage()); return resultResponse(HaoBanErrCode.ERR_DEFINE, hr.getMessage(), null, hr.getMessage());
} }
...@@ -236,14 +237,14 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -236,14 +237,14 @@ public class DepartmentContoller extends WebBaseController{
if(dto == null || dto.getStatusFlag() == 0) { if(dto == null || dto.getStatusFlag() == 0) {
return resultResponse(HaoBanErrCode.ERR_10003); return resultResponse(HaoBanErrCode.ERR_10003);
} }
HaobanResponse hr; ServiceResponse hr;
if(StringUtils.isBlank(dto.getRelatedId())) { if(StringUtils.isBlank(dto.getRelatedId())) {
hr = departmentApiService.del(departmentId); hr = departmentApiService.del(departmentId);
}else { }else {
hr = departmentApiService.recycle(departmentId); hr = departmentApiService.recycle(departmentId);
} }
if(hr.getErrorCode() == 0) { if(hr.getCode() == 0) {
return resultResponse(HaoBanErrCode.ERR_0, hr.getMessage(),null,hr.getMessage()); return resultResponse(HaoBanErrCode.ERR_0, hr.getMessage(),null,hr.getMessage());
} }
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
...@@ -432,8 +433,8 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -432,8 +433,8 @@ public class DepartmentContoller extends WebBaseController{
department.setRelatedId(departmentAddQO.getRelatedId()); department.setRelatedId(departmentAddQO.getRelatedId());
department.setRelatedCode(storeCode); department.setRelatedCode(storeCode);
department.setSort(maxSort - sort); department.setSort(maxSort - sort);
HaobanResponse hr = departmentApiService.add(department); ServiceResponse hr = departmentApiService.add(department);
if(hr.getErrorCode() != 1) { if(hr.getCode() != 1) {
continue; continue;
} }
DepartmentDTO departmentAdd = (DepartmentDTO) hr.getResult(); DepartmentDTO departmentAdd = (DepartmentDTO) hr.getResult();
...@@ -473,7 +474,7 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -473,7 +474,7 @@ public class DepartmentContoller extends WebBaseController{
logger.info("【部门修改】department={}",JSON.toJSONString(department)); logger.info("【部门修改】department={}",JSON.toJSONString(department));
handerSonDepartment(departmentQO.getCurrDepartment()); handerSonDepartment(departmentQO.getCurrDepartment());
HaobanResponse hr = departmentApiService.edit(department); ServiceResponse hr = departmentApiService.edit(department);
String sonDepartment = departmentQO.getChildren(); String sonDepartment = departmentQO.getChildren();
handler(sonDepartment,department.getDepartmentId()); handler(sonDepartment,department.getDepartmentId());
...@@ -636,8 +637,8 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -636,8 +637,8 @@ public class DepartmentContoller extends WebBaseController{
} }
department.setRelatedId(departmentAddQO.getRelatedId()); department.setRelatedId(departmentAddQO.getRelatedId());
department.setRelatedCode(storeCode); department.setRelatedCode(storeCode);
HaobanResponse hr = departmentApiService.add(department); ServiceResponse hr = departmentApiService.add(department);
if(hr.getErrorCode() != 1) { if(hr.getCode() != 1) {
continue; continue;
} }
DepartmentDTO departmentAdd = (DepartmentDTO) hr.getResult(); DepartmentDTO departmentAdd = (DepartmentDTO) hr.getResult();
...@@ -657,8 +658,8 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -657,8 +658,8 @@ public class DepartmentContoller extends WebBaseController{
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId()); department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setChainName(dto.getChainName() + Constant.NAME_SEPARATOR + dto.getDepartmentName()); department.setChainName(dto.getChainName() + Constant.NAME_SEPARATOR + dto.getDepartmentName());
department.setSort(departmentAddQO.getSort()); department.setSort(departmentAddQO.getSort());
HaobanResponse hr = departmentApiService.edit(department); ServiceResponse hr = departmentApiService.edit(department);
if(hr.getErrorCode() != 1) { if(hr.getCode() != 1) {
continue; continue;
} }
DepartmentDTO departmentEdit = (DepartmentDTO) hr.getResult(); DepartmentDTO departmentEdit = (DepartmentDTO) hr.getResult();
...@@ -711,8 +712,8 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -711,8 +712,8 @@ public class DepartmentContoller extends WebBaseController{
} }
staff.setSyncPostionFlag(1); staff.setSyncPostionFlag(1);
HaobanResponse hr = staffApiService.add(staff, departmentId); ServiceResponse hr = staffApiService.add(staff, departmentId);
if(hr.getErrorCode() == 1){ if(hr.getCode() == 1){
StaffDepartmentRelatedDTO staffRelated = staffApiService.getDepartmentIdAndStaffId(departmentId, hr.getResult().toString()); StaffDepartmentRelatedDTO staffRelated = staffApiService.getDepartmentIdAndStaffId(departmentId, hr.getResult().toString());
StaffDepartmentRelatedDTO isCodeExist = staffApiService.getDepartmentIdAndCode(departmentId,clerkCode); StaffDepartmentRelatedDTO isCodeExist = staffApiService.getDepartmentIdAndCode(departmentId,clerkCode);
if(staffRelated != null && isCodeExist == null){ if(staffRelated != null && isCodeExist == null){
...@@ -766,7 +767,7 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -766,7 +767,7 @@ public class DepartmentContoller extends WebBaseController{
public HaobanResponse departmentBatchDel(String departmentIds) { public HaobanResponse departmentBatchDel(String departmentIds) {
String[] departmentIdArr = departmentIds.split(","); String[] departmentIdArr = departmentIds.split(",");
for (String departmentId : departmentIdArr) { for (String departmentId : departmentIdArr) {
HaobanResponse hr; ServiceResponse hr;
hr = departmentApiService.del(departmentId); hr = departmentApiService.del(departmentId);
} }
......
...@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSON; ...@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.PageResult; import com.gic.haoban.base.api.common.PageResult;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
...@@ -64,9 +65,9 @@ public class StaffController extends WebBaseController{ ...@@ -64,9 +65,9 @@ public class StaffController extends WebBaseController{
if(staff != null) { if(staff != null) {
return resultResponse(HaoBanErrCode.ERR_10005); return resultResponse(HaoBanErrCode.ERR_10005);
} }
HaobanResponse hr = staffApiService.add(staffDTO,departmentIds); ServiceResponse hr = staffApiService.add(staffDTO,departmentIds);
if(hr.getErrorCode() == 0){ if(hr.getCode() == 0){
return resultResponse(HaoBanErrCode.ERR_DEFINE, hr.getDetailError(), null, hr.getDetailError()); return resultResponse(HaoBanErrCode.ERR_DEFINE, hr.getMessage(), null, hr.getMessage());
} }
return resultResponse(HaoBanErrCode.ERR_1); 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