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); }