#E10-41# 接口优化

main
shilei 11 months ago
parent b1b4f7cb57
commit 3bf3c8ba9e

@ -42,13 +42,8 @@ public class CockpitDocumentAnalysisCmd {
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);
List<Map<String, Object>> rightList = getRightViewData(employee,tenantKey);
recordMap.put("rightdata",rightList);;
} catch (Exception e) {
e.printStackTrace();
log.error("CockpitDocumentAnalysisCmd-e:" + e);
@ -80,7 +75,7 @@ public class CockpitDocumentAnalysisCmd {
// doclist.add(docMap);
docMap = new HashMap<String,String>();
String doc_count5 = getDocumentDateAmount6(employeeId,tenantKey);
String doc_count5 = getDocumentDateAmount5(employeeId,tenantKey);
String doc_name5 = "我的积分";
String doc_pkey5 = "document.create.amount";
String doc_url5 = jucailinCockpitUtils.getUfPropData(doc_pkey5,tenantKey);
@ -260,6 +255,12 @@ public class CockpitDocumentAnalysisCmd {
// return count;
// }
/***
*
* @param employeeId
* @param tenantKey
* @return
*/
public String getDocumentDateAmount1(Long employeeId,String tenantKey) {
String count = "0";
try {
@ -273,6 +274,56 @@ public class CockpitDocumentAnalysisCmd {
return count;
}
/***
*
* @param employeeId
* @param tenantKey
* @return
*/
public String getDocumentDateAmount5(Long employeeId,String tenantKey) {
String count = "0";
String groupId = "weaver-ebuilder-form-service";
String sourceType = "LOGIC";
try {
if(StringUtils.isNotBlank(employeeId+"")){
String sql =" select sum(case when jfzj = 0 then jfz else 0-jfz end ) as zjf \n" +
" from uf_docPointDetail_112 " +
" where xm = ?"+
" and delete_type = 0" +
" 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"));
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
return count;
}
/***
*
* @param employeeId
* @param tenantKey
* @return
*/
public String getDocumentDateAmount6(Long employeeId,String tenantKey) {
int count = 0;
String count1 = "0";
@ -283,11 +334,11 @@ public class CockpitDocumentAnalysisCmd {
if(StringUtils.isNotBlank(employeeId+"")){
String sql =" select count(1) as cou\n" +
" from doc_external_share \n" +
" where creator = ? " +
" and date_add(create_time, interval period_validity day) >= curdate()" +
" and delete_type = 0" +
" and tenant_key = ?" ;
" from doc_external_share \n" +
" where creator = ? " +
" and date_add(create_time, interval period_validity day) >= curdate()" +
" and delete_type = 0" +
" and tenant_key = ?" ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
@ -458,4 +509,55 @@ public class CockpitDocumentAnalysisCmd {
return count;
}
/***
*
* @param employee
* @param tenantKey
* @return
*/
public List<Map<String,Object>> getRightViewData(SimpleEmployee employee,String tenantKey){
List<Map<String,Object>> recordList = new ArrayList<Map<String,Object>>();
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
Long employeeId = employee.getEmployeeId();
try {
String sql =" select p.folder,p.name,p.cou from ( \n" +
" select w.folder,w.name,w.cou \n" +
" from ( \n" +
" select t.folder,l.name,count(1) as cou \n" +
" from document t \n" +
" inner join folder l on l.id = t.folder \n" +
" where t.creator = ? \n" +
" and delete_type = 0 \n" +
" and tenant_key= ? " +
" group by t.folder,l.name \n" +
" ) w order by w.cou desc \n" +
") p 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);
recordList = databaseUtils.getDataSourceList(result);
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
return recordList;
}
}

@ -54,8 +54,6 @@ public class CockpitUserDataCmd {
String gradename = employee.getGrade().getName();
log.error("gradename:"+gradename);
String personnelstatusname = "" ;
String personnelstatus = employee.getPersonnelStatus();
log.error("personnelstatus:"+personnelstatus);
@ -189,11 +187,99 @@ public class CockpitUserDataCmd {
recordMap.put("personnelstatus",personnelstatus);
recordMap.put("gradename",gradename);
recordMap.put("field69",field69);
String avatarUrl = "";
if(StringUtils.isBlank(avatarUrl)){
avatarUrl = "/build/hrm/static/media/male.png";
}
recordMap.put("avatarUrl",avatarUrl);
// List<Map<String,String>> customList = new ArrayList<Map<String,String>>();
// Map<String,String> customMap = new HashMap<String,String>();
// customMap.put("name","销售排名");
// customMap.put("value","TOP1");
// customList.add(customMap);
//
// customMap = new HashMap<String,String>();
// customMap.put("name","职称");
// customMap.put("value","高级工程师");
// customList.add(customMap);
//
// customMap = new HashMap<String,String>();
// customMap.put("name","熟悉领域");
// customMap.put("value","项目实施");
// customList.add(customMap);
//
// customMap = new HashMap<String,String>();
// customMap.put("name","技能证书");
// customMap.put("value","人力资源管理师");
// customList.add(customMap);
List<Map<String,Object>> customList = getCustomType(employee,tenantKey);
recordMap.put("customType",customList);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
}
try{
String avatarUrl = employee.getAvatar().getPreviewUrl();
log.error("CockpitUserDataCmd-test-avatarUrl:"+avatarUrl);
Long SubCompanyId = employee.getDepartment().getSubCompanyId();
log.error("CockpitUserDataCmd-test-SubCompanyId:"+SubCompanyId);
}catch (Exception e){
}
return recordMap;
}
/***
*
* @return
*/
public List<Map<String,Object>> getCustomType(SimpleEmployee employee,String tenantKey){
List<Map<String,Object>> recordList = new ArrayList<Map<String,Object>>();
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
Long employeeId = employee.getEmployeeId();
try {
String sql =" select p.bqmc,p.bqnr \n" +
" from(\n" +
" select bqmc,bqnr " +
" from uf_rcbq " +
" where ry = ? \n" +
" and delete_type = 0\n" +
" and tenant_key = ? \n" +
" order by xssx desc\n" +
" ) p limit 4" ;
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);
recordList = databaseUtils.getDataSourceList(result);
if(recordList.size() < 4){
for(int i=0;i<(4-recordList.size());i++){
Map<String,Object> nullMap = new HashMap<String,Object>();
recordList.add(nullMap);
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("getRightViewData:" + e);
}
return recordList;
}
}

@ -2,6 +2,7 @@ package com.weaver.seconddev.cockpit.cmd;
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;
@ -51,13 +52,8 @@ public class CockpitWorkflowAnalysisCmd {
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);
List<Map<String,Object>> rightList = getRightViewData(employee,tenantKey);
recordMap.put("rightdata",rightList);
} catch (Exception e) {
e.printStackTrace();
log.error("PortalPerformanceInfoCmd :" + e);
@ -298,6 +294,57 @@ public class CockpitWorkflowAnalysisCmd {
return dayList;
}
/***
*
* @param employee
* @param tenantKey
* @return
*/
public List<Map<String,Object>> getRightViewData(SimpleEmployee employee,String tenantKey){
List<Map<String,Object>> recordList = new ArrayList<Map<String,Object>>();
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
Long employeeId = employee.getEmployeeId();
try {
String sql =" select w.workflowid,w.workflowname,w.cou " +
" from (\n" +
" select p.workflowid,p.WORKFLOWNAME,p.cou\n" +
" from (\n" +
" select t.workflowid,p.workflowname,count(1) as cou \n" +
" from wfc_requestbase t\n" +
" inner join wfp_base p on p.id = t.workflowid\n" +
" where t.userid = ? \n" +
" and delete_type = 0 \n" +
" and tenant_key= ? " +
" group by t.workflowid,p.WORKFLOWNAME\n" +
" ) p order by p.cou 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);
recordList = databaseUtils.getDataSourceList(result);
} catch (Exception e) {
e.printStackTrace();
log.error("getRightViewData:" + e);
}
return recordList;
}
}

Loading…
Cancel
Save