Browse Source

Merge branch 'dev-excel0521' into dev-to-user-1

chenendian 1 week ago
parent
commit
36bcb29f08

+ 1 - 1
siwei-auth/src/main/java/com/siwei/auth/service/SysPasswordService.java

@@ -62,7 +62,7 @@ public class SysPasswordService
             retryCount = retryCount + 1;
             retryCount = retryCount + 1;
             recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
             recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
             redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
             redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
-            throw new ServiceException("用户不存在/密码错误");
+            throw new ServiceException("用户名或密码输入错误,请重新输入!");
         }
         }
         else
         else
         {
         {

+ 1 - 1
siwei-gateway/src/main/java/com/siwei/gateway/service/impl/ValidateCodeServiceImpl.java

@@ -113,7 +113,7 @@ public class ValidateCodeServiceImpl implements ValidateCodeService
         redisService.deleteObject(verifyKey);
         redisService.deleteObject(verifyKey);
         if (!code.equalsIgnoreCase(captcha))
         if (!code.equalsIgnoreCase(captcha))
         {
         {
-            throw new CaptchaException("验证码错误");
+            throw new CaptchaException("验证码错误,请重新输入");
         }
         }
     }
     }
 }
 }

+ 396 - 5
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/StorageController.java

@@ -8,17 +8,22 @@ import com.siwei.apply.domain.res.TrendStatisticsData;
 import com.siwei.apply.domain.res.TrendStatisticsRes;
 import com.siwei.apply.domain.res.TrendStatisticsRes;
 import com.siwei.apply.domain.res.TrendUseStatisticsData;
 import com.siwei.apply.domain.res.TrendUseStatisticsData;
 import com.siwei.apply.domain.vo.LandSupplyProjectVO;
 import com.siwei.apply.domain.vo.LandSupplyProjectVO;
+import com.siwei.apply.domain.vo.LandSupplyReportVO;
 import com.siwei.apply.service.cadastre.impl.StorageServiceImpl;
 import com.siwei.apply.service.cadastre.impl.StorageServiceImpl;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.web.controller.BaseController;
 import com.siwei.common.core.web.controller.BaseController;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -193,6 +198,209 @@ public class StorageController extends BaseController {
 
 
 
 
 
 
+
+    /**
+     * 收储进度报表导出
+     * @param response
+     * @param startYear
+     * @param endYear
+     */
+    @PostMapping("/progress/export")
+    public void exportPurposeReport(HttpServletResponse response, @RequestParam String startYear, @RequestParam String endYear) {
+        try {
+            LandStorageReportDTO res =  storageServiceImpl.stroageProgress(startYear,endYear);
+            if (res == null || CollectionUtils.isEmpty(res.getDetails())) {
+                return;
+            }
+
+            Workbook workbook = new XSSFWorkbook();
+            Sheet sheet = workbook.createSheet("收储进度报表");
+
+            CellStyle titleStyle = workbook.createCellStyle();
+            titleStyle.setAlignment(HorizontalAlignment.CENTER);
+            titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            Font titleFont = workbook.createFont();
+            titleFont.setBold(true);
+            titleFont.setFontHeightInPoints((short) 14);
+            titleStyle.setFont(titleFont);
+            titleStyle.setBorderTop(BorderStyle.THIN);
+            titleStyle.setBorderBottom(BorderStyle.THIN);
+            titleStyle.setBorderLeft(BorderStyle.THIN);
+            titleStyle.setBorderRight(BorderStyle.THIN);
+
+            CellStyle headerStyle = workbook.createCellStyle();
+            headerStyle.setAlignment(HorizontalAlignment.CENTER);
+            headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+            headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+            Font headerFont = workbook.createFont();
+            headerFont.setBold(true);
+            headerStyle.setFont(headerFont);
+            headerStyle.setBorderTop(BorderStyle.THIN);
+            headerStyle.setBorderBottom(BorderStyle.THIN);
+            headerStyle.setBorderLeft(BorderStyle.THIN);
+            headerStyle.setBorderRight(BorderStyle.THIN);
+
+            CellStyle dataStyle = workbook.createCellStyle();
+            dataStyle.setAlignment(HorizontalAlignment.RIGHT);
+            dataStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            dataStyle.setBorderTop(BorderStyle.THIN);
+            dataStyle.setBorderBottom(BorderStyle.THIN);
+            dataStyle.setBorderLeft(BorderStyle.THIN);
+            dataStyle.setBorderRight(BorderStyle.THIN);
+
+            CellStyle rateStyle = workbook.createCellStyle();
+            rateStyle.setAlignment(HorizontalAlignment.CENTER);
+            rateStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            rateStyle.setBorderTop(BorderStyle.THIN);
+            rateStyle.setBorderBottom(BorderStyle.THIN);
+            rateStyle.setBorderLeft(BorderStyle.THIN);
+            rateStyle.setBorderRight(BorderStyle.THIN);
+
+            int rowIndex = 0;
+
+            Row titleRow = sheet.createRow(rowIndex++);
+            Cell titleCell = titleRow.createCell(0);
+            titleCell.setCellValue(res.getTitle() != null ? res.getTitle() : "收储进度报表");
+            titleCell.setCellStyle(titleStyle);
+            sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 13));
+            titleRow.setHeight((short) 600);
+
+            Row subTitleRow = sheet.createRow(rowIndex++);
+            Cell subTitleCell = subTitleRow.createCell(0);
+            subTitleCell.setCellValue("统计时间范围:" + (res.getStatTimeRange() != null ? res.getStatTimeRange() : startYear + " 至 " + endYear));
+            subTitleCell.setCellStyle(titleStyle);
+            sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 13));
+
+            Row headerRow = sheet.createRow(rowIndex++);
+            String[] headers = {"用地类型", "收储进度", "计划面积", "计划数量", "计划成本", "计划收购", "计划征收", "计划其它",
+                    "完成面积", "完成数量", "完成成本", "完成收购", "完成征收", "完成其它"};
+            for (int i = 0; i < headers.length; i++) {
+                Cell cell = headerRow.createCell(i);
+                cell.setCellValue(headers[i]);
+                cell.setCellStyle(headerStyle);
+            }
+
+            int detailColCount = headers.length - 1;
+            for (LandStorageReportDTO.DetailDTO detail : res.getDetails()) {
+                Row dataRow = sheet.createRow(rowIndex++);
+
+                Cell typeCell = dataRow.createCell(0);
+                typeCell.setCellValue(detail.getCategory() != null ? detail.getCategory() : "");
+                typeCell.setCellStyle(dataStyle);
+
+                Cell rateCell = dataRow.createCell(1);
+                rateCell.setCellValue(detail.getProgress() != null ? detail.getProgress() : "0%");
+                rateCell.setCellStyle(rateStyle);
+
+                int colIndex = 2;
+                if (detail.getPlan() != null) {
+                    LandStorageReportDTO.PlanDTO plan = detail.getPlan();
+                    dataRow.createCell(colIndex++).setCellValue(plan.getArea() != null ? plan.getArea() : 0.0);
+                    dataRow.createCell(colIndex++).setCellValue(plan.getCount() != null ? plan.getCount() : 0);
+                    dataRow.createCell(colIndex++).setCellValue(plan.getCost() != null ? plan.getCost() : 0.0f);
+                    dataRow.createCell(colIndex++).setCellValue(plan.getMethod1() != null ? plan.getMethod1() : 0);
+                    dataRow.createCell(colIndex++).setCellValue(plan.getMethod2() != null ? plan.getMethod2() : 0);
+                    dataRow.createCell(colIndex++).setCellValue(plan.getOtherMethod() != null ? plan.getOtherMethod() : 0);
+                } else {
+                    colIndex += 6;
+                }
+
+                if (detail.getCompleted() != null) {
+                    LandStorageReportDTO.CompletedDTO completed = detail.getCompleted();
+                    dataRow.createCell(colIndex++).setCellValue(completed.getArea() != null ? completed.getArea() : 0.0);
+                    dataRow.createCell(colIndex++).setCellValue(completed.getCount() != null ? completed.getCount() : 0);
+                    dataRow.createCell(colIndex++).setCellValue(completed.getCost() != null ? completed.getCost() : 0.0f);
+                    dataRow.createCell(colIndex++).setCellValue(completed.getMethod1() != null ? completed.getMethod1() : 0);
+                    dataRow.createCell(colIndex++).setCellValue(completed.getMethod2() != null ? completed.getMethod2() : 0);
+                    dataRow.createCell(colIndex++).setCellValue(completed.getOtherMethod() != null ? completed.getOtherMethod() : 0);
+                } else {
+                    colIndex += 6;
+                }
+
+                for (int i = 0; i <= detailColCount; i++) {
+                    if (dataRow.getCell(i) == null) {
+                        dataRow.createCell(i).setCellStyle(dataStyle);
+                    } else if (i == 1) {
+                        continue;
+                    } else {
+                        dataRow.getCell(i).setCellStyle(dataStyle);
+                    }
+                }
+            }
+
+            if (res.getSummary() != null && res.getSummary().getTotal() != null) {
+                LandStorageReportDTO.TotalDTO total = res.getSummary().getTotal();
+                Row totalRow = sheet.createRow(rowIndex++);
+
+                Cell typeCell = totalRow.createCell(0);
+                typeCell.setCellValue("合计");
+                typeCell.setCellStyle(dataStyle);
+
+                Cell rateCell = totalRow.createCell(1);
+                rateCell.setCellValue(total.getProgress() != null ? total.getProgress() : "0%");
+                rateCell.setCellStyle(rateStyle);
+
+                int colIndex = 2;
+                if (total.getPlan() != null) {
+                    LandStorageReportDTO.PlanDTO plan = total.getPlan();
+                    totalRow.createCell(colIndex++).setCellValue(plan.getArea() != null ? plan.getArea() : 0.0);
+                    totalRow.createCell(colIndex++).setCellValue(plan.getCount() != null ? plan.getCount() : 0);
+                    totalRow.createCell(colIndex++).setCellValue(plan.getCost() != null ? plan.getCost() : 0.0f);
+                    totalRow.createCell(colIndex++).setCellValue(plan.getMethod1() != null ? plan.getMethod1() : 0);
+                    totalRow.createCell(colIndex++).setCellValue(plan.getMethod2() != null ? plan.getMethod2() : 0);
+                    totalRow.createCell(colIndex++).setCellValue(plan.getOtherMethod() != null ? plan.getOtherMethod() : 0);
+                } else {
+                    colIndex += 6;
+                }
+
+                if (total.getCompleted() != null) {
+                    LandStorageReportDTO.CompletedDTO completed = total.getCompleted();
+                    totalRow.createCell(colIndex++).setCellValue(completed.getArea() != null ? completed.getArea() : 0.0);
+                    totalRow.createCell(colIndex++).setCellValue(completed.getCount() != null ? completed.getCount() : 0);
+                    totalRow.createCell(colIndex++).setCellValue(completed.getCost() != null ? completed.getCost() : 0.0f);
+                    totalRow.createCell(colIndex++).setCellValue(completed.getMethod1() != null ? completed.getMethod1() : 0);
+                    totalRow.createCell(colIndex++).setCellValue(completed.getMethod2() != null ? completed.getMethod2() : 0);
+                    totalRow.createCell(colIndex++).setCellValue(completed.getOtherMethod() != null ? completed.getOtherMethod() : 0);
+                }
+
+                for (int i = 0; i <= detailColCount; i++) {
+                    if (totalRow.getCell(i) == null) {
+                        totalRow.createCell(i).setCellStyle(dataStyle);
+                    } else if (i == 1) {
+                        continue;
+                    } else {
+                        totalRow.getCell(i).setCellStyle(dataStyle);
+                    }
+                }
+            }
+
+            for (int i = 0; i <= detailColCount; i++) {
+                sheet.autoSizeColumn(i);
+            }
+
+            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+            response.setCharacterEncoding("utf-8");
+            String fileName = "收储进度分析报表.xlsx";
+            String encodedName = URLEncoder.encode(fileName, StandardCharsets.UTF_8).replace("+", "%20");
+            response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + encodedName);
+
+            workbook.write(response.getOutputStream());
+            workbook.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+
+
+
+
+
+
+
+
     @GetMapping("/report/inOutDetails")
     @GetMapping("/report/inOutDetails")
     public R<LandStorageInOutReportDTO> getInOutDetails() {
     public R<LandStorageInOutReportDTO> getInOutDetails() {
         try {
         try {
@@ -206,6 +414,189 @@ public class StorageController extends BaseController {
 
 
 
 
 
 
+    /**
+     * 出入库报表导出
+     * @param response
+     */
+    @PostMapping("/inout/export")
+    public void exportInoutReport(HttpServletResponse response) {
+        try {
+            LandStorageInOutReportDTO res =  storageServiceImpl.inOutDetails();
+            if (res == null || CollectionUtils.isEmpty(res.getCategoryList())) {
+                return;
+            }
+
+            Workbook workbook = new XSSFWorkbook();
+            Sheet sheet = workbook.createSheet("收储出入库分析报表");
+
+            CellStyle titleStyle = workbook.createCellStyle();
+            titleStyle.setAlignment(HorizontalAlignment.CENTER);
+            titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            Font titleFont = workbook.createFont();
+            titleFont.setBold(true);
+            titleFont.setFontHeightInPoints((short) 14);
+            titleStyle.setFont(titleFont);
+            titleStyle.setBorderTop(BorderStyle.THIN);
+            titleStyle.setBorderBottom(BorderStyle.THIN);
+            titleStyle.setBorderLeft(BorderStyle.THIN);
+            titleStyle.setBorderRight(BorderStyle.THIN);
+
+            CellStyle headerStyle = workbook.createCellStyle();
+            headerStyle.setAlignment(HorizontalAlignment.CENTER);
+            headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+            headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+            Font headerFont = workbook.createFont();
+            headerFont.setBold(true);
+            headerStyle.setFont(headerFont);
+            headerStyle.setBorderTop(BorderStyle.THIN);
+            headerStyle.setBorderBottom(BorderStyle.THIN);
+            headerStyle.setBorderLeft(BorderStyle.THIN);
+            headerStyle.setBorderRight(BorderStyle.THIN);
+
+            CellStyle dataStyle = workbook.createCellStyle();
+            dataStyle.setAlignment(HorizontalAlignment.RIGHT);
+            dataStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            dataStyle.setBorderTop(BorderStyle.THIN);
+            dataStyle.setBorderBottom(BorderStyle.THIN);
+            dataStyle.setBorderLeft(BorderStyle.THIN);
+            dataStyle.setBorderRight(BorderStyle.THIN);
+
+            CellStyle totalStyle = workbook.createCellStyle();
+            totalStyle.setAlignment(HorizontalAlignment.RIGHT);
+            totalStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+            totalStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+            totalStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+            Font totalFont = workbook.createFont();
+            totalFont.setBold(true);
+            totalStyle.setFont(totalFont);
+            totalStyle.setBorderTop(BorderStyle.THIN);
+            totalStyle.setBorderBottom(BorderStyle.THIN);
+            totalStyle.setBorderLeft(BorderStyle.THIN);
+            totalStyle.setBorderRight(BorderStyle.THIN);
+
+            List<String> years = java.util.Arrays.asList("all", "2021", "2022", "2023", "2024", "2025", "2026", "other");
+            List<LandStorageInOutReportDTO.CategoryDTO> dataList = res.getCategoryList();
+
+            int lastColIndex = years.size() * 2;
+
+            int rowIndex = 0;
+
+            Row titleRow = sheet.createRow(rowIndex++);
+            Cell titleCell = titleRow.createCell(0);
+            titleCell.setCellValue(res.getTitle() != null ? res.getTitle() : "收储出入库分析报表");
+            titleCell.setCellStyle(titleStyle);
+            sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, lastColIndex));
+            titleRow.setHeight((short) 600);
+
+            Row headerRow1 = sheet.createRow(rowIndex++);
+            Row headerRow2 = sheet.createRow(rowIndex++);
+
+            Cell typeHeader = headerRow1.createCell(0);
+            typeHeader.setCellValue("用地类型");
+            typeHeader.setCellStyle(headerStyle);
+            sheet.addMergedRegion(new CellRangeAddress(1, 2, 0, 0));
+            headerRow2.createCell(0).setCellStyle(headerStyle);
+
+            int colIndex = 1;
+            String[] categoryNames = {"入库", "出库"};
+            for (int i = 0; i < categoryNames.length; i++) {
+                Cell categoryCell = headerRow1.createCell(colIndex);
+                categoryCell.setCellValue(categoryNames[i]);
+                categoryCell.setCellStyle(headerStyle);
+                sheet.addMergedRegion(new CellRangeAddress(1, 1, colIndex, colIndex + years.size() - 1));
+
+                for (int j = 0; j < years.size(); j++) {
+                    Cell yearCell = headerRow2.createCell(colIndex + j);
+                    yearCell.setCellValue(years.get(j));
+                    yearCell.setCellStyle(headerStyle);
+                }
+                colIndex += years.size();
+            }
+
+            for (LandStorageInOutReportDTO.CategoryDTO categoryData : dataList) {
+                Row dataRow = sheet.createRow(rowIndex++);
+
+                Cell typeCell = dataRow.createCell(0);
+                typeCell.setCellValue(categoryData.getCategory() != null ? categoryData.getCategory() : "");
+                typeCell.setCellStyle(headerStyle);
+
+                int dataColIndex = 1;
+                LandStorageInOutReportDTO.DetailDTO detail = categoryData.getDetail() != null
+                        ? categoryData.getDetail()
+                        : new LandStorageInOutReportDTO.DetailDTO();
+
+                List<LandStorageInOutReportDTO.ItemDTO> inItems = detail.getIn();
+                List<LandStorageInOutReportDTO.ItemDTO> outItems = detail.getOut();
+
+                for (String year : years) {
+                    Cell cell = dataRow.createCell(dataColIndex++);
+                    cell.setCellValue(getItemCount(inItems, year, 0L));
+                    cell.setCellStyle(dataStyle);
+                }
+                for (String year : years) {
+                    Cell cell = dataRow.createCell(dataColIndex++);
+                    cell.setCellValue(getItemCount(outItems, year, 0L));
+                    cell.setCellStyle(dataStyle);
+                }
+            }
+
+            Row totalRow = sheet.createRow(rowIndex++);
+            Cell totalLabelCell = totalRow.createCell(0);
+            totalLabelCell.setCellValue("合计");
+            totalLabelCell.setCellStyle(headerStyle);
+
+            int totalColIndex = 1;
+            LandStorageInOutReportDTO.DetailDTO totalDetail = (res.getSummary() != null && res.getSummary().getDetail() != null)
+                    ? res.getSummary().getDetail()
+                    : new LandStorageInOutReportDTO.DetailDTO();
+
+            List<LandStorageInOutReportDTO.ItemDTO> totalInItems = totalDetail.getIn();
+            List<LandStorageInOutReportDTO.ItemDTO> totalOutItems = totalDetail.getOut();
+
+            for (String year : years) {
+                Cell cell = totalRow.createCell(totalColIndex++);
+                cell.setCellValue(getItemCount(totalInItems, year, 0L));
+                cell.setCellStyle(totalStyle);
+            }
+            for (String year : years) {
+                Cell cell = totalRow.createCell(totalColIndex++);
+                cell.setCellValue(getItemCount(totalOutItems, year, 0L));
+                cell.setCellStyle(totalStyle);
+            }
+
+            for (int i = 0; i <= lastColIndex; i++) {
+                sheet.autoSizeColumn(i);
+            }
+
+            response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+            response.setCharacterEncoding("utf-8");
+            String fileName = "出入库分析报表.xlsx";
+            String encodedName = URLEncoder.encode(fileName, StandardCharsets.UTF_8).replace("+", "%20");
+            response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + encodedName);
+
+            workbook.write(response.getOutputStream());
+            workbook.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static long getItemCount(List<LandStorageInOutReportDTO.ItemDTO> items, String year, long defaultValue) {
+        if (items == null) {
+            return defaultValue;
+        }
+        for (LandStorageInOutReportDTO.ItemDTO item : items) {
+            if (item != null && year != null && year.equals(item.getYear())) {
+                try {
+                    return item.getCount() != null ? Long.parseLong(item.getCount()) : defaultValue;
+                } catch (NumberFormatException e) {
+                    return defaultValue;
+                }
+            }
+        }
+        return defaultValue;
+    }
 
 
 
 
 
 

+ 9 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GyjsydjfwscdjMapper.java

@@ -44,4 +44,13 @@ public interface GyjsydjfwscdjMapper {
      * @param hasOnchain 是否上链
      * @param hasOnchain 是否上链
      */
      */
     void updateHasOnchain(@Param("id") String id, @Param("hasOnchain") Boolean hasOnchain);
     void updateHasOnchain(@Param("id") String id, @Param("hasOnchain") Boolean hasOnchain);
+
+
+
+    /**
+     * 根据主键ID获取单条记录
+     */
+    Gyjsydjfwscdj getBySourceId(@Param("sourceId") String sourceId);
+
+
 }
 }

+ 4 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/GyjsydjfwscdjService.java

@@ -1,5 +1,6 @@
 package com.siwei.apply.service;
 package com.siwei.apply.service;
 
 
+import com.siwei.apply.domain.Gyjsydjfwscdj;
 import com.siwei.apply.domain.res.GyjsydjfwscdjRes;
 import com.siwei.apply.domain.res.GyjsydjfwscdjRes;
 import com.siwei.apply.domain.res.GyjsydjfwscdjSinglRes;
 import com.siwei.apply.domain.res.GyjsydjfwscdjSinglRes;
 import com.siwei.apply.domain.vo.GyjsydjfwscdjUpdateVo;
 import com.siwei.apply.domain.vo.GyjsydjfwscdjUpdateVo;
@@ -46,4 +47,7 @@ public interface GyjsydjfwscdjService {
      * @param hasOnchain 是否上链
      * @param hasOnchain 是否上链
      */
      */
     void updateHasOnchain(String id, Boolean hasOnchain);
     void updateHasOnchain(String id, Boolean hasOnchain);
+
+    Gyjsydjfwscdj getBySourceId(String sourceId);
+
 }
 }

+ 70 - 11
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/StorageServiceImpl.java

@@ -31,7 +31,6 @@ public class StorageServiceImpl {
     private TdgyMapper tdgyMapper;
     private TdgyMapper tdgyMapper;
 
 
 
 
-
     public LandStorageInOutReportDTO inOutDetails() {
     public LandStorageInOutReportDTO inOutDetails() {
         LandStorageInOutReportDTO report = new LandStorageInOutReportDTO();
         LandStorageInOutReportDTO report = new LandStorageInOutReportDTO();
         report.setTitle("收储出入库分析报表");
         report.setTitle("收储出入库分析报表");
@@ -74,11 +73,17 @@ public class StorageServiceImpl {
         for(String category  : categorySet){
         for(String category  : categorySet){
             List<TdgyStatisticsRes>   categoryCompleteList =  groupedCompleteMap.get(category);
             List<TdgyStatisticsRes>   categoryCompleteList =  groupedCompleteMap.get(category);
             List<TdgyStatisticsRes>   groupedCompleteSjgdList = groupedCompleteSjgdMap.get(category);
             List<TdgyStatisticsRes>   groupedCompleteSjgdList = groupedCompleteSjgdMap.get(category);
+            if(Objects.isNull(categoryCompleteList)){
+                categoryCompleteList = new ArrayList<>();
+            }
+            if(Objects.isNull(groupedCompleteSjgdList)){
+                groupedCompleteSjgdList = new ArrayList<>();
+            }
 
 
             List<LandStorageInOutReportDTO.ItemDTO> inList = new ArrayList<>();
             List<LandStorageInOutReportDTO.ItemDTO> inList = new ArrayList<>();
             List<LandStorageInOutReportDTO.ItemDTO> outList = new ArrayList<>();
             List<LandStorageInOutReportDTO.ItemDTO> outList = new ArrayList<>();
 
 
-            if(CollectionUtils.isNotEmpty(categoryCompleteList)){
+            if(Objects.nonNull(categoryCompleteList)){
                 // 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
                 // 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
                 Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
                 Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
                 Map<String, Long> yearCountMap = categoryCompleteList.stream()
                 Map<String, Long> yearCountMap = categoryCompleteList.stream()
@@ -106,10 +111,10 @@ public class StorageServiceImpl {
                 }
                 }
             }
             }
             //这里解析out数据
             //这里解析out数据
-            if(CollectionUtils.isNotEmpty(groupedCompleteSjgdList)){
+            if(Objects.nonNull(groupedCompleteSjgdList)){
                 // 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
                 // 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
                 Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
                 Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
-                Map<String, Long> yearCountMap = categoryCompleteList.stream()
+                Map<String, Long> yearCountMap = groupedCompleteSjgdList.stream()
                         .collect(Collectors.groupingBy(
                         .collect(Collectors.groupingBy(
                                 s -> {
                                 s -> {
                                     String nf = s.getNf();
                                     String nf = s.getNf();
@@ -126,7 +131,7 @@ public class StorageServiceImpl {
                     item.setYear(year);
                     item.setYear(year);
                     if ("all".equals(year)) {
                     if ("all".equals(year)) {
                         // all 统计当前分类下不区分 nf 的所有数据加总
                         // all 统计当前分类下不区分 nf 的所有数据加总
-                        item.setCount(String.valueOf(categoryCompleteList.size()));
+                        item.setCount(String.valueOf(groupedCompleteSjgdList.size()));
                     } else {
                     } else {
                         item.setCount(String.valueOf(yearCountMap.getOrDefault(year, 0L)));
                         item.setCount(String.valueOf(yearCountMap.getOrDefault(year, 0L)));
                     }
                     }
@@ -151,20 +156,74 @@ public class StorageServiceImpl {
         LandStorageInOutReportDTO.DetailDTO totalDetail = new LandStorageInOutReportDTO.DetailDTO();
         LandStorageInOutReportDTO.DetailDTO totalDetail = new LandStorageInOutReportDTO.DetailDTO();
         //todo 这里计算 totalInList
         //todo 这里计算 totalInList
         List<LandStorageInOutReportDTO.ItemDTO> totalInList = new ArrayList<>();
         List<LandStorageInOutReportDTO.ItemDTO> totalInList = new ArrayList<>();
+
+        //这里计算总量的入库
+        if(Objects.nonNull(completeList)){
+            // 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
+            Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
+            Map<String, Long> yearCountMap = completeList.stream()
+                    .collect(Collectors.groupingBy(
+                            s -> {
+                                String nf = s.getNf();
+                                if (StringUtils.isNotBlank(nf) && definedYears.contains(nf)) {
+                                    return nf;
+                                }
+                                return "other";
+                            },
+                            Collectors.counting()
+                    ));
+
+            for (String year : yearArr) {
+                LandStorageInOutReportDTO.ItemDTO item = new LandStorageInOutReportDTO.ItemDTO();
+                item.setYear(year);
+                if ("all".equals(year)) {
+                    // all 统计当前分类下不区分 nf 的所有数据加总
+                    item.setCount(String.valueOf(completeList.size()));
+                } else {
+                    item.setCount(String.valueOf(yearCountMap.getOrDefault(year, 0L)));
+                }
+                totalInList.add(item);
+            }
+        }
+
+        //todo 这里计算 totalInList
+        List<LandStorageInOutReportDTO.ItemDTO> totalOutList = new ArrayList<>();
+        //这里计算总量的出库
+        if(Objects.nonNull(completeSjgdList)){
+            // 根据 nf 字段分组:在 yearArr 中年份相等的归到对应年份,不在 yearArr 中的归到 other
+            Set<String> definedYears = new HashSet<>(Arrays.asList("2021","2022","2023","2024","2025","2026"));
+            Map<String, Long> yearCountMap = completeSjgdList.stream()
+                    .collect(Collectors.groupingBy(
+                            s -> {
+                                String nf = s.getNf();
+                                if (StringUtils.isNotBlank(nf) && definedYears.contains(nf)) {
+                                    return nf;
+                                }
+                                return "other";
+                            },
+                            Collectors.counting()
+                    ));
+            for (String year : yearArr) {
+                LandStorageInOutReportDTO.ItemDTO item = new LandStorageInOutReportDTO.ItemDTO();
+                item.setYear(year);
+                if ("all".equals(year)) {
+                    // all 统计当前分类下不区分 nf 的所有数据加总
+                    item.setCount(String.valueOf(completeSjgdList.size()));
+                } else {
+                    item.setCount(String.valueOf(yearCountMap.getOrDefault(year, 0L)));
+                }
+                totalOutList.add(item);
+            }
+        }
         totalDetail.setIn(totalInList);
         totalDetail.setIn(totalInList);
-        totalDetail.setOut(null);
+        totalDetail.setOut(totalOutList);
         summary.setDetail(totalDetail);
         summary.setDetail(totalDetail);
         report.setSummary(summary);
         report.setSummary(summary);
-
-
-
-
         return report;
         return report;
     }
     }
 
 
 
 
 
 
-
     //统计分析
     //统计分析
     public LandStorageReportDTO stroageProgress(String startYear, String endYear) {
     public LandStorageReportDTO stroageProgress(String startYear, String endYear) {
         LandStorageReportDTO report = new LandStorageReportDTO();
         LandStorageReportDTO report = new LandStorageReportDTO();

+ 8 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/Gyjsydjfwscdjmpl.java

@@ -120,4 +120,12 @@ public class Gyjsydjfwscdjmpl implements GyjsydjfwscdjService {
     public void updateHasOnchain(String id, Boolean hasOnchain) {
     public void updateHasOnchain(String id, Boolean hasOnchain) {
         gyjsydjfwscdjMapper.updateHasOnchain(id, hasOnchain);
         gyjsydjfwscdjMapper.updateHasOnchain(id, hasOnchain);
     }
     }
+
+
+    @Override
+    public Gyjsydjfwscdj getBySourceId(String sourceId) {
+        return gyjsydjfwscdjMapper.getBySourceId(sourceId);
+    }
+
+
 }
 }

+ 44 - 46
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/TakeDataServiceImpl.java

@@ -2,10 +2,8 @@ package com.siwei.apply.service.third.impl;
 
 
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONObject;
-import com.siwei.apply.domain.LandType;
-import com.siwei.apply.domain.Project;
-import com.siwei.apply.domain.ProjectImmobileCode;
-import com.siwei.apply.domain.ProjectWorkflow;
+import com.siwei.apply.domain.*;
+import com.siwei.apply.domain.res.GyjsydjfwscdjSinglRes;
 import com.siwei.apply.domain.res.GyjsydscdjRes;
 import com.siwei.apply.domain.res.GyjsydscdjRes;
 import com.siwei.apply.domain.res.GyjsydscdjSinglRes;
 import com.siwei.apply.domain.res.GyjsydscdjSinglRes;
 import com.siwei.apply.domain.vo.*;
 import com.siwei.apply.domain.vo.*;
@@ -92,7 +90,7 @@ public class TakeDataServiceImpl implements TakeDataService {
     @Override
     @Override
     public void syncLandNodeInfo(String projectId,String nodeTableName) {
     public void syncLandNodeInfo(String projectId,String nodeTableName) {
         Project project = projectMapper.get(projectId);
         Project project = projectMapper.get(projectId);
-        if (Objects.isNull(project) || StringUtils.isBlank(project.getCode())) {
+        if (Objects.isNull(project) || StringUtils.isBlank(project.getId())) {
             throw new ServiceException("当前项目不具备同步条件,请检查项目代码是否存在");
             throw new ServiceException("当前项目不具备同步条件,请检查项目代码是否存在");
         }
         }
         List<ThirdRecordStatusParamVo> syncRecordList =  thirdRecordStatusMapper.selectByProjectIdAndType(projectId,"2");
         List<ThirdRecordStatusParamVo> syncRecordList =  thirdRecordStatusMapper.selectByProjectIdAndType(projectId,"2");
@@ -226,6 +224,9 @@ public class TakeDataServiceImpl implements TakeDataService {
         return retMap;
         return retMap;
     }
     }
 
 
+
+
+
     /**
     /**
      * 远程获取国有建设用地使用权首次登记数据
      * 远程获取国有建设用地使用权首次登记数据
      * 并且入库
      * 并且入库
@@ -247,11 +248,10 @@ public class TakeDataServiceImpl implements TakeDataService {
             throw new ServiceException("业务类型为空");
             throw new ServiceException("业务类型为空");
         }
         }
         Map<String, Object> retMap = new HashMap<>();
         Map<String, Object> retMap = new HashMap<>();
-
         //todo 这里进行远程请求,获取相关数据,解析后入库
         //todo 这里进行远程请求,获取相关数据,解析后入库
         try {
         try {
             Map<String,Object> paramMap = new LinkedHashMap<>();
             Map<String,Object> paramMap = new LinkedHashMap<>();
-            paramMap.put("ywbh","");
+            paramMap.put("ywbh","12345");
             paramMap.put("yfbdcdyh",yfbdcdyh);
             paramMap.put("yfbdcdyh",yfbdcdyh);
             String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.landRegist.datas",paramMap);
             String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.landRegist.datas",paramMap);
             JSONObject root = JSON.parseObject(remoteResult);
             JSONObject root = JSON.parseObject(remoteResult);
@@ -263,67 +263,69 @@ public class TakeDataServiceImpl implements TakeDataService {
                     throw new ServiceException("检查预赋不动产单元号是否正确");
                     throw new ServiceException("检查预赋不动产单元号是否正确");
                 }
                 }
                 //todo  这里根据 sourceId 确认是修改还是新增
                 //todo  这里根据 sourceId 确认是修改还是新增
-                //
-
+                String needUpdateNodeId = "";
                 String projectId = immobileCodeRes.getProjectId();
                 String projectId = immobileCodeRes.getProjectId();
-                //Project project = projectMapper.get(projectId);
-                GyjsydscdjVo gyjsydscdjVo = new GyjsydscdjVo();
-                gyjsydscdjVo.setProjectId(projectId);
-                gyjsydscdjVo.setQlr(body.getQlr());
-
-                gyjsydscdjVo.setGyqk(body.getGyqk());
-                gyjsydscdjVo.setZl(body.getZl());
-                gyjsydscdjVo.setQllx(body.getQllx());
-                gyjsydscdjVo.setQlxz(body.getQlxz());
-                //土地用途转化
-                if(StringUtils.isNotBlank(body.getTdyt())){
-                    String code = this.getTdytCodeByName(body.getTdyt());
-                    gyjsydscdjVo.setTdyt(code);
-                }
-                if (StringUtils.isNotBlank(body.getTdmj())) {
-                    gyjsydscdjVo.setArea(Float.valueOf(body.getTdmj()));
+                String sourceId = body.getYwbh();
+                Gyjsydjfwscdj existsNode = gyjsydjfwscdjService.getBySourceId(sourceId);//todo 这里需要根据sourceId 检查
+                if(Objects.nonNull(existsNode)){
+                    needUpdateNodeId = existsNode.getId();
                 }
                 }
-                gyjsydscdjVo.setAreaUnit(body.getTdmjdw());
-                gyjsydscdjVo.setBdcdyh(StringUtils.isNotBlank(body.getBdcdyh()) ? body.getBdcdyh() : body.getYfbdcdyh());
-                gyjsydscdjVo.setBdczh(body.getBdczh());
-                gyjsydscdjVo.setDjjg(body.getDjjg());
-                gyjsydscdjVo.setDjDate(body.getDjrq());
-                gyjsydscdjVo.setSourceId(ywh);
-                String nodeId = gyjsydscdjService.add(gyjsydscdjVo);
-                retMap.put("id", nodeId);
+                String addNodeId = addOrUpdateLandFirstRegistration(body,projectId,needUpdateNodeId);
                 //这里保存附件信息
                 //这里保存附件信息
                 if(Objects.nonNull(body.getAttachment()) && !body.getAttachment().isEmpty()){
                 if(Objects.nonNull(body.getAttachment()) && !body.getAttachment().isEmpty()){
-                    nodeAttachmentService.getThirdAttachment(projectId,nodeId,AloneWorkFlowEnum.NODE_3.getName(),body.getAttachment());
+                    nodeAttachmentService.getThirdAttachment(projectId,addNodeId,AloneWorkFlowEnum.NODE_3.getName(),body.getAttachment());
                 }
                 }
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("调用矢量保存文件错误,业务编号:{}: ", ywh);
             log.error("调用矢量保存文件错误,业务编号:{}: ", ywh);
             e.printStackTrace();
             e.printStackTrace();
         }
         }
-        //todo 同步完成之后,需要修改t_third_record_status 表的状态值,同步完成;
         return retMap;
         return retMap;
     }
     }
 
 
 
 
 
 
-    public String  addOrUpdateLandFirstRegistration( LandFirstParamVo body ,String projectId,String needUpdateNodeId,String ywh ) {
+    public String  addOrUpdateLandFirstRegistration(LandFirstParamVo body,String projectId,String needUpdateNodeId) {
         String addNodeId = "";
         String addNodeId = "";
         if (StringUtils.isNotBlank(needUpdateNodeId)) {
         if (StringUtils.isNotBlank(needUpdateNodeId)) {
+            GyjsydscdjUpdateVo gyjsydscdjUpdateVo = new GyjsydscdjUpdateVo();
+            gyjsydscdjUpdateVo.setProjectId(projectId);
+            gyjsydscdjUpdateVo.setId(needUpdateNodeId);
+            gyjsydscdjUpdateVo.setQlr(body.getQlr());
+            gyjsydscdjUpdateVo.setGyqk(body.getGyqk());
+            gyjsydscdjUpdateVo.setZl(body.getZl());
+            gyjsydscdjUpdateVo.setQllx(body.getQllx());
+            gyjsydscdjUpdateVo.setQlxz(body.getQlxz());
+
+            //土地用途转化
+            if (StringUtils.isNotBlank(body.getTdyt())) {
+                String code = null; //todo 转化
+                gyjsydscdjUpdateVo.setTdyt(code);
+            }
+            if (StringUtils.isNotBlank(body.getTdmj())) {
+                gyjsydscdjUpdateVo.setArea(Float.valueOf(body.getTdmj()));
+            }
+            gyjsydscdjUpdateVo.setAreaUnit(body.getTdmjdw());
+            gyjsydscdjUpdateVo.setBdcdyh(StringUtils.isNotBlank(body.getBdcdyh()) ? body.getBdcdyh() : body.getYfbdcdyh());
+            gyjsydscdjUpdateVo.setBdczh(body.getBdczh());
+            gyjsydscdjUpdateVo.setDjjg(body.getDjjg());
+            gyjsydscdjUpdateVo.setDjDate(body.getDjrq());
+            gyjsydscdjUpdateVo.setSourceId(body.getYwbh());
+            gyjsydscdjService.update(gyjsydscdjUpdateVo);
+            addNodeId = needUpdateNodeId;
+        }else{
             GyjsydscdjVo gyjsydscdjVo = new GyjsydscdjVo();
             GyjsydscdjVo gyjsydscdjVo = new GyjsydscdjVo();
             gyjsydscdjVo.setProjectId(projectId);
             gyjsydscdjVo.setProjectId(projectId);
             gyjsydscdjVo.setQlr(body.getQlr());
             gyjsydscdjVo.setQlr(body.getQlr());
-
             gyjsydscdjVo.setGyqk(body.getGyqk());
             gyjsydscdjVo.setGyqk(body.getGyqk());
             gyjsydscdjVo.setZl(body.getZl());
             gyjsydscdjVo.setZl(body.getZl());
             gyjsydscdjVo.setQllx(body.getQllx());
             gyjsydscdjVo.setQllx(body.getQllx());
             gyjsydscdjVo.setQlxz(body.getQlxz());
             gyjsydscdjVo.setQlxz(body.getQlxz());
-
             //土地用途转化
             //土地用途转化
-            if (StringUtils.isNotBlank(body.getTdyt())) {
-                String code = null;
+            if(StringUtils.isNotBlank(body.getTdyt())){
+                String code = this.getTdytCodeByName(body.getTdyt());
                 gyjsydscdjVo.setTdyt(code);
                 gyjsydscdjVo.setTdyt(code);
             }
             }
-
             if (StringUtils.isNotBlank(body.getTdmj())) {
             if (StringUtils.isNotBlank(body.getTdmj())) {
                 gyjsydscdjVo.setArea(Float.valueOf(body.getTdmj()));
                 gyjsydscdjVo.setArea(Float.valueOf(body.getTdmj()));
             }
             }
@@ -332,11 +334,10 @@ public class TakeDataServiceImpl implements TakeDataService {
             gyjsydscdjVo.setBdczh(body.getBdczh());
             gyjsydscdjVo.setBdczh(body.getBdczh());
             gyjsydscdjVo.setDjjg(body.getDjjg());
             gyjsydscdjVo.setDjjg(body.getDjjg());
             gyjsydscdjVo.setDjDate(body.getDjrq());
             gyjsydscdjVo.setDjDate(body.getDjrq());
-            gyjsydscdjVo.setSourceId(ywh);
+            gyjsydscdjVo.setSourceId(body.getYwbh());
             String nodeId = gyjsydscdjService.add(gyjsydscdjVo);
             String nodeId = gyjsydscdjService.add(gyjsydscdjVo);
             addNodeId = nodeId;
             addNodeId = nodeId;
         }
         }
-
         return addNodeId;
         return addNodeId;
     }
     }
 
 
@@ -348,9 +349,6 @@ public class TakeDataServiceImpl implements TakeDataService {
 
 
 
 
 
 
-
-
-
     @Override
     @Override
     public Map<String, Object> remoteHouseFirstRegistration(ThirdRecordStatusParamVo paramVo) {
     public Map<String, Object> remoteHouseFirstRegistration(ThirdRecordStatusParamVo paramVo) {
         String yfbdcdyh = paramVo.getYfbdcdyh();
         String yfbdcdyh = paramVo.getYfbdcdyh();

+ 13 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/GyjsydjfwscdjMapper.xml

@@ -57,6 +57,16 @@
         WHERE id = #{id}
         WHERE id = #{id}
     </select>
     </select>
 
 
+
+    <!-- 新增:根据主键ID获取单条记录 -->
+    <select id="getBySourceId" resultMap="BaseResultMap" parameterType="String">
+        SELECT *
+        FROM t_gyjsydjfwscdj
+        WHERE source_id = #{sourceId}
+        Limit 1
+    </select>
+
+
     <!-- 更新记录 -->
     <!-- 更新记录 -->
     <update id="update" parameterType="com.siwei.apply.domain.vo.GyjsydjfwscdjUpdateVo">
     <update id="update" parameterType="com.siwei.apply.domain.vo.GyjsydjfwscdjUpdateVo">
         UPDATE t_gyjsydjfwscdj
         UPDATE t_gyjsydjfwscdj
@@ -87,4 +97,7 @@
         WHERE id = #{id}
         WHERE id = #{id}
     </update>
     </update>
 
 
+
+
+
 </mapper>
 </mapper>

+ 1 - 1
siwei-modules/siwei-system/src/main/java/com/siwei/system/controller/SysProfileController.java

@@ -141,7 +141,7 @@ public class SysProfileController extends BaseController
             {
             {
                 return error("文件服务异常,请联系管理员");
                 return error("文件服务异常,请联系管理员");
             }
             }
-            String url = fileResult.getData().getUrl();
+            String url = fileResult.getData().getPath();
             if (userService.updateUserAvatar(loginUser.getUsername(), url))
             if (userService.updateUserAvatar(loginUser.getUsername(), url))
             {
             {
                 AjaxResult ajax = AjaxResult.success();
                 AjaxResult ajax = AjaxResult.success();