统计bug

This commit is contained in:
zhangqinlin
2021-09-24 18:27:44 +08:00
parent 58632ddb3e
commit 1025935817
16 changed files with 689 additions and 256 deletions
@@ -91,6 +91,8 @@ public class PayWorkingGroupStatisticsController {
}else if( constant.QYRY.equals(roleCode)){
String userId = sysUser.getId();
idList.add(userId);
}else {
idList=null;
}
IPage<PayWorkingGroupStatistics> pageList = payWorkingGroupService.queryPageListForStatistics(page, payWorkingGroupSearch,idList);
List<PayWorkingGroupStatistics> records = pageList.getRecords();
@@ -109,8 +111,12 @@ public class PayWorkingGroupStatisticsController {
// }
// }
//计算应收和实收总金额
double sum = records.stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney()==null ? "0.00" : t.getAllMoney())).sum();
double sum2 = records.stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney()==null ? "0.00" : t.getComeAllMoney())).sum();
double sum=0;
double sum2 =0;
if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
sum = records.stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0.00" : t.getAllMoney())).sum();
sum2 = records.stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0.00" : t.getComeAllMoney())).sum();
}
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
DecimalFormat df = new DecimalFormat("#.00");
objectObjectHashMap.put("pageList",pageList.setRecords(records));
@@ -148,6 +154,8 @@ public class PayWorkingGroupStatisticsController {
}else if( constant.QYRY.equals(roleCode)){
String userId = sysUser.getId();
idList.add(userId);
}else {
idList=null;
}
List<PayWorkingGroupStatistics> pageList = payWorkingGroupService.queryPageListForStatisticsExcel(payWorkingGroupSearch,idList);
for (PayWorkingGroupStatistics payWorkingGroupStatistics:pageList){
@@ -182,8 +190,12 @@ public class PayWorkingGroupStatisticsController {
payWorkingGroupSubletSearch.setYear(year);
}
IPage<PayWorkGroupSubletStatistics> pageList = payWorkingGroupSubItemService.queryPageList2(page, payWorkingGroupSubletSearch,id);
double sum = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null ? "0" : t.getAllMoney())).sum();
double sum2 = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null ? "0" : t.getComeAllMoney())).sum();
double sum=0;
double sum2 =0;
if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
sum = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0" : t.getAllMoney())).sum();
sum2 = pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum();
}
HashMap<String, Object> hashMap = new HashMap<>();
DecimalFormat df = new DecimalFormat("#.00");
for(PayWorkGroupSubletStatistics s: pageList.getRecords()){
@@ -149,4 +149,13 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
* @return
*/
List<CompanyComeMoneyDetail> queryPageListForCompanyDetail(@Param("CompanyComeMoneyDetailSearch") CompanyComeMoneyDetailSearch companyComeMoneyDetailSearch);
List<PrincipalPeopleList> queryPageListForPrincipalFirstPage();
List<PayWorkingGroupStatistics> queryPageListForStatisticsFirstPage();
List<CompanyComeMoneyList> queryPageListForCompanyFirstPage();
List<DepartStatistics> queryPageListForDepartFirstPage();
}
@@ -173,4 +173,13 @@ public interface IPayWorkingGroupService extends IService<PayWorkingGroup> {
* @return
*/
List<CompanyComeMoneyList> queryPageListForCompanyExcel(CompanyComeMoneySearch companyComeMoneySearch, List<String> idList);
List<PrincipalPeopleList> queryPageListForPrincipalFirstPage();
List<PayWorkingGroupStatistics> queryPageListForStatisticsFirstPage();
List<CompanyComeMoneyList> queryPageListForCompanyFirstPage();
List<DepartStatistics> queryPageListForDepartFirstPage();
}
@@ -277,6 +277,26 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl<PayWorkingGroupMappe
return payWorkingGroupMapper.queryPageListForCompany(companyComeMoneySearch,idList);
}
@Override
public List<PrincipalPeopleList> queryPageListForPrincipalFirstPage() {
return payWorkingGroupMapper.queryPageListForPrincipalFirstPage();
}
@Override
public List<PayWorkingGroupStatistics> queryPageListForStatisticsFirstPage() {
return payWorkingGroupMapper.queryPageListForStatisticsFirstPage();
}
@Override
public List<CompanyComeMoneyList> queryPageListForCompanyFirstPage() {
return payWorkingGroupMapper.queryPageListForCompanyFirstPage();
}
@Override
public List<DepartStatistics> queryPageListForDepartFirstPage() {
return payWorkingGroupMapper.queryPageListForDepartFirstPage();
}
/**
* @Description 校验是存在关联合同的项目
* @Author lqt
@@ -66,7 +66,7 @@ public class AllProjectStatisticsController {
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
LoginUser sysUser =(LoginUser) SecurityUtils.getSubject().getPrincipal();
String roleCode = sysUser.getRoleCode();
if(constant.SLD.equals(roleCode)||constant.ADMIN.equals(roleCode)) {
// 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));
@@ -75,8 +75,12 @@ public class AllProjectStatisticsController {
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;
double sum=0;
double sum2 =0;
if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0" : t.getAllMoney())).sum() : 0;
sum2 = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum() : 0;
}
DecimalFormat df = new DecimalFormat("#.00");
if (pageList.getRecords() != null) {
for(AllProjectStatistics s: pageList.getRecords()){
@@ -89,9 +93,9 @@ public class AllProjectStatisticsController {
hashMap.put("sumOfReallyMoney", sum2==0.0?sum2:df.format(sum2));
hashMap.put("pageList",pageList);
return Result.OK(hashMap);
}else {
return Result.OK("权限不足");
}
// }else {
// return Result.OK("权限不足");
// }
}
/**
@@ -103,17 +107,17 @@ public class AllProjectStatisticsController {
public ModelAndView excel( AllProjectStatisticsSearch allProjectStatisticsSearch) {
LoginUser sysUser =(LoginUser) SecurityUtils.getSubject().getPrincipal();
String roleCode = sysUser.getRoleCode();
if(constant.SLD.equals(roleCode)||constant.ADMIN.equals(roleCode)) {
// 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);
}
List<AllProjectStatistics> pageList = payWorkingGroupService.queryPageListExcel(allProjectStatisticsSearch);
return AmountUtil.exportListXls(pageList, AllProjectStatistics.class, "所领导统计");
return AmountUtil.exportListXls(pageList, AllProjectStatistics.class, "统计");
}else {
return new ModelAndView();
}
// }else {
// return new ModelAndView();
// }
}
}
@@ -15,6 +15,7 @@ import com.jero.util.AmountUtil;
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.GetMapping;
@@ -82,12 +83,18 @@ public class CompanyComeMoneyStatisticsController {
}else if( constant.QYRY.equals(roleCode)){
String userId = sysUser.getId();
idList.add(userId);
}else {
idList=null;
}
Page<CompanyComeMoneyList> page = new Page<>(pageNo, pageSize);
IPage<CompanyComeMoneyList> pageList = payWorkingGroupService.queryPageListForCompany(page,companyComeMoneySearch,idList);
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;
double sum=0;
double sum2 =0;
if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0" : t.getAllMoney())).sum() : 0;
sum2 = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum() : 0;
}
DecimalFormat df = new DecimalFormat("#.00");
hashMap.put("sumOfMoney", sum==0.0?sum:df.format(sum));
hashMap.put("sumOfReallyMoney", sum2==0.0?sum2:df.format(sum2));
@@ -118,8 +125,12 @@ public class CompanyComeMoneyStatisticsController {
Page<CompanyComeMoneyDetail> page = new Page<>(pageNo, pageSize);
IPage<CompanyComeMoneyDetail> pageList = payWorkingGroupService.queryPageListForCompanyDetail(page, companyComeMoneyDetailSearch);
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;
double sum=0;
double sum2 =0;
if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0" : t.getAllMoney())).sum() : 0;
sum2 = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum() : 0;
}
DecimalFormat df = new DecimalFormat("#.00");
for(CompanyComeMoneyDetail s: pageList.getRecords()){
String key = String.valueOf(s.getChargeUse());
@@ -164,10 +175,12 @@ public class CompanyComeMoneyStatisticsController {
}else if( constant.QYRY.equals(roleCode)){
String userId = sysUser.getId();
idList.add(userId);
}else {
idList=null;
}
List<CompanyComeMoneyList> pageList = payWorkingGroupService.queryPageListForCompanyExcel(companyComeMoneySearch,idList);
return AmountUtil.exportListXls(pageList, PrincipalPeopleList.class, "企业来款统计");
return AmountUtil.exportListXls(pageList, CompanyComeMoneyList.class, "企业来款统计");
}
/**
@@ -184,7 +197,7 @@ public class CompanyComeMoneyStatisticsController {
}
List<CompanyComeMoneyDetail> pageList = payWorkingGroupService.queryPageListForCompanyDetailExcel(companyComeMoneyDetailSearch);
return AmountUtil.exportListXls(pageList, PrincipalPeopleDetail.class, "企业来款详情统计");
return AmountUtil.exportListXls(pageList, CompanyComeMoneyDetail.class, "企业来款详情统计");
}
}
@@ -0,0 +1,46 @@
package com.jero.statistics.controller;
import com.jero.common.api.vo.Result;
import com.jero.project.entity.PayWorkingGroupStatistics;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.statistics.entity.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* @author zql
* @date 2021/9/24 16:08
*/
@Api(tags="首页统计")
@RestController
@RequestMapping("/statistics/principalPeople")
@Slf4j
public class FirstPageStatisticsController {
@Autowired
private IPayWorkingGroupService payWorkingGroupService;
@GetMapping(value = "/firstPage")
@ApiOperation(value = "首页统计", notes = "首页统计")
public Result<?> getFirstPage() {
List<PrincipalPeopleList> pageList = payWorkingGroupService.queryPageListForPrincipalFirstPage();
List<PayWorkingGroupStatistics> pageList2 = payWorkingGroupService.queryPageListForStatisticsFirstPage();
List<CompanyComeMoneyList> pageList3 = payWorkingGroupService.queryPageListForCompanyFirstPage();
List<DepartStatistics> pageList4 = payWorkingGroupService.queryPageListForDepartFirstPage();
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("PrincipalPeople",pageList);
hashMap.put("PayWorkingGroup",pageList2);
hashMap.put("Company",pageList3);
hashMap.put("Depart",pageList4);
return Result.OK(hashMap);
}
}
@@ -16,6 +16,7 @@ import com.jero.util.AmountUtil;
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.*;
@@ -81,12 +82,20 @@ public class PrincipalPeopleStatisticsController {
}else if( constant.QYRY.equals(roleCode)){
String userId = sysUser.getId();
idList.add(userId);
}else {
idList=null;
}
Page<PrincipalPeopleList> page = new Page<>(pageNo, pageSize);
IPage<PrincipalPeopleList> pageList = payWorkingGroupService.queryPageListForPrincipal(page,principalPeopleSearch,idList);
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;
double sum=0;
double sum2 =0;
if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0" : t.getAllMoney())).sum() : 0;
sum2 = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum() : 0;
}
DecimalFormat df = new DecimalFormat("#.00");
hashMap.put("sumOfMoney", sum==0.0?sum:df.format(sum));
hashMap.put("sumOfReallyMoney", sum2==0.0?sum2:df.format(sum2));
@@ -117,8 +126,12 @@ public class PrincipalPeopleStatisticsController {
Page<PrincipalPeopleDetail> page = new Page<>(pageNo, pageSize);
IPage<PrincipalPeopleDetail> pageList = payWorkingGroupService.queryPageListForPrincipalDetail(page, principalPeopleDetailSearch);
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;
double sum=0;
double sum2 =0;
if(ObjectUtils.isNotEmpty(pageList.getRecords())) {
sum = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getAllMoney() == null || t.getAllMoney().equals("") ? "0" : t.getAllMoney())).sum() : 0;
sum2 = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum() : 0;
}
DecimalFormat df = new DecimalFormat("#.00");
for(PrincipalPeopleDetail s: pageList.getRecords()){
String key = String.valueOf(s.getChargeUse());
@@ -163,6 +176,8 @@ public class PrincipalPeopleStatisticsController {
}else if( constant.QYRY.equals(roleCode)){
String userId = sysUser.getId();
idList.add(userId);
}else {
idList=null;
}
List<PrincipalPeopleList> pageList = payWorkingGroupService.queryPageListForPrincipalExcel(principalPeopleSearch,idList);
@@ -182,7 +197,11 @@ public class PrincipalPeopleStatisticsController {
principalPeopleDetailSearch.setYear(year);
}
List<PrincipalPeopleDetail> pageList = payWorkingGroupService.queryPageListForPrincipalDetailExcel(principalPeopleDetailSearch);
for(PrincipalPeopleDetail s: pageList) {
String key = String.valueOf(s.getChargeUse());
String payment_charge_use = sysBaseAPI.translateDict("payment_charge_use", key);
s.setChargeUse_text(payment_charge_use);
}
return AmountUtil.exportListXls(pageList, PrincipalPeopleDetail.class, "个人来款详情");
}
@@ -12,7 +12,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@Data
public class CompanyComeMoneyDetail {
@ApiModelProperty(value = "项目id")
private String id;
private String projectId;
@Excel(name = "来款项目", width = 15)
@ApiModelProperty(value = "来款项目")
private String projectName;
@@ -15,7 +15,7 @@ import java.math.BigDecimal;
public class CompanyComeMoneyDetailSearch {
@ApiModelProperty(value = "来款企业id")
private String chargeCompanyTemporaryId;
private String chargeCompanyId;
@ApiModelProperty(value = "来款项目")
private String projectName;
@@ -12,11 +12,11 @@ import org.jeecgframework.poi.excel.annotation.Excel;
public class CompanyComeMoneyList {
@ApiModelProperty(value = "来款企业id")
private String chargeCompanyTemporaryId;
private String chargeCompanyId;
@Excel(name = "来款企业", width = 15)
@ApiModelProperty(value = "来款企业")
private String chargeCompanyTemporaryName;
private String chargeCompanyName;
@Excel(name = "应收总金额", width = 15)
@ApiModelProperty(value = "应收总金额")
@@ -16,7 +16,7 @@ public class CompanyComeMoneySearch {
@ApiModelProperty(value = "来款企业id")
private String chargeCompanyTemporaryId;
private String chargeCompanyId;
@ApiModelProperty(value = "来款年份")
private String year;
@@ -0,0 +1,23 @@
package com.jero.statistics.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @author zql
* @date 2021/9/24 17:32
*/
@Data
public class DepartStatistics {
@Excel(name = "应收总金额", width = 15)
@ApiModelProperty(value = "应收总金额")
private String allMoney;
@Excel(name = "实收总金额", width = 15)
@ApiModelProperty(value = "实收总金额")
private String comeAllMoney;
private String departName;
}
@@ -23,10 +23,9 @@ public class PrincipalPeopleDetail {
@Excel(name = "实收总金额", width = 15)
@ApiModelProperty(value = "实收总金额")
private String comeAllMoney;
@Excel(name = "来款用途", width = 15,dicCode = "charge_use")
@ApiModelProperty(value = "来款用途编码")
private String chargeUse;
@Excel(name = "来款用途", width = 15)
@ApiModelProperty(value = "来款用途")
private String chargeUse_text;
@@ -11,7 +11,6 @@ import java.math.BigDecimal;
@Data
public class PrincipalPeopleList {
@Excel(name = "项目负责人id", width = 15)
@ApiModelProperty(value = "项目负责人id")
private String principalId;