Merge pull request 'feature/cl' (#239) from feature/cl into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/239
This commit is contained in:
commit
b232148b09
|
|
@ -0,0 +1,41 @@
|
|||
package com.engine.organization.entity.hrmresource.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/5/29 2:54 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class HrmStatusHistoryParam {
|
||||
|
||||
private Long resourceId;
|
||||
|
||||
private String changeDate;
|
||||
|
||||
private String changeReason;
|
||||
|
||||
private Integer oldJobtitleId;
|
||||
|
||||
private Integer newjobtitleId;
|
||||
|
||||
private Integer typeN;
|
||||
|
||||
private Integer oldDepartmentId;
|
||||
|
||||
private Integer newDepartmentId;
|
||||
|
||||
private Integer oldSubcompanyId;
|
||||
|
||||
private Integer newSubcompanyId;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -34,7 +34,6 @@ import lombok.NoArgsConstructor;
|
|||
primarykey = "id",
|
||||
operates = {
|
||||
@OrganizationTableOperate(text = "查看"),
|
||||
@OrganizationTableOperate(index = "1", text = "另存为版本")
|
||||
},
|
||||
tableType = WeaTableType.CHECKBOX
|
||||
)
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ import lombok.NoArgsConstructor;
|
|||
sortway = " asc",
|
||||
primarykey = "id",
|
||||
operates = {
|
||||
@OrganizationTableOperate(text = "查看"),
|
||||
@OrganizationTableOperate(index = "1", text = "另存为版本")
|
||||
@OrganizationTableOperate(text = "查看")
|
||||
},
|
||||
tableType = WeaTableType.CHECKBOX
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package com.engine.organization.util;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.param.HrmStatusHistoryParam;
|
||||
import com.engine.organization.entity.hrmresource.po.ResourceChartPO;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/5/29 2:50 PM
|
||||
* @Description: 人员工作记录
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class HrmStatusHistoryUtil {
|
||||
|
||||
/**
|
||||
* @param resourceChartPOList 调整前人员信息
|
||||
* @param departmentID 调整后部门
|
||||
*/
|
||||
public static void personWorkRecord(List<ResourceChartPO> resourceChartPOList,Integer departmentID,String changeReason){
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
DepartmentComInfo comInfo = new DepartmentComInfo();
|
||||
String subcompanyid1 = comInfo.getSubcompanyid1(String.valueOf(departmentID));
|
||||
Integer newSub = "".equals(subcompanyid1) ? null : Integer.valueOf(subcompanyid1);
|
||||
|
||||
List<HrmStatusHistoryParam> historyParamList = new ArrayList<>();
|
||||
resourceChartPOList.forEach(item -> historyParamList.add(HrmStatusHistoryParam.builder()
|
||||
.resourceId(item.getId())
|
||||
.changeDate(OrganizationDateUtil.getFormatLocalDate(LocalDate.now()))
|
||||
.changeReason(changeReason)
|
||||
.oldJobtitleId(item.getJobTitle())
|
||||
.newjobtitleId(item.getJobTitle())
|
||||
.typeN(4)
|
||||
.oldDepartmentId(item.getDepartmentId())
|
||||
.newDepartmentId(departmentID)
|
||||
.oldSubcompanyId(item.getSubcompanyid1())
|
||||
.newSubcompanyId(newSub)
|
||||
.build()));
|
||||
|
||||
historyParamList.forEach(item -> {
|
||||
rs.executeUpdate("insert into hrmstatushistory(resourceid,changedate,changereason,oldjobtitleid,newjobtitleid,type_n,olddepartmentid,newdepartmentid,oldsubcompanyid,newsubcompanyid) " +
|
||||
" values(?,?,?,?,?,?,?,?,?,?)",item.getResourceId(),item.getChangeDate(),item.getChangeReason(),item.getOldJobtitleId(),item.getNewjobtitleId(),item.getTypeN(),
|
||||
item.getOldDepartmentId(),item.getNewDepartmentId(),item.getOldSubcompanyId(),item.getNewSubcompanyId());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.organization.wrapper;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
|
|
@ -9,21 +10,23 @@ import com.engine.organization.entity.company.po.CompPO;
|
|||
import com.engine.organization.entity.department.param.*;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
|
||||
import com.engine.organization.entity.hrmresource.po.ResourceChartPO;
|
||||
import com.engine.organization.entity.job.vo.SingleJobTreeVO;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.resource.HrmResourceMapper;
|
||||
import com.engine.organization.service.DepartmentService;
|
||||
import com.engine.organization.service.impl.DepartmentServiceImpl;
|
||||
import com.engine.organization.util.HrmStatusHistoryUtil;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.page.PageInfo;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -46,6 +49,10 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
private DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
private HrmResourceMapper getHrmResourceMapper() {
|
||||
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
|
@ -236,7 +243,12 @@ public class DepartmentWrapper extends OrganizationWrapper {
|
|||
@Log(operateType = OperateTypeEnum.MERGE, operateDesc = "合并部门", operateModule = LogModuleNameEnum.DEPARTMENT)
|
||||
public int mergeDepartment(DepartmentMergeParam mergeParam) {
|
||||
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(mergeParam.getId());
|
||||
//被合并的部门人员工作记录表记录调动
|
||||
List<ResourceChartPO> resourceChartPOList = getHrmResourceMapper().selectByDepartmentId(mergeParam.getId());
|
||||
int mergeDepartment = getDepartmentService(user).mergeDepartment(mergeParam);
|
||||
if (CollectionUtil.isNotEmpty(resourceChartPOList)) {
|
||||
HrmStatusHistoryUtil.personWorkRecord(resourceChartPOList,mergeParam.getDepartment(),"合并部门");
|
||||
}
|
||||
writeOperateLog(new Object() {
|
||||
}.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(mergeParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId()));
|
||||
return mergeDepartment;
|
||||
|
|
|
|||
Loading…
Reference in New Issue