update 企业、工作组、个人 统计详情更换为视图

This commit is contained in:
lijiarao
2022-06-08 11:18:30 +08:00
parent 43478be444
commit 7b4d2d43cc
3 changed files with 140 additions and 1392 deletions
@@ -67,129 +67,108 @@
</select>
<!--工作组详情-->
<select id="queryPageList2" resultType="com.jero.project.entity.PayWorkGroupSubletStatistics">
select pwg1.principalId,pwg1.principalName,pwg1.chargeCompanyTemporaryName,pwg1.allMoney,pwg1.comeAllMoney,pwg1.chargeUse,if(pwg1.pack=0,'否','是') as packText,pwg1.pack,pwg1.id from (SELECT
pwgs.id,
pwg.principal_id_a as principalId,
pwg.principal_name_a as principalName,
pwgs.charge_company_temporary_name AS chargeCompanyTemporaryName,
pwgs.receivable_amount AS allMoney,
pwgs.paid_amount AS comeAllMoney,
pwgs.charge_use as chargeUse,
pwgs.pack,
pwgs.create_time
FROM pay_working_group_subitem pwgs
left join pay_working_group pwg on(pwgs.working_group_id=pwg.id)
SELECT
principalNameId as principalId,
principalName,
chargeCompanyTemporaryName,
allMoney,
comeAllMoney,
chargeUse,
packText,
pack,
projectId as id
FROM v_statistical
<where>
pwgs.working_group_id = #{id}
superId = #{id}
<if test="payWorkingGroupSubletSearch.projectName != null and payWorkingGroupSubletSearch.projectName != ''">
AND pwg.working_group_project LIKE
concat('%',concat(#{payWorkingGroupSubletSearch.projectName},'%'))
AND projectName LIKE
concat('%',#{payWorkingGroupSubletSearch.projectName},'%')
</if>
<if test="payWorkingGroupSubletSearch.year != null and payWorkingGroupSubletSearch.year != ''">
AND pwg.year LIKE
concat(#{payWorkingGroupSubletSearch.year},'%')
AND year LIKE
concat('%',#{payWorkingGroupSubletSearch.year},'%')
</if>
<if test="payWorkingGroupSubletSearch.chargeUse != null and payWorkingGroupSubletSearch.chargeUse != ''">
AND pwgs.charge_use=#{payWorkingGroupSubletSearch.chargeUse}
AND chargeUse=#{payWorkingGroupSubletSearch.chargeUse}
</if>
<if test="payWorkingGroupSubletSearch.chargeCompanyTemporaryName != null and payWorkingGroupSubletSearch.chargeCompanyTemporaryName != ''">
AND pwgs.charge_company_temporary_name LIKE
concat('%',concat(#{payWorkingGroupSubletSearch.chargeCompanyTemporaryName},'%'))
AND chargeCompanyTemporaryName LIKE
concat('%',#{payWorkingGroupSubletSearch.chargeCompanyTemporaryName},'%')
</if>
<if test="payWorkingGroupSubletSearch.inAccountStatue != null and payWorkingGroupSubletSearch.inAccountStatue != ''">
AND pwgs.in_account= #{payWorkingGroupSubletSearch.inAccountStatue}
AND payStatue= #{payWorkingGroupSubletSearch.inAccountStatue}
</if>
<if test="payWorkingGroupSubletSearch.principalNameId != null and payWorkingGroupSubletSearch.principalNameId != ''">
AND pwg.principal_id_a=#{payWorkingGroupSubletSearch.principalNameId}
AND principalNameId=#{payWorkingGroupSubletSearch.principalNameId}
</if>
<choose>
<when test="payWorkingGroupSubletSearch.allMoney != null and payWorkingGroupSubletSearch.allMoney != '' and payWorkingGroupSubletSearch.allMoneyTwo != null and payWorkingGroupSubletSearch.allMoneyTwo != ''">
AND if(pwgs.receivable_amount IS NULL OR pwgs.receivable_amount = '', 0, pwgs.receivable_amount ) >= #{payWorkingGroupSubletSearch.allMoney} and if(pwgs.receivable_amount IS NULL OR pwgs.receivable_amount = '', 0, pwgs.receivable_amount ) <![CDATA[<]]>= #{payWorkingGroupSubletSearch.allMoneyTwo}
AND if(allMoney IS NULL OR allMoney = '', 0, allMoney ) >= #{payWorkingGroupSubletSearch.allMoney} and if(allMoney IS NULL OR allMoney = '', 0, allMoney ) <![CDATA[<]]>= #{payWorkingGroupSubletSearch.allMoneyTwo}
</when>
<otherwise>
<if test="payWorkingGroupSubletSearch.allMoney != null and payWorkingGroupSubletSearch.allMoney != ''">
AND if(pwgs.receivable_amount IS NULL OR pwgs.receivable_amount = '', 0, pwgs.receivable_amount ) >= #{payWorkingGroupSubletSearch.allMoney}
AND if(allMoney IS NULL OR allMoney = '', 0, allMoney ) >= #{payWorkingGroupSubletSearch.allMoney}
</if>
<if test="payWorkingGroupSubletSearch.allMoneyTwo != null and payWorkingGroupSubletSearch.allMoneyTwo != ''">
AND if(pwgs.receivable_amount IS NULL OR pwgs.receivable_amount = '', 0, pwgs.receivable_amount ) <![CDATA[<]]>= #{payWorkingGroupSubletSearch.allMoneyTwo}
AND if(allMoney IS NULL OR allMoney = '', 0, allMoney ) <![CDATA[<]]>= #{payWorkingGroupSubletSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
group by pwgs.id) pwg1 where pwg1.allMoney is not null and pwg1.allMoney !=0 order by pwg1.create_time desc
<!-- inner join-->
<!-- (select pwgs.id as id,working_group_id,max(ppr.payment_date) as payment_date-->
<!-- from pay_working_group_subitem pwgs-->
<!-- left join pay_payment_record ppr on(pwgs.id=ppr.project_id)-->
<!-- <if test="payWorkingGroupSubletSearch.year !='' and payWorkingGroupSubletSearch.year !=null">-->
<!-- WHERE ppr.payment_date like concat('%',#{payWorkingGroupSubletSearch.year},'%')-->
<!-- </if>-->
<!-- GROUP BY pwgs.id-->
<!-- ) pwg2 on (pwg2.id=pwg1.id)-->
<!-- order by pwg2.payment_date-->
group by id
</select>
<!--工作组详情总金额-->
<select id="queryPageList233" resultType="com.jero.statistics.entity.AllMoney">
select sum(pwg1.allMoney) as allMoney,sum(pwg1.comeAllMoney) as comeAllMoney from (SELECT
pwgs.id,
pwg.principal_id_a as principalId,
pwg.principal_name_a as principalName,
pwgs.charge_company_temporary_name AS chargeCompanyTemporaryName,
pwgs.receivable_amount AS allMoney,
pwgs.paid_amount AS comeAllMoney,
pwgs.charge_use as chargeUse,
pwgs.pack,
pwgs.create_time
FROM pay_working_group_subitem pwgs
left join pay_working_group pwg on(pwgs.working_group_id=pwg.id)
select sum(allMoney) as allMoney,sum(comeAllMoney) as comeAllMoney from (
SELECT
principalNameId as principalId,
principalName,
chargeCompanyTemporaryName,
allMoney,
comeAllMoney,
chargeUse,
packText,
pack,
projectId as id
FROM v_statistical
<where>
pwgs.working_group_id = #{id}
superId = #{id}
<if test="payWorkingGroupSubletSearch.projectName != null and payWorkingGroupSubletSearch.projectName != ''">
AND pwg.working_group_project LIKE
concat('%',concat(#{payWorkingGroupSubletSearch.projectName},'%'))
AND projectName LIKE
concat('%',#{payWorkingGroupSubletSearch.projectName},'%')
</if>
<if test="payWorkingGroupSubletSearch.year != null and payWorkingGroupSubletSearch.year != ''">
AND pwg.year LIKE
concat(#{payWorkingGroupSubletSearch.year},'%')
AND year LIKE
concat('%',#{payWorkingGroupSubletSearch.year},'%')
</if>
<if test="payWorkingGroupSubletSearch.chargeUse != null and payWorkingGroupSubletSearch.chargeUse != ''">
AND pwgs.charge_use=#{payWorkingGroupSubletSearch.chargeUse}
AND chargeUse=#{payWorkingGroupSubletSearch.chargeUse}
</if>
<if test="payWorkingGroupSubletSearch.chargeCompanyTemporaryName != null and payWorkingGroupSubletSearch.chargeCompanyTemporaryName != ''">
AND pwgs.charge_company_temporary_name LIKE
concat('%',concat(#{payWorkingGroupSubletSearch.chargeCompanyTemporaryName},'%'))
AND chargeCompanyTemporaryName LIKE
concat('%',#{payWorkingGroupSubletSearch.chargeCompanyTemporaryName},'%')
</if>
<if test="payWorkingGroupSubletSearch.inAccountStatue != null and payWorkingGroupSubletSearch.inAccountStatue != ''">
AND pwgs.in_account= #{payWorkingGroupSubletSearch.inAccountStatue}
AND payStatue= #{payWorkingGroupSubletSearch.inAccountStatue}
</if>
<if test="payWorkingGroupSubletSearch.principalNameId != null and payWorkingGroupSubletSearch.principalNameId != ''">
AND pwg.principal_id_a=#{payWorkingGroupSubletSearch.principalNameId}
AND principalNameId=#{payWorkingGroupSubletSearch.principalNameId}
</if>
<choose>
<when test="payWorkingGroupSubletSearch.allMoney != null and payWorkingGroupSubletSearch.allMoney != '' and payWorkingGroupSubletSearch.allMoneyTwo != null and payWorkingGroupSubletSearch.allMoneyTwo != ''">
AND if(pwgs.receivable_amount IS NULL OR pwgs.receivable_amount = '', 0, pwgs.receivable_amount ) >= #{payWorkingGroupSubletSearch.allMoney} and if(pwgs.receivable_amount IS NULL OR pwgs.receivable_amount = '', 0, pwgs.receivable_amount ) <![CDATA[<]]>= #{payWorkingGroupSubletSearch.allMoneyTwo}
AND if(allMoney IS NULL OR allMoney = '', 0, allMoney ) >= #{payWorkingGroupSubletSearch.allMoney} and if(allMoney IS NULL OR allMoney = '', 0, allMoney ) <![CDATA[<]]>= #{payWorkingGroupSubletSearch.allMoneyTwo}
</when>
<otherwise>
<if test="payWorkingGroupSubletSearch.allMoney != null and payWorkingGroupSubletSearch.allMoney != ''">
AND if(pwgs.receivable_amount IS NULL OR pwgs.receivable_amount = '', 0, pwgs.receivable_amount ) >= #{payWorkingGroupSubletSearch.allMoney}
AND if(allMoney IS NULL OR allMoney = '', 0, allMoney ) >= #{payWorkingGroupSubletSearch.allMoney}
</if>
<if test="payWorkingGroupSubletSearch.allMoneyTwo != null and payWorkingGroupSubletSearch.allMoneyTwo != ''">
AND if(pwgs.receivable_amount IS NULL OR pwgs.receivable_amount = '', 0, pwgs.receivable_amount ) <![CDATA[<]]>= #{payWorkingGroupSubletSearch.allMoneyTwo}
AND if(allMoney IS NULL OR allMoney = '', 0, allMoney ) <![CDATA[<]]>= #{payWorkingGroupSubletSearch.allMoneyTwo}
</if>
</otherwise>
</choose>
</where>
group by pwgs.id) pwg1 where pwg1.allMoney is not null and pwg1.allMoney !=0 order by pwg1.create_time desc
<!-- inner join-->
<!-- (select pwgs.id as id,working_group_id,max(ppr.payment_date) as payment_date-->
<!-- from pay_working_group_subitem pwgs-->
<!-- left join pay_payment_record ppr on(pwgs.id=ppr.project_id)-->
<!-- <if test="payWorkingGroupSubletSearch.year !='' and payWorkingGroupSubletSearch.year !=null">-->
<!-- WHERE ppr.payment_date like concat('%',#{payWorkingGroupSubletSearch.year},'%')-->
<!-- </if>-->
<!-- GROUP BY pwgs.id-->
<!-- ) pwg2 on (pwg2.id=pwg1.id)-->
<!-- order by pwg2.payment_date-->
group by id) p
</select>
<!-- 工作组详情导出 -->
@@ -59,39 +59,9 @@ public class CompanyComeMoneyStatisticsController {
public Result<?> list(CompanyComeMoneySearch companyComeMoneySearch,
@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)) {
// idList = null;
// //部门负责人
// } else if (roleCodes.contains(constant.BMFZR)||roleCodes.contains(constant.SLD)) {
// //获取本部门及其所有下部部门所有成员(不包含最开始的部门下级成员)
// List<String> allDepartIds = sysBaseAPI.getAllDepartIds(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()));
//
// idList.addAll(allDepartIds);
// //项目负责人
// } else if (roleCodes.contains(constant.XMFZR)) {
// String userId = sysUser.getId();
// idList.add(userId);
// } else {
// return Result.OK();
// }
Page<CompanyComeMoneyList> page = new Page<>(pageNo, pageSize);
IPage<CompanyComeMoneyList> pageList = payWorkingGroupService.queryPageListForCompany(page,companyComeMoneySearch,null);
HashMap<String, Object> hashMap = new HashMap<>();
// double sum=0;
// double sumTwo =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;
// sumTwo = pageList.getRecords() != null ? pageList.getRecords().stream().mapToDouble(t -> Double.parseDouble(t.getComeAllMoney() == null || t.getComeAllMoney().equals("") ? "0" : t.getComeAllMoney())).sum() : 0;
// }
//处理为空数据为0
for(CompanyComeMoneyList s: pageList.getRecords()){
if(s.getAllMoney()== null || s.getAllMoney().equals("") ){
@@ -130,30 +100,6 @@ public class CompanyComeMoneyStatisticsController {
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
companyComeMoneyDetailSearch.setProjectName( oConvertUtils.replaceAllPercent(companyComeMoneyDetailSearch.getProjectName()));
// //根据不同角色加载不同列表的参数
// 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)) {
// idList = null;
// //部门负责人
// } else if (roleCodes.contains(constant.BMFZR)||roleCodes.contains(constant.SLD)) {
// //获取本部门及其所有下部部门所有成员(不包含最开始的部门下级成员)
// List<String> allDepartIds = sysBaseAPI.getAllDepartIds(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()));
//
// idList.addAll(allDepartIds);
// //项目负责人
// } else if (roleCodes.contains(constant.XMFZR)) {
// String userId = sysUser.getId();
// idList.add(userId);
// } else {
// return Result.OK();
// }
PayCompanyManagement byId = payCompanyManagementService.getById(companyComeMoneyDetailSearch.getChargeCompanyId());
if(ObjectUtils.isEmpty(byId)){
return Result.error("企业id错误,无对应企业id");
@@ -165,13 +111,6 @@ public class CompanyComeMoneyStatisticsController {
s.setChargeCompanyName(byId.getCompanyName());
}
HashMap<String, Object> hashMap = new HashMap<>();
// double sum=0;
// double sumTwo =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;
// sumTwo = 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("#,##0.00");
for(CompanyComeMoneyDetail s: pageList.getRecords()){
String key = String.valueOf(s.getChargeUse());
String payment_charge_use = sysBaseAPI.translateDict("payment_charge_use", key);
@@ -202,31 +141,6 @@ public class CompanyComeMoneyStatisticsController {
@GetMapping(value = "/excel")
@ApiOperation(value = "企业来款统计-导出统计", notes = "企业来款统计-导出统计")
public ModelAndView excel(CompanyComeMoneySearch companyComeMoneySearch) {
//根据不同角色加载不同列表的参数
// 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)) {
// idList = null;
// //部门负责人
// } else if (roleCodes.contains(constant.BMFZR)||roleCodes.contains(constant.SLD)) {
// //获取本部门及其所有下部部门所有成员(不包含最开始的部门下级成员)
// List<String> allDepartIds = sysBaseAPI.getAllDepartIds(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()));
//
// idList.addAll(allDepartIds);//项目负责人
// } else if (roleCodes.contains(constant.XMFZR)) {
// String userId = sysUser.getId();
// idList.add(userId);
// } else {
// ArrayList<CompanyComeMoneyList> objects = new ArrayList<>();
// return AmountUtil.exportListXls(objects, CompanyComeMoneyList.class, "企业来款统计");
// }
List<CompanyComeMoneyList> pageList = payWorkingGroupService.queryPageListForCompanyExcel(companyComeMoneySearch, null);
//处理为空数据为0
for(CompanyComeMoneyList s: pageList) {
@@ -252,30 +166,6 @@ public class CompanyComeMoneyStatisticsController {
@GetMapping(value = "/excelDetail")
@ApiOperation(value = "企业来款详情统计-导出统计", notes = "企业来款详情统计-导出统计")
public ModelAndView excelDetail( CompanyComeMoneyDetailSearch companyComeMoneyDetailSearch) {
//根据不同角色加载不同列表的参数
// 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)) {
// idList = null;
// //部门负责人
// } else if (roleCodes.contains(constant.BMFZR)||roleCodes.contains(constant.SLD)) {
// //获取本部门及其所有下部部门所有成员(不包含最开始的部门下级成员)
// List<String> allDepartIds = sysBaseAPI.getAllDepartIds(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()));
//
// idList.addAll(allDepartIds);//项目负责人
// } else if (roleCodes.contains(constant.XMFZR)) {
// String userId = sysUser.getId();
// idList.add(userId);
// } else {
// ArrayList<CompanyComeMoneyDetail> objects = new ArrayList<>();
// return AmountUtil.exportListXls(objects, CompanyComeMoneyDetail.class, "企业来款详情统计");
// }
List<CompanyComeMoneyDetail> pageList = payWorkingGroupService.queryPageListForCompanyDetailExcel(companyComeMoneyDetailSearch, null);
PayCompanyManagement byId = payCompanyManagementService.getById(companyComeMoneyDetailSearch.getChargeCompanyId());
for(CompanyComeMoneyDetail s:pageList){