update 会议打包统计 修改为会议金额A 会议金额B,导出增加选择导出

This commit is contained in:
lijiarao
2024-03-13 11:08:39 +08:00
parent a5425826df
commit 2e0c07f031
7 changed files with 77 additions and 32 deletions
+21 -1
View File
@@ -74,4 +74,24 @@ INSERT INTO sys_sms_template ( id, template_code, template_name, template_conten
update income_payments.tb_member_project_subitem tmps update income_payments.tb_member_project_subitem tmps
left join standards_association.tb_member_info tmi on tmps.company_name = tmi.company_name left join standards_association.tb_member_info tmi on tmps.company_name = tmi.company_name
set tmps.effective_date = tmi.effective_date, tmps.invalidation_date = tmi.invalidation_date set tmps.effective_date = tmi.effective_date, tmps.invalidation_date = tmi.invalidation_date
where 1=1; where 1=1;
# 会议打包统计视图
create view v_meeting_pack_statistical as
SELECT
p1.id,
p1.meeting_id,
p1.company_name,
p1.company_contact_name,
p1.pay_mode,
p1.amount_receivable AS allMoney,
p1.confirm_amount AS confirm_amount,
p1.invoice_amount AS billMoney,
p1.paid_amount AS comeAllMoney,
ifnull(p2.meeting_costs,p2.meeting_costs_two_topic) meeting_costs_a,
ifnull(p2.meeting_costs_vip,p2.meeting_costs_three_topic) meeting_costs_b,
p2.meeting_name,
p2.meeting_type,
( SELECT DATE_FORMAT( payment_date, '%Y' ) FROM pay_confirm_payment_record p3 WHERE p3.project_id = p1.id LIMIT 1 ) AS payment_year
FROM
pay_meeting_situation p1
LEFT JOIN pay_meeting p2 ON p1.meeting_id = p2.id;
+22 -1
View File
@@ -759,4 +759,25 @@ from (SELECT pwgs.id,
left join v_mail_bill_project vmbp on tcp.id = vmbp.project_id left join v_mail_bill_project vmbp on tcp.id = vmbp.project_id
group by tcp.id group by tcp.id
) pp ) pp
order by pp.createTime; order by pp.createTime;
drop view v_meeting_pack_statistical;
create view v_meeting_pack_statistical as
SELECT
p1.id,
p1.meeting_id,
p1.company_name,
p1.company_contact_name,
p1.pay_mode,
p1.amount_receivable AS allMoney,
p1.confirm_amount AS confirm_amount,
p1.invoice_amount AS billMoney,
p1.paid_amount AS comeAllMoney,
ifnull(p2.meeting_costs,p2.meeting_costs_two_topic) meeting_costs_a,
ifnull(p2.meeting_costs_vip,p2.meeting_costs_three_topic) meeting_costs_b,
p2.meeting_name,
p2.meeting_type,
( SELECT DATE_FORMAT( payment_date, '%Y' ) FROM pay_confirm_payment_record p3 WHERE p3.project_id = p1.id LIMIT 1 ) AS payment_year
FROM
pay_meeting_situation p1
LEFT JOIN pay_meeting p2 ON p1.meeting_id = p2.id;
@@ -180,20 +180,16 @@
</select> </select>
<select id="getMeetingPackStatistics" resultType="com.jero.statistics.entity.MeetingPackStatistics"> <select id="getMeetingPackStatistics" resultType="com.jero.statistics.entity.MeetingPackStatistics">
select select
${ew.sqlSelect} *
from pay_meeting_situation p1 from v_meeting_pack_statistical
left join pay_meeting p2 on p1.meeting_id = p2.id
left join pay_confirm_payment_record p3 on p3.project_id = p1.id
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
<select id="getMeetingPackStatisticsCount" resultType="com.jero.statistics.entity.MeetingPackStatistics"> <select id="getMeetingPackStatisticsCount" resultType="com.jero.statistics.entity.MeetingPackStatistics">
select sum(amount_receivable ) AS allMoney,sum(confirm_amount ) AS confirm_amount, sum(invoice_amount ) AS billMoney,sum(paid_amount ) AS comeAllMoney from select sum(allMoney) AS allMoney,
( sum(confirm_amount) AS confirm_amount,
select sum(p1.amount_receivable) as amount_receivable, sum(p1.confirm_amount) as confirm_amount, sum(meeting_costs_a) AS meetingCostsA,
sum(p1.invoice_amount) as invoice_amount, sum(p1.paid_amount) as paid_amount from pay_meeting_situation p1 sum(meeting_costs_b) AS meetingCostsB
left join pay_meeting p2 on p1.meeting_id = p2.id from v_meeting_pack_statistical
left join pay_confirm_payment_record p3 on p3.project_id = p1.id
${ew.customSqlSegment} ${ew.customSqlSegment}
) a
</select> </select>
</mapper> </mapper>
@@ -110,5 +110,5 @@ public interface IPayMeetingSituationService extends IService<PayMeetingSituatio
Integer pageNo, Integer pageNo,
Integer pageSize); Integer pageSize);
ModelAndView excelMeetingPackStatistics(MeetingPackStatisticsSearch metingPackStatisticsSearch); ModelAndView excelMeetingPackStatistics(HttpServletRequest request, MeetingPackStatisticsSearch metingPackStatisticsSearch);
} }
@@ -1978,18 +1978,23 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
HashMap<String, Object> hashMap = new HashMap<>(); HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("sumOfMoney", (Objects.isNull(count) || StringUtils.isBlank(count.getAllMoney())) ? 0 : count.getAllMoney()); hashMap.put("sumOfMoney", (Objects.isNull(count) || StringUtils.isBlank(count.getAllMoney())) ? 0 : count.getAllMoney());
hashMap.put("sumOfReallyMoney", (Objects.isNull(count) || StringUtils.isBlank(count.getComeAllMoney())) ? 0 : count.getComeAllMoney()); hashMap.put("sumOfReallyMoney", (Objects.isNull(count) || StringUtils.isBlank(count.getComeAllMoney())) ? 0 : count.getComeAllMoney());
hashMap.put("sumOfBillMoney", (Objects.isNull(count) || StringUtils.isBlank(count.getBillMoney())) ? 0 : count.getBillMoney()); hashMap.put("sumOfMeetingCostsA", (Objects.isNull(count) || StringUtils.isBlank(count.getMeetingCostsA())) ? 0 : count.getMeetingCostsA());
hashMap.put("sumOfConfirmAmount", (Objects.isNull(count) || StringUtils.isBlank(count.getConfirmAmount())) ? 0 : count.getConfirmAmount()); hashMap.put("sumOfMeetingCostsB", (Objects.isNull(count) || StringUtils.isBlank(count.getMeetingCostsB())) ? 0 : count.getMeetingCostsB());
hashMap.put("pageList", pageList); hashMap.put("pageList", pageList);
return hashMap; return hashMap;
} }
@Override @Override
public ModelAndView excelMeetingPackStatistics(MeetingPackStatisticsSearch metingPackStatisticsSearch) { public ModelAndView excelMeetingPackStatistics(HttpServletRequest request, MeetingPackStatisticsSearch metingPackStatisticsSearch) {
QueryWrapper<PayMeetingSituation> query = getPayMeetingSituationQueryWrapper(metingPackStatisticsSearch); QueryWrapper<PayMeetingSituation> query = getPayMeetingSituationQueryWrapper(metingPackStatisticsSearch);
addOrder(metingPackStatisticsSearch, query); addOrder(metingPackStatisticsSearch, query);
List<MeetingPackStatistics> list = payMeetingSituationMapper.getMeetingPackStatistics(query); List<MeetingPackStatistics> list = payMeetingSituationMapper.getMeetingPackStatistics(query);
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
list = list.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
}
// Step.3 AutoPoi 导出Excel // Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "会议打包统计"); //此处设置的filename无效 ,前端会重更新设置一下 mv.addObject(NormalExcelConstants.FILE_NAME, "会议打包统计"); //此处设置的filename无效 ,前端会重更新设置一下
@@ -2010,28 +2015,24 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
query.lambda().like(PayMeetingSituation::getCompanyName, metingPackStatisticsSearch.getCompanyName()); query.lambda().like(PayMeetingSituation::getCompanyName, metingPackStatisticsSearch.getCompanyName());
} }
if (!StringUtils.isBlank(metingPackStatisticsSearch.getPayMode())) { if (!StringUtils.isBlank(metingPackStatisticsSearch.getPayMode())) {
query.lambda().in(PayMeetingSituation::getPayMode, Arrays.asList(metingPackStatisticsSearch.getPayMode().split(","))); query.lambda().eq(PayMeetingSituation::getPayMode, metingPackStatisticsSearch.getPayMode());
} }
if (!StringUtils.isBlank(metingPackStatisticsSearch.getPaymentYear())) { if (!StringUtils.isBlank(metingPackStatisticsSearch.getPaymentYear())) {
query.eq("DATE_FORMAT(p3.payment_date,'%Y')", metingPackStatisticsSearch.getPaymentYear()); query.eq("payment_year", metingPackStatisticsSearch.getPaymentYear());
} }
query.groupBy("p1.id");
return query; return query;
} }
@NotNull @NotNull
private void addOrder(MeetingPackStatisticsSearch metingPackStatisticsSearch,QueryWrapper<PayMeetingSituation> query) { private void addOrder(MeetingPackStatisticsSearch metingPackStatisticsSearch,QueryWrapper<PayMeetingSituation> query) {
query.select("p1.id,p1.meeting_id,p1.company_name,p1.company_contact_name,sum(p1.amount_receivable) as allMoney," +
"sum(p1.confirm_amount) as confirm_amount,sum(p1.invoice_amount) as billMoney,sum(p1.paid_amount) as comeAllMoney," +
"p2.meeting_name,p2.meeting_type,DATE_FORMAT(p3.payment_date,'%Y') as payment_year");
// 排序 // 排序
if(!StringUtils.isBlank(metingPackStatisticsSearch.getColumn()) && !StringUtils.isBlank(metingPackStatisticsSearch.getOrder())){ if(!StringUtils.isBlank(metingPackStatisticsSearch.getColumn()) && !StringUtils.isBlank(metingPackStatisticsSearch.getOrder())){
String column = ""; String column = "";
switch (metingPackStatisticsSearch.getColumn()){ switch (metingPackStatisticsSearch.getColumn()){
case "allMoney": column = "p1.amount_receivable";break; case "allMoney": column = "amount_receivable";break;
case "confirmAmount": column = "p1.confirm_amount";break; case "confirmAmount": column = "confirm_amount";break;
case "billMoney": column = "p1.invoice_amount";break; case "billMoney": column = "invoice_amount";break;
case "comeAllMoney": column = "p1.paid_amount";break; case "comeAllMoney": column = "paid_amount";break;
default:break; default:break;
} }
if(!StringUtils.isBlank(column)){ if(!StringUtils.isBlank(column)){
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/** /**
@@ -59,7 +60,7 @@ public class MeetingPackStatisticsController {
@AutoLog(value = "会议打包统计-导出统计") @AutoLog(value = "会议打包统计-导出统计")
@ApiOperation(value = "会议打包统计-导出统计", notes = "会议打包统计-导出统计") @ApiOperation(value = "会议打包统计-导出统计", notes = "会议打包统计-导出统计")
@GetMapping(value = "/excelMeetingPackStatistics") @GetMapping(value = "/excelMeetingPackStatistics")
public ModelAndView excelMeetingPackStatistics(MeetingPackStatisticsSearch metingPackStatisticsSearch) { public ModelAndView excelMeetingPackStatistics(HttpServletRequest request, MeetingPackStatisticsSearch metingPackStatisticsSearch) {
return payMeetingSituationService.excelMeetingPackStatistics(metingPackStatisticsSearch); return payMeetingSituationService.excelMeetingPackStatistics(request,metingPackStatisticsSearch);
} }
} }
@@ -45,14 +45,20 @@ public class MeetingPackStatistics implements Serializable {
@ApiModelProperty(value = "确认金额") @ApiModelProperty(value = "确认金额")
private String confirmAmount; private String confirmAmount;
@Excel(name = "开票金额", width = 15)
@ApiModelProperty(value = "开票金额") @ApiModelProperty(value = "开票金额")
private String billMoney; private String billMoney;
@Excel(name = "到账金额", width = 15)
@ApiModelProperty(value = "到账金额") @ApiModelProperty(value = "到账金额")
private String comeAllMoney; private String comeAllMoney;
@Excel(name = "会议金额A", width = 15)
@ApiModelProperty(value = "会议金额A")
private String meetingCostsA;
@Excel(name = "会议金额B", width = 15)
@ApiModelProperty(value = "会议金额B")
private String meetingCostsB;
@ApiModelProperty(value = "确认年份") @ApiModelProperty(value = "确认年份")
private BigDecimal paymentYear; private BigDecimal paymentYear;