Merge branch 'develop' of http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization into feature/geoharbour
commit
c0a5d802f4
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,67 +0,0 @@
|
|||||||
package com.engine.organization.entity.hrmresource.vo;
|
|
||||||
|
|
||||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
|
||||||
import com.engine.organization.annotation.OrganizationTable;
|
|
||||||
import com.engine.organization.annotation.OrganizationTableColumn;
|
|
||||||
import com.engine.organization.annotation.OrganizationTableOperate;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@OrganizationTable(pageId = "8df45b09-0cda-4f57-a93a-ca9f96a4c111",
|
|
||||||
fields = "t.id," +
|
|
||||||
"t.name," +
|
|
||||||
"t.basic_fields," +
|
|
||||||
"t.personal_fields," +
|
|
||||||
"t.work_fields," +
|
|
||||||
"t.isused," +
|
|
||||||
"t.creator," +
|
|
||||||
"t.create_time," +
|
|
||||||
"t.update_time",
|
|
||||||
fromSql = "FROM jcl_org_custom_template t ",
|
|
||||||
orderby = "id",
|
|
||||||
sortway = "asc",
|
|
||||||
primarykey = "id",
|
|
||||||
operates = {
|
|
||||||
@OrganizationTableOperate(index = "0", text = "编辑"),
|
|
||||||
@OrganizationTableOperate(index = "1", text = "另存为"),
|
|
||||||
@OrganizationTableOperate(index = "2", text = "删除")
|
|
||||||
},
|
|
||||||
tableType = WeaTableType.CHECKBOX
|
|
||||||
)
|
|
||||||
public class JclOrgCustomTemplateVO {
|
|
||||||
|
|
||||||
@OrganizationTableColumn(column = "id", display = false)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@OrganizationTableColumn(text = "模板名称", width = "30%", column = "name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@OrganizationTableColumn(column = "basic_fields", display = false)
|
|
||||||
private String basicFields;
|
|
||||||
|
|
||||||
@OrganizationTableColumn(column = "personal_fields", display = false)
|
|
||||||
private String personalFields;
|
|
||||||
|
|
||||||
@OrganizationTableColumn(column = "work_fields", display = false)
|
|
||||||
private String workFields;
|
|
||||||
|
|
||||||
@OrganizationTableColumn(column = "isused", display = false)
|
|
||||||
private Integer isUsed;
|
|
||||||
|
|
||||||
@OrganizationTableColumn(column = "creator", display = false)
|
|
||||||
private Integer creator;
|
|
||||||
|
|
||||||
@OrganizationTableColumn(text = "创建时间",column = "create_time", width = "30%")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
@OrganizationTableColumn(text = "更新时间",column = "update_time", display = false)
|
|
||||||
private Date updateTime;
|
|
||||||
}
|
|
@ -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());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,204 @@
|
|||||||
|
package com.engine.organization.util.saveimport;
|
||||||
|
|
||||||
|
|
||||||
|
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
||||||
|
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
|
||||||
|
|
||||||
|
import com.engine.organization.entity.scheme.po.SchemePO;
|
||||||
|
import com.engine.organization.entity.sequence.po.SequencePO;
|
||||||
|
import com.engine.organization.mapper.comp.CompMapper;
|
||||||
|
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||||
|
import com.engine.organization.mapper.sequence.SequenceMapper;
|
||||||
|
import com.engine.organization.util.OrganizationAssert;
|
||||||
|
import com.engine.organization.util.db.MapperProxyFactory;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
import weaver.file.ImageFileManager;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.systeminfo.SystemEnv;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 岗位序列
|
||||||
|
* @Author: liang.cheng
|
||||||
|
* @Date: 2024/3/12 2:17 PM
|
||||||
|
* @param:
|
||||||
|
* @return:
|
||||||
|
*/
|
||||||
|
public class SequenceImportUtil {
|
||||||
|
static Map<String, ExtendInfoPO> importFieldsMap;
|
||||||
|
|
||||||
|
static {
|
||||||
|
importFieldsMap = new HashMap<>();
|
||||||
|
importFieldsMap.put("编号", ExtendInfoPO.builder().tableName("jcl_org_sequence").fieldName("sequence_no").fieldNameDesc("编号").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||||
|
importFieldsMap.put("名称", ExtendInfoPO.builder().tableName("jcl_org_sequence").fieldName("sequence_name").fieldNameDesc("名称").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||||
|
importFieldsMap.put("等级方案", ExtendInfoPO.builder().tableName("jcl_org_sequence").fieldName("scheme_name").fieldNameDesc("等级方案").isrequired(1).controlType(1).browserType("3").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||||
|
importFieldsMap.put("方案所属分部", ExtendInfoPO.builder().tableName("jcl_org_sequence").fieldName("subcompanyname").fieldNameDesc("方案所属分部").isrequired(1).controlType(1).browserType("3").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||||
|
importFieldsMap.put("描述说明", ExtendInfoPO.builder().tableName("jcl_org_sequence").fieldName("description").fieldNameDesc("描述说明").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static Long saveImport(String operateType, String excelFile, User user) {
|
||||||
|
Long importHistoryId = OrgImportUtil.saveImportLog("sequence_info", operateType, user);
|
||||||
|
JclImportHistoryDetailPO historyDetailPO;
|
||||||
|
|
||||||
|
ImageFileManager manager = new ImageFileManager();
|
||||||
|
manager.getImageFileInfoById(Util.getIntValue(excelFile));
|
||||||
|
XSSFWorkbook workbook;
|
||||||
|
try {
|
||||||
|
workbook = new XSSFWorkbook(manager.getInputStream());
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
// 当前sheet
|
||||||
|
XSSFSheet sheetAt = workbook.getSheetAt(0);
|
||||||
|
int lastRow = sheetAt.getLastRowNum();
|
||||||
|
OrganizationAssert.isTrue(lastRow > 0, "文件数据为空");
|
||||||
|
short lastCellNum = sheetAt.getRow(0).getLastCellNum();
|
||||||
|
List<ExtendInfoPO> extendInfoPOS = new ArrayList<>();
|
||||||
|
Date currDate = new Date();
|
||||||
|
// 遍历每一行数据
|
||||||
|
nextRow:
|
||||||
|
for (int i = 0; i <= lastRow; i++) {
|
||||||
|
historyDetailPO = new JclImportHistoryDetailPO();
|
||||||
|
historyDetailPO.setPid(importHistoryId);
|
||||||
|
XSSFRow row = sheetAt.getRow(i);
|
||||||
|
if (null == row) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组装待处理数据
|
||||||
|
Map<String, Object> map = new HashMap<>(16);
|
||||||
|
Integer parentCompanyId = null;
|
||||||
|
|
||||||
|
historyDetailPO.setRowNums(String.valueOf(i + 1));
|
||||||
|
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
|
||||||
|
XSSFCell cell = row.getCell((short) cellIndex);
|
||||||
|
String cellValue = OrgImportUtil.getCellValue(cell).trim();
|
||||||
|
if (i == 0) {
|
||||||
|
// 首行 初始化字段信息
|
||||||
|
ExtendInfoPO extendInfoPO = importFieldsMap.get(cellValue);
|
||||||
|
extendInfoPOS.add(extendInfoPO);
|
||||||
|
} else {
|
||||||
|
ExtendInfoPO infoPO = extendInfoPOS.get(cellIndex);
|
||||||
|
// 数据校验
|
||||||
|
if (infoPO.getIsrequired() == 1 && StringUtils.isBlank(cellValue)) {
|
||||||
|
historyDetailPO.setRelatedName("");
|
||||||
|
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
|
||||||
|
historyDetailPO.setStatus("0");
|
||||||
|
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||||
|
continue nextRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object reallyValue = cellValue;
|
||||||
|
|
||||||
|
if ("subcompanyname".equalsIgnoreCase(infoPO.getFieldName())) {
|
||||||
|
historyDetailPO.setRelatedName(cellValue);
|
||||||
|
String[] split = cellValue.split(">");
|
||||||
|
if (split.length > 0) {
|
||||||
|
if (split.length > 8) {
|
||||||
|
historyDetailPO.setOperateDetail("分部层级不能大于10");
|
||||||
|
historyDetailPO.setStatus("0");
|
||||||
|
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||||
|
continue nextRow;
|
||||||
|
}
|
||||||
|
for (int index = 0; index <= split.length - 1; index++) {
|
||||||
|
parentCompanyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(split[index], parentCompanyId == null ? 0 : parentCompanyId);
|
||||||
|
if (null == parentCompanyId) {
|
||||||
|
historyDetailPO.setOperateDetail(split[index] + "分部未找到对应数据");
|
||||||
|
historyDetailPO.setStatus("0");
|
||||||
|
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||||
|
continue nextRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.put("subcompanyid", Util.null2String(parentCompanyId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编号是否重复
|
||||||
|
if ("sequence_no".equals(infoPO.getFieldName())){
|
||||||
|
List<SequencePO> sequencePOS = MapperProxyFactory.getProxy(SequenceMapper.class).listByNo(Util.null2String(reallyValue));
|
||||||
|
if(sequencePOS.size()>0){
|
||||||
|
historyDetailPO.setRelatedName("");
|
||||||
|
historyDetailPO.setOperateDetail("编号:" + reallyValue + ","+SystemEnv.getHtmlLabelName(547137, user.getLanguage()));
|
||||||
|
historyDetailPO.setStatus("0");
|
||||||
|
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||||
|
continue nextRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
map.put(infoPO.getFieldName(), reallyValue);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == 0) {
|
||||||
|
continue nextRow;
|
||||||
|
}
|
||||||
|
String subCompanyName = (String) map.get("scheme_name");
|
||||||
|
String subCompanyId = (String) map.get("subcompanyid");
|
||||||
|
|
||||||
|
List<SchemePO> schemePOS = MapperProxyFactory.getProxy(SchemeMapper.class).selectByParams(Integer.parseInt(subCompanyId), subCompanyName);
|
||||||
|
if (schemePOS.size() == 0){
|
||||||
|
historyDetailPO.setRelatedName("");
|
||||||
|
historyDetailPO.setOperateDetail("第"+i+"行,所属分部下的等级方案不存在");
|
||||||
|
historyDetailPO.setStatus("0");
|
||||||
|
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||||
|
continue nextRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
SequencePO build = SequencePO.builder()
|
||||||
|
.sequenceNo((String) map.get("sequence_no"))
|
||||||
|
.sequenceName((String) map.get("sequence_name"))
|
||||||
|
.schemeId(schemePOS.get(0).getId())
|
||||||
|
.description((String) map.get("description"))
|
||||||
|
.build();
|
||||||
|
MapperProxyFactory.getProxy(SequenceMapper.class).insertIgnoreNull(build);
|
||||||
|
historyDetailPO.setOperateDetail("添加成功");
|
||||||
|
historyDetailPO.setStatus("1");
|
||||||
|
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||||
|
}
|
||||||
|
|
||||||
|
return importHistoryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static List<Map<String, Object>> importForm(User user) {
|
||||||
|
// 返回导入数据
|
||||||
|
List<Map<String, Object>> lsGroup = new ArrayList<>();
|
||||||
|
Map<String, Object> groupItem = new HashMap<>(3);
|
||||||
|
List<Object> itemList = new ArrayList<>();
|
||||||
|
groupItem.put("title", SystemEnv.getHtmlLabelName(33803, Util.getIntValue(user.getLanguage())));
|
||||||
|
groupItem.put("defaultshow", true);
|
||||||
|
List<Integer> lsPromptLabel = new ArrayList<>();
|
||||||
|
lsPromptLabel.add(34275);
|
||||||
|
lsPromptLabel.add(125452);
|
||||||
|
|
||||||
|
for (int i = 0; i < lsPromptLabel.size(); i++) {
|
||||||
|
Map<String, Object> item = new HashMap<>();
|
||||||
|
item.put("index", (i + 1));
|
||||||
|
String value = Util.toScreen(SystemEnv.getHtmlLabelName(lsPromptLabel.get(i), user.getLanguage()), user.getLanguage());
|
||||||
|
if (i == 0) {
|
||||||
|
value += SystemEnv.getHtmlLabelName(28576, user.getLanguage());
|
||||||
|
item.put("link", "/hrm/import/template/sequence.xls");
|
||||||
|
}
|
||||||
|
item.put("value", value);
|
||||||
|
itemList.add(item);
|
||||||
|
}
|
||||||
|
Map<String,Object> map = new HashMap<String,Object>(2){{
|
||||||
|
put("index",3);
|
||||||
|
put("value","分部的层级关系用字符>分割。");
|
||||||
|
}};
|
||||||
|
itemList.add(map);
|
||||||
|
groupItem.put("items", itemList);
|
||||||
|
lsGroup.add(groupItem);
|
||||||
|
return lsGroup;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue