|
|
@ -10,7 +10,6 @@ import com.cloudstore.eccom.result.WeaResultMsg;
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
import com.engine.hrm.entity.RuleCodeType;
|
|
|
|
import com.engine.hrm.entity.RuleCodeType;
|
|
|
|
import com.engine.hrm.util.CodeRuleManager;
|
|
|
|
|
|
|
|
import com.engine.organization.component.OrganizationWeaTable;
|
|
|
|
import com.engine.organization.component.OrganizationWeaTable;
|
|
|
|
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
|
|
|
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
|
|
|
import com.engine.organization.entity.company.bo.CompBO;
|
|
|
|
import com.engine.organization.entity.company.bo.CompBO;
|
|
|
@ -35,6 +34,7 @@ import com.engine.organization.service.ExtService;
|
|
|
|
import com.engine.organization.util.MenuBtn;
|
|
|
|
import com.engine.organization.util.MenuBtn;
|
|
|
|
import com.engine.organization.util.OrganizationAssert;
|
|
|
|
import com.engine.organization.util.OrganizationAssert;
|
|
|
|
import com.engine.organization.util.OrganizationFormItemUtil;
|
|
|
|
import com.engine.organization.util.OrganizationFormItemUtil;
|
|
|
|
|
|
|
|
import com.engine.organization.util.coderule.CodeRuleUtil;
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
import com.engine.organization.util.page.Column;
|
|
|
|
import com.engine.organization.util.page.Column;
|
|
|
|
import com.engine.organization.util.page.PageInfo;
|
|
|
|
import com.engine.organization.util.page.PageInfo;
|
|
|
@ -172,13 +172,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int saveBaseForm(DeptSearchParam params) {
|
|
|
|
public int saveBaseForm(DeptSearchParam params) {
|
|
|
|
try {
|
|
|
|
// 自动编号
|
|
|
|
// 处理自动编号
|
|
|
|
params.setDeptNo(CodeRuleUtil.generateCode(RuleCodeType.DEPARTMENT, params.getDeptNo()));
|
|
|
|
params.setDeptNo(CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.
|
|
|
|
|
|
|
|
DEPARTMENT, params.getDeptNo()));
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<DepartmentPO> list = getDepartmentMapper().listByNo(Util.null2String(params.getDeptNo()));
|
|
|
|
List<DepartmentPO> list = getDepartmentMapper().listByNo(Util.null2String(params.getDeptNo()));
|
|
|
|
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
|
|
|
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
|
|
|
DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(params, user.getUID());
|
|
|
|
DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(params, user.getUID());
|
|
|
@ -320,8 +315,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
SearchConditionItem deptNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "deptNo");
|
|
|
|
SearchConditionItem deptNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "deptNo");
|
|
|
|
deptNoItem.setRules("required|string");
|
|
|
|
deptNoItem.setRules("required|string");
|
|
|
|
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.DEPARTMENT.getValue());
|
|
|
|
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.DEPARTMENT.getValue());
|
|
|
|
if ("1".equals(codeRuleByType.getSerialEnable())) {
|
|
|
|
if (null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable())) {
|
|
|
|
deptNoItem.setViewAttr(2);
|
|
|
|
deptNoItem.setViewAttr(2);
|
|
|
|
|
|
|
|
deptNoItem.setRules("");
|
|
|
|
deptNoItem.setHelpfulTip("编号为空,则按照指定规则自动生成编号");
|
|
|
|
deptNoItem.setHelpfulTip("编号为空,则按照指定规则自动生成编号");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 名称
|
|
|
|
// 名称
|
|
|
@ -392,25 +388,15 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
List<Long> idList = Arrays.stream(copyParam.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
|
List<Long> idList = Arrays.stream(copyParam.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
|
for (Long id : idList) {
|
|
|
|
for (Long id : idList) {
|
|
|
|
DepartmentPO deptById = getDepartmentMapper().getDeptById(id);
|
|
|
|
DepartmentPO deptById = getDepartmentMapper().getDeptById(id);
|
|
|
|
try {
|
|
|
|
// 处理自动编号
|
|
|
|
// 处理自动编号
|
|
|
|
deptById.setDeptNo(CodeRuleUtil.generateCode(RuleCodeType.DEPARTMENT, deptById.getDeptNo(), true));
|
|
|
|
deptById.setDeptNo(CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.
|
|
|
|
|
|
|
|
DEPARTMENT, ""));
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deptById.setParentComp(Long.parseLong(copyParam.getCompany()));
|
|
|
|
deptById.setParentComp(Long.parseLong(copyParam.getCompany()));
|
|
|
|
insertCount += getDepartmentMapper().insertIgnoreNull(deptById);
|
|
|
|
insertCount += getDepartmentMapper().insertIgnoreNull(deptById);
|
|
|
|
if ("1".equals(copyParam.getCopyJob())) {
|
|
|
|
if ("1".equals(copyParam.getCopyJob())) {
|
|
|
|
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(id);
|
|
|
|
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(id);
|
|
|
|
for (JobPO jobPO : jobPOS) {
|
|
|
|
for (JobPO jobPO : jobPOS) {
|
|
|
|
try {
|
|
|
|
// 处理自动编号
|
|
|
|
// 处理自动编号
|
|
|
|
jobPO.setJobNo(CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, jobPO.getJobNo(), true));
|
|
|
|
jobPO.setJobNo(CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.
|
|
|
|
|
|
|
|
JOBTITLES, ""));
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
jobPO.setParentDept(deptById.getId());
|
|
|
|
jobPO.setParentDept(deptById.getId());
|
|
|
|
jobPO.setCreator((long) user.getUID());
|
|
|
|
jobPO.setCreator((long) user.getUID());
|
|
|
|
jobPO.setCreateTime(new Date());
|
|
|
|
jobPO.setCreateTime(new Date());
|
|
|
|