소스 검색

Merge remote-tracking branch 'origin/master'

liuyc 1 년 전
부모
커밋
576f4b20a9

+ 21 - 10
blade-service/blade-land/src/main/java/org/springblade/land/controller/ClearingAgreementInfoController.java

@@ -2,13 +2,11 @@ package org.springblade.land.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 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 io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 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.ClearingAgreementInfo;
 import org.springblade.land.entity.CompensationInfo;
@@ -38,7 +36,7 @@ public class ClearingAgreementInfoController {
      */
     @GetMapping("/addOrUpdate")
     @ApiOperationSupport(order = 1)
-    @ApiOperation(value = "新增结算协议", notes = "新增结算协议")
+    @ApiOperation(value = "新增或修改结算协议", notes = "新增或修改结算协议")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
             @ApiImplicitParam(name = "areaId", value = "当前树节点id", required = true),
@@ -46,18 +44,18 @@ public class ClearingAgreementInfoController {
             @ApiImplicitParam(name = "stageId", value = "结算期id", required = true),
             @ApiImplicitParam(name = "agreementIds", value = "补偿协议id数组,逗号分隔", required = true),
             @ApiImplicitParam(name = "type", value = "协议类型1征地补偿2坟地补偿3专项设施", required = true),
-            @ApiImplicitParam(name = "id", value = "结算id", required = false)
+            @ApiImplicitParam(name = "id", value = "结算id,修改时传入代表修改", required = false)
     })
-    public R<Long> add(ClearingAgreementInfo info) {
+    public R<Long> add(ClearingAgreementInfo info) throws Exception {
         infoService.add(info);
-        return R.success("新增成功");
+        return R.success("保存成功");
     }
 
     /**
      * 分页
      */
     @GetMapping("/page")
-    @ApiOperationSupport(order = 7)
+    @ApiOperationSupport(order = 2)
     @ApiOperation(value = "分页查询结算", notes = "分页查询结算")
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
@@ -72,11 +70,12 @@ public class ClearingAgreementInfoController {
         return R.data(page);
     }
 
+
     /**
      * 查看文件列表
      */
     @GetMapping("/getFileList")
-    @ApiOperationSupport(order = 7)
+    @ApiOperationSupport(order = 4)
     @ApiOperation(value = "查看文件列表", notes = "查看文件列表")
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "id", value = "结算id", required = true),
@@ -86,6 +85,18 @@ public class ClearingAgreementInfoController {
         return R.data(fileList);
     }
 
+    /**
+     * 批量删除
+     */
+    @GetMapping("/remove")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "批量逻辑删除", notes = "传入ids")
+    public R remove(@ApiParam(value = "主键集合", required = true)String ids) {
+        infoService.remove(ids);
+        return R.success("删除成功");
+    }
+
+
     /**
      * 结算统计-面积进度
      */

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

@@ -194,15 +194,17 @@ public class CompensationInfoController extends BladeController {
      */
     @GetMapping("/getAgreementList")
     @ApiOperationSupport(order = 12)
-    @ApiOperation(value = "结算查询补偿协议", notes = "结算查询补偿协议")
+    @ApiOperation(value = "结算获取补偿协议列表", notes = "结算获取补偿协议列表")
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "projectId", value = "项目id", required = true),
             @ApiImplicitParam(name = "areaId", value = "当前树节点id", required = true),
             @ApiImplicitParam(name = "type", value = "协议类型1征地补偿2坟地补偿3专项设施", required = true),
-            @ApiImplicitParam(name = "number", value = "编号搜索值", required = false)
+            @ApiImplicitParam(name = "number", value = "编号搜索值", required = false),
+            @ApiImplicitParam(name = "agreementIds", value = "补偿协议id数组,修改时传入,回显已经选择的", required = false)
+
     })
-    public R<List<CompensationInfo>> getAgreementList(CompensationInfo info)  {
-        List<CompensationInfo> list = compensationInfoService.getAgreementList(info);
+    public R<List<CompensationInfo>> getAgreementList(CompensationInfo info,String agreementIds)  {
+        List<CompensationInfo> list = compensationInfoService.getAgreementList(info,agreementIds);
         return R.data(list);
     }
 

+ 3 - 1
blade-service/blade-land/src/main/java/org/springblade/land/controller/SettlementIntervalController.java

@@ -41,7 +41,8 @@ public class SettlementIntervalController {
     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)));
+                .eq(SettlementInterval::getType,type)
+                .orderByAsc(SettlementInterval::getStartDate)));
     }
 
     /**
@@ -76,4 +77,5 @@ public class SettlementIntervalController {
     }
 
 
+
 }

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

@@ -75,4 +75,6 @@ public interface CompensationInfoMapper extends BaseMapper<CompensationInfo> {
     void delete2(@Param("id") Long agreementId);
 
     List<CompensationInfo> getAllAgreementList(@Param("projectId") Long projectId,@Param("areaId") Long areaId);
+
+    List<CompensationInfo> getQuote(@Param("info") CompensationInfo info,@Param("ids") List<Long> ids);
 }

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

@@ -84,6 +84,15 @@
         where project_id = #{projectId} and is_deleted = 0
           and area_id in (select id from l_region_tree_info where is_deleted = 0 and (id = #{areaId} or ancestors like CONCAT(CONCAT('%', #{areaId}), '%')))
     </select>
+    <select id="getQuote" resultType="org.springblade.land.entity.CompensationInfo">
+        select id,number,name,all_money,is_quote from l_compensation_info
+        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}), '%')))
+          and id in
+        <foreach collection="ids" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </select>
 
 
 </mapper>

+ 3 - 1
blade-service/blade-land/src/main/java/org/springblade/land/service/IClearingAgreementInfoService.java

@@ -39,7 +39,7 @@ import java.util.List;
 public interface IClearingAgreementInfoService extends BaseService<ClearingAgreementInfo> {
 
 
-    void add(ClearingAgreementInfo info);
+    void add(ClearingAgreementInfo info) throws Exception;
 
     IPage<ClearingAgreementInfo> page(Query query, ClearingAgreementInfo info);
 
@@ -50,4 +50,6 @@ public interface IClearingAgreementInfoService extends BaseService<ClearingAgree
     R<List<AreaPictureVO>> statAreaPicture(Long projectId, Long areaId);
 
     R<List<AreaPictureVO>> statMoney(Long projectId, Long areaId);
+
+    void remove(String ids);
 }

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

@@ -70,7 +70,7 @@ public interface ICompensationInfoService extends BaseService<CompensationInfo>
     void remove(List<Long> ids);
 
     //获取没有引用的
-    List<CompensationInfo> getAgreementList(CompensationInfo info);
+    List<CompensationInfo> getAgreementList(CompensationInfo info,String agreementIds);
 
     //获取项目节点下所有的协议
     List<CompensationInfo> getAllAgreementList(Long projectId,Long areaId);

+ 35 - 7
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/ClearingAgreementInfoServiceImpl.java

@@ -45,12 +45,12 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
     private final NewIOSSClient newIOSSClient;
 
     /**
-     * 新增结算协议
+     * 新增或修改结算协议
      * @param info
      */
     @Override
     @Transactional
-    public void add(ClearingAgreementInfo info) {
+    public void add(ClearingAgreementInfo info) throws Exception {
         //修改选择的补偿协议的引用状态
         String agreementIds = info.getAgreementIds();
         if (StringUtils.isBlank(agreementIds)){
@@ -59,7 +59,6 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
         //是新增还是修改
         Boolean isAdd = false;
         List<Long> ids = Func.toLongList(agreementIds);
-        compensationInfoService.batchUpdateStatus(ids,1);
         List<AgreementLinkTable> linkTables = new ArrayList<>();
         if (info.getId() == null) {
             isAdd = true;
@@ -85,7 +84,12 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
             info.setId(agreeId);
         }else {
             linkTables = linkTableService.getByAgreementId(info.getId());
+            //修改则先还原之前补偿协议的状态
+            ClearingAgreementInfo agreementInfo = this.getById(info.getId());
+            compensationInfoService.batchUpdateStatus(Func.toLongList(agreementInfo.getAgreementIds()),0);
         }
+        //批量修改选中的状态
+        compensationInfoService.batchUpdateStatus(ids,1);
         //获取所有选中的补偿协议
         List<CompensationInfo> compensationInfos = compensationInfoService.listByIds(ids);
         //统计补偿协议的统计字段
@@ -121,11 +125,11 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
         //生成补偿资金数量分配表
         //生成面积统计明细表
         //合并PDF
-        try {
+//        try {
             this.mergePdfs(info.getId());
-        }catch (Exception e){
-            throw new ServiceException("合并PDF失败");
-        }
+//        }catch (Exception e){
+//            throw new ServiceException("合并PDF失败");
+//        }
     }
 
     /**
@@ -272,6 +276,30 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
         return R.data(vo);
     }
 
+    /**
+     * 批量删除
+     * @param ids
+     */
+    @Override
+    @Transactional
+    public void remove(String ids) {
+        List<Long> id = Func.toLongList(ids);
+        //先删除表单数据
+        linkTableService.deleteTableData(id);
+        //再删除中间表数据
+        linkTableService.deleteByAgreementIds(id);
+        //释放所有补偿协议的引用
+        List<Long> li = new ArrayList<>();
+        List<ClearingAgreementInfo> list = this.listByIds(id);
+        for (ClearingAgreementInfo info : list) {
+            li.addAll( Func.toLongList(info.getAgreementIds()));
+        }
+        compensationInfoService.batchUpdateStatus(li,0);
+        //最后删除结算协议
+        this.deleteLogic(id);
+
+    }
+
     //合并pdf
     public void mergePdfs(Long agreementId) throws Exception {
         String file_path = FileUtils.getSysLocalFileUrl();

+ 15 - 46
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/CompensationInfoServiceImpl.java

@@ -419,48 +419,6 @@ 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,"复制成功");
-//    }
 
     /**
      * 修改复制表单
@@ -550,8 +508,18 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
      * @return
      */
     @Override
-    public List<CompensationInfo> getAgreementList(CompensationInfo info) {
-        List<CompensationInfo> list = baseMapper.getAgreementList(info);
+    public List<CompensationInfo> getAgreementList(CompensationInfo info,String agreementIds) {
+        List<CompensationInfo> list = new ArrayList<>();
+        if (StringUtils.isNotBlank(agreementIds)){
+            List<Long> ids = Func.toLongList(agreementIds);
+            //获取已经引用的补偿协议,并且要在当前区域中
+            List<CompensationInfo> quote = baseMapper.getQuote(info, ids);
+            list.addAll(quote);
+        }
+        List<CompensationInfo> l = baseMapper.getAgreementList(info);
+        if (l != null && l.size() > 0){
+            list.addAll(l);
+        }
         return list;
     }
 
@@ -940,7 +908,8 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
         ProjectInfo projectInfo = baseMapper.getProjectInfo(linkTable.getProjectId());
 
         int all = 0;
-        for (int i = 0; i < 10; i++) {
+       int num= sheet.getNumMergedRegions()>10?10:sheet.getNumMergedRegions();
+        for (int i = 0; i < num; i++) {
             CellRangeAddress mergedCell = sheet.getMergedRegion(i);
             int xx = mergedCell.getNumberOfCells();
             if (xx >= all) {
@@ -948,7 +917,7 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
             }
         }
 
-        for (int i = 0; i < 10; i++) {
+        for (int i = 0; i < num; i++) {
             CellRangeAddress mergedCell = sheet.getMergedRegion(i);
             int xx = mergedCell.getNumberOfCells() + 2;
             if (xx >= all) {