CostDocumentTemplateFileManagerImpl.java 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package com.hotent.baseInfo.manager.impl;
  2. import cn.hutool.core.util.ObjectUtil;
  3. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4. import com.hotent.base.util.StringUtil;
  5. import com.hotent.baseInfo.model.CostDocumentTemplateFile;
  6. import com.hotent.baseInfo.dao.CostDocumentTemplateFileDao;
  7. import com.hotent.baseInfo.manager.CostDocumentTemplateFileManager;
  8. import com.hotent.base.manager.impl.BaseManagerImpl;
  9. import com.hotent.project.model.CostProjectDocumentFile;
  10. import com.hotent.uc.api.model.IUser;
  11. import com.hotent.uc.exception.BaseException;
  12. import com.hotent.uc.util.ContextUtil;
  13. import org.springframework.stereotype.Service;
  14. import org.springframework.transaction.annotation.Transactional;
  15. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  16. import java.time.LocalDateTime;
  17. import java.util.List;
  18. import javax.annotation.Resource;
  19. import com.hotent.base.util.BeanUtils;
  20. /**
  21. * 监审文书文件内容表 服务实现类
  22. *
  23. * @author 超级管理员
  24. * @company 山西清众科技股份有限公司
  25. * @since 2025-10-14
  26. */
  27. @Service
  28. public class CostDocumentTemplateFileManagerImpl extends BaseManagerImpl<CostDocumentTemplateFileDao, CostDocumentTemplateFile> implements CostDocumentTemplateFileManager {
  29. @Override
  30. public CostDocumentTemplateFile getDetail(String id) {
  31. CostDocumentTemplateFile costDocumentTemplateFile = this.get(id);
  32. return costDocumentTemplateFile;
  33. }
  34. @Override
  35. @Transactional
  36. public void createOrUpdate(CostDocumentTemplateFile costDocumentTemplateFile) {
  37. //新建或更新
  38. this.saveOrUpdate(costDocumentTemplateFile);
  39. }
  40. @Override
  41. public List<CostDocumentTemplateFile> queryByDocumentId(String documentId,String whereValue) {
  42. List<CostDocumentTemplateFile> documentFileList = this.getDocumentFileList(documentId);
  43. QueryWrapper<CostDocumentTemplateFile> eq = new QueryWrapper<CostDocumentTemplateFile>().eq("document_id", documentId);
  44. for (CostDocumentTemplateFile costProjectDocumentFile : documentFileList) {
  45. try {
  46. if (StringUtil.isNotEmpty(costProjectDocumentFile.getTableName())){
  47. if(StringUtil.isEmpty(costProjectDocumentFile.getWhereValue())){
  48. costProjectDocumentFile.setWhereValue(whereValue);
  49. }else {
  50. String whereValue1 = costProjectDocumentFile.getWhereValue();
  51. String replace = whereValue1.replace("?", "'" + whereValue + "'");
  52. costProjectDocumentFile.setWhereValue(replace);
  53. }
  54. String colValue = this.baseMapper.getColValue(costProjectDocumentFile.getTableName(), costProjectDocumentFile.getColName(), costProjectDocumentFile.getWhereName(), costProjectDocumentFile.getWhereValue());
  55. //获取whereValue字段值
  56. costProjectDocumentFile.setDataValue(colValue);
  57. }
  58. } catch (Exception e) {
  59. throw new BaseException("获取字段失败:" + costProjectDocumentFile.getColName());
  60. }
  61. }
  62. return documentFileList;
  63. }
  64. @Override
  65. public List<CostDocumentTemplateFile> getDocumentFileList(String documentId) {
  66. LambdaQueryWrapper<CostDocumentTemplateFile> queryWrapper = new LambdaQueryWrapper<>();
  67. queryWrapper.eq(CostDocumentTemplateFile::getDocumentId, documentId);
  68. List<CostDocumentTemplateFile> list = this.list(queryWrapper);
  69. if (ObjectUtil.isEmpty(list)) {
  70. throw new BaseException("没有找到对应的数据");
  71. }
  72. return list;
  73. }
  74. @Override
  75. public String getColValue(String tableName, String colName, String whereName, String whereValue) {
  76. return baseMapper.getColValue(tableName, colName, whereName, whereValue);
  77. }
  78. }