#E10-40# 增加项目查询的接口

main
shilei 1 year ago
parent 82e3e0f9c4
commit 8c9d21a0ca

@ -7,6 +7,7 @@ import com.weaver.seconddev.cockpit.util.DatabaseUtils;
import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils; import com.weaver.seconddev.cockpit.util.JucailinCockpitUtils;
import com.weaver.teams.client.doc.remote.DocClientService; import com.weaver.teams.client.doc.remote.DocClientService;
import com.weaver.teams.domain.user.SimpleEmployee; import com.weaver.teams.domain.user.SimpleEmployee;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -79,7 +80,7 @@ public class CockpitDocumentAnalysisCmd {
// doclist.add(docMap); // doclist.add(docMap);
docMap = new HashMap<String,String>(); docMap = new HashMap<String,String>();
String doc_count5 = getDocumentDateAmount(employeeId,"5",tenantKey); String doc_count5 = getDocumentDateAmount6(employeeId,tenantKey);
String doc_name5 = "我的积分"; String doc_name5 = "我的积分";
String doc_pkey5 = "document.create.amount"; String doc_pkey5 = "document.create.amount";
String doc_url5 = jucailinCockpitUtils.getUfPropData(doc_pkey5,tenantKey); String doc_url5 = jucailinCockpitUtils.getUfPropData(doc_pkey5,tenantKey);
@ -159,25 +160,134 @@ public class CockpitDocumentAnalysisCmd {
} }
public String getDocumentDateAmount(Long employeeId,String type,String tenantKey) { // public String getDocumentDateAmount(Long employeeId,String type,String tenantKey) {
String count = "0"; // String count = "0";
String groupId = "weaver-doc-service"; // String groupId = "weaver-doc-service";
String sourceType = "LOGIC"; // 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"));
// }
// }else if("4".equals(type)){
//
// }else if("5".equals(type)){
//
// }else if("6".equals(type)){
//
// }else if("7".equals(type)){
//
// }else if("8".equals(type)){
//
// }
// } catch (Exception e) {
// e.printStackTrace();
// log.error("getDocCreateNum:" + e);
// }
//
// return count;
// }
public String getDocumentDateAmount1(Long employeeId,String tenantKey) {
String count = "0";
try { try {
if("1".equals(type)){
int doccreatecount = docClientService.countByCreator(employeeId); int doccreatecount = docClientService.countByCreator(employeeId);
count = doccreatecount + ""; count = doccreatecount + "";
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
}else if("2".equals(type)){ return count;
}
String sql =" select count(1) as cou " + public String getDocumentDateAmount6(Long employeeId,String tenantKey) {
" from document " + int count = 0;
" 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" + String count1 = "0";
" and creator = ?\n" + String count2 = "0";
" and delete_type = 0\n" + String groupId = "weaver-doc-service";
" and tenant_key= ? " ; String sourceType = "LOGIC";
try {
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 = ?" ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>(); List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity(); SqlParamEntity sqlParamEntity = new SqlParamEntity();
@ -190,29 +300,37 @@ public class CockpitDocumentAnalysisCmd {
sqlParamEntity.setValue(tenantKey); sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity); 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); Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result); List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){ if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("cou")); count1 = String.valueOf(recordList.get(0).get("cou"));
} }
}else if("3".equals(type)){ }
String sql =" select count(1) as cou \n" +
" from doc_documentlogs \n" + } catch (Exception e) {
" where targetid in( select id from document where creator = ? and delete_type = 0 and tenant_key=? and doc_status = 2) \n" + e.printStackTrace();
" and log_operator <> ? \n" + log.error("getDocumentDateAmount6:" + e);
" and OPERATETYPE = 'read' \n" + }
try {
if(StringUtils.isNotBlank(employeeId+"")){
String sql =" select count(1) as cou " +
" from doc_matter_forwardlogs " +
" where creator = ? \n" +
" and delete_type = 0 \n" + " and delete_type = 0 \n" +
" and tenant_key=? " ; " and tenant_key = ?\n" +
" and functionname = 'matter_forward'\n" +
" and operatetype = 0 " +
" and targetid not in(\n" +
" select targetid " +
" from doc_matter_forwardlogs " +
" where creator = ?\n" +
" and delete_type = 0 \n" +
" and tenant_key = ?\n" +
" and functionname = 'matter_forward'\n" +
" and operatetype=1 \n" +
" )" ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>(); List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
SqlParamEntity sqlParamEntity = new SqlParamEntity(); SqlParamEntity sqlParamEntity = new SqlParamEntity();
@ -238,51 +356,30 @@ public class CockpitDocumentAnalysisCmd {
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam); Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result); List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){ if(recordList.size()>0){
count = String.valueOf(recordList.get(0).get("cou")); count2 = String.valueOf(recordList.get(0).get("cou"));
} }
}else if("4".equals(type)){
}else if("5".equals(type)){
}else if("6".equals(type)){
}else if("7".equals(type)){
}else if("8".equals(type)){
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("getDocCreateNum:" + e); log.error("getDocumentDateAmount6:" + e);
}
return count;
} }
public String getDocumentDateAmount1(Long employeeId,String tenantKey) { try{
String count = "0"; if(StringUtils.isNotBlank(count1)){
try { int cou1 = Integer.parseInt(count1);
int doccreatecount = docClientService.countByCreator(employeeId); count = count + cou1;
count = doccreatecount + "";
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
} }
return count; if(StringUtils.isNotBlank(count2)){
int cou2 = Integer.parseInt(count2);
count = count + cou2;
} }
}catch (Exception e){
public String getDocumentDateAmount6(Long employeeId,String tenantKey) {
String count = "0";
try {
int sharecount = docClientService.countShareToOther(employeeId);
count = sharecount + "";
} catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("getDocCreateNum:" + e); log.error("getDocumentDateAmount6:" + e);
} }
return count; return count+"";
} }
@ -293,7 +390,7 @@ public class CockpitDocumentAnalysisCmd {
try { try {
String sql =" select count(1) as cou from document where creator in(" + String sql =" select count(1) as cou from document where creator in(" +
" select id from eteams.employee where (superior = ?) and status='normal' and delete_type=0 and tenant_key=? and password is not null "+ " select id from eteams.employee where superior = ? and status='normal' and delete_type=0 and tenant_key=? "+
" ) and delete_type = 0 and tenant_key=? and doc_status = 2" ; " ) and delete_type = 0 and tenant_key=? and doc_status = 2" ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>(); List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
@ -349,16 +446,6 @@ public class CockpitDocumentAnalysisCmd {
sqlParamEntity.setValue(tenantKey); sqlParamEntity.setValue(tenantKey);
sqlparam.add(sqlParamEntity); 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); Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result); List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size()>0){ if(recordList.size()>0){

@ -96,8 +96,8 @@ public class CockpitUserDataCmd {
log.error("jobcallid:"+jobcallid); log.error("jobcallid:"+jobcallid);
if(StringUtils.isNotBlank(deptid+"")){ if(StringUtils.isNotBlank(deptid+"")){
String sql =" select name from department where id in( " + String sql =" select name from eteams.department where id in( " +
" select subcompanyid from department where id = ? and delete_type=0 and tenant_key = ?" + " select subcompanyid from eteams.department where id = ? and delete_type=0 and tenant_key = ?" +
" ) and delete_type=0 and tenant_key = ?"; " ) and delete_type=0 and tenant_key = ?";
log.error("sql:"+sql); log.error("sql:"+sql);

Loading…
Cancel
Save