瀏覽代碼

1.任务归档的时候督办办结

赵越越 1 天之前
父節點
當前提交
f832278e9b
共有 20 個文件被更改,包括 378 次插入166 次删除
  1. 14 1
      assistMg/src/main/java/com/hotent/baseInfo/controller/CostCatalogSurveyController.java
  2. 10 0
      assistMg/src/main/java/com/hotent/baseInfo/dao/CostCatalogSurveyDao.java
  3. 2 4
      assistMg/src/main/java/com/hotent/baseInfo/manager/CostCatalogSurveyManager.java
  4. 29 1
      assistMg/src/main/java/com/hotent/baseInfo/manager/impl/CostCatalogSurveyManagerImpl.java
  5. 8 0
      assistMg/src/main/java/com/hotent/baseInfo/req/CostBaseInfoPageReq.java
  6. 4 2
      assistMg/src/main/java/com/hotent/dataMiddlePlatform/controller/DataMiddlePlatformController.java
  7. 5 0
      assistMg/src/main/java/com/hotent/dataMiddlePlatform/manager/DataMiddlePlatformManager.java
  8. 36 1
      assistMg/src/main/java/com/hotent/dataMiddlePlatform/manager/impl/DataMiddlePlatformManagerImpl.java
  9. 36 6
      assistMg/src/main/java/com/hotent/project/controller/CostProjectApprovalController.java
  10. 1 1
      assistMg/src/main/java/com/hotent/project/manager/impl/CostProjectDocumentManagerImpl.java
  11. 2 1
      assistMg/src/main/java/com/hotent/surveyinfo/dao/CostSurveyTemplateDao.java
  12. 1 1
      assistMg/src/main/java/com/hotent/surveyinfo/manager/impl/CostSurveyTemplateManagerImpl.java
  13. 155 145
      assistMg/src/main/java/com/hotent/util/wordexcelutils/CompleteTemplateProcessor.java
  14. 1 1
      assistMg/src/main/java/com/hotent/util/wordexcelutils/SmartTemplateWriter.java
  15. 43 0
      assistMg/src/main/resources/mapper/CostCatalogSurveyMapper.xml
  16. 4 0
      assistMg/src/main/resources/mapper/CostSurveyTemplateMapper.xml
  17. 2 0
      uc/src/main/java/com/hotent/uc/dao/UserDao.java
  18. 2 0
      uc/src/main/java/com/hotent/uc/manager/UserManager.java
  19. 10 2
      uc/src/main/java/com/hotent/uc/manager/impl/UserManagerImpl.java
  20. 13 0
      uc/src/main/resources/mapper/UserMapper.xml

+ 14 - 1
assistMg/src/main/java/com/hotent/baseInfo/controller/CostCatalogSurveyController.java

@@ -4,12 +4,16 @@ package com.hotent.baseInfo.controller;
 import com.hotent.base.annotation.ApiGroup;
 import com.hotent.base.constants.ApiGroupConsts;
 import com.hotent.base.enums.ResponseErrorEnums;
+import com.hotent.base.query.PageList;
 import com.hotent.baseInfo.req.CostBaseInfoPageReq;
 import com.hotent.baseInfo.resp.CostCatalogInformationPageResp;
 import com.hotent.baseInfo.resp.CostCatalogSurveyPageResp;
 import com.hotent.common.CrudService;
 import com.hotent.req.IdReq;
 import com.hotent.resp.PageResp;
+import com.hotent.surveyinfo.manager.CostSurveyTemplateManager;
+import com.hotent.surveyinfo.model.CostSurveyTemplate;
+import com.hotent.surveyinfo.req.ConstSurveyPageParam;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -37,7 +41,8 @@ import java.util.List;
 @Api(tags = "监审目录-成本调查表")
 public class CostCatalogSurveyController extends BaseController<CostCatalogSurveyManager, CostCatalogSurvey> {
 
-
+	@Autowired
+	CostSurveyTemplateManager constbaseService;
 
 	// 创建通用服务实例
 	private final CrudService crudService = new CrudService();
@@ -66,6 +71,14 @@ public class CostCatalogSurveyController extends BaseController<CostCatalogSurve
 		return crudService.pageQuery(req, baseService::pageList);
 	}
 
+	//分页查询
+	@PostMapping(value="/page")
+	@ApiOperation(value="分页查询",httpMethod = "POST",notes = "分页查询")
+	public PageList<CostSurveyTemplate> page(@RequestBody ConstSurveyPageParam req) throws Exception{
+		return constbaseService.getCostSurveyListPage(req);
+	}
+
+
 	//取消关联文件
 	@PostMapping(value="/cleanByIds")
 	@ApiOperation(value="取消关联成本调查表",httpMethod = "POST",notes = "取消关联成本调查表")

+ 10 - 0
assistMg/src/main/java/com/hotent/baseInfo/dao/CostCatalogSurveyDao.java

@@ -1,7 +1,10 @@
 package com.hotent.baseInfo.dao;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.hotent.baseInfo.model.CostCatalogSurvey;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hotent.baseInfo.resp.CostCatalogSurveyPageResp;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 监审目录-成本调查表 Mapper 接口
@@ -12,4 +15,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface CostCatalogSurveyDao extends BaseMapper<CostCatalogSurvey> {
 
+    Page<CostCatalogSurveyPageResp> getPageList(
+            Page<CostCatalogSurveyPageResp> objectPage,
+            @Param("catalogId") String catalogId,
+            @Param("dataScope")Integer dataScope,
+            @Param("provinceCode")String provinceCode,
+            @Param("cityCode")String cityCode,
+            @Param("countyCode")String countyCode);
 }

+ 2 - 4
assistMg/src/main/java/com/hotent/baseInfo/manager/CostCatalogSurveyManager.java

@@ -1,6 +1,7 @@
 package com.hotent.baseInfo.manager;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.hotent.base.query.PageList;
 import com.hotent.baseInfo.model.CostCatalogSurvey;
 import com.hotent.base.manager.BaseManager;
 import com.hotent.baseInfo.req.CostBaseInfoPageReq;
@@ -33,8 +34,5 @@ public interface CostCatalogSurveyManager extends BaseManager<CostCatalogSurvey>
 
 	void cleanByIds(IdReq ids);
 
-
-
-
-
+	PageList<CostCatalogSurveyPageResp> getPageList(CostBaseInfoPageReq req) throws Exception;
 }

+ 29 - 1
assistMg/src/main/java/com/hotent/baseInfo/manager/impl/CostCatalogSurveyManagerImpl.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.hotent.base.manager.impl.BaseManagerImpl;
+import com.hotent.base.query.PageList;
 import com.hotent.baseInfo.dao.CostCatalogSurveyDao;
 import com.hotent.baseInfo.manager.CostCatalogSurveyManager;
 import com.hotent.baseInfo.model.CostCatalogSurvey;
@@ -13,7 +14,11 @@ import com.hotent.baseInfo.resp.CostCatalogSurveyPageResp;
 import com.hotent.req.IdReq;
 import com.hotent.surveyinfo.manager.CostSurveyTemplateManager;
 import com.hotent.surveyinfo.model.CostSurveyTemplate;
+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;
@@ -32,7 +37,8 @@ import java.util.List;
  */
 @Service
 public class CostCatalogSurveyManagerImpl extends BaseManagerImpl<CostCatalogSurveyDao, CostCatalogSurvey> implements CostCatalogSurveyManager {
-
+    @Autowired
+    private UserManager userService;
 
     @Autowired
     private CostSurveyTemplateManager costSurveyTemplateManager;
@@ -57,6 +63,7 @@ public class CostCatalogSurveyManagerImpl extends BaseManagerImpl<CostCatalogSur
         if (ObjectUtil.isEmpty(req.getCatalogId())) {
             throw new BaseException("目录id不能为空");
         }
+
         LambdaQueryWrapper<CostCatalogSurvey> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(CostCatalogSurvey::getCatalogId, req.getCatalogId());
         queryWrapper.orderByDesc(CostCatalogSurvey::getCreateTime);
@@ -99,4 +106,25 @@ public class CostCatalogSurveyManagerImpl extends BaseManagerImpl<CostCatalogSur
 
     }
 
+    @Override
+    public PageList<CostCatalogSurveyPageResp> getPageList(CostBaseInfoPageReq req) throws Exception {
+        IUser iUser = ContextUtil.getCurrentUser();
+        User user = userService.getByAccount(iUser.getAccount());
+        if(iUser.isAdmin()){
+            req.setDataScope(null);
+        }else{
+            req.setDataScope(user.getDataScope());
+        }
+        req.setProvinceCode(user.getProvinceCode());
+        req.setCityCode(user.getCityCode());
+        req.setCountyCode(user.getCountyCode());
+        Page<CostCatalogSurveyPageResp> objectPage = new Page<>(req.getPageNum(),req.getPageSize());
+        Page<CostCatalogSurveyPageResp> page =baseMapper.getPageList(objectPage,req.getCatalogId()
+                ,req.getDataScope()
+                ,req.getProvinceCode(),req.getCityCode()
+                ,req.getCountyCode());
+        return new PageList<>(page);
+    }
+
+
 }

+ 8 - 0
assistMg/src/main/java/com/hotent/baseInfo/req/CostBaseInfoPageReq.java

@@ -15,4 +15,12 @@ public class CostBaseInfoPageReq extends PageReq {
     @ApiModelProperty(value = "监审目录id",required = true)
     private String catalogId;
 
+    @ApiModelProperty(value = "级别0:省,1:市,2:区(县)")
+    private Integer dataScope;
+    @ApiModelProperty(value = "所属省")
+    private String provinceCode;
+    @ApiModelProperty(value = "所属市")
+    private String cityCode;
+    @ApiModelProperty(value = "所属区、县")
+    private String countyCode;
 }

+ 4 - 2
assistMg/src/main/java/com/hotent/dataMiddlePlatform/controller/DataMiddlePlatformController.java

@@ -54,10 +54,12 @@ public class DataMiddlePlatformController {
     @ApiOperation(value = "中台推送用户数据", notes = "中台推送用户数据")
     public CommonResult<String> base(MiddlePlatformBaseParam param) {
         try {
-            //dataMiddlePlatformManager.sync();
-            return CommonResult.<String>ok().message("同步成功");
+            String msg= dataMiddlePlatformManager.base(param);
+            return CommonResult.<String>ok().message(msg);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }
+
+
 }

+ 5 - 0
assistMg/src/main/java/com/hotent/dataMiddlePlatform/manager/DataMiddlePlatformManager.java

@@ -5,6 +5,7 @@ package com.hotent.dataMiddlePlatform.manager;/**
  * @create: 2025-11-06 11:36
  */
 
+import com.hotent.dataMiddlePlatform.param.MiddlePlatformBaseParam;
 import org.springframework.http.ResponseEntity;
 
 /**
@@ -15,4 +16,8 @@ public interface DataMiddlePlatformManager {
     void sync() throws Exception;
 
     ResponseEntity<?> ssoDataMiddlePlatform(String code) throws Exception;
+
+    String  sendMsg(String subject,String description,String content,String receiverId);
+
+    String base(MiddlePlatformBaseParam param);
 }

+ 36 - 1
assistMg/src/main/java/com/hotent/dataMiddlePlatform/manager/impl/DataMiddlePlatformManagerImpl.java

@@ -8,11 +8,12 @@ import com.hotent.base.conf.SsoConfig;
 import com.hotent.base.feign.UCFeignService;
 import com.hotent.base.jwt.JwtAuthenticationResponse;
 import com.hotent.base.jwt.JwtTokenHandler;
-import com.hotent.base.model.CommonResult;
 import com.hotent.base.service.PwdStrategyService;
 import com.hotent.base.util.*;
 import com.hotent.baseInfo.manager.AuditedUnitManager;
+import com.hotent.common.MyAsyncExecutor;
 import com.hotent.dataMiddlePlatform.manager.DataMiddlePlatformManager;
+import com.hotent.dataMiddlePlatform.param.MiddlePlatformBaseParam;
 import com.hotent.uc.api.model.IUser;
 import com.hotent.uc.manager.OrgManager;
 import com.hotent.uc.manager.RoleManager;
@@ -28,6 +29,7 @@ import com.integration.oauth2.sdk.model.Role;
 import com.integration.oauth2.sdk.model.UserDetail;
 import com.integration.oauth2.sdk.model.UserInfo;
 import com.integration.oauth2.sdk.response.AccessTokenResponse;
+import com.integration.oauth2.sdk.response.CommonResult;
 import oracle.net.ano.AuthenticationService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,6 +52,9 @@ import java.util.stream.Collectors;
 public class DataMiddlePlatformManagerImpl implements DataMiddlePlatformManager {
 
 
+    @Autowired
+    private MyAsyncExecutor myAsyncExecutor;
+
     private static final String baseUrl = "http://10.7.14.236:8280/stage-api/";
     private static final String clientId = "cbjsxt";
     private static final String clientSecret = "cbjsxt";
@@ -109,6 +114,7 @@ public class DataMiddlePlatformManagerImpl implements DataMiddlePlatformManager
                     UserVo userVo = new UserVo();
                     BeanUtils.copyProperties(u,userVo);
                     userVo.setOrgId(u.getDeptId());
+                    userVo.setFrom("ZT");
                     return userVo;
                 }).collect(Collectors.toList());
                 userService.addUsers(userVos);
@@ -200,6 +206,32 @@ public class DataMiddlePlatformManagerImpl implements DataMiddlePlatformManager
         //return null;
     }
 
+    /**
+     * 异步推送消息通知
+     * @param subject 标题
+     * @param description 简介
+     * @param content 内容
+     * @param receiverId 接收人id(中台用户id)
+     * @return
+     */
+    @Override
+    public String sendMsg(String subject, String description, String content, String receiverId) {
+        // 将同步调用改为异步执行
+        myAsyncExecutor.execute(() -> {
+            String openApiToken = OAuth2ToMethod.getOpenApiToken("");
+            CommonResult result = OAuth2ToMethod.sendMsg(openApiToken, subject, description, content, receiverId);
+            System.out.println("消息id: " + result.getValue().toString());
+        });
+
+        // 立即返回,不等待消息发送完成
+        return "消息发送任务已提交";
+    }
+
+    @Override
+    public String base(MiddlePlatformBaseParam param) {
+        return "";
+    }
+
 
     /**
      * 处理单用户登录
@@ -239,4 +271,7 @@ public class DataMiddlePlatformManagerImpl implements DataMiddlePlatformManager
         return result;
     }
 
+
+
+
 }

+ 36 - 6
assistMg/src/main/java/com/hotent/project/controller/CostProjectApprovalController.java

@@ -11,24 +11,22 @@ import com.hotent.project.req.CostProjectApprovalPublishReq;
 import com.hotent.project.resp.CostProjectApprovalDetailResp;
 import com.hotent.project.resp.CostProjectMembersResp;
 import com.hotent.resp.PageResp;
+import com.hotent.uc.api.model.IUser;
 import com.hotent.uc.manager.UserManager;
 import com.hotent.uc.model.User;
+import com.hotent.uc.util.ContextUtil;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.*;
 import com.hotent.base.model.CommonResult;
 import com.hotent.base.util.StringUtil;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import org.springframework.web.bind.annotation.RestController;
 import com.hotent.base.controller.BaseController;
 import com.hotent.project.model.CostProjectApproval;
 import com.hotent.project.manager.CostProjectApprovalManager;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
@@ -73,6 +71,38 @@ public class CostProjectApprovalController extends BaseController<CostProjectApp
 	}*/
 
 
+	@RequestMapping(value="/getUserList",method= RequestMethod.GET)
+	@ApiOperation(value = "获取系统中所有用户", httpMethod = "GET", notes = "获取系统中所有用户")
+	public CommonResult<List<User>> getUserListByRoleCodes() throws Exception{
+		List<String> list1 = Arrays.asList("dbfzr", "jsztry");
+		List<User> userList = userService.getUserListByRoleCodes(list1);
+		IUser iUser = ContextUtil.getCurrentUser();
+		User user = userService.getByAccount(iUser.getAccount());
+		List<User> userArrayList = new ArrayList<>();
+		if (user.getDataScope().equals(0)) {
+			List<User> users = userList.stream().filter(u
+					->StringUtil.isNotEmpty(u.getProvinceCode())
+					&& StringUtil.isNotEmpty(user.getProvinceCode())
+					&& u.getProvinceCode().equals(user.getProvinceCode())).collect(Collectors.toList());
+			userArrayList.addAll(users);
+		} else if (user.getDataScope().equals(1)) {
+			List<User> users = userList.stream().filter(u
+					->StringUtil.isNotEmpty(u.getCityCode())
+					&& StringUtil.isNotEmpty(user.getCityCode())
+					&& u.getCityCode().equals(user.getCityCode())).collect(Collectors.toList());
+			userArrayList.addAll(users);
+		}else if (user.getDataScope().equals(2)) {
+			List<User> users = userList.stream().filter(u
+					->StringUtil.isNotEmpty(u.getCountyCode())
+					&& StringUtil.isNotEmpty(user.getCountyCode())
+					&& u.getCountyCode().equals(user.getCountyCode())).collect(Collectors.toList());
+			userArrayList.addAll(users);
+		}else {
+			userArrayList.addAll(userList);
+		}
+		return CommonResult.<List<User>>ok().value(userArrayList);
+	}
+
 	@PostMapping(value="/pageList")
 	@ApiOperation(value="分页查询pageList",httpMethod = "POST",notes = "分页查询pageList")
 	public PageList<CostProjectApproval> pageList(@RequestBody CostProjectApprovalPageReq req) throws Exception {

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

@@ -620,7 +620,7 @@ public class CostProjectDocumentManagerImpl extends BaseManagerImpl<CostProjectD
                         }).collect(Collectors.toList());
                         AuditedUnit auditedUnit = auditedUnitManager.get(costProjectDocument.getEnterpriseId());
 
-                        CompleteTemplateProcessor.processTemplateComplete(document,auditedUnit.getUnitName(),mapList,DateUtils.format(new Date(),ISO8601_DATE_PATTERN));
+                        CompleteTemplateProcessor.processTemplateComplete(document,auditedUnit.getUnitName(),mapList,DateUtils.format(new Date(),"yyyy年MM月dd日"));
                     }
                 } else if (costProjectDocument.getDocumentType().equals("3")) {
                     CostProjectApproval costProjectApproval = costProjectApprovalManager.get(costProjectDocument.getProjectId());

+ 2 - 1
assistMg/src/main/java/com/hotent/surveyinfo/dao/CostSurveyTemplateDao.java

@@ -30,5 +30,6 @@ public interface CostSurveyTemplateDao extends BaseMapper<CostSurveyTemplate> {
             , @Param("cityCode") String cityCode
             , @Param("countyCode") String countyCode
             , @Param("keyword") String keyword
-            , @Param("status") Integer status);
+            , @Param("status") Integer status
+            , @Param("catalogId") String catalogId);
 }

+ 1 - 1
assistMg/src/main/java/com/hotent/surveyinfo/manager/impl/CostSurveyTemplateManagerImpl.java

@@ -171,7 +171,7 @@ public class CostSurveyTemplateManagerImpl extends BaseManagerImpl<CostSurveyTem
 		Page<CostSurveyTemplate> page =baseMapper.getCostSurveyTemplatePage1(objectPage,params.getContentType()
 				,params.getType(),params.getDataScope()
 				,params.getProvinceCode(),params.getCityCode()
-				,params.getCountyCode(),params.getKeyword(),params.getStatus());
+				,params.getCountyCode(),params.getKeyword(),params.getStatus(),params.getCatalogId());
 		return new PageList<>(page);
 	}
 

+ 155 - 145
assistMg/src/main/java/com/hotent/util/wordexcelutils/CompleteTemplateProcessor.java

@@ -1,20 +1,19 @@
-package com.hotent.util.wordexcelutils;/**
- * @program: cbjs-mvue-master
- * @description:
- * @author: zhao yue yue
- * @create: 2025-11-27 15:34
- */
+package com.hotent.util.wordexcelutils;
 
 import com.hotent.base.util.StringUtil;
 import lombok.Data;
 import lombok.Getter;
 import org.apache.poi.xwpf.usermodel.*;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
+
+import java.math.BigInteger;
 import java.util.*;
-import java.io.*;
 
 /**
- *@author: zhao yue yue
- *@create: 2025-11-27 15:34
+ * 完整处理模板:替换占位符 + 填充表格数据,支持内容自适应高度
+ *
+ * @author: zhao yue yue
+ * @create: 2025-11-27 15:34
  */
 public class CompleteTemplateProcessor {
 
@@ -37,18 +36,14 @@ public class CompleteTemplateProcessor {
         System.out.println("生成日期: " + generateDate);
 
         // 2. 替换文档中的占位符
-        //replaceDocumentPlaceholders(document, organizationName, totalDocuments, totalPages, generateDate);
-        // 替换映射
         Map<String, String> replacements = new HashMap<>();
         replacements.put("{价格主管部门或成本监审机构}", organizationName);
         replacements.put("{材料件数}", String.valueOf(totalDocuments));
         replacements.put("{材料页数}", String.valueOf(totalPages));
         replacements.put("{登记表生成日期}", generateDate);
-        replacements.put("{序号}", "1");
-        replacements.put("{资料名称}", rowDataList.get(0).getDocumentName());
-        replacements.put("{页数}", String.valueOf(rowDataList.get(0).getPageCount()));
-        replacements.put("{备注}", rowDataList.get(0).getRemark());
-        SmartTemplateWriter.writeToTemplate(document,replacements);
+
+        // 注意:这里不替换表格内的占位符,因为表格数据会在processTableData中单独处理
+        SmartTemplateWriter.writeToTemplate(document, replacements);
 
         // 3. 处理表格数据
         processTableData(document, rowDataList);
@@ -64,33 +59,6 @@ public class CompleteTemplateProcessor {
     }
 
     /**
-     * 替换文档中的占位符
-     */
-    private static void replaceDocumentPlaceholders(XWPFDocument document,
-                                                    String organizationName,
-                                                    int totalDocuments,
-                                                    int totalPages,
-                                                    String generateDate) {
-
-        // 替换映射
-        Map<String, String> replacements = new HashMap<>();
-        replacements.put("{价格主管部门或成本监审机构}", organizationName);
-        replacements.put("{材料件数}", String.valueOf(totalDocuments));
-        replacements.put("{材料页数}", String.valueOf(totalPages));
-        replacements.put("{登记表生成日期}", generateDate);
-
-        // 在文档中查找并替换
-        for (Map.Entry<String, String> entry : replacements.entrySet()) {
-            boolean found = replaceTextInDocument(document, entry.getKey(), entry.getValue());
-            if (!found) {
-                System.out.println("警告: 未找到占位符 " + entry.getKey());
-            } else {
-                System.out.println("成功替换: " + entry.getKey() + " → " + entry.getValue());
-            }
-        }
-    }
-
-    /**
      * 处理表格数据
      */
     private static void processTableData(XWPFDocument document, List<TableRowData> rowDataList) {
@@ -101,19 +69,20 @@ public class CompleteTemplateProcessor {
         }
 
         XWPFTable table = tables.get(0);
-        System.out.println("找到表格,行数: " + table.getRows().size());
+        System.out.println("找到表格,原始行数: " + table.getRows().size());
 
         // 找到模板行(包含占位符的行)
-        //int templateRowIndex = findTemplateRow(table);
-       /* if (templateRowIndex == -1) {
+        int templateRowIndex = findTemplateRow(table);
+        if (templateRowIndex == -1) {
             System.err.println("错误: 未找到包含占位符的模板行");
             return;
-        }*/
+        }
 
-        System.out.println("模板行索引: " + 1);
+        System.out.println("模板行索引: " + templateRowIndex);
+        System.out.println("需要处理的数据行数: " + rowDataList.size());
 
         // 处理表格数据
-        processTableRows(table, 1, rowDataList);
+        processTableRows(table, templateRowIndex, rowDataList);
     }
 
     /**
@@ -152,25 +121,60 @@ public class CompleteTemplateProcessor {
     private static void processTableRows(XWPFTable table, int templateRowIndex, List<TableRowData> rowDataList) {
         XWPFTableRow templateRow = table.getRows().get(templateRowIndex);
 
-        // 1. 首先替换模板行(第一行数据)
-       /* if (rowDataList.size() > 0) {
-            replaceTemplateRow(templateRow, rowDataList.get(0), 1);
-            System.out.println("替换模板行完成");
-        }*/
+        System.out.println("开始处理表格行,模板行索引: " + templateRowIndex);
+        System.out.println("数据列表大小: " + rowDataList.size());
 
-        // 2. 添加额外的数据行
-        for (int i = 1; i < rowDataList.size(); i++) {
-            addDataRow(table, templateRow, rowDataList.get(i), i + 1, templateRowIndex + i);
-            System.out.println("添加数据行: " + (i + 1));
+        // 1. 先清理模板行之后的所有行(保留汇总行)
+        int summaryRowIndex = findSummaryRow(table);
+        if (summaryRowIndex == -1) {
+            System.err.println("警告: 未找到汇总行");
+            summaryRowIndex = table.getRows().size();
         }
 
-        // 3. 清理多余的空行(保留汇总行)
-        cleanupEmptyRows(table, templateRowIndex + rowDataList.size());
+        System.out.println("汇总行索引: " + summaryRowIndex);
+
+        // 从汇总行的前一行开始删除,直到模板行之后
+        for (int i = summaryRowIndex - 1; i > templateRowIndex; i--) {
+            if (i < table.getRows().size()) {
+                table.removeRow(i);
+                System.out.println("删除行: " + i);
+            }
+        }
+
+        // 2. 如果数据列表不为空,首先处理第一条数据
+        if (!rowDataList.isEmpty()) {
+            System.out.println("处理第一条数据: " + rowDataList.get(0).getDocumentName());
+            replaceTemplateRow(templateRow, rowDataList.get(0), 1);
+
+            // 3. 添加额外的数据行(从第二条数据开始)
+            for (int i = 1; i < rowDataList.size(); i++) {
+                System.out.println("添加数据行 " + (i+1) + ": " + rowDataList.get(i).getDocumentName());
+                addDataRow(table, templateRow, rowDataList.get(i), i + 1, templateRowIndex + i);
+            }
+        } else {
+            // 如果没有数据,清理模板行
+            clearTemplateRow(templateRow);
+        }
 
         System.out.println("表格处理完成,最终行数: " + table.getRows().size());
     }
 
     /**
+     * 清理模板行(当没有数据时)
+     */
+    private static void clearTemplateRow(XWPFTableRow row) {
+        List<XWPFTableCell> cells = row.getTableCells();
+        if (cells.size() < 4) {
+            return;
+        }
+
+        setCellTextWithAutoHeight(cells.get(0), "", false);
+        setCellTextWithAutoHeight(cells.get(1), "", false);
+        setCellTextWithAutoHeight(cells.get(2), "", false);
+        setCellTextWithAutoHeight(cells.get(3), "", true);
+    }
+
+    /**
      * 替换模板行
      */
     private static void replaceTemplateRow(XWPFTableRow row, TableRowData data, int sequence) {
@@ -180,50 +184,51 @@ public class CompleteTemplateProcessor {
             return;
         }
 
-        // 替换占位符
-        //replaceInCell(cells.get(0), "[{序号}]", String.valueOf(sequence));
-       // replaceInCell(cells.get(1), "[{资料名称}]", data.getDocumentName());
-       // replaceInCell(cells.get(2), "[{页数}]", data.getPageCount() > 0 ? String.valueOf(data.getPageCount()) : "");
-       // replaceInCell(cells.get(3), "[{备注}]", data.getRemark() != null ? data.getRemark() : "");
+        System.out.println("替换模板行,序号: " + sequence + ", 资料名称: " + data.getDocumentName());
+
+        // 设置单元格内容,支持自适应高度
+        setCellTextWithAutoHeight(cells.get(0), String.valueOf(sequence), false);
+        setCellTextWithAutoHeight(cells.get(1), data.getDocumentName(), false);
+        setCellTextWithAutoHeight(cells.get(2), data.getPageCount() > 0 ? String.valueOf(data.getPageCount()) : "", false);
+
+        // 特别注意:备注内容要完整显示
+        String remark = data.getRemark() != null ? data.getRemark() : "";
+        System.out.println("备注内容长度: " + remark.length());
+        setCellTextWithAutoHeight(cells.get(3), remark, true);
+
+        // 设置行高自适应
+        setRowAutoHeight(row);
     }
 
     /**
      * 添加数据行
      */
     private static void addDataRow(XWPFTable table, XWPFTableRow templateRow, TableRowData data, int sequence, int insertIndex) {
+        System.out.println("添加新行到索引: " + insertIndex + ", 序列号: " + sequence);
+
         // 创建新行
         XWPFTableRow newRow = table.insertNewTableRow(insertIndex);
 
         // 复制模板行的单元格结构
         for (int i = 0; i < templateRow.getTableCells().size(); i++) {
             XWPFTableCell newCell = newRow.addNewTableCell();
-            // 复制单元格样式(简化)
+            // 复制单元格样式
             copyCellStyle(templateRow.getTableCells().get(i), newCell);
         }
 
-        // 填充数据
+        // 填充数据,备注列支持自适应高度
         List<XWPFTableCell> cells = newRow.getTableCells();
-        setCellText(cells.get(0), String.valueOf(sequence));
-        setCellText(cells.get(1), data.getDocumentName());
-        setCellText(cells.get(2), data.getPageCount() > 0 ? String.valueOf(data.getPageCount()) : "");
-        setCellText(cells.get(3), data.getRemark() != null ? data.getRemark() : "");
-    }
+        setCellTextWithAutoHeight(cells.get(0), String.valueOf(sequence), false);
+        setCellTextWithAutoHeight(cells.get(1), data.getDocumentName(), false);
+        setCellTextWithAutoHeight(cells.get(2), data.getPageCount() > 0 ? String.valueOf(data.getPageCount()) : "", false);
 
-    /**
-     * 清理多余的空行
-     */
-    private static void cleanupEmptyRows(XWPFTable table, int startIndex) {
-        // 找到汇总行
-        int summaryRowIndex = findSummaryRow(table);
-        if (summaryRowIndex == -1) return;
+        // 特别注意:备注内容要完整显示
+        String remark = data.getRemark() != null ? data.getRemark() : "";
+        System.out.println("添加行的备注内容长度: " + remark.length());
+        setCellTextWithAutoHeight(cells.get(3), remark, true);
 
-        // 清理汇总行之前的空行
-        for (int i = summaryRowIndex - 1; i >= startIndex; i--) {
-            if (i < table.getRows().size() && isRowEmpty(table.getRows().get(i))) {
-                table.removeRow(i);
-                System.out.println("清理空行: " + i);
-            }
-        }
+        // 设置行高自适应
+        setRowAutoHeight(newRow);
     }
 
     /**
@@ -240,90 +245,92 @@ public class CompleteTemplateProcessor {
         return -1;
     }
 
-    // ========== 工具方法 ==========
-
     /**
-     * 替换文档中的文本
+     * 设置单元格文本,支持自适应高度
+     * @param cell 单元格
+     * @param text 文本内容
+     * @param isRemarksColumn 是否为备注列(需要特殊处理)
      */
-    private static boolean replaceTextInDocument(XWPFDocument document, String findText, String replaceText) {
-        boolean found = false;
+    private static void setCellTextWithAutoHeight(XWPFTableCell cell, String text, boolean isRemarksColumn) {
+        // 清除现有内容
+        for (int i = cell.getParagraphs().size() - 1; i >= 0; i--) {
+            cell.removeParagraph(i);
+        }
+
+        // 添加新内容
+        XWPFParagraph paragraph = cell.addParagraph();
 
-        // 在段落中查找
-        for (XWPFParagraph paragraph : document.getParagraphs()) {
-            if (replaceInParagraph(paragraph, findText, replaceText)) {
-                found = true;
+        // 对于备注列,设置左对齐,允许自动换行
+        if (isRemarksColumn) {
+            paragraph.setAlignment(ParagraphAlignment.LEFT);
+            // 设置单元格垂直顶部对齐
+            CTTc ctTc = cell.getCTTc();
+            if (ctTc.getTcPr() == null) {
+                ctTc.addNewTcPr();
             }
-        }
+            ctTc.getTcPr().addNewVAlign().setVal(org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalJc.TOP);
 
-        // 在表格中查找
-        for (XWPFTable table : document.getTables()) {
-            for (XWPFTableRow row : table.getRows()) {
-                for (XWPFTableCell cell : row.getTableCells()) {
-                    for (XWPFParagraph paragraph : cell.getParagraphs()) {
-                        if (replaceInParagraph(paragraph, findText, replaceText)) {
-                            found = true;
-                        }
-                    }
-                }
+            // 设置单元格宽度,确保备注列足够宽
+            if (ctTc.getTcPr().getTcW() == null) {
+                ctTc.getTcPr().addNewTcW().setW(BigInteger.valueOf(5000)); // 设置足够宽度
             }
+        } else {
+            paragraph.setAlignment(ParagraphAlignment.CENTER);
         }
 
-        return found;
-    }
+        XWPFRun run = paragraph.createRun();
+        run.setText(text);
 
-    private static boolean replaceInParagraph(XWPFParagraph paragraph, String findText, String replaceText) {
-        boolean found = false;
-        for (XWPFRun run : paragraph.getRuns()) {
-            String text = run.getText(0);
-            if (text != null && text.contains(findText)) {
-                run.setText(text.replace(findText, replaceText), 0);
-                found = true;
+        // 设置字体
+        run.setFontFamily("宋体");
+        run.setFontSize(10); // 使用较小的字体确保内容完整显示
+
+        // 重要:确保换行符被正确处理
+        if (text != null && text.contains("\n")) {
+            String[] lines = text.split("\n");
+            run.setText(lines[0], 0);
+            for (int i = 1; i < lines.length; i++) {
+                run.addBreak(); // 添加换行
+                run.setText(lines[i]);
             }
         }
-        return found;
     }
 
     /**
-     * 替换单元格中的文本
+     * 设置行高自适应
      */
-    private static void replaceInCell(XWPFTableCell cell, String findText, String replaceText) {
-        for (XWPFParagraph paragraph : cell.getParagraphs()) {
-            for (XWPFRun run : paragraph.getRuns()) {
-                String text = run.getText(0);
-                if (text != null && text.contains(findText)) {
-                    run.setText(text.replace(findText, replaceText), 0);
-                }
+    private static void setRowAutoHeight(XWPFTableRow row) {
+        try {
+            // 移除固定行高设置,允许自动调整
+            if (row.getCtRow().getTrPr() != null) {
+                row.getCtRow().getTrPr().getTrHeightList().forEach(trHeight -> {
+                    trHeight.setHRule(org.openxmlformats.schemas.wordprocessingml.x2006.main.STHeightRule.AUTO);
+                });
             }
+        } catch (Exception e) {
+            System.err.println("设置行高自适应时出错: " + e.getMessage());
         }
     }
 
     /**
-     * 设置单元格文本
-     */
-    private static void setCellText(XWPFTableCell cell, String text) {
-        // 清除现有内容
-        for (int i = cell.getParagraphs().size() - 1; i >= 0; i--) {
-            cell.removeParagraph(i);
-        }
-
-        // 添加新内容
-        XWPFParagraph paragraph = cell.addParagraph();
-        XWPFRun run = paragraph.createRun();
-        run.setText(text);
-        paragraph.setAlignment(ParagraphAlignment.CENTER);
-    }
-
-    /**
      * 复制单元格样式
      */
     private static void copyCellStyle(XWPFTableCell source, XWPFTableCell target) {
         try {
+            // 复制背景色
             target.setColor(source.getColor());
-            if (StringUtil.isNotEmpty(String.valueOf(source.getWidth()) )) {
-                target.setWidth(String.valueOf(source.getWidth()));
+            String width =String.valueOf(source.getWidth());
+            if (StringUtil.isNotEmpty(width)) {
+                target.setWidth(width);
+            } else {
+                // 如果源单元格没有宽度,为备注列设置更宽
+                String cellText = getCellText(source);
+                if (cellText != null && cellText.contains("{备注}")) {
+                    target.setWidth("5000"); // 备注列更宽
+                }
             }
         } catch (Exception e) {
-            // 忽略样式复制错误
+            System.err.println("复制单元格样式时出错: " + e.getMessage());
         }
     }
 
@@ -377,11 +384,14 @@ public class CompleteTemplateProcessor {
         private int pageCount;
         private String remark;
 
-        public TableRowData() {
+        public TableRowData(String documentName, int pageCount, String remark) {
             this.documentName = documentName;
             this.pageCount = pageCount;
             this.remark = remark;
         }
 
+        public TableRowData() {
+            // 默认构造函数
+        }
     }
-}
+}

+ 1 - 1
assistMg/src/main/java/com/hotent/util/wordexcelutils/SmartTemplateWriter.java

@@ -120,7 +120,7 @@ public class SmartTemplateWriter {
                 // 恢复格式
                 restoreRunStyle(run, originalStyle);
 
-                System.out.println("成功在单个Run中替换: " + placeholder);
+                System.out.println("成功在单个Run中替换: " + placeholder+",value:"+value);
             }
         } catch (Exception e) {
             System.err.println("单个Run替换失败: " + e.getMessage());

+ 43 - 0
assistMg/src/main/resources/mapper/CostCatalogSurveyMapper.xml

@@ -12,6 +12,18 @@
     <result column="year" property="year" />
     </resultMap>
 
+
+	<!-- 通用查询映射结果 -->
+	<resultMap id="ResultMap" type="com.hotent.baseInfo.resp.CostCatalogSurveyPageResp">
+
+		<result column="survey_id" property="surveyId" />
+		<result column="create_time" property="createTime" />
+		<result column="year" property="year" />
+		<result column="status" property="status" />
+		<result column="template_type" property="templateType" />
+		<result column="survey_template_name" property="surveyTemplateName" />
+	</resultMap>
+
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id, catalog_id, survey_id, create_time, create_by, year
@@ -41,4 +53,35 @@
 		where 
 		    id = ${id}
 	</select>
+
+
+	<select id="getPageList"
+			resultMap="ResultMap">
+		SELECT
+		s.*,
+		c.status,
+		c.template_type,
+		c.survey_template_name
+		FROM
+		cost_catalog_survey s
+		LEFT JOIN cost_survey_template c ON s.survey_id = c.survey_template_id
+		<where>
+
+			<if test=" catalogId != null and  catalogId != ''">
+				and s.catalog_id=#{catalogId}
+			</if>
+			<if test="dataScope != null and dataScope >= 0">
+				<if test=" dataScope ==0">
+					and c.area_code= #{provinceCode}
+				</if>
+				<if test=" dataScope ==1">
+					and c.area_code=#{cityCode}
+				</if>
+				<if test=" dataScope ==2">
+					and c.area_code= #{countyCode}
+				</if>
+			</if>
+		</where>
+		ORDER BY s.create_time DESC
+	</select>
 </mapper>

+ 4 - 0
assistMg/src/main/resources/mapper/CostSurveyTemplateMapper.xml

@@ -109,6 +109,10 @@
 				and c.type=#{ type}
 			</if>
 
+			<if test=" catalogId != null and  catalogId != ''">
+				and c.catalog_id=#{ catalogId}
+			</if>
+
 			<if test=" keyword != null and  keyword != ''">
 				and c.survey_template_name LIKE CONCAT('%', #{ keyword}, '%')
 			</if>

+ 2 - 0
uc/src/main/java/com/hotent/uc/dao/UserDao.java

@@ -406,4 +406,6 @@ public interface UserDao extends BaseMapper<User>{
 	 * @return
 	 */
 	String getAccountByUserId(@Param("userId") String userId);
+
+	List<User> getUserListByRoleCodes(@Param("roleCodes") List<String> list);
 }

+ 2 - 0
uc/src/main/java/com/hotent/uc/manager/UserManager.java

@@ -839,4 +839,6 @@ public interface UserManager extends BaseManager<User>{
 	CommonResult<?> deleteUser(UserVo user,String demId);
 
     List<User> getUserList();
+
+	List<User> getUserListByRoleCodes(List<String> list1);
 }

+ 10 - 2
uc/src/main/java/com/hotent/uc/manager/impl/UserManagerImpl.java

@@ -363,9 +363,11 @@ public class UserManagerImpl extends BaseManagerImpl <UserDao, User> implements
 					User newUser = null;
 					newUser = UserVo.parser(user);
 					newUser.setStatus(User.STATUS_NORMAL);
-					newUser.setId(UniqueIdUtil.getSuid());
+					//newUser.setId(UniqueIdUtil.getSuid());
+					newUser.setId(user.getId());
+
 					newUser.setCreateTime(LocalDateTime.now());
-					newUser.setFrom(User.FROM_RESTFUL);
+					newUser.setFrom(user.getFrom());
 					String password = user.getPassword();
 					if (StringUtil.isEmpty(user.getPassword())) {
 						password = pwdStrategyManager.getDefault().getInitPwd();
@@ -4024,6 +4026,12 @@ public class UserManagerImpl extends BaseManagerImpl <UserDao, User> implements
 		return this.list(wrapper);
 	}
 
+	@Override
+	public List<User> getUserListByRoleCodes(List<String> list) {
+
+		return baseMapper.getUserListByRoleCodes(list);
+	}
+
 
 	private boolean isUserNotInList(List<UserVo> list, UserVo user){
 		for (UserVo userVo : list) {

+ 13 - 0
uc/src/main/resources/mapper/UserMapper.xml

@@ -124,6 +124,19 @@
 		</if>
 	</select>
 
+
+	<select id="getUserListByRoleCodes" parameterType="java.lang.String" resultMap="BaseResultMap">
+		SELECT u.*,r.CODE_ from uc_user u inner JOIN uc_user_role ur on u.ID_=ur.USER_ID_
+		inner join UC_ROLE r on ur.ROLE_ID_=r.ID_
+		WHERE u.IS_DELE_!='1' AND ur.IS_DELE_!='1' AND r.IS_DELE_!='1' AND u.STATUS_ =1
+		<if test="roleCodes!=null">
+			and r.CODE_ in
+			<foreach collection="roleCodes" index="index" item="item" open="(" separator="," close=")">
+				#{item}
+			</foreach>
+		</if>
+	</select>
+
 	<select id="getUserListByRoleCodeMap" parameterType="java.util.Map" resultMap="BaseResultMap">
 		SELECT u.*,r.CODE_ from uc_user u
 		inner JOIN uc_user_role ur on u.ID_=ur.USER_ID_