#E10-37# 聚才林驾驶舱接口
parent
1a3ca73a5d
commit
9d647996e7
@ -0,0 +1,129 @@
|
||||
package com.weaver.seconddev.cockpit.cmd;
|
||||
|
||||
import com.weaver.calendar.service.RemoteAgendaService;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
|
||||
import com.weaver.framework.rpc.annotation.RpcReference;
|
||||
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
|
||||
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
|
||||
import com.weaver.teams.client.doc.remote.DocClientService;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
|
||||
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
|
||||
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
|
||||
import com.weaver.workflow.common.entity.list.api.publicapi.RequestListInfoPAEntity;
|
||||
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
|
||||
import com.weaver.workrelate.performance.api.rest.RemotePerformanceService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 流程、日程、协助、文档 4个类型数据
|
||||
*
|
||||
* @author shil
|
||||
* @version 1.00版本
|
||||
* @Date 2024/5/22
|
||||
*/
|
||||
@Component
|
||||
public class CockpitBlogDataCmd {
|
||||
//日志
|
||||
private final static Logger log = LoggerFactory.getLogger(CockpitWorkDate4TypeCmd.class);
|
||||
|
||||
@RpcReference
|
||||
public RemotePerformanceService remotePerformanceService;
|
||||
|
||||
@Autowired
|
||||
private JucailinCockpitUtils jucailinCockpitUtils;
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
@RpcReference(group = "workflow")
|
||||
WflRequestListRest wflRequestListRest;
|
||||
|
||||
@RpcReference
|
||||
DocClientService docClientService;
|
||||
|
||||
@RpcReference
|
||||
RemoteAgendaService remoteAgendaService;
|
||||
|
||||
public Map<String, Object> getDataInfo(SimpleEmployee simpleEmployee, Map<String, Object> paramMap,String tenantKey) {
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Map<String, Object> recordMap = new HashMap<String, Object>();
|
||||
|
||||
try {
|
||||
String employeeId = String.valueOf(simpleEmployee.getEmployeeId());
|
||||
|
||||
String groupId = "weaver-elog-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
String sql =" select w.id,w.blog_time,w.content \n" +
|
||||
" from (\n" +
|
||||
" select id,blog_time,content \n" +
|
||||
" from blog where creator = ?\n" +
|
||||
" and delete_type = 0\n" +
|
||||
" and tenant_key = ? \n" +
|
||||
" order by blog_time desc\n" +
|
||||
" ) w limit 5 " ;
|
||||
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
||||
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
|
||||
List<Map<String,Object>> blogList = new ArrayList<Map<String,Object>>();
|
||||
Map<String,Object> blogMap = null;
|
||||
|
||||
if(recordList.size()>0){
|
||||
for(int i=0;i<recordList.size();i++){
|
||||
Map<String,Object> dataMap = recordList.get(i) ;
|
||||
String blogid = String.valueOf(dataMap.get("id"));
|
||||
String blog_time = String.valueOf(dataMap.get("blog_time"));
|
||||
String content = String.valueOf(dataMap.get("content"));
|
||||
String blogDate = "";
|
||||
if(StringUtils.isNotBlank(blog_time)){
|
||||
try{
|
||||
Long blogTime = Long.parseLong(blog_time);
|
||||
Date date = new Date(blogTime);
|
||||
blogDate = sdf.format(date);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(blogDate)){
|
||||
blogMap = new HashMap<String,Object>();
|
||||
blogMap.put("blogid",blogid);
|
||||
blogMap.put("blog_time",blogDate);
|
||||
blogMap.put("content",content);
|
||||
blogList.add(blogMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
recordMap.put("datas",blogList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("PortalPerformanceInfoCmd :" + e);
|
||||
}
|
||||
return recordMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,271 @@
|
||||
package com.weaver.seconddev.cockpit.cmd;
|
||||
|
||||
import com.weaver.calendar.service.RemoteAgendaService;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
|
||||
import com.weaver.framework.rpc.annotation.RpcReference;
|
||||
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
|
||||
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
|
||||
import com.weaver.teams.client.doc.remote.DocClientService;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
|
||||
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
|
||||
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
|
||||
import com.weaver.workflow.common.entity.list.api.publicapi.RequestListInfoPAEntity;
|
||||
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
|
||||
import com.weaver.workrelate.performance.api.rest.RemotePerformanceService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 文档分析
|
||||
*
|
||||
* @author shil
|
||||
* @version 1.00版本
|
||||
* @Date 2024/5/22
|
||||
*/
|
||||
@Component
|
||||
public class CockpitDocumentAnalysisCmd {
|
||||
//日志
|
||||
private final static Logger log = LoggerFactory.getLogger(CockpitWorkDate4TypeCmd.class);
|
||||
|
||||
@RpcReference
|
||||
public RemotePerformanceService remotePerformanceService;
|
||||
|
||||
@Autowired
|
||||
private JucailinCockpitUtils jucailinCockpitUtils;
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
@RpcReference(group = "workflow")
|
||||
WflRequestListRest wflRequestListRest;
|
||||
|
||||
@RpcReference
|
||||
DocClientService docClientService;
|
||||
|
||||
@RpcReference
|
||||
RemoteAgendaService remoteAgendaService;
|
||||
|
||||
public Map<String, Object> getDataInfo(SimpleEmployee employee, Map<String, Object> paramMap,String tenantKey) {
|
||||
|
||||
Map<String, Object> recordMap = new HashMap<String, Object>();
|
||||
try {
|
||||
List<Map<String,String>> dataList = getDocumentDate(employee,tenantKey);
|
||||
recordMap.put("leftdata",dataList);
|
||||
Map<String,String> chartMap = new HashMap<String,String>();
|
||||
chartMap.put("项目管理","16.6");
|
||||
chartMap.put("客户服务","16.6");
|
||||
chartMap.put("产品中心","40.8");
|
||||
chartMap.put("市场管理","10.0");
|
||||
chartMap.put("其他","8.6");
|
||||
recordMap.put("rightdata",chartMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("CockpitDocumentAnalysisCmd-e:" + e);
|
||||
}
|
||||
return recordMap;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param employee
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> getDocumentDate(SimpleEmployee employee,String tenantKey) {
|
||||
|
||||
List<Map<String,String>> doclist = new ArrayList<>(100);
|
||||
try {
|
||||
long employeeId = employee.getEmployeeId();
|
||||
|
||||
Map<String,String> docMap = new HashMap<String,String>();
|
||||
|
||||
|
||||
String doc_count4 = getDocumentDateAmount(employeeId,"1",tenantKey);
|
||||
String doc_name4 = "待查看文档数量";
|
||||
String doc_pkey4 = "document.create.amount";
|
||||
String doc_url4 = jucailinCockpitUtils.getUfPropData(doc_pkey4,tenantKey);
|
||||
docMap.put("count",doc_count4);
|
||||
docMap.put("name",doc_name4);
|
||||
docMap.put("url",doc_url4);
|
||||
doclist.add(docMap);
|
||||
|
||||
docMap = new HashMap<String,String>();
|
||||
String doc_count5 = getDocumentDateAmount(employeeId,"1",tenantKey);
|
||||
String doc_name5 = "我的积分";
|
||||
String doc_pkey5 = "document.create.amount";
|
||||
String doc_url5 = jucailinCockpitUtils.getUfPropData(doc_pkey5,tenantKey);
|
||||
docMap.put("count",doc_count5);
|
||||
docMap.put("name",doc_name5);
|
||||
docMap.put("url",doc_url5);
|
||||
doclist.add(docMap);
|
||||
|
||||
docMap = new HashMap<String,String>();
|
||||
String doc_count6 = getDocumentDateAmount(employeeId,"1",tenantKey);
|
||||
String doc_name6 = "我的分享";
|
||||
String doc_pkey6 = "document.create.amount";
|
||||
String doc_url6 = jucailinCockpitUtils.getUfPropData(doc_pkey6,tenantKey);
|
||||
docMap.put("count",doc_count6);
|
||||
docMap.put("name",doc_name6);
|
||||
docMap.put("url",doc_url6);
|
||||
doclist.add(docMap);
|
||||
|
||||
|
||||
docMap = new HashMap<String,String>();
|
||||
String doc_count7 = getDocumentDateAmount(employeeId,"1",tenantKey);
|
||||
String doc_name7 = "下属知识";
|
||||
String doc_pkey7 = "document.create.amount";
|
||||
String doc_url7 = jucailinCockpitUtils.getUfPropData(doc_pkey7,tenantKey);
|
||||
docMap.put("count",doc_count7);
|
||||
docMap.put("name",doc_name7);
|
||||
docMap.put("url",doc_url7);
|
||||
doclist.add(docMap);
|
||||
|
||||
|
||||
docMap = new HashMap<String,String>();
|
||||
String doc_count1 = getDocumentDateAmount(employeeId,"1",tenantKey);
|
||||
String doc_name1 = "我创建的文档";
|
||||
String doc_pkey1 = "document.create.amount";
|
||||
String doc_url1 = jucailinCockpitUtils.getUfPropData(doc_pkey1,tenantKey);
|
||||
docMap.put("count",doc_count1);
|
||||
docMap.put("name",doc_name1);
|
||||
docMap.put("url",doc_url1);
|
||||
doclist.add(docMap);
|
||||
|
||||
docMap = new HashMap<String,String>();
|
||||
String doc_count2 = getDocumentDateAmount(employeeId,"2",tenantKey);
|
||||
String doc_name2 = "共享给我的文档";
|
||||
String doc_pkey2 = "document.read.amount";
|
||||
String doc_url2 = jucailinCockpitUtils.getUfPropData(doc_pkey2,tenantKey);
|
||||
docMap.put("count",doc_count2);
|
||||
docMap.put("name",doc_name2);
|
||||
docMap.put("url",doc_url2);
|
||||
doclist.add(docMap);
|
||||
|
||||
docMap = new HashMap<String,String>();
|
||||
String doc_count3 = getDocumentDateAmount(employeeId,"3",tenantKey);
|
||||
String doc_name3 = "我订阅的文档";
|
||||
String doc_pkey3 = "document.number.amount";
|
||||
String doc_url3 = jucailinCockpitUtils.getUfPropData(doc_pkey3,tenantKey);
|
||||
docMap.put("count",doc_count3);
|
||||
docMap.put("name",doc_name3);
|
||||
docMap.put("url",doc_url3);
|
||||
doclist.add(docMap);
|
||||
|
||||
|
||||
docMap = new HashMap<String,String>();
|
||||
String doc_count8 = getDocumentDateAmount(employeeId,"3",tenantKey);
|
||||
String doc_name8 = "我关注的文档";
|
||||
String doc_pkey8 = "document.number.amount";
|
||||
String doc_url8 = jucailinCockpitUtils.getUfPropData(doc_pkey8,tenantKey);
|
||||
docMap.put("count",doc_count8);
|
||||
docMap.put("name",doc_name8);
|
||||
docMap.put("url",doc_url8);
|
||||
doclist.add(docMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("DevQuestCountCmd-Exception:" + e);
|
||||
}
|
||||
return doclist;
|
||||
}
|
||||
|
||||
|
||||
public String getDocumentDateAmount(Long employeeId,String type,String tenantKey) {
|
||||
String count = "0";
|
||||
String groupId = "weaver-doc-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
try {
|
||||
if("1".equals(type)){
|
||||
|
||||
int doccreatecount = docClientService.countByCreator(employeeId);
|
||||
count = doccreatecount + "";
|
||||
|
||||
}else if("2".equals(type)){
|
||||
|
||||
String sql =" select count(1) as cou " +
|
||||
" from document " +
|
||||
" where id in( select targetid from doc_documentlogs where log_operator <> ? and operatetype = 'read' and delete_type = 0 and tenant_key=? and doc_status = 2 ) \n" +
|
||||
" and creator = ?\n" +
|
||||
" and delete_type = 0\n" +
|
||||
" and tenant_key= ? " ;
|
||||
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
||||
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
count = String.valueOf(recordList.get(0).get("cou"));
|
||||
}
|
||||
}else if("3".equals(type)){
|
||||
String sql =" select count(1) as cou \n" +
|
||||
" from doc_documentlogs \n" +
|
||||
" where targetid in( select id from document where creator = ? and delete_type = 0 and tenant_key=? and doc_status = 2) \n" +
|
||||
" and log_operator <> ? \n" +
|
||||
" and OPERATETYPE = 'read' \n" +
|
||||
" and delete_type = 0 \n" +
|
||||
" and tenant_key=? " ;
|
||||
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
||||
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
count = String.valueOf(recordList.get(0).get("cou"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("getDocCreateNum:" + e);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package com.weaver.seconddev.cockpit.cmd;
|
||||
|
||||
import com.weaver.framework.rpc.annotation.RpcReference;
|
||||
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.workrelate.performance.api.rest.RemotePerformanceService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 月绩效信息
|
||||
*
|
||||
* @author wangj
|
||||
* @version 1.00版本
|
||||
* @Date 2024/3/8
|
||||
*/
|
||||
@Component
|
||||
public class CockpitMonthPerformanceInfoCmd {
|
||||
//日志
|
||||
private final static Logger log = LoggerFactory.getLogger(CockpitMonthPerformanceInfoCmd.class);
|
||||
|
||||
@RpcReference
|
||||
public RemotePerformanceService remotePerformanceService;
|
||||
|
||||
public Map<String, Object> getDataInfo(SimpleEmployee simpleEmployee, Map<String, Object> paramMap,String tenantKey) {
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>(100);
|
||||
String dateType = "month";
|
||||
try {
|
||||
long employeeId = simpleEmployee.getEmployeeId();
|
||||
List<Long> userList = new ArrayList<Long>();
|
||||
userList.add(employeeId);
|
||||
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
Map<String, Object> scoreMap = new HashMap<String, Object>();
|
||||
for (int i = 0; i < 6; i++) {
|
||||
LocalDate lastLocalDate = currentDate.minus(i, ChronoUnit.MONTHS); // 当前日期减去6个月
|
||||
LocalDate startDay = lastLocalDate.with(TemporalAdjusters.firstDayOfMonth()); // 计算当前月份的首日
|
||||
LocalDate endDay = lastLocalDate.with(TemporalAdjusters.lastDayOfMonth()); // 获取本月最后一天
|
||||
|
||||
log.error("startDay:"+startDay.toString());
|
||||
log.error("endDay:"+endDay.toString());
|
||||
|
||||
String score = getScore(userList,startDay.toString(), endDay.toString(),dateType,tenantKey);
|
||||
log.error("score:"+score);
|
||||
|
||||
int month = lastLocalDate.getMonth().getValue();
|
||||
int year = lastLocalDate.getYear();
|
||||
|
||||
String currentMonth = "" ;
|
||||
if(month < 10){
|
||||
currentMonth = year+"-0"+month;
|
||||
}else{
|
||||
currentMonth = year+"-"+month;
|
||||
}
|
||||
log.error("currentMonth:"+currentMonth);
|
||||
|
||||
scoreMap.put(currentMonth,score);
|
||||
}
|
||||
dataMap.put("score",dataMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("PortalPerformanceInfoCmd :" + e);
|
||||
}
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
public String getScore( List<Long> userList,String startDay, String endDay,String dateType,String tenantKey) {
|
||||
String scoreData = "0.00" ;
|
||||
try {
|
||||
FlowDataListReq flowDataListReq = new FlowDataListReq();
|
||||
flowDataListReq.setCurrent(1);
|
||||
flowDataListReq.setPageSize(20);
|
||||
flowDataListReq.setStartTime(startDay + "");
|
||||
flowDataListReq.setEndTime(endDay + "");
|
||||
flowDataListReq.setDateType(dateType);
|
||||
flowDataListReq.setTenantKey(tenantKey);
|
||||
|
||||
flowDataListReq.setUserList(userList);
|
||||
FlowData flowData = remotePerformanceService.queryFlowData(flowDataListReq);
|
||||
log.error("getWholeYearKpi2-flowData:" + flowData);
|
||||
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();
|
||||
scoreData = score+"";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("getWholeYearKpi2-getScore-Exception:" + e.getMessage());
|
||||
}
|
||||
return scoreData;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,570 @@
|
||||
package com.weaver.seconddev.cockpit.cmd;
|
||||
|
||||
import com.weaver.calendar.service.RemoteAgendaService;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
|
||||
import com.weaver.framework.rpc.annotation.RpcReference;
|
||||
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
|
||||
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
|
||||
import com.weaver.teams.client.doc.remote.DocClientService;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
import com.weaver.workflow.common.constant.list.api.DateTimeConditionEnum;
|
||||
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
|
||||
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
|
||||
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
|
||||
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
|
||||
import com.weaver.workrelate.performance.api.rest.RemotePerformanceService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 流程、日程、协助、文档 4个类型数据
|
||||
*
|
||||
* @author shil
|
||||
* @version 1.00版本
|
||||
* @Date 2024/5/22
|
||||
*/
|
||||
@Component
|
||||
public class CockpitWorkDate4TypeCmd {
|
||||
//日志
|
||||
private final static Logger log = LoggerFactory.getLogger(CockpitWorkDate4TypeCmd.class);
|
||||
|
||||
@RpcReference
|
||||
public RemotePerformanceService remotePerformanceService;
|
||||
|
||||
@Autowired
|
||||
private JucailinCockpitUtils jucailinCockpitUtils;
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
@RpcReference(group = "workflow")
|
||||
WflRequestListRest wflRequestListRest;
|
||||
|
||||
@RpcReference
|
||||
DocClientService docClientService;
|
||||
|
||||
@RpcReference
|
||||
RemoteAgendaService remoteAgendaService;
|
||||
|
||||
public Map<String, Object> getDataInfo(SimpleEmployee employee, Map<String, Object> paramMap,String tenantKey) {
|
||||
|
||||
Map<String, Object> recordMap = new HashMap<String, Object>();
|
||||
|
||||
List<Map<String,String>> wfList = new ArrayList<Map<String,String>>();
|
||||
List<Map<String,String>> docList = new ArrayList<Map<String,String>>();
|
||||
List<Map<String,String>> coworkList = new ArrayList<Map<String,String>>();
|
||||
List<Map<String,String>> calendarList = new ArrayList<Map<String,String>>();
|
||||
|
||||
try {
|
||||
wfList = getWorkflowDate(employee,tenantKey);
|
||||
|
||||
docList = getDocumentDate(employee,tenantKey);
|
||||
|
||||
coworkList = getCoWorkDate(employee,tenantKey);
|
||||
|
||||
calendarList = getCalendarDate(employee,tenantKey);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("PortalPerformanceInfoCmd :" + e);
|
||||
}
|
||||
|
||||
recordMap.put("wfdata",wfList);
|
||||
recordMap.put("docdata",docList);
|
||||
recordMap.put("coworkdata",coworkList);
|
||||
recordMap.put("calendardata",calendarList);
|
||||
|
||||
return recordMap;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> getWorkflowDate(SimpleEmployee employee,String tenantKey) {
|
||||
|
||||
List<Map<String,String>> wflist = new ArrayList<>(100);
|
||||
try {
|
||||
Map<String,String> wfMap = new HashMap<String,String>();
|
||||
String wf_count1 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.TODO_FLOWALL.getTabid());
|
||||
String wf_name1 = "待办流程数";
|
||||
String wf_pkey1 = "workflow.todo.amount";
|
||||
String wf_url1 = jucailinCockpitUtils.getUfPropData(wf_pkey1,tenantKey);
|
||||
wfMap.put("count",wf_count1);
|
||||
wfMap.put("name",wf_name1);
|
||||
wfMap.put("url",wf_url1);
|
||||
wflist.add(wfMap);
|
||||
|
||||
wfMap = new HashMap<String,String>();
|
||||
String wf_count2 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid());
|
||||
String wf_name2 = "我发起的流程";
|
||||
String wf_pkey2 = "workflow.mine.amount";
|
||||
String wf_url2 = jucailinCockpitUtils.getUfPropData(wf_pkey2,tenantKey);
|
||||
wfMap.put("count",wf_count2);
|
||||
wfMap.put("name",wf_name2);
|
||||
wfMap.put("url",wf_url2);
|
||||
wflist.add(wfMap);
|
||||
|
||||
wfMap = new HashMap<String,String>();
|
||||
String wf_count3 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid());
|
||||
String wf_name3 = "已办流程";
|
||||
String wf_pkey3 = "workflow.done.amount";
|
||||
String wf_url3 = jucailinCockpitUtils.getUfPropData(wf_pkey3,tenantKey);
|
||||
wfMap.put("count",wf_count3);
|
||||
wfMap.put("name",wf_name3);
|
||||
wfMap.put("url",wf_url3);
|
||||
wflist.add(wfMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("DevQuestCountCmd-Exception:" + e);
|
||||
}
|
||||
return wflist;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param employee
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> getDocumentDate(SimpleEmployee employee,String tenantKey) {
|
||||
|
||||
List<Map<String,String>> doclist = new ArrayList<>(100);
|
||||
try {
|
||||
long employeeId = employee.getEmployeeId();
|
||||
|
||||
Map<String,String> docMap = new HashMap<String,String>();
|
||||
String doc_count1 = getDocumentDateAmount(employeeId,"1",tenantKey);
|
||||
String doc_name1 = "创建文档";
|
||||
String doc_pkey1 = "document.create.amount";
|
||||
String doc_url1 = jucailinCockpitUtils.getUfPropData(doc_pkey1,tenantKey);
|
||||
docMap.put("count",doc_count1);
|
||||
docMap.put("name",doc_name1);
|
||||
docMap.put("url",doc_url1);
|
||||
doclist.add(docMap);
|
||||
|
||||
docMap = new HashMap<String,String>();
|
||||
String doc_count2 = getDocumentDateAmount(employeeId,"2",tenantKey);
|
||||
String doc_name2 = "查阅文档";
|
||||
String doc_pkey2 = "document.read.amount";
|
||||
String doc_url2 = jucailinCockpitUtils.getUfPropData(doc_pkey2,tenantKey);
|
||||
docMap.put("count",doc_count2);
|
||||
docMap.put("name",doc_name2);
|
||||
docMap.put("url",doc_url2);
|
||||
doclist.add(docMap);
|
||||
|
||||
docMap = new HashMap<String,String>();
|
||||
String doc_count3 = getDocumentDateAmount(employeeId,"3",tenantKey);
|
||||
String doc_name3 = "查阅次数";
|
||||
String doc_pkey3 = "document.number.amount";
|
||||
String doc_url3 = jucailinCockpitUtils.getUfPropData(doc_pkey3,tenantKey);
|
||||
docMap.put("count",doc_count3);
|
||||
docMap.put("name",doc_name3);
|
||||
docMap.put("url",doc_url3);
|
||||
doclist.add(docMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("DevQuestCountCmd-Exception:" + e);
|
||||
}
|
||||
return doclist;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param employee
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> getCoWorkDate(SimpleEmployee employee,String tenantKey) {
|
||||
|
||||
List<Map<String,String>> datalist = new ArrayList<>(100);
|
||||
try {
|
||||
long employeeId = employee.getEmployeeId();
|
||||
|
||||
Map<String,String> coworkMap = new HashMap<String,String>();
|
||||
String cowork_count = getCoWorkDateAmount(employeeId,"1",tenantKey);
|
||||
String cowork_name = "协作区发表";
|
||||
String cowork_pkey = "cowork.create.amount";
|
||||
String cowork_url = jucailinCockpitUtils.getUfPropData(cowork_pkey,tenantKey);
|
||||
coworkMap.put("count",cowork_count);
|
||||
coworkMap.put("name",cowork_name);
|
||||
coworkMap.put("url",cowork_url);
|
||||
datalist.add(coworkMap);
|
||||
|
||||
Map<String,String> imMap = new HashMap<String,String>();
|
||||
String im_count2 = getCoWorkDateAmount(employeeId,"2",tenantKey);
|
||||
String im_name2 = "参与群聊";
|
||||
String im_pkey2 = "im.group.amount";
|
||||
String im_url2 = jucailinCockpitUtils.getUfPropData(im_pkey2,tenantKey);
|
||||
imMap.put("count",im_count2);
|
||||
imMap.put("name",im_name2);
|
||||
imMap.put("url",im_url2);
|
||||
datalist.add(imMap);
|
||||
|
||||
imMap = new HashMap<String,String>();
|
||||
String im_count3 = getCoWorkDateAmount(employeeId,"3",tenantKey);
|
||||
String im_name3 = "平均每日沟通人数";
|
||||
String im_pkey3 = "im.chatday.amount";
|
||||
String im_url3 = jucailinCockpitUtils.getUfPropData(im_pkey3,tenantKey);
|
||||
imMap.put("count",im_count3);
|
||||
imMap.put("name",im_name3);
|
||||
imMap.put("url",im_url3);
|
||||
datalist.add(imMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("DevQuestCountCmd-Exception:" + e);
|
||||
}
|
||||
return datalist;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,String>> getCalendarDate(SimpleEmployee employee,String tenantKey) {
|
||||
|
||||
List<Map<String,String>> datalist = new ArrayList<>(100);
|
||||
try {
|
||||
long employeeId = employee.getEmployeeId();
|
||||
|
||||
Map<String,String> calendarMap = new HashMap<String,String>();
|
||||
String calendar_count = getCalendarDateAmount(employeeId,"1",tenantKey);
|
||||
String calendar_name = "日程";
|
||||
String calendar_pkey = "calendar.create.amount";
|
||||
String calendar_url = jucailinCockpitUtils.getUfPropData(calendar_pkey,tenantKey);
|
||||
calendarMap.put("count",calendar_count);
|
||||
calendarMap.put("name",calendar_name);
|
||||
calendarMap.put("url",calendar_url);
|
||||
datalist.add(calendarMap);
|
||||
|
||||
calendarMap = new HashMap<String,String>();
|
||||
String calendar_count2 = getCalendarDateAmount(employeeId,"2",tenantKey);
|
||||
String calendar_name2 = "我的任务";
|
||||
String calendar_pkey2 = "task.mine.amount";
|
||||
String calendar_url2 = jucailinCockpitUtils.getUfPropData(calendar_pkey2,tenantKey);
|
||||
calendarMap.put("count",calendar_count2);
|
||||
calendarMap.put("name",calendar_name2);
|
||||
calendarMap.put("url",calendar_url2);
|
||||
datalist.add(calendarMap);
|
||||
|
||||
calendarMap = new HashMap<String,String>();
|
||||
String calendar_count3 = getCalendarDateAmount(employeeId,"3",tenantKey);
|
||||
String calendar_name3 = "关注任务";
|
||||
String calendar_pkey3 = "task.watch.amount";
|
||||
String calendar_url3 = jucailinCockpitUtils.getUfPropData(calendar_pkey3,tenantKey);
|
||||
calendarMap.put("count",calendar_count3);
|
||||
calendarMap.put("name",calendar_name3);
|
||||
calendarMap.put("url",calendar_url3);
|
||||
datalist.add(calendarMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("DevQuestCountCmd-Exception:" + e);
|
||||
}
|
||||
return datalist;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取文档数量
|
||||
*
|
||||
* @param employeeId
|
||||
* @return
|
||||
*/
|
||||
|
||||
public String getCoWorkDateAmount(Long employeeId,String type,String tenantKey) {
|
||||
String count = "0";
|
||||
if("1".equals(type)){
|
||||
|
||||
String groupId = "weaver-cowork-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
String sql =" select count(1) as cou " +
|
||||
" from cw_content " +
|
||||
" where creator=?\n" +
|
||||
" and delete_type = 0\n" +
|
||||
" and tenant_key= ? " ;
|
||||
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
||||
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
count = String.valueOf(recordList.get(0).get("cou"));
|
||||
}
|
||||
}else if("2".equals(type)){
|
||||
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
String sql =" select amount " +
|
||||
" from uf_nj_pjmrdlhhsl " +
|
||||
" where ry = ?\n" +
|
||||
" and delete_type = 0\n" +
|
||||
" and tenant_key= ? " ;
|
||||
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
||||
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
count = String.valueOf(recordList.get(0).get("amount"));
|
||||
}
|
||||
}else if("3".equals(type)){
|
||||
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
String sql =" select amount " +
|
||||
" from uf_nj_cyqltjb " +
|
||||
" where ry = ?\n" +
|
||||
" and delete_type = 0\n" +
|
||||
" and tenant_key= ? " ;
|
||||
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
||||
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
count = String.valueOf(recordList.get(0).get("amount"));
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public String getDocumentDateAmount(Long employeeId,String type,String tenantKey) {
|
||||
String count = "0";
|
||||
String groupId = "weaver-doc-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
try {
|
||||
if("1".equals(type)){
|
||||
|
||||
int doccreatecount = docClientService.countByCreator(employeeId);
|
||||
count = doccreatecount + "";
|
||||
|
||||
}else if("2".equals(type)){
|
||||
|
||||
String sql =" select count(1) as cou " +
|
||||
" from document " +
|
||||
" where id in( select targetid from doc_documentlogs where log_operator <> ? and operatetype = 'read' and delete_type = 0 and tenant_key=? and doc_status = 2 ) \n" +
|
||||
" and creator = ?\n" +
|
||||
" and delete_type = 0\n" +
|
||||
" and tenant_key= ? " ;
|
||||
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
||||
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
count = String.valueOf(recordList.get(0).get("cou"));
|
||||
}
|
||||
}else if("3".equals(type)){
|
||||
String sql =" select count(1) as cou \n" +
|
||||
" from doc_documentlogs \n" +
|
||||
" where targetid in( select id from document where creator = ? and delete_type = 0 and tenant_key=? and doc_status = 2) \n" +
|
||||
" and log_operator <> ? \n" +
|
||||
" and OPERATETYPE = 'read' \n" +
|
||||
" and delete_type = 0 \n" +
|
||||
" and tenant_key=? " ;
|
||||
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
||||
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
count = String.valueOf(recordList.get(0).get("cou"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("getDocCreateNum:" + e);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getCalendarDateAmount(Long employeeId,String type,String tenantKey) {
|
||||
String count = "0";
|
||||
String groupId = "weaver-doc-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
try {
|
||||
if("1".equals(type)){
|
||||
|
||||
int clendarcount = remoteAgendaService.countCalendar(employeeId,tenantKey);
|
||||
count = clendarcount + "";
|
||||
|
||||
}else if("2".equals(type)){
|
||||
|
||||
String sql =" select count(1) as cou " +
|
||||
" from task " +
|
||||
" where creator = ? \n" +
|
||||
" and STATUS = 'todo'\n" +
|
||||
" and delete_type = 0\n" +
|
||||
" and tenant_key= ? " ;
|
||||
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
||||
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
count = String.valueOf(recordList.get(0).get("cou"));
|
||||
}
|
||||
}else if("3".equals(type)){
|
||||
String sql =" select count(1) as cou \n" +
|
||||
" from my_watch \n" +
|
||||
" where watcher = ? \n" +
|
||||
" and module='task' \n" +
|
||||
" and delete_type = 0 \n" +
|
||||
" and tenant_key=? " ;
|
||||
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeId+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
||||
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
count = String.valueOf(recordList.get(0).get("cou"));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("getDocCreateNum:" + e);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param employee
|
||||
* @return
|
||||
*/
|
||||
public String getWorkflowDataAmount(SimpleEmployee employee,int Type) {
|
||||
Map<String,Object> data = new HashMap<>(100);
|
||||
String count = "0";
|
||||
try{
|
||||
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
|
||||
// conditionEntity.setOperatedate(DateTimeConditionEnum.CURRENT_YEAR);
|
||||
WeaResult<RequestCountInfoPAEntity> requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, Type, conditionEntity);
|
||||
int code = requestCountInfo.getCode();
|
||||
if(code == 200){
|
||||
RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData();
|
||||
count = String.valueOf(requestCountInfoPAEntity.getCount());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("PortalWfDealCountCmd-Exception:" + e);
|
||||
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,204 @@
|
||||
package com.weaver.seconddev.cockpit.cmd;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.framework.rpc.annotation.RpcReference;
|
||||
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum;
|
||||
import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity;
|
||||
import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity;
|
||||
import com.weaver.workflow.common.entity.list.api.publicapi.RequestListInfoPAEntity;
|
||||
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 流程、日程、协助、文档 4个类型数据
|
||||
*
|
||||
* @author shil
|
||||
* @version 1.00版本
|
||||
* @Date 2024/5/22
|
||||
*/
|
||||
@Component
|
||||
public class CockpitWorkflowAnalysisCmd {
|
||||
//日志
|
||||
private final static Logger log = LoggerFactory.getLogger(CockpitWorkDate4TypeCmd.class);
|
||||
|
||||
@Autowired
|
||||
private JucailinCockpitUtils jucailinCockpitUtils;
|
||||
|
||||
@RpcReference(group = "workflow")
|
||||
WflRequestListRest wflRequestListRest;
|
||||
|
||||
public Map<String, Object> getDataInfo(SimpleEmployee employee, Map<String, Object> paramMap,String tenantKey) {
|
||||
|
||||
Map<String, Object> recordMap = new HashMap<String, Object>();
|
||||
try {
|
||||
List<Map<String,String>> dataList = getWorkflowDate(employee,tenantKey);
|
||||
recordMap.put("leftdata",dataList);
|
||||
Map<String,String> chartMap = new HashMap<String,String>();
|
||||
chartMap.put("项目管理类流程","16.6");
|
||||
chartMap.put("日常办公类流程","16.6");
|
||||
chartMap.put("行政事务类流程","40.8");
|
||||
chartMap.put("人事类流程","10.0");
|
||||
chartMap.put("销售类流程","8.6");
|
||||
recordMap.put("rightdata",chartMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("PortalPerformanceInfoCmd :" + e);
|
||||
}
|
||||
return recordMap;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> getWorkflowDate(SimpleEmployee employee,String tenantKey) {
|
||||
|
||||
List<Map<String,String>> wflist = new ArrayList<>(100);
|
||||
try {
|
||||
Map<String,String> wfMap = new HashMap<String,String>();
|
||||
String wf_count1 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.TODO_FLOWALL.getTabid());
|
||||
String wf_name1 = "待处理流程数量";
|
||||
String wf_pkey1 = "workflow.todo.amount";
|
||||
String wf_url1 = jucailinCockpitUtils.getUfPropData(wf_pkey1,tenantKey);
|
||||
wfMap.put("count",wf_count1);
|
||||
wfMap.put("name",wf_name1);
|
||||
wfMap.put("url",wf_url1);
|
||||
wflist.add(wfMap);
|
||||
|
||||
wfMap = new HashMap<String,String>();
|
||||
String wf_count2 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid());
|
||||
String wf_name2 = "我创建的流程";
|
||||
String wf_pkey2 = "workflow.mine.amount";
|
||||
String wf_url2 = jucailinCockpitUtils.getUfPropData(wf_pkey2,tenantKey);
|
||||
wfMap.put("count",wf_count2);
|
||||
wfMap.put("name",wf_name2);
|
||||
wfMap.put("url",wf_url2);
|
||||
wflist.add(wfMap);
|
||||
|
||||
wfMap = new HashMap<String,String>();
|
||||
String wf_count3 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid());
|
||||
String wf_name3 = "我处理的流程";
|
||||
String wf_pkey3 = "workflow.done.amount";
|
||||
String wf_url3 = jucailinCockpitUtils.getUfPropData(wf_pkey3,tenantKey);
|
||||
wfMap.put("count",wf_count3);
|
||||
wfMap.put("name",wf_name3);
|
||||
wfMap.put("url",wf_url3);
|
||||
wflist.add(wfMap);
|
||||
|
||||
|
||||
wfMap = new HashMap<String,String>();
|
||||
String wf_count4 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.SUPERVISE_ALL.getTabid());
|
||||
String wf_name4 = "我督办的流程";
|
||||
String wf_pkey4 = "workflow.supervise.amount";
|
||||
String wf_url4 = jucailinCockpitUtils.getUfPropData(wf_pkey4,tenantKey);
|
||||
wfMap.put("count",wf_count4);
|
||||
wfMap.put("name",wf_name4);
|
||||
wfMap.put("url",wf_url4);
|
||||
wflist.add(wfMap);
|
||||
|
||||
|
||||
wfMap = new HashMap<String,String>();
|
||||
String wf_count5 = getWorkflowDataAmount(employee,RequestListInitDimensionTabEnum.ATTENTION_ALL.getTabid());
|
||||
String wf_name5 = "我关注的流程";
|
||||
String wf_pkey5 = "workflow.attention.amount";
|
||||
String wf_url5 = jucailinCockpitUtils.getUfPropData(wf_pkey5,tenantKey);
|
||||
wfMap.put("count",wf_count5);
|
||||
wfMap.put("name",wf_name5);
|
||||
wfMap.put("url",wf_url5);
|
||||
wflist.add(wfMap);
|
||||
|
||||
wfMap = new HashMap<String,String>();
|
||||
String wf_count6 = "2.6";
|
||||
String wf_name6 = "平均每天处理";
|
||||
String wf_pkey6 = "workflow.average.amount";
|
||||
String wf_url6 = jucailinCockpitUtils.getUfPropData(wf_pkey6,tenantKey);
|
||||
wfMap.put("count",wf_count6);
|
||||
wfMap.put("name",wf_name6);
|
||||
wfMap.put("url",wf_url6);
|
||||
wflist.add(wfMap);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("DevQuestCountCmd-Exception:" + e);
|
||||
}
|
||||
return wflist;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param employee
|
||||
* @return
|
||||
*/
|
||||
public String getWorkflowDataAmount(SimpleEmployee employee,int Type) {
|
||||
String count = "0";
|
||||
try{
|
||||
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
|
||||
WeaResult<RequestCountInfoPAEntity> requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, Type, conditionEntity);
|
||||
int code = requestCountInfo.getCode();
|
||||
if(code == 200){
|
||||
RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData();
|
||||
count = String.valueOf(requestCountInfoPAEntity.getCount());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("PortalWfDealCountCmd-Exception:" + e);
|
||||
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param employee
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
public Map<String,String> getWorkflowOperateAverageTime(SimpleEmployee employee,String tenantKey) {
|
||||
String count = "0.0";
|
||||
try{
|
||||
RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity();
|
||||
WeaResult<List<RequestListInfoPAEntity>> requestListData = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.TODO_FLOWALL.getTabid(), 1, 10, conditionEntity);
|
||||
|
||||
int code = requestListData.getCode();
|
||||
if(code == 200){
|
||||
Long minutescount = 0L;
|
||||
List<RequestListInfoPAEntity> requestCountInfoPAEntityList = requestListData.getData();
|
||||
int requestLength = requestCountInfoPAEntityList.size() ;
|
||||
for(int i=0;i<requestLength;i++){
|
||||
RequestListInfoPAEntity requestListInfoPAEntity = requestCountInfoPAEntityList.get(i);
|
||||
LocalDateTime receiveDateTime = requestListInfoPAEntity.getReceiveTime();
|
||||
LocalDateTime operateDateTime = requestListInfoPAEntity.getOperateTime();
|
||||
Long minutesDiff = ChronoUnit.MINUTES.between(receiveDateTime, operateDateTime);
|
||||
minutescount += minutesDiff ;
|
||||
}
|
||||
if(requestLength > 0 && minutescount > 0){
|
||||
double average = minutescount/requestLength ;
|
||||
count = String.valueOf(average);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("PortalWfDealCountCmd-Exception:" + e);
|
||||
}
|
||||
|
||||
Map<String,String> wfMap = new HashMap<String,String>();
|
||||
String wf_name1 = "平均流程处理时间";
|
||||
String wf_pkey1 = "workflow.time.amount";
|
||||
String wf_url1 = jucailinCockpitUtils.getUfPropData(wf_pkey1,tenantKey);
|
||||
wfMap.put("count",count);
|
||||
wfMap.put("name",wf_name1);
|
||||
wfMap.put("url",wf_url1);
|
||||
|
||||
return wfMap;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.weaver.seconddev.cockpit.service;
|
||||
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface JucailinCockpitService {
|
||||
|
||||
Map<String, Object> getMonthPerformanceData(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
|
||||
|
||||
Map<String, Object> getWorkAchievementsData(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
|
||||
|
||||
Map<String, Object> getUserData4Type(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
|
||||
|
||||
Map<String, Object> getWorkflowAnalysis(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
|
||||
|
||||
Map<String, Object> getBlogData(SimpleEmployee simpleEmployee,Map<String,Object> paramMap,String tenantKey);
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.weaver.seconddev.cockpit.service.impl;
|
||||
|
||||
import com.weaver.seconddev.cockpit.cmd.CockpitMonthPerformanceInfoCmd;
|
||||
import com.weaver.seconddev.cockpit.cmd.CockpitWorkAchievementsCmd;
|
||||
import com.weaver.seconddev.cockpit.cmd.CockpitWorkDate4TypeCmd;
|
||||
import com.weaver.seconddev.cockpit.service.JucailinCockpitService;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import groovy.util.logging.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class JucailinCockpitServiceimpl implements JucailinCockpitService {
|
||||
@Autowired
|
||||
private CockpitMonthPerformanceInfoCmd cockpitMonthPerformanceInfoCmd;
|
||||
|
||||
@Autowired
|
||||
private CockpitWorkAchievementsCmd cockpitWorkAchievementsCmd;
|
||||
|
||||
@Autowired
|
||||
private CockpitWorkDate4TypeCmd cockpitWorkDate4TypeCmd;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMonthPerformanceData(SimpleEmployee simpleEmployee, Map<String, Object> paramMap,String tenantKey) {
|
||||
|
||||
Map<String,Object> dataMap = cockpitMonthPerformanceInfoCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getWorkAchievementsData(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
|
||||
Map<String,Object> dataMap = cockpitWorkAchievementsCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getUserData4Type(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
|
||||
Map<String,Object> dataMap = cockpitWorkDate4TypeCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getWorkflowAnalysis(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
|
||||
Map<String,Object> dataMap = cockpitWorkDate4TypeCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getBlogData(SimpleEmployee simpleEmployee, Map<String, Object> paramMap, String tenantKey) {
|
||||
Map<String,Object> dataMap = cockpitWorkDate4TypeCmd.getDataInfo(simpleEmployee,paramMap,tenantKey);
|
||||
return dataMap;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue