全所统计
This commit is contained in:
+38
-24
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.mail.commont.constant;
|
||||
import com.jero.meeting.service.IPayMeetingSituationService;
|
||||
import com.jero.member.service.IPayMemberProjectService;
|
||||
import com.jero.member.service.IPayMemberProjectSubitemService;
|
||||
@@ -22,6 +24,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
@@ -61,29 +64,34 @@ public class AllProjectStatisticsController {
|
||||
public Result<?> list(AllProjectStatisticsSearch allProjectStatisticsSearch,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
|
||||
if (allProjectStatisticsSearch.getYear() == null || allProjectStatisticsSearch.getYear().equals("")) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
String year = String.valueOf(calendar.get(Calendar.YEAR));
|
||||
allProjectStatisticsSearch.setYear(year);
|
||||
}
|
||||
Page<AllProjectStatistics> page = new Page<>(pageNo, pageSize);
|
||||
IPage<AllProjectStatistics> pageList = payWorkingGroupService.queryPageList3(page,allProjectStatisticsSearch);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
double sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null ? "0" : t.getAllMoney())).sum() : 0;
|
||||
double sum2 = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null ? "0" : t.getComeAllMoney())).sum() : 0;
|
||||
DecimalFormat df = new DecimalFormat("#.00");
|
||||
if (pageList.getRecords() != null) {
|
||||
for(AllProjectStatistics s: pageList.getRecords()){
|
||||
String key = String.valueOf(s.getChargeUse());
|
||||
String payment_charge_use = sysBaseAPI.translateDict("payment_charge_use", key);
|
||||
s.setChargeUse_text(payment_charge_use);
|
||||
LoginUser sysUser =(LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String roleCode = sysUser.getRoleCode();
|
||||
if(constant.SLD.equals(roleCode)||constant.ADMIN.equals(roleCode)) {
|
||||
if (allProjectStatisticsSearch.getYear() == null || allProjectStatisticsSearch.getYear().equals("")) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
String year = String.valueOf(calendar.get(Calendar.YEAR));
|
||||
allProjectStatisticsSearch.setYear(year);
|
||||
}
|
||||
Page<AllProjectStatistics> page = new Page<>(pageNo, pageSize);
|
||||
IPage<AllProjectStatistics> pageList = payWorkingGroupService.queryPageList3(page,allProjectStatisticsSearch);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
double sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null ? "0" : t.getAllMoney())).sum() : 0;
|
||||
double sum2 = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null ? "0" : t.getComeAllMoney())).sum() : 0;
|
||||
DecimalFormat df = new DecimalFormat("#.00");
|
||||
if (pageList.getRecords() != null) {
|
||||
for(AllProjectStatistics s: pageList.getRecords()){
|
||||
String key = String.valueOf(s.getChargeUse());
|
||||
String payment_charge_use = sysBaseAPI.translateDict("payment_charge_use", key);
|
||||
s.setChargeUse_text(payment_charge_use);
|
||||
}
|
||||
}
|
||||
hashMap.put("sumOfMoney", sum==0.0?sum:df.format(sum));
|
||||
hashMap.put("sumOfReallyMoney", sum2==0.0?sum2:df.format(sum2));
|
||||
hashMap.put("pageList",pageList);
|
||||
return Result.OK(hashMap);
|
||||
}else {
|
||||
return Result.OK("权限不足");
|
||||
}
|
||||
hashMap.put("sumOfMoney", sum==0.0?sum:df.format(sum));
|
||||
hashMap.put("sumOfReallyMoney", sum2==0.0?sum2:df.format(sum2));
|
||||
hashMap.put("pageList",pageList);
|
||||
return Result.OK(hashMap);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,11 +101,17 @@ public class AllProjectStatisticsController {
|
||||
@GetMapping(value = "/statistics/excel")
|
||||
@ApiOperation(value = "所领导统计-导出统计", notes = "所领导统计-导出统计")
|
||||
public ModelAndView excel() {
|
||||
AllProjectStatisticsSearch allProjectStatisticsSearch=new AllProjectStatisticsSearch();
|
||||
AllProjectStatisticsSearch allProjectStatisticsSearch = new AllProjectStatisticsSearch();
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// String year = String.valueOf(calendar.get(Calendar.YEAR));
|
||||
// allProjectStatisticsSearch.setYear(year);
|
||||
List<AllProjectStatistics> pageList = payWorkingGroupService.queryPageListExcel(allProjectStatisticsSearch);
|
||||
return AmountUtil.exportListXls(pageList, AllProjectStatistics.class, "所领导统计");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String roleCode = sysUser.getRoleCode();
|
||||
if(constant.SLD.equals(roleCode)||constant.ADMIN.equals(roleCode)) {
|
||||
List<AllProjectStatistics> pageList = payWorkingGroupService.queryPageListExcel(allProjectStatisticsSearch);
|
||||
return AmountUtil.exportListXls(pageList, AllProjectStatistics.class, "所领导统计");
|
||||
}else {
|
||||
return new ModelAndView();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user