#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.teams.client.doc.remote.DocClientService;
import com.weaver.teams.domain.user.SimpleEmployee;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -79,7 +80,7 @@ public class CockpitDocumentAnalysisCmd {
// doclist.add(docMap);
docMap = new HashMap<String,String>();
String doc_count5 = getDocumentDateAmount(employeeId,"5",tenantKey);
String doc_count5 = getDocumentDateAmount6(employeeId,tenantKey);
String doc_name5 = "我的积分";
String doc_pkey5 = "document.create.amount";
String doc_url5 = jucailinCockpitUtils.getUfPropData(doc_pkey5,tenantKey);
@ -159,25 +160,134 @@ public class CockpitDocumentAnalysisCmd {
}
public String getDocumentDateAmount(Long employeeId,String type,String tenantKey) {
String count = "0";
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
// 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"));
// }
// }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 {
if("1".equals(type)){
int doccreatecount = docClientService.countByCreator(employeeId);
count = doccreatecount + "";
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
int doccreatecount = docClientService.countByCreator(employeeId);
count = doccreatecount + "";
return count;
}
}else if("2".equals(type)){
public String getDocumentDateAmount6(Long employeeId,String tenantKey) {
int count = 0;
String count1 = "0";
String count2 = "0";
String groupId = "weaver-doc-service";
String sourceType = "LOGIC";
try {
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= ? " ;
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>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
@ -190,29 +300,37 @@ public class CockpitDocumentAnalysisCmd {
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"));
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" +
" 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=? " ;
}
} catch (Exception e) {
e.printStackTrace();
log.error("getDocumentDateAmount6:" + e);
}
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 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>();
SqlParamEntity sqlParamEntity = new SqlParamEntity();
@ -238,51 +356,30 @@ public class CockpitDocumentAnalysisCmd {
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"));
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) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
}
return count;
}
public String getDocumentDateAmount1(Long employeeId,String tenantKey) {
String count = "0";
try {
int doccreatecount = docClientService.countByCreator(employeeId);
count = doccreatecount + "";
} catch (Exception e) {
e.printStackTrace();
log.error("getDocCreateNum:" + e);
log.error("getDocumentDateAmount6:" + e);
}
return count;
}
try{
if(StringUtils.isNotBlank(count1)){
int cou1 = Integer.parseInt(count1);
count = count + cou1;
}
public String getDocumentDateAmount6(Long employeeId,String tenantKey) {
String count = "0";
try {
int sharecount = docClientService.countShareToOther(employeeId);
count = sharecount + "";
} catch (Exception e) {
if(StringUtils.isNotBlank(count2)){
int cou2 = Integer.parseInt(count2);
count = count + cou2;
}
}catch (Exception e){
e.printStackTrace();
log.error("getDocCreateNum:" + e);
log.error("getDocumentDateAmount6:" + e);
}
return count;
return count+"";
}
@ -293,7 +390,7 @@ public class CockpitDocumentAnalysisCmd {
try {
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" ;
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
@ -349,16 +446,6 @@ public class CockpitDocumentAnalysisCmd {
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){

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

Loading…
Cancel
Save