|
|
@@ -781,9 +781,22 @@
|
|
|
date_format(a.`final_Receivables_time`, '%Y-%m-%d %H:%i:%s')finalReceivablesTime,a.patent_cost patentCost,a.patent_cost_actual patentCostActual ,
|
|
|
a.soft_cost softCost ,a.soft_cost_actual softCostActual ,a.audit_cost auditCost ,a.audit_cost_actual auditCostActual ,a.other_cost otherCost ,
|
|
|
a.other_cost_actual otherCostActual , a.expect_profit expectProfit ,a.actual_profit actualProfit,a.service_type serviceType,
|
|
|
- a.service_project serviceProject,o.examine_name examineName
|
|
|
+ a.service_project serviceProject,o.examine_name examineName,toa.type,toa.type_explain typeExplain
|
|
|
from t_order_new o left join department d on o.order_dep = d.id left join `user` u on o.buyer_id = u.id left join t_order_mid a on o.order_no=a.order_no
|
|
|
- left join (select * from t_order_outsource where type=0) too on o.order_no=too.order_no where delete_sign in(0,2) and o.approval in(0,1,2,4,5,7,8)
|
|
|
+ left join (select * from t_order_outsource where type=0) too on o.order_no=too.order_no
|
|
|
+ left join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
|
|
|
+ from t_order_approval group by order_no) toa on o.order_no=toa.order_no
|
|
|
+ <if test="type !=null">
|
|
|
+ inner join
|
|
|
+ (select distinct order_no
|
|
|
+ from t_order_approval
|
|
|
+ where `type` in
|
|
|
+ <foreach collection="type" item="item" separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ group by order_no) toa2 on o.order_no=toa.order_no
|
|
|
+ </if>
|
|
|
+ where delete_sign in(0,2) and o.approval in(0,1,2,4,5,7,8)
|
|
|
and outsource= #{o.outsource,jdbcType=INTEGER}
|
|
|
<if test="o.processStatus == 3">
|
|
|
and o.process_status = #{o.processStatus,jdbcType=INTEGER}
|
|
|
@@ -871,6 +884,16 @@
|
|
|
<select id="financeCount" parameterType="Map" resultType="java.lang.Integer">
|
|
|
select count(*) from t_order_new o left join `user` u on o.buyer_id = u.id
|
|
|
left join department d on o.order_dep = d.id left join t_order_mid a on o.order_no=a.order_no
|
|
|
+ <if test="type !=null">
|
|
|
+ inner join
|
|
|
+ (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
|
|
|
+ from t_order_approval
|
|
|
+ where `type` in
|
|
|
+ <foreach collection="type" item="item" separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ group by order_no) toa on o.order_no=toa.order_no
|
|
|
+ </if>
|
|
|
where delete_sign in(0,2) and o.approval in(0,1,2,4,5,7,8) and outsource= #{o.outsource,jdbcType=INTEGER}
|
|
|
<if test="o.processStatus == 3">
|
|
|
and o.process_status = #{o.processStatus,jdbcType=INTEGER}
|
|
|
@@ -955,10 +978,11 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
<select id="getSaleIdByOno" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderNewBo">
|
|
|
select o.order_no orderNo ,o.salesman_id as salesmanId, a.name as salesmanName,e.name managerName,
|
|
|
o.contract_no contractNo,a.email ,u.nickname as userName,o.order_dep orderDep,d.name departmentName,
|
|
|
- d.finance_id financeId,d.approval approvalStatus,d.approval_aid approvalAid,ad.name approvalName
|
|
|
+ d.finance_id financeId,d.approval approvalStatus,d.approval_aid approvalAid,ad.name approvalName,
|
|
|
+ d.operation_guarantee_id operationGuaranteeId,ad2.name operationGuaranteeName
|
|
|
from t_order_new o left join admin a on o.salesman_id = a.id left join `user` u on u.id = o.buyer_id
|
|
|
left join department d on o.order_dep=d.id left join admin e on a.manager_id=e.id
|
|
|
- left join admin ad on d.approval_aid=ad.id
|
|
|
+ left join admin ad on d.approval_aid=ad.id left join admin ad2 on d.operation_guarantee_id=ad2.id
|
|
|
where order_no = #{_parameter,jdbcType=VARCHAR}
|
|
|
</select>
|
|
|
|
|
|
@@ -969,7 +993,7 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
a.contract_picture_url contractPictureUrl,
|
|
|
a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
|
|
|
dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
|
|
|
- a.sales_type salesType, a.channel_id channelId ,a.other,a.examine_name examineName,c.stop_project stopProject
|
|
|
+ a.sales_type salesType, a.channel_id channelId ,a.other,a.examine_name examineName,c.stop_project stopProject,toa.type,toa.type_explain typeExplain
|
|
|
<if test="specially == 2">
|
|
|
,f.name as initiateName ,e.reason ,date_format(e.create_time,'%Y-%m-%d' ) as backDate,e.id as backId
|
|
|
</if>
|
|
|
@@ -993,7 +1017,19 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
<if test="specially == 10">
|
|
|
left join admin mg on a.salesman_id=mg.id
|
|
|
</if>
|
|
|
- where a.delete_sign in(0,2)
|
|
|
+ left join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
|
|
|
+ from t_order_approval group by order_no) toa on a.order_no=toa.order_no
|
|
|
+ <if test="type !=null">
|
|
|
+ inner join
|
|
|
+ (select distinct order_no
|
|
|
+ from t_order_approval
|
|
|
+ where `type` in
|
|
|
+ <foreach collection="type" item="item" separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ group by order_no) toa2 on a.order_no=toa2.order_no
|
|
|
+ </if>
|
|
|
+ where a.delete_sign in(0,2)
|
|
|
<include refid="selectOrderNewSql"/>
|
|
|
order by
|
|
|
<if test="specially == 3">
|
|
|
@@ -1046,6 +1082,10 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
and a.process_status = 1 and a.order_status in (0,1,2)
|
|
|
and mg.manager_id= #{aid}
|
|
|
</if>
|
|
|
+ <if test="specially == 11">
|
|
|
+ and a.process_status = 4 and a.approval >0
|
|
|
+ and dep.operation_guarantee_id =#{aid}
|
|
|
+ </if>
|
|
|
<if test="specially == 1">
|
|
|
and a.process_status = 2 and a.order_status in (0,1,2)
|
|
|
</if>
|
|
|
@@ -1111,13 +1151,13 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
and a.process_status = 3
|
|
|
</if>
|
|
|
<if test="distribution == 1">
|
|
|
- and a.process_status = 5
|
|
|
+ and a.process_status = 6
|
|
|
</if>
|
|
|
<if test="distribution == 2">
|
|
|
- and a.process_status = 6
|
|
|
+ and a.process_status = 7
|
|
|
</if>
|
|
|
<if test="distribution == 3">
|
|
|
- and a.process_status = 7
|
|
|
+ and a.process_status = 8
|
|
|
</if>
|
|
|
<if test="name != null">
|
|
|
and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
|
|
|
@@ -1140,6 +1180,9 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
<if test="tag != null">
|
|
|
and a.tag= #{tag}
|
|
|
</if>
|
|
|
+ <if test="approvalType != null">
|
|
|
+ and fina.approval_type = #{approvalType,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
<if test="amountStatus == 0">
|
|
|
and a.total_amount < 10
|
|
|
</if>
|
|
|
@@ -1173,6 +1216,16 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
<if test="specially == 10">
|
|
|
left join admin mg on a.salesman_id=mg.id
|
|
|
</if>
|
|
|
+ <if test="type !=null">
|
|
|
+ inner join
|
|
|
+ (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
|
|
|
+ from t_order_approval
|
|
|
+ where `type` in
|
|
|
+ <foreach collection="type" item="item" separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ group by order_no) toa on a.order_no=toa.order_no
|
|
|
+ </if>
|
|
|
where a.delete_sign in(0,2)
|
|
|
<include refid="selectOrderNewSql"/>
|
|
|
|
|
|
@@ -1344,13 +1397,17 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
g.location_city as locationCity,g.location_area locationArea,g.postal_address postalAddress,outsource,a.primary_order primaryOrder,a.agreement_url agreementUrl,
|
|
|
h.name NowFinance,h.contact_mobile NowFinanceMobile,a.additional_order additionalOrder,i.name as oldSalesmanName, i.contact_mobile oldSalesmanMobile,
|
|
|
a.service_content serviceContent,a.examine_name examineName, tht.knowledge_services knowledgeServices, tht.audit_services auditServices,c.manager_id managerId,
|
|
|
- tht.add_deduction_services addDeductionServices, tht.knowledge_other knowledgeOther, tht.audit_other auditOther, tht.add_deduction_other addDeductionOther
|
|
|
+ tht.add_deduction_services addDeductionServices, tht.knowledge_other knowledgeOther, tht.audit_other auditOther, tht.add_deduction_other addDeductionOther,
|
|
|
+ toa.type,toa.type_explain typeExplain
|
|
|
from t_order_new a left join `user` b on a.buyer_id=b.id left join admin i on a.old_salesman_id=i.id
|
|
|
- left join admin c on a.salesman_id=c.id left join department dep on a.order_dep=dep.id
|
|
|
- left join admin d on a.finance_id=d.id left join admin h on dep.finance_id=h.id
|
|
|
- left join t_order_back e on a.order_no=e.order_no and e.back_status=0
|
|
|
- left join admin f on e.initiate=f.id left join organization_identity g on a.buyer_id=g.uid
|
|
|
- left join t_order_high_tech tht on a.order_no=tht.order_no
|
|
|
+ left join admin c on a.salesman_id=c.id left join department dep on a.order_dep=dep.id
|
|
|
+ left join admin d on a.finance_id=d.id left join admin h on dep.finance_id=h.id
|
|
|
+ left join t_order_back e on a.order_no=e.order_no and e.back_status=0
|
|
|
+ left join admin f on e.initiate=f.id left join organization_identity g on a.buyer_id=g.uid
|
|
|
+ left join t_order_high_tech tht on a.order_no=tht.order_no
|
|
|
+ left join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
|
|
|
+ from t_order_approval where order_no=#{orderNo,jdbcType=VARCHAR}
|
|
|
+ group by order_no) toa on a.order_no=toa.order_no
|
|
|
where a.order_no = #{orderNo,jdbcType=VARCHAR}
|
|
|
</select>
|
|
|
|
|
|
@@ -1437,6 +1494,16 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
select IFNULL( sum(o.settlement_amount),0) actuallyTotalAmount,IFNULL(sum(o.total_amount),0) signTotalAmount
|
|
|
from t_order_new o
|
|
|
left join department d on o.order_dep=d.id left join `user` u on o.buyer_id = u.id left join t_order_mid a on o.order_no=a.order_no
|
|
|
+ <if test="types !=null">
|
|
|
+ inner join
|
|
|
+ (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
|
|
|
+ from t_order_approval
|
|
|
+ where `type` in
|
|
|
+ <foreach collection="types" item="item" separator="," open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ group by order_no) toa on o.order_no=toa.order_no
|
|
|
+ </if>
|
|
|
where o.delete_sign in(0,2,3) and o.approval in(0,1,2,4,5,7,8) and outsource= #{o.outsource,jdbcType=INTEGER}
|
|
|
<if test="o.processStatus == 3">
|
|
|
and o.process_status = #{o.processStatus,jdbcType=INTEGER}
|
|
|
@@ -1959,7 +2026,8 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
</select>
|
|
|
<select id="getProcessName" resultType="com.goafanti.order.bo.OrderProcessName">
|
|
|
select a.order_no orderNo,a.approval,a.process_status processStatus ,b.name yxy,mg.name yxjl,
|
|
|
- yxgly.name yxgly,d.name cwzy, zxsgly.name zxsgly,dsz.name dsz,dep.approval approvalStatus ,da.name approvalName
|
|
|
+ yxgly.name yxgly,d.name cwzy, zxsgly.name zxsgly,dsz.name dsz,dep.approval approvalStatus ,da.name approvalName,
|
|
|
+ dep.operation_guarantee_id, ad2.name yybz
|
|
|
from t_order_new a left join admin b on a.salesman_id =b.id
|
|
|
left join admin mg on b.manager_id =mg.id left join department c on a.order_dep =c.id
|
|
|
left join (select a.department_id depId,group_concat(a.name) name
|
|
|
@@ -1973,6 +2041,7 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
from admin a left join user_role b on a.id=b.uid left join `role` c on b.rid =c.id
|
|
|
where c.role_type in ('9998') and a.status ='0' ) zxsgly on 1=1
|
|
|
left join department dep on a.order_dep =dep.id left join admin da on dep.approval_aid=da.id
|
|
|
+ left join admin ad2 on dep.operation_guarantee_id=ad2.id
|
|
|
where a.order_no = #{orderNo}
|
|
|
</select>
|
|
|
<select id="selectByuidandAid" resultType="com.goafanti.order.bo.TOrderNewBo">
|
|
|
@@ -2060,7 +2129,8 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
where a.order_no =#{orderNo}
|
|
|
</select>
|
|
|
<select id="selectDepByOrderNo" resultType="com.goafanti.common.model.Department">
|
|
|
- select a.id,a.name,a.province,a.finance_id financeId,a.approval ,a.approval_aid approvalAid
|
|
|
+ select a.id,a.name,a.province,a.finance_id financeId,a.approval ,a.approval_aid approvalAid,
|
|
|
+ a.operation_guarantee_id operationGuaranteeId
|
|
|
from department a left join t_order_new b on a.id =b.order_dep
|
|
|
where b.order_no= #{orderNo}
|
|
|
</select>
|