From d28f91331096b1cb476508251589118fde0b4c15 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Fri, 13 Oct 2023 14:13:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=93=AD=E6=B2=A3=E7=A7=91=E6=8A=80=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=88=86=E6=9E=90=E9=97=A8=E6=88=B7=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20=E9=A5=BC=E5=9B=BE=20=E6=9F=B1=E7=8A=B6=E5=9B=BE=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=B0=81=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/StatisticsPortalServiceImpl.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/com/engine/matfron/service/impl/StatisticsPortalServiceImpl.java b/src/com/engine/matfron/service/impl/StatisticsPortalServiceImpl.java index f1ecea9..595199d 100644 --- a/src/com/engine/matfron/service/impl/StatisticsPortalServiceImpl.java +++ b/src/com/engine/matfron/service/impl/StatisticsPortalServiceImpl.java @@ -6,6 +6,7 @@ import com.engine.matfron.exception.CustomizeRunTimeException; import com.engine.matfron.service.StatisticsPortalService; import com.engine.matfron.util.CommonDateUtil; import com.engine.matfron.util.CommonUtils; +import com.weaver.general.BaseBean; import lombok.SneakyThrows; import org.apache.commons.lang.StringUtils; import weaver.conn.RecordSet; @@ -348,12 +349,11 @@ public class StatisticsPortalServiceImpl extends Service implements StatisticsPo int divisor = sum % 6; sum = sum + (6 - divisor) + 12; int ceil =(int) Math.ceil((double) sum / 3); - int roundedMax = CommonUtils.roundedMax(ceil, 6); return OptionVO.builder() .titleText("年龄与性别分析") - .yMin(-roundedMax) - .yMax(roundedMax) + .yMin(-sum) + .yMax(sum) .yInterval(ceil) .barSeriesData(barSeriesData) .barSeriesDataTwo(barSeriesDataTwo) @@ -396,6 +396,7 @@ public class StatisticsPortalServiceImpl extends Service implements StatisticsPo public Map getLeaveMonth(String departmentIds) { Map data = new HashMap<>(4); RecordSet rs = new RecordSet(); + BaseBean bb = new BaseBean(); String startMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateStartOfMonth(YearMonth.now())); String endMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateEndOfMonth(YearMonth.now())); LinkedList xData = new LinkedList<>(); @@ -411,12 +412,13 @@ public class StatisticsPortalServiceImpl extends Service implements StatisticsPo " where h.type_n = 5 and h.changedate >= ? and h.changedate <= ? group by s.departmentid ) a\n" + " on t.id = a.departmentid "); + sql.append(" where (t.canceled = 0 or t.canceled is null)"); + if(StringUtils.isNotEmpty(departmentIds)) { - sql.append(" where (t.canceled = 0 or t.canceled is null)"); sql.append(" and t.id in (").append(departmentIds).append(")"); - } + bb.writeLog("sql2023"+sql.toString()+"->"+startMonth+endMonth); rs.executeQuery(sql.toString(),startMonth,endMonth); int i = 0; @@ -550,10 +552,13 @@ public class StatisticsPortalServiceImpl extends Service implements StatisticsPo " left join (select s.departmentid,count(1) as sum from hrmstatushistory h left join hrmresource s on h.resourceid = s.id " + " where type_n = 5 and changedate >= ? and changedate <= ? group by s.departmentid ) a\n" + " on t.id = a.departmentid where t.id = ? and (t.canceled = 0 or t.canceled is null)"); + BaseBean bb = new BaseBean(); + bb.writeLog("calculateLeave "+sql); rs.executeQuery(sql,startMonth,endMonth,id); rs.next(); - int countBydeptId = countBydeptId(id, endMonth); - return countBydeptId == 0 ? 0 : ((Util.getIntValue(rs.getString("num")) * 100) / countBydeptId); + int num = Util.getIntValue(rs.getString("num")); + int countBydeptId = countBydeptId(id, endMonth) + num; + return countBydeptId == 0 ? 0 : ((num * 100) / countBydeptId); }