Compare commits
4 Commits
master
...
深圳市京贵投资有限公
Author | SHA1 | Date |
---|---|---|
|
2b66e41241 | 4 months ago |
|
ed17924591 | 4 months ago |
|
2ef0c3a229 | 4 months ago |
|
2dcf46b579 | 4 months ago |
@ -0,0 +1,13 @@
|
||||
package com.api.gainway.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/12/11 2:18 PM
|
||||
* @Description: 基础人员状况报表
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Path("/gainway/basicResource")
|
||||
public class BasicResourceTableAction extends com.engine.gainway.web.BasicResourceTableAction {
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -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 EducationLevelPo {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String levelName;
|
||||
}
|
@ -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;
|
||||
}
|
@ -0,0 +1,241 @@
|
||||
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.entity.ProvinceNamePo;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/12/11 2:27 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class BasicResourceTableServiceImpl extends Service implements BasicResourceTableService {
|
||||
|
||||
@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");
|
||||
String nativeplace = bb.getPropValue("gwsecond", "nativeplace");
|
||||
|
||||
|
||||
WeaTable table = new WeaTable();
|
||||
String pageId = "7036b679-029d-411f-b885-8e1720514f83";
|
||||
table.setPageID(pageId);
|
||||
table.setPageUID(String.format("%s_%s",pageId,user.getUID()));
|
||||
String pageSize = PageIdConst.getPageSize(pageId, user.getUID());
|
||||
table.setPagesize(pageSize);
|
||||
|
||||
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";
|
||||
table.setBackfields(fields);
|
||||
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);
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
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);
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
resultMap.putAll(result.getResultMap());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
private String buildSqlwhere(String cmd,String name) {
|
||||
String nativeplace = new BaseBean().getPropValue("gwsecond", "nativeplace");
|
||||
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;
|
||||
}
|
||||
}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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package com.engine.gainway.transmethod;
|
||||
|
||||
import com.engine.gainway.util.BasicResourceUtil;
|
||||
import com.engine.hrm.biz.HrmFieldManager;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.job.EducationLevelComInfo;
|
||||
import weaver.hrm.job.JobTitlesComInfo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/12/12 9:33 AM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class BasicResourceTrans {
|
||||
|
||||
public static String selectSubCompanyName(String subcompanyid) {
|
||||
SubCompanyComInfo sub = new SubCompanyComInfo();
|
||||
return sub.getSubCompanyname(subcompanyid);
|
||||
}
|
||||
|
||||
public static String selectJobName(String jobId) {
|
||||
JobTitlesComInfo jc = new JobTitlesComInfo();
|
||||
return jc.getJobTitlesname(jobId);
|
||||
}
|
||||
|
||||
public static String selectSexName(String sex) {
|
||||
if (StringUtils.isEmpty(sex)) {
|
||||
return "未设置";
|
||||
}else {
|
||||
return "0".equals(sex) ? "男" : "女";
|
||||
}
|
||||
}
|
||||
|
||||
public static String selectAge(String birthday) {
|
||||
String age = "";
|
||||
if (StringUtils.isNotEmpty(birthday)) {
|
||||
age = String.valueOf(BasicResourceUtil.calculateAge(birthday));
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
public static String selectEducation(String educationlevel) {
|
||||
EducationLevelComInfo edu = new EducationLevelComInfo();
|
||||
String eduName = edu.getEducationLevelname(educationlevel);
|
||||
if (StringUtils.isEmpty(eduName)) {
|
||||
eduName = "空";
|
||||
}
|
||||
return eduName;
|
||||
}
|
||||
|
||||
public static String selectCompanyYear(String companydate) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int currentYear = calendar.get(Calendar.YEAR);
|
||||
String yearDifference = "";
|
||||
if (StringUtils.isNotEmpty(companydate)) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate date = LocalDate.parse(companydate, formatter);
|
||||
int dateYear = date.getYear();
|
||||
yearDifference = String.valueOf(currentYear - dateYear);
|
||||
}
|
||||
return yearDifference;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.engine.gainway.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.gainway.service.BasicResourceTableService;
|
||||
import com.engine.gainway.service.impl.BasicResourceTableServiceImpl;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author liang.cheng
|
||||
* @Date 2024/12/11 2:25 PM
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class BasicResourceTableAction {
|
||||
|
||||
private BasicResourceTableService getService(User user) {
|
||||
return ServiceUtil.getService(BasicResourceTableServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/linkTable")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String linkTable(@Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
Map<String, Object> data = new HashMap<>(8);
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
data.put("datas",getService(user).linkTable(ParamUtil.request2Map(request)));
|
||||
data.put("api_status", true);
|
||||
} catch (Exception e) {
|
||||
data.put("api_status", false);
|
||||
data.put("msg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue