分部导入
This commit is contained in:
parent
9d304b0303
commit
3356a7388e
|
|
@ -76,7 +76,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
*/
|
||||
private static final Long GROUP_ID = 1L;
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
private static CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
|
|
@ -372,7 +372,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
private String repeatDetermine(String compNo) {
|
||||
public static String repeatDetermine(String compNo) {
|
||||
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.SUBCOMPANY.getValue());
|
||||
if (StringUtils.isNotBlank(compNo)) {
|
||||
compNo = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, compNo);
|
||||
|
|
@ -391,7 +391,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
private String autoCreateCompanyNo() {
|
||||
private static String autoCreateCompanyNo() {
|
||||
String generateCode = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, "");
|
||||
List<CompPO> list = getCompMapper().listByNo(Util.null2String(generateCode));
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
|
|
|
|||
|
|
@ -10,13 +10,14 @@ import com.engine.core.impl.Service;
|
|||
import com.engine.hrm.entity.FieldSelectOptionBean;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.SelectOptionParam;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.extend.param.ExtendInfoParams;
|
||||
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
||||
import com.engine.organization.entity.hrmresource.param.HrmResourceImportParam;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendInfoMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.service.ImportCommonService;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
|
|
@ -182,7 +183,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
jsonObject.put("name", item.getFieldNameDesc());
|
||||
return jsonObject;
|
||||
}).collect(Collectors.toList());
|
||||
List<Long> selectedKeys = infoPOList.stream().filter(item -> 0 == item.getIsSystemDefault()).map(ExtendInfoPO::getId).collect(Collectors.toList());
|
||||
List<Long> selectedKeys = infoPOList.stream().filter(item -> (!exculdeFields.contains(item.getFieldName()) && 0 == item.getIsSystemDefault())).map(ExtendInfoPO::getId).collect(Collectors.toList());
|
||||
returnMaps.put("data", fieldDatas);
|
||||
returnMaps.put("selectedKeys", selectedKeys);
|
||||
return returnMaps;
|
||||
|
|
@ -402,14 +403,23 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
break nextRow;
|
||||
}
|
||||
map.put(infoPO.getFieldName(), reallyValue);
|
||||
// TODO 自动编号
|
||||
String compNo = (String) map.get("comp_no");
|
||||
if ("add".equals(operateType)) {
|
||||
// 自动编号
|
||||
compNo = CompServiceImpl.repeatDetermine(compNo);
|
||||
map.put("comp_no", compNo);
|
||||
MapperProxyFactory.getProxy(ExtMapper.class).insertExt(ExtendInfoParams.builder().tableName("JCL_ORG_COMP").params(map).build());
|
||||
} else if ("update".equals(operateType)) {
|
||||
String compNo = (String) map.get("comp_no");
|
||||
// 查询对应ID
|
||||
if (StringUtils.isNotBlank(compNo)) {
|
||||
List<CompPO> compPOS = MapperProxyFactory.getProxy(CompMapper.class).listByNo(compNo);
|
||||
if (checkRepeatNo(compNo, extendType, null)) {
|
||||
|
||||
} else {
|
||||
errMsg.add(compNo + "编号已存在");
|
||||
}
|
||||
|
||||
} else {
|
||||
errMsg.add("编号为空,更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -506,20 +516,22 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
* 校验重复编号
|
||||
*
|
||||
* @param no
|
||||
* @param tableName
|
||||
* @param extendType
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private boolean checkRepeatNo(String no, String tableName, Long id) {
|
||||
private boolean checkRepeatNo(String no, Long extendType, Long id) {
|
||||
if (StringUtils.isBlank(no)) {
|
||||
return true;
|
||||
}
|
||||
if (StringUtils.isNotBlank(tableName)) {
|
||||
switch (tableName) {
|
||||
case "JCL_ORG_COMP":
|
||||
if (null != extendType) {
|
||||
switch (extendType.toString()) {
|
||||
case "1":
|
||||
return 0 == MapperProxyFactory.getProxy(CompMapper.class).checkRepeatNo(no, id);
|
||||
case "JCL_ORG_DEPT":
|
||||
case "JCL_ORG_JOB":
|
||||
case "2":
|
||||
return 0 == MapperProxyFactory.getProxy(DepartmentMapper.class).checkRepeatNo(no, id);
|
||||
case "3":
|
||||
return 0 == MapperProxyFactory.getProxy(JobMapper.class).checkRepeatNo(no, id);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue