Преглед на файлове

Merge remote-tracking branch 'origin/test' into test

wks преди 1 година
родител
ревизия
732a2bffe6

+ 4 - 0
src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java

@@ -471,6 +471,10 @@ public class InsPlyIncome implements Serializable {
     @TableField(exist = false)
     private String isExternal;
 
+    @ApiModelProperty("结清状态")
+    @TableField(exist = false)
+    private String status;
+
     @ApiModelProperty("是否外部订单")
     @TableField("add_type")
     private String addType;

+ 13 - 3
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -789,6 +789,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getCreateTimeStart())){
             params.put("createTimeStart", insPlyIncomeVo.getCreateTimeStart());
         }
+        if(StringUtils.isNotEmpty(insPlyIncomeVo.getStatus())){
+            params.put("status", insPlyIncomeVo.getStatus());
+        }
         if(StringUtils.isNotBlank(insPlyIncomeVo.getAddType())){
             params.put("addType", insPlyIncomeVo.getAddType());
         }
@@ -1889,7 +1892,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         params = this.saveParams(insPlyIncomeVo, params);
         params.remove("handlingFeesStatus");
         List<InsPlyIncome> resultList = baseMapper.totalBxAmountNew(params);
-        return resultList;
+        return resultList.stream()
+                .sorted(Comparator.comparing(InsPlyIncome::getUnSettledAmount, Comparator.reverseOrder()))
+                .collect(Collectors.toList());
     }
 
     /**
@@ -2207,6 +2212,13 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             item.setExpendAmount(expendAmount);
             item.setTaxesFees(taxesFees);
         }
+        if (StringUtils.isNotEmpty(insPlyIncomeVo.getStatus())) {
+            if ("0".equals(insPlyIncomeVo.getStatus())) {
+                return  HttpResult.ok(resultList.stream().filter(insPlyIncome -> insPlyIncome.getAllInvoicCommissionFeevalue().compareTo(insPlyIncome.getReadyCommissionFeevalue()) > 0).sorted(Comparator.comparing(InsPlyIncome::getUnSettledAmount, Comparator.reverseOrder())).collect(Collectors.toList()));
+            }else if ("1".equals(insPlyIncomeVo.getStatus())){
+                return  HttpResult.ok(resultList.stream().filter(insPlyIncome -> insPlyIncome.getAllInvoicCommissionFeevalue().compareTo(insPlyIncome.getReadyCommissionFeevalue()) == 0).sorted(Comparator.comparing(InsPlyIncome::getUnSettledAmount, Comparator.reverseOrder())).collect(Collectors.toList())) ;
+            }
+        }
         return HttpResult.ok(resultList);
     }
 
@@ -2214,8 +2226,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Override
     @Transactional
     public HttpResult<Object> batchInvoic(InsPlyIncomeVo insPlyIncomeVo) {
-
-
         SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo();  // 生成跟单费结算表
         if (StringUtils.isNotEmpty(insPlyIncomeVo.getYear())) {
             settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度

+ 3 - 0
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java

@@ -425,5 +425,8 @@ public class InsPlyIncomeVo implements Serializable {
     @ApiModelProperty("添加类型")
     private String addType;
 
+    @ApiModelProperty(value = "统计结清状态")
+    private String status;
+
 
 }

+ 14 - 1
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -3154,7 +3154,8 @@
         IFNULL(b.settlementAmount,0)   as "readyCommissionFeevalue",
         IFNULL(a.allInvoicCommissionFeevalue,0) -IFNULL(b.settlementAmount,0) as "invoicCommissionFeevalue",
         IFNULL(a.commissionFeevalue,0) - IFNULL(a.allInvoicCommissionFeevalue,0) as "noInvoicCommissionFeevalue",
-        (IFNULL(a.allInvoicCommissionFeevalue,0) -IFNULL(b.settlementAmount,0)) +(IFNULL(a.commissionFeevalue,0) - IFNULL(a.allInvoicCommissionFeevalue,0)) as "unSettledAmount"
+        (IFNULL(a.allInvoicCommissionFeevalue,0) -IFNULL(b.settlementAmount,0)) +(IFNULL(a.commissionFeevalue,0) - IFNULL(a.allInvoicCommissionFeevalue,0)) as "unSettledAmount",
+        CASE WHEN IFNULL( a.allInvoicCommissionFeevalue, 0 )  = IFNULL( b.settlementAmount, 0 )  THEN '1' ELSE 0 END as "status"
         from (
         select a.partner_companies_id,
         sum(a.commission_feevalue) as "commissionFeevalue",
@@ -3353,6 +3354,18 @@
             </if>
         </where>
         group by a.partner_companies_id) b on b.partner_companies_id = a.partner_companies_id
+        <where>
+            <if test="status  !=null  and   status  !=''">
+                <choose>
+                    <when test="status==0">
+                        and IFNULL(a.allInvoicCommissionFeevalue,0) != IFNULL(b.settlementAmount,0)
+                    </when>
+                    <when test="status==1">
+                        and IFNULL(a.allInvoicCommissionFeevalue,0) = IFNULL(b.settlementAmount,0)
+                    </when>
+                </choose>
+            </if>
+        </where>
     </select>
 
     <select id="totalPTAmount" resultType="com.ydtech.modules.fnc.dto.InsPlyIncomePTDto">