!165 分部导入

Merge pull request !165 from dxfeng/feature/dxf
pull/166/MERGE
dxfeng 3 years ago committed by Gitee
commit 88c646272d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -76,7 +76,7 @@ public class CompServiceImpl extends Service implements CompService {
*/ */
private static final Long GROUP_ID = 1L; private static final Long GROUP_ID = 1L;
private CompMapper getCompMapper() { private static CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class); return MapperProxyFactory.getProxy(CompMapper.class);
} }
@ -372,7 +372,7 @@ public class CompServiceImpl extends Service implements CompService {
* *
* @return * @return
*/ */
private String repeatDetermine(String compNo) { public static String repeatDetermine(String compNo) {
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.SUBCOMPANY.getValue()); CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.SUBCOMPANY.getValue());
if (StringUtils.isNotBlank(compNo)) { if (StringUtils.isNotBlank(compNo)) {
compNo = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, compNo); compNo = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, compNo);
@ -391,7 +391,7 @@ public class CompServiceImpl extends Service implements CompService {
* *
* @return * @return
*/ */
private String autoCreateCompanyNo() { private static String autoCreateCompanyNo() {
String generateCode = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, ""); String generateCode = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, "");
List<CompPO> list = getCompMapper().listByNo(Util.null2String(generateCode)); List<CompPO> list = getCompMapper().listByNo(Util.null2String(generateCode));
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {

@ -10,13 +10,14 @@ import com.engine.core.impl.Service;
import com.engine.hrm.entity.FieldSelectOptionBean; import com.engine.hrm.entity.FieldSelectOptionBean;
import com.engine.organization.entity.DeleteParam; import com.engine.organization.entity.DeleteParam;
import com.engine.organization.entity.SelectOptionParam; 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.param.ExtendInfoParams;
import com.engine.organization.entity.extend.po.ExtendInfoPO; import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.hrmresource.param.HrmResourceImportParam; import com.engine.organization.entity.hrmresource.param.HrmResourceImportParam;
import com.engine.organization.mapper.comp.CompMapper; 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.ExtMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper; import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.service.ImportCommonService; import com.engine.organization.service.ImportCommonService;
import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
@ -182,7 +183,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
jsonObject.put("name", item.getFieldNameDesc()); jsonObject.put("name", item.getFieldNameDesc());
return jsonObject; return jsonObject;
}).collect(Collectors.toList()); }).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("data", fieldDatas);
returnMaps.put("selectedKeys", selectedKeys); returnMaps.put("selectedKeys", selectedKeys);
return returnMaps; return returnMaps;
@ -402,14 +403,23 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
break nextRow; break nextRow;
} }
map.put(infoPO.getFieldName(), reallyValue); map.put(infoPO.getFieldName(), reallyValue);
// TODO 自动编号 String compNo = (String) map.get("comp_no");
if ("add".equals(operateType)) { 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()); MapperProxyFactory.getProxy(ExtMapper.class).insertExt(ExtendInfoParams.builder().tableName("JCL_ORG_COMP").params(map).build());
} else if ("update".equals(operateType)) { } else if ("update".equals(operateType)) {
String compNo = (String) map.get("comp_no");
// 查询对应ID // 查询对应ID
if (StringUtils.isNotBlank(compNo)) { 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 no
* @param tableName * @param extendType
* @param id * @param id
* @return * @return
*/ */
private boolean checkRepeatNo(String no, String tableName, Long id) { private boolean checkRepeatNo(String no, Long extendType, Long id) {
if (StringUtils.isBlank(no)) { if (StringUtils.isBlank(no)) {
return true; return true;
} }
if (StringUtils.isNotBlank(tableName)) { if (null != extendType) {
switch (tableName) { switch (extendType.toString()) {
case "JCL_ORG_COMP": case "1":
return 0 == MapperProxyFactory.getProxy(CompMapper.class).checkRepeatNo(no, id); return 0 == MapperProxyFactory.getProxy(CompMapper.class).checkRepeatNo(no, id);
case "JCL_ORG_DEPT": case "2":
case "JCL_ORG_JOB": return 0 == MapperProxyFactory.getProxy(DepartmentMapper.class).checkRepeatNo(no, id);
case "3":
return 0 == MapperProxyFactory.getProxy(JobMapper.class).checkRepeatNo(no, id);
default: default:
return false; return false;
} }

Loading…
Cancel
Save