Parcourir la source

发起订单BUG修复

anderx il y a 1 an
Parent
commit
029e8b9f39

+ 47 - 0
src/main/java/com/goafanti/common/mapper/TOrderMidMapper.xml

@@ -337,6 +337,53 @@
         where   id = #{id,jdbcType=INTEGER} 
     </update>
 
+
+
+    <select id="selectByOrderNo" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from t_order_mid
+        where order_no = #{id,jdbcType=INTEGER}
+    </select>
+    <update id="updateSalesmanId">
+        update t_order_mid a ,admin b set a.salesman_id=#{transferId},a.salesman_name=b.name
+        where b.id=#{transferId} and a.salesman_id=#{aid}
+    </update>
+    <update id="updateFinanceId">
+        update t_order_new a ,t_order_mid b,admin c  set b.finance_id=c.id,b.finance_name=c.name
+        where a.order_dep=#{id} and a.order_no=b.order_no and c.id= #{financeId}
+    </update>
+    <update id="updatefinalReceivables">
+        update t_order_mid set final_receivables= #{amount},`final_Receivables_time`= #{receivablesTime},
+                               order_arrears=if(order_arrears- #{amount} &lt; 0,0,order_arrears- #{amount}),
+                               actual_profit=#{count}-payment_amount
+        where order_no= #{orderNo}
+    </update>
+    <update id="updateInvoice">
+        update t_order_mid m,(select order_no,sum(amount)amount from t_order_invoice where status=2 group by order_no)b
+        set m.invoice_amount=b.amount where m.order_no= #{orderNo} and  m.order_no=b.order_no
+    </update>
+    <select id="selectDepNameByDepid" resultType="java.lang.String">
+        select name from department where id= #{orderDep}
+    </select>
+
+
+    <update id="updateCostAmount">
+        update t_order_mid x,(select x.order_no,sum(cost)cost,sum(party)party, sum(if(type = 1, cost, 0))zlc, sum(if(type = 1, party, 0))zlf,
+                                     sum(if(type = 2, cost, 0))rzc, sum(if(type = 2, party, 0))rzf, sum(if(type = 3, cost, 0))sjc, sum(if(type = 3, party, 0))sjf,
+                                     sum(if(type = 0 or type>3, cost, 0))qtc, sum(if(type = 0 or type>3, party, 0))qtf
+                              from(select b.order_no, c.`type`, sum(cost_amount)cost, sum(party_amount)party
+                                   from t_task_mid a left join t_order_task b on a.tid = b.id left join business_project c on b.commodity_id = c.id
+                                                     left join t_order_new d on b.order_no = d.order_no left join t_order_outsource too on a.tid =too.tid
+                                   where   too.`type` =1 and too.refund_status =1 and d.delete_sign in (0,2) and b.order_no = #{orderNo}
+                                   group by b.order_no , c.`type`)x group by x.order_no)y,t_order_new z
+        set x.cost_amount =y.cost,x.payment_amount =y.party,x.patent_cost =y.zlc,x.patent_cost_actual =y.zlf,
+            x.soft_cost =y.rzc,x.soft_cost_actual =y.rzf,x.audit_cost =y.sjc,x.audit_cost_actual =y.sjf,
+            x.other_cost =qtc,x.other_cost_actual =y.qtf,x.expect_profit =z.total_amount-y.cost,
+            x.actual_profit =z.settlement_amount-y.party
+        where x.order_no =y.order_no and x.order_no=z.order_no
+    </update>
+
     <update id="updateByOrderNo">
         update t_order_mid
         <set>

+ 1 - 0
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -1683,6 +1683,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 //财务管理员和超级管理员查看全部
                 in.setProcessStatus(6);
                 param.put("auditor",TokenManager.getAdminId());
+                if(StringUtils.isNotBlank(in.getAid()))param.put("aid",in.getAid());
             }else if (TokenManager.hasRole(AFTConstants.FINANCE)){
                 //0 设置为财务查看