赵越越 1 ヶ月 前
コミット
f24a847bea

+ 3 - 2
assistMg/src/main/java/com/hotent/baseInfo/controller/CostDocumentTemplateFileController.java

@@ -79,9 +79,10 @@ public class CostDocumentTemplateFileController extends BaseController<CostDocum
 	@ApiOperation(value = "根据文书id查询和whereValue查询", httpMethod = "GET", notes = "根据文书id查询和whereValue查询")
 	public CommonResult<List<CostDocumentTemplateFile>> queryByDocumentIdandWhereValue(
 			@ApiParam(name="documentId",value="文书id", required = true)@RequestParam() String documentId,
-			@ApiParam(name="whereValue",value="条件值", required = true)@RequestParam() String whereValue
+			@ApiParam(name="whereValue",value="条件值", required = true)@RequestParam() String whereValue,
+			@ApiParam(name="unitId",value="监审单位id", required = true)@RequestParam() String unitId
 	) throws Exception{
-		List<CostDocumentTemplateFile> costDocumentTemplateFiles = costDocumentTemplateFileManager.queryByDocumentId(documentId,whereValue);
+		List<CostDocumentTemplateFile> costDocumentTemplateFiles = costDocumentTemplateFileManager.queryByDocumentId(documentId,whereValue,unitId);
 		return CommonResult.<List<CostDocumentTemplateFile>>ok().value(costDocumentTemplateFiles);
 
 	}

+ 1 - 1
assistMg/src/main/java/com/hotent/baseInfo/manager/CostDocumentTemplateFileManager.java

@@ -28,7 +28,7 @@ public interface CostDocumentTemplateFileManager extends BaseManager<CostDocumen
 	void createOrUpdate(CostDocumentTemplateFile costDocumentTemplateFile);
 
 
-	public List<CostDocumentTemplateFile> queryByDocumentId(String documentId,String whereValue);
+	public List<CostDocumentTemplateFile> queryByDocumentId(String documentId,String whereValue,String unitId);
 
 	List<CostDocumentTemplateFile> getDocumentFileList(String documentId);
 

+ 18 - 2
assistMg/src/main/java/com/hotent/baseInfo/manager/impl/CostDocumentTemplateFileManagerImpl.java

@@ -3,6 +3,8 @@ package com.hotent.baseInfo.manager.impl;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.hotent.base.util.StringUtil;
+import com.hotent.baseInfo.manager.AuditedUnitManager;
+import com.hotent.baseInfo.model.AuditedUnit;
 import com.hotent.baseInfo.model.CostDocumentTemplateFile;
 import com.hotent.baseInfo.dao.CostDocumentTemplateFileDao;
 import com.hotent.baseInfo.manager.CostDocumentTemplateFileManager;
@@ -10,7 +12,10 @@ import com.hotent.base.manager.impl.BaseManagerImpl;
 import com.hotent.project.model.CostProjectDocumentFile;
 import com.hotent.uc.api.model.IUser;
 import com.hotent.uc.exception.BaseException;
+import com.hotent.uc.manager.UserManager;
+import com.hotent.uc.model.User;
 import com.hotent.uc.util.ContextUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -32,6 +37,12 @@ import com.hotent.base.util.BeanUtils;
 @Service
 public class CostDocumentTemplateFileManagerImpl extends BaseManagerImpl<CostDocumentTemplateFileDao, CostDocumentTemplateFile> implements CostDocumentTemplateFileManager {
 
+    @Autowired
+    private AuditedUnitManager auditedUnitManager;
+
+    @Autowired
+    private UserManager userService;
+
     @Override
     public CostDocumentTemplateFile getDetail(String id) {
         CostDocumentTemplateFile costDocumentTemplateFile = this.get(id);
@@ -50,7 +61,7 @@ public class CostDocumentTemplateFileManagerImpl extends BaseManagerImpl<CostDoc
 
 
     @Override
-    public List<CostDocumentTemplateFile> queryByDocumentId(String documentId,String whereValue) {
+    public List<CostDocumentTemplateFile> queryByDocumentId(String documentId,String whereValue,String unitId) {
         List<CostDocumentTemplateFile> documentFileList = this.getDocumentFileList(documentId);
         QueryWrapper<CostDocumentTemplateFile> eq = new QueryWrapper<CostDocumentTemplateFile>().eq("document_id", documentId);
         for (CostDocumentTemplateFile costProjectDocumentFile : documentFileList) {
@@ -58,9 +69,14 @@ public class CostDocumentTemplateFileManagerImpl extends BaseManagerImpl<CostDoc
                 if (StringUtil.isNotEmpty(costProjectDocumentFile.getTableName())){
                     if(StringUtil.isEmpty(costProjectDocumentFile.getWhereValue())){
                         costProjectDocumentFile.setWhereValue(whereValue);
-                    }else {
+                    } else {
+
                         String whereValue1 = costProjectDocumentFile.getWhereValue();
                         String replace = whereValue1.replace("?", "'" + whereValue + "'");
+                        if (replace.contains("&")) {
+                            AuditedUnit auditedUnit = auditedUnitManager.get(unitId);
+                             replace = replace.replace("&", auditedUnit.getUnitId());
+                        }
                         costProjectDocumentFile.setWhereValue(replace);
                     }
                     String colValue = this.baseMapper.getColValue(costProjectDocumentFile.getTableName(), costProjectDocumentFile.getColName(), costProjectDocumentFile.getWhereName(), costProjectDocumentFile.getWhereValue());

+ 41 - 26
assistMg/src/main/java/com/hotent/project/manager/impl/CostProjectDocumentManagerImpl.java

@@ -195,7 +195,15 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
         if (ObjectUtil.isEmpty(req.getProjectId())) {
             throw new BaseException("请选择项目");
         }
-        if (ObjectUtil.isEmpty(req.getDocumentNumber())) {
+        CostDocumentTemplate costDocumentTemplate = this.costDocumentTemplateManager.get(req.getDocumentId());
+        if (costDocumentTemplate == null || BaseConstant.DELETE_FLAG.equals(costDocumentTemplate.getIsDeleted())) {
+            throw new BaseException("文书模板不存在");
+        }
+        if (!costDocumentTemplate.getAlias().equals("cbjsgzdg")
+                &&!costDocumentTemplate.getAlias().equals("cbjsjtsyjl")
+                &&!costDocumentTemplate.getAlias().equals("cbshcbyjb1")
+                &&!costDocumentTemplate.getAlias().equals("cbjstqzldjb")
+                && ObjectUtil.isEmpty(req.getDocumentNumber())) {
             throw new BaseException("请填写通知文号");
         }
         if (ObjectUtil.isEmpty(req.getEnterpriseId())) {
@@ -204,30 +212,28 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
         req.setGenerateTime(LocalDateTime.now());
         req.setIsPushed("1");
 
-        CostDocumentTemplate costDocumentTemplate = this.costDocumentTemplateManager.get(req.getDocumentId());
-        if (costDocumentTemplate == null || BaseConstant.DELETE_FLAG.equals(costDocumentTemplate.getIsDeleted())) {
-            throw new BaseException("文书模板不存在");
-        }
+
         req.setDocumentAlias(costDocumentTemplate.getAlias());
         AuditedUnit auditedUnit = auditedUnitManager.get(req.getEnterpriseId());
         if (auditedUnit == null || BaseConstant.DELETE_FLAG.equals(auditedUnit.getIsDeleted())) {
             throw new BaseException("被监审单位不存在");
         }
-        CostDocumentWh costDocumentWh = costDocumentWhManager.get(req.getDocumentWhId());
-        if (costDocumentWh == null || BaseConstant.DELETE_FLAG.equals(costDocumentWh.getIsDeleted())) {
-            throw new BaseException("文书文号不存在");
-        }
+        CostDocumentWh costDocumentWh=null;
         //返回文号
-        String whNo = this.getWH(costDocumentWh);
-        //校验文号唯一性
-        /*Boolean b = whMap.get(whNo);
-        if (b==null || !b) {
-            whMap.put(whNo,true);
-        }else {
-            throw new BaseException("【"+whNo+"】文号已存在请重新添加");
-        }*/
-
-
+        String whNo;
+        if (!costDocumentTemplate.getAlias().equals("cbjsgzdg")
+                &&!costDocumentTemplate.getAlias().equals("cbjsjtsyjl")
+                &&!costDocumentTemplate.getAlias().equals("cbshcbyjb1")
+                &&!costDocumentTemplate.getAlias().equals("cbjstqzldjb")) {
+            costDocumentWh= costDocumentWhManager.get(req.getDocumentWhId());
+            if (costDocumentWh == null || BaseConstant.DELETE_FLAG.equals(costDocumentWh.getIsDeleted())) {
+                throw new BaseException("文书文号不存在");
+            }
+            //返回文号
+            whNo = this.getWH(costDocumentWh);
+        } else {
+            whNo = "";
+        }
         LambdaQueryWrapper<CostProjectDocument> qw = new LambdaQueryWrapper<>();
         qw.eq(CostProjectDocument::getProjectId, req.getProjectId());
         qw.eq(CostProjectDocument::getDocumentId, req.getDocumentId());
@@ -261,7 +267,15 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
             if (StringUtils.isNotBlank(costProjectDocumentFile.getTableName())){
                 if(StringUtil.isEmpty(costProjectDocumentFile.getWhereValue())){
                     costProjectDocumentFile.setWhereValue(costProjectApproval.getProjectId());
-                }else {
+                } else if (costProjectDocument.getDocumentAlias().equals("cbjsgzdg")
+                        &&!costProjectDocument.getDocumentAlias().equals("cbjsjtsyjl")
+                        &&!costProjectDocument.getDocumentAlias().equals("cbshcbyjb1")
+                        &&!costProjectDocument.getDocumentAlias().equals("cbjstqzldjb")) {
+                    String whereValue1 = costProjectDocumentFile.getWhereValue();
+                    String replace = whereValue1.replace("?", "'" + costProjectApproval.getProjectId() + "'");
+                    String replaced = replace.replace("&", auditedUnit.getUnitId());
+                    costProjectDocumentFile.setWhereValue(replaced);
+                } else {
                     String whereValue1 = costProjectDocumentFile.getWhereValue();
                     String replace = whereValue1.replace("?", "'" + costProjectApproval.getProjectId() + "'");
                     costProjectDocumentFile.setWhereValue(replace);
@@ -274,7 +288,7 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
         });
 
 
-        if (!costProjectDocument.getDocumentAlias().equals("sdhz")) {
+        if (!costDocumentTemplate.getAlias().equals("sdhz")) {
 
             CostDocumentTemplate templateManagerById = costDocumentTemplateManager.getByAlias("sdhz");
             if (templateManagerById==null) {
@@ -353,7 +367,7 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
                         costProjectDocumentFile.setDataValue("");
                         break;
                 }
-                if (StringUtils.isNotBlank(f.getTableName())){
+                /*if (StringUtils.isNotBlank(f.getTableName())){
                     if(StringUtil.isEmpty(costProjectDocumentFile.getWhereValue())){
                         costProjectDocumentFile.setWhereValue(costProjectApproval.getProjectId());
                     }else {
@@ -364,7 +378,7 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
                     String colValue = costTemplateFileManager.getColValue(costProjectDocumentFile.getTableName(), costProjectDocumentFile.getColName(), costProjectDocumentFile.getWhereName(), costProjectDocumentFile.getWhereValue());
                     //获取whereValue字段值
                     costProjectDocumentFile.setDataValue(colValue);
-                }
+                }*/
                 arrayList.add(costProjectDocumentFile);
             });
             costProjectDocumentFileManager.saveBatch(arrayList);
@@ -373,9 +387,10 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
 
         //保存解析出的文件内容
         costProjectDocumentFileManager.saveBatch(req.getCostProjectDocumentFiles());
-
-        //更新文号值
-        costDocumentWhManager.updateCurrentValue(costDocumentWh.getId());
+        if (costDocumentWh!=null) {
+            //更新文号值
+            costDocumentWhManager.updateCurrentValue(costDocumentWh.getId());
+        }
 
         whMap.remove(whNo);
     }