|
|
@ -1,9 +1,14 @@
|
|
|
|
package com.weaver.seconddev.jcldoor.cmd;
|
|
|
|
package com.weaver.seconddev.jcldoor.cmd;
|
|
|
|
|
|
|
|
|
|
|
|
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
|
|
|
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
|
|
|
|
|
|
|
import com.weaver.framework.rpc.annotation.RpcReference;
|
|
|
|
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
|
|
|
|
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
|
|
|
|
|
|
|
|
import com.weaver.teams.domain.hr.entity.FlowData;
|
|
|
|
|
|
|
|
import com.weaver.teams.domain.hr.entity.FlowDataListReq;
|
|
|
|
|
|
|
|
import com.weaver.teams.domain.hr.entity.FlowDataListRes;
|
|
|
|
import com.weaver.teams.domain.user.SimpleEmployee;
|
|
|
|
import com.weaver.teams.domain.user.SimpleEmployee;
|
|
|
|
import com.weaver.teams.security.context.UserContext;
|
|
|
|
import com.weaver.teams.security.context.UserContext;
|
|
|
|
|
|
|
|
import com.weaver.workrelate.performance.api.rest.RemotePerformanceService;
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
@ -37,6 +42,9 @@ public class PortalPerformanceInfoCmd {
|
|
|
|
|
|
|
|
|
|
|
|
public String tenant_key = "t7akvdnf84";
|
|
|
|
public String tenant_key = "t7akvdnf84";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RpcReference
|
|
|
|
|
|
|
|
public RemotePerformanceService remotePerformanceService;
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
|
|
|
|
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
|
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(100);
|
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(100);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -55,7 +63,7 @@ public class PortalPerformanceInfoCmd {
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> scoreMap = getLastMonthKpi2(employeeId, groupId, sourceType);
|
|
|
|
Map<String, Object> scoreMap = getLastMonthKpi2(employeeId, groupId, sourceType);
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, String>> yearList = getWholeYearKpi2(employeeId,groupId,sourceType);
|
|
|
|
List<Map<String, String>> yearList = getWholeYearKpi2();
|
|
|
|
|
|
|
|
|
|
|
|
dataMap.put("scoreMap", scoreMap);
|
|
|
|
dataMap.put("scoreMap", scoreMap);
|
|
|
|
dataMap.put("yearList", yearList);
|
|
|
|
dataMap.put("yearList", yearList);
|
|
|
@ -323,66 +331,25 @@ public class PortalPerformanceInfoCmd {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Map<String, String>> getWholeYearKpi2(String employeeId,String groupId,String sourceType){
|
|
|
|
public List<Map<String, String>> getWholeYearKpi2() {
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, String>> dateList = new ArrayList<Map<String, String>>();
|
|
|
|
List<Map<String, String>> dateList = new ArrayList<Map<String, String>>();
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> dataMap = null;
|
|
|
|
|
|
|
|
LocalDate localDate = LocalDate.now();
|
|
|
|
LocalDate localDate = LocalDate.now();
|
|
|
|
int year = localDate.getYear();
|
|
|
|
int year = localDate.getYear();
|
|
|
|
int dayOfYear = 1;
|
|
|
|
int dayOfYear = 1;
|
|
|
|
String[] monthzw = new String[]{"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"};
|
|
|
|
String[] monthzw = new String[]{"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"};
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= 12; i++) {
|
|
|
|
for (int i = 1; i <= 12; i++) {
|
|
|
|
|
|
|
|
Map<String, String> dataMap = new HashMap<>();
|
|
|
|
Month month = Month.of(i);
|
|
|
|
Month month = Month.of(i);
|
|
|
|
LocalDate startDay = YearMonth.of(year, month).atDay(dayOfYear); // 计算当前月份的首日
|
|
|
|
LocalDate startDay = YearMonth.of(year, month).atDay(dayOfYear); // 计算当前月份的首日
|
|
|
|
LocalDate endDay = YearMonth.of(year, month).atEndOfMonth(); // 计算当前月份的最后一天
|
|
|
|
LocalDate endDay = YearMonth.of(year, month).atEndOfMonth(); // 计算当前月份的最后一天
|
|
|
|
|
|
|
|
|
|
|
|
log.error("getWholeYearKpi2-startDay:"+startDay);
|
|
|
|
|
|
|
|
log.error("getWholeYearKpi2-endDay:"+endDay);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String yearMonth = "";
|
|
|
|
String yearMonth = "";
|
|
|
|
if (monthzw.length == 12) {
|
|
|
|
if (monthzw.length == 12) {
|
|
|
|
yearMonth = monthzw[i - 1];
|
|
|
|
yearMonth = monthzw[i - 1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String score = getScore(startDay + "", endDay + "");
|
|
|
|
String sql =" select score from hr_kpi_flow " +
|
|
|
|
|
|
|
|
" where kpi_user=? " +
|
|
|
|
|
|
|
|
" and left(real_period,10) >= ?" +
|
|
|
|
|
|
|
|
" and left(real_period,10) <=?" +
|
|
|
|
|
|
|
|
" and module = 'kpiFlow'" +
|
|
|
|
|
|
|
|
" and date_type = 'month'" +
|
|
|
|
|
|
|
|
" and flow_status in('noApprove','approve','finished') \n" +
|
|
|
|
|
|
|
|
" and delete_type = '0'" +
|
|
|
|
|
|
|
|
" and tenant_key=? " ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.error("getWholeYearKpi2-sql:"+sql);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataMap = new HashMap<String,String>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> strlist = new ArrayList<>(100);
|
|
|
|
|
|
|
|
strlist.add(employeeId);
|
|
|
|
|
|
|
|
strlist.add(startDay+"");
|
|
|
|
|
|
|
|
strlist.add(endDay+"");
|
|
|
|
|
|
|
|
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()){
|
|
|
|
|
|
|
|
String score = String.valueOf(recordMap.get("score"));
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(score)){
|
|
|
|
|
|
|
|
dataMap.put(yearMonth, score);
|
|
|
|
dataMap.put(yearMonth, score);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
dataMap.put(yearMonth,"0");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dateList.add(dataMap);
|
|
|
|
dateList.add(dataMap);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -390,6 +357,37 @@ public class PortalPerformanceInfoCmd {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getScore(String startDay, String endDay) {
|
|
|
|
|
|
|
|
String score = "0.0";
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
FlowDataListReq flowDataListReq = new FlowDataListReq();
|
|
|
|
|
|
|
|
flowDataListReq.setCurrent(1);
|
|
|
|
|
|
|
|
flowDataListReq.setPageSize(20);
|
|
|
|
|
|
|
|
flowDataListReq.setStartTime(startDay + "");
|
|
|
|
|
|
|
|
flowDataListReq.setEndTime(endDay + "");
|
|
|
|
|
|
|
|
flowDataListReq.setDateType("month");
|
|
|
|
|
|
|
|
flowDataListReq.setTenantKey("t7akvdnf84");
|
|
|
|
|
|
|
|
List<Long> userList = new ArrayList<Long>();
|
|
|
|
|
|
|
|
Long employeeId = UserContext.getCurrentEmployeeId();
|
|
|
|
|
|
|
|
userList.add(employeeId);
|
|
|
|
|
|
|
|
flowDataListReq.setUserList(userList);
|
|
|
|
|
|
|
|
FlowData flowData = remotePerformanceService.queryFlowData(flowDataListReq);
|
|
|
|
|
|
|
|
log.error("getWholeYearKpi2-flowData:" + flowData);
|
|
|
|
|
|
|
|
Long total = flowData.getTotal();
|
|
|
|
|
|
|
|
List<FlowDataListRes> flowDataList = flowData.getDataList();
|
|
|
|
|
|
|
|
if (flowDataList.size() > 0) {
|
|
|
|
|
|
|
|
for (int index = 0; index < flowDataList.size(); index++) {
|
|
|
|
|
|
|
|
FlowDataListRes flowDataListRes = flowDataList.get(index);
|
|
|
|
|
|
|
|
float Score = flowDataListRes.getScore();
|
|
|
|
|
|
|
|
score = Score + "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error("getWholeYearKpi2-getScore-Exception:" + e.getMessage());
|
|
|
|
|
|
|
|
score = "0.0";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return score;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String null2String(String s, String def) {
|
|
|
|
public static String null2String(String s, String def) {
|
|
|
|
return s == null ? (def == null ? "" : def) : s;
|
|
|
|
return s == null ? (def == null ? "" : def) : s;
|
|
|
|