Browse Source

结算周期

qianxb 1 năm trước cách đây
mục cha
commit
4d5cb98534
17 tập tin đã thay đổi với 687 bổ sung9 xóa
  1. 22 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/dto/SettlementIntervalDTO.java
  2. 51 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/AgreementFile.java
  3. 28 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/CompensationInfo.java
  4. 60 0
      blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/SettlementInterval.java
  5. 138 0
      blade-service/blade-land/src/main/java/org/springblade/land/controller/AgreementFileController.java
  6. 9 6
      blade-service/blade-land/src/main/java/org/springblade/land/controller/CompensationInfoController.java
  7. 82 0
      blade-service/blade-land/src/main/java/org/springblade/land/controller/SettlementIntervalController.java
  8. 33 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementFileMapper.java
  9. 5 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementFileMapper.xml
  10. 2 1
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/CompensationInfoMapper.xml
  11. 40 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/SettlementIntervalMapper.java
  12. 12 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/SettlementIntervalMapper.xml
  13. 36 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/IAgreementFileService.java
  14. 40 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/ISettlementIntervalService.java
  15. 25 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/AgreementFileServiceImpl.java
  16. 27 2
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/CompensationInfoServiceImpl.java
  17. 77 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/SettlementIntervalServiceImpl.java

+ 22 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/dto/SettlementIntervalDTO.java

@@ -0,0 +1,22 @@
+package org.springblade.land.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.land.entity.CropsInfo;
+import org.springblade.land.entity.SettlementInterval;
+
+import java.util.List;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2023/9/13 11:09
+ **/
+@Data
+public class SettlementIntervalDTO{
+
+    @ApiModelProperty(value = "结算周期集合")
+    private List<SettlementInterval> list;
+
+}

+ 51 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/AgreementFile.java

@@ -0,0 +1,51 @@
+package org.springblade.land.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2023/10/7 14:53
+ **/
+@Data
+@TableName("l_agreement_file")
+@ApiModel(value = "协议附件信息表", description = "协议附件信息表")
+@NoArgsConstructor
+@AllArgsConstructor
+public class AgreementFile implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "主键")
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
+    private Long id;
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+
+    @ApiModelProperty(value = "表单ID")
+    private Long agreementId;
+
+    @ApiModelProperty(value = "附件路径")
+    private String domainUrl;
+
+    @ApiModelProperty(value = "附件名称")
+    private String name;
+
+    @ApiModelProperty(value = "附件拓展名")
+    private String extension;
+
+    @ApiModelProperty(value = "附件pdf路径")
+    private String domainPdfUrl;
+}

+ 28 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/CompensationInfo.java

@@ -1,12 +1,15 @@
 package org.springblade.land.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.springblade.core.mp.base.BaseEntity;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 
 /**
  * @Param   补偿协议表,几个补偿协议共用
@@ -51,4 +54,29 @@ public class CompensationInfo extends BaseEntity {
     @ApiModelProperty(value = "区域id")
     private Long areaId;
 
+    @DateTimeFormat(
+            pattern = "yyyy-MM-dd"
+    )
+    @JsonFormat(
+            pattern = "yyyy-MM-dd"
+    )
+    @ApiModelProperty(value = "拆迁日期")
+    private LocalDate removeDate;
+
+    @ApiModelProperty(value = "施工单位")
+    private String buildUnit;
+
+    @ApiModelProperty(value = "甲方")
+    private String partyA;
+
+    @ApiModelProperty(value = "乙方")
+    private String partyB;
+
+    @ApiModelProperty(value = "丙方")
+    private String partyC;
+
+    @ApiModelProperty(value = "是否引用0否1是")
+    private String isQuote;
+
+
 }

+ 60 - 0
blade-service-api/blade-land-api/src/main/java/org/springblade/land/entity/SettlementInterval.java

@@ -0,0 +1,60 @@
+package org.springblade.land.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+
+/**
+ * @Param 补偿周期
+ * @Author wangwl
+ * @Date 2023/10/7 11:20
+ **/
+@Data
+@TableName("l_settlement_interval")
+@EqualsAndHashCode(callSuper = true)
+public class SettlementInterval extends BaseEntity {
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+
+    @ApiModelProperty(value = "补偿类型1征地2坟地3专项")
+    private Integer type;
+
+    @ApiModelProperty(value = "期号")
+    private String number;
+
+    @DateTimeFormat(
+            pattern = "yyyy-MM-dd"
+    )
+    @JsonFormat(
+            pattern = "yyyy-MM-dd"
+    )
+    @ApiModelProperty(value = "开始时间")
+    private LocalDate startDate;
+
+    @DateTimeFormat(
+            pattern = "yyyy-MM-dd"
+    )
+    @JsonFormat(
+            pattern = "yyyy-MM-dd"
+    )
+    @ApiModelProperty(value = "结束时间")
+    private LocalDate endDate;
+
+    @DateTimeFormat(
+            pattern = "yyyy-MM-dd"
+    )
+    @JsonFormat(
+            pattern = "yyyy-MM-dd"
+    )
+    @ApiModelProperty(value = "报表打印日期")
+    private LocalDate printDate;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+}

+ 138 - 0
blade-service/blade-land/src/main/java/org/springblade/land/controller/AgreementFileController.java

@@ -0,0 +1,138 @@
+package org.springblade.land.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import lombok.SneakyThrows;
+import org.springblade.business.entity.InformationQuery;
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.FileUtil;
+import org.springblade.land.entity.AgreementFile;
+import org.springblade.land.service.IAgreementFileService;
+import org.springblade.manager.entity.TableFile;
+import org.springblade.manager.entity.WbsTreeContract;
+import org.springblade.resource.feign.CommonFileClient;
+import org.springblade.resource.feign.IOSSClient;
+import org.springblade.resource.vo.NewBladeFile;
+import org.springblade.system.cache.ParamCache;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2023/10/7 15:01
+ **/
+@RestController
+@AllArgsConstructor
+@RequestMapping("/agreementFile")
+@Api(value = "协议附件", tags = "协议附件接口")
+public class AgreementFileController {
+
+    private final IOSSClient iossClient;
+
+    private final CommonFileClient commonFileClient;
+
+    private final IAgreementFileService fileService;
+
+
+    /**
+     * 查询附件列表
+     */
+    @GetMapping("/getFileList")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "附件列表", notes = "附件列表")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "agreementId", value = "协议id", required = true)
+    })
+    public R<List<AgreementFile>> getFileList(Long agreementId) {
+        return R.data(fileService.list(new LambdaQueryWrapper<AgreementFile>().eq(AgreementFile::getAgreementId,agreementId)));
+    }
+
+
+    /**
+     * 附件上传
+     *
+     * @param file 文件
+     * @return ObjectStat
+     */
+    @SneakyThrows
+    @PostMapping("/add-buss-file")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "附件上传", notes = "附件上传")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "file", value = "附件", required = true),
+            @ApiImplicitParam(name = "agreementId", value = "协议id", required = true),
+            @ApiImplicitParam(name = "projectId", value = "项目id", required = true)
+    })
+    public R addBussFile(@RequestParam("file") MultipartFile file, Long agreementId,Long projectId) {
+
+        if (file.getSize() > 52428800L){
+           return R.fail("上传失败,文件不得大于50M");
+        }
+
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+
+        R<BladeFile> bladeFile = iossClient.addFileInfo(file);
+        BladeFile bladeFile1 = bladeFile.getData();
+        AgreementFile tableFile = new AgreementFile();
+        String fileExtension = FileUtil.getFileExtension(bladeFile1.getName()).toLowerCase();
+        tableFile.setAgreementId(agreementId);
+        tableFile.setName(file.getOriginalFilename());
+        tableFile.setDomainUrl(bladeFile1.getLink());
+        tableFile.setExtension(fileExtension);
+        tableFile.setProjectId(projectId);
+
+
+        NewBladeFile newBladeFile = new NewBladeFile();
+        if (fileExtension.contains("xlsx")) {
+            newBladeFile = this.commonFileClient.excelToPdf(file);
+            tableFile.setDomainPdfUrl(newBladeFile.getPdfUrl());
+        } else if (fileExtension.contains("xls")) {
+            newBladeFile = this.commonFileClient.excelToPdf(file);
+            tableFile.setDomainPdfUrl(newBladeFile.getPdfUrl());
+        } else if (fileExtension.contains("docx")) {
+            newBladeFile = this.commonFileClient.wordToPdf(file);
+            tableFile.setDomainPdfUrl(newBladeFile.getPdfUrl());
+        } else if (fileExtension.contains("png") || fileExtension.contains("jpg") || fileExtension.contains("webp") || fileExtension.contains("apng") ||
+                fileExtension.contains("bmp") || fileExtension.contains("jepg") || fileExtension.contains("tif") || fileExtension.contains("gif")) {
+            newBladeFile = this.commonFileClient.pngOrJpgToPdf(file);
+            tableFile.setDomainPdfUrl(newBladeFile.getPdfUrl());
+        } else if (fileExtension.contains("pdf")) {
+            tableFile.setDomainPdfUrl(bladeFile1.getLink());
+        }else {
+            return R.fail("上传失败,文件格式错误");
+        }
+
+        fileService.save(tableFile);
+        return R.success("上传成功");
+    }
+    /**
+     * 删除附件
+     */
+    @GetMapping("/delete")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "删除附件", notes = "删除附件")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "id", value = "附件id", required = true)
+    })
+    public R delete(Long id) {
+        fileService.removeById(id);
+        return R.success("删除成功");
+    }
+
+}

+ 9 - 6
blade-service/blade-land/src/main/java/org/springblade/land/controller/CompensationInfoController.java

@@ -11,6 +11,7 @@ import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 
+import org.springblade.core.tool.utils.Func;
 import org.springblade.land.entity.AgreementLinkTable;
 import org.springblade.land.entity.CompensationInfo;
 import org.springblade.land.service.ICompensationInfoService;
@@ -134,7 +135,8 @@ public class CompensationInfoController extends BladeController {
             @ApiImplicitParam(name = "areaId", value = "当前树节点id", required = true),
             @ApiImplicitParam(name = "current", value = "当前页", required = true),
             @ApiImplicitParam(name = "size", value = "每页的数量", required = true),
-            @ApiImplicitParam(name = "name", value = "搜索值", required = false),
+            @ApiImplicitParam(name = "type", value = "协议类型1征地补偿2坟地补偿3专项设施", required = true),
+            @ApiImplicitParam(name = "name", value = "搜索值", required = false)
     })
     public R<IPage<CompensationInfo>> page(Query query, CompensationInfo info)  {
         IPage<CompensationInfo> page = compensationInfoService.page(query, info);
@@ -144,11 +146,12 @@ public class CompensationInfoController extends BladeController {
     /**
      * 批量删除
      */
-    @PostMapping("/remove")
+    @GetMapping("/remove")
     @ApiOperationSupport(order = 8)
     @ApiOperation(value = "批量逻辑删除", notes = "传入ids")
-    public R remove(@ApiParam(value = "主键集合", required = true) @RequestBody List<Long> ids) {
-        compensationInfoService.remove(ids);
+    public R remove(@ApiParam(value = "主键集合", required = true)String ids) {
+        List<Long> id = Func.toLongList(ids);
+        compensationInfoService.remove(id);
         return R.success("删除成功");
     }
 
@@ -185,13 +188,13 @@ public class CompensationInfoController extends BladeController {
 //        return compensationInfoService.addCopeTab(vo);
 //    }
 
-    @PostMapping("/cope-tab")
+    @GetMapping("/cope-tab")
     @ApiOperationSupport(order = 19)
     @ApiOperation(value = "表单复制", notes = "表单复制,传入当前表id,返回协议id")
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "id", value = "当前表单的id", required = true)
     })
-    public R updateCopeTab(@RequestBody Long id) {
+    public R updateCopeTab(Long id) {
         return compensationInfoService.updateCopeTab(id);
     }
 

+ 82 - 0
blade-service/blade-land/src/main/java/org/springblade/land/controller/SettlementIntervalController.java

@@ -0,0 +1,82 @@
+package org.springblade.land.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.tool.api.R;
+import org.springblade.land.dto.SettlementIntervalDTO;
+import org.springblade.land.entity.SettlementInterval;
+import org.springblade.land.service.ISettlementIntervalService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2023/10/7 11:30
+ **/
+@RestController
+@AllArgsConstructor
+@RequestMapping("/settlementInterval")
+@Api(value = "结算周期", tags = "结算周期接口")
+public class SettlementIntervalController {
+
+    private final ISettlementIntervalService intervalService;
+
+    /**
+     * 获取周期列表
+     */
+    @GetMapping("/getList")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "获取周期列表", notes = "传入项目id和补偿类型")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
+            @ApiImplicitParam(name = "type", value = "协议类型1征地补偿2坟地补偿3专项设施", required = true),
+    })
+    public R<List<SettlementInterval>> getList(Long projectId,Integer type){
+        return R.data(intervalService.list(new LambdaQueryWrapper<SettlementInterval>()
+                .eq(SettlementInterval::getProjectId,projectId)
+                .eq(SettlementInterval::getType,type)));
+    }
+
+    /**
+     * 新增或修改周期
+     */
+    @GetMapping("/addOrUpdate")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "新增或修改周期", notes = "传入周期集合")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
+            @ApiImplicitParam(name = "type", value = "协议类型1征地补偿2坟地补偿3专项设施", required = true),
+            @ApiImplicitParam(name = "number", value = "期号", required = true),
+            @ApiImplicitParam(name = "startDate", value = "开始时间", required = true),
+            @ApiImplicitParam(name = "endDate", value = "结束时间", required = true)
+    })
+    public R addOrUpdate(@RequestBody SettlementIntervalDTO dto){
+        intervalService.addOrUpdate(dto);
+        return R.success("操作成功");
+    }
+    /**
+     * 删除周期
+     */
+    @GetMapping("/delete")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "删除周期", notes = "删除周期")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "周期id", required = true)
+    })
+    public R delete( Long id){
+        intervalService.delete(id);
+        return R.success("删除成功");
+    }
+
+
+}

+ 33 - 0
blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementFileMapper.java

@@ -0,0 +1,33 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.land.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springblade.land.entity.AgreementFile;
+import org.springblade.land.entity.SettlementInterval;
+
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-02-17
+ */
+public interface AgreementFileMapper extends BaseMapper<AgreementFile> {
+
+
+}

+ 5 - 0
blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementFileMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.land.mapper.AgreementFileMapper">
+
+</mapper>

+ 2 - 1
blade-service/blade-land/src/main/java/org/springblade/land/mapper/CompensationInfoMapper.xml

@@ -41,6 +41,7 @@
     </select>
     <select id="getTablesByUpdate" resultType="org.springblade.land.entity.AgreementLinkTable">
         select * from l_agreement_link_table where agreement_id = #{id} and is_deleted = 0
+        order by sort,id
     </select>
     <select id="getTableCount" resultType="java.lang.Integer">
         select COUNT(1) from l_agreement_link_table
@@ -48,7 +49,7 @@
     </select>
     <select id="page" resultType="org.springblade.land.entity.CompensationInfo">
         select * from l_compensation_info
-        where project_id = #{info.projectId}
+        where project_id = #{info.projectId} and is_deleted = 0 and `type` = #{info.type}
           and area_id in (select id from l_region_tree_info where is_deleted = 0 and (id = #{info.areaId} or ancestors like CONCAT(CONCAT('%', #{info.areaId}), '%')))
         <if test="info.name != null and info.name != ''">
             and name like CONCAT(CONCAT('%', #{info.name}), '%')

+ 40 - 0
blade-service/blade-land/src/main/java/org/springblade/land/mapper/SettlementIntervalMapper.java

@@ -0,0 +1,40 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.land.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.land.entity.RegionTreeInfo;
+import org.springblade.land.entity.SettlementInterval;
+import org.springblade.land.vo.RegionTreeInfoVO;
+
+import java.util.List;
+
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-02-17
+ */
+public interface SettlementIntervalMapper extends BaseMapper<SettlementInterval> {
+
+
+    Integer getAgreement(@Param("id") Long id);
+
+    void remove(@Param("id") Long id);
+}

+ 12 - 0
blade-service/blade-land/src/main/java/org/springblade/land/mapper/SettlementIntervalMapper.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.land.mapper.SettlementIntervalMapper">
+    <delete id="remove">
+        DELETE FROM l_settlement_interval WHERE id = #{id}
+    </delete>
+
+    <select id="getAgreement" resultType="java.lang.Integer">
+        select count(1) from l_clearing_agreement_info
+        where period_id = #{id}
+    </select>
+</mapper>

+ 36 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/IAgreementFileService.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.land.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.land.dto.SettlementIntervalDTO;
+import org.springblade.land.entity.AgreementFile;
+import org.springblade.land.entity.SettlementInterval;
+
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2023-02-17
+ */
+public interface IAgreementFileService extends IService<AgreementFile> {
+
+
+}

+ 40 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/ISettlementIntervalService.java

@@ -0,0 +1,40 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.land.service;
+
+
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.land.dto.SettlementIntervalDTO;
+import org.springblade.land.entity.RegionTreeInfo;
+import org.springblade.land.entity.SettlementInterval;
+import org.springblade.land.vo.RegionTreeInfoVO;
+
+import java.util.List;
+
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2023-02-17
+ */
+public interface ISettlementIntervalService extends BaseService<SettlementInterval> {
+
+    void addOrUpdate(SettlementIntervalDTO dto);
+
+    void delete(Long id);
+}

+ 25 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/AgreementFileServiceImpl.java

@@ -0,0 +1,25 @@
+package org.springblade.land.service.impl;
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.AllArgsConstructor;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.land.dto.SettlementIntervalDTO;
+import org.springblade.land.entity.AgreementFile;
+import org.springblade.land.entity.SettlementInterval;
+import org.springblade.land.mapper.AgreementFileMapper;
+import org.springblade.land.mapper.SettlementIntervalMapper;
+import org.springblade.land.service.IAgreementFileService;
+import org.springblade.land.service.ISettlementIntervalService;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+import java.util.List;
+
+@Service
+@AllArgsConstructor
+public class AgreementFileServiceImpl extends ServiceImpl<AgreementFileMapper, AgreementFile> implements IAgreementFileService {
+
+
+}

+ 27 - 2
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/CompensationInfoServiceImpl.java

@@ -75,6 +75,8 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
 
     private final IRegionTreeInfoService treeInfoService;
 
+    private final IAgreementFileService fileService;
+
 
     /**
      * 获取补偿表单
@@ -222,9 +224,14 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
         JSONObject tableInfo1 = dataArray.getJSONObject(0);
         Long id = tableInfo1.getLong("agreementId");
         Long areaId = tableInfo1.getLong("areaId");
-        List<AgreementLinkTable> linkTables = new ArrayList<>();
         //中间表tableId与dataId的映射
         Map<Long,Long> map = new HashMap<>();
+        //获取表单id与数据id的映射
+        List<AgreementLinkTable> linkTables = linkTableService.getByAgreementId(id);
+        if (linkTables == null || linkTables.size() == 0){
+            throw new ServiceException("暂无表单");
+        }
+        linkTables.stream().forEach(l->map.put(l.getTableId(),l.getTableDataId()));
 
         for (int i=0; i<dataArray.size();i++) {
             JSONObject jsonObject = dataArray.getJSONObject(i);
@@ -240,6 +247,8 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
         BigDecimal b2 = new BigDecimal(0);
         //地面附着物
         BigDecimal b3 = new BigDecimal(0);
+        //户主姓名(协议名称)
+        StringBuilder str = new StringBuilder("");
         //计算统计值
         List<WbsFormElement> elementList = baseMapper.getTableElement(linkTables.stream().map(l -> l.getTableId()).collect(Collectors.toList()));
         CompensationInfo info = new CompensationInfo();
@@ -278,6 +287,8 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
                                         b2 = b2.add(new BigDecimal(dataVO.getTabVal()));
                                     }else if (dict.equals(3)){
                                         b3 = b3.add(new BigDecimal(dataVO.getTabVal()));
+                                    }else if (dict.equals(4)){
+                                        str.append(dataVO.getTabVal()+"、");
                                     }
                                 }
                             }
@@ -286,7 +297,12 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
                         }
                     }
                 }
-                info.setName("默认值");
+                String names = str.toString();
+                if (StringUtils.isNotBlank(names)){
+                    info.setName(names.substring(0, names.length() - 1));
+                }else {
+                    info.setName("未找到用户名称");
+                }
                 info.setLandMoney(b1);
                 info.setCropsMoney(b2.add(b3));
                 info.setAllMoney(info.getLandMoney().add(info.getCropsMoney()));
@@ -727,6 +743,15 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
                 }
             }
         }
+        //附件如果有也要一起合并
+        List<AgreementFile> fileList = fileService.list(new LambdaQueryWrapper<AgreementFile>().eq(AgreementFile::getAgreementId, agreementId));
+        if (fileList != null && fileList.size() != 0){
+            for (AgreementFile file : fileList) {
+                if (StringUtils.isNotBlank(file.getDomainPdfUrl())){
+                    data.add(file.getDomainPdfUrl());
+                }
+            }
+        }
         String listPdf = file_path + "/pdf/" + agreementId + ".pdf";
         File tabpdf2 = ResourceUtil.getFile(listPdf);
         if (tabpdf2.exists()) {

+ 77 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/SettlementIntervalServiceImpl.java

@@ -0,0 +1,77 @@
+package org.springblade.land.service.impl;
+
+
+import lombok.AllArgsConstructor;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.land.dto.SettlementIntervalDTO;
+import org.springblade.land.entity.RegionTreeInfo;
+import org.springblade.land.entity.SettlementInterval;
+import org.springblade.land.mapper.RegionTreeInfoMapper;
+import org.springblade.land.mapper.SettlementIntervalMapper;
+import org.springblade.land.service.IRegionTreeInfoService;
+import org.springblade.land.service.ISettlementIntervalService;
+import org.springblade.land.utils.ForestNodeMerger;
+import org.springblade.land.vo.RegionTreeInfoVO;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+@AllArgsConstructor
+public class SettlementIntervalServiceImpl extends BaseServiceImpl<SettlementIntervalMapper, SettlementInterval> implements ISettlementIntervalService {
+
+
+    /**
+     * 新增或修改周期
+     * @param dto
+     */
+    @Override
+    public void addOrUpdate(SettlementIntervalDTO dto) {
+        List<SettlementInterval> list = dto.getList();
+        if (list == null || list.size() == 0){
+            return;
+        }
+        //上一结束日期
+        LocalDate lastDate = null;
+        //校验时间,日期不能为空,开始日期不能小于结束日期,下一周期开始时间要根据上一周期结束时间
+        for (SettlementInterval interval : list) {
+            if (interval.getType() == null){
+                throw new ServiceException("协议类型不能为空");
+            }
+            if (interval.getNumber() == null){
+                throw new ServiceException("期号不能为空");
+            }
+            if (interval.getStartDate() == null || interval.getEndDate() == null){
+                throw new ServiceException("日期不能为空");
+            }
+            if (!interval.getStartDate().isBefore(interval.getEndDate())){
+                throw new ServiceException("结束时间不能小于等于开始时间");
+            }
+            if (lastDate != null) {
+                if (!lastDate.plusDays(1).equals(interval.getStartDate())) {
+                    throw new ServiceException("下一周期开始时间要根据上一周期结束时间多一天");
+                }
+            }
+            lastDate = interval.getEndDate();
+        }
+        //批量新增或修改
+        this.saveOrUpdateBatch(list);
+    }
+
+    /**
+     * 删除周期
+     * @param id
+     */
+    @Override
+    public void delete(Long id) {
+        //获取当前周期的结算协议,如果为0允许删除
+        Integer total = baseMapper.getAgreement(id);
+        if (total > 0){
+            throw new ServiceException("当前周期已使用不能删除");
+        }
+        baseMapper.remove(id);
+    }
+}