add 统计报表-科室总体统计
This commit is contained in:
+5
-1
@@ -329,7 +329,11 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @param departId 部门id
|
||||
* @return JSONObject
|
||||
*/
|
||||
List<String> getAllDepartIds(String departId ,List<String> idList);
|
||||
List<String> getAllUserIdsByDepart(String departId , List<String> idList);
|
||||
|
||||
//获取本部门下全部子部门的id(包含本部门)
|
||||
List<String> getAllDepartIdsByDepart(String departId, List<String> idList);
|
||||
|
||||
/**
|
||||
* 发送短信验证码
|
||||
*/
|
||||
|
||||
+3
@@ -212,4 +212,7 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
|
||||
|
||||
AllMoney queryPageListForPrincipalDetail33(@Param("principalPeopleDetailSearch") PrincipalPeopleDetailSearch principalPeopleDetailSearch);
|
||||
|
||||
IPage<DepartStatistics> queryPageListDepartment(Page<DepartStatistics> page, @Param("departStatisticsSearch") DepartStatisticsSearch departStatisticsSearch, @Param("idList") List<String> idList);
|
||||
|
||||
AllMoney queryPageListDepartment33(@Param("departStatisticsSearch") DepartStatisticsSearch departStatisticsSearch, @Param("idList") List<String> idList);
|
||||
}
|
||||
|
||||
+79
@@ -2052,5 +2052,84 @@
|
||||
) pp
|
||||
</select>
|
||||
|
||||
<select id="queryPageListDepartment" resultType="com.jero.statistics.entity.DepartStatistics">
|
||||
select
|
||||
allMoney,
|
||||
comeAllMoney,
|
||||
departName,
|
||||
billMoney,
|
||||
CONCAT(CAST(ROUND((comeAllMoney / allMoney) * 100, 2) AS CHAR), '%') AS finishRate,
|
||||
confirmAmount
|
||||
from
|
||||
(select
|
||||
sum(allMoney) as allMoney,
|
||||
sum(comeAllMoney) as comeAllMoney,
|
||||
depart as departName,
|
||||
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney,
|
||||
sum(confirmAmount) as confirmAmount
|
||||
from v_statistical v
|
||||
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id
|
||||
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
|
||||
<where>
|
||||
<foreach item="item" open="departId in(" separator="," close=")" collection="idList">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="departStatisticsSearch.year != null and departStatisticsSearch.year != ''">
|
||||
AND year LIKE
|
||||
concat(#{departStatisticsSearch.year}, '%')
|
||||
</if>
|
||||
<if test="departStatisticsSearch.billYear != null and departStatisticsSearch.billYear != ''">
|
||||
and DATE_FORMAT (pmb.bill_date,'%Y') like concat(#{departStatisticsSearch.billYear}, '%')
|
||||
</if>
|
||||
</where>
|
||||
group by v.departId) p
|
||||
<if test="departStatisticsSearch.column != null and departStatisticsSearch.column != ''">
|
||||
<if test="departStatisticsSearch.column == 'allMoney' and departStatisticsSearch.order == 'desc'">
|
||||
order by allMoney desc
|
||||
</if>
|
||||
<if test="departStatisticsSearch.column == 'comeAllMoney' and departStatisticsSearch.order == 'desc'">
|
||||
order by comeAllMoney desc
|
||||
</if>
|
||||
<if test="departStatisticsSearch.column == 'billMoney' and departStatisticsSearch.order == 'desc'">
|
||||
order by billMoney desc
|
||||
</if>
|
||||
<if test="departStatisticsSearch.column == 'confirmAmount' and departStatisticsSearch.order == 'desc'">
|
||||
order by confirmAmount desc
|
||||
</if>
|
||||
<if test="departStatisticsSearch.column == 'confirmAmount' and departStatisticsSearch.order == 'asc'">
|
||||
order by confirmAmount
|
||||
</if>
|
||||
<if test="departStatisticsSearch.column == 'allMoney' and departStatisticsSearch.order == 'asc'">
|
||||
order by allMoney
|
||||
</if>
|
||||
<if test="departStatisticsSearch.column == 'comeAllMoney' and departStatisticsSearch.order == 'asc'">
|
||||
order by comeAllMoney
|
||||
</if>
|
||||
<if test="departStatisticsSearch.column == 'billMoney' and departStatisticsSearch.order == 'asc'">
|
||||
order by billMoney
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryPageListDepartment33" resultType="com.jero.statistics.entity.AllMoney">
|
||||
select sum(allMoney) as allMoney,
|
||||
sum(comeAllMoney) as comeAllMoney,
|
||||
if(sum(pmb.invoice_amount) is null, 0.00, sum(pmb.invoice_amount)) as billMoney,
|
||||
sum(confirmAmount) as confirmAmount
|
||||
from v_statistical v
|
||||
left join pay_mail_bill_project pmbp on v.projectId = pmbp.project_id
|
||||
left join pay_mail_bill pmb on pmbp.bill_id = pmb.id
|
||||
<where>
|
||||
<foreach item="item" open="departId in(" separator="," close=")" collection="idList">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="departStatisticsSearch.year != null and departStatisticsSearch.year != ''">
|
||||
AND year LIKE
|
||||
concat(#{departStatisticsSearch.year}, '%')
|
||||
</if>
|
||||
<if test="departStatisticsSearch.billYear != null and departStatisticsSearch.billYear != ''">
|
||||
and DATE_FORMAT (pmb.bill_date,'%Y') like concat(#{departStatisticsSearch.billYear}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
+3
@@ -233,4 +233,7 @@ public interface IPayWorkingGroupService extends IService<PayWorkingGroup> {
|
||||
|
||||
AllMoney queryPageListForPrincipalDetail33(PrincipalPeopleDetailSearch principalPeopleDetailSearch);
|
||||
|
||||
IPage<DepartStatistics> queryPageListDepartment(Page<DepartStatistics> page, DepartStatisticsSearch allProjectStatisticsSearch, List<String> idList);
|
||||
|
||||
AllMoney queryPageListDepartment33(DepartStatisticsSearch departStatisticsSearch, List<String> idList);
|
||||
}
|
||||
|
||||
+10
@@ -595,6 +595,16 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl<PayWorkingGroupMappe
|
||||
return payWorkingGroupMapper.queryPageListForPrincipalDetail33(principalPeopleDetailSearch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DepartStatistics> queryPageListDepartment(Page<DepartStatistics> page, DepartStatisticsSearch departStatisticsSearch, List<String> idList) {
|
||||
return payWorkingGroupMapper.queryPageListDepartment(page, departStatisticsSearch, idList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AllMoney queryPageListDepartment33(DepartStatisticsSearch departStatisticsSearch, List<String> idList) {
|
||||
return payWorkingGroupMapper.queryPageListDepartment33(departStatisticsSearch, idList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description 校验是存在关联合同的项目
|
||||
|
||||
+58
-5
@@ -15,9 +15,7 @@ import com.jero.modules.system.mapper.SysUserMapper;
|
||||
import com.jero.modules.system.service.ISysDepartService;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import com.jero.project.service.IPayWorkingGroupService;
|
||||
import com.jero.statistics.entity.AllMoney;
|
||||
import com.jero.statistics.entity.AllProjectStatistics;
|
||||
import com.jero.statistics.entity.AllProjectStatisticsSearch;
|
||||
import com.jero.statistics.entity.*;
|
||||
import com.jero.util.AmountUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -131,7 +129,7 @@ public class AllProjectStatisticsController {
|
||||
//部门负责人
|
||||
} else if (roleCodes.contains(constant.BMFZR) || roleCodes.contains(constant.SLD)) {
|
||||
//获取本部门及其所有下部部门所有成员(不包含最开始的部门下级成员)
|
||||
List<String> allDepartIds = sysBaseAPI.getAllDepartIds(sysUser.getDepartIds(), idList);
|
||||
List<String> allDepartIds = sysBaseAPI.getAllUserIdsByDepart(sysUser.getDepartIds(), idList);
|
||||
//获取本部门成员
|
||||
idList.addAll((userMapper.selectList(new QueryWrapper<SysUser>().eq("status", 1).eq("del_flag", 0).eq("org_code", sysUser.getOrgCode()))).stream().map(SysUser::getId).collect(Collectors.toList()));
|
||||
|
||||
@@ -260,7 +258,7 @@ public class AllProjectStatisticsController {
|
||||
//部门负责人
|
||||
} else if (roleCodes.contains(constant.BMFZR) || roleCodes.contains(constant.SLD)) {
|
||||
//获取本部门及其所有下部部门所有成员(不包含最开始的部门下级成员)
|
||||
List<String> allDepartIds = sysBaseAPI.getAllDepartIds(sysUser.getDepartIds(), idList);
|
||||
List<String> allDepartIds = sysBaseAPI.getAllUserIdsByDepart(sysUser.getDepartIds(), idList);
|
||||
//获取本部门成员
|
||||
idList.addAll((userMapper.selectList(new QueryWrapper<SysUser>().eq("status", 1).eq("del_flag", 0).eq("org_code", sysUser.getOrgCode()))).stream().map(SysUser::getId).collect(Collectors.toList()));
|
||||
|
||||
@@ -299,4 +297,59 @@ public class AllProjectStatisticsController {
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室统计——分页列表查询
|
||||
*
|
||||
* @param departStatisticsSearch 企业项目统计
|
||||
* @param pageNo 页数
|
||||
* @param pageSize 条数
|
||||
*/
|
||||
//@RequiresPermissions("projectPaymentStatistics:search")
|
||||
@ApiOperation(value = "科室统计-分页列表查询", notes = "科室统计-详情分页列表查询")
|
||||
@GetMapping(value = "/listDepartment")
|
||||
public Result<?> listDepartment(DepartStatisticsSearch departStatisticsSearch,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
//根据不同角色加载不同列表的参数
|
||||
List<String> idList = new ArrayList<>();
|
||||
//判断登录角色,显示特定内容,判断依据为登录用户的角色和机构编码
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String roleCode = sysUser.getRoleCode();
|
||||
List<String> roleCodes = new ArrayList<>(Arrays.asList(roleCode.split(",")));
|
||||
|
||||
//admin
|
||||
if (roleCodes.contains(constant.ADMIN)) {
|
||||
|
||||
} else if (roleCodes.contains(constant.BMFZR) || roleCodes.contains(constant.SLD)) {
|
||||
//获取本部门下全部子部门的id(包含本部门)
|
||||
List<String> allDepartIds = sysBaseAPI.getAllDepartIdsByDepart(sysUser.getDepartIds(), idList);
|
||||
|
||||
idList.addAll(allDepartIds);
|
||||
} else {
|
||||
return Result.OK();
|
||||
}
|
||||
Page<DepartStatistics> page = new Page<>(pageNo, pageSize);
|
||||
IPage<DepartStatistics> pageList = payWorkingGroupService.queryPageListDepartment(page, departStatisticsSearch, idList);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
//处理为空数据为0
|
||||
for (DepartStatistics s : pageList.getRecords()) {
|
||||
if (s.getAllMoney() == null || s.getAllMoney().equals("")) {
|
||||
s.setAllMoney("0.00");
|
||||
}
|
||||
if (s.getComeAllMoney() == null || s.getComeAllMoney().equals("")) {
|
||||
s.setComeAllMoney("0.00");
|
||||
}
|
||||
|
||||
}
|
||||
AllMoney allMoney = payWorkingGroupService.queryPageListDepartment33(departStatisticsSearch, idList);
|
||||
|
||||
hashMap.put("sumOfMoney", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getAllMoney());
|
||||
hashMap.put("sumOfReallyMoney", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getComeAllMoney());
|
||||
hashMap.put("sumOfBillMoney", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getBillMoney());
|
||||
hashMap.put("sumOfConfirmAmount", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getConfirmAmount());
|
||||
hashMap.put("pageList", pageList);
|
||||
return Result.OK(hashMap);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-13
@@ -1,25 +1,15 @@
|
||||
package com.jero.statistics.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.aspect.annotation.DictPoint;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.service.ProjectDetailService;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.system.vo.SysDepartTreeModel;
|
||||
import com.jero.common.vo.ProjectDetailVO;
|
||||
import com.jero.mail.commont.constant;
|
||||
import com.jero.mail.entity.PayMailBillProject;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.mapper.SysUserMapper;
|
||||
import com.jero.project.entity.PayWorkGroupSubletStatistics;
|
||||
import com.jero.project.entity.PayWorkingGroupStatistics;
|
||||
import com.jero.project.service.IPayWorkingGroupService;
|
||||
import com.jero.statistics.entity.*;
|
||||
import com.jero.util.AmountUtil;
|
||||
@@ -30,7 +20,6 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@@ -81,7 +70,7 @@ public class PrincipalPeopleStatisticsController {
|
||||
//部门负责人
|
||||
} else if (roleCodes.contains(constant.BMFZR) || roleCodes.contains(constant.SLD)) {
|
||||
//获取本部门及其所有下部部门所有成员(不包含最开始的部门下级成员)
|
||||
List<String> allDepartIds = sysBaseAPI.getAllDepartIds(sysUser.getDepartIds(), idList);
|
||||
List<String> allDepartIds = sysBaseAPI.getAllUserIdsByDepart(sysUser.getDepartIds(), idList);
|
||||
//获取本部门成员
|
||||
idList.addAll((userMapper.selectList(new QueryWrapper<SysUser>().eq("status", 1).eq("del_flag", 0).eq("org_code", sysUser.getOrgCode()))).stream().map(SysUser::getId).collect(Collectors.toList()));
|
||||
|
||||
@@ -186,7 +175,7 @@ public class PrincipalPeopleStatisticsController {
|
||||
//部门负责人
|
||||
} else if (roleCodes.contains(constant.BMFZR) || roleCodes.contains(constant.SLD)) {
|
||||
//获取本部门及其所有下部部门所有成员(不包含最开始的部门下级成员)
|
||||
List<String> allDepartIds = sysBaseAPI.getAllDepartIds(sysUser.getDepartIds(), idList);
|
||||
List<String> allDepartIds = sysBaseAPI.getAllUserIdsByDepart(sysUser.getDepartIds(), idList);
|
||||
//获取本部门成员
|
||||
idList.addAll((userMapper.selectList(new QueryWrapper<SysUser>().eq("status", 1).eq("del_flag", 0).eq("org_code", sysUser.getOrgCode()))).stream().map(SysUser::getId).collect(Collectors.toList()));
|
||||
|
||||
|
||||
+10
-1
@@ -10,6 +10,9 @@ import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
*/
|
||||
@Data
|
||||
public class DepartStatistics {
|
||||
@Excel(name = "部门名称", width = 15)
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String departName;
|
||||
|
||||
@Excel(name = "应收总金额", width = 15)
|
||||
@ApiModelProperty(value = "应收总金额")
|
||||
@@ -19,9 +22,15 @@ public class DepartStatistics {
|
||||
@ApiModelProperty(value = "实收总金额")
|
||||
private String comeAllMoney;
|
||||
|
||||
@Excel(name = "到账率", width = 15)
|
||||
@ApiModelProperty(value = "到账率")
|
||||
private String finishRate;
|
||||
|
||||
@Excel(name = "开票金额", width = 15)
|
||||
@ApiModelProperty(value = "开票金额")
|
||||
private String billMoney;
|
||||
|
||||
private String departName;
|
||||
@Excel(name = "确认到账金额", width = 15)
|
||||
@ApiModelProperty(value = "确认到账金额")
|
||||
private String confirmAmount;
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.jero.statistics.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
|
||||
@Data
|
||||
public class DepartStatisticsSearch {
|
||||
@ApiModelProperty(value = "来款年份")
|
||||
private String year;
|
||||
|
||||
@ApiModelProperty(value = "开票年份")
|
||||
private String billYear;
|
||||
|
||||
@ApiModelProperty(value = "字段")
|
||||
private String column;
|
||||
|
||||
@ApiModelProperty(value = "排序规则")
|
||||
private String order;
|
||||
}
|
||||
+17
-3
@@ -40,7 +40,6 @@ import com.jero.modules.system.service.*;
|
||||
import com.jero.modules.system.util.SecurityUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
@@ -1072,13 +1071,28 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
|
||||
@Override
|
||||
//获取本部门下全部子部门的全部成员(不包含本部门)
|
||||
public List<String> getAllDepartIds(String departId,List<String> idList) {
|
||||
public List<String> getAllUserIdsByDepart(String departId, List<String> idList) {
|
||||
|
||||
List<SysDepartTreeModel> sysDepartTreeModels =listSonDepartsByDepId(departId);
|
||||
if(!(sysDepartTreeModels.size()==0)) {
|
||||
for (SysDepartTreeModel s : sysDepartTreeModels) {
|
||||
idList.addAll((userMapper.selectList(new QueryWrapper<SysUser>().eq("status", 1).eq("del_flag", 0).eq("org_code", s.getOrgCode()))).stream().map(SysUser::getId).collect(Collectors.toList()));
|
||||
getAllDepartIds(s.getId(),idList);
|
||||
getAllUserIdsByDepart(s.getId(),idList);
|
||||
}
|
||||
return idList;
|
||||
}
|
||||
return idList;
|
||||
}
|
||||
|
||||
@Override
|
||||
//获取本部门下全部子部门的id(包含本部门)
|
||||
public List<String> getAllDepartIdsByDepart(String departId, List<String> idList) {
|
||||
|
||||
List<SysDepartTreeModel> sysDepartTreeModels =listSonDepartsByDepId(departId);
|
||||
if(!(sysDepartTreeModels.size()==0)) {
|
||||
for (SysDepartTreeModel s : sysDepartTreeModels) {
|
||||
idList.add(s.getId());
|
||||
getAllUserIdsByDepart(s.getId(),idList);
|
||||
}
|
||||
return idList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user