Эх сурвалжийг харах

疑似闲置去掉认定过的

gushoubang 8 сар өмнө
parent
commit
4062cdb4cd

+ 1 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/tdgy/dto/LandIdleConfirmDTO.java

@@ -23,7 +23,7 @@ public class LandIdleConfirmDTO {
     private Boolean isIdle;
     //  是否处置
     @TableField("is_disposal")
-    private Boolean isDisposal;
+    private Boolean isDisposal=false;
     // 闲置原因
     @TableField("idle_reason")
     private String idleReason;

+ 17 - 8
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/tdgy/TdgyServiceImp.java

@@ -1,6 +1,8 @@
 package com.onemap.apply.service.impl.tdgy;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.onemap.apply.domain.tdgy.dto.LandIdleConfirmDTO;
 import com.onemap.apply.domain.tdgy.dto.LandIdleDisposalDTO;
 import com.onemap.apply.domain.tdgy.vo.IdleLandListVo;
@@ -21,6 +23,7 @@ import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.datasource.annotation.Slave;
 
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.HashMap;
@@ -163,20 +166,26 @@ public class TdgyServiceImp implements TdgyService {
      * @return
      */
     @Override
+    @Transactional
     public RequestResult addIdleLandDisposal(LandIdleDisposalVo landIdleDisposalVo) {
         String landId = landIdleDisposalVo.getLandId();
-        // 查询处置信息是否存在
-        LandIdleDisposalDTO landIdleDisposalDTO = landIdleDisposalMapper.selectById(landId);
-        if (landIdleDisposalDTO != null) {
-            return RequestResult.error("认定信息已存在");
-        }
-        // 添加处置信息
-        landIdleDisposalDTO = new LandIdleDisposalDTO();
-        DozerUtils.map(landIdleDisposalVo, landIdleDisposalDTO);
 
+        // 根据landId删除处置信息
+        Wrapper<LandIdleDisposalDTO> wrapper = new UpdateWrapper<LandIdleDisposalDTO>().eq("land_id", landId);
+        landIdleDisposalMapper.delete(wrapper);
+
+        // 存储处置信息
+        LandIdleDisposalDTO landIdleDisposalDTO = new LandIdleDisposalDTO();
+        DozerUtils.map(landIdleDisposalVo, landIdleDisposalDTO);
         String uuid = IdUtils.simpleUUID();
         landIdleDisposalDTO.setId(uuid);
         landIdleDisposalMapper.insert(landIdleDisposalDTO);
+
+        // 根据landId更新表t_land_idle_confirm的is_disposal字段
+        LandIdleConfirmDTO landIdleConfirmDTO = landIdleConfirmMapper.selectById(landId);
+        landIdleConfirmDTO.setIsDisposal(true);
+        landIdleConfirmMapper.updateById(landIdleConfirmDTO);
+
         return RequestResult.success();
     }
 

+ 1 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/tdgy/TdgyMapper.xml

@@ -9,6 +9,7 @@
         WHERE (ts.sfjg != true OR ts.sfjg IS NULL)
         AND (NOW() > ts.ydkgsj)
         AND ts.sfkg != true
+        AND ts.id::varchar NOT IN (SELECT land_id FROM base.t_land_idle_confirm)
         <if test="key != null and key != ''">
             AND (ts.xmmc LIKE '%' || #{key} || '%' OR ts.srf LIKE '%' || #{key} || '%')
         </if>