OrderFileRepository.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package me.zhengjie.dao.mybatis;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import lombok.RequiredArgsConstructor;
  4. import me.zhengjie.dao.mybatis.entity.OrderFileEntity;
  5. import me.zhengjie.dao.mybatis.mapper.OrderFileMapper;
  6. import me.zhengjie.domain.order.OrderConstant;
  7. import me.zhengjie.domain.order.OrderFileConstant;
  8. import org.apache.commons.lang3.StringUtils;
  9. import org.springframework.stereotype.Component;
  10. import java.util.List;
  11. @RequiredArgsConstructor
  12. @Component
  13. public class OrderFileRepository {
  14. final OrderFileMapper orderFileMapper;
  15. /**
  16. * 获取指定订单指定类型的公证文书列表
  17. *
  18. * @param businessNo
  19. * @param codes
  20. * @return
  21. */
  22. public List<OrderFileEntity> getOrderFileListWithCodes(String businessNo, String[] codes) {
  23. QueryWrapper<OrderFileEntity> qw = new QueryWrapper<>();
  24. qw.eq("business_no", businessNo);
  25. qw.in("code", codes);
  26. qw.orderByAsc("sort_num");
  27. return orderFileMapper.selectList(qw);
  28. }
  29. /**
  30. * 获取指定订单指定类型的公证文书
  31. *
  32. * @param businessNo
  33. * @param code
  34. * @return
  35. */
  36. public OrderFileEntity getOrderFileWithCode(String businessNo, String code) {
  37. String[] codes = {code};
  38. List<OrderFileEntity> orderFileList = getOrderFileListWithCodes(businessNo, codes);
  39. if (orderFileList != null && orderFileList.size() > 0) {
  40. return orderFileList.get(0);
  41. }
  42. return null;
  43. }
  44. /**
  45. * 获取指定订单指定产品的公证书
  46. *
  47. * @param businessNo
  48. * @return
  49. */
  50. public OrderFileEntity getOrderNotarization(String businessNo) {
  51. return getOrderFileWithCode(businessNo, OrderFileConstant.TYPE_CODE_NOTARIZATION);
  52. }
  53. /**
  54. * 获取指定订单指定产品面谈笔录
  55. *
  56. * @param businessNo
  57. * @return
  58. */
  59. public OrderFileEntity getOrderNote(String businessNo) {
  60. return getOrderFileWithCode(businessNo, OrderFileConstant.TYPE_CODE_NOTE);
  61. }
  62. /**
  63. * 获取已签名面谈笔录列表
  64. *
  65. * @param bizNoList
  66. * @return
  67. */
  68. public List<OrderFileEntity> getOrderNoteList(List<String> bizNoList) {
  69. QueryWrapper<OrderFileEntity> qw = new QueryWrapper<>();
  70. qw.in("business_no", bizNoList);
  71. qw.eq("code", OrderFileConstant.TYPE_CODE_NOTE);
  72. qw.isNotNull("signed_pdf_url");
  73. return orderFileMapper.selectList(qw);
  74. }
  75. /**
  76. * 获取指定订单可以签名的公证书列表
  77. *
  78. * @param bizNoList
  79. * @return
  80. */
  81. public List<OrderFileEntity> canBeSignedNotarization(List<String> bizNoList) {
  82. QueryWrapper<OrderFileEntity> qw = new QueryWrapper<>();
  83. qw.in("business_no", bizNoList);
  84. qw.in("code", OrderFileConstant.TYPE_CODE_NOTARIZATION);
  85. qw.isNotNull("doc_no");
  86. return orderFileMapper.selectList(qw);
  87. }
  88. /**
  89. * 删除订单的公证文书
  90. *
  91. * @param businessNO
  92. */
  93. public void delFileWithBizNO(String businessNO) {
  94. QueryWrapper<OrderFileEntity> qw = new QueryWrapper<>();
  95. qw.eq("business_no", businessNO);
  96. orderFileMapper.delete(qw);
  97. }
  98. }