chenendian hace 3 semanas
padre
commit
cf05f1f334

+ 76 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/ConvergeController.java

@@ -0,0 +1,76 @@
+package com.siwei.apply.controller.cadastre;
+
+import com.siwei.apply.domain.Converge;
+import com.siwei.apply.domain.vo.ConvergeFilterVo;
+import com.siwei.apply.domain.vo.ConvergeUpdateVo;
+import com.siwei.apply.domain.vo.IdsVo;
+import com.siwei.apply.service.ConvergeService;
+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.*;
+
+import java.util.Map;
+
+/**
+ * 汇交管理控制器
+ */
+@RestController
+@RequestMapping("/converge")
+public class ConvergeController extends BaseController {
+
+    @Autowired
+    private ConvergeService convergeService;
+
+    /**
+     * 新增汇交记录
+     */
+    @PostMapping("/add")
+    public R<Void> add(@RequestBody Converge converge) {
+        try {
+            convergeService.add(converge);
+            return R.ok();
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
+    }
+
+    /**
+     * 获取汇交记录列表
+     */
+    @PostMapping("/list")
+    public R<Map<String, Object>> getList(@RequestBody ConvergeFilterVo filterVo) {
+        try {
+            Map<String, Object> data = convergeService.getList(filterVo);
+            return R.ok(data);
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
+    }
+
+    /**
+     * 更新汇交记录
+     */
+    @PutMapping("/update")
+    public R<Void> update(@RequestBody ConvergeUpdateVo updateVo) {
+        try {
+            convergeService.update(updateVo);
+            return R.ok();
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
+    }
+
+    /**
+     * 批量删除汇交记录
+     */
+    @DeleteMapping("/batchDelete")
+    public R<Void> batchDelete(@RequestBody IdsVo idsVo) {
+        try {
+            convergeService.batchDelete(idsVo.getIds());
+            return R.ok();
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
+    }
+}

+ 44 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/Converge.java

@@ -0,0 +1,44 @@
+package com.siwei.apply.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 汇交对象 t_converge
+ *
+ * @author xiaogu
+ * @date 2026-03-23
+ */
+@Data
+public class Converge extends BaseId {
+    /** 汇交名称 */
+    private String name;
+
+    /** 汇交批次 */
+    private String batchName;
+
+    /** 操作时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date operationTime;
+
+    /** 生成文件路径 */
+    private String filePath;
+
+    /** 状态(0-正在生成,1-生成成功,2-失败) */
+    private String status;
+
+    /** 类型:0-全部,  1-自然资源数据,2-不动产数据 */
+    private String type;
+
+    /** 文件生成信息 */
+    private String readMessage;
+
+    /** 入库时间(秒) */
+    private String fileCostTime;
+
+    /** 生成时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+}

+ 50 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/ConvergeFilterVo.java

@@ -0,0 +1,50 @@
+package com.siwei.apply.domain.vo;
+
+import lombok.Data;
+
+/**
+ * 汇交过滤条件
+ */
+@Data
+public class ConvergeFilterVo {
+    /** 汇交名称 */
+    private String name;
+
+    /** 汇交批次 */
+    private String batchName;
+
+    /** 状态(0-正在生成,1-生成成功,2-失败) */
+    private String status;
+
+    /** 类型:1-自然资源数据,2-不动产数据 */
+    private String type;
+
+    /** 开始时间 (格式:YYYY-MM-DD HH24:MI:SS) */
+    private String beginTime;
+
+    /** 结束时间 (格式:YYYY-MM-DD HH24:MI:SS) */
+    private String endTime;
+
+    // 分页参数
+    private Integer pageNum = 1; // 当前页码
+    private Integer pageSize = 10; // 每页条数
+
+    /**
+     * 计算偏移量(MyBatis 调用 getOffset())
+     */
+    public Integer getOffset() {
+        return (pageNum - 1) * pageSize;
+    }
+
+    /**
+     * 校验分页参数
+     */
+    public void validatePageParams() {
+        if (pageNum == null || pageNum < 1) {
+            pageNum = 1;
+        }
+        if (pageSize == null || pageSize < 1) {
+            pageSize = 10;
+        }
+    }
+}

+ 15 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/ConvergeUpdateVo.java

@@ -0,0 +1,15 @@
+package com.siwei.apply.domain.vo;
+
+import lombok.Data;
+
+@Data
+public class ConvergeUpdateVo {
+    private String id;
+    private String name;
+    private String batchName;
+    private String filePath;
+    private String status;
+    private String type;
+    private String readMessage;
+    private String fileCostTime;
+}

+ 42 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/ConvergeMapper.java

@@ -0,0 +1,42 @@
+package com.siwei.apply.mapper;
+
+import com.siwei.apply.domain.Converge;
+import com.siwei.apply.domain.vo.ConvergeFilterVo;
+import com.siwei.apply.domain.vo.ConvergeUpdateVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface ConvergeMapper {
+    /**
+     * 新增汇交记录
+     */
+    void add(Converge converge);
+
+    /**
+     * 根据ID获取汇交记录
+     */
+    Converge get(String id);
+
+    /**
+     * 获取汇交记录列表
+     */
+    List<Converge> getList(ConvergeFilterVo filterVo);
+
+    /**
+     * 获取汇交记录总数
+     */
+    Integer getCount(ConvergeFilterVo filterVo);
+
+    /**
+     * 更新汇交记录
+     */
+    void update(ConvergeUpdateVo updateVo);
+
+    /**
+     * 批量删除汇交记录
+     */
+    void batchDelete(@Param("ids") List<String> ids);
+}

+ 33 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/ConvergeService.java

@@ -0,0 +1,33 @@
+package com.siwei.apply.service;
+
+import com.siwei.apply.domain.Converge;
+import com.siwei.apply.domain.vo.ConvergeFilterVo;
+import com.siwei.apply.domain.vo.ConvergeUpdateVo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 汇交服务接口
+ */
+public interface ConvergeService {
+    /**
+     * 新增汇交记录
+     */
+    void add(Converge converge);
+
+    /**
+     * 获取汇交记录列表
+     */
+    Map<String, Object> getList(ConvergeFilterVo filterVo);
+
+    /**
+     * 更新汇交记录
+     */
+    void update(ConvergeUpdateVo updateVo);
+
+    /**
+     * 批量删除汇交记录
+     */
+    void batchDelete(List<String> ids);
+}

+ 57 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/ConvergeServiceImpl.java

@@ -0,0 +1,57 @@
+package com.siwei.apply.service.impl;
+
+import com.siwei.apply.domain.Converge;
+import com.siwei.apply.domain.vo.ConvergeFilterVo;
+import com.siwei.apply.domain.vo.ConvergeUpdateVo;
+import com.siwei.apply.mapper.ConvergeMapper;
+import com.siwei.apply.service.ConvergeService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 汇交服务实现
+ */
+@Slf4j
+@Service
+public class ConvergeServiceImpl implements ConvergeService {
+
+    @Autowired
+    private ConvergeMapper convergeMapper;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void add(Converge converge) {
+        converge.generateId();
+        convergeMapper.add(converge);
+    }
+
+    @Override
+    public Map<String, Object> getList(ConvergeFilterVo filterVo) {
+        filterVo.validatePageParams();
+        List<Converge> list = convergeMapper.getList(filterVo);
+        Integer total = convergeMapper.getCount(filterVo);
+
+        Map<String, Object> res = new HashMap<>();
+        res.put("rows", list);
+        res.put("total", total);
+        return res;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void update(ConvergeUpdateVo updateVo) {
+        convergeMapper.update(updateVo);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void batchDelete(List<String> ids) {
+        convergeMapper.batchDelete(ids);
+    }
+}

+ 107 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/ConvergeMapper.xml

@@ -0,0 +1,107 @@
+<?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="com.siwei.apply.mapper.ConvergeMapper">
+    <resultMap id="convergeMap" type="com.siwei.apply.domain.Converge">
+        <id column="id" property="id"/>
+        <result column="name" property="name"/>
+        <result column="batch_name" property="batchName"/>
+        <result column="operation_time" property="operationTime"/>
+        <result column="file_path" property="filePath"/>
+        <result column="status" property="status"/>
+        <result column="type" property="type"/>
+        <result column="read_message" property="readMessage"/>
+        <result column="file_cost_time" property="fileCostTime"/>
+        <result column="create_time" property="createTime"/>
+    </resultMap>
+
+    <insert id="add" parameterType="com.siwei.apply.domain.Converge">
+        INSERT INTO t_converge (
+            id, name, batch_name, operation_time, file_path, status, type, read_message, file_cost_time, create_time
+        ) VALUES (
+            #{id}, #{name}, #{batchName}, now(), #{filePath}, #{status}, #{type}, #{readMessage}, #{fileCostTime}, now()
+        )
+    </insert>
+
+    <select id="get" resultMap="convergeMap">
+        SELECT *
+        FROM t_converge
+        WHERE id = #{id}
+    </select>
+
+    <select id="getList" parameterType="com.siwei.apply.domain.vo.ConvergeFilterVo" resultMap="convergeMap">
+        SELECT *
+        FROM t_converge
+        <where>
+            <if test="name != null and name != ''">
+                AND name LIKE CONCAT('%', #{name}, '%')
+            </if>
+            <if test="batchName != null and batchName != ''">
+                AND batch_name LIKE CONCAT('%', #{batchName}, '%')
+            </if>
+            <if test="status != null and status != ''">
+                AND status = #{status}
+            </if>
+            <if test="type != null and type != ''">
+                AND type = #{type}
+            </if>
+            <if test="beginTime != null and beginTime != ''">
+                AND "operation_time" &gt;= TO_TIMESTAMP(#{beginTime}, 'YYYY-MM-DD HH24:MI:SS')
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND "operation_time" &lt;= TO_TIMESTAMP(#{endTime}, 'YYYY-MM-DD HH24:MI:SS') + INTERVAL '1 day'
+            </if>
+        </where>
+        ORDER BY create_time DESC
+        LIMIT #{pageSize} OFFSET #{offset}
+    </select>
+
+    <select id="getCount" parameterType="com.siwei.apply.domain.vo.ConvergeFilterVo" resultType="int">
+        SELECT COUNT(*)
+        FROM t_converge
+        <where>
+            <if test="name != null and name != ''">
+                AND name LIKE CONCAT('%', #{name}, '%')
+            </if>
+            <if test="batchName != null and batchName != ''">
+                AND batch_name LIKE CONCAT('%', #{batchName}, '%')
+            </if>
+            <if test="status != null and status != ''">
+                AND status = #{status}
+            </if>
+            <if test="type != null and type != ''">
+                AND type = #{type}
+            </if>
+            <if test="beginTime != null and beginTime != ''">
+                AND "operation_time" &gt;= TO_TIMESTAMP(#{beginTime}, 'YYYY-MM-DD HH24:MI:SS')
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND "operation_time" &lt;= TO_TIMESTAMP(#{endTime}, 'YYYY-MM-DD HH24:MI:SS') + INTERVAL '1 day'
+            </if>
+        </where>
+    </select>
+
+    <update id="update" parameterType="com.siwei.apply.domain.vo.ConvergeUpdateVo">
+        UPDATE t_converge
+        <set>
+            <if test="name != null">name = #{name},</if>
+            <if test="batchName != null">batch_name = #{batchName},</if>
+            <if test="filePath != null">file_path = #{filePath},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="readMessage != null">read_message = #{readMessage},</if>
+            <if test="fileCostTime != null">file_cost_time = #{fileCostTime},</if>
+            operation_time = now()
+        </set>
+        WHERE id = #{id}
+    </update>
+
+    <delete id="batchDelete">
+        DELETE FROM t_converge
+        WHERE id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>