#E10-16# 绩效接口优化、人员信息入职时间展示年日

main
shilei 1 year ago
parent 865852e719
commit 13a05b1050

@ -132,6 +132,8 @@ public class PortalPerformanceInfoCmd {
String period_month = "" ; String period_month = "" ;
String score = "0.0"; String score = "0.0";
String kpi_scheme = ""; String kpi_scheme = "";
String real_period = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
String nowDate = sdf.format(new Date())+"-01"; String nowDate = sdf.format(new Date())+"-01";
Map<String,String> scoreMap = getLastScore(nowDate); Map<String,String> scoreMap = getLastScore(nowDate);
@ -162,15 +164,52 @@ public class PortalPerformanceInfoCmd {
if (CollectionUtils.isNotEmpty(recordList)) { if (CollectionUtils.isNotEmpty(recordList)) {
Map<String, Object> recordMap = recordList.get(0); Map<String, Object> recordMap = recordList.get(0);
if (!recordMap.isEmpty()) { if (!recordMap.isEmpty()) {
kpi_scheme = String.valueOf(recordMap.get("kpi_scheme")); kpi_scheme = String.valueOf(recordMap.get("scheme_id"));
} }
} }
} }
log.error("kpi_scheme:"+kpi_scheme); log.error("kpi_scheme:"+kpi_scheme);
if(StringUtils.isNotBlank(kpi_scheme)){
dataMap.put("score", score); dataMap.put("score", score);
dataMap.put("yearmonth", period_month); dataMap.put("yearmonth", period_month);
dataMap.put("real_period", period_month); dataMap.put("real_period", period_month);
dataMap.put("kpi_scheme", kpi_scheme); dataMap.put("kpi_scheme", kpi_scheme);
}else{
String sql =" select left(k.real_period,10) as real_period,left(k.real_period,7) as period_month,k.kpi_scheme,k.score\n" +
" from (select real_period,kpi_scheme,score\n" +
" from hr_kpi_flow \n" +
" where kpi_user=? \n" +
" and module = 'kpiFlow' \n" +
" and date_type = 'month' \n" +
" and delete_type = '0' " +
" and tenant_key=?\n" +
" order by real_period desc\n" +
") k limit 1 ";
log.error("sql20-1:" + sql);
List<String> strlist = new ArrayList<>(100);
strlist.add(employeeId);
strlist.add(tenant_key);
List<SqlParamEntity> sqlparam = databaseUtils.getSqlParamEntity(strlist);
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql, sqlparam);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if (CollectionUtils.isNotEmpty(recordList)) {
Map<String, Object> recordMap = recordList.get(0);
if (!recordMap.isEmpty()) {
score = String.valueOf(recordMap.get("score"));
kpi_scheme = String.valueOf(recordMap.get("kpi_scheme"));
real_period = String.valueOf(recordMap.get("real_period"));
period_month = String.valueOf(recordMap.get("period_month"));
dataMap.put("score", score);
dataMap.put("yearmonth", period_month);
dataMap.put("kpi_scheme", kpi_scheme);
dataMap.put("real_period", real_period);
}
}
}
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
@ -485,13 +524,11 @@ public class PortalPerformanceInfoCmd {
if (flowDataList.size() > 0) { if (flowDataList.size() > 0) {
FlowDataListRes flowDataListRes = flowDataList.get(0); FlowDataListRes flowDataListRes = flowDataList.get(0);
float Score = flowDataListRes.getScore(); float Score = flowDataListRes.getScore();
if(Math.abs(Score) > 0){
score = String.valueOf(Score); score = String.valueOf(Score);
period_month = startDay.substring(0,7); period_month = startDay.substring(0,7);
break; break;
} }
} }
}
} catch (Exception e) { } catch (Exception e) {
log.error("getWholeYearKpi2-getScore-Exception:" + e.getMessage()); log.error("getWholeYearKpi2-getScore-Exception:" + e.getMessage());
score = "0.0"; score = "0.0";

@ -21,6 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
/** /**
@ -62,7 +65,7 @@ public class UserInfoCmd {
String userimageurl = "/profile/" + userid + "/personal"; String userimageurl = "/profile/" + userid + "/personal";
String department = ""; String department = "";
String position = ""; String position = "";
int days = 0; String days = "";
String doccreate = "0"; String doccreate = "0";
String wfcreate = "0"; String wfcreate = "0";
String wfdeal = "0"; String wfdeal = "0";
@ -111,7 +114,7 @@ public class UserInfoCmd {
position = CommonUtils.null2String(recordMap.get("position")); position = CommonUtils.null2String(recordMap.get("position"));
String hiredate = CommonUtils.null2String(recordMap.get("hiredate")); String hiredate = CommonUtils.null2String(recordMap.get("hiredate"));
if (!"".equals(hiredate)) { if (!"".equals(hiredate)) {
days = calculateMinute(hiredate); days = calculateMinute2(hiredate);
} }
//文档创建 //文档创建
doccreate = getDocCreateNum(userid); doccreate = getDocCreateNum(userid);
@ -230,6 +233,21 @@ public class UserInfoCmd {
return day; return day;
} }
public static String calculateMinute2(String sdate) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String nowDate = sdf.format(new Date());
Period period = Period.between(LocalDate.parse(sdate), LocalDate.parse(nowDate));
int p_year = period.getYears() ;
LocalDate date = LocalDate.parse(sdate);
LocalDate p_day = date.plusYears(p_year);
long days = ChronoUnit.DAYS.between(p_day, LocalDate.parse(nowDate));
String rzsj = p_year+"年"+days ;
return rzsj;
}
public static boolean isTimestampFormat(String inputDate) { public static boolean isTimestampFormat(String inputDate) {
// 使用 simpleDateFormat 尝试将输入日期解析为时间戳格式 // 使用 simpleDateFormat 尝试将输入日期解析为时间戳格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

Loading…
Cancel
Save