| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ydtech.modules.order.dao.InsOrdersMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.InsOrders">
- <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
- <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
- <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
- <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
- <result property="insCompany" column="ins_company" jdbcType="VARCHAR"/>
- <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="userid" column="userid" jdbcType="VARCHAR"/>
- <result property="username" column="username" jdbcType="VARCHAR"/>
- <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
- <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
- <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
- jdbcType="VARCHAR"/>
- <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
- <result property="productid" column="productid" jdbcType="VARCHAR"/>
- <result property="product" column="product" jdbcType="VARCHAR"/>
- <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
- <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
- <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
- <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
- <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
- <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
- <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
- <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
- <result property="jqpremium" column="jqpremium" jdbcType="VARCHAR"/>
- <result property="sypremium" column="sypremium" jdbcType="VARCHAR"/>
- <result property="jypremium" column="jypremium" jdbcType="VARCHAR"/>
- <result property="taxamount" column="taxamount" jdbcType="VARCHAR"/>
- <result property="risk" column="risk" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="king" column="king" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
- javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="subOrderId" column="subOrderId" jdbcType="VARCHAR"/>
- <result property="agreementCode" column="agreementCode" jdbcType="VARCHAR"/>
- <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
- <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
- <result property="managementSource" column="managementSource" jdbcType="VARCHAR"/>
- </resultMap>
- <resultMap id="OrderResultMap" type="com.ydtech.modules.order.entity.vo.OrderVo">
- <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
- <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
- <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
- <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
- <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="userid" column="userid" jdbcType="VARCHAR"/>
- <result property="username" column="username" jdbcType="VARCHAR"/>
- <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
- <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
- <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
- jdbcType="VARCHAR"/>
- <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
- <result property="productid" column="productid" jdbcType="VARCHAR"/>
- <result property="product" column="product" jdbcType="VARCHAR"/>
- <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
- <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
- <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
- <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
- <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
- <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
- <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
- <result property="id" column="id" jdbcType="BIGINT"/>
- <result property="companyId" column="company_id" jdbcType="BIGINT"/>
- <result property="reptxt" column="reptxt" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
- javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
- <result property="jqapplyno" column="jqapplyno" jdbcType="VARCHAR"/>
- <result property="jqpolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
- <result property="syapplyno" column="syapplyno" jdbcType="VARCHAR"/>
- <result property="sypolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
- <result property="riskinfo" column="riskinfo" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="kindinfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="jqpremium" column="jqpremium" jdbcType="DECIMAL"/>
- <result property="sypremium" column="sypremium" jdbcType="DECIMAL"/>
- <result property="jypremium" column="jypremium" jdbcType="DECIMAL"/>
- <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
- <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
- <result property="jqdiscountrate" column="jqdiscountrate" jdbcType="DOUBLE"/>
- <result property="sydiscountrate" column="sydiscountrate" jdbcType="DOUBLE"/>
- <result property="feerate" column="feerate" jdbcType="DOUBLE"/>
- <result property="disrate" column="disrate" jdbcType="DOUBLE"/>
- <result property="auditid" column="auditid" jdbcType="VARCHAR"/>
- <result property="auditname" column="auditname" jdbcType="VARCHAR"/>
- <result property="audittime" column="audittime" jdbcType="TIMESTAMP"/>
- <result property="auditopinion" column="auditopinion" jdbcType="VARCHAR"/>
- <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
- <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
- <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
- <result property="paymentLink" column="payment_link" jdbcType="VARCHAR"/>
- <result property="accidentInfo" column="accident_info" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="taxArrears" column="tax_arrears" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="ubiPredictedInfoScore" column="ubi_predicted_info_score" jdbcType="VARCHAR"/>
- <result property="signingTime" column="signingTime" jdbcType="TIMESTAMP"/>
- <result property="payDate" column="payDate" jdbcType="TIMESTAMP"/>
- <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
- </resultMap>
- <resultMap id="OrderExcelResultMap" type="com.ydtech.modules.ins.model.InsOrdersExcel">
- <id property="orderNo" column="orderno" jdbcType="VARCHAR"/>
- <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
- <result property="fraMeno" column="frameno" jdbcType="VARCHAR"/>
- <result property="carInfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="score" column="score" jdbcType="VARCHAR"/>
- <result property="ownerInfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="jqpRemIum" column="jqpremium" jdbcType="VARCHAR"/>
- <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
- <result property="jqPolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
- <result property="sypRemIum" column="sypremium" jdbcType="VARCHAR"/>
- <result property="syPolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
- <result property="jypRemIum" column="jypremium" jdbcType="VARCHAR"/>
- <result property="taxaMount" column="taxamount" jdbcType="VARCHAR"/>
- <result property="jqStartDate" column="jq_start_date" jdbcType="VARCHAR"/>
- <result property="jqEndDate" column="jq_end_date" jdbcType="VARCHAR"/>
- <result property="syStartDate" column="sy_start_date" jdbcType="VARCHAR"/>
- <result property="syEndDate" column="sy_end_date" jdbcType="VARCHAR"/>
- <result property="jqScore" column="jq_score" jdbcType="VARCHAR"/>
- <result property="syScore" column="sy_score" jdbcType="VARCHAR"/>
- <result property="lossRation" column="loss_ration" jdbcType="VARCHAR"/>
- <result property="jqLossRation" column="jq_loss_ration" jdbcType="VARCHAR"/>
- <result property="syLossRation" column="sy_loss_ration" jdbcType="VARCHAR"/>
- <result property="insCompany" column="inscompany" jdbcType="VARCHAR"/>
- <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
- <result property="userId" column="userid" jdbcType="VARCHAR"/>
- <result property="userName" column="username" jdbcType="VARCHAR"/>
- <result property="applyInfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="insureInfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="kindInfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="payDate" column="pay_date" jdbcType="VARCHAR"/>
- <result property="signingTime" column="signing_time" jdbcType="VARCHAR"/>
- <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="Base_Column_List">
- orderno,quoteno,orderstatus,
- carinfo,userid,username,
- deptid,deptname,ownerinfo,
- applyinfo,insureinfo,agreeid,
- productid,product,createtime,
- frameno,licenseno,insuredname,
- jqstartdate,jqenddate,systartdate,
- syenddate
- </sql>
- <select id="getOrderAndAreaCompany" parameterType="java.lang.String" resultMap="OrderResultMap">
- select o.orderno,
- o.quoteno,
- o.carinfo,
- o.userid,
- o.username,
- o.deptid,
- o.deptname,
- o.ownerinfo,
- o.applyinfo,
- o.insureinfo,
- o.agreeid,
- o.productid,
- o.product,
- o.frameno,
- o.licenseno,
- o.insuredname,
- o.vehicle_and_vessel_tax,
- o.is_external,
- iac.jq_start_date as jqstartdate,
- iac.jq_end_date as jqenddate,
- iac.sy_start_date as systartdate,
- iac.sy_end_date as syenddate,
- iac.id,
- iac.api_type,
- iac.company_id,
- iac.reptxt,
- iac.orderstatus,
- iac.inscompany,
- iac.jqapplyno,
- iac.jqpolicyno,
- iac.syapplyno,
- iac.sypolicyno,
- iac.riskinfo,
- iac.kindinfo,
- iac.jqpremium,
- iac.sypremium,
- iac.jypremium,
- iac.taxamount,
- iac.sumpremium,
- iac.jqdiscountrate,
- iac.sydiscountrate,
- iac.feerate,
- iac.disrate,
- iac.auditid,
- iac.auditname,
- iac.audittime,
- iac.auditopinion,
- iac.jqappoint,
- iac.syappoint,
- iac.createtime,
- iac.payment_link,
- iac.accident_info,
- iac.tax_arrears,
- iac.cross_insurance,
- iac.ubi_predicted_info_score,
- iac.signing_time as signingTime,
- iac.pay_date as payDate,
- eic.namesimple as partnerCompaniesName
- from ins_orders as o
- join ins_area_company iac on o.orderno = iac.orderno
- LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
- LEFT JOIN esm_ins_company eic on eic.id = pa.partner_companies_id
- where iac.id = #{companyId}
- </select>
- <select id="getByUseridAndLicenseNo" resultType="com.ydtech.modules.order.entity.InsOrders"
- parameterType="com.ydtech.modules.order.entity.vo.VerifyOrdersVo">
- select orderno,
- quoteno,
- orderstatus,
- carinfo,
- userid,
- username,
- deptid,
- deptname,
- ownerinfo,
- applyinfo,
- insureinfo,
- agreeid,
- productid,
- product,
- createtime,
- frameno,
- licenseno,
- insuredname,
- jqstartdate,
- jqenddate,
- systartdate,
- syenddate,
- risk,
- king,
- vehicle_and_vessel_tax
- from ins_orders
- where userid = #{userId, jdbcType=VARCHAR}
- and licenseno = #{licenseNo, jdbcType=VARCHAR}
- and createtime > DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
- </select>
- <select id="queryPageOrderCount" resultType="Long">
- select
- count(1)
- from (
- select
- io.orderno
- from
- ins_orders io
- <!--如果存在 公司查询则进行连表 -->
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- left JOIN
- ins_area_company iac on iac.orderno = io.orderno
- </if>
- <where>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and io.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <!--
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
- and io.operatorid = #{orderQueryVo.userId}
- </if>
- -->
- <choose>
- <when test="isCdy">
- <if test="deptId != null and deptId != '' ">
- and io.deptid like "${deptId}%"
- </if>
- </when>
- <otherwise>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
- and io.userid = #{orderQueryVo.userId}
- </if>
- </otherwise>
- </choose>
- </where>
- group by io.orderno
- ) as s
- </select>
- <select id="queryPageOrder" resultMap="BaseResultMap">
- select
- io.*
- from
- ins_orders io
- <!--如果存在 公司查询则进行连表 -->
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- left JOIN
- ins_area_company iac on iac.orderno = io.orderno
- </if>
- <where>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and io.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.product != null and orderQueryVo.product != ''">
- and io.product = #{orderQueryVo.product}
- </if>
- <if test="orderQueryVo.productid != null and orderQueryVo.productid != ''">
- and io.productid = #{orderQueryVo.productid}
- </if>
- <!--
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
- and io.operatorid = #{orderQueryVo.userId}
- </if>
- -->
- <choose>
- <when test="isCdy">
- <if test="deptId != null and deptId != '' ">
- and io.deptid like "${deptId}%"
- </if>
- </when>
- <otherwise>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
- and io.userid = #{orderQueryVo.userId}
- </if>
- </otherwise>
- </choose>
- </where>
- group by
- orderno
- order by io.createtime desc
- </select>
- <select id="queryOrderList" parameterType="com.ydtech.modules.ins.model.InsOrdersExcelVo" resultMap="OrderExcelResultMap">
- select
- a.orderno,
- a.licenseno,
- a.frameno,
- a.carinfo,
- b.api_type,
- b.score,
- a.ownerinfo,
- b.jqpremium,
- b.jqpolicyno,
- b.sypremium,
- b.sypolicyno,
- b.jypremium,
- b.taxamount,
- b.jq_start_date,
- b.jq_end_date,
- b.sy_start_date,
- b.sy_end_date,
- b.score,
- b.jq_score,
- b.sy_score,
- b.loss_ration,
- b.jq_loss_ration,
- b.sy_loss_ration,
- b.score,
- b.inscompany,
- b.agreement_id,
- a.userid,
- a.username,
- a.applyinfo,
- a.insureinfo,
- b.kindinfo,
- b.pay_date,
- b.signing_time,
- b.cross_insurance
- FROM ins_orders a LEFT JOIN ins_area_company b on a.orderno = b.orderno
- WHERE
- 1 = 1
- <if test="orderstatus != null and orderstatus != '' ">
- and b.orderstatus = #{orderstatus}
- </if>
- <if test="startDate != null ">
- and b.signing_time >= #{startDate}
- </if>
- <if test="endDate != null ">
- and b.signing_time <= #{endDate}
- </if>
- </select>
- <resultMap id="PolicyInsuranceReportMap" type="com.ydtech.modules.order.entity.vo.PolicyInsuranceReportResVo">
- <result property="insCompany" column="insCompany" jdbcType="VARCHAR"/>
- <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
- <result property="policyNo" column="policyNo" jdbcType="VARCHAR"/>
- <result property="quoteDate" column="quoteDate" jdbcType="VARCHAR"/>
- <result property="policyStartDate" column="policyStartDate" jdbcType="VARCHAR"/>
- <result property="riskName" column="riskName" jdbcType="VARCHAR"/>
- <result property="sumPremium" column="sumPremium" jdbcType="DECIMAL"/>
- <result property="taxPremium" column="taxPremium" jdbcType="DECIMAL"/>
- <result property="taxLaterPremium" column="taxLaterPremium" jdbcType="DECIMAL"/>
- <result property="insuranceSubAmount" column="insuranceSubAmount" jdbcType="VARCHAR"/>
- <result property="licenseNo" column="licenseNo" jdbcType="VARCHAR"/>
- <result property="vehicleUse" column="vehicleUse" jdbcType="VARCHAR"/>
- <result property="powerType" column="powerType" jdbcType="VARCHAR"/>
- <result property="ciModelClass" column="ciModelClass" jdbcType="VARCHAR"/>
- <result property="limitLoad" column="limitLoad" jdbcType="VARCHAR"/>
- <result property="appliName" column="appliName" jdbcType="VARCHAR"/>
- <result property="insureName" column="insureName" jdbcType="VARCHAR"/>
- <result property="deptName" column="deptName" jdbcType="VARCHAR"/>
- <result property="userName" column="username" jdbcType="VARCHAR"/>
- </resultMap>
- <select id="getPolicyInsuranceReport" resultMap="PolicyInsuranceReportMap">
- /*交强数据*/
- SELECT a.`inscompany` AS insCompany,
- (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
- a.`jqpolicyno` AS policyNo,
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- a.pay_date AS quoteDate,
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- a.inside_pay_time AS quoteDate,
- </if>
- a.`jq_start_date` AS policyStartDate,
- '交强险' AS riskName,
- a.`jqpremium` AS sumPremium,
- a.`taxamount` AS taxPremium,
- getCarShipLateFee(a.`id`) AS taxLaterPremium,
- '交强险 : 200000.00,' AS insuranceSubAmount,
- b.`licenseno` AS licenseNo,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
- REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
- REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
- REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
- b.`deptname` AS deptName,
- b.`username` AS userName
- FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
- AND a.`orderno`=b.`orderno`
- <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
- and b.deptid = #{policyReqVo.deptId}
- </if>
- <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
- and b.userid = #{policyReqVo.userId}
- </if>
- <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
- and b.username = #{policyReqVo.userName}
- </if>
- <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
- and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
- </if>
- <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
- and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
- </if>
- <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
- and b.productid = #{policyReqVo.productId}
- </if>
- <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
- and a.company_id = #{policyReqVo.insCompany}
- </if>
- <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
- and a.operatorid = #{policyReqVo.operatorId}
- </if>
- <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- </if>
- <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
- and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
- </if>
- UNION ALL
- /*##商业数据*/
- SELECT a.`inscompany` AS insCompany,
- (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
- a.`sypolicyno` AS policyNo,
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- a.pay_date AS quoteDate,
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- a.inside_pay_time AS quoteDate,
- </if>
- a.`sy_start_date` AS policyStartDate,
- '商业险' AS riskName,
- a.`sypremium` AS sumPremium,
- '' AS taxPremium,
- '' AS taxLaterPremium,
- getSyAmount(a.`orderno`) AS insuranceSubAmount,
- b.`licenseno` AS licenseNo,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
- REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
- REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
- REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
- b.`deptname` AS deptName,
- b.`username` AS userName
- FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
- AND a.`orderno`=b.`orderno`
- <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
- and b.deptid = #{policyReqVo.deptId}
- </if>
- <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
- and b.userid = #{policyReqVo.userId}
- </if>
- <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
- and b.username = #{policyReqVo.userName}
- </if>
- <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
- and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
- </if>
- <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
- and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
- </if>
- <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
- and b.productid = #{policyReqVo.productId}
- </if>
- <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
- and a.company_id = #{policyReqVo.insCompany}
- </if>
- <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
- and a.operatorid = #{policyReqVo.operatorId}
- </if>
- <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- </if>
- <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
- and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
- </if>
- </select>
- <select id="getPolicyInsuranceReportCount" resultType="Long">
- select
- count(1)
- from (
- /*交强数据*/
- SELECT a.`inscompany` AS insCompany,
- (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
- a.`jqpolicyno` AS policyNo,
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- a.pay_date AS quoteDate,
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- a.inside_pay_time AS quoteDate,
- </if>
- a.`jq_start_date` AS policyStartDate,
- '交强险' AS riskName,
- a.`jqpremium` AS sumPremium,
- a.`taxamount` AS taxPremium,
- getCarShipLateFee(a.`id`) AS taxLaterPremium,
- '交强险 : 200000.00,' AS insuranceSubAmount,
- b.`licenseno` AS licenseNo,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
- REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
- REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
- REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
- b.`deptname` AS deptName,
- b.`username` AS userName
- FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
- AND a.`orderno`=b.`orderno`
- <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
- and b.deptid = #{policyReqVo.deptId}
- </if>
- <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
- and b.userid = #{policyReqVo.userId}
- </if>
- <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
- and b.username = #{policyReqVo.userName}
- </if>
- <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
- and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
- </if>
- <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
- and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
- </if>
- <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
- and b.productid = #{policyReqVo.productId}
- </if>
- <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
- and a.company_id = #{policyReqVo.insCompany}
- </if>
- <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
- and a.operatorid = #{policyReqVo.operatorId}
- </if>
- <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- </if>
- <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
- and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
- </if>
- UNION ALL
- /*##商业数据*/
- SELECT a.`inscompany` AS insCompany,
- (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
- a.`sypolicyno` AS policyNo,
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- a.pay_date AS quoteDate,
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- a.inside_pay_time AS quoteDate,
- </if>
- a.`sy_start_date` AS policyStartDate,
- '商业险' AS riskName,
- a.`sypremium` AS sumPremium,
- '' AS taxPremium,
- '' AS taxLaterPremium,
- getSyAmount(a.`orderno`) AS insuranceSubAmount,
- b.`licenseno` AS licenseNo,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
- REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
- REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
- REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
- b.`deptname` AS deptName,
- b.`username` AS userName
- FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
- AND a.`orderno`=b.`orderno`
- <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
- and b.deptid = #{policyReqVo.deptId}
- </if>
- <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
- and b.userid = #{policyReqVo.userId}
- </if>
- <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
- and b.username = #{policyReqVo.userName}
- </if>
- <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
- and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
- </if>
- <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
- and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
- </if>
- <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
- and b.productid = #{policyReqVo.productId}
- </if>
- <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
- and a.company_id = #{policyReqVo.insCompany}
- </if>
- <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
- and a.operatorid = #{policyReqVo.operatorId}
- </if>
- <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- </if>
- <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
- and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
- </if>
- ) as s
- </select>
- <update id="updateStatus">
- update ins_orders set orderstatus = #{status} where orderno = #{orderno}
- </update>
- <select id="queryPageHospitalityOrder" resultMap="BaseResultMap">
- select
- io.*,
- iac.orderno
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- ,eic.namesimple as partnerCompaniesName
- </if>
- from
- ins_orders io
- left JOIN
- ins_area_company iac on iac.orderno = io.orderno
- LEFT JOIN
- ptl_agreement pa on pa.id = iac.agreement_id
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- LEFT JOIN
- esm_ins_company eic on eic.id = pa.partner_companies_id
- </if>
- <where>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' ">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and io.orderstatus = #{orderQueryVo.orderStatus}
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- and iac.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
- and io.userid = #{orderQueryVo.userId}
- </if>
- </where>
- group by io.orderno
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- ,eic.namesimple
- </if>
- order by io.createtime desc
- </select>
- <select id="queryPageHospitalityOrderCount" resultType="Long">
- select
- count(1)
- from (
- select
- io.orderno
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- ,eic.namesimple as partnerCompaniesName
- </if>
- from
- ins_orders io
- left JOIN
- ins_area_company iac on iac.orderno = io.orderno
- LEFT JOIN
- ptl_agreement pa on pa.id = iac.agreement_id
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- LEFT JOIN
- esm_ins_company eic on eic.id = pa.partner_companies_id
- </if>
- <where>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' ">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and io.orderstatus = #{orderQueryVo.orderStatus}
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- and iac.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
- and io.userid = #{orderQueryVo.userId}
- </if>
- </where>
- group by io.orderno
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- ,eic.namesimple
- </if>
- order by io.createtime desc
- ) as s
- </select>
- <select id="queryPageOrderByLinkType" resultMap="BaseResultMap">
- select
- io.orderno as orderno,
- io.quoteno as quoteno,
- iac.orderstatus as orderstatus,
- io.carinfo as carinfo,
- io.userid as userid,
- io.username as username,
- io.deptid as deptid,
- io.deptname as deptname,
- io.ownerinfo as ownerinfo,
- io.applyinfo as applyinfo,
- io.insureinfo as insureinfo,
- io.agreeid as agreeid,
- iac.productid as productid,
- iac.product as product,
- iac.createtime as createtime,
- io.frameno as frameno,
- io.licenseno as licenseno,
- io.insuredname as insuredname,
- iac.jq_start_date as jqstartdate,
- iac.jq_end_date as jqenddate,
- iac.sy_start_date as systartdate,
- iac.sy_end_date as syenddate,
- iac.jqpremium as jqpremium,
- iac.sypremium as sypremium,
- iac.jypremium as jypremium,
- iac.taxamount as taxamount,
- io.risk as risk,
- io.king as king,
- io.vehicle_and_vessel_tax as vehicleAndVesselTax,
- iac.id as subOrderId,
- iac.company_id as company_id,
- iac.inscompany as ins_company,
- agree.agreement_code as agreementCode,
- agree.agreement_name as agreementName,
- company.namesimple as partnerCompaniesName,
- iac.api_type,
- io.is_external,
- CASE dept.management_source
- WHEN '1' THEN '渠道'
- WHEN '2' THEN '个代'
- WHEN '3' THEN '电销'
- ELSE '' END
- AS managementSource
- from
- ins_area_company iac
- left JOIN
- ins_orders io on iac.orderno = io.orderno
- left join
- ptl_agreement agree on iac.agreement_id= agree.id
- left join
- esm_ins_company company on agree.partner_companies_id= company.id
- LEFT JOIN
- sys_dept dept ON dept.id = io.deptid
- <where>
- <if test="agentUserIds != null and agentUserIds.size>0" >
- AND (
- (io.userid in
- <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
- <if test="deptIds != null and deptIds.size>0" >
- AND (
- <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
- io.deptid like CONCAT('', #{item}, '%')
- </foreach>
- )
- </if>
- )
- <if test="flag" >
- OR iac.operator_id = #{orderQueryVo.userId}
- </if>
- )
- </if>
- <if test="agreeIds != null and agreeIds.size>0">
- AND (
- (iac.agreement_id in
- <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
- <if test="flag" >
- OR iac.operator_id = #{orderQueryVo.userId}
- </if>
- )
- </if>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and iac.id = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource != ''">
- and dept.management_source = #{orderQueryVo.managementSource}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and iac.orderstatus= #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
- and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{orderQueryVo.quoteStartDateStr} AND #{orderQueryVo.quoteEndDateStr}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
- and io.userid = #{orderQueryVo.operatorId}
- </if>
- <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
- and io.username = #{orderQueryVo.operatorName}
- </if>
- <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
- and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
- </if>
- <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
- and io.deptid like "${orderQueryVo.provinceId}%"
- </if>
- <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
- and io.deptid like "${orderQueryVo.cityId}%"
- </if>
- <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
- and io.deptid like "${orderQueryVo.countyId}%"
- </if>
- <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
- and io.deptid like "${orderQueryVo.houseId}%"
- </if>
- <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
- and iac.agreement_id = #{orderQueryVo.agreeId}
- </if>
- <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
- and io.orderno = #{orderQueryVo.taskNo}
- </if>
- <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
- and iac.product = #{orderQueryVo.riskCode}
- </if>
- <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
- and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
- </if>
- <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
- and ((
- DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
- AND #{orderQueryVo.attachEndDateStr}
- )
- OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
- )
- </if>
- <choose>
- <when test="type==1">
- and dept.management_source=1
- </when>
- <when test="type==2">
- and dept.management_source=2
- </when>
- </choose>
- </where>
- order by io.createtime desc
- </select>
- <select id="queryPageOrderByLinkTypeCount" resultType="Long">
- select
- count(1)
- from (
- select
- (0)
- from
- ins_area_company iac
- left JOIN
- ins_orders io on iac.orderno = io.orderno
- LEFT JOIN
- sys_dept dept ON dept.id = io.deptid
- <where>
- <if test="agentUserIds != null and agentUserIds.size>0" >
- AND (
- (io.userid in
- <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
- <if test="deptIds != null and deptIds.size>0" >
- AND (
- <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
- io.deptid like CONCAT('', #{item}, '%')
- </foreach>
- )
- </if>
- )
- <if test="flag" >
- OR iac.operator_id = #{orderQueryVo.userId}
- </if>
- )
- </if>
- <if test="agreeIds != null and agreeIds.size>0">
- AND (
- (iac.agreement_id in
- <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
- <if test="flag" >
- OR iac.operator_id = #{orderQueryVo.userId}
- </if>
- )
- </if>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and iac.id = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource != ''">
- and dept.management_source = #{orderQueryVo.managementSource}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and iac.orderstatus= #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
- and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{orderQueryVo.quoteStartDateStr} AND #{orderQueryVo.quoteEndDateStr}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
- and io.userid = #{orderQueryVo.operatorId}
- </if>
- <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
- and io.username = #{orderQueryVo.operatorName}
- </if>
- <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
- and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
- </if>
- <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
- and io.deptid like "${orderQueryVo.provinceId}%"
- </if>
- <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
- and io.deptid like "${orderQueryVo.cityId}%"
- </if>
- <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
- and io.deptid like "${orderQueryVo.countyId}%"
- </if>
- <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
- and io.deptid like "${orderQueryVo.houseId}%"
- </if>
- <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
- and iac.agreement_id = #{orderQueryVo.agreeId}
- </if>
- <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
- and io.orderno = #{orderQueryVo.taskNo}
- </if>
- <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
- and iac.product = #{orderQueryVo.riskCode}
- </if>
- <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
- and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
- </if>
- <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
- and ((
- DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
- AND #{orderQueryVo.attachEndDateStr}
- )
- OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
- )
- </if>
- <choose>
- <when test="type==1">
- and dept.management_source=1
- </when>
- <when test="type==2">
- and dept.management_source=2
- </when>
- </choose>
- </where>
- ) as s
- </select>
- <select id="queryPageSubOrders" resultMap="BaseResultMap">
- select
- io.*,
- iac.id as subOrderId
- from
- ins_area_company iac
- left JOIN
- ins_orders io on iac.orderno = io.orderno
- <where>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
- and io.userid = #{orderQueryVo.userid}
- </if>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.quoteNo != null and orderQueryVo.quoteNo != ''">
- and io.quoteno = #{orderQueryVo.quoteNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and iac.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
- and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
- and iac.product = #{orderQueryVo.riskCode}
- </if>
- <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
- and IFNULL( io.agreeid, '' ) = #{orderQueryVo.auditId}
- </if>
- <if test="orderQueryVo.policyStartDate != null and orderQueryVo.policyEndDate != ''">
- and ((
- io.jqstartdate BETWEEN #{orderQueryVo.policyStartDate}
- AND #{orderQueryVo.policyEndDate}
- )
- OR ( io.systartdate BETWEEN #{orderQueryVo.policyStartDate} AND #{orderQueryVo.policyEndDate} )
- )
- </if>
- </where>
- group by iac.id
- order by io.createtime desc
- </select>
- <select id="queryPageSubOrdersCount" resultType="Long">
- select
- count(1)
- from (
- select
- io.*
- from
- ins_area_company iac
- left JOIN
- ins_orders io on iac.orderno = io.orderno
- <where>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
- and io.userid = #{orderQueryVo.userid}
- </if>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.quoteNo != null and orderQueryVo.quoteNo != ''">
- and io.quoteno = #{orderQueryVo.quoteNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and iac.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
- and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
- and iac.product = #{orderQueryVo.riskCode}
- </if>
- <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
- and IFNULL( io.agreeid, '' ) = #{orderQueryVo.auditId}
- </if>
- <if test="orderQueryVo.policyStartDate != null and orderQueryVo.policyEndDate != ''">
- and ((
- io.jqstartdate BETWEEN #{orderQueryVo.policyStartDate}
- AND #{orderQueryVo.policyEndDate}
- )
- OR ( io.systartdate BETWEEN #{orderQueryVo.policyStartDate} AND #{orderQueryVo.policyEndDate} )
- )
- </if>
- </where>
- group by iac.id
- ) as s
- </select>
- <select id="selectEntityByinsOrderNo" resultMap="OrderResultMap">
- select o.orderno,
- o.quoteno,
- o.frameno,
- o.licenseno,
- iac.jq_start_date as jqstartdate,
- iac.jq_end_date as jqenddate,
- iac.sy_start_date as systartdate,
- iac.sy_end_date as syenddate,
- iac.id,
- iac.company_id,
- iac.reptxt,
- iac.orderstatus,
- iac.inscompany,
- iac.jqapplyno,
- iac.jqpolicyno,
- iac.syapplyno,
- iac.sypolicyno,
- iac.riskinfo,
- iac.kindinfo,
- iac.jqpremium,
- iac.sypremium,
- iac.jypremium,
- iac.taxamount,
- iac.sumpremium,
- iac.jqdiscountrate,
- iac.sydiscountrate,
- iac.feerate,
- iac.disrate,
- iac.auditid,
- iac.auditname,
- iac.audittime,
- iac.auditopinion,
- iac.jqappoint,
- iac.syappoint,
- iac.createtime,
- iac.payment_link,
- iac.accident_info,
- iac.tax_arrears,
- iac.cross_insurance,
- iac.ubi_predicted_info_score
- from ins_area_company iac
- join ins_orders as o on o.orderno = iac.orderno
- where
- iac.id = #{insOrderNo}
- <if test="timeFiltering != null and timeFiltering != ''">
- and DATE_FORMAT(iac.signing_time, '%Y-%m') = #{timeFiltering}
- </if>
- </select>
- <select id="getExpirationInsureCount" resultType="Integer">
- SELECT
- count( b.orderno ) AS count
- FROM
- ins_orders a
- left join
- ins_area_company b
- on a.orderno = b.orderno
- WHERE
- <if test="isJq == 1">
- jqenddate BETWEEN #{startDate} AND #{endDate}
- </if>
- <if test="isJq == 2">
- syenddate BETWEEN #{startDate} AND #{endDate}
- </if>
- AND a.orderstatus = 3
- AND b.orderstatus = 3
- <if test="param != null and param != ''">
- AND (a.licenseno = #{param} or a.ins_company = #{param})
- </if>
- <if test="userId != null and userId != ''">
- AND a.userid = #{userId}
- </if>
- </select>
- <select id="getExpirationInsure" resultType="com.ydtech.modules.order.entity.vo.OrderExpirationVo">
- SELECT
- a.ins_company,
- b.id as orderno,
- b.jq_end_date,
- b.sy_end_date,
- b.productid,
- b.product,
- a.licenseno,
- case when b.jq_end_date is not null then DATEDIFF( b.jq_end_date,NOW() ) else null end AS jqDiff,
- case when b.sy_end_date is not null then DATEDIFF( b.sy_end_date,NOW() ) else null end AS syDiff
- FROM ins_orders a,ins_area_company b
- WHERE a.orderno = b.orderno
- AND (b.jq_end_date BETWEEN #{order.jqStartDate} AND #{order.jqEndDate} or b.sy_end_date BETWEEN #{order.syStartDate} AND #{order.syEndDate})
- AND b.orderstatus = 3
- <if test="order.param != null and order.param != ''">
- AND (a.licenseno = #{order.param} or a.ins_company = #{order.param})
- </if>
- <if test="order.userid != null and order.userid != ''">
- AND a.userid = #{order.userid}
- </if>
- ORDER BY least(IFNULL(jqDiff, 9999999) , IFNULL(syDiff, 9999999)) asc
- </select>
- <select id="getCarBusinessDetailList" resultType="com.ydtech.modules.order.entity.vo.CarBusinessDetailVo">
- SELECT
- io.username,
- iac.signing_time as sign_date,
- io.licenseno,
- JSON_UNQUOTE(json_extract(io.applyinfo, '$.name')) as applyname,
- io.product,
- io.ins_company as inscompany,
- iac.jqpremium,
- iac.sypremium,
- iac.jypremium,
- iac.taxamount,
- ifo.jq_costs_export_proportion+ifo.jq_export_other_costs_proportion as jq_export_proportion,
- ifo.sy_costs_export_proportion+ifo.sy_export_other_costs_proportion as sy_export_proportion,
- ifo.no_costs_export_proportion+ifo.no_export_other_costs_proportion as no_export_proportion,
- ifo.jq_export_supervise_costs_premiums + ifo.sy_export_supervise_costs_premiums + ifo.no_export_supervise_costs_premiums + ifo.jq_export_other_costs_premiums + ifo.sy_export_other_costs_premiums + ifo.no_export_other_costs_premiums as settlement,
- CASE ifa.auditstatus
- WHEN 1 THEN
- '已审核'
- ELSE
- '未审核'
- END as audittype,
- ifa.audittime as audit_date
- FROM
- ins_orders io
- LEFT JOIN ins_area_company iac ON io.orderno = iac.orderno
- LEFT JOIN ins_fee_order_new ifo ON iac.id = ifo.ins_order_no
- left join ins_fee_audit ifa on ifo.ins_order_no = ifa.ins_order_no
- WHERE
- io.userid = #{userId}
- AND io.orderstatus = 3
- AND iac.orderstatus = 3
- AND iac.signing_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
- </select>
- <select id="getRevenueExpenditureDetailList" resultType="com.ydtech.modules.order.entity.vo.RevenueExpenditureDetailVo">
- SELECT
- sua.create_time,
- io.licenseno,
- sua.amount,
- sua.business_eegments_type,
- sua.documentary,
- sua.property
- FROM
- sys_user_account_history sua
- left join ins_area_company iac on sua.suborder = iac.id
- left join ins_orders io on iac.orderno = io.orderno
- WHERE
- (sua.property != 1 and sua.property != 2)
- AND
- user_id = #{userId}
- AND
- sua.create_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
- </select>
- <select id="getAuditExportList" resultType="com.ydtech.modules.order.entity.vo.AuditExportVo">
- SELECT
- iac.company_id,
- iac.api_type,
- iac.cross_insurance,
- io.username,
- iac.signing_time,
- io.licenseno,
- JSON_UNQUOTE(json_extract(io.applyinfo, '$.name')) as applyname,
- io.ins_company,
- io.product,
- eic.namesimple,
- iac.jqapplyno,
- iac.syapplyno,
- iac.cross_insurance,
- iac.jqpremium,
- iac.sypremium,
- iac.jypremium,
- iac.taxamount,
- ifo.jq_costs_export_proportion + ifo.jq_export_other_costs_proportion AS jq_export_proportion,
- ifo.sy_costs_export_proportion+ifo.sy_export_other_costs_proportion as sy_export_proportion,
- ifo.no_costs_export_proportion+ifo.no_export_other_costs_proportion as no_export_proportion,
- ifo.jq_export_supervise_costs_premiums + ifo.sy_export_supervise_costs_premiums + ifo.no_export_supervise_costs_premiums + ifo.jq_export_other_costs_premiums + ifo.sy_export_other_costs_premiums + ifo.no_export_other_costs_premiums as settlement,
- ifo.jq_supervise_costs_proportion + ifo.jq_other_costs_proportion as jq_entrance_proportion,
- ifo.sy_supervise_costs_proportion + ifo.sy_other_costs_proportion as sy_entrance_proportion,
- ifo.no_supervise_costs_proportion + ifo.no_other_costs_proportion as no_entrance_proportion,
- ifo.jq_supervise_costs_premiums + ifo.jq_other_costs_premiums + ifo.sy_supervise_costs_premiums + ifo.sy_other_costs_premiums + ifo.no_supervise_costs_premiums + ifo.no_other_costs_premiums as receivable,
- ifo.jq_dept_premiums_level_1 + ifo.sy_dept_premiums_level_1 + ifo.no_dept_premiums_level_1 as dept_premiums_level_1,
- ifo.jq_dept_premiums_level_2 + ifo.sy_dept_premiums_level_2 + ifo.no_dept_premiums_level_2 as dept_premiums_level_2,
- ifo.jq_dept_premiums_level_3 + ifo.sy_dept_premiums_level_3 + ifo.no_dept_premiums_level_3 as dept_premiums_level_3,
- ifo.jq_dept_premiums_level_4 + ifo.sy_dept_premiums_level_4 + ifo.no_dept_premiums_level_4 as dept_premiums_level_4,
- ifo.jq_dept_premiums_level_5 + ifo.sy_dept_premiums_level_5 + ifo.no_dept_premiums_level_5 as dept_premiums_level_5,
- ifo.first_detail_premiums,
- ifo.second_detail_premiums,
- ifo.third_detail_premiums,
- ifo.jq_profit_margin_premiums,
- ifo.sy_profit_margin_premiums,
- ifo.no_profit_margin_premiums,
- io.is_external
- FROM
- ins_fee_order_new ifo
- LEFT JOIN ins_fee_audit ifa ON ifo.ins_order_no = ifa.ins_order_no
- left join ins_area_company iac on ifa.ins_order_no = iac.id
- left join ins_orders io on iac.orderno = io.orderno
- left join ptl_agreement pa on iac.agreement_id = pa.id
- left join esm_ins_company eic on pa.partner_companies_id = eic.id
- WHERE
- iac.signing_time between #{param.signStartDate} and #{param.signEndDate}
- <if test="param.audit != null and param.audit != ''">
- AND
- ifa.auditstatus = #{param.audit}
- AND
- io.orderstatus = 3
- AND
- iac.orderstatus = 3
- GROUP BY
- io.orderno,
- iac.api_type,
- iac.cross_insurance,
- iac.signing_time,
- eic.namesimple,
- iac.jqapplyno,
- iac.syapplyno,
- iac.jqpremium,
- iac.company_id,
- iac.sypremium,
- iac.jypremium,
- iac.taxamount,
- ifo.jq_costs_export_proportion,
- ifo.jq_export_other_costs_proportion,
- ifo.sy_costs_export_proportion,
- ifo.sy_export_other_costs_proportion,
- ifo.no_costs_export_proportion,
- ifo.no_export_other_costs_proportion,
- ifo.jq_export_supervise_costs_premiums,
- ifo.sy_export_supervise_costs_premiums,
- ifo.no_export_supervise_costs_premiums,
- ifo.jq_export_other_costs_premiums,
- ifo.sy_export_other_costs_premiums,
- ifo.no_export_other_costs_premiums,
- ifo.jq_supervise_costs_proportion,
- ifo.jq_other_costs_proportion,
- ifo.sy_supervise_costs_proportion,
- ifo.sy_other_costs_proportion,
- ifo.no_supervise_costs_proportion,
- ifo.no_other_costs_proportion,
- ifo.jq_supervise_costs_premiums,
- ifo.jq_other_costs_premiums,
- ifo.sy_supervise_costs_premiums,
- ifo.sy_other_costs_premiums,
- ifo.no_supervise_costs_premiums,
- ifo.no_other_costs_premiums,
- ifo.jq_dept_premiums_level_1,
- ifo.jq_dept_premiums_level_2,
- ifo.jq_dept_premiums_level_3,
- ifo.jq_dept_premiums_level_4,
- ifo.jq_dept_premiums_level_5,
- ifo.sy_dept_premiums_level_1,
- ifo.sy_dept_premiums_level_2,
- ifo.sy_dept_premiums_level_3,
- ifo.sy_dept_premiums_level_4,
- ifo.sy_dept_premiums_level_5,
- ifo.no_dept_premiums_level_1,
- ifo.no_dept_premiums_level_2,
- ifo.no_dept_premiums_level_3,
- ifo.no_dept_premiums_level_4,
- ifo.no_dept_premiums_level_5,
- ifo.first_detail_premiums,
- ifo.second_detail_premiums,
- ifo.third_detail_premiums,
- ifo.jq_profit_margin_premiums,
- ifo.sy_profit_margin_premiums,
- ifo.no_profit_margin_premiums
- </if>
- </select>
- <resultMap id="hxOrderCountMap" type="com.ydtech.modules.order.entity.vo.QueryHxOrdersCountVo">
- <result property="operatorId" column="operatorid" jdbcType="VARCHAR"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="orderStatus0" column="orderstatus0" jdbcType="VARCHAR"/>
- <result property="orderStatus1" column="orderstatus1" jdbcType="VARCHAR"/>
- <result property="orderStatus2" column="orderstatus2" jdbcType="VARCHAR"/>
- <result property="orderStatus3" column="orderstatus3" jdbcType="VARCHAR"/>
- <result property="orderStatus4" column="orderstatus4" jdbcType="VARCHAR"/>
- <result property="createTime" column="createtime" jdbcType="TIMESTAMP"/>
- <result property="createTimeStart" column="createTimeStart" jdbcType="VARCHAR"/>
- <result property="createTimeEnd" column="createTimeEnd" jdbcType="VARCHAR"/>
- <result property="count" column="count1" jdbcType="VARCHAR"/>
- </resultMap>
- <select id="queryHxOrdersCount" resultMap="hxOrderCountMap">
- select
- operatorid,
- su.name,
- count(*) as count1,
- SUM(CASE WHEN orderstatus = '1' THEN 1 ELSE 0 END) AS orderstatus1,
- SUM(CASE WHEN orderstatus = '2' THEN 1 ELSE 0 END) AS orderstatus2,
- SUM(CASE WHEN orderstatus = '3' THEN 1 ELSE 0 END) AS orderstatus3,
- SUM(CASE WHEN orderstatus = '4' THEN 1 ELSE 0 END) AS orderstatus4,
- SUM(CASE WHEN orderstatus = '0' THEN 1 ELSE 0 END) AS orderstatus0
- from
- ins_orders
- LEFT JOIN
- sys_user su ON operatorid = su.id
- WHERE operatorid IS NOT NULL
- AND operatorid NOT LIKE '%M%'
- <if test="queryHxOrdersCountVo.ids != null and !queryHxOrdersCountVo.ids.isEmpty()">
- and operatorid IN
- <foreach item="item" index="index" collection="queryHxOrdersCountVo.ids" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="queryHxOrdersCountVo.operatorId !=null and queryHxOrdersCountVo.operatorId !=''">
- and operatorid =#{queryHxOrdersCountVo.operatorId}
- </if>
- <if test="queryHxOrdersCountVo.name !=null and queryHxOrdersCountVo.name !=''">
- and su.name =#{queryHxOrdersCountVo.name}
- </if>
- <if test="queryHxOrdersCountVo.createTimeStart != null and queryHxOrdersCountVo.createTimeStart != ''">
- and createtime >= #{queryHxOrdersCountVo.createTimeStart}
- </if>
- <if test="queryHxOrdersCountVo.createTimeEnd != null and queryHxOrdersCountVo.createTimeEnd != ''">
- and createtime <= #{queryHxOrdersCountVo.createTimeEnd}
- </if>
- group by
- operatorid,su.name
- order by
- count1 desc
- </select>
- </mapper>
|