Commit 1953bb1b by qwmqiuwenmin

fix

parent 4e21466d
......@@ -139,5 +139,10 @@ public interface DepartmentApiService {
* @return
*/
boolean hasSonNode(String departmentId);
/**
* gic回调删除部门
* @param departmentId
*/
HaobanResponse gicDel(String departmentId);
}
......@@ -37,6 +37,8 @@ public class TabHaobanDepartment implements Serializable {
private String relatedCode;
private String enterpriseId;
private Integer gicDelFlag;
private static final long serialVersionUID = 1L;
......@@ -175,6 +177,14 @@ public class TabHaobanDepartment implements Serializable {
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getGicDelFlag() {
return gicDelFlag;
}
public void setGicDelFlag(Integer gicDelFlag) {
this.gicDelFlag = gicDelFlag;
}
}
\ No newline at end of file
......@@ -530,4 +530,54 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
return false;
}
@Override
public HaobanResponse gicDel(String departmentId) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(1);
List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId);
logger.info("【部门删除】list.size={}",list.size());
if(!list.isEmpty()) {
hr.setErrorCode(0);
hr.setMessage("存在子部门,删除部门失败");
//return hr;
TabHaobanDepartment department = departmentService.selectById(departmentId);
if(department != null){
department.setGicDelFlag(1);
}
departmentMapper.updateByPrimaryKeySelective(department);
}
List<TabHaobanStaffDepartmentRelated> staffList = staffDepartmentService.listByDepartmentId(departmentId);
logger.info("【部门删除】staffList.size={}",staffList.size());
if(!staffList.isEmpty()) {
hr.setErrorCode(0);
hr.setMessage("存在成员,删除部门失败");
//return hr;
TabHaobanDepartment department = departmentService.selectById(departmentId);
if(department != null){
department.setGicDelFlag(1);
}
departmentMapper.updateByPrimaryKeySelective(department);
}
//调微信的删除接口
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.del(departmentId);
return hr;
}
}
......@@ -112,7 +112,7 @@ public class MessageApiServiceImpl implements MessageApiService {
}else {
TabHaobanDepartment department = this.departmentService.selectByRelatedId(dto.getId());
if(department != null){
this.departmentApiService.del(department.getDepartmentId());
this.departmentApiService.gicDel(department.getDepartmentId());
log.info("gic同步删除完成");
}else {
log.info("gic同步删除不存在");
......
......@@ -12,6 +12,7 @@
<result column="is_store" property="isStore" jdbcType="INTEGER" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="recycle_flag" property="recycleFlag" jdbcType="INTEGER" />
<result column="gic_del_flag" property="gicDelFlag" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="wx_department_id" property="wxDepartmentId" jdbcType="VARCHAR" />
......@@ -22,7 +23,7 @@
</resultMap>
<sql id="Base_Column_List" >
department_id, department_name, parent_department_id, related_id, related_code,chain_id, is_store,
status_flag, recycle_flag, create_time, update_time,wx_department_id,sort,level,wx_enterprise_id,chain_name,enterprise_id
status_flag, recycle_flag, create_time, update_time,wx_department_id,sort,level,wx_enterprise_id,chain_name,enterprise_id,gic_del_flag
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
......@@ -204,6 +205,9 @@
<if test="level != null" >
level = #{level,jdbcType=INTEGER},
</if>
<if test="gicDelFlag != null" >
gic_del_flag = #{gicDelFlag,jdbcType=INTEGER},
</if>
</set>
where department_id = #{departmentId,jdbcType=VARCHAR}
</update>
......@@ -223,7 +227,7 @@
recycle_flag = #{recycleFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
gic_del_flag = #{gicDelFlag},
wx_enterprise_id = #{wxEnterpriseId},
enterprise_id = #{enterpriseId}
where department_id = #{departmentId,jdbcType=VARCHAR}
......@@ -414,6 +418,7 @@
from tab_haoban_department
where enterprise_id = #{enterpriseId}
and status_flag = 1
and gic_del_flag != 1
</select>
<select id="countByDepartment" resultType="java.lang.Integer" parameterType="java.lang.String" >
......
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