InsOrdersMapper.xml 72 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ydtech.modules.order.dao.InsOrdersMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.InsOrders">
  7. <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
  8. <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
  9. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  10. <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
  11. <result property="insCompany" column="ins_company" jdbcType="VARCHAR"/>
  12. <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
  13. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  14. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  15. <result property="username" column="username" jdbcType="VARCHAR"/>
  16. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  17. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  18. <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
  19. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  20. <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  21. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  22. <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  23. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
  24. jdbcType="VARCHAR"/>
  25. <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
  26. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  27. <result property="product" column="product" jdbcType="VARCHAR"/>
  28. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  29. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  30. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  31. <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
  32. <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
  33. <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
  34. <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
  35. <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
  36. <result property="jqpremium" column="jqpremium" jdbcType="VARCHAR"/>
  37. <result property="sypremium" column="sypremium" jdbcType="VARCHAR"/>
  38. <result property="jypremium" column="jypremium" jdbcType="VARCHAR"/>
  39. <result property="taxamount" column="taxamount" jdbcType="VARCHAR"/>
  40. <result property="risk" column="risk" javaType="com.alibaba.fastjson.JSONArray"
  41. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  42. <result property="king" column="king" javaType="com.alibaba.fastjson.JSONArray"
  43. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  44. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  45. javaType="com.alibaba.fastjson.JSONObject"
  46. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  47. <result property="subOrderId" column="subOrderId" jdbcType="VARCHAR"/>
  48. <result property="agreementCode" column="agreementCode" jdbcType="VARCHAR"/>
  49. <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
  50. <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
  51. <result property="managementSource" column="managementSource" jdbcType="VARCHAR"/>
  52. </resultMap>
  53. <resultMap id="OrderResultMap" type="com.ydtech.modules.order.entity.vo.OrderVo">
  54. <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
  55. <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
  56. <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
  57. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  58. <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
  59. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  60. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  61. <result property="username" column="username" jdbcType="VARCHAR"/>
  62. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  63. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  64. <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
  65. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  66. <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  67. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  68. <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  69. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
  70. jdbcType="VARCHAR"/>
  71. <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
  72. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  73. <result property="product" column="product" jdbcType="VARCHAR"/>
  74. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  75. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  76. <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
  77. <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
  78. <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
  79. <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
  80. <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
  81. <result property="id" column="id" jdbcType="BIGINT"/>
  82. <result property="companyId" column="company_id" jdbcType="BIGINT"/>
  83. <result property="reptxt" column="reptxt" javaType="com.alibaba.fastjson.JSONObject"
  84. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  85. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  86. javaType="com.alibaba.fastjson.JSONObject"
  87. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  88. <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
  89. <result property="jqapplyno" column="jqapplyno" jdbcType="VARCHAR"/>
  90. <result property="jqpolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  91. <result property="syapplyno" column="syapplyno" jdbcType="VARCHAR"/>
  92. <result property="sypolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  93. <result property="riskinfo" column="riskinfo" javaType="com.alibaba.fastjson.JSONArray"
  94. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  95. <result property="kindinfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  96. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  97. <result property="jqpremium" column="jqpremium" jdbcType="DECIMAL"/>
  98. <result property="sypremium" column="sypremium" jdbcType="DECIMAL"/>
  99. <result property="jypremium" column="jypremium" jdbcType="DECIMAL"/>
  100. <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
  101. <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
  102. <result property="jqdiscountrate" column="jqdiscountrate" jdbcType="DOUBLE"/>
  103. <result property="sydiscountrate" column="sydiscountrate" jdbcType="DOUBLE"/>
  104. <result property="feerate" column="feerate" jdbcType="DOUBLE"/>
  105. <result property="disrate" column="disrate" jdbcType="DOUBLE"/>
  106. <result property="auditid" column="auditid" jdbcType="VARCHAR"/>
  107. <result property="auditname" column="auditname" jdbcType="VARCHAR"/>
  108. <result property="audittime" column="audittime" jdbcType="TIMESTAMP"/>
  109. <result property="auditopinion" column="auditopinion" jdbcType="VARCHAR"/>
  110. <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
  111. <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
  112. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  113. <result property="paymentLink" column="payment_link" jdbcType="VARCHAR"/>
  114. <result property="accidentInfo" column="accident_info" javaType="com.alibaba.fastjson.JSONArray"
  115. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  116. <result property="taxArrears" column="tax_arrears" javaType="com.alibaba.fastjson.JSONArray"
  117. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  118. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  119. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  120. <result property="ubiPredictedInfoScore" column="ubi_predicted_info_score" jdbcType="VARCHAR"/>
  121. <result property="signingTime" column="signingTime" jdbcType="TIMESTAMP"/>
  122. <result property="payDate" column="payDate" jdbcType="TIMESTAMP"/>
  123. <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
  124. </resultMap>
  125. <resultMap id="OrderExcelResultMap" type="com.ydtech.modules.ins.model.InsOrdersExcel">
  126. <id property="orderNo" column="orderno" jdbcType="VARCHAR"/>
  127. <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
  128. <result property="fraMeno" column="frameno" jdbcType="VARCHAR"/>
  129. <result property="carInfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  130. <result property="score" column="score" jdbcType="VARCHAR"/>
  131. <result property="ownerInfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  132. <result property="jqpRemIum" column="jqpremium" jdbcType="VARCHAR"/>
  133. <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
  134. <result property="jqPolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  135. <result property="sypRemIum" column="sypremium" jdbcType="VARCHAR"/>
  136. <result property="syPolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  137. <result property="jypRemIum" column="jypremium" jdbcType="VARCHAR"/>
  138. <result property="taxaMount" column="taxamount" jdbcType="VARCHAR"/>
  139. <result property="jqStartDate" column="jq_start_date" jdbcType="VARCHAR"/>
  140. <result property="jqEndDate" column="jq_end_date" jdbcType="VARCHAR"/>
  141. <result property="syStartDate" column="sy_start_date" jdbcType="VARCHAR"/>
  142. <result property="syEndDate" column="sy_end_date" jdbcType="VARCHAR"/>
  143. <result property="jqScore" column="jq_score" jdbcType="VARCHAR"/>
  144. <result property="syScore" column="sy_score" jdbcType="VARCHAR"/>
  145. <result property="lossRation" column="loss_ration" jdbcType="VARCHAR"/>
  146. <result property="jqLossRation" column="jq_loss_ration" jdbcType="VARCHAR"/>
  147. <result property="syLossRation" column="sy_loss_ration" jdbcType="VARCHAR"/>
  148. <result property="insCompany" column="inscompany" jdbcType="VARCHAR"/>
  149. <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
  150. <result property="userId" column="userid" jdbcType="VARCHAR"/>
  151. <result property="userName" column="username" jdbcType="VARCHAR"/>
  152. <result property="applyInfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  153. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  154. <result property="insureInfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  155. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  156. <result property="kindInfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  157. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  158. <result property="payDate" column="pay_date" jdbcType="VARCHAR"/>
  159. <result property="signingTime" column="signing_time" jdbcType="VARCHAR"/>
  160. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  161. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  162. </resultMap>
  163. <sql id="Base_Column_List">
  164. orderno,quoteno,orderstatus,
  165. carinfo,userid,username,
  166. deptid,deptname,ownerinfo,
  167. applyinfo,insureinfo,agreeid,
  168. productid,product,createtime,
  169. frameno,licenseno,insuredname,
  170. jqstartdate,jqenddate,systartdate,
  171. syenddate
  172. </sql>
  173. <select id="getOrderAndAreaCompany" parameterType="java.lang.String" resultMap="OrderResultMap">
  174. select o.orderno,
  175. o.quoteno,
  176. o.carinfo,
  177. o.userid,
  178. o.username,
  179. o.deptid,
  180. o.deptname,
  181. o.ownerinfo,
  182. o.applyinfo,
  183. o.insureinfo,
  184. o.agreeid,
  185. o.productid,
  186. o.product,
  187. o.frameno,
  188. o.licenseno,
  189. o.insuredname,
  190. o.vehicle_and_vessel_tax,
  191. o.is_external,
  192. iac.jq_start_date as jqstartdate,
  193. iac.jq_end_date as jqenddate,
  194. iac.sy_start_date as systartdate,
  195. iac.sy_end_date as syenddate,
  196. iac.id,
  197. iac.api_type,
  198. iac.company_id,
  199. iac.reptxt,
  200. iac.orderstatus,
  201. iac.inscompany,
  202. iac.jqapplyno,
  203. iac.jqpolicyno,
  204. iac.syapplyno,
  205. iac.sypolicyno,
  206. iac.riskinfo,
  207. iac.kindinfo,
  208. iac.jqpremium,
  209. iac.sypremium,
  210. iac.jypremium,
  211. iac.taxamount,
  212. iac.sumpremium,
  213. iac.jqdiscountrate,
  214. iac.sydiscountrate,
  215. iac.feerate,
  216. iac.disrate,
  217. iac.auditid,
  218. iac.auditname,
  219. iac.audittime,
  220. iac.auditopinion,
  221. iac.jqappoint,
  222. iac.syappoint,
  223. iac.createtime,
  224. iac.payment_link,
  225. iac.accident_info,
  226. iac.tax_arrears,
  227. iac.cross_insurance,
  228. iac.ubi_predicted_info_score,
  229. iac.signing_time as signingTime,
  230. iac.pay_date as payDate,
  231. eic.namesimple as partnerCompaniesName
  232. from ins_orders as o
  233. join ins_area_company iac on o.orderno = iac.orderno
  234. LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
  235. LEFT JOIN esm_ins_company eic on eic.id = pa.partner_companies_id
  236. where iac.id = #{companyId}
  237. </select>
  238. <select id="getByUseridAndLicenseNo" resultType="com.ydtech.modules.order.entity.InsOrders"
  239. parameterType="com.ydtech.modules.order.entity.vo.VerifyOrdersVo">
  240. select orderno,
  241. quoteno,
  242. orderstatus,
  243. carinfo,
  244. userid,
  245. username,
  246. deptid,
  247. deptname,
  248. ownerinfo,
  249. applyinfo,
  250. insureinfo,
  251. agreeid,
  252. productid,
  253. product,
  254. createtime,
  255. frameno,
  256. licenseno,
  257. insuredname,
  258. jqstartdate,
  259. jqenddate,
  260. systartdate,
  261. syenddate,
  262. risk,
  263. king,
  264. vehicle_and_vessel_tax
  265. from ins_orders
  266. where userid = #{userId, jdbcType=VARCHAR}
  267. and licenseno = #{licenseNo, jdbcType=VARCHAR}
  268. and createtime > DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
  269. </select>
  270. <select id="queryPageOrderCount" resultType="Long">
  271. select
  272. count(1)
  273. from (
  274. select
  275. io.orderno
  276. from
  277. ins_orders io
  278. <!--如果存在 公司查询则进行连表 -->
  279. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  280. left JOIN
  281. ins_area_company iac on iac.orderno = io.orderno
  282. </if>
  283. <where>
  284. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  285. and io.orderno = #{orderQueryVo.orderNo}
  286. </if>
  287. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  288. and io.deptid like "${orderQueryVo.deptId}%"
  289. </if>
  290. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  291. and io.orderstatus = #{orderQueryVo.orderStatus}
  292. </if>
  293. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  294. and io.frameno = #{orderQueryVo.frameNo}
  295. </if>
  296. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  297. and io.licenseno = #{orderQueryVo.licenseNo}
  298. </if>
  299. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  300. and io.insuredname = #{orderQueryVo.insuredName}
  301. </if>
  302. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  303. and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  304. </if>
  305. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  306. and iac.company_id = #{orderQueryVo.companyId}
  307. </if>
  308. <!--
  309. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
  310. and io.operatorid = #{orderQueryVo.userId}
  311. </if>
  312. -->
  313. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
  314. and io.userid = #{orderQueryVo.userId}
  315. </if>
  316. </where>
  317. group by io.orderno
  318. ) as s
  319. </select>
  320. <select id="queryPageOrder" resultMap="BaseResultMap">
  321. select
  322. io.*
  323. from
  324. ins_orders io
  325. <!--如果存在 公司查询则进行连表 -->
  326. left JOIN
  327. ins_area_company iac on iac.orderno = io.orderno
  328. <where>
  329. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  330. and io.orderno = #{orderQueryVo.orderNo}
  331. </if>
  332. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  333. and io.deptid like "${orderQueryVo.deptId}%"
  334. </if>
  335. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  336. and io.orderstatus = #{orderQueryVo.orderStatus}
  337. </if>
  338. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  339. and io.frameno = #{orderQueryVo.frameNo}
  340. </if>
  341. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  342. and io.licenseno = #{orderQueryVo.licenseNo}
  343. </if>
  344. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  345. and io.insuredname = #{orderQueryVo.insuredName}
  346. </if>
  347. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  348. and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  349. </if>
  350. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  351. and iac.company_id = #{orderQueryVo.companyId}
  352. </if>
  353. <if test="orderQueryVo.product != null and orderQueryVo.product != ''">
  354. and io.product = #{orderQueryVo.product}
  355. </if>
  356. <if test="orderQueryVo.productid != null and orderQueryVo.productid != ''">
  357. and io.productid = #{orderQueryVo.productid}
  358. </if>
  359. <!--
  360. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
  361. and io.operatorid = #{orderQueryVo.userId}
  362. </if>
  363. -->
  364. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
  365. and io.userid = #{orderQueryVo.userId}
  366. </if>
  367. </where>
  368. group by orderno
  369. order by io.createtime desc
  370. </select>
  371. <select id="queryOrderList" parameterType="com.ydtech.modules.ins.model.InsOrdersExcelVo" resultMap="OrderExcelResultMap">
  372. select
  373. a.orderno,
  374. a.licenseno,
  375. a.frameno,
  376. a.carinfo,
  377. b.api_type,
  378. b.score,
  379. a.ownerinfo,
  380. b.jqpremium,
  381. b.jqpolicyno,
  382. b.sypremium,
  383. b.sypolicyno,
  384. b.jypremium,
  385. b.taxamount,
  386. b.jq_start_date,
  387. b.jq_end_date,
  388. b.sy_start_date,
  389. b.sy_end_date,
  390. b.score,
  391. b.jq_score,
  392. b.sy_score,
  393. b.loss_ration,
  394. b.jq_loss_ration,
  395. b.sy_loss_ration,
  396. b.score,
  397. b.inscompany,
  398. b.agreement_id,
  399. a.userid,
  400. a.username,
  401. a.applyinfo,
  402. a.insureinfo,
  403. b.kindinfo,
  404. b.pay_date,
  405. b.signing_time,
  406. b.cross_insurance
  407. FROM ins_orders a LEFT JOIN ins_area_company b on a.orderno = b.orderno
  408. WHERE
  409. 1 = 1
  410. <if test="orderstatus != null and orderstatus != '' ">
  411. and b.orderstatus = #{orderstatus}
  412. </if>
  413. <if test="startDate != null ">
  414. and b.signing_time &gt;= #{startDate}
  415. </if>
  416. <if test="endDate != null ">
  417. and b.signing_time &lt;= #{endDate}
  418. </if>
  419. </select>
  420. <resultMap id="PolicyInsuranceReportMap" type="com.ydtech.modules.order.entity.vo.PolicyInsuranceReportResVo">
  421. <result property="insCompany" column="insCompany" jdbcType="VARCHAR"/>
  422. <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
  423. <result property="policyNo" column="policyNo" jdbcType="VARCHAR"/>
  424. <result property="quoteDate" column="quoteDate" jdbcType="VARCHAR"/>
  425. <result property="policyStartDate" column="policyStartDate" jdbcType="VARCHAR"/>
  426. <result property="riskName" column="riskName" jdbcType="VARCHAR"/>
  427. <result property="sumPremium" column="sumPremium" jdbcType="DECIMAL"/>
  428. <result property="taxPremium" column="taxPremium" jdbcType="DECIMAL"/>
  429. <result property="taxLaterPremium" column="taxLaterPremium" jdbcType="DECIMAL"/>
  430. <result property="insuranceSubAmount" column="insuranceSubAmount" jdbcType="VARCHAR"/>
  431. <result property="licenseNo" column="licenseNo" jdbcType="VARCHAR"/>
  432. <result property="vehicleUse" column="vehicleUse" jdbcType="VARCHAR"/>
  433. <result property="powerType" column="powerType" jdbcType="VARCHAR"/>
  434. <result property="ciModelClass" column="ciModelClass" jdbcType="VARCHAR"/>
  435. <result property="limitLoad" column="limitLoad" jdbcType="VARCHAR"/>
  436. <result property="appliName" column="appliName" jdbcType="VARCHAR"/>
  437. <result property="insureName" column="insureName" jdbcType="VARCHAR"/>
  438. <result property="deptName" column="deptName" jdbcType="VARCHAR"/>
  439. <result property="userName" column="username" jdbcType="VARCHAR"/>
  440. </resultMap>
  441. <select id="getPolicyInsuranceReport" resultMap="PolicyInsuranceReportMap">
  442. /*交强数据*/
  443. SELECT a.`inscompany` AS insCompany,
  444. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  445. a.`jqpolicyno` AS policyNo,
  446. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  447. a.pay_date AS quoteDate,
  448. </if>
  449. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  450. a.inside_pay_time AS quoteDate,
  451. </if>
  452. a.`jq_start_date` AS policyStartDate,
  453. '交强险' AS riskName,
  454. a.`jqpremium` AS sumPremium,
  455. a.`taxamount` AS taxPremium,
  456. getCarShipLateFee(a.`id`) AS taxLaterPremium,
  457. '交强险 : 200000.00,' AS insuranceSubAmount,
  458. b.`licenseno` AS licenseNo,
  459. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  460. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  461. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  462. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  463. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  464. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  465. b.`deptname` AS deptName,
  466. b.`username` AS userName
  467. FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
  468. AND a.`orderno`=b.`orderno`
  469. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  470. and b.deptid = #{policyReqVo.deptId}
  471. </if>
  472. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  473. and b.userid = #{policyReqVo.userId}
  474. </if>
  475. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  476. and b.username = #{policyReqVo.userName}
  477. </if>
  478. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  479. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  480. </if>
  481. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  482. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  483. </if>
  484. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  485. and b.productid = #{policyReqVo.productId}
  486. </if>
  487. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  488. and a.company_id = #{policyReqVo.insCompany}
  489. </if>
  490. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  491. and a.operatorid = #{policyReqVo.operatorId}
  492. </if>
  493. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  494. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  495. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  496. </if>
  497. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  498. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  499. </if>
  500. </if>
  501. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  502. and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  503. </if>
  504. UNION ALL
  505. /*##商业数据*/
  506. SELECT a.`inscompany` AS insCompany,
  507. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  508. a.`sypolicyno` AS policyNo,
  509. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  510. a.pay_date AS quoteDate,
  511. </if>
  512. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  513. a.inside_pay_time AS quoteDate,
  514. </if>
  515. a.`sy_start_date` AS policyStartDate,
  516. '商业险' AS riskName,
  517. a.`sypremium` AS sumPremium,
  518. '' AS taxPremium,
  519. '' AS taxLaterPremium,
  520. getSyAmount(a.`orderno`) AS insuranceSubAmount,
  521. b.`licenseno` AS licenseNo,
  522. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  523. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  524. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  525. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  526. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  527. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  528. b.`deptname` AS deptName,
  529. b.`username` AS userName
  530. FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
  531. AND a.`orderno`=b.`orderno`
  532. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  533. and b.deptid = #{policyReqVo.deptId}
  534. </if>
  535. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  536. and b.userid = #{policyReqVo.userId}
  537. </if>
  538. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  539. and b.username = #{policyReqVo.userName}
  540. </if>
  541. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  542. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  543. </if>
  544. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  545. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  546. </if>
  547. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  548. and b.productid = #{policyReqVo.productId}
  549. </if>
  550. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  551. and a.company_id = #{policyReqVo.insCompany}
  552. </if>
  553. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  554. and a.operatorid = #{policyReqVo.operatorId}
  555. </if>
  556. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  557. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  558. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  559. </if>
  560. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  561. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  562. </if>
  563. </if>
  564. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  565. and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  566. </if>
  567. </select>
  568. <select id="getPolicyInsuranceReportCount" resultType="Long">
  569. select
  570. count(1)
  571. from (
  572. /*交强数据*/
  573. SELECT a.`inscompany` AS insCompany,
  574. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  575. a.`jqpolicyno` AS policyNo,
  576. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  577. a.pay_date AS quoteDate,
  578. </if>
  579. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  580. a.inside_pay_time AS quoteDate,
  581. </if>
  582. a.`jq_start_date` AS policyStartDate,
  583. '交强险' AS riskName,
  584. a.`jqpremium` AS sumPremium,
  585. a.`taxamount` AS taxPremium,
  586. getCarShipLateFee(a.`id`) AS taxLaterPremium,
  587. '交强险 : 200000.00,' AS insuranceSubAmount,
  588. b.`licenseno` AS licenseNo,
  589. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  590. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  591. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  592. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  593. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  594. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  595. b.`deptname` AS deptName,
  596. b.`username` AS userName
  597. FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
  598. AND a.`orderno`=b.`orderno`
  599. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  600. and b.deptid = #{policyReqVo.deptId}
  601. </if>
  602. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  603. and b.userid = #{policyReqVo.userId}
  604. </if>
  605. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  606. and b.username = #{policyReqVo.userName}
  607. </if>
  608. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  609. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  610. </if>
  611. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  612. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  613. </if>
  614. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  615. and b.productid = #{policyReqVo.productId}
  616. </if>
  617. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  618. and a.company_id = #{policyReqVo.insCompany}
  619. </if>
  620. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  621. and a.operatorid = #{policyReqVo.operatorId}
  622. </if>
  623. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  624. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  625. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  626. </if>
  627. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  628. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  629. </if>
  630. </if>
  631. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  632. and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  633. </if>
  634. UNION ALL
  635. /*##商业数据*/
  636. SELECT a.`inscompany` AS insCompany,
  637. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  638. a.`sypolicyno` AS policyNo,
  639. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  640. a.pay_date AS quoteDate,
  641. </if>
  642. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  643. a.inside_pay_time AS quoteDate,
  644. </if>
  645. a.`sy_start_date` AS policyStartDate,
  646. '商业险' AS riskName,
  647. a.`sypremium` AS sumPremium,
  648. '' AS taxPremium,
  649. '' AS taxLaterPremium,
  650. getSyAmount(a.`orderno`) AS insuranceSubAmount,
  651. b.`licenseno` AS licenseNo,
  652. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  653. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  654. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  655. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  656. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  657. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  658. b.`deptname` AS deptName,
  659. b.`username` AS userName
  660. FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
  661. AND a.`orderno`=b.`orderno`
  662. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  663. and b.deptid = #{policyReqVo.deptId}
  664. </if>
  665. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  666. and b.userid = #{policyReqVo.userId}
  667. </if>
  668. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  669. and b.username = #{policyReqVo.userName}
  670. </if>
  671. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  672. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  673. </if>
  674. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  675. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  676. </if>
  677. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  678. and b.productid = #{policyReqVo.productId}
  679. </if>
  680. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  681. and a.company_id = #{policyReqVo.insCompany}
  682. </if>
  683. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  684. and a.operatorid = #{policyReqVo.operatorId}
  685. </if>
  686. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  687. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  688. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  689. </if>
  690. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  691. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  692. </if>
  693. </if>
  694. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  695. and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  696. </if>
  697. ) as s
  698. </select>
  699. <update id="updateStatus">
  700. update ins_orders set orderstatus = #{status} where orderno = #{orderno}
  701. </update>
  702. <select id="queryPageHospitalityOrder" resultMap="BaseResultMap">
  703. select
  704. io.*
  705. from
  706. ins_orders io
  707. <!--如果存在 公司查询则进行连表 -->
  708. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  709. left JOIN
  710. ins_area_company iac on iac.orderno = io.orderno
  711. </if>
  712. <where>
  713. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  714. and io.orderno = #{orderQueryVo.orderNo}
  715. </if>
  716. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' ">
  717. and io.deptid like "${orderQueryVo.deptId}%"
  718. </if>
  719. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  720. and io.orderstatus = #{orderQueryVo.orderStatus}
  721. </if>
  722. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  723. and io.frameno = #{orderQueryVo.frameNo}
  724. </if>
  725. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  726. and io.licenseno = #{orderQueryVo.licenseNo}
  727. </if>
  728. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  729. and io.insuredname = #{orderQueryVo.insuredName}
  730. </if>
  731. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  732. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  733. </if>
  734. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  735. and iac.company_id = #{orderQueryVo.companyId}
  736. </if>
  737. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  738. and io.userid = #{orderQueryVo.userId}
  739. </if>
  740. </where>
  741. group by orderno
  742. order by io.createtime desc
  743. </select>
  744. <select id="queryPageHospitalityOrderCount" resultType="Long">
  745. select
  746. count(1)
  747. from (
  748. select
  749. io.orderno
  750. from
  751. ins_orders io
  752. <!--如果存在 公司查询则进行连表 -->
  753. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  754. left JOIN
  755. ins_area_company iac on iac.orderno = io.orderno
  756. </if>
  757. <where>
  758. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  759. and io.orderno = #{orderQueryVo.orderNo}
  760. </if>
  761. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  762. and io.deptid like "${orderQueryVo.deptId}%"
  763. </if>
  764. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  765. and io.orderstatus = #{orderQueryVo.orderStatus}
  766. </if>
  767. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  768. and io.frameno = #{orderQueryVo.frameNo}
  769. </if>
  770. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  771. and io.licenseno = #{orderQueryVo.licenseNo}
  772. </if>
  773. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  774. and io.insuredname = #{orderQueryVo.insuredName}
  775. </if>
  776. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  777. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  778. </if>
  779. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  780. and iac.company_id = #{orderQueryVo.companyId}
  781. </if>
  782. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  783. and io.userid = #{orderQueryVo.userId}
  784. </if>
  785. </where>
  786. group by io.orderno
  787. ) as s
  788. </select>
  789. <select id="queryPageOrderByLinkType" resultMap="BaseResultMap">
  790. select
  791. io.orderno as orderno,
  792. io.quoteno as quoteno,
  793. iac.orderstatus as orderstatus,
  794. io.carinfo as carinfo,
  795. io.userid as userid,
  796. io.username as username,
  797. io.deptid as deptid,
  798. io.deptname as deptname,
  799. io.ownerinfo as ownerinfo,
  800. io.applyinfo as applyinfo,
  801. io.insureinfo as insureinfo,
  802. io.agreeid as agreeid,
  803. iac.productid as productid,
  804. iac.product as product,
  805. iac.createtime as createtime,
  806. io.frameno as frameno,
  807. io.licenseno as licenseno,
  808. io.insuredname as insuredname,
  809. iac.jq_start_date as jqstartdate,
  810. iac.jq_end_date as jqenddate,
  811. iac.sy_start_date as systartdate,
  812. iac.sy_end_date as syenddate,
  813. iac.jqpremium as jqpremium,
  814. iac.sypremium as sypremium,
  815. iac.jypremium as jypremium,
  816. iac.taxamount as taxamount,
  817. io.risk as risk,
  818. io.king as king,
  819. io.vehicle_and_vessel_tax as vehicleAndVesselTax,
  820. iac.id as subOrderId,
  821. iac.company_id as company_id,
  822. iac.inscompany as ins_company,
  823. agree.agreement_code as agreementCode,
  824. agree.agreement_name as agreementName,
  825. company.namesimple as partnerCompaniesName,
  826. iac.api_type,
  827. io.is_external,
  828. CASE dept.management_source
  829. WHEN '1' THEN '渠道'
  830. WHEN '2' THEN '个代'
  831. WHEN '3' THEN '电销'
  832. ELSE '' END
  833. AS managementSource
  834. from
  835. ins_area_company iac
  836. left JOIN
  837. ins_orders io on iac.orderno = io.orderno
  838. left join
  839. ptl_agreement agree on iac.agreement_id= agree.id
  840. left join
  841. esm_ins_company company on agree.partner_companies_id= company.id
  842. LEFT JOIN
  843. sys_dept dept ON dept.id = io.deptid
  844. <where>
  845. <if test="agentUserIds != null and agentUserIds.size>0" >
  846. AND (
  847. (io.userid in
  848. <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
  849. #{item}
  850. </foreach>
  851. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
  852. <if test="deptIds != null and deptIds.size>0" >
  853. AND (
  854. <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
  855. io.deptid like CONCAT('', #{item}, '%')
  856. </foreach>
  857. )
  858. </if>
  859. )
  860. <if test="flag" >
  861. OR iac.operator_id = #{orderQueryVo.userId}
  862. </if>
  863. )
  864. </if>
  865. <if test="agreeIds != null and agreeIds.size>0">
  866. AND (
  867. (iac.agreement_id in
  868. <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
  869. #{item}
  870. </foreach>
  871. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
  872. <if test="flag" >
  873. OR iac.operator_id = #{orderQueryVo.userId}
  874. </if>
  875. )
  876. </if>
  877. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  878. and iac.id = #{orderQueryVo.orderNo}
  879. </if>
  880. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  881. and io.deptid like "${orderQueryVo.deptId}%"
  882. </if>
  883. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  884. and iac.orderstatus= #{orderQueryVo.orderStatus}
  885. </if>
  886. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  887. and io.frameno = #{orderQueryVo.frameNo}
  888. </if>
  889. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  890. and io.licenseno = #{orderQueryVo.licenseNo}
  891. </if>
  892. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  893. and io.insuredname = #{orderQueryVo.insuredName}
  894. </if>
  895. <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
  896. and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{orderQueryVo.quoteStartDateStr} AND #{orderQueryVo.quoteEndDateStr}
  897. </if>
  898. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  899. and iac.company_id = #{orderQueryVo.companyId}
  900. </if>
  901. <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
  902. and io.userid = #{orderQueryVo.operatorId}
  903. </if>
  904. <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
  905. and io.username = #{orderQueryVo.operatorName}
  906. </if>
  907. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  908. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  909. </if>
  910. <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
  911. and io.deptid like "${orderQueryVo.provinceId}%"
  912. </if>
  913. <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
  914. and io.deptid like "${orderQueryVo.cityId}%"
  915. </if>
  916. <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
  917. and io.deptid like "${orderQueryVo.countyId}%"
  918. </if>
  919. <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
  920. and io.deptid like "${orderQueryVo.houseId}%"
  921. </if>
  922. <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
  923. and iac.agreement_id = #{orderQueryVo.agreeId}
  924. </if>
  925. <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
  926. and io.orderno = #{orderQueryVo.taskNo}
  927. </if>
  928. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  929. and iac.product = #{orderQueryVo.riskCode}
  930. </if>
  931. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  932. and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
  933. </if>
  934. <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
  935. and ((
  936. DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
  937. AND #{orderQueryVo.attachEndDateStr}
  938. )
  939. OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
  940. )
  941. </if>
  942. </where>
  943. order by io.createtime desc
  944. </select>
  945. <select id="queryPageOrderByLinkTypeCount" resultType="Long">
  946. select
  947. count(1)
  948. from (
  949. select
  950. (0)
  951. from
  952. ins_area_company iac
  953. left JOIN
  954. ins_orders io on iac.orderno = io.orderno
  955. <where>
  956. <if test="agentUserIds != null and agentUserIds.size>0" >
  957. AND (
  958. (io.userid in
  959. <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
  960. #{item}
  961. </foreach>
  962. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
  963. <if test="deptIds != null and deptIds.size>0" >
  964. AND (
  965. <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
  966. io.deptid like CONCAT('', #{item}, '%')
  967. </foreach>
  968. )
  969. </if>
  970. )
  971. <if test="flag" >
  972. OR iac.operator_id = #{orderQueryVo.userId}
  973. </if>
  974. )
  975. </if>
  976. <if test="agreeIds != null and agreeIds.size>0">
  977. AND (
  978. (iac.agreement_id in
  979. <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
  980. #{item}
  981. </foreach>
  982. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
  983. <if test="flag" >
  984. OR iac.operator_id = #{orderQueryVo.userId}
  985. </if>
  986. )
  987. </if>
  988. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  989. and iac.id = #{orderQueryVo.orderNo}
  990. </if>
  991. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  992. and io.deptid like "${orderQueryVo.deptId}%"
  993. </if>
  994. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  995. and iac.orderstatus= #{orderQueryVo.orderStatus}
  996. </if>
  997. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  998. and io.frameno = #{orderQueryVo.frameNo}
  999. </if>
  1000. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  1001. and io.licenseno = #{orderQueryVo.licenseNo}
  1002. </if>
  1003. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  1004. and io.insuredname = #{orderQueryVo.insuredName}
  1005. </if>
  1006. <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
  1007. and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{orderQueryVo.quoteStartDateStr} AND #{orderQueryVo.quoteEndDateStr}
  1008. </if>
  1009. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  1010. and iac.company_id = #{orderQueryVo.companyId}
  1011. </if>
  1012. <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
  1013. and io.userid = #{orderQueryVo.operatorId}
  1014. </if>
  1015. <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
  1016. and io.username = #{orderQueryVo.operatorName}
  1017. </if>
  1018. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  1019. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  1020. </if>
  1021. <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
  1022. and io.deptid like "${orderQueryVo.provinceId}%"
  1023. </if>
  1024. <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
  1025. and io.deptid like "${orderQueryVo.cityId}%"
  1026. </if>
  1027. <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
  1028. and io.deptid like "${orderQueryVo.countyId}%"
  1029. </if>
  1030. <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
  1031. and io.deptid like "${orderQueryVo.houseId}%"
  1032. </if>
  1033. <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
  1034. and iac.agreement_id = #{orderQueryVo.agreeId}
  1035. </if>
  1036. <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
  1037. and io.orderno = #{orderQueryVo.taskNo}
  1038. </if>
  1039. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  1040. and iac.product = #{orderQueryVo.riskCode}
  1041. </if>
  1042. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1043. and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
  1044. </if>
  1045. <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
  1046. and ((
  1047. DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
  1048. AND #{orderQueryVo.attachEndDateStr}
  1049. )
  1050. OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
  1051. )
  1052. </if>
  1053. </where>
  1054. ) as s
  1055. </select>
  1056. <select id="queryPageSubOrders" resultMap="BaseResultMap">
  1057. select
  1058. io.*,
  1059. iac.id as subOrderId
  1060. from
  1061. ins_area_company iac
  1062. left JOIN
  1063. ins_orders io on iac.orderno = io.orderno
  1064. <where>
  1065. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  1066. and io.userid = #{orderQueryVo.userid}
  1067. </if>
  1068. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  1069. and io.orderno = #{orderQueryVo.orderNo}
  1070. </if>
  1071. <if test="orderQueryVo.quoteNo != null and orderQueryVo.quoteNo != ''">
  1072. and io.quoteno = #{orderQueryVo.quoteNo}
  1073. </if>
  1074. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  1075. and io.deptid like "${orderQueryVo.deptId}%"
  1076. </if>
  1077. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  1078. and iac.orderstatus = #{orderQueryVo.orderStatus}
  1079. </if>
  1080. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  1081. and io.frameno = #{orderQueryVo.frameNo}
  1082. </if>
  1083. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  1084. and io.licenseno = #{orderQueryVo.licenseNo}
  1085. </if>
  1086. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  1087. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  1088. </if>
  1089. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  1090. and io.insuredname = #{orderQueryVo.insuredName}
  1091. </if>
  1092. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  1093. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  1094. </if>
  1095. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  1096. and iac.company_id = #{orderQueryVo.companyId}
  1097. </if>
  1098. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  1099. and iac.product = #{orderQueryVo.riskCode}
  1100. </if>
  1101. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1102. and IFNULL( io.agreeid, '' ) = #{orderQueryVo.auditId}
  1103. </if>
  1104. <if test="orderQueryVo.policyStartDate != null and orderQueryVo.policyEndDate != ''">
  1105. and ((
  1106. io.jqstartdate BETWEEN #{orderQueryVo.policyStartDate}
  1107. AND #{orderQueryVo.policyEndDate}
  1108. )
  1109. OR ( io.systartdate BETWEEN #{orderQueryVo.policyStartDate} AND #{orderQueryVo.policyEndDate} )
  1110. )
  1111. </if>
  1112. </where>
  1113. group by iac.id
  1114. order by io.createtime desc
  1115. </select>
  1116. <select id="queryPageSubOrdersCount" resultType="Long">
  1117. select
  1118. count(1)
  1119. from (
  1120. select
  1121. io.*
  1122. from
  1123. ins_area_company iac
  1124. left JOIN
  1125. ins_orders io on iac.orderno = io.orderno
  1126. <where>
  1127. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  1128. and io.userid = #{orderQueryVo.userid}
  1129. </if>
  1130. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  1131. and io.orderno = #{orderQueryVo.orderNo}
  1132. </if>
  1133. <if test="orderQueryVo.quoteNo != null and orderQueryVo.quoteNo != ''">
  1134. and io.quoteno = #{orderQueryVo.quoteNo}
  1135. </if>
  1136. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  1137. and io.deptid like "${orderQueryVo.deptId}%"
  1138. </if>
  1139. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  1140. and iac.orderstatus = #{orderQueryVo.orderStatus}
  1141. </if>
  1142. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  1143. and io.frameno = #{orderQueryVo.frameNo}
  1144. </if>
  1145. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  1146. and io.licenseno = #{orderQueryVo.licenseNo}
  1147. </if>
  1148. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  1149. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  1150. </if>
  1151. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  1152. and io.insuredname = #{orderQueryVo.insuredName}
  1153. </if>
  1154. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  1155. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  1156. </if>
  1157. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  1158. and iac.company_id = #{orderQueryVo.companyId}
  1159. </if>
  1160. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  1161. and iac.product = #{orderQueryVo.riskCode}
  1162. </if>
  1163. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1164. and IFNULL( io.agreeid, '' ) = #{orderQueryVo.auditId}
  1165. </if>
  1166. <if test="orderQueryVo.policyStartDate != null and orderQueryVo.policyEndDate != ''">
  1167. and ((
  1168. io.jqstartdate BETWEEN #{orderQueryVo.policyStartDate}
  1169. AND #{orderQueryVo.policyEndDate}
  1170. )
  1171. OR ( io.systartdate BETWEEN #{orderQueryVo.policyStartDate} AND #{orderQueryVo.policyEndDate} )
  1172. )
  1173. </if>
  1174. </where>
  1175. group by iac.id
  1176. ) as s
  1177. </select>
  1178. <select id="selectEntityByinsOrderNo" resultMap="OrderResultMap">
  1179. select o.orderno,
  1180. o.quoteno,
  1181. o.frameno,
  1182. o.licenseno,
  1183. iac.jq_start_date as jqstartdate,
  1184. iac.jq_end_date as jqenddate,
  1185. iac.sy_start_date as systartdate,
  1186. iac.sy_end_date as syenddate,
  1187. iac.id,
  1188. iac.company_id,
  1189. iac.reptxt,
  1190. iac.orderstatus,
  1191. iac.inscompany,
  1192. iac.jqapplyno,
  1193. iac.jqpolicyno,
  1194. iac.syapplyno,
  1195. iac.sypolicyno,
  1196. iac.riskinfo,
  1197. iac.kindinfo,
  1198. iac.jqpremium,
  1199. iac.sypremium,
  1200. iac.jypremium,
  1201. iac.taxamount,
  1202. iac.sumpremium,
  1203. iac.jqdiscountrate,
  1204. iac.sydiscountrate,
  1205. iac.feerate,
  1206. iac.disrate,
  1207. iac.auditid,
  1208. iac.auditname,
  1209. iac.audittime,
  1210. iac.auditopinion,
  1211. iac.jqappoint,
  1212. iac.syappoint,
  1213. iac.createtime,
  1214. iac.payment_link,
  1215. iac.accident_info,
  1216. iac.tax_arrears,
  1217. iac.cross_insurance,
  1218. iac.ubi_predicted_info_score
  1219. from ins_area_company iac
  1220. join ins_orders as o on o.orderno = iac.orderno
  1221. where
  1222. iac.id = #{insOrderNo}
  1223. <if test="timeFiltering != null and timeFiltering != ''">
  1224. and DATE_FORMAT(iac.signing_time, '%Y-%m') = #{timeFiltering}
  1225. </if>
  1226. </select>
  1227. <select id="getExpirationInsureCount" resultType="Integer">
  1228. SELECT
  1229. count( b.orderno ) AS count
  1230. FROM
  1231. ins_orders a
  1232. left join
  1233. ins_area_company b
  1234. on a.orderno = b.orderno
  1235. WHERE
  1236. <if test="isJq == 1">
  1237. jqenddate BETWEEN #{startDate} AND #{endDate}
  1238. </if>
  1239. <if test="isJq == 2">
  1240. syenddate BETWEEN #{startDate} AND #{endDate}
  1241. </if>
  1242. AND a.orderstatus = 3
  1243. AND b.orderstatus = 3
  1244. <if test="param != null and param != ''">
  1245. AND (a.licenseno = #{param} or a.ins_company = #{param})
  1246. </if>
  1247. <if test="userId != null and userId != ''">
  1248. AND a.userid = #{userId}
  1249. </if>
  1250. </select>
  1251. <select id="getExpirationInsure" resultType="com.ydtech.modules.order.entity.vo.OrderExpirationVo">
  1252. SELECT
  1253. a.ins_company,
  1254. b.id as orderno,
  1255. a.jqenddate,
  1256. a.syenddate,
  1257. a.productid,
  1258. a.product,
  1259. a.licenseno,
  1260. <if test="isJq == 1">
  1261. DATEDIFF( NOW(), jqenddate ) AS difference
  1262. </if>
  1263. <if test="isJq == 2">
  1264. DATEDIFF( NOW(), syenddate ) AS difference
  1265. </if>
  1266. FROM
  1267. ins_orders a
  1268. left join
  1269. ins_area_company b
  1270. on a.orderno = b.orderno
  1271. WHERE
  1272. <if test="isJq == 1">
  1273. jqenddate BETWEEN #{startDate} AND #{endDate}
  1274. </if>
  1275. <if test="isJq == 2">
  1276. syenddate BETWEEN #{startDate} AND #{endDate}
  1277. </if>
  1278. AND a.orderstatus = 3
  1279. AND b.orderstatus = 3
  1280. <if test="param != null and param != ''">
  1281. AND (a.licenseno = #{param} or a.ins_company = #{param})
  1282. </if>
  1283. <if test="userId != null and userId != ''">
  1284. AND a.userid = #{userId}
  1285. </if>
  1286. ORDER BY
  1287. difference DESC
  1288. </select>
  1289. <select id="getCarBusinessDetailList" resultType="com.ydtech.modules.order.entity.vo.CarBusinessDetailVo">
  1290. SELECT
  1291. io.username,
  1292. iac.signing_time as sign_date,
  1293. io.licenseno,
  1294. JSON_UNQUOTE(json_extract(io.applyinfo, '$.name')) as applyname,
  1295. io.product,
  1296. io.ins_company as inscompany,
  1297. iac.jqpremium,
  1298. iac.sypremium,
  1299. iac.jypremium,
  1300. iac.taxamount,
  1301. ifo.jq_costs_export_proportion+ifo.jq_export_other_costs_proportion as jq_export_proportion,
  1302. ifo.sy_costs_export_proportion+ifo.sy_export_other_costs_proportion as sy_export_proportion,
  1303. ifo.no_costs_export_proportion+ifo.no_export_other_costs_proportion as no_export_proportion,
  1304. 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,
  1305. CASE ifa.auditstatus
  1306. WHEN 1 THEN
  1307. '已审核'
  1308. ELSE
  1309. '未审核'
  1310. END as audittype,
  1311. ifa.audittime as audit_date
  1312. FROM
  1313. ins_orders io
  1314. LEFT JOIN ins_area_company iac ON io.orderno = iac.orderno
  1315. LEFT JOIN ins_fee_order_new ifo ON iac.id = ifo.ins_order_no
  1316. left join ins_fee_audit ifa on ifo.ins_order_no = ifa.ins_order_no
  1317. WHERE
  1318. io.userid = #{userId}
  1319. AND io.orderstatus = 3
  1320. AND iac.orderstatus = 3
  1321. AND iac.signing_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
  1322. </select>
  1323. <select id="getRevenueExpenditureDetailList" resultType="com.ydtech.modules.order.entity.vo.RevenueExpenditureDetailVo">
  1324. SELECT
  1325. sua.create_time,
  1326. io.licenseno,
  1327. sua.amount,
  1328. sua.business_eegments_type,
  1329. sua.documentary,
  1330. sua.property
  1331. FROM
  1332. sys_user_account_history sua
  1333. left join ins_area_company iac on sua.suborder = iac.id
  1334. left join ins_orders io on iac.orderno = io.orderno
  1335. WHERE
  1336. (sua.property != 1 and sua.property != 2)
  1337. AND
  1338. user_id = #{userId}
  1339. AND
  1340. sua.create_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
  1341. </select>
  1342. <select id="getAuditExportList" resultType="com.ydtech.modules.order.entity.vo.AuditExportVo">
  1343. SELECT
  1344. io.company_id,
  1345. iac.api_type,
  1346. iac.cross_insurance,
  1347. io.username,
  1348. iac.signing_time,
  1349. io.licenseno,
  1350. JSON_UNQUOTE(json_extract(io.applyinfo, '$.name')) as applyname,
  1351. io.ins_company,
  1352. io.product,
  1353. eic.namesimple,
  1354. iac.jqapplyno,
  1355. iac.syapplyno,
  1356. iac.cross_insurance,
  1357. iac.jqpremium,
  1358. iac.sypremium,
  1359. iac.jypremium,
  1360. iac.taxamount,
  1361. ifo.jq_costs_export_proportion + ifo.jq_export_other_costs_proportion AS jq_export_proportion,
  1362. ifo.sy_costs_export_proportion+ifo.sy_export_other_costs_proportion as sy_export_proportion,
  1363. ifo.no_costs_export_proportion+ifo.no_export_other_costs_proportion as no_export_proportion,
  1364. 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,
  1365. ifo.jq_supervise_costs_proportion + ifo.jq_other_costs_proportion as jq_entrance_proportion,
  1366. ifo.sy_supervise_costs_proportion + ifo.sy_other_costs_proportion as sy_entrance_proportion,
  1367. ifo.no_supervise_costs_proportion + ifo.no_other_costs_proportion as no_entrance_proportion,
  1368. 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,
  1369. ifo.jq_dept_premiums_level_1 + ifo.sy_dept_premiums_level_1 + ifo.no_dept_premiums_level_1 as dept_premiums_level_1,
  1370. ifo.jq_dept_premiums_level_2 + ifo.sy_dept_premiums_level_2 + ifo.no_dept_premiums_level_2 as dept_premiums_level_2,
  1371. ifo.jq_dept_premiums_level_3 + ifo.sy_dept_premiums_level_3 + ifo.no_dept_premiums_level_3 as dept_premiums_level_3,
  1372. ifo.jq_dept_premiums_level_4 + ifo.sy_dept_premiums_level_4 + ifo.no_dept_premiums_level_4 as dept_premiums_level_4,
  1373. ifo.jq_dept_premiums_level_5 + ifo.sy_dept_premiums_level_5 + ifo.no_dept_premiums_level_5 as dept_premiums_level_5,
  1374. ifo.first_detail_premiums,
  1375. ifo.second_detail_premiums,
  1376. ifo.third_detail_premiums,
  1377. ifo.jq_profit_margin_premiums,
  1378. ifo.sy_profit_margin_premiums,
  1379. ifo.no_profit_margin_premiums
  1380. FROM
  1381. ins_fee_order_new ifo
  1382. LEFT JOIN ins_fee_audit ifa ON ifo.ins_order_no = ifa.ins_order_no
  1383. left join ins_area_company iac on ifa.ins_order_no = iac.id
  1384. left join ins_orders io on iac.orderno = io.orderno
  1385. left join ptl_agreement pa on iac.agreement_id = pa.id
  1386. left join esm_ins_company eic on pa.partner_companies_id = eic.id
  1387. WHERE
  1388. iac.signing_time between #{param.signStartDate} and #{param.signEndDate}
  1389. <if test="param.audit != null and param.audit != ''">
  1390. AND
  1391. ifa.auditstatus = #{param.audit}
  1392. AND
  1393. io.orderstatus = 3
  1394. AND
  1395. iac.orderstatus = 3
  1396. GROUP BY
  1397. io.orderno,
  1398. iac.api_type,
  1399. iac.cross_insurance,
  1400. iac.signing_time,
  1401. eic.namesimple,
  1402. iac.jqapplyno,
  1403. iac.syapplyno,
  1404. iac.jqpremium,
  1405. iac.sypremium,
  1406. iac.jypremium,
  1407. iac.taxamount,
  1408. ifo.jq_costs_export_proportion,
  1409. ifo.jq_export_other_costs_proportion,
  1410. ifo.sy_costs_export_proportion,
  1411. ifo.sy_export_other_costs_proportion,
  1412. ifo.no_costs_export_proportion,
  1413. ifo.no_export_other_costs_proportion,
  1414. ifo.jq_export_supervise_costs_premiums,
  1415. ifo.sy_export_supervise_costs_premiums,
  1416. ifo.no_export_supervise_costs_premiums,
  1417. ifo.jq_export_other_costs_premiums,
  1418. ifo.sy_export_other_costs_premiums,
  1419. ifo.no_export_other_costs_premiums,
  1420. ifo.jq_supervise_costs_proportion,
  1421. ifo.jq_other_costs_proportion,
  1422. ifo.sy_supervise_costs_proportion,
  1423. ifo.sy_other_costs_proportion,
  1424. ifo.no_supervise_costs_proportion,
  1425. ifo.no_other_costs_proportion,
  1426. ifo.jq_supervise_costs_premiums,
  1427. ifo.jq_other_costs_premiums,
  1428. ifo.sy_supervise_costs_premiums,
  1429. ifo.sy_other_costs_premiums,
  1430. ifo.no_supervise_costs_premiums,
  1431. ifo.no_other_costs_premiums,
  1432. ifo.jq_dept_premiums_level_1,
  1433. ifo.jq_dept_premiums_level_2,
  1434. ifo.jq_dept_premiums_level_3,
  1435. ifo.jq_dept_premiums_level_4,
  1436. ifo.jq_dept_premiums_level_5,
  1437. ifo.sy_dept_premiums_level_1,
  1438. ifo.sy_dept_premiums_level_2,
  1439. ifo.sy_dept_premiums_level_3,
  1440. ifo.sy_dept_premiums_level_4,
  1441. ifo.sy_dept_premiums_level_5,
  1442. ifo.no_dept_premiums_level_1,
  1443. ifo.no_dept_premiums_level_2,
  1444. ifo.no_dept_premiums_level_3,
  1445. ifo.no_dept_premiums_level_4,
  1446. ifo.no_dept_premiums_level_5,
  1447. ifo.first_detail_premiums,
  1448. ifo.second_detail_premiums,
  1449. ifo.third_detail_premiums,
  1450. ifo.jq_profit_margin_premiums,
  1451. ifo.sy_profit_margin_premiums,
  1452. ifo.no_profit_margin_premiums
  1453. </if>
  1454. </select>
  1455. </mapper>