InsOrdersMapper.xml 89 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829
  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. <result property="leaderName" column="leader_name" jdbcType="VARCHAR"/>
  53. <result property="leaderId" column="leader_id" jdbcType="VARCHAR"/>
  54. <result property="underwritingStatus" column="underwritingStatus" jdbcType="INTEGER"/>
  55. <result property="entryStatus" column="entryStatus" jdbcType="VARCHAR"/>
  56. <result property="underwritingTime" column="underwritingTime" jdbcType="TIMESTAMP"/>
  57. <result property="payDate" column="payDate" jdbcType="TIMESTAMP"/>
  58. <result property="updateStatus" column="updateStatus" jdbcType="VARCHAR"/>
  59. <result property="updateStatusTime" column="updateStatusTime" jdbcType="TIMESTAMP"/>
  60. <result property="signingTime" column="signingTime" jdbcType="TIMESTAMP"/>
  61. </resultMap>
  62. <resultMap id="OrderResultMap" type="com.ydtech.modules.order.entity.vo.OrderVo">
  63. <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
  64. <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
  65. <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
  66. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  67. <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
  68. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  69. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  70. <result property="username" column="username" jdbcType="VARCHAR"/>
  71. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  72. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  73. <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
  74. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  75. <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  76. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  77. <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  78. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
  79. jdbcType="VARCHAR"/>
  80. <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
  81. <result property="entryStatus" column="entry_status" jdbcType="VARCHAR"/>
  82. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  83. <result property="product" column="product" jdbcType="VARCHAR"/>
  84. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  85. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  86. <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
  87. <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
  88. <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
  89. <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
  90. <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
  91. <result property="id" column="id" jdbcType="BIGINT"/>
  92. <result property="companyId" column="company_id" jdbcType="BIGINT"/>
  93. <result property="reptxt" column="reptxt" javaType="com.alibaba.fastjson.JSONObject"
  94. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  95. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  96. javaType="com.alibaba.fastjson.JSONObject"
  97. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  98. <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
  99. <result property="jqapplyno" column="jqapplyno" jdbcType="VARCHAR"/>
  100. <result property="jqpolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  101. <result property="syapplyno" column="syapplyno" jdbcType="VARCHAR"/>
  102. <result property="sypolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  103. <result property="riskinfo" column="riskinfo" javaType="com.alibaba.fastjson.JSONArray"
  104. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  105. <result property="kindinfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  106. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  107. <result property="jqpremium" column="jqpremium" jdbcType="DECIMAL"/>
  108. <result property="sypremium" column="sypremium" jdbcType="DECIMAL"/>
  109. <result property="jypremium" column="jypremium" jdbcType="DECIMAL"/>
  110. <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
  111. <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
  112. <result property="jqdiscountrate" column="jqdiscountrate" jdbcType="DOUBLE"/>
  113. <result property="sydiscountrate" column="sydiscountrate" jdbcType="DOUBLE"/>
  114. <result property="feerate" column="feerate" jdbcType="DOUBLE"/>
  115. <result property="disrate" column="disrate" jdbcType="DOUBLE"/>
  116. <result property="auditid" column="auditid" jdbcType="VARCHAR"/>
  117. <result property="auditname" column="auditname" jdbcType="VARCHAR"/>
  118. <result property="audittime" column="audittime" jdbcType="TIMESTAMP"/>
  119. <result property="auditopinion" column="auditopinion" jdbcType="VARCHAR"/>
  120. <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
  121. <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
  122. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  123. <result property="paymentLink" column="payment_link" jdbcType="VARCHAR"/>
  124. <result property="accidentInfo" column="accident_info" javaType="com.alibaba.fastjson.JSONArray"
  125. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  126. <result property="taxArrears" column="tax_arrears" javaType="com.alibaba.fastjson.JSONArray"
  127. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  128. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  129. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  130. <result property="ubiPredictedInfoScore" column="ubi_predicted_info_score" jdbcType="VARCHAR"/>
  131. <result property="signingTime" column="signingTime" jdbcType="TIMESTAMP"/>
  132. <result property="payDate" column="payDate" jdbcType="TIMESTAMP"/>
  133. <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
  134. </resultMap>
  135. <resultMap id="OrderExcelResultMap" type="com.ydtech.modules.ins.model.InsOrdersExcel">
  136. <id property="orderNo" column="orderno" jdbcType="VARCHAR"/>
  137. <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
  138. <result property="fraMeno" column="frameno" jdbcType="VARCHAR"/>
  139. <result property="carInfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  140. <result property="score" column="score" jdbcType="VARCHAR"/>
  141. <result property="ownerInfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  142. <result property="jqpRemIum" column="jqpremium" jdbcType="VARCHAR"/>
  143. <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
  144. <result property="jqPolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  145. <result property="sypRemIum" column="sypremium" jdbcType="VARCHAR"/>
  146. <result property="syPolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  147. <result property="jypRemIum" column="jypremium" jdbcType="VARCHAR"/>
  148. <result property="taxaMount" column="taxamount" jdbcType="VARCHAR"/>
  149. <result property="jqStartDate" column="jq_start_date" jdbcType="VARCHAR"/>
  150. <result property="jqEndDate" column="jq_end_date" jdbcType="VARCHAR"/>
  151. <result property="syStartDate" column="sy_start_date" jdbcType="VARCHAR"/>
  152. <result property="syEndDate" column="sy_end_date" jdbcType="VARCHAR"/>
  153. <result property="jqScore" column="jq_score" jdbcType="VARCHAR"/>
  154. <result property="syScore" column="sy_score" jdbcType="VARCHAR"/>
  155. <result property="lossRation" column="loss_ration" jdbcType="VARCHAR"/>
  156. <result property="jqLossRation" column="jq_loss_ration" jdbcType="VARCHAR"/>
  157. <result property="syLossRation" column="sy_loss_ration" jdbcType="VARCHAR"/>
  158. <result property="insCompany" column="inscompany" jdbcType="VARCHAR"/>
  159. <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
  160. <result property="userId" column="userid" jdbcType="VARCHAR"/>
  161. <result property="userName" column="username" jdbcType="VARCHAR"/>
  162. <result property="applyInfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  163. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  164. <result property="insureInfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  165. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  166. <result property="kindInfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  167. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  168. <result property="payDate" column="pay_date" jdbcType="VARCHAR"/>
  169. <result property="signingTime" column="signing_time" jdbcType="VARCHAR"/>
  170. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  171. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  172. <result property="product" column="product" jdbcType="VARCHAR"/>
  173. </resultMap>
  174. <sql id="Base_Column_List">
  175. orderno,quoteno,orderstatus,
  176. carinfo,userid,username,
  177. deptid,deptname,ownerinfo,
  178. applyinfo,insureinfo,agreeid,
  179. productid,product,createtime,
  180. frameno,licenseno,insuredname,
  181. jqstartdate,jqenddate,systartdate,
  182. syenddate
  183. </sql>
  184. <select id="getOrderAndAreaCompany" parameterType="java.lang.String" resultMap="OrderResultMap">
  185. select o.orderno,
  186. o.quoteno,
  187. o.carinfo,
  188. o.userid,
  189. o.username,
  190. o.deptid,
  191. o.deptname,
  192. o.ownerinfo,
  193. o.applyinfo,
  194. o.insureinfo,
  195. o.agreeid,
  196. iac.productid,
  197. iac.product,
  198. o.frameno,
  199. o.licenseno,
  200. o.insuredname,
  201. o.vehicle_and_vessel_tax,
  202. o.is_external,
  203. iac.jq_start_date as jqstartdate,
  204. iac.jq_end_date as jqenddate,
  205. iac.sy_start_date as systartdate,
  206. iac.sy_end_date as syenddate,
  207. iac.id,
  208. iac.api_type,
  209. iac.company_id,
  210. iac.reptxt,
  211. iac.orderstatus,
  212. iac.inscompany,
  213. iac.jqapplyno,
  214. iac.jqpolicyno,
  215. iac.syapplyno,
  216. iac.sypolicyno,
  217. iac.riskinfo,
  218. iac.kindinfo,
  219. iac.jqpremium,
  220. iac.sypremium,
  221. iac.jypremium,
  222. iac.taxamount,
  223. iac.sumpremium,
  224. iac.jqdiscountrate,
  225. iac.sydiscountrate,
  226. iac.feerate,
  227. iac.disrate,
  228. iac.auditid,
  229. iac.auditname,
  230. iac.audittime,
  231. iac.auditopinion,
  232. iac.jqappoint,
  233. iac.syappoint,
  234. iac.createtime,
  235. iac.payment_link,
  236. iac.accident_info,
  237. iac.tax_arrears,
  238. iac.cross_insurance,
  239. iac.ubi_predicted_info_score,
  240. iac.signing_time as signingTime,
  241. iac.pay_date as payDate,
  242. iac.agreement_id,
  243. o.entry_status,
  244. eic.namesimple as partnerCompaniesName
  245. from ins_orders as o
  246. join ins_area_company iac on o.orderno = iac.orderno
  247. LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
  248. LEFT JOIN esm_ins_company eic on eic.id = pa.partner_companies_id
  249. where iac.id = #{companyId}
  250. </select>
  251. <select id="getByUseridAndLicenseNo" resultType="com.ydtech.modules.order.entity.InsOrders"
  252. parameterType="com.ydtech.modules.order.entity.vo.VerifyOrdersVo">
  253. select orderno,
  254. quoteno,
  255. orderstatus,
  256. carinfo,
  257. userid,
  258. username,
  259. deptid,
  260. deptname,
  261. ownerinfo,
  262. applyinfo,
  263. insureinfo,
  264. agreeid,
  265. productid,
  266. product,
  267. createtime,
  268. frameno,
  269. licenseno,
  270. insuredname,
  271. jqstartdate,
  272. jqenddate,
  273. systartdate,
  274. syenddate,
  275. risk,
  276. king,
  277. vehicle_and_vessel_tax
  278. from ins_orders
  279. where userid = #{userId, jdbcType=VARCHAR}
  280. and licenseno = #{licenseNo, jdbcType=VARCHAR}
  281. and createtime > DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
  282. </select>
  283. <select id="queryPageOrderCount" resultType="Long">
  284. select
  285. count(1)
  286. from (
  287. select
  288. io.orderno
  289. from
  290. ins_orders io
  291. <!--如果存在 公司查询则进行连表 -->
  292. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  293. left JOIN
  294. ins_area_company iac on iac.orderno = io.orderno
  295. </if>
  296. <where>
  297. and (io.del_flag IS NULL
  298. or io.del_flag = 1)
  299. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  300. and io.orderno = #{orderQueryVo.orderNo}
  301. </if>
  302. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  303. and io.deptid like "${orderQueryVo.deptId}%"
  304. </if>
  305. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  306. and io.orderstatus = #{orderQueryVo.orderStatus}
  307. </if>
  308. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  309. and io.frameno = #{orderQueryVo.frameNo}
  310. </if>
  311. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  312. and io.licenseno = #{orderQueryVo.licenseNo}
  313. </if>
  314. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  315. and io.insuredname = #{orderQueryVo.insuredName}
  316. </if>
  317. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  318. and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  319. </if>
  320. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  321. and iac.company_id = #{orderQueryVo.companyId}
  322. </if>
  323. <!--
  324. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
  325. and io.operatorid = #{orderQueryVo.userId}
  326. </if>
  327. -->
  328. <choose>
  329. <when test="isCdy">
  330. <if test="deptId != null and deptId != '' ">
  331. and io.deptid like "${deptId}%"
  332. </if>
  333. </when>
  334. <when test="isDxFlag">
  335. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
  336. and io.userid in ( select id from sys_user where manager_id = #{orderQueryVo.userId} or id =
  337. #{orderQueryVo.userId} )
  338. </if>
  339. </when>
  340. <otherwise>
  341. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
  342. and io.userid = #{orderQueryVo.userId}
  343. </if>
  344. </otherwise>
  345. </choose>
  346. </where>
  347. group by io.orderno
  348. ) as s
  349. </select>
  350. <select id="queryPageOrder" resultMap="BaseResultMap">
  351. select
  352. io.*
  353. from
  354. ins_orders io
  355. <!--如果存在 公司查询则进行连表 -->
  356. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  357. left JOIN
  358. ins_area_company iac on iac.orderno = io.orderno
  359. </if>
  360. <where>
  361. and (io.del_flag IS NULL
  362. or io.del_flag = 1)
  363. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  364. and io.orderno = #{orderQueryVo.orderNo}
  365. </if>
  366. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  367. and io.deptid like "${orderQueryVo.deptId}%"
  368. </if>
  369. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  370. and io.orderstatus = #{orderQueryVo.orderStatus}
  371. </if>
  372. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  373. and io.frameno = #{orderQueryVo.frameNo}
  374. </if>
  375. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  376. and io.licenseno = #{orderQueryVo.licenseNo}
  377. </if>
  378. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  379. and io.insuredname = #{orderQueryVo.insuredName}
  380. </if>
  381. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  382. and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  383. </if>
  384. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  385. and iac.company_id = #{orderQueryVo.companyId}
  386. </if>
  387. <if test="orderQueryVo.product != null and orderQueryVo.product != ''">
  388. and io.product = #{orderQueryVo.product}
  389. </if>
  390. <if test="orderQueryVo.productid != null and orderQueryVo.productid != ''">
  391. and io.productid = #{orderQueryVo.productid}
  392. </if>
  393. <!--
  394. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
  395. and io.operatorid = #{orderQueryVo.userId}
  396. </if>
  397. -->
  398. <choose>
  399. <when test="isCdy">
  400. <if test="deptId != null and deptId != '' ">
  401. and io.deptid like "${deptId}%"
  402. </if>
  403. </when>
  404. <when test="isDxFlag">
  405. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
  406. and io.userid in ( select id from sys_user where manager_id = #{orderQueryVo.userId} or id =
  407. #{orderQueryVo.userId} )
  408. </if>
  409. </when>
  410. <otherwise>
  411. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
  412. and io.userid = #{orderQueryVo.userId}
  413. </if>
  414. </otherwise>
  415. </choose>
  416. </where>
  417. group by
  418. orderno
  419. order by io.createtime desc
  420. </select>
  421. <select id="queryOrderList" parameterType="com.ydtech.modules.ins.model.InsOrdersExcelVo" resultMap="OrderExcelResultMap">
  422. select
  423. a.orderno,
  424. a.licenseno,
  425. a.frameno,
  426. a.carinfo,
  427. b.api_type,
  428. b.score,
  429. a.ownerinfo,
  430. b.jqpremium,
  431. b.jqpolicyno,
  432. b.sypremium,
  433. b.sypolicyno,
  434. b.jypremium,
  435. b.taxamount,
  436. b.jq_start_date,
  437. b.jq_end_date,
  438. b.sy_start_date,
  439. b.sy_end_date,
  440. b.score,
  441. b.jq_score,
  442. b.sy_score,
  443. b.loss_ration,
  444. b.jq_loss_ration,
  445. b.sy_loss_ration,
  446. b.score,
  447. b.inscompany,
  448. b.agreement_id,
  449. a.userid,
  450. a.username,
  451. a.applyinfo,
  452. a.insureinfo,
  453. b.kindinfo,
  454. b.pay_date,
  455. b.signing_time,
  456. b.cross_insurance,
  457. b.product
  458. FROM ins_orders a LEFT JOIN ins_area_company b on a.orderno = b.orderno
  459. WHERE
  460. 1 = 1
  461. <if test="orderstatus != null and orderstatus != '' ">
  462. and b.orderstatus = #{orderstatus}
  463. </if>
  464. <if test="startDate != null ">
  465. and b.signing_time &gt;= #{startDate}
  466. </if>
  467. <if test="endDate != null ">
  468. and b.signing_time &lt;= #{endDate}
  469. </if>
  470. </select>
  471. <resultMap id="PolicyInsuranceReportMap" type="com.ydtech.modules.order.entity.vo.PolicyInsuranceReportResVo">
  472. <result property="insCompany" column="insCompany" jdbcType="VARCHAR"/>
  473. <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
  474. <result property="policyNo" column="policyNo" jdbcType="VARCHAR"/>
  475. <result property="quoteDate" column="quoteDate" jdbcType="VARCHAR"/>
  476. <result property="policyStartDate" column="policyStartDate" jdbcType="VARCHAR"/>
  477. <result property="riskName" column="riskName" jdbcType="VARCHAR"/>
  478. <result property="sumPremium" column="sumPremium" jdbcType="DECIMAL"/>
  479. <result property="taxPremium" column="taxPremium" jdbcType="DECIMAL"/>
  480. <result property="taxLaterPremium" column="taxLaterPremium" jdbcType="DECIMAL"/>
  481. <result property="insuranceSubAmount" column="insuranceSubAmount" jdbcType="VARCHAR"/>
  482. <result property="licenseNo" column="licenseNo" jdbcType="VARCHAR"/>
  483. <result property="vehicleUse" column="vehicleUse" jdbcType="VARCHAR"/>
  484. <result property="powerType" column="powerType" jdbcType="VARCHAR"/>
  485. <result property="ciModelClass" column="ciModelClass" jdbcType="VARCHAR"/>
  486. <result property="limitLoad" column="limitLoad" jdbcType="VARCHAR"/>
  487. <result property="appliName" column="appliName" jdbcType="VARCHAR"/>
  488. <result property="insureName" column="insureName" jdbcType="VARCHAR"/>
  489. <result property="deptName" column="deptName" jdbcType="VARCHAR"/>
  490. <result property="userName" column="username" jdbcType="VARCHAR"/>
  491. </resultMap>
  492. <select id="getPolicyInsuranceReport" resultMap="PolicyInsuranceReportMap">
  493. /*交强数据*/
  494. SELECT a.`inscompany` AS insCompany,
  495. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  496. a.`jqpolicyno` AS policyNo,
  497. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  498. a.pay_date AS quoteDate,
  499. </if>
  500. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  501. a.inside_pay_time AS quoteDate,
  502. </if>
  503. a.`jq_start_date` AS policyStartDate,
  504. '交强险' AS riskName,
  505. a.`jqpremium` AS sumPremium,
  506. a.`taxamount` AS taxPremium,
  507. getCarShipLateFee(a.`id`) AS taxLaterPremium,
  508. '交强险 : 200000.00,' AS insuranceSubAmount,
  509. b.`licenseno` AS licenseNo,
  510. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  511. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  512. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  513. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  514. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  515. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  516. b.`deptname` AS deptName,
  517. b.`username` AS userName
  518. FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
  519. AND a.`orderno`=b.`orderno`
  520. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  521. and b.deptid = #{policyReqVo.deptId}
  522. </if>
  523. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  524. and b.userid = #{policyReqVo.userId}
  525. </if>
  526. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  527. and b.username = #{policyReqVo.userName}
  528. </if>
  529. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  530. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  531. </if>
  532. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  533. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  534. </if>
  535. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  536. and b.productid = #{policyReqVo.productId}
  537. </if>
  538. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  539. and a.company_id = #{policyReqVo.insCompany}
  540. </if>
  541. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  542. and a.operatorid = #{policyReqVo.operatorId}
  543. </if>
  544. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  545. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  546. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  547. </if>
  548. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  549. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  550. </if>
  551. </if>
  552. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  553. and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  554. </if>
  555. UNION ALL
  556. /*##商业数据*/
  557. SELECT a.`inscompany` AS insCompany,
  558. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  559. a.`sypolicyno` AS policyNo,
  560. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  561. a.pay_date AS quoteDate,
  562. </if>
  563. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  564. a.inside_pay_time AS quoteDate,
  565. </if>
  566. a.`sy_start_date` AS policyStartDate,
  567. '商业险' AS riskName,
  568. a.`sypremium` AS sumPremium,
  569. '' AS taxPremium,
  570. '' AS taxLaterPremium,
  571. getSyAmount(a.`orderno`) AS insuranceSubAmount,
  572. b.`licenseno` AS licenseNo,
  573. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  574. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  575. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  576. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  577. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  578. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  579. b.`deptname` AS deptName,
  580. b.`username` AS userName
  581. FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
  582. AND a.`orderno`=b.`orderno`
  583. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  584. and b.deptid = #{policyReqVo.deptId}
  585. </if>
  586. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  587. and b.userid = #{policyReqVo.userId}
  588. </if>
  589. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  590. and b.username = #{policyReqVo.userName}
  591. </if>
  592. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  593. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  594. </if>
  595. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  596. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  597. </if>
  598. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  599. and b.productid = #{policyReqVo.productId}
  600. </if>
  601. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  602. and a.company_id = #{policyReqVo.insCompany}
  603. </if>
  604. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  605. and a.operatorid = #{policyReqVo.operatorId}
  606. </if>
  607. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  608. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  609. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  610. </if>
  611. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  612. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  613. </if>
  614. </if>
  615. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  616. and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  617. </if>
  618. </select>
  619. <select id="getPolicyInsuranceReportCount" resultType="Long">
  620. select
  621. count(1)
  622. from (
  623. /*交强数据*/
  624. SELECT a.`inscompany` AS insCompany,
  625. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  626. a.`jqpolicyno` AS policyNo,
  627. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  628. a.pay_date AS quoteDate,
  629. </if>
  630. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  631. a.inside_pay_time AS quoteDate,
  632. </if>
  633. a.`jq_start_date` AS policyStartDate,
  634. '交强险' AS riskName,
  635. a.`jqpremium` AS sumPremium,
  636. a.`taxamount` AS taxPremium,
  637. getCarShipLateFee(a.`id`) AS taxLaterPremium,
  638. '交强险 : 200000.00,' AS insuranceSubAmount,
  639. b.`licenseno` AS licenseNo,
  640. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  641. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  642. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  643. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  644. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  645. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  646. b.`deptname` AS deptName,
  647. b.`username` AS userName
  648. FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
  649. AND a.`orderno`=b.`orderno`
  650. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  651. and b.deptid = #{policyReqVo.deptId}
  652. </if>
  653. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  654. and b.userid = #{policyReqVo.userId}
  655. </if>
  656. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  657. and b.username = #{policyReqVo.userName}
  658. </if>
  659. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  660. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  661. </if>
  662. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  663. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  664. </if>
  665. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  666. and b.productid = #{policyReqVo.productId}
  667. </if>
  668. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  669. and a.company_id = #{policyReqVo.insCompany}
  670. </if>
  671. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  672. and a.operatorid = #{policyReqVo.operatorId}
  673. </if>
  674. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  675. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  676. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  677. </if>
  678. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  679. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  680. </if>
  681. </if>
  682. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  683. and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  684. </if>
  685. UNION ALL
  686. /*##商业数据*/
  687. SELECT a.`inscompany` AS insCompany,
  688. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  689. a.`sypolicyno` AS policyNo,
  690. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  691. a.pay_date AS quoteDate,
  692. </if>
  693. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  694. a.inside_pay_time AS quoteDate,
  695. </if>
  696. a.`sy_start_date` AS policyStartDate,
  697. '商业险' AS riskName,
  698. a.`sypremium` AS sumPremium,
  699. '' AS taxPremium,
  700. '' AS taxLaterPremium,
  701. getSyAmount(a.`orderno`) AS insuranceSubAmount,
  702. b.`licenseno` AS licenseNo,
  703. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  704. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  705. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  706. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  707. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  708. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  709. b.`deptname` AS deptName,
  710. b.`username` AS userName
  711. FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
  712. AND a.`orderno`=b.`orderno`
  713. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  714. and b.deptid = #{policyReqVo.deptId}
  715. </if>
  716. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  717. and b.userid = #{policyReqVo.userId}
  718. </if>
  719. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  720. and b.username = #{policyReqVo.userName}
  721. </if>
  722. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  723. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  724. </if>
  725. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  726. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  727. </if>
  728. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  729. and b.productid = #{policyReqVo.productId}
  730. </if>
  731. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  732. and a.company_id = #{policyReqVo.insCompany}
  733. </if>
  734. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  735. and a.operatorid = #{policyReqVo.operatorId}
  736. </if>
  737. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  738. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  739. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  740. </if>
  741. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  742. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  743. </if>
  744. </if>
  745. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  746. and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  747. </if>
  748. ) as s
  749. </select>
  750. <update id="updateStatus">
  751. update ins_orders set orderstatus = #{status} where orderno = #{orderno}
  752. </update>
  753. <select id="queryPageHospitalityOrder" resultMap="BaseResultMap">
  754. select
  755. io.*,
  756. iac.orderno
  757. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  758. ,eic.namesimple as partnerCompaniesName
  759. </if>
  760. from
  761. ins_orders io
  762. left JOIN
  763. ins_area_company iac on iac.orderno = io.orderno
  764. LEFT JOIN
  765. ptl_agreement pa on pa.id = iac.agreement_id
  766. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  767. LEFT JOIN
  768. esm_ins_company eic on eic.id = pa.partner_companies_id
  769. </if>
  770. <where>
  771. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  772. and io.orderno = #{orderQueryVo.orderNo}
  773. </if>
  774. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' ">
  775. and io.deptid like "${orderQueryVo.deptId}%"
  776. </if>
  777. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  778. and io.orderstatus = #{orderQueryVo.orderStatus}
  779. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  780. and iac.orderstatus = #{orderQueryVo.orderStatus}
  781. </if>
  782. </if>
  783. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  784. and io.frameno = #{orderQueryVo.frameNo}
  785. </if>
  786. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  787. and io.licenseno = #{orderQueryVo.licenseNo}
  788. </if>
  789. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  790. and io.insuredname = #{orderQueryVo.insuredName}
  791. </if>
  792. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  793. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  794. </if>
  795. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  796. and iac.company_id = #{orderQueryVo.companyId}
  797. </if>
  798. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  799. and io.userid = #{orderQueryVo.userId}
  800. </if>
  801. and (io.del_flag IS NULL
  802. or io.del_flag = 1)
  803. </where>
  804. group by io.orderno
  805. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  806. ,eic.namesimple
  807. </if>
  808. order by io.createtime desc
  809. </select>
  810. <select id="queryPageHospitalityOrderCount" resultType="Long">
  811. select
  812. count(1)
  813. from (
  814. select
  815. io.orderno
  816. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  817. ,eic.namesimple as partnerCompaniesName
  818. </if>
  819. from
  820. ins_orders io
  821. left JOIN
  822. ins_area_company iac on iac.orderno = io.orderno
  823. LEFT JOIN
  824. ptl_agreement pa on pa.id = iac.agreement_id
  825. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  826. LEFT JOIN
  827. esm_ins_company eic on eic.id = pa.partner_companies_id
  828. </if>
  829. <where>
  830. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  831. and io.orderno = #{orderQueryVo.orderNo}
  832. </if>
  833. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' ">
  834. and io.deptid like "${orderQueryVo.deptId}%"
  835. </if>
  836. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  837. and io.orderstatus = #{orderQueryVo.orderStatus}
  838. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  839. and iac.orderstatus = #{orderQueryVo.orderStatus}
  840. </if>
  841. </if>
  842. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  843. and io.frameno = #{orderQueryVo.frameNo}
  844. </if>
  845. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  846. and io.licenseno = #{orderQueryVo.licenseNo}
  847. </if>
  848. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  849. and io.insuredname = #{orderQueryVo.insuredName}
  850. </if>
  851. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  852. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  853. </if>
  854. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  855. and iac.company_id = #{orderQueryVo.companyId}
  856. </if>
  857. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  858. and io.userid = #{orderQueryVo.userId}
  859. </if>
  860. </where>
  861. group by io.orderno
  862. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  863. ,eic.namesimple
  864. </if>
  865. order by io.createtime desc
  866. ) as s
  867. </select>
  868. <select id="queryPageOrderByLinkType" resultMap="BaseResultMap">
  869. select
  870. io.orderno as orderno,
  871. io.quoteno as quoteno,
  872. iac.orderstatus as orderstatus,
  873. io.carinfo as carinfo,
  874. io.userid as userid,
  875. io.username as username,
  876. io.deptid as deptid,
  877. io.deptname as deptname,
  878. io.ownerinfo as ownerinfo,
  879. io.applyinfo as applyinfo,
  880. io.insureinfo as insureinfo,
  881. io.agreeid as agreeid,
  882. iac.productid as productid,
  883. iac.product as product,
  884. iac.createtime as createtime,
  885. io.frameno as frameno,
  886. io.licenseno as licenseno,
  887. REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') as insuredname,
  888. iac.jq_start_date as jqstartdate,
  889. iac.jq_end_date as jqenddate,
  890. iac.sy_start_date as systartdate,
  891. iac.sy_end_date as syenddate,
  892. iac.jqpremium as jqpremium,
  893. iac.sypremium as sypremium,
  894. iac.jypremium as jypremium,
  895. iac.taxamount as taxamount,
  896. io.risk as risk,
  897. io.king as king,
  898. io.vehicle_and_vessel_tax as vehicleAndVesselTax,
  899. iac.id as subOrderId,
  900. iac.underwriting_status as underwritingStatus,
  901. iac.company_id as company_id,
  902. iac.inscompany as ins_company,
  903. agree.agreement_code as agreementCode,
  904. agree.agreement_name as agreementName,
  905. company.namesimple as partnerCompaniesName,
  906. dept.province,
  907. dept.city,
  908. dept.area,
  909. d1.area_cname as province_name,
  910. d2.area_cname as city_name,
  911. d3.area_cname as area_name,
  912. concat(d1.area_cname,d2.area_cname,d3.area_cname) as area_info,
  913. iac.api_type,
  914. io.is_external,
  915. u.leader_name,
  916. u.leader_id,
  917. CASE dept.management_source
  918. WHEN '1' THEN '渠道'
  919. WHEN '2' THEN '个代'
  920. WHEN '3' THEN '电销'
  921. ELSE '' END
  922. AS managementSource,
  923. io.entry_status as entryStatus,
  924. iac.underwriting_time as underwritingTime,
  925. iac.pay_date as payDate,
  926. iac.update_status AS updateStatus,
  927. iac.update_status_time AS updateStatusTime,
  928. iac.signing_time as signingTime
  929. from
  930. ins_area_company iac
  931. left JOIN
  932. ins_orders io on iac.orderno = io.orderno
  933. left join
  934. ptl_agreement agree on iac.agreement_id= agree.id
  935. left join
  936. esm_ins_company company on agree.partner_companies_id= company.id
  937. LEFT JOIN
  938. sys_dept dept ON dept.id = io.deptid
  939. LEFT JOIN sys_dept pdept on dept.parent_id = pdept.id
  940. LEFT JOIN sys_area d1 ON d1.area_code = pdept.province
  941. LEFT JOIN sys_area d2 ON d2.area_code = pdept.city
  942. LEFT JOIN sys_area d3 ON d3.area_code = pdept.area
  943. LEFT JOIN
  944. sys_user u on io.userid = u.id
  945. <where>
  946. <if test="agentUserIds != null and agentUserIds.size>0" >
  947. AND (
  948. (io.userid in
  949. <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
  950. #{item}
  951. </foreach>
  952. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
  953. <if test="deptIds != null and deptIds.size>0" >
  954. AND (
  955. <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
  956. io.deptid like CONCAT('', #{item}, '%')
  957. </foreach>
  958. )
  959. </if>
  960. )
  961. <if test="flag" >
  962. OR iac.operator_id = #{orderQueryVo.userId}
  963. </if>
  964. )
  965. </if>
  966. <if test="agreeIds != null and agreeIds.size>0">
  967. AND (
  968. (iac.agreement_id in
  969. <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
  970. #{item}
  971. </foreach>
  972. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
  973. <if test="flag" >
  974. OR iac.operator_id = #{orderQueryVo.userId}
  975. </if>
  976. )
  977. </if>
  978. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  979. and iac.id = #{orderQueryVo.orderNo}
  980. </if>
  981. <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource != ''">
  982. and dept.management_source = #{orderQueryVo.managementSource}
  983. </if>
  984. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  985. and io.deptid like "${orderQueryVo.deptId}%"
  986. </if>
  987. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  988. and iac.orderstatus= #{orderQueryVo.orderStatus}
  989. </if>
  990. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  991. and io.frameno = #{orderQueryVo.frameNo}
  992. </if>
  993. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  994. and io.licenseno = #{orderQueryVo.licenseNo}
  995. </if>
  996. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  997. and REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') = #{orderQueryVo.insuredName}
  998. </if>
  999. <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
  1000. and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{orderQueryVo.quoteStartDateStr} AND #{orderQueryVo.quoteEndDateStr}
  1001. </if>
  1002. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  1003. and iac.company_id = #{orderQueryVo.companyId}
  1004. </if>
  1005. <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
  1006. and io.userid = #{orderQueryVo.operatorId}
  1007. </if>
  1008. <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
  1009. and io.username = #{orderQueryVo.operatorName}
  1010. </if>
  1011. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  1012. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  1013. </if>
  1014. <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
  1015. and io.deptid like "${orderQueryVo.provinceId}%"
  1016. </if>
  1017. <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
  1018. and io.deptid like "${orderQueryVo.cityId}%"
  1019. </if>
  1020. <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
  1021. and io.deptid like "${orderQueryVo.countyId}%"
  1022. </if>
  1023. <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
  1024. and io.deptid like "${orderQueryVo.houseId}%"
  1025. </if>
  1026. <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
  1027. and iac.agreement_id = #{orderQueryVo.agreeId}
  1028. </if>
  1029. <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
  1030. and io.orderno = #{orderQueryVo.taskNo}
  1031. </if>
  1032. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  1033. and iac.product = #{orderQueryVo.riskCode}
  1034. </if>
  1035. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1036. and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
  1037. </if>
  1038. <if test="orderQueryVo.leaderId != null and orderQueryVo.leaderId != ''">
  1039. and u.leader_id = #{orderQueryVo.leaderId}
  1040. </if>
  1041. <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
  1042. and u.leader_name = #{orderQueryVo.leaderName}
  1043. </if>
  1044. <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
  1045. and ((
  1046. DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
  1047. AND #{orderQueryVo.attachEndDateStr}
  1048. )
  1049. OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
  1050. )
  1051. </if>
  1052. <choose>
  1053. <when test="type==1">
  1054. and dept.management_source=1
  1055. </when>
  1056. <when test="type==2">
  1057. and dept.management_source=2
  1058. </when>
  1059. </choose>
  1060. <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
  1061. and DATE_FORMAT(iac.signing_time, '%Y-%m-%d') between #{orderQueryVo.signStartDateStr} AND #{orderQueryVo.signEndDateStr}
  1062. </if>
  1063. <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
  1064. and io.entry_status = #{orderQueryVo.entryStatus }
  1065. </if>
  1066. <if test="orderQueryVo.payStartDateStr != null and orderQueryVo.payEndDateStr != null">
  1067. and DATE_FORMAT(iac.pay_date, '%Y-%m-%d') between #{orderQueryVo.payStartDateStr} AND #{orderQueryVo.payEndDateStr}
  1068. </if>
  1069. <if test="orderQueryVo.auditStartDateStr != null and orderQueryVo.auditEndDateStr != null">
  1070. and DATE_FORMAT(iac.underwriting_time, '%Y-%m-%d') between #{orderQueryVo.auditStartDateStr} AND #{orderQueryVo.auditEndDateStr}
  1071. </if>
  1072. <if test="orderQueryVo.updateStartDateStr != null and orderQueryVo.updateEndDateStr != null">
  1073. and DATE_FORMAT( iac.update_status_time, '%Y-%m-%d') between #{orderQueryVo.updateStartDateStr} AND #{orderQueryVo.updateEndDateStr}
  1074. </if>
  1075. <if test="orderQueryVo.updateStatus != null and orderQueryVo.updateStatus != null">
  1076. and iac.update_status = #{orderQueryVo.updateStatus}
  1077. </if>
  1078. and (iac.del_flag = '1' or io.del_flag IS NULL or io.del_flag = 1)
  1079. </where>
  1080. order by io.createtime desc
  1081. </select>
  1082. <select id="queryPageOrderByLinkTypeCount" resultType="Long">
  1083. select
  1084. count(1)
  1085. from (
  1086. select
  1087. (0)
  1088. from
  1089. ins_area_company iac
  1090. left JOIN
  1091. ins_orders io on iac.orderno = io.orderno
  1092. LEFT JOIN
  1093. sys_dept dept ON dept.id = io.deptid
  1094. LEFT JOIN
  1095. sys_user u on io.userid = u.id
  1096. <where>
  1097. <if test="agentUserIds != null and agentUserIds.size>0" >
  1098. AND (
  1099. (io.userid in
  1100. <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
  1101. #{item}
  1102. </foreach>
  1103. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
  1104. <if test="deptIds != null and deptIds.size>0" >
  1105. AND (
  1106. <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
  1107. io.deptid like CONCAT('', #{item}, '%')
  1108. </foreach>
  1109. )
  1110. </if>
  1111. )
  1112. <if test="flag" >
  1113. OR iac.operator_id = #{orderQueryVo.userId}
  1114. </if>
  1115. )
  1116. </if>
  1117. <if test="agreeIds != null and agreeIds.size>0">
  1118. AND (
  1119. (iac.agreement_id in
  1120. <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
  1121. #{item}
  1122. </foreach>
  1123. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
  1124. <if test="flag" >
  1125. OR iac.operator_id = #{orderQueryVo.userId}
  1126. </if>
  1127. )
  1128. </if>
  1129. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  1130. and iac.id = #{orderQueryVo.orderNo}
  1131. </if>
  1132. <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource != ''">
  1133. and dept.management_source = #{orderQueryVo.managementSource}
  1134. </if>
  1135. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  1136. and io.deptid like "${orderQueryVo.deptId}%"
  1137. </if>
  1138. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  1139. and iac.orderstatus= #{orderQueryVo.orderStatus}
  1140. </if>
  1141. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  1142. and io.frameno = #{orderQueryVo.frameNo}
  1143. </if>
  1144. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  1145. and io.licenseno = #{orderQueryVo.licenseNo}
  1146. </if>
  1147. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  1148. and REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') = #{orderQueryVo.insuredName}
  1149. </if>
  1150. <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
  1151. and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{orderQueryVo.quoteStartDateStr} AND #{orderQueryVo.quoteEndDateStr}
  1152. </if>
  1153. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  1154. and iac.company_id = #{orderQueryVo.companyId}
  1155. </if>
  1156. <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
  1157. and io.userid = #{orderQueryVo.operatorId}
  1158. </if>
  1159. <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
  1160. and io.username = #{orderQueryVo.operatorName}
  1161. </if>
  1162. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  1163. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  1164. </if>
  1165. <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
  1166. and io.deptid like "${orderQueryVo.provinceId}%"
  1167. </if>
  1168. <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
  1169. and io.deptid like "${orderQueryVo.cityId}%"
  1170. </if>
  1171. <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
  1172. and io.deptid like "${orderQueryVo.countyId}%"
  1173. </if>
  1174. <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
  1175. and io.deptid like "${orderQueryVo.houseId}%"
  1176. </if>
  1177. <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
  1178. and iac.agreement_id = #{orderQueryVo.agreeId}
  1179. </if>
  1180. <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
  1181. and io.orderno = #{orderQueryVo.taskNo}
  1182. </if>
  1183. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  1184. and iac.product = #{orderQueryVo.riskCode}
  1185. </if>
  1186. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1187. and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
  1188. </if>
  1189. <if test="orderQueryVo.leaderId != null and orderQueryVo.leaderId != ''">
  1190. and u.leader_id = #{orderQueryVo.leaderId}
  1191. </if>
  1192. <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
  1193. and u.leader_name = #{orderQueryVo.leaderName}
  1194. </if>
  1195. <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
  1196. and ((
  1197. DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
  1198. AND #{orderQueryVo.attachEndDateStr}
  1199. )
  1200. OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
  1201. )
  1202. </if>
  1203. <choose>
  1204. <when test="type==1">
  1205. and dept.management_source=1
  1206. </when>
  1207. <when test="type==2">
  1208. and dept.management_source=2
  1209. </when>
  1210. </choose>
  1211. <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
  1212. and DATE_FORMAT(iac.signing_time, '%Y-%m-%d') between #{orderQueryVo.signStartDateStr} AND #{orderQueryVo.signEndDateStr}
  1213. </if>
  1214. <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
  1215. and io.entry_status = #{orderQueryVo.entryStatus }
  1216. </if>
  1217. <if test="orderQueryVo.payStartDateStr != null and orderQueryVo.payEndDateStr != null">
  1218. and DATE_FORMAT(iac.pay_date, '%Y-%m-%d') between #{orderQueryVo.payStartDateStr} AND #{orderQueryVo.payEndDateStr}
  1219. </if>
  1220. <if test="orderQueryVo.auditStartDateStr != null and orderQueryVo.auditEndDateStr != null">
  1221. and DATE_FORMAT(iac.underwriting_time, '%Y-%m-%d') between #{orderQueryVo.auditStartDateStr} AND #{orderQueryVo.auditEndDateStr}
  1222. </if>
  1223. <if test="orderQueryVo.updateStartDateStr != null and orderQueryVo.updateEndDateStr != null">
  1224. and DATE_FORMAT( iac.update_status_time, '%Y-%m-%d') between #{orderQueryVo.updateStartDateStr} AND #{orderQueryVo.updateEndDateStr}
  1225. </if>
  1226. <if test="orderQueryVo.updateStatus != null and orderQueryVo.updateStatus != null">
  1227. and iac.update_status = #{orderQueryVo.updateStatus}
  1228. </if>
  1229. and (iac.del_flag = '1' or io.del_flag IS NULL or io.del_flag = 1)
  1230. </where>
  1231. ) as s
  1232. </select>
  1233. <select id="queryPageSubOrders" resultMap="BaseResultMap">
  1234. select
  1235. io.*,
  1236. iac.id as subOrderId
  1237. from
  1238. ins_area_company iac
  1239. left JOIN
  1240. ins_orders io on iac.orderno = io.orderno
  1241. <where>
  1242. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  1243. and io.userid = #{orderQueryVo.userid}
  1244. </if>
  1245. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  1246. and io.orderno = #{orderQueryVo.orderNo}
  1247. </if>
  1248. <if test="orderQueryVo.quoteNo != null and orderQueryVo.quoteNo != ''">
  1249. and io.quoteno = #{orderQueryVo.quoteNo}
  1250. </if>
  1251. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  1252. and io.deptid like "${orderQueryVo.deptId}%"
  1253. </if>
  1254. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  1255. and iac.orderstatus = #{orderQueryVo.orderStatus}
  1256. </if>
  1257. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  1258. and io.frameno = #{orderQueryVo.frameNo}
  1259. </if>
  1260. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  1261. and io.licenseno = #{orderQueryVo.licenseNo}
  1262. </if>
  1263. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  1264. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  1265. </if>
  1266. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  1267. and io.insuredname = #{orderQueryVo.insuredName}
  1268. </if>
  1269. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  1270. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  1271. </if>
  1272. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  1273. and iac.company_id = #{orderQueryVo.companyId}
  1274. </if>
  1275. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  1276. and iac.product = #{orderQueryVo.riskCode}
  1277. </if>
  1278. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1279. and IFNULL( io.agreeid, '' ) = #{orderQueryVo.auditId}
  1280. </if>
  1281. <if test="orderQueryVo.policyStartDate != null and orderQueryVo.policyEndDate != ''">
  1282. and ((
  1283. io.jqstartdate BETWEEN #{orderQueryVo.policyStartDate}
  1284. AND #{orderQueryVo.policyEndDate}
  1285. )
  1286. OR ( io.systartdate BETWEEN #{orderQueryVo.policyStartDate} AND #{orderQueryVo.policyEndDate} )
  1287. )
  1288. </if>
  1289. </where>
  1290. group by iac.id
  1291. order by io.createtime desc
  1292. </select>
  1293. <select id="queryPageSubOrdersCount" resultType="Long">
  1294. select
  1295. count(1)
  1296. from (
  1297. select
  1298. io.*
  1299. from
  1300. ins_area_company iac
  1301. left JOIN
  1302. ins_orders io on iac.orderno = io.orderno
  1303. <where>
  1304. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  1305. and io.userid = #{orderQueryVo.userid}
  1306. </if>
  1307. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  1308. and io.orderno = #{orderQueryVo.orderNo}
  1309. </if>
  1310. <if test="orderQueryVo.quoteNo != null and orderQueryVo.quoteNo != ''">
  1311. and io.quoteno = #{orderQueryVo.quoteNo}
  1312. </if>
  1313. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  1314. and io.deptid like "${orderQueryVo.deptId}%"
  1315. </if>
  1316. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  1317. and iac.orderstatus = #{orderQueryVo.orderStatus}
  1318. </if>
  1319. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  1320. and io.frameno = #{orderQueryVo.frameNo}
  1321. </if>
  1322. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  1323. and io.licenseno = #{orderQueryVo.licenseNo}
  1324. </if>
  1325. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  1326. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  1327. </if>
  1328. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  1329. and io.insuredname = #{orderQueryVo.insuredName}
  1330. </if>
  1331. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  1332. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  1333. </if>
  1334. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  1335. and iac.company_id = #{orderQueryVo.companyId}
  1336. </if>
  1337. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  1338. and iac.product = #{orderQueryVo.riskCode}
  1339. </if>
  1340. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1341. and IFNULL( io.agreeid, '' ) = #{orderQueryVo.auditId}
  1342. </if>
  1343. <if test="orderQueryVo.policyStartDate != null and orderQueryVo.policyEndDate != ''">
  1344. and ((
  1345. io.jqstartdate BETWEEN #{orderQueryVo.policyStartDate}
  1346. AND #{orderQueryVo.policyEndDate}
  1347. )
  1348. OR ( io.systartdate BETWEEN #{orderQueryVo.policyStartDate} AND #{orderQueryVo.policyEndDate} )
  1349. )
  1350. </if>
  1351. </where>
  1352. group by iac.id
  1353. ) as s
  1354. </select>
  1355. <select id="selectEntityByinsOrderNo" resultMap="OrderResultMap">
  1356. select o.orderno,
  1357. o.quoteno,
  1358. o.frameno,
  1359. o.licenseno,
  1360. iac.jq_start_date as jqstartdate,
  1361. iac.jq_end_date as jqenddate,
  1362. iac.sy_start_date as systartdate,
  1363. iac.sy_end_date as syenddate,
  1364. iac.id,
  1365. iac.company_id,
  1366. iac.reptxt,
  1367. iac.orderstatus,
  1368. iac.inscompany,
  1369. iac.jqapplyno,
  1370. iac.jqpolicyno,
  1371. iac.syapplyno,
  1372. iac.sypolicyno,
  1373. iac.riskinfo,
  1374. iac.kindinfo,
  1375. iac.jqpremium,
  1376. iac.sypremium,
  1377. iac.jypremium,
  1378. iac.taxamount,
  1379. iac.sumpremium,
  1380. iac.jqdiscountrate,
  1381. iac.sydiscountrate,
  1382. iac.feerate,
  1383. iac.disrate,
  1384. iac.auditid,
  1385. iac.auditname,
  1386. iac.audittime,
  1387. iac.auditopinion,
  1388. iac.jqappoint,
  1389. iac.syappoint,
  1390. iac.createtime,
  1391. iac.payment_link,
  1392. iac.accident_info,
  1393. iac.tax_arrears,
  1394. iac.cross_insurance,
  1395. iac.ubi_predicted_info_score
  1396. from ins_area_company iac
  1397. join ins_orders as o on o.orderno = iac.orderno
  1398. where
  1399. iac.id = #{insOrderNo}
  1400. <if test="timeFiltering != null and timeFiltering != ''">
  1401. and DATE_FORMAT(iac.signing_time, '%Y-%m') = #{timeFiltering}
  1402. </if>
  1403. </select>
  1404. <select id="getExpirationInsureCount" resultType="Integer">
  1405. SELECT
  1406. count( b.orderno ) AS count
  1407. FROM
  1408. ins_orders a
  1409. left join
  1410. ins_area_company b
  1411. on a.orderno = b.orderno
  1412. WHERE
  1413. <if test="isJq == 1">
  1414. jqenddate BETWEEN #{startDate} AND #{endDate}
  1415. </if>
  1416. <if test="isJq == 2">
  1417. syenddate BETWEEN #{startDate} AND #{endDate}
  1418. </if>
  1419. AND a.orderstatus = 3
  1420. AND b.orderstatus = 3
  1421. <if test="param != null and param != ''">
  1422. AND (a.licenseno = #{param} or a.ins_company = #{param})
  1423. </if>
  1424. <if test="userId != null and userId != ''">
  1425. AND a.userid = #{userId}
  1426. </if>
  1427. </select>
  1428. <select id="getExpirationInsure" resultType="com.ydtech.modules.order.entity.vo.OrderExpirationVo">
  1429. SELECT
  1430. a.ins_company,
  1431. b.id as orderno,
  1432. b.jq_end_date,
  1433. b.sy_end_date,
  1434. b.productid,
  1435. b.product,
  1436. a.licenseno,
  1437. case when b.jq_end_date is not null then DATEDIFF( b.jq_end_date,NOW() ) else null end AS jqDiff,
  1438. case when b.sy_end_date is not null then DATEDIFF( b.sy_end_date,NOW() ) else null end AS syDiff
  1439. FROM ins_orders a,ins_area_company b
  1440. WHERE a.orderno = b.orderno
  1441. AND (b.jq_end_date BETWEEN #{order.jqStartDate} AND #{order.jqEndDate} or b.sy_end_date BETWEEN #{order.syStartDate} AND #{order.syEndDate})
  1442. AND b.orderstatus = 3
  1443. <if test="order.param != null and order.param != ''">
  1444. AND (a.licenseno = #{order.param} or a.ins_company = #{order.param})
  1445. </if>
  1446. <if test="order.userid != null and order.userid != ''">
  1447. AND a.userid = #{order.userid}
  1448. </if>
  1449. ORDER BY least(IFNULL(jqDiff, 9999999) , IFNULL(syDiff, 9999999)) asc
  1450. </select>
  1451. <select id="getCarBusinessDetailList" resultType="com.ydtech.modules.order.entity.vo.CarBusinessDetailVo">
  1452. SELECT
  1453. io.username,
  1454. iac.signing_time as sign_date,
  1455. io.licenseno,
  1456. JSON_UNQUOTE(json_extract(io.applyinfo, '$.name')) as applyname,
  1457. io.product,
  1458. io.ins_company as inscompany,
  1459. iac.jqpremium,
  1460. iac.sypremium,
  1461. iac.jypremium,
  1462. iac.taxamount,
  1463. ifo.jq_costs_export_proportion+ifo.jq_export_other_costs_proportion as jq_export_proportion,
  1464. ifo.sy_costs_export_proportion+ifo.sy_export_other_costs_proportion as sy_export_proportion,
  1465. ifo.no_costs_export_proportion+ifo.no_export_other_costs_proportion as no_export_proportion,
  1466. 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,
  1467. CASE ifa.auditstatus
  1468. WHEN 1 THEN
  1469. '已审核'
  1470. ELSE
  1471. '未审核'
  1472. END as audittype,
  1473. ifa.audittime as audit_date
  1474. FROM
  1475. ins_orders io
  1476. LEFT JOIN ins_area_company iac ON io.orderno = iac.orderno
  1477. LEFT JOIN ins_fee_order_new ifo ON iac.id = ifo.ins_order_no
  1478. left join ins_fee_audit ifa on ifo.ins_order_no = ifa.ins_order_no
  1479. WHERE
  1480. io.userid = #{userId}
  1481. AND io.orderstatus = 3
  1482. AND iac.orderstatus = 3
  1483. AND iac.signing_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
  1484. </select>
  1485. <select id="getRevenueExpenditureDetailList" resultType="com.ydtech.modules.order.entity.vo.RevenueExpenditureDetailVo">
  1486. SELECT
  1487. sua.create_time,
  1488. io.licenseno,
  1489. sua.amount,
  1490. sua.business_eegments_type,
  1491. sua.documentary,
  1492. sua.property
  1493. FROM
  1494. sys_user_account_history sua
  1495. left join ins_area_company iac on sua.suborder = iac.id
  1496. left join ins_orders io on iac.orderno = io.orderno
  1497. WHERE
  1498. (sua.property != 1 and sua.property != 2)
  1499. AND
  1500. user_id = #{userId}
  1501. AND
  1502. sua.create_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
  1503. </select>
  1504. <select id="getAuditExportList" resultType="com.ydtech.modules.order.entity.vo.AuditExportVo">
  1505. SELECT
  1506. iac.company_id,
  1507. iac.api_type,
  1508. iac.cross_insurance,
  1509. io.username,
  1510. iac.signing_time,
  1511. io.licenseno,
  1512. JSON_UNQUOTE(json_extract(io.applyinfo, '$.name')) as applyname,
  1513. io.ins_company,
  1514. io.product,
  1515. eic.namesimple,
  1516. iac.jqapplyno,
  1517. iac.syapplyno,
  1518. iac.cross_insurance,
  1519. iac.jqpremium,
  1520. iac.sypremium,
  1521. iac.jypremium,
  1522. iac.taxamount,
  1523. ifo.jq_costs_export_proportion + ifo.jq_export_other_costs_proportion AS jq_export_proportion,
  1524. ifo.sy_costs_export_proportion+ifo.sy_export_other_costs_proportion as sy_export_proportion,
  1525. ifo.no_costs_export_proportion+ifo.no_export_other_costs_proportion as no_export_proportion,
  1526. 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,
  1527. ifo.jq_supervise_costs_proportion + ifo.jq_other_costs_proportion as jq_entrance_proportion,
  1528. ifo.sy_supervise_costs_proportion + ifo.sy_other_costs_proportion as sy_entrance_proportion,
  1529. ifo.no_supervise_costs_proportion + ifo.no_other_costs_proportion as no_entrance_proportion,
  1530. 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,
  1531. ifo.jq_dept_premiums_level_1 + ifo.sy_dept_premiums_level_1 + ifo.no_dept_premiums_level_1 as dept_premiums_level_1,
  1532. ifo.jq_dept_premiums_level_2 + ifo.sy_dept_premiums_level_2 + ifo.no_dept_premiums_level_2 as dept_premiums_level_2,
  1533. ifo.jq_dept_premiums_level_3 + ifo.sy_dept_premiums_level_3 + ifo.no_dept_premiums_level_3 as dept_premiums_level_3,
  1534. ifo.jq_dept_premiums_level_4 + ifo.sy_dept_premiums_level_4 + ifo.no_dept_premiums_level_4 as dept_premiums_level_4,
  1535. ifo.jq_dept_premiums_level_5 + ifo.sy_dept_premiums_level_5 + ifo.no_dept_premiums_level_5 as dept_premiums_level_5,
  1536. ifo.first_detail_premiums,
  1537. ifo.second_detail_premiums,
  1538. ifo.third_detail_premiums,
  1539. ifo.jq_profit_margin_premiums,
  1540. ifo.sy_profit_margin_premiums,
  1541. ifo.no_profit_margin_premiums,
  1542. io.is_external
  1543. FROM
  1544. ins_fee_order_new ifo
  1545. LEFT JOIN ins_fee_audit ifa ON ifo.ins_order_no = ifa.ins_order_no
  1546. left join ins_area_company iac on ifa.ins_order_no = iac.id
  1547. left join ins_orders io on iac.orderno = io.orderno
  1548. left join ptl_agreement pa on iac.agreement_id = pa.id
  1549. left join esm_ins_company eic on pa.partner_companies_id = eic.id
  1550. WHERE
  1551. iac.signing_time between #{param.signStartDate} and #{param.signEndDate}
  1552. <if test="param.audit != null and param.audit != ''">
  1553. AND
  1554. ifa.auditstatus = #{param.audit}
  1555. AND
  1556. iac.orderstatus = 3
  1557. GROUP BY
  1558. io.orderno,
  1559. iac.api_type,
  1560. iac.cross_insurance,
  1561. iac.signing_time,
  1562. eic.namesimple,
  1563. iac.jqapplyno,
  1564. iac.syapplyno,
  1565. iac.jqpremium,
  1566. iac.company_id,
  1567. iac.sypremium,
  1568. iac.jypremium,
  1569. iac.taxamount,
  1570. ifo.jq_costs_export_proportion,
  1571. ifo.jq_export_other_costs_proportion,
  1572. ifo.sy_costs_export_proportion,
  1573. ifo.sy_export_other_costs_proportion,
  1574. ifo.no_costs_export_proportion,
  1575. ifo.no_export_other_costs_proportion,
  1576. ifo.jq_export_supervise_costs_premiums,
  1577. ifo.sy_export_supervise_costs_premiums,
  1578. ifo.no_export_supervise_costs_premiums,
  1579. ifo.jq_export_other_costs_premiums,
  1580. ifo.sy_export_other_costs_premiums,
  1581. ifo.no_export_other_costs_premiums,
  1582. ifo.jq_supervise_costs_proportion,
  1583. ifo.jq_other_costs_proportion,
  1584. ifo.sy_supervise_costs_proportion,
  1585. ifo.sy_other_costs_proportion,
  1586. ifo.no_supervise_costs_proportion,
  1587. ifo.no_other_costs_proportion,
  1588. ifo.jq_supervise_costs_premiums,
  1589. ifo.jq_other_costs_premiums,
  1590. ifo.sy_supervise_costs_premiums,
  1591. ifo.sy_other_costs_premiums,
  1592. ifo.no_supervise_costs_premiums,
  1593. ifo.no_other_costs_premiums,
  1594. ifo.jq_dept_premiums_level_1,
  1595. ifo.jq_dept_premiums_level_2,
  1596. ifo.jq_dept_premiums_level_3,
  1597. ifo.jq_dept_premiums_level_4,
  1598. ifo.jq_dept_premiums_level_5,
  1599. ifo.sy_dept_premiums_level_1,
  1600. ifo.sy_dept_premiums_level_2,
  1601. ifo.sy_dept_premiums_level_3,
  1602. ifo.sy_dept_premiums_level_4,
  1603. ifo.sy_dept_premiums_level_5,
  1604. ifo.no_dept_premiums_level_1,
  1605. ifo.no_dept_premiums_level_2,
  1606. ifo.no_dept_premiums_level_3,
  1607. ifo.no_dept_premiums_level_4,
  1608. ifo.no_dept_premiums_level_5,
  1609. ifo.first_detail_premiums,
  1610. ifo.second_detail_premiums,
  1611. ifo.third_detail_premiums,
  1612. ifo.jq_profit_margin_premiums,
  1613. ifo.sy_profit_margin_premiums,
  1614. ifo.no_profit_margin_premiums
  1615. </if>
  1616. </select>
  1617. <resultMap id="hxOrderCountMap" type="com.ydtech.modules.order.entity.vo.QueryHxOrdersCountVo">
  1618. <result property="operatorId" column="operatorid" jdbcType="VARCHAR"/>
  1619. <result property="name" column="name" jdbcType="VARCHAR"/>
  1620. <result property="orderStatus0" column="orderstatus0" jdbcType="VARCHAR"/>
  1621. <result property="orderStatus1" column="orderstatus1" jdbcType="VARCHAR"/>
  1622. <result property="orderStatus2" column="orderstatus2" jdbcType="VARCHAR"/>
  1623. <result property="orderStatus3" column="orderstatus3" jdbcType="VARCHAR"/>
  1624. <result property="orderStatus4" column="orderstatus4" jdbcType="VARCHAR"/>
  1625. <result property="createTime" column="createtime" jdbcType="TIMESTAMP"/>
  1626. <result property="createTimeStart" column="createTimeStart" jdbcType="VARCHAR"/>
  1627. <result property="createTimeEnd" column="createTimeEnd" jdbcType="VARCHAR"/>
  1628. <result property="count" column="count1" jdbcType="VARCHAR"/>
  1629. </resultMap>
  1630. <resultMap id="TelemarketingAuditOrderMap" type="com.ydtech.modules.order.entity.dto.TelemarketingAuditOrderDTO">
  1631. <result property="id" column="id" jdbcType="VARCHAR"/>
  1632. <result property="orderNo" column="orderno" jdbcType="VARCHAR"/>
  1633. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  1634. <result property="username" column="username" jdbcType="VARCHAR"/>
  1635. <result property="product" column="product" jdbcType="VARCHAR"/>
  1636. <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
  1637. <result property="orderStatus" column="orderstatus" jdbcType="VARCHAR"/>
  1638. <result property="insuredName" column="insuredname" jdbcType="VARCHAR"/>
  1639. <result property="createTime" column="createtime" jdbcType="VARCHAR"/>
  1640. <result property="auditStatus" column="auditstatus" jdbcType="VARCHAR"/>
  1641. <result property="insCompany" column="insCompany" jdbcType="VARCHAR"/>
  1642. </resultMap>
  1643. <select id="queryHxOrdersCount" resultMap="hxOrderCountMap">
  1644. select
  1645. operatorid,
  1646. su.name,
  1647. count(*) as count1,
  1648. SUM(CASE WHEN orderstatus = '1' THEN 1 ELSE 0 END) AS orderstatus1,
  1649. SUM(CASE WHEN orderstatus = '2' THEN 1 ELSE 0 END) AS orderstatus2,
  1650. SUM(CASE WHEN orderstatus = '3' THEN 1 ELSE 0 END) AS orderstatus3,
  1651. SUM(CASE WHEN orderstatus = '4' THEN 1 ELSE 0 END) AS orderstatus4,
  1652. SUM(CASE WHEN orderstatus = '0' THEN 1 ELSE 0 END) AS orderstatus0
  1653. from
  1654. ins_orders
  1655. LEFT JOIN
  1656. sys_user su ON operatorid = su.id
  1657. WHERE operatorid IS NOT NULL
  1658. AND operatorid NOT LIKE '%M%'
  1659. <if test="queryHxOrdersCountVo.ids != null and !queryHxOrdersCountVo.ids.isEmpty()">
  1660. and operatorid IN
  1661. <foreach item="item" index="index" collection="queryHxOrdersCountVo.ids" open="(" separator="," close=")">
  1662. #{item}
  1663. </foreach>
  1664. </if>
  1665. <if test="queryHxOrdersCountVo.operatorId !=null and queryHxOrdersCountVo.operatorId !=''">
  1666. and operatorid =#{queryHxOrdersCountVo.operatorId}
  1667. </if>
  1668. <if test="queryHxOrdersCountVo.name !=null and queryHxOrdersCountVo.name !=''">
  1669. and su.name =#{queryHxOrdersCountVo.name}
  1670. </if>
  1671. <if test="queryHxOrdersCountVo.createTimeStart != null and queryHxOrdersCountVo.createTimeStart != ''">
  1672. and createtime &gt;= #{queryHxOrdersCountVo.createTimeStart}
  1673. </if>
  1674. <if test="queryHxOrdersCountVo.createTimeEnd != null and queryHxOrdersCountVo.createTimeEnd != ''">
  1675. and createtime &lt;= #{queryHxOrdersCountVo.createTimeEnd}
  1676. </if>
  1677. group by
  1678. operatorid,su.name
  1679. order by
  1680. count1 desc
  1681. </select>
  1682. <select id="getTelemarketingAudit" resultMap="TelemarketingAuditOrderMap">
  1683. SELECT
  1684. iac.id as id,
  1685. iac.orderno as orderno,
  1686. io.userid as userid,
  1687. io.username as username,
  1688. iac.product as product,
  1689. io.licenseno as licenseno,
  1690. io.ins_company as insCompany,
  1691. io.orderstatus as orderstatus,
  1692. io.insuredname as insuredname,
  1693. iac.createtime as createtime,
  1694. ifa.auditstatus as auditstatus
  1695. FROM
  1696. ins_area_company iac
  1697. LEFT JOIN ins_orders io ON iac.orderno = io.orderno
  1698. LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
  1699. WHERE
  1700. iac.orderstatus = '3'
  1701. AND ifa.auditstatus IN ('4', '5')
  1702. AND io.userid = #{userId}
  1703. <if test="telemarketingAuditOrderQueryVo.orderNo != null and telemarketingAuditOrderQueryVo.orderNo != '' ">
  1704. AND iac.orderno = #{telemarketingAuditOrderQueryVo.orderNo}
  1705. </if>
  1706. <if test="telemarketingAuditOrderQueryVo.auditStatus != null and telemarketingAuditOrderQueryVo.auditStatus != '' ">
  1707. AND ifa.auditstatus = #{telemarketingAuditOrderQueryVo.auditStatus}
  1708. </if>
  1709. <if test="telemarketingAuditOrderQueryVo.companyId != null and telemarketingAuditOrderQueryVo.companyId != '' ">
  1710. AND iac.company_id = #{telemarketingAuditOrderQueryVo.companyId}
  1711. </if>
  1712. <if test="telemarketingAuditOrderQueryVo.licenseNo != null and telemarketingAuditOrderQueryVo.licenseNo != '' ">
  1713. AND io.licenseno = #{telemarketingAuditOrderQueryVo.licenseNo}
  1714. </if>
  1715. <if test="telemarketingAuditOrderQueryVo.frameNo != null and telemarketingAuditOrderQueryVo.frameNo != '' ">
  1716. AND io.frameno = #{telemarketingAuditOrderQueryVo.frameNo}
  1717. </if>
  1718. <if test="telemarketingAuditOrderQueryVo.productId != null and telemarketingAuditOrderQueryVo.productId != '' ">
  1719. AND io.product = #{telemarketingAuditOrderQueryVo.productId}
  1720. </if>
  1721. <if test="telemarketingAuditOrderQueryVo.startDate != null and telemarketingAuditOrderQueryVo.startDate != '' and telemarketingAuditOrderQueryVo.endDate != null and telemarketingAuditOrderQueryVo.endDate != ''">
  1722. AND iac.createtime BETWEEN #{telemarketingAuditOrderQueryVo.startDate} AND
  1723. #{telemarketingAuditOrderQueryVo.endDate}
  1724. </if>
  1725. </select>
  1726. <select id="queryLicense" resultType="java.lang.String">
  1727. SELECT DISTINCT licenseno
  1728. from ins_orders
  1729. WHERE userid = #{userId}
  1730. <if test="queryLicenseInOrderVo.startDate != null and queryLicenseInOrderVo.startDate != '' and queryLicenseInOrderVo.endDate != null and queryLicenseInOrderVo.endDate != ''">
  1731. AND createtime BETWEEN #{queryLicenseInOrderVo.startDate} AND
  1732. #{queryLicenseInOrderVo.endDate}
  1733. </if>
  1734. </select>
  1735. <select id="queryInsured" resultType="java.lang.String">
  1736. SELECT DISTINCT insuredname
  1737. from ins_orders
  1738. WHERE userid = #{userId}
  1739. <if test="queryInsuredInOrderVo.startDate != null and queryInsuredInOrderVo.startDate != '' and queryInsuredInOrderVo.endDate != null and queryInsuredInOrderVo.endDate != ''">
  1740. AND createtime BETWEEN #{queryInsuredInOrderVo.startDate} AND
  1741. #{queryInsuredInOrderVo.endDate}
  1742. </if>
  1743. </select>
  1744. <resultMap id="SendProjectInfoMap" type="com.ydtech.modules.order.entity.vo.sendProject.SendProjectInfo">
  1745. <result property="userName" column="user_name" jdbcType="VARCHAR"/>
  1746. <result property="userPhone" column="user_phone" jdbcType="VARCHAR"/>
  1747. <result property="userCarNum" column="user_car_num" jdbcType="VARCHAR"/>
  1748. </resultMap>
  1749. <select id="getOrderByCompanyId" resultMap="SendProjectInfoMap" parameterType="java.lang.String">
  1750. SELECT
  1751. REPLACE(o.applyinfo -> '$.name', '"', '') AS user_name,
  1752. REPLACE(o.applyinfo -> '$.mobile', '"', '') AS user_phone,
  1753. REPLACE(o.carinfo -> '$.licenseNo', '"', '') AS user_car_num
  1754. FROM
  1755. ins_orders AS o
  1756. JOIN
  1757. ins_area_company iac ON o.orderno = iac.orderno
  1758. WHERE
  1759. iac.id = #{companyId}
  1760. </select>
  1761. </mapper>