| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- package me.zhengjie.dao.mybatis;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import lombok.RequiredArgsConstructor;
- import me.zhengjie.dao.mybatis.entity.OrderFileEntity;
- import me.zhengjie.dao.mybatis.mapper.OrderFileMapper;
- import me.zhengjie.domain.order.OrderConstant;
- import me.zhengjie.domain.order.OrderFileConstant;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.stereotype.Component;
- import java.util.List;
- @RequiredArgsConstructor
- @Component
- public class OrderFileRepository {
- final OrderFileMapper orderFileMapper;
- /**
- * 获取指定订单指定类型的公证文书列表
- *
- * @param businessNo
- * @param codes
- * @return
- */
- public List<OrderFileEntity> getOrderFileListWithCodes(String businessNo, String[] codes) {
- QueryWrapper<OrderFileEntity> qw = new QueryWrapper<>();
- qw.eq("business_no", businessNo);
- qw.in("code", codes);
- qw.orderByAsc("sort_num");
- return orderFileMapper.selectList(qw);
- }
- /**
- * 获取指定订单指定类型的公证文书
- *
- * @param businessNo
- * @param code
- * @return
- */
- public OrderFileEntity getOrderFileWithCode(String businessNo, String code) {
- String[] codes = {code};
- List<OrderFileEntity> orderFileList = getOrderFileListWithCodes(businessNo, codes);
- if (orderFileList != null && orderFileList.size() > 0) {
- return orderFileList.get(0);
- }
- return null;
- }
- /**
- * 获取指定订单指定产品的公证书
- *
- * @param businessNo
- * @return
- */
- public OrderFileEntity getOrderNotarization(String businessNo) {
- return getOrderFileWithCode(businessNo, OrderFileConstant.TYPE_CODE_NOTARIZATION);
- }
- /**
- * 获取指定订单指定产品面谈笔录
- *
- * @param businessNo
- * @return
- */
- public OrderFileEntity getOrderNote(String businessNo) {
- return getOrderFileWithCode(businessNo, OrderFileConstant.TYPE_CODE_NOTE);
- }
- /**
- * 获取已签名面谈笔录列表
- *
- * @param bizNoList
- * @return
- */
- public List<OrderFileEntity> getOrderNoteList(List<String> bizNoList) {
- QueryWrapper<OrderFileEntity> qw = new QueryWrapper<>();
- qw.in("business_no", bizNoList);
- qw.eq("code", OrderFileConstant.TYPE_CODE_NOTE);
- qw.isNotNull("signed_pdf_url");
- return orderFileMapper.selectList(qw);
- }
- /**
- * 获取指定订单可以签名的公证书列表
- *
- * @param bizNoList
- * @return
- */
- public List<OrderFileEntity> canBeSignedNotarization(List<String> bizNoList) {
- QueryWrapper<OrderFileEntity> qw = new QueryWrapper<>();
- qw.in("business_no", bizNoList);
- qw.in("code", OrderFileConstant.TYPE_CODE_NOTARIZATION);
- qw.isNotNull("doc_no");
- return orderFileMapper.selectList(qw);
- }
- /**
- * 删除订单的公证文书
- *
- * @param businessNO
- */
- public void delFileWithBizNO(String businessNO) {
- QueryWrapper<OrderFileEntity> qw = new QueryWrapper<>();
- qw.eq("business_no", businessNO);
- orderFileMapper.delete(qw);
- }
- }
|