Kaynağa Gözat

汇总表的累计欠费合计

yanliming 11 ay önce
ebeveyn
işleme
8220a94ac5

+ 27 - 11
common/src/main/java/com/jpsoft/employment/modules/base/dao/FundIncomeInfoDAO.java

@@ -6,20 +6,36 @@ import java.util.List;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 import com.jpsoft.employment.modules.base.entity.FundIncomeInfo;
+
 import java.util.Map;
+
 import com.jpsoft.employment.modules.common.dto.Sort;
 
 @Repository
 public interface FundIncomeInfoDAO {
-	int insert(FundIncomeInfo entity);
-	int update(FundIncomeInfo entity);
-	int exist(String id);
-	FundIncomeInfo get(String id);
-	int delete(String id);
-	List<FundIncomeInfo> list();
-	List<FundIncomeInfo> findByTemplateOptionId(String templateOptionId);
-	List<FundIncomeInfo> findByYear(@Param("startDate")String startDate,@Param("endDate")String endDate,@Param("templateId")String templateId);
-	BigDecimal sumBySerialNumber(@Param("serialNumber") String serialNumber,@Param("curMonth") String curMonth,@Param("templateId")String templateId);
-	Map<String,BigDecimal> sumBudgetRevenue(@Param("serialNumber")String serialNumber,@Param("startDate")String startDate,@Param("endDate")String endDate,@Param("templateId")String templateId);
-	List<FundIncomeInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+    int insert(FundIncomeInfo entity);
+
+    int update(FundIncomeInfo entity);
+
+    int exist(String id);
+
+    FundIncomeInfo get(String id);
+
+    int delete(String id);
+
+    List<FundIncomeInfo> list();
+
+    List<FundIncomeInfo> findByTemplateOptionId(String templateOptionId);
+
+    List<FundIncomeInfo> findByYear(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("templateId") String templateId);
+
+    BigDecimal sumBySerialNumber(@Param("serialNumber") String serialNumber, @Param("curMonth") String curMonth, @Param("templateId") String templateId);
+
+    BigDecimal sumByTemplateOptionId(@Param("templateOptionId") String templateOptionId, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    Map<String, BigDecimal> sumBudgetRevenue(@Param("serialNumber") String serialNumber, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("templateId") String templateId);
+
+    FundIncomeInfo findOneByTemplateOptionId(@Param("templateOptionId") String templateOptionId, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    List<FundIncomeInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/FundIncomeInfoService.java

@@ -17,6 +17,8 @@ public interface FundIncomeInfoService {
 	int delete(String id);
 	List<FundIncomeInfo> list();
 	BigDecimal sumBySerialNumber(String serialNumber,String curMonth,String templateId);
+	BigDecimal sumByTemplateOptionId(String templateOptionId,String startDate,String endDate);
 	Map<String,BigDecimal> sumBudgetRevenue(String serialNumber,String startDate,String endDate,String templateId);
+	FundIncomeInfo findOneByTemplateOptionId(String templateOptionId,String startDate,String endDate);
 	Page<FundIncomeInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
 }

+ 11 - 0
common/src/main/java/com/jpsoft/employment/modules/base/service/impl/FundIncomeInfoServiceImpl.java

@@ -186,11 +186,22 @@ public class FundIncomeInfoServiceImpl implements FundIncomeInfoService {
     }
 
 
+    @Override
+    public BigDecimal sumByTemplateOptionId(String templateOptionId,String startDate,String endDate){
+        return fundIncomeInfoDAO.sumByTemplateOptionId(templateOptionId, startDate, endDate);
+    }
+
+
     @Override
     public Map<String,BigDecimal> sumBudgetRevenue(String serialNumber, String startDate, String endDate, String templateId) {
         return fundIncomeInfoDAO.sumBudgetRevenue(serialNumber, startDate, endDate, templateId);
     }
 
+    @Override
+    public FundIncomeInfo findOneByTemplateOptionId(String templateOptionId,String startDate,String endDate){
+        return fundIncomeInfoDAO.findOneByTemplateOptionId(templateOptionId, startDate, endDate);
+    }
+
     @Override
     public Page<FundIncomeInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
         Page<FundIncomeInfo> page = PageHelper.startPage(pageNumber, pageSize, count).doSelectPage(() -> {

+ 22 - 0
common/src/main/resources/mapper/base/FundIncomeInfo.xml

@@ -196,6 +196,28 @@
 			order by create_time
 		]]>
 	</select>
+	<select id="sumByTemplateOptionId" resultType="java.math.BigDecimal">
+		select IFNULL(sum(cur_month_received),0) from base_fund_income_info
+		<where>
+			<![CDATA[
+				del_flag=false
+				and year_<=#{endDate}
+				and template_option_id = #{templateOptionId}
+			]]>
+		</where>
+	</select>
+	<select id="findOneByTemplateOptionId" resultMap="FundIncomeInfoMap">
+		select * from base_fund_income_info
+		<where>
+			<![CDATA[
+				del_flag=false
+				and year_>=#{startDate}
+				and year_<=#{endDate}
+				and template_option_id = #{templateOptionId}
+			]]>
+		</where>
+		limit 1
+	</select>
 	<select id="sumBudgetRevenue" resultType="java.util.Map">
 		<![CDATA[
 			select

+ 28 - 1
web/src/main/java/com/jpsoft/employment/modules/base/controller/FundIncomeInfoController.java

@@ -875,6 +875,33 @@ public class FundIncomeInfoController {
                         if (sumMap != null) {
                             BigDecimal tempBudgetRevenue = sumMap.get("sumCurBudgetRevenue");
                             mapSum.put("curBudgetRevenue", tempBudgetRevenue);
+
+                            List<TemplateOption> templateOptionList = templateOptionService.findByTemplateId(templateId);
+                            BigDecimal sumAcc = BigDecimal.ZERO;
+                            for (TemplateOption item : templateOptionList) {
+                                BigDecimal sum = fundIncomeInfoService.sumByTemplateOptionId(item.getId(), startDate, endDate);
+
+                                FundIncomeInfo fundIncome = fundIncomeInfoService.findOneByTemplateOptionId(item.getId(), startDate, endDate);
+
+                                BigDecimal tempNum = BigDecimal.ZERO;
+
+                                if (fundIncome != null) {
+                                    if (fundIncome.getCurBudgetRevenue() != null) {
+                                        tempNum = fundIncome.getCurBudgetRevenue();
+                                    } else {
+                                        tempNum = fundIncome.getBudgetRevenue();
+                                    }
+                                }
+                                if(tempNum!=null){
+                                    BigDecimal c = tempNum.subtract(sum);
+
+                                    if (c.compareTo(BigDecimal.ZERO) > 0) {
+                                        sumAcc = sumAcc.add(c);
+                                    }
+                                }
+                            }
+
+                            mapSum.put("accumulatedArrears", sumAcc);
                         }
 
 
@@ -933,7 +960,7 @@ public class FundIncomeInfoController {
             int colIndex = 0;
             row.createCell(colIndex++).setCellValue(i + 1);
             row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("name"), ""));
-            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("budgetRevenue"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("curBudgetRevenue"), ""));
             row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("curMonthReceived"), ""));
             row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("actualTotalRevenue"), ""));
             row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("accumulatedArrears"), ""));