Przeglądaj źródła

Merge remote-tracking branch 'origin/master' into master

yangyj 1 rok temu
rodzic
commit
ebddb2c36c
25 zmienionych plików z 925 dodań i 198 usunięć
  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. 2 2
      blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml
  6. 13 8
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java
  7. 138 0
      blade-service/blade-land/src/main/java/org/springblade/land/controller/AgreementFileController.java
  8. 59 47
      blade-service/blade-land/src/main/java/org/springblade/land/controller/CompensationInfoController.java
  9. 82 0
      blade-service/blade-land/src/main/java/org/springblade/land/controller/SettlementIntervalController.java
  10. 33 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementFileMapper.java
  11. 5 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementFileMapper.xml
  12. 5 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementLinkTableMapper.java
  13. 15 1
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementLinkTableMapper.xml
  14. 2 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/CompensationInfoMapper.java
  15. 6 1
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/CompensationInfoMapper.xml
  16. 40 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/SettlementIntervalMapper.java
  17. 12 0
      blade-service/blade-land/src/main/java/org/springblade/land/mapper/SettlementIntervalMapper.xml
  18. 36 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/IAgreementFileService.java
  19. 4 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/IAgreementLinkTableService.java
  20. 9 5
      blade-service/blade-land/src/main/java/org/springblade/land/service/ICompensationInfoService.java
  21. 40 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/ISettlementIntervalService.java
  22. 25 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/AgreementFileServiceImpl.java
  23. 18 0
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/AgreementLinkTableServiceImpl.java
  24. 143 134
      blade-service/blade-land/src/main/java/org/springblade/land/service/impl/CompensationInfoServiceImpl.java
  25. 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;
+}

+ 2 - 2
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml

@@ -465,7 +465,7 @@
         from m_archive_tree_contract matc left join u_archives_auto uaa on matc.id = uaa.node_id
         where uaa.is_deleted = 0 and uaa.is_archive = 1
         <if test="vo.queryValue != null and vo.queryValue != ''">
-            and uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%')
+            and (uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%'))
         </if>
         <if test="vo.projectId != null and vo.projectId != ''">
             and matc.project_id = #{vo.projectId}
@@ -570,7 +570,7 @@
         ) matc left join u_archives_auto uaa on matc.id = uaa.node_id
         where uaa.is_deleted = 0 and uaa.is_archive = 1
         <if test="vo.queryValue != null and vo.queryValue != ''">
-            and uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%')
+            and (uaa.name like concat('%',#{vo.queryValue},'%') or uaa.file_number like concat('%',#{vo.queryValue},'%'))
         </if>
         <if test="vo.contractId != null and vo.contractId != ''">
             and uaa.contract_id = #{vo.contractId}

+ 13 - 8
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -577,23 +577,28 @@ public class TaskController extends BladeController {
                     //通过checkArchiveTaskUserByCurrent检查,说明当前登陆用户是该条任务的审批人,修改审批任务状态
                     Task task = jdbcTemplate.queryForObject("select process_instance_id,form_data_id from u_task where id = " + taskArchiveDTO.getTaskId(), new BeanPropertyRowMapper<>(Task.class));
                     if (task != null) {
+                        //TODO ============ 档案电签推送(每个人都要电签,按照顺序) ============
+                        org.springblade.evisa.vo.TaskArchiveDTO eVisaObj = new org.springblade.evisa.vo.TaskArchiveDTO();
+                        BeanUtils.copyProperties(taskArchiveDTO, eVisaObj);
+                        eVisaObj.setType(1); //审批
+                        try {
+                            this.eVisaClient.eVisaCustom(eVisaObj);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            throw new ServiceException("电签失败,原因:" + e.getMessage());
+                        }
+
                         //获取审批任务关联用户的详情
                         List<TaskParallel> taskParallels = jdbcTemplate.query("select id,process_instance_id,task_user,task_user_name from u_task_parallel where process_instance_id = '" + task.getProcessInstanceId() + "'", new BeanPropertyRowMapper<>(TaskParallel.class));
                         if (taskParallels.size() > 0) {
                             //当前用户任务
                             TaskParallel taskParallelCurrentUser = taskParallels.stream().filter(f -> f.getTaskUser().equals(SecureUtil.getUserId().toString())).findAny().orElse(null);
                             if (taskParallelCurrentUser != null) {
-                                //修改当前用户任务为已审批
-                                jdbcTemplate.execute("update u_task_parallel set status = 2 where id = " + taskParallelCurrentUser.getId());
+                                //修改当前用户任务为已审批、电签任务状态为成功
+                                jdbcTemplate.execute("update u_task_parallel set status = 2,e_visa_status = 1 where id = " + taskParallelCurrentUser.getId());
                             }
                         }
 
-                        //TODO ============ 档案电签推送(每个人都要电签,按照顺序) ============
-                        org.springblade.evisa.vo.TaskArchiveDTO eVisaObj = new org.springblade.evisa.vo.TaskArchiveDTO();
-                        BeanUtils.copyProperties(taskArchiveDTO, eVisaObj);
-                        eVisaObj.setType(1); //审批
-                        this.eVisaClient.eVisaCustom(eVisaObj);
-
                         //获取最新任务状态,判断是否存在未完成的审批任务(最后一个人审批完成);如果没有就闭环,修改审批任务状态、业务数据状态
                         List<TaskParallel> taskParallelsNow = jdbcTemplate.query("select status from u_task_parallel where process_instance_id = '" + task.getProcessInstanceId() + "'", new BeanPropertyRowMapper<>(TaskParallel.class));
                         List<TaskParallel> pendingApprovalTask = taskParallelsNow.stream().filter(f -> f.getStatus() != 2).collect(Collectors.toList());

+ 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("删除成功");
+    }
+
+}

+ 59 - 47
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;
@@ -36,26 +37,28 @@ public class CompensationInfoController extends BladeController {
 
     private final ICompensationInfoService compensationInfoService;
 
+
     /**
-     * 新增时获取补偿协议表单
+     * 新增协议
      */
-    @GetMapping("addGetTables")
+    @GetMapping("/add")
     @ApiOperationSupport(order = 1)
-    @ApiOperation(value = "新增获取补偿协议表单", notes = "传入项目id和协议类型1征地补偿2坟地补偿3专项设施")
+    @ApiOperation(value = "新增协议", notes = "返回协议id")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
+            @ApiImplicitParam(name = "areaId", value = "当前树节点id", required = true),
             @ApiImplicitParam(name = "type", value = "协议类型1征地补偿2坟地补偿3专项设施", required = true)
     })
-    public R<List<WbsTreePrivate>> addGetTables(Long projectId,Integer type){
-        return R.data(compensationInfoService.getTables(projectId,type));
+    public R<Long> add(Long projectId,Long areaId,Integer type){
+        return R.data(compensationInfoService.add(projectId,areaId,type));
     }
 
     /**
-     * 修改时获取补偿协议表单
+     * 获取补偿协议表单
      */
     @GetMapping("updateGetTables")
     @ApiOperationSupport(order = 2)
-    @ApiOperation(value = "修改获取补偿协议表单", notes = "传入协议id")
+    @ApiOperation(value = "获取补偿协议表单", notes = "传入协议id")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "agreementId", value = "协议id", required = true),
     })
@@ -71,11 +74,10 @@ public class CompensationInfoController extends BladeController {
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "协议表单-生成html", notes = "协议表单-生成html")
     @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "pkeyId", value = "新增传pkeyId,编辑传id", required = true),
-            @ApiImplicitParam(name = "type", value = "新增1编辑2", required = true)
+            @ApiImplicitParam(name = "id", value = "当前表单id", required = true)
     })
-    public R getExcelHtmlByBuss(Long pkeyId,Integer type) throws Exception {
-        return compensationInfoService.getExcelHtmlByBuss(pkeyId,type);
+    public R getExcelHtmlByBuss(Long id) throws Exception {
+        return compensationInfoService.getExcelHtmlByBuss(id);
     }
 
 
@@ -86,11 +88,10 @@ public class CompensationInfoController extends BladeController {
     @ApiOperationSupport(order = 4)
     @ApiOperation(value = "协议表单-获取坐标位置", notes = "协议表单-获取坐标位置")
     @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "pkeyId", value = "当前表单pkeyId", required = true),
-            @ApiImplicitParam(name = "type", value = "新增1编辑2", required = true)
+            @ApiImplicitParam(name = "id", value = "当前表单id", required = true)
     })
-    public R getHtmlBussCols(Long pkeyId,Integer type) throws Exception {
-        return compensationInfoService.getHtmlBussCols(pkeyId,type);
+    public R getHtmlBussCols(Long id) throws Exception {
+        return compensationInfoService.getHtmlBussCols(id);
     }
 
     /**
@@ -100,10 +101,10 @@ public class CompensationInfoController extends BladeController {
     @ApiOperationSupport(order = 5)
     @ApiOperation(value = "协议表单-获取用户保存数据", notes = "协议表单-获取用户保存数据")
     @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "linkId", value = "当前表单的id,新增的传null", required = true),
+            @ApiImplicitParam(name = "id", value = "当前表单的id", required = true),
     })
-    public R getBussDataInfo(Long linkId) throws FileNotFoundException {
-        return compensationInfoService.getBussDataInfo(linkId);
+    public R getBussDataInfo(Long id) throws FileNotFoundException {
+        return compensationInfoService.getBussDataInfo(id);
     }
 
     /**
@@ -117,11 +118,10 @@ public class CompensationInfoController extends BladeController {
     @ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存,返回当前协议id")
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
-            @ApiImplicitParam(name = "agreementId", value = "协议的id,新增协议为null", required = false),
-            @ApiImplicitParam(name = "linkId", value = "当前表单的id,新增协议为null", required = false),
+            @ApiImplicitParam(name = "agreementId", value = "协议的id,修改时放的agreementId", required = true),
+            @ApiImplicitParam(name = "linkId", value = "当前表单的id,修改时返回的id", required = true),
             @ApiImplicitParam(name = "areaId", value = "当前树节点id", required = true),
-            @ApiImplicitParam(name = "tableId", value = "表单的tableId", required = true),
-            @ApiImplicitParam(name = "nodeType", value = "新增返回的nodeType,修改传null", required = false)
+            @ApiImplicitParam(name = "tableId", value = "表单的tableId", required = true)
     })
     public R saveBussData(@Valid @RequestBody JSONObject dataInfo) throws Exception {
         return compensationInfoService.saveBussData(dataInfo);
@@ -129,61 +129,73 @@ public class CompensationInfoController extends BladeController {
 
     @GetMapping("/page")
     @ApiOperationSupport(order = 7)
-    @ApiOperation(value = "单表pdf预览", notes = "单表pdf预览")
+    @ApiOperation(value = "分页查询补偿协议", notes = "分页查询补偿协议")
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
             @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);
         return R.data(page);
     }
 
+    /**
+     * 批量删除
+     */
+    @GetMapping("/remove")
+    @ApiOperationSupport(order = 8)
+    @ApiOperation(value = "批量逻辑删除", notes = "传入ids")
+    public R remove(@ApiParam(value = "主键集合", required = true)String ids) {
+        List<Long> id = Func.toLongList(ids);
+        compensationInfoService.remove(id);
+        return R.success("删除成功");
+    }
+
     @GetMapping("/get-buss-pdfInfo")
     @ApiOperationSupport(order = 18)
     @ApiOperation(value = "单表pdf预览", notes = "单表pdf预览")
     @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "agreementId", value = "协议的id,新增的传null", required = true),
-            @ApiImplicitParam(name = "tableId", value = "表单的tableId", required = true)
+            @ApiImplicitParam(name = "id", value = "当前表单的id", required = true)
     })
-    public R getBussPdfDataInfo(Long agreementId,Long tableId)  {
-        return compensationInfoService.getBussPdfDataInfo(agreementId,tableId);
+    public R getBussPdfDataInfo(Long id)  {
+        return compensationInfoService.getBussPdfDataInfo(id);
     }
 
     @GetMapping("/get-buss-pdfs")
     @ApiOperationSupport(order = 21)
     @ApiOperation(value = "多表预览", notes = "多表预览")
     @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "agreementId", value = "协议的id,新增的传null", required = true),
+            @ApiImplicitParam(name = "agreementId", value = "协议的id", required = true),
     })
     public R getPdfS(Long agreementId) {
         return compensationInfoService.getPdfS(agreementId);
     }
 
-    @PostMapping("/add-cope-tab")
-    @ApiOperationSupport(order = 19)
-    @ApiOperation(value = "表单新增复制", notes = "表单新增复制,,返回协议id")
-    @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
-            @ApiImplicitParam(name = "areaId", value = "当前树节点id", required = true),
-            @ApiImplicitParam(name = "tableId", value = "表单的tableId", required = true),
-            @ApiImplicitParam(name = "nodeType", value = "新增返回的nodeType", required = true)
-    })
-    public R addCopeTab(@RequestBody TableCopyVO vo) {
-        return compensationInfoService.addCopeTab(vo);
-    }
-
-    @PostMapping("/update-cope-tab")
+//    @PostMapping("/add-cope-tab")
+//    @ApiOperationSupport(order = 19)
+//    @ApiOperation(value = "表单新增复制", notes = "表单新增复制,,返回协议id")
+//    @ApiImplicitParams(value = {
+//            @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
+//            @ApiImplicitParam(name = "areaId", value = "当前树节点id", required = true),
+//            @ApiImplicitParam(name = "tableId", value = "表单的tableId", required = true),
+//            @ApiImplicitParam(name = "nodeType", value = "新增返回的nodeType", required = true)
+//    })
+//    public R addCopeTab(@RequestBody TableCopyVO vo) {
+//        return compensationInfoService.addCopeTab(vo);
+//    }
+
+    @GetMapping("/cope-tab")
     @ApiOperationSupport(order = 19)
-    @ApiOperation(value = "表单修改复制", notes = "表单修改复制,,返回协议id")
+    @ApiOperation(value = "表单复制", notes = "表单复制,传入当前表id,返回协议id")
     @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "linkId", value = "当前表单的id,新增协议为null", required = true)
+            @ApiImplicitParam(name = "id", value = "当前表单的id", required = true)
     })
-    public R updateCopeTab(@RequestBody TableCopyVO vo) {
-        return compensationInfoService.updateCopeTab(vo);
+    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>

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

@@ -23,6 +23,8 @@ import org.springblade.land.dto.PolicyInfoSearchDTO;
 import org.springblade.land.entity.AgreementLinkTable;
 import org.springblade.land.entity.PolicyInfo;
 
+import java.util.List;
+
 
 /**
  *  Mapper 接口
@@ -33,4 +35,7 @@ import org.springblade.land.entity.PolicyInfo;
 public interface AgreementLinkTableMapper extends BaseMapper<AgreementLinkTable> {
 
 
+    void deleteTableData(@Param("ids") List<Long> ids);
+
+    void deleteByAgreementIds(@Param("ids") List<Long> ids);
 }

+ 15 - 1
blade-service/blade-land/src/main/java/org/springblade/land/mapper/AgreementLinkTableMapper.xml

@@ -3,5 +3,19 @@
 <mapper namespace="org.springblade.land.mapper.AgreementLinkTableMapper">
 
 
-
+    <delete id="deleteTableData">
+        delete from table_data_info
+        where p_key_id in
+              (select table_data_id from l_agreement_link_table where agreement_id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>)
+    </delete>
+    <delete id="deleteByAgreementIds">
+        delete from l_agreement_link_table
+        where agreement_id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
 </mapper>

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

@@ -65,4 +65,6 @@ public interface CompensationInfoMapper extends BaseMapper<CompensationInfo> {
     Integer getTableCount(@Param("agreementId") Long agreementId,@Param("tableId") Long tableId);
 
     IPage<CompensationInfo> page(IPage<CompensationInfo> iPage,@Param("info") CompensationInfo info);
+
+    Integer getNumber(@Param("areaId") Long areaId);
 }

+ 6 - 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,12 +49,16 @@
     </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}), '%')
         </if>
     </select>
+    <select id="getNumber" resultType="java.lang.Integer">
+        select count(1)
+        from l_compensation_info where area_id = #{areaId}
+    </select>
 
 
 </mapper>

+ 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> {
+
+
+}

+ 4 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/IAgreementLinkTableService.java

@@ -39,4 +39,8 @@ public interface IAgreementLinkTableService extends BaseService<AgreementLinkTab
 
 
     List<AgreementLinkTable> getByAgreementId(Long id);
+
+    void deleteTableData(List<Long> ids);
+
+    void deleteByAgreementIds(List<Long> ids);
 }

+ 9 - 5
blade-service/blade-land/src/main/java/org/springblade/land/service/ICompensationInfoService.java

@@ -45,23 +45,27 @@ public interface ICompensationInfoService extends BaseService<CompensationInfo>
 
     List<WbsTreePrivate> getTables(Long projectId, Integer type);
 
-    R getExcelHtmlByBuss(Long pkeyId,Integer type) throws Exception;
+    R getExcelHtmlByBuss(Long id) throws Exception;
 
-    R getHtmlBussCols(Long pkeyId,Integer type) throws Exception;
+    R getHtmlBussCols(Long id) throws Exception;
 
     R getBussDataInfo(Long linkId);
 
     R saveBussData(JSONObject dataInfo) throws Exception;
 
-    R getBussPdfDataInfo(Long agreementId, Long tableId);
+    R getBussPdfDataInfo(Long id);
 
     List<AgreementLinkTable> updateGetTables(Long agreementId);
 
     R getPdfS(Long agreementId);
 
-    R addCopeTab(TableCopyVO vo);
+//    R addCopeTab(TableCopyVO vo);
 
-    R updateCopeTab(TableCopyVO vo);
+    R updateCopeTab(Long id);
 
     IPage<CompensationInfo> page (Query query,CompensationInfo info);
+
+    Long add(Long projectId, Long areaId, Integer type);
+
+    void remove(List<Long> ids);
 }

+ 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 {
+
+
+}

+ 18 - 0
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/AgreementLinkTableServiceImpl.java

@@ -44,4 +44,22 @@ public class AgreementLinkTableServiceImpl extends BaseServiceImpl<AgreementLink
         return baseMapper.selectList(new LambdaQueryWrapper<AgreementLinkTable>()
                             .eq(AgreementLinkTable::getAgreementId,id));
     }
+
+    /**
+     * 删除表单填报的数据,根据补偿协议id
+     * @param ids
+     */
+    @Override
+    public void deleteTableData(List<Long> ids) {
+        baseMapper.deleteTableData(ids);
+    }
+
+    /**
+     * 删除中间表的数据,根据补偿协议id
+     * @param ids
+     */
+    @Override
+    public void deleteByAgreementIds(List<Long> ids) {
+        baseMapper.deleteByAgreementIds(ids);
+    }
 }

+ 143 - 134
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;
+
 
     /**
      * 获取补偿表单
@@ -91,30 +93,14 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
      * 协议表单 获取html接口
      */
     @Override
-    public R getExcelHtmlByBuss(Long pkeyId,Integer type) throws Exception {
+    public R getExcelHtmlByBuss(Long id) throws Exception {
         //获取表单信息
-        String fileUrl = "";
-        Long projectId = null;
-        if (type == 1) {
-            WbsTreePrivate wbsTreePrivate = baseMapper.getWbsPrivateTable(pkeyId);
-            if (wbsTreePrivate == null) {
-                return R.fail("该数据下无此节点!");
-            }
-            if (wbsTreePrivate.getHtmlUrl() == null) {
-                return R.fail("暂无表单!");
-            }
-            fileUrl = wbsTreePrivate.getHtmlUrl();
-            projectId = Long.parseLong(wbsTreePrivate.getProjectId());
-        }else if (type == 2){
-            AgreementLinkTable table = linkTableService.getById(pkeyId);
-            fileUrl = table.getHtmlUrl();
-            projectId = table.getProjectId();
-        }
+        AgreementLinkTable linkTable = linkTableService.getById(id);
 //        fileUrl = "C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1704045947043971072.html";
-        if (StringUtils.isBlank(fileUrl)){
+        if (StringUtils.isBlank(linkTable.getHtmlUrl())){
             return R.fail("没有获取到表单!");
         }
-        InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
+        InputStream fileInputStream = FileUtils.getInputStreamByUrl(linkTable.getHtmlUrl());
 
         String htmlString = IoUtil.readToString(fileInputStream);
         htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
@@ -124,7 +110,7 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
         Document doc = Jsoup.parse(htmlString);
         Element table = doc.select("table").first();
         // 添加标题显示
-        ProjectInfo projectInfo = baseMapper.getProjectInfo(projectId);
+        ProjectInfo projectInfo = baseMapper.getProjectInfo(linkTable.getProjectId());
         Elements trs = table.select("tr");
         for (int i = 1; i < 6; i++) {
             Element tr = trs.get(i);
@@ -149,24 +135,12 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
      * 协议表单 获取坐标位置
      */
     @Override
-    public R getHtmlBussCols(Long pkeyId,Integer type) throws Exception {
+    public R getHtmlBussCols(Long id) throws Exception {
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
         //获取表单信息
-        String fileUrl = "";
-        if (type == 1) {
-            WbsTreePrivate wbsTreePrivate = baseMapper.getWbsPrivateTable(pkeyId);
-            if (wbsTreePrivate == null) {
-                return R.fail("该数据下无此节点!");
-            }
-            if (wbsTreePrivate.getHtmlUrl() == null) {
-                return R.fail("暂无表单!");
-            }
-            fileUrl = wbsTreePrivate.getHtmlUrl();
-        }else if (type == 2){
-            AgreementLinkTable table = linkTableService.getById(pkeyId);
-            fileUrl = table.getHtmlUrl();
-        }
+        AgreementLinkTable linkTable = linkTableService.getById(id);
+        String fileUrl = linkTable.getHtmlUrl();
         if (StringUtils.isBlank(fileUrl)){
             return R.fail("没有获取到表单!");
         }
@@ -221,10 +195,6 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
      */
     @Override
     public R getBussDataInfo(Long linkId) {
-        //当前是新增没有数据
-        if (linkId == null){
-            return R.data(null);
-        }
         Map<String, Object> reData = new HashMap<>();
         //获取表单数据
         List<Map<String, Object>> mapList = baseMapper.getBussDataInfo(linkId);
@@ -253,52 +223,20 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
         }
         JSONObject tableInfo1 = dataArray.getJSONObject(0);
         Long id = tableInfo1.getLong("agreementId");
-        Long projectId = tableInfo1.getLong("projectId");
         Long areaId = tableInfo1.getLong("areaId");
-        Integer nodeType = tableInfo1.getInteger("nodeType");
-        Boolean isUpdate = true;
-        List<AgreementLinkTable> linkTables = new ArrayList<>();
         //中间表tableId与dataId的映射
         Map<Long,Long> map = new HashMap<>();
-        //中间表tableId与linkId的映射
-        Map<Long,Long> map2 = new HashMap<>();
-        if (id == null){
-            Long agreeId = SnowFlakeUtil.getId();
-            isUpdate = false;
-            //新增建立协议与表单映射,新增复制时会直接在复制接口创建
-            List<WbsTreePrivate> tables = baseMapper.getTables(projectId, nodeType);
-            linkTables = tables.stream().map(l -> {
-                AgreementLinkTable table = new AgreementLinkTable();
-                table.setTableId(Long.parseLong(l.getInitTableId()));
-                table.setProjectId(projectId);
-                table.setTableDataId(SnowFlakeUtil.getId());
-                table.setId(SnowFlakeUtil.getId());
-                table.setAgreementId(agreeId);
-                table.setPrivateId(l.getId());
-                table.setSort(l.getSort());
-                table.setExcelId(l.getExcelId());
-                table.setHtmlUrl(l.getHtmlUrl());
-                table.setTableName(l.getNodeName());
-                map.put(table.getTableId(),table.getTableDataId());
-                map2.put(table.getTableId(),table.getId());
-                return table;
-            }).collect(Collectors.toList());
-            linkTableService.saveBatch(linkTables);
-            id = agreeId;
-        }else {
-            //获取表单id与数据id的映射
-            linkTables = linkTableService.getByAgreementId(id);
-            linkTables.stream().forEach(l->map.put(l.getTableId(),l.getTableDataId()));
+        //获取表单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);
-            if (isUpdate){
-                //是修改,就先去删除原来保存的数据
-                baseMapper.deleteOldData(jsonObject.getLong("linkId"));
-            }else {
-                //新增时没有linkId,需要手动设置
-                jsonObject.put("linkId",map2.get(jsonObject.getLong("tableId")));
-            }
+            //删除原来保存的数据
+            baseMapper.deleteOldData(jsonObject.getLong("linkId"));
             this.SaveOneTabInfo(jsonObject);
         }
         //合并PDF
@@ -309,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();
@@ -316,9 +256,6 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
         //获取当前节点名称
         RegionTreeInfo treeInfo = treeInfoService.getById(areaId);
         info.setNumber(treeInfo.getAreaName()+"默认编号");
-        info.setAreaId(areaId);
-        info.setProjectId(projectId);
-        info.setType(nodeType);
         if (elementList == null || elementList.size() == 0){
             info.setName("未找到用户名称");
             info.setLandMoney(b1);
@@ -350,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()+"、");
                                     }
                                 }
                             }
@@ -358,27 +297,25 @@ 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()));
             }
         }
         //保存协议信息
-        if (isUpdate){
-            this.updateById(info);
-        }else {
-            this.save(info);
-        }
-
-        return R.data(200,id,"保存成功");
+        this.updateById(info);
+        return R.success("保存成功");
     }
 
     @Override
-    public R getBussPdfDataInfo(Long agreementId, Long tableId) {
-        AgreementLinkTable one = linkTableService.getOne(new LambdaQueryWrapper<AgreementLinkTable>()
-                .eq(AgreementLinkTable::getAgreementId, agreementId)
-                .eq(AgreementLinkTable::getTableDataId, tableId));
+    public R getBussPdfDataInfo(Long id) {
+        AgreementLinkTable one = linkTableService.getById(id);
         if (one == null){
             throw new ServiceException("未查询到表单,请联系管理员");
         }
@@ -405,9 +342,6 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
      */
     @Override
     public R getPdfS(Long agreementId) {
-        if (agreementId == null){
-            throw new ServiceException("当前节点还未保存过");
-        }
         CompensationInfo info = this.getById(agreementId);
         if (info == null || StringUtils.isBlank(info.getMergePdfUrl())){
             throw new ServiceException("当前节点还未保存过");
@@ -415,18 +349,86 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
         return R.data(info.getMergePdfUrl());
     }
 
+//    @Override
+//    @Transactional
+//    public R addCopeTab(TableCopyVO vo) {
+//        //新增复制
+//        Long agreeId = SnowFlakeUtil.getId();
+//        //先新增协议,再复制
+//        List<WbsTreePrivate> tables = baseMapper.getTables(vo.getProjectId(), vo.getNodeType());
+//        Map<Long,Long> map = new HashMap<>();
+//        List<AgreementLinkTable> linkTables = tables.stream().map(l -> {
+//            AgreementLinkTable table = new AgreementLinkTable();
+//            table.setTableId(Long.parseLong(l.getInitTableId()));
+//            table.setProjectId(vo.getProjectId());
+//            table.setTableDataId(SnowFlakeUtil.getId());
+//            table.setId(SnowFlakeUtil.getId());
+//            table.setAgreementId(agreeId);
+//            table.setPrivateId(l.getId());
+//            table.setSort(l.getSort());
+//            table.setExcelId(l.getExcelId());
+//            table.setHtmlUrl(l.getHtmlUrl());
+//            table.setTableName(l.getNodeName());
+//            map.put(Long.parseLong(l.getInitTableId()),table.getId());
+//            return table;
+//        }).collect(Collectors.toList());
+//        linkTableService.saveBatch(linkTables);
+//        vo.setLinkId(map.get(vo.getTableId()));
+//        this.updateCopeTab(vo);
+//        //保存协议
+//        CompensationInfo info = new CompensationInfo();
+//        info.setId(agreeId);
+//        info.setName("默认名称");
+//        //获取当前节点名称
+//        RegionTreeInfo treeInfo = treeInfoService.getById(vo.getAreaId());
+//        info.setNumber(treeInfo.getAreaName()+"默认编号");
+//        info.setAreaId(vo.getAreaId());
+//        info.setProjectId(vo.getProjectId());
+//        info.setType(vo.getNodeType());
+//        info.setLandMoney(new BigDecimal(0));
+//        info.setCropsMoney(new BigDecimal(0));
+//        info.setAllMoney(new BigDecimal(0));
+//        this.save(info);
+//        return R.data(200,agreeId,"复制成功");
+//    }
+
+    /**
+     * 修改复制表单
+     * @param id
+     * @return
+     */
     @Override
-    @Transactional
-    public R addCopeTab(TableCopyVO vo) {
+    public R updateCopeTab(Long id) {
+        AgreementLinkTable linkTable = linkTableService.getById(id);
+        AgreementLinkTable table = new AgreementLinkTable();
+        BeanUtils.copyProperties(linkTable,table);
+        table.setId(null);
+        table.setTableDataId(SnowFlakeUtil.getId());
+        table.setPdfUrl(null);
+        //获取复制表单存在的数量
+        Integer count = baseMapper.getTableCount(table.getAgreementId(), table.getTableId());
+        String[] s = table.getTableName().split("__");
+        table.setTableName(s[0]+"__"+ count);
+        linkTableService.save(table);
+        return R.data(200,linkTable.getAgreementId(),"复制成功");
+    }
+
+    @Override
+    public IPage<CompensationInfo> page(Query query, CompensationInfo info) {
+        IPage<CompensationInfo> iPage = new Page<>(query.getCurrent(),query.getSize());
+        return baseMapper.page(iPage,info);
+    }
+
+    @Override
+    public Long add(Long projectId, Long areaId, Integer type) {
         //新增复制
         Long agreeId = SnowFlakeUtil.getId();
-        //先新增协议,再复制
-        List<WbsTreePrivate> tables = baseMapper.getTables(vo.getProjectId(), vo.getNodeType());
-        Map<Long,Long> map = new HashMap<>();
+        //先新增中间表,再复制
+        List<WbsTreePrivate> tables = baseMapper.getTables(projectId, type);
         List<AgreementLinkTable> linkTables = tables.stream().map(l -> {
             AgreementLinkTable table = new AgreementLinkTable();
             table.setTableId(Long.parseLong(l.getInitTableId()));
-            table.setProjectId(vo.getProjectId());
+            table.setProjectId(projectId);
             table.setTableDataId(SnowFlakeUtil.getId());
             table.setId(SnowFlakeUtil.getId());
             table.setAgreementId(agreeId);
@@ -435,54 +437,52 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
             table.setExcelId(l.getExcelId());
             table.setHtmlUrl(l.getHtmlUrl());
             table.setTableName(l.getNodeName());
-            map.put(Long.parseLong(l.getInitTableId()),table.getId());
             return table;
         }).collect(Collectors.toList());
         linkTableService.saveBatch(linkTables);
-        vo.setLinkId(map.get(vo.getTableId()));
-        this.updateCopeTab(vo);
-        //保存协议
+        //再保存协议
         CompensationInfo info = new CompensationInfo();
         info.setId(agreeId);
         info.setName("默认名称");
         //获取当前节点名称
-        RegionTreeInfo treeInfo = treeInfoService.getById(vo.getAreaId());
-        info.setNumber(treeInfo.getAreaName()+"默认编号");
-        info.setAreaId(vo.getAreaId());
-        info.setProjectId(vo.getProjectId());
-        info.setType(vo.getNodeType());
+        RegionTreeInfo treeInfo = treeInfoService.getById(areaId);
+        //获取编号
+        String num = getNumber(areaId);
+        info.setNumber(treeInfo.getAreaName()+num);
+        info.setAreaId(areaId);
+        info.setProjectId(projectId);
+        info.setType(type);
         info.setLandMoney(new BigDecimal(0));
         info.setCropsMoney(new BigDecimal(0));
         info.setAllMoney(new BigDecimal(0));
         this.save(info);
-        return R.data(200,agreeId,"复制成功");
+        return agreeId;
     }
 
     /**
-     * 修改复制表单
-     * @param vo
-     * @return
+     * 批量删除
+     * @param ids
      */
     @Override
-    public R updateCopeTab(TableCopyVO vo) {
-        AgreementLinkTable linkTable = linkTableService.getById(vo.getLinkId());
-        AgreementLinkTable table = new AgreementLinkTable();
-        BeanUtils.copyProperties(linkTable,table);
-        table.setId(null);
-        table.setTableDataId(SnowFlakeUtil.getId());
-        table.setPdfUrl(null);
-        //获取复制表单存在的数量
-        Integer count = baseMapper.getTableCount(table.getAgreementId(), table.getTableId());
-        String[] s = table.getTableName().split("__");
-        table.setTableName(s[0]+"__"+ count);
-        linkTableService.save(table);
-        return R.data(200,linkTable.getAgreementId(),"复制成功");
+    @Transactional
+    public void remove(List<Long> ids) {
+        //先删除表单数据
+        linkTableService.deleteTableData(ids);
+        //再删除中间表数据
+        linkTableService.deleteByAgreementIds(ids);
+        //最后删除补偿协议
+        this.deleteLogic(ids);
     }
 
-    @Override
-    public IPage<CompensationInfo> page(Query query, CompensationInfo info) {
-        IPage<CompensationInfo> iPage = new Page<>(query.getCurrent(),query.getSize());
-        return baseMapper.page(iPage,info);
+    //获取当前节点的补偿编号
+    private String getNumber(Long areaId) {
+        Integer number = baseMapper.getNumber(areaId);
+        number++;
+        if (number < 10){
+            return "0"+number;
+        }else {
+            return number + "";
+        }
     }
 
     // 保存单表
@@ -743,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);
+    }
+}