Browse Source

大中型开票查询修改

wucl 2 months ago
parent
commit
7dfd39dbaf

+ 2 - 0
dao/src/main/java/com/dayou/mapper/FinanceInvoiceMapper.java

@@ -40,4 +40,6 @@ public interface FinanceInvoiceMapper extends CustomBaseMapper<FinanceInvoice> {
      * @return String
      */
     String getInvoiceNoByFundId(@Param("orderFundId") Long orderFundId, @Param("productionFundId") Long productionFundId);
+
+    List<FinanceInvoice> getList(@Param("orderFundId") Long id, @Param("productionFundId") Long productionFundId);
 }

+ 11 - 0
dao/src/main/resources/mapper/FinanceInvoiceMapper.xml

@@ -235,4 +235,15 @@
               AND finance_invoice.production_fund_id = #{productionFundId}
           </if>
     </select>
+
+    <select id="getList" resultType="com.dayou.entity.FinanceInvoice">
+        select * from finance_invoice where deleted = 0 and order_fund_id = #{orderFundId}
+        <if test="productionFundId!=null">
+            and production_fund_id = #{productionFundId}
+        </if>
+        <if test="productionFundId == null">
+            and production_fund_id is null
+        </if>
+        order by created DESC
+    </select>
 </mapper>

+ 1 - 3
dao/src/main/resources/mapper/MajorProductionMapper.xml

@@ -373,7 +373,7 @@
             pf.id as productionFundId,
             pf.real_amount,
             pf.production_should_amount as shouldAmount,
-            fi.invoiceAmount,
+            (select sum(real_amount) from finance_invoice where state = '已开票' and deleted =0 and  order_fund_id = orf.id and if(production_fund_id is null,1=1,production_fund_id = pf.id)) as invoiceAmount,
             mp.delivery,
             mp.delivery_date,
             (case mp.repertory_state when 0 then '已入库' when 1 then '已出库' else '未入库' end ) repertoryState,
@@ -389,8 +389,6 @@
                 left join customer_linkman cl on  cl.id = m.clientele_contact_id
                 left join (select * from order_fund where business_type ='MAJOR_BUSINESS' and deleted = 0) orf on orf.business_id = m.id
                 left join (select * from production_fund where business_type = 'MAJOR_BUSINESS' and deleted = 0) pf on (pf.business_id = m.id and pf.production_no = mp.report_no and mp.production = pf.production_type)
-                left join (select sum(real_amount) as invoiceAmount,order_fund_id,production_fund_id from finance_invoice where state='已开票' and deleted = 0 group by production_fund_id) fi on (fi.order_fund_id = orf.id and fi.production_fund_id = pf.id)
-
     </sql>
 
     <sql id="myOrderSql">

+ 1 - 5
service/src/main/java/com/dayou/service/impl/FinanceInvoiceServiceImpl.java

@@ -163,11 +163,7 @@ public class FinanceInvoiceServiceImpl extends ServiceImpl<FinanceInvoiceMapper,
 
     @Override
     public List<FinanceInvoice> getList(Long id, Long productionFundId) {
-        List<FinanceInvoice> list = this.list(new LambdaQueryWrapper<FinanceInvoice>()
-                .eq(FinanceInvoice::getOrderFundId, id)
-                .eq(productionFundId!=null,FinanceInvoice::getProductionFundId, productionFundId)
-                .orderByDesc(BaseEntity::getCreated));
-        return list;
+        return financeInvoiceMapper.getList(id,productionFundId);
     }
 
     @Override