Merge pull request '组织架构图搜索条件优化、Resin编译 异常、警告处理' (#165) from feature/dxf into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/165
This commit is contained in:
commit
c38a758129
|
|
@ -1,10 +1,7 @@
|
|||
package com.engine.organization.entity.browser.po;
|
||||
|
||||
import com.api.browser.bean.BrowserBean;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -17,6 +14,7 @@ import java.util.Map;
|
|||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class CustomBrowserBean extends BrowserBean {
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.engine.organization.entity.chart;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/06/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CompanyTreePO {
|
||||
private String id;
|
||||
private String pId;
|
||||
private String value;
|
||||
private String title;
|
||||
private boolean isLeaf;
|
||||
|
||||
public boolean getIsLeaf() {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from hrmsubcompany where (canceled is null or canceled != '1') and supsubcomid = ?",id);
|
||||
return rs.next();
|
||||
}
|
||||
|
||||
public String getpId() {
|
||||
return pId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
package com.engine.organization.entity.company.param;
|
||||
|
||||
import com.engine.organization.common.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -15,6 +12,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class CompParam extends BaseQueryParam {
|
||||
private Integer Id;
|
||||
private String subCompanyName;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package com.engine.organization.entity.department.param;
|
||||
|
||||
import com.engine.organization.common.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
|
|
@ -16,6 +13,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class DeptSearchParam extends BaseQueryParam {
|
||||
private Integer id;
|
||||
private String departmentMark;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package com.engine.organization.entity.department.param;
|
||||
|
||||
import com.engine.organization.common.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -16,6 +13,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class QuerySingleDeptListParam extends BaseQueryParam {
|
||||
|
||||
private Integer parentComp;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package com.engine.organization.entity.hrmresource.param;
|
||||
|
||||
import com.engine.organization.common.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -15,6 +12,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class HrmResourceSearchParam extends BaseQueryParam {
|
||||
/**
|
||||
* 姓名
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package com.engine.organization.entity.job.param;
|
||||
|
||||
import com.engine.organization.common.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
|
|
@ -16,6 +13,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class JobSearchParam extends BaseQueryParam {
|
||||
/**
|
||||
* 主键
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.engine.organization.entity.searchtree;
|
||||
|
||||
import com.api.hrm.bean.TreeNode;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -11,7 +10,6 @@ import java.util.Objects;
|
|||
* @createTime: 2022/05/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class SearchTree extends TreeNode {
|
||||
private String companyid;
|
||||
private String isVirtual;
|
||||
|
|
@ -22,6 +20,70 @@ public class SearchTree extends TreeNode {
|
|||
private String parentComp;
|
||||
private Integer orderNum;
|
||||
|
||||
public String getCompanyid() {
|
||||
return companyid;
|
||||
}
|
||||
|
||||
public void setCompanyid(String companyid) {
|
||||
this.companyid = companyid;
|
||||
}
|
||||
|
||||
public String getIsVirtual() {
|
||||
return isVirtual;
|
||||
}
|
||||
|
||||
public void setIsVirtual(String isVirtual) {
|
||||
this.isVirtual = isVirtual;
|
||||
}
|
||||
|
||||
public String getPsubcompanyid() {
|
||||
return psubcompanyid;
|
||||
}
|
||||
|
||||
public void setPsubcompanyid(String psubcompanyid) {
|
||||
this.psubcompanyid = psubcompanyid;
|
||||
}
|
||||
|
||||
public String getDisplayType() {
|
||||
return displayType;
|
||||
}
|
||||
|
||||
public void setDisplayType(String displayType) {
|
||||
this.displayType = displayType;
|
||||
}
|
||||
|
||||
public boolean isCanceled() {
|
||||
return isCanceled;
|
||||
}
|
||||
|
||||
public void setCanceled(boolean canceled) {
|
||||
isCanceled = canceled;
|
||||
}
|
||||
|
||||
public String getRequestParams() {
|
||||
return requestParams;
|
||||
}
|
||||
|
||||
public void setRequestParams(String requestParams) {
|
||||
this.requestParams = requestParams;
|
||||
}
|
||||
|
||||
public String getParentComp() {
|
||||
return parentComp;
|
||||
}
|
||||
|
||||
public void setParentComp(String parentComp) {
|
||||
this.parentComp = parentComp;
|
||||
}
|
||||
|
||||
public Integer getOrderNum() {
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum) {
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@
|
|||
from jcl_org_job
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
and parent_dept = = #{supDepId}
|
||||
and parent_dept = #{supDepId}
|
||||
</select>
|
||||
<select id="getIdByDepartmentCode" resultType="java.lang.String">
|
||||
select id
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@ public interface OrgChartService {
|
|||
*/
|
||||
Map<String, Object> getOptionCondition(Map<String, Object> request2Map, User user);
|
||||
|
||||
/**
|
||||
* 分部树下级数据
|
||||
* @param params [params]
|
||||
* @return java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
Map<String, Object> getSubCompanyTree(Map<String, Object> params);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 组织架构图
|
||||
* @Author: liang.cheng
|
||||
|
|
|
|||
|
|
@ -48,14 +48,15 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
|
|||
// 2.表头(后面动态获取)
|
||||
List<List<Object>> excelSheetData = new ArrayList<>();
|
||||
|
||||
String[] header = {
|
||||
Object[] header = {
|
||||
HrmI18nUtil.getI18nLabel( 93270, "姓名"),
|
||||
HrmI18nUtil.getI18nLabel( 93272, "部门"),
|
||||
HrmI18nUtil.getI18nLabel( 93274, "分部"),
|
||||
HrmI18nUtil.getI18nLabel( 93275, "移动电话"),
|
||||
HrmI18nUtil.getI18nLabel( 93278, "办公室电话"),
|
||||
HrmI18nUtil.getI18nLabel( 93279, "直接上级")};
|
||||
excelSheetData.add(Arrays.asList(header));
|
||||
List<Object> strings = Arrays.asList(header);
|
||||
excelSheetData.add(strings);
|
||||
|
||||
//数据
|
||||
List<List<Object>> rows = new LinkedList<>();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.organization.service.impl;
|
|||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.chart.CompanyTreePO;
|
||||
import com.engine.organization.entity.map.JclOrgMap;
|
||||
import com.engine.organization.entity.scheme.po.GradePO;
|
||||
import com.engine.organization.entity.scheme.po.LevelPO;
|
||||
|
|
@ -46,13 +47,13 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
List<Map<String, Object>> fclasslist = new ArrayList<>();
|
||||
Map<String, Object> defaultItem = new HashMap<>();
|
||||
int fkey = 0;
|
||||
defaultItem.put("key",fkey++);
|
||||
defaultItem.put("key", fkey++);
|
||||
defaultItem.put("id", "0");
|
||||
defaultItem.put("companyname", "行政维度");
|
||||
fclasslist.add(defaultItem);
|
||||
while (rs.next()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("key",fkey++);
|
||||
item.put("key", fkey++);
|
||||
item.put("id", rs.getString("id"));
|
||||
item.put("companyname", rs.getString("companyname"));
|
||||
fclasslist.add(item);
|
||||
|
|
@ -80,9 +81,40 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
item.setFname(rs.getString("fname"));
|
||||
companySet.add(item);
|
||||
}
|
||||
|
||||
List<CompanyTreePO> companyTree = new ArrayList<>();
|
||||
sql = "select id as 'id', id as 'value', subcompanyname as 'title', supsubcomid as 'pId' from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '0'";
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).build());
|
||||
}
|
||||
result.put("api_status", true);
|
||||
result.put("fclasslist", fclasslist);
|
||||
result.put("companylist", companySet);
|
||||
result.put("companyTree", companyTree);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSubCompanyTree(Map<String, Object> params) {
|
||||
Map<String, Object> result = new HashMap<>(2);
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
List<CompanyTreePO> companyTree = new ArrayList<>();
|
||||
String subcompany = Util.null2String(params.get("subcompany"));
|
||||
if (StringUtils.isBlank(subcompany)) {
|
||||
subcompany = "0";
|
||||
}
|
||||
String fclass = Util.null2String(params.get("fclass"));
|
||||
String sql = "select id as 'id', id as 'value', subcompanyname as 'title', supsubcomid as 'pId' from hrmsubcompany where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "'";
|
||||
if (StringUtils.isNotBlank(fclass) && !"0".equals(fclass)) {
|
||||
sql = "select id as 'id', id as 'value', subcompanyname as 'title', supsubcomid as 'pId' from hrmsubcompanyvirtual where (canceled is null or canceled != '1') and " + DBType.get(new RecordSet().getDBType()).ifNull("supsubcomid", "0") + " = '" + subcompany + "' and companyid = '" + fclass + "'";
|
||||
}
|
||||
rs.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
companyTree.add(CompanyTreePO.builder().id(rs.getString("id")).pId(rs.getString("pId")).value(rs.getString("value")).title(rs.getString("title")).build());
|
||||
}
|
||||
result.put("companyTree", companyTree);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +132,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
String whereSql = " where 1 = 1 ";
|
||||
if (DBType.isOracle()) {
|
||||
whereSql += " and ((fdatebegin <= to_date('" + date + "','yyyy-MM-DD') and fdateend >= to_date('" + date + "','yyyy-MM-DD')) or (fdatebegin <= to_date('" + date + "','yyyy-MM-DD') and fdateend is null )) ";
|
||||
}else {
|
||||
} else {
|
||||
whereSql += " and ((fdatebegin <= '" + date + "' and fdateend >= '" + date + "') or (fdatebegin <= '" + date + "' and fdateend is null )) ";
|
||||
}
|
||||
whereSql += " and fclass = " + fclass + " ";
|
||||
|
|
@ -227,7 +259,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
String whereSql = " where 1 = 1 ";
|
||||
if (DBType.isOracle()) {
|
||||
whereSql += " and ((t.fdatebegin <= to_date('" + date + "','yyyy-MM-DD') and t.fdateend >= to_date('" + date + "','yyyy-MM-DD')) or (t.fdatebegin <= to_date('" + date + "','yyyy-MM-DD') and t.fdateend is null )) ";
|
||||
}else {
|
||||
} else {
|
||||
whereSql += " and ((t.fdatebegin <= '" + date + "' and t.fdateend >= '" + date + "') or (t.fdatebegin <= '" + date + "' and t.fdateend is null )) ";
|
||||
}
|
||||
whereSql += " and t.fclass = " + fclass + " ";
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.engine.organization.util.page;
|
|||
|
||||
import com.engine.organization.annotation.TableTitle;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
|
@ -10,6 +11,7 @@ import java.util.List;
|
|||
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class PageInfo<T> extends com.github.pagehelper.PageInfo<T> {
|
||||
Class<T> clazz;
|
||||
|
||||
|
|
|
|||
|
|
@ -116,49 +116,6 @@ public class ReturnResult<T> implements Serializable {
|
|||
return new ReturnResult<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败返回结果
|
||||
*
|
||||
* @param errorCode
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> ReturnResult<T> failed(IErrorCode errorCode) {
|
||||
return new ReturnResult<>(errorCode.getCode(), errorCode.getMessage(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败状态
|
||||
*
|
||||
* @param msg
|
||||
* @return
|
||||
*/
|
||||
public static <T> ReturnResult<T> failed(String msg) {
|
||||
return failed(ResultCode.FAILED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 参数验证失败
|
||||
*
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> ReturnResult<T> validateFailed() {
|
||||
return failed(ResultCode.VALIDATE_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数验证失败,返回信息
|
||||
*
|
||||
* @param msg
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> ReturnResult<T> validateFailed(String msg) {
|
||||
return new ReturnResult<>(ResultCode.VALIDATE_FAILED.getCode(), msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常处理
|
||||
*
|
||||
|
|
@ -171,27 +128,4 @@ public class ReturnResult<T> implements Serializable {
|
|||
return new ReturnResult<>(ResultCode.FAILED.getCode(), e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 未登录返回结果 。 token过期..
|
||||
*
|
||||
* @param data
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> ReturnResult<T> unauthorized(T data) {
|
||||
return new ReturnResult<>(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 未授权返回结果
|
||||
*
|
||||
* @param data
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> ReturnResult<T> forbiden(T data) {
|
||||
return new ReturnResult<>(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ public class HrmResourceController {
|
|||
public ReturnResult getCustomTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String,Object> params = request.getParameterMap();
|
||||
Map<String, Object> params = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).getCustomTemplate(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,25 @@ public class OrgChartController {
|
|||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getSubCompanyTree")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getSubCompanyTree(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
//实例化Service 并调用业务类处理
|
||||
apidatas = getOrgChartWrapper(user).getSubCompanyTree(ParamUtil.request2Map(request), user);
|
||||
} catch (Exception e) {
|
||||
//异常处理
|
||||
e.printStackTrace();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
//数据转换
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
/**
|
||||
* 组织架构数据
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ public class OrgChartWrapper extends Service {
|
|||
return getOrgChartService(user).getOptionCondition(request2Map, user);
|
||||
}
|
||||
|
||||
public Map<String, Object> getSubCompanyTree(Map<String, Object> request2Map, User user) {
|
||||
return getOrgChartService(user).getSubCompanyTree(request2Map);
|
||||
}
|
||||
|
||||
public Map<String, Object> getCompanyData(Map<String, Object> request2Map, User user) {
|
||||
return getOrgChartService(user).getCompanyData(request2Map, user);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue