Browse Source

国有建设用地使用权首次登记

gushoubang 2 months ago
parent
commit
dcb9cccf13

+ 23 - 18
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/GyjsydscdjController.java

@@ -1,8 +1,11 @@
 package com.siwei.apply.controller;
 
-import com.siwei.apply.domain.Gyjsydscdj;
+import com.siwei.apply.domain.res.GyjsydscdjRes;
+import com.siwei.apply.domain.vo.GyjsydscdjUpdateVo;
+import com.siwei.apply.domain.vo.GyjsydscdjVo;
 import com.siwei.apply.service.GyjsydscdjService;
 import com.siwei.common.core.domain.R;
+import com.siwei.common.core.web.controller.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -16,19 +19,21 @@ import java.util.Map;
  */
 @RestController
 @RequestMapping("/gyjsydscdj")
-public class GyjsydscdjController {
+public class GyjsydscdjController extends BaseController {
     @Autowired
     private GyjsydscdjService gyjsydscdjService;
 
     /**
-     * 添加国有建设用地使用权首次登记记录
-     *
-     * @param gyjsydscdj
+     * 添加国有建设用地使用权首次登记
      */
     @PostMapping()
-    public R<Map> add(@RequestBody Gyjsydscdj gyjsydscdj) {
+    public R<Map> Add(@RequestBody GyjsydscdjVo gyjsydscdjVo) {
         try {
-            String id = gyjsydscdjService.add(gyjsydscdj);
+            Boolean b = gyjsydscdjService.isExit(gyjsydscdjVo.getProjectId());
+            if (b == true) {
+                return R.fail("此项目已添加国有建设用地使用权首次登记");
+            }
+            String id = gyjsydscdjService.add(gyjsydscdjVo);
             Map<String, String> map = new HashMap<>();
             map.put("id", id);
             return R.ok(map);
@@ -38,30 +43,30 @@ public class GyjsydscdjController {
     }
 
     /**
-     * 根据ID获取国有建设用地使用权首次登记记录
+     * 获取国有建设用地使用权首次登记
      *
-     * @param id
-     * @return
+     * @param projectId 项目ID
+     * @return 国有建设用地使用权首次登记
      */
-    @GetMapping()
-    public R<Gyjsydscdj> get(@PathVariable String id) {
+    @GetMapping("/{projectId}")
+    public R<GyjsydscdjRes> Get(@PathVariable String projectId) {
         try {
-            Gyjsydscdj gyjsydscdj = gyjsydscdjService.get(id);
-            return R.ok(gyjsydscdj);
+            return R.ok(gyjsydscdjService.get(projectId));
         } catch (Exception e) {
             return R.fail(e.getMessage());
         }
     }
 
     /**
-     * 更新国有建设用地使用权首次登记记录
+     * 更新国有建设用地使用权首次登记
      *
-     * @param gyjsydscdj
+     * @param gyjsydscdjUpdateVo 国有建设用地使用权首次登记
+     * @return 操作结果
      */
     @PutMapping()
-    public R<Void> update(@RequestBody Gyjsydscdj gyjsydscdj) {
+    public R<Void> Update(@RequestBody GyjsydscdjUpdateVo gyjsydscdjUpdateVo) {
         try {
-            gyjsydscdjService.update(gyjsydscdj);
+            gyjsydscdjService.update(gyjsydscdjUpdateVo);
             return R.ok();
         } catch (Exception e) {
             return R.fail(e.getMessage());

+ 1 - 2
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/Gyjsydscdj.java

@@ -25,8 +25,7 @@ public class Gyjsydscdj {
     private String bdcdyh;         // 不动产单元号
     private String bdczh;          // 不动产证号
     private String djjg;           // 登记结构
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date djDate;           // 登记日期
+    private String djDate;           // 登记日期
     private Map<String, Object> attachment; // 附件
     private String hasOnchain;     // 是否上链
     private String creatorId;      // 创建人ID

+ 13 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/res/GyjsydscdjRes.java

@@ -0,0 +1,13 @@
+package com.siwei.apply.domain.res;
+
+import com.siwei.apply.domain.Gyjsydscdj;
+import lombok.Data;
+
+/**
+ * 国有建设用地使用权首次登记 结果对象
+ */
+@Data
+public class GyjsydscdjRes extends Gyjsydscdj {
+    String projectName;// 项目名称
+    String projectCode;// 项目代码
+}

+ 12 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/GyjsydscdjUpdateVo.java

@@ -0,0 +1,12 @@
+package com.siwei.apply.domain.vo;
+
+import lombok.Data;
+
+/**
+ * 国有建设用地使用权首次登记 更新对象
+ */
+@Data
+public class GyjsydscdjUpdateVo extends GyjsydscdjVo {
+    private String id;
+    private String hasOnchain;    // 是否上链
+}

+ 22 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/GyjsydscdjVo.java

@@ -0,0 +1,22 @@
+package com.siwei.apply.domain.vo;
+
+import lombok.Data;
+
+/**
+ * 国有建设用地使用权首次登记 视图对象
+ */
+@Data
+public class GyjsydscdjVo {
+    private String projectId;      // 项目ID
+    private String qlr;            // 权利人
+    private String gyqk;           // 共有情况
+    private String zl;             // 坐落
+    private String qllx;           // 权利类型
+    private String qlxz;           // 权利性质
+    private String yt;             // 用途
+    private Float area;            // 面积
+    private String bdcdyh;         // 不动产单元号
+    private String bdczh;          // 不动产证号
+    private String djjg;           // 登记结构
+    private String djDate;           // 登记日期
+}

+ 0 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/TdgyVo.java

@@ -17,5 +17,4 @@ public class TdgyVo {
     private String hbcrfapfwh;     // 用地划拨/出让方案批复文号
     private String hbcrhtbh;       // 划拨决定书/出让合同编号
     private String hbcrhtDate;       // 划拨决定书/出让合同日期
-
 }

+ 13 - 14
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GyjsydscdjMapper.java

@@ -1,37 +1,36 @@
 package com.siwei.apply.mapper;
 
 import com.siwei.apply.domain.Gyjsydscdj;
+import com.siwei.apply.domain.vo.GyjsydscdjUpdateVo;
 import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
 
-/**
- * 国有建设用地使用权首次登记 Mapper 接口
- */
+// 国有建设用地使用权首次登记 Mapper 接口
 @Mapper
 public interface GyjsydscdjMapper {
+    /**
+     * 根据项目id查询是否存在
+     */
+    Boolean isExit(String projectId);
 
     /**
-     * 添加国有建设用地使用权首次登记记录
+     * 添加国有建设用地使用权首次登记信息
      *
      * @param gyjsydscdj
-     * @return
      */
     void add(Gyjsydscdj gyjsydscdj);
 
     /**
-     * 根据ID获取国有建设用地使用权首次登记记录
+     * 获取国有建设用地使用权首次登记信息
      *
-     * @param id
+     * @param projectId
      * @return
      */
-
-    Gyjsydscdj get(@Param("id") String id);
-
+    Gyjsydscdj get(String projectId);
 
     /**
-     * 更新国有建设用地使用权首次登记记录
+     * 更新国有建设用地使用权首次登记信息
      *
-     * @param gyjsydscdj
+     * @param gyjsydscdjUpdateVo
      */
-    void update(Gyjsydscdj gyjsydscdj);
+    void update(GyjsydscdjUpdateVo gyjsydscdjUpdateVo);
 }

+ 19 - 11
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/GyjsydscdjService.java

@@ -1,30 +1,38 @@
 package com.siwei.apply.service;
 
-import com.siwei.apply.domain.Gyjsydscdj;
+import com.siwei.apply.domain.res.GyjsydscdjRes;
+import com.siwei.apply.domain.vo.GyjsydscdjUpdateVo;
+import com.siwei.apply.domain.vo.GyjsydscdjVo;
 
 /**
  * 国有建设用地使用权首次登记 服务接口
  */
 public interface GyjsydscdjService {
     /**
-     * 添加国有建设用地使用权首次登记记录
+     * 根据项目projectId查询是否存在
+     */
+    Boolean isExit(String projectId);
+
+    /**
+     * 添加国有建设用地使用权首次登记信息
      *
-     * @param gyjsydscdj 实体
+     * @param gyjsydscdjVo 国有建设用地使用权首次登记视图对象
+     * @return 国有建设用地使用权首次登记ID
      */
-    String add(Gyjsydscdj gyjsydscdj);
+    String add(GyjsydscdjVo gyjsydscdjVo);
 
     /**
-     * 根据ID获取国有建设用地使用权首次登记记录
+     * 获取国有建设用地使用权首次登记信息
      *
-     * @param id 主键
-     * @return 实体
+     * @param projectId 项目ID
+     * @return 国有建设用地使用权首次登记结果对象
      */
-    Gyjsydscdj get(String id);
+    GyjsydscdjRes get(String projectId);
 
     /**
-     * 更新国有建设用地使用权首次登记记录
+     * 更新国有建设用地使用权首次登记信息
      *
-     * @param gyjsydscdj 实体
+     * @param gyjsydscdjUpdateVo 国有建设用地使用权首次登记更新视图对象
      */
-    void update(Gyjsydscdj gyjsydscdj);
+    void update(GyjsydscdjUpdateVo gyjsydscdjUpdateVo);
 }

+ 27 - 6
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/GyjsydscdjImpl.java

@@ -1,8 +1,14 @@
 package com.siwei.apply.service.impl;
 
 import com.siwei.apply.domain.Gyjsydscdj;
+import com.siwei.apply.domain.Project;
+import com.siwei.apply.domain.res.GyjsydscdjRes;
+import com.siwei.apply.domain.vo.GyjsydscdjUpdateVo;
+import com.siwei.apply.domain.vo.GyjsydscdjVo;
 import com.siwei.apply.mapper.GyjsydscdjMapper;
+import com.siwei.apply.mapper.ProjectMapper;
 import com.siwei.apply.service.GyjsydscdjService;
+import com.siwei.common.core.utils.bean.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -13,12 +19,20 @@ import static com.siwei.apply.common.Common.UserId;
  */
 @Service
 public class GyjsydscdjImpl implements GyjsydscdjService {
-
     @Autowired
     private GyjsydscdjMapper gyjsydscdjMapper;
+    @Autowired
+    private ProjectMapper projectMapper;
+
+    @Override
+    public Boolean isExit(String projectId) {
+        return gyjsydscdjMapper.isExit(projectId);
+    }
 
     @Override
-    public String add(Gyjsydscdj gyjsydscdj) {
+    public String add(GyjsydscdjVo gyjsydscdjVo) {
+        Gyjsydscdj gyjsydscdj = new Gyjsydscdj();
+        BeanUtils.copyProperties(gyjsydscdjVo, gyjsydscdj);
         gyjsydscdj.generateId();
         gyjsydscdj.setCreatorId(UserId);
         gyjsydscdjMapper.add(gyjsydscdj);
@@ -26,12 +40,19 @@ public class GyjsydscdjImpl implements GyjsydscdjService {
     }
 
     @Override
-    public Gyjsydscdj get(String id) {
-        return gyjsydscdjMapper.get(id);
+    public GyjsydscdjRes get(String projectId) {
+        Gyjsydscdj gyjsydscdj = gyjsydscdjMapper.get(projectId);
+        Project project = projectMapper.get(projectId);
+
+        GyjsydscdjRes gyjsydscdjRes = new GyjsydscdjRes();
+        BeanUtils.copyProperties(gyjsydscdj, gyjsydscdjRes);
+        gyjsydscdjRes.setProjectName(project.getName());
+        gyjsydscdjRes.setProjectCode(project.getCode());
+        return gyjsydscdjRes;
     }
 
     @Override
-    public void update(Gyjsydscdj gyjsydscdj) {
-        gyjsydscdjMapper.update(gyjsydscdj);
+    public void update(GyjsydscdjUpdateVo gyjsydscdjUpdateVo) {
+        gyjsydscdjMapper.update(gyjsydscdjUpdateVo);
     }
 }

+ 12 - 5
siwei-modules/siwei-apply/src/main/resources/mapper/GyjsydscdjMapper.xml

@@ -24,6 +24,12 @@
         <result property="updatedAt" column="updated_at"/>
     </resultMap>
 
+    <select id="isExit" resultType="Boolean">
+        SELECT COUNT(1) > 0
+        FROM t_gyjsydscdj
+        WHERE project_id = #{projectId}
+    </select>
+
     <insert id="add" parameterType="com.siwei.apply.domain.Gyjsydscdj">
         INSERT INTO t_gyjsydscdj (id, project_id, qlr, gyqk, zl, qllx, qlxz, yt, area, bdcdyh, bdczh, djjg, dj_date,
                                   has_onchain, creator_id, created_at, updated_at)
@@ -32,13 +38,15 @@
                 #{hasOnchain}, #{creatorId}, now(), now())
     </insert>
 
-    <select id="get" resultMap="GyjsydscdjResultMap">
+    <!-- 根据项目ID获取记录 -->
+    <select id="get" resultMap="GyjsydscdjResultMap" parameterType="String">
         SELECT *
         FROM t_gyjsydscdj
-        WHERE id = #{id}
+        WHERE project_id = #{projectId}
     </select>
 
-    <update id="update" parameterType="com.siwei.apply.domain.Gyjsydscdj">
+    <!-- 更新记录 -->
+    <update id="update" parameterType="com.siwei.apply.domain.vo.GyjsydscdjUpdateVo">
         UPDATE t_gyjsydscdj
         <set>
             <if test="projectId != null">project_id = #{projectId},</if>
@@ -54,9 +62,8 @@
             <if test="djjg != null">djjg = #{djjg},</if>
             <if test="djDate != null">dj_date = #{djDate},</if>
             <if test="hasOnchain != null">has_onchain = #{hasOnchain},</if>
-            <if test="creatorId != null">creator_id = #{creatorId},</if>
+            updated_at = now()
         </set>
-        updated_at = now()
         WHERE id = #{id}
     </update>
 </mapper>