部门切换数据源、实体类更新

pull/79/head
dxfeng 3 years ago
parent aa3d0742ff
commit 9a2eabc8bd

@ -199,13 +199,13 @@ public class JobBrowserService extends BrowserService {
if (detachUtil.isDETACH()) { if (detachUtil.isDETACH()) {
detachUtil.filterCompanyList(compList); detachUtil.filterCompanyList(compList);
} }
DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Integer.parseInt(params.getId())).forbiddenTag(0).deleteType(0).build(); DepartmentPO departmentBuild = DepartmentPO.builder().subCompanyId1(Integer.parseInt(params.getId())).canceled(0).build();
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order"); List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item)); compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
departmentList.stream().filter(item -> null == item.getParentDept() || 0 == item.getParentDept()).forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item)); departmentList.stream().filter(item -> null == item.getSupDepId() || 0 == item.getSupDepId()).forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item));
} else if ("2".equals(params.getType())) { } else if ("2".equals(params.getType())) {
DepartmentPO departmentBuild = DepartmentPO.builder().parentDept(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build(); DepartmentPO departmentBuild = DepartmentPO.builder().supDepId(Integer.parseInt(params.getId())).canceled(0).build();
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order"); List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
departmentList.forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item)); departmentList.forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item));
} }
@ -241,7 +241,7 @@ public class JobBrowserService extends BrowserService {
private void buildDeptNodes(List<TreeNode> treeNodes, List<String> hasSubDepartment, DepartmentPO department) { private void buildDeptNodes(List<TreeNode> treeNodes, List<String> hasSubDepartment, DepartmentPO department) {
SearchTree searchTree = new SearchTree(); SearchTree searchTree = new SearchTree();
searchTree.setId(department.getId().toString()); searchTree.setId(department.getId().toString());
searchTree.setName(department.getDeptName()); searchTree.setName(department.getDepartmentName());
searchTree.setType(TreeNodeTypeEnum.TYPE_DEPT.getValue()); searchTree.setType(TreeNodeTypeEnum.TYPE_DEPT.getValue());
searchTree.setIsParent(hasSubDepartment.contains(department.getId().toString())); searchTree.setIsParent(hasSubDepartment.contains(department.getId().toString()));
treeNodes.add(searchTree); treeNodes.add(searchTree);

@ -73,7 +73,7 @@ public class CodeSettingBO {
if(Objects.nonNull(param)) { if(Objects.nonNull(param)) {
String enable = Util.null2String(param.getEnable(),"0"); String enable = Util.null2String(param.getEnable(),"0");
String key = param.getKey(); String key = param.getKey();
if (enable.equals("1") && StringUtils.isNotEmpty(key)) { if ("1".equals(enable) && StringUtils.isNotEmpty(key)) {
sb.append(key); sb.append(key);
sb.append(","); sb.append(",");
} }

@ -96,8 +96,12 @@ public class FieldInfo {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FieldInfo fieldInfo = (FieldInfo) o; FieldInfo fieldInfo = (FieldInfo) o;
return Objects.equals(fieldName, fieldInfo.fieldName) && return Objects.equals(fieldName, fieldInfo.fieldName) &&
Objects.equals(firstFieldType, fieldInfo.firstFieldType) && Objects.equals(firstFieldType, fieldInfo.firstFieldType) &&

@ -26,22 +26,22 @@ public class DepartmentBO {
public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list) { public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list) {
// 递归添加父级数据 // 递归添加父级数据
Map<Long, DepartmentPO> poMaps = list.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item)); Map<Integer, DepartmentPO> poMaps = list.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item));
List<DepartmentListDTO> dtoList = list.stream().map(e -> List<DepartmentListDTO> dtoList = list.stream().map(e ->
DepartmentListDTO DepartmentListDTO
.builder() .builder()
.id(e.getId()) .id(e.getId())
.deptNo(e.getDeptNo()) .departmentMark(e.getDepartmentMark())
.deptName(e.getDeptName()) .departmentName(e.getDepartmentName())
.deptNameShort(e.getDeptNameShort()) .subCompanyId1(e.getSubCompanyId1())
.parentComp(null == e.getParentComp() ? "" : MapperProxyFactory.getProxy(CompanyMapper.class).listById(e.getParentComp().intValue()).getSubCompanyName()) .subCompanyName(0 == e.getSubCompanyId1() ? "" : MapperProxyFactory.getProxy(CompanyMapper.class).listById(e.getSubCompanyId1()).getSubCompanyName())
.parentDept(e.getParentDept()) .supDepId(e.getSupDepId())
.parentDeptName(null == poMaps.get(e.getParentDept()) ? "" : poMaps.get(e.getParentDept()).getDeptName()) .supDepName(null == poMaps.get(e.getSupDepId()) ? "" : poMaps.get(e.getSupDepId()).getDepartmentName())
.deptPrincipal(getEmployeeNameById(e.getDeptPrincipal())) // .deptPrincipal(getEmployeeNameById(e.getDeptPrincipal()))
.showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder()) .showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder())
.forbiddenTag(e.getForbiddenTag()) .canceled(e.getCanceled())
.build()).collect(Collectors.toList()); .build()).collect(Collectors.toList());
Map<Long, List<DepartmentListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentDept() && 0 != item.getParentDept()).collect(Collectors.groupingBy(DepartmentListDTO::getParentDept)); Map<Integer, List<DepartmentListDTO>> collects = dtoList.stream().filter(item -> 0 != item.getSupDepId()).collect(Collectors.groupingBy(DepartmentListDTO::getSupDepId));
// 处理被引用数据 // 处理被引用数据
List<String> usedIds = MapperProxyFactory.getProxy(DepartmentMapper.class).listUsedId(); List<String> usedIds = MapperProxyFactory.getProxy(DepartmentMapper.class).listUsedId();
List<String> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList()); List<String> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList());
@ -57,7 +57,7 @@ public class DepartmentBO {
e.setIsUsed(0); e.setIsUsed(0);
} }
} }
}).filter(item -> null == item.getParentDept() || 0 == item.getParentDept()).collect(Collectors.toList()); }).filter(item -> null == item.getSupDepId() || 0 == item.getSupDepId()).collect(Collectors.toList());
} }
public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list, List<DepartmentPO> filterList) { public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list, List<DepartmentPO> filterList) {
@ -66,7 +66,7 @@ public class DepartmentBO {
return Collections.emptyList(); return Collections.emptyList();
} }
// 递归添加父级数据 // 递归添加父级数据
Map<Long, DepartmentPO> poMaps = list.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item)); Map<Integer, DepartmentPO> poMaps = list.stream().collect(Collectors.toMap(DepartmentPO::getId, item -> item));
List<DepartmentPO> addedList = new ArrayList<>(); List<DepartmentPO> addedList = new ArrayList<>();
for (DepartmentPO po : filterList) { for (DepartmentPO po : filterList) {
dealParentData(addedList, po, poMaps); dealParentData(addedList, po, poMaps);
@ -74,32 +74,32 @@ public class DepartmentBO {
return buildDeptDTOList(addedList); return buildDeptDTOList(addedList);
} }
public static DepartmentPO convertParamsToPO(DeptSearchParam param, long employeeId) { public static DepartmentPO convertParamsToPO(DeptSearchParam param, Integer employeeId) {
if (null == param) { if (null == param) {
return null; return null;
} }
return DepartmentPO return DepartmentPO
.builder() .builder()
.id(param.getId() == null ? 0 : param.getId()) .id(param.getId() == null ? 0 : param.getId())
.deptNo(param.getDeptNo()) .departmentMark(param.getDepartmentMark())
.deptName(param.getDepartmentName()) .departmentName(param.getDepartmentName())
.deptNameShort(param.getDeptNameShort()) .subCompanyId1(param.getSubCompanyId1())
.parentComp(null == param.getParentComp() ? param.getSubcompanyid1() : param.getParentComp()) .supDepId(param.getSupDepId())
.ecCompany(param.getEcCompany()) .allSupDepId(param.getAllSupDepId())
.parentDept(null == param.getParentDept() ? param.getDepartmentid() : param.getParentDept()) .canceled(param.getCanceled() == null ? null : param.getCanceled() ? 0 : 1)
.ecDepartment(param.getEcDepartment()) .departmentCode(param.getDepartmentCode())
.deptPrincipal(param.getDeptPrincipal()) .coadjutant(param.getCoadjutant())
.uuid(param.getUuid())
.showOrder(param.getShowOrder()) .showOrder(param.getShowOrder())
.forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1) .showOrderOfTree(param.getShowOrderOfTree())
.description(param.getDescription()) .created(new Date())
.deleteType(0) .modified(new Date())
.createTime(new Date()) .creater(employeeId)
.updateTime(new Date()) .modifier(employeeId)
.creator(employeeId)
.build(); .build();
} }
public static List<SingleDeptTreeVO> buildSingleDeptTreeVOS(List<DepartmentPO> departmentPOs, Long parentComp) { public static List<SingleDeptTreeVO> buildSingleDeptTreeVOS(List<DepartmentPO> departmentPOs, Integer parentComp) {
if (CollectionUtils.isEmpty(departmentPOs)) { if (CollectionUtils.isEmpty(departmentPOs)) {
return Collections.emptyList(); return Collections.emptyList();
@ -109,17 +109,17 @@ public class DepartmentBO {
SingleDeptTreeVO SingleDeptTreeVO
.builder() .builder()
.id(e.getId()) .id(e.getId())
.deptNo(e.getDeptNo()) .departmentCode(e.getDepartmentCode())
.deptName(e.getDeptName()) .departmentMark(e.getDepartmentMark())
.parentComp(e.getParentComp()) .subCompanyId1(e.getSubCompanyId1())
.parentDept(e.getParentDept()) .supDepId(e.getSupDepId())
.parentDeptName(e.getParentDept() == null ? "" : getDeptNameById(e.getParentDept())) .supDepName(e.getSupDepId() == 0 ? "" : getDeptNameById(e.getSupDepId()))
.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal())) //.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal()))
.build()).collect(Collectors.toList()); .build()).collect(Collectors.toList());
//获取非一级部门 //获取非一级部门
Map<Long, List<SingleDeptTreeVO>> collects = singleDeptTreeVOS.stream().filter(item -> !parentComp.equals(item.getParentComp()) && null != item.getParentDept()).collect(Collectors.groupingBy(SingleDeptTreeVO::getParentDept)); Map<Integer, List<SingleDeptTreeVO>> collects = singleDeptTreeVOS.stream().filter(item -> !parentComp.equals(item.getSubCompanyId1()) && 0 != item.getSupDepId()).collect(Collectors.groupingBy(SingleDeptTreeVO::getSupDepId));
return singleDeptTreeVOS.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> parentComp.equals(item.getParentComp())).collect(Collectors.toList()); return singleDeptTreeVOS.stream().peek(e -> e.setChildren(collects.get(e.getId()))).filter(item -> parentComp.equals(item.getSubCompanyId1())).collect(Collectors.toList());
} }
public static List<SearchTree> buildSetToSearchTree(Set<DepartmentPO> departmentPOS) { public static List<SearchTree> buildSetToSearchTree(Set<DepartmentPO> departmentPOS) {
@ -131,23 +131,23 @@ public class DepartmentBO {
return departmentPOS.stream().map(item -> { return departmentPOS.stream().map(item -> {
SearchTree tree = new SearchTree(); SearchTree tree = new SearchTree();
tree.setCanClick(true); tree.setCanClick(true);
tree.setCanceled(item.getForbiddenTag() != 0); tree.setCanceled(item.getCanceled() != 0);
tree.setIcon(isLeaf ? "icon-coms-Branch" : "icon-coms-LargeArea"); tree.setIcon(isLeaf ? "icon-coms-Branch" : "icon-coms-LargeArea");
tree.setId(item.getId().toString()); tree.setId(item.getId().toString());
tree.setIsParent(false); tree.setIsParent(false);
tree.setIsVirtual("0"); tree.setIsVirtual("0");
tree.setName(item.getDeptName()); tree.setName(item.getDepartmentName());
tree.setPid(null == item.getParentDept() ? "0" : item.getParentDept().toString()); tree.setPid(item.getSupDepId().toString());
tree.setSelected(false); tree.setSelected(false);
tree.setType("2"); tree.setType("2");
tree.setParentComp(null == item.getParentComp() ? "0" : item.getParentComp().toString()); tree.setParentComp(item.getSubCompanyId1().toString());
tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder()); tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder().intValue());
return tree; return tree;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
public static String getDeptNameById(Long id) { public static String getDeptNameById(Integer id) {
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(id); return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(id);
} }
@ -163,11 +163,11 @@ public class DepartmentBO {
* @param po * @param po
* @param poMaps * @param poMaps
*/ */
private static void dealParentData(List<DepartmentPO> addedList, DepartmentPO po, Map<Long, DepartmentPO> poMaps) { private static void dealParentData(List<DepartmentPO> addedList, DepartmentPO po, Map<Integer, DepartmentPO> poMaps) {
if (!addedList.contains(po)) { if (!addedList.contains(po)) {
addedList.add(po); addedList.add(po);
} }
DepartmentPO parentPO = poMaps.get(po.getParentDept()); DepartmentPO parentPO = poMaps.get(po.getSupDepId());
if (null != parentPO) { if (null != parentPO) {
dealParentData(addedList, parentPO, poMaps); dealParentData(addedList, parentPO, poMaps);
} }

@ -24,7 +24,7 @@ import java.util.List;
tableType = WeaTableType.NONE) tableType = WeaTableType.NONE)
public class DepartmentListDTO { public class DepartmentListDTO {
private Long id; private Integer id;
/** /**
* *
*/ */
@ -33,58 +33,54 @@ public class DepartmentListDTO {
/** /**
* *
*/ */
@TableTitle(title = "名称", dataIndex = "deptName", key = "deptName",width = "200") @TableTitle(title = "名称", dataIndex = "departmentMark", key = "departmentMark", width = "200")
private String deptName; private String departmentMark;
/** /**
* *
*/ */
@TableTitle(title = "编号", dataIndex = "deptNo", key = "deptNo") @TableTitle(title = "编号", dataIndex = "departmentCode", key = "departmentCode")
private String deptNo; private String departmentCode;
/** /**
* *
*/ */
@TableTitle(title = "简称", dataIndex = "deptNameShort", key = "deptNameShort") @TableTitle(title = "简称", dataIndex = "departmentName", key = "departmentName")
private String deptNameShort; private String departmentName;
/** /**
* *
*/ */
@TableTitle(title = "所属分部", dataIndex = "parentComp", key = "parentComp") @TableTitle(title = "所属分部", dataIndex = "subCompanyName", key = "subCompanyName")
private String parentComp; private String subCompanyName;
private Integer subCompanyId1;
/** /**
* *
*/ */
@TableTitle(title = "上级部门", dataIndex = "parentDeptName", key = "parentDeptName") @TableTitle(title = "上级部门", dataIndex = "supDepName", key = "supDepName")
private String parentDeptName; private String supDepName;
private Long parentDept; private Integer supDepId;
/** ///**
* // * 部门负责人
*/ // */
@TableTitle(title = "部门负责人", dataIndex = "deptPrincipal", key = "deptPrincipal") //@TableTitle(title = "部门负责人", dataIndex = "deptPrincipal", key = "deptPrincipal")
private String deptPrincipal; //private String deptPrincipal;
/** /**
* *
*/ */
@TableTitle(title = "显示顺序", dataIndex = "showOrder", key = "showOrder", sorter = true) @TableTitle(title = "显示顺序", dataIndex = "showOrder", key = "showOrder", sorter = true)
private int showOrder; private Double showOrder;
///**
// * 说明
// */
//@TableTitle(title = "说明", dataIndex = "description", key = "description")
//private String description;
/** /**
* *
*/ */
@TableTitle(title = "是否启用", dataIndex = "forbiddenTag", key = "forbiddenTag") @TableTitle(title = "是否启用", dataIndex = "canceled", key = "canceled")
private int forbiddenTag; private int canceled;
/** /**
* *
*/ */

@ -19,11 +19,11 @@ public class DepartmentMergeParam {
/** /**
* *
*/ */
private Long id; private Integer id;
/** /**
* *
*/ */
private Long department; private Integer department;
/** /**
* *
*/ */

@ -16,8 +16,8 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class DepartmentMoveParam { public class DepartmentMoveParam {
private Long id; private Integer id;
private String moveType; private String moveType;
private Integer company; private Integer company;
private Long department; private Integer department;
} }

@ -17,29 +17,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class DeptSearchParam extends BaseQueryParam { public class DeptSearchParam extends BaseQueryParam {
private Long id; private Integer id;
private String departmentMark;
private String deptNo;
private String departmentName; private String departmentName;
private Integer subCompanyId1;
private String deptNameShort; private Integer supDepId;
private String allSupDepId;
private Integer parentComp; private Boolean canceled;
private Integer ecCompany; private String departmentCode;
private Integer coadjutant;
private Long parentDept;
private Long ecDepartment; private String uuid;
private Double showOrder;
private Long deptPrincipal; private Integer showOrderOfTree;
private Integer showOrder;
private String description;
private Boolean forbiddenTag;
private Integer subcompanyid1;
private Long departmentid;
} }

@ -18,8 +18,8 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
public class QuerySingleDeptListParam extends BaseQueryParam { public class QuerySingleDeptListParam extends BaseQueryParam {
private Long parentComp; private Integer parentComp;
private Long parentDept; private Integer parentDept;
} }

@ -18,36 +18,22 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class DepartmentPO { public class DepartmentPO {
private Integer id;
private Long id; private String departmentMark;
private String departmentName;
private String deptNo; private Integer subCompanyId1;
private Integer supDepId;
private String deptName; private String allSupDepId;
private Integer canceled;
private String deptNameShort; private String departmentCode;
private Integer coadjutant;
private Integer parentComp;
private Integer ecCompany; private Date created;
private Integer creater;
private Long parentDept; private Date modified;
private Long ecDepartment; private Integer modifier;
private Long deptPrincipal; //部门负责人
private Integer showOrder;
private String description;
private Integer forbiddenTag;
private String uuid; private String uuid;
private Double showOrder;
private Integer showOrderOfTree;
private Long creator;
private int deleteType;
private Date createTime;
private Date updateTime;
} }

@ -24,23 +24,23 @@ import java.util.List;
tableType = WeaTableType.NONE) tableType = WeaTableType.NONE)
public class SingleDeptTreeVO { public class SingleDeptTreeVO {
private Long id; private Integer id;
@TableTitle(title = "编号", dataIndex = "deptNo", key = "deptNo") @TableTitle(title = "编号", dataIndex = "departmentCode", key = "departmentCode")
private String deptNo; private String departmentCode;
@TableTitle(title = "部门名称", dataIndex = "deptName", key = "deptName") @TableTitle(title = "部门名称", dataIndex = "departmentMark", key = "departmentMark")
private String deptName; private String departmentMark;
private Integer parentComp; //上级分部 private Integer subCompanyId1; //上级分部
private Long parentDept; //上级部门id private Integer supDepId; //上级部门id
@TableTitle(title = "上级部门", dataIndex = "parentDeptName", key = "parentDeptName") @TableTitle(title = "上级部门", dataIndex = "supDepName", key = "supDepName")
private String parentDeptName; //上级部门 private String supDepName; //上级部门
@TableTitle(title = "部门负责人", dataIndex = "deptPrincipalName", key = "deptPrincipalName") //@TableTitle(title = "部门负责人", dataIndex = "deptPrincipalName", key = "deptPrincipalName")
private String deptPrincipalName; //部门负责人 //private String deptPrincipalName; //部门负责人
//子节点 //子节点
private List<SingleDeptTreeVO> children; private List<SingleDeptTreeVO> children;

@ -296,7 +296,7 @@ public class ExtendInfoBO {
switch (fieldhtmltype) { switch (fieldhtmltype) {
case "1": //单行文本框 case "1": //单行文本框
if (detailtype.equals("2")) {//数字 if ("2".equals(detailtype)) {//数字
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUTNUMBER, fieldlabel, fieldname, isQuickSearch); searchConditionItem = conditionFactory.createCondition(ConditionType.INPUTNUMBER, fieldlabel, fieldname, isQuickSearch);
} else { } else {
searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, "25034", fieldname, isQuickSearch); searchConditionItem = conditionFactory.createCondition(ConditionType.INPUT, "25034", fieldname, isQuickSearch);
@ -347,14 +347,14 @@ public class ExtendInfoBO {
break; break;
} }
default: default:
if (detailtype.equals("161") || detailtype.equals("162") || detailtype.equals("256") || detailtype.equals("257")) { if ("161".equals(detailtype) || "162".equals(detailtype) || "256".equals(detailtype) || "257".equals(detailtype)) {
BrowserBean browserbean = new BrowserBean(Util.null2String(detailtype)); BrowserBean browserbean = new BrowserBean(Util.null2String(detailtype));
BrowserInitUtil browserInitUtil = new BrowserInitUtil(); BrowserInitUtil browserInitUtil = new BrowserInitUtil();
String fielddbtype = customValue; String fielddbtype = customValue;
if (!customValue.startsWith("browser.")) { if (!customValue.startsWith("browser.")) {
fielddbtype = "browser." + customValue; fielddbtype = "browser." + customValue;
} }
if (detailtype.equals("161") || detailtype.equals("162")) { if ("161".equals(detailtype) || "162".equals(detailtype)) {
browserInitUtil.initCustomizeBrow(browserbean, fielddbtype, Util.getIntValue(detailtype), user.getUID()); browserInitUtil.initCustomizeBrow(browserbean, fielddbtype, Util.getIntValue(detailtype), user.getUID());
} else { } else {
browserbean.getDataParams().put("cube_treeid", customValue); browserbean.getDataParams().put("cube_treeid", customValue);
@ -382,7 +382,9 @@ public class ExtendInfoBO {
String[] fieldvalues = Util.splitString(tmpFieldValue, ","); String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) { for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) {
String fieldshowname = Util.null2String(shiftManagementToolKit.getShiftOnOffWorkSections(fieldvalues[i], user.getLanguage())); String fieldshowname = Util.null2String(shiftManagementToolKit.getShiftOnOffWorkSections(fieldvalues[i], user.getLanguage()));
if (fieldshowname.length() == 0) continue; if (fieldshowname.length() == 0) {
continue;
}
Map<String, Object> replaceData = new HashMap<>(); Map<String, Object> replaceData = new HashMap<>();
replaceData.put("id", fieldvalues[i]); replaceData.put("id", fieldvalues[i]);
replaceData.put("name", fieldshowname); replaceData.put("name", fieldshowname);
@ -395,7 +397,9 @@ public class ExtendInfoBO {
String[] fieldvalues = Util.splitString(tmpFieldValue, ","); String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) { for (int i = 0; fieldvalues != null && i < fieldvalues.length; i++) {
String fieldshowname = Util.null2String(sensitiveWordTypeComInfo.getName(fieldvalues[i])); String fieldshowname = Util.null2String(sensitiveWordTypeComInfo.getName(fieldvalues[i]));
if (fieldshowname.length() == 0) continue; if (fieldshowname.length() == 0) {
continue;
}
Map<String, Object> replaceData = new HashMap<>(); Map<String, Object> replaceData = new HashMap<>();
replaceData.put("id", fieldvalues[i]); replaceData.put("id", fieldvalues[i]);
replaceData.put("name", fieldshowname); replaceData.put("name", fieldshowname);
@ -423,7 +427,7 @@ public class ExtendInfoBO {
String fieldshowname = hrmFieldManager.getFieldvalue(user, customValue, Util.getIntValue(fieldid), Util.getIntValue(fieldhtmltype), Util.getIntValue(detailtype), tmpFieldValue, 0); String fieldshowname = hrmFieldManager.getFieldvalue(user, customValue, Util.getIntValue(fieldid), Util.getIntValue(fieldhtmltype), Util.getIntValue(detailtype), tmpFieldValue, 0);
String[] fieldvalues = Util.splitString(tmpFieldValue, ","); String[] fieldvalues = Util.splitString(tmpFieldValue, ",");
String[] fieldshownames = Util.splitString(fieldshowname, ","); String[] fieldshownames = Util.splitString(fieldshowname, ",");
if (detailtype.equals("257")) { if ("257".equals(detailtype)) {
if (fieldshowname.endsWith("&nbsp")) { if (fieldshowname.endsWith("&nbsp")) {
fieldshowname = fieldshowname.substring(0, fieldshowname.length() - 5); fieldshowname = fieldshowname.substring(0, fieldshowname.length() - 5);
} }
@ -450,7 +454,7 @@ public class ExtendInfoBO {
break; break;
case "4": //Check框 case "4": //Check框
searchConditionItem = conditionFactory.createCondition(ConditionType.CHECKBOX, fieldlabel, fieldname); searchConditionItem = conditionFactory.createCondition(ConditionType.CHECKBOX, fieldlabel, fieldname);
if (detailtype.equals("2")) { if ("2".equals(detailtype)) {
searchConditionItem.setConditionType(ConditionType.SWITCH); searchConditionItem.setConditionType(ConditionType.SWITCH);
} }
@ -459,7 +463,7 @@ public class ExtendInfoBO {
List<SearchConditionOption> searchConditionOptions = SelectOptionParam.convertJsonToListOption(customValue); List<SearchConditionOption> searchConditionOptions = SelectOptionParam.convertJsonToListOption(customValue);
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname, searchConditionOptions); searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, fieldlabel, fieldname, searchConditionOptions);
if (detailtype.equals("") || detailtype.equals("0")) { if ("".equals(detailtype) || "0".equals(detailtype)) {
detailtype = "1"; detailtype = "1";
} }
searchConditionItem.setKey(Util.null2String(fieldvalue)); searchConditionItem.setKey(Util.null2String(fieldvalue));
@ -467,7 +471,7 @@ public class ExtendInfoBO {
searchConditionItem.setDetailtype(Util.getIntValue(detailtype, 3)); searchConditionItem.setDetailtype(Util.getIntValue(detailtype, 3));
break; break;
case "6": //附件 case "6": //附件
if (fieldname.equals("resourceimageid")) { if ("resourceimageid".equals(fieldname)) {
searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, fieldlabel, fieldname, isQuickSearch); searchConditionItem = conditionFactory.createCondition(ConditionType.RESOURCEIMG, fieldlabel, fieldname, isQuickSearch);
} else { } else {
searchConditionItem = conditionFactory.createCondition(ConditionType.UPLOAD, fieldlabel, fieldname, isQuickSearch); searchConditionItem = conditionFactory.createCondition(ConditionType.UPLOAD, fieldlabel, fieldname, isQuickSearch);

@ -38,17 +38,17 @@ public class ExtendInfoFieldParam {
public String getControlType() { public String getControlType() {
JSONArray fieldType = (JSONArray) this.getFieldType(); JSONArray fieldType = (JSONArray) this.getFieldType();
String fieldHtmlType = Util.null2String(fieldType.get(0)); String fieldHtmlType = Util.null2String(fieldType.get(0));
if (fieldHtmlType.equals("input")) { if ("input".equals(fieldHtmlType)) {
fieldHtmlType = "1"; fieldHtmlType = "1";
} else if (fieldHtmlType.equals("textarea")) { } else if ("textarea".equals(fieldHtmlType)) {
fieldHtmlType = "2"; fieldHtmlType = "2";
} else if (fieldHtmlType.equals("browser")) { } else if ("browser".equals(fieldHtmlType)) {
fieldHtmlType = "3"; fieldHtmlType = "3";
} else if (fieldHtmlType.equals("check")) { } else if ("check".equals(fieldHtmlType)) {
fieldHtmlType = "4"; fieldHtmlType = "4";
} else if (fieldHtmlType.equals("select")) { } else if ("select".equals(fieldHtmlType)) {
fieldHtmlType = "5"; fieldHtmlType = "5";
} else if (fieldHtmlType.equals("upload")) { } else if ("upload".equals(fieldHtmlType)) {
fieldHtmlType = "6"; fieldHtmlType = "6";
} }
return fieldHtmlType; return fieldHtmlType;
@ -60,27 +60,27 @@ public class ExtendInfoFieldParam {
if (fieldType.size() > 1) { if (fieldType.size() > 1) {
browserType = Util.null2String(fieldType.get(1)); browserType = Util.null2String(fieldType.get(1));
} }
if (controlType.equals("1")) { if ("1".equals(controlType)) {
if (browserType.equals("text")) { if ("text".equals(browserType)) {
browserType = "1"; browserType = "1";
} else if (browserType.equals("int")) { } else if ("int".equals(browserType)) {
browserType = "2"; browserType = "2";
} else if (browserType.equals("float")) { } else if ("float".equals(browserType)) {
browserType = "3"; browserType = "3";
} else if (browserType.equals("file")) { } else if ("file".equals(browserType)) {
browserType = "1"; browserType = "1";
} }
} }
if (controlType.equals("2")) { if ("2".equals(controlType)) {
browserType = "1"; browserType = "1";
} else if (controlType.equals("3")) { } else if ("3".equals(controlType)) {
browserType = Util.null2String(((JSONObject) fieldType.get(1)).get("value")); browserType = Util.null2String(((JSONObject) fieldType.get(1)).get("value"));
} else if (controlType.equals("4")) { } else if ("4".equals(controlType)) {
browserType = "1"; browserType = "1";
} else if (controlType.equals("5")) { } else if ("5".equals(controlType)) {
browserType = "1"; browserType = "1";
} else if (controlType.equals("6")) { } else if ("6".equals(controlType)) {
if (browserType.equals("file")) { if ("file".equals(browserType)) {
browserType = "1"; browserType = "1";
} }
} }
@ -89,7 +89,7 @@ public class ExtendInfoFieldParam {
public String getDbType(String controlType, String browserType) { public String getDbType(String controlType, String browserType) {
FieldParam fp = new FieldParam(); FieldParam fp = new FieldParam();
if (controlType.equals("1")) { if ("1".equals(controlType)) {
JSONArray fieldType = (JSONArray) this.getFieldType(); JSONArray fieldType = (JSONArray) this.getFieldType();
String dbLength = "100"; String dbLength = "100";
if (fieldType.size() > 2) { if (fieldType.size() > 2) {
@ -101,15 +101,15 @@ public class ExtendInfoFieldParam {
} }
fp.setSimpleText(Util.getIntValue(browserType, -1), dbLength); fp.setSimpleText(Util.getIntValue(browserType, -1), dbLength);
} else if (controlType.equals("2")) { } else if ("2".equals(controlType)) {
fp.setText(); fp.setText();
} else if (controlType.equals("3")) { } else if ("3".equals(controlType)) {
fp.setBrowser(Util.getIntValue(browserType, -1)); fp.setBrowser(Util.getIntValue(browserType, -1));
} else if (controlType.equals("4")) { } else if ("4".equals(controlType)) {
fp.setCheck(); fp.setCheck();
} else if (controlType.equals("5")) { } else if ("5".equals(controlType)) {
fp.setSelect(); fp.setSelect();
} else if (controlType.equals("6")) { } else if ("6".equals(controlType)) {
fp.setAttach(); fp.setAttach();
} }
return fp.getFielddbtype(); return fp.getFielddbtype();

@ -53,7 +53,7 @@ public class JobBO {
} }
public static List<SingleJobTreeVO> buildSingleJobTreeVOS(List<JobPO> jobPOS, Long parentDept) { public static List<SingleJobTreeVO> buildSingleJobTreeVOS(List<JobPO> jobPOS, Integer parentDept) {
if (CollectionUtils.isEmpty(jobPOS)) { if (CollectionUtils.isEmpty(jobPOS)) {
return Collections.emptyList(); return Collections.emptyList();
} }
@ -78,8 +78,6 @@ public class JobBO {
public static List<JobListDTO> buildDTOList(Collection<JobListDTO> list) { public static List<JobListDTO> buildDTOList(Collection<JobListDTO> list) {
// 递归添加父级数据 // 递归添加父级数据
Map<Long, JobListDTO> poMaps = list.stream().collect(Collectors.toMap(JobListDTO::getId, item -> item));
List<JobListDTO> dtoList = list.stream().map(e -> List<JobListDTO> dtoList = list.stream().map(e ->
JobListDTO.builder() JobListDTO.builder()
.id(e.getId()) .id(e.getId())

@ -68,7 +68,7 @@ public class JobListDTO {
//@TableTitle(title = "上级岗位", dataIndex = "parentJobName", key = "parentJobName") //@TableTitle(title = "上级岗位", dataIndex = "parentJobName", key = "parentJobName")
private String parentJobName; private String parentJobName;
private Long parentJob; private Long parentJob;
private Long parentComp; private Integer parentComp;
/** /**
* *
*/ */

@ -36,7 +36,7 @@ public class JobSearchParam extends BaseQueryParam {
/** /**
* ec * ec
*/ */
private Long ecDepartment; private Integer ecDepartment;
/** /**
* *
*/ */
@ -81,5 +81,5 @@ public class JobSearchParam extends BaseQueryParam {
private Integer subcompanyid1; private Integer subcompanyid1;
private Long departmentid; private Integer departmentid;
} }

@ -42,11 +42,11 @@ public class JobPO {
/** /**
* *
*/ */
private Long parentDept; private Integer parentDept;
/** /**
* ec * ec
*/ */
private Long ecDepartment; private Integer ecDepartment;
/** /**
* *

@ -37,7 +37,7 @@ public class SingleJobTreeVO {
private Long parentJob; private Long parentJob;
private Long parentDept; private Integer parentDept;
private List<SingleJobTreeVO> children; private List<SingleJobTreeVO> children;

@ -98,8 +98,12 @@ public class FieldInfo {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FieldInfo fieldInfo = (FieldInfo) o; FieldInfo fieldInfo = (FieldInfo) o;
return Objects.equals(fieldName, fieldInfo.fieldName) && return Objects.equals(fieldName, fieldInfo.fieldName) &&
Objects.equals(firstFieldType, fieldInfo.firstFieldType) && Objects.equals(firstFieldType, fieldInfo.firstFieldType) &&

@ -24,8 +24,12 @@ public class SearchTree extends TreeNode {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SearchTree that = (SearchTree) o; SearchTree that = (SearchTree) o;
return isCanceled == that.isCanceled && Objects.equals(this.getId(), that.getId()) &&Objects.equals(companyid, that.companyid) && Objects.equals(isVirtual, that.isVirtual) && Objects.equals(psubcompanyid, that.psubcompanyid) && Objects.equals(displayType, that.displayType) && Objects.equals(requestParams, that.requestParams) && Objects.equals(parentComp, that.parentComp) && Objects.equals(orderNum, that.orderNum); return isCanceled == that.isCanceled && Objects.equals(this.getId(), that.getId()) &&Objects.equals(companyid, that.companyid) && Objects.equals(isVirtual, that.isVirtual) && Objects.equals(psubcompanyid, that.psubcompanyid) && Objects.equals(displayType, that.displayType) && Objects.equals(requestParams, that.requestParams) && Objects.equals(parentComp, that.parentComp) && Objects.equals(orderNum, that.orderNum);
} }

@ -32,8 +32,8 @@ public class StaffSearchParam {
/** /**
* *
*/ */
private Long deptId; private Integer deptId;
private Long ecDepartment; private Integer ecDepartment;
/** /**
* *
*/ */

@ -34,8 +34,8 @@ public class StaffPO {
/** /**
* *
*/ */
private Long deptId; private Integer deptId;
private Long ecDepartment; private Integer ecDepartment;
/** /**
* *
*/ */

@ -73,7 +73,7 @@ public interface CompanyMapper {
* @param supSubComId * @param supSubComId
* @return * @return
*/ */
Long getIdByNameAndPid(@Param("subCompanyName") String subCompanyName, @Param("supSubComId") Integer supSubComId); Integer getIdByNameAndPid(@Param("subCompanyName") String subCompanyName, @Param("supSubComId") Integer supSubComId);
/** /**
* *

@ -149,7 +149,7 @@
</foreach> </foreach>
</select> </select>
<select id="getIdByNameAndPid" resultType="java.lang.Long"> <select id="getIdByNameAndPid" resultType="java.lang.Integer">
select id select id
from hrmsubcompany from hrmsubcompany
where subcompanyname = #{subCompanyName} where subcompanyname = #{subCompanyName}

@ -14,28 +14,22 @@ import java.util.Map;
* @Version V1.0 * @Version V1.0
**/ **/
public interface DepartmentMapper { public interface DepartmentMapper {
List<DepartmentPO> getDeptListByPId(@Param("PId") Integer PId);
List<DepartmentPO> getDeptListByCompId(@Param("parentComp") Integer parentComp);
List<DepartmentPO> getDeptListByPId(@Param("PId") Long PId);
int countChildByPID(@Param("pid") Long pid);
/** /**
* *
* *
* @return * @return
*/ */
List<DepartmentPO> list(@Param("orderSql") String orderSql); List<DepartmentPO> listAll(@Param("orderSql") String orderSql);
/** /**
* No * No
* *
* @param deptNo * @param departmentCode
* @return * @return
*/ */
List<DepartmentPO> listByNo(@Param("deptNo") String deptNo); List<DepartmentPO> listByNo(@Param("departmentCode") String departmentCode);
/** /**
* *
@ -60,15 +54,7 @@ public interface DepartmentMapper {
* @param id * @param id
* @return * @return
*/ */
DepartmentPO getDeptById(@Param("id") Long id); DepartmentPO getDeptById(@Param("id") Integer id);
/**
* UUID
*
* @param uuid
* @return
*/
DepartmentPO getDepartmentByUUID(@Param("uuid") String uuid);
/** /**
* ID * ID
@ -76,38 +62,7 @@ public interface DepartmentMapper {
* @param id * @param id
* @return * @return
*/ */
String getDeptNameById(@Param("id") Long id); String getDeptNameById(@Param("id") Integer id);
/**
*
*
* @param departmentPO
* @return
*/
int insertIgnoreNull(DepartmentPO departmentPO);
/**
*
*
* @param departmentPO
* @return
*/
int updateBaseDept(DepartmentPO departmentPO);
/**
*
*
* @param departmentPO
* @return
*/
int updateForbiddenTagById(DepartmentPO departmentPO);
/**
*
*
* @param ids
*/
int deleteByIds(@Param("ids") Collection<Long> ids);
/** /**
* ID * ID
@ -121,24 +76,22 @@ public interface DepartmentMapper {
* *
* @return * @return
*/ */
Integer getMaxShowOrder(); Double getMaxShowOrder();
/** /**
* *
* *
* @param departmentName * @param departmentName
* @param parentCompany * @param subCompanyId1
* @param parentDepartment * @param supDepId
* @return * @return
*/ */
Long getIdByNameAndPid(@Param("departmentName") String departmentName, @Param("parentCompany") Long parentCompany, @Param("parentDepartment") Long parentDepartment); Integer getIdByNameAndPid(@Param("departmentName") String departmentName, @Param("subCompanyId1") Integer subCompanyId1, @Param("supDepId") Integer supDepId);
int checkRepeatNo(@Param("departmentNo") String departmentNo, @Param("id") Long id); int checkRepeatNo(@Param("departmentCode") String departmentCode, @Param("id") Long id);
List<String> hasSubs(); List<String> hasSubs();
int countUsedInJob(@Param("departmentId") Long departmentId); int countUsedInJob(@Param("supDepId") Long supDepId);
/**************************************************/
} }

@ -3,22 +3,15 @@
<mapper namespace="com.engine.organization.mapper.department.DepartmentMapper"> <mapper namespace="com.engine.organization.mapper.department.DepartmentMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.department.po.DepartmentPO"> <resultMap id="BaseResultMap" type="com.engine.organization.entity.department.po.DepartmentPO">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="dept_no" property="deptNo"/> <result column="departmentMark" property="departmentMark"/>
<result column="dept_name" property="deptName"/> <result column="departmentName" property="departmentName"/>
<result column="dept_name_short" property="deptNameShort"/> <result column="subCompanyId1" property="subCompanyId1"/>
<result column="parent_comp" property="parentComp"/> <result column="supDepId" property="supDepId"/>
<result column="ec_company" property="ecCompany"/> <result column="allSupDepId" property="allSupDepId"/>
<result column="parent_dept" property="parentDept"/> <result column="canceled" property="canceled"/>
<result column="ec_department" property="ecDepartment"/> <result column="departmentCode" property="departmentCode"/>
<result column="dept_principal" property="deptPrincipal"/> <result column="coadjutant" property="coadjutant"/>
<result column="show_order" property="showOrder"/> <result column="showOrder" property="showOrder"/>
<result column="description" property="description"/>
<result column="forbidden_tag" property="forbiddenTag"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="uuid" property="uuid"/> <result column="uuid" property="uuid"/>
</resultMap> </resultMap>
@ -28,39 +21,28 @@
. .
id id
, ,
t.dept_no, t.departmentMark,
t.dept_name, t.departmentName,
t.dept_name_short, t.subCompanyId1,
t.parent_comp, t.supDepId,
t.ec_company, t.allSupDepId,
t.parent_dept, t.canceled,
t.ec_department, t.departmentCode,
t.dept_principal, t.coadjutant,
t.show_order, t.showOrder,
t.description,
t.forbidden_tag,
t.uuid t.uuid
</sql> </sql>
<select id="getDeptListByCompId" resultType="com.engine.organization.entity.department.po.DepartmentPO">
select
<include refid="baseColumns"/>
from jcl_org_dept t
where delete_type = 0
and parent_comp = #{parentComp}
</select>
<select id="getDeptListByPId" resultType="com.engine.organization.entity.department.po.DepartmentPO"> <select id="getDeptListByPId" resultType="com.engine.organization.entity.department.po.DepartmentPO">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_dept t from hrmdepartment t
where delete_type = 0 where supDepId = #{PId}
and parent_dept = #{PId}
</select> </select>
<select id="getDeptNameById" resultType="string"> <select id="getDeptNameById" resultType="string">
select t.dept_name select t.departmentName
from jcl_org_dept t from hrmdepartment t
where id = #{id} where id = #{id}
</select> </select>
@ -68,69 +50,45 @@
resultMap="BaseResultMap"> resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_dept t from hrmdepartment t
where delete_type = 0 where 1=1
<include refid="likeSQL"/> <include refid="likeSQL"/>
<if test=" departmentPO.ecCompany != null "> <if test=" departmentPO.subCompanyId1 != null ">
and t.ec_company = #{departmentPO.ecCompany} and t.subCompanyId1 = #{departmentPO.subCompanyId1}
</if>
<if test=" departmentPO.ecDepartment != null ">
and t.ec_department = #{departmentPO.ecDepartment}
</if>
<if test=" departmentPO.parentComp != null ">
and t.parent_comp = #{departmentPO.parentComp}
</if>
<if test=" departmentPO.parentDept != null ">
and t.parent_dept = #{departmentPO.parentDept}
</if> </if>
<if test=" departmentPO.deptPrincipal != null "> <if test=" departmentPO.supDepId != null ">
and t.dept_principal = #{departmentPO.deptPrincipal} and t.supDepId = #{departmentPO.supDepId}
</if>
<if test=" departmentPO.showOrder != null ">
and t.show_order = #{departmentPO.showOrder}
</if>
<if test=" departmentPO.forbiddenTag != null ">
and t.forbidden_tag = #{departmentPO.forbiddenTag}
</if> </if>
order by ${orderSql} order by ${orderSql}
</select> </select>
<select id="getDeptById" resultType="com.engine.organization.entity.department.po.DepartmentPO"> <select id="getDeptById" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_dept t from hrmdepartment t
where delete_type = 0 where id = #{id}
and id = #{id}
</select> </select>
<select id="listDeptsByIds" resultType="java.util.Map"> <select id="listDeptsByIds" resultType="java.util.Map">
select select
id as "id", id as "id",
dept_name as "name" departmentName as "name"
from jcl_org_dept t from hrmdepartment t
WHERE delete_type = 0 WHERE id IN
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")"> <foreach collection="ids" open="(" item="id" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="list" resultType="com.engine.organization.entity.department.po.DepartmentPO"> <select id="listAll" resultType="com.engine.organization.entity.department.po.DepartmentPO">
SELECT SELECT
<include refid="baseColumns"/> <include refid="baseColumns"/>
FROM jcl_org_dept t FROM hrmdepartment t order by ${orderSql}
WHERE t.delete_type = 0 order by ${orderSql}
</select> </select>
<select id="listByNo" resultType="com.engine.organization.entity.department.po.DepartmentPO"> <select id="listByNo" resultType="com.engine.organization.entity.department.po.DepartmentPO">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_dept t where dept_no = #{deptNo} AND delete_type = 0 from hrmdepartment t where departmentCode = #{departmentCode}
</select>
<select id="countChildByPID" resultType="java.lang.Integer">
select count(1)
from jcl_org_dept t
where delete_type = 0
and parent_dept = #{pid}
</select> </select>
<select id="listUsedId" resultType="java.lang.String"> <select id="listUsedId" resultType="java.lang.String">
select parent_dept select parent_dept
@ -144,361 +102,69 @@
<select id="getDeptsByIds" resultMap="BaseResultMap"> <select id="getDeptsByIds" resultMap="BaseResultMap">
select select
<include refid="baseColumns"/> <include refid="baseColumns"/>
from jcl_org_dept t from hrmdepartment t
where delete_type = 0 where id IN
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")"> <foreach collection="ids" open="(" item="id" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="getMaxShowOrder" resultType="java.lang.Integer"> <select id="getMaxShowOrder" resultType="java.lang.Double">
select max(show_order) select max(showOrder)
from jcl_org_dept from hrmdepartment
</select> </select>
<select id="getIdByNameAndPid" resultType="java.lang.Long"> <select id="getIdByNameAndPid" resultType="java.lang.Integer">
select id select id
from jcl_org_dept from hrmdepartment
where delete_type = 0 and dept_name = #{departmentName} where departmentName = #{departmentName}
and parent_comp = #{parentCompany} and subCompanyId1 = #{subCompanyId1}
<include refid="nullParentDepartment"/> and supDepId = #{supDepId}
</select>
<select id="getDepartmentByUUID" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_dept t
where delete_type = 0
and uuid = #{uuid}
</select> </select>
<select id="checkRepeatNo" resultType="java.lang.Integer"> <select id="checkRepeatNo" resultType="java.lang.Integer">
select count(1) select count(1)
from jcl_org_dept t from hrmdepartment t
where t.delete_type = 0 where departmentCode = #{departmentCode}
AND dept_no = #{departmentNo}
<if test=" id != null "> <if test=" id != null ">
and t.id != #{id} and t.id != #{id}
</if> </if>
</select> </select>
<select id="hasSubs" resultType="java.lang.String"> <select id="hasSubs" resultType="java.lang.String">
select distinct parent_dept select distinct supDepId
from jcl_org_dept from hrmdepartment
where forbidden_tag = 0 where canceled = 0
and delete_type = 0
</select> </select>
<select id="countUsedInJob" resultType="java.lang.Integer"> <select id="countUsedInJob" resultType="java.lang.Integer">
select count(1) select count(1)
from jcl_org_job from jcl_org_job
where forbidden_tag = 0 where forbidden_tag = 0
and delete_type = 0 and delete_type = 0
and parent_dept = #{departmentId} and parent_dept = = #{supDepId}
</select> </select>
<sql id="nullParentDepartment">
and ifnull(parent_dept,0) =
#{parentDepartment}
</sql>
<sql id="nullParentDepartment" databaseId="sqlserver">
and isnull(parent_dept,0) =
#{parentDepartment}
</sql>
<sql id="nullParentDepartment" databaseId="oracle">
and NVL(parent_dept,0) =
#{parentDepartment}
</sql>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.department.po.DepartmentPO"
keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_dept
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="deptNo != null ">
dept_no,
</if>
<if test="deptName != null ">
dept_name,
</if>
<if test="deptNameShort != null ">
dept_name_short,
</if>
<if test="parentComp != null ">
parent_comp,
</if>
<if test="ecCompany != null ">
ec_company,
</if>
<if test="parentDept != null ">
parent_dept,
</if>
<if test="ecDepartment != null ">
ec_department,
</if>
<if test="deptPrincipal != null ">
dept_principal,
</if>
<if test="showOrder != null ">
show_order,
</if>
<if test="description != null ">
description,
</if>
<if test="uuid != null ">
uuid,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="deptNo != null ">
#{deptNo},
</if>
<if test="deptName != null ">
#{deptName},
</if>
<if test="deptNameShort != null ">
#{deptNameShort},
</if>
<if test="parentComp != null ">
#{parentComp},
</if>
<if test="ecCompany != null ">
#{ecCompany},
</if>
<if test="parentDept != null ">
#{parentDept},
</if>
<if test="ecDepartment != null ">
#{ecDepartment},
</if>
<if test="deptPrincipal != null ">
#{deptPrincipal},
</if>
<if test="showOrder != null ">
#{showOrder},
</if>
<if test="description != null ">
#{description},
</if>
<if test="uuid != null ">
#{uuid},
</if>
0,
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.department.po.DepartmentPO"
databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_DEPT_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_dept
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="deptNo != null ">
dept_no,
</if>
<if test="deptName != null ">
dept_name,
</if>
<if test="deptNameShort != null ">
dept_name_short,
</if>
<if test="parentComp != null ">
parent_comp,
</if>
<if test="ecCompany != null ">
ec_company,
</if>
<if test="parentDept != null ">
parent_dept,
</if>
<if test="ecDepartment != null ">
ec_department,
</if>
<if test="deptPrincipal != null ">
dept_principal,
</if>
<if test="showOrder != null ">
show_order,
</if>
<if test="description != null ">
description,
</if>
<if test="uuid != null ">
uuid,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="deptNo != null ">
#{deptNo},
</if>
<if test="deptName != null ">
#{deptName},
</if>
<if test="deptNameShort != null ">
#{deptNameShort},
</if>
<if test="parentComp != null ">
#{parentComp},
</if>
<if test="ecCompany != null ">
#{ecCompany},
</if>
<if test="parentDept != null ">
#{parentDept},
</if>
<if test="ecDepartment != null ">
#{ecDepartment},
</if>
<if test="deptPrincipal != null ">
#{deptPrincipal},
</if>
<if test="showOrder != null ">
#{showOrder},
</if>
<if test="description != null ">
#{description},
</if>
<if test="uuid != null ">
#{uuid},
</if>
0,
</trim>
</insert>
<update id="updateBaseDept" parameterType="com.engine.organization.entity.department.po.DepartmentPO">
update jcl_org_dept
<set>
creator=#{creator},
update_time=#{updateTime},
dept_name=#{deptName},
dept_name_short=#{deptNameShort},
parent_comp=#{parentComp},
ec_company=#{ecCompany},
parent_dept=#{parentDept},
ec_department=#{ecDepartment},
dept_principal=#{deptPrincipal},
show_order=#{showOrder},
description=#{description},
<if test="forbiddenTag !=null">
forbidden_tag=#{forbiddenTag},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.department.po.DepartmentPO">
update jcl_org_dept
<set>
forbidden_tag=#{forbiddenTag},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="deleteByIds">
UPDATE jcl_org_dept
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<sql id="likeSQL"> <sql id="likeSQL">
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' "> <if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
and t.dept_no like CONCAT('%',#{departmentPO.deptNo},'%') and t.departmentCode like CONCAT('%',#{departmentPO.departmentCode},'%')
</if> </if>
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' "> <if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
and t.dept_name like CONCAT('%',#{departmentPO.deptName},'%') and t.departmentName like CONCAT('%',#{departmentPO.departmentMarkShort},'%')
</if>
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
and t.dept_name_short like CONCAT('%',#{departmentPO.deptNameShort},'%')
</if> </if>
</sql> </sql>
<sql id="likeSQL" databaseId="oracle"> <sql id="likeSQL" databaseId="oracle">
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' "> <if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
and t.dept_no like '%'||#{departmentPO.deptNo}||'%' and t.departmentCode like '%'||#{departmentPO.departmentCode}||'%'
</if>
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
and t.dept_name like '%'||#{departmentPO.deptName}||'%'
</if> </if>
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' "> <if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
and t.dept_name_short like '%'||#{departmentPO.deptNameShort}||'%' and t.departmentName like '%'||#{departmentPO.departmentName}||'%'
</if> </if>
</sql> </sql>
<sql id="likeSQL" databaseId="sqlserver"> <sql id="likeSQL" databaseId="sqlserver">
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' "> <if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
and t.dept_no like '%'+#{departmentPO.deptNo}+'%' and t.departmentCode like '%'+#{departmentPO.departmentCode}+'%'
</if>
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
and t.dept_name like '%'+#{departmentPO.deptName}+'%'
</if> </if>
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' "> <if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
and t.dept_name_short like '%'+#{departmentPO.deptNameShort}+'%' and t.departmentName like '%'+#{departmentPO.departmentName}+'%'
</if> </if>
</sql> </sql>
<sql id="nullSql">
and ifnull(parent_dept,'0')='0'
</sql>
<sql id="nullSql" databaseId="sqlserver">
and isnull(parent_dept,'0')='0'
</sql>
<sql id="nullSql" databaseId="oracle">
and NVL(parent_dept,'0')='0'
</sql>
</mapper> </mapper>

@ -31,7 +31,7 @@ public interface SystemDataMapper {
RecordInfo getHrmJobTitleByName(@Param("name") String name); RecordInfo getHrmJobTitleByName(@Param("name") String name);
List<Long> getHrmResourceIds(@Param("departmentId") Long departmentId, @Param("jobTitle") String jobTitle); List<Long> getHrmResourceIds(@Param("departmentId") Integer departmentId, @Param("jobTitle") String jobTitle);
List<Long> getHrmResourceIdsByDept(@Param("departmentId") String departmentId); List<Long> getHrmResourceIdsByDept(@Param("departmentId") String departmentId);

@ -96,7 +96,7 @@ public interface JobMapper {
* @param ecDepartment * @param ecDepartment
* @return * @return
*/ */
Integer countRepeatNameByPid(@Param("jobName") String jobName, @Param("id") Long id, @Param("parentJob") Long parentJob, @Param("ecDepartment") Long ecDepartment); Integer countRepeatNameByPid(@Param("jobName") String jobName, @Param("id") Long id, @Param("parentJob") Long parentJob, @Param("ecDepartment") Integer ecDepartment);
/** /**
* *
@ -163,7 +163,7 @@ public interface JobMapper {
* @param parentJob * @param parentJob
* @return * @return
*/ */
Long getIdByNameAndPid(@Param("jobName") String jobName, @Param("parentCompany") Long parentCompany, @Param("parentDepartment") Long parentDepartment, @Param("parentJob") Long parentJob); Long getIdByNameAndPid(@Param("jobName") String jobName, @Param("parentCompany") Integer parentCompany, @Param("parentDepartment") Integer parentDepartment, @Param("parentJob") Long parentJob);
Long getIdByNameAndEcId(@Param("jobName") String jobName, @Param("ecCompany") String ecCompany, @Param("ecDepartment") String ecDepartment); Long getIdByNameAndEcId(@Param("jobName") String jobName, @Param("ecCompany") String ecCompany, @Param("ecDepartment") String ecDepartment);

@ -21,7 +21,7 @@ public interface ResourceMapper {
List<HrmResourcePO> getResourceListByJobId(@Param("jobId") Long jobId); List<HrmResourcePO> getResourceListByJobId(@Param("jobId") Long jobId);
int updateResourceJob(@Param("originalJobId") Long originalJobId, @Param("targetJobId") Long targetJobId, @Param("parentComp") Integer parentComp, @Param("parentDept") Long parentDept, @Param("ecCompany") Integer ecCompany, @Param("ecDepartment") Long ecDepartment); int updateResourceJob(@Param("originalJobId") Long originalJobId, @Param("targetJobId") Long targetJobId, @Param("parentComp") Integer parentComp, @Param("parentDept") Integer parentDept, @Param("ecCompany") Integer ecCompany, @Param("ecDepartment") Integer ecDepartment);
HrmResourcePO getResourceById(@Param("id") String id); HrmResourcePO getResourceById(@Param("id") String id);

@ -8,7 +8,6 @@ import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.util.MenuBtn; import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.page.PageInfo; import com.engine.organization.util.page.PageInfo;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -83,7 +82,7 @@ public interface DepartmentService {
* *
* @param ids * @param ids
*/ */
int deleteByIds(Collection<Long> ids); Map<String, Object> deleteByIds(Map<String, Object> params);
/** /**
* *

@ -263,9 +263,9 @@ public class CompServiceImpl extends Service implements CompService {
String addType = Util.null2String(params.get("addType")); String addType = Util.null2String(params.get("addType"));
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo(); SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
String supsubcomid = ""; String supsubcomid = "";
if (addType.equals("sibling")) { if ("sibling".equals(addType)) {
supsubcomid = subCompanyComInfo.getSupsubcomid(id); supsubcomid = subCompanyComInfo.getSupsubcomid(id);
} else if (addType.equals("child")) { } else if ("child".equals(addType)) {
supsubcomid = id; supsubcomid = id;
} }
if (StringUtils.isNotBlank(addType)) { if (StringUtils.isNotBlank(addType)) {
@ -290,7 +290,7 @@ public class CompServiceImpl extends Service implements CompService {
String groupId = (String) lsGroup.get(tmp); String groupId = (String) lsGroup.get(tmp);
List lsField = hfm.getLsField(groupId); List lsField = hfm.getLsField(groupId);
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)).equals("1"); boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !"1".equals(Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)));
String groupLabel = HrmFieldGroupComInfo.getLabel(groupId); String groupLabel = HrmFieldGroupComInfo.getLabel(groupId);
List<Object> itemList = new ArrayList<>(); List<Object> itemList = new ArrayList<>();
Map<String, Object> groupItem = new HashMap<>(); Map<String, Object> groupItem = new HashMap<>();
@ -301,7 +301,7 @@ public class CompServiceImpl extends Service implements CompService {
String fieldId = (String) lsField.get(j); String fieldId = (String) lsField.get(j);
String fieldName = HrmFieldComInfo.getFieldname(fieldId); String fieldName = HrmFieldComInfo.getFieldname(fieldId);
String isUse = HrmFieldComInfo.getIsused(fieldId); String isUse = HrmFieldComInfo.getIsused(fieldId);
if (!isUse.equals("1")) { if (!"1".equals(isUse)) {
continue; continue;
} }
int tmpViewAttr = viewAttr; int tmpViewAttr = viewAttr;
@ -313,14 +313,14 @@ public class CompServiceImpl extends Service implements CompService {
String fieldValue = ""; String fieldValue = "";
if (StringUtils.isNotBlank(addType)) { if (StringUtils.isNotBlank(addType)) {
} else { } else {
if (HrmFieldComInfo.getIssystem(fieldId).equals("1")) { if ("1".equals(HrmFieldComInfo.getIssystem(fieldId))) {
fieldValue = hfm.getData(fieldName); fieldValue = hfm.getData(fieldName);
} else { } else {
fieldValue = hfm.getData("hrmsubcompanydefined", fieldName); fieldValue = hfm.getData("hrmsubcompanydefined", fieldName);
} }
} }
if (!groupHide && tmpViewAttr == 2 && HrmFieldComInfo.getIsmand(fieldId).equals("1")) { if (!groupHide && tmpViewAttr == 2 && "1".equals(HrmFieldComInfo.getIsmand(fieldId))) {
tmpViewAttr = 3; tmpViewAttr = 3;
if ("1".equals(fieldHtmlType) && "2".equals(type)) { if ("1".equals(fieldHtmlType) && "2".equals(type)) {
rules = "required|integer"; rules = "required|integer";
@ -330,15 +330,16 @@ public class CompServiceImpl extends Service implements CompService {
} }
if ("84".equals(fieldId)) { if ("84".equals(fieldId)) {
if (user.getUID() != 1) if (user.getUID() != 1) {
continue; continue;
fieldValue = fieldValue.equals("0") ? "" : fieldValue;
} }
if (supsubcomid.length() > 0 && fieldName.equals("supsubcomid")) { fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
}
if (supsubcomid.length() > 0 && "supsubcomid".equals(fieldName)) {
fieldValue = supsubcomid; fieldValue = supsubcomid;
} }
if (fieldName.equals("subshowid")) { if ("subshowid".equals(fieldName)) {
if (StringUtils.isNotBlank(addType)) { if (StringUtils.isNotBlank(addType)) {
continue; continue;
} else { } else {
@ -359,20 +360,20 @@ public class CompServiceImpl extends Service implements CompService {
hrmFieldBean.setViewAttr(tmpViewAttr); hrmFieldBean.setViewAttr(tmpViewAttr);
hrmFieldBean.setRules(rules); hrmFieldBean.setRules(rules);
hrmFieldBean.setIssystem("1"); hrmFieldBean.setIssystem("1");
if (hrmFieldBean.getFieldname().equals("supsubcomid")) { if ("supsubcomid".equals(hrmFieldBean.getFieldname())) {
hrmFieldBean.setHideVirtualOrg(true); hrmFieldBean.setHideVirtualOrg(true);
} }
if (hrmFieldBean.getFieldname().equals("subcompanycode")) { if ("subcompanycode".equals(hrmFieldBean.getFieldname())) {
hrmFieldBean.setMultilang(false); hrmFieldBean.setMultilang(false);
} }
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user); SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if (searchConditionItem != null) { if (searchConditionItem != null) {
searchConditionItem.setLabelcol(8); searchConditionItem.setLabelcol(8);
searchConditionItem.setFieldcol(16); searchConditionItem.setFieldcol(16);
if (hrmFieldBean.getFieldname().equals("showorder")) { if ("showorder".equals(hrmFieldBean.getFieldname())) {
searchConditionItem.setPrecision(2); searchConditionItem.setPrecision(2);
} }
if (fieldName.equals("subshowid")) { if ("subshowid".equals(fieldName)) {
Map<String, Object> otherParams = new HashMap<>(); Map<String, Object> otherParams = new HashMap<>();
otherParams.put("hasBorder", true); otherParams.put("hasBorder", true);
searchConditionItem.setOtherParams(otherParams); searchConditionItem.setOtherParams(otherParams);
@ -408,8 +409,8 @@ public class CompServiceImpl extends Service implements CompService {
@Override @Override
public int moveCompany(DepartmentMoveParam moveParam) { public int moveCompany(DepartmentMoveParam moveParam) {
Integer companyId = moveParam.getId().intValue(); Integer companyId = moveParam.getId();
Integer targetCompanyId = moveParam.getCompany().intValue(); Integer targetCompanyId = moveParam.getCompany();
// 判断目标分部是否为它本身以及子元素 // 判断目标分部是否为它本身以及子元素
Set<Integer> disableIds = new HashSet<>(); Set<Integer> disableIds = new HashSet<>();
disableIds.add(companyId); disableIds.add(companyId);

@ -8,10 +8,9 @@ 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.service.impl.OrganizationServiceImpl;
import com.engine.organization.component.OrganizationWeaTable; 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.codesetting.po.CodeRulePO;
import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.company.bo.CompanyBO; import com.engine.organization.entity.company.bo.CompanyBO;
import com.engine.organization.entity.company.po.CompanyPO; import com.engine.organization.entity.company.po.CompanyPO;
import com.engine.organization.entity.department.bo.DepartmentBO; import com.engine.organization.entity.department.bo.DepartmentBO;
@ -35,13 +34,10 @@ import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.extend.ExtDTMapper; import com.engine.organization.mapper.extend.ExtDTMapper;
import com.engine.organization.mapper.extend.ExtMapper; import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper; import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.jclorgmap.JclOrgMapper; import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.service.DepartmentService; import com.engine.organization.service.DepartmentService;
import com.engine.organization.service.ExtService; import com.engine.organization.service.ExtService;
import com.engine.organization.thread.DepartmentTriggerRunnable;
import com.engine.organization.thread.HrmResourceTriggerRunnable;
import com.engine.organization.thread.JobTriggerRunnable; import com.engine.organization.thread.JobTriggerRunnable;
import com.engine.organization.thread.OrganizationSyncEc; import com.engine.organization.thread.OrganizationSyncEc;
import com.engine.organization.util.*; import com.engine.organization.util.*;
@ -99,8 +95,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
*/ */
private static final Long GROUP_ID = 2L; private static final Long GROUP_ID = 2L;
private static final String HRM_DEPARTMENT = "hrmdepartment";
private static DepartmentMapper getDepartmentMapper() { private static DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class); return MapperProxyFactory.getProxy(DepartmentMapper.class);
@ -118,10 +112,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
return MapperProxyFactory.getProxy(ExtendTitleMapper.class); return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
} }
private SystemDataMapper getSystemDataMapper() {
return MapperProxyFactory.getProxy(SystemDataMapper.class);
}
private ExtService getExtService(User user) { private ExtService getExtService(User user) {
return ServiceUtil.getService(ExtServiceImpl.class, user); return ServiceUtil.getService(ExtServiceImpl.class, user);
} }
@ -131,7 +121,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) { public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
//1.查询分部下所有部门 //1.查询分部下所有部门
//PageUtil.start(param.getCurrent(), param.getPageSize()); //PageUtil.start(param.getCurrent(), param.getPageSize());
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).list("show_order"); List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).listAll("showOrder");
PageInfo<DepartmentPO> pageInfo = new PageInfo<>(departmentPOS); PageInfo<DepartmentPO> pageInfo = new PageInfo<>(departmentPOS);
List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS, param.getParentComp()); List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS, param.getParentComp());
PageInfo<SingleDeptTreeVO> pageInfos = new PageInfo<>(singleDeptTreeVOS, SingleDeptTreeVO.class); PageInfo<SingleDeptTreeVO> pageInfos = new PageInfo<>(singleDeptTreeVOS, SingleDeptTreeVO.class);
@ -176,7 +166,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
boolean filter = isFilter(departmentPO); boolean filter = isFilter(departmentPO);
PageInfo<DepartmentListDTO> pageInfos; PageInfo<DepartmentListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams()); String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
List<DepartmentPO> allList = getDepartmentMapper().list(orderSql); List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql);
new DetachUtil(user.getUID()).filterDepartmentList(allList); new DetachUtil(user.getUID()).filterDepartmentList(allList);
// 通过子级遍历父级元素 // 通过子级遍历父级元素
if (filter) { if (filter) {
@ -261,19 +251,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
@Override @Override
public int updateForbiddenTagById(DeptSearchParam params) { public int updateForbiddenTagById(DeptSearchParam params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
DepartmentPO departmentPO = DepartmentPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build(); DepartmentPO departmentPO = DepartmentPO.builder().id(params.getId()).canceled(params.getCanceled() ? 0 : 1).build();
if (!params.getForbiddenTag()) {
// 判断当前岗位下是否有启用岗位,如有启用岗位,部门无法禁用
int countUsedInJob = getDepartmentMapper().countUsedInJob(params.getId());
OrganizationAssert.isTrue(countUsedInJob == 0, "部门存在下级岗位,不能封存");
}
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id", departmentPO.getId()); map.put("id", departmentPO.getId());
map.put("forbiddenTag", departmentPO.getForbiddenTag()); map.put("forbiddenTag", departmentPO.getCanceled());
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync(); new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
return getDepartmentMapper().updateForbiddenTagById(departmentPO); return 1;
} }
@Override @Override
@ -336,20 +319,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
} }
@Override @Override
public int deleteByIds(Collection<Long> ids) { public Map<String, Object> deleteByIds(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
OrganizationAssert.notEmpty(ids, "请选择要删除的数据"); return ServiceUtil.getService(OrganizationServiceImpl.class, user).delDepartment(params, user);
Map<String, Object> map = new HashMap<>();
for (Long id : ids) {
map.put("id", id);
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
// 删除拓展表、明细表
MapperProxyFactory.getProxy(ExtMapper.class).deleteByID("jcl_org_deptext", id);
MapperProxyFactory.getProxy(ExtDTMapper.class).deleteByMainID("jcl_org_deptext_dt1", id, null);
}
return getDepartmentMapper().deleteByIds(ids);
} }
@Override @Override
@ -446,36 +418,36 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
public Map<String, Object> getSaveForm(DeptSearchParam param) { public Map<String, Object> getSaveForm(DeptSearchParam param) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
Map<String, Object> apiDatas = new HashMap<>(); Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>(); //List<SearchConditionGroup> addGroups = new ArrayList<>();
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID, "1"); //List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID, "1");
if (CollectionUtils.isNotEmpty(extendTitles)) { //if (CollectionUtils.isNotEmpty(extendTitles)) {
Map<String, Object> params = new HashMap<>(); // Map<String, Object> params = new HashMap<>();
// 分部 // // 分部
if (StringUtils.isNotBlank(Util.null2String(param.getSubcompanyid1()))) { // if (StringUtils.isNotBlank(Util.null2String(param.getSubcompanyid1()))) {
CompanyPO companyPO = getCompanyMapper().listById(param.getSubcompanyid1()); // CompanyPO companyPO = getCompanyMapper().listById(param.getSubcompanyid1());
if (null != companyPO) { // if (null != companyPO) {
params.put("parent_comp", companyPO.getId()); // params.put("parent_comp", companyPO.getId());
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(companyPO.getId().toString())); // params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(companyPO.getId().toString()));
} // }
} // }
// 部门 // // 部门
if (StringUtils.isNotBlank(Util.null2String(param.getDepartmentid()))) { // if (StringUtils.isNotBlank(Util.null2String(param.getDepartmentid()))) {
DepartmentPO deptById = getDepartmentMapper().getDeptById(param.getDepartmentid()); // DepartmentPO deptById = getDepartmentMapper().getDeptById(param.getDepartmentid());
if (null != deptById) { // if (null != deptById) {
params.put("parent_dept", deptById.getId()); // params.put("parent_dept", deptById.getId());
params.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString())); // params.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString()));
params.put("parent_comp", deptById.getParentComp()); // params.put("parent_comp", deptById.getParentComp());
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(deptById.getParentComp().toString())); // params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(deptById.getParentComp().toString()));
} // }
} // }
for (ExtendTitlePO extendTitle : extendTitles) { // for (ExtendTitlePO extendTitle : extendTitles) {
List<SearchConditionItem> items = getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_DEPT, 2, extendTitle.getId().toString(), "dept_no", RuleCodeType.DEPARTMENT.getValue(), params); // List<SearchConditionItem> items = getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_DEPT, 2, extendTitle.getId().toString(), "dept_no", RuleCodeType.DEPARTMENT.getValue(), params);
if (CollectionUtils.isNotEmpty(items)) { // if (CollectionUtils.isNotEmpty(items)) {
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items)); // addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
} // }
} // }
} //}
apiDatas.put("condition", addGroups); //apiDatas.put("condition", addGroups);
return apiDatas; return apiDatas;
} }
@ -517,45 +489,34 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
OrganizationAssert.notBlank(copyParam.getCompany(), "请指定需要复制的公司/分部"); OrganizationAssert.notBlank(copyParam.getCompany(), "请指定需要复制的公司/分部");
int insertCount = 0; int insertCount = 0;
// 需复制的部门 // 需复制的部门
List<Long> idList = Arrays.stream(copyParam.getIds().split(",")).map(Long::parseLong).collect(Collectors.toList()); List<Integer> idList = Arrays.stream(copyParam.getIds().split(",")).map(Integer::parseInt).collect(Collectors.toList());
Integer maxShowOrder = getDepartmentMapper().getMaxShowOrder(); Double maxShowOrder = getDepartmentMapper().getMaxShowOrder();
maxShowOrder = null == maxShowOrder ? 0 : maxShowOrder; maxShowOrder = null == maxShowOrder ? 0 : maxShowOrder;
for (Long departmentId : idList) { for (Integer departmentId : idList) {
// 复制当前部门 // 复制当前部门
recursionCopyDept(departmentId, null, Integer.parseInt(copyParam.getCompany()), maxShowOrder, copyParam.getCopyJob(), copyParam.getCopySubDept(), copyParam.getCopySubJob()); recursionCopyDept(departmentId, null, Integer.parseInt(copyParam.getCompany()), maxShowOrder, copyParam.getCopyJob(), copyParam.getCopySubDept(), copyParam.getCopySubJob());
} }
return insertCount; return insertCount;
} }
private void recursionCopyDept(Long originalDeptId, Long parentDepartmentId, Integer companyId, Integer maxShowOrder, String copyJob, String copySubDept, String copySubJob) { private void recursionCopyDept(Integer originalDeptId, Integer parentDepartmentId, Integer companyId, Double maxShowOrder, String copyJob, String copySubDept, String copySubJob) {
// 源部门 // 源部门
DepartmentPO deptById = getDepartmentMapper().getDeptById(originalDeptId); DepartmentPO deptById = getDepartmentMapper().getDeptById(originalDeptId);
long timeMillis = System.currentTimeMillis(); long timeMillis = System.currentTimeMillis();
// 处理自动编号 // 处理自动编号
deptById.setDeptNo(CodeRuleUtil.generateCode(RuleCodeType.DEPARTMENT, deptById.getDeptNo(), timeMillis)); deptById.setDepartmentCode(null);
// 设置上级分部 // 设置上级分部
deptById.setParentComp(companyId); deptById.setSubCompanyId1(companyId);
deptById.setEcCompany(companyId); deptById.setSupDepId(parentDepartmentId);
deptById.setParentDept(parentDepartmentId);
if (null != parentDepartmentId) {
deptById.setEcDepartment(Long.parseLong(EcHrmRelationUtil.getEcDepartmentId(Util.null2String(parentDepartmentId))));
}
// 显示顺序字段 // 显示顺序字段
deptById.setShowOrder(++maxShowOrder); deptById.setShowOrder(++maxShowOrder);
deptById.setCreator((long) user.getUID());
deptById.setCreateTime(new Date());
deptById.setDeptPrincipal(null);
// 新增EC表部门 // 新增EC表部门
Map<String, Object> syncMap = addEcDepartment(deptById); Map<String, Object> syncMap = addEcDepartment(deptById);
String ecDepartmentID = Util.null2String(syncMap.get("id")); String ecDepartmentID = Util.null2String(syncMap.get("id"));
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecDepartmentID), syncMap.get("message").toString()); OrganizationAssert.isTrue(StringUtils.isNotBlank(ecDepartmentID), syncMap.get("message").toString());
// 查询UUID
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_DEPARTMENT, ecDepartmentID);
deptById.setUuid(recordInfo.getUuid());
getDepartmentMapper().insertIgnoreNull(deptById);
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(deptById.getId()).run(); //TODO new DepartmentTriggerRunnable(deptById.getId()).run();
// 复制当前部门岗位信息 // 复制当前部门岗位信息
if ("1".equals(copyJob)) { if ("1".equals(copyJob)) {
@ -598,11 +559,11 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
public int mergeDepartment(DepartmentMergeParam mergeParam) { public int mergeDepartment(DepartmentMergeParam mergeParam) {
HasRightUtil.hasRight(user, RIGHT_NAME, false); HasRightUtil.hasRight(user, RIGHT_NAME, false);
// 被合并部门 // 被合并部门
Long ecParamDepartment = mergeParam.getDepartment(); Integer ecParamDepartment = mergeParam.getDepartment();
DepartmentPO targetDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecParamDepartment)); DepartmentPO targetDepartment = getDepartmentMapper().getDeptById(ecParamDepartment);
// map表中合并部门parentID // map表中合并部门parentID
Long oldParamDepartment = mergeParam.getId(); Integer oldParamDepartment = mergeParam.getId();
DepartmentPO oldDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(oldParamDepartment)); DepartmentPO oldDepartment = getDepartmentMapper().getDeptById(oldParamDepartment);
Integer oldFParentId = null; Integer oldFParentId = null;
if (null != oldDepartment) { if (null != oldDepartment) {
java.sql.Date currentDate = new java.sql.Date(OrganizationDateUtil.stringToDate(OrganizationDateUtil.getFormatLocalDate(new Date())).getTime()); java.sql.Date currentDate = new java.sql.Date(OrganizationDateUtil.stringToDate(OrganizationDateUtil.getFormatLocalDate(new Date())).getTime());
@ -619,7 +580,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
OrganizationAssert.notBlank(mergeParam.getMergeName(), "请输入合并后的名称"); OrganizationAssert.notBlank(mergeParam.getMergeName(), "请输入合并后的名称");
// 不可选择合并的数据,本身及子部门 // 不可选择合并的数据,本身及子部门
Set<Long> disableIds = new HashSet<>(); Set<Integer> disableIds = new HashSet<>();
// 添加选择部门本身 // 添加选择部门本身
disableIds.add(mergeParam.getId()); disableIds.add(mergeParam.getId());
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(mergeParam.getId()); List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(mergeParam.getId());
@ -632,40 +593,37 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
List<DepartmentPO> firstChildDeptList = getDepartmentMapper().getDeptListByPId(mergeParam.getId()); List<DepartmentPO> firstChildDeptList = getDepartmentMapper().getDeptListByPId(mergeParam.getId());
// 更新所属部门、所属分部 // 更新所属部门、所属分部
for (DepartmentPO departmentPO : firstChildDeptList) { for (DepartmentPO departmentPO : firstChildDeptList) {
departmentPO.setParentDept(targetDepartment.getId()); departmentPO.setSupDepId(targetDepartment.getId());
departmentPO.setEcDepartment(ecParamDepartment); departmentPO.setSubCompanyId1(targetDepartment.getSubCompanyId1());
departmentPO.setParentComp(targetDepartment.getParentComp());
departmentPO.setEcCompany(targetDepartment.getEcCompany());
updateEcDepartment(departmentPO); updateEcDepartment(departmentPO);
getDepartmentMapper().updateBaseDept(departmentPO);
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(departmentPO.getId()).run(); //TODO new DepartmentTriggerRunnable(departmentPO.getId()).run();
} }
// 查询该部门一级岗位、更新岗位所属分部、所属部门 // 查询该部门一级岗位、更新岗位所属分部、所属部门
List<JobPO> firstChildJobList = getJobMapper().listJobsByDepartmentId(mergeParam.getId()); List<JobPO> firstChildJobList = getJobMapper().listJobsByDepartmentId(mergeParam.getId());
firstChildJobList = firstChildJobList.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList()); firstChildJobList = firstChildJobList.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
// 批量更新部门、所属分部 // 批量更新部门、所属分部
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String targetEcDeptId = EcHrmRelationUtil.getEcDepartmentId(targetDepartment.getId().toString()); String targetEcDeptId = targetDepartment.getId().toString();
String mergeEcDeptId = EcHrmRelationUtil.getEcDepartmentId(mergeParam.getId().toString()); String mergeEcDeptId = mergeParam.getId().toString();
rs.executeUpdate("update jcl_org_job set parent_comp =?,ec_company =?,parent_dept =?,ec_department =? where parent_dept =?", targetDepartment.getParentComp(), targetDepartment.getEcCompany(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId()); rs.executeUpdate("update jcl_org_job set parent_comp =?,ec_company =?,parent_dept =?,ec_department =? where ec_department =?", targetDepartment.getSubCompanyId1(), targetDepartment.getSubCompanyId1(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId());
// 更新岗位组织架构图 // 更新岗位组织架构图
for (JobPO jobPO : firstChildJobList) { for (JobPO jobPO : firstChildJobList) {
// 刷新组织架构图 // 刷新组织架构图
new JobTriggerRunnable(jobPO.getId()).run(); new JobTriggerRunnable(jobPO.getId()).run();
} }
// 更新当前部门下的人员 // 更新当前部门下的人员
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(mergeParam.getId().toString()); rs.executeUpdate("update hrmresource set SUBCOMPANYID1 =?,DEPARTMENTID =? where DEPARTMENTID =?", targetDepartment.getSubCompanyId1(), targetEcDeptId, mergeEcDeptId);
rs.executeUpdate("update hrmresource set SUBCOMPANYID1 =?,DEPARTMENTID =? where DEPARTMENTID =?", targetDepartment.getEcCompany(), targetEcDeptId, mergeEcDeptId); //new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? ,department_id = ?, ec_department = ?where department_id =?", targetDepartment.getParentComp(), targetDepartment.getEcCompany(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId());
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? ,department_id = ?, ec_department = ?where department_id =?", targetDepartment.getParentComp(), targetDepartment.getEcCompany(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId()); //List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(mergeParam.getId().toString());
// 更新人员组织架构图 //// 更新人员组织架构图
for (Long hrmResourceId : hrmResourceIds) { //for (Long hrmResourceId : hrmResourceIds) {
new HrmResourceTriggerRunnable(hrmResourceId).run(); //TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
} //}
// 更新子部门下岗位的所属分部 // 更新子部门下岗位的所属分部
for (DepartmentPO departmentPO : firstChildDeptList) { for (DepartmentPO departmentPO : firstChildDeptList) {
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(departmentPO.getId()); List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
forbiddenChildTag(targetDepartment.getParentComp(), Util.null2String(targetDepartment.getEcCompany()), deptList); forbiddenChildTag(targetDepartment.getSubCompanyId1(), Util.null2String(targetDepartment.getSubCompanyId1()), deptList);
} }
// 原部门删除 // 原部门删除
DepartmentPO mergeDepartment = getDepartmentMapper().getDeptById(mergeParam.getId()); DepartmentPO mergeDepartment = getDepartmentMapper().getDeptById(mergeParam.getId());
@ -675,16 +633,15 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 删除拓展表、明细表 // 删除拓展表、明细表
MapperProxyFactory.getProxy(ExtMapper.class).deleteByID("jcl_org_deptext", mergeParam.getId()); MapperProxyFactory.getProxy(ExtMapper.class).deleteByID("jcl_org_deptext", mergeParam.getId());
MapperProxyFactory.getProxy(ExtDTMapper.class).deleteByMainID("jcl_org_deptext_dt1", mergeParam.getId(), null); MapperProxyFactory.getProxy(ExtDTMapper.class).deleteByMainID("jcl_org_deptext_dt1", mergeParam.getId(), null);
getDepartmentMapper().deleteByIds(DeleteParam.builder().ids(mergeParam.getId().toString()).build().getIds()); // TODO 删除 getDepartmentMapper().deleteByIds(DeleteParam.builder().ids(mergeParam.getId().toString()).build().getIds());
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(mergeDepartment).run(); // TODO new DepartmentTriggerRunnable(mergeDepartment).run();
// 更新部门合并后名称 // 更新部门合并后名称
targetDepartment.setDeptName(mergeParam.getMergeName()); targetDepartment.setDepartmentName(mergeParam.getMergeName());
targetDepartment.setDeptNameShort(mergeParam.getMergeName()); targetDepartment.setDepartmentMark(mergeParam.getMergeName());
updateEcDepartment(targetDepartment); updateEcDepartment(targetDepartment);
getDepartmentMapper().updateBaseDept(targetDepartment);
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(oldFParentId, targetDepartment.getId()).run(); // TODO new DepartmentTriggerRunnable(oldFParentId, targetDepartment.getId()).run();
return 0; return 0;
} }
@ -721,53 +678,44 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
if ("0".equals(moveParam.getMoveType())) { if ("0".equals(moveParam.getMoveType())) {
Integer company = moveParam.getCompany(); Integer company = moveParam.getCompany();
OrganizationAssert.notNull(company, "请选择要转移到的分部"); OrganizationAssert.notNull(company, "请选择要转移到的分部");
deptById.setEcCompany(company); deptById.setSubCompanyId1(company);
deptById.setParentComp(company); deptById.setSupDepId(null);
deptById.setParentDept(null);
deptById.setEcDepartment(null);
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(company.toString(), deptById).run(); //TODO new DepartmentTriggerRunnable(company.toString(), deptById).run();
} else if ("1".equals(moveParam.getMoveType())) { } else if ("1".equals(moveParam.getMoveType())) {
Long department = moveParam.getDepartment(); Integer departmentId = moveParam.getDepartment();
Long departmentId = Objects.requireNonNull(EcHrmRelationUtil.getJclDepartmentId(Util.null2String(department))).getId();
OrganizationAssert.notNull(departmentId, "请选择要转移到的部门"); OrganizationAssert.notNull(departmentId, "请选择要转移到的部门");
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(moveParam.getId()); List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(moveParam.getId());
Set<Long> disableIds = new HashSet<>(); Set<Integer> disableIds = new HashSet<>();
disableIds.add(moveParam.getId()); disableIds.add(moveParam.getId());
if (CollectionUtils.isNotEmpty(deptListByPId)) { if (CollectionUtils.isNotEmpty(deptListByPId)) {
addDisableIds(disableIds, deptListByPId); addDisableIds(disableIds, deptListByPId);
} }
OrganizationAssert.isFalse(disableIds.contains(departmentId), "请勿选择当前部门本身及其子部门"); OrganizationAssert.isFalse(disableIds.contains(departmentId), "请勿选择当前部门本身及其子部门");
deptById.setParentDept(departmentId); deptById.setSupDepId(departmentId);
deptById.setEcDepartment(department);
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(departmentId); DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(departmentId);
deptById.setParentComp(parentDepartment.getParentComp()); deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
deptById.setEcCompany(parentDepartment.getEcCompany());
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(Integer.toString(100000000 + department.intValue()), deptById).run(); // TODO new DepartmentTriggerRunnable(Integer.toString(100000000 + department.intValue()), deptById).run();
} }
// 更新EC部门 // 更新EC部门
updateEcDepartment(deptById); updateEcDepartment(deptById);
int updateBaseDept = getDepartmentMapper().updateBaseDept(deptById);
// 刷新岗位分部 // 刷新岗位分部
refreshJobComp(deptById.getId(), deptById.getParentComp()); refreshJobComp(deptById.getId(), deptById.getSubCompanyId1());
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(deptById.getId()); List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(deptById.getId());
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(Util.null2String(deptById.getParentComp()));
// 更新当前部门下的人员 // 更新当前部门下的人员
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString()); new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", deptById.getSubCompanyId1(), deptById.getId());
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString()); //// 更新人员组织架构图
new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId); //List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(deptById.getId().toString());
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", deptById.getParentComp(), ecCompanyId, deptById.getId()); //for (Long hrmResourceId : hrmResourceIds) {
// 更新人员组织架构图 //TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
for (Long hrmResourceId : hrmResourceIds) { //}
new HrmResourceTriggerRunnable(hrmResourceId).run(); forbiddenChildTag(deptById.getSubCompanyId1(), Util.null2String(deptById.getSubCompanyId1()), deptList);
}
forbiddenChildTag(deptById.getParentComp(), ecCompanyId, deptList);
// 递归更新下级部门、岗位 // 递归更新下级部门、岗位
return updateBaseDept; return 1;
} }
/** /**
@ -779,25 +727,23 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
void forbiddenChildTag(Integer parentComp, String ecCompanyId, List<DepartmentPO> deptList) { void forbiddenChildTag(Integer parentComp, String ecCompanyId, List<DepartmentPO> deptList) {
if (CollectionUtils.isNotEmpty(deptList)) { if (CollectionUtils.isNotEmpty(deptList)) {
for (DepartmentPO departmentPO : deptList) { for (DepartmentPO departmentPO : deptList) {
departmentPO.setParentComp(parentComp); departmentPO.setSubCompanyId1(parentComp);
departmentPO.setEcCompany(Integer.parseInt(ecCompanyId));
// 更新EC表部门 // 更新EC表部门
updateEcDepartment(departmentPO); updateEcDepartment(departmentPO);
getDepartmentMapper().updateBaseDept(departmentPO);
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(departmentPO.getId()).run(); // TODO new DepartmentTriggerRunnable(departmentPO.getId()).run();
// 刷新岗位所属分部 // 刷新岗位所属分部
refreshJobComp(departmentPO.getId(), parentComp); refreshJobComp(departmentPO.getId(), parentComp);
// 更新当前部门下的人员 // 更新当前部门下的人员
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(departmentPO.getId().toString());
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(departmentPO.getId().toString()); String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(departmentPO.getId().toString());
new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId); new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId);
new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", parentComp, ecCompanyId, departmentPO.getId()); new RecordSet().executeUpdate("update jcl_org_hrmresource set company_id =? ,ec_company = ? where department_id =?", parentComp, ecCompanyId, departmentPO.getId());
// 更新人员组织架构图 //List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(departmentPO.getId().toString());
for (Long hrmResourceId : hrmResourceIds) { //// 更新人员组织架构图
new HrmResourceTriggerRunnable(hrmResourceId).run(); //for (Long hrmResourceId : hrmResourceIds) {
} //TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
//}
List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId()); List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
forbiddenChildTag(parentComp, ecCompanyId, childList); forbiddenChildTag(parentComp, ecCompanyId, childList);
} }
@ -811,16 +757,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
* @return * @return
*/ */
private boolean isFilter(DepartmentPO departmentPO) { private boolean isFilter(DepartmentPO departmentPO) {
return !(StringUtil.isEmpty(departmentPO.getDeptNo()) return !(StringUtil.isEmpty(departmentPO.getDepartmentCode())
&& StringUtil.isEmpty(departmentPO.getDeptName()) && StringUtil.isEmpty(departmentPO.getDepartmentName())
&& StringUtil.isEmpty(departmentPO.getDeptNameShort()) && null == departmentPO.getSubCompanyId1()
&& null == departmentPO.getEcCompany() && null == departmentPO.getSupDepId());
&& null == departmentPO.getEcDepartment()
&& null == departmentPO.getParentComp()
&& null == departmentPO.getParentDept()
&& null == departmentPO.getDeptPrincipal()
&& null == departmentPO.getShowOrder()
&& null == departmentPO.getForbiddenTag());
} }
@ -904,7 +844,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
* @param parentDeptId * @param parentDeptId
* @param orderNum * @param orderNum
*/ */
private void recursionCopyJob(List<JobPO> jobPOS, Integer parentCompId, Long parentDeptId, Long currentParentJobId, int orderNum, long timeMillis) { private void recursionCopyJob(List<JobPO> jobPOS, Integer parentCompId, Integer parentDeptId, Long currentParentJobId, int orderNum, long timeMillis) {
for (JobPO jobPO : jobPOS) { for (JobPO jobPO : jobPOS) {
orderNum++; orderNum++;
@ -916,10 +856,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 所属部门赋值 // 所属部门赋值
jobPO.setParentDept(parentDeptId); jobPO.setParentDept(parentDeptId);
String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(parentDeptId.toString()); jobPO.setEcDepartment(parentDeptId);
if (StringUtils.isNotBlank(ecDepartmentId)) {
jobPO.setEcDepartment(Long.parseLong(ecDepartmentId));
}
// 所属分部赋值 // 所属分部赋值
jobPO.setEcCompany(parentCompId); jobPO.setEcCompany(parentCompId);
jobPO.setParentComp(parentCompId); jobPO.setParentComp(parentCompId);
@ -947,13 +885,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
*/ */
private void updateEcDepartment(DepartmentPO departmentPO) { private void updateEcDepartment(DepartmentPO departmentPO) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("dept_name_short", departmentPO.getDeptNameShort()); map.put("departmentmark", departmentPO.getDepartmentMark());
map.put("dept_name", departmentPO.getDeptName()); map.put("departmentname", departmentPO.getDepartmentName());
map.put("parent_comp", departmentPO.getParentComp()); map.put("subcompanyid1", departmentPO.getSubCompanyId1());
map.put("parent_dept", departmentPO.getParentDept()); map.put("supdepid", departmentPO.getSupDepId());
map.put("show_order", departmentPO.getShowOrder()); map.put("showorder", departmentPO.getShowOrder());
map.put("dept_no", departmentPO.getDeptNo()); map.put("departmentcode", departmentPO.getDepartmentCode());
map.put("dept_principal", departmentPO.getDeptPrincipal()); map.put("coadjutant", departmentPO.getCoadjutant());
map.put("id", departmentPO.getId()); map.put("id", departmentPO.getId());
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map).sync(); new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map).sync();
} }
@ -966,14 +904,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
*/ */
private Map<String, Object> addEcDepartment(DepartmentPO departmentPO) { private Map<String, Object> addEcDepartment(DepartmentPO departmentPO) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("dept_name_short", departmentPO.getDeptNameShort()); map.put("departmentmark", departmentPO.getDepartmentMark());
map.put("dept_name", departmentPO.getDeptName()); map.put("departmentname", departmentPO.getDepartmentName());
map.put("parent_comp", departmentPO.getParentComp()); map.put("subcompanyid1", departmentPO.getSubCompanyId1());
map.put("parent_dept", departmentPO.getParentDept()); map.put("supdepid", departmentPO.getSupDepId());
map.put("show_order", departmentPO.getShowOrder()); map.put("showorder", departmentPO.getShowOrder());
map.put("dept_no", departmentPO.getDeptNo()); map.put("departmentcode", departmentPO.getDepartmentCode());
map.put("dept_principal", departmentPO.getDeptPrincipal());
map.put("id", departmentPO.getId());
return new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, map).sync(); return new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, map).sync();
} }
@ -989,7 +925,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync(); new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
} }
private void addDisableIds(Set<Long> disableIds, List<DepartmentPO> deptListByPId) { private void addDisableIds(Set<Integer> disableIds, List<DepartmentPO> deptListByPId) {
for (DepartmentPO departmentPO : deptListByPId) { for (DepartmentPO departmentPO : deptListByPId) {
disableIds.add(departmentPO.getId()); disableIds.add(departmentPO.getId());
List<DepartmentPO> childDeptPOS = getDepartmentMapper().getDeptListByPId(departmentPO.getId()); List<DepartmentPO> childDeptPOS = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
@ -1003,7 +939,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
* @param parentDepartment * @param parentDepartment
* @param parentComp * @param parentComp
*/ */
private void refreshJobComp(Long parentDepartment, Integer parentComp) { private void refreshJobComp(Integer parentDepartment, Integer parentComp) {
List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment); List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment);
jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList()); jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(jobPOS)) { if (CollectionUtils.isNotEmpty(jobPOS)) {

@ -337,7 +337,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
fieldTypeObj.add(tmp); fieldTypeObj.add(tmp);
fieldType = SystemEnv.getHtmlLabelName(695, user.getLanguage()); fieldType = SystemEnv.getHtmlLabelName(695, user.getLanguage());
fieldType += " " + SystemEnv.getHtmlLabelName(Util.getIntValue(BrowserComInfo.getBrowserlabelid(browserType), 0), user.getLanguage()); fieldType += " " + SystemEnv.getHtmlLabelName(Util.getIntValue(BrowserComInfo.getBrowserlabelid(browserType), 0), user.getLanguage());
if (browserType.equals("161") || browserType.equals("162") || browserType.equals("256") || browserType.equals("257")) { if ("161".equals(browserType) || "162".equals(browserType) || "256".equals(browserType) || "257".equals(browserType)) {
tmp = new HashMap<>(); tmp = new HashMap<>();
tmp.put("value", SelectOptionParam.getCustomBrowserId(customValue)); tmp.put("value", SelectOptionParam.getCustomBrowserId(customValue));
tmp.put("valueSpan", SelectOptionParam.getCustomBrowserValueSpan(customValue)); tmp.put("valueSpan", SelectOptionParam.getCustomBrowserValueSpan(customValue));
@ -448,7 +448,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
lsComDetialInfo = new ArrayList<>(); lsComDetialInfo = new ArrayList<>();
comDetialInfo = new HashMap<>(); comDetialInfo = new HashMap<>();
comDetialInfo.put("label", ""); comDetialInfo.put("label", "");
comDetialInfo.put("type", fieldHtmlType.equals("5") ? "CUSTOMFIELD" : "TEXT"); comDetialInfo.put("type", "5".equals(fieldHtmlType) ? "CUSTOMFIELD" : "TEXT");
comDetialInfo.put("width", "60%"); comDetialInfo.put("width", "60%");
comDetialInfo.put("key", "fieldType"); comDetialInfo.put("key", "fieldType");
lsComDetialInfo.add(comDetialInfo); lsComDetialInfo.add(comDetialInfo);
@ -462,7 +462,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
fieldTypeInfo.add("select"); fieldTypeInfo.add("select");
Map<String, Object> fieldTypeParamInfo = new HashMap<>(); Map<String, Object> fieldTypeParamInfo = new HashMap<>();
if (fieldHtmlType.equals("5")) { if ("5".equals(fieldHtmlType)) {
fieldTypeParamInfo.put("datas", SelectOptionParam.getSelectFields(customValue)); fieldTypeParamInfo.put("datas", SelectOptionParam.getSelectFields(customValue));
fieldTypeParamInfo.put("sort", "horizontal"); fieldTypeParamInfo.put("sort", "horizontal");

@ -542,14 +542,14 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
// 通过分部、公司 组装数据 // 通过分部、公司 组装数据
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) { if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id); Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).build(); DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(parentCompId).build();
CompanyPO compBuild = CompanyPO.builder().subCompanyName(keyword).supSubComId(parentCompId.intValue()).build(); CompanyPO compBuild = CompanyPO.builder().subCompanyName(keyword).supSubComId(parentCompId).build();
// 所属分部下的岗位 // 所属分部下的岗位
JobPO jobBuild = JobPO.builder().jobName(keyword).parentComp(parentCompId).build(); JobPO jobBuild = JobPO.builder().jobName(keyword).parentComp(parentCompId).build();
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild); searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild);
} else if (TYPE_DEPT.equals(type)) { } else if (TYPE_DEPT.equals(type)) {
Long parentDeptId = Long.parseLong(id); Integer parentDeptId = Integer.parseInt(id);
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentDept(parentDeptId).build(); DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).supDepId(parentDeptId).build();
// 所属分部下的岗位 // 所属分部下的岗位
JobPO jobBuild = JobPO.builder().jobName(keyword).parentDept(parentDeptId).build(); JobPO jobBuild = JobPO.builder().jobName(keyword).parentDept(parentDeptId).build();
searchTree = buildTreeByDeptAndJob(departmentBuild, jobBuild); searchTree = buildTreeByDeptAndJob(departmentBuild, jobBuild);
@ -689,10 +689,10 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
*/ */
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) { private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
builderDeparts.add(departmentPO); builderDeparts.add(departmentPO);
if (SearchTreeUtil.isTop(departmentPO.getParentDept())) { if (SearchTreeUtil.isTop(departmentPO.getSupDepId())) {
return; return;
} }
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getParentDept()); DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getSupDepId());
if (null != parentDept) { if (null != parentDept) {
buildParentDepts(parentDept, builderDeparts); buildParentDepts(parentDept, builderDeparts);
} }

@ -662,7 +662,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null; Integer parentCompanyId = null;
String companyName = ""; String companyName = "";
historyDetailPO.setRowNums(String.valueOf(i + 1)); historyDetailPO.setRowNums(String.valueOf(i + 1));
@ -715,7 +715,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
continue nextRow; continue nextRow;
} }
for (int index = 0; index < split.length - 1; index++) { for (int index = 0; index < split.length - 1; index++) {
parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(split[index], parentCompanyId == null ? 0 : parentCompanyId.intValue()); parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(split[index], parentCompanyId == null ? 0 : parentCompanyId);
if (null == parentCompanyId) { if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(split[index] + "分部未找到对应数据"); historyDetailPO.setOperateDetail(split[index] + "分部未找到对应数据");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
@ -745,7 +745,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
continue; continue;
} }
String compNo = (String) map.get("comp_no"); String compNo = (String) map.get("comp_no");
Long companyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(companyName, parentCompanyId == null ? 0 : parentCompanyId.intValue()); Integer companyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(companyName, parentCompanyId == null ? 0 : parentCompanyId);
if ("add".equals(operateType)) { if ("add".equals(operateType)) {
if (companyId != null) { if (companyId != null) {
historyDetailPO.setOperateDetail("数据已存在"); historyDetailPO.setOperateDetail("数据已存在");
@ -805,13 +805,13 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue; continue;
} }
if (checkRepeatNo(compNo, COMPANY_TYPE, companyId)) { if (checkRepeatNo(compNo, COMPANY_TYPE, Long.valueOf(companyId))) {
map.put("update_time", new Date()); map.put("update_time", new Date());
map.put("id", companyId); map.put("id", companyId);
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map, false).sync(); Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map, false).sync();
if (isThrowError(syncMap)) { if (isThrowError(syncMap)) {
map.remove("id"); map.remove("id");
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(companyId).tableName("JCL_ORG_COMP").params(map).build()); MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(Long.valueOf(companyId)).tableName("JCL_ORG_COMP").params(map).build());
// 刷新组织架构图 // 刷新组织架构图
//TODO new CompanyTriggerRunnable(companyId).run(); //TODO new CompanyTriggerRunnable(companyId).run();
historyDetailPO.setOperateDetail("更新成功"); historyDetailPO.setOperateDetail("更新成功");
@ -870,8 +870,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null; Integer parentCompanyId = null;
Long parentDepartmentId = null; Integer parentDepartmentId = null;
String departmentName = ""; String departmentName = "";
historyDetailPO.setRowNums(String.valueOf(i + 1)); historyDetailPO.setRowNums(String.valueOf(i + 1));
@ -924,7 +924,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
continue nextRow; continue nextRow;
} }
for (String s : split) { for (String s : split) {
parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId.intValue()); parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
if (null == parentCompanyId) { if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据"); historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
@ -983,7 +983,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
continue; continue;
} }
String deptNo = (String) map.get("dept_no"); String deptNo = (String) map.get("dept_no");
Long departmentId = MapperProxyFactory.getProxy(DepartmentMapper.class).getIdByNameAndPid(departmentName, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId); Integer departmentId = MapperProxyFactory.getProxy(DepartmentMapper.class).getIdByNameAndPid(departmentName, parentCompanyId, parentDepartmentId == null ? 0 : parentDepartmentId);
if ("add".equals(operateType)) { if ("add".equals(operateType)) {
if (departmentId != null) { if (departmentId != null) {
historyDetailPO.setOperateDetail("数据已存在"); historyDetailPO.setOperateDetail("数据已存在");
@ -1010,9 +1010,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
String showOrder = Util.null2String(map.get("show_order")); String showOrder = Util.null2String(map.get("show_order"));
if (StringUtils.isBlank(showOrder)) { if (StringUtils.isBlank(showOrder)) {
Integer maxShowOrder = MapperProxyFactory.getProxy(DepartmentMapper.class).getMaxShowOrder(); Double maxShowOrder = MapperProxyFactory.getProxy(DepartmentMapper.class).getMaxShowOrder();
if (null == maxShowOrder) { if (null == maxShowOrder) {
maxShowOrder = 0; maxShowOrder = 0D;
} }
map.put("show_order", maxShowOrder + 1); map.put("show_order", maxShowOrder + 1);
} }
@ -1025,7 +1025,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_DEPT").params(map).build(); ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName("JCL_ORG_DEPT").params(map).build();
MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams); MapperProxyFactory.getProxy(ExtMapper.class).insertTable(infoParams);
// 刷新组织架构图 // 刷新组织架构图
new DepartmentTriggerRunnable(infoParams.getId()).run(); //TODO new DepartmentTriggerRunnable(infoParams.getId()).run();
map.put("id", infoParams.getId()); map.put("id", infoParams.getId());
historyDetailPO.setOperateDetail("添加成功"); historyDetailPO.setOperateDetail("添加成功");
historyDetailPO.setStatus("1"); historyDetailPO.setStatus("1");
@ -1043,15 +1043,15 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue; continue;
} }
if (checkRepeatNo(deptNo, DEPARTMENT_TYPE, departmentId)) { if (checkRepeatNo(deptNo, DEPARTMENT_TYPE, Long.valueOf(departmentId))) {
map.put("update_time", new Date()); map.put("update_time", new Date());
map.put("id", departmentId); map.put("id", departmentId);
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map, false).sync(); Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map, false).sync();
if (isThrowError(syncMap)) { if (isThrowError(syncMap)) {
map.remove("id"); map.remove("id");
MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(departmentId).tableName("JCL_ORG_DEPT").params(map).build()); MapperProxyFactory.getProxy(ExtMapper.class).updateTable(ExtendInfoParams.builder().id(Long.valueOf(departmentId)).tableName("JCL_ORG_DEPT").params(map).build());
// 刷新组织架构图 // 刷新组织架构图
new DepartmentTriggerRunnable(departmentId).run(); //TODO new DepartmentTriggerRunnable(departmentId).run();
historyDetailPO.setOperateDetail("更新成功"); historyDetailPO.setOperateDetail("更新成功");
historyDetailPO.setStatus("1"); historyDetailPO.setStatus("1");
} else { } else {
@ -1107,8 +1107,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null; Integer parentCompanyId = null;
Long parentDepartmentId = null; Integer parentDepartmentId = null;
Long parentJobId = null; Long parentJobId = null;
String jobName = ""; String jobName = "";
@ -1162,7 +1162,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
continue nextRow; continue nextRow;
} }
for (String s : split) { for (String s : split) {
parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId.intValue()); parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
if (null == parentCompanyId) { if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据"); historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
@ -1372,8 +1372,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
} }
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null; Integer parentCompanyId = null;
Long parentDepartmentId = null; Integer parentDepartmentId = null;
Long parentJobId = null; Long parentJobId = null;
historyDetailPO.setRowNums(String.valueOf(i + 1)); historyDetailPO.setRowNums(String.valueOf(i + 1));
@ -1426,7 +1426,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
continue nextRow; continue nextRow;
} }
for (String s : split) { for (String s : split) {
parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId.intValue()); parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
if (null == parentCompanyId) { if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据"); historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
@ -1517,7 +1517,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setRelatedName(keyFieldValue); historyDetailPO.setRelatedName(keyFieldValue);
// 判断当前人员是否存在 // 判断当前人员是否存在
boolean hasSameKeyFieldValue = hasSameKeyFieldValue(historyDetailPO, keyField, keyFieldValue); boolean hasSameKeyFieldValue = hasSameKeyFieldValue(historyDetailPO, keyField, keyFieldValue);
;
if (hasSameKeyFieldValue) { if (hasSameKeyFieldValue) {
continue; continue;
} }
@ -1630,7 +1629,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
XSSFSheet sheetAt = workbook.getSheetAt(s); XSSFSheet sheetAt = workbook.getSheetAt(s);
int lastRow = sheetAt.getLastRowNum(); int lastRow = sheetAt.getLastRowNum();
allRow = allRow + lastRow; allRow = allRow + lastRow;
String relatedName = ""; String relatedName;
switch (s) { switch (s) {
case 0: case 0:
relatedName = "方案页"; relatedName = "方案页";
@ -1658,11 +1657,11 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
SchemePO schemePO = new SchemePO(); SchemePO schemePO = new SchemePO();
SchemePO schemeNew = new SchemePO(); SchemePO schemeNew;
GradePO gradePO = new GradePO(); GradePO gradePO = new GradePO();
GradePO gradeNew = new GradePO(); GradePO gradeNew = new GradePO();
LevelPO levelPO = new LevelPO(); LevelPO levelPO = new LevelPO();
LevelPO levelNew = new LevelPO(); LevelPO levelNew;
historyDetailPO.setRowNums(String.valueOf(i + 1)); historyDetailPO.setRowNums(String.valueOf(i + 1));
for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) { for (int cellIndex = 0; cellIndex < lastCellNum; cellIndex++) {
@ -1738,11 +1737,11 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
if ("level_no".equals(infoPO.getFieldName()) && s == 2) { if ("level_no".equals(infoPO.getFieldName()) && s == 2) {
String[] split = Util.null2String(reallyValue).split(","); String[] split = Util.null2String(reallyValue).split(",");
if (split.length > 0) { if (split.length > 0) {
for (int index = 0; index < split.length; index++) { for (String value : split) {
List<LevelPO> levelPOS = MapperProxyFactory.getProxy(LevelMapper.class).listByNo(split[index]); List<LevelPO> levelPOS = MapperProxyFactory.getProxy(LevelMapper.class).listByNo(value);
if (levelPOS.size() == 0) { if (levelPOS.size() == 0) {
historyDetailPO.setRelatedName(relatedName); historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等"); historyDetailPO.setOperateDetail("未找到编号为[" + value + "]的职等");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue nextRow;
@ -1790,7 +1789,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("职等页导入:同一方案" + schemeNo + "下,职等编号不可重复"); historyDetailPO.setOperateDetail("职等页导入:同一方案" + schemeNo + "下,职等编号不可重复");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} else { } else {
levelPO.setLevelNo(levelNo); levelPO.setLevelNo(levelNo);
levelPO.setLevelName((String) map.get("level_name")); levelPO.setLevelName((String) map.get("level_name"));
@ -1810,7 +1809,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案"); historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
break; break;
case 2: case 2:
@ -1824,7 +1823,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案"); historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
gradePO.setGradeNo(gradeNo2); gradePO.setGradeNo(gradeNo2);
@ -1839,21 +1838,21 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
gradePO.setCreateTime((Date) map.get("create_time")); gradePO.setCreateTime((Date) map.get("create_time"));
gradePO.setUpdateTime((Date) map.get("update_time")); gradePO.setUpdateTime((Date) map.get("update_time"));
String[] split = levelNo2.split(","); String[] split = levelNo2.split(",");
String levelIds = null; StringBuilder levelIds = null;
if (split.length > 0) { if (split.length > 0) {
for (int index = 0; index < split.length; index++) { for (String value : split) {
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(split[index], schemeNew.getId()); levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(value, schemeNew.getId());
if (levelNew == null) { if (levelNew == null) {
historyDetailPO.setRelatedName(relatedName); historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等"); historyDetailPO.setOperateDetail("未找到编号为[" + value + "]的职等");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue nextRow;
} }
if (levelIds != null) { if (levelIds != null) {
levelIds = levelIds + "," + levelNew.getId(); levelIds.append(",").append(levelNew.getId());
} else { } else {
levelIds = String.valueOf(levelNew.getId()); levelIds = new StringBuilder(String.valueOf(levelNew.getId()));
} }
} }
} }
@ -1863,10 +1862,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("同一方案[" + schemeNo2 + "]下,职级编号不可重复"); historyDetailPO.setOperateDetail("同一方案[" + schemeNo2 + "]下,职级编号不可重复");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} else { } else {
// 关联职等id // 关联职等id
gradePO.setLevelId(levelIds); gradePO.setLevelId(levelIds.toString());
MapperProxyFactory.getProxy(GradeMapper.class).insertIgnoreNull(gradePO); MapperProxyFactory.getProxy(GradeMapper.class).insertIgnoreNull(gradePO);
} }
break; break;
@ -1890,7 +1889,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号为[" + map.get("scheme_no") + "]的方案"); historyDetailPO.setOperateDetail("未找到编号为[" + map.get("scheme_no") + "]的方案");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
break; break;
case 1: case 1:
@ -1911,14 +1910,14 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案"); historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
} else { } else {
historyDetailPO.setRelatedName(relatedName); historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案,无法更新"); historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo + "]的方案,无法更新");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
break; break;
case 2: case 2:
@ -1930,25 +1929,25 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案"); historyDetailPO.setOperateDetail("未找到编号为[" + schemeNo2 + "]的方案");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
// 处理职级编号 // 处理职级编号
String[] split = levelNo2.split(","); String[] split = levelNo2.split(",");
String levelIds = null; StringBuilder levelIds = null;
if (split.length > 0) { if (split.length > 0) {
for (int index = 0; index < split.length; index++) { for (String value : split) {
levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(split[index], schemeNew.getId()); levelNew = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByNoAndSid(value, schemeNew.getId());
if (levelNew == null) { if (levelNew == null) {
historyDetailPO.setRelatedName(relatedName); historyDetailPO.setRelatedName(relatedName);
historyDetailPO.setOperateDetail("未找到编号为[" + split[index] + "]的职等"); historyDetailPO.setOperateDetail("未找到编号为[" + value + "]的职等");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue nextRow;
} }
if (levelIds != null) { if (levelIds != null) {
levelIds = levelIds + "," + levelNew.getId(); levelIds.append(",").append(levelNew.getId());
} else { } else {
levelIds = String.valueOf(levelNew.getId()); levelIds = new StringBuilder(String.valueOf(levelNew.getId()));
} }
} }
} }
@ -1958,7 +1957,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
gradeNew.setGradeName((String) map.get("grade_name")); gradeNew.setGradeName((String) map.get("grade_name"));
gradeNew.setDescription((String) map.get("grade_description")); gradeNew.setDescription((String) map.get("grade_description"));
// 关联职等id // 关联职等id
gradeNew.setLevelId(levelIds); gradeNew.setLevelId(levelIds.toString());
gradeNew.setUpdateTime((Date) map.get("update_time")); gradeNew.setUpdateTime((Date) map.get("update_time"));
MapperProxyFactory.getProxy(GradeMapper.class).updateGrade(gradeNew); MapperProxyFactory.getProxy(GradeMapper.class).updateGrade(gradeNew);
} else { } else {
@ -1966,7 +1965,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
historyDetailPO.setOperateDetail("未找到编号[" + schemeNo2 + "]的职级,无法更新"); historyDetailPO.setOperateDetail("未找到编号[" + schemeNo2 + "]的职级,无法更新");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
OrgImportUtil.saveImportDetailLog(historyDetailPO); OrgImportUtil.saveImportDetailLog(historyDetailPO);
continue nextRow; continue;
} }
break; break;
@ -1988,8 +1987,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
*/ */
private String getCellValue(XSSFCell cell) { private String getCellValue(XSSFCell cell) {
String cellValue = ""; String cellValue = "";
if (cell == null) if (cell == null) {
return ""; return "";
}
switch (cell.getCellType()) { switch (cell.getCellType()) {
case BOOLEAN: // 得到Boolean对象的方法 case BOOLEAN: // 得到Boolean对象的方法
cellValue = String.valueOf(cell.getBooleanCellValue()); cellValue = String.valueOf(cell.getBooleanCellValue());
@ -2000,9 +2000,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式 cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式
} else { } else {
cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字 cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字
if (cellValue.endsWith(".0")) if (cellValue.endsWith(".0")) {
cellValue = cellValue.substring(0, cellValue.indexOf(".")); cellValue = cellValue.substring(0, cellValue.indexOf("."));
} }
}
break; break;
case FORMULA: // 读取公式 case FORMULA: // 读取公式
cellValue = cell.getCellFormula(); cellValue = cell.getCellFormula();

@ -286,9 +286,9 @@ public class JobServiceImpl extends Service implements JobService {
DepartmentPO deptById = getDepartmentMapper().getDeptById(param.getDepartmentid()); DepartmentPO deptById = getDepartmentMapper().getDeptById(param.getDepartmentid());
if (null != deptById) { if (null != deptById) {
params.put("parent_dept", deptById.getId()); params.put("parent_dept", deptById.getId());
params.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString())); params.put("ec_department", deptById.getId());
params.put("parent_comp", deptById.getParentComp()); params.put("parent_comp", deptById.getSubCompanyId1());
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(deptById.getParentComp().toString())); params.put("ec_company", deptById.getSubCompanyId1());
} }
} }
for (ExtendTitlePO extendTitle : extendTitles) { for (ExtendTitlePO extendTitle : extendTitles) {
@ -371,12 +371,12 @@ public class JobServiceImpl extends Service implements JobService {
params.put("ec_company", parentJob.getEcCompany()); params.put("ec_company", parentJob.getEcCompany());
params.put("ec_department", parentJob.getEcDepartment()); params.put("ec_department", parentJob.getEcDepartment());
} else { } else {
Long ecDepartment = searchParam.getEcDepartment(); Integer ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment)); DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
params.put("parent_dept", jclDepartment.getId()); params.put("parent_dept", jclDepartment.getId());
params.put("parent_comp", jclDepartment.getParentComp()); params.put("parent_comp", jclDepartment.getSubCompanyId1());
if (null != jclDepartment.getParentComp()) { if (null != jclDepartment.getSubCompanyId1()) {
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartment.getParentComp()))); params.put("ec_company", jclDepartment.getSubCompanyId1());
} }
} }
@ -422,12 +422,12 @@ public class JobServiceImpl extends Service implements JobService {
params.put("ec_company", parentJob.getEcCompany()); params.put("ec_company", parentJob.getEcCompany());
params.put("ec_department", parentJob.getEcDepartment()); params.put("ec_department", parentJob.getEcDepartment());
} else { } else {
Long ecDepartment = searchParam.getEcDepartment(); Integer ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment)); DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
params.put("parent_dept", jclDepartment.getId()); params.put("parent_dept", jclDepartment.getId());
params.put("parent_comp", jclDepartment.getParentComp()); params.put("parent_comp", jclDepartment.getSubCompanyId1());
if (null != jclDepartment.getParentComp()) { if (null != jclDepartment.getSubCompanyId1()) {
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartment.getParentComp()))); params.put("ec_company", jclDepartment.getSubCompanyId1());
} }
} }
params.put("jobactivityid", JOB_ACTIVITY_ID); params.put("jobactivityid", JOB_ACTIVITY_ID);
@ -461,13 +461,13 @@ public class JobServiceImpl extends Service implements JobService {
// 处理自动编号 // 处理自动编号
jobById.setJobNo(CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, jobById.getJobNo(), System.currentTimeMillis())); jobById.setJobNo(CodeRuleUtil.generateCode(RuleCodeType.JOBTITLES, jobById.getJobNo(), System.currentTimeMillis()));
// 部门赋值 // 部门赋值
jobById.setEcDepartment(Long.parseLong(department)); jobById.setEcDepartment(Integer.parseInt(department));
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(department); DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(jobById.getEcDepartment());
if (null != jclDepartmentId) { if (null != jclDepartmentId) {
jobById.setParentDept(jclDepartmentId.getId()); jobById.setParentDept(jclDepartmentId.getId());
//分部赋值 //分部赋值
jobById.setEcCompany(jclDepartmentId.getEcCompany()); jobById.setEcCompany(jclDepartmentId.getSubCompanyId1());
jobById.setParentComp(jclDepartmentId.getParentComp()); jobById.setParentComp(jclDepartmentId.getSubCompanyId1());
} }
// 清空上级岗位 // 清空上级岗位
jobById.setParentJob(null); jobById.setParentJob(null);
@ -489,7 +489,7 @@ public class JobServiceImpl extends Service implements JobService {
if (params.getForbiddenTag()) { if (params.getForbiddenTag()) {
// 启用:判断上级部门是否启用,上级部门启用,岗位才可启用 // 启用:判断上级部门是否启用,上级部门启用,岗位才可启用
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(jobById.getParentDept()); DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(jobById.getParentDept());
OrganizationAssert.isTrue(0 == parentDepartment.getForbiddenTag(), "该岗位不能解封,请先解封上级部门"); OrganizationAssert.isTrue(0 == parentDepartment.getCanceled(), "该岗位不能解封,请先解封上级部门");
// 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用 // 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用
if (null != jobById.getParentJob()) { if (null != jobById.getParentJob()) {
@ -600,7 +600,7 @@ public class JobServiceImpl extends Service implements JobService {
} }
void recursionMergeJob(List<JobPO> jobs, Integer parentCompany, Integer ecCompany, Long parentDepartment, Long ecDepartment, Long parentJob) { void recursionMergeJob(List<JobPO> jobs, Integer parentCompany, Integer ecCompany, Integer parentDepartment, Integer ecDepartment, Long parentJob) {
for (JobPO job : jobs) { for (JobPO job : jobs) {
job.setParentComp(parentCompany); job.setParentComp(parentCompany);
job.setEcCompany(ecCompany); job.setEcCompany(ecCompany);
@ -627,11 +627,11 @@ public class JobServiceImpl extends Service implements JobService {
*/ */
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) { private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
builderDeparts.add(departmentPO); builderDeparts.add(departmentPO);
if (SearchTreeUtil.isTop(departmentPO.getParentDept())) { if (SearchTreeUtil.isTop(departmentPO.getSupDepId())) {
return; return;
} }
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getParentDept()); DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getSupDepId());
if (null != parentDept && 0 == parentDept.getForbiddenTag()) { if (null != parentDept && 0 == parentDept.getCanceled()) {
buildParentDepts(parentDept, builderDeparts); buildParentDepts(parentDept, builderDeparts);
} }
} }
@ -663,13 +663,13 @@ public class JobServiceImpl extends Service implements JobService {
// 通过分部、公司 组装数据 // 通过分部、公司 组装数据
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) { if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id); Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).forbiddenTag(0).build(); DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(parentCompId).canceled(0).build();
CompanyPO compBuild = CompanyPO.builder().subCompanyName(keyword).supSubComId(parentCompId).canceled(0).build(); CompanyPO compBuild = CompanyPO.builder().subCompanyName(keyword).supSubComId(parentCompId).canceled(0).build();
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild); searchTree = buildTreeByCompAndDept(departmentBuild, compBuild);
} else if (TYPE_DEPT.equals(type)) { } else if (TYPE_DEPT.equals(type)) {
// //
// 查询部门信息 // 查询部门信息
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(DepartmentPO.builder().deptName(keyword).forbiddenTag(0).parentDept(Long.parseLong(id)).build(), "show_order"); List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(DepartmentPO.builder().departmentName(keyword).canceled(0).supDepId(Integer.parseInt(id)).build(), "show_order");
Set<DepartmentPO> builderDeparts = new HashSet<>(); Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) { for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts); buildParentDepts(departmentPO, builderDeparts);
@ -808,7 +808,7 @@ public class JobServiceImpl extends Service implements JobService {
/** /**
* *
*/ */
public static void assertNameRepeat(Long jobId, Long departmentId, Long parentJobId, String jobName) { public static void assertNameRepeat(Long jobId, Integer departmentId, Long parentJobId, String jobName) {
assertNameRepeat(jobId, departmentId, parentJobId, jobName, true); assertNameRepeat(jobId, departmentId, parentJobId, jobName, true);
} }
@ -816,7 +816,7 @@ public class JobServiceImpl extends Service implements JobService {
* *
*/ */
public static boolean assertNameRepeat(String jobId, String departmentId, String parentJobId, String jobName) { public static boolean assertNameRepeat(String jobId, String departmentId, String parentJobId, String jobName) {
return assertNameRepeat(StringUtils.isBlank(jobId) ? null : Long.parseLong(jobId), StringUtils.isBlank(departmentId) ? null : Long.parseLong(departmentId), StringUtils.isBlank(parentJobId) ? null : Long.parseLong(parentJobId), jobName, false); return assertNameRepeat(StringUtils.isBlank(jobId) ? null : Long.parseLong(jobId), StringUtils.isBlank(departmentId) ? null : Integer.parseInt(departmentId), StringUtils.isBlank(parentJobId) ? null : Long.parseLong(parentJobId), jobName, false);
} }
/** /**
@ -829,8 +829,8 @@ public class JobServiceImpl extends Service implements JobService {
* @param throwException * @param throwException
* @return * @return
*/ */
public static boolean assertNameRepeat(Long jobId, Long departmentId, Long parentJobId, String jobName, boolean throwException) { public static boolean assertNameRepeat(Long jobId, Integer departmentId, Long parentJobId, String jobName, boolean throwException) {
int count = 0; int count;
// 有上级岗位、判断相同层级下有无相同名称岗位 // 有上级岗位、判断相同层级下有无相同名称岗位
if (null != jobId) { if (null != jobId) {
count = getJobMapper().countRepeatNameByPid(jobName, jobId, parentJobId, departmentId); count = getJobMapper().countRepeatNameByPid(jobName, jobId, parentJobId, departmentId);
@ -856,9 +856,9 @@ public class JobServiceImpl extends Service implements JobService {
Long originalJobId = originalJob.getId(); Long originalJobId = originalJob.getId();
Long targetJobId = targetJob.getId(); Long targetJobId = targetJob.getId();
Integer parentComp = targetJob.getParentComp(); Integer parentComp = targetJob.getParentComp();
Long parentDept = targetJob.getParentDept(); Integer parentDept = targetJob.getParentDept();
Integer ecCompany = targetJob.getEcCompany(); Integer ecCompany = targetJob.getEcCompany();
Long ecDepartment = targetJob.getEcDepartment(); Integer ecDepartment = targetJob.getEcDepartment();
List<HrmResourcePO> resourceList = getResourceMapper().getResourceListByJobId(originalJobId); List<HrmResourcePO> resourceList = getResourceMapper().getResourceListByJobId(originalJobId);
getResourceMapper().updateResourceJob(originalJobId, targetJobId, parentComp, parentDept, ecCompany, ecDepartment); getResourceMapper().updateResourceJob(originalJobId, targetJobId, parentComp, parentDept, ecCompany, ecDepartment);

@ -174,12 +174,12 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
* @param uId * @param uId
* @return * @return
*/ */
public static List<Long> getJclRoleLevels(Integer uId) { public static List<Integer> getJclRoleLevels(Integer uId) {
List<Long> ecRoleLevels = new ArrayList<>(); List<Integer> ecRoleLevels = new ArrayList<>();
ManagerDetachMapper mangeDetachMapper = MapperProxyFactory.getProxy(ManagerDetachMapper.class); ManagerDetachMapper mangeDetachMapper = MapperProxyFactory.getProxy(ManagerDetachMapper.class);
List<ManagerDetachPO> detachListById = mangeDetachMapper.getDetachListById(uId); List<ManagerDetachPO> detachListById = mangeDetachMapper.getDetachListById(uId);
for (ManagerDetachPO managerDetachPO : detachListById) { for (ManagerDetachPO managerDetachPO : detachListById) {
List<Long> ids = Stream.of(managerDetachPO.getJclRolelevel().split(",")).map(Long::parseLong).collect(Collectors.toList()); List<Integer> ids = Stream.of(managerDetachPO.getJclRolelevel().split(",")).map(Integer::parseInt).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(ids)) {
ecRoleLevels.addAll(ids); ecRoleLevels.addAll(ids);
} }

@ -18,6 +18,7 @@ import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.entity.staff.po.StaffPlanPO; import com.engine.organization.entity.staff.po.StaffPlanPO;
import com.engine.organization.entity.staff.po.StaffsPO; import com.engine.organization.entity.staff.po.StaffsPO;
import com.engine.organization.entity.staff.vo.StaffTableVO; import com.engine.organization.entity.staff.vo.StaffTableVO;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.staff.StaffMapper; import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.mapper.staff.StaffPlanMapper; import com.engine.organization.mapper.staff.StaffPlanMapper;
@ -29,7 +30,6 @@ import com.engine.organization.util.browser.OrganizationBrowserUtil;
import com.engine.organization.util.db.DBType; import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.excel.ExcelUtil; import com.engine.organization.util.excel.ExcelUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -65,6 +65,10 @@ public class StaffServiceImpl extends Service implements StaffService {
return MapperProxyFactory.getProxy(JobMapper.class); return MapperProxyFactory.getProxy(JobMapper.class);
} }
private DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class);
}
// 判断编制导入模板是否存在,不存在则创建该文件 // 判断编制导入模板是否存在,不存在则创建该文件
static { static {
try { try {
@ -366,7 +370,7 @@ public class StaffServiceImpl extends Service implements StaffService {
if (null != compId) { if (null != compId) {
sqlWhere += " AND t.comp_id = '" + compId + "'"; sqlWhere += " AND t.comp_id = '" + compId + "'";
} }
Long deptId = param.getDeptId(); Integer deptId = param.getDeptId();
if (null != deptId) { if (null != deptId) {
sqlWhere += " AND t.dept_id = '" + deptId + "'"; sqlWhere += " AND t.dept_id = '" + deptId + "'";
} }
@ -374,7 +378,7 @@ public class StaffServiceImpl extends Service implements StaffService {
if (null != ecCompany) { if (null != ecCompany) {
sqlWhere += " AND t.ec_company = '" + ecCompany + "'"; sqlWhere += " AND t.ec_company = '" + ecCompany + "'";
} }
Long ecDepartment = param.getEcDepartment(); Integer ecDepartment = param.getEcDepartment();
if (null != ecDepartment) { if (null != ecDepartment) {
sqlWhere += " AND t.ec_department = '" + ecDepartment + "'"; sqlWhere += " AND t.ec_department = '" + ecDepartment + "'";
} }
@ -433,11 +437,11 @@ public class StaffServiceImpl extends Service implements StaffService {
break; break;
case "2":// 部门 case "2":// 部门
OrganizationAssert.notNull(staffPO.getEcDepartment(), "编制维度选择部门时,部门必填!"); OrganizationAssert.notNull(staffPO.getEcDepartment(), "编制维度选择部门时,部门必填!");
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(staffPO.getEcDepartment())); DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(staffPO.getEcDepartment());
if (null != jclDepartmentId) { if (null != jclDepartmentId) {
staffPO.setDeptId(jclDepartmentId.getId()); staffPO.setDeptId(jclDepartmentId.getId());
staffPO.setCompId(jclDepartmentId.getParentComp()); staffPO.setCompId(jclDepartmentId.getSubCompanyId1());
staffPO.setEcCompany(jclDepartmentId.getEcCompany()); staffPO.setEcCompany(jclDepartmentId.getSubCompanyId1());
} }
break; break;
case "3": // 岗位 case "3": // 岗位

@ -1,227 +1,203 @@
package com.engine.organization.thread; package com.engine.organization.thread;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.hrmresource.po.HrmResourcePO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.logview.bo.FieldBaseEquator;
import com.engine.organization.entity.map.JclOrgMap;
import com.engine.organization.entity.personnelcard.UserCard;
import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.enums.ModuleTypeEnum;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.mapper.trigger.CompTriggerMapper;
import com.engine.organization.mapper.trigger.DepartmentTriggerMapper;
import com.engine.organization.util.OrganizationDateUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
import weaver.common.DateUtil;
import weaver.general.Util;
import java.sql.Date;
import java.util.Calendar;
import java.util.List;
/** /**
* @author:dxfeng * @author:dxfeng
* @createTime: 2022/08/30 * @createTime: 2022/08/30
* @version: 1.0 * @version: 1.0
*/ */
public class DepartmentTriggerRunnable implements Runnable { //public class DepartmentTriggerRunnable implements Runnable {
//
private DepartmentPO oldDepartment; // private DepartmentPO oldDepartment;
private final DepartmentPO newDepartment; // private final DepartmentPO newDepartment;
private String oldFparentId; // private String oldFparentId;
private String moveTarget; // private String moveTarget;
private Boolean forbiddenTag = false; // private Boolean forbiddenTag = false;
//
private CompTriggerMapper getCompTriggerMapper() { // private CompTriggerMapper getCompTriggerMapper() {
return MapperProxyFactory.getProxy(CompTriggerMapper.class); // return MapperProxyFactory.getProxy(CompTriggerMapper.class);
} // }
//
private DepartmentTriggerMapper getDepartmentTriggerMapper() { // private DepartmentTriggerMapper getDepartmentTriggerMapper() {
return MapperProxyFactory.getProxy(DepartmentTriggerMapper.class); // return MapperProxyFactory.getProxy(DepartmentTriggerMapper.class);
} // }
//
public DepartmentTriggerRunnable(DepartmentPO oldDepartment, DepartmentPO newDepartment) { // public DepartmentTriggerRunnable(DepartmentPO oldDepartment, DepartmentPO newDepartment) {
this.oldDepartment = oldDepartment; // this.oldDepartment = oldDepartment;
this.newDepartment = newDepartment; // this.newDepartment = newDepartment;
} // }
//
public DepartmentTriggerRunnable(Boolean forbiddenTag,DepartmentPO oldDepartment, DepartmentPO newDepartment) { // public DepartmentTriggerRunnable(Boolean forbiddenTag,DepartmentPO oldDepartment, DepartmentPO newDepartment) {
this.oldDepartment = oldDepartment; // this.oldDepartment = oldDepartment;
this.newDepartment = newDepartment; // this.newDepartment = newDepartment;
this.forbiddenTag = forbiddenTag; // this.forbiddenTag = forbiddenTag;
} // }
//
public DepartmentTriggerRunnable(Long departmentId) { // public DepartmentTriggerRunnable(Long departmentId) {
this.oldDepartment = new DepartmentPO(); // this.oldDepartment = new DepartmentPO();
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId); // this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
} // }
//
public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) { // public DepartmentTriggerRunnable(String moveTarget,DepartmentPO newDepartment) {
this.oldDepartment = new DepartmentPO(); // this.oldDepartment = new DepartmentPO();
this.newDepartment = newDepartment; // this.newDepartment = newDepartment;
this.moveTarget = moveTarget; // this.moveTarget = moveTarget;
} // }
//
public DepartmentTriggerRunnable(Integer oldFparentId, Long departmentId) { // public DepartmentTriggerRunnable(Integer oldFparentId, Long departmentId) {
this.oldFparentId = null == oldFparentId ? null : oldFparentId.toString(); // this.oldFparentId = null == oldFparentId ? null : oldFparentId.toString();
this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId); // this.newDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
} // }
//
public DepartmentTriggerRunnable(DepartmentPO newDepartment) { // public DepartmentTriggerRunnable(DepartmentPO newDepartment) {
this.oldDepartment = new DepartmentPO(); // this.oldDepartment = new DepartmentPO();
this.newDepartment = newDepartment; // this.newDepartment = newDepartment;
this.newDepartment.setDeleteType(1); // this.newDepartment.setDeleteType(1);
} // }
//
@Override // @Override
public void run() { // public void run() {
FieldBaseEquator fieldBaseEquator = new FieldBaseEquator(); // FieldBaseEquator fieldBaseEquator = new FieldBaseEquator();
List<String> diffFields = fieldBaseEquator.getDiffFieldList(oldDepartment, newDepartment); // List<String> diffFields = fieldBaseEquator.getDiffFieldList(oldDepartment, newDepartment);
if (CollectionUtils.isEmpty(diffFields)) { // if (CollectionUtils.isEmpty(diffFields)) {
return; // return;
} // }
//
// 判断 // // 判断
if (diffFields.contains("deptName") || diffFields.contains("deptPrincipal") || diffFields.contains("parentComp") || diffFields.contains("parentDept") || diffFields.contains("forbiddenTag") || diffFields.contains("deleteType")) { // if (diffFields.contains("deptName") || diffFields.contains("deptPrincipal") || diffFields.contains("parentComp") || diffFields.contains("parentDept") || diffFields.contains("forbiddenTag") || diffFields.contains("deleteType")) {
JclOrgMap jclMap = new JclOrgMap(); // JclOrgMap jclMap = new JclOrgMap();
jclMap.setFType(2); // jclMap.setFType(2);
int st = 100000000; // int st = 100000000;
//
// 更新逻辑 // // 更新逻辑
jclMap.setFObjId(newDepartment.getId().intValue()); // jclMap.setFObjId(newDepartment.getId().intValue());
jclMap.setId(newDepartment.getId().intValue() + st); // jclMap.setId(newDepartment.getId().intValue() + st);
jclMap.setUuid(newDepartment.getUuid()); // jclMap.setUuid(newDepartment.getUuid());
jclMap.setFNumber(newDepartment.getDeptNo()); // jclMap.setFNumber(newDepartment.getDeptNo());
jclMap.setFName(newDepartment.getDeptName()); // jclMap.setFName(newDepartment.getDeptName());
jclMap.setFParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue() + st); // jclMap.setFParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue() + st);
jclMap.setFObjParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue()); // jclMap.setFObjParentId(null == newDepartment.getParentDept() ? newDepartment.getParentComp().intValue() : newDepartment.getParentDept().intValue());
//
jclMap.setFEcId(getDepartmentTriggerMapper().getEcDepartmentIdByUuid(jclMap.getUuid())); // jclMap.setFEcId(getDepartmentTriggerMapper().getEcDepartmentIdByUuid(jclMap.getUuid()));
//
jclMap.setFClass(0); // jclMap.setFClass(0);
jclMap.setFClassName("行政维度"); // jclMap.setFClassName("行政维度");
Integer ecResourceId = null == newDepartment.getDeptPrincipal() ? null : newDepartment.getDeptPrincipal().intValue(); // Integer ecResourceId = null == newDepartment.getDeptPrincipal() ? null : newDepartment.getDeptPrincipal().intValue();
HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId); // HrmResourcePO hrmResourcePO = getCompTriggerMapper().getResourceByEcId(ecResourceId);
if (null != hrmResourcePO) { // if (null != hrmResourcePO) {
jclMap.setFLeader(hrmResourcePO.getId().intValue()); // jclMap.setFLeader(hrmResourcePO.getId().intValue());
jclMap.setFLeaderName(hrmResourcePO.getLastName()); // jclMap.setFLeaderName(hrmResourcePO.getLastName());
jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue()); // jclMap.setFLeaderJobId(hrmResourcePO.getJobTitle().intValue());
jclMap.setFLeaderSt(hrmResourcePO.getJobGrade()); // jclMap.setFLeaderSt(hrmResourcePO.getJobGrade());
jclMap.setFLeaderLv(hrmResourcePO.getJobLevel()); // jclMap.setFLeaderLv(hrmResourcePO.getJobLevel());
String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage(); // String image = UserCard.builder().image(hrmResourcePO.getResourceImageId()).build().getImage();
jclMap.setFLeaderImg(image); // jclMap.setFLeaderImg(image);
if (null != hrmResourcePO.getJobTitle()) { // if (null != hrmResourcePO.getJobTitle()) {
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle()); // JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(hrmResourcePO.getJobTitle());
if (null != jobById) { // if (null != jobById) {
jclMap.setFLeaderJob(jobById.getJobName()); // jclMap.setFLeaderJob(jobById.getJobName());
} // }
} // }
} // }
//
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date()); // String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime())); // jclMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); // jclMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
//
// 获取当前生效的本部门map记录 // // 获取当前生效的本部门map记录
JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId())); // JclOrgMap jclOrgMapByObjID = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapByObjID(jclMap.getFDateBegin(), ModuleTypeEnum.departmentfielddefined.getValue().toString(), Util.null2String(jclMap.getFObjId()));
StaffPO staffPO = new StaffPO(); // StaffPO staffPO = new StaffPO();
switch (jclMap.getFType()) { // switch (jclMap.getFType()) {
// 分部 // // 分部
case 1: // case 1:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,jclMap.getFObjId().toString(), null, null); // staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,jclMap.getFObjId().toString(), null, null);
break; // break;
// 部门 // // 部门
case 2: // case 2:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, jclMap.getFObjId().toString(), null); // staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2,null, jclMap.getFObjId().toString(), null);
break; // break;
} // }
// 取出以该部门为上级部门的在编、在岗数,转移无需计算 // // 取出以该部门为上级部门的在编、在岗数,转移无需计算
JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString()); // JclOrgMap jclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(jclMap.getFDateBegin(), jclMap.getId().toString());
if (null != moveTarget) { // if (null != moveTarget) {
jclOrgMap = null; // jclOrgMap = null;
} // }
if (null != jclOrgMapByObjID) { // if (null != jclOrgMapByObjID) {
if (null != jclOrgMap) { // if (null != jclOrgMap) {
jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan()); // jclMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMap.getFPlan());
jclMap.setFOnJob(jclOrgMap.getFOnJob()); // jclMap.setFOnJob(jclOrgMap.getFOnJob());
} else { // } else {
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0); // jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob()); // jclMap.setFOnJob(jclOrgMapByObjID.getFOnJob());
} // }
} else { // } else {
jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0); // jclMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
jclMap.setFOnJob(0); // jclMap.setFOnJob(0);
} // }
jclMap.setFIsVitual(0); // jclMap.setFIsVitual(0);
//
Calendar cal = Calendar.getInstance(); // Calendar cal = Calendar.getInstance();
cal.setTime(jclMap.getFDateBegin()); // cal.setTime(jclMap.getFDateBegin());
Calendar calendar = DateUtil.addDay(cal, -1); // Calendar calendar = DateUtil.addDay(cal, -1);
Date time = new Date(calendar.getTime().getTime()); // Date time = new Date(calendar.getTime().getTime());
getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin()); // getCompTriggerMapper().deleteMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin());
getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time); // getCompTriggerMapper().updateMap(jclMap.getFType(), jclMap.getFObjId(), jclMap.getFDateBegin(), time);
//
if (1 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) { // if (1 != newDepartment.getDeleteType() && 1 != newDepartment.getForbiddenTag()) {
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap); // MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(jclMap);
} // }
if(null != jclOrgMapByObjID) { // if(null != jclOrgMapByObjID) {
updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString()); // updateParentPlanAndJob(jclMap.getFDateBegin(), jclOrgMapByObjID.getFParentId().toString());
} // }
// 部门启用,刷新上级数据 // // 部门启用,刷新上级数据
if(forbiddenTag){ // if(forbiddenTag){
updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString()); // updateParentPlanAndJob(jclMap.getFDateBegin(), jclMap.getFParentId().toString());
} // }
if(null != moveTarget){ // if(null != moveTarget){
updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget); // updateParentPlanAndJob(jclMap.getFDateBegin(), moveTarget);
} // }
if (null != oldFparentId) { // if (null != oldFparentId) {
updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId); // updateParentPlanAndJob(jclMap.getFDateBegin(), oldFparentId);
} // }
} // }
} // }
//
private void updateParentPlanAndJob(Date currentDate, String parentId) { // private void updateParentPlanAndJob(Date currentDate, String parentId) {
// 获取上级部门 // // 获取上级部门
JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId); // JclOrgMap parentJclOrgMap = MapperProxyFactory.getProxy(JclOrgMapper.class).getJclOrgMapById(currentDate, parentId);
if (null != parentJclOrgMap) { // if (null != parentJclOrgMap) {
// 上级部门当前在编、在岗数 // // 上级部门当前在编、在岗数
JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString()); // JclOrgMap jclOrgMapSum = MapperProxyFactory.getProxy(JclOrgMapper.class).getSumPlanAndJobByFParentId(currentDate, parentJclOrgMap.getId().toString());
StaffPO staffPO = new StaffPO(); // StaffPO staffPO = new StaffPO();
switch (parentJclOrgMap.getFType()) { // switch (parentJclOrgMap.getFType()) {
case 1: // case 1:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,Util.null2String(parentJclOrgMap.getFObjId()), null, null); // staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(1,Util.null2String(parentJclOrgMap.getFObjId()), null, null);
break; // break;
// 部门 // // 部门
case 2: // case 2:
staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, Util.null2String(parentJclOrgMap.getFObjId()), null); // staffPO = MapperProxyFactory.getProxy(StaffMapper.class).getStaffsByParamId(2, null, Util.null2String(parentJclOrgMap.getFObjId()), null);
break; // break;
} // }
// 编制表jcl_org_staff中的编制数+下级编制数,工具类判断 // // 编制表jcl_org_staff中的编制数+下级编制数,工具类判断
if(null != jclOrgMapSum){ // if(null != jclOrgMapSum){
parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan()); // parentJclOrgMap.setFPlan((null != staffPO ? staffPO.getStaffNum() : 0) + jclOrgMapSum.getFPlan());
parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob()); // parentJclOrgMap.setFOnJob(jclOrgMapSum.getFOnJob());
}else{ // }else{
parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0); // parentJclOrgMap.setFPlan(null != staffPO ? staffPO.getStaffNum() : 0);
parentJclOrgMap.setFOnJob(0); // parentJclOrgMap.setFOnJob(0);
} // }
parentJclOrgMap.setFDateBegin(currentDate); // parentJclOrgMap.setFDateBegin(currentDate);
parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime())); // parentJclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2099-12-31").getTime()));
//
Calendar cal = Calendar.getInstance(); // Calendar cal = Calendar.getInstance();
cal.setTime(parentJclOrgMap.getFDateBegin()); // cal.setTime(parentJclOrgMap.getFDateBegin());
Calendar calendar = DateUtil.addDay(cal, -1); // Calendar calendar = DateUtil.addDay(cal, -1);
Date time = new Date(calendar.getTime().getTime()); // Date time = new Date(calendar.getTime().getTime());
getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin()); // getCompTriggerMapper().deleteMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin());
getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time); // getCompTriggerMapper().updateMap(parentJclOrgMap.getFType(), parentJclOrgMap.getFObjId(), parentJclOrgMap.getFDateBegin(), time);
MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap); // MapperProxyFactory.getProxy(JclOrgMapper.class).insertMap(parentJclOrgMap);
if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) { // if (null != parentJclOrgMap.getFParentId() && -1 != parentJclOrgMap.getFParentId()) {
updateParentPlanAndJob(currentDate, parentJclOrgMap.getFParentId().toString()); // updateParentPlanAndJob(currentDate, parentJclOrgMap.getFParentId().toString());
} // }
} // }
} // }
} //}

@ -4,11 +4,9 @@ import com.engine.common.util.ServiceUtil;
import com.engine.hrm.service.impl.HrmJobServiceImpl; import com.engine.hrm.service.impl.HrmJobServiceImpl;
import com.engine.hrm.service.impl.OrganizationServiceImpl; import com.engine.hrm.service.impl.OrganizationServiceImpl;
import com.engine.organization.entity.commom.RecordInfo; import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.job.po.JobPO; import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.enums.LogModuleNameEnum; import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum; import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper; import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationAssert;
@ -21,7 +19,6 @@ import weaver.conn.RecordSet;
import weaver.general.Util; import weaver.general.Util;
import weaver.hrm.User; import weaver.hrm.User;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -380,37 +377,13 @@ public class OrganizationSyncEc {
* *
*/ */
private void cancelDepartment() { private void cancelDepartment() {
String departmentIds = Util.null2String(params.get("id"));
String forbiddenTag = Util.null2String(params.get("forbiddenTag")); String forbiddenTag = Util.null2String(params.get("forbiddenTag"));
List<String> idList = new ArrayList<>();
String[] split = departmentIds.split(",");
if (StringUtils.isBlank(forbiddenTag)) {
long currentTimeMillis = System.currentTimeMillis();
for (String s : split) {
DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(Long.parseLong(s));
params.put("dept_name_short", departmentPO.getDeptNameShort() + currentTimeMillis);
params.put("dept_name", departmentPO.getDeptName() + currentTimeMillis);
params.put("parent_comp", departmentPO.getParentComp());
params.put("parent_dept", departmentPO.getParentDept());
params.put("show_order", departmentPO.getShowOrder());
params.put("dept_no", departmentPO.getDeptNo() + currentTimeMillis);
params.put("dept_principal", departmentPO.getDeptPrincipal());
updateDepartment();
idList.add(EcHrmRelationUtil.getEcDepartmentId(s));
}
} else {
for (String s : split) {
idList.add(EcHrmRelationUtil.getEcDepartmentId(s));
}
}
Map<String, Object> map = new HashMap<>();
map.put("id", StringUtils.join(idList, ","));
if ("0".equals(forbiddenTag)) { if ("0".equals(forbiddenTag)) {
// 解封 // 解封
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentISCanceled(map, user); this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentISCanceled(params, user);
} else { } else {
// 封存 // 封存
this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentCancel(map, user); this.resultMap = ServiceUtil.getService(OrganizationServiceImpl.class, user).doDepartmentCancel(params, user);
} }
} }

@ -120,15 +120,15 @@ public class StaffTriggerRunnable implements Runnable {
} }
} }
private void refreshDepartmentStaff(Long departmentId) { private void refreshDepartmentStaff(Integer departmentId) {
if (null == departmentId) { if (null == departmentId) {
return; return;
} }
DepartmentPO deptById = getDepartmentMapper().getDeptById(departmentId); DepartmentPO deptById = getDepartmentMapper().getDeptById(departmentId);
if (null != deptById) { if (null != deptById) {
updateOrgMap(ModuleTypeEnum.departmentfielddefined.getValue().toString(), departmentId.toString()); updateOrgMap(ModuleTypeEnum.departmentfielddefined.getValue().toString(), departmentId.toString());
if (null != deptById.getParentDept() && 0 != deptById.getParentDept()) { if (null != deptById.getSupDepId() && 0 != deptById.getSupDepId()) {
refreshDepartmentStaff(deptById.getParentDept()); refreshDepartmentStaff(deptById.getSupDepId());
} }
} }
} }

@ -15,7 +15,7 @@ import weaver.hrm.User;
public class HrmResourceTransMethod { public class HrmResourceTransMethod {
public static String getDepartmentName(String departmentId) { public static String getDepartmentName(String departmentId) {
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(Long.parseLong(departmentId)); return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(Integer.parseInt(departmentId));
} }
public static String getCompanyName(String companyId) { public static String getCompanyName(String companyId) {

@ -13,11 +13,12 @@ import java.util.List;
public class ConfigTrans { public class ConfigTrans {
public static String getCheckBoxPopedom(String status) { public static String getCheckBoxPopedom(String status) {
if ("0".equals(status)) if ("0".equals(status)) {
return "true"; return "true";
else } else {
return "false"; return "false";
} }
}
public static List<Object> formatSourceOperates(String id, String isDefault) { public static List<Object> formatSourceOperates(String id, String isDefault) {
List list = Lists.newArrayList(); List list = Lists.newArrayList();

@ -39,7 +39,7 @@ public class PageInfoSortUtil {
*/ */
private static String upperCharToUnderLine(String param) { private static String upperCharToUnderLine(String param) {
Pattern p = Pattern.compile("[A-Z]"); Pattern p = Pattern.compile("[A-Z]");
if (param == null || param.equals("")) { if (param == null || "".equals(param)) {
return ""; return "";
} }
StringBuilder builder = new StringBuilder(param); StringBuilder builder = new StringBuilder(param);

@ -37,7 +37,7 @@ public class ResponseResult<T, R> {
private void permission() { private void permission() {
if (permission) { if (permission) {
List<Object> roleInfo = hrmCommonService.getRoleInfo(user.getUID()); List<Object> roleInfo = hrmCommonService.getRoleInfo(user.getUID());
roleInfo.stream().map(m -> (Map) m).filter(m -> m.get("roleid") != null && m.get("roleid").toString().equals("28")).findFirst().orElseThrow(() -> new OrganizationRunTimeException("无权限")); roleInfo.stream().map(m -> (Map) m).filter(m -> m.get("roleid") != null && "28".equals(m.get("roleid").toString())).findFirst().orElseThrow(() -> new OrganizationRunTimeException("无权限"));
} }
} }

@ -20,7 +20,7 @@ import java.util.List;
public class DetachUtil { public class DetachUtil {
private boolean DETACH = "true".equals(new BaseBean().getPropValue("hrmOrganization", "detach")); private boolean DETACH = "true".equals(new BaseBean().getPropValue("hrmOrganization", "detach"));
private final List<Long> jclRoleLevels; private final List<Integer> jclRoleLevels;
public DetachUtil(Integer uId) { public DetachUtil(Integer uId) {
if (1 == uId) { if (1 == uId) {
@ -38,7 +38,7 @@ public class DetachUtil {
*/ */
public void filterCompanyList(List<CompanyPO> companyList) { public void filterCompanyList(List<CompanyPO> companyList) {
if (DETACH && CollectionUtils.isNotEmpty(companyList)) { if (DETACH && CollectionUtils.isNotEmpty(companyList)) {
companyList.removeIf(item -> !jclRoleLevels.contains((long) item.getId())); companyList.removeIf(item -> !jclRoleLevels.contains(item.getId()));
} }
} }
@ -47,7 +47,7 @@ public class DetachUtil {
*/ */
public void filterDepartmentList(List<DepartmentPO> departmentList) { public void filterDepartmentList(List<DepartmentPO> departmentList) {
if (DETACH && CollectionUtils.isNotEmpty(departmentList)) { if (DETACH && CollectionUtils.isNotEmpty(departmentList)) {
departmentList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp())); departmentList.removeIf(item -> !jclRoleLevels.contains(item.getSubCompanyId1()));
} }
} }

@ -221,7 +221,9 @@ public class FieldDefinedValueUtil {
} else if (fieldType == 161 || fieldType == 162) { //自定义浏览按钮 } else if (fieldType == 161 || fieldType == 162) { //自定义浏览按钮
try { try {
String fieldDbType = requestId;//用requestid传递数据 dmlurl String fieldDbType = requestId;//用requestid传递数据 dmlurl
if (Util.null2String(fieldDbType).length() == 0 || fieldDbType.equals("emptyVal")) return ""; if (Util.null2String(fieldDbType).length() == 0 || "emptyVal".equals(fieldDbType)) {
return "";
}
String sql = "select count(1) from mode_browser where showname = '" + fieldDbType + "'"; String sql = "select count(1) from mode_browser where showname = '" + fieldDbType + "'";
rs.execute(sql); rs.execute(sql);
if (rs.next()) {//建模浏览框 if (rs.next()) {//建模浏览框
@ -239,7 +241,7 @@ public class FieldDefinedValueUtil {
try { try {
BrowserBean bb = browser.searchById(s); BrowserBean bb = browser.searchById(s);
String name = Util.null2String(bb.getName()); String name = Util.null2String(bb.getName());
if (showName.toString().equals("")) { if ("".equals(showName.toString())) {
showName.append(name); showName.append(name);
} else { } else {
showName.append(",").append(name); showName.append(",").append(name);
@ -254,12 +256,12 @@ public class FieldDefinedValueUtil {
} }
} else if (fieldType == 256 || fieldType == 257) { } else if (fieldType == 256 || fieldType == 257) {
if (!fieldValue.equals("null")) { if (!"null".equals(fieldValue)) {
CustomTreeUtil customTreeUtil = new CustomTreeUtil(); CustomTreeUtil customTreeUtil = new CustomTreeUtil();
for (String s : tempshowidlist) { for (String s : tempshowidlist) {
String show_val = Util.null2String(s); String show_val = Util.null2String(s);
String name = customTreeUtil.getTreeFieldShowName(show_val, requestId); String name = customTreeUtil.getTreeFieldShowName(show_val, requestId);
if (showName.toString().equals("")) { if ("".equals(showName.toString())) {
showName.append(name); showName.append(name);
} else { } else {
showName.append(",").append(name); showName.append(",").append(name);
@ -274,8 +276,8 @@ public class FieldDefinedValueUtil {
+ fieldType); + fieldType);
String keyColumName = new BrowserComInfo() String keyColumName = new BrowserComInfo()
.getBrowserkeycolumname("" + fieldType); .getBrowserkeycolumname("" + fieldType);
if (columName.equals("") || tableName.equals("") if ("".equals(columName) || "".equals(tableName)
|| keyColumName.equals("") || fieldValue.equals("")) { || "".equals(keyColumName) || "".equals(fieldValue)) {
new BaseBean().writeLog("GET FIELD ERR: fieldType=" + fieldType); new BaseBean().writeLog("GET FIELD ERR: fieldType=" + fieldType);
} else { } else {
sql = "select " + columName + " from " + tableName sql = "select " + columName + " from " + tableName
@ -291,7 +293,7 @@ public class FieldDefinedValueUtil {
showName = new StringBuilder(showName.substring(0, showName.length() - 1)); showName = new StringBuilder(showName.substring(0, showName.length() - 1));
} }
} else if (fieldHtmlType == 4) { // check框 } else if (fieldHtmlType == 4) { // check框
if (fieldValue.equals("1")) { if ("1".equals(fieldValue)) {
showName.append("√"); showName.append("√");
} }
} else if (fieldHtmlType == 5) { } else if (fieldHtmlType == 5) {

@ -10,7 +10,6 @@ import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.job.JobMapper; import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.util.List; import java.util.List;
@ -63,25 +62,13 @@ public class EcHrmRelationUtil {
* @return * @return
*/ */
public static String getEcDepartmentId(String departmentId) { public static String getEcDepartmentId(String departmentId) {
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(Long.parseLong(departmentId)); DepartmentPO departmentPO = getDepartmentMapper().getDeptById(Integer.parseInt(departmentId));
RecordInfo supDepartment = getSystemDataMapper().getHrmObjectByUUID(HRM_DEPARTMENT, departmentPO.getUuid()); RecordInfo supDepartment = getSystemDataMapper().getHrmObjectByUUID(HRM_DEPARTMENT, departmentPO.getUuid());
return supDepartment.getId(); return supDepartment.getId();
} }
public static DepartmentPO getJclDepartmentId(String ecDepartmentId) {
if (StringUtils.isBlank(ecDepartmentId)) {
return null;
}
RecordInfo ecDepartment = getSystemDataMapper().getHrmObjectByID(HRM_DEPARTMENT, ecDepartmentId);
if (null == ecDepartment) {
return null;
}
String uuid = ecDepartment.getUuid();
return getDepartmentMapper().getDepartmentByUUID(uuid);
}
public static String getEcJobId(Long jclJobId) { public static String getEcJobId(Long jclJobId) {
JobPO jobById = getJobMapper().getJobById(jclJobId); JobPO jobById = getJobMapper().getJobById(jclJobId);
if (null == jobById) { if (null == jobById) {

@ -83,7 +83,9 @@ public class ResourceSyncUtil {
} }
String loginid = Util.null2String(params.get("loginid")); String loginid = Util.null2String(params.get("loginid"));
String accounttype = Util.null2s(Util.fromScreen3(Util.null2String(params.get(("accounttype"))), user.getLanguage()), "0"); String accounttype = Util.null2s(Util.fromScreen3(Util.null2String(params.get(("accounttype"))), user.getLanguage()), "0");
if (accounttype.equals("1")) loginid = "";//次账号没有loginid if ("1".equals(accounttype)) {
loginid = "";//次账号没有loginid
}
boolean canSave = false; boolean canSave = false;
LN LN = new LN(); LN LN = new LN();
int ckHrmnum = LN.CkHrmnum(); int ckHrmnum = LN.CkHrmnum();
@ -101,7 +103,7 @@ public class ResourceSyncUtil {
} }
if (!loginid.equals("") && "0".equals(accounttype)) { if (!"".equals(loginid) && "0".equals(accounttype)) {
sql = "select count(1) from hrmresourceallview where loginid='" + loginid + "' "; sql = "select count(1) from hrmresourceallview where loginid='" + loginid + "' ";
rs.execute(sql); rs.execute(sql);
if (rs.next()) { if (rs.next()) {
@ -115,7 +117,7 @@ public class ResourceSyncUtil {
String departmentid = Util.null2String(params.get("departmentid")); String departmentid = Util.null2String(params.get("departmentid"));
String subcompanyid = departmentComInfo.getSubcompanyid1(departmentid); String subcompanyid = departmentComInfo.getSubcompanyid1(departmentid);
if (!loginid.equals("") && !subcompanyid.equals("0") && new HrmResourceManager().noMore(subcompanyid)) { if (!"".equals(loginid) && !"0".equals(subcompanyid) && new HrmResourceManager().noMore(subcompanyid)) {
retmap.put("status", "-1"); retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(81926, user.getLanguage())); retmap.put("message", SystemEnv.getHtmlLabelName(81926, user.getLanguage()));
return retmap; return retmap;
@ -148,14 +150,14 @@ public class ResourceSyncUtil {
//【初始密码】 //【初始密码】
String defaultPassword = Util.null2String(settings.getDefaultPassword()); String defaultPassword = Util.null2String(settings.getDefaultPassword());
//如果管理员设置的密码为空。并且开启了【启用初始密码】,且初始密码不为空,则默认取初始密码作为密码 //如果管理员设置的密码为空。并且开启了【启用初始密码】,且初始密码不为空,则默认取初始密码作为密码
if (password.equals("") && defaultPasswordEnable.equals("1") && !defaultPassword.equals("")) { if ("".equals(password) && "1".equals(defaultPasswordEnable) && !"".equals(defaultPassword)) {
password = defaultPassword; password = defaultPassword;
} }
//判断是否开启了【禁止弱密码保存】 //判断是否开启了【禁止弱密码保存】
String weakPasswordDisable = Util.null2s(settings.getWeakPasswordDisable(), "0"); String weakPasswordDisable = Util.null2s(settings.getWeakPasswordDisable(), "0");
if (weakPasswordDisable.equals("1")) { if ("1".equals(weakPasswordDisable)) {
if (!password.equals("")) {//密码为空的情况 if (!"".equals(password)) {//密码为空的情况
//判断是否为弱密码 //判断是否为弱密码
HrmWeakPasswordUtil hrmWeakPasswordUtil = new HrmWeakPasswordUtil(); HrmWeakPasswordUtil hrmWeakPasswordUtil = new HrmWeakPasswordUtil();
if (hrmWeakPasswordUtil.isWeakPsd(password)) { if (hrmWeakPasswordUtil.isWeakPsd(password)) {
@ -186,8 +188,10 @@ public class ResourceSyncUtil {
String workstartdate = Util.null2String(params.get("workstartdate"));//参加工作日期 String workstartdate = Util.null2String(params.get("workstartdate"));//参加工作日期
String companystartdate = Util.null2String(params.get("companystartdate"));//入职日期 String companystartdate = Util.null2String(params.get("companystartdate"));//入职日期
String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage()); String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
if (dsporder.length() == 0) dsporder = "" + id; if (dsporder.length() == 0) {
if (accounttype.equals("0")) { dsporder = "" + id;
}
if ("0".equals(accounttype)) {
String encrptPassword = ""; String encrptPassword = "";
String salt = ""; String salt = "";
@ -224,8 +228,8 @@ public class ResourceSyncUtil {
//OA与第三方接口单条数据同步方法结束 //OA与第三方接口单条数据同步方法结束
//BBS集成相关 //BBS集成相关
String bbsLingUrl = new weaver.general.BaseBean().getPropValue(GCONST.getConfigFile(), "ecologybbs.linkUrl"); String bbsLingUrl = new weaver.general.BaseBean().getPropValue(GCONST.getConfigFile(), "ecologybbs.linkUrl");
if (!password.equals("0")) { if (!"0".equals(password)) {
if (!bbsLingUrl.equals("")) { if (!"".equals(bbsLingUrl)) {
new Thread(new weaver.bbs.BBSRunnable(loginid, password)).start(); new Thread(new weaver.bbs.BBSRunnable(loginid, password)).start();
} }
} }
@ -283,7 +287,9 @@ public class ResourceSyncUtil {
String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage()); String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage()); String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage());
String systemlanguage = Util.null2String(params.get("systemlanguage")); String systemlanguage = Util.null2String(params.get("systemlanguage"));
if (systemlanguage.equals("") || systemlanguage.equals("0")) systemlanguage = "7"; if ("".equals(systemlanguage) || "0".equals(systemlanguage)) {
systemlanguage = "7";
}
String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage()); String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage());
//应聘人员id //应聘人员id
String rcid = Util.null2String(params.get("rcId")); String rcid = Util.null2String(params.get("rcId"));
@ -305,8 +311,10 @@ public class ResourceSyncUtil {
} }
if (dsporder.length() == 0) dsporder = id; if (dsporder.length() == 0) {
if (accounttype.equals("0")) { dsporder = id;
}
if ("0".equals(accounttype)) {
belongto = "-1"; belongto = "-1";
} }
String departmentvirtualids = Util.null2String(params.get("departmentvirtualids"));//虚拟部门id; String departmentvirtualids = Util.null2String(params.get("departmentvirtualids"));//虚拟部门id;
@ -314,12 +322,12 @@ public class ResourceSyncUtil {
//Td9325,解决多账号次账号没有登陆Id在浏览框组织结构中无法显示的问题。 //Td9325,解决多账号次账号没有登陆Id在浏览框组织结构中无法显示的问题。
boolean falg = false; boolean falg = false;
String loginid = ""; String loginid = "";
if (accounttype.equals("1")) { if ("1".equals(accounttype)) {
rs.execute("select loginid from HrmResource where id =" + belongto); rs.execute("select loginid from HrmResource where id =" + belongto);
if (rs.next()) { if (rs.next()) {
loginid = rs.getString("loginid"); loginid = rs.getString("loginid");
} }
if (!loginid.equals("")) { if (!"".equals(loginid)) {
String maxidsql = "select max(id) as id from HrmResource where loginid like '" + loginid + "%'"; String maxidsql = "select max(id) as id from HrmResource where loginid like '" + loginid + "%'";
rs.execute(maxidsql); rs.execute(maxidsql);
if (rs.next()) { if (rs.next()) {
@ -356,8 +364,12 @@ public class ResourceSyncUtil {
while (rs.next()) { while (rs.next()) {
String tmp_managerstr = rs.getString("managerstr"); String tmp_managerstr = rs.getString("managerstr");
//处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin //处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!tmp_managerstr.startsWith(",")) tmp_managerstr = "," + tmp_managerstr; if (!tmp_managerstr.startsWith(",")) {
if (!tmp_managerstr.endsWith(",")) tmp_managerstr = tmp_managerstr + ","; tmp_managerstr = "," + tmp_managerstr;
}
if (!tmp_managerstr.endsWith(",")) {
tmp_managerstr = tmp_managerstr + ",";
}
//处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end //处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
managerstr += tmp_managerstr; managerstr += tmp_managerstr;
managerstr = "," + managerid + managerstr; managerstr = "," + managerid + managerstr;
@ -368,17 +380,37 @@ public class ResourceSyncUtil {
RecordSetTrans rst = new RecordSetTrans(); RecordSetTrans rst = new RecordSetTrans();
rst.setAutoCommit(false); rst.setAutoCommit(false);
try { try {
if (resourceimageid.length() == 0) resourceimageid = "null"; if (resourceimageid.length() == 0) {
if (costcenterid.length() == 0) costcenterid = "null"; resourceimageid = "null";
if (managerid.length() == 0) managerid = "null"; }
if (assistantid.length() == 0) assistantid = "null"; if (costcenterid.length() == 0) {
if (accounttype.length() == 0) accounttype = "null"; costcenterid = "null";
if (belongto.length() == 0) belongto = "null"; }
if (jobcall.length() == 0) jobcall = "null"; if (managerid.length() == 0) {
if (mobileshowtype.length() == 0) mobileshowtype = "null"; managerid = "null";
if (rst.getDBType().equalsIgnoreCase("postgresql")) { }
if (joblevel.length() == 0) joblevel = null; if (assistantid.length() == 0) {
if (dsporder.length() == 0) dsporder = null; assistantid = "null";
}
if (accounttype.length() == 0) {
accounttype = "null";
}
if (belongto.length() == 0) {
belongto = "null";
}
if (jobcall.length() == 0) {
jobcall = "null";
}
if (mobileshowtype.length() == 0) {
mobileshowtype = "null";
}
if ("postgresql".equalsIgnoreCase(rst.getDBType())) {
if (joblevel.length() == 0) {
joblevel = null;
}
if (dsporder.length() == 0) {
dsporder = null;
}
} }
workcode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.USER, subcmpanyid1, departmentid, jobtitle, workcode); workcode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.USER, subcmpanyid1, departmentid, jobtitle, workcode);
para = new StringBuilder("" + id + separator + workcode + separator + lastname + separator + sex + separator + resourceimageid + separator + para = new StringBuilder("" + id + separator + workcode + separator + lastname + separator + sex + separator + resourceimageid + separator +
@ -420,7 +452,9 @@ public class ResourceSyncUtil {
para = new StringBuilder("" + id); para = new StringBuilder("" + id);
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
int idx = i; int idx = i;
if (formdefined) idx++; if (formdefined) {
idx++;
}
String datefield = Util.null2String(params.get("datefield" + idx)); String datefield = Util.null2String(params.get("datefield" + idx));
String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0); String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0);
String textfield = Util.null2String(params.get("textfield" + idx)); String textfield = Util.null2String(params.get("textfield" + idx));
@ -443,7 +477,7 @@ public class ResourceSyncUtil {
for (Map.Entry<String, String> me : mapShowSets.entrySet()) { for (Map.Entry<String, String> me : mapShowSets.entrySet()) {
String fieldName = me.getKey(); String fieldName = me.getKey();
String fieldVal = Util.null2String(mapShowSets.get(fieldName)); String fieldVal = Util.null2String(mapShowSets.get(fieldName));
if (fieldVal.equals("1")) { if ("1".equals(fieldVal)) {
String tmpPK = id + "__" + fieldName; String tmpPK = id + "__" + fieldName;
String tmpPvalue = Util.null2String(params.get(fieldName + "showtype")); String tmpPvalue = Util.null2String(params.get(fieldName + "showtype"));
insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')"; insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')";
@ -483,7 +517,7 @@ public class ResourceSyncUtil {
Subject += ":" + lastname; Subject += ":" + lastname;
//modifier by lvyi 2013-12-31 //modifier by lvyi 2013-12-31
if (settings.getEntervalid().equals("1")) {//入职提醒 if ("1".equals(settings.getEntervalid())) {//入职提醒
String thesql = "select hrmids from HrmInfoMaintenance where id<4 or id = 10"; String thesql = "select hrmids from HrmInfoMaintenance where id<4 or id = 10";
rs.execute(thesql); rs.execute(thesql);
StringBuilder members = new StringBuilder(); StringBuilder members = new StringBuilder();
@ -493,7 +527,7 @@ public class ResourceSyncUtil {
members.append(",").append(rs.getString("hrmids")); members.append(",").append(rs.getString("hrmids"));
} }
} }
if (!members.toString().equals("")) { if (!"".equals(members.toString())) {
members = new StringBuilder(members.substring(1)); members = new StringBuilder(members.substring(1));
members = new StringBuilder(new HrmResourceBaseService().duplicateRemoval(members.toString(), user.getUID() + "")); members = new StringBuilder(new HrmResourceBaseService().duplicateRemoval(members.toString(), user.getUID() + ""));
SWFAccepter = members.toString(); SWFAccepter = members.toString();
@ -531,9 +565,13 @@ public class ResourceSyncUtil {
String healthinfo = Util.null2String(rs.getString("healthinfo")); String healthinfo = Util.null2String(rs.getString("healthinfo"));
String height = Util.null2String(rs.getString("height")); String height = Util.null2String(rs.getString("height"));
if (height.contains(".")) height = height.substring(0, height.indexOf(".")); if (height.contains(".")) {
height = height.substring(0, height.indexOf("."));
}
String weight = Util.null2String(rs.getString("weight")); String weight = Util.null2String(rs.getString("weight"));
if (weight.contains(".")) weight = weight.substring(0, weight.indexOf(".")); if (weight.contains(".")) {
weight = weight.substring(0, weight.indexOf("."));
}
String residentplace = Util.null2String(rs.getString("residentplace")); String residentplace = Util.null2String(rs.getString("residentplace"));
String homeaddress = Util.null2String(rs.getString("homeaddress")); String homeaddress = Util.null2String(rs.getString("homeaddress"));
@ -555,7 +593,9 @@ public class ResourceSyncUtil {
rs.execute(" select count(*) from HrmResourceVirtual where departmentid ='" + s + "' and resourceid = " + id); rs.execute(" select count(*) from HrmResourceVirtual where departmentid ='" + s + "' and resourceid = " + id);
if (rs.next()) { if (rs.next()) {
//如果已存在 无需处理 //如果已存在 无需处理
if (rs.getInt(1) > 0) continue; if (rs.getInt(1) > 0) {
continue;
}
} }
//写入 //写入
@ -630,7 +670,9 @@ public class ResourceSyncUtil {
resourceimageid = ServiceUtil.saveResourceImage(resourceimageBase64); resourceimageid = ServiceUtil.saveResourceImage(resourceimageBase64);
} }
String oldresourceimageid = Util.null2String(params.get("oldresourceimage")); String oldresourceimageid = Util.null2String(params.get("oldresourceimage"));
if (resourceimageid.equals("")) resourceimageid = oldresourceimageid; if ("".equals(resourceimageid)) {
resourceimageid = oldresourceimageid;
}
String departmentid = Util.fromScreen3(Util.null2String(params.get("departmentid")), user.getLanguage()); String departmentid = Util.fromScreen3(Util.null2String(params.get("departmentid")), user.getLanguage());
String costcenterid = Util.fromScreen3(Util.null2String(params.get("costcenterid")), user.getLanguage()); String costcenterid = Util.fromScreen3(Util.null2String(params.get("costcenterid")), user.getLanguage());
String jobtitle = Util.fromScreen3(Util.null2String(params.get("jobtitle")), user.getLanguage()); String jobtitle = Util.fromScreen3(Util.null2String(params.get("jobtitle")), user.getLanguage());
@ -650,13 +692,15 @@ public class ResourceSyncUtil {
String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage()); String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
String jobcall = Util.fromScreen3(Util.null2String(params.get("jobcall")), user.getLanguage()); String jobcall = Util.fromScreen3(Util.null2String(params.get("jobcall")), user.getLanguage());
String systemlanguage = Util.fromScreen3(Util.null2String(params.get("systemlanguage")), user.getLanguage()); String systemlanguage = Util.fromScreen3(Util.null2String(params.get("systemlanguage")), user.getLanguage());
if (systemlanguage.equals("") || systemlanguage.equals("0")) { if ("".equals(systemlanguage) || "0".equals(systemlanguage)) {
systemlanguage = "7"; systemlanguage = "7";
} }
String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage()); String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage());
String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage()); String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage());
if (dsporder.length() == 0) dsporder = id; if (dsporder.length() == 0) {
if (accounttype.equals("0")) { dsporder = id;
}
if ("0".equals(accounttype)) {
belongto = "-1"; belongto = "-1";
} }
@ -707,18 +751,18 @@ public class ResourceSyncUtil {
} }
String thisAccounttype = rs.getString("accounttype"); String thisAccounttype = rs.getString("accounttype");
if (thisAccounttype.equals("1") && accounttype.equals("0")) { if ("1".equals(thisAccounttype) && "0".equals(accounttype)) {
oldbelongto = rs.getString("belongto"); oldbelongto = rs.getString("belongto");
} }
} }
if (accounttype.equals("1") && loginid.equalsIgnoreCase("")) { if ("1".equals(accounttype) && "".equalsIgnoreCase(loginid)) {
rs.execute("select loginid from HrmResource where id =" + belongto); rs.execute("select loginid from HrmResource where id =" + belongto);
if (rs.next()) { if (rs.next()) {
loginid = rs.getString(1); loginid = rs.getString(1);
} }
if (!loginid.equals("")) { if (!"".equals(loginid)) {
loginid = loginid + (id + 1); loginid = loginid + (id + 1);
falg = true; falg = true;
} }
@ -731,19 +775,39 @@ public class ResourceSyncUtil {
oldmanagerid = rs.getString("managerid"); oldmanagerid = rs.getString("managerid");
oldmanagerstr = rs.getString("managerstr"); oldmanagerstr = rs.getString("managerstr");
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!oldmanagerstr.startsWith(",")) oldmanagerstr = "," + oldmanagerstr; if (!oldmanagerstr.startsWith(",")) {
if (!oldmanagerstr.endsWith(",")) oldmanagerstr = oldmanagerstr + ","; oldmanagerstr = "," + oldmanagerstr;
}
if (!oldmanagerstr.endsWith(",")) {
oldmanagerstr = oldmanagerstr + ",";
}
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
} }
//mysql报错问题java.sql.SQLException: Incorrect integer value: '' for column 'COSTCENTERID' at row 1 //mysql报错问题java.sql.SQLException: Incorrect integer value: '' for column 'COSTCENTERID' at row 1
if(resourceimageid.length()==0)resourceimageid="null"; if(resourceimageid.length()==0) {
if(costcenterid.length()==0)costcenterid="null"; resourceimageid="null";
if(managerid.length()==0)managerid="null"; }
if(assistantid.length()==0)assistantid="null"; if(costcenterid.length()==0) {
if(accounttype.length()==0)accounttype="null"; costcenterid="null";
if(belongto.length()==0)belongto="null"; }
if(jobcall.length()==0)jobcall="null"; if(managerid.length()==0) {
if(mobileshowtype.length()==0)mobileshowtype="null"; managerid="null";
}
if(assistantid.length()==0) {
assistantid="null";
}
if(accounttype.length()==0) {
accounttype="null";
}
if(belongto.length()==0) {
belongto="null";
}
if(jobcall.length()==0) {
jobcall="null";
}
if(mobileshowtype.length()==0) {
mobileshowtype="null";
}
if (StringUtils.isNotEmpty(workcode)) { if (StringUtils.isNotEmpty(workcode)) {
CodeRuleManager.getCodeRuleManager().checkReservedIfDel(RuleCodeType.USER.getValue(), workcode); CodeRuleManager.getCodeRuleManager().checkReservedIfDel(RuleCodeType.USER.getValue(), workcode);
@ -792,7 +856,7 @@ public class ResourceSyncUtil {
for (Map.Entry<String, String> me : mapShowSets.entrySet()) { for (Map.Entry<String, String> me : mapShowSets.entrySet()) {
String fieldName = me.getKey(); String fieldName = me.getKey();
String fieldVal = Util.null2String(mapShowSets.get(fieldName)); String fieldVal = Util.null2String(mapShowSets.get(fieldName));
if (fieldVal.equals("1")) { if ("1".equals(fieldVal)) {
String tmpPK = id + "__" + fieldName; String tmpPK = id + "__" + fieldName;
String tmpPvalue = Util.null2String(params.get(fieldName + "showtype")); String tmpPvalue = Util.null2String(params.get(fieldName + "showtype"));
insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')"; insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')";
@ -814,8 +878,12 @@ public class ResourceSyncUtil {
while (rs.next()) { while (rs.next()) {
managerstr = rs.getString("managerstr"); managerstr = rs.getString("managerstr");
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!managerstr.startsWith(",")) managerstr = "," + managerstr; if (!managerstr.startsWith(",")) {
if (!managerstr.endsWith(",")) managerstr = managerstr + ","; managerstr = "," + managerstr;
}
if (!managerstr.endsWith(",")) {
managerstr = managerstr + ",";
}
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
managerstr = "," + managerid + managerstr; managerstr = "," + managerid + managerstr;
managerstr = managerstr.endsWith(",") ? managerstr : (managerstr + ","); managerstr = managerstr.endsWith(",") ? managerstr : (managerstr + ",");
@ -845,13 +913,18 @@ public class ResourceSyncUtil {
while (rs.next()) { while (rs.next()) {
String nowmanagerstr = Util.null2String(rs.getString("managerstr")); String nowmanagerstr = Util.null2String(rs.getString("managerstr"));
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!nowmanagerstr.startsWith(",")) nowmanagerstr = "," + nowmanagerstr; if (!nowmanagerstr.startsWith(",")) {
if (!nowmanagerstr.endsWith(",")) nowmanagerstr = nowmanagerstr + ","; nowmanagerstr = "," + nowmanagerstr;
}
if (!nowmanagerstr.endsWith(",")) {
nowmanagerstr = nowmanagerstr + ",";
}
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end // 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
String resourceid = rs.getString("id"); String resourceid = rs.getString("id");
//指定上级为自身的情况,不更新自身上级 //指定上级为自身的情况,不更新自身上级
if (id.equals(resourceid)) if (id.equals(resourceid)) {
continue; continue;
}
String nowmanagerstr2 = ""; String nowmanagerstr2 = "";
int index = nowmanagerstr.lastIndexOf(oldmanagerstr); int index = nowmanagerstr.lastIndexOf(oldmanagerstr);
if (index != -1) { if (index != -1) {
@ -902,7 +975,9 @@ public class ResourceSyncUtil {
para = new StringBuilder("" + id); para = new StringBuilder("" + id);
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
int idx = i; int idx = i;
if (formdefined) idx++; if (formdefined) {
idx++;
}
String datefield = Util.null2String(params.get("datefield" + idx)); String datefield = Util.null2String(params.get("datefield" + idx));
String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0); String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0);
String textfield = Util.null2String(params.get("textfield" + idx)); String textfield = Util.null2String(params.get("textfield" + idx));
@ -926,10 +1001,10 @@ public class ResourceSyncUtil {
//处理次账号修改为主账号时,检查次账号所属 主账号的 其他设置是否需要修改 add by kzw QC159888 //处理次账号修改为主账号时,检查次账号所属 主账号的 其他设置是否需要修改 add by kzw QC159888
try { try {
if (!oldbelongto.equals("")) { if (!"".equals(oldbelongto)) {
HrmUserSettingComInfo userSetting = new HrmUserSettingComInfo(); HrmUserSettingComInfo userSetting = new HrmUserSettingComInfo();
String belongtoshow = userSetting.getBelongtoshowByUserId(oldbelongto); String belongtoshow = userSetting.getBelongtoshowByUserId(oldbelongto);
if (belongtoshow.equals("1")) { if ("1".equals(belongtoshow)) {
rs.execute("select id from hrmresource where belongto = " + oldbelongto); rs.execute("select id from hrmresource where belongto = " + oldbelongto);
if (!rs.next()) { if (!rs.next()) {
String setId = userSetting.getId(oldbelongto); String setId = userSetting.getId(oldbelongto);

@ -134,8 +134,9 @@ public class OrgImportUtil {
*/ */
public static String getCellValue(XSSFCell cell) { public static String getCellValue(XSSFCell cell) {
String cellValue = ""; String cellValue = "";
if (cell == null) if (cell == null) {
return ""; return "";
}
switch (cell.getCellType()) { switch (cell.getCellType()) {
case BOOLEAN: // 得到Boolean对象的方法 case BOOLEAN: // 得到Boolean对象的方法
cellValue = String.valueOf(cell.getBooleanCellValue()); cellValue = String.valueOf(cell.getBooleanCellValue());
@ -146,9 +147,10 @@ public class OrgImportUtil {
cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式 cellValue = sft.format(cell.getDateCellValue()); // 读取日期格式
} else { } else {
cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字 cellValue = String.valueOf(new Double(cell.getNumericCellValue())); // 读取数字
if (cellValue.endsWith(".0")) if (cellValue.endsWith(".0")) {
cellValue = cellValue.substring(0, cellValue.indexOf(".")); cellValue = cellValue.substring(0, cellValue.indexOf("."));
} }
}
break; break;
case FORMULA: // 读取公式 case FORMULA: // 读取公式
cellValue = cell.getCellFormula(); cellValue = cell.getCellFormula();

@ -83,8 +83,8 @@ public class StaffInfoImportUtil {
} }
// 组装待处理数据 // 组装待处理数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long parentCompanyId = null; Integer parentCompanyId = null;
Long parentDepartmentId = null; Integer parentDepartmentId = null;
Long parentJobId = null; Long parentJobId = null;
StaffPlanPO staffPlanPO = null; StaffPlanPO staffPlanPO = null;
@ -151,7 +151,7 @@ public class StaffInfoImportUtil {
continue nextRow; continue nextRow;
} }
for (String s : split) { for (String s : split) {
parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId.intValue()); parentCompanyId = MapperProxyFactory.getProxy(CompanyMapper.class).getIdByNameAndPid(s, parentCompanyId == null ? 0 : parentCompanyId);
if (null == parentCompanyId) { if (null == parentCompanyId) {
historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据"); historyDetailPO.setOperateDetail(cellValue + "分部未找到对应数据");
historyDetailPO.setStatus("0"); historyDetailPO.setStatus("0");
@ -261,8 +261,8 @@ public class StaffInfoImportUtil {
if (null == deptById) { if (null == deptById) {
checkMsg = "未找到对应部门!"; checkMsg = "未找到对应部门!";
} else { } else {
param.setCompId(deptById.getParentComp()); param.setCompId(deptById.getSubCompanyId1());
param.setEcCompany(deptById.getEcCompany()); param.setEcCompany(deptById.getSubCompanyId1());
} }
} }
// 取消岗位赋值 // 取消岗位赋值

@ -262,13 +262,13 @@ public class HrmImportProcessE9 extends BaseBean {
RemindSettings settings = reminder.getRemindSettings(); RemindSettings settings = reminder.getRemindSettings();
//判断是否启用【启用初始密码】 //判断是否启用【启用初始密码】
//是否启用初始密码false-不启用初始密码、true-启用初始密码 //是否启用初始密码false-不启用初始密码、true-启用初始密码
boolean defaultPasswordEnable = Util.null2String(settings.getDefaultPasswordEnable()).equals("1"); boolean defaultPasswordEnable = "1".equals(Util.null2String(settings.getDefaultPasswordEnable()));
//初始密码 //初始密码
//初始密码 //初始密码
String defaultPassword = Util.null2String(settings.getDefaultPassword()); String defaultPassword = Util.null2String(settings.getDefaultPassword());
//判断是否启用【弱密码禁止保存】 //判断是否启用【弱密码禁止保存】
//弱密码禁止保存false-允许保存弱密码、true-不允许保存弱密码 //弱密码禁止保存false-允许保存弱密码、true-不允许保存弱密码
boolean weakPasswordDisable = Util.null2String(settings.getWeakPasswordDisable()).equals("1"); boolean weakPasswordDisable = "1".equals(Util.null2String(settings.getWeakPasswordDisable()));
try { try {
//判断是否为弱密码 //判断是否为弱密码
hrmWeakPasswordUtil = new HrmWeakPasswordUtil(); hrmWeakPasswordUtil = new HrmWeakPasswordUtil();
@ -287,7 +287,7 @@ public class HrmImportProcessE9 extends BaseBean {
//TimeUnit.SECONDS.sleep(1); //TimeUnit.SECONDS.sleep(1);
try { // 异常处理 try { // 异常处理
if (operateType.equals("add")) { if ("add".equals(operateType)) {
if (keyMap.get(key) != null) { if (keyMap.get(key) != null) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83520, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83520, userlanguage)));
@ -398,7 +398,7 @@ public class HrmImportProcessE9 extends BaseBean {
if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) { if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
int belongto = getBelongId(vo.getBelongto(), keyField); int belongto = getBelongId(vo.getBelongto(), keyField);
hrm.setBelongto(belongto); hrm.setBelongto(belongto);
if (!vo.getBelongto().equals("") && belongto == 0) { if (!"".equals(vo.getBelongto()) && belongto == 0) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
continue; continue;
} else { } else {
@ -415,7 +415,7 @@ public class HrmImportProcessE9 extends BaseBean {
} else if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) { } else if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
int belongto = getBelongId(vo.getBelongto(), keyField); int belongto = getBelongId(vo.getBelongto(), keyField);
hrm.setBelongto(belongto); hrm.setBelongto(belongto);
if (!vo.getBelongto().equals("") && belongto == 0) { if (!"".equals(vo.getBelongto()) && belongto == 0) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
continue; continue;
} else { } else {
@ -463,7 +463,7 @@ public class HrmImportProcessE9 extends BaseBean {
hrm.setManagerstr(managerstr); hrm.setManagerstr(managerstr);
//如果vo.getManagerid()有值但manageid未找到说明填写有误 //如果vo.getManagerid()有值但manageid未找到说明填写有误
if (!vo.getManagerid().equals("") && managerid == 0) { if (!"".equals(vo.getManagerid()) && managerid == 0) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage)));
continue; continue;
} }
@ -478,7 +478,7 @@ public class HrmImportProcessE9 extends BaseBean {
int assistantid; int assistantid;
assistantid = getAssistantid(vo.getAssistantid(), keyField); assistantid = getAssistantid(vo.getAssistantid(), keyField);
hrm.setAssistantid(assistantid); hrm.setAssistantid(assistantid);
if (!vo.getAssistantid().equals("") && assistantid == 0) { if (!"".equals(vo.getAssistantid()) && assistantid == 0) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage)));
continue; continue;
} }
@ -513,10 +513,12 @@ public class HrmImportProcessE9 extends BaseBean {
//mobile-sunjsh //mobile-sunjsh
if (vo.getMobile() != null) { if (vo.getMobile() != null) {
if ("".equals(vo.getMobile().trim()) || (!"".equals(vo.getMobile().trim()) && vo.getMobile().contains("*"))) if ("".equals(vo.getMobile().trim()) || (!"".equals(vo.getMobile().trim()) && vo.getMobile().contains("*"))) {
vo.setMobile(null); vo.setMobile(null);
} else }
} else {
hrm.setMobile(""); hrm.setMobile("");
}
//工资银行-sunjsh //工资银行-sunjsh
if (vo.getBankid1() != null && !"".equals(vo.getBankid1())) { if (vo.getBankid1() != null && !"".equals(vo.getBankid1())) {
@ -621,7 +623,7 @@ public class HrmImportProcessE9 extends BaseBean {
continue; continue;
} }
//安全级别必须是数字 //安全级别必须是数字
if (!Util.null2String(vo.getSeclevel()).equals("")) { if (!"".equals(Util.null2String(vo.getSeclevel()))) {
if (Util.getIntValue(vo.getSeclevel(), -1000) == -1000) { if (Util.getIntValue(vo.getSeclevel(), -1000) == -1000) {
resultList.add(createLog(vo, "创建", "失败", "安全级别必须是数字")); resultList.add(createLog(vo, "创建", "失败", "安全级别必须是数字"));
continue; continue;
@ -678,7 +680,7 @@ public class HrmImportProcessE9 extends BaseBean {
password_tmp = "1"; password_tmp = "1";
//人员导入文件中,将密码这一列删除或者密码这一列存在,但是不填写都默认为初始密码 //人员导入文件中,将密码这一列删除或者密码这一列存在,但是不填写都默认为初始密码
if (defaultPasswordEnable) { if (defaultPasswordEnable) {
if (!defaultPassword.equals("")) { if (!"".equals(defaultPassword)) {
if (weakPasswordDisable && this.hrmWeakPasswordUtil.isWeakPsd(defaultPassword)) { if (weakPasswordDisable && this.hrmWeakPasswordUtil.isWeakPsd(defaultPassword)) {
resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(515436, userlanguage))); resultList.add(createLog(vo, "创建", "失败", SystemEnv.getHtmlLabelName(515436, userlanguage)));
continue; continue;
@ -728,7 +730,7 @@ public class HrmImportProcessE9 extends BaseBean {
} else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) { } else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) {
insertFields.append(s).append(","); insertFields.append(s).append(",");
String insertValueStr = Util.null2String(hrmField.get(hrm)); String insertValueStr = Util.null2String(hrmField.get(hrm));
if ("".equals(insertValueStr) && recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("".equals(insertValueStr) && "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
insertValues.append("null,"); insertValues.append("null,");
} else { } else {
insertValues.append(hrmField.get(hrm)).append(","); insertValues.append(hrmField.get(hrm)).append(",");
@ -736,8 +738,8 @@ public class HrmImportProcessE9 extends BaseBean {
} }
} else if (voField.get(vo) != null) { } else if (voField.get(vo) != null) {
if (voFieldType.endsWith("String")) { if (voFieldType.endsWith("String")) {
if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("mysql".equalsIgnoreCase(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
if (Util.null2String(voField.get(vo)).equals("")) { if ("".equals(Util.null2String(voField.get(vo)))) {
insertFields.append(s).append(","); insertFields.append(s).append(",");
insertValues.append("null,"); insertValues.append("null,");
} else { } else {
@ -751,7 +753,7 @@ public class HrmImportProcessE9 extends BaseBean {
} else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) { } else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) {
insertFields.append(s).append(","); insertFields.append(s).append(",");
String insertValueStr = Util.null2String(voField.get(vo)); String insertValueStr = Util.null2String(voField.get(vo));
if ("".equals(insertValueStr) && recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("".equals(insertValueStr) && "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
insertValues.append("null,"); insertValues.append("null,");
} else { } else {
insertValues.append(voField.get(vo)).append(","); insertValues.append(voField.get(vo)).append(",");
@ -775,12 +777,18 @@ public class HrmImportProcessE9 extends BaseBean {
PasswordUtil.updateResourceSalt(id + "", salt); PasswordUtil.updateResourceSalt(id + "", salt);
if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue(), id)) //添加基础字段信息 if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue(), id)) //添加基础字段信息
{
flag = false; flag = false;
}
if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue(), id)) //添加个人字段信息 if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue(), id)) //添加个人字段信息
{
flag = false; flag = false;
}
if (updateWorkData(vo.getWorkFields(), vo.getWorkFieldsValue(), id)) //添加工作字段信息 if (updateWorkData(vo.getWorkFields(), vo.getWorkFieldsValue(), id)) //添加工作字段信息
{
flag = false; flag = false;
} }
}
/*添加人员缓存人员默认按id显示顺序,HrmResource_Trigger_Insert 人员共享 入职维护项目状态*/ /*添加人员缓存人员默认按id显示顺序,HrmResource_Trigger_Insert 人员共享 入职维护项目状态*/
if (flag) { if (flag) {
@ -942,7 +950,7 @@ public class HrmImportProcessE9 extends BaseBean {
if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) { if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
int belongto = getBelongId(vo.getBelongto(), keyField); int belongto = getBelongId(vo.getBelongto(), keyField);
hrm.setBelongto(belongto); hrm.setBelongto(belongto);
if (!vo.getBelongto().equals("") && belongto == 0) { if (!"".equals(vo.getBelongto()) && belongto == 0) {
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
continue; continue;
} else { } else {
@ -959,7 +967,7 @@ public class HrmImportProcessE9 extends BaseBean {
} else if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) { } else if (vo.getBelongto() != null && !"".equals(vo.getBelongto().trim())) {
int belongto = getBelongId(vo.getBelongto(), keyField); int belongto = getBelongId(vo.getBelongto(), keyField);
hrm.setBelongto(belongto); hrm.setBelongto(belongto);
if (!vo.getBelongto().equals("") && belongto == 0) { if (!"".equals(vo.getBelongto()) && belongto == 0) {
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage)));
continue; continue;
} else { } else {
@ -1007,7 +1015,9 @@ public class HrmImportProcessE9 extends BaseBean {
//} //}
new BaseBean().writeLog("hrmId【" + hrmId + "】"); new BaseBean().writeLog("hrmId【" + hrmId + "】");
if (Util.getIntValue(hrmId) < 0) continue; if (Util.getIntValue(hrmId) < 0) {
continue;
}
//上级id //上级id
String managerstr = ""; //所有上级 String managerstr = ""; //所有上级
@ -1023,7 +1033,7 @@ public class HrmImportProcessE9 extends BaseBean {
} }
//如果vo.getManagerid()有值但manageid未找到说明填写有误 //如果vo.getManagerid()有值但manageid未找到说明填写有误
if (vo.getManagerid() != null && !vo.getManagerid().equals("") && managerid == 0) { if (vo.getManagerid() != null && !"".equals(vo.getManagerid()) && managerid == 0) {
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage))); resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage)));
continue; continue;
} }
@ -1044,7 +1054,7 @@ public class HrmImportProcessE9 extends BaseBean {
if (!"".equals(Util.null2String(vo.getAssistantid()))) { if (!"".equals(Util.null2String(vo.getAssistantid()))) {
int assistantid; int assistantid;
assistantid = getAssistantid(vo.getAssistantid(), keyField); assistantid = getAssistantid(vo.getAssistantid(), keyField);
if (vo.getAssistantid() != null && !vo.getAssistantid().equals("") && assistantid == 0) { if (vo.getAssistantid() != null && !"".equals(vo.getAssistantid()) && assistantid == 0) {
resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage))); resultList.add(createLog(vo, "更新", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage)));
continue; continue;
} }
@ -1076,11 +1086,12 @@ public class HrmImportProcessE9 extends BaseBean {
//mobile-sunjsh //mobile-sunjsh
if (vo.getMobile() != null) { if (vo.getMobile() != null) {
if ("".equals(vo.getMobile().trim())) if ("".equals(vo.getMobile().trim())) {
hrm.setMobile(""); hrm.setMobile("");
else if (!"".equals(vo.getMobile().trim()) && vo.getMobile().contains("*")) } else if (!"".equals(vo.getMobile().trim()) && vo.getMobile().contains("*")) {
vo.setMobile(null); vo.setMobile(null);
} }
}
//工资银行-sunjsh //工资银行-sunjsh
if (vo.getBankid1() != null && !"".equals(vo.getBankid1())) { if (vo.getBankid1() != null && !"".equals(vo.getBankid1())) {
@ -1138,14 +1149,14 @@ public class HrmImportProcessE9 extends BaseBean {
// 性别为空或其他情况统一为0(男) // 性别为空或其他情况统一为0(男)
if (!"".equals(Util.null2String(vo.getSex()))) { if (!"".equals(Util.null2String(vo.getSex()))) {
String sex = vo.getSex().equals("女") ? "1" : "0"; String sex = "女".equals(vo.getSex()) ? "1" : "0";
hrm.setSex(sex); hrm.setSex(sex);
} }
// 婚姻状况,如果不是以下选项,则默认为未婚 // 婚姻状况,如果不是以下选项,则默认为未婚
if (!"".equals(Util.null2String(vo.getMaritalstatus()))) { if (!"".equals(Util.null2String(vo.getMaritalstatus()))) {
String maritalstatus = vo.getMaritalstatus().equals("已婚") ? "1" String maritalstatus = "已婚".equals(vo.getMaritalstatus()) ? "1"
: vo.getMaritalstatus().equals("离异") ? "2" : "0"; : "离异".equals(vo.getMaritalstatus()) ? "2" : "0";
hrm.setMaritalstatus(maritalstatus); hrm.setMaritalstatus(maritalstatus);
} }
@ -1170,7 +1181,7 @@ public class HrmImportProcessE9 extends BaseBean {
// 工会会员,默认为是 // 工会会员,默认为是
if (!"".equals(Util.null2String(vo.getIslabouunion()))) { if (!"".equals(Util.null2String(vo.getIslabouunion()))) {
String islabouunion = vo.getIslabouunion().equals("是") ? "1" String islabouunion = "是".equals(vo.getIslabouunion()) ? "1"
: "0"; : "0";
hrm.setIslabouunion(islabouunion); hrm.setIslabouunion(islabouunion);
} }
@ -1192,7 +1203,7 @@ public class HrmImportProcessE9 extends BaseBean {
continue; continue;
} }
//安全级别必须是数字 //安全级别必须是数字
if (!Util.null2String(vo.getSeclevel()).equals("")) { if (!"".equals(Util.null2String(vo.getSeclevel()))) {
if (Util.getIntValue(vo.getSeclevel(), -1000) == -1000) { if (Util.getIntValue(vo.getSeclevel(), -1000) == -1000) {
resultList.add(createLog(vo, "更新", "失败", "安全级别必须是数字")); resultList.add(createLog(vo, "更新", "失败", "安全级别必须是数字"));
continue; continue;
@ -1245,7 +1256,9 @@ public class HrmImportProcessE9 extends BaseBean {
if (!"".equals(Util.null2String(vo.getPassword()))) { if (!"".equals(Util.null2String(vo.getPassword()))) {
String orgPwd = "1"; String orgPwd = "1";
if (!"".equals(vo.getPassword())) orgPwd = vo.getPassword(); if (!"".equals(vo.getPassword())) {
orgPwd = vo.getPassword();
}
String[] pwdArr = PasswordUtil.encrypt(orgPwd); String[] pwdArr = PasswordUtil.encrypt(orgPwd);
String salt = pwdArr[1]; String salt = pwdArr[1];
hrm.setPassword(pwdArr[0]); hrm.setPassword(pwdArr[0]);
@ -1274,19 +1287,19 @@ public class HrmImportProcessE9 extends BaseBean {
voField.setAccessible(true); voField.setAccessible(true);
if (Util.null2String(hrmField.get(hrm)).trim().length() > 0) { if (Util.null2String(hrmField.get(hrm)).trim().length() > 0) {
if (hrmFieldType.endsWith("String")) if (hrmFieldType.endsWith("String")) {
updateStr.append(fields[k]).append("='").append(hrmField.get(hrm)).append("',"); updateStr.append(fields[k]).append("='").append(hrmField.get(hrm)).append("',");
else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) { } else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) {
updateStr.append(fields[k]).append("=").append(hrmField.get(hrm)).append(","); updateStr.append(fields[k]).append("=").append(hrmField.get(hrm)).append(",");
} }
if (fields[k].equals("status")) { if ("status".equals(fields[k])) {
tmpstatus = Util.null2String(hrmField.get(hrm)); tmpstatus = Util.null2String(hrmField.get(hrm));
} }
} else if (Util.null2String(voField.get(vo)).trim().length() > 0) { } else if (Util.null2String(voField.get(vo)).trim().length() > 0) {
if (voFieldType.endsWith("String")) { if (voFieldType.endsWith("String")) {
if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("mysql".equalsIgnoreCase(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
if (Util.null2String(voField.get(vo)).equals("")) { if ("".equals(Util.null2String(voField.get(vo)))) {
updateStr.append(fields[k]).append("=null,"); updateStr.append(fields[k]).append("=null,");
} else { } else {
updateStr.append(fields[k]).append("='").append(voField.get(vo)).append("',"); updateStr.append(fields[k]).append("='").append(voField.get(vo)).append("',");
@ -1301,14 +1314,17 @@ public class HrmImportProcessE9 extends BaseBean {
updateStr.append(fields[k]).append("=").append(voField.get(vo)).append(","); updateStr.append(fields[k]).append("=").append(voField.get(vo)).append(",");
} }
} }
if (fields[k].equals("status")) tmpstatus = Util.null2String(voField.get(vo)); if ("status".equals(fields[k])) {
tmpstatus = Util.null2String(voField.get(vo));
}
} }
} }
updateStr.append(" lastmodid=").append(lastmodid).append(",lastmoddate='").append(lastmoddate).append("',managerstr='").append(hrm.getManagerstr()).append("',").append(DbFunctionUtil.getUpdateSetSql(new RecordSet().getDBType(), lastmodid)).append(" where id=").append(keyMap.get(key)); updateStr.append(" lastmodid=").append(lastmodid).append(",lastmoddate='").append(lastmoddate).append("',managerstr='").append(hrm.getManagerstr()).append("',").append(DbFunctionUtil.getUpdateSetSql(new RecordSet().getDBType(), lastmodid)).append(" where id=").append(keyMap.get(key));
if (!execSql(updateStr.toString())) if (!execSql(updateStr.toString())) {
flag = false; flag = false;
}
//同步密码到AD //同步密码到AD
if (flag && !"".equals(Util.null2String(vo.getPassword()))) { if (flag && !"".equals(Util.null2String(vo.getPassword()))) {
@ -1324,7 +1340,7 @@ public class HrmImportProcessE9 extends BaseBean {
String optype = "4"; //1强制修改密码操作。2首次登录密码操作3忘记密码找回。其它系统修改ad操作。 String optype = "4"; //1强制修改密码操作。2首次登录密码操作3忘记密码找回。其它系统修改ad操作。
map.put("optype", optype); map.put("optype", optype);
Map<String, Object> retInfo = new OaSync("", "").modifyADPWDNew(map); Map<String, Object> retInfo = new OaSync("", "").modifyADPWDNew(map);
if (Util.null2String(retInfo.get("code")).equals("0")) { if ("0".equals(Util.null2String(retInfo.get("code")))) {
//更新修改密码时间 //更新修改密码时间
String passwdchgdate = Util.null2String(TimeUtil.getCurrentDateString()); String passwdchgdate = Util.null2String(TimeUtil.getCurrentDateString());
flag = recordSet.executeUpdate("update hrmresource set passwdchgdate=?, haschangepwd='y' where id = ?", passwdchgdate, userid); flag = recordSet.executeUpdate("update hrmresource set passwdchgdate=?, haschangepwd='y' where id = ?", passwdchgdate, userid);
@ -1383,14 +1399,17 @@ public class HrmImportProcessE9 extends BaseBean {
//OA与第三方接口单条数据同步方法结束 //OA与第三方接口单条数据同步方法结束
} }
if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue().trim(), keyMap.get(key))) if (updateBaseData(vo.getBaseFields(), vo.getBaseFieldsValue().trim(), keyMap.get(key))) {
flag = false; flag = false;
}
if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue().trim(), keyMap.get(key))) if (updatePersonData(vo.getPersonFields(), vo.getPersonFieldsValue().trim(), keyMap.get(key))) {
flag = false; flag = false;
}
if (updateWorkData(vo.getWorkFields().trim(), vo.getWorkFieldsValue(), keyMap.get(key))) if (updateWorkData(vo.getWorkFields().trim(), vo.getWorkFieldsValue(), keyMap.get(key))) {
flag = false; flag = false;
}
/*update HrmResource_Trigger */ /*update HrmResource_Trigger */
if (flag) { if (flag) {
@ -1421,8 +1440,9 @@ public class HrmImportProcessE9 extends BaseBean {
String resourceid = recordSet.getString("id"); String resourceid = recordSet.getString("id");
//指定上级为自身的情况,不更新自身上级 //指定上级为自身的情况,不更新自身上级
new BaseBean().writeLog("resourceid【" + resourceid + "】"); new BaseBean().writeLog("resourceid【" + resourceid + "】");
if (hrmId.equals(resourceid)) if (hrmId.equals(resourceid)) {
continue; continue;
}
String nowmanagerstr2 = ""; String nowmanagerstr2 = "";
int index = nowmanagerstr.lastIndexOf(oldmanagerstr); int index = nowmanagerstr.lastIndexOf(oldmanagerstr);
if (index != -1) { if (index != -1) {
@ -1466,7 +1486,7 @@ public class HrmImportProcessE9 extends BaseBean {
if (rst.next()) { if (rst.next()) {
loginid = rst.getString("loginid"); loginid = rst.getString("loginid");
} }
if (loginid != null && !loginid.equals("")) { if (loginid != null && !"".equals(loginid)) {
if (!rtxService.checkUser(Integer.parseInt(hrmId))) { if (!rtxService.checkUser(Integer.parseInt(hrmId))) {
rtxService.addUser(Integer.parseInt(hrmId));//更新人员rtx rtxService.addUser(Integer.parseInt(hrmId));//更新人员rtx
} }
@ -1481,7 +1501,7 @@ public class HrmImportProcessE9 extends BaseBean {
if (rst.next()) { if (rst.next()) {
loginid = rst.getString("loginid"); loginid = rst.getString("loginid");
} }
if (loginid != null && !loginid.equals("")) { if (loginid != null && !"".equals(loginid)) {
if (!rtxService.checkUser(Integer.parseInt(hrmId))) { if (!rtxService.checkUser(Integer.parseInt(hrmId))) {
rtxService.addUser(Integer.parseInt(hrmId));//更新人员rtx rtxService.addUser(Integer.parseInt(hrmId));//更新人员rtx
} }
@ -1536,7 +1556,9 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean addBaseData(String baseFild, String baseValue, int id) { public boolean addBaseData(String baseFild, String baseValue, int id) {
if (baseFild == null || baseFild.equals("")) return true; if (baseFild == null || "".equals(baseFild)) {
return true;
}
String[] baseValues = baseValue.split(";"); String[] baseValues = baseValue.split(";");
String[] baseFields = baseFild.split(","); String[] baseFields = baseFild.split(",");
String fielddbType; String fielddbType;
@ -1587,15 +1609,16 @@ public class HrmImportProcessE9 extends BaseBean {
} }
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) { if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
//是否需要加密 //是否需要加密
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue)); fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
} }
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
valueStr.append(",").append("'").append(!fieldvalue.equals("") ? fieldvalue : "").append("'"); valueStr.append(",").append("'").append(!"".equals(fieldvalue) ? fieldvalue : "").append("'");
else } else {
valueStr.append(",").append(!fieldvalue.equals("") ? fieldvalue : "NULL"); valueStr.append(",").append(!"".equals(fieldvalue) ? fieldvalue : "NULL");
}
} }
valueStr = new StringBuilder(valueStr.substring(1)); valueStr = new StringBuilder(valueStr.substring(1));
sql += "(scope,scopeid,id," + baseFild + ") values('HrmCustomFieldByInfoType'," + -1 + "," + id + "," + valueStr + ")"; sql += "(scope,scopeid,id," + baseFild + ") values('HrmCustomFieldByInfoType'," + -1 + "," + id + "," + valueStr + ")";
@ -1616,7 +1639,9 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean updateBaseData(String baseFild, String baseValue, int id) { public boolean updateBaseData(String baseFild, String baseValue, int id) {
if (baseFild == null || baseFild.equals("")) return false; if (baseFild == null || "".equals(baseFild)) {
return false;
}
//检查cus_fielddata表中是否存在对应id人员的基础自定义信息如果不存在则向数据库添加 //检查cus_fielddata表中是否存在对应id人员的基础自定义信息如果不存在则向数据库添加
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
@ -1676,20 +1701,25 @@ public class HrmImportProcessE9 extends BaseBean {
} }
} }
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) { if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
//是否需要加密 //是否需要加密
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue)); fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
} }
if (fieldvalue.startsWith(",")) fieldvalue = fieldvalue.substring(1); if (fieldvalue.startsWith(",")) {
if (fieldvalue.endsWith(",")) fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1); fieldvalue = fieldvalue.substring(1);
if (!fieldvalue.equals("") || "field100002".equalsIgnoreCase(fieldname)) { }
if (fieldvalue.endsWith(",")) {
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
}
if (!"".equals(fieldvalue) || "field100002".equalsIgnoreCase(fieldname)) {
flag = true; flag = true;
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
setStr.append(",").append(baseFields[i]).append("='").append(fieldvalue).append("'"); setStr.append(",").append(baseFields[i]).append("='").append(fieldvalue).append("'");
else } else {
setStr.append(",").append(baseFields[i]).append("=").append(fieldvalue); setStr.append(",").append(baseFields[i]).append("=").append(fieldvalue);
} }
} }
}
sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=-1 and id=" + id; sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=-1 and id=" + id;
} catch (Exception e) { } catch (Exception e) {
writeLog(e); writeLog(e);
@ -1712,7 +1742,9 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean addPersonData(String personFild, String personValue, int id) { public boolean addPersonData(String personFild, String personValue, int id) {
if (personFild == null || personFild.equals("")) return true; if (personFild == null || "".equals(personFild)) {
return true;
}
String[] personValues = personValue.split(";"); String[] personValues = personValue.split(";");
String[] personFields = personFild.split(","); String[] personFields = personFild.split(",");
String fielddbType; String fielddbType;
@ -1751,14 +1783,15 @@ public class HrmImportProcessE9 extends BaseBean {
jsonObject.put("fieldvalue", personValues[i]); jsonObject.put("fieldvalue", personValues[i]);
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) { if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
//是否需要加密 //是否需要加密
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue)); fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
} }
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
valueStr.append(",").append("'").append(!fieldvalue.equals("") ? fieldvalue : "").append("'"); valueStr.append(",").append("'").append(!"".equals(fieldvalue) ? fieldvalue : "").append("'");
else } else {
valueStr.append(",").append(!fieldvalue.equals("") ? fieldvalue : "NULL"); valueStr.append(",").append(!"".equals(fieldvalue) ? fieldvalue : "NULL");
}
} }
valueStr = new StringBuilder(valueStr.substring(1)); valueStr = new StringBuilder(valueStr.substring(1));
sql += "(scope,scopeid,id," + personFild + ") values('HrmCustomFieldByInfoType'," + 1 + "," + id + "," + valueStr + ")"; sql += "(scope,scopeid,id," + personFild + ") values('HrmCustomFieldByInfoType'," + 1 + "," + id + "," + valueStr + ")";
@ -1779,7 +1812,9 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean updatePersonData(String personFild, String personValue, int id) { public boolean updatePersonData(String personFild, String personValue, int id) {
if (personFild == null || personFild.equals("")) return false; if (personFild == null || "".equals(personFild)) {
return false;
}
//检查cus_fielddata表中是否存在对应id人员的个人自定义信息如果不存在则向数据库添加 //检查cus_fielddata表中是否存在对应id人员的个人自定义信息如果不存在则向数据库添加
String checkWorkInfo = "select id from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=1 and id=" + id; String checkWorkInfo = "select id from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=1 and id=" + id;
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
@ -1827,20 +1862,25 @@ public class HrmImportProcessE9 extends BaseBean {
jsonObject.put("fieldvalue", personValues[i]); jsonObject.put("fieldvalue", personValues[i]);
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) { if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
//是否需要加密 //是否需要加密
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue)); fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
} }
if (fieldvalue.startsWith(",")) fieldvalue = fieldvalue.substring(1); if (fieldvalue.startsWith(",")) {
if (fieldvalue.endsWith(",")) fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1); fieldvalue = fieldvalue.substring(1);
if (!fieldvalue.equals("")) { }
if (fieldvalue.endsWith(",")) {
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
}
if (!"".equals(fieldvalue)) {
flag = true; flag = true;
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
setStr.append(",").append(personFields[i]).append("='").append(fieldvalue).append("'"); setStr.append(",").append(personFields[i]).append("='").append(fieldvalue).append("'");
else } else {
setStr.append(",").append(personFields[i]).append("=").append(fieldvalue); setStr.append(",").append(personFields[i]).append("=").append(fieldvalue);
} }
} }
}
sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=1 and id=" + id; sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=1 and id=" + id;
} catch (Exception e) { } catch (Exception e) {
writeLog(e); writeLog(e);
@ -1859,7 +1899,7 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean addWorkData(String workField, String workValue, int id) { public boolean addWorkData(String workField, String workValue, int id) {
if (workField == null || workField.equals("")) { if (workField == null || "".equals(workField)) {
return true; return true;
} }
String[] workValues = workValue.split(";"); String[] workValues = workValue.split(";");
@ -1899,14 +1939,15 @@ public class HrmImportProcessE9 extends BaseBean {
jsonObject.put("fieldvalue", workValues[i]); jsonObject.put("fieldvalue", workValues[i]);
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) { if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
//是否需要加密 //是否需要加密
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue)); fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
} }
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
valueStr.append(",").append("'").append(!fieldvalue.equals("") ? fieldvalue : "").append("'"); valueStr.append(",").append("'").append(!"".equals(fieldvalue) ? fieldvalue : "").append("'");
else } else {
valueStr.append(",").append(!fieldvalue.equals("") ? fieldvalue : "NULL"); valueStr.append(",").append(!"".equals(fieldvalue) ? fieldvalue : "NULL");
}
} }
valueStr = new StringBuilder(valueStr.substring(1)); valueStr = new StringBuilder(valueStr.substring(1));
sql += "(scope,scopeid,id," + workField + ") values('HrmCustomFieldByInfoType'," + 3 + "," + id + "," + valueStr + ")"; sql += "(scope,scopeid,id," + workField + ") values('HrmCustomFieldByInfoType'," + 3 + "," + id + "," + valueStr + ")";
@ -1927,7 +1968,9 @@ public class HrmImportProcessE9 extends BaseBean {
* @return * @return
*/ */
public boolean updateWorkData(String workField, String workValue, int id) { public boolean updateWorkData(String workField, String workValue, int id) {
if (workField == null || workField.equals("")) return false; if (workField == null || "".equals(workField)) {
return false;
}
//检查cus_fielddata表中是否存在对应id人员的工作自定义信息如果不存在则向数据库添加 //检查cus_fielddata表中是否存在对应id人员的工作自定义信息如果不存在则向数据库添加
String checkWorkInfo = "select id from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=" + id; String checkWorkInfo = "select id from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=" + id;
@ -1975,20 +2018,25 @@ public class HrmImportProcessE9 extends BaseBean {
jsonObject.put("fieldvalue", workValues[i]); jsonObject.put("fieldvalue", workValues[i]);
String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject);
EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId); EncryptFieldEntity encryptFieldEntity = new EncryptFieldConfigComInfo().getFieldEncryptConfig("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId);
if (encryptFieldEntity != null && encryptFieldEntity.getIsEncrypt().equals("1")) { if (encryptFieldEntity != null && "1".equals(encryptFieldEntity.getIsEncrypt())) {
//是否需要加密 //是否需要加密
fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue)); fieldvalue = Util.null2String(encryptUtil.encryt("cus_fielddata", fieldname, "HrmCustomFieldByInfoType", scopeId, fieldvalue, fieldvalue));
} }
if (fieldvalue.startsWith(",")) fieldvalue = fieldvalue.substring(1); if (fieldvalue.startsWith(",")) {
if (fieldvalue.endsWith(",")) fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1); fieldvalue = fieldvalue.substring(1);
if (!fieldvalue.equals("")) { }
if (fieldvalue.endsWith(",")) {
fieldvalue = fieldvalue.substring(0, fieldvalue.length() - 1);
}
if (!"".equals(fieldvalue)) {
flag = true; flag = true;
if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) if (fielddbType.toLowerCase().startsWith("char") || fielddbType.toLowerCase().startsWith("varchar") || fielddbType.toLowerCase().startsWith("text")) {
setStr.append(",").append(workFields[i]).append("='").append(fieldvalue).append("'"); setStr.append(",").append(workFields[i]).append("='").append(fieldvalue).append("'");
else } else {
setStr.append(",").append(workFields[i]).append("=").append(fieldvalue); setStr.append(",").append(workFields[i]).append("=").append(fieldvalue);
} }
} }
}
sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=" + id; sql += setStr.substring(1) + " where scope='HrmCustomFieldByInfoType' and scopeid=3 and id=" + id;
} catch (Exception e) { } catch (Exception e) {
@ -2022,11 +2070,13 @@ public class HrmImportProcessE9 extends BaseBean {
String supsubcomidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supsubcomid", 0); String supsubcomidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supsubcomid", 0);
for (String companyName : subCompanyNames) { for (String companyName : subCompanyNames) {
if (StringUtil.isNull(companyName)) continue; if (StringUtil.isNull(companyName)) {
continue;
}
sql = "select id from HrmSubCompany where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(subcompanyname))," + userlanguage + ")))='" sql = "select id from HrmSubCompany where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(subcompanyname))," + userlanguage + ")))='"
+ companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId; + companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId;
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("oracle".equalsIgnoreCase(recordSet.getDBType()) || DialectUtil.isMySql(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
sql = "select id from HrmSubCompany where ltrim(rtrim(convToMultiLang(ltrim(rtrim(subcompanyname))," + userlanguage + ")))='" sql = "select id from HrmSubCompany where ltrim(rtrim(convToMultiLang(ltrim(rtrim(subcompanyname))," + userlanguage + ")))='"
+ companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId; + companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId;
} }
@ -2043,9 +2093,10 @@ public class HrmImportProcessE9 extends BaseBean {
break; break;
} }
parentId = currentId; parentId = currentId;
if (currentId != -1) if (currentId != -1) {
rtxService.addSubCompany(parentId); //同步RTX rtxService.addSubCompany(parentId); //同步RTX
} }
}
return currentId; return currentId;
} }
@ -2072,13 +2123,13 @@ public class HrmImportProcessE9 extends BaseBean {
String supdepidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supdepid", 0); String supdepidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supdepid", 0);
for (String s : deptName) { for (String s : deptName) {
if (s == null || s.equals("")) { if (s == null || "".equals(s)) {
continue; continue;
} }
sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='" sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='"
+ s.trim() + "' and " + supdepidConditon + "=" + parentId; + s.trim() + "' and " + supdepidConditon + "=" + parentId;
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("oracle".equalsIgnoreCase(recordSet.getDBType()) || DialectUtil.isMySql(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='" sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='"
+ s.trim() + "' and " + supdepidConditon + "=" + parentId; + s.trim() + "' and " + supdepidConditon + "=" + parentId;
} }
@ -2209,10 +2260,10 @@ public class HrmImportProcessE9 extends BaseBean {
String managerstr; String managerstr;
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
Map<String, Comparable> managerInfo = new HashMap<>(); Map<String, Comparable> managerInfo = new HashMap<>();
if (!keyFieldValue.equals("")) { if (!"".equals(keyFieldValue)) {
// String selSql = "select id,managerstr from hrmResource where " + keyField + "='" + keyFieldValue + "'"; // String selSql = "select id,managerstr from hrmResource where " + keyField + "='" + keyFieldValue + "'";
String selSql = "select id,managerstr from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; String selSql = "select id,managerstr from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("oracle".equalsIgnoreCase(recordSet.getDBType()) || DialectUtil.isMySql(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
selSql = "select id,managerstr from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; selSql = "select id,managerstr from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
} }
recordSet.execute(selSql); recordSet.execute(selSql);
@ -2244,10 +2295,10 @@ public class HrmImportProcessE9 extends BaseBean {
int getAssistantid = 0; int getAssistantid = 0;
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
if (!keyFieldValue.equals("")) { if (!"".equals(keyFieldValue)) {
// String selSql = "select id from hrmResource where " + keyField + "='" + keyFieldValue + "'"; // String selSql = "select id from hrmResource where " + keyField + "='" + keyFieldValue + "'";
String selSql = "select id from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; String selSql = "select id from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("oracle".equalsIgnoreCase(recordSet.getDBType()) || DialectUtil.isMySql(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
selSql = "select id from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; selSql = "select id from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
} }
getAssistantid = getResultSetId(selSql); getAssistantid = getResultSetId(selSql);
@ -2265,10 +2316,10 @@ public class HrmImportProcessE9 extends BaseBean {
public int getBelongId(String keyFieldValue, String keyField) { public int getBelongId(String keyFieldValue, String keyField) {
int getAssistantid = -1; int getAssistantid = -1;
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
if (!keyFieldValue.equals("")) { if (!"".equals(keyFieldValue)) {
// String selSql = "select id from hrmResource where " + keyField + "='" + keyFieldValue + "'"; // String selSql = "select id from hrmResource where " + keyField + "='" + keyFieldValue + "'";
String selSql = "select id from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; String selSql = "select id from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if ("oracle".equalsIgnoreCase(recordSet.getDBType()) || DialectUtil.isMySql(recordSet.getDBType()) || "postgresql".equalsIgnoreCase(recordSet.getDBType())) {
selSql = "select id from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; selSql = "select id from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'";
} }
getAssistantid = getResultSetId(selSql); getAssistantid = getResultSetId(selSql);
@ -2284,7 +2335,7 @@ public class HrmImportProcessE9 extends BaseBean {
*/ */
public int getLocationid(String locationname) { public int getLocationid(String locationname) {
int locationid = 0; int locationid = 0;
if (!locationname.equals("")) { if (!"".equals(locationname)) {
locationid = locationMap.getOrDefault(locationname, 0); locationid = locationMap.getOrDefault(locationname, 0);
if (locationid == 0) { if (locationid == 0) {
String insertSql = "insert into HrmLocations(locationname,locationdesc,countryid) values('" + locationname + "','" + locationname + "',1)"; String insertSql = "insert into HrmLocations(locationname,locationdesc,countryid) values('" + locationname + "','" + locationname + "',1)";
@ -2305,7 +2356,7 @@ public class HrmImportProcessE9 extends BaseBean {
*/ */
public int getUseKind(String usekindname) { public int getUseKind(String usekindname) {
int usekindid = 0; int usekindid = 0;
if (!usekindname.equals("")) { if (!"".equals(usekindname)) {
usekindid = usekindMap.getOrDefault(usekindname, 0); usekindid = usekindMap.getOrDefault(usekindname, 0);
if (usekindid == 0) { if (usekindid == 0) {
String insertSql = "insert into HrmUseKind(name,description) values('" + usekindname + "','" + usekindname + "')"; String insertSql = "insert into HrmUseKind(name,description) values('" + usekindname + "','" + usekindname + "')";
@ -2327,7 +2378,7 @@ public class HrmImportProcessE9 extends BaseBean {
public int getJobcall(String jobcall) { public int getJobcall(String jobcall) {
int jobcalld = 0; int jobcalld = 0;
if (!jobcall.equals("")) { if (!"".equals(jobcall)) {
jobcalld = jobcallMap.getOrDefault(jobcall, 0); jobcalld = jobcallMap.getOrDefault(jobcall, 0);
if (jobcalld == 0) { if (jobcalld == 0) {
String insertSql = "insert into HrmJobCall(name) values('" + jobcall + "')"; String insertSql = "insert into HrmJobCall(name) values('" + jobcall + "')";
@ -2354,13 +2405,14 @@ public class HrmImportProcessE9 extends BaseBean {
//return -1; //return -1;
//如果系统不支持多语言则返回0 //如果系统不支持多语言则返回0
if ((language.equals("English") || language.equals("繁體中文")) && !multilanguage.equalsIgnoreCase("y")) if (("English".equals(language) || "繁體中文".equals(language)) && !"y".equalsIgnoreCase(multilanguage)) {
return 0; return 0;
}
if (!language.equals("")) { if (!"".equals(language)) {
if (language.equals("简体中文")) if ("简体中文".equals(language)) {
systemlanguageid = cnLanguageId; systemlanguageid = cnLanguageId;
else { } else {
systemlanguageid = sysLanguage.getOrDefault(language, -1); systemlanguageid = sysLanguage.getOrDefault(language, -1);
} }
} }
@ -2375,7 +2427,7 @@ public class HrmImportProcessE9 extends BaseBean {
*/ */
public int getBankId(String bank1) { public int getBankId(String bank1) {
int id = 0; int id = 0;
if (!bank1.equals("")) { if (!"".equals(bank1)) {
String insertSql = "insert into hrmbank(bankname,bankdesc) values('" + bank1 + "','" + bank1 + "')"; String insertSql = "insert into hrmbank(bankname,bankdesc) values('" + bank1 + "','" + bank1 + "')";
execSql(insertSql); execSql(insertSql);
String selSql = "select id from hrmbank where bankname='" + bank1 + "'"; String selSql = "select id from hrmbank where bankname='" + bank1 + "'";
@ -2454,7 +2506,7 @@ public class HrmImportProcessE9 extends BaseBean {
*/ */
public int getEducationlevel(String educationlevel) { public int getEducationlevel(String educationlevel) {
int educationlevelid = 0; int educationlevelid = 0;
if (!educationlevel.equals("")) { if (!"".equals(educationlevel)) {
educationlevelid = educationlevelMap.getOrDefault(educationlevel, 0); educationlevelid = educationlevelMap.getOrDefault(educationlevel, 0);
if (educationlevelid == 0) { if (educationlevelid == 0) {
String insertSql = "insert into HrmEducationLevel(name,description) values('" + educationlevel + "','" + educationlevel + "')"; String insertSql = "insert into HrmEducationLevel(name,description) values('" + educationlevel + "','" + educationlevel + "')";
@ -2504,7 +2556,7 @@ public class HrmImportProcessE9 extends BaseBean {
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
String sql; String sql;
sql = "select id, accounttype,isADAccount,certificatenum,loginid,workcode, ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from hrmResource"; sql = "select id, accounttype,isADAccount,certificatenum,loginid,workcode, ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from hrmResource";
if (recordSet.getDBType().equalsIgnoreCase("sqlserver")) { if ("sqlserver".equalsIgnoreCase(recordSet.getDBType())) {
sql = "select id, accounttype,isADAccount,certificatenum,loginid,workcode, ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from hrmResource"; sql = "select id, accounttype,isADAccount,certificatenum,loginid,workcode, ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from hrmResource";
} }
recordSet.execute(sql); recordSet.execute(sql);
@ -2585,10 +2637,11 @@ public class HrmImportProcessE9 extends BaseBean {
log.setLastname(vo.getLastname()); //用户名 log.setLastname(vo.getLastname()); //用户名
log.setLoginid(vo.getLoginid()); //登录名 log.setLoginid(vo.getLoginid()); //登录名
log.setOperation(operation); //操作类型 log.setOperation(operation); //操作类型
if (vo.getSubcompanyid1() != null && vo.getDepartmentid() != null) if (vo.getSubcompanyid1() != null && vo.getDepartmentid() != null) {
log.setDepartment(vo.getSubcompanyid1() + ">" + vo.getDepartmentid()); //分部部门 log.setDepartment(vo.getSubcompanyid1() + ">" + vo.getDepartmentid()); //分部部门
else } else {
log.setDepartment(""); log.setDepartment("");
}
log.setStatus(status); //状态,成功、失败 log.setStatus(status); //状态,成功、失败
log.setReason(reason); //原因 log.setReason(reason); //原因
@ -2605,7 +2658,7 @@ public class HrmImportProcessE9 extends BaseBean {
relatedName = log.getLastname(); relatedName = log.getLastname();
break; break;
} }
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid((long) this.pId).rowNums(this.rowNum + 1 + "").relatedName(relatedName).operateDetail(log.getStatus().equals("成功") ? relatedName + "导入成功!" : log.getReason()).status(log.getStatus().equals("成功") ? "1" : "0").build()); MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid((long) this.pId).rowNums(this.rowNum + 1 + "").relatedName(relatedName).operateDetail("成功".equals(log.getStatus()) ? relatedName + "导入成功!" : log.getReason()).status("成功".equals(log.getStatus()) ? "1" : "0").build());
} catch (Exception e) { } catch (Exception e) {
writeLog(e); writeLog(e);
} }
@ -2614,8 +2667,9 @@ public class HrmImportProcessE9 extends BaseBean {
//整数判断 //整数判断
public static boolean isInteger(String str) { public static boolean isInteger(String str) {
if (str == null) if (str == null) {
return false; return false;
}
Pattern pattern = Pattern.compile("[0-9]+"); Pattern pattern = Pattern.compile("[0-9]+");
return pattern.matcher(str).matches(); return pattern.matcher(str).matches();
} }
@ -2650,7 +2704,7 @@ public class HrmImportProcessE9 extends BaseBean {
} }
if (reosurceid > 0 && val.length() > 0) { if (reosurceid > 0 && val.length() > 0) {
resultList.add(createLog(vo, this.operateType.equals("add") ? "创建" : "更新", "失败", errorMsg)); resultList.add(createLog(vo, "add".equals(this.operateType) ? "创建" : "更新", "失败", errorMsg));
return true; return true;
} }
} }

@ -156,4 +156,8 @@ public class SearchTreeUtil {
public static boolean isTop(Long pid) { public static boolean isTop(Long pid) {
return null == pid; return null == pid;
} }
public static boolean isTop(Integer pid) {
return null == pid;
}
} }

@ -56,7 +56,7 @@ public class DepartmentController {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request); Map<String, Object> map = ParamUtil.request2Map(request);
String parentDept = (String) map.get("parentDept"); String parentDept = (String) map.get("parentDept");
return ReturnResult.successed(getDepartmentWrapper(user).getJobListByPid(QuerySingleDeptListParam.builder().parentDept(Long.parseLong(parentDept)).build())); return ReturnResult.successed(getDepartmentWrapper(user).getJobListByPid(QuerySingleDeptListParam.builder().parentDept(Integer.parseInt(parentDept)).build()));
} catch (Exception e) { } catch (Exception e) {
return ReturnResult.exceptionHandle(e); return ReturnResult.exceptionHandle(e);
} }

@ -15,15 +15,16 @@ import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.mapper.department.DepartmentMapper; import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.service.DepartmentService; import com.engine.organization.service.DepartmentService;
import com.engine.organization.service.impl.DepartmentServiceImpl; import com.engine.organization.service.impl.DepartmentServiceImpl;
import com.engine.organization.thread.DepartmentTriggerRunnable;
import com.engine.organization.util.MenuBtn; import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationWrapper; import com.engine.organization.util.OrganizationWrapper;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.PageInfo; import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.response.ReturnResult; import com.engine.organization.util.response.ReturnResult;
import org.apache.commons.lang.StringUtils;
import weaver.hrm.User; import weaver.hrm.User;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -97,8 +98,8 @@ public class DepartmentWrapper extends OrganizationWrapper {
public Long saveBaseForm(Map<String, Object> params) { public Long saveBaseForm(Map<String, Object> params) {
Long departmentId = getDepartmentService(user).saveBaseForm(params); Long departmentId = getDepartmentService(user).saveBaseForm(params);
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), params.get("dept_name").toString(), JSON.toJSONString(params), "新增部门"); }.getClass(), params.get("departmentname").toString(), JSON.toJSONString(params), "新增部门");
new Thread(new DepartmentTriggerRunnable(departmentId)).start(); // TODO new Thread(new DepartmentTriggerRunnable(departmentId)).start();
return departmentId; return departmentId;
} }
@ -114,8 +115,8 @@ public class DepartmentWrapper extends OrganizationWrapper {
int updateForbiddenTagById = getDepartmentService(user).updateForbiddenTagById(params); int updateForbiddenTagById = getDepartmentService(user).updateForbiddenTagById(params);
DepartmentPO newDeptById = getDepartmentMapper().getDeptById(params.getId()); DepartmentPO newDeptById = getDepartmentMapper().getDeptById(params.getId());
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, newDeptById); }.getClass(), deptById.getDepartmentName(), JSON.toJSONString(params), deptById, newDeptById);
new Thread(new DepartmentTriggerRunnable(params.getForbiddenTag(),deptById, newDeptById)).start(); // new Thread(new DepartmentTriggerRunnable(params.getForbiddenTag(),deptById, newDeptById)).start();
return updateForbiddenTagById; return updateForbiddenTagById;
} }
@ -127,12 +128,12 @@ public class DepartmentWrapper extends OrganizationWrapper {
*/ */
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新部门", operateModule = LogModuleNameEnum.DEPARTMENT) @Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新部门", operateModule = LogModuleNameEnum.DEPARTMENT)
public Long updateForm(Map<String, Object> params) { public Long updateForm(Map<String, Object> params) {
long id = Long.parseLong(params.get("id").toString()); Integer id = Integer.parseInt(params.get("id").toString());
DepartmentPO deptById = getDepartmentMapper().getDeptById(id); DepartmentPO deptById = getDepartmentMapper().getDeptById(id);
Long departmentId = getDepartmentService(user).updateForm(params); Long departmentId = getDepartmentService(user).updateForm(params);
DepartmentPO newDeptById = getDepartmentMapper().getDeptById(id); DepartmentPO newDeptById = getDepartmentMapper().getDeptById(id);
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, newDeptById); }.getClass(), deptById.getDepartmentName(), JSON.toJSONString(params), deptById, newDeptById);
return departmentId; return departmentId;
} }
@ -142,16 +143,18 @@ public class DepartmentWrapper extends OrganizationWrapper {
* @param ids * @param ids
*/ */
@Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除部门", operateModule = LogModuleNameEnum.DEPARTMENT) @Log(operateType = OperateTypeEnum.DELETE, operateDesc = "删除部门", operateModule = LogModuleNameEnum.DEPARTMENT)
public int deleteByIds(Collection<Long> ids) { public Map<String, Object> deleteByIds(Collection<Long> ids) {
Map<String, Object> params = new HashMap<>();
params.put("id", StringUtils.join(ids, ","));
List<DepartmentPO> departmentPOS = getDepartmentMapper().getDeptsByIds(ids); List<DepartmentPO> departmentPOS = getDepartmentMapper().getDeptsByIds(ids);
int deleteByIds = getDepartmentService(user).deleteByIds(ids); Map<String, Object> map = getDepartmentService(user).deleteByIds(params);
for (DepartmentPO departmentPO : departmentPOS) { for (DepartmentPO departmentPO : departmentPOS) {
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), departmentPO.getDeptName(), JSON.toJSONString(ids), "删除部门"); }.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(ids), "删除部门");
// 更新组织架构图 // 更新组织架构图
new DepartmentTriggerRunnable(departmentPO).run(); // TODO new DepartmentTriggerRunnable(departmentPO).run();
} }
return deleteByIds; return map;
} }
/** /**
@ -204,7 +207,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
int copyDepartment = getDepartmentService(user).copyDepartment(copyParam); int copyDepartment = getDepartmentService(user).copyDepartment(copyParam);
for (DepartmentPO departmentPO : departmentPOS) { for (DepartmentPO departmentPO : departmentPOS) {
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), departmentPO.getDeptName(), JSON.toJSONString(copyParam), "复制部门[" + departmentPO.getDeptName() + "]"); }.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(copyParam), "复制部门[" + departmentPO.getDepartmentName() + "]");
} }
return copyDepartment; return copyDepartment;
} }
@ -230,7 +233,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(mergeParam.getId()); DepartmentPO departmentPO = getDepartmentMapper().getDeptById(mergeParam.getId());
int mergeDepartment = getDepartmentService(user).mergeDepartment(mergeParam); int mergeDepartment = getDepartmentService(user).mergeDepartment(mergeParam);
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), departmentPO.getDeptName(), JSON.toJSONString(mergeParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId())); }.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(mergeParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId()));
return mergeDepartment; return mergeDepartment;
} }
@ -254,7 +257,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(moveParam.getId()); DepartmentPO departmentPO = getDepartmentMapper().getDeptById(moveParam.getId());
int moveDepartment = getDepartmentService(user).moveDepartment(moveParam); int moveDepartment = getDepartmentService(user).moveDepartment(moveParam);
writeOperateLog(new Object() { writeOperateLog(new Object() {
}.getClass(), departmentPO.getDeptName(), JSON.toJSONString(moveParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId())); }.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(moveParam), departmentPO, getDepartmentMapper().getDeptById(departmentPO.getId()));
return moveDepartment; return moveDepartment;
} }
} }

Loading…
Cancel
Save