|
|
@ -2,6 +2,7 @@ package com.epmet.service.issue.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.dao.issue.IssueDao; |
|
|
|
import com.epmet.dto.form.LoginUserDetailsFormDTO; |
|
|
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|
|
@ -17,6 +18,7 @@ import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.text.DecimalFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -35,15 +37,29 @@ public class IssueServiceImpl implements IssueService { |
|
|
|
IssueSummaryInfoResultDTO result = new IssueSummaryInfoResultDTO(); |
|
|
|
String agencyId = getAgencyId(tokenDto); |
|
|
|
IssueDataDTO data = issueDao.selectAgencyInfo(agencyId); |
|
|
|
result.setAgencyId(agencyId); |
|
|
|
result.setDateName(data.getDateName()); |
|
|
|
result.setIssueTotal(data.getIssueTotal()); |
|
|
|
result.setVotingTotal(data.getVotingTotal()); |
|
|
|
result.setShiftProjectTotal(data.getShiftProjectTotal()); |
|
|
|
result.setClosedTotal(data.getClosedTotal()); |
|
|
|
result.setVotingRatio(toRatio(data.getVotingPercent())); |
|
|
|
result.setShiftProjectRatio(toRatio(data.getShiftProjectPercent())); |
|
|
|
result.setClosedRatio(toRatio(data.getClosedPercent())); |
|
|
|
if (null == data) { |
|
|
|
//获取当前日期前一天
|
|
|
|
Date date = DateUtils.getBeforeDay(new Date()); |
|
|
|
result.setAgencyId(agencyId); |
|
|
|
result.setDateName(DateUtils.format(date, "yyyy.MM.dd")); |
|
|
|
result.setIssueTotal(NumConstant.ZERO); |
|
|
|
result.setVotingTotal(NumConstant.ZERO); |
|
|
|
result.setShiftProjectTotal(NumConstant.ZERO); |
|
|
|
result.setClosedTotal(NumConstant.ZERO); |
|
|
|
result.setVotingRatio("0%"); |
|
|
|
result.setShiftProjectRatio("0%"); |
|
|
|
result.setClosedRatio("0%"); |
|
|
|
} else { |
|
|
|
result.setAgencyId(agencyId); |
|
|
|
result.setDateName(data.getDateName()); |
|
|
|
result.setIssueTotal(data.getIssueTotal()); |
|
|
|
result.setVotingTotal(data.getVotingTotal()); |
|
|
|
result.setShiftProjectTotal(data.getShiftProjectTotal()); |
|
|
|
result.setClosedTotal(data.getClosedTotal()); |
|
|
|
result.setVotingRatio(toRatio(data.getVotingPercent())); |
|
|
|
result.setShiftProjectRatio(toRatio(data.getShiftProjectPercent())); |
|
|
|
result.setClosedRatio(toRatio(data.getClosedPercent())); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
@ -52,21 +68,39 @@ public class IssueServiceImpl implements IssueService { |
|
|
|
List<IssueSummaryPieResultDTO> list = new ArrayList<>(); |
|
|
|
String agencyId = getAgencyId(tokenDto); |
|
|
|
IssueDataDTO data = issueDao.selectAgencyInfo(agencyId); |
|
|
|
IssueSummaryPieResultDTO voting = new IssueSummaryPieResultDTO(); |
|
|
|
voting.setName(IssueConstant.VOTING_NAME); |
|
|
|
voting.setValue(data.getVotingTotal()); |
|
|
|
voting.setRatio(toRatio(data.getVotingPercent())); |
|
|
|
list.add(voting); |
|
|
|
IssueSummaryPieResultDTO shift = new IssueSummaryPieResultDTO(); |
|
|
|
shift.setName(IssueConstant.SHIFT_NAME); |
|
|
|
shift.setValue(data.getShiftProjectTotal()); |
|
|
|
shift.setRatio(toRatio(data.getShiftProjectPercent())); |
|
|
|
list.add(shift); |
|
|
|
IssueSummaryPieResultDTO closed = new IssueSummaryPieResultDTO(); |
|
|
|
closed.setName(IssueConstant.CLOSED_NAME); |
|
|
|
closed.setValue(data.getClosedTotal()); |
|
|
|
closed.setRatio(toRatio(data.getClosedPercent())); |
|
|
|
list.add(closed); |
|
|
|
if (null == data) { |
|
|
|
IssueSummaryPieResultDTO voting = new IssueSummaryPieResultDTO(); |
|
|
|
voting.setName(IssueConstant.VOTING_NAME); |
|
|
|
voting.setValue(NumConstant.ZERO); |
|
|
|
voting.setRatio("0%"); |
|
|
|
list.add(voting); |
|
|
|
IssueSummaryPieResultDTO shift = new IssueSummaryPieResultDTO(); |
|
|
|
shift.setName(IssueConstant.SHIFT_NAME); |
|
|
|
shift.setValue(NumConstant.ZERO); |
|
|
|
shift.setRatio("0%"); |
|
|
|
list.add(shift); |
|
|
|
IssueSummaryPieResultDTO closed = new IssueSummaryPieResultDTO(); |
|
|
|
closed.setName(IssueConstant.CLOSED_NAME); |
|
|
|
closed.setValue(NumConstant.ZERO); |
|
|
|
closed.setRatio("0%"); |
|
|
|
list.add(closed); |
|
|
|
} else { |
|
|
|
IssueSummaryPieResultDTO voting = new IssueSummaryPieResultDTO(); |
|
|
|
voting.setName(IssueConstant.VOTING_NAME); |
|
|
|
voting.setValue(data.getVotingTotal()); |
|
|
|
voting.setRatio(toRatio(data.getVotingPercent())); |
|
|
|
list.add(voting); |
|
|
|
IssueSummaryPieResultDTO shift = new IssueSummaryPieResultDTO(); |
|
|
|
shift.setName(IssueConstant.SHIFT_NAME); |
|
|
|
shift.setValue(data.getShiftProjectTotal()); |
|
|
|
shift.setRatio(toRatio(data.getShiftProjectPercent())); |
|
|
|
list.add(shift); |
|
|
|
IssueSummaryPieResultDTO closed = new IssueSummaryPieResultDTO(); |
|
|
|
closed.setName(IssueConstant.CLOSED_NAME); |
|
|
|
closed.setValue(data.getClosedTotal()); |
|
|
|
closed.setRatio(toRatio(data.getClosedPercent())); |
|
|
|
list.add(closed); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|