|
|
@@ -5,37 +5,45 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import me.zhengjie.appapi.config.AppConfigInfo;
|
|
|
+import me.zhengjie.appapi.entity.CityEntity;
|
|
|
+import me.zhengjie.appapi.entity.ProvinceEntity;
|
|
|
import me.zhengjie.appapi.entity.SysUserEntity;
|
|
|
import me.zhengjie.appapi.entity.response.BaseResponse;
|
|
|
import me.zhengjie.appapi.entity.response.ResultData;
|
|
|
+import me.zhengjie.appapi.mapper.ICityDao;
|
|
|
+import me.zhengjie.appapi.mapper.IProvinceDao;
|
|
|
import me.zhengjie.appapi.mapper.ISysUserDao;
|
|
|
import me.zhengjie.appapi.service.OrderService;
|
|
|
-import me.zhengjie.appapi.util.BeanCopyUtils;
|
|
|
-import me.zhengjie.appapi.util.DateUtils;
|
|
|
-import me.zhengjie.appapi.util.FileUploadUtil;
|
|
|
-import me.zhengjie.appapi.util.StatusEnum;
|
|
|
-import me.zhengjie.appapi.util.StatusEnum.StepStatusEnum;
|
|
|
+import me.zhengjie.appapi.service.impl.NotaryNoteServiceImpl;
|
|
|
+import me.zhengjie.appapi.util.*;
|
|
|
import me.zhengjie.appapi.vo.FileVo;
|
|
|
import me.zhengjie.base.ResultCode;
|
|
|
-import me.zhengjie.modules.security.service.dto.JwtUserDto;
|
|
|
+import me.zhengjie.dao.ModelRepository;
|
|
|
+import me.zhengjie.dao.OrderFileRepository;
|
|
|
+import me.zhengjie.dao.entity.OrderFileEntity;
|
|
|
+import me.zhengjie.dao.mapper.OrderFileMapper;
|
|
|
+import me.zhengjie.domain.order.OrderBizCodeMessage;
|
|
|
import me.zhengjie.modules.system.domain.User;
|
|
|
-import me.zhengjie.modules.system.domain.user.UserDomain;
|
|
|
+import me.zhengjie.domain.user.UserDomain;
|
|
|
import me.zhengjie.modules.system.entity.*;
|
|
|
import me.zhengjie.modules.system.entity.request.order.NotaryOrderQueryReq;
|
|
|
import me.zhengjie.modules.system.entity.response.order.NotaryOrderInfoQueryRsp;
|
|
|
import me.zhengjie.modules.system.entity.response.order.NotaryOrderQueryRsp;
|
|
|
import me.zhengjie.modules.system.repository.*;
|
|
|
import me.zhengjie.modules.system.service.NotaryOrderService;
|
|
|
-import me.zhengjie.modules.system.service.dto.RoleSmallDto;
|
|
|
-import me.zhengjie.util.TextTempletUtil;
|
|
|
+import me.zhengjie.base.util.TextTempletUtil;
|
|
|
import me.zhengjie.utils.SecurityUtils;
|
|
|
-import org.apache.commons.io.FileUtils;
|
|
|
+import org.apache.commons.io.IOUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
-import java.io.File;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.nio.file.Paths;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
@@ -61,8 +69,6 @@ public class NotaryOrderServiceImpl extends ServiceImpl<NotaryOrderMapper, Notar
|
|
|
@Autowired
|
|
|
private GuaranteeMapper guaranteeMapper;
|
|
|
@Autowired
|
|
|
- private OrderDocMapper orderDocMapper;
|
|
|
- @Autowired
|
|
|
private OrderService orderService;
|
|
|
@Autowired
|
|
|
private UserRepository userRepository;
|
|
|
@@ -80,6 +86,16 @@ public class NotaryOrderServiceImpl extends ServiceImpl<NotaryOrderMapper, Notar
|
|
|
ISysUserDao userDao;
|
|
|
@Autowired
|
|
|
UserDomain userDomain;
|
|
|
+ @Autowired
|
|
|
+ OrderFileMapper orderFileMapper;
|
|
|
+ @Autowired
|
|
|
+ OrderFileRepository orderFileRepository;
|
|
|
+ @Autowired
|
|
|
+ ModelRepository modelRepository;
|
|
|
+ @Autowired
|
|
|
+ IProvinceDao provinceDao;
|
|
|
+ @Autowired
|
|
|
+ ICityDao cityDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseResponse<List<NotaryOrderQueryRsp>> query(NotaryOrderQueryReq req) {
|
|
|
@@ -100,7 +116,7 @@ public class NotaryOrderServiceImpl extends ServiceImpl<NotaryOrderMapper, Notar
|
|
|
|
|
|
/**
|
|
|
* 获取查询条件
|
|
|
- *
|
|
|
+ *
|
|
|
* @param req
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -238,15 +254,6 @@ public class NotaryOrderServiceImpl extends ServiceImpl<NotaryOrderMapper, Notar
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public BaseResponse<OrderDocEntity> pdf(HashMap<String, String> map) {
|
|
|
- BaseResponse<OrderDocEntity> response = new BaseResponse<>();
|
|
|
- OrderDocEntity orderDocEntity = orderDocMapper.selectOne(
|
|
|
- new QueryWrapper<OrderDocEntity>().orderByDesc("id").eq("contract_id", map.get("id")).last("limit 1"));
|
|
|
- response.setData(new ResultData<OrderDocEntity>(orderDocEntity));
|
|
|
- return response;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public BaseResponse orderReturn(NotaryOrderQueryReq req) {
|
|
|
BaseResponse response = new BaseResponse();
|
|
|
NotaryOrderEntity notaryOrderEntity = notaryOrderMapper.selectById(req.getId());
|
|
|
@@ -324,7 +331,30 @@ public class NotaryOrderServiceImpl extends ServiceImpl<NotaryOrderMapper, Notar
|
|
|
public BaseResponse partyPass(NotaryOrderQueryReq req) {
|
|
|
BaseResponse response = new BaseResponse();
|
|
|
NotaryOrderEntity notaryOrderEntity = notaryOrderMapper.selectById(req.getId());
|
|
|
- // 获取公证书编号
|
|
|
+ if ("0".equals(notaryOrderEntity.getAutoGenerate())) {
|
|
|
+ response.fail(OrderBizCodeMessage.NOTARIZATION_GENERATE_TYPE_ERROR);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ // 检查面谈笔录是否提交
|
|
|
+ List<OrderFileEntity> orderFileList = orderFileRepository.getOrderFileListByCodes(req.getPartyId(), "6,7,8,9".split(","));
|
|
|
+ if (orderFileList != null && orderFileList.size() > 0) {
|
|
|
+ response.fail(ResultCode.INTERVIEW_NOTE_UNSUBMIT);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ // 检查公证书模板是否处于编辑状态
|
|
|
+ String code = "";
|
|
|
+ if ("10".equals(req.getPartyId().substring(0, 2))) {
|
|
|
+ code = "10";
|
|
|
+ } else if ("11".equals(req.getPartyId().substring(0, 2))) {
|
|
|
+ code = "12";
|
|
|
+ } else {
|
|
|
+ code = "11";
|
|
|
+ }
|
|
|
+ if (modelRepository.existModelInEditing(notaryOrderEntity.getNotaryOfficeId(), code)) {
|
|
|
+ response.fail(OrderBizCodeMessage.MODEL_IN_EDITING);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ // 检查是否具备可用的公证书编号
|
|
|
SimpleDateFormat yearFormatter = new SimpleDateFormat("yyyy");
|
|
|
QueryWrapper<NotarizationNoEntity> notarizationNoQw = new QueryWrapper<>();
|
|
|
notarizationNoQw.eq("notary_office_id", notaryOrderEntity.getNotaryOfficeId());
|
|
|
@@ -337,23 +367,118 @@ public class NotaryOrderServiceImpl extends ServiceImpl<NotaryOrderMapper, Notar
|
|
|
response.fail(ResultCode.NO_NOTARIZARION_NO);
|
|
|
return response;
|
|
|
}
|
|
|
- // 检查面谈笔录是否提交
|
|
|
- QueryWrapper<OrderDocEntity> orderDocWrapper = new QueryWrapper<>();
|
|
|
- orderDocWrapper.eq("business_no", notaryOrderEntity.getBusinessNo());
|
|
|
- orderDocWrapper.eq("contract_id", req.getPartyId());
|
|
|
- OrderDocEntity orderDoc = orderDocMapper.selectOne(orderDocWrapper);
|
|
|
- if (StringUtils.isEmpty(orderDoc.getNotePdf())) {
|
|
|
- response.fail(ResultCode.INTERVIEW_NOTE_UNSUBMIT);
|
|
|
- return response;
|
|
|
+ // Load公证书模板需要的信息
|
|
|
+ // 订单相关信息
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("$LoanAmount$", notaryOrderEntity.getLoanMoney());
|
|
|
+ if ("10".equals(req.getPartyId().substring(0, 2))) {
|
|
|
+ map.put("$Type$", "借款合同");
|
|
|
+ } else if ("11".equals(req.getPartyId().substring(0, 2))) {
|
|
|
+ map.put("$Type$", "抵押合同");
|
|
|
+ } else {
|
|
|
+ map.put("$Type$", "担保合同");
|
|
|
}
|
|
|
- // 保存公证书编号
|
|
|
+ // 公证书编号
|
|
|
NotarizationNoEntity notarizationNoEntity = notarizationNoList.get(0);
|
|
|
int currentNum = notarizationNoEntity.getCurrentNum() == 0 ? notarizationNoEntity.getBeginNum()
|
|
|
: notarizationNoEntity.getCurrentNum() + 1;
|
|
|
- OrderDocEntity saveOrderDoc = new OrderDocEntity();
|
|
|
- saveOrderDoc.setId(orderDoc.getId());
|
|
|
- saveOrderDoc.setNotarizationNo(String.valueOf(currentNum));
|
|
|
- orderDocMapper.updateById(saveOrderDoc);
|
|
|
+ map.put("$NotarialNumber$", String.valueOf(currentNum));
|
|
|
+ // 公证处信息
|
|
|
+ NotaryOfficeEntity notaryOffice = notaryOfficeMapper.selectById(notaryOrderEntity.getNotaryOfficeId());
|
|
|
+ String[] areas = notaryOffice.getAreaCodesStr().split(",");
|
|
|
+ QueryWrapper<ProvinceEntity> provinceQW = new QueryWrapper<>();
|
|
|
+ provinceQW.eq("code", areas[0]);
|
|
|
+ ProvinceEntity provinceEntity = provinceDao.selectOne(provinceQW);
|
|
|
+ QueryWrapper<CityEntity> cityQW = new QueryWrapper<>();
|
|
|
+ cityQW.eq("code", areas[1]);
|
|
|
+ CityEntity cityEntity = cityDao.selectOne(cityQW);
|
|
|
+ String usedLocation = provinceEntity.getProvinceName().concat(cityEntity.getCityName());
|
|
|
+ map.put("$Site$", usedLocation);
|
|
|
+ map.put("$NotaryOffice$", notaryOffice.getName());
|
|
|
+ // 借款人信息
|
|
|
+ try {
|
|
|
+ QueryWrapper<BorrowerEntity> borrowQw = new QueryWrapper<>();
|
|
|
+ borrowQw.eq("business_no", notaryOrderEntity.getBusinessNo());
|
|
|
+ BorrowerEntity borrowerEntity = borrowerMapper.selectOne(borrowQw);
|
|
|
+ SimpleDateFormat monthformatter = new SimpleDateFormat("yyyy-MM");
|
|
|
+ Date beginDate = monthformatter.parse(borrowerEntity.getStartDate());
|
|
|
+ Date endDate = monthformatter.parse(borrowerEntity.getEndDate());
|
|
|
+ Integer months = DateUtils.getDiffNaturalMonth(endDate, beginDate);
|
|
|
+ map.put("$Year$", yearFormatter.format(new Date()));
|
|
|
+ map.put("$LoanName$", borrowerEntity.getUsername());
|
|
|
+ map.put("$LoanSex$", "1".equals(borrowerEntity.getSex()) ? "男" : "女");
|
|
|
+ map.put("$LoanBirthdday$", borrowerEntity.getBirth());
|
|
|
+ map.put("$LoanIDNo$", borrowerEntity.getIdCard());
|
|
|
+ map.put("$LoanRate$", borrowerEntity.getRate());
|
|
|
+ map.put("$LoanTerm$", borrowerEntity.getStartDate().concat(" - ").concat(borrowerEntity.getEndDate()));
|
|
|
+ map.put("$TotalMonth$", months.toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ // 抵押人信息
|
|
|
+ QueryWrapper<MortgageEntity> mortgageQw = new QueryWrapper<>();
|
|
|
+ mortgageQw.eq("business_no", notaryOrderEntity.getBusinessNo());
|
|
|
+ MortgageEntity mortgageEntity = mortgageMapper.selectOne(mortgageQw);
|
|
|
+ map.put("$MortgageName$", mortgageEntity.getUsername());
|
|
|
+ map.put("$MortgageIDNo$", mortgageEntity.getIdCard());
|
|
|
+ map.put("$MortgageSex$", "1".equals(mortgageEntity.getSex()) ? "男" : "女");
|
|
|
+ map.put("$MortgageBirthdday$", mortgageEntity.getBirth());
|
|
|
+ map.put("$HouseAddr$", mortgageEntity.getHouseLocation());
|
|
|
+ // 担保人信息
|
|
|
+ QueryWrapper<GuaranteeEntity> guaranteeQw = new QueryWrapper<>();
|
|
|
+ guaranteeQw.eq("business_no", notaryOrderEntity.getBusinessNo());
|
|
|
+ GuaranteeEntity guaranteeEntity = guaranteeMapper.selectOne(guaranteeQw);
|
|
|
+ map.put("$GuaranteeName$", guaranteeEntity.getUsername());
|
|
|
+ map.put("$GuaranteeIDNo$", guaranteeEntity.getIdCard());
|
|
|
+ map.put("$GuaranteeSex$", "1".equals(guaranteeEntity.getSex()) ? "男" : "女");
|
|
|
+ map.put("$GuaranteeBirthdday$", guaranteeEntity.getBirth());
|
|
|
+ // 银行信息
|
|
|
+ BankEntity bankEntity = bankMapper.selectById(notaryOrderEntity.getBankId());
|
|
|
+ map.put("$Bank$", bankEntity.getBankName());
|
|
|
+ map.put("$BankAddr$", bankEntity.getAddress());
|
|
|
+ map.put("$BankLeader$", bankEntity.getPrincipal());
|
|
|
+ // 其他信息
|
|
|
+ SimpleDateFormat dayFormatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ map.put("$Date$", dayFormatter.format(new Date()));
|
|
|
+ // 生成并保存未签名公证书
|
|
|
+ ModelEntity modelEntity = modelRepository.getModelEntity(notaryOrderEntity.getNotaryOfficeId(), code, "1");
|
|
|
+ String result = "";
|
|
|
+ String htmlFilePath = "";
|
|
|
+ String pdfFilePath = "";
|
|
|
+ try {
|
|
|
+ InputStream inputStream = NotaryNoteServiceImpl.class.getClassLoader().getResourceAsStream("template/note/notary-model.html");
|
|
|
+ result = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
|
|
+ String content = result.replace("${ModelContent}", TextTempletUtil.replaceContent(modelEntity.getContent(), map));
|
|
|
+ String htmlFileDir = AppConfigInfo.APP_UPLOAD_PATH + "notary-html-" + notaryOrderEntity.getBusinessNo() + "/";
|
|
|
+ Path path = Paths.get(htmlFileDir);
|
|
|
+ if (!Files.exists(path)) {
|
|
|
+ Files.createDirectory(path);
|
|
|
+ }
|
|
|
+ htmlFilePath = htmlFileDir + req.getPartyId() + ".html";
|
|
|
+ Files.write(Paths.get(htmlFilePath), content.getBytes(StandardCharsets.UTF_8));
|
|
|
+ //
|
|
|
+ String pdfFileDir = AppConfigInfo.APP_UPLOAD_PATH + "notary-pdf-" + notaryOrderEntity.getBusinessNo() + "/";
|
|
|
+ path = Paths.get(pdfFileDir);
|
|
|
+ if (!Files.exists(path)) {
|
|
|
+ Files.createDirectory(path);
|
|
|
+ }
|
|
|
+ pdfFilePath = pdfFileDir + req.getPartyId() + ".pdf";
|
|
|
+ HtmlConvertPdf.createPdfFile(content, pdfFilePath);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ //
|
|
|
+ OrderFileEntity notaryOrderFile = new OrderFileEntity();
|
|
|
+ notaryOrderFile.setBusinessNo(notaryOrderEntity.getBusinessNo());
|
|
|
+ notaryOrderFile.setContractId(req.getPartyId());
|
|
|
+ notaryOrderFile.setCode(code);
|
|
|
+ notaryOrderFile.setDocNo(String.valueOf(currentNum));
|
|
|
+ notaryOrderFile.setHtmlUrl(htmlFilePath);
|
|
|
+ notaryOrderFile.setPdfUrl(pdfFilePath);
|
|
|
+ notaryOrderFile.setSortNum(modelEntity.getSort());
|
|
|
+ notaryOrderFile.setCreateTime(new Date());
|
|
|
+ notaryOrderFile.setCreatorId(SecurityUtils.getCurrentUserId());
|
|
|
+ orderFileMapper.insert(notaryOrderFile);
|
|
|
// 更新当前公证书编号
|
|
|
NotarizationNoEntity notarizationNo = new NotarizationNoEntity();
|
|
|
notarizationNo.setId(notarizationNoEntity.getId());
|
|
|
@@ -368,7 +493,7 @@ public class NotaryOrderServiceImpl extends ServiceImpl<NotaryOrderMapper, Notar
|
|
|
|
|
|
/**
|
|
|
* 订单状态更新为通过公证
|
|
|
- *
|
|
|
+ *
|
|
|
* @param orderId
|
|
|
* @param businessNo
|
|
|
*/
|
|
|
@@ -554,165 +679,56 @@ public class NotaryOrderServiceImpl extends ServiceImpl<NotaryOrderMapper, Notar
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BaseResponse uploadNotarization(FileVo file) {
|
|
|
-
|
|
|
BaseResponse response = new BaseResponse<>();
|
|
|
-// String uploadFileName = file.getFile().getOriginalFilename();
|
|
|
-// int index = uploadFileName.lastIndexOf(".");
|
|
|
-// String suffix = uploadFileName.substring(index);
|
|
|
-// String fileName = file.getFileName() + suffix;
|
|
|
-// String filePath = AppConfigInfo.APP_UPLOAD_PATH + "notarization/" + fileName;
|
|
|
-// String fileUrl = "notarization/" + fileName;
|
|
|
-// File fullPath = new File(filePath);
|
|
|
-// if (fullPath.exists()) {
|
|
|
-// response.fail(ResultCode.FILE_EXISTING);
|
|
|
-// }
|
|
|
-// try {
|
|
|
-// FileUtils.copyInputStreamToFile(file.getFile().getInputStream(), fullPath);
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// response.fail(ResultCode.INTERFACE_INNER_INVOKE_ERROR);
|
|
|
-// }
|
|
|
-
|
|
|
- QueryWrapper<OrderDocEntity> orderDocQw = new QueryWrapper<>();
|
|
|
- orderDocQw.eq("contract_id", file.getContractId());
|
|
|
- OrderDocEntity orderDoc = orderDocMapper.selectOne(orderDocQw);
|
|
|
- String path = orderDoc.getBusinessNo()+ "/" + StepStatusEnum.getType(orderDoc.getContractId()) + "/" ;
|
|
|
+ String path = file.getBusinessNo()+ "/" + StatusEnum.StepStatusEnum.getType(file.getContractId()) + "/" ;
|
|
|
file.setFilePath(path);
|
|
|
String filePath = FileUploadUtil.upload(file);
|
|
|
-
|
|
|
- OrderDocEntity saveOrderDoc = new OrderDocEntity();
|
|
|
- saveOrderDoc.setId(orderDoc.getId());
|
|
|
- saveOrderDoc.setAuthNotarization(filePath);
|
|
|
- orderDocMapper.updateById(saveOrderDoc);
|
|
|
- updateStatusPass(file.getContractId(), orderDoc.getBusinessNo());
|
|
|
+ OrderFileEntity notaryOrderFile = new OrderFileEntity();
|
|
|
+ notaryOrderFile.setBusinessNo(file.getBusinessNo());
|
|
|
+ notaryOrderFile.setContractId(file.getContractId());
|
|
|
+ notaryOrderFile.setSignedPdfUrl(filePath);
|
|
|
+ notaryOrderFile.setCreateTime(new Date());
|
|
|
+ notaryOrderFile.setCreatorId(SecurityUtils.getCurrentUserId());
|
|
|
+ orderFileMapper.insert(notaryOrderFile);
|
|
|
+
|
|
|
+ updateStatusPass(file.getContractId(), file.getBusinessNo());
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取文件列表
|
|
|
- *
|
|
|
+ *
|
|
|
* @param req
|
|
|
* @return
|
|
|
*/
|
|
|
public BaseResponse getDocList(NotaryOrderQueryReq req) {
|
|
|
BaseResponse response = new BaseResponse();
|
|
|
- QueryWrapper<OrderDocEntity> orderDocQw = new QueryWrapper<>();
|
|
|
- orderDocQw.eq("contract_id", req.getPartyId());
|
|
|
- OrderDocEntity orderDoc = orderDocMapper.selectOne(orderDocQw);
|
|
|
- response.setData(new ResultData(getDocList(orderDoc)));
|
|
|
- return response;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取文件列表
|
|
|
- *
|
|
|
- * @param orderDoc
|
|
|
- * @return
|
|
|
- */
|
|
|
- private List<Map<String, String>> getDocList(OrderDocEntity orderDoc) {
|
|
|
- QueryWrapper<NotaryOrderEntity> orderQw = new QueryWrapper<>();
|
|
|
- orderQw.eq("business_no", orderDoc.getBusinessNo());
|
|
|
- NotaryOrderEntity orderEntity = notaryOrderMapper.selectOne(orderQw);
|
|
|
- QueryWrapper<ModelEntity> modelQw = new QueryWrapper<>();
|
|
|
- modelQw.eq("notary_office_id", orderEntity.getNotaryOfficeId());
|
|
|
- modelQw.eq("status", 1);
|
|
|
- modelQw.in("code", "1,2,3,4,5,6,7,8,9".split(","));
|
|
|
- modelQw.orderByAsc("sort");
|
|
|
- List<ModelEntity> modelEntityList = modelMapper.selectList(modelQw);
|
|
|
- List<Map<String, String>> fileList = new ArrayList<>();
|
|
|
- boolean isAlreadyDeal = false;
|
|
|
- for (ModelEntity modelEntity : modelEntityList) {
|
|
|
- if ("6,7,8,9".indexOf(modelEntity.getCode()) > -1) {
|
|
|
- if (isAlreadyDeal) {
|
|
|
- continue;
|
|
|
- } else {
|
|
|
- isAlreadyDeal = true;
|
|
|
- }
|
|
|
- }
|
|
|
- Map<String, String> map = getDocMap(modelEntity.getCode(), orderDoc);
|
|
|
- if (map != null) {
|
|
|
- fileList.add(map);
|
|
|
- }
|
|
|
- }
|
|
|
- return fileList;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取文件Map
|
|
|
- *
|
|
|
- * @param code
|
|
|
- * @param orderDoc
|
|
|
- * @return
|
|
|
- */
|
|
|
- private Map<String, String> getDocMap(String code, OrderDocEntity orderDoc) {
|
|
|
- Map<String, String> fileMap = null;
|
|
|
- if ("1".equals(code)) {
|
|
|
- if (!StringUtils.isEmpty(orderDoc.getAuthApply())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "申请表");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getAuthApply()));
|
|
|
- } else if (!StringUtils.isEmpty(orderDoc.getApplyPdf())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "申请表");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getApplyPdf()));
|
|
|
- }
|
|
|
- } else if ("2".equals(code)) {
|
|
|
- if (!StringUtils.isEmpty(orderDoc.getAuthConfirmation())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "送达确认书");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getAuthConfirmation()));
|
|
|
- } else if (!StringUtils.isEmpty(orderDoc.getConfirmationPdf())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "送达确认书");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getConfirmationPdf()));
|
|
|
- }
|
|
|
- } else if ("3".equals(code)) {
|
|
|
- if (!StringUtils.isEmpty(orderDoc.getAuthNotice())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "受理回执");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getAuthNotice()));
|
|
|
- } else if (!StringUtils.isEmpty(orderDoc.getNoticePdf())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "受理回执");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getNoticePdf()));
|
|
|
- }
|
|
|
- } else if ("4".equals(code)) {
|
|
|
- if (!StringUtils.isEmpty(orderDoc.getAuthNotification())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "债权书");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getAuthNotification()));
|
|
|
- } else if (!StringUtils.isEmpty(orderDoc.getNotificationPdf())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "债权书");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getNotificationPdf()));
|
|
|
- }
|
|
|
- } else if ("5".equals(code)) {
|
|
|
- if (!StringUtils.isEmpty(orderDoc.getAuthPromise())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "承诺书");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getAuthPromise()));
|
|
|
- } else if (!StringUtils.isEmpty(orderDoc.getPromisePdf())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "承诺书");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getPromisePdf()));
|
|
|
- }
|
|
|
- } else if ("6,7,8,9".indexOf(code) > -1) {
|
|
|
- if (!StringUtils.isEmpty(orderDoc.getAuthNote())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "面谈笔录");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getAuthNote()));
|
|
|
- } else if (!StringUtils.isEmpty(orderDoc.getNotePdf())) {
|
|
|
- fileMap = new HashMap<>();
|
|
|
- fileMap.put("name", "面谈笔录");
|
|
|
- fileMap.put("value", getPreviewUrl(orderDoc.getNotePdf()));
|
|
|
+ Map<String, String> map = new HashMap<String, String>() {
|
|
|
+ {
|
|
|
+ put("1", "申请表");
|
|
|
+ put("2", "送达确认书");
|
|
|
+ put("3", "受理回执");
|
|
|
+ put("4", "债权书");
|
|
|
+ put("5", "承诺书");
|
|
|
+ put("6", "面谈笔录");
|
|
|
+ put("7", "面谈笔录");
|
|
|
+ put("8", "面谈笔录");
|
|
|
+ put("9", "面谈笔录");
|
|
|
}
|
|
|
+ };
|
|
|
+ List<OrderFileEntity> orderFileList = orderFileRepository.getOrderFileListByCodes(req.getPartyId(), "1,2,3,4,5,6,7,8,9".split(","));
|
|
|
+ List<Map<String, String>> fileList = new ArrayList<>();
|
|
|
+ for (OrderFileEntity orderFile : orderFileList) {
|
|
|
+ Map<String, String> content = new HashMap<>();
|
|
|
+ String fileUrl = StringUtils.isEmpty(orderFile.getSignedPdfUrl()) ? orderFile.getPdfUrl() : orderFile.getSignedPdfUrl();
|
|
|
+ map.put("name", map.get(orderFile.getCode()));
|
|
|
+ map.put("value", getPreviewUrl(fileUrl));
|
|
|
}
|
|
|
- return fileMap;
|
|
|
+ response.setData(new ResultData(fileList));
|
|
|
+ return response;
|
|
|
}
|
|
|
|
|
|
public String getPreviewUrl(String path) {
|
|
|
-
|
|
|
return FileUploadUtil.getPreviewUrl(path);
|
|
|
}
|
|
|
-
|
|
|
}
|