#E10-40# 增加项目查询的接口
parent
0365e27476
commit
bd1bdf40c5
@ -0,0 +1,216 @@
|
||||
package com.weaver.seconddev.cockpit.cmd;
|
||||
|
||||
|
||||
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.project.entity.SimpleMainline;
|
||||
import com.weaver.project.service.RemoteMainlineService;
|
||||
import com.weaver.seconddev.cockpit.util.DatabaseUtils;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CockpitProjectDataCmd {
|
||||
|
||||
//日志
|
||||
private final static Logger log = LoggerFactory.getLogger(CockpitProjectDataCmd.class);
|
||||
|
||||
@RpcReference
|
||||
RemoteMainlineService remoteMainlineService ;
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
|
||||
public Map<String, Object> getDataInfo(SimpleEmployee employee, Map<String, Object> paramMap, String tenantKey) {
|
||||
|
||||
Map<String, Object> recordMap = new HashMap<String, Object>();
|
||||
|
||||
List<Map<String,Object>> projectDate2 = new ArrayList<Map<String,Object>>();
|
||||
List<Map<String,Object>> projectDate3 = new ArrayList<Map<String,Object>>();
|
||||
|
||||
try {
|
||||
projectDate2 = getProjectDate2(employee,tenantKey);
|
||||
projectDate3 = getProjectDate3(employee,tenantKey);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("PortalPerformanceInfoCmd :" + e);
|
||||
}
|
||||
|
||||
recordMap.put("projectDate2",projectDate2);
|
||||
recordMap.put("projectDate3",projectDate3);
|
||||
return recordMap;
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> getProjectDate2(SimpleEmployee employee, String tenantKey) {
|
||||
|
||||
List<Map<String,Object>> projectList = new ArrayList<Map<String,Object>>();
|
||||
String groupId = "weaver-project-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
long employeeid = employee.getEmployeeId();
|
||||
|
||||
try {
|
||||
|
||||
String sql =" select w.* from (\n" +
|
||||
" select convert(m.id,char) as mainline_id,m.name as mainline_name,\n" +
|
||||
" convert(m.manager,char) as manager_id,\n" +
|
||||
" convert(p.rel_custom,char) as rel_custom,p.proj_amount,p.proj_approval_date,\n" +
|
||||
" p.actual_val_date \n" +
|
||||
" from ec_customerservice.mainline m \n" +
|
||||
" inner JOIN ec_customerservice.mainline_form_data f ON f.mainline_id = m.id \n" +
|
||||
" inner join ec_customerservice.proj_pms_base p on p.form_data_id = f.form_data_id \n" +
|
||||
" inner join ec_customerservice.mainline_status_custom msc on msc.mainline_id = m.id \n" +
|
||||
" inner join ec_customerservice.mainline_cust_status mcs on msc.status_id = mcs.id\n" +
|
||||
" where m.group_id = '4527875868755238091' \n" +
|
||||
" and m.manager in( select id\n" +
|
||||
" from eteams.employee \n" +
|
||||
" where (superior = "+employeeid+" or id = "+employeeid+")\n" +
|
||||
" and status='normal'\n" +
|
||||
" and delete_type=0" +
|
||||
" and tenant_key = '"+tenantKey+"'\n" +
|
||||
" and password is not null\n" +
|
||||
" )\n" +
|
||||
" and m.delete_type = 0 \n" +
|
||||
" and m.tenant_key = '"+tenantKey+"'\n" +
|
||||
" and f.delete_type = 0 \n" +
|
||||
" and f.tenant_key = '"+tenantKey+"'\n" +
|
||||
" and p.delete_type = 0\n" +
|
||||
" and p.tenant_key = '"+tenantKey+"'\n" +
|
||||
" and msc.delete_type = 0\n" +
|
||||
" and msc.tenant_key = '"+tenantKey+"'\n" +
|
||||
" and mcs.delete_type = 0\n" +
|
||||
" and mcs.tenant_key = '"+tenantKey+"'\n" +
|
||||
" and mcs.enabled = 1 \n" +
|
||||
" and mcs.name <> '结案'\n" +
|
||||
" order by m.create_time desc\n" +
|
||||
") w limit 6";
|
||||
|
||||
log.error("sql:"+sql);
|
||||
|
||||
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
|
||||
projectList = databaseUtils.getDataSourceList(result);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("getProjectDate2-Exception:" + e);
|
||||
}
|
||||
return projectList;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,Object>> getProjectDate3(SimpleEmployee employee, String tenantKey) {
|
||||
|
||||
List<Map<String,Object>> projectList = new ArrayList<Map<String,Object>>();
|
||||
String groupId = "weaver-project-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
String groupid = "4527875868755238091";
|
||||
long employeeid = employee.getEmployeeId();
|
||||
|
||||
try {
|
||||
|
||||
String sql =" select w.* from (\n" +
|
||||
" select convert(m.id,char) as mainline_id,m.name as mainline_name,\n" +
|
||||
" convert(m.manager,char) as manager_id,\n" +
|
||||
" convert(p.rel_custom,char) as rel_custom,p.proj_amount,p.proj_approval_date,\n" +
|
||||
" p.actual_val_date \n" +
|
||||
" from ec_customerservice.mainline m \n" +
|
||||
" inner JOIN ec_customerservice.mainline_form_data f ON f.mainline_id = m.id \n" +
|
||||
" inner join ec_customerservice.proj_pms_base p on p.form_data_id = f.form_data_id \n" +
|
||||
" inner join ec_customerservice.mainline_status_custom msc on msc.mainline_id = m.id \n" +
|
||||
" inner join ec_customerservice.mainline_cust_status mcs on msc.status_id = mcs.id\n" +
|
||||
" where m.group_id = ? \n" +
|
||||
" and m.manager in( select id\n" +
|
||||
" from eteams.employee \n" +
|
||||
" where (superior = ? or id = ?)\n" +
|
||||
" and status='normal'\n" +
|
||||
" and delete_type=0" +
|
||||
" and tenant_key = ?\n" +
|
||||
" and password is not null\n" +
|
||||
" )\n" +
|
||||
" and m.delete_type = 0 \n" +
|
||||
" and m.tenant_key = ?\n" +
|
||||
" and f.delete_type = 0 \n" +
|
||||
" and f.tenant_key = ?\n" +
|
||||
" and p.delete_type = 0\n" +
|
||||
" and p.tenant_key = ?\n" +
|
||||
" and msc.delete_type = 0\n" +
|
||||
" and msc.tenant_key = ?\n" +
|
||||
" and mcs.delete_type = 0\n" +
|
||||
" and mcs.tenant_key = ?\n" +
|
||||
" and mcs.enabled = 1 \n" +
|
||||
" and mcs.name <> '结案'\n" +
|
||||
" order by m.create_time desc\n" +
|
||||
") w limit 6";
|
||||
|
||||
log.error("sql:"+sql);
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(groupid);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.LONG);
|
||||
sqlParamEntity.setValue(employeeid+"");
|
||||
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);
|
||||
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey+"");
|
||||
sqlparam.add(sqlParamEntity);
|
||||
|
||||
sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(tenantKey+"");
|
||||
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);
|
||||
projectList = databaseUtils.getDataSourceList(result);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("getProjectDate2-Exception:" + e);
|
||||
}
|
||||
return projectList;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue