提交修改

This commit is contained in:
quyixiao 2020-08-20 19:23:50 +08:00
commit a3b0657632
13 changed files with 121 additions and 39 deletions

View File

@ -3,6 +3,7 @@ package com.lz.modules.app.dao;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -38,7 +39,7 @@ public interface DepartmentsStaffRelateDao extends BaseMapper<DepartmentsStaffRe
* @param staffId
* @return
*/
int updateByStaffId(@Param("departmentId") String departmentId, @Param("staffId") StaffEntity staffId);
int updateByStaffId(@Param("departmentId") String departmentId, @Param("staffId") DepartmentStaffBo staffId);
void deleteAllRelates();

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.PageUtils;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import java.util.List;
import java.util.Map;
@ -22,7 +23,7 @@ public interface DepartmentsStaffRelateService extends IService<DepartmentsStaff
/**
* 根据部门ID和员工Ids创建部门和员工关系表
*/
void addRelateInfos(String departmentId, List<StaffEntity> staffIds);
void addRelateInfos(String departmentId, List<DepartmentStaffBo> staffs);
void deleteAllRelates();

View File

@ -23,7 +23,7 @@ public interface StaffService extends IService<StaffEntity> {
PageUtils queryPage(Map<String, Object> params);
List<StaffEntity> updateStaffsInfo(List<DepartmentStaffBo> staffs);
boolean updateStaffsInfo(List<DepartmentStaffBo> staffs);
StaffEntity getStaffInfoByOpenId(String openId);

View File

@ -3,6 +3,7 @@ package com.lz.modules.app.service.impl;
import com.google.common.collect.Lists;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import org.springframework.stereotype.Service;
import java.util.List;
@ -37,15 +38,15 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl<DepartmentsSt
}
@Override
public void addRelateInfos(String departmentId, List<StaffEntity> staffIds) {
public void addRelateInfos(String departmentId, List<DepartmentStaffBo> staffs) {
List<DepartmentsStaffRelateEntity> departStaffRelateList = Lists.newArrayList();
for (StaffEntity staffId : staffIds) {
for (DepartmentStaffBo staffId : staffs) {
String departId = departmentsStaffRelateDao.getRelateByStaffIdAndDepartmentId(staffId.getId(), departmentId);
if (StringUtil.isEmpty(departId)) {
DepartmentsStaffRelateEntity departmentsStaffRelateBo = new DepartmentsStaffRelateEntity();
departmentsStaffRelateBo.setDepartmentId(departmentId);
departmentsStaffRelateBo.setStaffId(staffId.getId());
//departmentsStaffRelateBo.setIsLeader(staffId.getIsLeader());
departmentsStaffRelateBo.setIsLeader(staffId.getIsLeader());
departStaffRelateList.add(departmentsStaffRelateBo);
} else /*if (!StringUtil.equals(departmentId, departId))*/ {
departmentsStaffRelateDao.updateByStaffId(departmentId, staffId);

View File

@ -98,9 +98,8 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
}
@Override
public List<StaffEntity> updateStaffsInfo(List<DepartmentStaffBo> staffs) {
public boolean updateStaffsInfo(List<DepartmentStaffBo> staffs) {
try {
List<StaffEntity> staffEntitys = Lists.newArrayList();
for (DepartmentStaffBo staffBo : staffs) {
StaffEntity staffEntity = staffDao.getStaffInfoByOpenId(staffBo.getOpenId());
StaffEntity staff = convertStaffEntity(staffBo);
@ -113,13 +112,13 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
staffDao.addStaff(staff);
}
staffEntitys.add(staff);
staffBo.setId(staff.getId());
}
return staffEntitys;
return true;
} catch (Exception e) {
logger.info("updateDepartmentInfos error : " + e);
return null;
}
return false;
}
@Override

View File

@ -127,12 +127,14 @@ public class DingtalkBusiness {
if(staffs.size() > 0){
//循环录入到员工信息表中
List<StaffEntity> staffIds = staffService.updateStaffsInfo(staffs);
if(staffService.updateStaffsInfo(staffs)){
//加入到部门和员工关系表同时更新leader关系
departmentsStaffRelateService.addRelateInfos(departmentInfo.getId(), staffs);
//录入员工职业信息表
enterStaffOccupationInfos(staffs);
}
//加入到部门和员工关系表同时更新leader关系
departmentsStaffRelateService.addRelateInfos(departmentInfo.getId(), staffIds);
//录入员工职业信息表
enterStaffOccupationInfos(staffs);
}
}
for (String key : departmentInfosBos.keySet()) {

View File

@ -85,12 +85,14 @@ public class FeishuBusiness {
// for (DepartmentStaffBo staff : staffs)
// logger.info(staff.getName());
//循环录入到员工信息表中
List<StaffEntity> staffIds = staffService.updateStaffsInfo(staffs);
if(staffService.updateStaffsInfo(staffs)){
//加入到部门和员工关系表
departmentsStaffRelateService.addRelateInfos(departmentInfo.getId(), staffs);
//录入员工职业信息表
enterStaffOccupationInfos(staffs);
}
//加入到部门和员工关系表
departmentsStaffRelateService.addRelateInfos(departmentInfo.getId(), staffIds);
//录入员工职业信息表
enterStaffOccupationInfos(staffs);
}

View File

@ -16,6 +16,10 @@ import java.util.List;
@Data
public class DepartmentStaffBo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 插入数据库之后的IDlz_staff表中的id
*/
private Long id;
/**
* 用户名

View File

@ -9,7 +9,7 @@ import java.util.Date;
* 菜单权限表
* </p>*第三方应用配置表
* @author quyixiao
* @since 2020-08-17
* @since 2020-08-20
*/
@Data
@ -38,6 +38,10 @@ public class ThirdAppConfig implements java.io.Serializable {
private String thirdAppName;
//程序入口如果有
private String appUrl;
//企业的钉钉corpId
private Long corpId;
//备注说明
private String remark;
/**
*
* @return
@ -203,6 +207,36 @@ public class ThirdAppConfig implements java.io.Serializable {
this.appUrl = appUrl;
}
/**
* 企业的钉钉corpId
* @return
*/
public Long getCorpId() {
return corpId;
}
/**
* 企业的钉钉corpId
* @param corpId
*/
public void setCorpId(Long corpId) {
this.corpId = corpId;
}
/**
* 备注说明
* @return
*/
public String getRemark() {
return remark;
}
/**
* 备注说明
* @param remark
*/
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return "ThirdAppConfig{" +
@ -217,6 +251,8 @@ public class ThirdAppConfig implements java.io.Serializable {
",appType=" + appType +
",thirdAppName=" + thirdAppName +
",appUrl=" + appUrl +
",corpId=" + corpId +
",remark=" + remark +
"}";
}
}

View File

@ -6,7 +6,7 @@ import java.util.Date;
* 菜单权限表
* </p>*第三方应用配置表
* @author quyixiao
* @since 2020-08-17
* @since 2020-08-20
*/
@ -39,6 +39,10 @@ public class ThirdAppConfigReq implements java.io.Serializable {
private String thirdAppName;
//程序入口如果有
private String appUrl;
//企业的钉钉corpId
private Long corpId;
//备注说明
private String remark;
/**
*
* @return
@ -204,6 +208,36 @@ public class ThirdAppConfigReq implements java.io.Serializable {
this.appUrl = appUrl;
}
/**
* 企业的钉钉corpId
* @return
*/
public Long getCorpId() {
return corpId;
}
/**
* 企业的钉钉corpId
* @param corpId
*/
public void setCorpId(Long corpId) {
this.corpId = corpId;
}
/**
* 备注说明
* @return
*/
public String getRemark() {
return remark;
}
/**
* 备注说明
* @param remark
*/
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return "ThirdAppConfig{" +
@ -218,6 +252,8 @@ public class ThirdAppConfigReq implements java.io.Serializable {
",appType=" + appType +
",thirdAppName=" + thirdAppName +
",appUrl=" + appUrl +
",corpId=" + corpId +
",remark=" + remark +
"}";
}
}

View File

@ -261,18 +261,7 @@
<if test="name != null and name != ''">
and ls.name like concat('%',#{name},'%')
</if>
and (ls.id in (
select dsr.staff_id from lz_departments_staff_relate dsr where dsr.is_delete=0
<if test="departmentId != null and departmentId != ''">
and dsr.department_id=#{departmentId}
</if>
)
or ls.employee_id in (
select sr.leader_employee_id from lz_departments sr where sr.is_delete=0
<if test="departmentId != null and departmentId != ''">
and sr.department_id=#{departmentId}
</if>
)) order by department_leader desc
order by department_leader desc
limit #{startIndex}, #{pageLimit}
</select>

View File

@ -15,12 +15,14 @@
<result column="app_type" property="appType"/>
<result column="third_app_name" property="thirdAppName"/>
<result column="app_url" property="appUrl"/>
<result column="corp_id" property="corpId"/>
<result column="remark" property="remark"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, app_id AS appId, app_key AS appKey, app_secret AS appSecret, app_name AS appName, app_type AS appType, third_app_name AS thirdAppName, app_url AS appUrl
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, app_id AS appId, app_key AS appKey, app_secret AS appSecret, app_name AS appName, app_type AS appType, third_app_name AS thirdAppName, app_url AS appUrl, corp_id AS corpId, remark AS remark
</sql>
@ -40,6 +42,8 @@
<if test="appType != null">app_type, </if>
<if test="thirdAppName != null">third_app_name, </if>
<if test="appUrl != null">app_url, </if>
<if test="corpId != null">corp_id, </if>
<if test="remark != null">remark, </if>
is_delete,
gmt_create,
gmt_modified
@ -51,6 +55,8 @@
<if test="appType != null">#{ appType}, </if>
<if test="thirdAppName != null">#{ thirdAppName}, </if>
<if test="appUrl != null">#{ appUrl}, </if>
<if test="corpId != null">#{ corpId}, </if>
<if test="remark != null">#{ remark}, </if>
0,
now(),
now()
@ -70,7 +76,9 @@
<if test="appName != null">app_name = #{appName},</if>
<if test="appType != null">app_type = #{appType},</if>
<if test="thirdAppName != null">third_app_name = #{thirdAppName},</if>
<if test="appUrl != null">app_url = #{appUrl}</if>
<if test="appUrl != null">app_url = #{appUrl}</if>
<if test="corpId != null">corp_id = #{corpId},</if>
<if test="remark != null">remark = #{remark}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -89,7 +97,9 @@
app_name = #{appName},
app_type = #{appType},
third_app_name = #{thirdAppName},
app_url = #{appUrl}
app_url = #{appUrl},
corp_id = #{corpId},
remark = #{remark}
,gmt_modified = now()
where id = #{id}
</update>

View File

@ -61,7 +61,8 @@ public class MysqlMain {
}
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_staff_role"));
list.add(new TablesBean("third_app_config"));
List<TablesBean> list2 = new ArrayList<TablesBean>();