#处理花名册页面 部门展示部门全路径,导出支持勾选数据导出
This commit is contained in:
parent
52f7695866
commit
433d3fabbe
|
|
@ -21,5 +21,5 @@ public interface ExportCommonService {
|
|||
*/
|
||||
XSSFWorkbook resourceExport(List<Long> ids);
|
||||
|
||||
XSSFWorkbook resourceExport(HttpServletRequest request, HttpServletResponse response);
|
||||
XSSFWorkbook resourceExport(HttpServletRequest request, HttpServletResponse response,String ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
|
|||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook resourceExport(HttpServletRequest request, HttpServletResponse response) {
|
||||
public XSSFWorkbook resourceExport(HttpServletRequest request, HttpServletResponse response,String ids) {
|
||||
List<String> headerList = new ArrayList<>();
|
||||
List<Object> headerNameList = new ArrayList<>();
|
||||
OrganizationWeaTable<HrmResourceVO> table = new OrganizationWeaTable<>(user, HrmResourceVO.class);
|
||||
|
|
@ -97,6 +97,11 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
|
|||
if (detachUtil.isDETACH()) {
|
||||
sqlWhere += " and t.subcompanyid1 in(" + parentCompanyIds + ")";
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
sqlWhere += " and t.id in(" + ids + ")";
|
||||
}
|
||||
|
||||
table.setSqlwhere(sqlWhere);
|
||||
List<WeaTableColumn> weaTableColumnList = new ArrayList<>();
|
||||
String columns = "";
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.api.browser.bean.SearchConditionOption;
|
|||
import com.api.browser.util.ConditionType;
|
||||
import com.api.hrm.bean.HrmFieldBean;
|
||||
import com.api.hrm.util.HrmFieldSearchConditionComInfo;
|
||||
import com.cloudstore.dev.api.util.Util_DataCache;
|
||||
import com.cloudstore.eccom.constant.WeaBoolAttr;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
|
|
@ -141,6 +142,11 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
List<String> fields = new ArrayList<>();
|
||||
List<SearchConditionGroup> allConditions = getAllConditions();
|
||||
|
||||
if (Util_DataCache.getObjVal("hmc_allDept") == null) {
|
||||
Map<String, Map<String, String>> deptStr = getDeptMap();
|
||||
Util_DataCache.setObjVal("hmc_allDept", deptStr, 7200);
|
||||
}
|
||||
|
||||
if (jclOrgCustomTemplatePO != null) {
|
||||
if (StringUtils.isNotBlank(jclOrgCustomTemplatePO.getBasicFields())) {
|
||||
columns = jclOrgCustomTemplatePO.getBasicFields();
|
||||
|
|
@ -1209,4 +1215,23 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
return selectKeys;
|
||||
}
|
||||
|
||||
private static Map<String, Map<String, String>> getDeptMap() {
|
||||
Map<String, Map<String, String>> data = new HashMap();
|
||||
String sql = "select id,departmentname,supdepid from HrmDepartment where (canceled IS NULL OR canceled !='1')";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
|
||||
while(rs.next()) {
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String departmentname = Util.null2String(rs.getString("departmentname"));
|
||||
String supdepid = Util.null2String(rs.getString("supdepid"));
|
||||
Map<String, String> obj = new HashMap();
|
||||
obj.put("departmentname", departmentname);
|
||||
obj.put("supdepid", supdepid);
|
||||
data.put(id, obj);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,20 @@
|
|||
package com.engine.organization.transmethod;
|
||||
|
||||
import com.cloudstore.dev.api.util.Util_DataCache;
|
||||
import com.engine.organization.entity.job.bo.JobBO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.json.JSONObject;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.definedfield.HrmFieldManager;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/21
|
||||
|
|
@ -18,14 +24,20 @@ public class HrmResourceTransMethod {
|
|||
|
||||
public static String getFieldTrueValue(String id, String para) {
|
||||
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType", Integer.parseInt(para.split("_")[0]));
|
||||
// hfm.getCustomFields();
|
||||
String fieldName = para.substring(para.lastIndexOf("_") + 1);
|
||||
JSONObject hrmFieldConf = hfm.getHrmFieldConf(fieldName);
|
||||
User user = new User();
|
||||
user.setUid(1);
|
||||
|
||||
try {
|
||||
return hfm.getFieldvalue(null, user, null, hrmFieldConf.getString("dmlurl"), hrmFieldConf.getInt("id"), hrmFieldConf.getInt("fieldhtmltype"), hrmFieldConf.getInt("type"), id, 0, fieldName);
|
||||
} catch (Exception e) {
|
||||
if ("departmentid".equals(fieldName)) {
|
||||
Map<String, Map<String, String>> dept = (Map) Util_DataCache.getObjVal("hmc_allDept");
|
||||
return getAllDepartmentName(id, dept);
|
||||
} else {
|
||||
return hfm.getFieldvalue((HttpSession)null, user, (String)null, hrmFieldConf.getString("dmlurl"), hrmFieldConf.getInt("id"), hrmFieldConf.getInt("fieldhtmltype"), hrmFieldConf.getInt("type"), id, 0, fieldName);
|
||||
}
|
||||
} catch (Exception var7) {
|
||||
(new BaseBean()).writeLog("getFieldTrueValue Exception:" + var7.getMessage());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -60,4 +72,26 @@ public class HrmResourceTransMethod {
|
|||
}
|
||||
return MapperProxyFactory.getProxy(SystemDataMapper.class).getScHrmResourceNameById(managerId);
|
||||
}
|
||||
|
||||
private static String getAllDepartmentName(String id, Map<String, Map<String, String>> dept) {
|
||||
String allname = "";
|
||||
String departmentname = "";
|
||||
|
||||
try {
|
||||
while(!"".equals(id) && !"0".equals(id)) {
|
||||
Map<String, String> obj = (Map)dept.get(id);
|
||||
id = Util.null2String((String)obj.get("supdepid"));
|
||||
departmentname = Util.null2String((String)obj.get("departmentname"));
|
||||
allname = departmentname + ">" + allname;
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
(new BaseBean()).writeLog("getAllDepartmentName Exception", var5.getMessage());
|
||||
}
|
||||
|
||||
if (!"".equals(allname)) {
|
||||
allname = allname.substring(0, allname.length() - 1);
|
||||
}
|
||||
|
||||
return allname;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class ExportCommonController {
|
|||
idList = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
}
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getExportCommonWrapper(user).resourceExport(request, response);
|
||||
XSSFWorkbook workbook = getExportCommonWrapper(user).resourceExport(request, response,ids);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "人员导出" + time;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class ExportCommonWrapper extends Service {
|
|||
return getExportCommonService(user).resourceExport(ids);
|
||||
}
|
||||
|
||||
public XSSFWorkbook resourceExport(HttpServletRequest request, HttpServletResponse response) {
|
||||
return getExportCommonService(user).resourceExport(request,response);
|
||||
public XSSFWorkbook resourceExport(HttpServletRequest request, HttpServletResponse response,String ids) {
|
||||
return getExportCommonService(user).resourceExport(request,response,ids);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue