add 未收账款统计 增加部门筛选

This commit is contained in:
lijiarao
2022-10-19 10:21:45 +08:00
parent 341b939a0f
commit 0510deb6df
4 changed files with 29 additions and 17 deletions
@@ -98,8 +98,8 @@ public class IndexController {
@ApiOperation(value = "未收账款统计")
@GetMapping(value = "/uncollected")
public Result<List<UncollectedPieChartVO>> uncollected() {
List<UncollectedPieChartVO> UncollectedPieChartVOS = indexService.uncollected();
public Result<List<UncollectedPieChartVO>> uncollected(@RequestParam(name="departCode",required = false)String departCode) {
List<UncollectedPieChartVO> UncollectedPieChartVOS = indexService.uncollected(departCode);
return Result.OK(UncollectedPieChartVOS);
}
@@ -12,7 +12,6 @@ import com.jero.index.vo.*;
import com.jero.project.mapper.PayWorkingGroupMapper;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.statistics.entity.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -267,22 +266,22 @@ public class IndexService {
return histogramVOList;
}
public List<UncollectedPieChartVO> uncollected() {
public List<UncollectedPieChartVO> uncollected(String departCode) {
List<UncollectedPieChartVO> uncollectedPieChartVOList = new ArrayList<>();
UncollectedPieChartVO uncollectedPieChartVO1 = setUncollectedPieChartVO("3月内", null, 90);
UncollectedPieChartVO uncollectedPieChartVO1 = setUncollectedPieChartVO("3月内", null, 90, departCode);
uncollectedPieChartVOList.add(uncollectedPieChartVO1);
UncollectedPieChartVO uncollectedPieChartVO2 = setUncollectedPieChartVO("3-6月内", 91, 180);
UncollectedPieChartVO uncollectedPieChartVO2 = setUncollectedPieChartVO("3-6月内", 91, 180, departCode);
uncollectedPieChartVOList.add(uncollectedPieChartVO2);
UncollectedPieChartVO uncollectedPieChartVO3 = setUncollectedPieChartVO("6-12月内", 181, 360);
UncollectedPieChartVO uncollectedPieChartVO3 = setUncollectedPieChartVO("6-12月内", 181, 360, departCode);
uncollectedPieChartVOList.add(uncollectedPieChartVO3);
UncollectedPieChartVO uncollectedPieChartVO4 = setUncollectedPieChartVO("一年以上", 361, null);
UncollectedPieChartVO uncollectedPieChartVO4 = setUncollectedPieChartVO("一年以上", 361, null, departCode);
uncollectedPieChartVOList.add(uncollectedPieChartVO4);
return uncollectedPieChartVOList;
}
private UncollectedPieChartVO setUncollectedPieChartVO(String name, Integer start, Integer end){
BigDecimal bigDecimal = payWorkingGroupMapper.invoiceAmount(start, end);
BigDecimal bigDecimal1 = payWorkingGroupMapper.arrivalAmount(start, end);
private UncollectedPieChartVO setUncollectedPieChartVO(String name, Integer start, Integer end, String departCode){
BigDecimal bigDecimal = payWorkingGroupMapper.invoiceAmount(start, end, departCode);
BigDecimal bigDecimal1 = payWorkingGroupMapper.arrivalAmount(start, end, departCode);
UncollectedPieChartVO uncollectedPieChartVO = new UncollectedPieChartVO();
uncollectedPieChartVO.setName(name);
if (bigDecimal.compareTo(bigDecimal1) > 0){
@@ -246,7 +246,7 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
List<AllProjectStatistics> cumulativeListComeAllMoney();
BigDecimal invoiceAmount(@Param("start") Integer start, @Param("end") Integer end);
BigDecimal invoiceAmount(@Param("start") Integer start, @Param("end") Integer end, @Param("departCode") String departCode);
BigDecimal arrivalAmount(@Param("start") Integer start, @Param("end") Integer end);
BigDecimal arrivalAmount(@Param("start") Integer start, @Param("end") Integer end, @Param("departCode") String departCode);
}
@@ -2701,8 +2701,12 @@
</select>
<select id="invoiceAmount" resultType="java.math.BigDecimal">
SELECT sum(invoice_amount)
FROM pay_mail_bill
SELECT IFNULL(sum(pmbp.invoice_amount),0)
FROM pay_mail_bill pmb
left join pay_mail_bill_project pmbp on pmb.id = pmbp.bill_id
<if test="departCode != null and departCode != ''">
left join v_statistical v on v.projectId = pmbp.project_id
</if>
<where>
<if test="end != null">
bill_date >= DATE_SUB(CURDATE(), INTERVAL #{end} DAY)
@@ -2713,12 +2717,18 @@
<if test="start == null">
AND bill_date <![CDATA[<=]]> CURDATE()
</if>
<if test="departCode != null and departCode != ''">
and departCode = #{departCode}
</if>
</where>
</select>
<select id="arrivalAmount" resultType="java.math.BigDecimal">
SELECT sum(amount_received)
FROM pay_payment_record
SELECT IFNULL(sum(amount_received),0)
FROM pay_payment_record ppr
<if test="departCode != null and departCode != ''">
left join v_statistical v on v.projectId = ppr.project_id
</if>
<where>
<if test="end != null">
payment_date >= DATE_SUB(CURDATE(), INTERVAL #{end} DAY)
@@ -2729,6 +2739,9 @@
<if test="start == null">
AND payment_date <![CDATA[<=]]> CURDATE()
</if>
<if test="departCode != null and departCode != ''">
and departCode = #{departCode}
</if>
and payment_status = 'completed'
</where>
</select>