huangjn 2 ani în urmă
părinte
comite
e10bcddceb

+ 34 - 4
blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java

@@ -21,6 +21,7 @@ import org.springblade.business.feign.OperationLogClient;
 import org.springblade.business.feign.TaskClient;
 import org.springblade.business.service.IContractLogWbsService;
 import org.springblade.business.utils.FileUtils;
+import org.springblade.business.utils.YearTreeUtils;
 import org.springblade.business.vo.*;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.SnowFlakeUtil;
@@ -41,10 +42,7 @@ import org.springframework.web.bind.annotation.*;
 import org.springblade.business.service.IContractLogService;
 import org.springblade.core.boot.ctrl.BladeController;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -77,6 +75,38 @@ public class ContractLogController extends BladeController {
 
 	private final ProjectClient projectClient;
 
+	/**
+	 * 获取填报记录
+	 */
+	@GetMapping("/queryLogList")
+	@ApiOperationSupport(order = 19)
+	@ApiOperation(value = "获取填报记录")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "contractId", value = "合同段ID"),
+			@ApiImplicitParam(name = "nodePrimaryKeyId", value = "左侧填报日志节点primaryKeyId"),
+			@ApiImplicitParam(name = "time", value = "所选的时间,格式为yyyy-MM-dd")
+	})
+	public R<List<ContractLog>> queryLogByContractIdAndNodePrimaryKeyId(@RequestParam String contractId, @RequestParam String nodePrimaryKeyId, @RequestParam String time){
+		return R.data(this.contractLogService.list(Wrappers.<ContractLog>lambdaQuery().eq(ContractLog::getContractId, contractId).eq(ContractLog::getWbsNodeId, nodePrimaryKeyId).like(ContractLog::getRecordTime, time)));
+	}
+
+	/**
+	 * 获取当前合同段下本日志节点的填报资料日期树
+	 */
+	@GetMapping("/queryReportLogTimeTree")
+	@ApiOperationSupport(order = 18)
+	@ApiOperation(value = "获取当前合同段下本日志节点的填报资料日期树")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "contractId", value = "合同段ID"),
+			@ApiImplicitParam(name = "nodePrimaryKeyId", value = "左侧填报的日志节点primaryKeyId")
+	})
+	public R<List<TreeVo>> queryReportLogTimeTree(@RequestParam String contractId, @RequestParam String nodePrimaryKeyId){
+		//获取填报时间
+		List<String> recordTimeList = this.contractLogService.queryReportLogTimeTree(contractId, nodePrimaryKeyId);
+		//转成结构树
+		return R.data(YearTreeUtils.yearMonthDayTree(recordTimeList));
+	}
+
 	/**
 	 * 删除日志
 	 */

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogMapper.java

@@ -31,6 +31,8 @@ import java.util.List;
  */
 public interface ContractLogMapper extends BaseMapper<ContractLog> {
 
+	List<String> queryReportLogTimeTree(@Param("contractId") String contractId, @Param("nodePrimaryKeyId") String nodePrimaryKeyId);
+
 	List<String> getSubmitLogDateList(@Param("contractId") String contractId, @Param("primaryKeyId") String primaryKeyId, @Param("year") String year);
 
 	List<ContractLog> queryFillUser(@Param("vo") ContractLogVO vo);

+ 4 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ContractLogMapper.xml

@@ -57,6 +57,10 @@
         <result column="operation" property="operation"/>
     </resultMap>
 
+    <select id="queryReportLogTimeTree" resultType="java.lang.String">
+      select record_time from u_contract_log where contract_id = #{contractId} and wbs_node_id = #{nodePrimaryKeyId} and is_deleted = 0 group by record_time order by record_time DESC
+    </select>
+
     <select id="getSubmitLogDateList" resultType="java.lang.String">
         select record_time from u_contract_log where is_deleted = 0 and wbs_node_id = #{primaryKeyId} and contract_id = #{contractId} and record_time like concat('%',#{year},'%') group by record_time order by record_time DESC
     </select>

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/IContractLogService.java

@@ -32,6 +32,8 @@ import java.util.List;
  */
 public interface IContractLogService extends BaseService<ContractLog> {
 
+	List<String> queryReportLogTimeTree(String contractId, String nodePrimaryKeyId);
+
 	List<FileUserVO> queryFillUser(ContractLogVO logVO);
 
 	List<String> getSubmitLogDateList(String contractId, String primaryKeyId, String year);

+ 5 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ContractLogServiceImpl.java

@@ -43,6 +43,11 @@ import java.util.List;
 @Service
 public class ContractLogServiceImpl extends BaseServiceImpl<ContractLogMapper, ContractLog> implements IContractLogService {
 
+	@Override
+	public List<String> queryReportLogTimeTree(String contractId, String nodePrimaryKeyId) {
+		return this.baseMapper.queryReportLogTimeTree(contractId, nodePrimaryKeyId);
+	}
+
 	@Override
 	public List<String> getSubmitLogDateList(String contractId, String primaryKeyId, String year) {
 		return this.baseMapper.getSubmitLogDateList(contractId, primaryKeyId, year);

+ 6 - 60
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ImageClassificationFileServiceImpl.java

@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.alibaba.nacos.common.utils.DateFormatUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springblade.business.entity.ImageClassificationFile;
+import org.springblade.business.utils.YearTreeUtils;
 import org.springblade.business.vo.ImageClassificationFileVO;
 import org.springblade.business.mapper.ImageClassificationFileMapper;
 import org.springblade.business.service.IImageClassificationFileService;
@@ -55,66 +56,11 @@ public class ImageClassificationFileServiceImpl extends BaseServiceImpl<ImageCla
 	public List<TreeVo> getYearDateTree(String classifyId, String projectId, String contractId) {
 		//获取时间
 		List<Date> shootingTimes = this.baseMapper.selectShootingTimeByClassifyAndProjectId(classifyId, projectId, contractId);
-
-		//最终集合
-		List<TreeVo> result = new ArrayList<>();
-		//年
-		Map<String,List<String>> yearMap = new HashMap<>();
-		for(Date date : shootingTimes){
-			//转换为字符串后拆分获取年月日
-			String dateStr = DateFormatUtils.format(date, "yyyy-MM-dd");
-			String[] dateArray = dateStr.split("-");
-			List<String> monthList;
-			if(yearMap.containsKey(dateArray[0] + "年")){
-				//存在,获取集合
-				monthList = yearMap.get(dateArray[0] + "年");
-			} else {
-				//不存在,创建
-				monthList = new ArrayList<>();
-			}
-			monthList.add(dateArray[1] + "-" + dateArray[2]);
-			yearMap.put(dateArray[0] + "年", monthList);
-		}
-
-		//循环年
-		for(Map.Entry<String,List<String>> yearMaps : yearMap.entrySet()){
-			String year = yearMaps.getKey().replace("年", "");
-			List<String> monthList = yearMaps.getValue();
-
-			//月集合
-			List<TreeVo> monthResult = new ArrayList<>();
-
-			//月
-			TreeVo monthMap = new TreeVo();
-
-			//循环月份
-			String month = monthList.get(0).split("-")[0];
-			int index = 0;
-			for(String monthDay : monthList){
-				//拆分
-				String[] monthDays = monthDay.split("-");
-
-				if(!month.equals(monthDays[0])){
-					month = monthDays[0];
-					monthResult.add(monthMap);
-					monthMap = new TreeVo();
-				}
-				monthMap.setName(month + "月");
-				monthMap.setHierarchy(year + "-" + month);
-				monthMap.getTreeList().add(new TreeVo(monthDays[1] + "日", new ArrayList<>(), year + "-" + month + "-" + monthDays[1]));
-				index ++;
-				if(index == monthList.size()){
-					monthResult.add(monthMap);
-				}
-			}
-			//年
-			TreeVo yearResult = new TreeVo(year, monthResult, year);
-			result.add(yearResult);
-		}
-		//时间倒序
-		result.sort(Comparator.comparing(TreeVo::getName).reversed());
-
-		return result;
+		//转换时间
+		List<String> yearMonthDayList = new ArrayList<>();
+		shootingTimes.forEach(date -> yearMonthDayList.add(DateFormatUtils.format(date, "yyyy-MM-dd")));
+		//转成结构树
+		return YearTreeUtils.yearMonthDayTree(yearMonthDayList);
 	}
 
 	@Override

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -465,7 +465,7 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 							this.integrationMethod(vor, linkTasks);
 						}
 						//设置上报批次
-						vor.setReportNumber(String.valueOf(tasks.get(0).getBatch()));
+//						vor.setReportNumber(String.valueOf(tasks.get(0).getBatch()));
 					}
 				}
 			});

+ 76 - 0
blade-service/blade-business/src/main/java/org/springblade/business/utils/YearTreeUtils.java

@@ -0,0 +1,76 @@
+package org.springblade.business.utils;
+
+import org.springblade.business.vo.TreeVo;
+
+import java.util.*;
+
+public class YearTreeUtils {
+
+    public static List<TreeVo> yearMonthDayTree(List<String> yearMonthDayList){
+
+        //最终集合
+        List<TreeVo> result = new ArrayList<>();
+        if(yearMonthDayList == null || yearMonthDayList.size() <= 0){
+            return result;
+        }
+
+        //年
+        Map<String,List<String>> yearMap = new HashMap<>();
+        for(String dateStr : yearMonthDayList){
+            //拆分获取年月日
+            String[] dateArray = dateStr.split("-");
+
+            List<String> monthList;
+            if(yearMap.containsKey(dateArray[0] + "年")){
+                //存在,获取集合
+                monthList = yearMap.get(dateArray[0] + "年");
+            } else {
+                //不存在,创建
+                monthList = new ArrayList<>();
+            }
+            monthList.add(dateArray[1] + "-" + dateArray[2]);
+            yearMap.put(dateArray[0] + "年", monthList);
+        }
+
+        //循环年
+        for(Map.Entry<String,List<String>> yearMaps : yearMap.entrySet()){
+            String year = yearMaps.getKey().replace("年", "");
+            List<String> monthList = yearMaps.getValue();
+
+            //月集合
+            List<TreeVo> monthResult = new ArrayList<>();
+
+            //月
+            TreeVo monthMap = new TreeVo();
+
+            //循环月份
+            String month = monthList.get(0).split("-")[0];
+            int index = 0;
+            for(String monthDay : monthList){
+                //拆分
+                String[] monthDays = monthDay.split("-");
+
+                if(!month.equals(monthDays[0])){
+                    month = monthDays[0];
+                    monthResult.add(monthMap);
+                    monthMap = new TreeVo();
+                }
+                monthMap.setName(month + "月");
+                monthMap.setHierarchy(year + "-" + month);
+                monthMap.getTreeList().add(new TreeVo(monthDays[1] + "日", new ArrayList<>(), year + "-" + month + "-" + monthDays[1]));
+                index ++;
+                if(index == monthList.size()){
+                    monthResult.add(monthMap);
+                }
+            }
+            //年
+            TreeVo yearResult = new TreeVo(year, monthResult, year);
+            result.add(yearResult);
+        }
+        //时间倒序
+        result.sort(Comparator.comparing(TreeVo::getName).reversed());
+
+        return result;
+    }
+
+}

+ 6 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -1868,14 +1868,15 @@ public class ExcelTabController extends BladeController {
     @ApiOperationSupport(order = 27)
     @ApiOperation(value = "复制指定日期的日志填报数据")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "nodePrimaryKeyId", value = "当前操作的日志类型ID,即左侧列表的节点primaryKeyId"),
+            @ApiImplicitParam(name = "theLogId", value = "选取的数据ID"),
+            @ApiImplicitParam(name = "nodePrimaryKeyId", value = "当前操作的日志节点primaryKeyId"),
             @ApiImplicitParam(name = "currentTime", value = "当前选择的填写日期,即右侧日期控件所选日期,格式为 yyyy-MM-dd"),
-            @ApiImplicitParam(name = "targetTime", value = "需要复制的目标日期")
+            @ApiImplicitParam(name = "contractId", value = "合同段ID")
     })
-    public R<List<Map<String, Object>>> copyTheLogBusinessData(@RequestParam String nodePrimaryKeyId, @RequestParam String currentTime, @RequestParam String targetTime, @RequestParam String contractId) {
-        if (StringUtils.isNotEmpty(nodePrimaryKeyId) && StringUtils.isNotEmpty(currentTime) && StringUtils.isNotEmpty(targetTime)) {
+    public R<List<Map<String, Object>>> copyTheLogBusinessData(@RequestParam String theLogId, @RequestParam String nodePrimaryKeyId, @RequestParam String currentTime, @RequestParam String contractId) {
+        if (StringUtils.isNotEmpty(theLogId) && StringUtils.isNotEmpty(currentTime)) {
             //获取目标的数据
-            JSONObject targetJson = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTime(nodePrimaryKeyId, targetTime, contractId);
+            JSONObject targetJson = this.contractLogClient.queryContractLogById(theLogId);
             if (targetJson == null) {
                 return R.fail("目标日期下未找到当前用户填报的数据,请重新选择");
             }