Commit 26139dee by 水库浪子

修改离职分配相关bug

1 parent f3538fa7
......@@ -69,15 +69,16 @@ public class WeDepartmentController extends BaseController
weDepartmentService.updateWeDepartment(weDepartment);
return AjaxResult.success();
}
//
// /**
// * 删除企业微信组织架构相关
// */
// @PreAuthorize("@ss.hasPermi('wecom:department:remove')")
// @Log(title = "企业微信组织架构相关", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable Long[] ids)
// public AjaxResult remove(@PathVariable String[] ids)
// {
// return toAjax(weDepartmentService.deleteWeDepartmentByIds(ids));
// }
}
......@@ -116,8 +116,8 @@ public class WeUserController extends BaseController {
public TableDataInfo leaveUserAllocateList(WeLeaveUserVo weLeaveUserVo) {
startPage();
weLeaveUserVo.setIsActivate(WeConstans.WE_USER_IS_LEAVE);
weLeaveUserVo.setIsAllocate(WeConstans.LEAVE_ALLOCATE_STATE);
List<WeLeaveUserVo> list = this.weUserService.leaveNoAllocateUserList(weLeaveUserVo);
weLeaveUserVo.setIsAllocate(WeConstans.LEAVE_ALLOCATE_STATE);
List<WeLeaveUserVo> list = this.weUserService.leaveAllocateUserList(weLeaveUserVo);
return getDataTable(list);
}
......@@ -147,7 +147,7 @@ public class WeUserController extends BaseController {
@PutMapping({"/allocateLeaveUserAboutData"})
public AjaxResult allocateLeaveUserAboutData(@RequestBody WeLeaveUserInfoAllocateVo weLeaveUserInfoAllocateVo) {
weUserService.allocateLeaveUserAboutData(weLeaveUserInfoAllocateVo);
weUserService.allocateLeaveUserAboutData(weLeaveUserInfoAllocateVo);
return AjaxResult.success("离职分配成功");
}
......
package com.linkwechat.wecom.domain.vo;
import lombok.Data;
import java.util.Date;
/**
* @description: 已分配员工信息
* @author: HaoN
* @create: 2020-10-28 00:13
**/
@Data
public class WeAllocateCustomersVo {
/**客户名称*/
private String customerName;
/**接替人名称*/
private String takeUserName;
/**分配时间*/
private Date allocateTime;
/**接替人所在部门*/
private String department;
}
......@@ -14,13 +14,6 @@ import org.apache.ibatis.annotations.Param;
*/
public interface IWeDepartmentService extends IService<WeDepartment>
{
/**
* 查询企业微信组织架构相关
*
* @param id 企业微信组织架构相关ID
* @return 企业微信组织架构相关
*/
public WeDepartment selectWeDepartmentById(Long id);
/**
* 查询企业微信组织架构相关列表
......@@ -47,23 +40,16 @@ public interface IWeDepartmentService extends IService<WeDepartment>
/**
* 批量保存
* @param weDepartments
* @return
*/
public int batchInsertWeDepartment(List<WeDepartment> weDepartments);
/**
* 删除部门表所有数据
* @return
*/
public int deleteAllWeDepartment();
/**
* 同步部门
*/
public List<WeDepartment> synchWeDepartment();
// /**
// * 根据部门id删除部门
// * @param ids
// */
// public void deleteWeDepartmentByIds(String[] ids);
}
......@@ -2,6 +2,8 @@ package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.HttpStatus;
import com.linkwechat.common.constant.WeConstans;
......@@ -10,10 +12,12 @@ import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.common.utils.bean.BeanUtils;
import com.linkwechat.wecom.client.WeDepartMentClient;
import com.linkwechat.wecom.domain.WeDepartment;
import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.domain.dto.WeDepartMentDto;
import com.linkwechat.wecom.domain.dto.WeResultDto;
import com.linkwechat.wecom.mapper.WeDepartmentMapper;
import com.linkwechat.wecom.service.IWeDepartmentService;
import com.linkwechat.wecom.service.IWeUserService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -39,18 +43,11 @@ public class WeDepartmentServiceImpl extends ServiceImpl<WeDepartmentMapper,WeDe
private WeDepartMentClient weDepartMentClient;
@Autowired
private IWeUserService weUserService;
/**
* 查询企业微信组织架构相关
*
* @param id 企业微信组织架构相关ID
* @return 企业微信组织架构相关
*/
@Override
public WeDepartment selectWeDepartmentById(Long id)
{
return weDepartmentMapper.selectWeDepartmentById(id);
}
/**
* 查询企业微信组织架构相关列表
......@@ -121,38 +118,6 @@ public class WeDepartmentServiceImpl extends ServiceImpl<WeDepartmentMapper,WeDe
this.updateById(weDepartment);
}
// int returnCode=weDepartmentMapper.updateWeDepartment(weDepartment);
// if(returnCode>0){
//
// weDepartMentClient.updateWeDepartMent(
// weDepartment.transformDeartMentDto(weDepartment)
// );
//
//
// }
//
// return returnCode;
}
/**
* 批量保存
* @param weDepartments
* @return
*/
@Override
public int batchInsertWeDepartment(List<WeDepartment> weDepartments) {
return weDepartmentMapper.batchInsertWeDepartment(weDepartments);
}
/**
* 删除部门表所有数据
* @return
*/
@Override
public int deleteAllWeDepartment() {
return weDepartmentMapper.deleteAllWeDepartment();
}
......@@ -172,4 +137,33 @@ public class WeDepartmentServiceImpl extends ServiceImpl<WeDepartmentMapper,WeDe
}
// /**
// * 根据部门id删除部门
// * @param ids
// */
// @Override
// public void deleteWeDepartmentByIds(String[] ids) {
//
// //查询当前部门下所有的子部门,如果存在,则不可以删除
// List<WeDepartment> weDepartments = this.list(new LambdaQueryWrapper<WeDepartment>()
// .in(WeDepartment::getParentId, ids));
// if(CollectionUtil.isNotEmpty(weDepartments)) {
// //抛出异常,请删除此部门下的成员或子部门后,再删除此部门
//
// }
//
//
// List<WeUser> weUsers = weUserService.selectWeUserList(WeUser.builder()
// .department(ids)
// .build());
// if(CollectionUtil.isNotEmpty(weUsers)){
// //该部门存在子部门或成员无法删除
//
// }
//
//
//
// }
}
......@@ -153,7 +153,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
*/
@Override
public List<WeLeaveUserVo> leaveAllocateUserList(WeLeaveUserVo weLeaveUserVo) {
return null;
return this.baseMapper.leaveAllocateUserList(weLeaveUserVo);
}
......@@ -171,6 +171,12 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
//分配群组
iWeGroupService.allocateWeGroup(weLeaveUserInfoAllocateVo);
//更新员工状态为已分配
this.updateById(WeUser.builder()
.userId(weLeaveUserInfoAllocateVo.getHandoverUserid())
.isAllocate(WeConstans.LEAVE_ALLOCATE_STATE)
.build());
}catch (Exception e){
throw new WeComException(e.getMessage());
}
......@@ -211,7 +217,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
weUsers.add(
WeUser.builder()
.userId(k)
.enable(WeConstans.WE_USER_IS_LEAVE)
.isActivate(WeConstans.WE_USER_IS_LEAVE)
.dimissionTime(new Date())
.build()
);
......
......@@ -12,81 +12,16 @@
wg.create_time,
wg.notice,
wu.user_name as groupLeaderName,
(SELECT COUNT(*) FROM we_group_member wgm WHERE wgm.chat_id=wg.chat_id) as memberNum
(SELECT COUNT(*) FROM we_group_member wgm WHERE wgm.chat_id=wg.chat_id) as memberNum,
wg.status
FROM
we_group wg
INNER JOIN we_user wu ON wg.`owner`=wu.user_id
LEFT JOIN we_user wu ON wg.`owner`=wu.user_id
<where>
<if test="groupName != null and groupName != ''"> and wg.group_name like concat('%', #{groupName}, '%')</if>
<if test="owner != null and owner != ''"> and owner = #{owner}</if>
</where>
</select>
<!-- <select id="selectWeGroupById" parameterType="Long" resultMap="WeGroupResult">-->
<!-- <include refid="selectWeGroupVo"/>-->
<!-- where id = #{id}-->
<!-- </select>-->
<!-- <insert id="insertWeGroup" parameterType="WeGroup">-->
<!-- insert into we_group-->
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
<!-- <if test="id != null">id,</if>-->
<!-- <if test="groupName != null">group_name,</if>-->
<!-- <if test="memberNum != null">member_num,</if>-->
<!-- <if test="groupLeader != null">group_leader,</if>-->
<!-- <if test="createTime != null">create_time,</if>-->
<!-- <if test="notice != null">notice,</if>-->
<!-- <if test="groupLeaderUserId != null and groupLeaderUserId !=''">group_leader_user_id,</if>-->
<!-- </trim>-->
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
<!-- <if test="id != null">#{id},</if>-->
<!-- <if test="groupName != null">#{groupName},</if>-->
<!-- <if test="memberNum != null">#{memberNum},</if>-->
<!-- <if test="groupLeader != null">#{groupLeader},</if>-->
<!-- <if test="createTime != null">#{createTime},</if>-->
<!-- <if test="notice != null">#{notice},</if>-->
<!-- <if test="groupLeaderUserId != null and groupLeaderUserId !=''">#{groupLeaderUserId},</if>-->
<!-- </trim>-->
<!-- </insert>-->
<!-- <update id="updateWeGroup" parameterType="WeGroup">-->
<!-- update we_group-->
<!-- <trim prefix="SET" suffixOverrides=",">-->
<!-- <if test="groupName != null">group_name = #{groupName},</if>-->
<!-- <if test="memberNum != null">member_num = #{memberNum},</if>-->
<!-- <if test="groupLeader != null">group_leader = #{groupLeader},</if>-->
<!-- <if test="createTime != null">create_time = #{createTime},</if>-->
<!-- <if test="notice != null">notice = #{notice},</if>-->
<!-- <if test="groupLeaderUserId != null and groupLeaderUserId !=''">group_leader_user_id =#{groupLeaderUserId},</if>-->
<!-- </trim>-->
<!-- where id = #{id}-->
<!-- </update>-->
<!-- <delete id="deleteWeGroupById" parameterType="Long">-->
<!-- delete from we_group where id = #{id}-->
<!-- </delete>-->
<!-- <delete id="deleteWeGroupByIds" parameterType="String">-->
<!-- delete from we_group where id in-->
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </delete>-->
<!-- <update id="batchLogicDeleteByIds" parameterType="String">-->
<!-- update we_group set del_flag=2-->
<!-- where id in-->
<!-- <foreach item="id" collection="ids" open="(" separator="," close=")">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </update>-->
<!-- <insert id="batchInsetWeGroup" >-->
<!-- insert into we_group (id, group_name, member_num, group_leader, create_time, notice, group_leader_user_id)-->
<!-- values-->
<!-- <foreach collection="weGroups" item="weGroup" index="index" separator=",">-->
<!-- (#{weGroup.id},#{weGroup.groupName},#{weGroup.memberNum},#{weGroup.groupLeader},#{weGroup.createTime},#{weGroup.notice},#{weGroup.groupLeaderUserId})-->
<!-- </foreach>-->
<!-- </insert>-->
</mapper>
\ No newline at end of file
......@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
<if test="email != null and email != ''"> and email = #{email}</if>
<if test="wxAccount != null and wxAccount != ''"> and wx_account = #{wxAccount}</if>
<if test="department != null and department != '' and department != '1' "> and FIND_IN_SET(#{department},department)</if>
<if test="department != null and department.length > 0 "> and FIND_IN_SET(#{department},department)</if>
<if test="position != null and position != ''"> and position = #{position}</if>
<if test="isLeaderInDept != null "> and is_leader_in_dept = #{isLeaderInDept}</if>
<if test="joinTime != null "> and join_time = #{joinTime}</if>
......@@ -164,12 +164,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
wu.user_id,
wu.user_name,
wu.dimission_time,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department,
(SELECT COUNT(*) FROM we_allocate_customer wac WHERE wac.handover_userid=wu.user_id) as allocateCustomerNum,
(SELECT COUNT(*) FROM we_allocate_group wag WHERE wag.old_owner=wu.user_id) as allocateGroupNum,
wu.dimission_time
FROM
we_user wu
(SELECT COUNT(*) FROM we_allocate_group wag WHERE wag.old_owner=wu.user_id) as allocateGroupNum
FROM we_user wu
<where>
<if test="userName != null and userName !=''">and wu.user_name=#{userName}</if>
<if test="beginTime != null and beginTime !='' and endTime != null and endTime !=''">
......@@ -218,6 +217,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- <select id="getAllocateCustomers">-->
<!-- SELECT-->
<!-- wc.`name`,-->
<!-- wu.user_name,-->
<!-- wac.allocate_time,-->
<!-- (SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department-->
<!--FROM-->
<!-- we_allocate_customer wac-->
<!--LEFT JOIN we_customer wc ON wac.external_userid=wc.external_userid-->
<!--LEFT JOIN we_user wu ON wu.user_id=wac.takeover_userid-->
<!-- -->
<!-- </select>-->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!