Pre Merge pull request !239 from dxfeng/feature/dxf

pull/239/MERGE
dxfeng 3 years ago committed by Gitee
commit 1452ee623c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -43,4 +43,8 @@ public interface ImportCommonService {
Map<String, Object> getHasRight();
Map<String,Object> saveCommonImport(Map<String, Object> params);
Map<String, Object> getCommonForm(String importModule);
}

@ -1,10 +1,8 @@
package com.engine.organization.service;
import com.engine.organization.entity.staff.param.StaffSearchParam;
import com.engine.organization.util.MenuBtn;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**

@ -42,6 +42,7 @@ import com.engine.organization.util.excel.ExcelUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.saveimport.hrmimport.HrmImportAdaptExcelE9;
import com.engine.organization.util.saveimport.hrmimport.HrmImportProcessE9;
import com.orgimport.service.OrgImportEnum;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
@ -286,6 +287,22 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
return returnMap;
}
@Override
public Map<String, Object> saveCommonImport(Map<String, Object> params) {
String importModule = Util.null2String(params.get("importModule"));
OrgImportEnum orgImport = OrgImportEnum.getOrgImportUtil(importModule);
return orgImport.orgImport(params, user);
}
@Override
public Map<String, Object> getCommonForm(String importModule) {
Map<String, Object> returnMap = new HashMap<>();
OrgImportEnum orgImport = OrgImportEnum.getOrgImportUtil(importModule);
returnMap.put("condition", orgImport.orgForm(user));
returnMap.put("status", "1");
return returnMap;
}
/**
*
@ -428,6 +445,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
SearchConditionItem searchConditionItem;
ConditionFactory conditionFactory = new ConditionFactory(user);
//导入类型
List<SearchConditionOption> statusOptions = new ArrayList<>();
statusOptions.add(new SearchConditionOption("add", SystemEnv.getHtmlLabelName(611, user.getLanguage()), true));
statusOptions.add(new SearchConditionOption("update", SystemEnv.getHtmlLabelName(17744, user.getLanguage())));
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24863, "importType", statusOptions);
searchConditionItem.setValue("add");
itemList.add(searchConditionItem);
//模板文件
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, 28576, "templet");
searchConditionItem.setValue(templatePath);
@ -1076,7 +1101,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
for (int index = 0; index < split.length - 1; index++) {
parentJobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndPid(split[index], parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId, parentJobId == null ? 0 : parentJobId);
if (null == parentJobId) {
historyDetailPO.setOperateDetail(split[index] + "部门未找到对应数据");
historyDetailPO.setOperateDetail(split[index] + "岗位未找到对应数据");
historyDetailPO.setStatus("0");
saveImportDetailLog(historyDetailPO);
continue nextRow;

@ -529,11 +529,8 @@ public class JobServiceImpl extends Service implements JobService {
rs.executeUpdate("SELECT ID FROM CUS_FIELDDATA WHERE SCOPEID =-1 AND FIELD100002 = ?", jobById.getId());
while (rs.next()) {
long userId = Long.parseLong(Util.null2String(rs.getString("ID")));
// 更新人员分部、部门
rs.executeUpdate("UPDATE HRMRESOURCE SET SUBCOMPANYID1 = ? , DEPARTMENTID = ? WHERE ID =? ", targetJob.getEcCompany(), targetJob.getEcDepartment(), userId);
// 更新岗位 、岗位更新触发器
// TODO
rs.executeUpdate("",null);
rs.executeUpdate("update CUS_FIELDDATA set FIELD100002 = ? where SCOPEID =-1 and id = ", targetJob.getId(), userId);
CusFieldDataTrigger.run(userId);
// 更新人员组织架构图
}

@ -409,7 +409,6 @@ public class StaffServiceImpl extends Service implements StaffService {
break;
default:
break;
}
}

@ -213,7 +213,9 @@ public class OrganizationSyncEc {
RecordInfo hrmJobTitle = getSystemDataMapper().getHrmJobTitleByName(newName);
// 查询原分部、原岗位下的人员并更新岗位ID
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIds(oldJobPO.getParentDept(), oldHrmJobTitle.getId());
getSystemDataMapper().updateResourceJobTitleByIds(Util.null2String(hrmJobTitle.getId()), hrmResourceIds);
if(CollectionUtils.isNotEmpty(hrmResourceIds)) {
getSystemDataMapper().updateResourceJobTitleByIds(Util.null2String(hrmJobTitle.getId()), hrmResourceIds);
}
// 封存原名称岗位
map.put("ids", oldHrmJobTitle.getId());
map.put("canceled", "canceled");

@ -0,0 +1,128 @@
package com.engine.organization.util.saveimport;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.hrm.entity.FieldSelectOptionBean;
import com.engine.organization.entity.SelectOptionParam;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryPO;
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
import com.engine.organization.mapper.jclimport.JclImportHistoryMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
import weaver.common.DateUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.definedfield.HrmFieldManager;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:dxfeng
* @createTime: 2022/09/15
* @version: 1.0
*/
public class OrgImportUtil {
public static Long saveImportLog(String importType, String operateType, User user) {
JclImportHistoryPO historyPO = JclImportHistoryPO.builder().operator((long) user.getUID()).operateTime(DateUtil.getFullDate()).clientAddress(user.getLoginip()).importType(importType).sourceFrom("excel").operateType(operateType).status("importing").build();
MapperProxyFactory.getProxy(JclImportHistoryMapper.class).insertHistory(historyPO);
return historyPO.getId();
}
public static void saveImportDetailLog(JclImportHistoryDetailPO historyDetailPO) {
String detailMsg = "导入第" + historyDetailPO.getRowNums() + "行数据,[" + historyDetailPO.getRelatedName() + "]" + historyDetailPO.getOperateDetail();
historyDetailPO.setOperateDetail(detailMsg);
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(historyDetailPO);
}
/**
*
*/
public static Object getReallyValue(ExtendInfoPO extendInfo, String cellValue) throws Exception {
if (StringUtils.isBlank(cellValue)) {
return null;
}
Object object = null;
JSONArray jsonArray = JSONObject.parseArray(extendInfo.getCustomValue());
switch (extendInfo.getControlType()) {
case 1:
String valueType = (String) jsonArray.get(1);
// INPUT
if ("int".equals(valueType)) {
object = Integer.parseInt(cellValue);
} else if ("float".equals(valueType)) {
object = Float.parseFloat(cellValue);
} else {
object = cellValue;
}
break;
case 3:
// BROWSER
org.json.JSONObject jsonObject = new org.json.JSONObject();
jsonObject.put("fieldhtmltype", extendInfo.getControlType());
jsonObject.put("type", extendInfo.getBrowserType());
jsonObject.put("fieldvalue", cellValue);
if ("161".equals(extendInfo.getBrowserType()) || "162".equals(extendInfo.getBrowserType())) {
jsonObject.put("dmlurl", SelectOptionParam.getCustomBrowserId(extendInfo.getCustomValue()));
} else {
jsonObject.put("dmlurl", extendInfo.getBrowserType());
}
jsonObject.put("fieldid", 0);
object = HrmFieldManager.getReallyFieldvalue(jsonObject);
break;
case 5:
// SELECT
JSONObject o = (JSONObject) jsonArray.get(2);
JSONArray datas = o.getJSONArray("datas");
List<FieldSelectOptionBean> options = datas.toJavaList(FieldSelectOptionBean.class);
Map<String, String> optionMap = options.stream().collect(Collectors.toMap(FieldSelectOptionBean::getOption, FieldSelectOptionBean::getId, (k1, k2) -> k1));
object = optionMap.get(cellValue);
break;
case 4:// CHECKBOX
case 6:
// FILEUPLOAD
break;
case 7:// TEXT
case 2:// TEXTAREA
default:
object = cellValue;
break;
}
return object;
}
public static String getCellValue(XSSFCell cell) {
String cellValue = "";
if (cell == null)
return "";
switch (cell.getCellType()) {
case BOOLEAN: // 得到Boolean对象的方法
cellValue = String.valueOf(cell.getBooleanCellValue());
break;
case NUMERIC:
if (HSSFDateUtil.isCellDateFormatted(cell)) {// 先看是否是日期格式
SimpleDateFormat sft = new SimpleDateFormat("yyyy-MM-dd");
cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式
} else {
cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字
if (cellValue.endsWith(".0"))
cellValue = cellValue.substring(0, cellValue.indexOf("."));
}
break;
case FORMULA: // 读取公式
cellValue = cell.getCellFormula();
break;
case STRING: // 读取String
cellValue = cell.getStringCellValue();
break;
}
cellValue = Util.toHtmlForHrm(cellValue);
return cellValue;
}
}

@ -4,6 +4,7 @@ import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.ImportCommonWrapper;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
@ -97,4 +98,30 @@ public class ImportCommonController {
return ReturnResult.exceptionHandle(e);
}
}
@POST
@Path("/saveCommonImport")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult saveCommonImport(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getImportCommonWrapper(user).saveCommonImport(map));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@GET
@Path("/getCommonForm")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getCommonForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getImportCommonWrapper(user).getCommonForm(Util.null2String(map.get("importModule"))));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
}

@ -65,4 +65,11 @@ public class ImportCommonWrapper extends Service {
public Map<String, Object> getHasRight() {
return getImportCommonService(user).getHasRight();
}
public Map<String, Object> saveCommonImport(Map<String, Object> params) {
return getImportCommonService(user).saveCommonImport(params);
}
public Map<String, Object> getCommonForm(String importModule) {
return getImportCommonService(user).getCommonForm(importModule);
}
}

@ -0,0 +1,17 @@
package com.orgimport.service;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/09/15
* @version: 1.0
*/
public interface OrgImportAdapter {
Map<String,Object> orgImport(Map<String, Object> params, User user);
List<Map<String, Object>> orgForm(User user);
}

@ -0,0 +1,47 @@
package com.orgimport.service;
import com.engine.organization.exception.OrganizationRunTimeException;
import com.orgimport.service.action.StaffInfoImportUtil;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/09/15
* @version: 1.0
*/
public enum OrgImportEnum implements OrgImportAdapter {
STAFF("staff_info") {
@Override
public Map<String, Object> orgImport(Map<String, Object> params, User user) {
Map<String, Object> resultMap = new HashMap<>();
String excelFile = (String) params.get("excelfile");
resultMap.put("pId", StaffInfoImportUtil.saveImport("add", excelFile, user));
return resultMap;
}
@Override
public List<Map<String, Object>> orgForm(User user) {
return StaffInfoImportUtil.importForm(user);
}
};
private String tableName;
OrgImportEnum(String tableName) {
this.tableName = tableName;
}
public static OrgImportEnum getOrgImportUtil(String tableName) {
for (OrgImportEnum item : OrgImportEnum.values()) {
if (item.tableName.equalsIgnoreCase(tableName)) {
return item;
}
}
throw new OrganizationRunTimeException("不支持的导入类型");
}
}

@ -0,0 +1,319 @@
package com.orgimport.service.action;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.util.ConditionFactory;
import com.api.browser.util.ConditionType;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
import com.engine.organization.entity.staff.bo.StaffBO;
import com.engine.organization.entity.staff.param.StaffSearchParam;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.entity.staff.po.StaffPlanPO;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.mapper.staff.StaffPlanMapper;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.saveimport.OrgImportUtil;
import org.apache.commons.collections.CollectionUtils;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/09/15
* @version: 1.0
*/
public class StaffInfoImportUtil {
static Map<String, ExtendInfoPO> importFieldsMap;
static {
importFieldsMap = new HashMap<>();
importFieldsMap.put("方案编号", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("plan_no").fieldNameDesc("方案编号").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("方案名称", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("plan_name").fieldNameDesc("方案名称").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("分部", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("comp_id").fieldNameDesc("分部").isrequired(1).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("部门", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("dept_id").fieldNameDesc("部门").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("岗位", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("job_id").fieldNameDesc("岗位").isrequired(0).controlType(1).browserType("1").customValue("[\"input\",\"text\",\"100\"]").build());
importFieldsMap.put("编制数", ExtendInfoPO.builder().tableName("jcl_org_staff").fieldName("staff_num").fieldNameDesc("编制数").isrequired(1).controlType(1).browserType("2").customValue("[\"input\",\"int\"]").build());
}
public static Long saveImport(String operateType, String excelFile, User user) {
Long importHistoryId = OrgImportUtil.saveImportLog("staff_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<>();
// 遍历每一行数据
nextRow:
for (int i = 0; i <= lastRow; i++) {
historyDetailPO = new JclImportHistoryDetailPO();
historyDetailPO.setPid(importHistoryId);
XSSFRow row = sheetAt.getRow(i);
// 组装待处理数据
Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null;
Long parentDepartmentId = null;
Long parentJobId = null;
StaffPlanPO staffPlanPO = 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.setOperateDetail(infoPO.getFieldNameDesc() + "为必填项");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
Object reallyValue;
try {
reallyValue = OrgImportUtil.getReallyValue(infoPO, cellValue);
} catch (Exception e) {
historyDetailPO.setOperateDetail(cellValue + "转换失败");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
if (StringUtils.isNotBlank(cellValue) && StringUtils.isBlank(Util.null2String(reallyValue))) {
historyDetailPO.setOperateDetail(infoPO.getFieldNameDesc() + "数据转换失败,未找到对应数据");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
map.put(infoPO.getFieldName(), reallyValue);
// 编制方案
if ("plan_no".equals(infoPO.getFieldName())) {
// 根据编制方案判断控制维度,控制必填
List<StaffPlanPO> staffPlanPOS = MapperProxyFactory.getProxy(StaffPlanMapper.class).listByNo(Util.null2String(reallyValue));
if (CollectionUtils.isNotEmpty(staffPlanPOS)) {
staffPlanPO = staffPlanPOS.get(0);
map.put("plan_id",staffPlanPO.getId());
historyDetailPO.setRelatedName(staffPlanPO.getPlanNo());
} else {
historyDetailPO.setOperateDetail("编号:" + reallyValue + ",未找到对应数据");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
if (null == staffPlanPO) {
historyDetailPO.setOperateDetail("未找到对应数据");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
// 分部
if ("comp_id".equals(infoPO.getFieldName())) {
String[] split = cellValue.split(">");
if (split.length > 0) {
if (split.length > 8) {
historyDetailPO.setOperateDetail("分部层级不能大于10");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (String s : split) {
parentCompanyId = MapperProxyFactory.getProxy(CompMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
}
map.put("comp_id", parentCompanyId);
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(parentCompanyId)));
}
// 部门
if ("dept_id".equals(infoPO.getFieldName())) {
String[] split = cellValue.split(">");
if (split.length > 0) {
if (split.length > 8) {
historyDetailPO.setOperateDetail("部门层级不能大于10");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (String s : split) {
parentDepartmentId = MapperProxyFactory.getProxy(DepartmentMapper.class).getIdByNameAndPid(s, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId);
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "部门未找到对应数据");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
}
map.put("dept_id", parentDepartmentId);
if (null != parentDepartmentId) {
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId)));
}
}
// 岗位
if ("job_id".equals(infoPO.getFieldName()) && StringUtils.isNotBlank(cellValue)) {
if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "所属分部未找到");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
String[] split = cellValue.split(">");
if (split.length > 0) {
if (split.length > 8) {
historyDetailPO.setOperateDetail("岗位层级不能大于10");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
for (String s : split) {
parentJobId = MapperProxyFactory.getProxy(JobMapper.class).getIdByNameAndPid(s, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId, parentJobId == null ? 0 : parentJobId);
if (null == parentJobId) {
historyDetailPO.setOperateDetail(s + "岗位未找到对应数据");
historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow;
}
}
}
map.put("job_id", parentJobId);
}
}
}
// 校验、数据交互
if (i == 0) {
continue;
}
String controlDimension = staffPlanPO.getControlDimension();
switch (controlDimension) {
case "1":// 分部
OrganizationAssert.notNull(parentCompanyId, "编制维度选择分部时,分部必填!");
break;
case "2":// 部门
OrganizationAssert.notNull(parentCompanyId, "编制维度选择部门时,分部必填!");
OrganizationAssert.notNull(parentDepartmentId, "编制维度选择部门时,部门必填!");
break;
case "3": // 岗位
OrganizationAssert.notNull(parentCompanyId, "编制维度选择岗位时,分部必填!");
OrganizationAssert.notNull(parentDepartmentId, "编制维度选择岗位时,部门必填!");
OrganizationAssert.notNull(parentJobId, "编制维度选择岗位时,岗位必填!");
break;
default:
break;
}
StaffSearchParam param = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), StaffSearchParam.class);
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
MapperProxyFactory.getProxy(StaffMapper.class).insertIgnoreNull(staffPO);
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<>();
List<Object> itemList = new ArrayList<>();
groupItem.put("title", SystemEnv.getHtmlLabelName(1361, user.getLanguage()));
groupItem.put("defaultshow", true);
SearchConditionItem searchConditionItem;
ConditionFactory conditionFactory = new ConditionFactory(user);
////导入类型
//List<SearchConditionOption> statusOptions = new ArrayList<>();
//statusOptions.add(new SearchConditionOption("add", SystemEnv.getHtmlLabelName(611, user.getLanguage()), true));
//statusOptions.add(new SearchConditionOption("update", SystemEnv.getHtmlLabelName(17744, user.getLanguage())));
//searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24863, "importType", statusOptions);
//searchConditionItem.setValue("add");
//itemList.add(searchConditionItem);
//模板文件
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, 28576, "templet");
searchConditionItem.setValue("");
itemList.add(searchConditionItem);
//Excel文件
searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, 16630, "excelfile");
itemList.add(searchConditionItem);
groupItem.put("items", itemList);
lsGroup.add(groupItem);
itemList = new ArrayList<>();
groupItem = new HashMap<>();
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", "");
}
item.put("value", value);
itemList.add(item);
}
groupItem.put("items", itemList);
lsGroup.add(groupItem);
return lsGroup;
}
}
Loading…
Cancel
Save