#QC3428087# 职称统计改为籍贯统计 籍贯统计增加明细数据

深圳市京贵投资有限公司
Chengliang 6 months ago
parent ed17924591
commit 2b66e41241

@ -9,6 +9,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.engine.hrm.biz.HrmFieldManager;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import weaver.common.StringUtil; import weaver.common.StringUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -885,6 +886,7 @@ public List<Map<String,String>> getWedlockRpResult(HttpServletRequest request, H
/* /*
* *
* *
* #QC3428087#
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -957,26 +959,55 @@ public List<Map<String,String>> getJobCallRpResult(HttpServletRequest request, H
String sqlstr=""; String sqlstr="";
String nullmothod = ""; String nullmothod = "";
if(rs.getDBType().equals("oracle"))
{ //#QC3428087 职称统计改为籍贯统计#
nullmothod = "nvl(t1.jobcall,0)"; // if(rs.getDBType().equals("oracle"))
} // {
else if(rs.getDBType().equals("db2")) // nullmothod = "nvl(t1.jobcall,0)";
{ // }
nullmothod = "coalesce(t1.jobcall,0)"; // else if(rs.getDBType().equals("db2"))
// {
// nullmothod = "coalesce(t1.jobcall,0)";
// }else if(DialectUtil.isMySql(rs.getDBType())){
// nullmothod = DbDialectFactory.get(rs.getDBType()).isNull("t1.jobcall", 0) ;
// }else{
// nullmothod = "ISNULL(t1.jobcall,0)";
// }
// if(sqlwhere.equals(""))
// {
// sqlstr = "select "+nullmothod+" jobcall,COUNT(distinct t1.id) resultcount from HrmResource t1 where (t1.accounttype is null or t1.accounttype=0) group by t1.jobcall";
// }
// else
// sqlstr = "select "+nullmothod+" jobcall,COUNT(distinct t1.id) resultcount from HrmResource t1 where (t1.accounttype is null or t1.accounttype=0) "+sqlwhere+" group by t1.jobcall";
// sqlstr = "select a.jobcall, sum(a.resultcount) resultcount from ("+sqlstr+") a group by a.jobcall";
// rs.executeSql(sqlstr);
//#QC3428087# 职称统计改为籍贯统计#
String nativeplace = new BaseBean().getPropValue("gwsecond", "nativeplace");
if("oracle".equals(rs.getDBType())) {
nullmothod = "nvl(t2."+nativeplace+",0)";
} else if("db2".equals(rs.getDBType())) {
nullmothod = "coalesce(t2."+nativeplace+",0)";
}else if(DialectUtil.isMySql(rs.getDBType())){ }else if(DialectUtil.isMySql(rs.getDBType())){
nullmothod = DbDialectFactory.get(rs.getDBType()).isNull("t1.jobcall", 0) ; nullmothod = DbDialectFactory.get(rs.getDBType()).isNull("t2."+nativeplace+"", 0) ;
}else{ }else{
nullmothod = "ISNULL(t1.jobcall,0)"; nullmothod = "ISNULL(t2."+nativeplace+",0)";
} }
if(sqlwhere.equals("")) if("".equals(sqlwhere)) {
{ sqlstr = "select "+nullmothod+" nativeplace,COUNT(distinct t1.id) resultcount from HrmResource t1 left join cus_fielddata t2 \n" +
sqlstr = "select "+nullmothod+" jobcall,COUNT(distinct t1.id) resultcount from HrmResource t1 where (t1.accounttype is null or t1.accounttype=0) group by t1.jobcall"; " on t1.id = t2.id and t2.scopeid = 1 and t2.scope = 'HrmCustomFieldByInfoType'\n" +
" WHERE( t1.accounttype IS NULL OR t1.accounttype = 0 ) GROUP BY\n" +
" t2."+nativeplace;
} else {
sqlstr = "select "+nullmothod+" nativeplace,COUNT(distinct t1.id) resultcount from HrmResource t1 left join cus_fielddata t2 \n" +
" on t1.id = t2.id and t2.scopeid = 1 and t2.scope = 'HrmCustomFieldByInfoType'\n" +
" WHERE( t1.accounttype IS NULL OR t1.accounttype = 0 )"+sqlwhere+" GROUP BY\n" +
" t2."+nativeplace;
sqlstr = "select a.nativeplace, sum(a.resultcount) resultcount from ("+sqlstr+") a group by a.nativeplace";
} }
else
sqlstr = "select "+nullmothod+" jobcall,COUNT(distinct t1.id) resultcount from HrmResource t1 where (t1.accounttype is null or t1.accounttype=0) "+sqlwhere+" group by t1.jobcall"; rs.executeQuery(sqlstr);
sqlstr = "select a.jobcall, sum(a.resultcount) resultcount from ("+sqlstr+") a group by a.jobcall";
rs.executeSql(sqlstr);
while(rs.next()) { while(rs.next()) {
int resultcount = rs.getInt(2); int resultcount = rs.getInt(2);
@ -985,6 +1016,7 @@ public List<Map<String,String>> getJobCallRpResult(HttpServletRequest request, H
rs.beforFirst(); rs.beforFirst();
List<Map<String,String>> list = new ArrayList<Map<String,String>>(); List<Map<String,String>> list = new ArrayList<Map<String,String>>();
Map<String, String> map = null; Map<String, String> map = null;
HrmFieldManager hrmFieldManager = new HrmFieldManager();
if(total!=0){ if(total!=0){
while(rs.next()){ while(rs.next()){
String resultid = rs.getString(1); String resultid = rs.getString(1);
@ -996,7 +1028,8 @@ public List<Map<String,String>> getJobCallRpResult(HttpServletRequest request, H
title = SystemEnv.getHtmlLabelName(15863,user.getLanguage()); title = SystemEnv.getHtmlLabelName(15863,user.getLanguage());
}else{ }else{
try { try {
title = Util.toScreen(new JobCallComInfo().getJobCallname(resultid),user.getLanguage()); title = hrmFieldManager.getFieldvalue(user, null, 0, 3, 2222, resultid, 0);
title = Util.formatMultiLang(title, Util.null2String(user.getLanguage()));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -0,0 +1,24 @@
package com.engine.gainway.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author liang.cheng
* @Date 2024/12/12 5:49 PM
* @Description: TODO
* @Version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ProvinceNamePo {
private Integer id;
private String provinceName;
}

@ -7,6 +7,7 @@ import com.cloudstore.eccom.pc.table.WeaTableType;
import com.cloudstore.eccom.result.WeaResultMsg; import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.gainway.entity.EducationLevelPo; import com.engine.gainway.entity.EducationLevelPo;
import com.engine.gainway.entity.ProvinceNamePo;
import com.engine.gainway.service.BasicResourceTableService; import com.engine.gainway.service.BasicResourceTableService;
import com.engine.gainway.util.BasicResourceUtil; import com.engine.gainway.util.BasicResourceUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -57,6 +58,7 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
String field3 = bb.getPropValue("gwsecond", "deptThree"); String field3 = bb.getPropValue("gwsecond", "deptThree");
String field4 = bb.getPropValue("gwsecond", "deptFour"); String field4 = bb.getPropValue("gwsecond", "deptFour");
String scopeId = bb.getPropValue("gwsecond", "scopeId"); String scopeId = bb.getPropValue("gwsecond", "scopeId");
String nativeplace = bb.getPropValue("gwsecond", "nativeplace");
WeaTable table = new WeaTable(); WeaTable table = new WeaTable();
@ -66,10 +68,11 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
String pageSize = PageIdConst.getPageSize(pageId, user.getUID()); String pageSize = PageIdConst.getPageSize(pageId, user.getUID());
table.setPagesize(pageSize); table.setPagesize(pageSize);
String fields = "a.subcompanyid1,b."+field1+",b."+field2+",b."+field3+",b."+field4+",a.workcode,a.lastname,a.jobtitle,\n" + String fields = "a.subcompanyid1,b."+field1+",b."+field2+",b."+field3+",b."+field4+",c."+nativeplace+",a.workcode,a.lastname,a.jobtitle,\n" +
" a.companystartdate,a.sex,a.birthday,a.birthday as age,a.educationlevel,a.companystartdate as companyworkyear"; " a.companystartdate,a.sex,a.birthday,a.birthday as age,a.educationlevel,a.companystartdate as companyworkyear";
table.setBackfields(fields); table.setBackfields(fields);
String fromSql = "from hrmresource a left join cus_fielddata b on a.id = b.id and b.scopeid = "+scopeId; String fromSql = "from hrmresource a left join cus_fielddata b on a.id = b.id and b.scope = 'HrmCustomFieldByInfoType' " +
" and b.scopeid = "+scopeId+" left join cus_fielddata c on a.id = c.id and c.scope = 'HrmCustomFieldByInfoType' and c.scopeid = 1";
table.setSqlform(fromSql); table.setSqlform(fromSql);
String sqlWhere = "where (accounttype is null or accounttype = 0) "; String sqlWhere = "where (accounttype is null or accounttype = 0) ";
@ -112,7 +115,7 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
String s = buildSqlwhere(cmd, name); String s = buildSqlwhere(cmd, name);
sqlWhere = sqlWhere+s; sqlWhere = sqlWhere+s;
// todo 分权暂时不做 // todo 分权不做 该项目未开启分权
String detachSqlWhere = hrmReportDetachUtil.getDetachSqlWhere(user.getUID(), "hrmresource"); String detachSqlWhere = hrmReportDetachUtil.getDetachSqlWhere(user.getUID(), "hrmresource");
table.setSqlwhere(sqlWhere); table.setSqlwhere(sqlWhere);
@ -138,7 +141,10 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
if ("SeniorityRp".equals(cmd)) { if ("SeniorityRp".equals(cmd)) {
table.getColumns().add(new WeaTableColumn("10%", "司龄", "companyworkyear").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectCompanyYear")); table.getColumns().add(new WeaTableColumn("10%", "司龄", "companyworkyear").setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectCompanyYear"));
}
if ("JobCallRp".equals(cmd)) {
table.getColumns().add(new WeaTableColumn("10%", "籍贯(省)", nativeplace).setTransmethod("com.engine.gainway.transmethod.BasicResourceTrans.selectNativeplace").setOtherpara(String.valueOf(user.getUID())));
} }
table.setTableType(WeaTableType.NONE); table.setTableType(WeaTableType.NONE);
@ -150,6 +156,7 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
} }
private String buildSqlwhere(String cmd,String name) { private String buildSqlwhere(String cmd,String name) {
String nativeplace = new BaseBean().getPropValue("gwsecond", "nativeplace");
String sql = ""; String sql = "";
if ("AgeRp".equals(cmd)) { if ("AgeRp".equals(cmd)) {
if (SystemEnv.getHtmlLabelName(15863,user.getLanguage()).equals(name)) { if (SystemEnv.getHtmlLabelName(15863,user.getLanguage()).equals(name)) {
@ -183,7 +190,7 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
sql += " and (a.educationlevel is null or a.educationlevel < 2)"; sql += " and (a.educationlevel is null or a.educationlevel < 2)";
}else { }else {
List<EducationLevelPo> educationLevel = new ArrayList<>(); List<EducationLevelPo> educationLevel = new ArrayList<>();
//获取学历数据 不带多语言 //获取学历数据
getEduLevel(educationLevel); getEduLevel(educationLevel);
Integer levelId = educationLevel.stream() Integer levelId = educationLevel.stream()
.filter(edu -> name.equals(edu.getLevelName())) .filter(edu -> name.equals(edu.getLevelName()))
@ -192,6 +199,19 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
.orElse(-1); .orElse(-1);
sql += " and a.educationlevel = "+levelId; sql += " and a.educationlevel = "+levelId;
} }
}else if("JobCallRp".equals(cmd)) {
if (SystemEnv.getHtmlLabelName(15863,user.getLanguage()).equals(name)) {
sql += " and (c."+nativeplace+" is null or c."+nativeplace+" ='')";
} else {
List<ProvinceNamePo> provinceNames = new ArrayList<>();
getNativeplace(provinceNames);
Integer provinceId = provinceNames.stream()
.filter(edu -> name.equals(edu.getProvinceName()))
.map(ProvinceNamePo::getId)
.findFirst()
.orElse(-1);
sql += " and c."+nativeplace+"= "+provinceId;
}
} }
@ -208,4 +228,14 @@ public class BasicResourceTableServiceImpl extends Service implements BasicResou
educationLevel.add(EducationLevelPo.builder().id(id).levelName(name).build()); educationLevel.add(EducationLevelPo.builder().id(id).levelName(name).build());
} }
} }
private void getNativeplace(List<ProvinceNamePo> provinceNames) {
RecordSet rs = new RecordSet();
rs.executeQuery("select id,provincename from hrmprovince");
while (rs.next()) {
Integer id = Util.getIntValue(rs.getString("id"));
String name = Util.formatMultiLang(Util.null2String(rs.getString("provincename")),String.valueOf(user.getLanguage()));
provinceNames.add(ProvinceNamePo.builder().id(id).provinceName(name).build());
}
}
} }

@ -1,7 +1,10 @@
package com.engine.gainway.transmethod; package com.engine.gainway.transmethod;
import com.engine.gainway.util.BasicResourceUtil; import com.engine.gainway.util.BasicResourceUtil;
import com.engine.hrm.biz.HrmFieldManager;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.SubCompanyComInfo; import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.job.EducationLevelComInfo; import weaver.hrm.job.EducationLevelComInfo;
import weaver.hrm.job.JobTitlesComInfo; import weaver.hrm.job.JobTitlesComInfo;
@ -67,4 +70,19 @@ public class BasicResourceTrans {
} }
public static String selectNativeplace(String nativeplace,String userId) {
HrmFieldManager hrmFieldManager = new HrmFieldManager();
String title = "";
User user = new User();
try {
user.setUid(Integer.parseInt(userId));
title = hrmFieldManager.getFieldvalue(user, null, 0, 3, 2222, nativeplace, 0);
title = Util.formatMultiLang(title, Util.null2String(user.getLanguage()));
}catch (Exception e) {
e.printStackTrace();
}
return title;
}
} }

@ -1,5 +1,9 @@
package test; package test;
import com.engine.hrm.biz.HrmFieldManager;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -31,4 +35,16 @@ public class MainTest {
System.out.println("Age From: " + ageFrom); System.out.println("Age From: " + ageFrom);
System.out.println("Age To: " + ageTo); System.out.println("Age To: " + ageTo);
} }
public static String getBrowserShowNames(User user, int browserType, String value) {
HrmFieldManager hrmFieldManager = new HrmFieldManager();
String fieldShowName;
try {
fieldShowName = hrmFieldManager.getFieldvalue(user, null, 0, 3, browserType, value, 0);
fieldShowName = Util.formatMultiLang(fieldShowName, Util.null2String(user.getLanguage()));
} catch (Exception e) {
throw new RuntimeException(e);
}
return fieldShowName;
}
} }

Loading…
Cancel
Save