ezhizao_zx 1 năm trước cách đây
mục cha
commit
62d671efd7

+ 2 - 2
src/main/java/cn/ezhizao/project/business/deduct/controller/BizDeductController.java

@@ -218,7 +218,7 @@ public class BizDeductController extends BaseController {
         totalRemain = totalRemain == null ? BigDecimal.ZERO : totalRemain;
         BigDecimal donateRemain = depositService.getDonateRemain(totalCondition);
         donateRemain = donateRemain == null ? BigDecimal.ZERO : donateRemain;
-        bizDeduct.setRemainAmount(totalRemain.add(donateRemain));
+        bizDeduct.setPrevRemainAmount(totalRemain.add(donateRemain));
 
         // 获取循环从表
         BizEntrust entrustLoopCondition = new BizEntrust();
@@ -338,7 +338,7 @@ public class BizDeductController extends BaseController {
         BigDecimal deduct = BigDecimal.valueOf(accounts.stream().mapToDouble(v -> v.getActuallyAmount().doubleValue()).sum()).setScale(2, RoundingMode.HALF_UP);
         bizDeduct.setAmount(deduct);
         // 本期余额
-        bizDeduct.setPrevRemainAmount(bizDeduct.getRemainAmount().subtract(deduct));
+        bizDeduct.setRemainAmount(bizDeduct.getRemainAmount().subtract(deduct));
         return success(bizDeduct);
     }
 

+ 2 - 2
src/main/resources/mybatis/business/BizWorkOrderMapper.xml

@@ -41,7 +41,7 @@
             <if test="startMonth != null ">AND t1.end_month &gt;= #{startMonth}</if>
             <if test="monthNum != null ">AND t1.month_num = #{monthNum}</if>
             <if test="isStop != null ">AND t1.is_stop = #{isStop}</if>
-            <if test="currentMonth != null"> AND t1.start_month != 0 AND #{currentMonth} &gt;= (case when t1.task_type_id = 1 then DATE_ADD(t1.start_month,interval 1 month) else t1.start_month end) and #{currentMonth} &lt;= (case when t1.end_month = 0 then #{currentMonth} when t1.task_type_id = 1 then DATE_ADD(t1.end_month,interval 1 month) else t1.end_month end)</if>
+            <if test="currentMonth != null"> AND t1.start_month != 0 AND DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') &gt;= (case when t1.task_type_id = 1 then DATE_ADD(t1.start_month,interval 1 month) else t1.start_month end) and DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') &lt;= (case when t1.end_month = 0 then DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') when t1.task_type_id = 1 then DATE_ADD(t1.end_month,interval 1 month) else t1.end_month end)</if>
             <if test="toTenantId != null and currentMonth != null">
                 AND exists (select 1 from biz_entrust t6 where t6.deleted = 0 and t6.to_tenant_id = #{toTenantId} and t6.work_month = #{currentMonth} and t1.id = t6.work_order_id )
             </if>
@@ -84,7 +84,7 @@
             <if test="endMonth != null ">AND t1.end_month = #{endMonth}</if>
             <if test="monthNum != null ">AND t1.month_num = #{monthNum}</if>
             <if test="isStop != null ">AND t1.is_stop = #{isStop}</if>
-            <if test="currentMonth != null"> AND t1.start_month != 0 AND #{currentMonth} &gt;= (case when t1.task_type_id = 1 then DATE_ADD(t1.start_month,interval 1 month) else t1.start_month end) and #{currentMonth} &lt;= (case when t1.end_month = 0 then #{currentMonth} when t1.task_type_id = 1 then DATE_ADD(t1.end_month,interval 1 month) else t1.end_month end)</if>
+            <if test="currentMonth != null"> AND t1.start_month != 0 AND DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') &gt;= (case when t1.task_type_id = 1 then DATE_ADD(t1.start_month,interval 1 month) else t1.start_month end) and DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') &lt;= (case when t1.end_month = 0 then DATE_FORMAT(#{currentMonth}, '%Y-%m-%d') when t1.task_type_id = 1 then DATE_ADD(t1.end_month,interval 1 month) else t1.end_month end)</if>
             <if test="toTenantId != null and currentMonth != null">
                 AND exists (select 1 from biz_entrust t6 where t6.deleted = 0 and t6.to_tenant_id = #{toTenantId} and t6.work_month = #{currentMonth} and t1.id = t6.work_order_id )
             </if>