|
|
|
@ -1,15 +1,25 @@
|
|
|
|
|
package com.engine.gainway.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.api.hrm.util.HrmReportDetachUtil;
|
|
|
|
|
import com.cloudstore.eccom.pc.table.WeaTable;
|
|
|
|
|
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
|
|
|
|
import com.cloudstore.eccom.pc.table.WeaTableType;
|
|
|
|
|
import com.cloudstore.eccom.result.WeaResultMsg;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.gainway.entity.EducationLevelPo;
|
|
|
|
|
import com.engine.gainway.service.BasicResourceTableService;
|
|
|
|
|
import com.engine.gainway.util.BasicResourceUtil;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.general.BaseBean;
|
|
|
|
|
import weaver.general.PageIdConst;
|
|
|
|
|
import weaver.general.TimeUtil;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
import weaver.hrm.appdetach.AppDetachComInfo;
|
|
|
|
|
import weaver.systeminfo.SystemEnv;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -23,7 +33,32 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> linkTable(Map<String, Object> params) {
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>(4);
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
|
|
|
|
|
|
String cmd = Util.null2String(params.get("cmd"));
|
|
|
|
|
String name = Util.null2String(params.get("name"));
|
|
|
|
|
String dateselect = Util.null2String(params.get("dateselect"));
|
|
|
|
|
String fromdate = Util.null2String(params.get("fromdate"));
|
|
|
|
|
String enddate = Util.null2String(params.get("enddate"));
|
|
|
|
|
String department =Util.null2String(params.get("departmentid"));
|
|
|
|
|
String subcompany =Util.null2String(params.get("subcompanyid"));
|
|
|
|
|
String location =Util.null2String(params.get("location"));
|
|
|
|
|
String status =Util.null2String(params.get("workstatus"));
|
|
|
|
|
String agearea =Util.null2String(params.get("agearea"));
|
|
|
|
|
HrmReportDetachUtil hrmReportDetachUtil = new HrmReportDetachUtil();
|
|
|
|
|
String startdateselect =Util.fromScreen(dateselect,user.getLanguage());
|
|
|
|
|
if(!"".equals(startdateselect) && !"0".equals(startdateselect) && !"6".equals(startdateselect)){
|
|
|
|
|
fromdate = TimeUtil.getDateByOption(startdateselect,"0");
|
|
|
|
|
enddate = TimeUtil.getDateByOption(startdateselect,"1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String field1 = bb.getPropValue("gwsecond", "deptOne");
|
|
|
|
|
String field2 = bb.getPropValue("gwsecond", "deptTwo");
|
|
|
|
|
String field3 = bb.getPropValue("gwsecond", "deptThree");
|
|
|
|
|
String field4 = bb.getPropValue("gwsecond", "deptFour");
|
|
|
|
|
String scopeId = bb.getPropValue("gwsecond", "scopeId");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WeaTable table = new WeaTable();
|
|
|
|
|
String pageId = "7036b679-029d-411f-b885-8e1720514f83";
|
|
|
|
|
table.setPageID(pageId);
|
|
|
|
@ -31,17 +66,81 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
|
|
|
|
|
String pageSize = PageIdConst.getPageSize(pageId, user.getUID());
|
|
|
|
|
table.setPagesize(pageSize);
|
|
|
|
|
|
|
|
|
|
String fields = "a.subcompanyid1,b."+field1+",b."+field2+",b."+field3+",b."+field4+",a.workcode,a.lastname,a.jobtitle,\n" +
|
|
|
|
|
" a.companystartdate,a.sex,a.birthday,a.birthday as age,a.educationlevel,a.companystartdate as companyworkyear";
|
|
|
|
|
table.setBackfields(fields);
|
|
|
|
|
String fromSql = "from hrmresource a left join cus_fielddata b on a.id = b.id and b.scopeid = "+scopeId;
|
|
|
|
|
table.setSqlform(fromSql);
|
|
|
|
|
|
|
|
|
|
String sqlWhere = "where (accounttype is null or accounttype = 0) ";
|
|
|
|
|
//查询条件筛选
|
|
|
|
|
if (!"".equals(fromdate) && !"0".equals(fromdate)) {
|
|
|
|
|
sqlWhere += " and a.companystartdate>= '"+fromdate+"'";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!"".equals(enddate) && !"0".equals(enddate)) {
|
|
|
|
|
sqlWhere += " and (a.companystartdate<='"+enddate+"' or a.companystartdate is null)";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!"".equals(location) && !"0".equals(location)){
|
|
|
|
|
sqlWhere += " and a.locationid ="+location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!"".equals(department) && !"0".equals(department)){
|
|
|
|
|
sqlWhere += " and a.departmentid in ("+department+") ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!"".equals(subcompany) && !"0".equals(subcompany)){
|
|
|
|
|
sqlWhere += " and a.subcompanyid1 in ("+subcompany+") ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!("".equals(status) || "9".equals(status))){
|
|
|
|
|
if("8".equals(status)){
|
|
|
|
|
sqlWhere += " and a.status <= 3";
|
|
|
|
|
}else{
|
|
|
|
|
sqlWhere += " and a.status ="+status;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String innerResourceSql = AppDetachComInfo.getInnerResourceSql();
|
|
|
|
|
innerResourceSql = innerResourceSql.replace("hrmresource", "a");
|
|
|
|
|
//只查询行政纬度人员
|
|
|
|
|
sqlWhere += " and "+innerResourceSql;
|
|
|
|
|
|
|
|
|
|
//按照pie图点击查询
|
|
|
|
|
String s = buildSqlwhere(cmd, name);
|
|
|
|
|
sqlWhere = sqlWhere+s;
|
|
|
|
|
|
|
|
|
|
// todo 分权暂时不做
|
|
|
|
|
String detachSqlWhere = hrmReportDetachUtil.getDetachSqlWhere(user.getUID(), "hrmresource");
|
|
|
|
|
|
|
|
|
|
table.setSqlwhere(sqlWhere);
|
|
|
|
|
table.setSqlprimarykey("a.id");
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "分部", "subcompanyid1").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectSubCompanyName"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "一级部门", field1));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "二级部门", field2));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "三级部门", field3));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "四级部门", field4));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "编号", "workcode"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "姓名", "lastname"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "岗位", "jobtitle").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectJobName"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "入职日期", "companystartDate"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "性别", "sex").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectSexName"));
|
|
|
|
|
if ("AgeRp".equals(cmd)) {
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "出生日期", "birthday"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "年龄", "age").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectAge"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("EduRp".equals(cmd)) {
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "学历", "educationlevel").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectEducation"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("SeniorityRp".equals(cmd)) {
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "司龄", "companyworkyear").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectCompanyYear"));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "分部", "resourceid").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectResourceName"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "一级部门", "workcode"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "二级部门", "subcompanyid1").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectSubCompanyName"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "三级部门", "departmentid").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectDeptName"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "四级部门", "jobtitle").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectJobName"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "考勤结果", "result").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectKqResult"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "考勤结果", "result").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectKqResult"));
|
|
|
|
|
table.getColumns().add(new WeaTableColumn("10%", "考勤结果", "result").setTransmethod("com.engine.kqsolution.util.ResourceSnipUtils.selectKqResult"));
|
|
|
|
|
table.setTableType(WeaTableType.NONE);
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
@ -49,4 +148,64 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
|
|
|
|
|
resultMap.putAll(result.getResultMap());
|
|
|
|
|
return resultMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String buildSqlwhere(String cmd,String name) {
|
|
|
|
|
String sql = "";
|
|
|
|
|
if ("AgeRp".equals(cmd)) {
|
|
|
|
|
if (SystemEnv.getHtmlLabelName(15863,user.getLanguage()).equals(name)) {
|
|
|
|
|
sql += " and (a.birthday is null or a.birthday ='')";
|
|
|
|
|
}else {
|
|
|
|
|
Map<String,String> map = BasicResourceUtil.selectRangeSet(name);
|
|
|
|
|
String fromDate = map.get("fromDate");
|
|
|
|
|
String toDate = map.get("toDate");
|
|
|
|
|
sql += " and a.birthday >'"+fromDate+"' and a.birthday <='"+toDate+"' and a.birthday is not null";
|
|
|
|
|
}
|
|
|
|
|
}else if("SexRp".equals(cmd)) {
|
|
|
|
|
if (SystemEnv.getHtmlLabelName(15808,user.getLanguage()).equals(name)) {
|
|
|
|
|
sql += " and (a.sex is null or a.sex ='')";
|
|
|
|
|
}else if (SystemEnv.getHtmlLabelName(28473,user.getLanguage()).equals(name)){
|
|
|
|
|
sql += " and a.sex = 0";
|
|
|
|
|
}else {
|
|
|
|
|
sql += " and a.sex = 1";
|
|
|
|
|
}
|
|
|
|
|
}else if ("SeniorityRp".equals(cmd)) {
|
|
|
|
|
if (SystemEnv.getHtmlLabelName(15863,user.getLanguage()).equals(name)) {
|
|
|
|
|
sql += " and (a.companystartdate is null or a.companystartdate ='')";
|
|
|
|
|
}else {
|
|
|
|
|
Map<String,String> map = BasicResourceUtil.companyYearRangeSet(name);
|
|
|
|
|
String fromDate = map.get("fromDate");
|
|
|
|
|
String toDate = map.get("toDate");
|
|
|
|
|
sql += " and a.companystartdate >'"+fromDate+"' and a.companystartdate <='"+toDate+"' and a.companystartdate is not null";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if ("EduRp".equals(cmd)) {
|
|
|
|
|
if (SystemEnv.getHtmlLabelName(21381,user.getLanguage()).equals(name)) {
|
|
|
|
|
sql += " and (a.educationlevel is null or a.educationlevel < 2)";
|
|
|
|
|
}else {
|
|
|
|
|
List<EducationLevelPo> educationLevel = new ArrayList<>();
|
|
|
|
|
//获取学历数据 不带多语言
|
|
|
|
|
getEduLevel(educationLevel);
|
|
|
|
|
Integer levelId = educationLevel.stream()
|
|
|
|
|
.filter(edu -> name.equals(edu.getLevelName()))
|
|
|
|
|
.map(EducationLevelPo::getId)
|
|
|
|
|
.findFirst()
|
|
|
|
|
.orElse(-1);
|
|
|
|
|
sql += " and a.educationlevel = "+levelId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return sql;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void getEduLevel(List<EducationLevelPo> educationLevel) {
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
rs.executeQuery("select id,name from hrmeducationlevel");
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
Integer id = Util.getIntValue(rs.getString("id"));
|
|
|
|
|
String name = Util.formatMultiLang(Util.null2String(rs.getString("name")),String.valueOf(user.getLanguage()));
|
|
|
|
|
educationLevel.add(EducationLevelPo.builder().id(id).levelName(name).build());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|