EiFpkjRequestMapper.xml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.tofly.feesapi.dzfp.mapper.EiFpkjRequestMapper">
  4. <sql id="querySql">
  5. SELECT sfid,
  6. lsbh,
  7. yhbh,
  8. buyerName,
  9. ssje,
  10. cwrq,
  11. sfrq,
  12. invoicetime,
  13. sfry,
  14. pushMode,
  15. case
  16. when pushMode = '-1' then '不推送'
  17. when pushMode = '0' then '邮箱'
  18. when pushMode = '1' then '手机'
  19. when pushMode = '2' then '邮箱、手机'
  20. else
  21. '不推送'
  22. end as pushModeMc,
  23. exTaxAmount,
  24. taxAmount,
  25. orderAmount,
  26. invoiceType,
  27. case
  28. when invoiceType = '1' then '蓝票'
  29. when invoiceType = '2' then '红票'
  30. else '开票类型值不对'
  31. end as invoiceTypeMc,
  32. invoiceLine,
  33. case
  34. when invoiceLine = 'p' then '普通电票'
  35. when invoiceLine = 'pc' then '数电普票'
  36. when invoiceLine = 'bs' then '数电专票'
  37. else
  38. '发票种类值不对'
  39. end as invoiceLineMc,
  40. jf_yxbz as jfYxbz,
  41. case
  42. when jf_yxbz = '0' then '未交付'
  43. when jf_yxbz = '1' then '已交付'
  44. else
  45. '未交付'
  46. end as jfYxbzMc,
  47. status,
  48. case
  49. when cl_cljg = '0' then '未开票'
  50. when cl_cljg = '1' then '开票完成'
  51. when cl_cljg = '3' then '开票中'
  52. when cl_cljg = '2' then '开票失败'
  53. else
  54. '未开票'
  55. end as statusMc,
  56. invoiceNum,
  57. invoicecode,
  58. zf_zfbz as zfZfbz,
  59. case
  60. when zf_zfbz = '0' then '正票'
  61. when zf_zfbz = '1' then '已冲红'
  62. when zf_zfbz = '2' then '冲红记录'
  63. else
  64. '正票'
  65. end as zfZfbzMc,
  66. fp_sfkp as fpSfkp,
  67. case
  68. when fp_sfkp = '0' then '不开票'
  69. when fp_sfkp = '1' then '开票'
  70. else
  71. '不开票'
  72. end as fpSfkpMc,
  73. fp_sf_hb as fpSfHb,
  74. case
  75. when fp_sf_hb = '0' then '否'
  76. when fp_sf_hb = '1' then '是'
  77. else
  78. '否'
  79. end as fp_sf_hbMc,
  80. fp_hb_lx as fpHbLx,
  81. case
  82. when fp_hb_lx = '0' then '否'
  83. when fp_hb_lx = '1' then '多笔欠费'
  84. when fp_hb_lx = '2' then '多笔用户'
  85. else
  86. '否'
  87. end as fpHbLxMc,
  88. statusmsg,
  89. failcause,
  90. cl_lock as clLock,
  91. cl_cljg as clCljg,
  92. cl_remessage as clRemessage,
  93. pdfurl
  94. FROM ei_fpkj_request
  95. WHERE 1 = 1
  96. <include refid="querySql_where"></include>
  97. </sql>
  98. <sql id="querySql_Sum">
  99. SELECT sum(ssje) ssje,
  100. sum(exTaxAmount) exTaxAmount,
  101. sum(taxAmount) taxAmount ,
  102. sum(orderAmount) orderAmount
  103. from ei_fpkj_request
  104. WHERE 1=1
  105. <include refid="querySql_where"></include>
  106. </sql>
  107. <sql id="querySql_where">
  108. <!--模糊查询 -->
  109. <if test="filter.searchText!=null">
  110. AND ( buyerName like '%${filter.searchText}%'
  111. OR buyerAddress like '%${filter.searchText}%'
  112. OR buyerTel like '%${filter.searchText}%'
  113. OR cwrq like '%${filter.searchText}%'
  114. OR yhbh like '%${filter.searchText}%'
  115. OR invoiceCode like '%${filter.searchText}%'
  116. OR sfid like '%${filter.searchText}%'
  117. OR invoiceNum like '%${filter.searchText}%'
  118. OR buyerPhone like '%${filter.searchText}%')
  119. </if>
  120. <!--所属公司-->
  121. <if test="filter.ssgs!=null">
  122. AND ssgs=#{filter.ssgs}
  123. </if>
  124. <!--所属片区-->
  125. <if test="filter.sspq!=null">
  126. AND yh_sspq=#{filter.sspq}
  127. </if>
  128. <!--开票类型invoiceType-->
  129. <if test="filter.invoiceType!=null">
  130. AND invoiceType=#{filter.invoiceType}
  131. </if>
  132. <!-- 是否开票fp_sfkp-->
  133. <if test="filter.fp_sfkp!=null">
  134. <if test="filter.fp_sfkp=='1'">
  135. AND fp_sfkp in ('1','2')
  136. </if>
  137. <if test="filter.fp_sfkp=='0'">
  138. AND fp_sfkp='0'
  139. </if>
  140. </if>
  141. <!-- 发票种类invoiceLine-->
  142. <if test="filter.invoiceLine!=null">
  143. AND invoiceLine=#{filter.invoiceLine}
  144. </if>
  145. <!-- 财务月份-->
  146. <if test="filter.cwrq!=null">
  147. AND cwrq=#{filter.cwrq}
  148. </if>
  149. <!-- 开票状态status-->
  150. <if test="filter.status!=null">
  151. AND cl_cljg=#{filter.status}
  152. </if>
  153. <!-- 收费人员-->
  154. <if test="filter.sfry!=null">
  155. AND sfry=#{filter.sfry}
  156. </if>
  157. <if test="filter.tjsj_type!=null and filter.tjsj_type==1">
  158. <!--收费日期-->
  159. <if test="filter.start_tjsj!=null and filter.end_tjsj!=null">
  160. AND sfrq BETWEEN #{filter.start_tjsj} AND #{filter.end_tjsj}
  161. </if>
  162. </if>
  163. <if test="filter.tjsj_type!=null and filter.tjsj_type==2">
  164. <!--开票日期-->
  165. <if test="filter.start_tjsj!=null and filter.end_tjsj!=null">
  166. AND invoicetime BETWEEN to_char(#{filter.start_tjsj},'yyyy-MM-dd HH:mm:ss') AND to_char(#{filter.end_tjsj},'yyyy-MM-dd HH:mm:ss')
  167. </if>
  168. </if>
  169. <if test="filter.isykfp!=null">
  170. AND isykfp=#{filter.isykfp}
  171. </if>
  172. <if test="filter.kpyw!=null">
  173. AND yhlx=#{filter.kpyw}
  174. </if>
  175. <if test="filter.dxh!=null">
  176. AND dxh=#{filter.dxh}
  177. </if>
  178. </sql>
  179. <sql id="querySql_sf">
  180. SELECT sfid ,a.lsbh,yhbh,buyerName,ssje,cwrq,sfrq,invoicetime,sfry,pushMode,
  181. case
  182. when pushMode='-1' then '不推送'
  183. when pushMode='0' then '邮箱'
  184. when pushMode='1' then '手机'
  185. when pushMode='2' then '邮箱、手机'
  186. else '不推送'
  187. end as pushModeMc,
  188. b.tax exTaxAmount,b.taxexcludedamount taxAmount,b.taxincludedamount orderAmount,invoiceType,
  189. case
  190. when invoiceType='1' then '蓝票'
  191. when invoiceType='2' then '红票'
  192. else '开票类型值不对'
  193. end as invoiceTypeMc
  194. ,invoiceLine,
  195. case
  196. when invoiceLine='p' then '普通电票'
  197. when invoiceLine='pc' then '数电普票'
  198. when invoiceLine='bs' then '数电专票'
  199. else '发票种类值不对'
  200. end as invoiceLineMc,
  201. jf_yxbz as jfYxbz,
  202. case
  203. when jf_yxbz='0' then '未交付'
  204. when jf_yxbz='1' then '已交付'
  205. else '未交付'
  206. end as jfYxbzMc,
  207. status,
  208. case
  209. when status='0' then '未开票'
  210. when status='2' then '开票完成'
  211. when status='20' then '开票中'
  212. when status='21' then '开票成功签章中'
  213. when status='22' then '开票失败'
  214. when status='24' then '开票成功签章失败'
  215. when status='3' then '发票已作废'
  216. when status='31' then '发票作废中'
  217. else '未开票'
  218. end as statusMc,
  219. invoiceNum,
  220. zf_zfbz as zfZfbz,
  221. case
  222. when zf_zfbz='0' then '正票'
  223. when zf_zfbz='1' then '已冲红'
  224. when zf_zfbz='2' then '冲红记录'
  225. else '正票'
  226. end as zfZfbzMc,
  227. fp_sfkp as fpSfkp,
  228. case
  229. when fp_sfkp='0' then '不开票'
  230. when fp_sfkp='1' then '开票'
  231. else '不开票'
  232. end as fpSfkpMc,
  233. fp_sf_hb as fpSfHb,
  234. case
  235. when fp_sf_hb='0' then '否'
  236. when fp_sf_hb='1' then '是'
  237. else '否' end as fp_sf_hbMc,
  238. fp_hb_lx as fpHbLx,
  239. case
  240. when fp_hb_lx='0' then '否'
  241. when fp_hb_lx='1' then '多笔欠费'
  242. when fp_hb_lx='2' then '多笔用户'
  243. else '否' end as fpHbLxMc,statusmsg,failcause,
  244. cl_lock as clLock,cl_cljg as clCljg,cl_remessage as clRemessage
  245. from ei_fpkj_request a,ei_fpkj_mx b where a.lsbh=b.lsbh and goodsCode='110030101'
  246. <!--模糊查询 -->
  247. <if test="filter.searchText!=null">
  248. AND ( buyerName like '%${filter.searchText}%'
  249. OR buyerAddress like '%${filter.searchText}%'
  250. OR buyerTel like '%${filter.searchText}%'
  251. OR cwrq like '%${filter.searchText}%'
  252. OR yhbh like '%${filter.searchText}%'
  253. OR invoiceCode like '%${filter.searchText}%'
  254. OR sfid like '%${filter.searchText}%'
  255. OR invoiceNum like '%${filter.searchText}%'
  256. OR buyerPhone like '%${filter.searchText}%')
  257. </if>
  258. <!--所属公司-->
  259. <if test="filter.ssgs!=null">
  260. AND ssgs=#{filter.ssgs}
  261. </if>
  262. <!--所属片区-->
  263. <if test="filter.sspq!=null">
  264. AND yh_sspq=#{filter.sspq}
  265. </if>
  266. <!--开票类型invoiceType-->
  267. <if test="filter.invoiceType!=null">
  268. AND invoiceType=#{filter.invoiceType}
  269. </if>
  270. <!-- 是否开票fp_sfkp-->
  271. <if test="filter.fp_sfkp!=null">
  272. AND fp_sfkp=#{filter.fp_sfkp}
  273. </if>
  274. <!-- 发票种类invoiceLine-->
  275. <if test="filter.invoiceLine!=null">
  276. AND invoiceLine=#{filter.invoiceLine}
  277. </if>
  278. <!-- 财务月份-->
  279. <if test="filter.cwrq!=null">
  280. AND cwrq=#{filter.cwrq}
  281. </if>
  282. <!-- 开票状态status-->
  283. <if test="filter.status!=null">
  284. AND cl_cljg=#{filter.status}
  285. </if>
  286. <!-- 收费人员-->
  287. <if test="filter.sfry!=null">
  288. AND sfry=#{filter.sfry}
  289. </if>
  290. <if test="filter.tjsj_type!=null and filter.tjsj_type==1">
  291. <!--收费日期-->
  292. <if test="filter.start_tjsj!=null and filter.end_tjsj!=null">
  293. AND sfrq BETWEEN #{filter.start_tjsj} AND
  294. #{filter.end_tjsj}
  295. </if>
  296. </if>
  297. <if test="filter.tjsj_type!=null and filter.tjsj_type==2">
  298. <!--开票日期-->
  299. <if test="filter.start_tjsj!=null and filter.end_tjsj!=null">
  300. AND invoicetime BETWEEN to_char(#{filter.start_tjsj},'yyyy-MM-dd HH:mm:ss') AND to_char(#{filter.end_tjsj},'yyyy-MM-dd HH:mm:ss')
  301. </if>
  302. </if>
  303. </sql>
  304. <sql id="querySql_fp">
  305. SELECT sfid ,a.lsbh,yhbh,buyerName,ssje,cwrq,sfrq,invoicetime,sfry,pushMode ,
  306. case
  307. when pushMode='-1' then '不推送'
  308. when pushMode='0' then '邮箱'
  309. when pushMode='1' then '手机'
  310. when pushMode='2' then '邮箱、手机'
  311. else '不推送'
  312. end as pushModeMc,
  313. b.tax exTaxAmount,b.taxexcludedamount taxAmount,b.taxincludedamount orderAmount,invoiceType,
  314. case
  315. when invoiceType='1' then '蓝票'
  316. when invoiceType='2' then '红票'
  317. else '开票类型值不对'
  318. end as invoiceTypeMc
  319. ,invoiceLine,
  320. case
  321. when invoiceLine='p' then '普通电票'
  322. when invoiceLine='pc' then '数电普票'
  323. when invoiceLine='bs' then '数电专票'
  324. else '发票种类值不对'
  325. end as invoiceLineMc,
  326. jf_yxbz as jfYxbz,
  327. case
  328. when jf_yxbz='0' then '未交付'
  329. when jf_yxbz='1' then '已交付'
  330. else '未交付'
  331. end as jfYxbzMc,
  332. status,
  333. case
  334. when status='0' then '未开票'
  335. when status='2' then '开票完成'
  336. when status='20' then '开票中'
  337. when status='21' then '开票成功签章中'
  338. when status='22' then '开票失败'
  339. when status='24' then '开票成功签章失败'
  340. when status='3' then '发票已作废'
  341. when status='31' then '发票作废中'
  342. else '未开票'
  343. end as statusMc,
  344. invoiceNum,
  345. zf_zfbz as zfZfbz,
  346. case
  347. when zf_zfbz='0' then '正票'
  348. when zf_zfbz='1' then '已冲红'
  349. when zf_zfbz='2' then '冲红记录'
  350. else '正票'
  351. end as zfZfbzMc,
  352. fp_sfkp as fpSfkp,
  353. case
  354. when fp_sfkp='0' then '不开票'
  355. when fp_sfkp='1' then '开票'
  356. else '不开票'
  357. end as fpSfkpMc,
  358. fp_sf_hb as fpSfHb,
  359. case
  360. when fp_sf_hb='0' then '否'
  361. when fp_sf_hb='1' then '是'
  362. else '否' end as fp_sf_hbMc,
  363. fp_hb_lx as fpHbLx,
  364. case
  365. when fp_hb_lx='0' then '否'
  366. when fp_hb_lx='1' then '多笔欠费'
  367. when fp_hb_lx='2' then '多笔用户'
  368. else '否' end as fpHbLxMc,statusmsg,failcause,
  369. cl_lock as clLock,cl_cljg as clCljg,cl_remessage as clRemessage
  370. from ei_fpkj_request a,ei_fpkj_mx b where a.lsbh=b.lsbh and goodsCode='110030101'
  371. <!--模糊查询 -->
  372. <if test="filter.searchText!=null">
  373. AND ( buyerName like '%${filter.searchText}%'
  374. OR buyerAddress like '%${filter.searchText}%'
  375. OR buyerTel like '%${filter.searchText}%'
  376. OR cwrq like '%${filter.searchText}%'
  377. OR yhbh like '%${filter.searchText}%'
  378. OR invoiceCode like '%${filter.searchText}%'
  379. OR sfid like '%${filter.searchText}%'
  380. OR invoiceNum like '%${filter.searchText}%'
  381. OR buyerPhone like '%${filter.searchText}%')
  382. </if>
  383. <!--所属公司-->
  384. <if test="filter.ssgs!=null">
  385. AND ssgs=#{filter.ssgs}
  386. </if>
  387. <!--所属片区-->
  388. <if test="filter.sspq!=null">
  389. AND yh_sspq=#{filter.sspq}
  390. </if>
  391. <!--开票类型invoiceType-->
  392. <if test="filter.invoiceType!=null">
  393. AND invoiceType=#{filter.invoiceType}
  394. </if>
  395. <!-- 是否开票fp_sfkp-->
  396. <if test="filter.fp_sfkp!=null">
  397. AND fp_sfkp=#{filter.fp_sfkp}
  398. </if>
  399. <!-- 发票种类invoiceLine-->
  400. <if test="filter.invoiceLine!=null">
  401. AND invoiceLine=#{filter.invoiceLine}
  402. </if>
  403. <!-- 财务月份-->
  404. <if test="filter.cwrq!=null">
  405. AND cwrq=#{filter.cwrq}
  406. </if>
  407. <!-- 开票状态status-->
  408. <if test="filter.status!=null">
  409. AND cl_cljg=#{filter.status}
  410. </if>
  411. <!-- 收费人员-->
  412. <if test="filter.sfry!=null">
  413. AND sfry=#{filter.sfry}
  414. </if>
  415. <if test="filter.tjsj_type!=null and filter.tjsj_type==1">
  416. <!--收费日期-->
  417. <if test="filter.start_tjsj!=null and filter.end_tjsj!=null">
  418. AND sfrq BETWEEN #{filter.start_tjsj} AND
  419. #{filter.end_tjsj}
  420. </if>
  421. </if>
  422. <if test="filter.tjsj_type!=null and filter.tjsj_type==2">
  423. <!--开票日期-->
  424. <if test="filter.start_tjsj!=null and filter.end_tjsj!=null">
  425. AND invoicetime BETWEEN to_char(#{filter.start_tjsj},'yyyy-MM-dd HH:mm:ss') AND to_char(#{filter.end_tjsj},'yyyy-MM-dd HH:mm:ss')
  426. </if>
  427. </if>
  428. </sql>
  429. <sql id="querySql_znj">
  430. SELECT sfid ,a.lsbh,yhbh,buyerName,ssje,cwrq,sfrq,invoicetime,sfry,pushMode ,
  431. case
  432. when pushMode='-1' then '不推送'
  433. when pushMode='0' then '邮箱'
  434. when pushMode='1' then '手机'
  435. when pushMode='2' then '邮箱、手机'
  436. else '不推送'
  437. end as pushModeMc,
  438. b.tax exTaxAmount,b.taxexcludedamount taxAmount,b.taxincludedamount orderAmount,invoiceType,
  439. case
  440. when invoiceType='1' then '蓝票'
  441. when invoiceType='2' then '红票'
  442. else '开票类型值不对'
  443. end as invoiceTypeMc
  444. ,invoiceLine,
  445. case
  446. when invoiceLine='p' then '普通电票'
  447. when invoiceLine='pc' then '数电普票'
  448. when invoiceLine='bs' then '数电专票'
  449. else '发票种类值不对'
  450. end as invoiceLineMc,
  451. jf_yxbz as jfYxbz,
  452. case
  453. when jf_yxbz='0' then '未交付'
  454. when jf_yxbz='1' then '已交付'
  455. else '未交付'
  456. end as jfYxbzMc,
  457. status,
  458. case
  459. when status='0' then '未开票'
  460. when status='2' then '开票完成'
  461. when status='20' then '开票中'
  462. when status='21' then '开票成功签章中'
  463. when status='22' then '开票失败'
  464. when status='24' then '开票成功签章失败'
  465. when status='3' then '发票已作废'
  466. when status='31' then '发票作废中'
  467. else '未开票'
  468. end as statusMc,
  469. invoiceNum,
  470. zf_zfbz as zfZfbz,
  471. case
  472. when zf_zfbz='0' then '正票'
  473. when zf_zfbz='1' then '已冲红'
  474. when zf_zfbz='2' then '冲红记录'
  475. else '正票'
  476. end as zfZfbzMc,
  477. fp_sfkp as fpSfkp,
  478. case
  479. when fp_sfkp='0' then '不开票'
  480. when fp_sfkp='1' then '开票'
  481. else '不开票'
  482. end as fpSfkpMc,
  483. fp_sf_hb as fpSfHb,
  484. case
  485. when fp_sf_hb='0' then '否'
  486. when fp_sf_hb='1' then '是'
  487. else '否' end as fp_sf_hbMc,
  488. fp_hb_lx as fpHbLx,
  489. case
  490. when fp_hb_lx='0' then '否'
  491. when fp_hb_lx='1' then '多笔欠费'
  492. when fp_hb_lx='2' then '多笔用户'
  493. else '否' end as fpHbLxMc,statusmsg,failcause,
  494. cl_lock as clLock,cl_cljg as clCljg,cl_remessage as clRemessage
  495. from ei_fpkj_request a,ei_fpkj_mx b where a.lsbh=b.lsbh and goodsCode='110030101'
  496. <!--模糊查询 -->
  497. <if test="filter.searchText!=null">
  498. AND ( buyerName like '%${filter.searchText}%'
  499. OR buyerAddress like '%${filter.searchText}%'
  500. OR buyerTel like '%${filter.searchText}%'
  501. OR cwrq like '%${filter.searchText}%'
  502. OR yhbh like '%${filter.searchText}%'
  503. OR invoiceCode like '%${filter.searchText}%'
  504. OR sfid like '%${filter.searchText}%'
  505. OR invoiceNum like '%${filter.searchText}%'
  506. OR buyerPhone like '%${filter.searchText}%')
  507. </if>
  508. <!--所属公司-->
  509. <if test="filter.ssgs!=null">
  510. AND ssgs=#{filter.ssgs}
  511. </if>
  512. <!--所属片区-->
  513. <if test="filter.sspq!=null">
  514. AND yh_sspq=#{filter.sspq}
  515. </if>
  516. <!--开票类型invoiceType-->
  517. <if test="filter.invoiceType!=null">
  518. AND invoiceType=#{filter.invoiceType}
  519. </if>
  520. <!-- 是否开票fp_sfkp-->
  521. <if test="filter.fp_sfkp!=null">
  522. AND fp_sfkp=#{filter.fp_sfkp}
  523. </if>
  524. <!-- 发票种类invoiceLine-->
  525. <if test="filter.invoiceLine!=null">
  526. AND invoiceLine=#{filter.invoiceLine}
  527. </if>
  528. <!-- 财务月份-->
  529. <if test="filter.cwrq!=null">
  530. AND cwrq=#{filter.cwrq}
  531. </if>
  532. <!-- 开票状态status-->
  533. <if test="filter.status!=null">
  534. AND cl_cljg=#{filter.status}
  535. </if>
  536. <!-- 收费人员-->
  537. <if test="filter.sfry!=null">
  538. AND sfry=#{filter.sfry}
  539. </if>
  540. <if test="filter.tjsj_type!=null and filter.tjsj_type==1">
  541. <!--收费日期-->
  542. <if test="filter.start_tjsj!=null and filter.end_tjsj!=null">
  543. AND sfrq BETWEEN #{filter.start_tjsj} AND
  544. #{filter.end_tjsj}
  545. </if>
  546. </if>
  547. <if test="filter.tjsj_type!=null and filter.tjsj_type==2">
  548. <!--开票日期-->
  549. <if test="filter.start_tjsj!=null and filter.end_tjsj!=null">
  550. AND invoicetime BETWEEN to_char(#{filter.start_tjsj},'yyyy-MM-dd HH:mm:ss') AND to_char(#{filter.end_tjsj},'yyyy-MM-dd HH:mm:ss')
  551. </if>
  552. </if>
  553. </sql>
  554. <!-- 污水费-->
  555. <sql id="querySql_wsf">
  556. SELECT sfid ,a.lsbh,yhbh,buyerName,ssje,cwrq,sfrq,invoicetime,sfry,pushMode ,
  557. case
  558. when pushMode='-1' then '不推送'
  559. when pushMode='0' then '邮箱'
  560. when pushMode='1' then '手机'
  561. when pushMode='2' then '邮箱、手机'
  562. else '不推送'
  563. end as pushModeMc,
  564. b.tax exTaxAmount,b.taxexcludedamount taxAmount,b.taxincludedamount orderAmount,invoiceType,
  565. case
  566. when invoiceType='1' then '蓝票'
  567. when invoiceType='2' then '红票'
  568. else '开票类型值不对'
  569. end as invoiceTypeMc
  570. ,invoiceLine,
  571. case
  572. when invoiceLine='p' then '普通电票'
  573. when invoiceLine='pc' then '数电普票'
  574. when invoiceLine='bs' then '数电专票'
  575. else '发票种类值不对'
  576. end as invoiceLineMc,
  577. jf_yxbz as jfYxbz,
  578. case
  579. when jf_yxbz='0' then '未交付'
  580. when jf_yxbz='1' then '已交付'
  581. else '未交付'
  582. end as jfYxbzMc,
  583. status,
  584. case
  585. when status='0' then '未开票'
  586. when status='2' then '开票完成'
  587. when status='20' then '开票中'
  588. when status='21' then '开票成功签章中'
  589. when status='22' then '开票失败'
  590. when status='24' then '开票成功签章失败'
  591. when status='3' then '发票已作废'
  592. when status='31' then '发票作废中'
  593. else '未开票'
  594. end as statusMc,
  595. invoiceNum,
  596. zf_zfbz as zfZfbz,
  597. case
  598. when zf_zfbz='0' then '正票'
  599. when zf_zfbz='1' then '已冲红'
  600. when zf_zfbz='2' then '冲红记录'
  601. else '正票'
  602. end as zfZfbzMc,
  603. fp_sfkp as fpSfkp,
  604. case
  605. when fp_sfkp='0' then '不开票'
  606. when fp_sfkp='1' then '开票'
  607. else '不开票'
  608. end as fpSfkpMc,
  609. fp_sf_hb as fpSfHb,
  610. case
  611. when fp_sf_hb='0' then '否'
  612. when fp_sf_hb='1' then '是'
  613. else '否' end as fp_sf_hbMc,
  614. fp_hb_lx as fpHbLx,
  615. case
  616. when fp_hb_lx='0' then '否'
  617. when fp_hb_lx='1' then '多笔欠费'
  618. when fp_hb_lx='2' then '多笔用户'
  619. else '否' end as fpHbLxMc,statusmsg,failcause,
  620. cl_lock as clLock,cl_cljg as clCljg,cl_remessage as clRemessage
  621. from ei_fpkj_request a,ei_fpkj_mx b where a.lsbh=b.lsbh and goodsCode='611'
  622. <!--模糊查询 -->
  623. <if test="filter.searchText!=null">
  624. AND ( buyerName like '%${filter.searchText}%'
  625. OR buyerAddress like '%${filter.searchText}%'
  626. OR buyerTel like '%${filter.searchText}%'
  627. OR cwrq like '%${filter.searchText}%'
  628. OR yhbh like '%${filter.searchText}%'
  629. OR invoiceCode like '%${filter.searchText}%'
  630. OR sfid like '%${filter.searchText}%'
  631. OR invoiceNum like '%${filter.searchText}%'
  632. OR buyerPhone like '%${filter.searchText}%')
  633. </if>
  634. <!--所属公司-->
  635. <if test="filter.ssgs!=null">
  636. AND ssgs=#{filter.ssgs}
  637. </if>
  638. <!--所属片区-->
  639. <if test="filter.sspq!=null">
  640. AND yh_sspq=#{filter.sspq}
  641. </if>
  642. <!--开票类型invoiceType-->
  643. <if test="filter.invoiceType!=null">
  644. AND invoiceType=#{filter.invoiceType}
  645. </if>
  646. <!-- 是否开票fp_sfkp-->
  647. <if test="filter.fp_sfkp!=null">
  648. AND fp_sfkp=#{filter.fp_sfkp}
  649. </if>
  650. <!-- 发票种类invoiceLine-->
  651. <if test="filter.invoiceLine!=null">
  652. AND invoiceLine=#{filter.invoiceLine}
  653. </if>
  654. <!-- 财务月份-->
  655. <if test="filter.cwrq!=null">
  656. AND cwrq=#{filter.cwrq}
  657. </if>
  658. <!-- 开票状态status-->
  659. <if test="filter.status!=null">
  660. AND cl_cljg=#{filter.status}
  661. </if>
  662. <!-- 收费人员-->
  663. <if test="filter.sfry!=null">
  664. AND sfry=#{filter.sfry}
  665. </if>
  666. <if test="filter.tjsj_type!=null and filter.tjsj_type==1">
  667. <!--收费日期-->
  668. <if test="filter.start_tjsj!=null and filter.end_tjsj!=null">
  669. AND sfrq BETWEEN #{filter.start_tjsj} AND
  670. #{filter.end_tjsj}
  671. </if>
  672. </if>
  673. <if test="filter.tjsj_type!=null and filter.tjsj_type==2">
  674. <!--开票日期-->
  675. <if test="filter.start_tjsj!=null and filter.end_tjsj!=null">
  676. AND invoicetime BETWEEN to_char(#{filter.start_tjsj},'yyyy-MM-dd HH:mm:ss') AND to_char(#{filter.end_tjsj},'yyyy-MM-dd HH:mm:ss')
  677. </if>
  678. </if>
  679. </sql>
  680. <!--自定义用户开票明细分页查询 -->
  681. <select id="getPage" resultType="com.tofly.feesapi.dzfp.entity.vo.EiFpkjRequest_select">
  682. <include refid="querySql"/>
  683. </select>
  684. <select id="getListSum" resultType="com.tofly.feesapi.dzfp.entity.vo.EiFpkjRequest_sum">
  685. <include refid="querySql_Sum"/>
  686. </select>
  687. <select id="getList" resultType="com.tofly.feesapi.dzfp.entity.vo.EiFpkjRequest_Excel">
  688. <include refid="querySql"/>
  689. <if test="filter.orders!=null and filter.orders.size()>0">
  690. ORDER BY
  691. <foreach collection="filter.orders" item="o" separator=",">
  692. <if test="o.column=='sfrq'">
  693. cast(sfrq as numeric)
  694. </if>
  695. <if test="o.column!='sfrq'">
  696. ${o.column}
  697. </if>
  698. <if test="!o.asc">DESC</if>
  699. </foreach>
  700. </if>
  701. </select>
  702. <resultMap id="eiFpkjRequestMap" type="com.tofly.feesapi.dzfp.entity.EiFpkjRequest">
  703. <id property="lsbh" column="LSBH"/>
  704. <result property="clCljg" column="CL_CLJG"/>
  705. <result property="clClsj" column="CL_CLSJ"/>
  706. <result property="clRecode" column="CL_RECODE"/>
  707. <result property="clRemessage" column="CL_REMESSAGE"/>
  708. <result property="zfZfbz" column="ZF_ZFBZ"/>
  709. <result property="jfPdf" column="JF_PDF"/>
  710. <result property="jfPdffilename" column="JF_PDFFILENAME"/>
  711. <result property="jfYxbz" column="JF_YXBZ"/>
  712. <result property="cxJfbz" column="CX_JFBZ"/>
  713. <result property="fpCkbz" column="FP_CKBZ"/>
  714. <result property="fpSfkp" column="FP_SFKP"/>
  715. <result property="bzGcbh" column="BZ_GCBH"/>
  716. <result property="fpSfHb" column="FP_SF_HB"/>
  717. <result property="fpHbLx" column="FP_HB_LX"/>
  718. <!-- <result property="Qfid" column="QFID"/>-->
  719. <result property="sflsbh" column="SFLSBH"/>
  720. <result property="ssgs" column="SSGS"/>
  721. <result property="yhbh" column="YHBH"/>
  722. <result property="cbkh" column="CBKH"/>
  723. <result property="cwrq" column="CWRQ"/>
  724. <result property="ssje" column="SSJE"/>
  725. <result property="sflx" column="SFLX"/>
  726. <result property="sfry" column="SFRY"/>
  727. <result property="sfrq" column="SFRQ"/>
  728. <result property="buyername" column="BUYERNAME"/>
  729. <result property="buyertaxnum" column="BUYERTAXNUM"/>
  730. <result property="buyertel" column="BUYERTEL"/>
  731. <result property="buyeraddress" column="BUYERADDRESS"/>
  732. <result property="buyeraccount" column="BUYERACCOUNT"/>
  733. <result property="buyerbank" column="BUYERBANK"/>
  734. <result property="salertaxnum" column="SALERTAXNUM"/>
  735. <result property="salertel" column="SALERTEL"/>
  736. <result property="saleraddress" column="SALERADDRESS"/>
  737. <result property="saleraccount" column="SALERACCOUNT"/>
  738. <result property="salerbank" column="SALERBANK"/>
  739. <result property="orderno" column="ORDERNO"/>
  740. <result property="invoicedate" column="INVOICEDATE"/>
  741. <result property="invoicecode" column="INVOICECODE"/>
  742. <result property="invoicenum" column="INVOICENUM"/>
  743. <result property="redreason" column="REDREASON"/>
  744. <result property="billinfono" column="BILLINFONO"/>
  745. <result property="departmentid" column="DEPARTMENTID"/>
  746. <result property="clerkid" column="CLERKID"/>
  747. <result property="remark" column="REMARK"/>
  748. <result property="extaxamount" column="EXTAXAMOUNT"/>
  749. <result property="taxamount" column="TAXAMOUNT"/>
  750. <result property="orderamount" column="ORDERAMOUNT"/>
  751. <result property="checker" column="CHECKER"/>
  752. <result property="payee" column="PAYEE"/>
  753. <result property="clerk" column="CLERK"/>
  754. <result property="listflag" column="LISTFLAG"/>
  755. <result property="listname" column="LISTNAME"/>
  756. <result property="pushmode" column="PUSHMODE"/>
  757. <result property="buyerphone" column="BUYERPHONE"/>
  758. <result property="email" column="EMAIL"/>
  759. <result property="invoicetype" column="INVOICETYPE"/>
  760. <result property="invoiceline" column="INVOICELINE"/>
  761. <result property="specificfactor" column="SPECIFICFACTOR"/>
  762. <result property="proxyinvoiceflag" column="PROXYINVOICEFLAG"/>
  763. <result property="invoiceserialnum" column="INVOICESERIALNUM"/>
  764. <result property="invoicetime" column="INVOICETIME"/>
  765. <result property="status" column="STATUS"/>
  766. <result property="statusmsg" column="STATUSMSG"/>
  767. <result property="failcause" column="FAILCAUSE"/>
  768. <result property="pdfurl" column="PDFURL"/>
  769. <result property="clLock" column="CL_LOCK"/>
  770. </resultMap>
  771. <!-- 水费发票查询-->
  772. <select id="getSfPage" resultType="com.tofly.feesapi.dzfp.entity.vo.EiFpkjRequest_select">
  773. <include refid="querySql_sf"></include>
  774. </select>
  775. <!-- 发票查询-->
  776. <select id="getFpPage" resultType="com.tofly.feesapi.dzfp.entity.vo.EiFpkjRequest_select">
  777. <include refid="querySql_fp"/>
  778. </select>
  779. <select id="getZnjPage" resultType="com.tofly.feesapi.dzfp.entity.vo.EiFpkjRequest_select">
  780. <include refid="querySql_znj"/>
  781. </select>
  782. <select id="getWsfPage" resultType="com.tofly.feesapi.dzfp.entity.vo.EiFpkjRequest_select">
  783. <include refid="querySql_wsf"/>
  784. </select>
  785. <select id="getFprkptjList" resultType="com.tofly.feesapi.dzfp.entity.vo.EiFpkjRequestSelectTj">
  786. SELECT
  787. yhbh,
  788. buyerName,
  789. cwrq,
  790. sfry,
  791. sfrq,
  792. invoicetime,
  793. exTaxAmount,
  794. invoiceNum,
  795. invoiceLineMc,
  796. nvl(sum(sf),0)sf,
  797. nvl(sum(wsf),0)wsf,
  798. nvl(sum(szyf),0)szyf,
  799. nvl(sum(wyj),0)wyj,
  800. nvl(sum(ljf),0)ljf
  801. from ( select a.yhbh,
  802. a.buyerName,
  803. a.cwrq,
  804. a.sfry,
  805. a.sfrq,
  806. a.invoicetime,
  807. a.exTaxAmount,
  808. a.invoiceNum,
  809. (case
  810. when invoiceLine = 'p' then '普通电票'
  811. when invoiceLine = 'pc' then '数电普票'
  812. when invoiceLine = 'bs' then '数电专票'
  813. else '发票种类值不对'
  814. end) as invoiceLineMc,
  815. (case
  816. when goodscode = '110030101' and (instr(goodsname, '自来水') > 0 or instr(goodsname, '水费') > 0)
  817. then taxincludedamount
  818. else 0
  819. end) as sf,
  820. (case
  821. when goodscode = '110030101' and instr(goodsname, '污水处理费') > 0 then taxincludedamount
  822. else 0
  823. end) as wsf,
  824. (case
  825. when goodscode = '611' and (instr(goodsname, '水资源税') > 0 or instr(goodsname, '水资源费') > 0)
  826. then taxincludedamount
  827. else 0
  828. end) as szyf,
  829. (case
  830. when goodscode = '611' and instr(goodsname, '违约金') > 0 then taxincludedamount
  831. else 0
  832. end) as wyj,
  833. (case
  834. when goodscode = '110030101' and instr(goodsname, '垃圾费') > 0 then taxincludedamount
  835. else 0
  836. end) as ljf
  837. from ei_fpkj_request a
  838. left join ei_fpkj_mx b on a.lsbh = b.lsbh
  839. where cl_cljg='1'
  840. <if test="filter.kprqStart!=null and filter.kprqEnd!=null">
  841. and a.invoicetime between to_char(#{filter.kprqStart},'yyyy-MM-dd HH:mm:ss') and
  842. to_char(#{filter.kprqEnd},'yyyy-MM-dd HH:mm:ss')
  843. </if>
  844. <if test="filter.sfry!=null">
  845. and a.sfry = #{filter.sfry}
  846. </if>
  847. <if test="filter.searchText!=null">
  848. AND ( buyerName like '%${filter.searchText}%'
  849. OR yhbh like '%${filter.searchText}%'
  850. OR invoiceNum like '%${filter.searchText}%')
  851. </if>
  852. <if test="filter.ssgs!=null">
  853. AND ssgs=#{filter.ssgs}
  854. </if>
  855. <if test="filter.sspq!=null">
  856. AND yh_sspq=#{filter.sspq}
  857. </if>
  858. <if test="filter.invoiceType!=null">
  859. AND invoiceType=#{filter.invoiceType}
  860. </if>
  861. <if test="filter.invoiceLine!=null">
  862. AND invoiceLine=#{filter.invoiceLine}
  863. </if>
  864. <if test="filter.cwrq!=null">
  865. AND cwrq=#{filter.cwrq}
  866. </if>
  867. <if test="filter.isykfp!=null">
  868. AND isykfp=#{filter.isykfp}
  869. </if>
  870. <if test="filter.kpyw!=null">
  871. AND yhlx=#{filter.kpyw}
  872. </if>
  873. <if test="filter.dxh!=null">
  874. AND dxh=#{filter.dxh}
  875. </if>
  876. )a
  877. group by a.yhbh,
  878. a.buyerName,
  879. a.cwrq,
  880. a.sfry,
  881. a.sfrq,
  882. a.invoicetime,
  883. a.exTaxAmount,
  884. a.invoiceNum,
  885. a.invoiceLineMc
  886. </select>
  887. </mapper>