|
|
|
@ -11,6 +11,7 @@ import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.hrm.entity.RuleCodeType;
|
|
|
|
|
import com.engine.organization.component.OrganizationWeaTable;
|
|
|
|
|
import com.engine.organization.entity.DeleteParam;
|
|
|
|
|
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
|
|
|
|
import com.engine.organization.entity.company.bo.CompBO;
|
|
|
|
|
import com.engine.organization.entity.company.po.CompPO;
|
|
|
|
|
import com.engine.organization.entity.department.bo.DepartmentBO;
|
|
|
|
@ -27,6 +28,7 @@ import com.engine.organization.entity.job.po.JobPO;
|
|
|
|
|
import com.engine.organization.entity.scheme.po.GradePO;
|
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTree;
|
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
|
|
|
|
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
|
|
|
|
import com.engine.organization.mapper.comp.CompMapper;
|
|
|
|
|
import com.engine.organization.mapper.department.DepartmentMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
|
|
|
@ -47,6 +49,7 @@ import com.engine.organization.util.page.PageInfo;
|
|
|
|
|
import com.engine.organization.util.page.PageUtil;
|
|
|
|
|
import com.engine.organization.util.tree.SearchTreeUtil;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import weaver.general.StringUtil;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
@ -284,7 +287,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|
|
|
|
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(extendTitles)) {
|
|
|
|
|
for (ExtendTitlePO extendTitle : extendTitles) {
|
|
|
|
|
List<SearchConditionItem> items = getExtService(user).getExtForm(user, EXTEND_TYPE + "", GROUP_ID.equals(Long.parseLong(groupId)) ? JCL_ORG_JOB : JCL_ORG_JOBEXT, viewAttr, id, extendTitle.getId().toString(), "job_no");
|
|
|
|
|
List<SearchConditionItem> items = getExtService(user).getExtForm(user, EXTEND_TYPE + "", GROUP_ID.equals(Long.parseLong(groupId)) ? JCL_ORG_JOB : JCL_ORG_JOBEXT, viewAttr, id, extendTitle.getId().toString(), "");
|
|
|
|
|
if (CollectionUtils.isNotEmpty(items)) {
|
|
|
|
|
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
|
|
|
|
|
}
|
|
|
|
@ -328,16 +331,15 @@ public class JobServiceImpl extends Service implements JobService {
|
|
|
|
|
@Override
|
|
|
|
|
public int saveBaseForm(Map<String, Object> params) {
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
|
|
|
|
|
String jobNo = (String) params.get("job_no");
|
|
|
|
|
// 判断是否开启自动编号
|
|
|
|
|
jobNo = repeatDetermine(jobNo);
|
|
|
|
|
params.put("job_no", jobNo);
|
|
|
|
|
|
|
|
|
|
// 处理自动编号
|
|
|
|
|
searchParam.setJobNo(CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, searchParam.getJobNo()));
|
|
|
|
|
List<JobPO> list = getJobMapper().listByNo(Util.null2String(searchParam.getJobNo()));
|
|
|
|
|
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
|
|
|
|
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
|
|
|
|
|
JobPO jobPO = JobBO.convertParamsToPO(searchParam, user.getUID());
|
|
|
|
|
jobPO.setIsKey(null == jobPO.getIsKey() ? 0 : jobPO.getIsKey());
|
|
|
|
|
int insertCount = getJobMapper().insertIgnoreNull(jobPO);
|
|
|
|
|
params.put("job_no", jobPO.getJobNo());
|
|
|
|
|
params.put("is_key", jobPO.getIsKey());
|
|
|
|
|
DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(jobPO.getParentDept());
|
|
|
|
|
params.put("parent_comp", departmentPO.getParentComp());
|
|
|
|
@ -365,6 +367,13 @@ public class JobServiceImpl extends Service implements JobService {
|
|
|
|
|
if ("0".equals(groupId)) {
|
|
|
|
|
groupId = GROUP_ID.toString();
|
|
|
|
|
}
|
|
|
|
|
String oldJobNo = getJobMapper().getJobById(searchParam.getId()).getJobNo();
|
|
|
|
|
String jobNo = searchParam.getJobNo();
|
|
|
|
|
if (!oldJobNo.equals(jobNo)) {
|
|
|
|
|
jobNo = repeatDetermine(jobNo);
|
|
|
|
|
params.put("job_no", jobNo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int updateCount = 0;
|
|
|
|
|
// 更新主表数据
|
|
|
|
|
params.put("is_key", searchParam.getIsKey());
|
|
|
|
@ -559,4 +568,37 @@ public class JobServiceImpl extends Service implements JobService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断编号是否重复
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String repeatDetermine(String jobNo) {
|
|
|
|
|
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.JOBTITLES.getValue());
|
|
|
|
|
if (StringUtils.isNotBlank(jobNo)) {
|
|
|
|
|
jobNo = CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, jobNo);
|
|
|
|
|
List<JobPO> list = getJobMapper().listByNo(Util.null2String(jobNo));
|
|
|
|
|
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
|
|
|
|
} else {
|
|
|
|
|
if (null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable())) {
|
|
|
|
|
jobNo = autoCreateCompanyNo();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return jobNo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 自动编号处理
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String autoCreateCompanyNo() {
|
|
|
|
|
String generateCode = CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, "");
|
|
|
|
|
List<JobPO> list = getJobMapper().listByNo(Util.null2String(generateCode));
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
generateCode = autoCreateCompanyNo();
|
|
|
|
|
}
|
|
|
|
|
return generateCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|