|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.weaver.seconddev.njprojectreport.util;
|
|
|
|
|
|
|
|
|
|
import com.weaver.common.security.util.SecurityUtil;
|
|
|
|
|
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
|
|
|
|
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
@ -884,14 +885,14 @@ public class ColumnsUtils {
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
String sqlwhere = "" ;
|
|
|
|
|
log.error("subcompanyids:"+subcompanyids);
|
|
|
|
|
log.error("queryProjectList--subcompanyids:"+subcompanyids);
|
|
|
|
|
if(StringUtils.isNotBlank(subcompanyids)){
|
|
|
|
|
sqlwhere = " and d.subcompanyid in(?)";
|
|
|
|
|
sqlwhere += " and d.subcompanyid in("+SecurityUtil.ecodeForSql(subcompanyids)+")";
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(subcompanyids);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
// sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
// sqlParamEntity.setValue(subcompanyids);
|
|
|
|
|
// sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -907,6 +908,9 @@ public class ColumnsUtils {
|
|
|
|
|
xm_ysrq_end = year+"-12-31";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.error("queryProjectList--xm_ysrq_start:"+xm_ysrq_start);
|
|
|
|
|
log.error("queryProjectList--xm_ysrq_end:"+xm_ysrq_end);
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(xm_ysrq_start)){
|
|
|
|
|
sqlwhere += " and p.actual_val_date >= ? " ;
|
|
|
|
|
|
|
|
|
@ -915,6 +919,7 @@ public class ColumnsUtils {
|
|
|
|
|
sqlParamEntity.setValue(xm_ysrq_start);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(xm_ysrq_end)){
|
|
|
|
|
sqlwhere += " and p.actual_val_date <= ?" ;
|
|
|
|
|
|
|
|
|
@ -924,50 +929,43 @@ public class ColumnsUtils {
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.error("queryProjectList--xm_mc:"+xm_mc);
|
|
|
|
|
if(StringUtils.isNotBlank(xm_mc)){
|
|
|
|
|
sqlwhere += " and m.name like '%?%'" ;
|
|
|
|
|
sqlwhere += " and m.name like '%"+SecurityUtil.ecodeForSql(xm_mc)+"%'" ;
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(xm_mc);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
// sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
// sqlParamEntity.setValue(xm_mc);
|
|
|
|
|
// sqlparam.add(sqlParamEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.error("queryProjectList--xm_xmjl:"+xm_xmjl);
|
|
|
|
|
if(StringUtils.isNotBlank(xm_xmjl)){
|
|
|
|
|
sqlwhere += " and m.manager in(?)" ;
|
|
|
|
|
sqlwhere += " and m.manager in("+SecurityUtil.ecodeForSql(xm_xmjl)+")" ;
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(xm_xmjl);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
// sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
// sqlParamEntity.setValue(xm_xmjl);
|
|
|
|
|
// sqlparam.add(sqlParamEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(xm_bm)){
|
|
|
|
|
sqlwhere += " and d.id in (?)" ;
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(xm_bm);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(xm_bm)){
|
|
|
|
|
sqlwhere += " and d.id in ("+SecurityUtil.ecodeForSql(xm_bm)+")" ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(xm_jg)){
|
|
|
|
|
sqlwhere += " and d.subcompanyid in (?)" ;
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(xm_jg);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
sqlwhere += " and d.subcompanyid in("+SecurityUtil.ecodeForSql(xm_jg)+")" ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.error("queryProjectList--xm_id:"+xm_id);
|
|
|
|
|
if(StringUtils.isNotBlank(xm_id)){
|
|
|
|
|
sqlwhere += " and m.id in (?)" ;
|
|
|
|
|
sqlwhere += " and m.id in ("+SecurityUtil.ecodeForSql(xm_id)+")" ;
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(xm_id);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
// sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
// sqlParamEntity.setValue(xm_id);
|
|
|
|
|
// sqlparam.add(sqlParamEntity);
|
|
|
|
|
}
|
|
|
|
|
sqlwhere += " order by actual_val_date desc " ;
|
|
|
|
|
|
|
|
|
@ -977,7 +975,14 @@ public class ColumnsUtils {
|
|
|
|
|
log.error("queryProjectList---dataSql:"+dataSql);
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql,sqlparam);
|
|
|
|
|
result.entrySet().stream().forEach(entry -> {
|
|
|
|
|
if(!"records".equals(entry.getKey())){
|
|
|
|
|
log.error("key:"+entry.getKey() + " value:" + entry.getValue());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
|
|
|
|
log.error("queryProjectList---recordList:"+recordList.size());
|
|
|
|
|
return recordList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1046,20 +1051,18 @@ public class ColumnsUtils {
|
|
|
|
|
" convert(d.subcompanyid,char) as subcompany_id,d2.name as subcompany_name,"+
|
|
|
|
|
" convert(p.rel_custom,char) as rel_custom," +
|
|
|
|
|
" p.proj_amount,p.proj_approval_date,p.actual_val_date "+
|
|
|
|
|
" from ec_customerservice.mainline m " +
|
|
|
|
|
" inner join mainline_form_data fd on fd.mainline_id = m.id "+
|
|
|
|
|
" inner join ec_customerservice.proj_pms_base p on p.form_data_id = fd.form_data_id "+
|
|
|
|
|
" inner join ec_customerservice.mainline_status_custom msc on msc.mainline_id = m.id "+
|
|
|
|
|
" inner join ec_customerservice.mainline_cust_status mcs on msc.status_id = mcs.id "+
|
|
|
|
|
" from mainline m " +
|
|
|
|
|
" inner join (select distinct mainline_id,form_data_id from mainline_form_data where delete_type = 0 and tenant_key = ?) fd on fd.mainline_id = m.id "+
|
|
|
|
|
" inner join proj_pms_base p on p.form_data_id = fd.form_data_id "+
|
|
|
|
|
" inner join (select distinct mainline_id,status_id from mainline_status_custom where delete_type = 0 and tenant_key = ?) msc on msc.mainline_id = m.id and msc.status_id = m.status_id "+
|
|
|
|
|
" inner join mainline_cust_status mcs on msc.status_id = mcs.id "+
|
|
|
|
|
" inner join ( select id,username,department from eteams.employee where tenant_key = ? ) e on m.manager = e.id "+
|
|
|
|
|
" inner join ( select id,name,subcompanyid from eteams.department where type = 'department' and tenant_key = ? ) d on e.department = d.id "+
|
|
|
|
|
" inner join ( select id,name,subcompanyid from eteams.department where type = 'subcompany' and tenant_key = ? ) d2 on d.subcompanyid = d2.id "+
|
|
|
|
|
" where m.group_id = '"+group_id+"' " +
|
|
|
|
|
" and m.delete_type = 0 and m.tenant_key = ? " +
|
|
|
|
|
" and fd.delete_type = 0 and fd.tenant_key = ? " +
|
|
|
|
|
" and p.delete_type = 0 and p.tenant_key = ? " +
|
|
|
|
|
" and msc.delete_type = 0 and msc.tenant_key = ? " +
|
|
|
|
|
" and mcs.name in ('验收','结案') and msc.delete_type = 0 and msc.tenant_key = ? "+
|
|
|
|
|
" and mcs.name in ('验收','结案') and mcs.tenant_key = ? "+
|
|
|
|
|
" and p.actual_val_date is not null " ;
|
|
|
|
|
|
|
|
|
|
log.error("queryProjectSql--dataSql:"+dataSql);
|
|
|
|
@ -1116,6 +1119,7 @@ public class ColumnsUtils {
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, countSql,sqlparam);
|
|
|
|
|
recordList = databaseUtils.getDataSourceList(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<recordList.size();i++){
|
|
|
|
@ -1802,14 +1806,14 @@ public class ColumnsUtils {
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
String sqlwhere = "" ;
|
|
|
|
|
log.error("subcompanyids:"+subcompanyids);
|
|
|
|
|
log.error("queryProjectListByExcel2-subcompanyids:"+subcompanyids);
|
|
|
|
|
if(StringUtils.isNotBlank(subcompanyids)){
|
|
|
|
|
sqlwhere += " and d.subcompanyid in(?)";
|
|
|
|
|
sqlwhere += " and d.subcompanyid in("+SecurityUtil.ecodeForSql(subcompanyids)+")";
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(subcompanyids);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
// sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
// sqlParamEntity.setValue(subcompanyids);
|
|
|
|
|
// sqlparam.add(sqlParamEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(xm_ysrq_start)){
|
|
|
|
@ -1846,62 +1850,65 @@ public class ColumnsUtils {
|
|
|
|
|
|
|
|
|
|
log.error("xm_mc:"+xm_mc);
|
|
|
|
|
if(StringUtils.isNotBlank(xm_mc)){
|
|
|
|
|
sqlwhere += " and m.name like '%?%'" ;
|
|
|
|
|
sqlwhere += " and m.name like '%"+SecurityUtil.ecodeForSql(xm_mc)+"%'" ;
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(xm_mc);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
// sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
// sqlParamEntity.setValue(xm_mc);
|
|
|
|
|
// sqlparam.add(sqlParamEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.error("xm_xmjl:"+xm_xmjl);
|
|
|
|
|
if(StringUtils.isNotBlank(xm_xmjl)){
|
|
|
|
|
sqlwhere += " and m.manager in(?)" ;
|
|
|
|
|
sqlwhere += " and m.manager in("+SecurityUtil.ecodeForSql(xm_xmjl)+")" ;
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(xm_xmjl);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
// sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
// sqlParamEntity.setValue(xm_xmjl);
|
|
|
|
|
// sqlparam.add(sqlParamEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.error("xm_bm:"+xm_bm);
|
|
|
|
|
if(StringUtils.isNotBlank(xm_bm)){
|
|
|
|
|
sqlwhere += " and d.id in (?)" ;
|
|
|
|
|
sqlwhere += " and d.id in ("+SecurityUtil.ecodeForSql(xm_bm)+")" ;
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(xm_bm);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
// sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
// sqlParamEntity.setValue(xm_bm);
|
|
|
|
|
// sqlparam.add(sqlParamEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.error("xm_jg:"+xm_jg);
|
|
|
|
|
if(StringUtils.isNotBlank(xm_jg)){
|
|
|
|
|
sqlwhere += " and d.subcompanyid in (?)" ;
|
|
|
|
|
sqlwhere += " and d.subcompanyid in ("+SecurityUtil.ecodeForSql(xm_jg)+")" ;
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(xm_jg);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
// sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
// sqlParamEntity.setValue(xm_jg);
|
|
|
|
|
// sqlparam.add(sqlParamEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.error("xm_id:"+xm_id);
|
|
|
|
|
if(StringUtils.isNotBlank(xm_id)){
|
|
|
|
|
sqlwhere += " and m.id in (?)" ;
|
|
|
|
|
sqlwhere += " and m.id in ("+SecurityUtil.ecodeForSql(xm_id)+")" ;
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(xm_id);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
// sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
// sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
// sqlParamEntity.setValue(xm_id);
|
|
|
|
|
// sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
sqlwhere += " order by actual_val_date desc " ;
|
|
|
|
|
log.error("sqlwhere:"+sqlwhere);
|
|
|
|
|
log.error("queryProjectListByExcel2--sqlwhere:"+sqlwhere);
|
|
|
|
|
|
|
|
|
|
String dataSql = baseSql + sqlwhere ;
|
|
|
|
|
|
|
|
|
|
dataSql = databaseUtils.getMysqlPagedSql(dataSql, pageNo, pageSize);
|
|
|
|
|
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql,sqlparam);
|
|
|
|
|
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
|
|
|
|
|
|
|
|
|
log.error("queryProjectListByExcel2--recordList:"+recordList.size());
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
for(int i=0;i<recordList.size();i++)
|
|
|
|
|
{
|
|
|
|
|