编制方案
This commit is contained in:
parent
d65551c0ee
commit
6415ee3eb7
|
|
@ -26,6 +26,7 @@ public class StaffPlanBO {
|
|||
.timeStart(StringUtil.isEmpty(param.getTimeStart()) ? null : DateUtil.parseToDateTime(param.getTimeStart()))
|
||||
.timeEnd(StringUtil.isEmpty(param.getTimeEnd()) ? null : DateUtil.parseToDateTime(param.getTimeEnd()))
|
||||
.companyId(param.getCompanyId())
|
||||
.ecCompany(param.getEcCompany())
|
||||
.controlDimension(param.getControlDimension())
|
||||
.description(param.getDescription())
|
||||
.forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public class StaffPlanSearchParam {
|
|||
* 适用公司
|
||||
*/
|
||||
private String companyId;
|
||||
private String ecCompany;
|
||||
/**
|
||||
* 控制维度
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public class StaffPlanPO {
|
|||
* 适用公司
|
||||
*/
|
||||
private String companyId;
|
||||
private String ecCompany;
|
||||
/**
|
||||
* 控制维度
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
<result column="time_start" property="timeStart"/>
|
||||
<result column="time_end" property="timeEnd"/>
|
||||
<result column="company_id" property="companyId"/>
|
||||
<result column="ec_company" property="ecCompany"/>
|
||||
<result column="control_dimension" property="controlDimension"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="forbidden_tag" property="forbiddenTag"/>
|
||||
|
|
@ -29,6 +30,7 @@
|
|||
, t.time_start
|
||||
, t.time_end
|
||||
, t.company_id
|
||||
, t.ec_company
|
||||
, t.control_dimension
|
||||
, t.description
|
||||
, t.forbidden_tag
|
||||
|
|
@ -88,6 +90,7 @@
|
|||
time_start=#{timeStart},
|
||||
time_end=#{timeEnd},
|
||||
company_id=#{companyId},
|
||||
ec_company=#{ecCompany},
|
||||
control_dimension=#{controlDimension},
|
||||
description=#{description},
|
||||
</set>
|
||||
|
|
@ -128,6 +131,9 @@
|
|||
<if test="companyId != null ">
|
||||
company_id,
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
ec_company,
|
||||
</if>
|
||||
<if test="controlDimension != null ">
|
||||
control_dimension,
|
||||
</if>
|
||||
|
|
@ -167,6 +173,9 @@
|
|||
<if test="companyId != null ">
|
||||
#{companyId},
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
#{ecCompany},
|
||||
</if>
|
||||
<if test="controlDimension != null ">
|
||||
#{controlDimension},
|
||||
</if>
|
||||
|
|
@ -177,8 +186,9 @@
|
|||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.staff.po.StaffPlanPO" databaseId="oracle">
|
||||
<selectKey keyProperty="id" resultType="long" order="AFTER">
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.staff.po.StaffPlanPO"
|
||||
databaseId="oracle">
|
||||
<selectKey keyProperty="id" resultType="long" order="AFTER">
|
||||
select JCL_ORG_STAFFPLAN_ID.currval from dual
|
||||
</selectKey>
|
||||
INSERT INTO jcl_org_staffplan
|
||||
|
|
@ -213,6 +223,9 @@
|
|||
<if test="companyId != null ">
|
||||
company_id,
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
ec_company,
|
||||
</if>
|
||||
<if test="controlDimension != null ">
|
||||
control_dimension,
|
||||
</if>
|
||||
|
|
@ -252,6 +265,9 @@
|
|||
<if test="companyId != null ">
|
||||
#{companyId},
|
||||
</if>
|
||||
<if test="ecCompany != null ">
|
||||
#{ecCompany},
|
||||
</if>
|
||||
<if test="controlDimension != null ">
|
||||
#{controlDimension},
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -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, ",");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,6 @@ package com.engine.organization.util.db;
|
|||
|
||||
public interface DBOperateAdapter {
|
||||
String like(String some);
|
||||
|
||||
String concat(String some);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,18 +10,33 @@ public enum DBType implements DBOperateAdapter {
|
|||
public String like(String some) {
|
||||
return "like '%" + some + "%'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String concat(String some) {
|
||||
return "concat(','," + some + ",',')";
|
||||
}
|
||||
},
|
||||
SQLSERVER("sqlserver") {
|
||||
@Override
|
||||
public String like(String some) {
|
||||
return "like '%" + some + "%'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String concat(String some) {
|
||||
return "','+" + some + "+','";
|
||||
}
|
||||
},
|
||||
ORACLE("oracle") {
|
||||
@Override
|
||||
public String like(String some) {
|
||||
return "'%'||" + some + "||'%'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String concat(String some) {
|
||||
return "',' ||" + some + "|| ','";
|
||||
}
|
||||
};
|
||||
|
||||
private String dbtype;
|
||||
|
|
|
|||
Loading…
Reference in New Issue