| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736 |
- <?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"/>
- <result property="leaderName" column="leader_name" jdbcType="VARCHAR"/>
- <result property="leaderId" column="leader_id" jdbcType="VARCHAR"/>
- <result property="underwritingStatus" column="underwritingStatus" jdbcType="INTEGER"/>
- <result property="entryStatus" column="entryStatus" 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>
- <when test="isDxFlag">
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
- and ( exists ( select id from sys_user where manager_id = #{orderQueryVo.userId}) or io.userid = #{orderQueryVo.userId} )
- </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>
- <when test="isDxFlag">
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
- and ( exists ( select id from sys_user where manager_id = #{orderQueryVo.userId}) or io.userid = #{orderQueryVo.userId} )
- </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.underwriting_status as underwritingStatus,
- 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,
- u.leader_name,
- u.leader_id,
- CASE dept.management_source
- WHEN '1' THEN '渠道'
- WHEN '2' THEN '个代'
- WHEN '3' THEN '电销'
- ELSE '' END
- AS managementSource,
- io.entry_status as entryStatus
- 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
- LEFT JOIN
- sys_user u on io.userid = u.id
- <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.leaderId != null and orderQueryVo.leaderId != ''">
- and u.leader_id = #{orderQueryVo.leaderId}
- </if>
- <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
- and u.leader_name = #{orderQueryVo.leaderName}
- </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>
- <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
- and DATE_FORMAT(iac.signing_time, '%Y-%m-%d') between #{orderQueryVo.signStartDateStr} AND #{orderQueryVo.signEndDateStr}
- </if>
- <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
- and io.entry_status = #{orderQueryVo.entryStatus }
- </if>
- </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
- LEFT JOIN
- sys_user u on io.userid = u.id
- <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.leaderId != null and orderQueryVo.leaderId != ''">
- and u.leader_id = #{orderQueryVo.leaderId}
- </if>
- <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
- and u.leader_name = #{orderQueryVo.leaderName}
- </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>
- <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
- and DATE_FORMAT(iac.signing_time, '%Y-%m-%d') between #{orderQueryVo.signStartDateStr} AND #{orderQueryVo.signEndDateStr}
- </if>
- <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
- and io.entry_status = #{orderQueryVo.entryStatus }
- </if>
- </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
- 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>
- <resultMap id="TelemarketingAuditOrderMap" type="com.ydtech.modules.order.entity.dto.TelemarketingAuditOrderDTO">
- <result property="id" column="id" jdbcType="VARCHAR"/>
- <result property="orderNo" column="orderno" jdbcType="VARCHAR"/>
- <result property="userid" column="userid" jdbcType="VARCHAR"/>
- <result property="username" column="username" jdbcType="VARCHAR"/>
- <result property="product" column="product" jdbcType="VARCHAR"/>
- <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
- <result property="orderStatus" column="orderstatus" jdbcType="VARCHAR"/>
- <result property="insuredName" column="insuredname" jdbcType="VARCHAR"/>
- <result property="createTime" column="createtime" jdbcType="VARCHAR"/>
- <result property="auditStatus" column="auditstatus" jdbcType="VARCHAR"/>
- <result property="insCompany" column="insCompany" 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>
- <select id="getTelemarketingAudit" resultMap="TelemarketingAuditOrderMap">
- SELECT
- iac.id as id,
- iac.orderno as orderno,
- io.userid as userid,
- io.username as username,
- iac.product as product,
- io.licenseno as licenseno,
- io.ins_company as insCompany,
- io.orderstatus as orderstatus,
- io.insuredname as insuredname,
- iac.createtime as createtime,
- ifa.auditstatus as auditstatus
- FROM
- ins_area_company iac
- LEFT JOIN ins_orders io ON iac.orderno = io.orderno
- LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
- WHERE
- iac.orderstatus = '3'
- AND ifa.auditstatus IN ('4', '5')
- AND io.userid = #{userId}
- <if test="telemarketingAuditOrderQueryVo.orderNo != null and telemarketingAuditOrderQueryVo.orderNo != '' ">
- AND iac.orderno = #{telemarketingAuditOrderQueryVo.orderNo}
- </if>
- <if test="telemarketingAuditOrderQueryVo.auditStatus != null and telemarketingAuditOrderQueryVo.auditStatus != '' ">
- AND ifa.auditstatus = #{telemarketingAuditOrderQueryVo.auditStatus}
- </if>
- <if test="telemarketingAuditOrderQueryVo.companyId != null and telemarketingAuditOrderQueryVo.companyId != '' ">
- AND iac.company_id = #{telemarketingAuditOrderQueryVo.companyId}
- </if>
- <if test="telemarketingAuditOrderQueryVo.licenseNo != null and telemarketingAuditOrderQueryVo.licenseNo != '' ">
- AND io.licenseno = #{telemarketingAuditOrderQueryVo.licenseNo}
- </if>
- <if test="telemarketingAuditOrderQueryVo.frameNo != null and telemarketingAuditOrderQueryVo.frameNo != '' ">
- AND io.frameno = #{telemarketingAuditOrderQueryVo.frameNo}
- </if>
- <if test="telemarketingAuditOrderQueryVo.productId != null and telemarketingAuditOrderQueryVo.productId != '' ">
- AND io.product = #{telemarketingAuditOrderQueryVo.productId}
- </if>
- <if test="telemarketingAuditOrderQueryVo.startDate != null and telemarketingAuditOrderQueryVo.startDate != '' and telemarketingAuditOrderQueryVo.endDate != null and telemarketingAuditOrderQueryVo.endDate != ''">
- AND iac.createtime BETWEEN #{telemarketingAuditOrderQueryVo.startDate} AND
- #{telemarketingAuditOrderQueryVo.endDate}
- </if>
- </select>
- <select id="queryLicense" resultType="java.lang.String">
- SELECT DISTINCT licenseno
- from ins_orders
- WHERE userid = #{userId}
- <if test="queryLicenseInOrderVo.startDate != null and queryLicenseInOrderVo.startDate != '' and queryLicenseInOrderVo.endDate != null and queryLicenseInOrderVo.endDate != ''">
- AND createtime BETWEEN #{queryLicenseInOrderVo.startDate} AND
- #{queryLicenseInOrderVo.endDate}
- </if>
- </select>
- </mapper>
|