|
|
|
@ -1,13 +1,13 @@
|
|
|
|
|
package com.engine.organization.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.api.browser.bean.BrowserBean;
|
|
|
|
|
import com.api.browser.bean.SearchConditionGroup;
|
|
|
|
|
import com.api.browser.bean.SearchConditionItem;
|
|
|
|
|
import com.api.browser.bean.SearchConditionOption;
|
|
|
|
|
import com.api.browser.util.BrowserInitUtil;
|
|
|
|
|
import com.cloudstore.eccom.result.WeaResultMsg;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.organization.component.OrganizationWeaTable;
|
|
|
|
|
import com.engine.organization.entity.DeleteParam;
|
|
|
|
|
import com.engine.organization.entity.company.po.CompPO;
|
|
|
|
|
import com.engine.organization.entity.staff.bo.StaffPlanBO;
|
|
|
|
|
import com.engine.organization.entity.staff.param.StaffPlanSearchParam;
|
|
|
|
|
import com.engine.organization.entity.staff.po.StaffPlanPO;
|
|
|
|
@ -18,11 +18,13 @@ import com.engine.organization.service.StaffPlanService;
|
|
|
|
|
import com.engine.organization.util.*;
|
|
|
|
|
import com.engine.organization.util.db.DBType;
|
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import weaver.common.DateUtil;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.general.StringUtil;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
import weaver.hrm.definedfield.HrmFieldManager;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
@ -72,6 +74,8 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|
|
|
|
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
|
|
|
|
// 结束时间大于开始时间
|
|
|
|
|
StaffPlanPO staffPlanPO = StaffPlanBO.convertParamToPO(param, (long) user.getUID());
|
|
|
|
|
// 多选赋值
|
|
|
|
|
staffPlanPO.setCompanyId(getJclCompanyIdsByEcIds(staffPlanPO.getEcCompany()));
|
|
|
|
|
String timeStart = param.getTimeStart();
|
|
|
|
|
String timeEnd = param.getTimeEnd();
|
|
|
|
|
Date startDate = DateUtil.parseToDate(timeStart);
|
|
|
|
@ -96,6 +100,8 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|
|
|
|
Date startDate = DateUtil.parseToDate(timeStart);
|
|
|
|
|
Date endDate = DateUtil.parseToDate(timeEnd);
|
|
|
|
|
OrganizationAssert.isFalse(startDate.after(endDate), "开始时间不允许在结束时间之后");
|
|
|
|
|
// 多选赋值
|
|
|
|
|
staffPlanPO.setCompanyId(getJclCompanyIdsByEcIds(staffPlanPO.getEcCompany()));
|
|
|
|
|
return getStaffPlanMapper().updateStaffPlan(staffPlanPO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -130,7 +136,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|
|
|
|
// 时间结束
|
|
|
|
|
SearchConditionItem timeEndItem = OrganizationFormItemUtil.datePickerItem(user, 2, 16, false, 2, "时间结束", "timeEnd");
|
|
|
|
|
// 适用公司
|
|
|
|
|
SearchConditionItem companyIdtItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "适用公司", "161", "companyId", "compBrowser");
|
|
|
|
|
SearchConditionItem companyIdtItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "适用公司", "164", "ecCompany", "");
|
|
|
|
|
// 说明
|
|
|
|
|
SearchConditionItem descriptionItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "说明", "description");
|
|
|
|
|
// 状态
|
|
|
|
@ -178,8 +184,8 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|
|
|
|
SearchConditionItem timeEndItem = OrganizationFormItemUtil.datePickerItem(user, 2, 16, false, 3, "时间结束", "timeEnd");
|
|
|
|
|
timeEndItem.setRules("required|string");
|
|
|
|
|
// 适用公司
|
|
|
|
|
SearchConditionItem companyIdtItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "适用公司", "162", "companyId", "compBrowser");
|
|
|
|
|
companyIdtItem.setRules("required|string");
|
|
|
|
|
SearchConditionItem ecCompanyIdtItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "适用公司", "194", "ecCompany", "compBrowser");
|
|
|
|
|
ecCompanyIdtItem.setRules("required|string");
|
|
|
|
|
List<SearchConditionOption> selectOptions = new ArrayList<>();
|
|
|
|
|
SearchConditionOption option1 = new SearchConditionOption("1", "分部");
|
|
|
|
|
SearchConditionOption option2 = new SearchConditionOption("2", "部门");
|
|
|
|
@ -205,10 +211,33 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|
|
|
|
timeStartItem.setValue(DateUtil.getDate(staffPlanPO.getTimeStart(), "yyyy-MM-dd"));
|
|
|
|
|
timeEndItem.setValue(DateUtil.getDate(staffPlanPO.getTimeEnd(), "yyyy-MM-dd"));
|
|
|
|
|
|
|
|
|
|
BrowserBean browserBean = companyIdtItem.getBrowserConditionParam();
|
|
|
|
|
List<Map<String, Object>> maps = getCompMapper().listCompsByIds(DeleteParam.builder().ids(staffPlanPO.getCompanyId()).build().getIds());
|
|
|
|
|
browserBean.setReplaceDatas(maps);
|
|
|
|
|
companyIdtItem.setBrowserConditionParam(browserBean);
|
|
|
|
|
String tmpFieldValue = staffPlanPO.getEcCompany();
|
|
|
|
|
if (StringUtils.isNotBlank(tmpFieldValue)) {
|
|
|
|
|
HrmFieldManager hrmFieldManager = new HrmFieldManager();
|
|
|
|
|
String fieldshowname = null;
|
|
|
|
|
try {
|
|
|
|
|
fieldshowname = hrmFieldManager.getFieldvalue(user, null, 0, 3, 164, tmpFieldValue, 0);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
|
|
|
|
|
String[] fieldshownames = Util.splitString(fieldshowname, ",");
|
|
|
|
|
List<Map<String, Object>> replaceDatas = new ArrayList<>();
|
|
|
|
|
for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) {
|
|
|
|
|
if (fieldvalues.length != fieldshownames.length) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (Util.null2String(fieldshownames[i]).length() == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> replaceData = new HashMap<>();
|
|
|
|
|
replaceData.put("id", fieldvalues[i]);
|
|
|
|
|
replaceData.put("name", fieldshownames[i]);
|
|
|
|
|
replaceDatas.add(replaceData);
|
|
|
|
|
}
|
|
|
|
|
BrowserInitUtil.setConditionItemDefaultValue(ecCompanyIdtItem, replaceDatas, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dimensionItem.setValue(staffPlanPO.getControlDimension());
|
|
|
|
|
descriptionItem.setValue(staffPlanPO.getDescription());
|
|
|
|
|
|
|
|
|
@ -221,7 +250,7 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|
|
|
|
selectItems.add(planYearItem);
|
|
|
|
|
selectItems.add(timeStartItem);
|
|
|
|
|
selectItems.add(timeEndItem);
|
|
|
|
|
selectItems.add(companyIdtItem);
|
|
|
|
|
selectItems.add(ecCompanyIdtItem);
|
|
|
|
|
selectItems.add(dimensionItem);
|
|
|
|
|
selectItems.add(descriptionItem);
|
|
|
|
|
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
|
|
|
|
@ -264,9 +293,9 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|
|
|
|
if (null != timeEnd) {
|
|
|
|
|
sqlWhere += " AND t.time_end <= '" + timeEnd + "'";
|
|
|
|
|
}
|
|
|
|
|
String companyId = staffPlanPO.getCompanyId();
|
|
|
|
|
if (StringUtils.isNotBlank(companyId)) {
|
|
|
|
|
sqlWhere += " AND t.companyId = '" + companyId + "'";
|
|
|
|
|
String ecCompany = staffPlanPO.getEcCompany();
|
|
|
|
|
if (StringUtils.isNotBlank(ecCompany)) {
|
|
|
|
|
sqlWhere += " AND " + dbType.concat("t.ec_company") + " " + dbType.like("," + ecCompany + ",");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String description = staffPlanPO.getDescription();
|
|
|
|
@ -280,5 +309,17 @@ public class StaffPlanServiceImpl extends Service implements StaffPlanService {
|
|
|
|
|
return sqlWhere;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getJclCompanyIdsByEcIds(String ecIds) {
|
|
|
|
|
List<String> jclCompanyIds = new ArrayList<>();
|
|
|
|
|
String[] split = ecIds.split(",");
|
|
|
|
|
for (String s : split) {
|
|
|
|
|
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(s);
|
|
|
|
|
if (null != jclCompanyId) {
|
|
|
|
|
jclCompanyIds.add(jclCompanyId.getId().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return StringUtils.join(jclCompanyIds, ",");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|