|
@ -126,15 +126,19 @@ public class StatisticsService extends BaseService {
|
|
* @param level 级别
|
|
* @param level 级别
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public String getSignRate(String endDate, String area, int level) throws Exception {
|
|
|
|
|
|
public JSONObject getSignRate(String endDate, String area, int level) throws Exception {
|
|
|
|
JSONObject json = new JSONObject();
|
|
long signAmount = getTotalAmount(endDate, area, level, SIGN);
|
|
long signAmount = getTotalAmount(endDate, area, level, SIGN);
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
|
|
DecimalFormat df = new DecimalFormat("0.0000");
|
|
DecimalFormat df = new DecimalFormat("0.0000");
|
|
|
|
|
|
if (peopleNum != null && peopleNum.getNum() > 0) {
|
|
if (peopleNum != null && peopleNum.getNum() > 0) {
|
|
return df.format((signAmount * 1.0000) / peopleNum.getNum() * 100);
|
|
|
|
|
|
json.put("rate",df.format((signAmount * 1.0000) / peopleNum.getNum() * 100));
|
|
|
|
json.put("sign",signAmount);
|
|
|
|
json.put("people", peopleNum.getNum());
|
|
|
|
return json;
|
|
} else {
|
|
} else {
|
|
throw new Exception("户籍人口为0");
|
|
|
|
|
|
throw new Exception("户籍任务人口数为0");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -146,13 +150,17 @@ public class StatisticsService extends BaseService {
|
|
* @param level 级别
|
|
* @param level 级别
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public String getSignTaskRate(String endDate, String area, int level) throws Exception {
|
|
|
|
|
|
public JSONObject getSignTaskRate(String endDate, String area, int level) throws Exception {
|
|
|
|
JSONObject json = new JSONObject();
|
|
long signAmount = getTotalAmount(endDate, area, level, SIGN);
|
|
long signAmount = getTotalAmount(endDate, area, level, SIGN);
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
|
|
PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
|
|
DecimalFormat df = new DecimalFormat("0.0000");
|
|
DecimalFormat df = new DecimalFormat("0.0000");
|
|
|
|
|
|
if (peopleNum != null && peopleNum.getTaskNum() > 0) {
|
|
if (peopleNum != null && peopleNum.getTaskNum() > 0) {
|
|
return df.format((signAmount * 1.0000) / peopleNum.getTaskNum() * 100);
|
|
|
|
|
|
json.put("rate",df.format((signAmount * 1.0000) / peopleNum.getTaskNum() * 100));
|
|
|
|
json.put("sign",signAmount);
|
|
|
|
json.put("people", peopleNum.getTaskNum());
|
|
|
|
return json;
|
|
} else {
|
|
} else {
|
|
throw new Exception("户籍人口任务数为0");
|
|
throw new Exception("户籍人口任务数为0");
|
|
}
|
|
}
|