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

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

@ -199,13 +199,13 @@ public class JobBrowserService extends BrowserService {
if (detachUtil.isDETACH()) {
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");
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())) {
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");
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) {
SearchTree searchTree = new SearchTree();
searchTree.setId(department.getId().toString());
searchTree.setName(department.getDeptName());
searchTree.setName(department.getDepartmentName());
searchTree.setType(TreeNodeTypeEnum.TYPE_DEPT.getValue());
searchTree.setIsParent(hasSubDepartment.contains(department.getId().toString()));
treeNodes.add(searchTree);

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

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

@ -26,22 +26,22 @@ public class DepartmentBO {
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 ->
DepartmentListDTO
.builder()
.id(e.getId())
.deptNo(e.getDeptNo())
.deptName(e.getDeptName())
.deptNameShort(e.getDeptNameShort())
.parentComp(null == e.getParentComp() ? "" : MapperProxyFactory.getProxy(CompanyMapper.class).listById(e.getParentComp().intValue()).getSubCompanyName())
.parentDept(e.getParentDept())
.parentDeptName(null == poMaps.get(e.getParentDept()) ? "" : poMaps.get(e.getParentDept()).getDeptName())
.deptPrincipal(getEmployeeNameById(e.getDeptPrincipal()))
.departmentMark(e.getDepartmentMark())
.departmentName(e.getDepartmentName())
.subCompanyId1(e.getSubCompanyId1())
.subCompanyName(0 == e.getSubCompanyId1() ? "" : MapperProxyFactory.getProxy(CompanyMapper.class).listById(e.getSubCompanyId1()).getSubCompanyName())
.supDepId(e.getSupDepId())
.supDepName(null == poMaps.get(e.getSupDepId()) ? "" : poMaps.get(e.getSupDepId()).getDepartmentName())
// .deptPrincipal(getEmployeeNameById(e.getDeptPrincipal()))
.showOrder(null == e.getShowOrder() ? 0 : e.getShowOrder())
.forbiddenTag(e.getForbiddenTag())
.canceled(e.getCanceled())
.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> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList());
@ -57,7 +57,7 @@ public class DepartmentBO {
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) {
@ -66,7 +66,7 @@ public class DepartmentBO {
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<>();
for (DepartmentPO po : filterList) {
dealParentData(addedList, po, poMaps);
@ -74,32 +74,32 @@ public class DepartmentBO {
return buildDeptDTOList(addedList);
}
public static DepartmentPO convertParamsToPO(DeptSearchParam param, long employeeId) {
public static DepartmentPO convertParamsToPO(DeptSearchParam param, Integer employeeId) {
if (null == param) {
return null;
}
return DepartmentPO
.builder()
.id(param.getId() == null ? 0 : param.getId())
.deptNo(param.getDeptNo())
.deptName(param.getDepartmentName())
.deptNameShort(param.getDeptNameShort())
.parentComp(null == param.getParentComp() ? param.getSubcompanyid1() : param.getParentComp())
.ecCompany(param.getEcCompany())
.parentDept(null == param.getParentDept() ? param.getDepartmentid() : param.getParentDept())
.ecDepartment(param.getEcDepartment())
.deptPrincipal(param.getDeptPrincipal())
.departmentMark(param.getDepartmentMark())
.departmentName(param.getDepartmentName())
.subCompanyId1(param.getSubCompanyId1())
.supDepId(param.getSupDepId())
.allSupDepId(param.getAllSupDepId())
.canceled(param.getCanceled() == null ? null : param.getCanceled() ? 0 : 1)
.departmentCode(param.getDepartmentCode())
.coadjutant(param.getCoadjutant())
.uuid(param.getUuid())
.showOrder(param.getShowOrder())
.forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1)
.description(param.getDescription())
.deleteType(0)
.createTime(new Date())
.updateTime(new Date())
.creator(employeeId)
.showOrderOfTree(param.getShowOrderOfTree())
.created(new Date())
.modified(new Date())
.creater(employeeId)
.modifier(employeeId)
.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)) {
return Collections.emptyList();
@ -109,17 +109,17 @@ public class DepartmentBO {
SingleDeptTreeVO
.builder()
.id(e.getId())
.deptNo(e.getDeptNo())
.deptName(e.getDeptName())
.parentComp(e.getParentComp())
.parentDept(e.getParentDept())
.parentDeptName(e.getParentDept() == null ? "" : getDeptNameById(e.getParentDept()))
.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal()))
.departmentCode(e.getDepartmentCode())
.departmentMark(e.getDepartmentMark())
.subCompanyId1(e.getSubCompanyId1())
.supDepId(e.getSupDepId())
.supDepName(e.getSupDepId() == 0 ? "" : getDeptNameById(e.getSupDepId()))
//.deptPrincipalName(getEmployeeNameById(e.getDeptPrincipal()))
.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) {
@ -131,23 +131,23 @@ public class DepartmentBO {
return departmentPOS.stream().map(item -> {
SearchTree tree = new SearchTree();
tree.setCanClick(true);
tree.setCanceled(item.getForbiddenTag() != 0);
tree.setCanceled(item.getCanceled() != 0);
tree.setIcon(isLeaf ? "icon-coms-Branch" : "icon-coms-LargeArea");
tree.setId(item.getId().toString());
tree.setIsParent(false);
tree.setIsVirtual("0");
tree.setName(item.getDeptName());
tree.setPid(null == item.getParentDept() ? "0" : item.getParentDept().toString());
tree.setName(item.getDepartmentName());
tree.setPid(item.getSupDepId().toString());
tree.setSelected(false);
tree.setType("2");
tree.setParentComp(null == item.getParentComp() ? "0" : item.getParentComp().toString());
tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder());
tree.setParentComp(item.getSubCompanyId1().toString());
tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder().intValue());
return tree;
}).collect(Collectors.toList());
}
public static String getDeptNameById(Long id) {
public static String getDeptNameById(Integer id) {
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(id);
}
@ -163,11 +163,11 @@ public class DepartmentBO {
* @param po
* @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)) {
addedList.add(po);
}
DepartmentPO parentPO = poMaps.get(po.getParentDept());
DepartmentPO parentPO = poMaps.get(po.getSupDepId());
if (null != parentPO) {
dealParentData(addedList, parentPO, poMaps);
}

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

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

@ -18,8 +18,8 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
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
@NoArgsConstructor
public class DepartmentPO {
private Long id;
private String deptNo;
private String deptName;
private String deptNameShort;
private Integer parentComp;
private Integer ecCompany;
private Long parentDept;
private Long ecDepartment;
private Long deptPrincipal; //部门负责人
private Integer showOrder;
private String description;
private Integer forbiddenTag;
private Integer id;
private String departmentMark;
private String departmentName;
private Integer subCompanyId1;
private Integer supDepId;
private String allSupDepId;
private Integer canceled;
private String departmentCode;
private Integer coadjutant;
private Date created;
private Integer creater;
private Date modified;
private Integer modifier;
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)
public class SingleDeptTreeVO {
private Long id;
private Integer id;
@TableTitle(title = "编号", dataIndex = "deptNo", key = "deptNo")
private String deptNo;
@TableTitle(title = "编号", dataIndex = "departmentCode", key = "departmentCode")
private String departmentCode;
@TableTitle(title = "部门名称", dataIndex = "deptName", key = "deptName")
private String deptName;
@TableTitle(title = "部门名称", dataIndex = "departmentMark", key = "departmentMark")
private String departmentMark;
private Integer parentComp; //上级分部
private Integer subCompanyId1; //上级分部
private Long parentDept; //上级部门id
private Integer supDepId; //上级部门id
@TableTitle(title = "上级部门", dataIndex = "parentDeptName", key = "parentDeptName")
private String parentDeptName; //上级部门
@TableTitle(title = "上级部门", dataIndex = "supDepName", key = "supDepName")
private String supDepName; //上级部门
@TableTitle(title = "部门负责人", dataIndex = "deptPrincipalName", key = "deptPrincipalName")
private String deptPrincipalName; //部门负责人
//@TableTitle(title = "部门负责人", dataIndex = "deptPrincipalName", key = "deptPrincipalName")
//private String deptPrincipalName; //部门负责人
//子节点
private List<SingleDeptTreeVO> children;

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

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

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

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

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

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

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

@ -24,8 +24,12 @@ public class SearchTree extends TreeNode {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
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);
}

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

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

@ -73,7 +73,7 @@ public interface CompanyMapper {
* @param supSubComId
* @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>
</select>
<select id="getIdByNameAndPid" resultType="java.lang.Long">
<select id="getIdByNameAndPid" resultType="java.lang.Integer">
select id
from hrmsubcompany
where subcompanyname = #{subCompanyName}

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

@ -3,22 +3,15 @@
<mapper namespace="com.engine.organization.mapper.department.DepartmentMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.department.po.DepartmentPO">
<result column="id" property="id"/>
<result column="dept_no" property="deptNo"/>
<result column="dept_name" property="deptName"/>
<result column="dept_name_short" property="deptNameShort"/>
<result column="parent_comp" property="parentComp"/>
<result column="ec_company" property="ecCompany"/>
<result column="parent_dept" property="parentDept"/>
<result column="ec_department" property="ecDepartment"/>
<result column="dept_principal" property="deptPrincipal"/>
<result column="show_order" 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="departmentMark" property="departmentMark"/>
<result column="departmentName" property="departmentName"/>
<result column="subCompanyId1" property="subCompanyId1"/>
<result column="supDepId" property="supDepId"/>
<result column="allSupDepId" property="allSupDepId"/>
<result column="canceled" property="canceled"/>
<result column="departmentCode" property="departmentCode"/>
<result column="coadjutant" property="coadjutant"/>
<result column="showOrder" property="showOrder"/>
<result column="uuid" property="uuid"/>
</resultMap>
@ -28,39 +21,28 @@
.
id
,
t.dept_no,
t.dept_name,
t.dept_name_short,
t.parent_comp,
t.ec_company,
t.parent_dept,
t.ec_department,
t.dept_principal,
t.show_order,
t.description,
t.forbidden_tag,
t.departmentMark,
t.departmentName,
t.subCompanyId1,
t.supDepId,
t.allSupDepId,
t.canceled,
t.departmentCode,
t.coadjutant,
t.showOrder,
t.uuid
</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
<include refid="baseColumns"/>
from jcl_org_dept t
where delete_type = 0
and parent_dept = #{PId}
from hrmdepartment t
where supDepId = #{PId}
</select>
<select id="getDeptNameById" resultType="string">
select t.dept_name
from jcl_org_dept t
select t.departmentName
from hrmdepartment t
where id = #{id}
</select>
@ -68,69 +50,45 @@
resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_dept t
where delete_type = 0
from hrmdepartment t
where 1=1
<include refid="likeSQL"/>
<if test=" departmentPO.ecCompany != null ">
and t.ec_company = #{departmentPO.ecCompany}
</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 test=" departmentPO.deptPrincipal != null ">
and t.dept_principal = #{departmentPO.deptPrincipal}
</if>
<if test=" departmentPO.showOrder != null ">
and t.show_order = #{departmentPO.showOrder}
<if test=" departmentPO.subCompanyId1 != null ">
and t.subCompanyId1 = #{departmentPO.subCompanyId1}
</if>
<if test=" departmentPO.forbiddenTag != null ">
and t.forbidden_tag = #{departmentPO.forbiddenTag}
<if test=" departmentPO.supDepId != null ">
and t.supDepId = #{departmentPO.supDepId}
</if>
order by ${orderSql}
</select>
<select id="getDeptById" resultType="com.engine.organization.entity.department.po.DepartmentPO">
<select id="getDeptById" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_dept t
where delete_type = 0
and id = #{id}
from hrmdepartment t
where id = #{id}
</select>
<select id="listDeptsByIds" resultType="java.util.Map">
select
id as "id",
dept_name as "name"
from jcl_org_dept t
WHERE delete_type = 0
AND id IN
departmentName as "name"
from hrmdepartment t
WHERE id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="list" resultType="com.engine.organization.entity.department.po.DepartmentPO">
<select id="listAll" resultType="com.engine.organization.entity.department.po.DepartmentPO">
SELECT
<include refid="baseColumns"/>
FROM jcl_org_dept t
WHERE t.delete_type = 0 order by ${orderSql}
FROM hrmdepartment t order by ${orderSql}
</select>
<select id="listByNo" resultType="com.engine.organization.entity.department.po.DepartmentPO">
select
<include refid="baseColumns"/>
from jcl_org_dept t where dept_no = #{deptNo} AND delete_type = 0
</select>
<select id="countChildByPID" resultType="java.lang.Integer">
select count(1)
from jcl_org_dept t
where delete_type = 0
and parent_dept = #{pid}
from hrmdepartment t where departmentCode = #{departmentCode}
</select>
<select id="listUsedId" resultType="java.lang.String">
select parent_dept
@ -144,361 +102,69 @@
<select id="getDeptsByIds" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_dept t
where delete_type = 0
AND id IN
from hrmdepartment t
where id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="getMaxShowOrder" resultType="java.lang.Integer">
select max(show_order)
from jcl_org_dept
<select id="getMaxShowOrder" resultType="java.lang.Double">
select max(showOrder)
from hrmdepartment
</select>
<select id="getIdByNameAndPid" resultType="java.lang.Long">
<select id="getIdByNameAndPid" resultType="java.lang.Integer">
select id
from jcl_org_dept
where delete_type = 0 and dept_name = #{departmentName}
and parent_comp = #{parentCompany}
<include refid="nullParentDepartment"/>
</select>
<select id="getDepartmentByUUID" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_dept t
where delete_type = 0
and uuid = #{uuid}
from hrmdepartment
where departmentName = #{departmentName}
and subCompanyId1 = #{subCompanyId1}
and supDepId = #{supDepId}
</select>
<select id="checkRepeatNo" resultType="java.lang.Integer">
select count(1)
from jcl_org_dept t
where t.delete_type = 0
AND dept_no = #{departmentNo}
from hrmdepartment t
where departmentCode = #{departmentCode}
<if test=" id != null ">
and t.id != #{id}
</if>
</select>
<select id="hasSubs" resultType="java.lang.String">
select distinct parent_dept
from jcl_org_dept
where forbidden_tag = 0
and delete_type = 0
select distinct supDepId
from hrmdepartment
where canceled = 0
</select>
<select id="countUsedInJob" resultType="java.lang.Integer">
select count(1)
from jcl_org_job
where forbidden_tag = 0
and delete_type = 0
and parent_dept = #{departmentId}
and parent_dept = = #{supDepId}
</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">
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' ">
and t.dept_no like CONCAT('%',#{departmentPO.deptNo},'%')
<if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
and t.departmentCode like CONCAT('%',#{departmentPO.departmentCode},'%')
</if>
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
and t.dept_name like CONCAT('%',#{departmentPO.deptName},'%')
</if>
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
and t.dept_name_short like CONCAT('%',#{departmentPO.deptNameShort},'%')
<if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
and t.departmentName like CONCAT('%',#{departmentPO.departmentMarkShort},'%')
</if>
</sql>
<sql id="likeSQL" databaseId="oracle">
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' ">
and t.dept_no like '%'||#{departmentPO.deptNo}||'%'
</if>
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
and t.dept_name like '%'||#{departmentPO.deptName}||'%'
<if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
and t.departmentCode like '%'||#{departmentPO.departmentCode}||'%'
</if>
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
and t.dept_name_short like '%'||#{departmentPO.deptNameShort}||'%'
<if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
and t.departmentName like '%'||#{departmentPO.departmentName}||'%'
</if>
</sql>
<sql id="likeSQL" databaseId="sqlserver">
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' ">
and t.dept_no like '%'+#{departmentPO.deptNo}+'%'
</if>
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
and t.dept_name like '%'+#{departmentPO.deptName}+'%'
<if test=" departmentPO.departmentCode != null and departmentPO.departmentCode != '' ">
and t.departmentCode like '%'+#{departmentPO.departmentCode}+'%'
</if>
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
and t.dept_name_short like '%'+#{departmentPO.deptNameShort}+'%'
<if test=" departmentPO.departmentName != null and departmentPO.departmentName != '' ">
and t.departmentName like '%'+#{departmentPO.departmentName}+'%'
</if>
</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>

@ -31,7 +31,7 @@ public interface SystemDataMapper {
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);

@ -96,7 +96,7 @@ public interface JobMapper {
* @param ecDepartment
* @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
* @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);

@ -21,7 +21,7 @@ public interface ResourceMapper {
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);

@ -8,7 +8,6 @@ import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.page.PageInfo;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -83,7 +82,7 @@ public interface DepartmentService {
*
* @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"));
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
String supsubcomid = "";
if (addType.equals("sibling")) {
if ("sibling".equals(addType)) {
supsubcomid = subCompanyComInfo.getSupsubcomid(id);
} else if (addType.equals("child")) {
} else if ("child".equals(addType)) {
supsubcomid = id;
}
if (StringUtils.isNotBlank(addType)) {
@ -290,7 +290,7 @@ public class CompServiceImpl extends Service implements CompService {
String groupId = (String) lsGroup.get(tmp);
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);
List<Object> itemList = new ArrayList<>();
Map<String, Object> groupItem = new HashMap<>();
@ -301,7 +301,7 @@ public class CompServiceImpl extends Service implements CompService {
String fieldId = (String) lsField.get(j);
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
String isUse = HrmFieldComInfo.getIsused(fieldId);
if (!isUse.equals("1")) {
if (!"1".equals(isUse)) {
continue;
}
int tmpViewAttr = viewAttr;
@ -313,14 +313,14 @@ public class CompServiceImpl extends Service implements CompService {
String fieldValue = "";
if (StringUtils.isNotBlank(addType)) {
} else {
if (HrmFieldComInfo.getIssystem(fieldId).equals("1")) {
if ("1".equals(HrmFieldComInfo.getIssystem(fieldId))) {
fieldValue = hfm.getData(fieldName);
} else {
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;
if ("1".equals(fieldHtmlType) && "2".equals(type)) {
rules = "required|integer";
@ -330,15 +330,16 @@ public class CompServiceImpl extends Service implements CompService {
}
if ("84".equals(fieldId)) {
if (user.getUID() != 1)
if (user.getUID() != 1) {
continue;
fieldValue = fieldValue.equals("0") ? "" : fieldValue;
}
fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
}
if (supsubcomid.length() > 0 && fieldName.equals("supsubcomid")) {
if (supsubcomid.length() > 0 && "supsubcomid".equals(fieldName)) {
fieldValue = supsubcomid;
}
if (fieldName.equals("subshowid")) {
if ("subshowid".equals(fieldName)) {
if (StringUtils.isNotBlank(addType)) {
continue;
} else {
@ -359,20 +360,20 @@ public class CompServiceImpl extends Service implements CompService {
hrmFieldBean.setViewAttr(tmpViewAttr);
hrmFieldBean.setRules(rules);
hrmFieldBean.setIssystem("1");
if (hrmFieldBean.getFieldname().equals("supsubcomid")) {
if ("supsubcomid".equals(hrmFieldBean.getFieldname())) {
hrmFieldBean.setHideVirtualOrg(true);
}
if (hrmFieldBean.getFieldname().equals("subcompanycode")) {
if ("subcompanycode".equals(hrmFieldBean.getFieldname())) {
hrmFieldBean.setMultilang(false);
}
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if (searchConditionItem != null) {
searchConditionItem.setLabelcol(8);
searchConditionItem.setFieldcol(16);
if (hrmFieldBean.getFieldname().equals("showorder")) {
if ("showorder".equals(hrmFieldBean.getFieldname())) {
searchConditionItem.setPrecision(2);
}
if (fieldName.equals("subshowid")) {
if ("subshowid".equals(fieldName)) {
Map<String, Object> otherParams = new HashMap<>();
otherParams.put("hasBorder", true);
searchConditionItem.setOtherParams(otherParams);
@ -408,8 +409,8 @@ public class CompServiceImpl extends Service implements CompService {
@Override
public int moveCompany(DepartmentMoveParam moveParam) {
Integer companyId = moveParam.getId().intValue();
Integer targetCompanyId = moveParam.getCompany().intValue();
Integer companyId = moveParam.getId();
Integer targetCompanyId = moveParam.getCompany();
// 判断目标分部是否为它本身以及子元素
Set<Integer> disableIds = new HashSet<>();
disableIds.add(companyId);

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

@ -337,7 +337,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
fieldTypeObj.add(tmp);
fieldType = SystemEnv.getHtmlLabelName(695, 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.put("value", SelectOptionParam.getCustomBrowserId(customValue));
tmp.put("valueSpan", SelectOptionParam.getCustomBrowserValueSpan(customValue));
@ -448,7 +448,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
lsComDetialInfo = new ArrayList<>();
comDetialInfo = new HashMap<>();
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("key", "fieldType");
lsComDetialInfo.add(comDetialInfo);
@ -462,7 +462,7 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
fieldTypeInfo.add("select");
Map<String, Object> fieldTypeParamInfo = new HashMap<>();
if (fieldHtmlType.equals("5")) {
if ("5".equals(fieldHtmlType)) {
fieldTypeParamInfo.put("datas", SelectOptionParam.getSelectFields(customValue));
fieldTypeParamInfo.put("sort", "horizontal");

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

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

@ -286,9 +286,9 @@ public class JobServiceImpl extends Service implements JobService {
DepartmentPO deptById = getDepartmentMapper().getDeptById(param.getDepartmentid());
if (null != deptById) {
params.put("parent_dept", deptById.getId());
params.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(deptById.getId().toString()));
params.put("parent_comp", deptById.getParentComp());
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(deptById.getParentComp().toString()));
params.put("ec_department", deptById.getId());
params.put("parent_comp", deptById.getSubCompanyId1());
params.put("ec_company", deptById.getSubCompanyId1());
}
}
for (ExtendTitlePO extendTitle : extendTitles) {
@ -371,12 +371,12 @@ public class JobServiceImpl extends Service implements JobService {
params.put("ec_company", parentJob.getEcCompany());
params.put("ec_department", parentJob.getEcDepartment());
} else {
Long ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment));
Integer ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
params.put("parent_dept", jclDepartment.getId());
params.put("parent_comp", jclDepartment.getParentComp());
if (null != jclDepartment.getParentComp()) {
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartment.getParentComp())));
params.put("parent_comp", jclDepartment.getSubCompanyId1());
if (null != jclDepartment.getSubCompanyId1()) {
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_department", parentJob.getEcDepartment());
} else {
Long ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(ecDepartment));
Integer ecDepartment = searchParam.getEcDepartment();
DepartmentPO jclDepartment = getDepartmentMapper().getDeptById(ecDepartment);
params.put("parent_dept", jclDepartment.getId());
params.put("parent_comp", jclDepartment.getParentComp());
if (null != jclDepartment.getParentComp()) {
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(Util.null2String(jclDepartment.getParentComp())));
params.put("parent_comp", jclDepartment.getSubCompanyId1());
if (null != jclDepartment.getSubCompanyId1()) {
params.put("ec_company", jclDepartment.getSubCompanyId1());
}
}
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.setEcDepartment(Long.parseLong(department));
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(department);
jobById.setEcDepartment(Integer.parseInt(department));
DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(jobById.getEcDepartment());
if (null != jclDepartmentId) {
jobById.setParentDept(jclDepartmentId.getId());
//分部赋值
jobById.setEcCompany(jclDepartmentId.getEcCompany());
jobById.setParentComp(jclDepartmentId.getParentComp());
jobById.setEcCompany(jclDepartmentId.getSubCompanyId1());
jobById.setParentComp(jclDepartmentId.getSubCompanyId1());
}
// 清空上级岗位
jobById.setParentJob(null);
@ -489,7 +489,7 @@ public class JobServiceImpl extends Service implements JobService {
if (params.getForbiddenTag()) {
// 启用:判断上级部门是否启用,上级部门启用,岗位才可启用
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(jobById.getParentDept());
OrganizationAssert.isTrue(0 == parentDepartment.getForbiddenTag(), "该岗位不能解封,请先解封上级部门");
OrganizationAssert.isTrue(0 == parentDepartment.getCanceled(), "该岗位不能解封,请先解封上级部门");
// 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用
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) {
job.setParentComp(parentCompany);
job.setEcCompany(ecCompany);
@ -627,11 +627,11 @@ public class JobServiceImpl extends Service implements JobService {
*/
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
builderDeparts.add(departmentPO);
if (SearchTreeUtil.isTop(departmentPO.getParentDept())) {
if (SearchTreeUtil.isTop(departmentPO.getSupDepId())) {
return;
}
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getParentDept());
if (null != parentDept && 0 == parentDept.getForbiddenTag()) {
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getSupDepId());
if (null != parentDept && 0 == parentDept.getCanceled()) {
buildParentDepts(parentDept, builderDeparts);
}
}
@ -663,13 +663,13 @@ public class JobServiceImpl extends Service implements JobService {
// 通过分部、公司 组装数据
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
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();
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild);
} 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<>();
for (DepartmentPO departmentPO : filterDeparts) {
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);
}
@ -816,7 +816,7 @@ public class JobServiceImpl extends Service implements JobService {
*
*/
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
* @return
*/
public static boolean assertNameRepeat(Long jobId, Long departmentId, Long parentJobId, String jobName, boolean throwException) {
int count = 0;
public static boolean assertNameRepeat(Long jobId, Integer departmentId, Long parentJobId, String jobName, boolean throwException) {
int count;
// 有上级岗位、判断相同层级下有无相同名称岗位
if (null != jobId) {
count = getJobMapper().countRepeatNameByPid(jobName, jobId, parentJobId, departmentId);
@ -856,9 +856,9 @@ public class JobServiceImpl extends Service implements JobService {
Long originalJobId = originalJob.getId();
Long targetJobId = targetJob.getId();
Integer parentComp = targetJob.getParentComp();
Long parentDept = targetJob.getParentDept();
Integer parentDept = targetJob.getParentDept();
Integer ecCompany = targetJob.getEcCompany();
Long ecDepartment = targetJob.getEcDepartment();
Integer ecDepartment = targetJob.getEcDepartment();
List<HrmResourcePO> resourceList = getResourceMapper().getResourceListByJobId(originalJobId);
getResourceMapper().updateResourceJob(originalJobId, targetJobId, parentComp, parentDept, ecCompany, ecDepartment);

@ -174,12 +174,12 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
* @param uId
* @return
*/
public static List<Long> getJclRoleLevels(Integer uId) {
List<Long> ecRoleLevels = new ArrayList<>();
public static List<Integer> getJclRoleLevels(Integer uId) {
List<Integer> ecRoleLevels = new ArrayList<>();
ManagerDetachMapper mangeDetachMapper = MapperProxyFactory.getProxy(ManagerDetachMapper.class);
List<ManagerDetachPO> detachListById = mangeDetachMapper.getDetachListById(uId);
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)) {
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.StaffsPO;
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.staff.StaffMapper;
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.MapperProxyFactory;
import com.engine.organization.util.excel.ExcelUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.conn.RecordSet;
@ -65,6 +65,10 @@ public class StaffServiceImpl extends Service implements StaffService {
return MapperProxyFactory.getProxy(JobMapper.class);
}
private DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class);
}
// 判断编制导入模板是否存在,不存在则创建该文件
static {
try {
@ -366,7 +370,7 @@ public class StaffServiceImpl extends Service implements StaffService {
if (null != compId) {
sqlWhere += " AND t.comp_id = '" + compId + "'";
}
Long deptId = param.getDeptId();
Integer deptId = param.getDeptId();
if (null != deptId) {
sqlWhere += " AND t.dept_id = '" + deptId + "'";
}
@ -374,7 +378,7 @@ public class StaffServiceImpl extends Service implements StaffService {
if (null != ecCompany) {
sqlWhere += " AND t.ec_company = '" + ecCompany + "'";
}
Long ecDepartment = param.getEcDepartment();
Integer ecDepartment = param.getEcDepartment();
if (null != ecDepartment) {
sqlWhere += " AND t.ec_department = '" + ecDepartment + "'";
}
@ -433,11 +437,11 @@ public class StaffServiceImpl extends Service implements StaffService {
break;
case "2":// 部门
OrganizationAssert.notNull(staffPO.getEcDepartment(), "编制维度选择部门时,部门必填!");
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(Util.null2String(staffPO.getEcDepartment()));
DepartmentPO jclDepartmentId = getDepartmentMapper().getDeptById(staffPO.getEcDepartment());
if (null != jclDepartmentId) {
staffPO.setDeptId(jclDepartmentId.getId());
staffPO.setCompId(jclDepartmentId.getParentComp());
staffPO.setEcCompany(jclDepartmentId.getEcCompany());
staffPO.setCompId(jclDepartmentId.getSubCompanyId1());
staffPO.setEcCompany(jclDepartmentId.getSubCompanyId1());
}
break;
case "3": // 岗位

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

@ -15,7 +15,7 @@ import weaver.hrm.User;
public class HrmResourceTransMethod {
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) {

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

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

@ -37,7 +37,7 @@ public class ResponseResult<T, R> {
private void permission() {
if (permission) {
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 {
private boolean DETACH = "true".equals(new BaseBean().getPropValue("hrmOrganization", "detach"));
private final List<Long> jclRoleLevels;
private final List<Integer> jclRoleLevels;
public DetachUtil(Integer uId) {
if (1 == uId) {
@ -38,7 +38,7 @@ public class DetachUtil {
*/
public void filterCompanyList(List<CompanyPO> 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) {
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) { //自定义浏览按钮
try {
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 + "'";
rs.execute(sql);
if (rs.next()) {//建模浏览框
@ -239,7 +241,7 @@ public class FieldDefinedValueUtil {
try {
BrowserBean bb = browser.searchById(s);
String name = Util.null2String(bb.getName());
if (showName.toString().equals("")) {
if ("".equals(showName.toString())) {
showName.append(name);
} else {
showName.append(",").append(name);
@ -254,12 +256,12 @@ public class FieldDefinedValueUtil {
}
} else if (fieldType == 256 || fieldType == 257) {
if (!fieldValue.equals("null")) {
if (!"null".equals(fieldValue)) {
CustomTreeUtil customTreeUtil = new CustomTreeUtil();
for (String s : tempshowidlist) {
String show_val = Util.null2String(s);
String name = customTreeUtil.getTreeFieldShowName(show_val, requestId);
if (showName.toString().equals("")) {
if ("".equals(showName.toString())) {
showName.append(name);
} else {
showName.append(",").append(name);
@ -274,8 +276,8 @@ public class FieldDefinedValueUtil {
+ fieldType);
String keyColumName = new BrowserComInfo()
.getBrowserkeycolumname("" + fieldType);
if (columName.equals("") || tableName.equals("")
|| keyColumName.equals("") || fieldValue.equals("")) {
if ("".equals(columName) || "".equals(tableName)
|| "".equals(keyColumName) || "".equals(fieldValue)) {
new BaseBean().writeLog("GET FIELD ERR: fieldType=" + fieldType);
} else {
sql = "select " + columName + " from " + tableName
@ -291,7 +293,7 @@ public class FieldDefinedValueUtil {
showName = new StringBuilder(showName.substring(0, showName.length() - 1));
}
} else if (fieldHtmlType == 4) { // check框
if (fieldValue.equals("1")) {
if ("1".equals(fieldValue)) {
showName.append("√");
}
} 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.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.util.List;
@ -63,25 +62,13 @@ public class EcHrmRelationUtil {
* @return
*/
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());
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) {
JobPO jobById = getJobMapper().getJobById(jclJobId);
if (null == jobById) {

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

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

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

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

@ -156,4 +156,8 @@ public class SearchTreeUtil {
public static boolean isTop(Long 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);
Map<String, Object> map = ParamUtil.request2Map(request);
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) {
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.service.DepartmentService;
import com.engine.organization.service.impl.DepartmentServiceImpl;
import com.engine.organization.thread.DepartmentTriggerRunnable;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationWrapper;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.response.ReturnResult;
import org.apache.commons.lang.StringUtils;
import weaver.hrm.User;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -97,8 +98,8 @@ public class DepartmentWrapper extends OrganizationWrapper {
public Long saveBaseForm(Map<String, Object> params) {
Long departmentId = getDepartmentService(user).saveBaseForm(params);
writeOperateLog(new Object() {
}.getClass(), params.get("dept_name").toString(), JSON.toJSONString(params), "新增部门");
new Thread(new DepartmentTriggerRunnable(departmentId)).start();
}.getClass(), params.get("departmentname").toString(), JSON.toJSONString(params), "新增部门");
// TODO new Thread(new DepartmentTriggerRunnable(departmentId)).start();
return departmentId;
}
@ -114,8 +115,8 @@ public class DepartmentWrapper extends OrganizationWrapper {
int updateForbiddenTagById = getDepartmentService(user).updateForbiddenTagById(params);
DepartmentPO newDeptById = getDepartmentMapper().getDeptById(params.getId());
writeOperateLog(new Object() {
}.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, newDeptById);
new Thread(new DepartmentTriggerRunnable(params.getForbiddenTag(),deptById, newDeptById)).start();
}.getClass(), deptById.getDepartmentName(), JSON.toJSONString(params), deptById, newDeptById);
// new Thread(new DepartmentTriggerRunnable(params.getForbiddenTag(),deptById, newDeptById)).start();
return updateForbiddenTagById;
}
@ -127,12 +128,12 @@ public class DepartmentWrapper extends OrganizationWrapper {
*/
@Log(operateType = OperateTypeEnum.UPDATE, operateDesc = "更新部门", operateModule = LogModuleNameEnum.DEPARTMENT)
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);
Long departmentId = getDepartmentService(user).updateForm(params);
DepartmentPO newDeptById = getDepartmentMapper().getDeptById(id);
writeOperateLog(new Object() {
}.getClass(), deptById.getDeptName(), JSON.toJSONString(params), deptById, newDeptById);
}.getClass(), deptById.getDepartmentName(), JSON.toJSONString(params), deptById, newDeptById);
return departmentId;
}
@ -142,16 +143,18 @@ public class DepartmentWrapper extends OrganizationWrapper {
* @param ids
*/
@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);
int deleteByIds = getDepartmentService(user).deleteByIds(ids);
Map<String, Object> map = getDepartmentService(user).deleteByIds(params);
for (DepartmentPO departmentPO : departmentPOS) {
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);
for (DepartmentPO departmentPO : departmentPOS) {
writeOperateLog(new Object() {
}.getClass(), departmentPO.getDeptName(), JSON.toJSONString(copyParam), "复制部门[" + departmentPO.getDeptName() + "]");
}.getClass(), departmentPO.getDepartmentName(), JSON.toJSONString(copyParam), "复制部门[" + departmentPO.getDepartmentName() + "]");
}
return copyDepartment;
}
@ -230,7 +233,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(mergeParam.getId());
int mergeDepartment = getDepartmentService(user).mergeDepartment(mergeParam);
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;
}
@ -254,7 +257,7 @@ public class DepartmentWrapper extends OrganizationWrapper {
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(moveParam.getId());
int moveDepartment = getDepartmentService(user).moveDepartment(moveParam);
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;
}
}

Loading…
Cancel
Save