InsOrdersMapper.xml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  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="risk" column="risk" javaType="com.alibaba.fastjson.JSONArray"
  37. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  38. <result property="king" column="king" javaType="com.alibaba.fastjson.JSONArray"
  39. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  40. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  41. javaType="com.alibaba.fastjson.JSONObject"
  42. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  43. </resultMap>
  44. <resultMap id="OrderResultMap" type="com.ydtech.modules.order.entity.vo.OrderVo">
  45. <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
  46. <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
  47. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  48. <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
  49. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  50. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  51. <result property="username" column="username" jdbcType="VARCHAR"/>
  52. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  53. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  54. <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
  55. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  56. <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  57. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  58. <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  59. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
  60. jdbcType="VARCHAR"/>
  61. <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
  62. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  63. <result property="product" column="product" jdbcType="VARCHAR"/>
  64. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  65. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  66. <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
  67. <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
  68. <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
  69. <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
  70. <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
  71. <result property="id" column="id" jdbcType="BIGINT"/>
  72. <result property="companyId" column="company_id" jdbcType="BIGINT"/>
  73. <result property="reptxt" column="reptxt" javaType="com.alibaba.fastjson.JSONObject"
  74. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  75. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  76. javaType="com.alibaba.fastjson.JSONObject"
  77. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  78. <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
  79. <result property="jqapplyno" column="jqapplyno" jdbcType="VARCHAR"/>
  80. <result property="jqpolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  81. <result property="syapplyno" column="syapplyno" jdbcType="VARCHAR"/>
  82. <result property="sypolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  83. <result property="riskinfo" column="riskinfo" javaType="com.alibaba.fastjson.JSONArray"
  84. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  85. <result property="kindinfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  86. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  87. <result property="jqpremium" column="jqpremium" jdbcType="DECIMAL"/>
  88. <result property="sypremium" column="sypremium" jdbcType="DECIMAL"/>
  89. <result property="jypremium" column="jypremium" jdbcType="DECIMAL"/>
  90. <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
  91. <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
  92. <result property="jqdiscountrate" column="jqdiscountrate" jdbcType="DOUBLE"/>
  93. <result property="sydiscountrate" column="sydiscountrate" jdbcType="DOUBLE"/>
  94. <result property="feerate" column="feerate" jdbcType="DOUBLE"/>
  95. <result property="disrate" column="disrate" jdbcType="DOUBLE"/>
  96. <result property="auditid" column="auditid" jdbcType="VARCHAR"/>
  97. <result property="auditname" column="auditname" jdbcType="VARCHAR"/>
  98. <result property="audittime" column="audittime" jdbcType="TIMESTAMP"/>
  99. <result property="auditopinion" column="auditopinion" jdbcType="VARCHAR"/>
  100. <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
  101. <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
  102. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  103. <result property="paymentLink" column="payment_link" jdbcType="VARCHAR"/>
  104. <result property="accidentInfo" column="accident_info" javaType="com.alibaba.fastjson.JSONArray"
  105. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  106. <result property="taxArrears" column="tax_arrears" javaType="com.alibaba.fastjson.JSONArray"
  107. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  108. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  109. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  110. </resultMap>
  111. <resultMap id="OrderExcelResultMap" type="com.ydtech.modules.ins.model.InsOrdersExcel">
  112. <id property="orderNo" column="orderno" jdbcType="VARCHAR"/>
  113. <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
  114. <result property="fraMeno" column="frameno" jdbcType="VARCHAR"/>
  115. <result property="carInfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  116. <result property="score" column="score" jdbcType="VARCHAR"/>
  117. <result property="ownerInfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  118. <result property="jqpRemIum" column="jqpremium" jdbcType="VARCHAR"/>
  119. <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
  120. <result property="jqPolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  121. <result property="sypRemIum" column="sypremium" jdbcType="VARCHAR"/>
  122. <result property="syPolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  123. <result property="jypRemIum" column="jypremium" jdbcType="VARCHAR"/>
  124. <result property="taxaMount" column="taxamount" jdbcType="VARCHAR"/>
  125. <result property="jqStartDate" column="jq_start_date" jdbcType="VARCHAR"/>
  126. <result property="jqEndDate" column="jq_end_date" jdbcType="VARCHAR"/>
  127. <result property="syStartDate" column="sy_start_date" jdbcType="VARCHAR"/>
  128. <result property="syEndDate" column="sy_end_date" jdbcType="VARCHAR"/>
  129. <result property="jqScore" column="jq_score" jdbcType="VARCHAR"/>
  130. <result property="syScore" column="sy_score" jdbcType="VARCHAR"/>
  131. <result property="lossRation" column="loss_ration" jdbcType="VARCHAR"/>
  132. <result property="jqLossRation" column="jq_loss_ration" jdbcType="VARCHAR"/>
  133. <result property="syLossRation" column="sy_loss_ration" jdbcType="VARCHAR"/>
  134. <result property="insCompany" column="inscompany" jdbcType="VARCHAR"/>
  135. <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
  136. <result property="userId" column="userid" jdbcType="VARCHAR"/>
  137. <result property="userName" column="username" jdbcType="VARCHAR"/>
  138. <result property="applyInfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  139. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  140. <result property="insureInfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  141. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  142. <result property="kindInfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  143. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  144. <result property="payDate" column="pay_date" jdbcType="VARCHAR"/>
  145. <result property="signingTime" column="signing_time" jdbcType="VARCHAR"/>
  146. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  147. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  148. </resultMap>
  149. <sql id="Base_Column_List">
  150. orderno,quoteno,orderstatus,
  151. carinfo,userid,username,
  152. deptid,deptname,ownerinfo,
  153. applyinfo,insureinfo,agreeid,
  154. productid,product,createtime,
  155. frameno,licenseno,insuredname,
  156. jqstartdate,jqenddate,systartdate,
  157. syenddate
  158. </sql>
  159. <select id="getOrderAndAreaCompany" parameterType="java.lang.String" resultMap="OrderResultMap">
  160. select o.orderno,
  161. o.quoteno,
  162. o.carinfo,
  163. o.userid,
  164. o.username,
  165. o.deptid,
  166. o.deptname,
  167. o.ownerinfo,
  168. o.applyinfo,
  169. o.insureinfo,
  170. o.agreeid,
  171. o.productid,
  172. o.product,
  173. o.frameno,
  174. o.licenseno,
  175. o.insuredname,
  176. o.vehicle_and_vessel_tax,
  177. o.ubi_predicted_info_score,
  178. iac.jq_start_date as jqstartdate,
  179. iac.jq_end_date as jqenddate,
  180. iac.sy_start_date as systartdate,
  181. iac.sy_end_date as syenddate,
  182. iac.id,
  183. iac.company_id,
  184. iac.reptxt,
  185. iac.orderstatus,
  186. iac.inscompany,
  187. iac.jqapplyno,
  188. iac.jqpolicyno,
  189. iac.syapplyno,
  190. iac.sypolicyno,
  191. iac.riskinfo,
  192. iac.kindinfo,
  193. iac.jqpremium,
  194. iac.sypremium,
  195. iac.jypremium,
  196. iac.taxamount,
  197. iac.sumpremium,
  198. iac.jqdiscountrate,
  199. iac.sydiscountrate,
  200. iac.feerate,
  201. iac.disrate,
  202. iac.auditid,
  203. iac.auditname,
  204. iac.audittime,
  205. iac.auditopinion,
  206. iac.jqappoint,
  207. iac.syappoint,
  208. iac.createtime,
  209. iac.payment_link,
  210. iac.accident_info,
  211. iac.tax_arrears,
  212. iac.cross_insurance
  213. from ins_orders as o
  214. join ins_area_company iac on o.orderno = iac.orderno
  215. where iac.id = #{companyId}
  216. </select>
  217. <select id="getByUseridAndLicenseNo" resultType="com.ydtech.modules.order.entity.InsOrders"
  218. parameterType="com.ydtech.modules.order.entity.vo.VerifyOrdersVo">
  219. select orderno,
  220. quoteno,
  221. orderstatus,
  222. carinfo,
  223. userid,
  224. username,
  225. deptid,
  226. deptname,
  227. ownerinfo,
  228. applyinfo,
  229. insureinfo,
  230. agreeid,
  231. productid,
  232. product,
  233. createtime,
  234. frameno,
  235. licenseno,
  236. insuredname,
  237. jqstartdate,
  238. jqenddate,
  239. systartdate,
  240. syenddate,
  241. risk,
  242. king,
  243. vehicle_and_vessel_tax,
  244. ubi_predicted_info_score
  245. from ins_orders
  246. where userid = #{userId, jdbcType=VARCHAR}
  247. and licenseno = #{licenseNo, jdbcType=VARCHAR}
  248. and createtime > DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
  249. </select>
  250. <select id="queryPageOrderCount" resultType="Long">
  251. select
  252. count(1)
  253. from (
  254. select
  255. io.orderno
  256. from
  257. ins_orders io
  258. <!--如果存在 公司查询则进行连表 -->
  259. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  260. left JOIN
  261. ins_area_company iac on iac.orderno = io.orderno
  262. </if>
  263. <where>
  264. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  265. and io.orderno = #{orderQueryVo.orderNo}
  266. </if>
  267. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' and isTeamLeader">
  268. and io.deptid like "${orderQueryVo.deptId}%"
  269. </if>
  270. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  271. and io.orderstatus = #{orderQueryVo.orderStatus}
  272. </if>
  273. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  274. and io.frameno = #{orderQueryVo.frameNo}
  275. </if>
  276. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  277. and io.licenseno = #{orderQueryVo.licenseNo}
  278. </if>
  279. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  280. and io.insuredname = #{orderQueryVo.insuredName}
  281. </if>
  282. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  283. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  284. </if>
  285. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  286. and iac.company_id = #{orderQueryVo.companyId}
  287. </if>
  288. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
  289. and io.operatorid = #{orderQueryVo.userId}
  290. </if>
  291. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
  292. and io.userid = #{orderQueryVo.userId}
  293. </if>
  294. </where>
  295. group by io.orderno
  296. ) as s
  297. </select>
  298. <select id="queryPageOrder" resultMap="BaseResultMap">
  299. select
  300. io.*
  301. from
  302. ins_orders io
  303. <!--如果存在 公司查询则进行连表 -->
  304. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  305. left JOIN
  306. ins_area_company iac on iac.orderno = io.orderno
  307. </if>
  308. <where>
  309. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  310. and io.orderno = #{orderQueryVo.orderNo}
  311. </if>
  312. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' and isTeamLeader">
  313. and io.deptid like "${orderQueryVo.deptId}%"
  314. </if>
  315. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  316. and io.orderstatus = #{orderQueryVo.orderStatus}
  317. </if>
  318. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  319. and io.frameno = #{orderQueryVo.frameNo}
  320. </if>
  321. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  322. and io.licenseno = #{orderQueryVo.licenseNo}
  323. </if>
  324. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  325. and io.insuredname = #{orderQueryVo.insuredName}
  326. </if>
  327. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  328. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  329. </if>
  330. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  331. and iac.company_id = #{orderQueryVo.companyId}
  332. </if>
  333. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
  334. and io.operatorid = #{orderQueryVo.userId}
  335. </if>
  336. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
  337. and io.userid = #{orderQueryVo.userId}
  338. </if>
  339. </where>
  340. group by orderno
  341. order by io.createtime desc
  342. </select>
  343. <select id="queryOrderList" parameterType="com.ydtech.modules.ins.model.InsOrdersExcelVo" resultMap="OrderExcelResultMap">
  344. select
  345. a.orderno,
  346. a.licenseno,
  347. a.frameno,
  348. a.carinfo,
  349. b.api_type,
  350. b.score,
  351. a.ownerinfo,
  352. b.jqpremium,
  353. b.jqpolicyno,
  354. b.sypremium,
  355. b.sypolicyno,
  356. b.jypremium,
  357. b.taxamount,
  358. b.jq_start_date,
  359. b.jq_end_date,
  360. b.sy_start_date,
  361. b.sy_end_date,
  362. b.score,
  363. b.jq_score,
  364. b.sy_score,
  365. b.loss_ration,
  366. b.jq_loss_ration,
  367. b.sy_loss_ration,
  368. b.score,
  369. b.inscompany,
  370. b.agreement_id,
  371. a.userid,
  372. a.username,
  373. a.applyinfo,
  374. a.insureinfo,
  375. b.kindinfo,
  376. b.pay_date,
  377. b.signing_time,
  378. b.cross_insurance,
  379. a.ubi_predicted_info_score
  380. FROM ins_orders a LEFT JOIN ins_area_company b on a.orderno = b.orderno
  381. WHERE
  382. 1 = 1
  383. <if test="orderstatus != null and orderstatus != '' ">
  384. and b.orderstatus = #{orderstatus}
  385. </if>
  386. <if test="startDate != null ">
  387. and a.createtime &gt;= #{startDate}
  388. </if>
  389. <if test="endDate != null ">
  390. and a.createtime &lt;= #{endDate}
  391. </if>
  392. </select>
  393. <resultMap id="PolicyInsuranceReportMap" type="com.ydtech.modules.order.entity.vo.PolicyInsuranceReportResVo">
  394. <result property="insCompany" column="insCompany" jdbcType="VARCHAR"/>
  395. <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
  396. <result property="policyNo" column="policyNo" jdbcType="VARCHAR"/>
  397. <result property="quoteDate" column="quoteDate" jdbcType="VARCHAR"/>
  398. <result property="policyStartDate" column="policyStartDate" jdbcType="VARCHAR"/>
  399. <result property="riskName" column="riskName" jdbcType="VARCHAR"/>
  400. <result property="sumPremium" column="sumPremium" jdbcType="DECIMAL"/>
  401. <result property="taxPremium" column="taxPremium" jdbcType="DECIMAL"/>
  402. <result property="taxLaterPremium" column="taxLaterPremium" jdbcType="DECIMAL"/>
  403. <result property="insuranceSubAmount" column="insuranceSubAmount" jdbcType="VARCHAR"/>
  404. <result property="licenseNo" column="licenseNo" jdbcType="VARCHAR"/>
  405. <result property="vehicleUse" column="vehicleUse" jdbcType="VARCHAR"/>
  406. <result property="powerType" column="powerType" jdbcType="VARCHAR"/>
  407. <result property="ciModelClass" column="ciModelClass" jdbcType="VARCHAR"/>
  408. <result property="limitLoad" column="limitLoad" jdbcType="VARCHAR"/>
  409. <result property="appliName" column="appliName" jdbcType="VARCHAR"/>
  410. <result property="insureName" column="insureName" jdbcType="VARCHAR"/>
  411. <result property="deptName" column="deptName" jdbcType="VARCHAR"/>
  412. <result property="userName" column="username" jdbcType="VARCHAR"/>
  413. </resultMap>
  414. <select id="getPolicyInsuranceReport" resultMap="PolicyInsuranceReportMap">
  415. /*交强数据*/
  416. SELECT a.`inscompany` AS insCompany,
  417. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  418. a.`jqpolicyno` AS policyNo,
  419. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  420. a.pay_date AS quoteDate,
  421. </if>
  422. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  423. a.inside_pay_time AS quoteDate,
  424. </if>
  425. a.`jq_start_date` AS policyStartDate,
  426. '交强险' AS riskName,
  427. a.`jqpremium` AS sumPremium,
  428. a.`taxamount` AS taxPremium,
  429. getCarShipLateFee(a.`id`) AS taxLaterPremium,
  430. '交强险 : 200000.00,' AS insuranceSubAmount,
  431. b.`licenseno` AS licenseNo,
  432. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  433. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  434. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  435. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  436. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  437. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  438. b.`deptname` AS deptName,
  439. b.`username` AS userName
  440. FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
  441. AND a.`orderno`=b.`orderno`
  442. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  443. and b.deptid = #{policyReqVo.deptId}
  444. </if>
  445. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  446. and b.userid = #{policyReqVo.userId}
  447. </if>
  448. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  449. and b.username = #{policyReqVo.userName}
  450. </if>
  451. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  452. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  453. </if>
  454. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  455. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  456. </if>
  457. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  458. and b.productid = #{policyReqVo.productId}
  459. </if>
  460. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  461. and a.company_id = #{policyReqVo.insCompany}
  462. </if>
  463. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  464. and a.operatorid = #{policyReqVo.operatorId}
  465. </if>
  466. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  467. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  468. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  469. </if>
  470. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  471. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  472. </if>
  473. </if>
  474. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  475. and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  476. </if>
  477. UNION ALL
  478. /*##商业数据*/
  479. SELECT a.`inscompany` AS insCompany,
  480. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  481. a.`sypolicyno` AS policyNo,
  482. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  483. a.pay_date AS quoteDate,
  484. </if>
  485. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  486. a.inside_pay_time AS quoteDate,
  487. </if>
  488. a.`sy_start_date` AS policyStartDate,
  489. '商业险' AS riskName,
  490. a.`sypremium` AS sumPremium,
  491. '' AS taxPremium,
  492. '' AS taxLaterPremium,
  493. getSyAmount(a.`orderno`) AS insuranceSubAmount,
  494. b.`licenseno` AS licenseNo,
  495. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  496. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  497. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  498. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  499. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  500. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  501. b.`deptname` AS deptName,
  502. b.`username` AS userName
  503. FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
  504. AND a.`orderno`=b.`orderno`
  505. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  506. and b.deptid = #{policyReqVo.deptId}
  507. </if>
  508. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  509. and b.userid = #{policyReqVo.userId}
  510. </if>
  511. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  512. and b.username = #{policyReqVo.userName}
  513. </if>
  514. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  515. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  516. </if>
  517. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  518. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  519. </if>
  520. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  521. and b.productid = #{policyReqVo.productId}
  522. </if>
  523. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  524. and a.company_id = #{policyReqVo.insCompany}
  525. </if>
  526. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  527. and a.operatorid = #{policyReqVo.operatorId}
  528. </if>
  529. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  530. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  531. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  532. </if>
  533. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  534. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  535. </if>
  536. </if>
  537. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  538. and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  539. </if>
  540. </select>
  541. <select id="getPolicyInsuranceReportCount" resultType="Long">
  542. select
  543. count(1)
  544. from (
  545. /*交强数据*/
  546. SELECT a.`inscompany` AS insCompany,
  547. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  548. a.`jqpolicyno` AS policyNo,
  549. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  550. a.pay_date AS quoteDate,
  551. </if>
  552. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  553. a.inside_pay_time AS quoteDate,
  554. </if>
  555. a.`jq_start_date` AS policyStartDate,
  556. '交强险' AS riskName,
  557. a.`jqpremium` AS sumPremium,
  558. a.`taxamount` AS taxPremium,
  559. getCarShipLateFee(a.`id`) AS taxLaterPremium,
  560. '交强险 : 200000.00,' AS insuranceSubAmount,
  561. b.`licenseno` AS licenseNo,
  562. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  563. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  564. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  565. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  566. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  567. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  568. b.`deptname` AS deptName,
  569. b.`username` AS userName
  570. FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
  571. AND a.`orderno`=b.`orderno`
  572. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  573. and b.deptid = #{policyReqVo.deptId}
  574. </if>
  575. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  576. and b.userid = #{policyReqVo.userId}
  577. </if>
  578. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  579. and b.username = #{policyReqVo.userName}
  580. </if>
  581. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  582. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  583. </if>
  584. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  585. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  586. </if>
  587. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  588. and b.productid = #{policyReqVo.productId}
  589. </if>
  590. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  591. and a.company_id = #{policyReqVo.insCompany}
  592. </if>
  593. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  594. and a.operatorid = #{policyReqVo.operatorId}
  595. </if>
  596. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  597. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  598. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  599. </if>
  600. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  601. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  602. </if>
  603. </if>
  604. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  605. and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  606. </if>
  607. UNION ALL
  608. /*##商业数据*/
  609. SELECT a.`inscompany` AS insCompany,
  610. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  611. a.`sypolicyno` AS policyNo,
  612. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  613. a.pay_date AS quoteDate,
  614. </if>
  615. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  616. a.inside_pay_time AS quoteDate,
  617. </if>
  618. a.`sy_start_date` AS policyStartDate,
  619. '商业险' AS riskName,
  620. a.`sypremium` AS sumPremium,
  621. '' AS taxPremium,
  622. '' AS taxLaterPremium,
  623. getSyAmount(a.`orderno`) AS insuranceSubAmount,
  624. b.`licenseno` AS licenseNo,
  625. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  626. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  627. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  628. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  629. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  630. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  631. b.`deptname` AS deptName,
  632. b.`username` AS userName
  633. FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
  634. AND a.`orderno`=b.`orderno`
  635. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  636. and b.deptid = #{policyReqVo.deptId}
  637. </if>
  638. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  639. and b.userid = #{policyReqVo.userId}
  640. </if>
  641. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  642. and b.username = #{policyReqVo.userName}
  643. </if>
  644. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  645. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  646. </if>
  647. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  648. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  649. </if>
  650. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  651. and b.productid = #{policyReqVo.productId}
  652. </if>
  653. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  654. and a.company_id = #{policyReqVo.insCompany}
  655. </if>
  656. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  657. and a.operatorid = #{policyReqVo.operatorId}
  658. </if>
  659. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  660. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  661. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  662. </if>
  663. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  664. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  665. </if>
  666. </if>
  667. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  668. and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  669. </if>
  670. ) as s
  671. </select>
  672. <update id="updateStatus">
  673. update ins_orders set orderstatus = #{status} where orderno = #{orderno}
  674. </update>
  675. </mapper>