提交修改
This commit is contained in:
commit
436b1446e8
4
pom.xml
4
pom.xml
@ -37,7 +37,7 @@
|
||||
<joda.time.version>2.9.9</joda.time.version>
|
||||
<gson.version>2.8.5</gson.version>
|
||||
<fastjson.version>1.2.60</fastjson.version>
|
||||
<hutool.version>4.1.1</hutool.version>
|
||||
<hutool.version>5.2.3</hutool.version>
|
||||
<lombok.version>1.18.4</lombok.version>
|
||||
<poi.version>3.17</poi.version>
|
||||
<!--wagon plugin 配置-->
|
||||
@ -251,7 +251,7 @@
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>2.0.0</version>
|
||||
<classifier>suibian</classifier>
|
||||
</dependency>
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ public enum WorkMsgTypeEnum {
|
||||
LEADER_PASS(2, "绩效已打分", "去提交给人事", "# 绩效已打分\n ## 你的绩效已经打分"),
|
||||
//绩效通过人事,老板审核的最终审核通知
|
||||
PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"),
|
||||
URGING(4, "绩效催办", "去审批", "# 绩效催办\n ## @提醒您审批"),
|
||||
URGING(4, "绩效催办", "去处理", "# 绩效催办\n ## @的绩效需您处理"),
|
||||
END(5, "绩效终止", "去查看", "# 绩效终止\n ## @,你的绩效终止"),
|
||||
START_WORK(6, "绩效考评待办事项", "去查看", "# 绩效目标制定\n ## @,你的绩效需要制定目标"),
|
||||
START_SCORE(7, "绩效考评待办事项", "去查看", "# 绩效结果输入\n ## @,你的绩效需要输入结果"),
|
||||
|
||||
@ -121,6 +121,7 @@ public class DingTalkUtil {
|
||||
try {
|
||||
//下面获取所有部门的i就按单信息
|
||||
Map<String, DepartmentInfosBo> list = new HashMap<>();
|
||||
|
||||
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/department/list");
|
||||
OapiDepartmentListRequest req = new OapiDepartmentListRequest();
|
||||
req.setFetchChild(true);
|
||||
@ -144,6 +145,7 @@ public class DingTalkUtil {
|
||||
deReq.setId(departmentInfosBo.getId());
|
||||
deReq.setHttpMethod("GET");
|
||||
OapiDepartmentGetResponse deRsp = client.execute(deReq, accessToken);
|
||||
logger.info("钉钉部门信息返回{}", deRsp.getBody());
|
||||
json = JSONObject.parseObject(deRsp.getBody());
|
||||
departmentInfosBo.setChatId(json.getString("deptGroupChatId"));
|
||||
departmentInfosBo.setLeaderEmployeeId(json.getString("deptManagerUseridList"));//部门主管,多个主管以|隔开
|
||||
@ -162,6 +164,47 @@ public class DingTalkUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<DepartmentInfosBo> getDepartmentDetailsV2(String accessToken, String departmentIds) {
|
||||
List<DepartmentInfosBo> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
//下面获取所有部门的i就按单信息
|
||||
getDepartment(list, 1L, accessToken);
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
logger.info("获取部门详情异常{}", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void getDepartment(List<DepartmentInfosBo> list, Long depId, String accessToken) throws ApiException {
|
||||
|
||||
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listsub");
|
||||
OapiV2DepartmentListsubRequest req = new OapiV2DepartmentListsubRequest();
|
||||
req.setDeptId(depId);
|
||||
req.setLanguage("zh_CN");
|
||||
OapiV2DepartmentListsubResponse rsp = client.execute(req, accessToken);
|
||||
|
||||
logger.info("钉钉请求返回{}", rsp.getBody());
|
||||
JSONObject json = JSONObject.parseObject(rsp.getBody());
|
||||
if(json.getInteger("errcode") == 0) {
|
||||
JSONArray array = json.getJSONArray("result");
|
||||
logger.info("子部门数量{}", array.size());
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
json = array.getJSONObject(i);
|
||||
|
||||
DepartmentInfosBo departmentInfosBo = new DepartmentInfosBo();
|
||||
departmentInfosBo.setName(json.getString("name"));
|
||||
departmentInfosBo.setId(json.getString("dept_id"));//自身ID
|
||||
departmentInfosBo.setParentId(json.getString("parent_id"));//父级ID
|
||||
list.add(departmentInfosBo);
|
||||
logger.info("钉钉请求{}的子部门", departmentInfosBo.getName());
|
||||
getDepartment(list, json.getLong("dept_id"), accessToken);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门用户详情
|
||||
*
|
||||
@ -183,7 +226,7 @@ public class DingTalkUtil {
|
||||
for(long page = 0; isNext; page++){
|
||||
req.setOffset(page);
|
||||
OapiUserListbypageResponse rsp = client.execute(req, accessToken);
|
||||
logger.info("钉钉请求返回{}", rsp.getBody());
|
||||
logger.info("钉钉请求人员返回{}", rsp.getBody());
|
||||
JSONObject json = JSONObject.parseObject(rsp.getBody());
|
||||
if(json.getInteger("errcode") == 0){
|
||||
JSONArray array = json.getJSONArray("userlist");
|
||||
@ -219,7 +262,104 @@ public class DingTalkUtil {
|
||||
|
||||
|
||||
}else{
|
||||
logger.info("获取部门详情异常{}", rsp.getBody());
|
||||
logger.info("获取人员详情异常{}", rsp.getBody());
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取部门用户详情异常{}", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门用户详情
|
||||
*
|
||||
* @param accessToken
|
||||
* @return
|
||||
*/
|
||||
public List<DepartmentStaffBo> getDepartmentStaffDetailsV2(String accessToken, String departmentId, Map<String, String> mapProbation) {
|
||||
try {
|
||||
long page = 0L;
|
||||
List<DepartmentStaffBo> list =new ArrayList<>();
|
||||
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/list");
|
||||
OapiV2UserListRequest req = new OapiV2UserListRequest();
|
||||
req.setDeptId(Long.parseLong(departmentId));
|
||||
req.setCursor(page);
|
||||
req.setSize(100L);
|
||||
req.setOrderField("modify_desc");
|
||||
req.setContainAccessLimit(false);
|
||||
req.setLanguage("zh_CN");
|
||||
/*OapiV2UserListResponse rsp = client.execute(req, accessToken);
|
||||
|
||||
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/user/listbypage");
|
||||
|
||||
OapiUserListbypageRequest req = new OapiUserListbypageRequest();
|
||||
req.setDepartmentId(Long.parseLong(departmentId));
|
||||
|
||||
req.setSize(100L);
|
||||
req.setHttpMethod("GET");*/
|
||||
|
||||
boolean isNext = false;
|
||||
for(; true; page++){
|
||||
req.setCursor(page);
|
||||
OapiV2UserListResponse rsp = client.execute(req, accessToken);
|
||||
logger.info("钉钉请求人员返回{}", rsp.getBody());
|
||||
JSONObject json = JSONObject.parseObject(rsp.getBody());
|
||||
if(json.getInteger("errcode") == 0){
|
||||
json = json.getJSONObject("result");
|
||||
JSONArray array = json.getJSONArray("list");
|
||||
isNext = json.getBoolean("has_more");//获取是否由更多数据
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
json = array.getJSONObject(i);
|
||||
DepartmentStaffBo departmentStaffBo = new DepartmentStaffBo();
|
||||
departmentStaffBo.setEmployeeId(json.getString("userid"));//用户在企业内部的唯一编号,创建时可指定。可代表一定的含义
|
||||
departmentStaffBo.setName(json.getString("name"));
|
||||
departmentStaffBo.setEmployeeNo(json.getString("job_number"));//工号
|
||||
departmentStaffBo.setUnionId(json.getString("unionid"));//企业内部id,唯一
|
||||
departmentStaffBo.setOpenId(departmentStaffBo.getUnionId());//和上面的值目前是一样的,未找到说明
|
||||
departmentStaffBo.setMobile(json.getString("mobile"));//手机,需要单独授权手机权限
|
||||
departmentStaffBo.setEmail(json.getString("email"));//邮箱,钉钉的企业邮箱才可以,需要单独授权手机权限
|
||||
departmentStaffBo.setAvatar(json.getString("avatar"));//头像
|
||||
departmentStaffBo.setPosition(json.getString("title"));
|
||||
if(mapProbation.containsKey(departmentStaffBo.getEmployeeId())){
|
||||
departmentStaffBo.setEmployeeType(2);
|
||||
}else{
|
||||
departmentStaffBo.setEmployeeType(1);
|
||||
}
|
||||
departmentStaffBo.setStatus(0);
|
||||
/*if(json.getBoolean("active")){
|
||||
//在职已激活
|
||||
departmentStaffBo.setStatus(0);
|
||||
}else{
|
||||
//在职未激活
|
||||
departmentStaffBo.setStatus(4);
|
||||
}*/
|
||||
if(json.getBoolean("leader")){
|
||||
departmentStaffBo.setIsLeader(1);
|
||||
|
||||
}else{
|
||||
departmentStaffBo.setIsLeader(0);
|
||||
}
|
||||
|
||||
if(json.getBoolean("boss")){
|
||||
departmentStaffBo.setIsBoss(1);
|
||||
|
||||
}else{
|
||||
departmentStaffBo.setIsBoss(0);
|
||||
}
|
||||
list.add(departmentStaffBo);
|
||||
}
|
||||
if(!isNext){
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
logger.info("获取人员详情异常{}", rsp.getBody());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
package com.lz.config;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@ -29,10 +30,13 @@ import static com.google.common.collect.Lists.newArrayList;
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig implements WebMvcConfigurer {
|
||||
|
||||
@Value(value = "${swagger.enable}")
|
||||
boolean enableSwagger;
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.enable(enableSwagger)
|
||||
.select()
|
||||
//加了ApiOperation注解的类,才生成接口文档
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
|
||||
@ -20,6 +20,7 @@ import com.lz.modules.flow.entity.*;
|
||||
import com.lz.modules.flow.model.*;
|
||||
import com.lz.modules.flow.req.ResultDetailReq;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.job.business.DingtalkBusiness;
|
||||
import com.lz.modules.sys.controller.AbstractController;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultComment;
|
||||
@ -105,6 +106,9 @@ public class ResultRecordController extends AbstractController {
|
||||
@Autowired
|
||||
private FlowChartDetailRecordService flowChartDetailRecordService;
|
||||
|
||||
@Autowired
|
||||
private DingtalkBusiness dingtalkBusiness;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ -331,6 +335,31 @@ public class ResultRecordController extends AbstractController {
|
||||
return R.ok().put("lzResultRecord", lzResultRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@GetMapping("/urging")
|
||||
@ApiOperation("绩效催办-吴林")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "绩效id")})
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = R.class)})
|
||||
public R getDetail(@RequestParam Long id) {
|
||||
ResultRecord lzResultRecord = lzResultRecordService.selectResultRecordById(id);
|
||||
//获取当前节点,谁在处理
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordsByRecordIdAndStatus(id, 2);
|
||||
if(flowRecords.size() > 0){
|
||||
List<Long> ids = flowRecords.stream().map(new Function<FlowRecord, Long>() {
|
||||
@Override
|
||||
public Long apply(FlowRecord flowRecord) {
|
||||
return flowRecord.getApprovalStaffId();
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
List<StaffEntity> staffs = staffService.selectNamesByIds(ids);
|
||||
dingtalkBusiness.sendNoticeMsg(lzResultRecord, staffs);
|
||||
return R.ok("催办成功");
|
||||
}
|
||||
return R.error("无可催办人员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
|
||||
@ -6,6 +6,7 @@ import com.lz.modules.app.dto.DepartmentsDto;
|
||||
import com.lz.modules.app.dto.StaffDepartmentDto;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.performance.dto.SimpleDepartmentDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -59,4 +60,9 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
|
||||
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
|
||||
|
||||
int delDepartments(@Param("list") List<DepartmentsEntity> departmentsEntities);
|
||||
|
||||
List<SimpleDepartmentDto> selectSimpleDepartmentByDepartmentIds(@Param("depIds") List<String> depIds);
|
||||
|
||||
SimpleDepartmentDto selectSimpleDepartmentByDepartmentId(@Param("departmentId") String departmentId);
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.lz.modules.app.dto.StaffOccupationInfoDto;
|
||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.performance.dto.StaffTypeDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -33,4 +34,8 @@ public interface StaffOccupationDao extends BaseMapper<StaffOccupationEntity> {
|
||||
void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo);
|
||||
|
||||
List<String> removeDimissionStaffByStaffIds(@Param("staffIds") List<String> staffIds);
|
||||
|
||||
List<StaffOccupationEntity> selectAll();
|
||||
|
||||
List<StaffTypeDto> selectStaffTypesByStaffIds(@Param("staffIds")List<Long> staffIds);
|
||||
}
|
||||
|
||||
@ -39,6 +39,11 @@ public class DepartmentsStaffRelateEntity implements Serializable {
|
||||
* 是否为部门领导
|
||||
*/
|
||||
private Integer isLeader;
|
||||
//获取mapkey
|
||||
public String getKey(){
|
||||
return departmentId + "_" + staffId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自增主键
|
||||
* @return
|
||||
|
||||
@ -105,4 +105,8 @@ public class StaffOccupationEntity implements Serializable {
|
||||
*/
|
||||
private String resumeUrl;
|
||||
|
||||
public String getKey(){
|
||||
return staffId + "_" + position;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -61,5 +61,7 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
|
||||
List<DepartmentsEntity> selectAll();
|
||||
|
||||
int delDepartments(List<DepartmentsEntity> departmentsEntities);
|
||||
|
||||
Map<Long,List<String>> selectDepartmentTreeByDepIds(List<String> depIds);
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import com.lz.common.utils.PageUtils;
|
||||
import com.lz.modules.app.dto.StaffOccupationInfoDto;
|
||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.performance.dto.StaffTypeDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -33,5 +34,9 @@ public interface StaffOccupationService extends IService<StaffOccupationEntity>
|
||||
void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo);
|
||||
|
||||
List<String> removeDimissionStaffByStaffIds(List<String> staffIds);
|
||||
|
||||
List<StaffOccupationEntity> selectAll();
|
||||
|
||||
List<StaffTypeDto> selectStaffTypesByStaffIds(List<Long> staffIds);
|
||||
}
|
||||
|
||||
|
||||
@ -105,5 +105,7 @@ public interface StaffService extends IService<StaffEntity> {
|
||||
List<StaffEntity> selectStaffsByGroupId(Long copyId);
|
||||
|
||||
List<StaffEntity> findManger(Long recordId, int flowProcess);
|
||||
|
||||
StaffEntity convertStaffEntity(DepartmentStaffBo staffBo);
|
||||
}
|
||||
|
||||
|
||||
@ -1,27 +1,28 @@
|
||||
package com.lz.modules.app.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.Query;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dao.DepartmentsDao;
|
||||
import com.lz.modules.app.dao.DepartmentsStaffRelateDao;
|
||||
import com.lz.modules.app.dao.StaffDao;
|
||||
import com.lz.modules.app.dto.DepartmentInfos;
|
||||
import com.lz.modules.app.dto.DepartmentsDto;
|
||||
import com.lz.modules.app.dto.StaffDepartmentDto;
|
||||
import com.lz.modules.app.dto.StaffDto;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
||||
import com.lz.modules.performance.dto.SimpleDepartmentDto;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -306,4 +307,64 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
||||
return departmentsDao.delDepartments(departmentsEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, List<String>> selectDepartmentTreeByDepIds(List<String> depIds) {
|
||||
Map<Long, List<String>> data = Maps.newHashMap();
|
||||
if(CollectionUtils.isEmpty(depIds)){
|
||||
return data;
|
||||
}
|
||||
|
||||
List<SimpleDepartmentDto> simpleDepartmentDtos = departmentsDao.selectSimpleDepartmentByDepartmentIds(depIds);
|
||||
List<String> depNames = Lists.newArrayList();
|
||||
//将数据分类
|
||||
Map<Long,SimpleDepartmentDto> dtos = Maps.newHashMap();
|
||||
for (SimpleDepartmentDto simpleDepartmentDto:simpleDepartmentDtos){
|
||||
dtos.put(Long.valueOf(simpleDepartmentDto.getDepartmentId()),simpleDepartmentDto);
|
||||
}
|
||||
|
||||
for (SimpleDepartmentDto simpleDepartmentDto:simpleDepartmentDtos) {
|
||||
List<String> names = recursiveToBuild(depNames, simpleDepartmentDto, dtos,simpleDepartmentDto.getLevel());
|
||||
data.put(Long.valueOf(simpleDepartmentDto.getDepartmentId()),names);
|
||||
}
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data 响应数据
|
||||
* @param departmentDto 当前部门信息
|
||||
* @param dtos 缓存,存在就不查数据库
|
||||
* @return
|
||||
*/
|
||||
private List<String> recursiveToBuild(List<String> data, SimpleDepartmentDto departmentDto,Map<Long,SimpleDepartmentDto> dtos, int level){
|
||||
if(departmentDto == null){
|
||||
logger.info("部门信息为空,截至当前数据data: " + JSON.toJSONString(data));
|
||||
return data;
|
||||
}
|
||||
data.add(departmentDto.getDepartmentName());
|
||||
if(level == 0){
|
||||
logger.info("部门级别为0,departmentId: " + departmentDto.getDepartmentId());
|
||||
return data;
|
||||
}
|
||||
if(level == data.size()){
|
||||
logger.info("数据填充结束,departmentId: " + departmentDto.getDepartmentId() + " ,level: " + level);
|
||||
return data;
|
||||
}
|
||||
SimpleDepartmentDto existSimpleDepartment = dtos.get(departmentDto.getDepartmentParentId());
|
||||
|
||||
if(existSimpleDepartment!=null){
|
||||
return recursiveToBuild(data,existSimpleDepartment,dtos,level);
|
||||
}
|
||||
else {
|
||||
SimpleDepartmentDto simpleDepartmentDto = departmentsDao.selectSimpleDepartmentByDepartmentId(departmentDto.getDepartmentParentId());
|
||||
if(simpleDepartmentDto!=null){
|
||||
dtos.put(Long.valueOf(departmentDto.getDepartmentParentId()),simpleDepartmentDto);
|
||||
}
|
||||
return recursiveToBuild(data,simpleDepartmentDto,dtos,level);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.lz.modules.app.dao.StaffOccupationDao;
|
||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||
import com.lz.modules.app.service.StaffOccupationService;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.performance.dto.StaffTypeDto;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -72,4 +73,14 @@ public class StaffOccupationServiceImpl extends ServiceImpl<StaffOccupationDao,
|
||||
}
|
||||
return staffOccupationDao.removeDimissionStaffByStaffIds(staffIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffOccupationEntity> selectAll(){
|
||||
return staffOccupationDao.selectAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffTypeDto> selectStaffTypesByStaffIds(List<Long> staffIds) {
|
||||
return staffOccupationDao.selectStaffTypesByStaffIds(staffIds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
||||
}
|
||||
}
|
||||
|
||||
private StaffEntity convertStaffEntity(DepartmentStaffBo staffBo) {
|
||||
public StaffEntity convertStaffEntity(DepartmentStaffBo staffBo) {
|
||||
StaffEntity staffEntity = new StaffEntity();
|
||||
staffEntity.setName(staffBo.getName());//员工姓名
|
||||
staffEntity.setGender(staffBo.getGender());
|
||||
|
||||
@ -90,5 +90,7 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
|
||||
|
||||
List<FlowRecord> selectSkipFlowRecordsById(@Param("recordId") Long recordId);
|
||||
|
||||
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);
|
||||
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") int flowIndex, @Param("status") int status);
|
||||
|
||||
List<FlowRecord> selectFlowRecordsByRecordIdAndStatus(@Param("recordId") Long recordId, @Param("status") int status);
|
||||
}
|
||||
@ -86,4 +86,6 @@ public interface FlowRecordService extends IService<FlowRecord> {
|
||||
List<FlowRecord> selectSkipFlowRecordsById(Long recordId);
|
||||
|
||||
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);
|
||||
|
||||
List<FlowRecord> selectFlowRecordsByRecordIdAndStatus(Long recordId, int status);
|
||||
}
|
||||
@ -38,4 +38,5 @@ public interface FlowService extends IService<Flow> {
|
||||
FlowChart selectFlowChartByChartId(Long flowId);
|
||||
|
||||
|
||||
FlowChart selectFlowChartByFlow(Flow flow);
|
||||
}
|
||||
@ -183,7 +183,6 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
group.setScore(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return pageUtils;
|
||||
|
||||
@ -231,4 +231,9 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
|
||||
return flowRecordMapper.selectFirstFlowRecordsByIdAndFlowIndex(recordId, flowIndex, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowRecord> selectFlowRecordsByRecordIdAndStatus(Long recordId, int status){
|
||||
return flowRecordMapper.selectFlowRecordsByRecordIdAndStatus(recordId, status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -77,6 +77,11 @@ public class FlowServiceImpl extends ServiceImpl<FlowMapper, Flow> implements Fl
|
||||
return flowChart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowChart selectFlowChartByFlow(Flow flow){
|
||||
FlowChart flowChart = flowChartService.selectFlowChartById(flow.getChartId());
|
||||
return flowChart;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2,22 +2,13 @@ package com.lz.modules.flow.service.impl;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.lz.common.emun.ChartOptType;
|
||||
import com.lz.common.emun.CheckStaffType;
|
||||
import com.lz.common.emun.WorkMsgTypeEnum;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.entity.StaffSimpleInfo;
|
||||
import com.lz.modules.app.enums.FlowApprovalRoleTypeEnums;
|
||||
import com.lz.modules.app.enums.FlowRecordStatusEnums;
|
||||
import com.lz.modules.app.enums.RoleEnums;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.dao.EvaluationStartStaffMapper;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
import com.lz.modules.flow.entity.*;
|
||||
import com.lz.modules.flow.model.*;
|
||||
@ -28,22 +19,15 @@ import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import com.lz.modules.third.entity.ThirdAppConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -839,12 +823,12 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
}
|
||||
|
||||
public class ThreadInitFlowRecord implements Runnable{
|
||||
List<StartStartDto> resultRecords;
|
||||
List<StartStartDto> resultStarts;
|
||||
List<StaffSimpleInfo> noticeStaff;
|
||||
|
||||
public ThreadInitFlowRecord(List<StartStartDto> resultRecords, List<StaffSimpleInfo> noticeStaff){
|
||||
|
||||
this.resultRecords = resultRecords;
|
||||
this.resultStarts = resultRecords;
|
||||
this.noticeStaff = noticeStaff;
|
||||
}
|
||||
|
||||
@ -853,12 +837,14 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
||||
String oldNo = Logger.inheritableThreadLocalNo.get();//.threadLocalNo.get();
|
||||
String newNo = oldNo + "_initFlowRecord" ;//+ resultRecord.getStaffId() + "_" + resultRecord.getId();
|
||||
ch.qos.logback.classic.Logger.threadLocalNo.set(newNo);
|
||||
log.info("开始批量初始化流程,数量{}", resultRecords.size());
|
||||
log.info("开始批量初始化流程,任务数量{}", resultStarts.size());
|
||||
|
||||
for (StartStartDto startStartDto:resultRecords
|
||||
for (StartStartDto startStartDto: resultStarts
|
||||
) {
|
||||
log.info("初始化任务中绩效数量{}", startStartDto.getResultRecordList().size());
|
||||
for (ResultRecord resultRecord:startStartDto.getResultRecordList()
|
||||
) {
|
||||
log.info("初始化绩效{}", resultRecord);
|
||||
resultRecordService.initFlowRecord(resultRecord, startStartDto.getFlows(), startStartDto.getFlowApprovalRoles());
|
||||
}
|
||||
|
||||
|
||||
@ -1,15 +1,22 @@
|
||||
package com.lz.modules.job.business;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dingtalk.api.DefaultDingTalkClient;
|
||||
import com.dingtalk.api.DingTalkClient;
|
||||
import com.dingtalk.api.request.OapiRoleListRequest;
|
||||
import com.dingtalk.api.request.OapiRoleSimplelistRequest;
|
||||
import com.dingtalk.api.request.OapiSmartworkHrmEmployeeQueryonjobRequest;
|
||||
import com.dingtalk.api.response.OapiRoleListResponse;
|
||||
import com.dingtalk.api.response.OapiRoleSimplelistResponse;
|
||||
import com.dingtalk.api.response.OapiSmartworkHrmEmployeeQueryonjobResponse;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.lz.common.emun.WorkMsgTypeEnum;
|
||||
import com.lz.common.utils.DateUtils;
|
||||
import com.lz.common.utils.DingTalkUtil;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.app.dao.StaffDao;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||
import com.lz.modules.app.entity.StaffSimpleInfo;
|
||||
import com.lz.modules.app.entity.*;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.app.service.StaffOccupationService;
|
||||
@ -31,17 +38,18 @@ import com.lz.modules.third.entity.ThirdMsgSendRecord;
|
||||
import com.lz.modules.third.entity.WorkMsg;
|
||||
import com.lz.modules.third.service.ThirdAppConfigService;
|
||||
import com.lz.modules.third.service.ThirdMsgSendRecordService;
|
||||
import com.taobao.api.ApiException;
|
||||
import org.apache.commons.collections.map.CompositeMap;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -95,6 +103,7 @@ public class DingtalkBusiness {
|
||||
@Resource
|
||||
StaffDao staffDao;
|
||||
|
||||
static String homeUrl = "https://lzmanagement.ldxinyong.com/digitization";
|
||||
|
||||
@Value("${dingtalk.appid}")
|
||||
private String appid;
|
||||
@ -131,75 +140,465 @@ public class DingtalkBusiness {
|
||||
//获取Token
|
||||
String token = dingTalkUtil.getAccessToken(appid);
|
||||
if(token != null && token.length() > 0){
|
||||
|
||||
/*DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/role/list");
|
||||
OapiRoleListRequest request = new OapiRoleListRequest();
|
||||
request.setOffset(0L);
|
||||
request.setSize(10L);
|
||||
|
||||
OapiRoleListResponse response = null;
|
||||
try {
|
||||
response = client.execute(request, token);
|
||||
logger.info("角色返回{}", response.getBody());
|
||||
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
|
||||
JSONArray jsonArray = jsonObject.getJSONObject("result").getJSONArray("list");
|
||||
for (int i = 0; i < jsonArray.size(); i++
|
||||
) {
|
||||
JSONObject json = jsonArray.getJSONObject(i);
|
||||
JSONArray array = json.getJSONArray("roles");
|
||||
logger.info("角色组{}", json.getString("name"));
|
||||
for(int j = 0; j < array.size(); j++){
|
||||
json = array.getJSONObject(j);
|
||||
client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/role/simplelist");
|
||||
OapiRoleSimplelistRequest request1 = new OapiRoleSimplelistRequest();
|
||||
request1.setRoleId(json.getLong("id"));
|
||||
request1.setOffset(0L);
|
||||
request1.setSize(200L);
|
||||
|
||||
OapiRoleSimplelistResponse response1 = client.execute(request1, token);
|
||||
logger.info("钉钉获取角色{},数据为{}", json.getString("name"), response1.getBody());
|
||||
}
|
||||
}
|
||||
} catch (ApiException e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
List<DepartmentsEntity> addDeparts = new ArrayList<>();//需要新增的部门信息
|
||||
List<DepartmentsEntity> updateDeparts = new ArrayList<>();//需要更新的部门信息
|
||||
|
||||
List<StaffEntity> addStaffs = new ArrayList<>();//需要新增的人员信息
|
||||
List<StaffEntity> updateStaffs = new ArrayList<>();//需要更新的人员
|
||||
|
||||
List<DepartmentsStaffRelateEntity> addDepartStaff = new ArrayList<>();//需要新增的部门人员对应关系
|
||||
List<DepartmentsStaffRelateEntity> updateDepartStaff = new ArrayList<>();//需要更新部门人员对应关系
|
||||
Map<String, DepartmentsStaffRelateEntity> mapEmployeeIdDeparts = new HashedMap();//新员工对应的部门对应关系
|
||||
|
||||
List<StaffOccupationEntity> addStaffOcc = new ArrayList<>();//需要新增的职位信息
|
||||
List<StaffOccupationEntity> updateStaffOcc = new ArrayList<>();//需要更新的职位信息
|
||||
Map<String, StaffOccupationEntity> mapEmployeeIdStaffOccs = new HashedMap();//新员工对应的职位对应关系
|
||||
|
||||
List<String> newDepartIds = new ArrayList<>();//新的部门或者新的人员对应信息
|
||||
List<String> newPositions = new ArrayList<>();//新的职位或者新的人员对应信息
|
||||
|
||||
//获取所有的部门详情
|
||||
Map<String, DepartmentInfosBo> departmentInfosBos = dingTalkUtil.getDepartmentDetails(token, "1");
|
||||
List<DepartmentInfosBo> departmentInfosBos = dingTalkUtil.getDepartmentDetailsV2(token, "1");
|
||||
|
||||
if(departmentInfosBos.size() > 0){
|
||||
//获取所有部门信息
|
||||
List<String> probationUserIDS = getProbationStaff(token);//获取试用期人员信息
|
||||
Map<String, String> mapProbation =
|
||||
probationUserIDS.stream().collect(Collectors.toMap(String::toString, Function.identity(), (e, r) -> e));
|
||||
//获取原有部门信息
|
||||
Map<String, DepartmentInfosBo> mapDepartmentInfosBos
|
||||
= departmentInfosBos.stream().collect(Collectors.toMap(DepartmentInfosBo::getId, Function.identity(), (e, r) -> e));
|
||||
List<DepartmentsEntity> departmentsEntities = departmentsService.selectAll();
|
||||
Map<String, DepartmentsEntity> mapDeparts =
|
||||
Map<String, DepartmentsEntity> mapDeparts = null;
|
||||
if(departmentsEntities.size() > 0){
|
||||
mapDeparts =
|
||||
departmentsEntities.stream().collect(Collectors.toMap(DepartmentsEntity::getDepartmentId, Function.identity(), (e, r) -> e));
|
||||
//更新数据库中的部门相关信息
|
||||
//departmentsService.updateDepartmentInfos(departmentInfosBos);
|
||||
}
|
||||
|
||||
//获取原有的部门人员对应关系
|
||||
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll();
|
||||
|
||||
Map<String, DepartmentsStaffRelateEntity> mapDepStaffs = null;
|
||||
if(departmentsStaffRelateEntities.size() > 0){
|
||||
mapDepStaffs =
|
||||
departmentsStaffRelateEntities.stream().collect(
|
||||
Collectors.toMap(DepartmentsStaffRelateEntity::getKey,
|
||||
Function.identity(), (e, r) -> e));
|
||||
}
|
||||
|
||||
//获取所有人员信息
|
||||
List<StaffEntity> staffEntities = staffService.selectAll();
|
||||
Map<String, StaffEntity> mapStaffs = null;
|
||||
if(staffEntities.size() > 0){
|
||||
mapStaffs = staffEntities.stream().
|
||||
collect(Collectors.toMap(StaffEntity::getEmployeeId, Function.identity(), (e, r)->e));
|
||||
}
|
||||
Map<String, StaffEntity> mapMorDepartStaffs = new HashedMap();//跨部门人员
|
||||
List<StaffOccupationEntity> staffOccupationEntities = staffOccupationService.selectAll();
|
||||
Map<String, StaffOccupationEntity> mapStaffOccs = null;
|
||||
if(staffOccupationEntities.size() > 0){
|
||||
mapStaffOccs =
|
||||
staffOccupationEntities.stream().collect(Collectors.toMap(StaffOccupationEntity::getKey, Function.identity(), (e, r) -> e));
|
||||
}
|
||||
Map<String, StaffOccupationEntity> mapHaveStaffOccs = new HashedMap();
|
||||
|
||||
//删除原有的对应关系下面在更新
|
||||
departmentsStaffRelateService.deleteAllRelates();
|
||||
//未在飞书组织架构里的成员,置为离职(全部置为离职,再把在职的恢复)
|
||||
staffOccupationService.updateAllOccupation();
|
||||
//获取飞书部门对应的用户详情
|
||||
for (String key : departmentInfosBos.keySet()) {
|
||||
if(mapDeparts.containsKey(key)){
|
||||
for (DepartmentInfosBo departmentInfo : departmentInfosBos) {
|
||||
//DepartmentInfosBo departmentInfo = departmentInfosBos.get(key);
|
||||
String key = departmentInfo.getId();
|
||||
DepartmentsEntity departmentsEntity = null;
|
||||
if(mapDeparts != null && mapDeparts.containsKey(key)){
|
||||
//部门存在
|
||||
departmentsEntity = mapDeparts.get(key);
|
||||
updateDeparts.add(departmentsEntity);
|
||||
mapDeparts.remove(key);
|
||||
}else{//新增部门信息
|
||||
departmentsEntity = new DepartmentsEntity();
|
||||
departmentsEntity.setDepartmentId(departmentInfo.getId());
|
||||
addDeparts.add(departmentsEntity);
|
||||
}
|
||||
DepartmentInfosBo departmentInfo = departmentInfosBos.get(key);
|
||||
|
||||
//获取部门用户详情
|
||||
List<DepartmentStaffBo> staffs = dingTalkUtil.getDepartmentStaffDetails(token, departmentInfo.getId());
|
||||
List<DepartmentStaffBo> staffs = dingTalkUtil.getDepartmentStaffDetailsV2(token, departmentInfo.getId(), mapProbation);
|
||||
logger.info("=============================" + departmentInfo.getName() + "================================");
|
||||
|
||||
//departmentInfo.setMemberCount(staffs.size());//设置部门人数,钉钉没有返回部门人数,只能这样设置
|
||||
//计算父类的
|
||||
DepartmentInfosBo integer = departmentInfo;
|
||||
while(!integer.getParentId().equals("1")){
|
||||
integer = departmentInfosBos.get(integer.getParentId());
|
||||
if(integer.getMemberCount() == null){
|
||||
integer.setMemberCount(0);
|
||||
}
|
||||
integer.setMemberCount(integer.getMemberCount() + staffs.size());
|
||||
|
||||
}
|
||||
//获取自己的
|
||||
//设置本部门人数
|
||||
if(departmentInfo.getMemberCount() == null){
|
||||
departmentInfo.setMemberCount(0);
|
||||
}
|
||||
departmentInfo.setMemberCount(departmentInfo.getMemberCount() + staffs.size());
|
||||
//计算父类的
|
||||
DepartmentInfosBo integer = departmentInfo;
|
||||
while(!integer.getParentId().equals("1")){
|
||||
integer = mapDepartmentInfosBos.get(integer.getParentId());
|
||||
if(integer.getMemberCount() == null){
|
||||
integer.setMemberCount(0);
|
||||
}
|
||||
integer.setMemberCount(integer.getMemberCount() + staffs.size());
|
||||
}
|
||||
|
||||
if(staffs.size() > 0){
|
||||
//循环录入到员工信息表中
|
||||
if(staffService.updateStaffsInfo(staffs)){
|
||||
//加入到部门和员工关系表,同时更新leader关系
|
||||
departmentsStaffRelateService.addRelateInfos(departmentInfo.getId(), staffs);
|
||||
//录入员工职业信息表
|
||||
enterStaffOccupationInfos(staffs);
|
||||
for (DepartmentStaffBo departmentStaffBo:staffs
|
||||
) {
|
||||
StaffEntity staff = staffService.convertStaffEntity(departmentStaffBo);
|
||||
if(mapStaffs != null && mapStaffs.containsKey(departmentStaffBo.getEmployeeId())){//老员工
|
||||
StaffEntity entity = mapStaffs.get(departmentStaffBo.getEmployeeId());
|
||||
staff.setId(entity.getId());
|
||||
staff.setCreateTime(entity.getCreateTime());
|
||||
staff.setUpdateTime(new Date());
|
||||
updateStaffs.add(staff);
|
||||
if(!mapMorDepartStaffs.containsKey(departmentStaffBo.getEmployeeId())){
|
||||
mapMorDepartStaffs.put(departmentStaffBo.getEmployeeId(), staff);
|
||||
}
|
||||
mapStaffs.remove(departmentStaffBo.getEmployeeId());
|
||||
|
||||
StaffOccupationEntity staffOccupation = new StaffOccupationEntity();
|
||||
staffOccupation.setStaffId(staff.getId());
|
||||
staffOccupation.setPosition(departmentStaffBo.getPosition());//职位信息
|
||||
staffOccupation.setEmployeeNo(departmentStaffBo.getEmployeeNo());
|
||||
staffOccupation.setStaffNo(departmentStaffBo.getEmployeeNo());//钉钉的员工工号
|
||||
staffOccupation.setStaffType(departmentStaffBo.getEmployeeType());
|
||||
staffOccupation.setStaffStatus(departmentStaffBo.getStatus());
|
||||
String key1 = entity.getId() + "_" + staffOccupation.getPosition();
|
||||
if(mapStaffOccs != null && mapStaffOccs.containsKey(key1)){//职位信息已存在,更新
|
||||
StaffOccupationEntity staffOccupation1 = mapStaffOccs.get(key1);
|
||||
staffOccupation.setId(staffOccupation1.getId());
|
||||
staffOccupation.setUpdateTime(new Date());
|
||||
updateStaffOcc.add(staffOccupation);
|
||||
mapStaffOccs.remove(key1);
|
||||
mapHaveStaffOccs.put(key1, staffOccupation);
|
||||
}else if(!mapHaveStaffOccs.containsKey(key1)){//职位信息不存在,新建
|
||||
|
||||
addStaffOcc.add(staffOccupation);
|
||||
mapHaveStaffOccs.put(key1, staffOccupation);
|
||||
}
|
||||
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = new DepartmentsStaffRelateEntity();
|
||||
departmentsStaffRelateEntity.setDepartmentId(departmentInfo.getId());
|
||||
departmentsStaffRelateEntity.setStaffId(staff.getId());
|
||||
departmentsStaffRelateEntity.setIsLeader(departmentStaffBo.getIsLeader());
|
||||
if(mapDepStaffs != null && mapDepStaffs.containsKey(departmentsStaffRelateEntity.getKey())){//对应关系已经存在
|
||||
DepartmentsStaffRelateEntity staffRelateEntityentity1 = mapDepStaffs.get(departmentsStaffRelateEntity.getKey());
|
||||
if(staffRelateEntityentity1.getIsLeader().intValue() != departmentsStaffRelateEntity.getIsLeader().intValue()){
|
||||
departmentsStaffRelateEntity.setId(staffRelateEntityentity1.getId());
|
||||
departmentsStaffRelateEntity.setUpdateTime(new Date());
|
||||
updateDepartStaff.add(departmentsStaffRelateEntity);
|
||||
|
||||
}
|
||||
mapDepStaffs.remove(departmentsStaffRelateEntity.getKey());
|
||||
|
||||
}else{//不存在对应关系
|
||||
addDepartStaff.add(departmentsStaffRelateEntity);
|
||||
}
|
||||
}else if(mapMorDepartStaffs.containsKey(departmentStaffBo.getEmployeeId())){
|
||||
//跨部门人员
|
||||
StaffEntity entity = mapMorDepartStaffs.get(departmentStaffBo.getEmployeeId());
|
||||
staff.setId(entity.getId());
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = new DepartmentsStaffRelateEntity();
|
||||
departmentsStaffRelateEntity.setDepartmentId(departmentInfo.getId());
|
||||
departmentsStaffRelateEntity.setIsLeader(departmentStaffBo.getIsLeader());
|
||||
departmentsStaffRelateEntity.setStaffId(staff.getId());
|
||||
|
||||
StaffOccupationEntity staffOccupation = new StaffOccupationEntity();
|
||||
staffOccupation.setStaffId(staff.getId());
|
||||
staffOccupation.setPosition(departmentStaffBo.getPosition());//职位信息
|
||||
staffOccupation.setEmployeeNo(departmentStaffBo.getEmployeeNo());
|
||||
staffOccupation.setStaffNo(departmentStaffBo.getEmployeeNo());//钉钉的员工工号
|
||||
staffOccupation.setStaffType(departmentStaffBo.getEmployeeType());
|
||||
staffOccupation.setStaffStatus(departmentStaffBo.getStatus());
|
||||
|
||||
|
||||
if(entity.getId() == null){//新用户
|
||||
key = staff.getEmployeeId() + "_" + departmentsStaffRelateEntity.getDepartmentId();
|
||||
if(!mapEmployeeIdDeparts.containsKey(key)){
|
||||
|
||||
departmentsStaffRelateEntity.setIsLeader(departmentStaffBo.getIsLeader());
|
||||
mapEmployeeIdDeparts.put(key
|
||||
, departmentsStaffRelateEntity);
|
||||
newDepartIds.add(departmentsStaffRelateEntity.getDepartmentId());
|
||||
}
|
||||
|
||||
key = staff.getEmployeeId() + "_" + staffOccupation.getPosition();
|
||||
if(!mapEmployeeIdStaffOccs.containsKey(key)){
|
||||
|
||||
mapEmployeeIdStaffOccs.put(key
|
||||
, staffOccupation);
|
||||
newPositions.add(departmentStaffBo.getPosition());
|
||||
}
|
||||
}else{
|
||||
String key1 = entity.getId() + "_" + staffOccupation.getPosition();
|
||||
if(mapStaffOccs != null && mapStaffOccs.containsKey(key1)){//职位信息已存在,更新
|
||||
StaffOccupationEntity staffOccupation1 = mapStaffOccs.get(key1);
|
||||
staffOccupation.setId(staffOccupation1.getId());//职位信息
|
||||
staffOccupation.setUpdateTime(new Date());
|
||||
updateStaffOcc.add(staffOccupation);
|
||||
mapStaffOccs.remove(key1);
|
||||
mapHaveStaffOccs.put(key1, staffOccupation);
|
||||
}else if(!mapHaveStaffOccs.containsKey(key1)){//职位信息不存在,新建
|
||||
addStaffOcc.add(staffOccupation);
|
||||
mapHaveStaffOccs.put(key1, staffOccupation);
|
||||
}
|
||||
|
||||
if(mapDepStaffs != null && mapDepStaffs.containsKey(departmentsStaffRelateEntity.getKey())){//对应关系已经存在
|
||||
DepartmentsStaffRelateEntity staffRelateEntityentity1 = mapDepStaffs.get(departmentsStaffRelateEntity.getKey());
|
||||
if(staffRelateEntityentity1.getIsLeader().intValue() != departmentsStaffRelateEntity.getIsLeader().intValue()){
|
||||
departmentsStaffRelateEntity.setId(staffRelateEntityentity1.getId());
|
||||
departmentsStaffRelateEntity.setUpdateTime(new Date());
|
||||
updateDepartStaff.add(departmentsStaffRelateEntity);
|
||||
|
||||
}
|
||||
mapDepStaffs.remove(departmentsStaffRelateEntity.getKey());
|
||||
}else{//不存在对应关系
|
||||
addDepartStaff.add(departmentsStaffRelateEntity);
|
||||
}
|
||||
}
|
||||
}else{//新的员工信息
|
||||
addStaffs.add(staff);
|
||||
|
||||
if(!mapMorDepartStaffs.containsKey(departmentStaffBo.getEmployeeId())){
|
||||
mapMorDepartStaffs.put(departmentStaffBo.getEmployeeId(), staff);
|
||||
}
|
||||
|
||||
//新增部门人员对应关系,新增人员后插入数据库
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = new DepartmentsStaffRelateEntity();
|
||||
departmentsStaffRelateEntity.setDepartmentId(departmentInfo.getId());
|
||||
key = staff.getEmployeeId() + "_" + departmentsStaffRelateEntity.getDepartmentId();
|
||||
if(!mapEmployeeIdDeparts.containsKey(key)){
|
||||
|
||||
departmentsStaffRelateEntity.setIsLeader(departmentStaffBo.getIsLeader());
|
||||
mapEmployeeIdDeparts.put(key
|
||||
, departmentsStaffRelateEntity);
|
||||
newDepartIds.add(departmentsStaffRelateEntity.getDepartmentId());
|
||||
}
|
||||
|
||||
//新增人员职位信息,新增人员后插入数据库
|
||||
StaffOccupationEntity staffOccupation = new StaffOccupationEntity();
|
||||
staffOccupation.setPosition(departmentStaffBo.getPosition());//职位信息
|
||||
key = staff.getEmployeeId() + "_" + staffOccupation.getPosition();
|
||||
if(!mapEmployeeIdStaffOccs.containsKey(key)){
|
||||
|
||||
staffOccupation.setEmployeeNo(departmentStaffBo.getEmployeeNo());
|
||||
staffOccupation.setStaffNo(departmentStaffBo.getEmployeeNo());//钉钉的员工工号
|
||||
staffOccupation.setStaffType(departmentStaffBo.getEmployeeType());
|
||||
staffOccupation.setStaffStatus(departmentStaffBo.getStatus());
|
||||
mapEmployeeIdStaffOccs.put(key
|
||||
, staffOccupation);
|
||||
newPositions.add(departmentStaffBo.getPosition());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for (String key : departmentInfosBos.keySet()) {
|
||||
DepartmentInfosBo departmentInfo = departmentInfosBos.get(key);
|
||||
departmentsService.updateDepartmentInfo(departmentInfo);
|
||||
}
|
||||
if(mapDeparts.size() > 0){//有需要删除的部门信息
|
||||
}
|
||||
if(mapDeparts != null && mapDeparts.size() > 0){//有需要删除的部门信息
|
||||
logger.info("删除部门信息个数{}", mapDeparts.size());
|
||||
departmentsEntities = mapDeparts.values().stream().collect(Collectors.toList());
|
||||
departmentsService.delDepartments(departmentsEntities);
|
||||
for(DepartmentsEntity entity:departmentsEntities) {
|
||||
entity.setIsDelete(1);
|
||||
entity.setUpdateTime(new Date());
|
||||
}
|
||||
departmentsService.updateBatchById(departmentsEntities);
|
||||
}
|
||||
if(addDeparts.size() > 0){//有新增部门
|
||||
logger.info("新增部门信息个数{}", addDeparts.size());
|
||||
for (DepartmentsEntity entity:addDeparts
|
||||
) {
|
||||
DepartmentInfosBo departmentInfo = mapDepartmentInfosBos.get(entity.getDepartmentId());
|
||||
entity.setDepartmentId(departmentInfo.getId());
|
||||
entity.setDepartmentName(departmentInfo.getName());
|
||||
entity.setDepartmentParentId(departmentInfo.getParentId());
|
||||
entity.setMemberCount(departmentInfo.getMemberCount());
|
||||
entity.setChatId(departmentInfo.getChatId());
|
||||
entity.setLeaderEmployeeId(departmentInfo.getLeaderEmployeeId());
|
||||
entity.setLeaderOpenId(departmentInfo.getLeaderOpenId());
|
||||
entity.setStatus(1);
|
||||
}
|
||||
departmentsService.saveBatch(addDeparts);
|
||||
}
|
||||
|
||||
if(updateDeparts.size() > 0){//有新增部门
|
||||
logger.info("更新部门信息个数{}", updateDeparts.size());
|
||||
for (DepartmentsEntity entity:updateDeparts
|
||||
) {
|
||||
DepartmentInfosBo departmentInfo = mapDepartmentInfosBos.get(entity.getDepartmentId());
|
||||
entity.setDepartmentId(departmentInfo.getId());
|
||||
entity.setDepartmentName(departmentInfo.getName());
|
||||
entity.setDepartmentParentId(departmentInfo.getParentId());
|
||||
entity.setMemberCount(departmentInfo.getMemberCount());
|
||||
entity.setChatId(departmentInfo.getChatId());
|
||||
entity.setLeaderEmployeeId(departmentInfo.getLeaderEmployeeId());
|
||||
entity.setLeaderOpenId(departmentInfo.getLeaderOpenId());
|
||||
entity.setStatus(1);
|
||||
}
|
||||
departmentsService.updateBatchById(updateDeparts);
|
||||
}
|
||||
|
||||
if(addStaffs.size() > 0){//有新增部门
|
||||
logger.info("新增人员信息个数{}", addStaffs.size());
|
||||
|
||||
staffService.saveBatch(addStaffs);
|
||||
String key;
|
||||
for (StaffEntity entity:addStaffs
|
||||
) {
|
||||
for (String departId:newDepartIds
|
||||
) {
|
||||
key = entity.getEmployeeId() + "_" + departId;
|
||||
if(mapEmployeeIdDeparts.containsKey(key)){
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity =
|
||||
mapEmployeeIdDeparts.get(key);
|
||||
departmentsStaffRelateEntity.setStaffId(entity.getId());
|
||||
addDepartStaff.add(departmentsStaffRelateEntity);
|
||||
mapEmployeeIdDeparts.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
for (String position:newPositions
|
||||
) {
|
||||
key = entity.getEmployeeId() + "_" + position;
|
||||
if(mapEmployeeIdStaffOccs.containsKey(key)){
|
||||
StaffOccupationEntity staffOccupation = mapEmployeeIdStaffOccs.get(key);
|
||||
staffOccupation.setStaffId(entity.getId());
|
||||
addStaffOcc.add(staffOccupation);
|
||||
mapEmployeeIdStaffOccs.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(updateStaffs.size() > 0){//有新增部门
|
||||
logger.info("更新人员信息个数{}", updateStaffs.size());
|
||||
staffService.updateBatchById(updateStaffs);
|
||||
}
|
||||
|
||||
if(mapDepStaffs != null && mapDepStaffs.size() > 0){
|
||||
logger.info("删除人员部门个数{}", mapDepStaffs.size());
|
||||
departmentsStaffRelateEntities = mapDepStaffs.values().stream().collect(Collectors.toList());
|
||||
for (DepartmentsStaffRelateEntity entity:departmentsStaffRelateEntities
|
||||
) {
|
||||
entity.setIsDelete(1);
|
||||
}
|
||||
departmentsStaffRelateService.updateBatchById(departmentsStaffRelateEntities);
|
||||
}
|
||||
|
||||
if(addDepartStaff.size() > 0){//有新增部门
|
||||
logger.info("新增部门人员对应关系个数{}", addDepartStaff.size());
|
||||
departmentsStaffRelateService.saveBatch(addDepartStaff);
|
||||
|
||||
}
|
||||
|
||||
if(updateDepartStaff.size() > 0){//有新增部门
|
||||
logger.info("更新部门人员对应关系个数{}", updateDepartStaff.size());
|
||||
departmentsStaffRelateService.updateBatchById(updateDepartStaff);
|
||||
}
|
||||
|
||||
if(addStaffOcc.size() > 0){//有新增部门
|
||||
logger.info("新增人员职位对应关系个数{}", addStaffOcc.size());
|
||||
staffOccupationService.saveBatch(addStaffOcc);
|
||||
|
||||
}
|
||||
|
||||
if(updateStaffOcc.size() > 0){//有新增部门
|
||||
logger.info("更新人员对职位应关系个数{}", updateStaffOcc.size());
|
||||
staffOccupationService.updateBatchById(updateStaffOcc);
|
||||
}
|
||||
|
||||
if(mapStaffs != null && mapStaffs.size() > 0){//离职人员
|
||||
logger.info("离职人员可能个数{}", mapStaffs.size());
|
||||
if(mapStaffOccs != null && mapStaffOccs.size() > 0){
|
||||
logger.info("离职人员对应的职位信息个数{}", mapStaffs.size());
|
||||
staffEntities = mapStaffs.values().stream().collect(Collectors.toList());
|
||||
staffOccupationEntities.clear();
|
||||
for (StaffEntity entity:staffEntities
|
||||
) {
|
||||
if(mapStaffOccs.containsKey(entity.getId())){
|
||||
StaffOccupationEntity staffOccupationEntity = mapStaffOccs.get(entity.getId());
|
||||
if(staffOccupationEntity.getStaffStatus().intValue() == 0){
|
||||
staffOccupationEntity.setStaffStatus(1);
|
||||
staffOccupationEntity.setUpdateTime(new Date());
|
||||
staffOccupationEntities.add(staffOccupationEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("离职人员实际个数{}", staffOccupationEntities.size());
|
||||
staffOccupationService.updateBatchById(staffOccupationEntities);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.info("部门信息为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getProbationStaff(String token){
|
||||
//获取试用期员工信息
|
||||
|
||||
try {
|
||||
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/queryonjob");
|
||||
OapiSmartworkHrmEmployeeQueryonjobRequest req = new OapiSmartworkHrmEmployeeQueryonjobRequest();
|
||||
Long offSet = 0L;
|
||||
req.setStatusList("2");
|
||||
req.setSize(50L);
|
||||
boolean isNext = false;
|
||||
List<String> ids = new ArrayList<>();
|
||||
{
|
||||
req.setOffset(offSet);
|
||||
OapiSmartworkHrmEmployeeQueryonjobResponse rsp = client.execute(req, token);
|
||||
logger.info("钉钉请求试用期员工返回信息{}", rsp.getBody());
|
||||
JSONObject jsonObject = JSONObject.parseObject(rsp.getBody());
|
||||
if(jsonObject.getIntValue("errcode") == 0){
|
||||
jsonObject = jsonObject.getJSONObject("result");
|
||||
offSet = jsonObject.getLong("next_cursor");
|
||||
if(offSet != null){
|
||||
isNext = true;
|
||||
}
|
||||
JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("data_list"));
|
||||
ids.addAll(Arrays.stream(jsonArray.toArray(new String[jsonArray.size()])).collect(Collectors.toList()));
|
||||
}else{
|
||||
logger.info("钉钉请求返回错误{}", jsonObject);
|
||||
}
|
||||
}while(isNext)
|
||||
return ids;
|
||||
|
||||
} catch (ApiException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void enterStaffOccupationInfos(List<DepartmentStaffBo> staffs) {
|
||||
@ -227,6 +626,45 @@ public class DingtalkBusiness {
|
||||
}
|
||||
}
|
||||
|
||||
public String sendNoticeMsg(ResultRecord lzResultRecord, List<StaffEntity> staffs) {
|
||||
|
||||
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
||||
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
|
||||
if(token != null && token.length() > 0){
|
||||
String url = homeUrl;
|
||||
if(url.contains("?")){
|
||||
url += "&halokit=" + System.currentTimeMillis();
|
||||
}else{
|
||||
url += "?halokit=" + System.currentTimeMillis();
|
||||
}
|
||||
url += ("&detail=1&id=" + lzResultRecord.getId());
|
||||
url = URLEncoder.encode(url);
|
||||
|
||||
|
||||
url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
|
||||
"&container_type=work_platform&app_id=0_" +
|
||||
appid + "&redirect_type=jump&redirect_url=" + url;
|
||||
logger.info("推送消息个数{}", staffs.size());
|
||||
for (StaffEntity info:
|
||||
staffs) {
|
||||
logger.info("发送消息给{},url:{}", info, url);
|
||||
String content = null;
|
||||
if(!lzResultRecord.getStaffName().equals(info.getName())){
|
||||
content = WorkMsgTypeEnum.URGING.getContent().replace("@", lzResultRecord.getStaffName());
|
||||
}else{
|
||||
content = WorkMsgTypeEnum.URGING.getContent().replace("@", "您");
|
||||
}
|
||||
|
||||
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.URGING.getTitle(),
|
||||
content, WorkMsgTypeEnum.URGING.getBtnText(), url, token);
|
||||
}
|
||||
return "OK";
|
||||
|
||||
}else{
|
||||
return "token无效";
|
||||
}
|
||||
}
|
||||
|
||||
public String sendWorkMSG(String appid, Long fromStaffid, long toStaffid, int type) {
|
||||
//获取Token
|
||||
StaffEntity toStaffEntity = staffService.selectStaffById(toStaffid);
|
||||
@ -383,13 +821,15 @@ public class DingtalkBusiness {
|
||||
return R.error("未授权登录");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class ThreadSendMessage implements Runnable{
|
||||
List<StaffSimpleInfo> toStaffids;
|
||||
StaffSimpleInfo fromStaff = null;
|
||||
List<Long> recordIds;
|
||||
WorkMsgTypeEnum workMsgTypeEnum;
|
||||
String appid;
|
||||
String hostUrl = "https://lzmanagement.ldxinyong.com/digitization";
|
||||
String hostUrl = homeUrl;
|
||||
public ThreadSendMessage(StaffSimpleInfo fromStaff, List<StaffSimpleInfo> toStaffids, WorkMsgTypeEnum typeEnum, String appid){
|
||||
this.fromStaff = fromStaff;
|
||||
this.toStaffids = toStaffids;
|
||||
|
||||
@ -82,6 +82,10 @@ public class DepartmentStaffBo implements Serializable {
|
||||
*/
|
||||
private Integer isLeader;
|
||||
|
||||
/***
|
||||
* 是否为老板
|
||||
*/
|
||||
private Integer isBoss;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dto.StaffSimpleDto;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.service.EvaluationStartStaffService;
|
||||
import com.lz.modules.performance.req.AssessChangeReq;
|
||||
import com.lz.modules.performance.req.AssessListReq;
|
||||
import com.lz.modules.performance.req.AssessDetailReq;
|
||||
@ -47,6 +48,7 @@ public class AssessManagerController extends AbstractController{
|
||||
private ChartResultService chartResultService;
|
||||
|
||||
|
||||
|
||||
@PostMapping("assess/manager/list")
|
||||
@ApiOperation("获取考核列表")
|
||||
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerListRes.class)})
|
||||
@ -115,9 +117,6 @@ public class AssessManagerController extends AbstractController{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("assess/manager/delete")
|
||||
@ApiOperation("删除考核任务")
|
||||
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatisticalRes.class)})
|
||||
|
||||
@ -1,16 +1,9 @@
|
||||
package com.lz.modules.performance.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.enums.ResultRecordStatusEnum;
|
||||
import com.lz.modules.app.resp.OwnResultResp;
|
||||
import com.lz.modules.equipment.entity.model.BasePage;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.service.FlowStartService;
|
||||
import com.lz.modules.performance.req.ChartResultReq;
|
||||
import com.lz.modules.performance.req.ChartStartsReq;
|
||||
import com.lz.modules.performance.req.OwnResultReq;
|
||||
@ -19,17 +12,13 @@ import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
import com.lz.modules.performance.res.ResultRankListRes;
|
||||
import com.lz.modules.performance.service.ChartResultService;
|
||||
import com.lz.modules.sys.controller.AbstractController;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
@ -110,6 +99,4 @@ public class ChartController extends AbstractController{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,138 @@
|
||||
package com.lz.modules.performance.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import cn.hutool.poi.excel.StyleSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.performance.req.ChartResultReq;
|
||||
import com.lz.modules.performance.res.LevelDetailExportRes;
|
||||
import com.lz.modules.performance.service.ChartResultService;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/12/1 10:26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/file")
|
||||
@Slf4j
|
||||
@Api(value="导出excel接口", tags={"导出表格"})
|
||||
public class ExportController {
|
||||
@Autowired
|
||||
private ChartResultService chartResultService;
|
||||
|
||||
|
||||
@GetMapping("/export/levelDetail")
|
||||
@ApiOperation("导出等级详情")
|
||||
public void levelDetail(ChartResultReq req,HttpServletResponse response){
|
||||
try {
|
||||
//Long userId = getUserId();
|
||||
Long userId = 313L;
|
||||
req.setLoginUserId(userId);
|
||||
//获取数据
|
||||
List data = chartResultService.selectLevelDetailList(req);
|
||||
//导出
|
||||
buildExcelExport(data,response);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("导出等级详情异常,e: ",e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//对应实体属性名与表列名
|
||||
private void buildData(Class<?> data,List<String> tags,ExcelWriter writer){
|
||||
if(data == null || CollectionUtils.isEmpty(tags)){
|
||||
log.info("导出excel-实体属性或数据为空!");
|
||||
return;
|
||||
}
|
||||
Field[] fields = data.getDeclaredFields();
|
||||
if(fields.length != tags.size()){
|
||||
log.info("导出excel-实体属性与数据大小不一致!");
|
||||
return;
|
||||
}
|
||||
for(int i=0; i<fields.length; i++){
|
||||
Field field = fields[i];
|
||||
field.setAccessible(true);
|
||||
writer.addHeaderAlias(field.getName(), tags.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
private void buildExcelExport(List data, HttpServletResponse response){
|
||||
//设置表头表尾及数据
|
||||
List<String> rowHead = CollUtil.newArrayList("序号", "工号", "员工姓名", "当月状态", "一级部门", "二级部门", "三级部门", "职位", "员工月度绩效考核评分","员工月度绩效考核结果等级");
|
||||
ExcelWriter writer = ExcelUtil.getWriter();
|
||||
writer.setColumnWidth(-1,15);
|
||||
writer.passRows(4);
|
||||
buildData(LevelDetailExportRes.class,rowHead,writer);
|
||||
writer.merge(0,2,0,9,"绩效考核总表",false);
|
||||
writer.merge(3,3,0,1,"考核月份",false);
|
||||
writer.write(data, true);
|
||||
writer.merge(7 + data.size(),8 + data.size(),0,0,"签字",false);
|
||||
|
||||
//设置下拉框数据
|
||||
String[] values = {"已转正", "试用期"};
|
||||
Sheet sheet = writer.getSheet();
|
||||
int firstRow = 4;
|
||||
int lastRow = 4;
|
||||
int firstCol = 3;
|
||||
int lastCol = 3;
|
||||
CellRangeAddressList addressList = new CellRangeAddressList(firstRow, lastRow, firstCol, lastCol);
|
||||
StyleSet styleSet = writer.getStyleSet();
|
||||
CellStyle cellStyle = styleSet.getCellStyle();
|
||||
cellStyle.setDataFormat((short) BuiltinFormats.getBuiltinFormat("text"));
|
||||
DataValidationHelper helper = sheet.getDataValidationHelper();
|
||||
DataValidationConstraint constraint = helper.createExplicitListConstraint(values);
|
||||
DataValidation dataValidation = helper.createValidation(constraint, addressList);
|
||||
writer.addValidationData(dataValidation);
|
||||
|
||||
//响应
|
||||
String name = "test测试";
|
||||
response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + name + ".xls");
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
out = response.getOutputStream();
|
||||
writer.flush(out, true);
|
||||
}
|
||||
catch (IOException e) {
|
||||
log.error("生成excel文档异常,e: ",e);
|
||||
}
|
||||
finally {
|
||||
writer.close();
|
||||
}
|
||||
IoUtil.close(out);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.lz.modules.performance.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/12/2 10:15
|
||||
*/
|
||||
@Data
|
||||
public class LevelDetailExportDto {
|
||||
//序号
|
||||
private Long id;
|
||||
//工号
|
||||
private String staffNo;
|
||||
//姓名
|
||||
private String staffName;
|
||||
//员工id
|
||||
private Long staffId;
|
||||
//当月状态
|
||||
private int staffType;
|
||||
//所属部门
|
||||
private Long departmentId;
|
||||
//一级部门
|
||||
private String departmentOne;
|
||||
//二级部门
|
||||
private String departmentTwo;
|
||||
//三级部门
|
||||
private String departmentThree;
|
||||
//职位
|
||||
private String position;
|
||||
//员工月度绩效考核评分
|
||||
private String allScore;
|
||||
//员工月度绩效考核结果等级
|
||||
private String scoreLevel;
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.lz.modules.performance.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/12/1 16:37
|
||||
*/
|
||||
@Data
|
||||
public class SimpleDepartmentDto {
|
||||
//部门id
|
||||
private String departmentId;
|
||||
//上级部门id
|
||||
private String departmentParentId;
|
||||
//组织架构名称/部门名称
|
||||
private String departmentName;
|
||||
//第几级部门
|
||||
private Integer level;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.lz.modules.performance.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/12/1 16:11
|
||||
*/
|
||||
@Data
|
||||
public class StaffTypeDto {
|
||||
//员工类型
|
||||
private int staffType;
|
||||
//员工id
|
||||
private Long staffId;
|
||||
//职位
|
||||
private String position;
|
||||
//人员状态
|
||||
private Long staffStatus;
|
||||
//入职日期
|
||||
private Date entryTime;
|
||||
//转正日期
|
||||
private Date officialTime;
|
||||
//离职时间
|
||||
private Date resignationTime;
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.lz.modules.performance.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/12/1 15:04
|
||||
*/
|
||||
@Data
|
||||
public class LevelDetailExportRes {
|
||||
//序号
|
||||
private Long id;
|
||||
//工号
|
||||
private String staffNo;
|
||||
//姓名
|
||||
private String staffName;
|
||||
//当月状态
|
||||
private String staffType;
|
||||
//一级部门
|
||||
private String departmentOne;
|
||||
//二级部门
|
||||
private String departmentTwo;
|
||||
//三级部门
|
||||
private String departmentThree;
|
||||
//职位
|
||||
private String position;
|
||||
//员工月度绩效考核评分
|
||||
private String allScore;
|
||||
//员工月度绩效考核结果等级
|
||||
private String scoreLevel;
|
||||
|
||||
|
||||
}
|
||||
@ -8,6 +8,7 @@ import com.lz.modules.performance.req.ChartStartsReq;
|
||||
import com.lz.modules.performance.res.ChartStartsRes;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
import com.lz.modules.performance.res.LevelDetailExportRes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -28,4 +29,6 @@ public interface ChartResultService {
|
||||
|
||||
List<ChartStatistical> countAssessNumByFlowProcess(AssessDetailReq req);
|
||||
|
||||
List<LevelDetailExportRes> selectLevelDetailList(ChartResultReq req);
|
||||
|
||||
}
|
||||
|
||||
@ -12,9 +12,7 @@ import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.app.service.*;
|
||||
import com.lz.modules.flow.dao.EvaluationGroupMapper;
|
||||
import com.lz.modules.flow.dao.FlowChartMapper;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
@ -23,6 +21,8 @@ import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
||||
import com.lz.modules.flow.service.FlowChartService;
|
||||
import com.lz.modules.flow.service.FlowStartService;
|
||||
import com.lz.modules.performance.dto.LevelDetailExportDto;
|
||||
import com.lz.modules.performance.dto.StaffTypeDto;
|
||||
import com.lz.modules.performance.enums.ResultFlowProcessEnum;
|
||||
import com.lz.modules.performance.req.AssessDetailReq;
|
||||
import com.lz.modules.performance.req.ChartResultReq;
|
||||
@ -30,6 +30,7 @@ import com.lz.modules.performance.req.ChartStartsReq;
|
||||
import com.lz.modules.performance.res.ChartStartsRes;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
import com.lz.modules.performance.res.LevelDetailExportRes;
|
||||
import com.lz.modules.performance.service.AssessService;
|
||||
import com.lz.modules.performance.service.ChartResultService;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
@ -37,6 +38,8 @@ import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -75,6 +78,8 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
private AssessService assessService;
|
||||
@Autowired
|
||||
private EvaluationGroupMapper evaluationGroupMapper;
|
||||
@Autowired
|
||||
private StaffOccupationService staffOccupationService;
|
||||
|
||||
private static final Long processId = 1L;
|
||||
|
||||
@ -183,34 +188,7 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
|
||||
@Override
|
||||
public PageUtils selectChartDetailList(ChartResultReq req) {
|
||||
String departmentIds = req.getDepartmentIds();
|
||||
Set<String> allDepart = Sets.newHashSet();
|
||||
if(StringUtil.isNotBlank(departmentIds)){
|
||||
String[] split = departmentIds.split(",");
|
||||
for(String s:split){
|
||||
List<String> deparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(s);
|
||||
allDepart.addAll(deparmentIds);
|
||||
}
|
||||
}
|
||||
List<String> allDeparmentIds = new ArrayList<>(allDepart);
|
||||
//自己管理的和所有的部门交集
|
||||
log.info("selectChartDetailList 查询部门:" + JSON.toJSONString(allDeparmentIds));
|
||||
List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());
|
||||
if(mandepartmentIds!=null ){
|
||||
if(mandepartmentIds.size()==0){
|
||||
return new PageUtils();
|
||||
}
|
||||
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(mandepartmentIds));
|
||||
mandepartmentIds.retainAll(allDeparmentIds);
|
||||
if(mandepartmentIds.size()==0){
|
||||
return new PageUtils();
|
||||
}
|
||||
}
|
||||
else {
|
||||
//如果掌管所有部门,查询请求部门
|
||||
mandepartmentIds = allDeparmentIds;
|
||||
}
|
||||
log.info("selectChartDetailList 交集部门:" + JSON.toJSONString(mandepartmentIds));
|
||||
List<String> mandepartmentIds = getMandepartmentIds(req.getDepartmentIds(), req.getLoginUserId());
|
||||
List<String> finalMandepartmentIds = mandepartmentIds;
|
||||
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(), req.getPageSize()).doSelect(
|
||||
page -> resultRecordMapper.selectChartDetailList(page, finalMandepartmentIds,req.getStartId(),req.getScoreLevel())
|
||||
@ -261,6 +239,72 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<LevelDetailExportRes> selectLevelDetailList(ChartResultReq req) {
|
||||
List<String> mandepartmentIds = getMandepartmentIds(req.getDepartmentIds(), req.getLoginUserId());
|
||||
List<LevelDetailExportDto> levelDetailExportDtos = resultRecordMapper.selectLevelDetailList(mandepartmentIds, req.getStartId(), req.getScoreLevel());
|
||||
|
||||
if(CollectionUtils.isEmpty(levelDetailExportDtos)){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
List<Long> staffIds = levelDetailExportDtos.stream().map(LevelDetailExportDto::getStaffId).collect(Collectors.toList());
|
||||
List<String> depIds = levelDetailExportDtos.stream().map(levelDetailExportDto -> levelDetailExportDto.getDepartmentId().toString()).collect(Collectors.toList());
|
||||
|
||||
List<StaffTypeDto> staffTypeDtos = staffOccupationService.selectStaffTypesByStaffIds(staffIds);
|
||||
//状态
|
||||
Map<Long,Integer> types = Maps.newHashMap();
|
||||
//职位
|
||||
Map<Long,String> positions = Maps.newHashMap();
|
||||
|
||||
for(StaffTypeDto dto: staffTypeDtos){
|
||||
types.put(dto.getStaffId(),dto.getStaffType());
|
||||
positions.put(dto.getStaffId(),dto.getPosition());
|
||||
}
|
||||
Map<Long, List<String>> map = departmentsService.selectDepartmentTreeByDepIds(depIds);
|
||||
|
||||
for(LevelDetailExportDto res: levelDetailExportDtos){
|
||||
Integer integer = types.get(res.getStaffId());
|
||||
String position = positions.get(res.getStaffId());
|
||||
if(integer !=null){
|
||||
res.setStaffType(integer);
|
||||
}
|
||||
if(StringUtil.isNotBlank(position)){
|
||||
res.setPosition(position);
|
||||
}
|
||||
List<String> names = map.get(res.getDepartmentId());
|
||||
if(CollectionUtils.isNotEmpty(names)){
|
||||
Collections.reverse(names);
|
||||
int size = names.size();
|
||||
if(size>0 && StringUtils.isNotBlank(names.get(0))){
|
||||
res.setDepartmentOne(names.get(0));
|
||||
}
|
||||
if(size>1 && StringUtils.isNotBlank(names.get(1))){
|
||||
res.setDepartmentTwo(names.get(1));
|
||||
}
|
||||
if(size>2 && StringUtils.isNotBlank(names.get(2))){
|
||||
res.setDepartmentThree(names.get(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//拷贝为excel格式
|
||||
List<LevelDetailExportRes> levelDetailExportRes = levelDetailExportDtos.stream().map(levelDetailExportDto -> {
|
||||
LevelDetailExportRes res = new LevelDetailExportRes();
|
||||
BeanUtils.copyProperties(levelDetailExportDto,res);
|
||||
if(1 == levelDetailExportDto.getStaffType()){
|
||||
res.setStaffType("已转正");
|
||||
}
|
||||
if(2 == levelDetailExportDto.getStaffType()){
|
||||
res.setStaffType("试用期");
|
||||
}
|
||||
return res;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return levelDetailExportRes;
|
||||
|
||||
}
|
||||
|
||||
//构建流程默认人数
|
||||
private List<ChartStatistical> buildProcess(List<ChartStatistical> process,Long startId,List<String> mandepartmentIds,AssessDetailReq req){
|
||||
List<ChartStatistical> data = Lists.newArrayList();
|
||||
@ -314,4 +358,36 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
});
|
||||
return depStaffs;
|
||||
}
|
||||
|
||||
private List<String> getMandepartmentIds(String departmentIds,Long loginUserId){
|
||||
Set<String> allDepart = Sets.newHashSet();
|
||||
if(StringUtil.isNotBlank(departmentIds)){
|
||||
String[] split = departmentIds.split(",");
|
||||
for(String s:split){
|
||||
List<String> deparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(s);
|
||||
allDepart.addAll(deparmentIds);
|
||||
}
|
||||
}
|
||||
List<String> allDeparmentIds = new ArrayList<>(allDepart);
|
||||
//自己管理的和所有的部门交集
|
||||
log.info("selectChartDetailList 查询部门:" + JSON.toJSONString(allDeparmentIds));
|
||||
List<String> mandepartmentIds = assessService.roleDepartments(loginUserId);
|
||||
if(mandepartmentIds!=null ){
|
||||
if(mandepartmentIds.size()==0){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
log.info("selectChartDetailList 管理部门:" + JSON.toJSONString(mandepartmentIds));
|
||||
mandepartmentIds.retainAll(allDeparmentIds);
|
||||
if(mandepartmentIds.size()==0){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//如果掌管所有部门,查询请求部门
|
||||
mandepartmentIds = allDeparmentIds;
|
||||
}
|
||||
log.info("selectChartDetailList 交集部门:" + JSON.toJSONString(mandepartmentIds));
|
||||
return mandepartmentIds;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,11 +16,13 @@ import com.lz.modules.app.req.ReportListReq;
|
||||
import com.lz.modules.app.req.ResultRecordReq;
|
||||
import com.lz.modules.app.resp.OwnResultResp;
|
||||
import com.lz.modules.flow.model.ResultRecordDto;
|
||||
import com.lz.modules.performance.dto.LevelDetailExportDto;
|
||||
import com.lz.modules.performance.dto.ToScoreDingTalkDto;
|
||||
import com.lz.modules.performance.req.AssessDetailReq;
|
||||
import com.lz.modules.performance.req.OwnResultReq;
|
||||
import com.lz.modules.performance.res.AssessManagerDetailRes;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.LevelDetailExportRes;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -108,4 +110,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
|
||||
List<ResultRecord> selectResultRecordsByStartId(Long startId);
|
||||
|
||||
List<LevelDetailExportDto> selectLevelDetailList(@Param("departmentIds") List<String> departmentIds, @Param("startId")Long startId, @Param("scoreLevel")String scoreLevel);
|
||||
|
||||
|
||||
}
|
||||
@ -841,10 +841,11 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
public void insertFlowRecord(FlowRecord flowRecord,StaffEntity approvalStaff,List<Flow> flows,FlowApprovalRole flowApprovalRole ,ResultRecord resultRecord,int i,Integer stepType ){
|
||||
flowRecord.setApprovalStaffName(approvalStaff.getName());
|
||||
flowRecord.setApprovalStaffId(approvalStaff.getId());
|
||||
flowRecord.setFlowName(getFlow(flows, flowApprovalRole.getFlowId()).getOptDesc());
|
||||
Flow flow = getFlow(flows, flowApprovalRole.getFlowId());
|
||||
flowRecord.setFlowName(flow.getOptDesc());
|
||||
flowRecord.setRecordStaffId(resultRecord.getStaffId());
|
||||
flowRecord.setFlowId(flowApprovalRole.getFlowId());
|
||||
FlowChart flowChart = flowService.selectFlowChartByChartId(flowApprovalRole.getFlowId());
|
||||
FlowChart flowChart = flowService.selectFlowChartByFlow(flow);
|
||||
flowRecord.setProcessId(flowChart.getProcessId());
|
||||
flowRecord.setFlowProcess(flowChart.getFlowProcess());
|
||||
String staffRole = StaffRoles.getStaffRole(approvalStaff.getId(), StringUtil.strToLongs(flowApprovalRole.getRoleId()));
|
||||
|
||||
@ -37,6 +37,8 @@ domain:
|
||||
main: "http://192.168.43.94:8001"
|
||||
sms:
|
||||
code: false
|
||||
swagger:
|
||||
enable: true
|
||||
|
||||
##多数据源的配置
|
||||
#dynamic:
|
||||
|
||||
@ -36,6 +36,8 @@ domain:
|
||||
main: "https://lzmanagement.ldxinyong.com"
|
||||
sms:
|
||||
code: true
|
||||
swagger:
|
||||
enable: false
|
||||
##多数据源的配置
|
||||
#dynamic:
|
||||
# datasource:
|
||||
|
||||
@ -36,7 +36,8 @@ domain:
|
||||
main: "http:/localhost"
|
||||
sms:
|
||||
code: false
|
||||
|
||||
swagger:
|
||||
enable: true
|
||||
|
||||
##多数据源的配置
|
||||
#dynamic:
|
||||
|
||||
@ -619,6 +619,29 @@
|
||||
and start_id = #{startId}
|
||||
</select>
|
||||
|
||||
<select id="selectLevelDetailList" resultType="com.lz.modules.performance.dto.LevelDetailExportDto">
|
||||
SELECT r.id,all_score,department_id,staff_name,staff_id,score_level,job_number staffNo from lz_result_record r
|
||||
LEFT JOIN lz_staff s
|
||||
on r.staff_id = s.id
|
||||
where r.is_delete =0 and s.is_delete=0
|
||||
and r.start_id = #{startId}
|
||||
<if test="departmentIds!=null and departmentIds.size()!=0">
|
||||
and r.department_id in (
|
||||
<foreach collection="departmentIds" item="department_id" separator=",">
|
||||
#{department_id}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="scoreLevel !=null">
|
||||
<if test="scoreLevel == ''">
|
||||
and r.score_level is null
|
||||
</if>
|
||||
<if test="scoreLevel != ''">
|
||||
and r.score_level = #{scoreLevel}
|
||||
</if>
|
||||
</if>
|
||||
ORDER BY all_score desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -111,8 +111,9 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
group by id
|
||||
|
||||
</if>
|
||||
group by id order by id desc
|
||||
</select>
|
||||
|
||||
<select id="selectEvaluationGroupByIds" resultType="EvaluationGroup" >
|
||||
|
||||
@ -322,5 +322,10 @@
|
||||
select * from lz_flow_record where is_delete = 0 and flow_index <![CDATA[>=]]> #{flowIndex}
|
||||
and record_id = #{recordId} and status=#{status} order by flow_index asc
|
||||
</select>
|
||||
|
||||
<select id="selectFlowRecordsByRecordIdAndStatus" resultType="com.lz.modules.flow.entity.FlowRecord">
|
||||
select * from lz_flow_record where is_delete = 0
|
||||
and record_id = #{recordId} and status=#{status} order by flow_index asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -188,4 +188,22 @@
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectSimpleDepartmentByDepartmentIds" resultType="com.lz.modules.performance.dto.SimpleDepartmentDto">
|
||||
select department_id,department_parent_id,department_name,level from lz_departments where
|
||||
is_delete = 0 and status = 1 and
|
||||
department_id in (
|
||||
<foreach collection="depIds" item="department_id" separator=",">
|
||||
#{department_id}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="selectSimpleDepartmentByDepartmentId" resultType="com.lz.modules.performance.dto.SimpleDepartmentDto">
|
||||
select department_id,department_parent_id,department_name,level from lz_departments where
|
||||
is_delete = 0 and status = 1 and
|
||||
department_id =#{departmentId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -248,43 +248,45 @@
|
||||
|
||||
|
||||
<select id="getStaffInfos" resultType="com.lz.modules.app.dto.StaffDto">
|
||||
select ls.id staffId,if(lso.employee_no='', lso.staff_no,lso.employee_no) staff_no,ls.name,lso.position,
|
||||
case lso.staff_status when 0 then '在职' else '离职' end staff_status,
|
||||
if(ls.id in (select staff_id from lz_departments_staff_relate where is_delete=0 and is_leader=1
|
||||
select staffinfo.id as staff_id,
|
||||
if(occ.employee_no='', occ.staff_no,occ.employee_no) staff_no,
|
||||
staffinfo.name as name,
|
||||
occ.position as position,
|
||||
case occ.staff_status when 0 then '在职' else '离职' end staff_status,
|
||||
staffinfo.is_leader as department_leader
|
||||
from
|
||||
(
|
||||
select staff.id as id, staff.name as name, relate.is_leader as is_leader
|
||||
from lz_staff staff join lz_departments_staff_relate relate on staff.id=relate.staff_id
|
||||
where staff.is_delete=0 and relate.is_delete=0
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and department_id=#{departmentId}
|
||||
and relate.department_id=#{departmentId}
|
||||
</if>
|
||||
),1,0) department_leader
|
||||
from lz_staff ls,lz_staff_occupation lso
|
||||
where lso.staff_id=ls.id and ls.is_delete=0
|
||||
and lso.staff_status=#{staffStatus}
|
||||
<if test="name != null and name != ''">
|
||||
and ls.name like concat('%',#{name},'%')
|
||||
and staff.name like concat('%',#{name},'%')
|
||||
</if>
|
||||
order by department_leader desc
|
||||
group by staff.id
|
||||
) as staffinfo join lz_staff_occupation as occ on occ.staff_id = staffinfo.id
|
||||
where occ.is_delete=0 and occ.staff_status=#{staffStatus} order by department_leader desc
|
||||
limit #{startIndex}, #{pageLimit}
|
||||
</select>
|
||||
|
||||
<select id="getStaffInfoCount" resultType="java.lang.Integer">
|
||||
select count(ls.id) count
|
||||
from lz_staff ls,lz_staff_occupation lso
|
||||
where lso.staff_id=ls.id and ls.is_delete=0
|
||||
and lso.staff_status=#{staffStatus}
|
||||
select count(staffinfo.id)
|
||||
from
|
||||
(
|
||||
select staff.id as id, staff.name as name, relate.is_leader as is_leader
|
||||
from lz_staff staff join lz_departments_staff_relate relate on staff.id=relate.staff_id
|
||||
where staff.is_delete=0 and relate.is_delete=0
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and relate.department_id=#{departmentId}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
and ls.name like concat('%',#{name},'%')
|
||||
and staff.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>
|
||||
))
|
||||
group by staff.id
|
||||
) as staffinfo join lz_staff_occupation as occ on occ.staff_id = staffinfo.id
|
||||
where occ.is_delete=0 and occ.staff_status=#{staffStatus}
|
||||
</select>
|
||||
|
||||
<select id="getBaseInfo" resultType="com.lz.modules.app.dto.StaffBaseInfoDto">
|
||||
@ -467,7 +469,7 @@
|
||||
<foreach collection="ids" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
) and occupation.staff_status=0 order by field(staff.id,
|
||||
) and occupation.staff_status=0 and occupation.is_delete=0 order by field(staff.id,
|
||||
<foreach collection="ids" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
@ -480,7 +482,7 @@
|
||||
from (select staff.id as staff_id, staff.name as name, relate.is_leader as department_leader
|
||||
from lz_departments_staff_relate relate join lz_staff staff on staff.id = relate.staff_id
|
||||
where relate.department_id = #{departmentId} and relate.is_delete=0 and staff.is_delete=0 group by relate.staff_id) jj
|
||||
join lz_staff_occupation occ on jj.staff_id=occ.staff_id where occ.staff_status=0 and occ.is_delete=0
|
||||
join lz_staff_occupation occ on jj.staff_id=occ.staff_id where occ.staff_status=0 and occ.is_delete=0 GROUP BY jj.staff_id
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
@ -60,7 +60,21 @@
|
||||
</update>
|
||||
|
||||
<select id="removeDimissionStaffByStaffIds" resultType="String">
|
||||
SELECT staff_id from lz_staff_occupation where staff_status = 0 and
|
||||
SELECT staff_id from lz_staff_occupation where staff_status = 0 and is_delete = 0 and
|
||||
staff_id in
|
||||
<foreach collection="staffIds" item="staff_id" open="(" close=")"
|
||||
separator=",">
|
||||
#{staff_id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultType="com.lz.modules.app.entity.StaffOccupationEntity">
|
||||
select * from lz_staff_occupation where is_delete=0
|
||||
</select>
|
||||
|
||||
<select id="selectStaffTypesByStaffIds" resultType="com.lz.modules.performance.dto.StaffTypeDto">
|
||||
select staff_id,staff_type,position,staff_status,entry_time,official_time from lz_staff_occupation
|
||||
where is_delete = 0 and staff_status = 0 and
|
||||
staff_id in
|
||||
<foreach collection="staffIds" item="staff_id" open="(" close=")"
|
||||
separator=",">
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.lz.mysql;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.flow.entity.FlowChartRole;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
@ -65,51 +67,7 @@ public class MysqlMain {
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
/*Long a = 2l;
|
||||
Long b = 3l;
|
||||
String value = "aaa";
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start("测试静态方法");
|
||||
for(int i = 0; i < 10000; i++){
|
||||
if(TestStaticAndHuo.isEmpt(value)){
|
||||
|
||||
}
|
||||
}
|
||||
stopWatch.stop();
|
||||
|
||||
stopWatch.start("测试对象方法");
|
||||
for(int i = 0; i < 10000; i++){
|
||||
if(value == null || value.length() == 0){
|
||||
|
||||
}
|
||||
}
|
||||
stopWatch.stop();
|
||||
|
||||
System.out.println(stopWatch.prettyPrint());*/
|
||||
|
||||
/*List<TestMap> testMaps = new ArrayList<>();
|
||||
TestMap test = new TestMap();
|
||||
test.setName("123");
|
||||
test.setMobile("18969093321");
|
||||
testMaps.add(test);
|
||||
|
||||
test = new TestMap();
|
||||
test.setName("123");
|
||||
test.setMobile("18969093321");
|
||||
testMaps.add(test);
|
||||
|
||||
Map<String, TestMap> t = testMaps.stream().collect(Collectors.toMap(TestMap::getName, testMap -> testMap));
|
||||
List<Long> flowChartRoles = new ArrayList<>();
|
||||
flowChartRoles.add(1L);
|
||||
flowChartRoles.add(2L);
|
||||
flowChartRoles.add(3L);
|
||||
flowChartRoles.add(4L);
|
||||
String roles = flowChartRoles.stream().map(new Function<Long, String>() {
|
||||
@Override
|
||||
public String apply(Long flowChartRole) {
|
||||
return flowChartRole.toString();
|
||||
}
|
||||
}).collect(Collectors.joining(","));*/
|
||||
|
||||
String path = ResourceUtils.getURL("classpath:").getPath();
|
||||
System.out.println(path);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user