From 8880ac0f5d529946e07b8ee3435d2f25ec036e50 Mon Sep 17 00:00:00 2001 From: shilei <798989044@qq.com> Date: Mon, 18 Mar 2024 21:05:55 +0800 Subject: [PATCH] =?UTF-8?q?#E10-08#=20=E5=A4=84=E7=90=86sql=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HrmSelfHelpController.java | 1705 +++-------------- 1 file changed, 313 insertions(+), 1392 deletions(-) diff --git a/src/main/java/com/weaver/seconddev/jcldoor/controller/HrmSelfHelpController.java b/src/main/java/com/weaver/seconddev/jcldoor/controller/HrmSelfHelpController.java index d30c4a6..01cdf3c 100644 --- a/src/main/java/com/weaver/seconddev/jcldoor/controller/HrmSelfHelpController.java +++ b/src/main/java/com/weaver/seconddev/jcldoor/controller/HrmSelfHelpController.java @@ -2,13 +2,11 @@ package com.weaver.seconddev.jcldoor.controller; import com.weaver.common.authority.annotation.WeaPermission; import com.weaver.common.base.entity.result.WeaResult; -import com.weaver.common.security.util.SecurityUtil; import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity; import com.weaver.ebuilder.datasource.api.enums.SqlParamType; import com.weaver.em.msg.api.rest.OaRest; import com.weaver.framework.remote.client.rest.RestClient; import com.weaver.framework.rpc.annotation.RpcReference; -import com.weaver.seconddev.jcldoor.util.CommonUtils; import com.weaver.seconddev.jcldoor.util.DatabaseUtils; import com.weaver.teams.blog.domain.RemoteBlogInfoService; import com.weaver.teams.client.doc.remote.DocClientService; @@ -18,7 +16,6 @@ import com.weaver.teams.security.context.UserContext; import com.weaver.workflow.common.constant.list.listdimension.RequestListInitDimensionTabEnum; import com.weaver.workflow.common.entity.list.api.RequestListConditionApiEntity; import com.weaver.workflow.common.entity.list.api.publicapi.RequestCountInfoPAEntity; -import com.weaver.workflow.common.entity.list.api.publicapi.RequestListInfoPAEntity; import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest; import com.weaver.workrelate.performance.api.rest.RemotePerformanceService; import org.apache.commons.collections.CollectionUtils; @@ -68,28 +65,8 @@ public class HrmSelfHelpController { @Autowired private DatabaseUtils databaseUtils; - public String tenant_key = "t7akvdnf84" ; - @GetMapping("/testSapi9") - @WeaPermission(publicPermission = true) - public WeaResult testSapi9(HttpServletRequest request){ - - //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData - Map dataMap = new HashMap(); - dataMap.put("test","testSapi9"); - try { - Long employeeId = UserContext.getCurrentEmployeeId(); - String TenantKey = "t7akvdnf84"; - dataMap = remoteHrKpiService.getKpiFLowById(employeeId,TenantKey); - } catch (Exception e) { - e.printStackTrace(); - log.error("testSapi8:"+e); - } - return WeaResult.success(dataMap); - } - - @GetMapping("/testSapi10") @WeaPermission(publicPermission = true) public WeaResult testSapi10(HttpServletRequest request){ @@ -97,18 +74,21 @@ public class HrmSelfHelpController { Map dataMap = new HashMap(); dataMap.put("test","testSapi10"); try { - SimpleEmployee employee = UserContext.getCurrentUser(); + log.error("employee:"+employee.getEmployeeId()); RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity(); - WeaResult requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity); - + log.error("3333333"); + WeaResult requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity); + log.error("requestCountInfo:"+requestCountInfo.toString()); int code = requestCountInfo.getCode(); + log.error("code:"+code); RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData(); + log.error("requestCountInfoPAEntity:"+requestCountInfoPAEntity); long count = requestCountInfoPAEntity.getCount(); + log.error("count:"+count); dataMap.put("code",code); dataMap.put("count",count); - } catch (Exception e) { e.printStackTrace(); log.error("testSapi10:"+e); @@ -118,6 +98,7 @@ public class HrmSelfHelpController { } + @GetMapping("/testSapi11") @WeaPermission(publicPermission = true) public WeaResult testSapi11(HttpServletRequest request){ @@ -127,48 +108,35 @@ public class HrmSelfHelpController { dataMap.put("test","testSapi11"); try { SimpleEmployee employee = UserContext.getCurrentUser(); + log.error("employee:"+employee.getEmployeeId()); + RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity(); - WeaResult RequestCountInfoPAEntity = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), conditionEntity); - int code = RequestCountInfoPAEntity.getCode(); - Long count = RequestCountInfoPAEntity.getData().getCount(); + log.error("444444"); - dataMap.put("code",code); - dataMap.put("count",count); + WeaResult requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), conditionEntity); + log.error("requestCountInfo:"+requestCountInfo.toString()); + int code = requestCountInfo.getCode(); + log.error("code:"+code); - } catch (Exception e) { - e.printStackTrace(); - log.error("testSapi11:"+e); - dataMap.put("count","-1"); - } - return WeaResult.success(dataMap); - } + RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData(); + log.error("requestCountInfoPAEntity:"+requestCountInfoPAEntity); + long count = requestCountInfoPAEntity.getCount(); + log.error("count:"+count); - @GetMapping("/testSapi12") - @WeaPermission(publicPermission = true) - public WeaResult testSapi12(HttpServletRequest request){ - //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData - Map dataMap = new HashMap(); - dataMap.put("test","testSapi12"); - try { - long employeeId = UserContext.getCurrentEmployeeId(); - int doccreatecount = docClientService.countByCreator(employeeId); - dataMap.put("employeeId",employeeId); - dataMap.put("count",doccreatecount); + dataMap.put("code",code); + dataMap.put("count",count); } catch (Exception e) { e.printStackTrace(); - log.error("testSapi12:"+e); + log.error("testSapi11:"+e); dataMap.put("count","-1"); } return WeaResult.success(dataMap); } - - @GetMapping("/testSapi13") @WeaPermission(publicPermission = true) public WeaResult testSapi13(HttpServletRequest request){ - //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData Map dataMap = new HashMap(); dataMap.put("test","testSapi13"); @@ -187,7 +155,13 @@ public class HrmSelfHelpController { cal.add(Calendar.DATE, 1); String endDate = format.format(cal.getTime()); + log.error("startDate:"+startDate); + log.error("endDate:"+endDate); + Long cid = employee.getCid(); + + log.error("cid:"+cid); + String pageSize = "100"; String pageNum = "1"; @@ -201,11 +175,12 @@ public class HrmSelfHelpController { com.weaver.em.msg.api.entity.Request emrequest = new com.weaver.em.msg.api.entity.Request(); emrequest.setUrl("/user-profile/groupSession"); emrequest.setParamsMap(json); - com.weaver.em.msg.api.entity.Response response = oaRest.executeIm(emrequest); + com.weaver.em.msg.api.entity.Response response2 = oaRest.executeIm(emrequest); - String data = response.getData(); - dataMap.put("datas",data); + String data = response2.getData(); + log.error("data:"+data); + dataMap.put("datas",data); } catch (Exception e) { e.printStackTrace(); log.error("testSapi13:"+e); @@ -265,897 +240,6 @@ public class HrmSelfHelpController { } - @GetMapping("/testSapi15") - @WeaPermission(publicPermission = true) - public WeaResult testSapi15(HttpServletRequest request){ - //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData - Map dataMap = new HashMap(); - dataMap.put("test","testSapi15"); - - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); - try { - - LocalDate currentDate = LocalDate.now(); - LocalDate lastMonthDate = currentDate.minusMonths(1); - int lastMonth = lastMonthDate.getMonthValue(); - log.error("上个月的月份是:" + lastMonth); - - SimpleEmployee employee = UserContext.getCurrentUser(); - - long employeeId = UserContext.getCurrentEmployeeId(); - - String groupId = "weaver-wr-performance-service"; - String sourceType = "LOGIC"; - - Map dataMap1 = getLastMonthKpi(employeeId,groupId,sourceType); - - Map dataMap2 = getWholeYearKpi(employeeId,groupId,sourceType); - - dataMap.putAll(dataMap1); - dataMap.putAll(dataMap2); - - // " select * from HR_KPI_FLOW where kpi_user='6488080121949444347' and REAL_PERIOD>='2024-01-01' and REAL_PERIOD<='2024-01-31' " ; - // KPI_SCHEME - - //select * from hr_kpi_details where kpi_scheme like '%100001230000006534%' - - - //select * from hr_kpi_details_link where - //KPI_DETAILS like '%100001200000006534%' - //and PROPERTY='describe' - -// select * from hr_kpi_details_link where -// KPI_DETAILS like '%100001200000006534%' -// and PROPERTY = 'weight' - -// select * from hr_kpi_details_link where -// KPI_DETAILS like '%100001200000006534%' -// and PROPERTY = 'type' - - -// select * from hr_kpi_scheme_indicator -// where SCHEME_ID='100001230000006534' - - - - - - } catch (Exception e) { - e.printStackTrace(); - log.error("testSapi14:"+e); - dataMap.put("count","-1"); - } - return WeaResult.success(dataMap); - } - - - /*** - * - * @param employeeId - * @param groupId - * @param sourceType - * @return - */ - public Map getWholeYearKpi(long employeeId,String groupId,String sourceType){ - - Map dataMap = new HashMap(); - LocalDate localDate = LocalDate.now(); - int year = localDate.getYear() ; - int dayOfYear = 1 ; - for(int i=1;i<=12;i++){ - Month month = Month.of(i); - LocalDate startDay = YearMonth.of(year, month).atDay(dayOfYear); // 计算当前月份的首日 - LocalDate endDay = YearMonth.of(year, month).atEndOfMonth(); // 计算当前月份的最后一天 - String yearMonth = ""; - if(i<10){ - yearMonth = year+"-0"+i ; - }else{ - yearMonth = year+"-"+i ; - } - - String sql =" select score from wr-performance.hr_kpi_flow " + - " where kpi_user='"+employeeId+"' " + - " and REAL_PERIOD >= '" +startDay+"'" + - " and REAL_PERIOD <='" + endDay +"'" + - " and module = 'kpiFlow'" + - " and DATE_TYPE = 'month'" + - " and FLOW_STATUS = 'finished'" + - " and delete_type = '0'" + - " and tenant_key='"+tenant_key+"' " ; - - log.error("sql:"+sql); - - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - if(CollectionUtils.isNotEmpty(recordList)){ - Map recordMap = recordList.get(0); - if(!recordMap.isEmpty()){ - String score = String.valueOf(recordMap.get("score")); - if(StringUtils.isNotBlank(score)){ - dataMap.put(yearMonth,score); - } - } - } - } - return dataMap ; - } - - - public Map getLastMonthKpi(long employeeId, String groupId, String sourceType){ - - log.error("getLastMonthKpi:"); - - Map dataMap = new HashMap(); - - List> indicatorList = new ArrayList>(); - - LocalDate localDate = LocalDate.now(); - int year = localDate.getYear() ; - for(int i=0;i<=12;i++){ - LocalDate previousMonth = localDate.minusMonths(i); - String startDay = previousMonth.with(TemporalAdjusters.lastDayOfMonth()).toString(); - String endDay = previousMonth.with(TemporalAdjusters.firstDayOfMonth()).toString(); - log.error("startDay:"+startDay); - log.error("endDay:"+endDay); - - String yearMonth = ""; - if(i<10){ - yearMonth = year+"-0"+i ; - }else{ - yearMonth = year+"-"+i ; - } - - String sql =" select kpi_scheme,score " + - " from wr-performance.hr_kpi_flow " + - " where kpi_user='"+employeeId+"' " + - " and real_period >= '" +startDay+"'" + - " and real_period <='" + endDay +"'" + - " and module = 'kpiFlow'" + - " and date_type = 'month'" + - " and flow_status = 'finished'" + - " and delete_type = '0'" + - " and tenant_key='"+tenant_key+"' " ; - log.error("sql:"+sql); - - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - if(CollectionUtils.isNotEmpty(recordList)){ - Map recordMap = recordList.get(0); - if(!recordMap.isEmpty()){ - String score = String.valueOf(recordMap.get("score")); - String kpi_scheme = String.valueOf(recordMap.get("kpi_scheme")); - log.error("score:"+score); - log.error("kpi_scheme:"+kpi_scheme); - if(StringUtils.isNotBlank(score)){ - dataMap.put("score",score); - dataMap.put("yearmonth",yearMonth); - dataMap.put("kpi_scheme",kpi_scheme); - break; - } - } - } - } - - if(!dataMap.isEmpty()){ - String kpi_scheme = String.valueOf(dataMap.get("kpi_scheme")); - - log.error("kpi_scheme:"+kpi_scheme); - - if(StringUtils.isNotBlank(kpi_scheme)){ - String sql =" select indicator_type,indicator_description,weight \n" + - " from wr-performance.hr_kpi_scheme_indicator " + - " where scheme_id='"+kpi_scheme+"' " + - " and indicator_mode='quantify'\n" + - " and status='on' " + - " and delete_type = '0'" + - " and tenant_key = '"+tenant_key+"'" ; - log.error("sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - - log.error("recordList:"+recordList.size()); - - if(recordList.size()>=2){ - for(int i=0;i<2;i++){ - indicatorList.add(recordList.get(i)); - } - }else if(recordList.size() == 1){ - indicatorList.add(recordList.get(0)); - - Map indicatorMap = new HashMap(); - sql = " select name,data_row,property\n" + - " from wr-performance.hr_kpi_details_link\n" + - " where kpi_details = '"+kpi_scheme+"'\n" + - " and module = 'kpiSchemeSetting'\n" + - " and tenant_key = '"+tenant_key+"'\n" + - " and delete_type = '0'\n" + - " and property in('weight', 'describe', 'type')\n" + - " and data_row in ( \n" + - " select p.data_row from (\n" + - " select w.data_row from (\n" + - " select data_row \n" + - " from wr-performance.hr_kpi_details_link\n" + - " where KPI_DETAILS = '"+kpi_scheme+"'\n" + - " and PROPERTY = 'weight'\n" + - " and MODULE = 'kpiSchemeSetting'\n" + - " and TENANT_KEY = '"+tenant_key+"'\n" + - " and DELETE_TYPE = '0'\n" + - " order by name desc\n" + - " ) w limit 1 \n" + - " ) p\n" + - " )"; - log.error("sql:"+sql); - Map result2 = databaseUtils.execute(sourceType, groupId, sql); - List> recordList2 = databaseUtils.getDataSourceList(result2); - log.error("recordList2:"+recordList2.size()); - for(int i=0;i recordMap = recordList2.get(i); - String name = String.valueOf(recordMap.get("name")); - String property = String.valueOf(recordMap.get("property")); - - log.error("name:"+name); - log.error("property:"+property); - - if("weight".equalsIgnoreCase(property)){ - indicatorMap.put("weight",name); - } - if("describe".equalsIgnoreCase(property)){ - indicatorMap.put("indicator_description",name); - } - if("type".equalsIgnoreCase(property)){ - indicatorMap.put("indicator_type",name); - } - } - - if(!indicatorMap.isEmpty()){ - indicatorList.add(indicatorMap); - } - - }else{ - - sql = " select w.data_row from (\n" + - " select data_row\n" + - " from wr-performance.hr_kpi_details_link\n" + - " where KPI_DETAILS = '"+kpi_scheme+"'\n" + - " and PROPERTY = 'weight'\n" + - " and MODULE = 'kpiSchemeSetting'\n" + - " and TENANT_KEY = '"+tenant_key+"'\n" + - " and DELETE_TYPE = '0'\n" + - " order by name desc\n" + - " limit 2\n" + - ") w " ; - - Map result3 = databaseUtils.execute(sourceType, groupId, sql); - List> recordList3 = databaseUtils.getDataSourceList(result3); - for(int k=0;k recordMap3 = recordList3.get(k); - - String data_row = String.valueOf(recordMap3.get("data_row")); - - Map indicatorMap = new HashMap(); - - sql = " select name,data_row,property\n" + - " from wr-performance.hr_kpi_details_link\n" + - " where KPI_DETAILS = '"+kpi_scheme+"'\n" + - " and MODULE = 'kpiSchemeSetting'\n" + - " and TENANT_KEY = '"+tenant_key+"'\n" + - " and DELETE_TYPE = '0'\n" + - " and property in('weight', 'describe', 'type')\n" + - " and data_row in("+data_row+")" ; - - Map result2 = databaseUtils.execute(sourceType, groupId, sql); - List> recordList2 = databaseUtils.getDataSourceList(result2); - - for(int i=0;i recordMap = recordList2.get(i); - - String name = String.valueOf(recordMap.get("name")); - String property = String.valueOf(recordMap.get("property")); - if("weight".equalsIgnoreCase(property)){ - indicatorMap.put("weight",name); - } - if("describe".equalsIgnoreCase(property)){ - indicatorMap.put("indicator_description",name); - } - if("type".equalsIgnoreCase(property)){ - indicatorMap.put("indicator_type",name); - } - } - } - } - } - } - - return dataMap ; - } - - - @GetMapping("/testSapi16") - @WeaPermission(publicPermission = true) - public WeaResult testSapi16(HttpServletRequest request){ - //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData - Map dataMap = new HashMap(); - dataMap.put("test","testSapi16"); - - Map recordMap = new HashMap(); - try { - - String day = "30"; - SimpleEmployee employee = UserContext.getCurrentUser(); - - long employeeId = UserContext.getCurrentEmployeeId(); - dataMap.put("day",day); - dataMap.put("employeeId",employeeId); - - String groupId = "weaver-portrait-service"; - String sourceType = "LOGIC"; - - String sql =" SELECT \n" + - " t1.id typeid,\n" + - " t1.name typename,\n" + - " t2.id riskid,\n" + - " t2.name riskname,\n" + - " t.risk_value,\n" + - " t.tenant_key,\n" + - " t.userid," + - " e.username,\n" + - " times \n" + - " FROM (\n" + - " SELECT k.riskid,k.risk_value,k.tenant_key,k.userid,COUNT(k.riskid) times \n" + - " FROM (\n" + - " SELECT t.riskid,t.risk_value,t.tenant_key,t.userid\n" + - " FROM pr_indrisk_data t \n" + - " WHERE t.delete_type = 0 \n" + - " AND t.tenant_key = '"+tenant_key+"'\n" + - " AND t.risk_date >= DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 30 DAY), '%Y-%m-%d')\n" + - " AND t.userid = '"+employeeId+"'\n" + - " union all\n" + - " SELECT t.riskid,t.risk_value,t.tenant_key,t.userid\n" + - " FROM pr_indrisk_data t \n" + - " WHERE t.delete_type = 0 \n" + - " AND t.tenant_key = '"+tenant_key+"'\n" + - " AND t.risk_date >= DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 30 DAY), '%Y-%m-%d')\n" + - " AND t.userid IN (select cid from eteams.emp_link where pid= '"+employeeId+"' and relation = 'senior') \n" + - " ) k \n" + - " GROUP BY k.riskid,\n" + - " k.risk_value,\n" + - " k.tenant_key,\n" + - " k.userid\n" + - " ) t,\n" + - " pr_indrisk_type t1,\n" + - " pr_indrisk_info t2 ,\n" + - " eteams.employee e\n" + - " WHERE t.riskid = t2.id \n" + - " AND t2.risk_type = t1.id \n" + - " AND t.userid = e.id\n" + - " AND e.STATUS != 'unavailable' AND e.PERMANENTLY_DELETE = '0'\n" + - " AND t1.delete_type = 0 \n" + - " AND t2.delete_type = 0" ; - - log.error("testSapi16:"+sql); - - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - recordMap.put("datas",recordList); - } catch (Exception e) { - e.printStackTrace(); - log.error("testSapi16:"+e); - dataMap.put("count","-1"); - } - return WeaResult.success(recordMap); - } - - - @GetMapping("/testSapi17") - @WeaPermission(publicPermission = true) - public WeaResult testSapi17(HttpServletRequest request){ - //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData - Map dataMap = new HashMap(); - dataMap.put("test","testSapi17"); - - Map recordMap = new HashMap(); - try { - - String day = null2String(request.getParameter("day"),"30"); - SimpleEmployee employee = UserContext.getCurrentUser(); - - long employeeId = UserContext.getCurrentEmployeeId(); - - dataMap.put("day",day); - dataMap.put("employeeId",employeeId); - - String groupId = "weaver-portrait-service"; - String sourceType = "LOGIC"; - - String sql =" SELECT \n" + - " t1.id typeid,\n" + - " t1.name typename,\n" + - " t2.id riskid,\n" + - " t2.name riskname,\n" + - " t.risk_value,\n" + - " t.tenant_key,\n" + - " t.userid,\n" + - " e.username,\n" + - " times \n" + - " FROM (\n" + - " SELECT k.riskid,k.risk_value,k.tenant_key,k.userid,COUNT(k.riskid) times \n" + - " FROM (\n" + - " SELECT t.riskid,t.risk_value,t.tenant_key,t.userid\n" + - " FROM portrait.pr_indrisk_data t \n" + - " WHERE t.delete_type = 0 \n" + - " AND t.tenant_key = '"+tenant_key+"'\n" + - " AND t.risk_date >= DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL "+day+" DAY), '%Y-%m-%d')\n" + - " AND t.userid = '"+employeeId+"'\n" + - " union all\n" + - " SELECT t.riskid,t.risk_value,t.tenant_key,t.userid\n" + - " FROM portrait.pr_indrisk_data t \n" + - " WHERE t.delete_type = 0 \n" + - " AND t.tenant_key = '"+tenant_key+"'\n" + - " AND t.risk_date >= DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL "+day+" DAY), '%Y-%m-%d')\n" + - " AND t.userid IN (select cid from eteams.emp_link where pid= '"+employeeId+"' and relation = 'senior') \n" + - " ) k \n" + - " GROUP BY k.riskid,\n" + - " k.risk_value,\n" + - " k.tenant_key,\n" + - " k.userid\n" + - " ) t,\n" + - " portrait.pr_indrisk_type t1,\n" + - " portrait.pr_indrisk_info t2 ,\n" + - " eteams.employee e\n" + - " WHERE t.riskid = t2.id \n" + - " AND t2.risk_type = t1.id \n" + - " AND t.userid = e.id\n" + - " AND e.STATUS != 'unavailable' AND e.PERMANENTLY_DELETE = '0'\n" + - " AND t1.delete_type = 0 \n" + - " AND t2.delete_type = 0" ; - - log.error("testSapi17:"+sql); - - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - recordMap.put("datas",recordList); - } catch (Exception e) { - e.printStackTrace(); - log.error("testSapi17:"+e); - dataMap.put("count","-1"); - } - return WeaResult.success(recordMap); - } - - - @GetMapping("/testSapi18") - @WeaPermission(publicPermission = true) - public WeaResult testSapi18(HttpServletRequest request){ - //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData - Map dataMap = new HashMap(); - dataMap.put("test","testSapi18"); - - Map recordMap = new HashMap(); - try { - - String day = null2String(request.getParameter("day"),"30"); - SimpleEmployee employee = UserContext.getCurrentUser(); - - String startDay = ""; - if(StringUtils.isNotBlank(day)){ - int day_ = Integer.parseInt(day); - LocalDate today = LocalDate.now(); // 获取当前日期 - LocalDate tenDaysBefore = today.minusDays(day_); // 当前日期前10天 - startDay = tenDaysBefore.toString(); - }else{ - LocalDate today = LocalDate.now(); // 获取当前日期 - LocalDate tenDaysBefore = today.minusDays(30); // 当前日期前10天 - startDay = tenDaysBefore.toString(); - } - long employeeId = UserContext.getCurrentEmployeeId(); - - dataMap.put("day",day); - dataMap.put("employeeId",employeeId); - - String groupId = "weaver-portrait-service"; - String sourceType = "LOGIC"; - - String sql =" SELECT \n" + - " t1.id typeid,\n" + - " t1.name typename,\n" + - " t2.id riskid,\n" + - " t2.name riskname,\n" + - " t.risk_value,\n" + - " t.tenant_key,\n" + - " t.userid,\n" + - " e.username,\n" + - " times \n" + - " FROM ( \n" + - " SELECT k.riskid,k.risk_value,k.tenant_key,k.userid,COUNT(k.riskid) times \n" + - " FROM (\n" + - " SELECT t.riskid,t.risk_value,t.tenant_key,t.userid\n" + - " FROM pr_indrisk_data t \n" + - " WHERE t.delete_type = 0 \n" + - " AND t.tenant_key = '"+tenant_key+"'\n" + - " AND t.risk_date >= '"+startDay+"'\n" + - " AND t.userid = '"+employeeId+"'\n" + - " union all\n" + - " SELECT t.riskid,t.risk_value,t.tenant_key,t.userid \n" + - " FROM pr_indrisk_data t \n" + - " WHERE t.delete_type = 0 \n" + - " AND t.tenant_key = '"+tenant_key+"' \n" + - " AND t.risk_date >= '"+startDay+"' \n" + - " AND t.userid IN (select cid from eteams.emp_link where pid= '"+employeeId+"' and relation = 'senior') \n" + - " ) k \n" + - " GROUP BY k.riskid,\n" + - " k.risk_value,\n" + - " k.tenant_key,\n" + - " k.userid\n" + - " ) t,\n" + - " pr_indrisk_type t1,\n" + - " pr_indrisk_info t2 ,\n" + - " eteams.employee e\n" + - " WHERE t.riskid = t2.id \n" + - " AND t2.risk_type = t1.id \n" + - " AND t.userid = e.id\n" + - " AND e.STATUS != 'unavailable' AND e.PERMANENTLY_DELETE = '0'\n" + - " AND t1.delete_type = 0 \n" + - " AND t2.delete_type = 0" ; - - log.error("testSapi17:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - for(int i=0;i recordMap2 = recordList.get(i); - recordMap2.put("pid",i+""); - } - recordMap.put("datas",recordList); - } catch (Exception e) { - e.printStackTrace(); - log.error("testSapi17:"+e); - dataMap.put("count","-1"); - } - return WeaResult.success(recordMap); - } - - - - @GetMapping("/testSapi20") - @WeaPermission(publicPermission = true) - public WeaResult testSapi20(HttpServletRequest request){ - Map dataMap = new HashMap(); - dataMap.put("test","testSapi20"); - - try { - - String employeeId = request.getParameter("employeeId"); - LocalDate currentDate = LocalDate.now(); - LocalDate lastMonthDate = currentDate.minusMonths(1); - int lastMonth = lastMonthDate.getMonthValue(); - log.error("上个月的月份是20:" + lastMonth); - - SimpleEmployee employee = UserContext.getCurrentUser(); - - if(StringUtils.isBlank(employeeId)){ - employeeId = String.valueOf(UserContext.getCurrentEmployeeId()); - } - - String groupId = "weaver-ebuilder-form-service"; - String sourceType = "LOGIC"; - - Map scoreMap = getLastMonthKpi2(employeeId,groupId,sourceType); - - List> yearList = getWholeYearKpi2(employeeId,groupId,sourceType); - - dataMap.put("scoreMap",scoreMap); - dataMap.put("yearList",yearList); - - } catch (Exception e) { - e.printStackTrace(); - log.error("testSapi20:"+e); - dataMap.put("count","-1"); - } - return WeaResult.success(dataMap); - } - - - - public Map getLastMonthKpi2(String employeeId, String groupId, String sourceType){ - - log.error("getLastMonthKpi20"); - - Map dataMap = new HashMap(); - - List> indicatorList = new ArrayList>(); - - if(StringUtils.isNotBlank(employeeId)){ - - String sql =" select left(k.real_period,10) as real_period,left(k.real_period,7) as period_month,k.kpi_scheme,k.score\n" + - " from (select real_period,kpi_scheme,score\n" + - " from hr_kpi_flow \n" + - " where kpi_user='"+employeeId+"' \n" + - " and module = 'kpiFlow' \n" + - " and date_type = 'month' \n" + - " and delete_type = '0' " + - " and tenant_key='"+tenant_key+"'\n" + - " and FLOW_STATUS in('noApprove','approve','finished')\n" + - " order by real_period desc\n" + - ") k limit 1 "; - - log.error("sql20-1:"+sql); - - - - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - if(CollectionUtils.isNotEmpty(recordList)){ - Map recordMap = recordList.get(0); - if(!recordMap.isEmpty()){ - String score = String.valueOf(recordMap.get("score")); - String kpi_scheme = String.valueOf(recordMap.get("kpi_scheme")); - String real_period = String.valueOf(recordMap.get("real_period")); - String period_month = String.valueOf(recordMap.get("period_month")); - - dataMap.put("score",score); - dataMap.put("yearmonth",period_month); - dataMap.put("kpi_scheme",kpi_scheme); - dataMap.put("real_period",real_period); - } - } - } - -// LocalDate localDate = LocalDate.now(); -// int year = localDate.getYear() ; -// for(int i=0;i<=12;i++){ -// LocalDate previousMonth = localDate.minusMonths(i); -// String startDay = previousMonth.with(TemporalAdjusters.lastDayOfMonth()).toString(); -// String endDay = previousMonth.with(TemporalAdjusters.firstDayOfMonth()).toString(); -// log.error("startDay20:"+startDay); -// log.error("endDay20:"+endDay); -//// " select kpi_scheme,score " + -//// " from hr_kpi_flow " + -//// " where kpi_user='"+employeeId+"' " + -//// " and real_period >= '" +startDay+"'" + -//// " and real_period <='" + endDay +"'" + -//// " and module = 'kpiFlow'" + -//// " and date_type = 'month'" + -//// " and flow_status = 'finished'" + -//// " and delete_type = '0'" + -//// " and tenant_key='"+tenant_key+"' "; -// String yearMonth = ""; -// if(i<10){ -// yearMonth = year+"-0"+i ; -// }else{ -// yearMonth = year+"-"+i ; -// } -// } - - if(!dataMap.isEmpty()){ - String kpi_scheme = String.valueOf(dataMap.get("kpi_scheme")); - - log.error("kpi_scheme:"+kpi_scheme); - - if(StringUtils.isNotBlank(kpi_scheme)){ - String sql =" select indicator_type,indicator_description,weight \n" + - " from hr_kpi_scheme_indicator " + - " where scheme_id='"+kpi_scheme+"' " + - " and indicator_mode='quantify'\n" + - " and status='on' " + - " and delete_type = '0'" + - " and tenant_key = '"+tenant_key+"'" ; - - log.error("sql2:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - - log.error("recordList:"+recordList.size()); - - if(recordList.size()>=2){ - for(int i=0;i<2;i++){ - indicatorList.add(recordList.get(i)); - } - }else if(recordList.size() == 1){ - indicatorList.add(recordList.get(0)); - - Map indicatorMap = new HashMap(); - sql = " select name,data_row,property\n" + - " from hr_kpi_details_link\n" + - " where kpi_details in( " + - " select id\n" + - " from hr_kpi_details " + - " where KPI_SCHEME='"+kpi_scheme+"'\n" + - " and MODULE='kpiSchemeSetting'\n" + - " and TENANT_KEY='"+tenant_key+"'\n" + - " and DELETE_TYPE = 0" + - " )\n" + - " and module = 'kpiSchemeSetting'\n" + - " and tenant_key = '"+tenant_key+"'\n" + - " and delete_type = '0'\n" + - " and property in('weight', 'describe', 'type')\n" + - " and data_row in ( \n" + - " select p.data_row from (\n" + - " select w.data_row from (\n" + - " select data_row \n" + - " from hr_kpi_details_link\n" + - " where kpi_details in ( " + - " select id\n" + - " from hr_kpi_details " + - " where KPI_SCHEME='"+kpi_scheme+"'\n" + - " and MODULE='kpiSchemeSetting'\n" + - " and TENANT_KEY='"+tenant_key+"'\n" + - " and DELETE_TYPE = 0" + - " )\n" + - " and PROPERTY = 'weight'\n" + - " and MODULE = 'kpiSchemeSetting'\n" + - " and TENANT_KEY = '"+tenant_key+"'\n" + - " and DELETE_TYPE = '0'\n" + - " order by name desc\n" + - " ) w limit 1 \n" + - " ) p\n" + - " )"; - log.error("sql3:"+sql); - Map result2 = databaseUtils.execute(sourceType, groupId, sql); - List> recordList2 = databaseUtils.getDataSourceList(result2); - log.error("recordList2:"+recordList2.size()); - for(int i=0;i recordMap = recordList2.get(i); - String name = String.valueOf(recordMap.get("name")); - String property = String.valueOf(recordMap.get("property")); - - log.error("name:"+name); - log.error("property:"+property); - - if("weight".equalsIgnoreCase(property)){ - indicatorMap.put("weight",name); - } - if("describe".equalsIgnoreCase(property)){ - indicatorMap.put("indicator_description",name); - } - if("type".equalsIgnoreCase(property)){ - indicatorMap.put("indicator_type",name); - } - } - - if(!indicatorMap.isEmpty()){ - indicatorList.add(indicatorMap); - } - - }else{ - - sql = " select w.data_row from (\n" + - " select data_row\n" + - " from hr_kpi_details_link\n" + - " where kpi_details in( " + - " select id\n" + - " from hr_kpi_details " + - " where KPI_SCHEME='"+kpi_scheme+"'\n" + - " and MODULE='kpiSchemeSetting'\n" + - " and TENANT_KEY='"+tenant_key+"'\n" + - " and DELETE_TYPE = 0" + - " )\n" + - " and PROPERTY = 'weight'\n" + - " and MODULE = 'kpiSchemeSetting'\n" + - " and TENANT_KEY = '"+tenant_key+"'\n" + - " and DELETE_TYPE = '0'\n" + - " order by name desc\n" + - ") w limit 2" ; - log.error("sql4:"+sql); - Map result3 = databaseUtils.execute(sourceType, groupId, sql); - List> recordList3 = databaseUtils.getDataSourceList(result3); - for(int k=0;k recordMap3 = recordList3.get(k); - - String data_row = String.valueOf(recordMap3.get("data_row")); - - Map indicatorMap = new HashMap(); - - sql = " select name,data_row,property\n" + - " from hr_kpi_details_link\n" + - " where kpi_details in( " + - " select id\n" + - " from hr_kpi_details " + - " where KPI_SCHEME='"+kpi_scheme+"'\n" + - " and MODULE='kpiSchemeSetting'\n" + - " and TENANT_KEY='"+tenant_key+"'\n" + - " and DELETE_TYPE = 0" + - " )\n" + - " and MODULE = 'kpiSchemeSetting'\n" + - " and TENANT_KEY = '"+tenant_key+"'\n" + - " and DELETE_TYPE = '0'\n" + - " and property in('weight', 'describe', 'type')\n" + - " and data_row in("+data_row+")" ; - - log.error("sql5:"+sql); - - Map result2 = databaseUtils.execute(sourceType, groupId, sql); - List> recordList2 = databaseUtils.getDataSourceList(result2); - - for(int i=0;i recordMap = recordList2.get(i); - - String name = String.valueOf(recordMap.get("name")); - String property = String.valueOf(recordMap.get("property")); - if("weight".equalsIgnoreCase(property)){ - indicatorMap.put("weight",name); - } - if("describe".equalsIgnoreCase(property)){ - indicatorMap.put("indicator_description",name); - } - if("type".equalsIgnoreCase(property)){ - indicatorMap.put("indicator_type",name); - } - } - - indicatorList.add(indicatorMap); - } - } - } - dataMap.put("indicator",indicatorList); - } - return dataMap ; - } - - - - public List> getWholeYearKpi2(String employeeId,String groupId,String sourceType){ - - List> dateList = new ArrayList>(); - - Map dataMap = null; - LocalDate localDate = LocalDate.now(); - int year = localDate.getYear() ; - int dayOfYear = 1 ; - String[] monthzw = new String[]{"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}; - - for(int i=1;i<=12;i++){ - Month month = Month.of(i); - LocalDate startDay = YearMonth.of(year, month).atDay(dayOfYear); // 计算当前月份的首日 - LocalDate endDay = YearMonth.of(year, month).atEndOfMonth(); // 计算当前月份的最后一天 - - log.error("getWholeYearKpi2-startDay:"+startDay); - log.error("getWholeYearKpi2-endDay:"+endDay); - - String yearMonth = ""; - if(monthzw.length==12){ - yearMonth = monthzw[i-1]; - } - - String sql =" select score from hr_kpi_flow " + - " where kpi_user='"+employeeId+"' " + - " and left(real_period,10) >= '" +startDay+"'" + - " and left(real_period,10) <='" + endDay +"'" + - " and module = 'kpiFlow'" + - " and date_type = 'month'" + - " and flow_status in('noApprove','approve','finished') \n" + - " and delete_type = '0'" + - " and tenant_key='"+tenant_key+"' " ; - - log.error("getWholeYearKpi2-sql:"+sql); - - dataMap = new HashMap(); - - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - if(CollectionUtils.isNotEmpty(recordList)){ - Map recordMap = recordList.get(0); - if(!recordMap.isEmpty()){ - String score = String.valueOf(recordMap.get("score")); - if(StringUtils.isNotBlank(score)){ - dataMap.put(yearMonth,score); - } - } - }else{ - dataMap.put(yearMonth,"0"); - } - - dateList.add(dataMap); - } - return dateList ; - } - - - public static String null2String(String s,String def) { - return s == null ?(def==null?"":def) : s; - } - - @GetMapping("/testSapi30") @WeaPermission(publicPermission = true) public WeaResult testSapi30(HttpServletRequest request){ @@ -1192,24 +276,105 @@ public class HrmSelfHelpController { " CONVERT(sum(cast(t1.htyxje as decimal(18,2))),CHAR) as htyxje," + " CONVERT(sum(cast(t1.sumsk as decimal(18,2))),CHAR) as sumsk " + " from uf_jxhs_xmys t1 \n" + - " where t1.ysrq>='" +startday+"' and t1.ysrq<='"+endday+"' " + - " and ( t1.qyjl = '"+employeeId+"' "+ - " or t1.qyjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= '"+employeeId+"')\n" + - " or t1.ysry = '"+employeeId+"'\n" + - " or t1.ysry in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= '"+employeeId+"')\n" + - " or t1.dqfzr = '"+employeeId+"'\n" + - " or t1.dqfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= '"+employeeId+"')\n" + - " or t1.tdjl = '"+employeeId+"'\n" + - " or t1.tdjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= '"+employeeId+"')\n" + - " or t1.tdfzr = '"+employeeId+"'\n" + - " or t1.tdfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= '"+employeeId+"')\n" + - " or t1.jgfzr = '"+employeeId+"'\n" + - " or t1.jgfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= '"+employeeId+"')\n" + - " or t1.dqzj = '"+employeeId+"'\n" + - " or t1.dqzj in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= '"+employeeId+"') " + + " where t1.ysrq>=? and t1.ysrq<= ? " + + " and ( t1.qyjl = ? "+ + " or t1.qyjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" + + " or t1.ysry = ? \n" + + " or t1.ysry in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" + + " or t1.dqfzr = ? \n" + + " or t1.dqfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" + + " or t1.tdjl = ?\n" + + " or t1.tdjl in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" + + " or t1.tdfzr = ? \n" + + " or t1.tdfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" + + " or t1.jgfzr = ?\n" + + " or t1.jgfzr in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?)\n" + + " or t1.dqzj = ? \n" + + " or t1.dqzj in (select cid from eteams.EMP_LINK where RELATION in ('othersenior','senior') and pid= ?) " + " ) " ; - Map result = databaseUtils.execute(sourceType, groupId, sql); + List sqlparam = new ArrayList(); + SqlParamEntity sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(startday); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(endday); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + Map result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam); List> recordList = databaseUtils.getDataSourceList(result); dataMap.put("datas",recordList); @@ -1270,161 +435,103 @@ public class HrmSelfHelpController { " LEFT JOIN ebdf_physical_data epd on t1.id = epd.form_data_id and epd.delete_type = 0 \n" + " WHERE t1.skje != 0 \n" + " and t1.skje IS NOT NULL " + - " and t1.xshsny >= '" + startday+"' and t1.xshsny <='"+endday+"' "+ + " and t1.xshsny >= ? and t1.xshsny <= ? "+ " and (" + - " '"+employeeId+"' IN ( 2, 27, 166, 10285, 11661, 300, 876, 3593, 1416, 1647, 1844,3044480226941419013,794508876297846787 ) \n" + + " ? IN ( 2, 27, 166, 10285, 11661, 300, 876, 3593, 1416, 1647, 1844,3044480226941419013,794508876297846787 ) \n" + " or cast(t1.xsjl AS decimal(25,0)) in( \n" + - " SELECT cid AS id FROM eteams.emp_link WHERE pid = '"+employeeId+"' and RELATION in ('othersenior','senior') \n" + + " SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" + " UNION " + - " SELECT id FROM eteams.employee WHERE id = '"+employeeId+"' " + + " SELECT id FROM eteams.employee WHERE id = ? " + " )\n" + " or cast(t1.kfry AS decimal(25,0)) in(\n" + - " SELECT cid AS id FROM eteams.emp_link WHERE pid = '"+employeeId+"' and RELATION in ('othersenior','senior') \n" + + " SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" + " UNION " + - " SELECT id FROM eteams.employee WHERE id = '"+employeeId+"' " + + " SELECT id FROM eteams.employee WHERE id = ? " + " )\n" + " or cast(t1.qdjl AS decimal(25,0)) in(\n" + - " SELECT cid AS id FROM eteams.emp_link WHERE pid = '"+employeeId+"' and RELATION in ('othersenior','senior') \n" + + " SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" + " UNION " + - " SELECT id FROM eteams.employee WHERE id = '"+employeeId+"' " + + " SELECT id FROM eteams.employee WHERE id = ? " + " )\n" + " or cast(t1.xmjl AS decimal(25,0)) in(\n" + - " SELECT cid AS id FROM eteams.emp_link WHERE pid = '"+employeeId+"' and RELATION in ('othersenior','senior') \n" + + " SELECT cid AS id FROM eteams.emp_link WHERE pid = ? and RELATION in ('othersenior','senior') \n" + " UNION " + - " SELECT id FROM eteams.employee WHERE id = '"+employeeId+"' " + + " SELECT id FROM eteams.employee WHERE id = ? " + " )\n" + " )\n" + " order by t1.id " ; - log.error("sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - dataMap.put("datas",recordList); - } catch (Exception e) { - e.printStackTrace(); - log.error("testSapi30:"+e); - dataMap.put("count","-1"); - } - return WeaResult.success(dataMap); - } - - - /** - * 流程信息(我发起的) - * @param request - * @return - */ - @GetMapping("/getWorkFlowInfo") - @WeaPermission(publicPermission = true) - public WeaResult getWfInfoCreate(HttpServletRequest request){ - log.error("getWorkFlowInfo"); + List sqlparam = new ArrayList(); + SqlParamEntity sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(startday); + sqlparam.add(sqlParamEntity); - List requestListInfoPAEntityList = new ArrayList(); - try{ - RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity(); - SimpleEmployee employee = UserContext.getCurrentUser(); - String keyword = CommonUtils.null2String(request.getParameter("keyword")); - if(!"".equals(keyword)){ - conditionEntity.setRequestname(keyword); - } - String type = CommonUtils.null2String(request.getParameter("type"),"0"); - int pageSize = CommonUtils.getIntValue(request.getParameter("pageSize"),10); - int pageNo = CommonUtils.getIntValue(request.getParameter("pageNo"),1); - // 0 我发起的; 1 我的待办; 2 我的已办 - if("0".equals(type)){ - WeaResult> requestResult = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), pageNo, pageSize, conditionEntity); - int code = requestResult.getCode(); - if(code == 200){ - requestListInfoPAEntityList = requestResult.getData(); - } - }else if("1".equals(type)){ - WeaResult> requestResult = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.TODO_FLOWALL.getTabid(), pageNo, pageSize, conditionEntity); + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(endday); + sqlparam.add(sqlParamEntity); - int code = requestResult.getCode(); - if(code == 200){ - requestListInfoPAEntityList = requestResult.getData(); - } + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); - }else if("2".equals(type)){ - WeaResult> requestResult = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), pageNo, pageSize, conditionEntity); + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); - int code = requestResult.getCode(); - if(code == 200){ - requestListInfoPAEntityList = requestResult.getData(); - } - } - }catch (Exception e){ - log.error("getWorkFlowInfo-Exception:"+e.getMessage()); - return WeaResult.fail(500,"程序执行异常"); - } - return WeaResult.success(requestListInfoPAEntityList); - } + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); - @GetMapping("/getPortalWorkFlowInfo") - @WeaPermission(publicPermission = true) - public WeaResult getPortalWorkFlowInfo(HttpServletRequest request){ - log.error("getPortalWorkFlowInfo"); + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); - Map dataMap = new HashMap(); - try{ - RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity(); - SimpleEmployee employee = UserContext.getCurrentUser(); - String keyword = CommonUtils.null2String(request.getParameter("keyword")); - if(!"".equals(keyword)){ - conditionEntity.setRequestname(keyword); - } - int pageSize = CommonUtils.getIntValue(request.getParameter("pageSize"),10); - int pageNo = CommonUtils.getIntValue(request.getParameter("pageNo"),1); - // 0 我发起的; 1 我的待办; 2 我的已办 + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); - WeaResult> requestResult0 = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), pageNo, pageSize, conditionEntity); - int code0 = requestResult0.getCode(); - if(code0 == 200){ - List requestList0 = requestResult0.getData(); + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); - dataMap.put("PORTAL_MINE",requestList0); - } + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); - WeaResult> requestResult1 = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.TODO_FLOWALL.getTabid(), pageNo, pageSize, conditionEntity); - int code1 = requestResult1.getCode(); - if(code1 == 200){ - List requestList1 = requestResult1.getData(); - dataMap.put("TODO_FLOWALL",requestList1); - } + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + log.error("sql:"+sql); + Map result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam); + List> recordList = databaseUtils.getDataSourceList(result); + dataMap.put("datas",recordList); - WeaResult> requestResult2 = wflRequestListRest.getRequestListByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), pageNo, pageSize, conditionEntity); - int code2 = requestResult2.getCode(); - if(code2 == 200){ - List requestList2 = requestResult2.getData(); - dataMap.put("DONE_FLOWALL",requestList2); - } - }catch (Exception e){ - log.error("getWorkFlowInfo-Exception:"+e.getMessage()); - return WeaResult.fail(500,"程序执行异常"); + } catch (Exception e) { + e.printStackTrace(); + log.error("testSapi30:"+e); + dataMap.put("count","-1"); } return WeaResult.success(dataMap); } -// @GetMapping("/testSapi50") -// @WeaPermission(publicPermission = true) -// public WeaResult testSapi50(HttpServletRequest request){ -// log.error("getPortalWorkFlowInfo"); -// int blogcount = 0 ; -// try{ -// long employeeId = UserContext.getCurrentEmployeeId(); -// blogcount = remoteBlogInfoService.countByCreator(tenant_key,employeeId); -// }catch (Exception e){ -// log.error("getWorkFlowInfo-Exception:"+e.getMessage()); -// return WeaResult.fail(500,"程序执行异常"); -// } -// return WeaResult.success(blogcount); -// } - - /*** * 本年沟通协作数 * @param request @@ -1459,9 +566,9 @@ public class HrmSelfHelpController { employeeId = String.valueOf(UserContext.getCurrentEmployeeId()); } - String sql = " select count(1) as cou from cw_content " + - " where CREATOR= ? " + - " and left(CREATE_TIME,10)>=? and left(CREATE_TIME,10) <= ? " ; + String sql =" select count(1) as cou from cw_content " + + " where CREATOR= ? " + + " and left(CREATE_TIME,10)>=? and left(CREATE_TIME,10) <= ? " ; List sqlparam = new ArrayList(); SqlParamEntity sqlParamEntity = new SqlParamEntity(); @@ -1480,6 +587,7 @@ public class HrmSelfHelpController { sqlparam.add(sqlParamEntity); log.error("sql:"+sql); + Map result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam); List> recordList = databaseUtils.getDataSourceList(result); if(recordList.size()>0){ @@ -1499,105 +607,51 @@ public class HrmSelfHelpController { * @param request * @return */ - @GetMapping("/testSapi511") - @WeaPermission(publicPermission = true) - public WeaResult testSapi511(HttpServletRequest request){ - log.error("testSapi511"); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String groupId = "weaver-cowork-service"; - String sourceType = "LOGIC"; - - Map dataMap = new HashMap(); - try{ - String startday = request.getParameter("startday"); - String endday = request.getParameter("endday"); - String employeeId = request.getParameter("employeeId"); - - Calendar calendar = Calendar.getInstance(); - int year = calendar.get(Calendar.YEAR); - - if(StringUtils.isBlank(startday)){ - startday = year+"-01-01"; - } - if(StringUtils.isBlank(endday)){ - endday = sdf.format(new Date()); - } - - if(StringUtils.isBlank(employeeId)){ - employeeId = String.valueOf(UserContext.getCurrentEmployeeId()); - } - - String sql =" select count(1) as cou from cw_content " + - " where CREATOR= " +SecurityUtil.ecodeForSql(employeeId)+ - " and left(CREATE_TIME,10)>="+SecurityUtil.ecodeForSql(startday)+" and left(CREATE_TIME,10) <= "+SecurityUtil.ecodeForSql(endday) ; - - log.error("sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - if(recordList.size()>0){ - dataMap = recordList.get(0); - } - }catch (Exception e){ - log.error("testSapi51-Exception:"+e.getMessage()); - return WeaResult.fail(500,"程序执行异常"); - } - return WeaResult.success(dataMap); - } - - /*** - * 本年文档贡献度 - * @param request - * @return - */ - @GetMapping("/testSapi52") - @WeaPermission(publicPermission = true) - public WeaResult testSapi52(HttpServletRequest request){ - log.error("getPortalWorkFlowInfo"); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String groupId = "weaver-doc-service"; - String sourceType = "LOGIC"; - - - Map dataMap = new HashMap(); - try{ - String startday = request.getParameter("startday"); - String endday = request.getParameter("endday"); - String employeeId = request.getParameter("employeeId"); - - Calendar calendar = Calendar.getInstance(); - int year = calendar.get(Calendar.YEAR); - - if(StringUtils.isBlank(startday)){ - startday = year+"-01-01"; - } - if(StringUtils.isBlank(endday)){ - endday = sdf.format(new Date()); - } - - if(StringUtils.isBlank(employeeId)){ - employeeId = String.valueOf(UserContext.getCurrentEmployeeId()); - } - - String sql = " select count(1) as cou from document " + - " where CREATOR='"+employeeId+"'\n" + - " and left(create_time,10)>='"+startday+"' and left(create_time,10) <= '"+endday+"'" ; - - log.error("sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - if(recordList.size()>0){ - dataMap = recordList.get(0); - } - - }catch (Exception e){ - log.error("testSapi51-Exception:"+e.getMessage()); - return WeaResult.fail(500,"程序执行异常"); - } - return WeaResult.success(dataMap); - } - +// @GetMapping("/testSapi511") +// @WeaPermission(publicPermission = true) +// public WeaResult testSapi511(HttpServletRequest request){ +// log.error("testSapi511"); +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// +// String groupId = "weaver-cowork-service"; +// String sourceType = "LOGIC"; +// +// Map dataMap = new HashMap(); +// try{ +// String startday = request.getParameter("startday"); +// String endday = request.getParameter("endday"); +// String employeeId = request.getParameter("employeeId"); +// +// Calendar calendar = Calendar.getInstance(); +// int year = calendar.get(Calendar.YEAR); +// +// if(StringUtils.isBlank(startday)){ +// startday = year+"-01-01"; +// } +// if(StringUtils.isBlank(endday)){ +// endday = sdf.format(new Date()); +// } +// +// if(StringUtils.isBlank(employeeId)){ +// employeeId = String.valueOf(UserContext.getCurrentEmployeeId()); +// } +// +// String sql =" select count(1) as cou from cw_content " + +// " where CREATOR= " +SecurityUtil.ecodeForSql(employeeId)+ +// " and left(CREATE_TIME,10)>="+SecurityUtil.ecodeForSql(startday)+" and left(CREATE_TIME,10) <= "+SecurityUtil.ecodeForSql(endday) ; +// +// log.error("sql:"+sql); +// Map result = databaseUtils.execute(sourceType, groupId, sql); +// List> recordList = databaseUtils.getDataSourceList(result); +// if(recordList.size()>0){ +// dataMap = recordList.get(0); +// } +// }catch (Exception e){ +// log.error("testSapi51-Exception:"+e.getMessage()); +// return WeaResult.fail(500,"程序执行异常"); +// } +// return WeaResult.success(dataMap); +// } /** * 本年处理流程数 @@ -1617,6 +671,9 @@ public class HrmSelfHelpController { try{ RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity(); SimpleEmployee employee = UserContext.getCurrentUser(); + log.error("employee--:"+employee.getEmployeeId()); + + LocalDateTime startDateTime = LocalDateTime.of(LocalDate.from(LocalDateTime.now().with(TemporalAdjusters.firstDayOfYear())), LocalTime.MIN); if(StringUtils.isNotBlank(startday)){ startDateTime = LocalDateTime.parse(startday, format); @@ -1628,12 +685,19 @@ public class HrmSelfHelpController { } conditionEntity.setCusOperateDateStart(startDateTime); conditionEntity.setCusOperateDateEnd(endDateTime); + log.error("conditionEntity--:"+conditionEntity.toString()); - WeaResult RequestCountInfoPAEntity = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity); - int code = RequestCountInfoPAEntity.getCode(); + WeaResult requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity); + log.error("requestCountInfo--:"+requestCountInfo.toString()); + int code = requestCountInfo.getCode(); + log.error("code--:"+code); if(code == 200){ - count = RequestCountInfoPAEntity.getData().getCount(); + RequestCountInfoPAEntity requestCountInfoPAEntity = requestCountInfo.getData(); + log.error("requestCountInfoPAEntity--:"+requestCountInfoPAEntity.toString()); + count = requestCountInfoPAEntity.getCount(); + log.error("count--:"+count); } + }catch (Exception e){ log.error("getWorkFlowInfo-Exception:"+e.getMessage()); return WeaResult.fail(500,"程序执行异常"); @@ -1641,68 +705,6 @@ public class HrmSelfHelpController { return WeaResult.success(count); } - - /*** - * 本年微博数量 - * @param request - * @return - */ - @GetMapping("/testSapi62") - @WeaPermission(publicPermission = true) - public WeaResult testSapi62(HttpServletRequest request){ - log.error("testSapi62"); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String groupId = "weaver-blog-service"; - String sourceType = "LOGIC"; - - - Map dataMap = new HashMap(); - try{ - String startday = request.getParameter("startday"); - String endday = request.getParameter("endday"); - String employeeId = request.getParameter("employeeId"); - - Calendar calendar = Calendar.getInstance(); - int year = calendar.get(Calendar.YEAR); - - if(StringUtils.isBlank(startday)){ - startday = year+"-01-01"; - } - if(StringUtils.isBlank(endday)){ - endday = sdf.format(new Date()); - } - - if(StringUtils.isBlank(employeeId)){ - employeeId = String.valueOf(UserContext.getCurrentEmployeeId()); - } - - String sql =" select count(1) as blogcount\n" + - " from blog " + - " where creator='"+employeeId+"'\n" + - " and left(BLOG_TIME,10) >='"+startday+"'\n" + - " and left(BLOG_TIME,10) <='"+endday+"'\n" + - " and type='blog'\n" + - " and TENANT_KEY = '"+tenant_key+"'\n" + - " and MODULE = 'blog'\n" + - " and DELETE_TYPE = 0\n" + - " and CONTENT is not null" ; - - log.error("sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - if(recordList.size()>0){ - dataMap = recordList.get(0); - } - - }catch (Exception e){ - log.error("testSapi51-Exception:"+e.getMessage()); - return WeaResult.fail(500,"程序执行异常"); - } - return WeaResult.success(dataMap); - } - - /*** * 本年开发人天 * @param request @@ -1746,9 +748,9 @@ public class HrmSelfHelpController { " from wfc_form_data l\n" + " inner join fto_62 d on d.id = l.dataid\n" + " inner join wfc_requestbase p on p.requestid = l.requestid\n" + - " where d.multiresource5='"+employeeId+"'\n" + - " and d.date2 >='" + startday+"'"+ - " and d.date2 <='" + endday+"'"+ + " where d.multiresource5= ? \n" + + " and d.date2 >= ? "+ + " and d.date2 <= ? "+ " and d.tenant_key='"+tenant_key+"'\n" + " and d.is_delete='0'\n" + " and l.tenant_key='"+tenant_key+"'\n" + @@ -1757,9 +759,25 @@ public class HrmSelfHelpController { " and p.delete_type=0\n" + " order by d.id desc " ; + List sqlparam = new ArrayList(); + SqlParamEntity sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(startday); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(endday); + sqlparam.add(sqlParamEntity); + log.info("dataSql:"+dataSql); - Map result = databaseUtils.execute(sourceType, groupId, dataSql); + Map result = databaseUtils.executeForQuery(sourceType, groupId, dataSql,sqlparam); List> recordList = databaseUtils.getDataSourceList(result); if(CollectionUtils.isNotEmpty(recordList)) { devcou = String.valueOf(recordList.get(0).get("devcou")); @@ -1818,9 +836,9 @@ public class HrmSelfHelpController { " from wfc_form_data l\n" + " inner join fto_83 d on d.id = l.dataid\n" + " inner join wfc_requestbase p on p.requestid = l.requestid\n" + - " where d.mutiresource='"+employeeId+"'\n" + - " and d.xsjfrq >='" + startday+"'"+ - " and d.xsjfrq <='" + endday+"'"+ + " where d.mutiresource= ?\n" + + " and d.xsjfrq >= ? "+ + " and d.xsjfrq <=? "+ " and d.tenant_key='"+tenant_key+"'\n" + " and d.is_delete='0'\n" + " and l.tenant_key='"+tenant_key+"'\n" + @@ -1829,10 +847,24 @@ public class HrmSelfHelpController { " and p.delete_type=0\n" + " order by d.id desc " ; - log.info("dataSql:"+dataSql); - List sqlparam = new ArrayList(); SqlParamEntity sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(employeeId); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(startday); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(endday); + sqlparam.add(sqlParamEntity); + + log.info("dataSql:"+dataSql); + Map result = databaseUtils.executeForQuery(sourceType, groupId, dataSql,sqlparam); List> recordList = databaseUtils.getDataSourceList(result); if(CollectionUtils.isNotEmpty(recordList)) { @@ -1848,18 +880,18 @@ public class HrmSelfHelpController { } - @GetMapping("/testSapi110") @WeaPermission(publicPermission = true) public WeaResult testSapi110(HttpServletRequest request){ - //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData Map dataMap = new HashMap(); dataMap.put("test","testSapi110"); try { SimpleEmployee employee = UserContext.getCurrentUser(); + log.error("employee:"+employee.getEmployeeId()); + RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity(); - WeaResult requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), conditionEntity); + WeaResult requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), conditionEntity); log.error("testSapi110:"+requestCountInfo.toString()); int code = requestCountInfo.getCode(); log.error("testSapi110:"+code); @@ -1875,138 +907,27 @@ public class HrmSelfHelpController { } - @GetMapping("/testSapi80") + @GetMapping("/testSapi112") @WeaPermission(publicPermission = true) - public WeaResult testSapi80(HttpServletRequest request){ - - // SecurityUtil.ecodeForSql(field_id); - log.error("testSapi80"); - - String groupId = "weaver-ebuilder-form-service"; - String sourceType = "LOGIC"; - - List> dataList = new ArrayList>(); - try{ - String sql = " select ry from uf_zzfwrkpz t where delete_type=0 and tenant_key = '"+tenant_key+"'"; - log.info("sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - if(recordList.size()>0){ - Map recordMap = recordList.get(0); - String ry = String.valueOf(recordMap.get("ry")); - if(StringUtils.isNotBlank(ry)){ - dataList = getSelfServiceTypeData(groupId,sourceType); - }else{ - dataList = getSelfServiceTypeData(groupId,sourceType); - } - } + public WeaResult testSapi112(HttpServletRequest request){ - }catch (Exception e){ - log.error("testSapi51-Exception:"+e.getMessage()); - return WeaResult.fail(500,"程序执行异常"); - } - return WeaResult.success(dataList); - } - - - - public List> getCustemSelfServiceType(String groupId,String sourceType){ - - - Map optionMap = getSelfServiceTypeName(groupId,sourceType); - - String sql = " select distinct taby as value_key from uf_zzfwrkp_mxb1 where delete_type=0 and tenant_key = '"+tenant_key+"'"; - log.info("sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - for(int i=0;i recordMap = recordList.get(i); - String taby = String.valueOf(recordMap.get("value_key")); - log.error("getCustemSelfServiceType-taby:"+taby); - List> customList = new ArrayList>(); - String tabyName = ""; - if(StringUtils.isNotBlank(taby)){ - tabyName = optionMap.get(taby); - customList = getCustomeSelfServiceData(groupId,sourceType,taby); - } - - log.error("getCustemSelfServiceType-tabyName:"+tabyName); - log.error("getCustemSelfServiceType-taby:"+taby); - recordMap.put("menu",customList); - recordMap.put("name",tabyName); - } - return recordList; - } - - - public Map getSelfServiceTypeName(String groupId,String sourceType){ - - Map optionMap = new HashMap(); - String field_id = "977306579913818114" ; - String sql = " select name,value_key from field_option where field_id='"+field_id+"' and delete_type=0 and tenant_key = '"+tenant_key+"'"; - log.info("sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - for(int i=0;i recordMap = recordList.get(i); - String value = String.valueOf(recordMap.get("value_key")); - String name = String.valueOf(recordMap.get("name")); - optionMap.put(value,name); - } - return optionMap; - } - - public List> getCustomeSelfServiceData(String groupId,String sourceType,String value){ - String sql =" select t.taby,t.fwtb,t.fwmc,t.fwdz\n" + - " from uf_zzfwcsh t \n" + - " where t.delete_type=0 \n" + - " and t.taby=" + value + - " and t.tenant_key = '"+tenant_key+"'"; - log.info("getSelfServiceData--sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - return recordList; + SimpleEmployee employee = UserContext.getCurrentUser(); + log.error("employee:"+employee.getEmployeeId()); + RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity(); + WeaResult requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.MINE_FLOWALL.getTabid(), conditionEntity); + log.error("testSapi110:"+requestCountInfo.toString()); + return requestCountInfo; } - public List> getSelfServiceTypeData(String groupId,String sourceType){ - - String field_id = "977306579913818114" ; - String sql = " select name,value_key from field_option where field_id='"+field_id+"' and delete_type=0 and tenant_key = '"+tenant_key+"'"; - log.info("sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - for(int i=0;i recordMap = recordList.get(i); - String value = String.valueOf(recordMap.get("value_key")); - List> recordList2 = new ArrayList>(); - if(StringUtils.isNotBlank(value)){ - recordList2 = getSelfServiceData(groupId,sourceType,value); - } - recordMap.put("menu",recordList2); - } - return recordList; - } + @GetMapping("/testSapi113") + @WeaPermission(publicPermission = true) + public WeaResult testSapi113(HttpServletRequest request){ - /*** - * - * @param groupId - * @param sourceType - * @param value - * @return - */ - public List> getSelfServiceData(String groupId,String sourceType,String value){ - String sql =" select t.taby,t.fwtb,t.fwmc,t.fwdz\n" + - " from uf_zzfwcsh t \n" + - " where t.delete_type=0 \n" + - " and t.taby=" + value + - " and t.tenant_key = '"+tenant_key+"'"; - log.info("getSelfServiceData--sql:"+sql); - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - return recordList; + SimpleEmployee employee = UserContext.getCurrentUser(); + log.error("employee:"+employee.getEmployeeId()); + RequestListConditionApiEntity conditionEntity = new RequestListConditionApiEntity(); + WeaResult requestCountInfo = wflRequestListRest.getRequestCountByTabId(employee, RequestListInitDimensionTabEnum.DONE_FLOWALL.getTabid(), conditionEntity); + log.error("testSapi110:"+requestCountInfo.toString()); + return requestCountInfo; } - - - - }